Changeset 21509
- Timestamp:
- 2012/02/15 12:52:25 (11 years ago)
- Location:
- branches/version-2_12-dev/data/class
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/admin/system/LC_Page_Admin_System_Plugin.php
r21501 r21509 84 84 $plugin_file_name = $plugin_file['name']; 85 85 $plugin_code = $this->getPluginCode($plugin_file_name); 86 86 87 87 // 既に登録されていないか判定. 88 88 if ($this->isInstalledPlugin($plugin_code) === false) { … … 107 107 $plugin_id = $objFormParam->getValue('plugin_id'); 108 108 $plugin = SC_Helper_Plugin_Ex::getPluginByPluginId($plugin_id); 109 109 110 110 $this->arrErr = $this->uninstallPlugin($plugin_id, $plugin_code); 111 111 // 完了メッセージアラート設定. … … 193 193 $this->arrErr['priority'][$plugin_id] = $arrErr['priority']; 194 194 } 195 195 196 196 break; 197 197 default: … … 289 289 function checkPluginFile($file_path, $plugin_code, $key_file) { 290 290 $arrErr = array(); 291 291 292 292 // Archive_Tarを生成します. 293 293 $tar_obj = new Archive_Tar($file_path); 294 294 295 295 // 圧縮ファイル名とディレクトリ名が同一であるかを判定します. 296 296 if ($this->checkUploadFileName($tar_obj, $plugin_code) === false) { … … 385 385 return $arrErr; 386 386 } 387 387 388 388 // リフレクションオブジェクトを生成. 389 389 $objReflection = new ReflectionClass($plugin_code); … … 406 406 $plugin_html_dir = PLUGIN_HTML_REALDIR . $plugin_code; 407 407 $this->makeDir($plugin_html_dir); 408 408 409 409 $plugin = SC_Helper_Plugin_Ex::getPluginByPluginCode($plugin_code); 410 410 $arrErr = $this->execPlugin($plugin['plugin_id'], $plugin_code, 'install'); 411 411 412 412 return $arrErr; 413 413 } … … 537 537 $this->makeDir($unpack_dir); 538 538 $objUpFile->moveTempFile(); 539 539 540 540 // 解凍 541 541 $update_plugin_file_path = $unpack_dir . "/" . $unpack_file_name; … … 626 626 return $arrErr; 627 627 } 628 628 629 629 /** 630 630 * 優先度を更新します. -
branches/version-2_12-dev/data/class/plugin/SC_Plugin_TemplateSelector.php
r21500 r21509 49 49 } 50 50 51 52 51 /** 53 52 * 見つかった要素をプロパティに登録 … … 91 90 } 92 91 93 94 92 /** 95 93 * 要素の前にHTMLを挿入 … … 104 102 return $this; 105 103 } 106 107 104 108 105 /** … … 131 128 return $this; 132 129 } 133 134 130 135 131 /** 136 132 * 要素を指定したHTMLに置換 … … 145 141 return $this; 146 142 } 147 148 143 149 144 /** 150 145 * findで見つかったエレメントの数を返す … … 155 150 return count($this->arrElements); 156 151 } 157 158 159 160 152 } 161 162 ?> -
branches/version-2_12-dev/data/class/plugin/SC_Plugin_TemplateTransformList.php
r21500 r21509 154 154 * @return void 155 155 */ 156 function setHeadNavi($url) {156 function setHeadNavi($url) { 157 157 $this->arrHeadNaviBlocsByPlugin[$url] = TARGET_ID_HEAD; 158 158 } … … 164 164 * @return void 165 165 */ 166 function setHeadNaviBlocs(&$arrBlocs) {167 foreach ($this->arrHeadNaviBlocsByPlugin as $key => $value){166 function setHeadNaviBlocs(&$arrBlocs) { 167 foreach ($this->arrHeadNaviBlocsByPlugin as $key => $value) { 168 168 $arrBlocs[] = array( 169 169 'target_id' =>$value, … … 174 174 175 175 } 176 177 ?> -
branches/version-2_12-dev/data/class/plugin/SC_Plugin_TemplateTransformer.php
r21500 r21509 61 61 $html = file_get_contents(SMARTY_TEMPLATES_REALDIR . $tmpl); 62 62 $err_msg = null; 63 63 64 64 // 対象のパスが存在するかを検証する, 65 65 if ($html === false) { … … 68 68 $err_msg = $tmpl. "の文字コードがUTF-8ではありません"; 69 69 } 70 70 71 71 if (!is_null($err_msg)) { 72 72 // TODO エラー処理 … … 74 74 75 75 // JavaScript内にSmartyのタグが存在するものを、コメント形式に置換 76 77 78 79 80 76 $html = preg_replace_callback( 77 '/<script.+?\/script>/s', 78 array($this, 'captureSmartyTags2Comment'), 79 $html 80 ); 81 81 82 82 // HTMLタグ内にSmartyのタグが存在するものを、いったんダミーのタグに置換する … … 93 93 $html 94 94 ); 95 95 96 96 $html = '<meta http-equiv="content-type" content="text/html; charset=UTF-8" /><html><body><!--TemplateTransformer start-->'.$html.'<!--TemplateTransformer end--></body></html>'; 97 97 // TODO エラー処理 … … 213 213 function scanChild(DOMNode $objDOMElement, $parent_selector = '') { 214 214 $objNodeList = $objDOMElement->childNodes; 215 215 216 216 if (is_null($objNodeList)) return; 217 217 foreach ($objNodeList as $element) { 218 218 219 219 $arrAttr = array(); 220 220 // エレメントの場合、tag名を配列に入れる. … … 222 222 $arrAttr[] = $element->tagName; 223 223 } 224 224 225 225 // getAttributeメソッドを持つかを検証 226 226 if (method_exists($element, 'getAttribute')) { 227 227 // id属性を持つ場合. 228 if ($element->hasAttribute('id')) {228 if ($element->hasAttribute('id')) { 229 229 // idの値を配列に格納(ex: [0] => #hoge) 230 230 $arrAttr[] = '#'.$element->getAttribute('id'); … … 237 237 } 238 238 // name属性を持つ場合. 239 if ($element->hasAttribute('name')) {239 if ($element->hasAttribute('name')) { 240 240 $this->arrDomHash['name'][$element->getAttribute('name')][] = $element; 241 241 } … … 266 266 267 267 if (is_null($objSelector)) $objSelector = new SC_Plugin_TemplateSelector($this, $this->current_plugin); 268 268 269 269 // jQueryライクなセレクタを正規表現に 270 270 $selector = preg_replace('/ *> */', ' >', $selector); … … 274 274 // セレクターを配列にします. 275 275 $arrSelectors = explode(' ', $selector); 276 276 277 277 // セレクタから正規表現を生成. 278 278 foreach ($arrSelectors as $sub_selector) { … … 295 295 296 296 // エレメントツリーのセレクタを先ほど作成した正規表現で順に検索. 297 for ($iLoop=$startIndex; $iLoop < count($this->arrElementTree); $iLoop++){298 297 for ($iLoop=$startIndex; $iLoop < count($this->arrElementTree); $iLoop++) { 298 299 299 if (preg_match($regex, $this->arrElementTree[$iLoop][0])) { 300 300 if (is_null($index) || $cur_idx == $index) { … … 314 314 ); 315 315 } 316 316 317 317 return $objSelector; 318 318 } 319 319 320 320 /** 321 321 * DOMを用いた変形を実行する … … 327 327 */ 328 328 function setTransform($mode, $target_key, $html_snip) { 329 329 330 330 $substitute_tag = sprintf('<!--###%08d###-->', $this->smarty_tags_idx); 331 331 … … 333 333 $this->arrSmartyTagsSub[$this->smarty_tags_idx] = $substitute_tag; 334 334 $this->smarty_tags_idx++; 335 335 336 336 $objSnip = $this->objDOM->createDocumentFragment(); 337 337 $objSnip->appendXML($substitute_tag); 338 338 339 339 $objElement = false; 340 if (isset($this->arrElementTree[$target_key]) && $this->arrElementTree[$target_key][0]){340 if (isset($this->arrElementTree[$target_key]) && $this->arrElementTree[$target_key][0]) { 341 341 $objElement = &$this->arrElementTree[$target_key][1]; 342 342 } 343 343 344 344 if (!$objElement) return false; 345 345 346 346 try { 347 347 if ($mode == 'appendChild') { … … 351 351 $objElement->parentNode->insertBefore($objSnip, $objElement); 352 352 } elseif ($mode == 'insertAfter') { 353 354 355 356 357 353 if ($objElement->nextSibling) { 354 $objElement->parentNode->insertBefore($objSnip, $objElement->nextSibling); 355 } else { 356 $objElement->parentNode->appendChild($objSnip); 357 } 358 358 } elseif ($mode == 'replaceChild') { 359 359 if (!is_object($objElement->parentNode)) return false; … … 366 366 return true; 367 367 } 368 368 369 369 /** 370 370 * セレクタエラーを記録する … … 384 384 ); 385 385 } 386 386 387 387 /** 388 388 * HTMLに戻して、Transform用に付けたマーカーを削除し、Smartyのタグを復元する … … 407 407 // TODO エラー処理 408 408 // ECC_Plugin_Engine::dispError(FREE_ERROR_MSG, "テンプレートの操作に失敗しました。".$err_msg); 409 409 410 410 } elseif ($this->snip_count) { 411 411 $html = $this->objDOM->saveHTML(); … … 415 415 $html = preg_replace('/<\!--TemplateTransformer end-->.*$/s', '', $html); 416 416 return $html; 417 417 418 418 } else { 419 419 return false; 420 420 } 421 421 } 422 423 422 424 423 /** … … 434 433 $filepath = PLUGIN_TMPL_CACHE_REALDIR . $filename; 435 434 $dir = dirname($filepath); 436 435 437 436 if (!file_exists($dir)) mkdir($dir, PLUGIN_DIR_PERMISSION, true); 438 437 if (!file_put_contents($filepath, $html)) return false; … … 444 443 445 444 } 446 447 448 ?>
Note: See TracChangeset
for help on using the changeset viewer.