This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: php | |
php: | |
- 5.5 | |
- 5.6 | |
- 7.0 | |
- hhvm | |
matrix: | |
allow_failures: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function boot() | |
{ | |
// Add RainLab.Blog articles to sitemap | |
Event::listen('pages.menuitem.listTypes', function() { | |
return [ | |
'blog-post' => 'Blog post', | |
'all-blog-posts' => 'All blog posts' | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function boot() | |
{ | |
// Extend all backend form usage | |
Event::listen('backend.form.extendFields', function($widget) { | |
// Only for the Posts controller | |
if (!$widget->getController() instanceof \RainLab\Blog\Controllers\Posts) | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
public function boot() | |
{ | |
// Event Listeners for RainLab Blog | |
Event::listen('eloquent.created: RainLab\Blog\Models\Post', function($model) { | |
// ... do something | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "rainlab/googleanalytics", | |
"type": "october-plugin", | |
"description": "Google Analytics integration plugin for OctoberCMS", | |
"homepage": "http://octobercms.com", | |
"keywords": ["october", "cms", "rainlab", "google", "analytics"], | |
"authors": [ | |
{ | |
"name": "Alexey Bobkov", | |
"email": "[email protected]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use System\Classes\PluginManager; | |
protected function isPluginActive($pluginName) | |
{ | |
$pluginManager = PluginManager::instance(); | |
return array_key_exists($pluginName, $pluginManager->getPlugins()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
public function boot() | |
{ | |
UserModel::extend(function($model) { | |
$model->addFillable([ | |
'phone', | |
'mobile', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# examle taken from https://github.com/krisawzm/demomanager-plugin | |
language: php | |
php: | |
- 5.4 | |
- 5.5 | |
- 5.6 | |
- 7.0 | |
- hhvm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$email = '[email protected]'; | |
$template = 'my.plugin::mail.recordform'; | |
$templateParameters = ['site' => 'mysite.cz']; | |
$attachments = []; | |
foreach($record->images as $image) { | |
$attachments[] = $image; | |
} | |
Mail::send($template, $templateParameters, function($message) use ($email, $attachments) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INIT: session key as transfer unique identifier | |
$sessionKey = 'abcdefghijklmnopqrstuvwxyz'; | |
// PART ONE: receiving files | |
// receive first file | |
$file = new System\Models\File(); | |
$file->fromFile(base_path() . '/storage/app/media/users/12905.jpg'); | |
$file->save(); |