Timber\URLHelper::remove_double_slashes PHP 메소드

remove_double_slashes() 공개 정적인 메소드

public static remove_double_slashes ( string $url ) : string
$url string
리턴 string
    public static function remove_double_slashes($url)
    {
        $url = str_replace('//', '/', $url);
        if (strstr($url, 'http:') && !strstr($url, 'http://')) {
            $url = str_replace('http:/', 'http://', $url);
        }
        return $url;
    }

Usage Example

예제 #1
0
파일: Image.php 프로젝트: mrgrain/timber
 /**
  * @internal
  * @param string $url
  */
 protected function init_with_url($url)
 {
     $this->abs_url = $url;
     if (URLHelper::is_local($url)) {
         $this->file = URLHelper::remove_double_slashes(ABSPATH . URLHelper::get_rel_url($url));
         $this->file_loc = URLHelper::remove_double_slashes(ABSPATH . URLHelper::get_rel_url($url));
     }
 }