XPressME Integration Kit

Trac


Ignore:
Timestamp:
Aug 23, 2010, 10:01:59 AM (14 years ago)
Author:
toemon
Message:

ナビアイコン設定時、ソースが有効であるかチェックする Fixes#361

Location:
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include
Files:
2 edited

Legend:

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

    r638 r639  
    483483        return ( strlen($str) - $start <= $length ) ? substr( $str, $start, $length ) : substr( $str, $start, $length - strlen($trimmarker) ) . $trimmarker; 
    484484    } 
    485 } 
    486  
    487 function 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); 
    501485} 
    502486 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/xpress_common_functions.php

    r583 r639  
    417417} 
    418418 
     419function icon_exists($str = '') 
     420{ 
     421        global $xpress_config; 
     422        if (empty($str)) return false; 
     423        $root_path = $_SERVER['DOCUMENT_ROOT']; 
     424        $root_pattern = str_replace(".","\.",$root_path); 
     425        $root_pattern = '/'. str_replace("/","\/",$root_pattern) . '/'; 
     426        $host = str_replace(".","\.",$_SERVER['SERVER_NAME']); 
     427        $pattern = "/https?:\/\/{$host}/"; 
     428        if (preg_match($pattern,$str)){ 
     429                $str = preg_replace($pattern,$root_path,$str); 
     430        } else if (!preg_match($root_pattern,$str)){ 
     431                $str = $root_path.$str; 
     432        } 
     433        return file_exists($str); 
     434} 
    419435?> 
Note: See TracChangeset for help on using the changeset viewer.