本文整理汇总了PHP中Plugin::addController方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::addController方法的具体用法?PHP Plugin::addController怎么用?PHP Plugin::addController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::addController方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Init
/**
* Registers the plugin and controller in the system as well as the observers.
*/
public static function Init()
{
// Register plugin
Plugin::setInfos(array('id' => self::PLUGIN_ID, 'title' => __('Page Part Forms'), 'description' => __('Allows to create custom page part forms'), 'version' => self::PLUGIN_VERSION, 'license' => 'AGPL', 'author' => 'THE M', 'website' => 'http://github.com/them/frog_page_part_forms/', 'update_url' => 'http://github.com/them/frog_page_part_forms/raw/master/frog-plugins.xml', 'require_frog_version' => '0.9.5'));
// Register controller
Plugin::addController(self::PLUGIN_ID, __('Page Part Forms'), 'administrator, developer', true);
// Add extra scripting for JSON
Plugin::addJavascript(self::PLUGIN_ID, "labs_json.js");
// The callbacks for the backend
Observer::observe('view_page_page_metadata', __CLASS__ . '::callback_view_page_page_metadata');
Observer::observe('view_page_edit_popup', __CLASS__ . '::callback_view_page');
}
示例2: __
/*
| pawFramework
| @file ./index.php
| @author svanlaere
| @version 1.0.0 [1.0.0] - Stable
|
| @license X11 / MIT License
| @copyright Copyright © 2015 pytesNET
*/
if (!defined("IN_CMS")) {
exit;
}
// SET PLUGIN INFOS
Plugin::setInfos(array("id" => "themer", "title" => "Themer", "description" => __("A WordPress AdminTheme configuration plugin."), "version" => "1.0.0", "license" => "GPL", "author" => "svanlaere", "website" => "http://www.wolfcms.org/forum/", "require_wolf_version" => "0.7.5", "type" => "backend"));
Plugin::addController("themer", __("Wordpress admin theme"), "admin_view", false);
if (Plugin::isEnabled("themer")) {
if (!defined("THEMER")) {
define("THEMER", PLUGINS_ROOT . "/themer");
}
if (!defined("THEMER_VIEW")) {
define("THEMER_VIEW", "themer/views/");
}
function themer_customize_admin_theme($path)
{
$admin_theme = Setting::get("theme");
$settings = Plugin::getAllSettings("themer");
if ($admin_theme == "wordpress-3.8") {
echo new View(THEMER . DS . "views" . DS . "head", array("color" => $settings["color"], "sidebar_width" => $settings["sidebar_width"]));
}
return $path;
示例3: __
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
/**
* The skeleton plugin serves as a basic plugin template.
*
* This skeleton plugin makes use/provides the following features:
* - A controller without a tab
* - Three views (sidebar, documentation and settings)
* - A documentation page
* - A sidebar
* - A settings page (that does nothing except display some text)
* - Code that gets run when the plugin is enabled (enable.php)
*
* Note: to use the settings and documentation pages, you will first need to enable
* the plugin!
*
* @package Plugins
* @subpackage skeleton
*
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @copyright Martijn van der Kleijn, 2008
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
Plugin::setInfos(array('id' => 'skeleton', 'title' => __('Skeleton'), 'description' => __('Provides a basic plugin implementation. (try enabling it!)'), 'version' => '1.1.0', 'license' => 'GPL', 'author' => 'Martijn van der Kleijn', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml', 'require_wolf_version' => '0.5.5'));
Plugin::addController('skeleton', __('Skeleton'), 'admin_view', false);
示例4: define
* Copyright (C) 2009-2011 Martijn van der Kleijn <martijn.niji@gmail.com>
*
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
/**
* The BackupRestore plugin provides administrators with the option of backing
* up their pages and settings to an XML file.
*
* @package Plugins
* @subpackage backup_restore
*
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @copyright Martijn van der Kleijn, 2009-2011
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
if (!defined('BR_VERSION')) {
define('BR_VERSION', '0.7.3');
}
/**
*
* Root location where Comment plugin lives.
*/
define('BACKUPRESTORE_ROOT', URI_PUBLIC . 'wolf/plugins/backup_restore');
Plugin::setInfos(array('id' => 'backup_restore', 'title' => __('Backup Restore'), 'description' => __('Provides administrators with the option of backing up their pages and settings to an XML file.'), 'version' => BR_VERSION, 'license' => 'GPLv3', 'author' => 'Martijn van der Kleijn', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml', 'require_wolf_version' => '0.6.0'));
Plugin::addController('backup_restore', __('Backup Restore'), 'administrator', true);
示例5: define
* @package Plugins
* @subpackage shopping-cart
*
* @author Stefan Miller <linuxsmiller@gmail.com>
* Copyright (C) 2014 Stefan Miller <linuxsmiller@gmail.com>
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
/**
* Root location where Files plugin lives.
*/
define('SC_FILES_ROOT', PATH_PUBLIC . 'wolf/plugins/shopping_cart');
/**
* Root location where files get uploaded to as an absolute path.
*/
define('SC_FILES_DIR', CMS_ROOT . DS . 'public');
/**
* Root location where files get uploaded to as a URL.
*/
define('BASE_SC_FILES_DIR', URL_PUBLIC . 'public');
// DO NOT EDIT AFTER THIS LINE -----------------------------------------------
Plugin::setInfos(array('id' => 'shopping_cart', 'title' => 'Shopping Cart', 'description' => 'A shopping cart inventory administration module', 'version' => '0.0.1', 'author' => 'Stefan Miller', 'website' => 'http://www.artisticdigital.com', 'require_wolf_version' => '0.7.0'));
Plugin::addController('shopping_cart', __('Shopping Cart'), 'admin_view', true);
// Make sure possible hack attempts get registered if the statistics API is available.
if (Plugin::isEnabled('statistics_api')) {
Observer::observe('stats_shopping_cart_hack_attempt', 'StatisticsEvent::registerEvent');
}
示例6: image_resize_try_resizing
<?php
require_once "ImageResize.php";
Plugin::setInfos(array('id' => 'image_resize', 'title' => 'Image Resize', 'description' => 'Allows for dynamic resizing of images.', 'version' => '1.3.1', 'license' => 'GPL 3.0', 'author' => 'Peter Gassner', 'website' => 'http://www.naehrstoff.ch/code/image-resize-for-frog', 'update_url' => 'http://frog.naehrstoff.ch/plugin-versions.xml', 'require_frog_version' => '0.9.4'));
// Listen for page_not_found messages
Observer::observe('page_not_found', 'image_resize_try_resizing');
// Add the controller without showing a tab (fourth option)
Plugin::addController('image_resize', 'Image Resize', '', FALSE);
/**
* Execute this function on page_not_found.
* If the request is for an image file,
* resize the image.
*/
function image_resize_try_resizing()
{
// Require that visitor be logged in and has
// permission to create files
if (!AuthUser::isLoggedIn()) {
AuthUser::load();
}
if (!AuthUser::hasPermission('administrator,developer,editor')) {
return false;
}
// Check that gd library is available
if (!ImageResize::gd_available()) {
return false;
}
if (preg_match('#\\.(jpe?g|gif|png|wbmp)$#i', CURRENT_URI)) {
// If requested file appears to be an accepted format, create the new image
if (image_resize_scale(CURRENT_URI) && !DEBUG) {
// If Frog isn't debugging, it writes to a file; redirect to it
示例7: __
*
* Copyright (C) 2012 Martijn van der Kleijn <martijn.niji@gmail.com>
* Copyright (c) 2008-2009 Mika Tuupola
*
* This file is part of the Funky Cache plugin for Wolf CMS. It is licensed
* under the MIT license.
*
* For details, see: http://www.opensource.org/licenses/mit-license.php
*/
//require_once 'models/FunkyCachePage.php';
Plugin::setInfos(array('id' => 'funky_cache', 'title' => 'Funky Cache', 'description' => 'Enables funky caching, making your site ultra fast.', 'version' => '0.4.1', 'license' => 'MIT', 'author' => 'Mika Tuupola & Martijn van der Kleijn', 'require_wolf_version' => '0.7.5+', 'website' => 'http://vanderkleijn.net/'));
AutoLoader::addFolder(PLUGINS_ROOT . '/funky_cache/models');
/* Stuff for backend. */
if (defined('CMS_BACKEND')) {
AutoLoader::addFolder(dirname(__FILE__) . '/lib');
Plugin::addController('funky_cache', __('Cache'), "admin_view", true);
#Observer::observe('page_edit_after_save', 'funky_cache_delete_one');
Observer::observe('page_edit_after_save', 'funky_cache_delete_all');
Observer::observe('page_add_after_save', 'funky_cache_delete_all');
Observer::observe('page_delete', 'funky_cache_delete_all');
Observer::observe('view_page_edit_plugins', 'funky_cache_show_select');
Observer::observe('comment_after_add', 'funky_cache_delete_all');
Observer::observe('comment_after_edit', 'funky_cache_delete_all');
Observer::observe('comment_after_delete', 'funky_cache_delete_all');
Observer::observe('comment_after_approve', 'funky_cache_delete_all');
Observer::observe('comment_after_unapprove', 'funky_cache_delete_all');
Observer::observe('layout_after_edit', 'funky_cache_delete_all');
Observer::observe('snippet_after_edit', 'funky_cache_delete_all');
/* TODO Fix this to work with configurable cache folder. */
function funky_cache_delete_one($page)
{
示例8: __
<?php
$plugin_id = "page_versions";
$controller_name = 'PageVersionsController';
Plugin::setInfos(array('id' => $plugin_id, 'title' => 'Page Versions', 'description' => 'Stores all the previous versions of a page', 'version' => '0.1', 'author' => 'Jules Piccotti', 'website' => 'http://fresh.jules.it/page_versions'));
Plugin::addController($plugin_id, __('Page Versions'), null, false);
Plugin::addJavascript($plugin_id, "page_versions.js");
Behavior::add('version', 'page_versions/page_versions.php');
Behavior::add('current_version', 'page_versions/page_versions.php');
Observer::observe('page_add_after_save', $controller_name . '::callback_page_updated');
Observer::observe('page_edit_after_save', $controller_name . '::callback_page_updated');
Observer::observe('page_before_execute_find', $controller_name . '::callback_filter_out_versions');
//Observer::observe('pages_tree_item_found', $controller_name.'::callback_tree_item_found');
示例9: add_user_key
<?php
if (!defined('IN_CMS')) {
exit;
}
Plugin::setInfos(array('id' => 'adduserdata', 'title' => 'Add user data', 'description' => 'Add data to the user table', 'version' => '0.1.0', 'license' => 'MIT', 'author' => 'svanlaere', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml', 'require_wolf_version' => '0.7.6'));
AutoLoader::addFile('Kint', PLUGINS_ROOT . DS . 'adduserdata/kint/kint.class.php');
Plugin::addController('adduserdata', 'User data', 'admin_view', true);
Observer::observe('user_after_add', 'add_user_key');
function add_user_key($user_name, $user_id)
{
// some random string
$random = sha1(microtime() . rand());
// insert random string into user_key colomn
Record::update('User', array('user_key' => $random), 'id = :user_id', array(':user_id' => (int) $user_id));
}
示例10: __
<?php
/*
* Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
* Copyright (C) 2009-2010 Martijn van der Kleijn <martijn.niji@gmail.com>
*
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/**
* The Markdown plugin allows users edit pages using the markdown syntax.
*
* @package Plugins
* @subpackage markdown
*
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @copyright Martijn van der Kleijn, 2010
* @author Philippe Archambault <philippe.archambault@gmail.com>
* @copyright Philippe Archambault, 2008
* @license http://www.gnu.org/licenses/gpl.html GPLv3 License
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
Plugin::setInfos(array('id' => 'markdown', 'title' => __('Markdown filter'), 'description' => __('Allows you to use the Markdown text filter (with MarkdownExtra and Smartypants).'), 'version' => '2.0.2', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml'));
Filter::add('markdown', 'markdown/filter_markdown.php');
Plugin::addController('markdown', null, 'admin_view', false);
Plugin::addJavascript('markdown', 'markdown.php');
示例11: define
<?php
// place where we will upload project files (absolute path)
define('FILES_DIR', FROG_ROOT . '/public');
// place where we will upload project files (html url)
define('BASE_FILES_DIR', URL_PUBLIC . 'public');
// DO NOT EDIT AFTER THIS LINE -----------------------------------------------
Plugin::setInfos(array('id' => 'file_manager', 'title' => 'Files Manager', 'description' => 'Provides interface to manage file from the administration.', 'version' => '1.0', 'website' => 'http://www.madebyfrog.com/'));
Plugin::addController('file_manager', 'Files');
示例12: __
* - URI based language hint (for example: http://www.example.com/en/page.html
* - Preferred language setting of logged in users
*
* @package plugins
* @subpackage multi_lang
*
* @author Jules Piccotti <julpi@jules.it>
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @version 1.0.0
* @since Fresh CMS version 0.7.0
* @license http://www.gnu.org/licenses/gpl.html GPL License
* @copyright Martijn van der Kleijn, 2010
*/
$urilang = false;
Plugin::setInfos(array('id' => 'multi_lang', 'title' => __('Multiple Languages'), 'description' => __('Provides language specific content when available based on user preferences.'), 'version' => '1.0.0', 'license' => 'GPL', 'author' => 'Martijn van der Kleijn', 'website' => 'http://freshcms.jules.it/', 'update_url' => 'http://freshcms.jules.it/plugin-versions.xml', 'require_cms_version' => '0.6.0'));
Plugin::addController('multi_lang', __('Multiple Languages'), 'administrator', false);
// Observe the necessary events.
$style = Plugin::getSetting('style', 'multi_lang');
$source = Plugin::getSetting('langsource', 'multi_lang');
if (false !== $style && $style == 'tab') {
if ($source == 'uri') {
Observer::observe('page_requested', 'replaceUri');
Observer::observe('page_found', 'replaceContentByUri');
} else {
Observer::observe('page_found', 'replaceContent');
}
} else {
if (false !== $style && $style == 'page') {
if ($source == 'header' || $source == 'preferences') {
Observer::observe('page_found', 'replaceContent');
}
示例13: define
* any later version.
*
* FrogTags Plugin is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* FrogTags Plugin. If not, see <http://www.gnu.org/licenses/>.
*
* FrogTags Plugin was designed for Frog CMS at version 0.9.5.
*/
if (!defined('FrogTagsPluginIncluded')) {
define('FrogTagsPluginIncluded', true);
Plugin::setInfos(array('id' => 'frog_tags', 'title' => 'Frog Tags', 'description' => 'Allows defining and using of HTML-like tags - called Frog tags.', 'version' => '0.0.1', 'author' => 'Bastian Harendt', 'website' => 'http://github.com/harendt/frog_tags/', 'update_url' => 'http://github.com/harendt/frog_tags/raw/master/version.xml'));
Plugin::addController('frog_tags', 'Frog Tags', '', false);
// default setting (could be changed in FROG_ROOT/config.php)
if (!defined('ALLOW_PHP')) {
define('ALLOW_PHP', false);
}
include_once 'app/FrogTagsParser.php';
include_once 'app/StandardTags.php';
include_once 'app/FrogTagsHacks.php';
function frog_tags_main($page)
{
$content = FrogTagsHacks::get_page_layout($page);
$parser = new FrogTagsParser($page);
$content = $parser->parse($content);
echo $content;
}
}
示例14: __
<?php
/*
* Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
* Copyright (C) 2009-2010 Martijn van der Kleijn <martijn.niji@gmail.com>
* Copyright (C) 2008 Philippe Archambault <philippe.archambault@gmail.com>
*
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
/**
* The Archive plugin provides an Archive pagetype behaving similar to a blog or news archive.
*
* @package Plugins
* @subpackage archive
*
* @author Philippe Archambault <philippe.archambault@gmail.com>
* @copyright Philippe Archambault, 2008
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
Plugin::setInfos(array('id' => 'archive', 'title' => __('Archive'), 'description' => __('Provides an Archive pagetype behaving similar to a blog or news archive.'), 'version' => '1.1.0', 'website' => 'http://www.wolfcms.org/', 'update_url' => 'http://www.wolfcms.org/plugin-versions.xml'));
// Add the plugin's tab and controller
Plugin::addController('archive', '', 'admin_view', false);
Behavior::add('archive', 'archive/archive.php');
Behavior::add('archive_day_index', 'archive/archive.php');
Behavior::add('archive_month_index', 'archive/archive.php');
Behavior::add('archive_year_index', 'archive/archive.php');
示例15: ru_login_page
<?php
// Written by Andrew Waters - andrew@band-x.org
// Please leave credit
/*
* Contains the following functions for the Front End :
*
* ru_register_page() Use this on the page you want to have for registrations eg mysite.com/register
* ru_login_page() Use this on the page you want to have for logging in eg mysite.com/login
* ru_confirm_page() This is the page a user clicks through to validate their account
* ru_auth_required_page() Users who are not authorised to view the requested page will be redirected here
* ru_reset_page() Will allow a user to have an email sent to them with a lnk to reset their password
* ru_logout() A page to logout a user and return them to the hompage
*/
Plugin::setInfos(array('id' => 'registered_users', 'title' => 'Registered Users', 'description' => 'Allows you to manage new user registrations on your site.', 'version' => '0.9.8', 'require_cms_version' => '0.9.5'));
Plugin::addController('registered_users', 'Registered Users', 'administrator');
Observer::observe('view_page_edit_plugins', 'registered_users_access_page_checkbox');
Observer::observe('page_add_after_save', 'registered_users_add_page_permissions');
Observer::observe('page_edit_after_save', 'registered_users_edit_page_permissions');
Observer::observe('page_delete', 'registered_users_delete_page_permissions');
Observer::observe('page_found', 'registered_users_page_found');
Behavior::add('login_page', '');
include 'classes/RegisteredUsers.php';
include 'classes/RUCommon.php';
include 'observers/RUObservers.php';
function ru_login_page()
{
$registered_users_class = new RegisteredUsers();
$loginpage = $registered_users_class->login_page();
echo $loginpage;
}