phpdoc updates from jacobsantos. see #7038

git-svn-id: https://develop.svn.wordpress.org/trunk@7990 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-05-25 15:45:05 +00:00
parent 44084888b7
commit be87986f7a
5 changed files with 255 additions and 169 deletions

View File

@ -2,12 +2,16 @@
/** /**
* Author Template functions for use in themes. * Author Template functions for use in themes.
* *
* These functions must be used within the WordPress Loop.
*
* @link http://codex.wordpress.org/Author_Templates
*
* @package WordPress * @package WordPress
* @subpackage Template * @subpackage Template
*/ */
/** /**
* get_the_author() - Get the author of the current post in the Loop. * Retrieve the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -22,21 +26,22 @@ function get_the_author($deprecated = '') {
} }
/** /**
* the_author() - Echo the name of the author of the current post in the Loop. * Display the name of the author of the current post.
* *
* The behavior of this function is based off of old functionality predating get_the_author(). * The behavior of this function is based off of old functionality predating
* This function is not deprecated, but is designed to echo the value from get_the_author() * get_the_author(). This function is not deprecated, but is designed to echo
* and as an result of any old theme that might still use the old behavior will also * the value from get_the_author() and as an result of any old theme that might
* pass the value from get_the_author(). * still use the old behavior will also pass the value from get_the_author().
* *
* The normal, expected behavior of this function is to echo the author and not return it. * The normal, expected behavior of this function is to echo the author and not
* However, backwards compatiability has to be maintained. * return it. However, backwards compatiability has to be maintained.
* *
* @since 0.71 * @since 0.71
* @see get_the_author() * @see get_the_author()
* @link http://codex.wordpress.org/Template_Tags/the_author
* *
* @param string $deprecated Deprecated. * @param string $deprecated Deprecated.
* @param string $deprecated_echo Echo the string or return it. Deprecated, use get_the_author(). * @param string $deprecated_echo Echo the string or return it.
* @return string The author's display name, from get_the_author(). * @return string The author's display name, from get_the_author().
*/ */
function the_author($deprecated = '', $deprecated_echo = true) { function the_author($deprecated = '', $deprecated_echo = true) {
@ -46,7 +51,7 @@ function the_author($deprecated = '', $deprecated_echo = true) {
} }
/** /**
* get_the_author_description() - Get the description of the author of the current post in the Loop. * Retrieve the description of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -58,8 +63,9 @@ function get_the_author_description() {
} }
/** /**
* the_author_description() - Echo the description of the author of the current post in the Loop. * Display the description of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_description
* @since 1.0.0 * @since 1.0.0
* @see get_the_author_description() * @see get_the_author_description()
*/ */
@ -68,7 +74,7 @@ function the_author_description() {
} }
/** /**
* get_the_author_login() - Get the login name of the author of the current post in the Loop. * Retrieve the login name of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -80,8 +86,9 @@ function get_the_author_login() {
} }
/** /**
* the_author_login() - Echo the login name of the author of the current post in the Loop. * Display the login name of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_login
* @since 0.71 * @since 0.71
* @see get_the_author_login() * @see get_the_author_login()
*/ */
@ -90,7 +97,7 @@ function the_author_login() {
} }
/** /**
* get_the_author_firstname() - Get the first name of the author of the current post in the Loop. * Retrieve the first name of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -102,8 +109,9 @@ function get_the_author_firstname() {
} }
/** /**
* the_author_firstname() - Echo the first name of the author of the current post in the Loop. * Display the first name of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_firstname
* @since 0.71 * @since 0.71
* @uses get_the_author_firstname() * @uses get_the_author_firstname()
*/ */
@ -112,7 +120,7 @@ function the_author_firstname() {
} }
/** /**
* get_the_author_lastname() - Get the last name of the author of the current post in the Loop. * Retrieve the last name of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -124,8 +132,9 @@ function get_the_author_lastname() {
} }
/** /**
* the_author_lastname() - Echo the last name of the author of the current post in the Loop. * Display the last name of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_lastname
* @since 0.71 * @since 0.71
* @uses get_the_author_lastname() * @uses get_the_author_lastname()
*/ */
@ -134,7 +143,7 @@ function the_author_lastname() {
} }
/** /**
* get_the_author_nickname() - Get the nickname of the author of the current post in the Loop. * Retrieve the nickname of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -146,8 +155,9 @@ function get_the_author_nickname() {
} }
/** /**
* the_author_nickname() - Echo the nickname of the author of the current post in the Loop. * Display the nickname of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_nickname
* @since 0.71 * @since 0.71
* @uses get_the_author_nickname() * @uses get_the_author_nickname()
*/ */
@ -156,7 +166,7 @@ function the_author_nickname() {
} }
/** /**
* get_the_author_ID() - Get the ID of the author of the current post in the Loop. * Retrieve the ID of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -168,8 +178,9 @@ function get_the_author_ID() {
} }
/** /**
* the_author_ID() - Echo the ID of the author of the current post in the Loop. * Display the ID of the author of the current post.
* *
* @http://codex.wordpress.org/Template_Tags/the_author_ID
* @since 0.71 * @since 0.71
* @uses get_the_author_ID() * @uses get_the_author_ID()
*/ */
@ -178,7 +189,7 @@ function the_author_ID() {
} }
/** /**
* get_the_author_email() - Get the email of the author of the current post in the Loop. * Retrieve the email of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -190,8 +201,9 @@ function get_the_author_email() {
} }
/** /**
* the_author_email() - Echo the email of the author of the current post in the Loop. * Display the email of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_email
* @since 0.71 * @since 0.71
* @uses get_the_author_email() * @uses get_the_author_email()
*/ */
@ -200,7 +212,7 @@ function the_author_email() {
} }
/** /**
* get_the_author_url() - Get the URL to the home page of the author of the current post in the Loop. * Retrieve the URL to the home page of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -216,8 +228,9 @@ function get_the_author_url() {
} }
/** /**
* the_author_url() - Echo the URL to the home page of the author of the current post in the Loop. * Display the URL to the home page of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_url
* @since 0.71 * @since 0.71
* @uses get_the_author_url() * @uses get_the_author_url()
*/ */
@ -226,8 +239,12 @@ function the_author_url() {
} }
/** /**
* the_author_link() - If the author has a home page set, echo an HTML link, otherwise just echo the author's name. * Display either author's link or author's name.
* *
* If the author has a home page set, echo an HTML link, otherwise just echo the
* author's name.
*
* @link http://codex.wordpress.org/Template_Tags/the_author_link
* @since 2.1 * @since 2.1
* @uses get_the_author_url() * @uses get_the_author_url()
* @uses the_author() * @uses the_author()
@ -241,7 +258,7 @@ function the_author_link() {
} }
/** /**
* get_the_author_icq() - Get the ICQ number of the author of the current post in the Loop. * Retrieve the ICQ number of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -253,8 +270,9 @@ function get_the_author_icq() {
} }
/** /**
* the_author_icq() - Echo the ICQ number of the author of the current post in the Loop. * Display the ICQ number of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_icq
* @since 0.71 * @since 0.71
* @see get_the_author_icq() * @see get_the_author_icq()
*/ */
@ -263,7 +281,7 @@ function the_author_icq() {
} }
/** /**
* get_the_author_aim() - Get the AIM name of the author of the current post in the Loop. * Retrieve the AIM name of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -275,8 +293,9 @@ function get_the_author_aim() {
} }
/** /**
* the_author_aim() - Echo the AIM name of the author of the current post in the Loop. * Display the AIM name of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_aim
* @since 0.71 * @since 0.71
* @see get_the_author_aim() * @see get_the_author_aim()
*/ */
@ -285,7 +304,7 @@ function the_author_aim() {
} }
/** /**
* get_the_author_yim() - Get the Yahoo! IM name of the author of the current post in the Loop. * Retrieve the Yahoo! IM name of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -297,8 +316,9 @@ function get_the_author_yim() {
} }
/** /**
* the_author_yim() - Echo the Yahoo! IM name of the author of the current post in the Loop. * Display the Yahoo! IM name of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_yim
* @since 0.71 * @since 0.71
* @see get_the_author_yim() * @see get_the_author_yim()
*/ */
@ -307,7 +327,7 @@ function the_author_yim() {
} }
/** /**
* get_the_author_msn() - Get the MSN address of the author of the current post in the Loop. * Retrieve the MSN address of the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
@ -319,8 +339,9 @@ function get_the_author_msn() {
} }
/** /**
* the_author_msn() - Echo the MSN address of the author of the current post in the Loop. * Display the MSN address of the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_msn
* @since 0.71 * @since 0.71
* @see get_the_author_msn() * @see get_the_author_msn()
*/ */
@ -329,7 +350,7 @@ function the_author_msn() {
} }
/** /**
* get_the_author_posts() - Get the number of posts by the author of the current post in the Loop. * Retrieve the number of posts by the author of the current post.
* *
* @since 1.5 * @since 1.5
* @uses $post The current post in the Loop's DB object. * @uses $post The current post in the Loop's DB object.
@ -342,8 +363,9 @@ function get_the_author_posts() {
} }
/** /**
* the_author_posts() - Echo the number of posts by the author of the current post in the Loop. * Display the number of posts by the author of the current post.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_posts
* @since 0.71 * @since 0.71
* @uses get_the_author_posts() Echos returned value from function. * @uses get_the_author_posts() Echos returned value from function.
*/ */
@ -352,11 +374,13 @@ function the_author_posts() {
} }
/** /**
* the_author_posts_link() - Echo an HTML link to the author page of the author of the current post in the Loop. * Display an HTML link to the author page of the author of the current post.
* *
* Does just echo get_author_posts_url() function, like the others do. The reason for this, * Does just echo get_author_posts_url() function, like the others do. The
* is that another function is used to help in printing the link to the author's posts. * reason for this, is that another function is used to help in printing the
* link to the author's posts.
* *
* @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
* @since 1.2 * @since 1.2
* @uses $authordata The current author's DB object. * @uses $authordata The current author's DB object.
* @uses get_author_posts_url() * @uses get_author_posts_url()
@ -374,7 +398,7 @@ function the_author_posts_link($deprecated = '') {
} }
/** /**
* get_author_posts_url() - Get the URL to the author page of the author of the current post in the Loop. * Retrieve the URL to the author page of the author of the current post.
* *
* @since 2.1 * @since 2.1
* @uses $wp_rewrite WP_Rewrite * @uses $wp_rewrite WP_Rewrite
@ -404,7 +428,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
} }
/** /**
* get_author_name() - Get the specified author's preferred display name. * Retrieve the specified author's preferred display name.
* *
* @since 1.0.0 * @since 1.0.0
* @param int $auth_id The ID of the author. * @param int $auth_id The ID of the author.
@ -416,16 +440,19 @@ function get_author_name( $auth_id ) {
} }
/** /**
* wp_list_authors() - List all the authors of the blog, with several options available. * List all the authors of the blog, with several options available.
* *
* optioncount (boolean) (false): Show the count in parenthesis next to the author's name. * optioncount (boolean) (false): Show the count in parenthesis next to the
* exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by default. * author's name.
* exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by
* default.
* show_fullname (boolean) (false): Show their full names. * show_fullname (boolean) (false): Show their full names.
* hide_empty (boolean) (true): Don't show authors without any posts. * hide_empty (boolean) (true): Don't show authors without any posts.
* feed (string) (''): If isn't empty, show links to author's feeds. * feed (string) (''): If isn't empty, show links to author's feeds.
* feed_image (string) (''): If isn't empty, use this image to link to feeds. * feed_image (string) (''): If isn't empty, use this image to link to feeds.
* echo (boolean) (true): Set to false to return the output, instead of echoing. * echo (boolean) (true): Set to false to return the output, instead of echoing.
* *
* @link http://codex.wordpress.org/Template_Tags/wp_list_authors
* @since 1.2 * @since 1.2
* @param array $args The argument array. * @param array $args The argument array.
* @return null|string The output, if echo is set to false. * @return null|string The output, if echo is set to false.

View File

@ -7,24 +7,31 @@
*/ */
/** /**
* _walk_bookmarks() - The formatted output of a list of bookmarks * The formatted output of a list of bookmarks
* *
* The $bookmarks array must contain bookmark objects and will be iterated over * The $bookmarks array must contain bookmark objects and will be iterated over
* to retrieve the bookmark to be used in the output. * to retrieve the bookmark to be used in the output.
* *
* The output is formatted as HTML with no way to change that format. However, what * The output is formatted as HTML with no way to change that format. However,
* is between, before, and after can be changed. The link itself will be HTML. * what is between, before, and after can be changed. The link itself will be
* HTML.
* *
* This function is used internally by wp_list_bookmarks() and should not be used by * This function is used internally by wp_list_bookmarks() and should not be
* themes. * used by themes.
* *
* The defaults for overwriting are: * The defaults for overwriting are:
* 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. * 'show_updated' - Default is 0 (integer). Will show the time of when the
* 'show_description' - Default is 0 (integer). Whether to show the description of the bookmark. * bookmark was last updated.
* 'show_images' - Default is 1 (integer). Whether to show link image if available. * 'show_description' - Default is 0 (integer). Whether to show the description
* 'before' - Default is '<li>' (string). The html or text to prepend to each bookmarks. * of the bookmark.
* 'after' - Default is '</li>' (string). The html or text to append to each bookmarks. * 'show_images' - Default is 1 (integer). Whether to show link image if
* 'between' - Default is '\n' (string). The string for use in between the link, description, and image. * available.
* 'before' - Default is '<li>' (string). The html or text to prepend to each
* bookmarks.
* 'after' - Default is '</li>' (string). The html or text to append to each
* bookmarks.
* 'between' - Default is '\n' (string). The string for use in between the link,
* description, and image.
* 'show_rating' - Default is 0 (integer). Whether to show the link rating. * 'show_rating' - Default is 0 (integer). Whether to show the link rating.
* *
* @since 2.1 * @since 2.1
@ -113,44 +120,68 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
} }
/** /**
* wp_list_bookmarks() - Retrieve or echo all of the bookmarks * Retrieve or echo all of the bookmarks
* *
* List of default arguments are as follows: * List of default arguments are as follows:
* 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme. * 'orderby' - Default is 'name' (string). How to order the links by. String is
* 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order. * based off of the bookmark scheme.
* 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display. * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either
* 'category' - Default is empty string (string). Include the links in what category ID(s). * ascending or descending order.
* 'category_name' - Default is empty string (string). Get links by category name. * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to
* 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'. * display.
* 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. * 'category' - Default is empty string (string). Include the links in what
* 'echo' - Default is 1 (integer). Whether to echo (default) or return the formatted bookmarks. * category ID(s).
* 'categorize' - Default is 1 (integer). Whether to show links listed by category (default) or show links in one column. * 'category_name' - Default is empty string (string). Get links by category
* name.
* 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide
* links marked as 'invisible'.
* 'show_updated' - Default is 0 (integer). Will show the time of when the
* bookmark was last updated.
* 'echo' - Default is 1 (integer). Whether to echo (default) or return the
* formatted bookmarks.
* 'categorize' - Default is 1 (integer). Whether to show links listed by
* category (default) or show links in one column.
* *
* These options define how the Category name will appear before the category links are displayed, if 'categorize' is 1. * These options define how the Category name will appear before the category
* If 'categorize' is 0, then it will display for only the 'title_li' string and only if 'title_li' is not empty. * links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will
* 'title_li' - Default is 'Bookmarks' (translatable string). What to show before the links appear. * display for only the 'title_li' string and only if 'title_li' is not empty.
* 'title_before' - Default is '<h2>' (string). The HTML or text to show before the 'title_li' string. * 'title_li' - Default is 'Bookmarks' (translatable string). What to show
* 'title_after' - Default is '</h2>' (string). The HTML or text to show after the 'title_li' string. * before the links appear.
* 'class' - Default is 'linkcat' (string). The CSS class to use for the 'title_li'. * 'title_before' - Default is '<h2>' (string). The HTML or text to show before
* the 'title_li' string.
* 'title_after' - Default is '</h2>' (string). The HTML or text to show after
* the 'title_li' string.
* 'class' - Default is 'linkcat' (string). The CSS class to use for the
* 'title_li'.
* *
* 'category_before' - Default is '<li id="%id" class="%class">'. String must contain '%id' and '%class' to get * 'category_before' - Default is '<li id="%id" class="%class">'. String must
* the id of the category and the 'class' argument. These are used for formatting in themes. Argument will be displayed * contain '%id' and '%class' to get
* before the 'title_before' argument. * the id of the category and the 'class' argument. These are used for
* 'category_after' - Default is '</li>' (string). The HTML or text that will appear after the list of links. * formatting in themes.
* Argument will be displayed before the 'title_before' argument.
* 'category_after' - Default is '</li>' (string). The HTML or text that will
* appear after the list of links.
* *
* These are only used if 'categorize' is set to 1 or true. * These are only used if 'categorize' is set to 1 or true.
* 'category_orderby' - Default is 'name'. How to order the bookmark category based on term scheme. * 'category_orderby' - Default is 'name'. How to order the bookmark category
* 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) or DESC (descending). * based on term scheme.
* 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending)
* or DESC (descending).
* *
* @see _walk_bookmarks() For other arguments that can be set in this function and passed to _walk_bookmarks(). * @see _walk_bookmarks() For other arguments that can be set in this function
* @see get_bookmarks() For other arguments that can be set in this function and passed to get_bookmarks(). * and passed to _walk_bookmarks().
* @see get_bookmarks() For other arguments that can be set in this function and
* passed to get_bookmarks().
* @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks
* *
* @since 2.1 * @since 2.1
* @uses _list_bookmarks() Used to iterate over all of the bookmarks and return the html * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return
* the html
* @uses get_terms() Gets all of the categories that are for links. * @uses get_terms() Gets all of the categories that are for links.
* *
* @param string|array $args Optional. Overwrite the defaults of the function * @param string|array $args Optional. Overwrite the defaults of the function
* @return string|null Will only return if echo option is set to not echo. Default is not return anything. * @return string|null Will only return if echo option is set to not echo.
* Default is not return anything.
*/ */
function wp_list_bookmarks($args = '') { function wp_list_bookmarks($args = '') {
$defaults = array( $defaults = array(

View File

@ -7,7 +7,7 @@
*/ */
/** /**
* get_bookmark() - Get Bookmark data based on ID * Retrieve Bookmark data based on ID
* *
* @since 2.1 * @since 2.1
* @uses $wpdb Database Object * @uses $wpdb Database Object
@ -37,7 +37,7 @@ function get_bookmark($bookmark_id, $output = OBJECT, $filter = 'raw') {
} }
/** /**
* get_bookmark_field() - Gets single bookmark data item or field. * Retrieve single bookmark data item or field.
* *
* @since 2.3 * @since 2.3
* @uses get_bookmark() Gets bookmark object using $bookmark as ID * @uses get_bookmark() Gets bookmark object using $bookmark as ID
@ -65,7 +65,7 @@ function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
} }
/** /**
* get_link() - Returns bookmark data based on ID. * Retrieve bookmark data based on ID.
* *
* @since 2.0 * @since 2.0
* @deprecated Use get_bookmark() * @deprecated Use get_bookmark()
@ -80,25 +80,35 @@ function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
} }
/** /**
* get_bookmarks() - Retrieves the list of bookmarks * Retrieves the list of bookmarks
* *
* Attempts to retrieve from the cache first based on MD5 hash of arguments. If * Attempts to retrieve from the cache first based on MD5 hash of arguments. If
* that fails, then the query will be built from the arguments and executed. The * that fails, then the query will be built from the arguments and executed. The
* results will be stored to the cache. * results will be stored to the cache.
* *
* List of default arguments are as follows: * List of default arguments are as follows:
* 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme. * 'orderby' - Default is 'name' (string). How to order the links by. String is
* 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order. * based off of the bookmark scheme.
* 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display. * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either
* 'category' - Default is empty string (string). Include the links in what category ID(s). * ascending or descending order.
* 'category_name' - Default is empty string (string). Get links by category name. * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to
* 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'. * display.
* 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. * 'category' - Default is empty string (string). Include the links in what
* 'include' - Default is empty string (string). Include other categories separated by commas. * category ID(s).
* 'exclude' - Default is empty string (string). Exclude other categories separated by commas. * 'category_name' - Default is empty string (string). Get links by category
* name.
* 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide
* links marked as 'invisible'.
* 'show_updated' - Default is 0 (integer). Will show the time of when the
* bookmark was last updated.
* 'include' - Default is empty string (string). Include other categories
* separated by commas.
* 'exclude' - Default is empty string (string). Exclude other categories
* separated by commas.
* *
* @since 2.1 * @since 2.1
* @uses $wpdb Database Object * @uses $wpdb Database Object
* @link http://codex.wordpress.org/Template_Tags/get_bookmarks
* *
* @param string|array $args List of arguments to overwrite the defaults * @param string|array $args List of arguments to overwrite the defaults
* @return array List of bookmark row objects * @return array List of bookmark row objects
@ -226,12 +236,13 @@ function get_bookmarks($args = '') {
} }
/** /**
* sanitize_bookmark() - Sanitizes all bookmark fields * Sanitizes all bookmark fields
* *
* @since 2.3 * @since 2.3
* *
* @param object|array $bookmark Bookmark row * @param object|array $bookmark Bookmark row
* @param string $context Optional, default is 'display'. How to filter the fields * @param string $context Optional, default is 'display'. How to filter the
* fields
* @return object|array Same type as $bookmark but with fields sanitized. * @return object|array Same type as $bookmark but with fields sanitized.
*/ */
function sanitize_bookmark($bookmark, $context = 'display') { function sanitize_bookmark($bookmark, $context = 'display') {
@ -254,25 +265,27 @@ function sanitize_bookmark($bookmark, $context = 'display') {
} }
/** /**
* sanitize_bookmark_field() - Sanitizes a bookmark field * Sanitizes a bookmark field
* *
* Sanitizes the bookmark fields based on what the field name is. If the field has a * Sanitizes the bookmark fields based on what the field name is. If the field
* strict value set, then it will be tested for that, else a more generic filtering is * has a strict value set, then it will be tested for that, else a more generic
* applied. After the more strict filter is applied, if the $context is 'raw' then the * filtering is applied. After the more strict filter is applied, if the
* value is immediately return. * $context is 'raw' then the value is immediately return.
* *
* Hooks exist for the more generic cases. With the 'edit' context, the 'edit_$field' * Hooks exist for the more generic cases. With the 'edit' context, the
* filter will be called and passed the $value and $bookmark_id respectively. With the * 'edit_$field' filter will be called and passed the $value and $bookmark_id
* 'db' context, the 'pre_$field' filter is called and passed the value. The 'display' * respectively. With the 'db' context, the 'pre_$field' filter is called and
* context is the final context and has the $field has the filter name and is passed the * passed the value. The 'display' context is the final context and has the
* $value, $bookmark_id, and $context respectively. * $field has the filter name and is passed the $value, $bookmark_id, and
* $context respectively.
* *
* @since 2.3 * @since 2.3
* *
* @param string $field The bookmark field * @param string $field The bookmark field
* @param mixed $value The bookmark field value * @param mixed $value The bookmark field value
* @param int $bookmark_id Bookmark ID * @param int $bookmark_id Bookmark ID
* @param string $context How to filter the field value. Either 'raw', 'edit', 'attribute', 'js', 'db', or 'display' * @param string $context How to filter the field value. Either 'raw', 'edit',
* 'attribute', 'js', 'db', or 'display'
* @return mixed The filtered value * @return mixed The filtered value
*/ */
function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
@ -318,7 +331,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
} }
/** /**
* delete_get_bookmark_cache() - Deletes entire bookmark cache * Deletes entire bookmark cache
* *
* @since 2.1 * @since 2.1
* @uses wp_cache_delete() Deletes the contents of 'get_bookmarks' * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks'

View File

@ -2,12 +2,14 @@
/** /**
* Object Cache API * Object Cache API
* *
* @link http://codex.wordpress.org/Function_Reference/WP_Cache
*
* @package WordPress * @package WordPress
* @subpackage Cache * @subpackage Cache
*/ */
/** /**
* wp_cache_add() - Adds data to the cache, if the cache key doesn't aleady exist * Adds data to the cache, if the cache key doesn't aleady exist.
* *
* @since 2.0 * @since 2.0
* @uses $wp_object_cache Object Cache Class * @uses $wp_object_cache Object Cache Class
@ -26,11 +28,12 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
} }
/** /**
* wp_cache_close() - Closes the cache * Closes the cache.
* *
* This function has ceased to do anything since WordPress 2.5. * This function has ceased to do anything since WordPress 2.5. The
* The functionality was removed along with the rest of the * functionality was removed along with the rest of the persistant cache. This
* persistant cache. * does not mean that plugins can't implement this function when they need to
* make sure that the cache is cleaned up after WordPress no longer needs it.
* *
* @since 2.0 * @since 2.0
* *
@ -41,7 +44,7 @@ function wp_cache_close() {
} }
/** /**
* wp_cache_delete() - Removes the cache contents matching ID and flag * Removes the cache contents matching ID and flag.
* *
* @since 2.0 * @since 2.0
* @uses $wp_object_cache Object Cache Class * @uses $wp_object_cache Object Cache Class
@ -58,7 +61,7 @@ function wp_cache_delete($id, $flag = '') {
} }
/** /**
* wp_cache_flush() - Removes all cache items * Removes all cache items.
* *
* @since 2.0 * @since 2.0
* @uses $wp_object_cache Object Cache Class * @uses $wp_object_cache Object Cache Class
@ -73,7 +76,7 @@ function wp_cache_flush() {
} }
/** /**
* wp_cache_get() - Retrieves the cache contents from the cache by ID and flag * Retrieves the cache contents from the cache by ID and flag.
* *
* @since 2.0 * @since 2.0
* @uses $wp_object_cache Object Cache Class * @uses $wp_object_cache Object Cache Class
@ -81,7 +84,8 @@ function wp_cache_flush() {
* *
* @param int|string $id What the contents in the cache are called * @param int|string $id What the contents in the cache are called
* @param string $flag Where the cache contents are grouped * @param string $flag Where the cache contents are grouped
* @return bool|mixed False on failure to retrieve contents or the cache contents on success * @return bool|mixed False on failure to retrieve contents or the cache
* contents on success
*/ */
function wp_cache_get($id, $flag = '') { function wp_cache_get($id, $flag = '') {
global $wp_object_cache; global $wp_object_cache;
@ -90,7 +94,7 @@ function wp_cache_get($id, $flag = '') {
} }
/** /**
* wp_cache_init() - Sets up Object Cache Global and assigns it * Sets up Object Cache Global and assigns it.
* *
* @since 2.0 * @since 2.0
* @global WP_Object_Cache $wp_object_cache WordPress Object Cache * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
@ -100,7 +104,7 @@ function wp_cache_init() {
} }
/** /**
* wp_cache_replace() - Replaces the contents of the cache with new data * Replaces the contents of the cache with new data.
* *
* @since 2.0 * @since 2.0
* @uses $wp_object_cache Object Cache Class * @uses $wp_object_cache Object Cache Class
@ -119,7 +123,7 @@ function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
} }
/** /**
* wp_cache_set() - Saves the data to the cache * Saves the data to the cache.
* *
* @since 2.0 * @since 2.0
* @uses $wp_object_cache Object Cache Class * @uses $wp_object_cache Object Cache Class
@ -138,7 +142,7 @@ function wp_cache_set($key, $data, $flag = '', $expire = 0) {
} }
/** /**
* wp_cache_add_global_groups() - Adds a group or set of groups to the list of global groups * Adds a group or set of groups to the list of global groups.
* *
* @since 2.6 * @since 2.6
* *
@ -150,7 +154,7 @@ function wp_cache_add_global_groups( $groups ) {
} }
/** /**
* wp_cache_add_non_persistent_groups() - Adds a group or set of groups to the list of non-persistent groups * Adds a group or set of groups to the list of non-persistent groups.
* *
* @since 2.6 * @since 2.6
* *
@ -164,14 +168,14 @@ function wp_cache_add_non_persistent_groups( $groups ) {
/** /**
* WordPress Object Cache * WordPress Object Cache
* *
* The WordPress Object Cache is used to save on trips to the database. * The WordPress Object Cache is used to save on trips to the database. The
* The Object Cache stores all of the cache data to memory and makes the * Object Cache stores all of the cache data to memory and makes the cache
* cache contents available by using a key, which is used to name and * contents available by using a key, which is used to name and later retrieve
* later retrieve the cache contents. * the cache contents.
* *
* The Object Cache can be replaced by other caching mechanisms by placing * The Object Cache can be replaced by other caching mechanisms by placing files
* files in the wp-content folder which is looked at in wp-settings. If * in the wp-content folder which is looked at in wp-settings. If that file
* that file exists, then this file will not be included. * exists, then this file will not be included.
* *
* @package WordPress * @package WordPress
* @subpackage Cache * @subpackage Cache
@ -219,7 +223,8 @@ class WP_Object_Cache {
* Adds data to the cache if it doesn't already exist. * Adds data to the cache if it doesn't already exist.
* *
* @uses WP_Object_Cache::get Checks to see if the cache already has data. * @uses WP_Object_Cache::get Checks to see if the cache already has data.
* @uses WP_Object_Cache::set Sets the data after the checking the cache contents existance. * @uses WP_Object_Cache::set Sets the data after the checking the cache
* contents existance.
* *
* @since 2.0 * @since 2.0
* *
@ -242,18 +247,19 @@ class WP_Object_Cache {
/** /**
* Remove the contents of the cache ID in the group * Remove the contents of the cache ID in the group
* *
* If the cache ID does not exist in the group and $force parameter * If the cache ID does not exist in the group and $force parameter is set
* is set to false, then nothing will happen. The $force parameter * to false, then nothing will happen. The $force parameter is set to false
* is set to false by default. * by default.
* *
* On success the group and the id will be added to the * On success the group and the id will be added to the
* $non_existant_objects property in the class. * $non_existant_objects property in the class.
* *
* @since 2.0 * @since 2.0
* *
* @param int|string $id What the contents in the cache are called * @param int|string $id What the contents in the cache are called
* @param string $group Where the cache contents are grouped * @param string $group Where the cache contents are grouped
* @param bool $force Optional. Whether to force the unsetting of the cache ID in the group * @param bool $force Optional. Whether to force the unsetting of the cache
* ID in the group
* @return bool False if the contents weren't deleted and true on success * @return bool False if the contents weren't deleted and true on success
*/ */
function delete($id, $group = 'default', $force = false) { function delete($id, $group = 'default', $force = false) {
@ -284,21 +290,22 @@ class WP_Object_Cache {
/** /**
* Retrieves the cache contents, if it exists * Retrieves the cache contents, if it exists
* *
* The contents will be first attempted to be retrieved by searching * The contents will be first attempted to be retrieved by searching by the
* by the ID in the cache group. If the cache is hit (success) then * ID in the cache group. If the cache is hit (success) then the contents
* the contents are returned. * are returned.
* *
* On failure, the $non_existant_objects property is checked and if * On failure, the $non_existant_objects property is checked and if the
* the cache group and ID exist in there the cache misses will not be * cache group and ID exist in there the cache misses will not be
* incremented. If not in the nonexistant objects property, then the * incremented. If not in the nonexistant objects property, then the cache
* cache misses will be incremented and the cache group and ID will * misses will be incremented and the cache group and ID will be added to
* be added to the nonexistant objects. * the nonexistant objects.
* *
* @since 2.0 * @since 2.0
* *
* @param int|string $id What the contents in the cache are called * @param int|string $id What the contents in the cache are called
* @param string $group Where the cache contents are grouped * @param string $group Where the cache contents are grouped
* @return bool|mixed False on failure to retrieve contents or the cache contents on success * @return bool|mixed False on failure to retrieve contents or the cache
* contents on success
*/ */
function get($id, $group = 'default') { function get($id, $group = 'default') {
if (empty ($group)) if (empty ($group))
@ -342,15 +349,14 @@ class WP_Object_Cache {
/** /**
* Sets the data contents into the cache * Sets the data contents into the cache
* *
* The cache contents is grouped by the $group parameter followed * The cache contents is grouped by the $group parameter followed by the
* by the $id. This allows for duplicate ids in unique groups. * $id. This allows for duplicate ids in unique groups. Therefore, naming of
* Therefore, naming of the group should be used with care and * the group should be used with care and should follow normal function
* should follow normal function naming guidelines outside of * naming guidelines outside of core WordPress usage.
* core WordPress usage.
* *
* The $expire parameter is not used, because the cache will * The $expire parameter is not used, because the cache will automatically
* automatically expire for each time a page is accessed and PHP * expire for each time a page is accessed and PHP finishes. The method is
* finishes. The method is more for cache plugins which use files. * more for cache plugins which use files.
* *
* @since 2.0 * @since 2.0
* *
@ -378,8 +384,8 @@ class WP_Object_Cache {
/** /**
* Echos the stats of the caching. * Echos the stats of the caching.
* *
* Gives the cache hits, and cache misses. Also prints every cached * Gives the cache hits, and cache misses. Also prints every cached group,
* group, key and the data. * key and the data.
* *
* @since 2.0 * @since 2.0
*/ */
@ -417,7 +423,11 @@ class WP_Object_Cache {
* @return null|WP_Object_Cache If cache is disabled, returns null. * @return null|WP_Object_Cache If cache is disabled, returns null.
*/ */
function __construct() { function __construct() {
register_shutdown_function(array(&$this, "__destruct")); /** @todo This should be moved to the PHP4 style constructor, PHP5 already calls __destruct() */ /**
* @todo This should be moved to the PHP4 style constructor, PHP5
* already calls __destruct()
*/
register_shutdown_function(array(&$this, "__destruct"));
} }
/** /**

View File

@ -2,7 +2,8 @@
/** /**
* Canonical API to handle WordPress Redirecting * Canonical API to handle WordPress Redirecting
* *
* Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference" by Mark Jaquith * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference"
* by Mark Jaquith
* *
* @author Scott Yang * @author Scott Yang
* @author Mark Jaquith * @author Mark Jaquith
@ -11,26 +12,29 @@
*/ */
/** /**
* redirect_canonical() - Redirects incoming links to the proper URL based on the site url * Redirects incoming links to the proper URL based on the site url
* *
* Search engines consider www.somedomain.com and somedomain.com to be two different URLs * Search engines consider www.somedomain.com and somedomain.com to be two
* when they both go to the same location. This SEO enhancement prevents penality for * different URLs when they both go to the same location. This SEO enhancement
* duplicate content by redirecting all incoming links to one or the other. * prevents penality for duplicate content by redirecting all incoming links to
* one or the other.
* *
* Prevents redirection for feeds, trackbacks, searches, comment popup, and admin URLs. * Prevents redirection for feeds, trackbacks, searches, comment popup, and
* Does not redirect on IIS, page/post previews, and on form data. * admin URLs. Does not redirect on IIS, page/post previews, and on form data.
* *
* Will also attempt to find the correct link when a user enters a URL that does not exist * Will also attempt to find the correct link when a user enters a URL that does
* based on exact WordPress query. Will instead try to parse the URL or query in an attempt * not exist based on exact WordPress query. Will instead try to parse the URL
* to figure the correct page to go to. * or query in an attempt to figure the correct page to go to.
* *
* @since 2.3 * @since 2.3
* @uses $wp_rewrite * @uses $wp_rewrite
* @uses $is_IIS * @uses $is_IIS
* *
* @param string $requested_url Optional. The URL that was requested, used to figure if redirect is needed. * @param string $requested_url Optional. The URL that was requested, used to
* figure if redirect is needed.
* @param bool $do_redirect Optional. Redirect to the new URL. * @param bool $do_redirect Optional. Redirect to the new URL.
* @return null|false|string Null, if redirect not needed. False, if redirect not needed or the string of the URL * @return null|false|string Null, if redirect not needed. False, if redirect
* not needed or the string of the URL
*/ */
function redirect_canonical($requested_url=null, $do_redirect=true) { function redirect_canonical($requested_url=null, $do_redirect=true) {
global $wp_rewrite, $is_IIS; global $wp_rewrite, $is_IIS;
@ -211,12 +215,13 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
} }
/** /**
* redirect_guess_404_permalink() - Tries to guess correct post based on query vars * Attempts to guess correct post based on query vars
* *
* @since 2.3 * @since 2.3
* @uses $wpdb * @uses $wpdb
* *
* @return bool|string Returns False, if it can't find post, returns correct location on success. * @return bool|string Returns False, if it can't find post, returns correct
* location on success.
*/ */
function redirect_guess_404_permalink() { function redirect_guess_404_permalink() {
global $wpdb; global $wpdb;