Changeset 21775
- Timestamp:
- 2012/04/22 13:57:45 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_Transform.php
r21767 r21775 37 37 protected $arrSelectElements; 38 38 protected $html_source; 39 protected $header_source; 40 protected $footer_source; 39 41 protected $search_depth; 40 42 … … 56 58 $this->arrSelectElements = array(); 57 59 $this->html_source = $source; 60 $this->header_source = NULL; 61 $this->footer_source = NULL; 58 62 $this->search_depth = 0; 59 63 … … 61 65 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', true, 'テンプレートの文字コードがUTF-8ではありません'); 62 66 } 63 67 68 // Smartyのコメントを削除 69 $source = preg_replace( 70 '/<\!--{\*.+?\*\}-->/s', 71 '', 72 $source 73 ); 64 74 // JavaScript内にSmartyのタグが存在するものを、コメント形式に置換 65 75 $source = preg_replace_callback( … … 81 91 ); 82 92 93 // BODYタグの外側は退避させる 94 if (preg_match('/^(.*?<body[^>]*>)(.+)(<\/body>.*)$/is', $source, $arrMatches)) { 95 $this->header_source = $arrMatches[1]; 96 $source = $arrMatches[2]; 97 $this->footer_source = $arrMatches[3]; 98 } 99 83 100 $source = '<meta http-equiv="content-type" content="text/html; charset=UTF-8" /><html><body><!--TemplateTransformer start-->'.$source.'<!--TemplateTransformer end--></body></html>'; 84 101 @$this->objDOM->loadHTML($source); … … 294 311 } elseif ($this->snip_count) { 295 312 $html = $this->objDOM->saveHTML(); 296 $html = str_replace($this->arrSmartyTagsSub, $this->arrSmartyTagsOrg, $html);297 313 $html = preg_replace('/^.*<\!--TemplateTransformer start-->/s', '', $html); 298 314 $html = preg_replace('/<\!--TemplateTransformer end-->.*$/s', '', $html); 315 $html = $this->header_source.$html.$this->footer_source; 316 $html = str_replace($this->arrSmartyTagsSub, $this->arrSmartyTagsOrg, $html); 299 317 return $html; 300 318 } else {
Note: See TracChangeset
for help on using the changeset viewer.