WordPress.org

Make WordPress Core

Ticket #24616: 24616.2.patch

File 24616.2.patch, 18.1 KB (added by SergeyBiryukov, 5 years ago)
  • wp-includes/category-template.php

     
    3737 * @param string $separator Optional, default is '/'. How to separate categories.
    3838 * @param bool $nicename Optional, default is false. Whether to use nice name for display.
    3939 * @param array $visited Optional. Already linked to categories to prevent duplicates.
    40  * @return string
     40 * @return string|WP_Error A list of category parents on success, WP_Error on failure.
    4141 */
    4242function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
    4343        $chain = '';
     
    131131 * @since 0.71
    132132 *
    133133 * @param int $cat_ID Category ID.
    134  * @return string Category name.
     134 * @return string|WP_Error Category name on success, WP_Error on failure.
    135135 */
    136136function get_the_category_by_ID( $cat_ID ) {
    137137        $cat_ID = (int) $cat_ID;
     
    980980 * @uses apply_filters() Calls 'get_the_tags' filter on the list of post tags.
    981981 *
    982982 * @param int $id Post ID.
    983  * @return array
     983 * @return array|bool Array of tag objects on success, false on failure.
    984984 */
    985985function get_the_tags( $id = 0 ) {
    986986        return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
     
    996996 * @param string $sep Optional. Between tags.
    997997 * @param string $after Optional. After tags.
    998998 * @param int $id Optional. Post ID. Defaults to the current post.
    999  * @return string
     999 * @return string|bool|WP_Error A list of tags on success, false or WP_Error on failure.
    10001000 */
    10011001function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
    10021002        return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
     
    10101010 * @param string $before Optional. Before list.
    10111011 * @param string $sep Optional. Separate items using this.
    10121012 * @param string $after Optional. After list.
    1013  * @return string
    10141013 */
    10151014function the_tags( $before = null, $sep = ', ', $after = '' ) {
    10161015        if ( null === $before )
     
    10541053 *
    10551054 * @since 2.5.0
    10561055 *
    1057  * @param mixed $post Post ID or object.
     1056 * @param int|object $post Post ID or object.
    10581057 * @param string $taxonomy Taxonomy name.
    1059  * @return array|bool False on failure. Array of term objects on success.
     1058 * @return array|bool|WP_Error Array of term objects on success, false or WP_Error on failure.
    10601059 */
    10611060function get_the_terms( $post, $taxonomy ) {
    10621061        if ( ! $post = get_post( $post ) )
     
    10861085 * @param string $before Optional. Before list.
    10871086 * @param string $sep Optional. Separate items using this.
    10881087 * @param string $after Optional. After list.
    1089  * @return string
     1088 * @return string|bool|WP_Error A list of terms on success, false or WP_Error on failure.
    10901089 */
    10911090function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
    10921091        $terms = get_the_terms( $id, $taxonomy );
  • wp-includes/comment.php

     
    539539 * @param string $meta_key Metadata name.
    540540 * @param mixed $meta_value Metadata value.
    541541 * @param bool $unique Optional, default is false. Whether the same key should not be added.
    542  * @return bool False for failure. True for success.
     542 * @return int|bool Meta ID on success, false on failure.
    543543 */
    544544function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
    545545        return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
     
    559559 * @param int $comment_id comment ID
    560560 * @param string $meta_key Metadata name.
    561561 * @param mixed $meta_value Optional. Metadata value.
    562  * @return bool False for failure. True for success.
     562 * @return bool True on success, false on failure.
    563563 */
    564564function delete_comment_meta($comment_id, $meta_key, $meta_value = '') {
    565565        return delete_metadata('comment', $comment_id, $meta_key, $meta_value);
     
    598598 * @param string $meta_key Metadata key.
    599599 * @param mixed $meta_value Metadata value.
    600600 * @param mixed $prev_value Optional. Previous value to check before removing.
    601  * @return bool False on failure, true if success.
     601 * @return bool True on success, false on failure.
    602602 */
    603603function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') {
    604604        return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value);
     
    994994 *
    995995 * @param int $comment_id Comment ID
    996996 * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
    997  * @return bool False if delete comment query failure, true on success.
     997 * @return bool True on success, false on failure.
    998998 */
    999999function wp_delete_comment($comment_id, $force_delete = false) {
    10001000        global $wpdb;
     
    10441044 * @uses wp_delete_comment() if trash is disabled
    10451045 *
    10461046 * @param int $comment_id Comment ID.
    1047  * @return mixed False on failure
     1047 * @return bool True on success, false on failure.
    10481048 */
    10491049function wp_trash_comment($comment_id) {
    10501050        if ( !EMPTY_TRASH_DAYS )
     
    10731073 * @uses do_action() on 'untrashed_comment' after untrashing
    10741074 *
    10751075 * @param int $comment_id Comment ID.
    1076  * @return mixed False on failure
     1076 * @return bool True on success, false on failure.
    10771077 */
    10781078function wp_untrash_comment($comment_id) {
    10791079        if ( ! (int)$comment_id )
     
    11031103 * @uses do_action() on 'spammed_comment' after spamming
    11041104 *
    11051105 * @param int $comment_id Comment ID.
    1106  * @return mixed False on failure
     1106 * @return bool True on success, false on failure.
    11071107 */
    11081108function wp_spam_comment($comment_id) {
    11091109        if ( !$comment = get_comment($comment_id) )
     
    11281128 * @uses do_action() on 'unspammed_comment' after unspamming
    11291129 *
    11301130 * @param int $comment_id Comment ID.
    1131  * @return mixed False on failure
     1131 * @return bool True on success, false on failure.
    11321132 */
    11331133function wp_unspam_comment($comment_id) {
    11341134        if ( ! (int)$comment_id )
     
    14231423 * @param int $comment_id Comment ID.
    14241424 * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'trash'.
    14251425 * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false.
    1426  * @return bool False on failure or deletion and true on success.
     1426 * @return bool|WP_Error True on success, false or WP_Error on failure.
    14271427 */
    14281428function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
    14291429        global $wpdb;
     
    16011601 * @uses do_action() Calls 'edit_posts' hook on $post_id and $post
    16021602 *
    16031603 * @param int $post_id Post ID
    1604  * @return bool False on '0' $post_id or if post with ID does not exist. True on success.
     1604 * @return bool True on success, false on '0' $post_id or if post with ID does not exist.
    16051605 */
    16061606function wp_update_comment_count_now($post_id) {
    16071607        global $wpdb;
  • wp-includes/formatting.php

     
    31163116 *
    31173117 * @since 2.5.0
    31183118 *
    3119  * @param integer $str String to get the excerpt from.
     3119 * @param string $str String to get the excerpt from.
    31203120 * @param integer $count Maximum number of characters to take.
    31213121 * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string.
    31223122 * @return string The excerpt.
  • wp-includes/js/quicktags.js

     
    296296         *     QTags.addButton( 'my_id', 'my button', '<span>', '</span>' );
    297297         *     QTags.addButton( 'my_id2', 'my button', '<br />' );
    298298         *
    299          * @param id string required Button HTML ID
    300          * @param display string required Button's value="..."
    301          * @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.
    302          * @param arg2 string optional Ending tag like "</span>"
    303          * @param access_key string optional Access key for the button.
    304          * @param title string optional Button's title="..."
    305          * @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.
    306          * @param instance string optional Limit the button to a specifric instance of Quicktags, add to all instances if not present.
     299         * @param string id Required. Button HTML ID
     300         * @param string display Required. Button's value="..."
     301         * @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.
     302         * @param string arg2 Optional. Ending tag like "</span>"
     303         * @param string access_key Optional. Access key for the button.
     304         * @param string title Optional. Button's title="..."
     305         * @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.
     306         * @param string instance Optional. Limit the button to a specifric instance of Quicktags, add to all instances if not present.
    307307         * @return mixed null or the button object that is needed for back-compat.
    308308         */
    309309        qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {
  • wp-includes/link-template.php

     
    232232 *
    233233 * @since 1.5.0
    234234 *
    235  * @param mixed $post Optional. Post ID or object.
     235 * @param int|object $post Optional. Post ID or object.
    236236 * @param bool $leavename Optional, defaults to false. Whether to keep page name.
    237237 * @param bool $sample Optional, defaults to false. Is it a sample permalink.
    238238 * @return string
     
    256256 * @since 2.1.0
    257257 * @access private
    258258 *
    259  * @param mixed $post Optional. Post ID or object.
     259 * @param int|object $post Optional. Post ID or object.
    260260 * @param bool $leavename Optional. Leave name.
    261261 * @param bool $sample Optional. Sample permalink.
    262262 * @return string
     
    291291 *
    292292 * @since 2.0.0
    293293 *
    294  * @param mixed $post Optional. Post ID or object.
     294 * @param int|object $post Optional. Post ID or object.
    295295 * @param bool $leavename Optional. Leave name.
    296296 * @return string
    297297 */
  • wp-includes/meta.php

     
    2626 * @param bool $unique Optional, default is false. Whether the specified metadata key should be
    2727 *              unique for the object. If true, and the object already has a value for the specified
    2828 *              metadata key, no change will be made
    29  * @return bool The meta ID on successful update, false on failure.
     29 * @return int|bool The meta ID on successful update, false on failure.
    3030 */
    3131function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
    3232        if ( !$meta_type || !$meta_key )
  • wp-includes/post-template.php

     
    9696 *
    9797 * @since 0.71
    9898 *
    99  * @param mixed $post Optional. Post ID or object.
     99 * @param int|object $post Optional. Post ID or object.
    100100 * @return string
    101101 */
    102102function get_the_title( $post = 0 ) {
     
    12651265 * @uses $wp_query
    12661266 *
    12671267 * @param string $template The specific template name if specific matching is required.
    1268  * @return bool False on failure, true if success.
     1268 * @return bool True on success, false on failure.
    12691269 */
    12701270function is_page_template( $template = '' ) {
    12711271        if ( ! is_page() )
  • wp-includes/post.php

     
    203203 *
    204204 * @param int $attachment_id Attachment ID
    205205 * @param string $file File path for the attachment
    206  * @return bool False on failure, true on success.
     206 * @return bool True on success, false on failure.
    207207 */
    208208function update_attached_file( $attachment_id, $file ) {
    209209        if ( !get_post( $attachment_id ) )
     
    724724 * @since 2.3.0
    725725 * @uses sanitize_post_field() See for possible $context values.
    726726 *
    727  * @param string $field Post field name
    728  * @param id $post Post ID
    729  * @param string $context Optional. How to filter the field. Default is display.
    730  * @return bool|string False on failure or returns the value in post field
     727 * @param string $field Post field name.
     728 * @param int|object $post Post ID or post object.
     729 * @param string $context Optional. How to filter the field. Default is 'display'.
     730 * @return string The value of the post field on success, empty string on failure.
    731731 */
    732732function get_post_field( $field, $post, $context = 'display' ) {
    733733        $post = get_post( $post );
     
    749749 *
    750750 * @since 2.0.0
    751751 *
    752  * @param int $ID Optional. Post ID.
    753  * @return bool|string False on failure or returns the mime type
     752 * @param int $ID Optional. Post ID. Default is the current post from the loop.
     753 * @return string|bool The mime type on success, false on failure.
    754754 */
    755755function get_post_mime_type($ID = '') {
    756756        $post = get_post($ID);
     
    769769 *
    770770 * @since 2.0.0
    771771 *
    772  * @param int $ID Post ID
    773  * @return string|bool Post status or false on failure.
     772 * @param int $ID Optional. Post ID. Default is the current post from the loop.
     773 * @return string|bool Post status on success, false on failure.
    774774 */
    775775function get_post_status($ID = '') {
    776776        $post = get_post($ID);
     
    10091009 *
    10101010 * @since 2.1.0
    10111011 *
    1012  * @uses $post The Loop current post global
    1013  *
    1014  * @param mixed $post Optional. Post object or post ID.
    1015  * @return bool|string post type or false on failure.
     1012 * @param int|object $post Optional. Post ID or post object. Default is the current post from the loop.
     1013 * @return string|bool Post type on success, false on failure.
    10161014 */
    10171015function get_post_type( $post = null ) {
    10181016        if ( $post = get_post( $post ) )
     
    16751673 * @param string $meta_key Metadata name.
    16761674 * @param mixed $meta_value Metadata value.
    16771675 * @param bool $unique Optional, default is false. Whether the same key should not be added.
    1678  * @return bool False for failure. True for success.
     1676 * @return int|bool Meta ID on success, false on failure.
    16791677 */
    16801678function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
    16811679        // make sure meta is added to the post, not a revision
     
    16991697 * @param int $post_id post ID
    17001698 * @param string $meta_key Metadata name.
    17011699 * @param mixed $meta_value Optional. Metadata value.
    1702  * @return bool False for failure. True for success.
     1700 * @return bool True on success, false on failure.
    17031701 */
    17041702function delete_post_meta($post_id, $meta_key, $meta_value = '') {
    17051703        // make sure meta is added to the post, not a revision
     
    17421740 * @param string $meta_key Metadata key.
    17431741 * @param mixed $meta_value Metadata value.
    17441742 * @param mixed $prev_value Optional. Previous value to check before removing.
    1745  * @return bool False on failure, true if success.
     1743 * @return bool True on success, false on failure.
    17461744 */
    17471745function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
    17481746        // make sure meta is added to the post, not a revision
     
    23912389 * @uses do_action() on 'trash_post_comments' before trashing
    23922390 * @uses do_action() on 'trashed_post_comments' after trashing
    23932391 *
    2394  * @param int $post Post ID or object.
     2392 * @param int|object $post Post ID or object.
    23952393 * @return mixed False on failure
    23962394 */
    23972395function wp_trash_post_comments($post = null) {
     
    24322430 * @uses do_action() on 'untrash_post_comments' before trashing
    24332431 * @uses do_action() on 'untrashed_post_comments' after trashing
    24342432 *
    2435  * @param int $post Post ID or object.
     2433 * @param int|object $post Post ID or object.
    24362434 * @return mixed False on failure
    24372435 */
    24382436function wp_untrash_post_comments($post = null) {
     
    29532951 * @uses $wpdb
    29542952 * @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data.
    29552953 *
    2956  * @param mixed $post Post ID or object.
     2954 * @param int|object $post Post ID or object.
    29572955 */
    29582956function wp_publish_post( $post ) {
    29592957        global $wpdb;
     
    46064604 *
    46074605 * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
    46084606 *
    4609  * @param object|int $post The post object or ID to remove from the cache
     4607 * @param int|object $post Post ID or object to remove from the cache
    46104608 */
    46114609function clean_post_cache( $post ) {
    46124610        global $_wp_suspend_cache_invalidation, $wpdb;
  • wp-includes/user.php

     
    791791 * @param string $meta_key Metadata name.
    792792 * @param mixed $meta_value Metadata value.
    793793 * @param bool $unique Optional, default is false. Whether the same key should not be added.
    794  * @return bool False for failure. True for success.
     794 * @return int|bool Meta ID on success, false on failure.
    795795 */
    796796function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {
    797797        return add_metadata('user', $user_id, $meta_key, $meta_value, $unique);
     
    811811 * @param int $user_id user ID
    812812 * @param string $meta_key Metadata name.
    813813 * @param mixed $meta_value Optional. Metadata value.
    814  * @return bool False for failure. True for success.
     814 * @return bool True on success, false on failure.
    815815 */
    816816function delete_user_meta($user_id, $meta_key, $meta_value = '') {
    817817        return delete_metadata('user', $user_id, $meta_key, $meta_value);
     
    850850 * @param string $meta_key Metadata key.
    851851 * @param mixed $meta_value Metadata value.
    852852 * @param mixed $prev_value Optional. Previous value to check before removing.
    853  * @return bool False on failure, true if success.
     853 * @return bool True on success, false on failure.
    854854 */
    855855function update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') {
    856856        return update_metadata('user', $user_id, $meta_key, $meta_value, $prev_value);