public function toggle($slug) { $pl = Plugin::factory()->get_by_slug($slug); if ($pl->exists()) { $pl->active = !$pl->active; $pl->save(); } redirect('administration/plugins'); }
<?php defined('SYSPATH') or die('No direct access allowed.'); Plugin::factory('page_not_found', array('title' => 'Page not found', 'description' => 'Provides Page not found type.', 'author' => 'ButscH'))->register(); Observer::observe('page_not_found', function ($message, $params) { throw new HTTP_Exception_Front_404($message, $params); });
<?php defined('SYSPATH') or die('No direct script access.'); $plugin = Plugin::factory('skeleton_dashboard_widget', array('title' => 'Skeleton Dashboard Widget', 'version' => '1.0.0', 'description' => 'Заготовка для создания плагина виджета для рабочего стола.', 'author' => 'KodiCMS', 'required_cms_version' => '100.0.0'))->register();
protected function db() { if (empty($this->_orm)) { $this->_orm = Plugin::factory()->get_by_slug($this->get_info('slug')); } return $this->_orm; }
<?php defined('SYSPATH') or die('No direct script access.'); Plugin::factory('archive', array('title' => 'Archive', 'description' => 'Provides an Archive pagetype behaving similar to a blog or news archive.', 'author' => 'ButscH'))->register();
<?php defined('SYSPATH') or die('No direct access allowed.'); Plugin::factory('page_fields', array('title' => 'Page fields', 'author' => 'ButscH'))->register();
<?php defined('SYSPATH') or die('No direct access allowed.'); define('PLUGIN_HYBRID_PATH', PLUGPATH . 'hybrid' . DIRECTORY_SEPARATOR); define('PLUGIN_HYBRID_URL', PLUGINS_URL . 'hybrid/media/'); Plugin::factory('hybrid', array('title' => 'Hybrid Datasource', 'author' => 'ButscH'))->register();
<?php defined('SYSPATH') or die('No direct script access.'); Plugin::factory('test', array('title' => __('Test Site'), 'version' => '1.0.0', 'description' => 'DO NOT INSTALL TO PRODUCTION SERVER', 'author' => 'ButscH'))->register();
<?php defined('SYSPATH') or die('No direct access allowed.'); Plugin::factory('maintenance', array('title' => 'Maintenance mode', 'author' => 'ButscH'))->register();
<?php // get settings $settings = Kohana::$config->load('template'); // create plugin $plugin = Plugin::factory('template', $settings); // set text $plugin->text(Text::factory('Plugin_Template')); // listen to hooks foreach ($settings as $controller => $settings) { Event::listen($controller, Event::BEFORE_LIST, array($plugin, 'handle')); }
<?php defined('SYSPATH') or die('No direct script access.'); define('PLUGIN_SKELETON_PATH', PLUGPATH . 'skeleton' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR); define('PLUGIN_SKELETON_URL', PLUGINS_URL . 'skeleton/public/'); // Этот файл подключается всегда после активации плагина и на странице списка плагинов // даже если плагин не активирован $plugin = Plugin::factory('skeleton', array('title' => 'Skeleton', 'version' => '1.0.0', 'description' => 'Заготовка для создания плагина. Не советуется активировать', 'author' => 'KodiCMS', 'required_cms_version' => '100.0.0'))->register(); // if($plugin->is_activated()) // { // ... // } Assets_Package::add('skeleton'); /** * Создание media пакета, для быстрого подключения через виджет * или через класс Meta * * Assets_Package::add('skeleton') * ->css(NULL, PLUGINS_URL . 'skeleton/media/css/skeleton.css') * ->js(NULL, PLUGINS_URL . 'skeleton/media/js/skeleton.js', 'jquery'); * * ИЛИ * Assets_Package::add('skeleton') * ->css(NULL, ADMIN_RESOURCES . 'css/skeleton.css') * ->js(NULL, ADMIN_RESOURCES . 'js/skeleton.js', 'jquery'); * * ИЛИ дополнить существующий * * Assets_Package::load('jquery') * ->js(....); *
<?php defined('SYSPATH') or die('No direct script access.'); Plugin::factory('redactor', array('title' => 'Redactor', 'description' => 'Create word-processed text on the web using a reliable, fast and unbelievably beautiful editor.', 'author' => 'ButscH'))->register(); Observer::observe('modules::after_load', function () { Assets_Package::add('redactor')->js('redactor.' . I18n::lang(), ADMIN_RESOURCES . 'vendors/redactor/' . I18n::lang() . '.js', 'jquery')->js('redactor.min', ADMIN_RESOURCES . 'vendors/redactor/redactor.min.js', 'jquery')->js('redactor', ADMIN_RESOURCES . 'js/redactor.js', 'global')->css('redator', ADMIN_RESOURCES . 'vendors/redactor/redactor.css'); });
<?php defined('SYSPATH') or die('No direct script access.'); Plugin::factory('userguide', array('title' => __('User Guide'), 'version' => '1.0.0', 'author' => 'ButscH'))->register(); // Static file serving (CSS, JS, images) Route::set('docs/media', ADMIN_DIR_NAME . '/guide/media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'userguide', 'action' => 'media', 'file' => NULL)); // API Browser, if enabled if (Kohana::$config->load('userguide.api_browser') === TRUE) { Route::set('docs/api', ADMIN_DIR_NAME . '/guide/api(/<class>)', array('class' => '[a-zA-Z0-9_]+'))->defaults(array('controller' => 'userguide', 'action' => 'api', 'class' => NULL)); } // User guide pages, in modules Route::set('docs/guide', ADMIN_DIR_NAME . '/guide/doc(/<module>(/<page>))', array('page' => '.+'))->defaults(array('controller' => 'userguide', 'action' => 'docs', 'module' => '')); // Simple autoloader used to encourage PHPUnit to behave itself. class Markdown_Autoloader { public static function autoload($class) { if ($class == 'Markdown_Parser' or $class == 'MarkdownExtra_Parser') { include_once Kohana::find_file('vendor', 'markdown/markdown'); } } } // Register the autoloader spl_autoload_register(array('Markdown_Autoloader', 'autoload'));
<?php defined('SYSPATH') or die('No direct access allowed.'); Plugin::factory('messages', array('title' => 'User messages', 'description' => 'Provides user messages system.', 'author' => 'ButscH'))->register();
images/icons/dark/docs.png" alt="" class="titleIcon" /><h6>Plugins</h6></div> <table class="sTable" cellpadding="0" cellspacing="0" width="100%"> <thead> <tr> <td>Name</td> <td>Active</td> <td>Author</td> <td>Description</td> <td>Actions</td> </tr> </thead> <tbody> <?php foreach ($fs_plugins as $slug) { $plugin = Plugin::factory()->get_by_slug($slug); ?> <tr> <td><?php echo anchor($plugin->url, $plugin->name . ' ' . $plugin->version, 'target="_blank"'); ?> </td> <td><?php echo $plugin->active ? '<strong>yes</strong>' : 'no'; ?> </td> <td><?php echo anchor($plugin->author_url, $plugin->author, 'target="_blank"'); ?> </td> <td><?php
<?php defined('SYSPATH') or die('No direct script access.'); Plugin::factory('disqus', array('title' => 'Disqus', 'description' => 'Disqus is a global comment system that improves discussion on websites and connects conversations across the web.', 'version' => '1.0.0', 'author' => 'ButscH'))->register();
<?php defined('SYSPATH') or die('No direct access allowed.'); Plugin::factory('part_revision', array('title' => 'Revision of parts', 'author' => 'ButscH'))->register();