本文整理汇总了PHP中Plugins::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::load方法的具体用法?PHP Plugins::load怎么用?PHP Plugins::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::load方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cpanel_menu
public static function cpanel_menu($zoneName)
{
$menu = Plugins::load($zoneName);
// print_r($menu);die();
$folderName = Plugins::$renderFolderName;
$li = '';
if (isset($menu[0]['title'])) {
$total = count($menu);
for ($i = 0; $i < $total; $i++) {
if (!isset($menu[$i]['child'])) {
if (isset($menu[$i]['func'])) {
$url = isset($menu[$i]['link']) ? $menu[$i]['link'] : ADMINCP_URL . 'plugins/run/' . base64_encode($folderName . ':' . $menu[$i]['func']);
} else {
$url = isset($menu[$i]['link']) ? $menu[$i]['link'] : ADMINCP_URL . 'plugins/controller/' . $folderName . '/' . $menu[$i]['controller'];
}
$li .= '
<li>
<a href="' . $url . '"><span class="glyphicon glyphicon-list-alt"></span> ' . $menu[$i]['title'] . '</a>
</li>
';
} else {
$start = '<li class="li-' . $folderName . '"><a href="javascript:;" data-toggle="collapse" data-target="#' . md5($menu[$i]['title'] . $i) . '"><span class="glyphicon glyphicon-list-alt"></span> ' . $menu[$i]['title'] . ' <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="' . md5($menu[$i]['title'] . $i) . '" class="collapse">';
$end = '</ul></li>';
$totalChild = count($menu[$i]['child']);
$liChild = '';
for ($j = 0; $j < $totalChild; $j++) {
if (isset($menu[$i]['child'][$j]['func'])) {
$url = isset($menu[$i]['child'][$j]['link']) ? $menu[$i]['child'][$j]['link'] : ADMINCP_URL . 'plugins/run/' . base64_encode($folderName . ':' . $menu[$i]['child'][$j]['func']);
} else {
$url = isset($menu[$i]['child'][$j]['link']) ? $menu[$i]['child'][$j]['link'] : ADMINCP_URL . 'plugins/controller/' . $folderName . '/' . $menu[$i]['child'][$j]['controller'];
}
$liChild .= '
<li><a href="' . $url . '">' . $menu[$i]['child'][$j]['title'] . '</a></li>
';
}
$li .= $start . $liChild . $end;
}
}
echo $li;
}
}
示例2: index
public function index()
{
$controlName = 'admincp/controlDashboard';
if (Cookie::has('userid')) {
$valid = UserGroups::getPermission(Users::getCookieGroupId(), 'can_view_admincp');
if ($valid != 'yes') {
Alert::make('You not have permission to view this page');
}
$controlName = 'admincp/controlDashboard';
$default_adminpage_method = trim(System::getSetting('default_adminpage_method', 'none'));
if ($default_adminpage_method == 'url') {
$default_adminpage = trim(System::getSetting('default_adminpage_url', 'admincp/'));
if ($default_adminpage != 'admincp/' && System::getUri() == 'admincp/') {
$beginUri = 'admincp';
if ($default_adminpage[0] != '/') {
$beginUri .= '/';
}
System::setUri($beginUri . $default_adminpage);
}
}
if ($match = Uri::match('^admincp\\/(\\w+)')) {
$controlName = 'admincp/control' . ucfirst($match[1]);
}
} else {
$controlName = 'admincp/controlLogin';
if ($match = Uri::match('^admincp\\/forgotpass')) {
$controlName = 'admincp/controlForgotpass';
}
}
$codeHead = Plugins::load('admincp_header');
$codeHead = is_array($codeHead) ? '' : $codeHead;
$codeFooter = Plugins::load('admincp_footer');
$codeFooter = is_array($codeFooter) ? '' : $codeFooter;
// print_r($codeHead);die();
System::defineGlobalVar('admincp_header', $codeHead);
System::defineGlobalVar('admincp_footer', $codeFooter);
Controller::load($controlName);
}
示例3: header
// Send the Content-Type HTTP header.
// @todo Find a better place to put this.
header('Content-Type: text/html;charset=utf-8');
/**
* Include all the active plugins.
* By loading them here they'll have global scope.
*
* We loop through them twice so we can cache all plugin classes on the first load() call.
* This gives about 60% improvement.
*/
foreach (Plugins::list_active() as $file) {
include_once $file;
}
// Call the plugin's load procedure.
foreach (Plugins::list_active() as $file) {
Plugins::load($file);
}
// All plugins loaded, tell the plugins.
Plugins::act('plugins_loaded');
// Start the session.
Session::init();
// Replace the $_COOKIE superglobal with an object representation
SuperGlobal::process_c();
// Initiating request handling, tell the plugins.
Plugins::act('init');
// Parse and handle the request.
Controller::parse_request();
// Run the cron jobs asyncronously.
CronTab::run_cron(true);
// Dispatch the request (action) to the matched handler.
Controller::dispatch_request();
示例4: configured
} else {
if (!is_array($config['languages']['list'])) {
$configuration_ok = false;
} else {
if (count($config['languages']['list']) < 1) {
$configuration_ok = false;
}
}
}
if (!$configuration_ok) {
Helpers::fatalError('The system is not properly configured (in /system/custom/config/main.config.php)', true);
}
}
// Datenstruktur, Plugins, Module, Modifikatoren laden
DataStructure::load();
Plugins::load();
FrontendModules::load();
DataModifiers::load();
// Frontend-Controller-Klassen-Datei laden
$controller_file_name = Config::get()->frontendController->classFile;
if (!file_exists($controller_file_name)) {
Helpers::fatalError('Frontend controller class file not found (' . $controller_file_name . ' doesn\'t exist)!', true);
}
require_once $controller_file_name;
// Klasse instanziieren
$controller_class_name = Config::get()->frontendController->className;
if (!class_exists($controller_class_name)) {
Helpers::fatalError('Frontend controller class not found (class "' . $controller_class_name . '" doesn\'t exist in ' . $controller_file_name . ')!', true);
}
$controller = new $controller_class_name();
Registry::set('frontendController', $controller);
示例5: array
<?php
$pageData = array();
$pageName = System::getCurrentPage();
$pageName = $pageName == '' ? 'home' : $pageName;
if ($matches = Uri::match('^(\\w+)\\/?')) {
$pageName = $matches[1];
}
if ($matches = Uri::match('^page\\/(\\d+)')) {
$pageName = 'home';
}
// Theme::view('head');
$codeHead = Plugins::load('site_header');
$codeHead = is_array($codeHead) ? '' : $codeHead;
$codeFooter = Plugins::load('site_footer');
$codeFooter = is_array($codeFooter) ? '' : $codeFooter;
// print_r($codeHead);die();
System::defineGlobalVar('site_header', $codeHead);
System::defineGlobalVar('site_footer', $codeFooter);
$links = Links::get(array('cacheTime' => 3, 'orderby' => 'order by sort_order asc'));
System::defineVar('linkList', $links, 'head');
Controller::loadWithPath('theme' . ucfirst($pageName), 'index', System::getThemePath() . 'controller/');
// Theme::view('footer');
示例6: activate_plugin
/**
* Activates a plugin file
*/
public static function activate_plugin( $file )
{
$ok = true;
// Keep stream handler and strip base path from stored path
$stream = '';
if(preg_match('#^([^:]+://)#i', $file, $matches)) {
$stream = $matches[1];
$short_file = $file; //$stream . MultiByte::substr( preg_replace('#^([^:]+://)#i', '', $file), strlen( HABARI_PATH ) );
}
else {
$short_file = MultiByte::substr( $file, strlen( HABARI_PATH ) );
}
//Utils::debug($stream, $file);die();
$activated = Options::get( 'active_plugins' );
if ( !is_array( $activated ) || !in_array( $short_file, $activated ) ) {
include_once( $file );
$class = Plugins::class_from_filename( $file );
$plugin = Plugins::load( $class );
$ok = Plugins::filter( 'activate_plugin', $ok, $file ); // Allow plugins to reject activation
}
else if ( is_array( $activated) && in_array( $short_file, $activated ) ) {
$ok = false;
}
if ( $ok ) {
$activated[$class] = $short_file;
Options::set( 'active_plugins', $activated );
$versions = Options::get( 'pluggable_versions' );
if(!isset($versions[$class])) {
$versions[$class] = $plugin->get_version();
Options::set( 'pluggable_versions', $versions );
}
if ( method_exists( $plugin, 'action_plugin_activation' ) ) {
$plugin->action_plugin_activation( $file ); // For the plugin to install itself
}
Plugins::act( 'plugin_activated', $file ); // For other plugins to react to a plugin install
EventLog::log( _t( 'Activated Plugin: %s', array( $plugin->info->name ) ), 'notice', 'plugin', 'habari' );
}
return $ok;
}
示例7: Tpl
// template object
$tpl = new Tpl();
// version
$set->version = '1.0.6 BETA';
// db connection
$db = new dbConn($set->db_host, $set->db_user, $set->db_pass, $set->db_name);
$set->sinfo = $db->get_row("SELECT * FROM `" . MAI_PREFIX . "settings`");
if (!$set->sinfo) {
header("Location: install.php");
exit;
}
// check if we have any cookie saved
if ($_COOKIE['pass'] == $set->sinfo->admin_pass) {
$_SESSION['adminpass'] = $set->sinfo->admin_pass;
}
// get the settings for plugins
if (!is_array(unserialize($set->sinfo->active_plugins))) {
$set->sinfo->active_plugins = serialize(array());
}
$_PS = $db->select("SELECT `name`,`value` FROM `" . MAI_PREFIX . "plugins_settings`");
if ($_PS) {
foreach ($_PS as $__PS) {
$set->plugins[$__PS->name] = $__PS->value;
}
}
// plugins object
$plugins = new Plugins();
$plugins->load();
$links[] = mai_img("arr.gif") . " <a href='{$set->url}'>{$lang->Home}</a>";
$plugins->run_hook("init");
remove_magic_quotes();
示例8: get_plugins
public function get_plugins()
{
$all_plugins = Plugins::list_all();
$active_plugins = Plugins::get_active();
$sort_active_plugins = array();
$sort_inactive_plugins = array();
foreach ($all_plugins as $file) {
$plugin = array();
$plugin_id = Plugins::id_from_file($file);
$plugin['plugin_id'] = $plugin_id;
$plugin['file'] = $file;
$error = '';
if (Utils::php_check_file_syntax($file, $error)) {
$plugin['debug'] = false;
if (array_key_exists($plugin_id, $active_plugins)) {
$plugin['verb'] = _t('Deactivate');
$pluginobj = $active_plugins[$plugin_id];
$plugin['active'] = true;
$plugin_actions = array();
$plugin_actions = Plugins::filter('plugin_config', $plugin_actions, $plugin_id);
$plugin['actions'] = array();
foreach ($plugin_actions as $plugin_action => $plugin_action_caption) {
if (is_numeric($plugin_action)) {
$plugin_action = $plugin_action_caption;
}
$action = array('url' => URL::get('admin', 'page=plugins&configure=' . $plugin_id . '&configaction=' . $plugin_action), 'caption' => $plugin_action_caption, 'action' => $plugin_action);
if ($action['caption'] == '?') {
$plugin['help'] = $action;
} else {
$plugin['actions'][$plugin_action] = $action;
}
}
$plugin['actions']['deactivate'] = array('url' => URL::get('admin', 'page=plugin_toggle&plugin_id=' . $plugin['plugin_id'] . '&action=deactivate'), 'caption' => _t('Deactivate'), 'action' => 'Deactivate');
} else {
// instantiate this plugin
// in order to get its info()
include_once $file;
Plugins::get_plugin_classes(true);
$pluginobj = Plugins::load($file, false);
$plugin['active'] = false;
$plugin['verb'] = _t('Activate');
$plugin['actions'] = array('activate' => array('url' => URL::get('admin', 'page=plugin_toggle&plugin_id=' . $plugin['plugin_id'] . '&action=activate'), 'caption' => _t('Activate'), 'action' => 'activate'));
}
$plugin['info'] = $pluginobj->info;
} else {
$plugin['debug'] = true;
$plugin['error'] = $error;
$plugin['active'] = false;
}
if (isset($this->handler_vars['configure']) && $this->handler_vars['configure'] == $plugin['plugin_id']) {
if (isset($plugin['help']) && Controller::get_var('configaction') == $plugin['help']['action']) {
$this->theme->config_plugin_caption = _t('Help');
} else {
if (isset($plugin['actions'][Controller::get_var('configaction')])) {
$this->theme->config_plugin_caption = $plugin['actions'][Controller::get_var('configaction')]['caption'];
} else {
$this->theme->config_plugin_caption = Controller::get_var('configaction');
}
}
unset($plugin['actions'][Controller::get_var('configaction')]);
$this->theme->config_plugin = $plugin;
} else {
if ($plugin['active']) {
$sort_active_plugins[$plugin_id] = $plugin;
} else {
$sort_inactive_plugins[$plugin_id] = $plugin;
}
}
}
//$this->theme->plugins = array_merge($sort_active_plugins, $sort_inactive_plugins);
$this->theme->assign('configaction', Controller::get_var('configaction'));
$this->theme->assign('configure', Controller::get_var('configure'));
$this->theme->active_plugins = $sort_active_plugins;
$this->theme->inactive_plugins = $sort_inactive_plugins;
$this->display('plugins');
}
示例9: activate_plugin
/**
* Activates a plugin file
*/
public static function activate_plugin($file)
{
$ok = true;
// strip base path from stored path
$short_file = MultiByte::substr($file, strlen(HABARI_PATH));
$activated = Options::get('active_plugins');
if (!is_array($activated) || !in_array($short_file, $activated)) {
include_once $file;
$class = Plugins::class_from_filename($file);
$plugin = Plugins::load($class);
$ok = Plugins::filter('activate_plugin', $ok, $file);
// Allow plugins to reject activation
} else {
if (is_array($activated) && in_array($short_file, $activated)) {
$ok = false;
}
}
if ($ok) {
$activated[$class] = $short_file;
Options::set('active_plugins', $activated);
$versions = Options::get('pluggable_versions');
if (!isset($versions[$class])) {
$versions[$class] = $plugin->get_version();
Options::set('pluggable_versions', $versions);
}
if (method_exists($plugin, 'action_plugin_activation')) {
$plugin->action_plugin_activation($file);
// For the plugin to install itself
}
Plugins::act('plugin_activated', $file);
// For other plugins to react to a plugin install
EventLog::log(_t('Activated Plugin: %s', array($plugin->info->name)), 'notice', 'plugin', 'habari');
}
return $ok;
}
示例10: getUsercpFooter
public static function getUsercpFooter()
{
$data = Plugins::load('usercp_footer');
return $data;
}
示例11: activate_plugin
/**
* Activates a plugin file
*/
public static function activate_plugin($file)
{
$ok = true;
// check for a URL-looking filename, which probably indicates a PHAR-format plugin
if (preg_match('#^([^:]+://)#i', $file, $matches)) {
// we need the entire path to the file
$short_file = $file;
} else {
// trim off the leading habari path from the filename
$short_file = MultiByte::substr($file, strlen(HABARI_PATH));
}
//Activate all dependency plugins first
$provider_data = self::provided(null, true, true);
$providing_data = self::provided();
$info = self::load_info($file);
if (isset($info->requires)) {
$dependencies = array();
foreach ($info->requires->feature as $feature) {
// Does something already provide this required feature?
if (isset($providing_data[(string) $feature])) {
continue;
}
// Could one inactive thing provide this required feature?
if (isset($provider_data[(string) $feature]) && count($provider_data[(string) $feature]) == 1) {
$dependencies[] = reset($provider_data[(string) $feature]);
} else {
return false;
}
}
// Try to activate the dependencies we accumulated just then
foreach ($dependencies as $dependency) {
$result = self::activate_plugin($dependency);
// Couldn't activate a dependency? Can't activate this one.
if (!$result) {
return false;
}
}
}
$activated = Options::get('active_plugins');
if (!is_array($activated) || !in_array($short_file, $activated)) {
include_once $file;
$class = Plugins::class_from_filename($file);
$plugin = Plugins::load($class);
$ok = Plugins::filter('activate_plugin', $ok, $file);
// Allow plugins to reject activation
} else {
if (is_array($activated) && in_array($short_file, $activated)) {
$ok = false;
}
}
if ($ok) {
$activated[$class] = $short_file;
Options::set('active_plugins', $activated);
$versions = Options::get('pluggable_versions');
if (!isset($versions[$class])) {
$versions[$class] = $plugin->get_version();
Options::set('pluggable_versions', $versions);
}
if (method_exists($plugin, 'action_plugin_activation')) {
$plugin->action_plugin_activation($file);
// For the plugin to install itself
}
Plugins::act('plugin_activated', $file);
// For other plugins to react to a plugin install
EventLog::log(_t('Activated Plugin: %s', array($plugin->info->name)), 'notice', 'plugin', 'habari');
}
return $ok;
}
示例12: activate_plugin
/**
* Activates a plugin file
**/
public static function activate_plugin($file)
{
$ok = true;
$ok = Plugins::filter('activate_plugin', $ok, $file);
// Allow plugins to reject activation
if ($ok) {
// strip base path from stored path
$short_file = substr($file, strlen(HABARI_PATH));
$activated = Options::get('active_plugins');
if (!is_array($activated) || !in_array($short_file, $activated)) {
$activated[] = $short_file;
Options::set('active_plugins', $activated);
include_once $file;
Plugins::get_plugin_classes();
$plugin = Plugins::load($file);
if (method_exists($plugin, 'action_plugin_activation')) {
$plugin->action_plugin_activation($file);
// For the plugin to install itself
}
Plugins::act('plugin_activated', $file);
// For other plugins to react to a plugin install
EventLog::log(_t('Activated Plugin: %s', array(self::$plugins[Plugins::id_from_file($file)]->info->name)), 'notice', 'plugin', 'habari');
}
}
return $ok;
}
示例13: get_plugins
public function get_plugins()
{
$all_plugins = Plugins::list_all();
$recommended_list = array('coredashmodules.plugin.php', 'habarisilo.plugin.php', 'pingback.plugin.php', 'spamchecker.plugin.php', 'undelete.plugin.php');
foreach ($all_plugins as $file) {
$plugin = array();
$plugin_id = Plugins::id_from_file($file);
$plugin['plugin_id'] = $plugin_id;
$plugin['file'] = $file;
$error = '';
if (Utils::php_check_file_syntax($file, $error)) {
$plugin['debug'] = false;
// instantiate this plugin
// in order to get its info()
include_once $file;
Plugins::get_plugin_classes();
$pluginobj = Plugins::load($file, false);
$plugin['active'] = false;
$plugin['verb'] = _t('Activate');
$plugin['actions'] = array();
$plugin['info'] = $pluginobj->info;
$plugin['recommended'] = in_array(basename($file), $recommended_list);
} else {
// We can't get the plugin info due to an error
// This will show up in the plugin panel, just continue through install
continue;
}
$plugins[$plugin_id] = $plugin;
}
return $plugins;
}