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


PHP Plugins::list_active方法代码示例

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


在下文中一共展示了Plugins::list_active方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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' );

	}
开发者ID:rynodivino,项目名称:system,代码行数:61,代码来源:adminimporthandler.php

示例2: header

}
// Send the Content-Type HTTP header.
// @todo Find a better place to put this.
header('Content-Type: text/html;charset=utf-8');
/**
 * Include all the active plugins.
 * By loading them here they'll have global scope.
 *
 * We loop through them twice so we can cache all plugin classes on the first load() call.
 * This gives about 60% improvement.
 */
foreach (Plugins::list_active() as $file) {
    include_once $file;
}
// Call the plugin's load procedure.
foreach (Plugins::list_active() as $file) {
    Plugins::load($file);
}
// All plugins loaded, tell the plugins.
Plugins::act('plugins_loaded');
// Start the session.
Session::init();
// Replace the $_COOKIE superglobal with an object representation
SuperGlobal::process_c();
// Initiating request handling, tell the plugins.
Plugins::act('init');
// Parse and handle the request.
Controller::parse_request();
// Run the cron jobs asyncronously.
CronTab::run_cron(true);
// Dispatch the request (action) to the matched handler.
开发者ID:anupom,项目名称:my-blog,代码行数:31,代码来源:index.php

示例3: upgrade_db_post_4291

 private function upgrade_db_post_4291()
 {
     // get all plugins so the legacy ones can be deactivated.
     $active_plugins = Plugins::list_active();
     $all_plugins = Installhandler::get_plugins();
     $legacy_plugins = array();
     foreach ($all_plugins as $plugin) {
         if (!isset($plugin['info'])) {
             $key = array_search($plugin['file'], $active_plugins);
             $legacy_plugins[$key] = $plugin['file'];
         }
     }
     $valid_plugins = array_diff_key(Options::get('active_plugins'), $legacy_plugins);
     // valid_plugins contains only working plugins, but the classnames are missing. The following was previously upgrade_db_post_3484()
     $new_plugins = array();
     if (is_array($valid_plugins)) {
         foreach ($valid_plugins as $filename) {
             if (!file_exists($filename)) {
                 // try adding base path to stored path
                 $filename = HABARI_PATH . $filename;
             }
             if (file_exists($filename)) {
                 // it is now safe to do this since plugins with info() functions are not in $valid_plugins
                 require_once $filename;
                 $class = Plugins::class_from_filename($filename);
                 $short_file = substr($filename, strlen(HABARI_PATH));
                 if ($class) {
                     $new_plugins[$class] = $short_file;
                 }
             }
         }
     }
     // replace option with only the usuable plugins
     Options::set('active_plugins', $new_plugins);
 }
开发者ID:habari,项目名称:system,代码行数:35,代码来源:installhandler.php


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