本文整理汇总了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;
}
示例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;
}
示例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;
}