Static Public Member Functions | Static Protected Member Functions

URL Class Reference

Inheritance diagram for URL:
Collaboration diagram for URL:

List of all members.

Static Public Member Functions

static get_matched_rule ()
static get_active_rules ()
static set_404 ()
static parse ($from_url)
static get ($rule_names= '', $args=array(), $useall=true, $noamp=false, $prepend_site=true)
static out ($rule_name=null, $args=array(), $useall=true, $noamp=true, $prepend_site=true)
static get_from_filesystem ($path, $trail=false, $preserve_file=false)
static extract_args ($args, $prefix= '')

Static Protected Member Functions

static instance ()

Detailed Description

URL class which handles creation of URLs based on the rewrite rules in the database. Uses rules to construct pretty URLs for use by the system and especially the theme's template engine

Definition at line 13 of file url.php.


Member Function Documentation

static URL::extract_args ( args,
prefix = '' 
) [static]

Extract the possible arguments to use in the URL from the passed variable

Parameters:
mixed $args An array of values or a URLProperties object with properties to use in the construction of a URL
Returns:
array Properties to use to construct a URL

Definition at line 260 of file url.php.

Referenced by get(), Post::get_url_args(), and User::get_url_args().

static URL::get ( rule_names = '',
args = array(),
useall = true,
noamp = false,
prepend_site = true 
) [static]

Builds the required pretty URL given a supplied rule name and a set of placeholder replacement values and returns the built URL.

URL::get( 'display_entries_by_date', array( 'year' => '2000', 'month' => '05', 'day' => '01', ) );

Parameters:
mixed $rule_names string name of the rule or array of rules which would build the URL
mixed $args (optional) array or object of placeholder replacement values
boolean $useall If true (default), then all passed parameters that are not part of the built URL are tacked onto the URL as querystring
boolean $prepend_site If true (default), a full URL is returned, if false, only the path part of the URL is returned

Definition at line 144 of file url.php.

Referenced by AdminHandler::__construct(), AtomHandler::act_introspection(), UserHandler::act_login(), ActionHandler::act_redirect(), AtomHandler::act_rsd(), Pingback::action_add_template_vars(), CoreBlocks::action_block_content_monthly_archives(), CoreBlocks::action_block_content_search_form(), CoreBlocks::action_block_content_tag_archives(), CoreBlocks::action_init(), ViddlerSilo::action_plugin_ui(), FlickrSilo::action_plugin_ui_authorize(), FlickrSilo::action_plugin_ui_confirm(), FlickrSilo::action_plugin_ui_deauthorize(), AtomHandler::add_pagination_links(), AtomHandler::add_posts(), AdminGroupsHandler::ajax_groups(), Post::comment_form(), AdminUsersHandler::form_user_success(), AdminThemesHandler::get_activate_theme(), AtomHandler::get_collection(), AdminCommentsHandler::get_comment(), AtomHandler::get_comments(), AtomHandler::get_entry(), AdminGroupsHandler::get_group(), AdminHandler::get_main_menu(), AdminPluginsHandler::get_plugin_toggle(), AdminPluginsHandler::get_plugins(), AdminThemesHandler::get_preview_theme(), AdminUsersHandler::get_user(), out(), AtomHandler::post_collection(), AdminPostsHandler::post_delete_post(), AdminGroupsHandler::post_group(), AdminImportHandler::post_import(), CronTab::run_cron(), AdminHandler::setup_admin_theme(), Theme::theme_comment_form_action(), Theme::theme_feed_alternate(), Theme::theme_header(), Theme::theme_next_page_link(), Theme::theme_page_selector(), Theme::theme_prev_page_link(), Charcoal::theme_show_tags(), and AdminGroupsHandler::update_groups().

static URL::get_active_rules (  )  [static]

Get the active RewriteRules that are cached in self::load_rules().

Returns:
array RewriteRules active rules, or null

Definition at line 56 of file url.php.

Referenced by PluginHandler::act(), UserHandler::login_form(), and ActionHandler::setup_theme().

static URL::get_from_filesystem ( path,
trail = false,
preserve_file = false 
) [static]

Get a fully-qualified URL from a filesystem path

Parameters:
string $path The filesystem path
bool whether to include a trailing slash. Default: No
bool whether to leave a filename on the URL. Default: No
Returns:
string URL

Definition at line 243 of file url.php.

Referenced by Pluggable::get_url(), ViddlerSilo::silo_info(), HabariSilo::silo_info(), and FlickrSilo::silo_info().

static URL::get_matched_rule (  )  [static]
static URL::instance (  )  [static, protected]

Enables singleton working properly

See also:
singleton.php

Reimplemented from Singleton.

Definition at line 25 of file url.php.

Referenced by get(), get_active_rules(), get_matched_rule(), parse(), and set_404().

static URL::out ( rule_name = null,
args = array(),
useall = true,
noamp = true,
prepend_site = true 
) [static]

Helper wrapper function. Outputs the URL via echo.

Parameters:
string $rule_name name of the rule which would build the URL
array $args (optional) array of placeholder replacement values
boolean $useall If true (default), then all passed parameters that are not part of the built URL are tacked onto the URL as querystring
boolean $prepend_site If true (default), a full URL is returned, if false, only the path part of the URL is returned

Definition at line 230 of file url.php.

Referenced by HiEngineParser::hi_command().

static URL::parse ( from_url  )  [static]

Match a URL/URI against the rewrite rules stored in the DB. 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.

Parameters:
string $from_url URL string to parse
Returns:
RewriteRule matched rule, or false

Definition at line 87 of file url.php.

Referenced by Controller::parse_request(), and Pingback::xmlrpc_pingback__ping().

static URL::set_404 (  )  [static]

Cause the matched rule to be unset in the case of a 404

Returns:
RewriteRule A rewrite rule that represents a 404 error - no match on the URL requested

Definition at line 66 of file url.php.

Referenced by Theme::act_display(), and Controller::parse_request().


The documentation for this class was generated from the following file: