PHP 클래스 Timber\URLHelper

파일 보기 프로젝트 열기: jarednova/timber 1 사용 예제들

공개 메소드들

메소드 설명
file_system_to_url ( string $fs )
get_current_url ( ) : string
get_full_path ( string $src ) : string
get_host ( ) : string Some setups like HTTP_HOST, some like SERVER_NAME, it's complicated
get_params ( integer $i = false ) : array | string Returns the url parameters, for example for url http://example.org/blog/post/news/2014/whatever this will return array('blog', 'post', 'news', '2014', 'whatever'); OR if sent an integer like: TimberUrlHelper::get_params(2); this will return 'news';
get_path_base ( ) : string
get_rel_path ( string $src ) : string
get_rel_url ( string $url, boolean $force = false ) : string
get_scheme ( ) : string Get url scheme
is_absolute ( string $path ) : boolean This will evaluate wheter a URL is at an aboslute location (like http://example.org/whatever)
is_external ( string $url ) : boolean
is_external_content ( string $url ) : boolean This function is slightly different from the one below in the case of: an image hosted on the same domain BUT on a different site than the Wordpress install will be reported as external content.
is_local ( string $url ) : boolean
is_url ( string $url ) : boolean
prepend_to_url ( string $url, string $path ) : string
preslashit ( string $path ) : string
remove_double_slashes ( string $url ) : string
remove_trailing_slash ( string $link ) : string Pass links through untrailingslashit unless they are a single /
url_to_file_system ( string $url ) : string Takes a url and figures out its place based in the file system based on path NOTE: Not fool-proof, makes a lot of assumptions about the file path matching the URL path

비공개 메소드들

메소드 설명
is_internal_content ( string $url )

메소드 상세

file_system_to_url() 공개 정적인 메소드

public static file_system_to_url ( string $fs )
$fs string

get_current_url() 공개 정적인 메소드

public static get_current_url ( ) : string
리턴 string

get_full_path() 공개 정적인 메소드

public static get_full_path ( string $src ) : string
$src string
리턴 string

get_host() 공개 정적인 메소드

Some setups like HTTP_HOST, some like SERVER_NAME, it's complicated
public static get_host ( ) : string
리턴 string the HTTP_HOST or SERVER_NAME

get_params() 공개 정적인 메소드

Returns the url parameters, for example for url http://example.org/blog/post/news/2014/whatever this will return array('blog', 'post', 'news', '2014', 'whatever'); OR if sent an integer like: TimberUrlHelper::get_params(2); this will return 'news';
public static get_params ( integer $i = false ) : array | string
$i integer the position of the parameter to grab.
리턴 array | string

get_path_base() 공개 정적인 메소드

public static get_path_base ( ) : string
리턴 string

get_rel_path() 공개 정적인 메소드

public static get_rel_path ( string $src ) : string
$src string
리턴 string

get_rel_url() 공개 정적인 메소드

public static get_rel_url ( string $url, boolean $force = false ) : string
$url string
$force boolean
리턴 string

get_scheme() 공개 정적인 메소드

Get url scheme
public static get_scheme ( ) : string
리턴 string

is_absolute() 공개 정적인 메소드

This will evaluate wheter a URL is at an aboslute location (like http://example.org/whatever)
public static is_absolute ( string $path ) : boolean
$path string
리턴 boolean true if $path is an absolute url, false if relative.

is_external() 공개 정적인 메소드

public static is_external ( string $url ) : boolean
$url string
리턴 boolean true if $path is an external url, false if relative or local. true if it's a subdomain (http://cdn.example.org = true)

is_external_content() 공개 정적인 메소드

This function is slightly different from the one below in the case of: an image hosted on the same domain BUT on a different site than the Wordpress install will be reported as external content.
public static is_external_content ( string $url ) : boolean
$url string a URL to evaluate against
리턴 boolean if $url points to an external location returns true

is_local() 공개 정적인 메소드

public static is_local ( string $url ) : boolean
$url string
리턴 boolean

is_url() 공개 정적인 메소드

public static is_url ( string $url ) : boolean
$url string
리턴 boolean

prepend_to_url() 공개 정적인 메소드

public static prepend_to_url ( string $url, string $path ) : string
$url string
$path string
리턴 string

preslashit() 공개 정적인 메소드

public static preslashit ( string $path ) : string
$path string
리턴 string

remove_double_slashes() 공개 정적인 메소드

public static remove_double_slashes ( string $url ) : string
$url string
리턴 string

remove_trailing_slash() 공개 정적인 메소드

Pass links through untrailingslashit unless they are a single /
public static remove_trailing_slash ( string $link ) : string
$link string
리턴 string

url_to_file_system() 공개 정적인 메소드

Takes a url and figures out its place based in the file system based on path NOTE: Not fool-proof, makes a lot of assumptions about the file path matching the URL path
public static url_to_file_system ( string $url ) : string
$url string
리턴 string