本文整理汇总了PHP中Plugins::load_info方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::load_info方法的具体用法?PHP Plugins::load_info怎么用?PHP Plugins::load_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::load_info方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
foreach ($all_plugins as $file) {
$plugin = array();
$plugin_id = Plugins::id_from_file($file);
$plugin['plugin_id'] = $plugin_id;
$plugin['file'] = $file;
$error = '';
$providing = array();
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_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('caption' => $plugin_action_caption, 'action' => $plugin_action);
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id);
$action['url'] = URL::get('admin', $urlparams);
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] = $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';
}
$action['caption'] = _t('?');
$action['action'] = '_help';
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id);
$action['url'] = URL::get('admin', $urlparams);
$plugin['help'] = $action;
}
}
} 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;
}
//.........这里部分代码省略.........
示例2: get_import
/**
* Handles GET requests for the import page.
*/
public function get_import()
{
// First check for troublesome plugins
$bad_features = array(
'ping',
'pingback',
'spamcheck',
);
$troublemakers = array();
$plugins = Plugins::list_active();
foreach( $plugins as $plugin ) {
$info = Plugins::load_info( $plugin );
$provides = array();
if( isset($info->provides ) ) {
foreach( $info->provides->feature as $feature ) {
$provides[] = $feature;
}
}
$has_bad = array_intersect( $bad_features, $provides );
if( count( $has_bad ) ) {
$troublemakers[] = $info->name;
}
}
if( count( $troublemakers ) ) {
$troublemakers = implode( ', ', $troublemakers );
$msg = _t( 'Plugins that conflict with importing are active. To prevent undesirable consequences, please de-activate the following plugins until the import is finished: ' ) . '<br>';
$msg .= $troublemakers;
$this->theme->conflicting_plugins = $msg;
Session::error( $msg );
}
// Now get on with creating the page
$importer = isset( $_POST['importer'] ) ? $_POST['importer'] : '';
$stage = isset( $_POST['stage'] ) ? $_POST['stage'] : '1';
$step = isset( $_POST['step'] ) ? $_POST['step'] : '1';
$this->theme->enctype = Plugins::filter( 'import_form_enctype', 'application/x-www-form-urlencoded', $importer, $stage, $step );
// filter to get registered importers
$importers = Plugins::filter( 'import_names', array() );
// fitler to get the output of the current importer, if one is running
if ( $importer != '' ) {
$output = Plugins::filter( 'import_stage', '', $importer, $stage, $step );
}
else {
$output = '';
}
$this->theme->importer = $importer;
$this->theme->stage = $stage;
$this->theme->step = $step;
$this->theme->importers = $importers;
$this->theme->output = $output;
$this->display( 'import' );
}
示例3: info
/**
* Loads a theme's metadata from an XML file in theme's
* directory.
*
*/
public final function info()
{
static $info;
if (!isset($info)) {
$info = Plugins::load_info($this->get_file());
if (isset($info->help)) {
Plugins::register(array($this, '_help_plugin_config_plugin'), 'filter', 'plugin_config');
Plugins::register(array($this, '_help_plugin_ui_plugin'), 'action', 'plugin_ui');
}
}
return $info;
}
示例4: get_deactives
/**
* Gets the deactived plugins and themes
*
* @todo This makes guesses and is not yet used.
*
* @return array An array of deactivated plugins, with an empty array() on failure
*/
public function get_deactives()
{
$active_plugins = Plugins::get_active();
$deactive_plugins = array();
foreach (Plugins::list_all() as $fname => $fpath) {
$id = Plugins::id_from_file($fpath);
$info = Plugins::load_info($fpath);
if (is_null($info) || is_null($id)) {
continue;
}
//@todo $info differs from get_option_from_name() output, but would be inefficient to use for 300+ plugins
if (empty($active_plugins[$id])) {
$deactive_plugins[$id] = $info;
}
}
return $deactive_plugins;
}
示例5: get_plugins
/**
* Helper function to grab list of plugins
*/
public function get_plugins()
{
$all_plugins = Plugins::list_all();
$recommended_list = array('coredashmodules.plugin.php', 'coreblocks.plugin.php', 'habarisilo.plugin.php', 'pingback.plugin.php', 'spamchecker.plugin.php', 'undelete.plugin.php', 'autop.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;
// get this plugin's info()
$plugin['active'] = false;
$plugin['verb'] = _t('Activate');
$plugin['actions'] = array();
$plugin['info'] = Plugins::load_info($file);
$plugin['recommended'] = in_array(basename($file), $recommended_list);
$plugin['requires'] = isset($plugin['info']->requires) ? self::get_feature_list($plugin['info']->requires->children()) : '';
$plugin['provides'] = isset($plugin['info']->provides) ? self::get_feature_list($plugin['info']->provides->children()) : '';
$plugin['conflicts'] = isset($plugin['info']->conflicts) ? self::get_feature_list($plugin['info']->conflicts->children()) : '';
} 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;
}
示例6: get_plugins
/**
* Display the plugin administration page
*/
public function get_plugins()
{
// Grab pathes to 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);
$plugin['core'] = strpos($file, 'system' . DIRECTORY_SEPARATOR . 'plugins') !== false;
// should rather be named "is_core"
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_id('plugin_config', $plugin_id, $plugin_actions, $plugin_id);
$plugin_actions = Plugins::filter('plugin_config_any', $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('caption' => $plugin_action_caption, 'action' => $plugin_action);
$urlparams = array('page' => 'plugins', 'configure' => $plugin_id, 'action' => $plugin_action);
$action['href'] = URL::get('display_plugins', $urlparams);
// @locale Displayed as an icon indicating there is help text available for a plugin.
if ($action['caption'] == _t('?')) {
$q = Controller::get_var('action');
if (isset($q)) {
$urlparams['action'] = Controller::get_var('action');
}
if ($_GET['help'] != $plugin_action) {
$urlparams['help'] = $plugin_action;
}
$action['url'] = URL::get('display_plugins', $urlparams);
$plugin['help'] = $action;
} else {
if (isset($_GET['help'])) {
$urlparams['help'] = $_GET['help'];
}
$urlparams['action'] = $plugin_action;
$action['url'] = URL::get('display_plugins', $urlparams);
$plugin['actions'][$plugin_action] = $action;
}
}
$plugin['actions']['deactivate'] = array('href' => URL::get('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('href' => URL::get('plugin_toggle', 'plugin_id=' . $plugin['plugin_id'] . '&action=activate'), 'caption' => _t('Activate'), 'action' => 'activate'));
if (isset($plugin['info']->help)) {
if (isset($_GET['action'])) {
$urlparams['action'] = $_GET['action'];
}
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 (!is_null(Controller::get_var('configure')) && Controller::get_var('configure') == $plugin['plugin_id']) {
$this->theme->configaction = Controller::get_var('action');
if (isset($plugin['help']) && Controller::get_var('action') == $plugin['help']['action']) {
$this->theme->config_plugin_caption = _t('Help');
} else {
//.........这里部分代码省略.........