/**
  * 有効なプラグインのロード. プラグインエンジンが有効になっていない場合は
  * プラグインエンジン自身のインストール処理を起動する
  *
  * @return void
  */
 function load($plugin_activate_flg = true)
 {
     if (!defined('CONFIG_REALFILE') || !file_exists(CONFIG_REALFILE)) {
         return;
     }
     // インストール前
     if (GC_Utils_Ex::isInstallFunction()) {
         return;
     }
     // インストール中
     if ($plugin_activate_flg === false) {
         return;
     }
     // 有効なプラグインを取得
     $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin();
     // pluginディレクトリを取得
     $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory();
     foreach ($arrPluginDataList as $arrPluginData) {
         // プラグイン本体ファイル名が取得したプラグインディレクトリ一覧にある事を確認
         if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) {
             // プラグイン本体ファイルをrequire.
             require_once PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . '/' . $arrPluginData['class_name'] . '.php';
             // プラグインのインスタンス生成.
             $objPlugin = new $arrPluginData['class_name']($arrPluginData);
             // メンバ変数にプラグインのインスタンスを登録.
             $this->arrPluginInstances[$arrPluginData['plugin_id']] = $objPlugin;
             $this->arrPluginIds[] = $arrPluginData['plugin_id'];
             // ローカルフックポイントの登録.
             $this->registerLocalHookPoint($objPlugin, $arrPluginData['priority']);
             // スーパーフックポイントの登録.
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PREPROCESS, 'preProcess', $arrPluginData['priority']);
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PROCESS, 'process', $arrPluginData['priority']);
         }
     }
 }
Beispiel #2
0
 /**
  * 有効なプラグインのロード. プラグインエンジンが有効になっていない場合は
  * プラグインエンジン自身のインストール処理を起動する
  *
  * @return void
  */
 public function load($plugin_activate_flg = true)
 {
     if (!defined('CONFIG_REALFILE') || !file_exists(CONFIG_REALFILE)) {
         return;
     }
     // インストール前
     if (GC_Utils_Ex::isInstallFunction()) {
         return;
     }
     // インストール中
     if ($plugin_activate_flg === false) {
         return;
     }
     // 有効なプラグインを取得
     $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin();
     // pluginディレクトリを取得
     $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory();
     foreach ($arrPluginDataList as $arrPluginData) {
         // プラグイン本体ファイル名が取得したプラグインディレクトリ一覧にある事を確認
         if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) {
             $plugin_file_path = PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . '/' . $arrPluginData['class_name'] . '.php';
             // プラグイン本体ファイルが存在しない場合
             if (!file_exists($plugin_file_path)) {
                 // エラー出力
                 $msg = 'プラグイン本体ファイルが存在しない。当該プラグインを無視して続行する。';
                 $msg .= 'ファイル=' . var_export($plugin_file_path, true) . '; ';
                 trigger_error($msg, E_USER_WARNING);
                 // 次のプラグインへ続行
                 continue 1;
             }
             // プラグイン本体ファイルをrequire.
             require_once $plugin_file_path;
             // プラグインのインスタンス生成.
             $objPlugin = new $arrPluginData['class_name']($arrPluginData);
             // メンバ変数にプラグインのインスタンスを登録.
             $this->arrPluginInstances[$arrPluginData['plugin_id']] = $objPlugin;
             $this->arrPluginIds[] = $arrPluginData['plugin_id'];
             // ローカルフックポイントの登録.
             $this->registerLocalHookPoint($objPlugin, $arrPluginData['priority']);
             // スーパーフックポイントの登録.
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PREPROCESS, 'preProcess', $arrPluginData['priority']);
             $this->registerSuperHookPoint($objPlugin, HOOK_POINT_PROCESS, 'process', $arrPluginData['priority']);
         }
     }
 }
 /**
  * Get a list of locale files.
  *
  * @param   string  $lang_code      language code
  * @param   integer $device_type_id device type ID
  * @return  array   file list
  */
 function get_locale_file_list($lang_code, $device_type_id = FALSE)
 {
     $file_list = array();
     // Path to the EC-CUBE Core locale file.
     $core_locale_path = DATA_REALDIR . "locales/{$lang_code}.mo";
     // If a locale file of specified language is exist, add to the file list.
     if (file_exists($core_locale_path)) {
         $file_list[] = $core_locale_path;
     }
     // Get a list of enabled plugins.
     if (defined('ECCUBE_INSTALL')) {
         $arrPluginDataList = SC_Plugin_Util_Ex::getAllPlugin();
         // Get the plugins directory.
         $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory();
         foreach ($arrPluginDataList as $arrPluginData) {
             // Check that the plugin filename is contained in the list of plugins directory.
             if (array_search($arrPluginData['plugin_code'], $arrPluginDirectory) !== false) {
                 // Path to the plugin locale file.
                 $plugin_locale_path = PLUGIN_UPLOAD_REALDIR . $arrPluginData['plugin_code'] . "/locales/{$lang_code}.mo";
                 // If a locale file of specified language is exist, add to the file list.
                 if (file_exists($plugin_locale_path)) {
                     $file_list[] = $plugin_locale_path;
                 }
             }
         }
     }
     // Path to the template locale file.
     if ($device_type_id !== FALSE) {
         $template_locale_path = HTML_REALDIR . SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true) . "locales/{$lang_code}.mo";
         // If a locale file of specified language is exist, add to the file list.
         if (file_exists($template_locale_path)) {
             $file_list[] = $template_locale_path;
         }
     }
     return $file_list;
 }