PHP 클래스 Habari\URL

상속: extends Singleton
파일 보기 프로젝트 열기: habari/system 1 사용 예제들

공개 메소드들

메소드 설명
ajax ( string $context, array | string | object $args = [] ) : string Helper method for ajax rule
auth_ajax ( string $context, array | string | object $args = [] ) : string Helper method for auth_ajax rule
extract_args ( mixed $args, string $prefix = '' ) : array Extract the possible arguments to use in the URL from the passed variable
get ( mixed $rule_names = '', mixed $args = [], boolean $useall = true, boolean $noamp = false, boolean $prepend_site = true ) : string Builds the required pretty URL given a supplied rule name and a set of placeholder replacement values and returns the built URL.
get_active_rules ( ) : array Get the active RewriteRules that are cached in self::load_rules().
get_from_filesystem ( string $path, string | boolean $trail = false, boolean $preserve_file = false ) : string Get a fully-qualified URL from a filesystem path
get_matched_rule ( ) : RewriteRule Get the matched RewriteRule that was matched in parse().
out ( string $rule_name = null, array $args = [], boolean $useall = true, boolean $noamp = true, boolean $prepend_site = true ) : void Helper wrapper function. Outputs the URL via echo.
parse ( string $from_url ) : RewriteRule Match a URL/URI against the rewrite rules stored in the DB.
set_404 ( ) : RewriteRule Cause the matched rule to be unset in the case of a 404

보호된 메소드들

메소드 설명
instance ( ) Enables singleton working properly

비공개 메소드들

메소드 설명
load_rules ( ) A simple caching mechanism to avoid reloading rule array

메소드 상세

ajax() 공개 정적인 메소드

Helper method for ajax rule
public static ajax ( string $context, array | string | object $args = [] ) : string
$context string The context of the ajax rule
$args array | string | object The arguments to pass to the rule's builder
리턴 string The resultant URL

auth_ajax() 공개 정적인 메소드

Helper method for auth_ajax rule
public static auth_ajax ( string $context, array | string | object $args = [] ) : string
$context string The context of the ajax rule
$args array | string | object The arguments to pass to the rule's builder
리턴 string The resultant URL

extract_args() 공개 정적인 메소드

Extract the possible arguments to use in the URL from the passed variable
public static extract_args ( mixed $args, string $prefix = '' ) : array
$args mixed An array of values or a URLProperties object with properties to use in the construction of a URL
$prefix string
리턴 array Properties to use to construct a URL

get() 공개 정적인 메소드

URL::get( 'display_entries_by_date', array( 'year' => '2000', 'month' => '05', 'day' => '01', ) );
public static get ( mixed $rule_names = '', mixed $args = [], boolean $useall = true, boolean $noamp = false, boolean $prepend_site = true ) : string
$rule_names mixed string name of the rule or array of rules which would build the URL
$args mixed (optional) array or object of placeholder replacement values
$useall boolean If true (default), then all passed parameters that are not part of the built URL are tacked onto the URL as querystring
$noamp boolean
$prepend_site boolean If true (default), a full URL is returned, if false, only the path part of the URL is returned
리턴 string

get_active_rules() 공개 정적인 메소드

Get the active RewriteRules that are cached in self::load_rules().
public static get_active_rules ( ) : array
리턴 array RewriteRules active rules, or null

get_from_filesystem() 공개 정적인 메소드

Get a fully-qualified URL from a filesystem path
public static get_from_filesystem ( string $path, string | boolean $trail = false, boolean $preserve_file = false ) : string
$path string The filesystem path
$trail string | boolean If true, include a trailing slash. If string, append this to the requested url. Default: Add nothing.
$preserve_file boolean If true, leave the filename on the URL. Default: Remove filename.
리턴 string URL

get_matched_rule() 공개 정적인 메소드

Get the matched RewriteRule that was matched in parse().
public static get_matched_rule ( ) : RewriteRule
리턴 RewriteRule matched rule, or null

instance() 보호된 정적인 메소드

Enables singleton working properly
protected static instance ( )

out() 공개 정적인 메소드

Helper wrapper function. Outputs the URL via echo.
public static out ( string $rule_name = null, array $args = [], boolean $useall = true, boolean $noamp = true, boolean $prepend_site = true ) : void
$rule_name string name of the rule which would build the URL
$args array (optional) array of placeholder replacement values
$useall boolean If true (default), then all passed parameters that are not part of the built URL are tacked onto the URL as querystring
$noamp boolean
$prepend_site boolean If true (default), a full URL is returned, if false, only the path part of the URL is returned
리턴 void

parse() 공개 정적인 메소드

This method is used by the Controller class for parsing requests, and by other classes, such as Pingback, which uses it to determine the post slug for a given URL. Returns the matched RewriteRule object, or false.
public static parse ( string $from_url ) : RewriteRule
$from_url string URL string to parse
리턴 RewriteRule matched rule, or false

set_404() 공개 정적인 메소드

Cause the matched rule to be unset in the case of a 404
public static set_404 ( ) : RewriteRule
리턴 RewriteRule A rewrite rule that represents a 404 error - no match on the URL requested