当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugins::list_all方法代码示例

本文整理汇总了PHP中Plugins::list_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::list_all方法的具体用法?PHP Plugins::list_all怎么用?PHP Plugins::list_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugins的用法示例。


在下文中一共展示了Plugins::list_all方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
             }
//.........这里部分代码省略.........
开发者ID:psaintlaurent,项目名称:Habari,代码行数:101,代码来源:adminhandler.php

示例2: 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;
 }
开发者ID:habari-extras,项目名称:optionsmanager,代码行数:24,代码来源:optionsmanager.plugin.php

示例3: set_present

	/**
	 * Stores the list of plugins that are present (not necessarily active) in
	 * the Options table for future comparison.
	 */
	public static function set_present()
	{
		$plugin_files = Plugins::list_all();
		// strip base path
		foreach ( $plugin_files as $plugin_file ) {
			$plugin_file = MultiByte::substr( $file, MultiByte::strlen( HABARI_PATH ) );
		}

		$plugin_data = array_map( create_function( '$a', 'return array( "file" => $a, "checksum" => md5_file( $a ) );' ), $plugin_files );
		Options::set( 'plugins_present', $plugin_data );
	}
开发者ID:rynodivino,项目名称:system,代码行数:15,代码来源:plugins.php

示例4: get_plugin_toggle

 /**
  * Handles plugin activation or deactivation.
  */
 public function get_plugin_toggle()
 {
     $extract = $this->handler_vars->filter_keys('plugin_id', 'action');
     foreach ($extract as $key => $value) {
         ${$key} = $value;
     }
     $plugins = Plugins::list_all();
     foreach ($plugins as $file) {
         if (Plugins::id_from_file($file) == $plugin_id) {
             switch (strtolower($action)) {
                 case 'activate':
                     if (Plugins::activate_plugin($file)) {
                         $plugins = Plugins::get_active();
                         Session::notice(_t("Activated plugin '%s'", array($plugins[Plugins::id_from_file($file)]->info->name)), $plugins[Plugins::id_from_file($file)]->plugin_id);
                     }
                     break;
                 case 'deactivate':
                     if (Plugins::deactivate_plugin($file)) {
                         $plugins = Plugins::get_active();
                         Session::notice(_t("Deactivated plugin '%s'", array($plugins[Plugins::id_from_file($file)]->info->name)), $plugins[Plugins::id_from_file($file)]->plugin_id);
                     }
                     break;
                 default:
                     Plugins::act('adminhandler_get_plugin_toggle_action', $action, $file, $plugin_id, $plugins);
                     break;
             }
         }
     }
     Utils::redirect(URL::get('admin', 'page=plugins'));
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:33,代码来源:adminpluginshandler.php

示例5: activate_plugins

 public function activate_plugins()
 {
     // extract checked plugin IDs from $_POST
     $plugin_ids = array();
     foreach ($this->handler_vars as $id => $activate) {
         if (preg_match('/plugin_([a-f0-9]{8})/u', $id, $matches) && $activate) {
             $plugin_ids[] = $matches[1];
         } elseif (preg_match('/plugin_(.+)/u', $id, $matches) && $activate) {
             $plugin_ids[] = $matches[1];
         }
     }
     if (count($plugin_ids) == 0) {
         return;
     }
     // set the user_id in the session in case plugin activation methods need it
     if (!($u = User::get_by_name($this->handler_vars['admin_username']))) {
         // @todo die gracefully
         die(_t('No admin user found'));
     }
     $u->remember();
     // loop through all plugins to find matching plugin files
     $plugin_files = Plugins::list_all();
     foreach ($plugin_files as $file) {
         if (in_array(basename($file), $plugin_ids)) {
             Plugins::activate_plugin($file);
             continue;
         }
         $id = Plugins::id_from_file($file);
         if (in_array($id, $plugin_ids)) {
             Plugins::activate_plugin($file);
         }
     }
     // unset the user_id session variable
     Session::clear_userid($_SESSION['user_id']);
     unset($_SESSION['user_id']);
 }
开发者ID:habari,项目名称:system,代码行数:36,代码来源:installhandler.php

示例6: get_sysinfo

 /**
  * Handles get requests for the system information page.
  */
 public function get_sysinfo()
 {
     $sysinfo = array();
     $siteinfo = array();
     // Assemble Site Info
     $siteinfo[_t('Habari Version')] = Version::get_habariversion();
     if (Version::is_devel()) {
         $siteinfo[_t('Habari Version')] .= " " . Version::get_git_short_hash();
     }
     $siteinfo[_t('Habari API Version')] = Version::get_apiversion();
     $siteinfo[_t('Habari DB Version')] = Version::get_dbversion();
     $siteinfo[_t('Active Theme')] = Options::get('theme_name');
     $siteinfo[_t('System Locale')] = HabariLocale::get();
     $siteinfo[_t('Cache Class')] = Cache::get_class();
     $this->theme->siteinfo = $siteinfo;
     // Assemble System Info
     $sysinfo[_t('PHP Version')] = phpversion();
     $sysinfo[_t('Server Software')] = $_SERVER['SERVER_SOFTWARE'];
     $sysinfo[_t('Database')] = DB::get_driver_name() . ' - ' . DB::get_driver_version();
     $sysinfo[_t('PHP Extensions')] = implode(', ', get_loaded_extensions());
     $sysinfo[_t('PHP Configuration Settings')] = implode("<br>", Utils::get_ini_settings());
     if (defined('PCRE_VERSION')) {
         $sysinfo[_t('PCRE Version')] = PCRE_VERSION;
     } else {
         // probably PHP < 5.2.4
         ob_start();
         phpinfo(8);
         $phpinfo = ob_get_contents();
         ob_end_clean();
         preg_match('/PCRE Library Version.*class="v">(.*)$/mi', $phpinfo, $matches);
         $sysinfo[_t('PCRE Version')] = $matches[1];
     }
     $sysinfo[_t('Browser')] = $_SERVER['HTTP_USER_AGENT'];
     $this->theme->sysinfo = $sysinfo;
     // Assemble Class Info
     $classinfo = Utils::glob(HABARI_PATH . "/user/classes/*.php");
     if (count($classinfo)) {
         $classinfo = array_map('realpath', $classinfo);
     }
     $this->theme->classinfo = $classinfo;
     // Assemble Plugin Info
     $raw_plugins = Plugins::get_active();
     $plugins = array('system' => array(), 'user' => array(), '3rdparty' => array(), 'other' => array());
     foreach ($raw_plugins as $plugin) {
         $file = $plugin->get_file();
         // Catch plugins that are symlinked from other locations as ReflectionClass->getFileName() only returns the ultimate file path, not the symlink path, and we really want the symlink path
         $all_plugins = Plugins::list_all();
         $filename = basename($file);
         if (array_key_exists($filename, $all_plugins) && $all_plugins[$filename] != $file) {
             $file = $all_plugins[$filename];
         }
         if (preg_match('%[\\\\/](system|3rdparty|user)[\\\\/]plugins[\\\\/]%i', $file, $matches)) {
             // A plugin's info is XML, cast the element to a string. See #1026.
             $plugins[strtolower($matches[1])][(string) $plugin->info->name] = $file;
         } else {
             // A plugin's info is XML, cast the element to a string.
             $plugins['other'][(string) $plugin->info->name] = $file;
         }
     }
     $this->theme->plugins = $plugins;
     $this->theme->admin_page = _t('System Information');
     $this->display('sysinfo');
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:66,代码来源:adminhandler.php

示例7: set_present

 /**
  * Stores the list of plugins that are present (not necessarily active) in
  * the Options table for future comparison.
  */
 public static function set_present()
 {
     $plugin_files = Plugins::list_all();
     // strip base path
     foreach ($plugin_files as $plugin_file) {
         $plugin_file = MultiByte::substr($plugin_file, MultiByte::strlen(HABARI_PATH));
     }
     $plugin_data = array_map(function ($a) {
         return array('file' => $a, 'checksum' => md5_file($a));
     }, $plugin_files);
     Options::set('plugins_present', $plugin_data);
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:16,代码来源:plugins.php

示例8: activate_plugins

	public function activate_plugins()
	{
		// extract checked plugin IDs from $_POST
		$plugin_ids = array();
		foreach ( $_POST as $id => $activate ) {
			if ( preg_match( '/plugin_\w+/u', $id ) && $activate ) {
				$id = substr( $id, 7 );
				$plugin_ids[] = $id;
			}
		}

		// set the user_id in the session in case plugin activation methods need it
		if ( ! $u = User::get_by_name( $this->handler_vars['admin_username'] ) ) {
			// @todo die gracefully
			die( _t( 'No admin user found' ) );
		}
		$u->remember();

		// loop through all plugins to find matching plugin files
		$plugin_files = Plugins::list_all();
		foreach ( $plugin_files as $file ) {
			$id = Plugins::id_from_file( $file );
			if ( in_array( $id, $plugin_ids ) ) {
				Plugins::activate_plugin( $file );
			}
		}

		// unset the user_id session variable
		Session::clear_userid( $_SESSION['user_id'] );
		unset( $_SESSION['user_id'] );
	}
开发者ID:rynodivino,项目名称:system,代码行数:31,代码来源:installhandler.php

示例9: 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');
 }
开发者ID:anupom,项目名称:my-blog,代码行数:76,代码来源:adminhandler.php

示例10: provided

 /**
  * Get a list of features and the active plugins that provide that feature
  * @param null|string $exclude A plugin id to exclude from the results
  * @param bool $include_inactive Default false.  If true, include inactive plugins in the list.
  * @param bool $use_file If true, return a filename as the depenedency. If false (default), return the name of the plugin.
  * @return array An array with keys of the feature name, values are an array of plugin names providing that feature
  */
 public static function provided($exclude = null, $include_inactive = false, $use_file = false)
 {
     if ($include_inactive) {
         $all_plugins = Plugins::list_all();
         $plugin_list = array();
         foreach ($all_plugins as $plugin => $plugin_file) {
             $pdata = new \stdClass();
             $pdata->info = self::load_info($plugin_file);
             $pdata->filename = $plugin_file;
             $plugin_list[self::id_from_file($plugin_file)] = $pdata;
         }
     } else {
         $plugin_list = Plugins::get_active();
     }
     $provided = array();
     foreach ($plugin_list as $plugin_id => $plugin) {
         if ($plugin->info->name == $exclude || $plugin_id == $exclude) {
             continue;
         }
         if (isset($plugin->info->provides)) {
             foreach ($plugin->info->provides->feature as $provide) {
                 if ($use_file) {
                     $provided[(string) $provide][] = isset(self::$plugin_files[get_class($plugin)]) ? self::$plugin_files[get_class($plugin)] : $plugin->filename;
                 } else {
                     $provided[(string) $provide][] = (string) $plugin->info->name;
                 }
             }
         }
     }
     return Plugins::filter('provided', $provided);
 }
开发者ID:habari,项目名称:system,代码行数:38,代码来源:plugins.php


注:本文中的Plugins::list_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。