XPressME Integration Kit

Trac


Ignore:
Timestamp:
Aug 22, 2010, 10:45:50 PM (14 years ago)
Author:
toemon
Message:

allow_url_fopen=Offのときナビアイコンを指定しても表示されないバグ修正。 Fixes#360

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php

    r630 r638  
    311311        $output = str_replace('">','" title="'.$on_mouse_show . '">' , $ret); 
    312312 
    313         if (!empty($xpress_config->post_left_arrow_image_link) && ($fp = fopen($xpress_config->post_left_arrow_image_link, "r"))){ 
     313        if (icon_exists($xpress_config->post_left_arrow_image_link)){ 
    314314                $img_link = str_replace($link_title,"<img src=\"$xpress_config->post_left_arrow_image_link\" align=\"absmiddle\"/>",$GLOBALS['left_arrow_post_link']); 
    315315                $img_link = str_replace('rel=','title="'.$on_mouse_show.'" rel=',$img_link); 
     
    387387        $output = str_replace('">','" title="'.$on_mouse_show . '">' , $ret); 
    388388 
    389  
    390         if (!empty($xpress_config->post_right_arrow_image_link) && ($fp = fopen($xpress_config->post_right_arrow_image_link, "r"))){ 
     389        if (icon_exists($xpress_config->post_right_arrow_image_link)){ 
    391390                $img_link = str_replace($link_title,"<img src=\"$xpress_config->post_right_arrow_image_link\" align=\"absmiddle\"/>",$GLOBALS['right_arrow_post_link']); 
    392391                $img_link = str_replace('rel=','title="'.$on_mouse_show.'" rel=',$img_link); 
     
    426425        } 
    427426         
    428         if (!empty($xpress_config->page_left_arrow_image_link) && ($fp = fopen($xpress_config->page_left_arrow_image_link, "r"))){ 
     427        if (icon_exists($xpress_config->page_left_arrow_image_link)){ 
    429428                $output = $img_link . str_replace('&laquo;','' , $output); 
    430429                $img_link = str_replace($link_title,"<img src=\"$xpress_config->page_left_arrow_image_link\" align=\"absmiddle\"/>",$output); 
     
    438437} 
    439438 
     439 
    440440function xpress_right_arrow_posts_link($args ='') 
    441441{ 
     
    464464        } 
    465465         
    466         if (!empty($xpress_config->page_right_arrow_image_link) && ($fp = fopen($xpress_config->page_right_arrow_image_link, "r"))){ 
     466        if (icon_exists($xpress_config->page_right_arrow_image_link)){ 
    467467                $output = $img_link . str_replace('&raquo;','' , $output); 
    468468                $img_link = str_replace($link_title,"<img src=\"$xpress_config->page_right_arrow_image_link\" align=\"absmiddle\"/>",$output); 
     
    483483        return ( strlen($str) - $start <= $length ) ? substr( $str, $start, $length ) : substr( $str, $start, $length - strlen($trimmarker) ) . $trimmarker; 
    484484    } 
     485} 
     486 
     487function icon_exists($str = '') 
     488{ 
     489        global $xpress_config; 
     490        $root_path = $_SERVER['DOCUMENT_ROOT']; 
     491        $root_pattern = str_replace(".","\.",$root_path); 
     492        $root_pattern = '/'. str_replace("/","\/",$root_pattern) . '/'; 
     493        $host = str_replace(".","\.",$_SERVER['SERVER_NAME']); 
     494        $pattern = "/https?:\/\/{$host}/"; 
     495        if (preg_match($pattern,$str)){ 
     496                $str = preg_replace($pattern,$root_path,$str); 
     497        } else if (!preg_match($root_pattern,$str)){ 
     498                $str = $root_path.$str; 
     499        } 
     500        return file_exists($str); 
    485501} 
    486502 
Note: See TracChangeset for help on using the changeset viewer.