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


PHP Plugins::plugin_files方法代码示例

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


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

示例1: list_active

 /**
  * function list_active
  * Gets a list of active plugin filenames to be included
  * @param boolean Whether to refresh the cached array.  Default FALSE
  * @return array An array of filenames
  **/
 public static function list_active($refresh = false)
 {
     if (!empty(self::$plugin_files) && !$refresh) {
         return self::$plugin_files;
     }
     $plugins = Options::get('active_plugins');
     if (is_array($plugins)) {
         foreach ($plugins as $plugin) {
             // add base path to stored path
             $plugin = HABARI_PATH . $plugin;
             if (file_exists($plugin)) {
                 self::$plugin_files[] = $plugin;
             }
         }
     }
     // make sure things work on Windows
     self::$plugin_files = array_map(create_function('$s', 'return str_replace(\'\\\\\', \'/\', $s);'), self::$plugin_files);
     return self::$plugin_files;
 }
开发者ID:anupom,项目名称:my-blog,代码行数:25,代码来源:plugins.php

示例2: list_active

	/**
	 * function list_active
	 * Gets a list of active plugin filenames to be included
	 * @param boolean Whether to refresh the cached array.  Default false
	 * @return array An array of filenames
	 */
	public static function list_active( $refresh = false )
	{
		if ( empty( self::$plugin_files ) || $refresh ) {
			$plugins = Options::get( 'active_plugins' );
			if ( is_array( $plugins ) ) {
				foreach ( $plugins as $class => $filename ) {
					// add base path to stored path
					if(!preg_match('#^([^:]+://)#i', $filename, $matches)) {
						$filename = HABARI_PATH . $filename;
					}

					// if class is somehow empty we'll throw an error when trying to load it - deactivate the plugin instead
					if ( $class == '' ) {
						self::deactivate_plugin( $filename, true );
						EventLog::log( _t( 'An empty plugin definition pointing to file "%1$s" was removed.', array( $filename ) ), 'err', 'plugin', 'habari' );
						// and skip adding it to the active stack
						continue;
					}

					if ( file_exists( $filename ) ) {
						self::$plugin_files[$class] = $filename;
					}
					else {
						// file does not exist, deactivate plugin
						self::deactivate_plugin( $filename, true );
						EventLog::log( _t( 'Plugin "%1$s" deactivated because it could no longer be found.', array( $class ) ), 'err', 'plugin', 'habari', $filename );
					}
				}
			}
			// make sure things work on Windows
			self::$plugin_files = array_map( create_function( '$s', 'return str_replace(\'\\\\\', \'/\', $s);' ), self::$plugin_files );
		}
		return self::$plugin_files;
	}
开发者ID:rynodivino,项目名称:system,代码行数:40,代码来源:plugins.php

示例3: list_active

 /**
  * function list_active
  * Gets a list of active plugin filenames to be included
  * @param boolean Whether to refresh the cached array.  Default FALSE
  * @return array An array of filenames
  */
 public static function list_active($refresh = false)
 {
     if (empty(self::$plugin_files) || $refresh) {
         $plugins = Options::get('active_plugins');
         if (is_array($plugins)) {
             foreach ($plugins as $class => $filename) {
                 // add base path to stored path
                 $filename = HABARI_PATH . $filename;
                 if (file_exists($filename)) {
                     self::$plugin_files[$class] = $filename;
                 }
             }
         }
         // make sure things work on Windows
         self::$plugin_files = array_map(create_function('$s', 'return str_replace(\'\\\\\', \'/\', $s);'), self::$plugin_files);
     }
     return self::$plugin_files;
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:24,代码来源:plugins.php


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