phpdoc for rewrite.php from jacobsantos. see #7660

git-svn-id: http://svn.automattic.com/wordpress/trunk@8899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-09-16 00:35:56 +00:00
parent 1deef71a52
commit ed246088be
1 changed files with 217 additions and 142 deletions

View File

@ -7,15 +7,14 @@
*/
/**
* add_rewrite_rule() - Add a straight rewrite rule
*
* {@internal Missing Long Description}}
* Add a straight rewrite rule.
*
* @see WP_Rewrite::add_rule() for long description.
* @since 2.1.0
*
* @param unknown_type $regex
* @param unknown_type $redirect
* @param unknown_type $after
* @param string $regex Regular Expression to match request against.
* @param string $redirect Page to redirect to.
* @param string $after Optional, default is 'bottom'. Where to add rule, can also be 'top'.
*/
function add_rewrite_rule($regex, $redirect, $after = 'bottom') {
global $wp_rewrite;
@ -23,15 +22,15 @@ function add_rewrite_rule($regex, $redirect, $after = 'bottom') {
}
/**
* add_rewrite_tag() - Add a new tag (like %postname%)
* Add a new tag (like %postname%).
*
* Warning: you must call this on init or earlier, otherwise
* the query var addition stuff won't work
* Warning: you must call this on init or earlier, otherwise the query var
* addition stuff won't work.
*
* @since 2.1.0
*
* @param unknown_type $tagname
* @param unknown_type $regex
* @param string $tagname
* @param string $regex
*/
function add_rewrite_tag($tagname, $regex) {
//validation
@ -47,15 +46,13 @@ function add_rewrite_tag($tagname, $regex) {
}
/**
* add_feed() - Add a new feed type like /atom1/
*
* {@internal Missing Long Description}}
* Add a new feed type like /atom1/.
*
* @since 2.1.0
*
* @param unknown_type $feedname
* @param unknown_type $function
* @return unknown
* @param string $feedname
* @param callback $function Callback to run on feed display.
* @return string Feed action name.
*/
function add_feed($feedname, $function) {
global $wp_rewrite;
@ -70,91 +67,91 @@ function add_feed($feedname, $function) {
}
/**
* {@internal Missing Description}}
* Endpoint Mask for Permalink.
*
* @since 2.1.0
*/
define('EP_PERMALINK', 1);
/**
* {@internal Missing Description}}
* Endpoint Mask for Attachment.
*
* @since 2.1.0
*/
define('EP_ATTACHMENT', 2);
/**
* {@internal Missing Description}}
* Endpoint Mask for date.
*
* @since 2.1.0
*/
define('EP_DATE', 4);
/**
* {@internal Missing Description}}
* Endpoint Mask for year
*
* @since 2.1.0
*/
define('EP_YEAR', 8);
/**
* {@internal Missing Description}}
* Endpoint Mask for month.
*
* @since 2.1.0
*/
define('EP_MONTH', 16);
/**
* {@internal Missing Description}}
* Endpoint Mask for day.
*
* @since 2.1.0
*/
define('EP_DAY', 32);
/**
* {@internal Missing Description}}
* Endpoint Mask for root.
*
* @since 2.1.0
*/
define('EP_ROOT', 64);
/**
* {@internal Missing Description}}
* Endpoint Mask for comments.
*
* @since 2.1.0
*/
define('EP_COMMENTS', 128);
/**
* {@internal Missing Description}}
* Endpoint Mask for searches.
*
* @since 2.1.0
*/
define('EP_SEARCH', 256);
/**
* {@internal Missing Description}}
* Endpoint Mask for categories.
*
* @since 2.1.0
*/
define('EP_CATEGORIES', 512);
/**
* {@internal Missing Description}}
* Endpoint Mask for tags.
*
* @since 2.3.0
*/
define('EP_TAGS', 1024);
/**
* {@internal Missing Description}}
* Endpoint Mask for authors.
*
* @since 2.1.0
*/
define('EP_AUTHORS', 2048);
/**
* {@internal Missing Description}}
* Endpoint Mask for pages.
*
* @since 2.1.0
*/
@ -162,25 +159,28 @@ define('EP_PAGES', 4096);
//pseudo-places
/**
* {@internal Missing Description}}
* Endpoint Mask for default, which is nothing.
*
* @since 2.1.0
*/
define('EP_NONE', 0);
/**
* {@internal Missing Description}}
* Endpoint Mask for everything.
*
* @since 2.1.0
*/
define('EP_ALL', 8191);
/**
* add_rewrite_endpoint() - Add an endpoint, like /trackback/
* Add an endpoint, like /trackback/.
*
* {@internal Missing Long Description}}
* The endpoints are added to the end of the request. So a request matching
* "/2008/10/14/my_post/myep/", the endpoint will be "/myep/".
*
* @since 2.1.0
* @see WP_Rewrite::add_endpoint() Parameters and more description.
* @uses $wp_rewrite
*
* @param unknown_type $name
* @param unknown_type $places
@ -191,10 +191,16 @@ function add_rewrite_endpoint($name, $places) {
}
/**
* _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/
* @param string $base the taxonomy base that we're going to filter
* @return string
* Filter the URL base for taxonomies.
*
* To remove any manually prepended /index.php/.
*
* @access private
* @since unknown (2.3.0?)
* @author Mark Jaquith
*
* @param string $base The taxonomy base that we're going to filter
* @return string
*/
function _wp_filter_taxonomy_base( $base ) {
if ( !empty( $base ) ) {
@ -204,19 +210,15 @@ function _wp_filter_taxonomy_base( $base ) {
return $base;
}
// examine a url (supposedly from this blog) and try to
// determine the post ID it represents.
/**
* url_to_postid() - Examine a url and try to determine the post ID it represents
*
* {@internal Missing Long Description}}
* Examine a url and try to determine the post ID it represents.
*
* Checks are supposedly from the hosted site blog.
*
* @since 1.0.0
*
* @param unknown_type $url
* @return unknown
* @param string $url Permalink to check.
* @return int Post ID, or 0 on failure.
*/
function url_to_postid($url) {
global $wp_rewrite;
@ -315,24 +317,32 @@ function url_to_postid($url) {
}
/**
* {@internal Missing Short Description}}
* WordPress Rewrite Component.
*
* {@internal Missing Long Description}}
* The WordPress Rewrite class writes the rewrite module rules to the .htaccess
* file. It also handles parsing the request to get the correct setup for the
* WordPress Query class.
*
* The Rewrite along with WP class function as a front controller for WordPress.
* You can add rules to trigger your page view and processing using this
* component. The full functionality of a front controller does not exist,
* meaning you can't define how the template files load based on the rewrite
* rules.
*
* @since 1.5.0
*/
class WP_Rewrite {
/**
* {@internal Missing Description}}
* Default permalink structure for WordPress.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $permalink_structure;
/**
* {@internal Missing Description}}
* Whether to add trailing slashes.
*
* @since 2.2.0
* @access private
@ -341,43 +351,43 @@ class WP_Rewrite {
var $use_trailing_slashes;
/**
* {@internal Missing Description}}
* Customized or default category permalink base ( example.com/xx/tagname ).
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $category_base;
/**
* {@internal Missing Description}}
* Customized or default tag permalink base ( example.com/xx/tagname ).
*
* @since 2.3.0
* @access private
* @var unknown_type
* @var string
*/
var $tag_base;
/**
* {@internal Missing Description}}
* Permalink request structure for categories.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $category_structure;
/**
* {@internal Missing Description}}
* Permalink request structure for tags.
*
* @since 2.3.0
* @access private
* @var unknown_type
* @var string
*/
var $tag_structure;
/**
* {@internal Missing Description}}
* Permalink author request base ( example.com/author/authorname ).
*
* @since 1.5.0
* @access private
@ -386,34 +396,34 @@ class WP_Rewrite {
var $author_base = 'author';
/**
* {@internal Missing Description}}
* Permalink request structure for author pages.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $author_structure;
/**
* {@internal Missing Description}}
* Permalink request structure for dates.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $date_structure;
/**
* {@internal Missing Description}}
* Permalink request structure for pages.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $page_structure;
/**
* {@internal Missing Description}}
* Search permalink base ( example.com/search/query ).
*
* @since 1.5.0
* @access private
@ -422,16 +432,16 @@ class WP_Rewrite {
var $search_base = 'search';
/**
* {@internal Missing Description}}
* Permalink request structure for searches.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $search_structure;
/**
* {@internal Missing Description}}
* Comments permalink base.
*
* @since 1.5.0
* @access private
@ -440,7 +450,7 @@ class WP_Rewrite {
var $comments_base = 'comments';
/**
* {@internal Missing Description}}
* Feed permalink base.
*
* @since 1.5.0
* @access private
@ -449,7 +459,7 @@ class WP_Rewrite {
var $feed_base = 'feed';
/**
* {@internal Missing Description}}
* Comments feed request structure permalink.
*
* @since 1.5.0
* @access private
@ -458,7 +468,7 @@ class WP_Rewrite {
var $comments_feed_structure;
/**
* {@internal Missing Description}}
* Feed request structure permalink.
*
* @since 1.5.0
* @access private
@ -467,25 +477,33 @@ class WP_Rewrite {
var $feed_structure;
/**
* {@internal Missing Description}}
* Front URL path.
*
* The difference between the root property is that WordPress might be
* located at example/WordPress/index.php, if permalinks are turned off. The
* index.php will be the front portion. If permalinks are turned on, this
* will most likely be empty or not set.
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $front;
/**
* {@internal Missing Description}}
* Root URL path to WordPress (without domain).
*
* The difference between front property is that WordPress might be located
* at example.com/WordPress/. The root is the 'WordPress/' portion.
*
* @since 1.5.0
* @access
* @var unknown_type
* @access private
* @var string
*/
var $root = '';
/**
* {@internal Missing Description}}
* Permalink to the home page.
*
* @since 1.5.0
* @access public
@ -498,12 +516,12 @@ class WP_Rewrite {
*
* @since 1.5.0
* @access private
* @var unknown_type
* @var string
*/
var $matches = '';
/**
* {@internal Missing Description}}
* Rewrite rules to match against the request to find the redirect or query.
*
* @since 1.5.0
* @access private
@ -512,9 +530,9 @@ class WP_Rewrite {
var $rules;
/**
* {@internal Missing Description}}
* Additional rules added external to the rewrite class.
*
* Those not generated by the class, see add_rewrite_rule()
* Those not generated by the class, see add_rewrite_rule().
*
* @since 2.1.0
* @access private
@ -523,9 +541,9 @@ class WP_Rewrite {
var $extra_rules = array(); //
/**
* {@internal Missing Description}}
* Additional rules that belong at the beginning to match first.
*
* Those not generated by the class, see add_rewrite_rule()
* Those not generated by the class, see add_rewrite_rule().
*
* @since 2.3.0
* @access private
@ -547,9 +565,17 @@ class WP_Rewrite {
*
* @since 2.1.0
* @access private
* @var unknown_type
* @var array
*/
var $extra_permastructs = array();
/**
* Endpoints permalinks
*
* @since unknown
* @access private
* @var array
*/
var $endpoints;
/**
@ -643,7 +669,7 @@ class WP_Rewrite {
);
/**
* {@internal Missing Description}}
* Supported default feeds.
*
* @since 1.5.0
* @access private
@ -652,14 +678,14 @@ class WP_Rewrite {
var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
/**
* {@internal Missing Short Description}}
* Whether permalinks are being used.
*
* {@internal Missing Long Description}}
* This can be either rewrite module or permalink in the HTTP query string.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool True, if permalinks are enabled.
*/
function using_permalinks() {
if (empty($this->permalink_structure))
@ -669,14 +695,14 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Whether permalinks are being used and rewrite module is not enabled.
*
* {@internal Missing Long Description}}
* Means that permalink links are enabled and index.php is in the URL.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool
*/
function using_index_permalinks() {
if (empty($this->permalink_structure)) {
@ -692,14 +718,14 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Whether permalinks are being used and rewrite module is enabled.
*
* {@internal Missing Long Description}}
* Using permalinks and index.php is not in the URL.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool
*/
function using_mod_rewrite_permalinks() {
if ( $this->using_permalinks() && ! $this->using_index_permalinks())
@ -716,8 +742,8 @@ class WP_Rewrite {
* @since 1.5.0
* @access public
*
* @param unknown_type $number
* @return unknown
* @param int $number Index number.
* @return string
*/
function preg_index($number) {
$match_prefix = '$';
@ -815,14 +841,24 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve date permalink structure, with year, month, and day.
*
* {@internal Missing Long Description}}
* The permalink structure for the date, if not set already depends on the
* permalink structure. It can be one of three formats. The first is year,
* month, day; the second is day, month, year; and the last format is month,
* day, year. These are matched against the permalink structure for which
* one is used. If none matches, then the default will be used, which is
* year, month, day.
*
* Prevents post ID and date permalinks from overlapping. In the case of
* post_id, the date permalink will be prepended with front permalink with
* 'date/' before the actual permalink to form the complete date permalink
* structure.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool|string False on no permalink structure. Date permalink structure.
*/
function get_date_permastruct() {
if (isset($this->date_structure)) {
@ -869,14 +905,15 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the year permalink structure without month and day.
*
* {@internal Missing Long Description}}
* Gets the date permalink structure and strips out the month and day
* permalink structures.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool|string False on failure. Year structure on success.
*/
function get_year_permastruct() {
$structure = $this->get_date_permastruct($this->permalink_structure);
@ -894,14 +931,15 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the month permalink structure without day and with year.
*
* {@internal Missing Long Description}}
* Gets the date permalink structure and strips out the day permalink
* structures. Keeps the year permalink structure.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool|string False on failure. Year/Month structure on success.
*/
function get_month_permastruct() {
$structure = $this->get_date_permastruct($this->permalink_structure);
@ -918,28 +956,28 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the day permalink structure with month and year.
*
* {@internal Missing Long Description}}
* Keeps date permalink structure with all year, month, and day.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool|string False on failure. Year/Month/Day structure on success.
*/
function get_day_permastruct() {
return $this->get_date_permastruct($this->permalink_structure);
}
/**
* {@internal Missing Short Description}}
* Retrieve the permalink structure for categories.
*
* {@internal Missing Long Description}}
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return bool|string False on failure. Category permalink structure.
*/
function get_category_permastruct() {
if (isset($this->category_structure)) {
@ -962,14 +1000,14 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the permalink structure for tags.
*
* {@internal Missing Long Description}}
*
* @since 2.3.0
* @access public
*
* @return unknown
* @return bool|string False on failure. Tag permalink structure.
*/
function get_tag_permastruct() {
if (isset($this->tag_structure)) {
@ -991,6 +1029,15 @@ class WP_Rewrite {
return $this->tag_structure;
}
/**
* Retrieve extra permalink structure by name.
*
* @since unknown
* @access public
*
* @param string $name Permalink structure name.
* @return string|bool False if not found. Permalink structure string.
*/
function get_extra_permastruct($name) {
if ( isset($this->extra_permastructs[$name]) )
return $this->extra_permastructs[$name];
@ -998,14 +1045,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the author permalink structure.
*
* {@internal Missing Long Description}}
* The permalink structure is front property, author base, and finally
* '/%author%'. Will set the author_structure property and then return it
* without attempting to set the value again.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return string|bool False if not found. Permalink structure string.
*/
function get_author_permastruct() {
if (isset($this->author_structure)) {
@ -1023,14 +1072,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the search permalink structure.
*
* {@internal Missing Long Description}}
* The permalink structure is root property, search base, and finally
* '/%search%'. Will set the search_structure property and then return it
* without attempting to set the value again.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return string|bool False if not found. Permalink structure string.
*/
function get_search_permastruct() {
if (isset($this->search_structure)) {
@ -1048,14 +1099,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the page permalink structure.
*
* {@internal Missing Long Description}}
* The permalink structure is root property, and '%pagename%'. Will set the
* page_structure property and then return it without attempting to set the
* value again.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return string|bool False if not found. Permalink structure string.
*/
function get_page_permastruct() {
if (isset($this->page_structure)) {
@ -1073,14 +1126,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the feed permalink structure.
*
* {@internal Missing Long Description}}
* The permalink structure is root property, feed base, and finally
* '/%feed%'. Will set the feed_structure property and then return it
* without attempting to set the value again.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return string|bool False if not found. Permalink structure string.
*/
function get_feed_permastruct() {
if (isset($this->feed_structure)) {
@ -1098,14 +1153,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Retrieve the comment feed permalink structure.
*
* {@internal Missing Long Description}}
* The permalink structure is root property, comment base property, feed
* base and finally '/%feed%'. Will set the comment_feed_structure property
* and then return it without attempting to set the value again.
*
* @since 1.5.0
* @access public
*
* @return unknown
* @return string|bool False if not found. Permalink structure string.
*/
function get_comment_feed_permastruct() {
if (isset($this->comment_feed_structure)) {
@ -1150,7 +1207,7 @@ class WP_Rewrite {
}
/**
* Generate the rules from permalink structure
* Generate the rules from permalink structure.
*
* {@internal Missing Long Description}}
*
@ -1640,6 +1697,18 @@ class WP_Rewrite {
$wp->add_query_var($name);
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
*
* @since unknown
* @access public
*
* @param unknown_type $name
* @param unknown_type $struct
* @param unknown_type $with_front
*/
function add_permastruct($name, $struct, $with_front = true) {
if ( $with_front )
$struct = $this->front . $struct;
@ -1647,9 +1716,11 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Remove rewrite rules and then recreate rewrite rules.
*
* {@internal Missing Long Description}}
* Calls {@link WP_Rewrite::wp_rewrite_rules()} after removing the
* 'rewrite_rules' option. If the function named 'save_mod_rewrite_rules'
* exists, it will be called.
*
* @since 2.0.1
* @access public
@ -1702,14 +1773,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Set the main permalink structure for the blog.
*
* {@internal Missing Long Description}}
* Will update the 'permalink_structure' option, if there is a difference
* between the current permalink structure and the parameter value. Calls
* {@link WP_Rewrite::init()} after the option is updated.
*
* @since 1.5.0
* @access public
*
* @param unknown_type $permalink_structure
* @param string $permalink_structure Permalink structure.
*/
function set_permalink_structure($permalink_structure) {
if ($permalink_structure != $this->permalink_structure) {
@ -1719,14 +1792,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Set the category base for the category permalink.
*
* {@internal Missing Long Description}}
* Will update the 'category_base' option, if there is a difference between
* the current category base and the parameter value. Calls
* {@link WP_Rewrite::init()} after the option is updated.
*
* @since 1.5.0
* @access public
*
* @param unknown_type $category_base
* @param string $category_base Category permalink structure base.
*/
function set_category_base($category_base) {
if ($category_base != $this->category_base) {
@ -1736,14 +1811,16 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
* Set the tag base for the tag permalink.
*
* {@internal Missing Long Description}}
* Will update the 'tag_base' option, if there is a difference between the
* current tag base and the parameter value. Calls
* {@link WP_Rewrite::init()} after the option is updated.
*
* @since 2.3.0
* @access public
*
* @param unknown_type $tag_base
* @param string $tag_base Tag permalink structure base.
*/
function set_tag_base( $tag_base ) {
if ( $tag_base != $this->tag_base ) {
@ -1753,9 +1830,7 @@ class WP_Rewrite {
}
/**
* {@internal Missing Short Description}}
*
* {@internal Missing Long Description}}
* PHP4 Constructor - Calls init(), which runs setup.
*
* @since 1.5.0
* @access public