/** * 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; }
/** * 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; }
/** * 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; }