本文整理汇总了PHP中Plugins::get_plugin_classes方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::get_plugin_classes方法的具体用法?PHP Plugins::get_plugin_classes怎么用?PHP Plugins::get_plugin_classes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::get_plugin_classes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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');
}
示例3: 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;
}