BcUtil::getCurrentThemesPlugins PHP Method

getCurrentThemesPlugins() public static method

テーマ梱包プラグインのリストを取得する
public static getCurrentThemesPlugins ( ) : array
return array
    public static function getCurrentThemesPlugins()
    {
        $theme = Configure::read('BcSite.theme');
        $path = BASER_THEMES . $theme . DS . 'Plugin';
        if (is_dir($path)) {
            $Folder = new Folder($path);
            $files = $Folder->read(true, true, false);
            if (!empty($files[0])) {
                return $files[0];
            }
        }
        return array();
    }

Usage Example

Example #1
0
 protected function _applyTheme($theme)
 {
     $plugins = BcUtil::getCurrentThemesPlugins();
     // テーマ梱包のプラグインをアンインストール
     foreach ($plugins as $plugin) {
         $this->BcManager->uninstallPlugin($plugin);
     }
     $siteConfig['SiteConfig']['theme'] = $theme;
     $this->SiteConfig->saveKeyValue($siteConfig);
     clearViewCache();
     $info = array();
     $themePath = BASER_THEMES . $theme . DS;
     $Folder = new Folder($themePath . 'Plugin');
     $files = $Folder->read(true, true, false);
     if (!empty($files[0])) {
         $info = array_merge($info, array('このテーマは下記のプラグインを同梱しています。'));
         foreach ($files[0] as $file) {
             $info[] = '	・' . $file;
         }
     }
     Configure::write('BcSite.theme', $theme);
     $plugins = BcUtil::getCurrentThemesPlugins();
     App::build(array('Plugin' => array_merge(array(BASER_THEMES . $theme . DS . 'Plugin' . DS), App::path('Plugin'))));
     // テーマ梱包のプラグインをインストール
     foreach ($plugins as $plugin) {
         $this->BcManager->installPlugin($plugin);
     }
     $path = BcUtil::getDefaultDataPath('Core', $theme);
     if (strpos($path, '/theme/' . $theme . '/') !== false) {
         if ($info) {
             $info = array_merge($info, array(''));
         }
         $info = array_merge($info, array('このテーマは初期データを保有しています。', 'Webサイトにテーマに合ったデータを適用するには、初期データ読込を実行してください。'));
     }
     if (!$this->Page->createAllPageTemplate()) {
         $message = array('テーマ変更中にページテンプレートの生成に失敗しました。', '「Pages」フォルダに書き込み権限が付与されていない可能性があります。', '権限設定後、テーマの適用をやり直すか、表示できないページについて固定ページ管理より更新処理を行ってください。');
         if ($info) {
             $message = array_merge($message, array(''), $info);
         }
         $this->setMessage(implode('<br />', $message), true);
     } else {
         $message = array('テーマ「' . $theme . '」を適用しました。');
         if ($info) {
             $message = array_merge($message, array(''), $info);
         }
         $this->setMessage(implode('<br />', $message));
     }
     return true;
 }
All Usage Examples Of BcUtil::getCurrentThemesPlugins