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


PHP Plugins::get_active方法代码示例

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


在下文中一共展示了Plugins::get_active方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:habari-extras,项目名称:pluginsubmenu,代码行数:24,代码来源:pluginsubmenu.plugin.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: 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')] .= " r" . Version::get_svn_revision();
     }
     $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('Site Language')] = strlen(Options::get('system_locale')) ? Options::get('system_locale') : 'en-us';
     $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());
     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();
         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 {
             $plugins['other'][$plugin->info->name] = $file;
         }
     }
     $this->theme->plugins = $plugins;
     $this->display('sysinfo');
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:56,代码来源:adminhandler.php

示例4: action_block_content_creditdue

 /**
  * Fill the block.
  */
 public function action_block_content_creditdue($block)
 {
     $block->theme_credits = Themes::get_active();
     $block->plugin_credits = Plugins::get_active();
 }
开发者ID:habari-extras,项目名称:creditdue,代码行数:8,代码来源:creditdue.plugin.php

示例5: 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

示例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: add_plugins

 /**
  * Loop through all the active plugins and add their information to the list of plugins to check for updates.
  */
 private static function add_plugins()
 {
     $plugins = Plugins::get_active();
     foreach ($plugins as $plugin) {
         // name and version are required in the XML file, make sure GUID is set
         if (!isset($plugin->info->guid)) {
             continue;
         }
         Update::add($plugin->info->name, $plugin->info->guid, $plugin->info->version);
     }
 }
开发者ID:habari,项目名称:system,代码行数:14,代码来源:update.php

示例8: provided

 public static function provided($exclude = null)
 {
     $active_plugins = Plugins::get_active();
     $provided = array();
     foreach ($active_plugins 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) {
                 $provided[(string) $provide][] = (string) $plugin->info->name;
             }
         }
     }
     return Plugins::filter('provided', $provided);
 }
开发者ID:wwxgitcat,项目名称:habari,代码行数:16,代码来源:plugins.php

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