Changeset 4912

Show
Ignore:
Timestamp:
12/29/07 02:56:10 (3 years ago)
Author:
inureyes
Message:

#779

  • 스킨 캐시 구현
  • 덤으로 pageCache 루틴에 초기화 루틴 하나 끼워 넣었습니다.
Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/components/Needlworks.Cache.PageCache.php

    r4910 r4912  
    1919    var $absoluteFilePathGuest; 
    2020    var $error;*/ 
    21  
     21    function pageCache($name = null){ 
     22        $this->reset(); 
     23        if($name != null) $this->name = $name; 
     24    } 
    2225    function reset() { 
    2326        $this->name =  
  • trunk/lib/blog.skin.php

    r4863 r4912  
    8282    function Skin($name, $previewMode = false) { 
    8383        global $service, $blogURL, $suri, $blog; 
    84          
    8584        //$this->noneCommentMessage = getBlogSetting('noneCommentMessage'); 
    8685        //$this->singleCommentMessage = getBlogSetting('singleCommentMessage'); 
    8786        //$this->noneTrackbackMessage = getBlogSetting('noneTrackbackMessage'); 
    8887        //$this->singleTrackbackMessage = getBlogSetting('singleTrackbackMessage'); 
    89         $this->noneCommentMessage = $blog['noneCommentMessage']; 
    90         $this->singleCommentMessage = $blog['singleCommentMessage']; 
    91         $this->noneTrackbackMessage = $blog['noneTrackbackMessage']; 
    92         $this->singleTrackbackMessage = $blog['singleTrackbackMessage']; 
    93          
    94         if (strncmp($name, 'customize/', 10) == 0) { 
    95             $name = "customize/".getBlogId(); 
    96         } else { 
    97             $name = Path::getBaseName($name); 
    98         } 
    99          
    100         if (($name == '.') || ($name == '..')) { 
    101             respondErrorPage(_text('스킨 정보가 존재하지 않습니다.'), _text('로그인'), $blogURL."/owner"); 
    102         } 
    103          
    104         $filename = ROOT . "/skin/$name/skin.html"; 
    105          
    106         if (!is_file($filename)) { 
    107             respondErrorPage(_text('스킨 정보가 존재하지 않습니다.'), _text('로그인'), $blogURL."/owner"); 
    108         } 
    109          
    110         if (!$sval = file_get_contents($filename)) 
    111             respondErrorPage(_text('스킨 정보가 존재하지 않습니다.'), _text('로그인'), $blogURL."/owner"); 
    112  
    113         addMicroformats($sval); 
    114         replaceSkinTag($sval, 'html'); 
    115         replaceSkinTag($sval, 'head'); 
    116         replaceSkinTag($sval, 'body'); 
    117         insertGeneratorVersion($sval); 
    118         handleTags($sval); 
    119          
    120         // 사이드바 작업. 
    121         $sidebarCount = 0; 
    122         $noNameCount = 1; 
    123         // - 사이드바가 여러개일 수 있으므로 루프로 돌린다. 
    124         while (strpos($sval, '<s_sidebar>') !== false) { 
    125             if (!isset($this->sidebarBasicModules[$sidebarCount])) 
    126                 $this->sidebarBasicModules[$sidebarCount] = array(); 
    127             list($sval, $this->sidebarOriginalContent[$sidebarCount]) = $this->cutSkinTag($sval, "sidebar", "[##_sidebar_{$sidebarCount}_##]"); 
    128              
    129             $moduleCount = 0; 
    130             $matchcount = preg_match_all('@<s_sidebar_element>.*</s_sidebar_element>@isU', $this->sidebarOriginalContent[$sidebarCount], $matches); 
    131             if ($matchcount !== false) { 
    132                 $rgSidebarContent = $matches[0];     
    133             } else { 
    134                 $rgSidebarContent = array(); 
    135             } 
    136              
    137             for ($i=0; $i<count($rgSidebarContent); $i++) { 
    138                 $taglength = 19; //strlen('<s_sidebar_element>'); 
    139                 $rgSidebarContent[$i] = substr($rgSidebarContent[$i], $taglength, strlen($rgSidebarContent[$i]) - 39);//2*$taglength - 1); 
    140                 // - 각 모듈을 나중에 가져다 쓰기 위해 기본 모듈 배열 안에 저장한다. 
    141                 preg_match("/<!\-\-(.+)\-\->/", $rgSidebarContent[$i], $temp); 
     88        if($previewMode == true || !$this->loadCache()) { 
     89            $this->noneCommentMessage = $blog['noneCommentMessage']; 
     90            $this->singleCommentMessage = $blog['singleCommentMessage']; 
     91            $this->noneTrackbackMessage = $blog['noneTrackbackMessage']; 
     92            $this->singleTrackbackMessage = $blog['singleTrackbackMessage']; 
     93             
     94            if (strncmp($name, 'customize/', 10) == 0) { 
     95                $name = "customize/".getBlogId(); 
     96            } else { 
     97                $name = Path::getBaseName($name); 
     98            } 
     99             
     100            if (($name == '.') || ($name == '..')) { 
     101                respondErrorPage(_text('스킨 정보가 존재하지 않습니다.'), _text('로그인'), $blogURL."/owner"); 
     102            } 
     103             
     104            $filename = ROOT . "/skin/$name/skin.html"; 
     105             
     106            if (!is_file($filename)) { 
     107                respondErrorPage(_text('스킨 정보가 존재하지 않습니다.'), _text('로그인'), $blogURL."/owner"); 
     108            } 
     109             
     110            if (!$sval = file_get_contents($filename)) 
     111                respondErrorPage(_text('스킨 정보가 존재하지 않습니다.'), _text('로그인'), $blogURL."/owner"); 
     112     
     113            addMicroformats($sval); 
     114            replaceSkinTag($sval, 'html'); 
     115            replaceSkinTag($sval, 'head'); 
     116            replaceSkinTag($sval, 'body'); 
     117            insertGeneratorVersion($sval); 
     118            handleTags($sval); 
     119             
     120            // 사이드바 작업. 
     121            $sidebarCount = 0; 
     122            $noNameCount = 1; 
     123            // - 사이드바가 여러개일 수 있으므로 루프로 돌린다. 
     124            while (strpos($sval, '<s_sidebar>') !== false) { 
     125                if (!isset($this->sidebarBasicModules[$sidebarCount])) 
     126                    $this->sidebarBasicModules[$sidebarCount] = array(); 
     127                list($sval, $this->sidebarOriginalContent[$sidebarCount]) = $this->cutSkinTag($sval, "sidebar", "[##_sidebar_{$sidebarCount}_##]"); 
     128                 
     129                $moduleCount = 0; 
     130                $matchcount = preg_match_all('@<s_sidebar_element>.*</s_sidebar_element>@isU', $this->sidebarOriginalContent[$sidebarCount], $matches); 
     131                if ($matchcount !== false) { 
     132                    $rgSidebarContent = $matches[0];     
     133                } else { 
     134                    $rgSidebarContent = array(); 
     135                } 
     136                 
     137                for ($i=0; $i<count($rgSidebarContent); $i++) { 
     138                    $taglength = 19; //strlen('<s_sidebar_element>'); 
     139                    $rgSidebarContent[$i] = substr($rgSidebarContent[$i], $taglength, strlen($rgSidebarContent[$i]) - 39);//2*$taglength - 1); 
     140                    // - 각 모듈을 나중에 가져다 쓰기 위해 기본 모듈 배열 안에 저장한다. 
     141                    preg_match("/<!\-\-(.+)\-\->/", $rgSidebarContent[$i], $temp); 
     142                    if (isset($temp[1])) { 
     143                        $tempTitle = trim($temp[1]); 
     144                    } else { 
     145                        $tempTitle = _f('(이름 없음 %1)', $noNameCount); //$rgSidebarContent[$i]; 
     146                        $noNameCount++; 
     147                    } 
     148                    $this->sidebarBasicModules[$sidebarCount][$moduleCount] = array('title' => $tempTitle, 'body' => $rgSidebarContent[$i]); 
     149                    $moduleCount++; 
     150                } 
     151                $matchcount = preg_match('@<s_sidebar_element>@', $this->sidebarOriginalContent[$sidebarCount],$matches, PREG_OFFSET_CAPTURE); 
     152                if (($matchcount === false) || ($matchcount == 0)) { 
     153                    $firstPos = strlen($this->sidebarOriginalContent[$sidebarCount]); 
     154                } else { 
     155                    $firstPos = $matches[0][1]; 
     156                } 
     157                preg_match("/<!\-\-(.+)\-\->/", substr($this->sidebarOriginalContent[$sidebarCount],0,$firstPos - 1), $temp); 
    142158                if (isset($temp[1])) { 
    143159                    $tempTitle = trim($temp[1]); 
    144160                } else { 
    145                     $tempTitle = _f('(이름 없음 %1)', $noNameCount); //$rgSidebarContent[$i]; 
    146                     $noNameCount++; 
     161                    $tempTitle = _t('사이드바') . ' ' . ($sidebarCount + 1); 
    147162                } 
    148                 $this->sidebarBasicModules[$sidebarCount][$moduleCount] = array('title' => $tempTitle, 'body' => $rgSidebarContent[$i]); 
    149                 $moduleCount++; 
    150             } 
    151             $matchcount = preg_match('@<s_sidebar_element>@', $this->sidebarOriginalContent[$sidebarCount],$matches, PREG_OFFSET_CAPTURE); 
    152             if (($matchcount === false) || ($matchcount == 0)) { 
    153                 $firstPos = strlen($this->sidebarOriginalContent[$sidebarCount]); 
    154             } else { 
    155                 $firstPos = $matches[0][1]; 
    156             } 
    157             preg_match("/<!\-\-(.+)\-\->/", substr($this->sidebarOriginalContent[$sidebarCount],0,$firstPos - 1), $temp); 
    158             if (isset($temp[1])) { 
    159                 $tempTitle = trim($temp[1]); 
    160             } else { 
    161                 $tempTitle = _t('사이드바') . ' ' . ($sidebarCount + 1); 
    162             } 
    163             $this->sidebarName[$sidebarCount] = $tempTitle; 
    164             $sidebarCount++; 
    165         } 
    166  
    167         handleSidebars($sval, $this, $previewMode); 
    168  
    169         // 표지 작업. 
    170         $this->coverpageBasicModules[0] = array(); 
    171         $this->coverpageName[0] =_t('표지'); 
    172  
    173         if((empty($suri['value'])  
    174             && $suri["directive"] == "/"  
    175             && $suri['page'] == 1  
    176             && getBlogSetting("coverpageInitView")) || 
    177             $suri['directive'] == "/cover"){ 
     163                $this->sidebarName[$sidebarCount] = $tempTitle; 
     164                $sidebarCount++; 
     165            } 
     166     
     167            handleSidebars($sval, $this, $previewMode); 
     168     
     169            // 표지 작업. 
     170            $this->coverpageBasicModules[0] = array(); 
     171            $this->coverpageName[0] =_t('표지'); 
     172     
     173            //if((empty($suri['value'])  
     174            //  && $suri["directive"] == "/"  
     175            //  && $suri['page'] == 1  
     176            //  && getBlogSetting("coverpageInitView")) || 
     177            //  $suri['directive'] == "/cover"){ 
    178178            handleCoverpages($sval, $this, $previewMode); 
    179         } 
    180  
    181         $sval = str_replace('./', "{$service['path']}/skin/$name/", $sval); 
    182  
    183         $this->noneCommentMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->noneCommentMessage); 
    184         $this->singleCommentMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->singleCommentMessage); 
    185         $this->noneTrackbackMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->noneTrackbackMessage); 
    186         $this->singleTrackbackMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->singleTrackbackMessage); 
    187  
    188  
    189         list($sval, $this->coverItem) = $this->cutSkinTag($sval, 'cover_rep'); 
    190         list($sval, $this->cover) = $this->cutSkinTag($sval, 'cover'); 
    191  
    192         list($sval, $this->listItem) = $this->cutSkinTag($sval, 'list_rep'); 
    193         list($sval, $this->list) = $this->cutSkinTag($sval, 'list'); 
    194         list($sval, $this->commentListItem) = $this->cutSkinTag($sval, 'rplist_rep'); 
    195         list($sval, $this->commentList) = $this->cutSkinTag($sval, 'rplist'); 
    196         list($sval, $this->trackbackListItem) = $this->cutSkinTag($sval, 'tblist_rep'); 
    197         list($sval, $this->trackbackList) = $this->cutSkinTag($sval, 'tblist'); 
    198         list($sval, $this->rss_rep) = $this->cutSkinTag($sval, 'rss_rep'); 
    199         list($sval, $this->rss_date) = $this->cutSkinTag($sval, 'rss_date'); 
    200         list($sval, $this->rss) = $this->cutSkinTag($sval, 'rss'); 
    201         list($sval, $this->keywordItem) = $this->cutSkinTag($sval, 'keyword_rep'); 
    202         list($sval, $this->keywordGroup) = $this->cutSkinTag($sval, 'keyword_date_rep'); 
    203         list($sval, $this->keyword) = $this->cutSkinTag($sval, 'keyword'); 
    204         list($sval, $this->noticeItem) = $this->cutSkinTag($sval, 'notice_rep'); 
    205         list($sval, $this->keylogItem) = $this->cutSkinTag($sval, 'keylog_rep'); 
    206         list($sval, $this->recentNoticeItem) = $this->cutSkinTag($sval, 'rct_notice_rep'); 
    207         list($sval, $this->recentNotice) = $this->cutSkinTag($sval, 'rct_notice'); 
    208         list($sval, $this->locativeEntry) = $this->cutSkinTag($sval, 'local_info_rep'); 
    209         list($sval, $this->locativeSpot) = $this->cutSkinTag($sval, 'local_spot_rep'); 
    210         list($sval, $this->locative) = $this->cutSkinTag($sval, 'local'); 
    211  
    212         list($sval, $this->guestSubContainer) = $this->cutSkinTag($sval, 'guest_reply_container'); 
    213         if ($this->guestSubContainer == '') { 
    214             $this->guestSubContainer = '[##_guest_reply_rep_##]'; 
    215             list($sval, $this->guestSubItem) = $this->cutSkinTag($sval, 'guest_reply_rep', '[##_guest_reply_container_##]'); 
    216         } else { 
    217             list($this->guestSubContainer, $this->guestSubItem) = $this->cutSkinTag($this->guestSubContainer, 'guest_reply_rep'); 
    218         } 
    219         list($sval, $this->guestContainer) = $this->cutSkinTag($sval, 'guest_container'); 
    220         if ($this->guestContainer == '') { 
    221             $this->guestContainer = '[##_guest_rep_##]'; 
    222             list($sval, $this->guestItem) = $this->cutSkinTag($sval, 'guest_rep', '[##_guest_container_##]'); 
    223         } else { 
    224             list($this->guestContainer, $this->guestItem) = $this->cutSkinTag($this->guestContainer, 'guest_rep'); 
    225         } 
    226          
    227         list($sval, $this->guestGuest) = $this->cutSkinTag($sval, 'guest_form'); 
    228         list($sval, $this->guestMember) = $this->cutSkinTag($sval, 'guest_member'); 
    229         list($sval, $this->guestForm) = $this->cutSkinTag($sval, 'guest_input_form'); 
    230         list($sval, $this->guest) = $this->cutSkinTag($sval, 'guest'); 
    231         list($sval, $this->entryProtected) = $this->cutSkinTag($sval, 'article_protected'); 
    232         list($sval, $this->management) = $this->cutSkinTag($sval, 'ad_div'); 
    233         list($sval, $this->trackbackCount) = $this->cutSkinTag($sval, 'tb_count'); 
    234         if ($this->trackbackCount == '') { 
    235             list($sval, $this->trackbackCount) = $this->cutSkinReplacer($sval, 'article_rep_tb_cnt','[##_tb_count_##]'); 
    236             $this->noneTrackbackMessage = ''; 
    237             $this->singleTrackbackMessage = ''; 
    238         } 
    239         list($sval, $this->commentCount) = $this->cutSkinTag($sval, 'rp_count'); 
    240         if ($this->commentCount == '') { 
    241             list($sval, $this->commentCount) = $this->cutSkinReplacer($sval, 'article_rep_rp_cnt','[##_rp_count_##]'); 
    242             $this->noneCommentMessage = ''; 
    243             $this->singleCommentMessage = ''; 
    244         } 
    245          
    246         list($sval, $this->trackbackContainer) = $this->cutSkinTag($sval, 'tb_container'); 
    247         if ($this->trackbackContainer == '') { 
    248             $this->trackbackContainer = '[##_tb_rep_##]'; 
    249             list($sval, $this->trackback) = $this->cutSkinTag($sval, 'tb_rep', '[##_tb_container_##]'); 
    250         } else { 
    251             list($this->trackbackContainer, $this->trackback) = $this->cutSkinTag($this->trackbackContainer, 'tb_rep'); 
    252         }        
    253          
    254         list($sval, $this->trackbacks) = $this->cutSkinTag($sval, 'tb'); 
    255         list($sval, $this->tagLabel) = $this->cutSkinTag($sval, 'tag_label'); 
    256         list($sval, $this->siteTagItem) = $this->cutSkinTag($sval, 'tag_rep'); 
    257         list($sval, $this->siteTag) = $this->cutSkinTag($sval, 'tag'); 
    258         list($sval, $this->randomTags) = $this->cutSkinTag($sval, 'random_tags'); 
    259          
    260         list($sval, $this->commentSubContainer) = $this->cutSkinTag($sval, 'rp2_container'); 
    261         if ($this->commentSubContainer == '') { 
    262             $this->commentSubContainer = '[##_rp2_rep_##]'; 
    263             list($sval, $this->commentSubItem) = $this->cutSkinTag($sval, 'rp2_rep', '[##_rp2_container_##]'); 
    264         } else { 
    265             list($this->commentSubContainer, $this->commentSubItem) = $this->cutSkinTag($this->commentSubContainer, 'rp2_rep'); 
    266         } 
    267         list($sval, $this->commentContainer) = $this->cutSkinTag($sval, 'rp_container'); 
    268         if ($this->commentContainer == '') { 
    269             $this->commentContainer = '[##_rp_rep_##]'; 
    270             list($sval, $this->commentItem) = $this->cutSkinTag($sval, 'rp_rep', '[##_rp_container_##]'); 
    271         } else { 
    272             list($this->commentContainer, $this->commentItem) = $this->cutSkinTag($this->commentContainer, 'rp_rep'); 
    273         } 
    274          
    275         list($sval, $this->commentGuest) = $this->cutSkinTag($sval, 'rp_guest'); 
    276         list($sval, $this->commentMember) = $this->cutSkinTag($sval, 'rp_member'); 
    277         list($sval, $this->commentForm) = $this->cutSkinTag($sval, 'rp_input_form'); 
    278         list($sval, $this->comment) = $this->cutSkinTag($sval, 'rp'); 
    279          
    280         list($sval, $this->pageError) = $this->cutSkinTag($sval, 'page_error');  
    281         list($sval, $this->entry) = $this->cutSkinTag($sval, 'article_rep'); 
    282         list($sval, $this->pagingItem) = $this->cutSkinTag($sval, 'paging_rep'); 
    283         list($sval, $this->paging) = $this->cutSkinTag($sval, 'paging'); 
    284         list($sval, $this->archive) = $this->cutSkinTag($sval, 'archive_rep'); 
    285         list($sval, $this->search) = $this->cutSkinTag($sval, 'search'); 
    286         list($sval, $this->authorList) = $this->cutSkinTag($sval, 'author_rep'); 
    287         list($sval, $this->recentEntry) = $this->cutSkinTag($sval, 'rctps_rep'); 
    288         list($sval, $this->recentComments) = $this->cutSkinTag($sval, 'rctrp_rep'); 
    289         list($sval, $this->recentTrackback) = $this->cutSkinTag($sval, 'rcttb_rep'); 
    290         list($sval, $this->s_link_rep) = $this->cutSkinTag($sval, 'link_rep'); 
    291         list($sval, $this->skin) = $this->cutSkinTag($sval, 't3'); 
    292         list($sval, $this->pageTitle) = $this->cutSkinTag($sval, 'page_title'); 
    293         $this->outter = $sval; 
     179            //} 
     180     
     181            $sval = str_replace('./', "{$service['path']}/skin/$name/", $sval); 
     182     
     183            $this->noneCommentMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->noneCommentMessage); 
     184            $this->singleCommentMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->singleCommentMessage); 
     185            $this->noneTrackbackMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->noneTrackbackMessage); 
     186            $this->singleTrackbackMessage = str_replace('./', "{$service['path']}/skin/$name/", $this->singleTrackbackMessage); 
     187     
     188     
     189            list($sval, $this->coverItem) = $this->cutSkinTag($sval, 'cover_rep'); 
     190            list($sval, $this->cover) = $this->cutSkinTag($sval, 'cover'); 
     191     
     192            list($sval, $this->listItem) = $this->cutSkinTag($sval, 'list_rep'); 
     193            list($sval, $this->list) = $this->cutSkinTag($sval, 'list'); 
     194            list($sval, $this->commentListItem) = $this->cutSkinTag($sval, 'rplist_rep'); 
     195            list($sval, $this->commentList) = $this->cutSkinTag($sval, 'rplist'); 
     196            list($sval, $this->trackbackListItem) = $this->cutSkinTag($sval, 'tblist_rep'); 
     197            list($sval, $this->trackbackList) = $this->cutSkinTag($sval, 'tblist'); 
     198            list($sval, $this->rss_rep) = $this->cutSkinTag($sval, 'rss_rep'); 
     199            list($sval, $this->rss_date) = $this->cutSkinTag($sval, 'rss_date'); 
     200            list($sval, $this->rss) = $this->cutSkinTag($sval, 'rss'); 
     201            list($sval, $this->keywordItem) = $this->cutSkinTag($sval, 'keyword_rep'); 
     202            list($sval, $this->keywordGroup) = $this->cutSkinTag($sval, 'keyword_date_rep'); 
     203            list($sval, $this->keyword) = $this->cutSkinTag($sval, 'keyword'); 
     204            list($sval, $this->noticeItem) = $this->cutSkinTag($sval, 'notice_rep'); 
     205            list($sval, $this->keylogItem) = $this->cutSkinTag($sval, 'keylog_rep'); 
     206            list($sval, $this->recentNoticeItem) = $this->cutSkinTag($sval, 'rct_notice_rep'); 
     207            list($sval, $this->recentNotice) = $this->cutSkinTag($sval, 'rct_notice'); 
     208            list($sval, $this->locativeEntry) = $this->cutSkinTag($sval, 'local_info_rep'); 
     209            list($sval, $this->locativeSpot) = $this->cutSkinTag($sval, 'local_spot_rep'); 
     210            list($sval, $this->locative) = $this->cutSkinTag($sval, 'local'); 
     211     
     212            list($sval, $this->guestSubContainer) = $this->cutSkinTag($sval, 'guest_reply_container'); 
     213            if ($this->guestSubContainer == '') { 
     214                $this->guestSubContainer = '[##_guest_reply_rep_##]'; 
     215                list($sval, $this->guestSubItem) = $this->cutSkinTag($sval, 'guest_reply_rep', '[##_guest_reply_container_##]'); 
     216            } else { 
     217                list($this->guestSubContainer, $this->guestSubItem) = $this->cutSkinTag($this->guestSubContainer, 'guest_reply_rep'); 
     218            } 
     219            list($sval, $this->guestContainer) = $this->cutSkinTag($sval, 'guest_container'); 
     220            if ($this->guestContainer == '') { 
     221                $this->guestContainer = '[##_guest_rep_##]'; 
     222                list($sval, $this->guestItem) = $this->cutSkinTag($sval, 'guest_rep', '[##_guest_container_##]'); 
     223            } else { 
     224                list($this->guestContainer, $this->guestItem) = $this->cutSkinTag($this->guestContainer, 'guest_rep'); 
     225            } 
     226             
     227            list($sval, $this->guestGuest) = $this->cutSkinTag($sval, 'guest_form'); 
     228            list($sval, $this->guestMember) = $this->cutSkinTag($sval, 'guest_member'); 
     229            list($sval, $this->guestForm) = $this->cutSkinTag($sval, 'guest_input_form'); 
     230            list($sval, $this->guest) = $this->cutSkinTag($sval, 'guest'); 
     231            list($sval, $this->entryProtected) = $this->cutSkinTag($sval, 'article_protected'); 
     232            list($sval, $this->management) = $this->cutSkinTag($sval, 'ad_div'); 
     233            list($sval, $this->trackbackCount) = $this->cutSkinTag($sval, 'tb_count'); 
     234            if ($this->trackbackCount == '') { 
     235                list($sval, $this->trackbackCount) = $this->cutSkinReplacer($sval, 'article_rep_tb_cnt','[##_tb_count_##]'); 
     236                $this->noneTrackbackMessage = ''; 
     237                $this->singleTrackbackMessage = ''; 
     238            } 
     239            list($sval, $this->commentCount) = $this->cutSkinTag($sval, 'rp_count'); 
     240            if ($this->commentCount == '') { 
     241                list($sval, $this->commentCount) = $this->cutSkinReplacer($sval, 'article_rep_rp_cnt','[##_rp_count_##]'); 
     242                $this->noneCommentMessage = ''; 
     243                $this->singleCommentMessage = ''; 
     244            } 
     245             
     246            list($sval, $this->trackbackContainer) = $this->cutSkinTag($sval, 'tb_container'); 
     247            if ($this->trackbackContainer == '') { 
     248                $this->trackbackContainer = '[##_tb_rep_##]'; 
     249                list($sval, $this->trackback) = $this->cutSkinTag($sval, 'tb_rep', '[##_tb_container_##]'); 
     250            } else { 
     251                list($this->trackbackContainer, $this->trackback) = $this->cutSkinTag($this->trackbackContainer, 'tb_rep'); 
     252            }        
     253             
     254            list($sval, $this->trackbacks) = $this->cutSkinTag($sval, 'tb'); 
     255            list($sval, $this->tagLabel) = $this->cutSkinTag($sval, 'tag_label'); 
     256            list($sval, $this->siteTagItem) = $this->cutSkinTag($sval, 'tag_rep'); 
     257            list($sval, $this->siteTag) = $this->cutSkinTag($sval, 'tag'); 
     258            list($sval, $this->randomTags) = $this->cutSkinTag($sval, 'random_tags'); 
     259             
     260            list($sval, $this->commentSubContainer) = $this->cutSkinTag($sval, 'rp2_container'); 
     261            if ($this->commentSubContainer == '') { 
     262                $this->commentSubContainer = '[##_rp2_rep_##]'; 
     263                list($sval, $this->commentSubItem) = $this->cutSkinTag($sval, 'rp2_rep', '[##_rp2_container_##]'); 
     264            } else { 
     265                list($this->commentSubContainer, $this->commentSubItem) = $this->cutSkinTag($this->commentSubContainer, 'rp2_rep'); 
     266            } 
     267            list($sval, $this->commentContainer) = $this->cutSkinTag($sval, 'rp_container'); 
     268            if ($this->commentContainer == '') { 
     269                $this->commentContainer = '[##_rp_rep_##]'; 
     270                list($sval, $this->commentItem) = $this->cutSkinTag($sval, 'rp_rep', '[##_rp_container_##]'); 
     271            } else { 
     272                list($this->commentContainer, $this->commentItem) = $this->cutSkinTag($this->commentContainer, 'rp_rep'); 
     273            } 
     274             
     275            list($sval, $this->commentGuest) = $this->cutSkinTag($sval, 'rp_guest'); 
     276            list($sval, $this->commentMember) = $this->cutSkinTag($sval, 'rp_member'); 
     277            list($sval, $this->commentForm) = $this->cutSkinTag($sval, 'rp_input_form'); 
     278            list($sval, $this->comment) = $this->cutSkinTag($sval, 'rp'); 
     279             
     280            list($sval, $this->pageError) = $this->cutSkinTag($sval, 'page_error');  
     281            list($sval, $this->entry) = $this->cutSkinTag($sval, 'article_rep'); 
     282            list($sval, $this->pagingItem) = $this->cutSkinTag($sval, 'paging_rep'); 
     283            list($sval, $this->paging) = $this->cutSkinTag($sval, 'paging'); 
     284            list($sval, $this->archive) = $this->cutSkinTag($sval, 'archive_rep'); 
     285            list($sval, $this->search) = $this->cutSkinTag($sval, 'search'); 
     286            list($sval, $this->authorList) = $this->cutSkinTag($sval, 'author_rep'); 
     287            list($sval, $this->recentEntry) = $this->cutSkinTag($sval, 'rctps_rep'); 
     288            list($sval, $this->recentComments) = $this->cutSkinTag($sval, 'rctrp_rep'); 
     289            list($sval, $this->recentTrackback) = $this->cutSkinTag($sval, 'rcttb_rep'); 
     290            list($sval, $this->s_link_rep) = $this->cutSkinTag($sval, 'link_rep'); 
     291            list($sval, $this->skin) = $this->cutSkinTag($sval, 't3'); 
     292            list($sval, $this->pageTitle) = $this->cutSkinTag($sval, 'page_title'); 
     293            $this->outter = $sval; 
     294            $this->saveCache(); 
     295        } 
    294296    } 
    295297     
     
    322324        $outter = substr($contents, 0, $pos) . $replace . substr($contents, $pos + $tagSize); 
    323325        return array($outter, $inner); 
     326    } 
     327 
     328    function saveCache() { 
     329        $skinCache = get_object_vars($this); 
     330        $cache = new pageCache('skinCache'); 
     331        $cache->contents = serialize($skinCache); 
     332        $cache->update(); 
     333    } 
     334     
     335    function loadCache() { 
     336        $cache = new pageCache('skinCache'); 
     337        if(!$cache->load()) return false; 
     338        $skinCache = unserialize($cache->contents); 
     339        foreach($skinCache as $key=>$value) { 
     340            $this->$key = $value; 
     341        } 
     342    } 
     343 
     344    function purgeCache() { 
     345        $cache = new pageCache('skinCache'); 
     346        $cache->purge(); 
    324347    } 
    325348} 
  • trunk/lib/model/blog.skin.php

    r4822 r4912  
    188188    removeBlogSetting("sidebarOrder"); 
    189189    CacheControl::flushAll(); 
     190    Skin::purgeCache(); 
    190191    getSkinSetting($blogid, true); // refresh skin cache 
    191192    return true; 
     
    226227        @chmod(ROOT . "/skin/customize/$blogid/$file", 0666); 
    227228        CacheControl::flushAll(); 
     229        Skin::purgeCache(); 
    228230        return true; 
    229231    } 
     
    290292    CacheControl::flushCategory(); 
    291293    CacheControl::flushTag(); 
     294    Skin::purgeCache(); 
    292295    getSkinSetting($blogid, true); // refresh skin cache 
    293296    return true;