Make WordPress Core

Changeset 45667


Ignore:
Timestamp:
07/25/2019 12:47:53 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename $r variable used with wp_parse_args() to $parsed_args for clarity.

Props freewebmentor.
Fixes #45059.

Location:
trunk/src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/bookmark.php

    r43598 r45667  
    163163        );
    164164
    165         $args = wp_parse_args( $linkdata, $defaults );
    166         $r    = wp_unslash( sanitize_bookmark( $args, 'db' ) );
    167 
    168         $link_id   = $r['link_id'];
    169         $link_name = $r['link_name'];
    170         $link_url  = $r['link_url'];
     165        $parsed_args = wp_parse_args( $linkdata, $defaults );
     166        $parsed_args = wp_unslash( sanitize_bookmark( $parsed_args, 'db' ) );
     167
     168        $link_id   = $parsed_args['link_id'];
     169        $link_name = $parsed_args['link_name'];
     170        $link_url  = $parsed_args['link_url'];
    171171
    172172        $update = false;
     
    187187        }
    188188
    189         $link_rating      = ( ! empty( $r['link_rating'] ) ) ? $r['link_rating'] : 0;
    190         $link_image       = ( ! empty( $r['link_image'] ) ) ? $r['link_image'] : '';
    191         $link_target      = ( ! empty( $r['link_target'] ) ) ? $r['link_target'] : '';
    192         $link_visible     = ( ! empty( $r['link_visible'] ) ) ? $r['link_visible'] : 'Y';
    193         $link_owner       = ( ! empty( $r['link_owner'] ) ) ? $r['link_owner'] : get_current_user_id();
    194         $link_notes       = ( ! empty( $r['link_notes'] ) ) ? $r['link_notes'] : '';
    195         $link_description = ( ! empty( $r['link_description'] ) ) ? $r['link_description'] : '';
    196         $link_rss         = ( ! empty( $r['link_rss'] ) ) ? $r['link_rss'] : '';
    197         $link_rel         = ( ! empty( $r['link_rel'] ) ) ? $r['link_rel'] : '';
    198         $link_category    = ( ! empty( $r['link_category'] ) ) ? $r['link_category'] : array();
     189        $link_rating      = ( ! empty( $parsed_args['link_rating'] ) ) ? $parsed_args['link_rating'] : 0;
     190        $link_image       = ( ! empty( $parsed_args['link_image'] ) ) ? $parsed_args['link_image'] : '';
     191        $link_target      = ( ! empty( $parsed_args['link_target'] ) ) ? $parsed_args['link_target'] : '';
     192        $link_visible     = ( ! empty( $parsed_args['link_visible'] ) ) ? $parsed_args['link_visible'] : 'Y';
     193        $link_owner       = ( ! empty( $parsed_args['link_owner'] ) ) ? $parsed_args['link_owner'] : get_current_user_id();
     194        $link_notes       = ( ! empty( $parsed_args['link_notes'] ) ) ? $parsed_args['link_notes'] : '';
     195        $link_description = ( ! empty( $parsed_args['link_description'] ) ) ? $parsed_args['link_description'] : '';
     196        $link_rss         = ( ! empty( $parsed_args['link_rss'] ) ) ? $parsed_args['link_rss'] : '';
     197        $link_rel         = ( ! empty( $parsed_args['link_rel'] ) ) ? $parsed_args['link_rel'] : '';
     198        $link_category    = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array();
    199199
    200200        // Make sure we set a valid category.
  • trunk/src/wp-admin/includes/media.php

    r45599 r45667  
    14941494                'show_title' => true,
    14951495        );
    1496         $args         = wp_parse_args( $args, $default_args );
     1496
     1497        $parsed_args = wp_parse_args( $args, $default_args );
    14971498
    14981499        /**
     
    15031504         * @see get_media_item
    15041505         *
    1505          * @param array $args An array of arguments.
     1506         * @param array $parsed_args An array of arguments.
    15061507         */
    1507         $r = apply_filters( 'get_media_item_args', $args );
     1508        $parsed_args = apply_filters( 'get_media_item_args', $parsed_args );
    15081509
    15091510        $toggle_on  = __( 'Show' );
     
    15191520        $type_html       = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
    15201521
    1521         $form_fields = get_attachment_fields_to_edit( $post, $r['errors'] );
    1522 
    1523         if ( $r['toggle'] ) {
    1524                 $class        = empty( $r['errors'] ) ? 'startclosed' : 'startopen';
     1522        $form_fields = get_attachment_fields_to_edit( $post, $parsed_args['errors'] );
     1523
     1524        if ( $parsed_args['toggle'] ) {
     1525                $class        = empty( $parsed_args['errors'] ) ? 'startclosed' : 'startopen';
    15251526                $toggle_links = "
    15261527        <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
     
    15321533
    15331534        $display_title = ( ! empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
    1534         $display_title = $r['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . '</span></div>' : '';
     1535        $display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . '</span></div>' : '';
    15351536
    15361537        $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
     
    16101611        );
    16111612
    1612         if ( $r['send'] ) {
    1613                 $r['send'] = get_submit_button( __( 'Insert into Post' ), '', "send[$attachment_id]", false );
    1614         }
    1615 
    1616         $delete = empty( $r['delete'] ) ? '' : $r['delete'];
     1613        if ( $parsed_args['send'] ) {
     1614                $parsed_args['send'] = get_submit_button( __( 'Insert into Post' ), '', "send[$attachment_id]", false );
     1615        }
     1616
     1617        $delete = empty( $parsed_args['delete'] ) ? '' : $parsed_args['delete'];
    16171618        if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
    16181619                if ( ! EMPTY_TRASH_DAYS ) {
     
    16511652        }
    16521653
    1653         if ( ( $r['send'] || $thumbnail || $delete ) && ! isset( $form_fields['buttons'] ) ) {
    1654                 $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $r['send'] . " $thumbnail $delete</td></tr>\n" );
     1654        if ( ( $parsed_args['send'] || $thumbnail || $delete ) && ! isset( $form_fields['buttons'] ) ) {
     1655                $form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $parsed_args['send'] . " $thumbnail $delete</td></tr>\n" );
    16551656        }
    16561657        $hidden_fields = array();
  • trunk/src/wp-admin/includes/meta-boxes.php

    r45599 r45667  
    493493                $args = $box['args'];
    494494        }
    495         $r                     = wp_parse_args( $args, $defaults );
    496         $tax_name              = esc_attr( $r['taxonomy'] );
    497         $taxonomy              = get_taxonomy( $r['taxonomy'] );
     495        $parsed_args           = wp_parse_args( $args, $defaults );
     496        $tax_name              = esc_attr( $parsed_args['taxonomy'] );
     497        $taxonomy              = get_taxonomy( $parsed_args['taxonomy'] );
    498498        $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
    499499        $comma                 = _x( ',', 'tag delimiter' );
     
    556556                $args = $box['args'];
    557557        }
    558         $r        = wp_parse_args( $args, $defaults );
    559         $tax_name = esc_attr( $r['taxonomy'] );
    560         $taxonomy = get_taxonomy( $r['taxonomy'] );
     558        $parsed_args = wp_parse_args( $args, $defaults );
     559        $tax_name    = esc_attr( $parsed_args['taxonomy'] );
     560        $taxonomy    = get_taxonomy( $parsed_args['taxonomy'] );
    561561        ?>
    562562        <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
     
    13111311                <td><select name="link_rating" id="link_rating" size="1">
    13121312                <?php
    1313                 for ( $r = 0; $r <= 10; $r++ ) {
    1314                         echo '<option value="' . $r . '"';
    1315                         if ( isset( $link->link_rating ) && $link->link_rating == $r ) {
     1313                for ( $parsed_args = 0; $parsed_args <= 10; $parsed_args++ ) {
     1314                        echo '<option value="' . $parsed_args . '"';
     1315                        if ( isset( $link->link_rating ) && $link->link_rating == $parsed_args ) {
    13161316                                echo ' selected="selected"';
    13171317                        }
    1318                         echo( '>' . $r . '</option>' );
     1318                        echo( '>' . $parsed_args . '</option>' );
    13191319                }
    13201320                ?>
  • trunk/src/wp-admin/includes/ms.php

    r45583 r45667  
    10901090
    10911091        // Parse arguments
    1092         $r = wp_parse_args(
     1092        $parsed_args = wp_parse_args(
    10931093                $args,
    10941094                array(
     
    11031103
    11041104        // Loop through tabs
    1105         foreach ( $r['links'] as $link_id => $link ) {
     1105        foreach ( $parsed_args['links'] as $link_id => $link ) {
    11061106
    11071107                // Skip link if user can't access
    1108                 if ( ! current_user_can( $link['cap'], $r['blog_id'] ) ) {
     1108                if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) {
    11091109                        continue;
    11101110                }
     
    11171117
    11181118                // Selected is set by the parent OR assumed by the $pagenow global
    1119                 if ( $r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
     1119                if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
    11201120                        $classes[]    = 'nav-tab-active';
    11211121                        $aria_current = ' aria-current="page"';
     
    11261126
    11271127                // Get the URL for this link
    1128                 $url = add_query_arg( array( 'id' => $r['blog_id'] ), network_admin_url( $link['url'] ) );
     1128                $url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) );
    11291129
    11301130                // Add link to nav links
  • trunk/src/wp-admin/includes/template.php

    r45657 r45667  
    101101        $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
    102102
    103         $r = wp_parse_args( $params, $defaults );
    104 
    105         if ( empty( $r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {
     103        $parsed_args = wp_parse_args( $params, $defaults );
     104
     105        if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
    106106                $walker = new Walker_Category_Checklist;
    107107        } else {
    108                 $walker = $r['walker'];
    109         }
    110 
    111         $taxonomy             = $r['taxonomy'];
    112         $descendants_and_self = (int) $r['descendants_and_self'];
     108                $walker = $parsed_args['walker'];
     109        }
     110
     111        $taxonomy             = $parsed_args['taxonomy'];
     112        $descendants_and_self = (int) $parsed_args['descendants_and_self'];
    113113
    114114        $args = array( 'taxonomy' => $taxonomy );
     
    117117        $args['disabled'] = ! current_user_can( $tax->cap->assign_terms );
    118118
    119         $args['list_only'] = ! empty( $r['list_only'] );
    120 
    121         if ( is_array( $r['selected_cats'] ) ) {
    122                 $args['selected_cats'] = $r['selected_cats'];
     119        $args['list_only'] = ! empty( $parsed_args['list_only'] );
     120
     121        if ( is_array( $parsed_args['selected_cats'] ) ) {
     122                $args['selected_cats'] = $parsed_args['selected_cats'];
    123123        } elseif ( $post_id ) {
    124124                $args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) );
     
    126126                $args['selected_cats'] = array();
    127127        }
    128         if ( is_array( $r['popular_cats'] ) ) {
    129                 $args['popular_cats'] = $r['popular_cats'];
     128        if ( is_array( $parsed_args['popular_cats'] ) ) {
     129                $args['popular_cats'] = $parsed_args['popular_cats'];
    130130        } else {
    131131                $args['popular_cats'] = get_terms(
     
    157157        $output = '';
    158158
    159         if ( $r['checked_ontop'] ) {
     159        if ( $parsed_args['checked_ontop'] ) {
    160160                // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
    161161                $checked_categories = array();
     
    175175        $output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
    176176
    177         if ( $r['echo'] ) {
     177        if ( $parsed_args['echo'] ) {
    178178                echo $output;
    179179        }
     
    24422442 */
    24432443function wp_star_rating( $args = array() ) {
    2444         $defaults = array(
     2444        $defaults    = array(
    24452445                'rating' => 0,
    24462446                'type'   => 'rating',
     
    24482448                'echo'   => true,
    24492449        );
    2450         $r        = wp_parse_args( $args, $defaults );
     2450        $parsed_args = wp_parse_args( $args, $defaults );
    24512451
    24522452        // Non-English decimal places when the $rating is coming from a string
    2453         $rating = (float) str_replace( ',', '.', $r['rating'] );
     2453        $rating = (float) str_replace( ',', '.', $parsed_args['rating'] );
    24542454
    24552455        // Convert Percentage to star rating, 0..5 in .5 increments
    2456         if ( 'percent' === $r['type'] ) {
     2456        if ( 'percent' === $parsed_args['type'] ) {
    24572457                $rating = round( $rating / 10, 0 ) / 2;
    24582458        }
     
    24632463        $empty_stars = 5 - $full_stars - $half_stars;
    24642464
    2465         if ( $r['number'] ) {
     2465        if ( $parsed_args['number'] ) {
    24662466                /* translators: 1: the rating, 2: the number of ratings */
    2467                 $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
    2468                 $title  = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
     2467                $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] );
     2468                $title  = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) );
    24692469        } else {
    24702470                /* translators: %s: the rating */
     
    24792479        $output .= '</div>';
    24802480
    2481         if ( $r['echo'] ) {
     2481        if ( $parsed_args['echo'] ) {
    24822482                echo $output;
    24832483        }
  • trunk/src/wp-includes/bookmark-template.php

    r45424 r45667  
    6363        );
    6464
    65         $r = wp_parse_args( $args, $defaults );
     65        $parsed_args = wp_parse_args( $args, $defaults );
    6666
    6767        $output = ''; // Blank string to start with.
     
    7171                        $bookmark->recently_updated = false;
    7272                }
    73                 $output .= $r['before'];
    74                 if ( $r['show_updated'] && $bookmark->recently_updated ) {
     73                $output .= $parsed_args['before'];
     74                if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) {
    7575                        $output .= '<em>';
    7676                }
     
    8383                $title = $desc;
    8484
    85                 if ( $r['show_updated'] ) {
     85                if ( $parsed_args['show_updated'] ) {
    8686                        if ( '00' != substr( $bookmark->link_updated_f, 0, 2 ) ) {
    8787                                $title .= ' (';
     
    9696                        }
    9797                }
    98                 $alt = ' alt="' . $name . ( $r['show_description'] ? ' ' . $title : '' ) . '"';
     98                $alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"';
    9999
    100100                if ( '' != $title ) {
     
    111111                $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
    112112
    113                 $output .= $r['link_before'];
    114 
    115                 if ( $bookmark->link_image != null && $r['show_images'] ) {
     113                $output .= $parsed_args['link_before'];
     114
     115                if ( $bookmark->link_image != null && $parsed_args['show_images'] ) {
    116116                        if ( strpos( $bookmark->link_image, 'http' ) === 0 ) {
    117117                                $output .= "<img src=\"$bookmark->link_image\" $alt $title />";
     
    119119                                $output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title />";
    120120                        }
    121                         if ( $r['show_name'] ) {
     121                        if ( $parsed_args['show_name'] ) {
    122122                                $output .= " $name";
    123123                        }
     
    126126                }
    127127
    128                 $output .= $r['link_after'];
     128                $output .= $parsed_args['link_after'];
    129129
    130130                $output .= '</a>';
    131131
    132                 if ( $r['show_updated'] && $bookmark->recently_updated ) {
     132                if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) {
    133133                        $output .= '</em>';
    134134                }
    135135
    136                 if ( $r['show_description'] && '' != $desc ) {
    137                         $output .= $r['between'] . $desc;
    138                 }
    139 
    140                 if ( $r['show_rating'] ) {
    141                         $output .= $r['between'] . sanitize_bookmark_field(
     136                if ( $parsed_args['show_description'] && '' != $desc ) {
     137                        $output .= $parsed_args['between'] . $desc;
     138                }
     139
     140                if ( $parsed_args['show_rating'] ) {
     141                        $output .= $parsed_args['between'] . sanitize_bookmark_field(
    142142                                'link_rating',
    143143                                $bookmark->link_rating,
     
    146146                        );
    147147                }
    148                 $output .= $r['after'] . "\n";
     148                $output .= $parsed_args['after'] . "\n";
    149149        } // end while
    150150
     
    226226        );
    227227
    228         $r = wp_parse_args( $args, $defaults );
     228        $parsed_args = wp_parse_args( $args, $defaults );
    229229
    230230        $output = '';
    231231
    232         if ( ! is_array( $r['class'] ) ) {
    233                 $r['class'] = explode( ' ', $r['class'] );
     232        if ( ! is_array( $parsed_args['class'] ) ) {
     233                $parsed_args['class'] = explode( ' ', $parsed_args['class'] );
    234234        }
    235         $r['class'] = array_map( 'sanitize_html_class', $r['class'] );
    236         $r['class'] = trim( join( ' ', $r['class'] ) );
    237 
    238         if ( $r['categorize'] ) {
     235        $parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] );
     236        $parsed_args['class'] = trim( join( ' ', $parsed_args['class'] ) );
     237
     238        if ( $parsed_args['categorize'] ) {
    239239                $cats = get_terms(
    240240                        'link_category',
    241241                        array(
    242                                 'name__like'   => $r['category_name'],
    243                                 'include'      => $r['category'],
    244                                 'exclude'      => $r['exclude_category'],
    245                                 'orderby'      => $r['category_orderby'],
    246                                 'order'        => $r['category_order'],
     242                                'name__like'   => $parsed_args['category_name'],
     243                                'include'      => $parsed_args['category'],
     244                                'exclude'      => $parsed_args['exclude_category'],
     245                                'orderby'      => $parsed_args['category_orderby'],
     246                                'order'        => $parsed_args['category_order'],
    247247                                'hierarchical' => 0,
    248248                        )
    249249                );
    250250                if ( empty( $cats ) ) {
    251                         $r['categorize'] = false;
     251                        $parsed_args['categorize'] = false;
    252252                }
    253253        }
    254254
    255         if ( $r['categorize'] ) {
     255        if ( $parsed_args['categorize'] ) {
    256256                // Split the bookmarks into ul's for each category
    257257                foreach ( (array) $cats as $cat ) {
    258                         $params    = array_merge( $r, array( 'category' => $cat->term_id ) );
     258                        $params    = array_merge( $parsed_args, array( 'category' => $cat->term_id ) );
    259259                        $bookmarks = get_bookmarks( $params );
    260260                        if ( empty( $bookmarks ) ) {
     
    263263                        $output .= str_replace(
    264264                                array( '%id', '%class' ),
    265                                 array( "linkcat-$cat->term_id", $r['class'] ),
    266                                 $r['category_before']
     265                                array( "linkcat-$cat->term_id", $parsed_args['class'] ),
     266                                $parsed_args['category_before']
    267267                        );
    268268                        /**
     
    275275                        $catname = apply_filters( 'link_category', $cat->name );
    276276
    277                         $output .= $r['title_before'];
     277                        $output .= $parsed_args['title_before'];
    278278                        $output .= $catname;
    279                         $output .= $r['title_after'];
     279                        $output .= $parsed_args['title_after'];
    280280                        $output .= "\n\t<ul class='xoxo blogroll'>\n";
    281                         $output .= _walk_bookmarks( $bookmarks, $r );
     281                        $output .= _walk_bookmarks( $bookmarks, $parsed_args );
    282282                        $output .= "\n\t</ul>\n";
    283                         $output .= $r['category_after'] . "\n";
     283                        $output .= $parsed_args['category_after'] . "\n";
    284284                }
    285285        } else {
    286286                //output one single list using title_li for the title
    287                 $bookmarks = get_bookmarks( $r );
     287                $bookmarks = get_bookmarks( $parsed_args );
    288288
    289289                if ( ! empty( $bookmarks ) ) {
    290                         if ( ! empty( $r['title_li'] ) ) {
     290                        if ( ! empty( $parsed_args['title_li'] ) ) {
    291291                                $output .= str_replace(
    292292                                        array( '%id', '%class' ),
    293                                         array( 'linkcat-' . $r['category'], $r['class'] ),
    294                                         $r['category_before']
     293                                        array( 'linkcat-' . $parsed_args['category'], $parsed_args['class'] ),
     294                                        $parsed_args['category_before']
    295295                                );
    296                                 $output .= $r['title_before'];
    297                                 $output .= $r['title_li'];
    298                                 $output .= $r['title_after'];
     296                                $output .= $parsed_args['title_before'];
     297                                $output .= $parsed_args['title_li'];
     298                                $output .= $parsed_args['title_after'];
    299299                                $output .= "\n\t<ul class='xoxo blogroll'>\n";
    300                                 $output .= _walk_bookmarks( $bookmarks, $r );
     300                                $output .= _walk_bookmarks( $bookmarks, $parsed_args );
    301301                                $output .= "\n\t</ul>\n";
    302                                 $output .= $r['category_after'] . "\n";
     302                                $output .= $parsed_args['category_after'] . "\n";
    303303                        } else {
    304                                 $output .= _walk_bookmarks( $bookmarks, $r );
     304                                $output .= _walk_bookmarks( $bookmarks, $parsed_args );
    305305                        }
    306306                }
     
    316316        $html = apply_filters( 'wp_list_bookmarks', $output );
    317317
    318         if ( ! $r['echo'] ) {
     318        if ( ! $parsed_args['echo'] ) {
    319319                return $html;
    320320        }
  • trunk/src/wp-includes/bookmark.php

    r45590 r45667  
    140140        );
    141141
    142         $r = wp_parse_args( $args, $defaults );
    143 
    144         $key   = md5( serialize( $r ) );
     142        $parsed_args = wp_parse_args( $args, $defaults );
     143
     144        $key   = md5( serialize( $parsed_args ) );
    145145        $cache = wp_cache_get( 'get_bookmarks', 'bookmark' );
    146         if ( 'rand' !== $r['orderby'] && $cache ) {
     146
     147        if ( 'rand' !== $parsed_args['orderby'] && $cache ) {
    147148                if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
    148149                        $bookmarks = $cache[ $key ];
     
    160161                         *
    161162                         * @param array $bookmarks List of the cached bookmarks.
    162                          * @param array $r         An array of bookmark query arguments.
     163                         * @param array $parsed_args         An array of bookmark query arguments.
    163164                         */
    164                         return apply_filters( 'get_bookmarks', $bookmarks, $r );
     165                        return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args );
    165166                }
    166167        }
     
    171172
    172173        $inclusions = '';
    173         if ( ! empty( $r['include'] ) ) {
    174                 $r['exclude']       = '';  //ignore exclude, category, and category_name params if using include
    175                 $r['category']      = '';
    176                 $r['category_name'] = '';
    177                 $inclinks           = wp_parse_id_list( $r['include'] );
     174        if ( ! empty( $parsed_args['include'] ) ) {
     175                $parsed_args['exclude']       = '';  //ignore exclude, category, and category_name params if using include
     176                $parsed_args['category']      = '';
     177                $parsed_args['category_name'] = '';
     178
     179                $inclinks = wp_parse_id_list( $parsed_args['include'] );
    178180                if ( count( $inclinks ) ) {
    179181                        foreach ( $inclinks as $inclink ) {
     
    191193
    192194        $exclusions = '';
    193         if ( ! empty( $r['exclude'] ) ) {
    194                 $exlinks = wp_parse_id_list( $r['exclude'] );
     195        if ( ! empty( $parsed_args['exclude'] ) ) {
     196                $exlinks = wp_parse_id_list( $parsed_args['exclude'] );
    195197                if ( count( $exlinks ) ) {
    196198                        foreach ( $exlinks as $exlink ) {
     
    207209        }
    208210
    209         if ( ! empty( $r['category_name'] ) ) {
    210                 $r['category'] = get_term_by( 'name', $r['category_name'], 'link_category' );
    211                 if ( $r['category'] ) {
    212                         $r['category'] = $r['category']->term_id;
     211        if ( ! empty( $parsed_args['category_name'] ) ) {
     212                $parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' );
     213                if ( $parsed_args['category'] ) {
     214                        $parsed_args['category'] = $parsed_args['category']->term_id;
    213215                } else {
    214216                        $cache[ $key ] = array();
    215217                        wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
    216218                        /** This filter is documented in wp-includes/bookmark.php */
    217                         return apply_filters( 'get_bookmarks', array(), $r );
     219                        return apply_filters( 'get_bookmarks', array(), $parsed_args );
    218220                }
    219221        }
    220222
    221223        $search = '';
    222         if ( ! empty( $r['search'] ) ) {
    223                 $like   = '%' . $wpdb->esc_like( $r['search'] ) . '%';
     224        if ( ! empty( $parsed_args['search'] ) ) {
     225                $like   = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%';
    224226                $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like );
    225227        }
     
    227229        $category_query = '';
    228230        $join           = '';
    229         if ( ! empty( $r['category'] ) ) {
    230                 $incategories = wp_parse_id_list( $r['category'] );
     231        if ( ! empty( $parsed_args['category'] ) ) {
     232                $incategories = wp_parse_id_list( $parsed_args['category'] );
    231233                if ( count( $incategories ) ) {
    232234                        foreach ( $incategories as $incat ) {
     
    244246        }
    245247
    246         if ( $r['show_updated'] ) {
     248        if ( $parsed_args['show_updated'] ) {
    247249                $recently_updated_test = ', IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated ';
    248250        } else {
     
    250252        }
    251253
    252         $get_updated = ( $r['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
    253 
    254         $orderby = strtolower( $r['orderby'] );
     254        $get_updated = ( $parsed_args['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
     255
     256        $orderby = strtolower( $parsed_args['orderby'] );
    255257        $length  = '';
    256258        switch ( $orderby ) {
     
    283285        }
    284286
    285         $order = strtoupper( $r['order'] );
     287        $order = strtoupper( $parsed_args['order'] );
    286288        if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {
    287289                $order = 'ASC';
     
    289291
    290292        $visible = '';
    291         if ( $r['hide_invisible'] ) {
     293        if ( $parsed_args['hide_invisible'] ) {
    292294                $visible = "AND link_visible = 'Y'";
    293295        }
     
    296298        $query .= " $exclusions $inclusions $search";
    297299        $query .= " ORDER BY $orderby $order";
    298         if ( $r['limit'] != -1 ) {
    299                 $query .= ' LIMIT ' . $r['limit'];
     300        if ( $parsed_args['limit'] != -1 ) {
     301                $query .= ' LIMIT ' . $parsed_args['limit'];
    300302        }
    301303
     
    308310
    309311        /** This filter is documented in wp-includes/bookmark.php */
    310         return apply_filters( 'get_bookmarks', $results, $r );
     312        return apply_filters( 'get_bookmarks', $results, $parsed_args );
    311313}
    312314
  • trunk/src/wp-includes/category-template.php

    r45599 r45667  
    366366        }
    367367
    368         $r                 = wp_parse_args( $args, $defaults );
    369         $option_none_value = $r['option_none_value'];
    370 
    371         if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
    372                 $r['pad_counts'] = true;
    373         }
    374 
    375         $tab_index = $r['tab_index'];
     368        // Parse incoming $args into an array and merge it with $defaults
     369        $parsed_args       = wp_parse_args( $args, $defaults );
     370        $option_none_value = $args['option_none_value'];
     371
     372        if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) {
     373                $parsed_args['pad_counts'] = true;
     374        }
     375
     376        $tab_index = $parsed_args['tab_index'];
    376377
    377378        $tab_index_attribute = '';
     
    381382
    382383        // Avoid clashes with the 'name' param of get_terms().
    383         $get_terms_args = $r;
     384        $get_terms_args = $parsed_args;
    384385        unset( $get_terms_args['name'] );
    385         $categories = get_terms( $r['taxonomy'], $get_terms_args );
    386 
    387         $name     = esc_attr( $r['name'] );
    388         $class    = esc_attr( $r['class'] );
    389         $id       = $r['id'] ? esc_attr( $r['id'] ) : $name;
    390         $required = $r['required'] ? 'required' : '';
    391 
    392         if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
     386        $categories = get_terms( $parsed_args['taxonomy'], $get_terms_args );
     387
     388        $name     = esc_attr( $parsed_args['name'] );
     389        $class    = esc_attr( $parsed_args['class'] );
     390        $id       = $parsed_args['id'] ? esc_attr( $parsed_args['id'] ) : $name;
     391        $required = $parsed_args['required'] ? 'required' : '';
     392
     393        if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) {
    393394                $output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n";
    394395        } else {
    395396                $output = '';
    396397        }
    397         if ( empty( $categories ) && ! $r['hide_if_empty'] && ! empty( $r['show_option_none'] ) ) {
     398        if ( empty( $categories ) && ! $parsed_args['hide_if_empty'] && ! empty( $parsed_args['show_option_none'] ) ) {
    398399
    399400                /**
     
    412413                 * @param WP_Term|null $category The category object, or null if there's no corresponding category.
    413414                 */
    414                 $show_option_none = apply_filters( 'list_cats', $r['show_option_none'], null );
     415                $show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
    415416                $output          .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
    416417        }
     
    418419        if ( ! empty( $categories ) ) {
    419420
    420                 if ( $r['show_option_all'] ) {
     421                if ( $parsed_args['show_option_all'] ) {
    421422
    422423                        /** This filter is documented in wp-includes/category-template.php */
    423                         $show_option_all = apply_filters( 'list_cats', $r['show_option_all'], null );
    424                         $selected        = ( '0' === strval( $r['selected'] ) ) ? " selected='selected'" : '';
     424                        $show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null );
     425                        $selected        = ( '0' === strval( $parsed_args['selected'] ) ) ? " selected='selected'" : '';
    425426                        $output         .= "\t<option value='0'$selected>$show_option_all</option>\n";
    426427                }
    427428
    428                 if ( $r['show_option_none'] ) {
     429                if ( $parsed_args['show_option_none'] ) {
    429430
    430431                        /** This filter is documented in wp-includes/category-template.php */
    431                         $show_option_none = apply_filters( 'list_cats', $r['show_option_none'], null );
    432                         $selected         = selected( $option_none_value, $r['selected'], false );
     432                        $show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
     433                        $selected         = selected( $option_none_value, $parsed_args['selected'], false );
    433434                        $output          .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
    434435                }
    435436
    436                 if ( $r['hierarchical'] ) {
    437                         $depth = $r['depth'];  // Walk the full depth.
     437                if ( $parsed_args['hierarchical'] ) {
     438                        $depth = $parsed_args['depth'];  // Walk the full depth.
    438439                } else {
    439440                        $depth = -1; // Flat.
    440441                }
    441                 $output .= walk_category_dropdown_tree( $categories, $depth, $r );
    442         }
    443 
    444         if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
     442                $output .= walk_category_dropdown_tree( $categories, $depth, $parsed_args );
     443        }
     444
     445        if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) {
    445446                $output .= "</select>\n";
    446447        }
     
    451452         *
    452453         * @param string $output HTML output.
    453          * @param array  $r      Arguments used to build the drop-down.
     454         * @param array  $parsed_args      Arguments used to build the drop-down.
    454455         */
    455         $output = apply_filters( 'wp_dropdown_cats', $output, $r );
    456 
    457         if ( $r['echo'] ) {
     456        $output = apply_filters( 'wp_dropdown_cats', $output, $parsed_args );
     457
     458        if ( $parsed_args['echo'] ) {
    458459                echo $output;
    459460        }
     
    538539        );
    539540
    540         $r = wp_parse_args( $args, $defaults );
    541 
    542         if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
    543                 $r['pad_counts'] = true;
     541        $parsed_args = wp_parse_args( $args, $defaults );
     542
     543        if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) {
     544                $parsed_args['pad_counts'] = true;
    544545        }
    545546
    546547        // Descendants of exclusions should be excluded too.
    547         if ( true == $r['hierarchical'] ) {
     548        if ( true == $parsed_args['hierarchical'] ) {
    548549                $exclude_tree = array();
    549550
    550                 if ( $r['exclude_tree'] ) {
    551                         $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude_tree'] ) );
    552                 }
    553 
    554                 if ( $r['exclude'] ) {
    555                         $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude'] ) );
    556                 }
    557 
    558                 $r['exclude_tree'] = $exclude_tree;
    559                 $r['exclude']      = '';
    560         }
    561 
    562         if ( ! isset( $r['class'] ) ) {
    563                 $r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
    564         }
    565 
    566         if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
     551                if ( $parsed_args['exclude_tree'] ) {
     552                        $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude_tree'] ) );
     553                }
     554
     555                if ( $parsed_args['exclude'] ) {
     556                        $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude'] ) );
     557                }
     558
     559                $parsed_args['exclude_tree'] = $exclude_tree;
     560                $parsed_args['exclude']      = '';
     561        }
     562
     563        if ( ! isset( $parsed_args['class'] ) ) {
     564                $parsed_args['class'] = ( 'category' == $parsed_args['taxonomy'] ) ? 'categories' : $parsed_args['taxonomy'];
     565        }
     566
     567        if ( ! taxonomy_exists( $parsed_args['taxonomy'] ) ) {
    567568                return false;
    568569        }
    569570
    570         $show_option_all  = $r['show_option_all'];
    571         $show_option_none = $r['show_option_none'];
    572 
    573         $categories = get_categories( $r );
     571        $show_option_all  = $parsed_args['show_option_all'];
     572        $show_option_none = $parsed_args['show_option_none'];
     573
     574        $categories = get_categories( $parsed_args );
    574575
    575576        $output = '';
    576         if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
    577                 $output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>';
     577        if ( $parsed_args['title_li'] && 'list' == $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) {
     578                $output = '<li class="' . esc_attr( $parsed_args['class'] ) . '">' . $parsed_args['title_li'] . '<ul>';
    578579        }
    579580        if ( empty( $categories ) ) {
    580581                if ( ! empty( $show_option_none ) ) {
    581                         if ( 'list' == $r['style'] ) {
     582                        if ( 'list' == $parsed_args['style'] ) {
    582583                                $output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
    583584                        } else {
     
    591592
    592593                        // For taxonomies that belong only to custom post types, point to a valid archive.
    593                         $taxonomy_object = get_taxonomy( $r['taxonomy'] );
     594                        $taxonomy_object = get_taxonomy( $parsed_args['taxonomy'] );
    594595                        if ( ! in_array( 'post', $taxonomy_object->object_type ) && ! in_array( 'page', $taxonomy_object->object_type ) ) {
    595596                                foreach ( $taxonomy_object->object_type as $object_type ) {
     
    614615
    615616                        $posts_page = esc_url( $posts_page );
    616                         if ( 'list' == $r['style'] ) {
     617                        if ( 'list' == $parsed_args['style'] ) {
    617618                                $output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
    618619                        } else {
     
    621622                }
    622623
    623                 if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
     624                if ( empty( $parsed_args['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
    624625                        $current_term_object = get_queried_object();
    625                         if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) {
    626                                 $r['current_category'] = get_queried_object_id();
     626                        if ( $current_term_object && $parsed_args['taxonomy'] === $current_term_object->taxonomy ) {
     627                                $parsed_args['current_category'] = get_queried_object_id();
    627628                        }
    628629                }
    629630
    630                 if ( $r['hierarchical'] ) {
    631                         $depth = $r['depth'];
     631                if ( $parsed_args['hierarchical'] ) {
     632                        $depth = $parsed_args['depth'];
    632633                } else {
    633634                        $depth = -1; // Flat.
    634635                }
    635                 $output .= walk_category_tree( $categories, $depth, $r );
    636         }
    637 
    638         if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
     636                $output .= walk_category_tree( $categories, $depth, $parsed_args );
     637        }
     638
     639        if ( $parsed_args['title_li'] && 'list' == $parsed_args['style'] && ( ! empty( $categories ) || ! $parsed_args['hide_title_if_empty'] ) ) {
    639640                $output .= '</ul></li>';
    640641        }
     
    650651        $html = apply_filters( 'wp_list_categories', $output, $args );
    651652
    652         if ( $r['echo'] ) {
     653        if ( $parsed_args['echo'] ) {
    653654                echo $html;
    654655        } else {
  • trunk/src/wp-includes/class-http.php

    r45590 r45667  
    221221                }
    222222
    223                 $r = wp_parse_args( $args, $defaults );
     223                $parsed_args = wp_parse_args( $args, $defaults );
    224224                /**
    225225                 * Filters the arguments used in an HTTP request.
     
    227227                 * @since 2.7.0
    228228                 *
    229                  * @param array  $r   An array of HTTP request arguments.
     229                 * @param array  $parsed_args   An array of HTTP request arguments.
    230230                 * @param string $url The request URL.
    231231                 */
    232                 $r = apply_filters( 'http_request_args', $r, $url );
     232                $parsed_args = apply_filters( 'http_request_args', $parsed_args, $url );
    233233
    234234                // The transports decrement this, store a copy of the original value for loop purposes.
    235                 if ( ! isset( $r['_redirection'] ) ) {
    236                         $r['_redirection'] = $r['redirection'];
     235                if ( ! isset( $parsed_args['_redirection'] ) ) {
     236                        $parsed_args['_redirection'] = $parsed_args['redirection'];
    237237                }
    238238
     
    252252                 *
    253253                 * @param false|array|WP_Error $preempt Whether to preempt an HTTP request's return value. Default false.
    254                  * @param array               $r        HTTP request arguments.
     254                 * @param array               $parsed_args        HTTP request arguments.
    255255                 * @param string              $url      The request URL.
    256256                 */
    257                 $pre = apply_filters( 'pre_http_request', false, $r, $url );
     257                $pre = apply_filters( 'pre_http_request', false, $parsed_args, $url );
    258258
    259259                if ( false !== $pre ) {
     
    262262
    263263                if ( function_exists( 'wp_kses_bad_protocol' ) ) {
    264                         if ( $r['reject_unsafe_urls'] ) {
     264                        if ( $parsed_args['reject_unsafe_urls'] ) {
    265265                                $url = wp_http_validate_url( $url );
    266266                        }
     
    275275                        $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) );
    276276                        /** This action is documented in wp-includes/class-http.php */
    277                         do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     277                        do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url );
    278278                        return $response;
    279279                }
     
    282282                        $response = new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) );
    283283                        /** This action is documented in wp-includes/class-http.php */
    284                         do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     284                        do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url );
    285285                        return $response;
    286286                }
     
    288288                // If we are streaming to a file but no filename was given drop it in the WP temp dir
    289289                // and pick its name using the basename of the $url
    290                 if ( $r['stream'] ) {
    291                         if ( empty( $r['filename'] ) ) {
    292                                 $r['filename'] = get_temp_dir() . basename( $url );
     290                if ( $parsed_args['stream'] ) {
     291                        if ( empty( $parsed_args['filename'] ) ) {
     292                                $parsed_args['filename'] = get_temp_dir() . basename( $url );
    293293                        }
    294294
    295295                        // Force some settings if we are streaming to a file and check for existence and perms of destination directory
    296                         $r['blocking'] = true;
    297                         if ( ! wp_is_writable( dirname( $r['filename'] ) ) ) {
     296                        $parsed_args['blocking'] = true;
     297                        if ( ! wp_is_writable( dirname( $parsed_args['filename'] ) ) ) {
    298298                                $response = new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
    299299                                /** This action is documented in wp-includes/class-http.php */
    300                                 do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     300                                do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url );
    301301                                return $response;
    302302                        }
    303303                }
    304304
    305                 if ( is_null( $r['headers'] ) ) {
    306                         $r['headers'] = array();
     305                if ( is_null( $parsed_args['headers'] ) ) {
     306                        $parsed_args['headers'] = array();
    307307                }
    308308
    309309                // WP allows passing in headers as a string, weirdly.
    310                 if ( ! is_array( $r['headers'] ) ) {
    311                         $processedHeaders = WP_Http::processHeaders( $r['headers'] );
    312                         $r['headers']    = $processedHeaders['headers'];
     310                if ( ! is_array( $parsed_args['headers'] ) ) {
     311                        $processedHeaders       = WP_Http::processHeaders( $parsed_args['headers'] );
     312                        $parsed_args['headers'] = $processedHeaders['headers'];
    313313                }
    314314
    315315                // Setup arguments
    316                 $headers = $r['headers'];
    317                 $data    = $r['body'];
    318                 $type    = $r['method'];
     316                $headers = $parsed_args['headers'];
     317                $data    = $parsed_args['body'];
     318                $type    = $parsed_args['method'];
    319319                $options = array(
    320                         'timeout'   => $r['timeout'],
    321                         'useragent' => $r['user-agent'],
    322                         'blocking'  => $r['blocking'],
    323                         'hooks'     => new WP_HTTP_Requests_Hooks( $url, $r ),
     320                        'timeout'   => $parsed_args['timeout'],
     321                        'useragent' => $parsed_args['user-agent'],
     322                        'blocking'  => $parsed_args['blocking'],
     323                        'hooks'     => new WP_HTTP_Requests_Hooks( $url, $parsed_args ),
    324324                );
    325325
     
    328328
    329329                // Validate redirected URLs.
    330                 if ( function_exists( 'wp_kses_bad_protocol' ) && $r['reject_unsafe_urls'] ) {
     330                if ( function_exists( 'wp_kses_bad_protocol' ) && $parsed_args['reject_unsafe_urls'] ) {
    331331                        $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) );
    332332                }
    333333
    334                 if ( $r['stream'] ) {
    335                         $options['filename'] = $r['filename'];
    336                 }
    337                 if ( empty( $r['redirection'] ) ) {
     334                if ( $parsed_args['stream'] ) {
     335                        $options['filename'] = $parsed_args['filename'];
     336                }
     337                if ( empty( $parsed_args['redirection'] ) ) {
    338338                        $options['follow_redirects'] = false;
    339339                } else {
    340                         $options['redirects'] = $r['redirection'];
     340                        $options['redirects'] = $parsed_args['redirection'];
    341341                }
    342342
    343343                // Use byte limit, if we can
    344                 if ( isset( $r['limit_response_size'] ) ) {
    345                         $options['max_bytes'] = $r['limit_response_size'];
     344                if ( isset( $parsed_args['limit_response_size'] ) ) {
     345                        $options['max_bytes'] = $parsed_args['limit_response_size'];
    346346                }
    347347
    348348                // If we've got cookies, use and convert them to Requests_Cookie.
    349                 if ( ! empty( $r['cookies'] ) ) {
    350                         $options['cookies'] = WP_Http::normalize_cookies( $r['cookies'] );
     349                if ( ! empty( $parsed_args['cookies'] ) ) {
     350                        $options['cookies'] = WP_Http::normalize_cookies( $parsed_args['cookies'] );
    351351                }
    352352
    353353                // SSL certificate handling
    354                 if ( ! $r['sslverify'] ) {
     354                if ( ! $parsed_args['sslverify'] ) {
    355355                        $options['verify']     = false;
    356356                        $options['verifyname'] = false;
    357357                } else {
    358                         $options['verify'] = $r['sslcertificates'];
     358                        $options['verify'] = $parsed_args['sslcertificates'];
    359359                }
    360360
     
    394394
    395395                        // Convert the response into an array
    396                         $http_response = new WP_HTTP_Requests_Response( $requests_response, $r['filename'] );
     396                        $http_response = new WP_HTTP_Requests_Response( $requests_response, $parsed_args['filename'] );
    397397                        $response      = $http_response->to_array();
    398398
     
    413413                 * @param string         $context  Context under which the hook is fired.
    414414                 * @param string         $class    HTTP transport used.
    415                  * @param array          $r        HTTP request arguments.
     415                 * @param array          $parsed_args        HTTP request arguments.
    416416                 * @param string         $url      The request URL.
    417417                 */
    418                 do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     418                do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url );
    419419                if ( is_wp_error( $response ) ) {
    420420                        return $response;
    421421                }
    422422
    423                 if ( ! $r['blocking'] ) {
     423                if ( ! $parsed_args['blocking'] ) {
    424424                        return array(
    425425                                'headers'       => array(),
     
    440440                 *
    441441                 * @param array  $response HTTP response.
    442                  * @param array  $r        HTTP request arguments.
     442                 * @param array  $parsed_args        HTTP request arguments.
    443443                 * @param string $url      The request URL.
    444444                 */
    445                 return apply_filters( 'http_response', $response, $r, $url );
     445                return apply_filters( 'http_response', $response, $parsed_args, $url );
    446446        }
    447447
     
    601601         */
    602602        public function post( $url, $args = array() ) {
    603                 $defaults = array( 'method' => 'POST' );
    604                 $r        = wp_parse_args( $args, $defaults );
    605                 return $this->request( $url, $r );
     603                $defaults    = array( 'method' => 'POST' );
     604                $parsed_args = wp_parse_args( $args, $defaults );
     605                return $this->request( $url, $parsed_args );
    606606        }
    607607
     
    618618         */
    619619        public function get( $url, $args = array() ) {
    620                 $defaults = array( 'method' => 'GET' );
    621                 $r        = wp_parse_args( $args, $defaults );
    622                 return $this->request( $url, $r );
     620                $defaults    = array( 'method' => 'GET' );
     621                $parsed_args = wp_parse_args( $args, $defaults );
     622                return $this->request( $url, $parsed_args );
    623623        }
    624624
     
    635635         */
    636636        public function head( $url, $args = array() ) {
    637                 $defaults = array( 'method' => 'HEAD' );
    638                 $r        = wp_parse_args( $args, $defaults );
    639                 return $this->request( $url, $r );
     637                $defaults    = array( 'method' => 'HEAD' );
     638                $parsed_args = wp_parse_args( $args, $defaults );
     639                return $this->request( $url, $parsed_args );
    640640        }
    641641
  • trunk/src/wp-includes/class-wp-ajax-response.php

    r45590 r45667  
    7474                );
    7575
    76                 $r = wp_parse_args( $args, $defaults );
     76                $parsed_args = wp_parse_args( $args, $defaults );
    7777
    78                 $position = preg_replace( '/[^a-z0-9:_-]/i', '', $r['position'] );
    79                 $id       = $r['id'];
    80                 $what     = $r['what'];
    81                 $action   = $r['action'];
    82                 $old_id   = $r['old_id'];
    83                 $data     = $r['data'];
     78                $position = preg_replace( '/[^a-z0-9:_-]/i', '', $parsed_args['position'] );
     79                $id       = $parsed_args['id'];
     80                $what     = $parsed_args['what'];
     81                $action   = $parsed_args['action'];
     82                $old_id   = $parsed_args['old_id'];
     83                $data     = $parsed_args['data'];
    8484
    8585                if ( is_wp_error( $id ) ) {
     
    119119
    120120                $s = '';
    121                 if ( is_array( $r['supplemental'] ) ) {
    122                         foreach ( $r['supplemental'] as $k => $v ) {
     121                if ( is_array( $parsed_args['supplemental'] ) ) {
     122                        foreach ( $parsed_args['supplemental'] as $k => $v ) {
    123123                                $s .= "<$k><![CDATA[$v]]></$k>";
    124124                        }
  • trunk/src/wp-includes/class-wp-http-curl.php

    r45590 r45667  
    8080                );
    8181
    82                 $r = wp_parse_args( $args, $defaults );
    83 
    84                 if ( isset( $r['headers']['User-Agent'] ) ) {
    85                         $r['user-agent'] = $r['headers']['User-Agent'];
    86                         unset( $r['headers']['User-Agent'] );
    87                 } elseif ( isset( $r['headers']['user-agent'] ) ) {
    88                         $r['user-agent'] = $r['headers']['user-agent'];
    89                         unset( $r['headers']['user-agent'] );
     82                $parsed_args = wp_parse_args( $args, $defaults );
     83
     84                if ( isset( $parsed_args['headers']['User-Agent'] ) ) {
     85                        $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent'];
     86                        unset( $parsed_args['headers']['User-Agent'] );
     87                } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) {
     88                        $parsed_args['user-agent'] = $parsed_args['headers']['user-agent'];
     89                        unset( $parsed_args['headers']['user-agent'] );
    9090                }
    9191
    9292                // Construct Cookie: header if any cookies are set.
    93                 WP_Http::buildCookieHeader( $r );
     93                WP_Http::buildCookieHeader( $parsed_args );
    9494
    9595                $handle = curl_init();
     
    110110                }
    111111
    112                 $is_local   = isset( $r['local'] ) && $r['local'];
    113                 $ssl_verify = isset( $r['sslverify'] ) && $r['sslverify'];
     112                $is_local   = isset( $parsed_args['local'] ) && $parsed_args['local'];
     113                $ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify'];
    114114                if ( $is_local ) {
    115115                        /** This filter is documented in wp-includes/class-wp-http-streams.php */
     
    124124                 * a value of 0 will allow an unlimited timeout.
    125125                 */
    126                 $timeout = (int) ceil( $r['timeout'] );
     126                $timeout = (int) ceil( $parsed_args['timeout'] );
    127127                curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout );
    128128                curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
     
    134134
    135135                if ( $ssl_verify ) {
    136                         curl_setopt( $handle, CURLOPT_CAINFO, $r['sslcertificates'] );
    137                 }
    138 
    139                 curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
     136                        curl_setopt( $handle, CURLOPT_CAINFO, $parsed_args['sslcertificates'] );
     137                }
     138
     139                curl_setopt( $handle, CURLOPT_USERAGENT, $parsed_args['user-agent'] );
    140140
    141141                /*
     
    148148                }
    149149
    150                 switch ( $r['method'] ) {
     150                switch ( $parsed_args['method'] ) {
    151151                        case 'HEAD':
    152152                                curl_setopt( $handle, CURLOPT_NOBODY, true );
     
    154154                        case 'POST':
    155155                                curl_setopt( $handle, CURLOPT_POST, true );
    156                                 curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
     156                                curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
    157157                                break;
    158158                        case 'PUT':
    159159                                curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' );
    160                                 curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
     160                                curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
    161161                                break;
    162162                        default:
    163                                 curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $r['method'] );
    164                                 if ( ! is_null( $r['body'] ) ) {
    165                                         curl_setopt( $handle, CURLOPT_POSTFIELDS, $r['body'] );
     163                                curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $parsed_args['method'] );
     164                                if ( ! is_null( $parsed_args['body'] ) ) {
     165                                        curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] );
    166166                                }
    167167                                break;
    168168                }
    169169
    170                 if ( true === $r['blocking'] ) {
     170                if ( true === $parsed_args['blocking'] ) {
    171171                        curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) );
    172172                        curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) );
     
    175175                curl_setopt( $handle, CURLOPT_HEADER, false );
    176176
    177                 if ( isset( $r['limit_response_size'] ) ) {
    178                         $this->max_body_length = intval( $r['limit_response_size'] );
     177                if ( isset( $parsed_args['limit_response_size'] ) ) {
     178                        $this->max_body_length = intval( $parsed_args['limit_response_size'] );
    179179                } else {
    180180                        $this->max_body_length = false;
     
    182182
    183183                // If streaming to a file open a file handle, and setup our curl streaming handler.
    184                 if ( $r['stream'] ) {
     184                if ( $parsed_args['stream'] ) {
    185185                        if ( ! WP_DEBUG ) {
    186                                 $this->stream_handle = @fopen( $r['filename'], 'w+' );
     186                                $this->stream_handle = @fopen( $parsed_args['filename'], 'w+' );
    187187                        } else {
    188                                 $this->stream_handle = fopen( $r['filename'], 'w+' );
     188                                $this->stream_handle = fopen( $parsed_args['filename'], 'w+' );
    189189                        }
    190190                        if ( ! $this->stream_handle ) {
     
    195195                                                __( 'Could not open handle for %1$s to %2$s.' ),
    196196                                                'fopen()',
    197                                                 $r['filename']
     197                                                $parsed_args['filename']
    198198                                        )
    199199                                );
     
    203203                }
    204204
    205                 if ( ! empty( $r['headers'] ) ) {
     205                if ( ! empty( $parsed_args['headers'] ) ) {
    206206                        // cURL expects full header strings in each element.
    207207                        $headers = array();
    208                         foreach ( $r['headers'] as $name => $value ) {
     208                        foreach ( $parsed_args['headers'] as $name => $value ) {
    209209                                $headers[] = "{$name}: $value";
    210210                        }
     
    212212                }
    213213
    214                 if ( $r['httpversion'] == '1.0' ) {
     214                if ( $parsed_args['httpversion'] == '1.0' ) {
    215215                        curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
    216216                } else {
     
    227227                 *
    228228                 * @param resource $handle  The cURL handle returned by curl_init() (passed by reference).
    229                  * @param array    $r       The HTTP request arguments.
     229                 * @param array    $parsed_args       The HTTP request arguments.
    230230                 * @param string   $url     The request URL.
    231231                 */
    232                 do_action_ref_array( 'http_api_curl', array( &$handle, $r, $url ) );
     232                do_action_ref_array( 'http_api_curl', array( &$handle, $parsed_args, $url ) );
    233233
    234234                // We don't need to return the body, so don't. Just execute request and return.
    235                 if ( ! $r['blocking'] ) {
     235                if ( ! $parsed_args['blocking'] ) {
    236236                        curl_exec( $handle );
    237237
     
    273273                        if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) {
    274274                                if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) {
    275                                         if ( $r['stream'] ) {
     275                                        if ( $parsed_args['stream'] ) {
    276276                                                curl_close( $handle );
    277277                                                fclose( $this->stream_handle );
     
    297297                curl_close( $handle );
    298298
    299                 if ( $r['stream'] ) {
     299                if ( $parsed_args['stream'] ) {
    300300                        fclose( $this->stream_handle );
    301301                }
     
    306306                        'response' => $theHeaders['response'],
    307307                        'cookies'  => $theHeaders['cookies'],
    308                         'filename' => $r['filename'],
     308                        'filename' => $parsed_args['filename'],
    309309                );
    310310
    311311                // Handle redirects.
    312                 $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response );
     312                $redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response );
    313313                if ( false !== $redirect_response ) {
    314314                        return $redirect_response;
    315315                }
    316316
    317                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) {
     317                if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) {
    318318                        $theBody = WP_Http_Encoding::decompress( $theBody );
    319319                }
  • trunk/src/wp-includes/class-wp-http-streams.php

    r45611 r45667  
    3939                );
    4040
    41                 $r = wp_parse_args( $args, $defaults );
    42 
    43                 if ( isset( $r['headers']['User-Agent'] ) ) {
    44                         $r['user-agent'] = $r['headers']['User-Agent'];
    45                         unset( $r['headers']['User-Agent'] );
    46                 } elseif ( isset( $r['headers']['user-agent'] ) ) {
    47                         $r['user-agent'] = $r['headers']['user-agent'];
    48                         unset( $r['headers']['user-agent'] );
     41                $parsed_args = wp_parse_args( $args, $defaults );
     42
     43                if ( isset( $parsed_args['headers']['User-Agent'] ) ) {
     44                        $parsed_args['user-agent'] = $parsed_args['headers']['User-Agent'];
     45                        unset( $parsed_args['headers']['User-Agent'] );
     46                } elseif ( isset( $parsed_args['headers']['user-agent'] ) ) {
     47                        $parsed_args['user-agent'] = $parsed_args['headers']['user-agent'];
     48                        unset( $parsed_args['headers']['user-agent'] );
    4949                }
    5050
    5151                // Construct Cookie: header if any cookies are set.
    52                 WP_Http::buildCookieHeader( $r );
     52                WP_Http::buildCookieHeader( $parsed_args );
    5353
    5454                $arrURL = parse_url( $url );
     
    7171                }
    7272
    73                 if ( isset( $r['headers']['Host'] ) || isset( $r['headers']['host'] ) ) {
    74                         if ( isset( $r['headers']['Host'] ) ) {
    75                                 $arrURL['host'] = $r['headers']['Host'];
     73                if ( isset( $parsed_args['headers']['Host'] ) || isset( $parsed_args['headers']['host'] ) ) {
     74                        if ( isset( $parsed_args['headers']['Host'] ) ) {
     75                                $arrURL['host'] = $parsed_args['headers']['Host'];
    7676                        } else {
    77                                 $arrURL['host'] = $r['headers']['host'];
    78                         }
    79                         unset( $r['headers']['Host'], $r['headers']['host'] );
     77                                $arrURL['host'] = $parsed_args['headers']['host'];
     78                        }
     79                        unset( $parsed_args['headers']['Host'], $parsed_args['headers']['host'] );
    8080                }
    8181
     
    9191                $connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host;
    9292
    93                 $is_local   = isset( $r['local'] ) && $r['local'];
    94                 $ssl_verify = isset( $r['sslverify'] ) && $r['sslverify'];
     93                $is_local   = isset( $parsed_args['local'] ) && $parsed_args['local'];
     94                $ssl_verify = isset( $parsed_args['sslverify'] ) && $parsed_args['sslverify'];
    9595                if ( $is_local ) {
    9696                        /**
     
    118118                                        'capture_peer_cert' => $ssl_verify,
    119119                                        'SNI_enabled'       => true,
    120                                         'cafile'            => $r['sslcertificates'],
     120                                        'cafile'            => $parsed_args['sslcertificates'],
    121121                                        'allow_self_signed' => ! $ssl_verify,
    122122                                ),
     
    124124                );
    125125
    126                 $timeout         = (int) floor( $r['timeout'] );
    127                 $utimeout        = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
     126                $timeout         = (int) floor( $parsed_args['timeout'] );
     127                $utimeout        = $timeout == $parsed_args['timeout'] ? 0 : 1000000 * $parsed_args['timeout'] % 1000000;
    128128                $connect_timeout = max( $timeout, 1 );
    129129
     
    183183                }
    184184
    185                 $strHeaders = strtoupper( $r['method'] ) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
     185                $strHeaders = strtoupper( $parsed_args['method'] ) . ' ' . $requestPath . ' HTTP/' . $parsed_args['httpversion'] . "\r\n";
    186186
    187187                $include_port_in_host_header = (
     
    197197                }
    198198
    199                 if ( isset( $r['user-agent'] ) ) {
    200                         $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
    201                 }
    202 
    203                 if ( is_array( $r['headers'] ) ) {
    204                         foreach ( (array) $r['headers'] as $header => $headerValue ) {
     199                if ( isset( $parsed_args['user-agent'] ) ) {
     200                        $strHeaders .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n";
     201                }
     202
     203                if ( is_array( $parsed_args['headers'] ) ) {
     204                        foreach ( (array) $parsed_args['headers'] as $header => $headerValue ) {
    205205                                $strHeaders .= $header . ': ' . $headerValue . "\r\n";
    206206                        }
    207207                } else {
    208                         $strHeaders .= $r['headers'];
     208                        $strHeaders .= $parsed_args['headers'];
    209209                }
    210210
     
    215215                $strHeaders .= "\r\n";
    216216
    217                 if ( ! is_null( $r['body'] ) ) {
    218                         $strHeaders .= $r['body'];
     217                if ( ! is_null( $parsed_args['body'] ) ) {
     218                        $strHeaders .= $parsed_args['body'];
    219219                }
    220220
    221221                fwrite( $handle, $strHeaders );
    222222
    223                 if ( ! $r['blocking'] ) {
     223                if ( ! $parsed_args['blocking'] ) {
    224224                        stream_set_blocking( $handle, 0 );
    225225                        fclose( $handle );
     
    239239                $keep_reading = true;
    240240                $block_size   = 4096;
    241                 if ( isset( $r['limit_response_size'] ) ) {
    242                         $block_size = min( $block_size, $r['limit_response_size'] );
     241                if ( isset( $parsed_args['limit_response_size'] ) ) {
     242                        $block_size = min( $block_size, $parsed_args['limit_response_size'] );
    243243                }
    244244
    245245                // If streaming to a file setup the file handle.
    246                 if ( $r['stream'] ) {
     246                if ( $parsed_args['stream'] ) {
    247247                        if ( ! WP_DEBUG ) {
    248                                 $stream_handle = @fopen( $r['filename'], 'w+' );
     248                                $stream_handle = @fopen( $parsed_args['filename'], 'w+' );
    249249                        } else {
    250                                 $stream_handle = fopen( $r['filename'], 'w+' );
     250                                $stream_handle = fopen( $parsed_args['filename'], 'w+' );
    251251                        }
    252252                        if ( ! $stream_handle ) {
     
    257257                                                __( 'Could not open handle for %1$s to %2$s.' ),
    258258                                                'fopen()',
    259                                                 $r['filename']
     259                                                $parsed_args['filename']
    260260                                        )
    261261                                );
     
    278278                                $this_block_size = strlen( $block );
    279279
    280                                 if ( isset( $r['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $r['limit_response_size'] ) {
    281                                         $this_block_size = ( $r['limit_response_size'] - $bytes_written );
     280                                if ( isset( $parsed_args['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $parsed_args['limit_response_size'] ) {
     281                                        $this_block_size = ( $parsed_args['limit_response_size'] - $bytes_written );
    282282                                        $block           = substr( $block, 0, $this_block_size );
    283283                                }
     
    293293                                $bytes_written += $bytes_written_to_file;
    294294
    295                                 $keep_reading = ! isset( $r['limit_response_size'] ) || $bytes_written < $r['limit_response_size'];
     295                                $keep_reading = ! isset( $parsed_args['limit_response_size'] ) || $bytes_written < $parsed_args['limit_response_size'];
    296296                        }
    297297
     
    307307                                        $bodyStarted   = true;
    308308                                }
    309                                 $keep_reading = ( ! $bodyStarted || ! isset( $r['limit_response_size'] ) || strlen( $strResponse ) < ( $header_length + $r['limit_response_size'] ) );
     309                                $keep_reading = ( ! $bodyStarted || ! isset( $parsed_args['limit_response_size'] ) || strlen( $strResponse ) < ( $header_length + $parsed_args['limit_response_size'] ) );
    310310                        }
    311311
     
    325325                        'response' => $arrHeaders['response'],
    326326                        'cookies'  => $arrHeaders['cookies'],
    327                         'filename' => $r['filename'],
     327                        'filename' => $parsed_args['filename'],
    328328                );
    329329
    330330                // Handle redirects.
    331                 $redirect_response = WP_Http::handle_redirects( $url, $r, $response );
     331                $redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response );
    332332                if ( false !== $redirect_response ) {
    333333                        return $redirect_response;
     
    339339                }
    340340
    341                 if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode( $arrHeaders['headers'] ) ) {
     341                if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $arrHeaders['headers'] ) ) {
    342342                        $process['body'] = WP_Http_Encoding::decompress( $process['body'] );
    343343                }
    344344
    345                 if ( isset( $r['limit_response_size'] ) && strlen( $process['body'] ) > $r['limit_response_size'] ) {
    346                         $process['body'] = substr( $process['body'], 0, $r['limit_response_size'] );
     345                if ( isset( $parsed_args['limit_response_size'] ) && strlen( $process['body'] ) > $parsed_args['limit_response_size'] ) {
     346                        $process['body'] = substr( $process['body'], 0, $parsed_args['limit_response_size'] );
    347347                }
    348348
  • trunk/src/wp-includes/comment-template.php

    r45602 r45667  
    20152015        );
    20162016
    2017         $r = wp_parse_args( $args, $defaults );
     2017        $parsed_args = wp_parse_args( $args, $defaults );
    20182018
    20192019        /**
     
    20242024         * @see wp_list_comments()
    20252025         *
    2026          * @param array $r An array of arguments for displaying comments.
    2027          */
    2028         $r = apply_filters( 'wp_list_comments_args', $r );
     2026         * @param array $parsed_args An array of arguments for displaying comments.
     2027         */
     2028        $parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args );
    20292029
    20302030        // Figure out what comments we'll be looping through ($_comments)
     
    20342034                        return;
    20352035                }
    2036                 if ( 'all' != $r['type'] ) {
     2036                if ( 'all' != $parsed_args['type'] ) {
    20372037                        $comments_by_type = separate_comments( $comments );
    2038                         if ( empty( $comments_by_type[ $r['type'] ] ) ) {
     2038                        if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
    20392039                                return;
    20402040                        }
    2041                         $_comments = $comments_by_type[ $r['type'] ];
     2041                        $_comments = $comments_by_type[ $parsed_args['type'] ];
    20422042                } else {
    20432043                        $_comments = $comments;
     
    20482048                 * perform a separate comment query and allow Walker_Comment to paginate.
    20492049                 */
    2050                 if ( $r['page'] || $r['per_page'] ) {
     2050                if ( $parsed_args['page'] || $parsed_args['per_page'] ) {
    20512051                        $current_cpage = get_query_var( 'cpage' );
    20522052                        if ( ! $current_cpage ) {
     
    20552055
    20562056                        $current_per_page = get_query_var( 'comments_per_page' );
    2057                         if ( $r['page'] != $current_cpage || $r['per_page'] != $current_per_page ) {
     2057                        if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) {
    20582058                                $comment_args = array(
    20592059                                        'post_id' => get_the_ID(),
     
    20752075                                $comments = get_comments( $comment_args );
    20762076
    2077                                 if ( 'all' != $r['type'] ) {
     2077                                if ( 'all' != $parsed_args['type'] ) {
    20782078                                        $comments_by_type = separate_comments( $comments );
    2079                                         if ( empty( $comments_by_type[ $r['type'] ] ) ) {
     2079                                        if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
    20802080                                                return;
    20812081                                        }
    20822082
    2083                                         $_comments = $comments_by_type[ $r['type'] ];
     2083                                        $_comments = $comments_by_type[ $parsed_args['type'] ];
    20842084                                } else {
    20852085                                        $_comments = $comments;
     
    20922092                                return;
    20932093                        }
    2094                         if ( 'all' != $r['type'] ) {
     2094                        if ( 'all' != $parsed_args['type'] ) {
    20952095                                if ( empty( $wp_query->comments_by_type ) ) {
    20962096                                        $wp_query->comments_by_type = separate_comments( $wp_query->comments );
    20972097                                }
    2098                                 if ( empty( $wp_query->comments_by_type[ $r['type'] ] ) ) {
     2098                                if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) {
    20992099                                        return;
    21002100                                }
    2101                                 $_comments = $wp_query->comments_by_type[ $r['type'] ];
     2101                                $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ];
    21022102                        } else {
    21032103                                $_comments = $wp_query->comments;
     
    21082108                                $cpage                 = get_query_var( 'cpage' );
    21092109                                if ( 'newest' === $default_comments_page ) {
    2110                                         $r['cpage'] = $cpage;
     2110                                        $parsed_args['cpage'] = $cpage;
    21112111
    21122112                                        /*
     
    21152115                                        */
    21162116                                } elseif ( $cpage == 1 ) {
    2117                                         $r['cpage'] = '';
     2117                                        $parsed_args['cpage'] = '';
    21182118                                } else {
    2119                                         $r['cpage'] = $cpage;
     2119                                        $parsed_args['cpage'] = $cpage;
    21202120                                }
    21212121
    2122                                 $r['page']     = 0;
    2123                                 $r['per_page'] = 0;
     2122                                $parsed_args['page']     = 0;
     2123                                $parsed_args['per_page'] = 0;
    21242124                        }
    21252125                }
    21262126        }
    21272127
    2128         if ( '' === $r['per_page'] && get_option( 'page_comments' ) ) {
    2129                 $r['per_page'] = get_query_var( 'comments_per_page' );
    2130         }
    2131 
    2132         if ( empty( $r['per_page'] ) ) {
    2133                 $r['per_page'] = 0;
    2134                 $r['page']     = 0;
    2135         }
    2136 
    2137         if ( '' === $r['max_depth'] ) {
     2128        if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) {
     2129                $parsed_args['per_page'] = get_query_var( 'comments_per_page' );
     2130        }
     2131
     2132        if ( empty( $parsed_args['per_page'] ) ) {
     2133                $parsed_args['per_page'] = 0;
     2134                $parsed_args['page']     = 0;
     2135        }
     2136
     2137        if ( '' === $parsed_args['max_depth'] ) {
    21382138                if ( get_option( 'thread_comments' ) ) {
    2139                         $r['max_depth'] = get_option( 'thread_comments_depth' );
     2139                        $parsed_args['max_depth'] = get_option( 'thread_comments_depth' );
    21402140                } else {
    2141                         $r['max_depth'] = -1;
     2141                        $parsed_args['max_depth'] = -1;
    21422142                }
    21432143        }
    21442144
    2145         if ( '' === $r['page'] ) {
     2145        if ( '' === $parsed_args['page'] ) {
    21462146                if ( empty( $overridden_cpage ) ) {
    2147                         $r['page'] = get_query_var( 'cpage' );
     2147                        $parsed_args['page'] = get_query_var( 'cpage' );
    21482148                } else {
    2149                         $threaded  = ( -1 != $r['max_depth'] );
    2150                         $r['page'] = ( 'newest' == get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $r['per_page'], $threaded ) : 1;
    2151                         set_query_var( 'cpage', $r['page'] );
     2149                        $threaded            = ( -1 != $parsed_args['max_depth'] );
     2150                        $parsed_args['page'] = ( 'newest' == get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $parsed_args['per_page'], $threaded ) : 1;
     2151                        set_query_var( 'cpage', $parsed_args['page'] );
    21522152                }
    21532153        }
    21542154        // Validation check
    2155         $r['page'] = intval( $r['page'] );
    2156         if ( 0 == $r['page'] && 0 != $r['per_page'] ) {
    2157                 $r['page'] = 1;
    2158         }
    2159 
    2160         if ( null === $r['reverse_top_level'] ) {
    2161                 $r['reverse_top_level'] = ( 'desc' == get_option( 'comment_order' ) );
     2155        $parsed_args['page'] = intval( $parsed_args['page'] );
     2156        if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) {
     2157                $parsed_args['page'] = 1;
     2158        }
     2159
     2160        if ( null === $parsed_args['reverse_top_level'] ) {
     2161                $parsed_args['reverse_top_level'] = ( 'desc' == get_option( 'comment_order' ) );
    21622162        }
    21632163
    21642164        wp_queue_comments_for_comment_meta_lazyload( $_comments );
    21652165
    2166         if ( empty( $r['walker'] ) ) {
     2166        if ( empty( $parsed_args['walker'] ) ) {
    21672167                $walker = new Walker_Comment;
    21682168        } else {
    2169                 $walker = $r['walker'];
    2170         }
    2171 
    2172         $output = $walker->paged_walk( $_comments, $r['max_depth'], $r['page'], $r['per_page'], $r );
     2169                $walker = $parsed_args['walker'];
     2170        }
     2171
     2172        $output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args );
    21732173
    21742174        $in_comment_loop = false;
    21752175
    2176         if ( $r['echo'] ) {
     2176        if ( $parsed_args['echo'] ) {
    21772177                echo $output;
    21782178        } else {
  • trunk/src/wp-includes/comment.php

    r45611 r45667  
    165165        }
    166166
    167         $defaults = array(
     167        $defaults    = array(
    168168                'status'  => 1,
    169169                'post_id' => $post_id,
    170170                'order'   => 'ASC',
    171171        );
    172         $r        = wp_parse_args( $args, $defaults );
     172        $parsed_args = wp_parse_args( $args, $defaults );
    173173
    174174        $query = new WP_Comment_Query;
    175         return $query->query( $r );
     175        return $query->query( $parsed_args );
    176176}
    177177
  • trunk/src/wp-includes/deprecated.php

    r45611 r45667  
    431431        );
    432432
    433         $r = wp_parse_args( $args, $defaults );
    434 
    435         return wp_list_bookmarks($r);
     433        $parsed_args = wp_parse_args( $args, $defaults );
     434
     435        return wp_list_bookmarks($parsed_args);
    436436}
    437437
     
    636636        _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
    637637
    638         $r = wp_parse_args( $args );
     638        $parsed_args = wp_parse_args( $args );
    639639
    640640        // Map to new names.
    641         if ( isset($r['optionall']) && isset($r['all']))
    642                 $r['show_option_all'] = $r['all'];
    643         if ( isset($r['sort_column']) )
    644                 $r['orderby'] = $r['sort_column'];
    645         if ( isset($r['sort_order']) )
    646                 $r['order'] = $r['sort_order'];
    647         if ( isset($r['optiondates']) )
    648                 $r['show_last_update'] = $r['optiondates'];
    649         if ( isset($r['optioncount']) )
    650                 $r['show_count'] = $r['optioncount'];
    651         if ( isset($r['list']) )
    652                 $r['style'] = $r['list'] ? 'list' : 'break';
    653         $r['title_li'] = '';
    654 
    655         return wp_list_categories($r);
     641        if ( isset($parsed_args['optionall']) && isset($parsed_args['all']))
     642                $parsed_args['show_option_all'] = $parsed_args['all'];
     643        if ( isset($parsed_args['sort_column']) )
     644                $parsed_args['orderby'] = $parsed_args['sort_column'];
     645        if ( isset($parsed_args['sort_order']) )
     646                $parsed_args['order'] = $parsed_args['sort_order'];
     647        if ( isset($parsed_args['optiondates']) )
     648                $parsed_args['show_last_update'] = $parsed_args['optiondates'];
     649        if ( isset($parsed_args['optioncount']) )
     650                $parsed_args['show_count'] = $parsed_args['optioncount'];
     651        if ( isset($parsed_args['list']) )
     652                $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break';
     653        $parsed_args['title_li'] = '';
     654
     655        return wp_list_categories($parsed_args);
    656656}
    657657
     
    893893        );
    894894
    895         $r = wp_parse_args( $args, $defaults );
    896 
    897         return wp_list_bookmarks($r);
     895        $parsed_args = wp_parse_args( $args, $defaults );
     896
     897        return wp_list_bookmarks($parsed_args);
    898898}
    899899
  • trunk/src/wp-includes/functions.php

    r45611 r45667  
    30813081 */
    30823082function _default_wp_die_handler( $message, $title = '', $args = array() ) {
    3083         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3083        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
    30843084
    30853085        if ( is_string( $message ) ) {
    3086                 if ( ! empty( $r['additional_errors'] ) ) {
     3086                if ( ! empty( $parsed_args['additional_errors'] ) ) {
    30873087                        $message = array_merge(
    30883088                                array( $message ),
    3089                                 wp_list_pluck( $r['additional_errors'], 'message' )
     3089                                wp_list_pluck( $parsed_args['additional_errors'], 'message' )
    30903090                        );
    30913091                        $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
     
    30973097        $have_gettext = function_exists( '__' );
    30983098
    3099         if ( ! empty( $r['link_url'] ) && ! empty( $r['link_text'] ) ) {
    3100                 $link_url = $r['link_url'];
     3099        if ( ! empty( $parsed_args['link_url'] ) && ! empty( $parsed_args['link_text'] ) ) {
     3100                $link_url = $parsed_args['link_url'];
    31013101                if ( function_exists( 'esc_url' ) ) {
    31023102                        $link_url = esc_url( $link_url );
    31033103                }
    3104                 $link_text = $r['link_text'];
     3104                $link_text = $parsed_args['link_text'];
    31053105                $message  .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>";
    31063106        }
    31073107
    3108         if ( isset( $r['back_link'] ) && $r['back_link'] ) {
     3108        if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) {
    31093109                $back_text = $have_gettext ? __( '&laquo; Back' ) : '&laquo; Back';
    31103110                $message  .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
     
    31143114                if ( ! headers_sent() ) {
    31153115                        header( 'Content-Type: text/html; charset=utf-8' );
    3116                         status_header( $r['response'] );
     3116                        status_header( $parsed_args['response'] );
    31173117                        nocache_headers();
    31183118                }
    31193119
    3120                 $text_direction = $r['text_direction'];
     3120                $text_direction = $parsed_args['text_direction'];
    31213121                if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) {
    31223122                        $dir_attr = get_language_attributes();
     
    32593259</html>
    32603260        <?php
    3261         if ( $r['exit'] ) {
     3261        if ( $parsed_args['exit'] ) {
    32623262                die();
    32633263        }
     
    32833283        );
    32843284
    3285         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3285        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
    32863286
    32873287        if ( ! headers_sent() ) {
    32883288                // This is intentional. For backward-compatibility, support passing null here.
    32893289                if ( null !== $args['response'] ) {
    3290                         status_header( $r['response'] );
     3290                        status_header( $parsed_args['response'] );
    32913291                }
    32923292                nocache_headers();
     
    32993299        }
    33003300
    3301         if ( $r['exit'] ) {
     3301        if ( $parsed_args['exit'] ) {
    33023302                die( $message );
    33033303        }
     
    33193319 */
    33203320function _json_wp_die_handler( $message, $title = '', $args = array() ) {
    3321         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3321        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
    33223322
    33233323        $data = array(
    3324                 'code'              => $r['code'],
     3324                'code'              => $parsed_args['code'],
    33253325                'message'           => $message,
    33263326                'data'              => array(
    3327                         'status' => $r['response'],
     3327                        'status' => $parsed_args['response'],
    33283328                ),
    3329                 'additional_errors' => $r['additional_errors'],
     3329                'additional_errors' => $parsed_args['additional_errors'],
    33303330        );
    33313331
    33323332        if ( ! headers_sent() ) {
    33333333                header( 'Content-Type: application/json; charset=utf-8' );
    3334                 if ( null !== $r['response'] ) {
    3335                         status_header( $r['response'] );
     3334                if ( null !== $parsed_args['response'] ) {
     3335                        status_header( $parsed_args['response'] );
    33363336                }
    33373337                nocache_headers();
     
    33393339
    33403340        echo wp_json_encode( $data );
    3341         if ( $r['exit'] ) {
     3341        if ( $parsed_args['exit'] ) {
    33423342                die();
    33433343        }
     
    33573357 */
    33583358function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) {
    3359         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3359        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
    33603360
    33613361        $data = array(
    3362                 'code'              => $r['code'],
     3362                'code'              => $parsed_args['code'],
    33633363                'message'           => $message,
    33643364                'data'              => array(
    3365                         'status' => $r['response'],
     3365                        'status' => $parsed_args['response'],
    33663366                ),
    3367                 'additional_errors' => $r['additional_errors'],
     3367                'additional_errors' => $parsed_args['additional_errors'],
    33683368        );
    33693369
     
    33723372                header( 'X-Content-Type-Options: nosniff' );
    33733373                header( 'X-Robots-Tag: noindex' );
    3374                 if ( null !== $r['response'] ) {
    3375                         status_header( $r['response'] );
     3374                if ( null !== $parsed_args['response'] ) {
     3375                        status_header( $parsed_args['response'] );
    33763376                }
    33773377                nocache_headers();
     
    33813381        $jsonp_callback = $_GET['_jsonp'];
    33823382        echo '/**/' . $jsonp_callback . '(' . $result . ')';
    3383         if ( $r['exit'] ) {
     3383        if ( $parsed_args['exit'] ) {
    33843384                die();
    33853385        }
     
    34033403        global $wp_xmlrpc_server;
    34043404
    3405         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3405        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
    34063406
    34073407        if ( ! headers_sent() ) {
     
    34103410
    34113411        if ( $wp_xmlrpc_server ) {
    3412                 $error = new IXR_Error( $r['response'], $message );
     3412                $error = new IXR_Error( $parsed_args['response'], $message );
    34133413                $wp_xmlrpc_server->output( $error->getXml() );
    34143414        }
    3415         if ( $r['exit'] ) {
     3415        if ( $parsed_args['exit'] ) {
    34163416                die();
    34173417        }
     
    34313431 */
    34323432function _xml_wp_die_handler( $message, $title = '', $args = array() ) {
    3433         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3433        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
    34343434
    34353435        $message = htmlspecialchars( $message );
     
    34383438        $xml = <<<EOD
    34393439<error>
    3440     <code>{$r['code']}</code>
     3440    <code>{$parsed_args['code']}</code>
    34413441    <title><![CDATA[{$title}]]></title>
    34423442    <message><![CDATA[{$message}]]></message>
    34433443    <data>
    3444         <status>{$r['response']}</status>
     3444        <status>{$parsed_args['response']}</status>
    34453445    </data>
    34463446</error>
     
    34503450        if ( ! headers_sent() ) {
    34513451                header( 'Content-Type: text/xml; charset=utf-8' );
    3452                 if ( null !== $r['response'] ) {
    3453                         status_header( $r['response'] );
     3452                if ( null !== $parsed_args['response'] ) {
     3453                        status_header( $parsed_args['response'] );
    34543454                }
    34553455                nocache_headers();
     
    34573457
    34583458        echo $xml;
    3459         if ( $r['exit'] ) {
     3459        if ( $parsed_args['exit'] ) {
    34603460                die();
    34613461        }
     
    34763476 */
    34773477function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) {
    3478         list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
    3479 
    3480         if ( $r['exit'] ) {
     3478        list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
     3479
     3480        if ( $parsed_args['exit'] ) {
    34813481                if ( is_scalar( $message ) ) {
    34823482                        die( (string) $message );
     
    41084108function wp_parse_args( $args, $defaults = '' ) {
    41094109        if ( is_object( $args ) ) {
    4110                 $r = get_object_vars( $args );
     4110                $parsed_args = get_object_vars( $args );
    41114111        } elseif ( is_array( $args ) ) {
    4112                 $r =& $args;
     4112                $parsed_args =& $args;
    41134113        } else {
    4114                 wp_parse_str( $args, $r );
     4114                wp_parse_str( $args, $parsed_args );
    41154115        }
    41164116
    41174117        if ( is_array( $defaults ) ) {
    4118                 return array_merge( $defaults, $r );
    4119         }
    4120         return $r;
     4118                return array_merge( $defaults, $parsed_args );
     4119        }
     4120        return $parsed_args;
    41214121}
    41224122
  • trunk/src/wp-includes/general-template.php

    r45590 r45667  
    18221822        );
    18231823
    1824         $r = wp_parse_args( $args, $defaults );
    1825 
    1826         $post_type_object = get_post_type_object( $r['post_type'] );
     1824        $parsed_args = wp_parse_args( $args, $defaults );
     1825
     1826        $post_type_object = get_post_type_object( $parsed_args['post_type'] );
    18271827        if ( ! is_post_type_viewable( $post_type_object ) ) {
    18281828                return;
    18291829        }
    1830         $r['post_type'] = $post_type_object->name;
    1831 
    1832         if ( '' == $r['type'] ) {
    1833                 $r['type'] = 'monthly';
    1834         }
    1835 
    1836         if ( ! empty( $r['limit'] ) ) {
    1837                 $r['limit'] = absint( $r['limit'] );
    1838                 $r['limit'] = ' LIMIT ' . $r['limit'];
    1839         }
    1840 
    1841         $order = strtoupper( $r['order'] );
     1830        $parsed_args['post_type'] = $post_type_object->name;
     1831
     1832        if ( '' == $parsed_args['type'] ) {
     1833                $parsed_args['type'] = 'monthly';
     1834        }
     1835
     1836        if ( ! empty( $parsed_args['limit'] ) ) {
     1837                $parsed_args['limit'] = absint( $parsed_args['limit'] );
     1838                $parsed_args['limit'] = ' LIMIT ' . $parsed_args['limit'];
     1839        }
     1840
     1841        $order = strtoupper( $parsed_args['order'] );
    18421842        if ( $order !== 'ASC' ) {
    18431843                $order = 'DESC';
     
    18471847        $archive_week_separator = '&#8211;';
    18481848
    1849         $sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $r['post_type'] );
     1849        $sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $parsed_args['post_type'] );
    18501850
    18511851        /**
     
    18551855         *
    18561856         * @param string $sql_where Portion of SQL query containing the WHERE clause.
    1857          * @param array  $r         An array of default arguments.
    1858          */
    1859         $where = apply_filters( 'getarchives_where', $sql_where, $r );
     1857         * @param array  $parsed_args         An array of default arguments.
     1858         */
     1859        $where = apply_filters( 'getarchives_where', $sql_where, $parsed_args );
    18601860
    18611861        /**
     
    18641864         * @since 2.2.0
    18651865         *
    1866          * @param string $sql_join Portion of SQL query containing JOIN clause.
    1867          * @param array  $r        An array of default arguments.
    1868          */
    1869         $join = apply_filters( 'getarchives_join', '', $r );
     1866         * @param string $sql_join    Portion of SQL query containing JOIN clause.
     1867         * @param array  $parsed_args An array of default arguments.
     1868         */
     1869        $join = apply_filters( 'getarchives_join', '', $parsed_args );
    18701870
    18711871        $output = '';
     
    18731873        $last_changed = wp_cache_get_last_changed( 'posts' );
    18741874
    1875         $limit = $r['limit'];
    1876 
    1877         if ( 'monthly' == $r['type'] ) {
     1875        $limit = $parsed_args['limit'];
     1876
     1877        if ( 'monthly' == $parsed_args['type'] ) {
    18781878                $query   = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit";
    18791879                $key     = md5( $query );
     
    18851885                }
    18861886                if ( $results ) {
    1887                         $after = $r['after'];
     1887                        $after = $parsed_args['after'];
    18881888                        foreach ( (array) $results as $result ) {
    18891889                                $url = get_month_link( $result->year, $result->month );
    1890                                 if ( 'post' !== $r['post_type'] ) {
    1891                                         $url = add_query_arg( 'post_type', $r['post_type'], $url );
     1890                                if ( 'post' !== $parsed_args['post_type'] ) {
     1891                                        $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
    18921892                                }
    18931893                                /* translators: 1: month name, 2: 4-digit year */
    18941894                                $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year );
    1895                                 if ( $r['show_post_count'] ) {
    1896                                         $r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
     1895                                if ( $parsed_args['show_post_count'] ) {
     1896                                        $parsed_args['after'] = '&nbsp;(' . $result->posts . ')' . $after;
    18971897                                }
    1898                                 $selected = is_archive() && (string) $r['year'] === $result->year && (string) $r['monthnum'] === $result->month;
    1899                                 $output  .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected );
     1898                                $selected = is_archive() && (string) $parsed_args['year'] === $result->year && (string) $parsed_args['monthnum'] === $result->month;
     1899                                $output  .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
    19001900                        }
    19011901                }
    1902         } elseif ( 'yearly' == $r['type'] ) {
     1902        } elseif ( 'yearly' == $parsed_args['type'] ) {
    19031903                $query   = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit";
    19041904                $key     = md5( $query );
     
    19101910                }
    19111911                if ( $results ) {
    1912                         $after = $r['after'];
     1912                        $after = $parsed_args['after'];
    19131913                        foreach ( (array) $results as $result ) {
    19141914                                $url = get_year_link( $result->year );
    1915                                 if ( 'post' !== $r['post_type'] ) {
    1916                                         $url = add_query_arg( 'post_type', $r['post_type'], $url );
     1915                                if ( 'post' !== $parsed_args['post_type'] ) {
     1916                                        $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
    19171917                                }
    19181918                                $text = sprintf( '%d', $result->year );
    1919                                 if ( $r['show_post_count'] ) {
    1920                                         $r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
     1919                                if ( $parsed_args['show_post_count'] ) {
     1920                                        $parsed_args['after'] = '&nbsp;(' . $result->posts . ')' . $after;
    19211921                                }
    1922                                 $selected = is_archive() && (string) $r['year'] === $result->year;
    1923                                 $output  .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected );
     1922                                $selected = is_archive() && (string) $parsed_args['year'] === $result->year;
     1923                                $output  .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
    19241924                        }
    19251925                }
    1926         } elseif ( 'daily' == $r['type'] ) {
     1926        } elseif ( 'daily' == $parsed_args['type'] ) {
    19271927                $query   = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit";
    19281928                $key     = md5( $query );
     
    19341934                }
    19351935                if ( $results ) {
    1936                         $after = $r['after'];
     1936                        $after = $parsed_args['after'];
    19371937                        foreach ( (array) $results as $result ) {
    19381938                                $url = get_day_link( $result->year, $result->month, $result->dayofmonth );
    1939                                 if ( 'post' !== $r['post_type'] ) {
    1940                                         $url = add_query_arg( 'post_type', $r['post_type'], $url );
     1939                                if ( 'post' !== $parsed_args['post_type'] ) {
     1940                                        $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
    19411941                                }
    19421942                                $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth );
    19431943                                $text = mysql2date( get_option( 'date_format' ), $date );
    1944                                 if ( $r['show_post_count'] ) {
    1945                                         $r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
     1944                                if ( $parsed_args['show_post_count'] ) {
     1945                                        $parsed_args['after'] = '&nbsp;(' . $result->posts . ')' . $after;
    19461946                                }
    1947                                 $selected = is_archive() && (string) $r['year'] === $result->year && (string) $r['monthnum'] === $result->month && (string) $r['day'] === $result->dayofmonth;
    1948                                 $output  .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected );
     1947                                $selected = is_archive() && (string) $parsed_args['year'] === $result->year && (string) $parsed_args['monthnum'] === $result->month && (string) $parsed_args['day'] === $result->dayofmonth;
     1948                                $output  .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
    19491949                        }
    19501950                }
    1951         } elseif ( 'weekly' == $r['type'] ) {
     1951        } elseif ( 'weekly' == $parsed_args['type'] ) {
    19521952                $week    = _wp_mysql_week( '`post_date`' );
    19531953                $query   = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit";
     
    19611961                $arc_w_last = '';
    19621962                if ( $results ) {
    1963                         $after = $r['after'];
     1963                        $after = $parsed_args['after'];
    19641964                        foreach ( (array) $results as $result ) {
    19651965                                if ( $result->week != $arc_w_last ) {
     
    19761976                                                home_url( '/' )
    19771977                                        );
    1978                                         if ( 'post' !== $r['post_type'] ) {
    1979                                                 $url = add_query_arg( 'post_type', $r['post_type'], $url );
     1978                                        if ( 'post' !== $parsed_args['post_type'] ) {
     1979                                                $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
    19801980                                        }
    19811981                                        $text = $arc_week_start . $archive_week_separator . $arc_week_end;
    1982                                         if ( $r['show_post_count'] ) {
    1983                                                 $r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
     1982                                        if ( $parsed_args['show_post_count'] ) {
     1983                                                $parsed_args['after'] = '&nbsp;(' . $result->posts . ')' . $after;
    19841984                                        }
    1985                                         $selected = is_archive() && (string) $r['year'] === $result->yr && (string) $r['w'] === $result->week;
    1986                                         $output  .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected );
     1985                                        $selected = is_archive() && (string) $parsed_args['year'] === $result->yr && (string) $parsed_args['w'] === $result->week;
     1986                                        $output  .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
    19871987                                }
    19881988                        }
    19891989                }
    1990         } elseif ( ( 'postbypost' == $r['type'] ) || ( 'alpha' == $r['type'] ) ) {
    1991                 $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
     1990        } elseif ( ( 'postbypost' == $parsed_args['type'] ) || ( 'alpha' == $parsed_args['type'] ) ) {
     1991                $orderby = ( 'alpha' == $parsed_args['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
    19921992                $query   = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
    19931993                $key     = md5( $query );
     
    20092009                                        }
    20102010                                        $selected = $result->ID === get_the_ID();
    2011                                         $output  .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $selected );
     2011                                        $output  .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
    20122012                                }
    20132013                        }
    20142014                }
    20152015        }
    2016         if ( $r['echo'] ) {
     2016        if ( $parsed_args['echo'] ) {
    20172017                echo $output;
    20182018        } else {
  • trunk/src/wp-includes/post-template.php

    r45627 r45667  
    7979 */
    8080function the_title_attribute( $args = '' ) {
    81         $defaults = array(
     81        $defaults    = array(
    8282                'before' => '',
    8383                'after'  => '',
     
    8585                'post'   => get_post(),
    8686        );
    87         $r        = wp_parse_args( $args, $defaults );
    88 
    89         $title = get_the_title( $r['post'] );
     87        $parsed_args = wp_parse_args( $args, $defaults );
     88
     89        $title = get_the_title( $parsed_args['post'] );
    9090
    9191        if ( strlen( $title ) == 0 ) {
     
    9393        }
    9494
    95         $title = $r['before'] . $title . $r['after'];
     95        $title = $parsed_args['before'] . $title . $parsed_args['after'];
    9696        $title = esc_attr( strip_tags( $title ) );
    9797
    98         if ( $r['echo'] ) {
     98        if ( $parsed_args['echo'] ) {
    9999                echo $title;
    100100        } else {
     
    947947        );
    948948
    949         $params = wp_parse_args( $args, $defaults );
     949        $parsed_args = wp_parse_args( $args, $defaults );
    950950
    951951        /**
     
    954954         * @since 3.0.0
    955955         *
    956          * @param array $params An array of arguments for page links for paginated posts.
     956         * @param array $parsed_args An array of arguments for page links for paginated posts.
    957957         */
    958         $r = apply_filters( 'wp_link_pages_args', $params );
     958        $parsed_args = apply_filters( 'wp_link_pages_args', $parsed_args );
    959959
    960960        $output = '';
    961961        if ( $multipage ) {
    962                 if ( 'number' == $r['next_or_number'] ) {
    963                         $output .= $r['before'];
     962                if ( 'number' == $parsed_args['next_or_number'] ) {
     963                        $output .= $parsed_args['before'];
    964964                        for ( $i = 1; $i <= $numpages; $i++ ) {
    965                                 $link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
     965                                $link = $parsed_args['link_before'] . str_replace( '%', $i, $parsed_args['pagelink'] ) . $parsed_args['link_after'];
    966966                                if ( $i != $page || ! $more && 1 == $page ) {
    967967                                        $link = _wp_link_page( $i ) . $link . '</a>';
    968968                                } elseif ( $i === $page ) {
    969                                         $link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $r['aria_current'] ) . '">' . $link . '</span>';
     969                                        $link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $parsed_args['aria_current'] ) . '">' . $link . '</span>';
    970970                                }
    971971                                /**
     
    980980
    981981                                // Use the custom links separator beginning with the second link.
    982                                 $output .= ( 1 === $i ) ? ' ' : $r['separator'];
     982                                $output .= ( 1 === $i ) ? ' ' : $parsed_args['separator'];
    983983                                $output .= $link;
    984984                        }
    985                         $output .= $r['after'];
     985                        $output .= $parsed_args['after'];
    986986                } elseif ( $more ) {
    987                         $output .= $r['before'];
     987                        $output .= $parsed_args['before'];
    988988                        $prev    = $page - 1;
    989989                        if ( $prev > 0 ) {
    990                                 $link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
     990                                $link = _wp_link_page( $prev ) . $parsed_args['link_before'] . $parsed_args['previouspagelink'] . $parsed_args['link_after'] . '</a>';
    991991
    992992                                /** This filter is documented in wp-includes/post-template.php */
     
    996996                        if ( $next <= $numpages ) {
    997997                                if ( $prev ) {
    998                                         $output .= $r['separator'];
     998                                        $output .= $parsed_args['separator'];
    999999                                }
    1000                                 $link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
     1000                                $link = _wp_link_page( $next ) . $parsed_args['link_before'] . $parsed_args['nextpagelink'] . $parsed_args['link_after'] . '</a>';
    10011001
    10021002                                /** This filter is documented in wp-includes/post-template.php */
    10031003                                $output .= apply_filters( 'wp_link_pages_link', $link, $next );
    10041004                        }
    1005                         $output .= $r['after'];
     1005                        $output .= $parsed_args['after'];
    10061006                }
    10071007        }
     
    10171017        $html = apply_filters( 'wp_link_pages', $output, $args );
    10181018
    1019         if ( $r['echo'] ) {
     1019        if ( $parsed_args['echo'] ) {
    10201020                echo $html;
    10211021        }
     
    11821182        );
    11831183
    1184         $r = wp_parse_args( $args, $defaults );
    1185 
    1186         $pages  = get_pages( $r );
     1184        $parsed_args = wp_parse_args( $args, $defaults );
     1185
     1186        $pages  = get_pages( $parsed_args );
    11871187        $output = '';
    11881188        // Back-compat with old system where both id and name were based on $name argument
    1189         if ( empty( $r['id'] ) ) {
    1190                 $r['id'] = $r['name'];
     1189        if ( empty( $parsed_args['id'] ) ) {
     1190                $parsed_args['id'] = $parsed_args['name'];
    11911191        }
    11921192
    11931193        if ( ! empty( $pages ) ) {
    11941194                $class = '';
    1195                 if ( ! empty( $r['class'] ) ) {
    1196                         $class = " class='" . esc_attr( $r['class'] ) . "'";
    1197                 }
    1198 
    1199                 $output = "<select name='" . esc_attr( $r['name'] ) . "'" . $class . " id='" . esc_attr( $r['id'] ) . "'>\n";
    1200                 if ( $r['show_option_no_change'] ) {
    1201                         $output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
    1202                 }
    1203                 if ( $r['show_option_none'] ) {
    1204                         $output .= "\t<option value=\"" . esc_attr( $r['option_none_value'] ) . '">' . $r['show_option_none'] . "</option>\n";
    1205                 }
    1206                 $output .= walk_page_dropdown_tree( $pages, $r['depth'], $r );
     1195                if ( ! empty( $parsed_args['class'] ) ) {
     1196                        $class = " class='" . esc_attr( $parsed_args['class'] ) . "'";
     1197                }
     1198
     1199                $output = "<select name='" . esc_attr( $parsed_args['name'] ) . "'" . $class . " id='" . esc_attr( $parsed_args['id'] ) . "'>\n";
     1200                if ( $parsed_args['show_option_no_change'] ) {
     1201                        $output .= "\t<option value=\"-1\">" . $parsed_args['show_option_no_change'] . "</option>\n";
     1202                }
     1203                if ( $parsed_args['show_option_none'] ) {
     1204                        $output .= "\t<option value=\"" . esc_attr( $parsed_args['option_none_value'] ) . '">' . $parsed_args['show_option_none'] . "</option>\n";
     1205                }
     1206                $output .= walk_page_dropdown_tree( $pages, $parsed_args['depth'], $parsed_args );
    12071207                $output .= "</select>\n";
    12081208        }
     
    12121212         *
    12131213         * @since 2.1.0
    1214          * @since 4.4.0 `$r` and `$pages` added as arguments.
    1215          *
    1216          * @param string $output HTML output for drop down list of pages.
    1217          * @param array  $r      The parsed arguments array.
    1218          * @param array  $pages  List of WP_Post objects returned by `get_pages()`
     1214         * @since 4.4.0 `$parsed_args` and `$pages` added as arguments.
     1215         *
     1216         * @param string $output      HTML output for drop down list of pages.
     1217         * @param array  $parsed_args The parsed arguments array.
     1218         * @param array  $pages       List of WP_Post objects returned by `get_pages()`
    12191219         */
    1220         $html = apply_filters( 'wp_dropdown_pages', $output, $r, $pages );
    1221 
    1222         if ( $r['echo'] ) {
     1220        $html = apply_filters( 'wp_dropdown_pages', $output, $parsed_args, $pages );
     1221
     1222        if ( $parsed_args['echo'] ) {
    12231223                echo $html;
    12241224        }
     
    12831283        );
    12841284
    1285         $r = wp_parse_args( $args, $defaults );
    1286 
    1287         if ( ! in_array( $r['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
     1285        $parsed_args = wp_parse_args( $args, $defaults );
     1286
     1287        if ( ! in_array( $parsed_args['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
    12881288                // invalid value, fall back to default.
    1289                 $r['item_spacing'] = $defaults['item_spacing'];
     1289                $parsed_args['item_spacing'] = $defaults['item_spacing'];
    12901290        }
    12911291
     
    12941294
    12951295        // sanitize, mostly to keep spaces out
    1296         $r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] );
     1296        $parsed_args['exclude'] = preg_replace( '/[^0-9,]/', '', $parsed_args['exclude'] );
    12971297
    12981298        // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
    1299         $exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array();
     1299        $exclude_array = ( $parsed_args['exclude'] ) ? explode( ',', $parsed_args['exclude'] ) : array();
    13001300
    13011301        /**
     
    13061306         * @param array $exclude_array An array of page IDs to exclude.
    13071307         */
    1308         $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
     1308        $parsed_args['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
     1309
     1310        $parsed_args['hierarchical'] = 0;
    13091311
    13101312        // Query pages.
    1311         $r['hierarchical'] = 0;
    1312         $pages             = get_pages( $r );
     1313        $pages = get_pages( $parsed_args );
    13131314
    13141315        if ( ! empty( $pages ) ) {
    1315                 if ( $r['title_li'] ) {
    1316                         $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
     1316                if ( $parsed_args['title_li'] ) {
     1317                        $output .= '<li class="pagenav">' . $parsed_args['title_li'] . '<ul>';
    13171318                }
    13181319                global $wp_query;
     
    13261327                }
    13271328
    1328                 $output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
    1329 
    1330                 if ( $r['title_li'] ) {
     1329                $output .= walk_page_tree( $pages, $parsed_args['depth'], $current_page, $parsed_args );
     1330
     1331                if ( $parsed_args['title_li'] ) {
    13311332                        $output .= '</ul></li>';
    13321333                }
     
    13411342         * @see wp_list_pages()
    13421343         *
    1343          * @param string $output HTML output of the pages list.
    1344          * @param array  $r      An array of page-listing arguments.
    1345          * @param array  $pages  List of WP_Post objects returned by `get_pages()`
     1344         * @param string $output      HTML output of the pages list.
     1345         * @param array  $parsed_args An array of page-listing arguments.
     1346         * @param array  $pages       List of WP_Post objects returned by `get_pages()`
    13461347         */
    1347         $html = apply_filters( 'wp_list_pages', $output, $r, $pages );
    1348 
    1349         if ( $r['echo'] ) {
     1348        $html = apply_filters( 'wp_list_pages', $output, $parsed_args, $pages );
     1349
     1350        if ( $parsed_args['echo'] ) {
    13501351                echo $html;
    13511352        } else {
  • trunk/src/wp-includes/post.php

    r45652 r45667  
    614614        );
    615615
    616         $r = wp_parse_args( $args, $defaults );
    617 
    618         $children = get_posts( $r );
     616        $parsed_args = wp_parse_args( $args, $defaults );
     617
     618        $children = get_posts( $parsed_args );
    619619
    620620        if ( ! $children ) {
     
    622622        }
    623623
    624         if ( ! empty( $r['fields'] ) ) {
     624        if ( ! empty( $parsed_args['fields'] ) ) {
    625625                return $children;
    626626        }
     
    19551955        );
    19561956
    1957         $r = wp_parse_args( $args, $defaults );
    1958         if ( empty( $r['post_status'] ) ) {
    1959                 $r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
    1960         }
    1961         if ( ! empty( $r['numberposts'] ) && empty( $r['posts_per_page'] ) ) {
    1962                 $r['posts_per_page'] = $r['numberposts'];
    1963         }
    1964         if ( ! empty( $r['category'] ) ) {
    1965                 $r['cat'] = $r['category'];
    1966         }
    1967         if ( ! empty( $r['include'] ) ) {
    1968                 $incposts            = wp_parse_id_list( $r['include'] );
    1969                 $r['posts_per_page'] = count( $incposts );  // only the number of posts included
    1970                 $r['post__in']       = $incposts;
    1971         } elseif ( ! empty( $r['exclude'] ) ) {
    1972                 $r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
    1973         }
    1974 
    1975         $r['ignore_sticky_posts'] = true;
    1976         $r['no_found_rows']       = true;
     1957        $parsed_args = wp_parse_args( $args, $defaults );
     1958        if ( empty( $parsed_args['post_status'] ) ) {
     1959                $parsed_args['post_status'] = ( 'attachment' == $parsed_args['post_type'] ) ? 'inherit' : 'publish';
     1960        }
     1961        if ( ! empty( $parsed_args['numberposts'] ) && empty( $parsed_args['posts_per_page'] ) ) {
     1962                $parsed_args['posts_per_page'] = $parsed_args['numberposts'];
     1963        }
     1964        if ( ! empty( $parsed_args['category'] ) ) {
     1965                $parsed_args['cat'] = $parsed_args['category'];
     1966        }
     1967        if ( ! empty( $parsed_args['include'] ) ) {
     1968                $incposts                      = wp_parse_id_list( $parsed_args['include'] );
     1969                $parsed_args['posts_per_page'] = count( $incposts );  // only the number of posts included
     1970                $parsed_args['post__in']       = $incposts;
     1971        } elseif ( ! empty( $parsed_args['exclude'] ) ) {
     1972                $parsed_args['post__not_in'] = wp_parse_id_list( $parsed_args['exclude'] );
     1973        }
     1974
     1975        $parsed_args['ignore_sticky_posts'] = true;
     1976        $parsed_args['no_found_rows']       = true;
    19771977
    19781978        $get_posts = new WP_Query;
    1979         return $get_posts->query( $r );
     1979        return $get_posts->query( $parsed_args );
    19801980
    19811981}
     
    33823382        );
    33833383
    3384         $r = wp_parse_args( $args, $defaults );
    3385 
    3386         $results = get_posts( $r );
     3384        $parsed_args = wp_parse_args( $args, $defaults );
     3385
     3386        $results = get_posts( $parsed_args );
    33873387
    33883388        // Backward compatibility. Prior to 3.1 expected posts to be returned in array.
     
    51125112        );
    51135113
    5114         $r = wp_parse_args( $args, $defaults );
    5115 
    5116         $number       = (int) $r['number'];
    5117         $offset       = (int) $r['offset'];
    5118         $child_of     = (int) $r['child_of'];
    5119         $hierarchical = $r['hierarchical'];
    5120         $exclude      = $r['exclude'];
    5121         $meta_key     = $r['meta_key'];
    5122         $meta_value   = $r['meta_value'];
    5123         $parent       = $r['parent'];
    5124         $post_status  = $r['post_status'];
     5114        $parsed_args = wp_parse_args( $args, $defaults );
     5115
     5116        $number       = (int) $parsed_args['number'];
     5117        $offset       = (int) $parsed_args['offset'];
     5118        $child_of     = (int) $parsed_args['child_of'];
     5119        $hierarchical = $parsed_args['hierarchical'];
     5120        $exclude      = $parsed_args['exclude'];
     5121        $meta_key     = $parsed_args['meta_key'];
     5122        $meta_value   = $parsed_args['meta_value'];
     5123        $parent       = $parsed_args['parent'];
     5124        $post_status  = $parsed_args['post_status'];
    51255125
    51265126        // Make sure the post type is hierarchical.
    51275127        $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
    5128         if ( ! in_array( $r['post_type'], $hierarchical_post_types ) ) {
     5128        if ( ! in_array( $parsed_args['post_type'], $hierarchical_post_types ) ) {
    51295129                return false;
    51305130        }
     
    51435143
    51445144        // $args can be whatever, only use the args defined in defaults to compute the key.
    5145         $key          = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) );
     5145        $key          = md5( serialize( wp_array_slice_assoc( $parsed_args, array_keys( $defaults ) ) ) );
    51465146        $last_changed = wp_cache_get_last_changed( 'posts' );
    51475147
     
    51525152                $pages = array_map( 'get_post', $cache );
    51535153                /** This filter is documented in wp-includes/post.php */
    5154                 $pages = apply_filters( 'get_pages', $pages, $r );
     5154                $pages = apply_filters( 'get_pages', $pages, $parsed_args );
    51555155                return $pages;
    51565156        }
    51575157
    51585158        $inclusions = '';
    5159         if ( ! empty( $r['include'] ) ) {
     5159        if ( ! empty( $parsed_args['include'] ) ) {
    51605160                $child_of     = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
    51615161                $parent       = -1;
     
    51645164                $meta_value   = '';
    51655165                $hierarchical = false;
    5166                 $incpages     = wp_parse_id_list( $r['include'] );
     5166                $incpages     = wp_parse_id_list( $parsed_args['include'] );
    51675167                if ( ! empty( $incpages ) ) {
    51685168                        $inclusions = ' AND ID IN (' . implode( ',', $incpages ) . ')';
     
    51795179
    51805180        $author_query = '';
    5181         if ( ! empty( $r['authors'] ) ) {
    5182                 $post_authors = wp_parse_list( $r['authors'] );
     5181        if ( ! empty( $parsed_args['authors'] ) ) {
     5182                $post_authors = wp_parse_list( $parsed_args['authors'] );
    51835183
    51845184                if ( ! empty( $post_authors ) ) {
     
    52345234
    52355235        if ( 1 == count( $post_status ) ) {
    5236                 $where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $r['post_type'], reset( $post_status ) );
     5236                $where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $parsed_args['post_type'], reset( $post_status ) );
    52375237        } else {
    52385238                $post_status     = implode( "', '", $post_status );
    5239                 $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $r['post_type'] );
     5239                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $parsed_args['post_type'] );
    52405240        }
    52415241
     
    52625262        );
    52635263
    5264         foreach ( explode( ',', $r['sort_column'] ) as $orderby ) {
     5264        foreach ( explode( ',', $parsed_args['sort_column'] ) as $orderby ) {
    52655265                $orderby = trim( $orderby );
    52665266                if ( ! in_array( $orderby, $allowed_keys ) ) {
     
    52935293        $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title";
    52945294
    5295         $sort_order = strtoupper( $r['sort_order'] );
     5295        $sort_order = strtoupper( $parsed_args['sort_order'] );
    52965296        if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ) ) ) {
    52975297                $sort_order = 'ASC';
     
    53125312
    53135313                /** This filter is documented in wp-includes/post.php */
    5314                 $pages = apply_filters( 'get_pages', array(), $r );
     5314                $pages = apply_filters( 'get_pages', array(), $parsed_args );
    53155315                return $pages;
    53165316        }
     
    53295329        }
    53305330
    5331         if ( ! empty( $r['exclude_tree'] ) ) {
    5332                 $exclude = wp_parse_id_list( $r['exclude_tree'] );
     5331        if ( ! empty( $parsed_args['exclude_tree'] ) ) {
     5332                $exclude = wp_parse_id_list( $parsed_args['exclude_tree'] );
    53335333                foreach ( $exclude as $id ) {
    53345334                        $children = get_page_children( $id, $pages );
     
    53625362         *
    53635363         * @param array $pages List of pages to retrieve.
    5364          * @param array $r     Array of get_pages() arguments.
     5364         * @param array $parsed_args     Array of get_pages() arguments.
    53655365         */
    5366         return apply_filters( 'get_pages', $pages, $r );
     5366        return apply_filters( 'get_pages', $pages, $parsed_args );
    53675367}
    53685368
  • trunk/src/wp-includes/taxonomy.php

    r45603 r45667  
    42964296        );
    42974297
    4298         $r = wp_parse_args( $args, $defaults );
    4299 
    4300         echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after'];
     4298        $parsed_args = wp_parse_args( $args, $defaults );
     4299
     4300        echo $parsed_args['before'] . join( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after'];
    43014301}
    43024302
  • trunk/src/wp-includes/user.php

    r45639 r45667  
    11241124        $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
    11251125
    1126         $r = wp_parse_args( $args, $defaults );
    1127 
    1128         $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in' ) );
     1126        $parsed_args = wp_parse_args( $args, $defaults );
     1127
     1128        $query_args = wp_array_slice_assoc( $parsed_args, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in' ) );
    11291129
    11301130        $fields = array( 'ID', 'user_login' );
    11311131
    1132         $show = ! empty( $r['show'] ) ? $r['show'] : 'display_name';
     1132        $show = ! empty( $parsed_args['show'] ) ? $parsed_args['show'] : 'display_name';
    11331133        if ( 'display_name_with_login' === $show ) {
    11341134                $fields[] = 'display_name';
     
    11391139        $query_args['fields'] = $fields;
    11401140
    1141         $show_option_all   = $r['show_option_all'];
    1142         $show_option_none  = $r['show_option_none'];
    1143         $option_none_value = $r['option_none_value'];
     1141        $show_option_all   = $parsed_args['show_option_all'];
     1142        $show_option_none  = $parsed_args['show_option_none'];
     1143        $option_none_value = $parsed_args['option_none_value'];
    11441144
    11451145        /**
     
    11491149         *
    11501150         * @param array $query_args The query arguments for get_users().
    1151          * @param array $r          The arguments passed to wp_dropdown_users() combined with the defaults.
    1152          */
    1153         $query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $r );
     1151         * @param array $parsed_args          The arguments passed to wp_dropdown_users() combined with the defaults.
     1152         */
     1153        $query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $parsed_args );
    11541154
    11551155        $users = get_users( $query_args );
    11561156
    11571157        $output = '';
    1158         if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
    1159                 $name = esc_attr( $r['name'] );
    1160                 if ( $r['multi'] && ! $r['id'] ) {
     1158        if ( ! empty( $users ) && ( empty( $parsed_args['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
     1159                $name = esc_attr( $parsed_args['name'] );
     1160                if ( $parsed_args['multi'] && ! $parsed_args['id'] ) {
    11611161                        $id = '';
    11621162                } else {
    1163                         $id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'";
    1164                 }
    1165                 $output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n";
     1163                        $id = $parsed_args['id'] ? " id='" . esc_attr( $parsed_args['id'] ) . "'" : " id='$name'";
     1164                }
     1165                $output = "<select name='{$name}'{$id} class='" . $parsed_args['class'] . "'>\n";
    11661166
    11671167                if ( $show_option_all ) {
     
    11701170
    11711171                if ( $show_option_none ) {
    1172                         $_selected = selected( $option_none_value, $r['selected'], false );
     1172                        $_selected = selected( $option_none_value, $parsed_args['selected'], false );
    11731173                        $output   .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n";
    11741174                }
    11751175
    1176                 if ( $r['include_selected'] && ( $r['selected'] > 0 ) ) {
    1177                         $found_selected = false;
    1178                         $r['selected']  = (int) $r['selected'];
     1176                if ( $parsed_args['include_selected'] && ( $parsed_args['selected'] > 0 ) ) {
     1177                        $found_selected          = false;
     1178                        $parsed_args['selected'] = (int) $parsed_args['selected'];
    11791179                        foreach ( (array) $users as $user ) {
    11801180                                $user->ID = (int) $user->ID;
    1181                                 if ( $user->ID === $r['selected'] ) {
     1181                                if ( $user->ID === $parsed_args['selected'] ) {
    11821182                                        $found_selected = true;
    11831183                                }
     
    11851185
    11861186                        if ( ! $found_selected ) {
    1187                                 $users[] = get_userdata( $r['selected'] );
     1187                                $users[] = get_userdata( $parsed_args['selected'] );
    11881188                        }
    11891189                }
     
    11991199                        }
    12001200
    1201                         $_selected = selected( $user->ID, $r['selected'], false );
     1201                        $_selected = selected( $user->ID, $parsed_args['selected'], false );
    12021202                        $output   .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
    12031203                }
     
    12151215        $html = apply_filters( 'wp_dropdown_users', $output );
    12161216
    1217         if ( $r['echo'] ) {
     1217        if ( $parsed_args['echo'] ) {
    12181218                echo $html;
    12191219        }
Note: See TracChangeset for help on using the changeset viewer.