Changeset 21681 for branches/version-2_12-dev
- Timestamp:
- 2012/03/26 20:32:15 (12 years ago)
- Location:
- branches/version-2_12-dev
- Files:
-
- 2 added
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_Plugin.php
r21672 r21681 50 50 if ($plugin_activate_flg === false) return; 51 51 // 有効なプラグインを取得 52 $arrPluginDataList = $this->getEnablePlugin();52 $arrPluginDataList = SC_Plugin_Util_Ex::getEnablePlugin(); 53 53 // pluginディレクトリを取得 54 $arrPluginDirectory = $this->getPluginDirectory(); 55 54 $arrPluginDirectory = SC_Plugin_Util_Ex::getPluginDirectory(); 56 55 foreach ($arrPluginDataList as $arrPluginData) { 57 56 // プラグイン本体ファイル名が取得したプラグインディレクトリ一覧にある事を確認 … … 112 111 } 113 112 } 114 }115 116 /**117 * 稼働中のプラグインを取得する。118 */119 function getEnablePlugin() {120 $objQuery = new SC_Query_Ex();121 $col = '*';122 $table = 'dtb_plugin';123 $where = 'enable = 1';124 // XXX 2.11.0 互換のため125 $arrCols = $objQuery->listTableFields($table);126 if (in_array('priority', $arrCols)) {127 $objQuery->setOrder('priority DESC, plugin_id ASC');128 }129 $arrRet = $objQuery->select($col,$table,$where);130 return $arrRet;131 }132 133 /**134 * インストールされているプラグインを取得する。135 *136 * @return array $arrRet インストールされているプラグイン.137 */138 function getAllPlugin() {139 $objQuery = new SC_Query_Ex();140 $col = '*';141 $table = 'dtb_plugin';142 // XXX 2.11.0 互換のため143 $arrCols = $objQuery->listTableFields($table);144 if (in_array('priority', $arrCols)) {145 $objQuery->setOrder('plugin_id ASC');146 }147 $arrRet = $objQuery->select($col,$table);148 return $arrRet;149 }150 151 /**152 * プラグインIDをキーにプラグインを取得する。153 *154 * @param int $plugin_id プラグインID.155 * @return array プラグインの基本情報.156 */157 function getPluginByPluginId($plugin_id) {158 $objQuery =& SC_Query_Ex::getSingletonInstance();159 $col = '*';160 $table = 'dtb_plugin';161 $where = 'plugin_id = ?';162 $plugin = $objQuery->getRow($col, $table, $where, array($plugin_id));163 return $plugin;164 }165 166 /**167 * プラグインコードをキーにプラグインを取得する。168 *169 * @param string $plugin_code プラグインコード.170 * @return array プラグインの基本情報.171 */172 function getPluginByPluginCode($plugin_code) {173 $objQuery =& SC_Query_Ex::getSingletonInstance();174 $col = '*';175 $table = 'dtb_plugin';176 $where = 'plugin_code = ?';177 $plugin = $objQuery->getRow($col, $table, $where, array($plugin_code));178 return $plugin;179 }180 181 /**182 * プラグインIDをキーにプラグインを削除する。183 *184 * @param string $plugin_id プラグインID.185 * @return array プラグインの基本情報.186 */187 function deletePluginByPluginId($plugin_id) {188 $objQuery =& SC_Query_Ex::getSingletonInstance();189 $objQuery->begin();190 $where = 'plugin_id = ?';191 $objQuery->delete('dtb_plugin', $where, array($plugin_id));192 $objQuery->delete('dtb_plugin_hookpoint', $where, array($plugin_id));193 }194 195 /**196 * プラグインディレクトリの取得197 *198 * @return array $arrPluginDirectory199 */200 function getPluginDirectory() {201 $arrPluginDirectory = array();202 if (is_dir(PLUGIN_UPLOAD_REALDIR)) {203 if ($dh = opendir(PLUGIN_UPLOAD_REALDIR)) {204 while (($pluginDirectory = readdir($dh)) !== false) {205 $arrPluginDirectory[] = $pluginDirectory;206 }207 closedir($dh);208 }209 }210 return $arrPluginDirectory;211 113 } 212 114 -
branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Plugin.php
r21670 r21681 99 99 if ($this->isError($this->arrErr) === false) { 100 100 $plugin_id = $objFormParam->getValue('plugin_id'); 101 $plugin = SC_ Helper_Plugin_Ex::getPluginByPluginId($plugin_id);101 $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); 102 102 $this->arrErr = $this->uninstallPlugin($plugin); 103 103 if ($this->isError($this->arrErr) === false) { … … 116 116 $plugin_id = $objFormParam->getValue('plugin_id'); 117 117 // プラグイン取得. 118 $plugin = SC_ Helper_Plugin_Ex::getPluginByPluginId($plugin_id);118 $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); 119 119 $this->arrErr = $this->enablePlugin($plugin); 120 120 if ($this->isError($this->arrErr) === false) { … … 132 132 $plugin_id = $objFormParam->getValue('plugin_id'); 133 133 // プラグイン取得. 134 $plugin = SC_ Helper_Plugin_Ex::getPluginByPluginId($plugin_id);135 $this->arrErr = $this->disablePlugin($plugin); 134 $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); 135 $this->arrErr = $this->disablePlugin($plugin); 136 136 if ($this->isError($this->arrErr) === false) { 137 137 // コンパイルファイルのクリア処理 … … 153 153 $update_plugin_file_name = $update_plugin_file['name']; // アップデートファイルのファイル名. 154 154 // インストール処理. 155 $target_plugin = SC_ Helper_Plugin_Ex::getPluginByPluginCode($target_plugin_code);155 $target_plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($target_plugin_code); 156 156 $this->arrErr = $this->updatePlugin($target_plugin, $update_plugin_file_name, $target_plugin_code); 157 157 if ($this->isError($this->arrErr) === false) { … … 183 183 break; 184 184 } 185 186 185 // DBからプラグイン情報を取得 187 $plugins = SC_ Helper_Plugin_Ex::getAllPlugin();186 $plugins = SC_Plugin_Util_Ex::getAllPlugin(); 188 187 189 188 foreach ($plugins as $key => $plugin) { … … 260 259 */ 261 260 function isInstalledPlugin($plugin_code) { 262 $plugin = SC_ Helper_Plugin_Ex::getPluginByPluginCode($plugin_code);261 $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($plugin_code); 263 262 if (!empty($plugin)) { 264 263 return true; … … 374 373 375 374 // プラグイン情報を取得 376 $plugin = SC_ Helper_Plugin_Ex::getPluginByPluginCode($plugin_code);375 $plugin = SC_Plugin_Util_Ex::getPluginByPluginCode($plugin_code); 377 376 378 377 // クラスファイルを読み込み. … … 410 409 SC_Utils_Ex::deleteFile($temp_dir, false); 411 410 // DBからプラグイン情報を削除 412 if(empty($plugin_id) === false) SC_ Helper_Plugin_Ex::deletePluginByPluginId($plugin_id);411 if(empty($plugin_id) === false) SC_Plugin_Util_Ex::deletePluginByPluginId($plugin_id); 413 412 // htmlディレクトリを削除 414 413 if(empty($plugin_html_dir) === false) SC_Utils_Ex::deleteFile($plugin_html_dir, true); -
branches/version-2_12-dev/data/class/plugin/SC_Plugin_Util.php
r21490 r21681 23 23 24 24 // 棒グラフ生成クラス 25 class SC_Graph_Bar extends SC_Graph_Line{ 26 // コンストラクタ 27 function SC_Graph_Line( 28 $bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, 29 $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) { 30 parent::SC_Graph_Line($bgw, $bgh, $left, $top, $area_width, $area_height); 25 class SC_Plugin_Util { 26 27 28 29 /** 30 * 稼働中のプラグインを取得する。 31 */ 32 function getEnablePlugin() { 33 $objQuery = new SC_Query_Ex(); 34 $col = '*'; 35 $table = 'dtb_plugin'; 36 $where = 'enable = 1'; 37 // XXX 2.11.0 互換のため 38 $arrCols = $objQuery->listTableFields($table); 39 if (in_array('priority', $arrCols)) { 40 $objQuery->setOrder('priority DESC, plugin_id ASC'); 41 } 42 $arrRet = $objQuery->select($col,$table,$where); 43 return $arrRet; 31 44 } 32 45 33 // グラフの描画 34 function drawGraph() { 35 $this->drawYLine(); 36 $this->drawXLine(true); 37 38 // 棒グラフの描画 39 for ($i = 0; $i < $this->line_max; $i++) { 40 $this->drawBar($i); 46 /** 47 * インストールされているプラグインを取得する。 48 * 49 * @return array $arrRet インストールされているプラグイン. 50 */ 51 function getAllPlugin() { 52 $objQuery = new SC_Query_Ex(); 53 $col = '*'; 54 $table = 'dtb_plugin'; 55 // XXX 2.11.0 互換のため 56 $arrCols = $objQuery->listTableFields($table); 57 if (in_array('priority', $arrCols)) { 58 $objQuery->setOrder('plugin_id ASC'); 41 59 } 42 43 // ラベルの描画 44 for ($i = 0; $i < $this->line_max; $i++) { 45 $this->drawLabel($i); 46 } 47 48 // 凡例の描画 49 $this->drawLegend(); 60 $arrRet = $objQuery->select($col,$table); 61 return $arrRet; 50 62 } 51 63 52 // 棒グラフの描画 53 function drawBar($line_no) { 54 $arrPointList = $this->arrPointList[$line_no]; 55 // データ数を数える 56 $count = count($arrPointList); 57 // 半目盛りの幅を求める 58 $half_scale = intval($this->area_width / ($count + 1) / 2); 59 // 目盛りの幅を求める 60 $scale_width = intval($this->area_width / ($count + 1)); 61 // 棒グラフのサイズを求める 62 $bar_width = intval(($scale_width - (BAR_PAD * 2)) / $this->line_max); 63 // 色数の取得 64 $c_max = count($this->arrColor); 65 for ($i = 0; $i < $count; $i++) { 66 $left = $arrPointList[$i][0] - $half_scale + BAR_PAD + ($bar_width * $line_no); 67 $top = $arrPointList[$i][1]; 68 $right = $left + $bar_width; 69 $bottom = $this->top + $this->area_height; 70 71 // 影の描画 72 if ($this->shade_on) { 73 imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom, $this->shade_color); 74 } 75 //imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[($i % $c_max)]); 76 imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->arrColor[$line_no]); 77 imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color); 78 } 64 /** 65 * プラグインIDをキーにプラグインを取得する。 66 * 67 * @param int $plugin_id プラグインID. 68 * @return array プラグインの基本情報. 69 */ 70 function getPluginByPluginId($plugin_id) { 71 $objQuery =& SC_Query_Ex::getSingletonInstance(); 72 $col = '*'; 73 $table = 'dtb_plugin'; 74 $where = 'plugin_id = ?'; 75 $plugin = $objQuery->getRow($col, $table, $where, array($plugin_id)); 76 return $plugin; 77 } 78 79 80 /** 81 * プラグインコードをキーにプラグインを取得する。 82 * 83 * @param string $plugin_code プラグインコード. 84 * @return array プラグインの基本情報. 85 */ 86 function getPluginByPluginCode($plugin_code) { 87 $objQuery =& SC_Query_Ex::getSingletonInstance(); 88 $col = '*'; 89 $table = 'dtb_plugin'; 90 $where = 'plugin_code = ?'; 91 $plugin = $objQuery->getRow($col, $table, $where, array($plugin_code)); 92 return $plugin; 79 93 } 80 94 81 // ラベルを描画する 82 function drawLabel($line_no) { 83 $arrData = $this->arrDataList[$line_no]; 84 $arrPointList = $this->arrPointList[$line_no]; 85 $count = count($arrPointList); 86 for ($i = 0; $i < $count; $i++) { 87 $x = $arrPointList[$i][0]; 88 $y = $arrPointList[$i][1]; 89 $text_width = $this->getTextWidth(number_format($arrData[$i]), FONT_SIZE); 90 $y_pos = $y - FONT_SIZE - 5; 91 $x_pos = $x - $text_width / 2; 92 $this->setText(FONT_SIZE, $x_pos, $y_pos, number_format($arrData[$i])); 93 } 95 /** 96 * プラグインIDをキーにプラグインを削除する。 97 * 98 * @param string $plugin_id プラグインID. 99 * @return array プラグインの基本情報. 100 */ 101 function deletePluginByPluginId($plugin_id) { 102 $objQuery =& SC_Query_Ex::getSingletonInstance(); 103 $objQuery->begin(); 104 $where = 'plugin_id = ?'; 105 $objQuery->delete('dtb_plugin', $where, array($plugin_id)); 106 $objQuery->delete('dtb_plugin_hookpoint', $where, array($plugin_id)); 94 107 } 95 108 109 /** 110 * プラグインディレクトリの取得 111 * 112 * @return array $arrPluginDirectory 113 */ 114 function getPluginDirectory() { 115 $arrPluginDirectory = array(); 116 if (is_dir(PLUGIN_UPLOAD_REALDIR)) { 117 if ($dh = opendir(PLUGIN_UPLOAD_REALDIR)) { 118 while (($pluginDirectory = readdir($dh)) !== false) { 119 $arrPluginDirectory[] = $pluginDirectory; 120 } 121 closedir($dh); 122 } 123 } 124 return $arrPluginDirectory; 125 } 96 126 } -
branches/version-2_12-dev/data/class_extends/plugin_extends/SC_Plugin_Util_Ex.php
r21420 r21681 22 22 */ 23 23 24 require_once CLASS_REALDIR . ' SC_AdminView.php';24 require_once CLASS_REALDIR . 'plugin/SC_Plugin_Util.php'; 25 25 26 class SC_ AdminView_Ex extends SC_AdminView{26 class SC_Plugin_Util_Ex extends SC_Plugin_Util { 27 27 } -
branches/version-2_12-dev/html/admin/load_plugin_config.php
r21671 r21681 40 40 41 41 GC_Utils::gfPrintLog('loading plugin ====> plugin_id = ' . $plugin_id); 42 $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance(false); 43 $plugin = $objPlugin->getPluginByPluginId($plugin_id); 42 $plugin = SC_Plugin_Util_Ex::getPluginByPluginId($plugin_id); 44 43 45 44 if (isset($plugin['plugin_code'])) {
Note: See TracChangeset
for help on using the changeset viewer.