本文整理汇总了PHP中Plugins::filter_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::filter_id方法的具体用法?PHP Plugins::filter_id怎么用?PHP Plugins::filter_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::filter_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_adminhandler_post_loadplugins_main_menu
public function filter_adminhandler_post_loadplugins_main_menu($menu)
{
$active_plugins = Plugins::get_active();
$submenu_count = 0;
foreach ($active_plugins as $pluginobj) {
$plugin_actions = array();
$plugin_actions = Plugins::filter_id('plugin_config', $pluginobj->plugin_id(), $plugin_actions, $pluginobj->plugin_id());
foreach ($plugin_actions as $plugin_action => $plugin_action_caption) {
if (is_numeric($plugin_action)) {
$plugin_action = $plugin_action_caption;
}
$urlparams = array('page' => 'plugins', 'configure' => $pluginobj->plugin_id(), 'configaction' => $plugin_action);
$url = URL::get('admin', $urlparams);
switch ($plugin_action_caption) {
case _t('?'):
break;
default:
$menu['plugins']['submenu']['plugin_' . ++$submenu_count] = array('url' => $url, 'title' => _t('%1$s: %2$s', array($pluginobj->info->name, $plugin_action_caption)), 'text' => _t('%1$s: %2$s', array($pluginobj->info->name, $plugin_action_caption)), 'access' => true, 'hotkey' => $submenu_count);
break;
}
}
}
return $menu;
}
示例2: get_plugins
/**
* Display the plugin administration page
*/
public function get_plugins()
{
$all_plugins = Plugins::list_all();
$active_plugins = Plugins::get_active();
$sort_active_plugins = array();
$sort_inactive_plugins = array();
$providing = array();
$available = 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;
$plugin['info'] = Plugins::load_info($file);
if (array_key_exists($plugin_id, $active_plugins)) {
$plugin['verb'] = _t('Deactivate');
$pluginobj = $active_plugins[$plugin_id];
$plugin['active'] = true;
$plugin_actions = array();
$plugin_actions1 = Plugins::filter_id('plugin_config', $plugin_id, $plugin_actions, $plugin_id);
$plugin_actions = Plugins::filter('plugin_config_any', $plugin_actions1, $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('caption' => $plugin_action_caption, 'action' => $plugin_action);
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id);
$action['url'] = URL::get('admin', $urlparams);
// @locale Displayed as an icon indicating there is help text available for a plugin.
if ($action['caption'] == _t('?')) {
if (isset($_GET['configaction'])) {
$urlparams['configaction'] = $_GET['configaction'];
}
if ($_GET['help'] != $plugin_action) {
$urlparams['help'] = $plugin_action;
}
$action['url'] = URL::get('admin', $urlparams);
$plugin['help'] = $action;
} else {
if (isset($_GET['help'])) {
$urlparams['help'] = $_GET['help'];
}
$urlparams['configaction'] = $plugin_action;
$action['url'] = URL::get('admin', $urlparams);
$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');
if (isset($plugin['info']->provides)) {
foreach ($plugin['info']->provides->feature as $feature) {
$providing[(string) $feature] = (string) $feature;
}
}
} else {
// instantiate this plugin
// in order to get its info()
$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'));
if (isset($plugin['info']->help)) {
if (isset($_GET['configaction'])) {
$urlparams['configaction'] = $_GET['configaction'];
}
if ($_GET['help'] != '_help') {
$urlparams['help'] = '_help';
}
// @locale Displayed as an icon indicating there is help text available for a plugin.
$action['caption'] = _t('?');
$action['action'] = '_help';
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id);
$action['url'] = URL::get('admin', $urlparams);
$plugin['help'] = $action;
}
if (isset($plugin['info']->provides)) {
foreach ($plugin['info']->provides->feature as $feature) {
$available[(string) $feature][$plugin_id] = $plugin['info']->name;
}
}
}
} 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');
}
//.........这里部分代码省略.........