XPressME Integration Kit

Trac

Changeset 431


Ignore:
Timestamp:
Nov 7, 2009, 8:41:56 PM (14 years ago)
Author:
toemon
Message:

パターンマッチしない場合のトラップを設けていなかった所を修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/include/xpress_render.php

    r422 r431  
    1111 
    1212        $pattern = "<head[^>]*?>(.*)<\/head>"; 
    13         preg_match("/".$pattern."/s",  $body_cut, $head_matches); 
    14         $head_str = $head_matches[1]; 
    15          
     13        $head_str = ''; 
     14        if (preg_match("/".$pattern."/s",  $body_cut, $head_matches)){ 
     15                $head_str = $head_matches[1]; 
     16        } 
    1617        $pattern = '<head[^>]*?>'; 
    1718        $head_str = preg_replace("/".$pattern."/s" , '' , $head_str); 
     
    5152{ 
    5253        $pattern = '<title[^>]*?>(.*)<\s*\/\s*title\s*>'; 
    53         preg_match("/".$pattern."/i",  $contents, $head_matches); 
    54         $title_str = $head_matches[1]; 
     54        $title_str = ''; 
     55        if (preg_match("/".$pattern."/i",  $contents, $head_matches)){ 
     56                $title_str = $head_matches[1]; 
     57        } 
    5558        return $title_str; 
    5659} 
     
    5962{ 
    6063        $pattern = '<\s*meta\s+name\s*=\s*["\']' . $name . '["\']\s*content\s*=\s*[\'"](.*)[\'"]\s*\/\s*>'; 
    61         preg_match("/".$pattern."/i",  $contents, $head_matches); 
    62         $meta = $head_matches[1]; 
     64        $meta = ''; 
     65        if (preg_match("/".$pattern."/i",  $contents, $head_matches)){ 
     66                $meta = @$head_matches[1]; 
     67        } 
    6368        return $meta; 
    6469} 
     
    8994        $xpess_config = new XPressME_Class(); 
    9095        $pattern = "<body[^>]*?>(.*)<\/body>"; 
    91         preg_match("/".$pattern."/s",  $contents, $body_matches); 
    92         $body = $body_matches[1]; 
    93  
     96        $body = ''; 
     97        if(preg_match("/".$pattern."/s",  $contents, $body_matches)){ 
     98                $body = $body_matches[1]; 
     99        } 
    94100        if (!$xpess_config->is_theme_sidebar_disp){ 
    95101                $side_panel = get_sidebar_rander(); 
     
    216222        $xpress_data['body_contents'] = get_body($contents); 
    217223        // used $GLOBALS. becose xpress_left_arrow_post_link() and xpress_right_arrow_post_link() is other loop in this position 
    218         $xpress_data['left_post_link'] = $GLOBALS['left_arrow_post_link']; 
    219         $xpress_data['right_post_link'] = $GLOBALS['right_arrow_post_link']; 
     224        $xpress_data['left_post_link'] = @$GLOBALS['left_arrow_post_link']; 
     225        $xpress_data['right_post_link'] = @$GLOBALS['right_arrow_post_link']; 
    220226        $xpress_data['left_posts_link'] =  str_replace('&laquo;','',xpress_left_arrow_posts_link('echo=0')); 
    221227        $xpress_data['right_posts_link'] = str_replace('&raquo;','',xpress_right_arrow_posts_link('echo=0')); 
Note: See TracChangeset for help on using the changeset viewer.