PHPDoc fixes and additions. fixes #24616.

git-svn-id: http://core.svn.wordpress.org/trunk@24490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-06-21 12:45:11 +00:00
parent 3864f4cedf
commit 58c364947f
9 changed files with 53 additions and 56 deletions

View File

@ -37,7 +37,7 @@ function get_category_link( $category ) {
* @param string $separator Optional, default is '/'. How to separate categories.
* @param bool $nicename Optional, default is false. Whether to use nice name for display.
* @param array $visited Optional. Already linked to categories to prevent duplicates.
* @return string
* @return string|WP_Error A list of category parents on success, WP_Error on failure.
*/
function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
$chain = '';
@ -131,7 +131,7 @@ function _usort_terms_by_ID( $a, $b ) {
* @since 0.71
*
* @param int $cat_ID Category ID.
* @return string Category name.
* @return string|WP_Error Category name on success, WP_Error on failure.
*/
function get_the_category_by_ID( $cat_ID ) {
$cat_ID = (int) $cat_ID;
@ -980,7 +980,7 @@ function get_tag_link( $tag ) {
* @uses apply_filters() Calls 'get_the_tags' filter on the list of post tags.
*
* @param int $id Post ID.
* @return array
* @return array|bool Array of tag objects on success, false on failure.
*/
function get_the_tags( $id = 0 ) {
return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
@ -996,7 +996,7 @@ function get_the_tags( $id = 0 ) {
* @param string $sep Optional. Between tags.
* @param string $after Optional. After tags.
* @param int $id Optional. Post ID. Defaults to the current post.
* @return string
* @return string|bool|WP_Error A list of tags on success, false or WP_Error on failure.
*/
function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
@ -1010,7 +1010,6 @@ function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
* @param string $before Optional. Before list.
* @param string $sep Optional. Separate items using this.
* @param string $after Optional. After list.
* @return string
*/
function the_tags( $before = null, $sep = ', ', $after = '' ) {
if ( null === $before )
@ -1054,9 +1053,9 @@ function term_description( $term = 0, $taxonomy = 'post_tag' ) {
*
* @since 2.5.0
*
* @param mixed $post Post ID or object.
* @param int|object $post Post ID or object.
* @param string $taxonomy Taxonomy name.
* @return array|bool False on failure. Array of term objects on success.
* @return array|bool|WP_Error Array of term objects on success, false or WP_Error on failure.
*/
function get_the_terms( $post, $taxonomy ) {
if ( ! $post = get_post( $post ) )
@ -1086,7 +1085,7 @@ function get_the_terms( $post, $taxonomy ) {
* @param string $before Optional. Before list.
* @param string $sep Optional. Separate items using this.
* @param string $after Optional. After list.
* @return string
* @return string|bool|WP_Error A list of terms on success, false or WP_Error on failure.
*/
function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
$terms = get_the_terms( $id, $taxonomy );

View File

@ -539,7 +539,7 @@ function get_comment_count( $post_id = 0 ) {
* @param string $meta_key Metadata name.
* @param mixed $meta_value Metadata value.
* @param bool $unique Optional, default is false. Whether the same key should not be added.
* @return bool False for failure. True for success.
* @return int|bool Meta ID on success, false on failure.
*/
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
@ -559,7 +559,7 @@ function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false)
* @param int $comment_id comment ID
* @param string $meta_key Metadata name.
* @param mixed $meta_value Optional. Metadata value.
* @return bool False for failure. True for success.
* @return bool True on success, false on failure.
*/
function delete_comment_meta($comment_id, $meta_key, $meta_value = '') {
return delete_metadata('comment', $comment_id, $meta_key, $meta_value);
@ -598,7 +598,7 @@ function get_comment_meta($comment_id, $key = '', $single = false) {
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value.
* @param mixed $prev_value Optional. Previous value to check before removing.
* @return bool False on failure, true if success.
* @return bool True on success, false on failure.
*/
function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') {
return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value);
@ -994,7 +994,7 @@ function wp_count_comments( $post_id = 0 ) {
*
* @param int $comment_id Comment ID
* @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
* @return bool False if delete comment query failure, true on success.
* @return bool True on success, false on failure.
*/
function wp_delete_comment($comment_id, $force_delete = false) {
global $wpdb;
@ -1044,7 +1044,7 @@ function wp_delete_comment($comment_id, $force_delete = false) {
* @uses wp_delete_comment() if trash is disabled
*
* @param int $comment_id Comment ID.
* @return mixed False on failure
* @return bool True on success, false on failure.
*/
function wp_trash_comment($comment_id) {
if ( !EMPTY_TRASH_DAYS )
@ -1073,7 +1073,7 @@ function wp_trash_comment($comment_id) {
* @uses do_action() on 'untrashed_comment' after untrashing
*
* @param int $comment_id Comment ID.
* @return mixed False on failure
* @return bool True on success, false on failure.
*/
function wp_untrash_comment($comment_id) {
if ( ! (int)$comment_id )
@ -1103,7 +1103,7 @@ function wp_untrash_comment($comment_id) {
* @uses do_action() on 'spammed_comment' after spamming
*
* @param int $comment_id Comment ID.
* @return mixed False on failure
* @return bool True on success, false on failure.
*/
function wp_spam_comment($comment_id) {
if ( !$comment = get_comment($comment_id) )
@ -1128,7 +1128,7 @@ function wp_spam_comment($comment_id) {
* @uses do_action() on 'unspammed_comment' after unspamming
*
* @param int $comment_id Comment ID.
* @return mixed False on failure
* @return bool True on success, false on failure.
*/
function wp_unspam_comment($comment_id) {
if ( ! (int)$comment_id )
@ -1423,7 +1423,7 @@ function wp_new_comment( $commentdata ) {
* @param int $comment_id Comment ID.
* @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'trash'.
* @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false.
* @return bool False on failure or deletion and true on success.
* @return bool|WP_Error True on success, false or WP_Error on failure.
*/
function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
global $wpdb;
@ -1601,7 +1601,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
* @uses do_action() Calls 'edit_posts' hook on $post_id and $post
*
* @param int $post_id Post ID
* @return bool False on '0' $post_id or if post with ID does not exist. True on success.
* @return bool True on success, false on '0' $post_id or if post with ID does not exist.
*/
function wp_update_comment_count_now($post_id) {
global $wpdb;

View File

@ -3116,7 +3116,7 @@ function wp_sprintf_l($pattern, $args) {
*
* @since 2.5.0
*
* @param integer $str String to get the excerpt from.
* @param string $str String to get the excerpt from.
* @param integer $count Maximum number of characters to take.
* @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string.
* @return string The excerpt.

View File

@ -296,14 +296,14 @@ function edButton(id, display, tagStart, tagEnd, access, open) {
* QTags.addButton( 'my_id', 'my button', '<span>', '</span>' );
* QTags.addButton( 'my_id2', 'my button', '<br />' );
*
* @param id string required Button HTML ID
* @param display string required Button's value="..."
* @param arg1 string || function required Either a starting tag to be inserted like "<span>" or a callback that is executed when the button is clicked.
* @param arg2 string optional Ending tag like "</span>"
* @param access_key string optional Access key for the button.
* @param title string optional Button's title="..."
* @param priority int optional Number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc.
* @param instance string optional Limit the button to a specifric instance of Quicktags, add to all instances if not present.
* @param string id Required. Button HTML ID
* @param string display Required. Button's value="..."
* @param string|function arg1 Required. Either a starting tag to be inserted like "<span>" or a callback that is executed when the button is clicked.
* @param string arg2 Optional. Ending tag like "</span>"
* @param string access_key Optional. Access key for the button.
* @param string title Optional. Button's title="..."
* @param int priority Optional. Number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc.
* @param string instance Optional. Limit the button to a specifric instance of Quicktags, add to all instances if not present.
* @return mixed null or the button object that is needed for back-compat.
*/
qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {

View File

@ -232,7 +232,7 @@ function post_permalink( $post_id = 0, $deprecated = '' ) {
*
* @since 1.5.0
*
* @param mixed $post Optional. Post ID or object.
* @param int|object $post Optional. Post ID or object.
* @param bool $leavename Optional, defaults to false. Whether to keep page name.
* @param bool $sample Optional, defaults to false. Is it a sample permalink.
* @return string
@ -256,7 +256,7 @@ function get_page_link( $post = false, $leavename = false, $sample = false ) {
* @since 2.1.0
* @access private
*
* @param mixed $post Optional. Post ID or object.
* @param int|object $post Optional. Post ID or object.
* @param bool $leavename Optional. Leave name.
* @param bool $sample Optional. Sample permalink.
* @return string
@ -291,7 +291,7 @@ function _get_page_link( $post = false, $leavename = false, $sample = false ) {
*
* @since 2.0.0
*
* @param mixed $post Optional. Post ID or object.
* @param int|object $post Optional. Post ID or object.
* @param bool $leavename Optional. Leave name.
* @return string
*/

View File

@ -26,7 +26,7 @@
* @param bool $unique Optional, default is false. Whether the specified metadata key should be
* unique for the object. If true, and the object already has a value for the specified
* metadata key, no change will be made
* @return bool The meta ID on successful update, false on failure.
* @return int|bool The meta ID on successful update, false on failure.
*/
function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
if ( !$meta_type || !$meta_key )

View File

@ -96,7 +96,7 @@ function the_title_attribute( $args = '' ) {
*
* @since 0.71
*
* @param mixed $post Optional. Post ID or object.
* @param int|object $post Optional. Post ID or object.
* @return string
*/
function get_the_title( $post = 0 ) {
@ -1265,7 +1265,7 @@ function get_the_password_form( $post = 0 ) {
* @uses $wp_query
*
* @param string $template The specific template name if specific matching is required.
* @return bool False on failure, true if success.
* @return bool True on success, false on failure.
*/
function is_page_template( $template = '' ) {
if ( ! is_page() )

View File

@ -203,7 +203,7 @@ function get_attached_file( $attachment_id, $unfiltered = false ) {
*
* @param int $attachment_id Attachment ID
* @param string $file File path for the attachment
* @return bool False on failure, true on success.
* @return bool True on success, false on failure.
*/
function update_attached_file( $attachment_id, $file ) {
if ( !get_post( $attachment_id ) )
@ -724,10 +724,10 @@ function get_post_ancestors( $post ) {
* @since 2.3.0
* @uses sanitize_post_field() See for possible $context values.
*
* @param string $field Post field name
* @param id $post Post ID
* @param string $context Optional. How to filter the field. Default is display.
* @return bool|string False on failure or returns the value in post field
* @param string $field Post field name.
* @param int|object $post Post ID or post object.
* @param string $context Optional. How to filter the field. Default is 'display'.
* @return string The value of the post field on success, empty string on failure.
*/
function get_post_field( $field, $post, $context = 'display' ) {
$post = get_post( $post );
@ -749,8 +749,8 @@ function get_post_field( $field, $post, $context = 'display' ) {
*
* @since 2.0.0
*
* @param int $ID Optional. Post ID.
* @return bool|string False on failure or returns the mime type
* @param int $ID Optional. Post ID. Default is the current post from the loop.
* @return string|bool The mime type on success, false on failure.
*/
function get_post_mime_type($ID = '') {
$post = get_post($ID);
@ -769,8 +769,8 @@ function get_post_mime_type($ID = '') {
*
* @since 2.0.0
*
* @param int $ID Post ID
* @return string|bool Post status or false on failure.
* @param int $ID Optional. Post ID. Default is the current post from the loop.
* @return string|bool Post status on success, false on failure.
*/
function get_post_status($ID = '') {
$post = get_post($ID);
@ -1009,10 +1009,8 @@ function post_type_exists( $post_type ) {
*
* @since 2.1.0
*
* @uses $post The Loop current post global
*
* @param mixed $post Optional. Post object or post ID.
* @return bool|string post type or false on failure.
* @param int|object $post Optional. Post ID or post object. Default is the current post from the loop.
* @return string|bool Post type on success, false on failure.
*/
function get_post_type( $post = null ) {
if ( $post = get_post( $post ) )
@ -1675,7 +1673,7 @@ function get_posts($args = null) {
* @param string $meta_key Metadata name.
* @param mixed $meta_value Metadata value.
* @param bool $unique Optional, default is false. Whether the same key should not be added.
* @return bool False for failure. True for success.
* @return int|bool Meta ID on success, false on failure.
*/
function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
// make sure meta is added to the post, not a revision
@ -1699,7 +1697,7 @@ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
* @param int $post_id post ID
* @param string $meta_key Metadata name.
* @param mixed $meta_value Optional. Metadata value.
* @return bool False for failure. True for success.
* @return bool True on success, false on failure.
*/
function delete_post_meta($post_id, $meta_key, $meta_value = '') {
// make sure meta is added to the post, not a revision
@ -1742,7 +1740,7 @@ function get_post_meta($post_id, $key = '', $single = false) {
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value.
* @param mixed $prev_value Optional. Previous value to check before removing.
* @return bool False on failure, true if success.
* @return bool True on success, false on failure.
*/
function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
// make sure meta is added to the post, not a revision
@ -2391,7 +2389,7 @@ function wp_untrash_post($post_id = 0) {
* @uses do_action() on 'trash_post_comments' before trashing
* @uses do_action() on 'trashed_post_comments' after trashing
*
* @param int $post Post ID or object.
* @param int|object $post Post ID or object.
* @return mixed False on failure
*/
function wp_trash_post_comments($post = null) {
@ -2432,7 +2430,7 @@ function wp_trash_post_comments($post = null) {
* @uses do_action() on 'untrash_post_comments' before trashing
* @uses do_action() on 'untrashed_post_comments' after trashing
*
* @param int $post Post ID or object.
* @param int|object $post Post ID or object.
* @return mixed False on failure
*/
function wp_untrash_post_comments($post = null) {
@ -2953,7 +2951,7 @@ function wp_update_post( $postarr = array(), $wp_error = false ) {
* @uses $wpdb
* @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data.
*
* @param mixed $post Post ID or object.
* @param int|object $post Post ID or object.
*/
function wp_publish_post( $post ) {
global $wpdb;
@ -4606,7 +4604,7 @@ function update_post_cache( &$posts ) {
*
* @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
*
* @param object|int $post The post object or ID to remove from the cache
* @param int|object $post Post ID or object to remove from the cache
*/
function clean_post_cache( $post ) {
global $_wp_suspend_cache_invalidation, $wpdb;

View File

@ -791,7 +791,7 @@ function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
* @param string $meta_key Metadata name.
* @param mixed $meta_value Metadata value.
* @param bool $unique Optional, default is false. Whether the same key should not be added.
* @return bool False for failure. True for success.
* @return int|bool Meta ID on success, false on failure.
*/
function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {
return add_metadata('user', $user_id, $meta_key, $meta_value, $unique);
@ -811,7 +811,7 @@ function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {
* @param int $user_id user ID
* @param string $meta_key Metadata name.
* @param mixed $meta_value Optional. Metadata value.
* @return bool False for failure. True for success.
* @return bool True on success, false on failure.
*/
function delete_user_meta($user_id, $meta_key, $meta_value = '') {
return delete_metadata('user', $user_id, $meta_key, $meta_value);
@ -850,7 +850,7 @@ function get_user_meta($user_id, $key = '', $single = false) {
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value.
* @param mixed $prev_value Optional. Previous value to check before removing.
* @return bool False on failure, true if success.
* @return bool True on success, false on failure.
*/
function update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') {
return update_metadata('user', $user_id, $meta_key, $meta_value, $prev_value);