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 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 auth_ajax ($context, $args=array())
static ajax ($context, $args=array())

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 15 of file url.php.


Member Function Documentation

static URL::ajax ( context,
args = array() 
) [static]

Helper method for ajax rule

Parameters:
string $context The context of the ajax rule
array|string|object $args The arguments to pass to the rule's builder
Returns:
string The resultant URL

Definition at line 314 of file url.php.

static URL::auth_ajax ( context,
args = array() 
) [static]

Helper method for auth_ajax rule

Parameters:
string $context The context of the ajax rule
array|string|object $args The arguments to pass to the rule's builder
Returns:
string The resultant URL

Definition at line 301 of file url.php.

Referenced by Menus::filter_menu_type_data().

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
string $prefix
Returns:
array Properties to use to construct a URL

Definition at line 267 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
bool $noamp
boolean $prepend_site If true (default), a full URL is returned, if false, only the path part of the URL is returned
Returns:
string

Definition at line 148 of file url.php.

Referenced by AdminHandler::__construct(), AtomHandler::act_introspection(), UserHandler::act_password_reset(), ActionHandler::act_redirect(), AtomHandler::act_rsd(), Pingback::action_add_template_vars(), Menus::action_admin_header(), Menus::action_admin_theme_get_menu_iframe(), Menus::action_admin_theme_get_menus(), WPImport::action_auth_ajax_wp_import_comments(), WPImport::action_auth_ajax_wp_import_posts(), WPImport::action_auth_ajax_wp_import_users(), CoreDashModules::action_block_content_latest_comments(), CoreDashModules::action_block_content_latest_entries(), CoreDashModules::action_block_content_latest_log_activity(), CoreBlocks::action_block_content_monthly_archives(), CoreBlocks::action_block_content_search_form(), CoreBlocks::action_block_content_tag_archives(), FlickrSilo::action_plugin_ui_authorize(), FlickrSilo::action_plugin_ui_confirm(), FlickrSilo::action_plugin_ui_deauthorize(), Stack::action_register_stackitems(), AtomHandler::add_pagination_links(), AtomHandler::add_posts(), ajax(), AdminGroupsHandler::ajax_groups(), auth_ajax(), Post::comment_form(), Menus::filter_adminhandler_post_loadplugins_main_menu(), CoreDashModules::filter_dash_module_post_types_and_statuses(), Charcoal::filter_post_tags_out(), Post::form_publish_delete(), AdminThemesHandler::get_activate_theme(), AtomHandler::get_collection(), AdminCommentsHandler::get_comment(), AtomHandler::get_comments(), AtomHandler::get_entry(), AdminImportHandler::get_form(), AdminGroupsHandler::get_group(), AdminHandler::get_main_menu(), AdminPluginsHandler::get_plugin_toggle(), AdminPluginsHandler::get_plugins(), AdminThemesHandler::get_preview_theme(), AdminUsersHandler::get_user(), CoreBlocks::meta_urls(), out(), AtomHandler::post_collection(), AdminGroupsHandler::post_group(), AdminGroupsHandler::post_groups(), AdminImportHandler::post_import(), AdminUsersHandler::post_users(), CronHandler::run_cron(), AdminHandler::setup_admin_theme(), Format::tag_and_list(), 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 58 of file url.php.

Referenced by PluginHandler::act(), and Controller::get_request_obj().

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
string|bool $trail If true, include a trailing slash. If string, append this to the requested url. Default: Add nothing.
bool $preserve_file If true, leave the filename on the URL. Default: Remove filename.
Returns:
string URL

Definition at line 249 of file url.php.

Referenced by Pluggable::get_url(), 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 27 of file url.php.

Referenced by get(), get_active_rules(), get_matched_rule(), 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
bool $noamp
boolean $prepend_site If true (default), a full URL is returned, if false, only the path part of the URL is returned
Returns:
void

Definition at line 236 of file url.php.

Referenced by HiEngineParser::hi_command().

static URL::set_404 (  )  [static]

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

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

Definition at line 68 of file url.php.

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


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