Ignore:
Timestamp:
2013/05/02 18:11:36 (13 years ago)
Author:
h_yoshimoto
Message:

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Transform.php

    r22567 r22796  
    2828 * @version $Id$ 
    2929 */ 
    30 class SC_Helper_Transform  
    31 { 
     30class SC_Helper_Transform { 
    3231    protected $objDOM; 
    3332    protected $arrSmartyTagsOrg; 
     
    5049     * @return void 
    5150     */ 
    52     public function __construct($source) 
    53     { 
     51    public function __construct($source) { 
    5452        $this->objDOM = new DOMDocument(); 
    5553        $this->objDOM->strictErrorChecking = false; 
     
    134132     * @return SC_Helper_Transformオブジェクト 
    135133     */ 
    136     public function select($selector, $index = NULL, $require = true, $err_msg = NULL) 
    137     { 
     134    public function select($selector, $index = NULL, $require = true, $err_msg = NULL) { 
    138135        $this->arrSelectElements = array(); 
    139136        $this->search_depth = 0; 
     
    175172     * @return SC_Helper_Transformオブジェクト 
    176173     */ 
    177     public function find($selector, $index = NULL, $require = true, $err_msg = NULL) 
    178     { 
     174    public function find($selector, $index = NULL, $require = true, $err_msg = NULL) { 
    179175        $arrParentElements = $this->arrSelectElements[$this->search_depth]; 
    180176        $this->search_depth++; 
     
    216212     * @return SC_Helper_Transformオブジェクト 
    217213     */ 
    218     public function end($back_num = 1) 
    219     { 
     214    public function end($back_num = 1) { 
    220215        if ($this->search_depth >= $back_num) { 
    221216            $this->search_depth -= $back_num; 
     
    234229     * @return SC_Helper_Transformオブジェクト 
    235230     */ 
    236     public function insertBefore($html_snip) 
    237     { 
     231    public function insertBefore($html_snip) { 
    238232        foreach ($this->arrSelectElements[$this->search_depth] as $key => $objElement) { 
    239233            $this->lfSetTransform('insertBefore', $objElement[0], $html_snip); 
     
    249243     * @return SC_Helper_Transformオブジェクト 
    250244     */ 
    251     public function insertAfter($html_snip) 
    252     { 
     245    public function insertAfter($html_snip) { 
    253246        foreach ($this->arrSelectElements[$this->search_depth] as $key => $objElement) { 
    254247            $this->lfSetTransform('insertAfter', $objElement[0], $html_snip); 
     
    264257     * @return SC_Helper_Transformオブジェクト 
    265258     */ 
    266     public function appendFirst($html_snip) 
    267     { 
     259    public function appendFirst($html_snip) { 
    268260        foreach ($this->arrSelectElements[$this->search_depth] as $key => $objElement) { 
    269261            $this->lfSetTransform('appendFirst', $objElement[0], $html_snip); 
     
    279271     * @return SC_Helper_Transformオブジェクト 
    280272     */ 
    281     public function appendChild($html_snip) 
    282     { 
     273    public function appendChild($html_snip) { 
    283274        foreach ($this->arrSelectElements[$this->search_depth] as $key => $objElement) { 
    284275            $this->lfSetTransform('appendChild', $objElement[0], $html_snip); 
     
    294285     * @return SC_Helper_Transformオブジェクト 
    295286     */ 
    296     public function replaceElement($html_snip) 
    297     { 
     287    public function replaceElement($html_snip) { 
    298288        foreach ($this->arrSelectElements[$this->search_depth] as $key => &$objElement) { 
    299289            $this->lfSetTransform('replaceElement', $objElement[0], $html_snip); 
     
    308298     * @return SC_Helper_Transformオブジェクト 
    309299     */ 
    310     public function removeElement() 
    311     { 
     300    public function removeElement() { 
    312301        foreach ($this->arrSelectElements[$this->search_depth] as $key => &$objElement) { 
    313302            $this->lfSetTransform('replaceElement', $objElement[0], ''); 
     
    322311     * @return string トランスフォーム済みHTML。まったくトランスフォームが行われなかった場合は元のHTMLを返す。。 
    323312     */ 
    324     public function getHTML() 
    325     { 
     313    public function getHTML() { 
    326314        if (count($this->arrErr)) { 
    327315            // エラーメッセージ組み立て 
     
    370358     * @return string 代わりの文字列 
    371359     */ 
    372     protected function lfCaptureSmartyTags2Comment(array $arrMatches) 
    373     { 
     360    protected function lfCaptureSmartyTags2Comment(array $arrMatches) { 
    374361        $substitute_tag = sprintf('<!--###%08d###-->', $this->smarty_tags_idx); 
    375362        $this->arrSmartyTagsOrg[$this->smarty_tags_idx] = $arrMatches[0]; 
     
    388375     * @return string 代わりの文字列 
    389376     */ 
    390     protected function lfCaptureHeadTags2Comment(array $arrMatches) 
    391     { 
     377    protected function lfCaptureHeadTags2Comment(array $arrMatches) { 
    392378        $substitute_tag = sprintf('<!--###%08d###-->', $this->smarty_tags_idx); 
    393379        $this->arrSmartyTagsOrg[$this->smarty_tags_idx] = $arrMatches[2]; 
     
    412398     * @return string 代わりの文字列 
    413399     */ 
    414     protected function lfCaptureSmartyTagsInTag(array $arrMatches) 
    415     { 
     400    protected function lfCaptureSmartyTagsInTag(array $arrMatches) { 
    416401        // Smartyタグ内のクォートを処理しやすいよう、いったんダミーのタグに 
    417402        $html = preg_replace_callback('/<\!--{.+?\}-->/s', array($this, 'lfCaptureSmartyTags2Temptag'), $arrMatches[0]); 
     
    430415     * @return string 代わりの文字列 
    431416     */ 
    432     protected function lfCaptureSmartyTags2Temptag(array $arrMatches) 
    433     { 
     417    protected function lfCaptureSmartyTags2Temptag(array $arrMatches) { 
    434418        $substitute_tag = sprintf('###TEMP%08d###', $this->smarty_tags_idx); 
    435419        $this->arrSmartyTagsOrg[$this->smarty_tags_idx] = $arrMatches[0]; 
     
    448432     * @return string 代わりの文字列 
    449433     */ 
    450     protected function lfCaptureSmartyTagsInQuote(array $arrMatches) 
    451     { 
     434    protected function lfCaptureSmartyTagsInQuote(array $arrMatches) { 
    452435        $html = preg_replace_callback( 
    453436            '/###TEMP(\d{8})###/s', 
     
    467450     * @return string 代わりの文字列 
    468451     */ 
    469     protected function lfCaptureSmartyTags2Value(array $arrMatches) 
    470     { 
     452    protected function lfCaptureSmartyTags2Value(array $arrMatches) { 
    471453        $tag_idx = (int)$arrMatches[1]; 
    472454        $substitute_tag = sprintf('###%08d###', $tag_idx); 
     
    484466     * @return string 代わりの文字列 
    485467     */ 
    486     protected function lfCaptureSmartyTags2Attr(array $arrMatches) 
    487     { 
     468    protected function lfCaptureSmartyTags2Attr(array $arrMatches) { 
    488469        $tag_idx = (int)$arrMatches[1]; 
    489470        $substitute_tag = sprintf('rel%08d="######"', $tag_idx); 
     
    499480     * @return void 
    500481     */ 
    501     protected function lfScanChild(DOMNode $objDOMElement, $parent_selector = '') 
    502     { 
     482    protected function lfScanChild(DOMNode $objDOMElement, $parent_selector = '') { 
    503483        $objNodeList = $objDOMElement->childNodes; 
    504484        if (is_null($objNodeList)) return; 
     
    536516     * @return string 正規表現文字列 
    537517     */ 
    538     protected function lfSelector2Regex($selector, $parent_index = NULL) 
    539     { 
     518    protected function lfSelector2Regex($selector, $parent_index = NULL){ 
    540519        // jQueryライクなセレクタを正規表現に 
    541520        $selector = preg_replace('/ *> */', ' >', $selector);   // 子セレクタをツリー検索用に 「A >B」の記法にする 
     
    572551     * @return void 
    573552     */ 
    574     protected function lfAddElement($elementNo, array &$arrElement) 
    575     { 
     553    protected function lfAddElement($elementNo, array &$arrElement) { 
    576554        if (is_array($this->arrSelectElements[$this->search_depth]) && array_key_exists($arrElement[0], $this->arrSelectElements[$this->search_depth])) { 
    577555            //nop 
     
    591569     * @return boolean 
    592570     */ 
    593     protected function lfSetTransform($mode, $target_key, $html_snip) 
    594     { 
     571    protected function lfSetTransform($mode, $target_key, $html_snip) { 
    595572 
    596573        $substitute_tag = sprintf('<!--###%08d###-->', $this->smarty_tags_idx); 
     
    658635     * @return void 
    659636     */ 
    660     protected function lfSetError($selector, $type, $err_msg = NULL) 
    661     { 
     637    protected function lfSetError($selector, $type, $err_msg = NULL) { 
    662638        $this->arrErr[] = array( 
    663639            'selector'    => $selector, 
Note: See TracChangeset for help on using the changeset viewer.