Exemple #1
0
 /**
  * 加载所有 Active 的 theme
  *
  * @param string $system
  * @param string $excludeSystemTheme 排除某个系统
  */
 public static function loadActiveTheme($system, $excludeSystemTheme = null)
 {
     $activeThemeArray = ThemeHelper::getActiveThemeArray();
     if (empty($activeThemeArray)) {
         return;
     }
     foreach ($activeThemeArray as $activeTheme) {
         // 排除某个系统
         if ($excludeSystemTheme == $activeTheme) {
             printLog('exclude theme [' . $activeTheme . ']', 'PLUGIN', \Core\Log\Base::DEBUG);
             continue;
         }
         $instance = static::loadPluginInstance($activeTheme);
         if (!$instance) {
             printLog('theme [' . $activeTheme . '] does not exist', 'PLUGIN', \Core\Log\Base::ERROR);
             continue;
         }
         //调用插件的 load 方法做初始化
         if (true !== $instance->pluginLoad($system)) {
             // 如果加载失败,就不要做后面的操作了
             printLog('load theme [' . $activeTheme . '] failed', 'PLUGIN', \Core\Log\Base::DEBUG);
             unset($instance);
             continue;
         }
         global $f3;
         if ($f3->get('DEBUG')) {
             printLog('load theme [' . $activeTheme . '] success', 'PLUGIN', \Core\Log\Base::DEBUG);
         }
         // 把插件放入到列表中
         static::$pluginInstanceArray[$activeTheme] = $instance;
         unset($instance);
     }
 }