/** * Page のアクション. * * @return void */ public function action() { // パラメーター管理クラス $objFormParam = new SC_FormParam_Ex(); $mode = $this->getMode(); // パラメーター情報の初期化 $this->initParam($objFormParam, $mode); $objFormParam->setParam($_POST); switch ($mode) { // インストール case 'install': $file_key = 'plugin_file'; $this->arrErr = $this->checkUploadFile($file_key); if ($this->isError($this->arrErr) === false) { $archive_file_name = $_FILES[$file_key]['name']; // インストール処理. $this->arrErr = $this->installPlugin($archive_file_name, 'plugin_file'); if ($this->isError($this->arrErr) === false) { // コンパイルファイルのクリア処理 SC_Utils_Ex::clearCompliedTemplate(); $this->tpl_onload = "alert('プラグインをインストールしました。');"; } } break; // 削除 // 削除 case 'uninstall': // エラーチェック $this->arrErr = $objFormParam->checkError(); if ($this->isError($this->arrErr) === false) { $plugin_id = $objFormParam->getValue('plugin_id'); $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); $this->arrErr = $this->uninstallPlugin($plugin); if ($this->isError($this->arrErr) === false) { // TODO 全プラグインのインスタンスを保持したまま後続処理が実行されるので、全てのインスタンスを解放する。 unset($GLOBALS['_SC_Helper_Plugin_instance']); // コンパイルファイルのクリア処理 SC_Utils_Ex::clearCompliedTemplate(); $this->tpl_onload = "alert('" . $plugin['plugin_name'] . "を削除しました。');"; } } break; // 有効化 // 有効化 case 'enable': // エラーチェック $this->arrErr = $objFormParam->checkError(); if ($this->isError($this->arrErr) === false) { $plugin_id = $objFormParam->getValue('plugin_id'); // プラグイン取得. $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); $this->arrErr = $this->enablePlugin($plugin); if ($this->isError($this->arrErr) === false) { // TODO 全プラグインのインスタンスを保持したまま後続処理が実行されるので、全てのインスタンスを解放する。 unset($GLOBALS['_SC_Helper_Plugin_instance']); // コンパイルファイルのクリア処理 SC_Utils_Ex::clearCompliedTemplate(); $this->tpl_onload = "alert('" . $plugin['plugin_name'] . "を有効にしました。');"; } } break; // 無効化 // 無効化 case 'disable': // エラーチェック $this->arrErr = $objFormParam->checkError(); if ($this->isError($this->arrErr) === false) { $plugin_id = $objFormParam->getValue('plugin_id'); // プラグイン取得. $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); $this->arrErr = $this->disablePlugin($plugin); if ($this->isError($this->arrErr) === false) { // TODO 全プラグインのインスタンスを保持したまま後続処理が実行されるので、全てのインスタンスを解放する。 unset($GLOBALS['_SC_Helper_Plugin_instance']); // コンパイルファイルのクリア処理 SC_Utils_Ex::clearCompliedTemplate(); $this->tpl_onload = "alert('" . $plugin['plugin_name'] . "を無効にしました。');"; } } break; // アップデート. // アップデート. case 'update': // エラーチェック $this->arrErr = $objFormParam->checkError(); if ($this->isError($this->arrErr) === false) { $plugin_id = $objFormParam->getValue('plugin_id'); $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); $target_plugin_code = $plugin['plugin_code']; // アップデート対象のプラグインコード $this->arrErr = $this->checkUploadFile($target_plugin_code); if ($this->isError($this->arrErr) === false) { $update_plugin_file = $_FILES[$target_plugin_code]; $update_plugin_file_name = $update_plugin_file['name']; // アップデートファイルのファイル名. // インストール処理. $target_plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($target_plugin_code); $this->arrErr = $this->updatePlugin($target_plugin, $update_plugin_file_name, $target_plugin_code); if ($this->isError($this->arrErr) === false) { // コンパイルファイルのクリア処理 SC_Utils_Ex::clearCompliedTemplate(); $this->tpl_onload = "alert('プラグインをアップデートしました。');"; } } } break; // 優先度. // 優先度. case 'priority': // エラーチェック $arrErr = $objFormParam->checkError(); $plugin_id = $objFormParam->getValue('plugin_id'); if ($this->isError($arrErr) === false) { // 優先度の更新 $priority = $objFormParam->getValue('priority'); $this->updatePriority($plugin_id, $priority); // コンパイルファイルのクリア処理 SC_Utils_Ex::clearCompliedTemplate(); } else { // エラーメッセージを詰め直す. $this->arrErr['priority'][$plugin_id] = $arrErr['priority']; } break; default: break; } // DBからプラグイン情報を取得 $plugins = SC_Plugin_Util_Ex::getAllPlugin(); foreach ($plugins as $key => $plugin) { // ロゴファイルへのパスを生成(ロゴが無い場合はNO_IMAGEを表示) if (file_exists(PLUGIN_HTML_REALDIR . $plugins[$key]['plugin_code'] . '/logo.png') === true) { $plugins[$key]['logo'] = ROOT_URLPATH . 'plugin/' . $plugins[$key]['plugin_code'] . '/logo.png'; } else { $plugins[$key]['logo'] = IMAGE_SAVE_URLPATH . 'noimage_plugin_list.png'; } // 設定ファイルがあるかを判定. $plugins[$key]['config_flg'] = $this->isContainsFile(PLUGIN_UPLOAD_REALDIR . $plugin['plugin_code'], 'config.php'); if ($plugins[$key]['enable'] === PLUGIN_ENABLE_TRUE) { // 競合するプラグインがあるかを判定. //$plugins[$key]['conflict_message']= $this->checkConflictPlugin($plugin['plugin_id']); $plugins[$key]['conflict_message'] = SC_Plugin_Util_Ex::checkConflictPlugin($plugin['plugin_id']); } } $this->plugins = $plugins; }
/** * 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; }