XPressME Integration Kit

Trac


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.