Changeset 45667
- Timestamp:
- 07/25/2019 12:47:53 AM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/bookmark.php
r43598 r45667 163 163 ); 164 164 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']; 171 171 172 172 $update = false; … … 187 187 } 188 188 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(); 199 199 200 200 // Make sure we set a valid category. -
trunk/src/wp-admin/includes/media.php
r45599 r45667 1494 1494 'show_title' => true, 1495 1495 ); 1496 $args = wp_parse_args( $args, $default_args ); 1496 1497 $parsed_args = wp_parse_args( $args, $default_args ); 1497 1498 1498 1499 /** … … 1503 1504 * @see get_media_item 1504 1505 * 1505 * @param array $ args An array of arguments.1506 * @param array $parsed_args An array of arguments. 1506 1507 */ 1507 $ r = apply_filters( 'get_media_item_args', $args );1508 $parsed_args = apply_filters( 'get_media_item_args', $parsed_args ); 1508 1509 1509 1510 $toggle_on = __( 'Show' ); … … 1519 1520 $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />"; 1520 1521 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'; 1525 1526 $toggle_links = " 1526 1527 <a class='toggle describe-toggle-on' href='#'>$toggle_on</a> … … 1532 1533 1533 1534 $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, '…' ) . '</span></div>' : '';1535 $display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . '</span></div>' : ''; 1535 1536 1536 1537 $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) ); … … 1610 1611 ); 1611 1612 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']; 1617 1618 if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { 1618 1619 if ( ! EMPTY_TRASH_DAYS ) { … … 1651 1652 } 1652 1653 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" ); 1655 1656 } 1656 1657 $hidden_fields = array(); -
trunk/src/wp-admin/includes/meta-boxes.php
r45599 r45667 493 493 $args = $box['args']; 494 494 } 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'] ); 498 498 $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); 499 499 $comma = _x( ',', 'tag delimiter' ); … … 556 556 $args = $box['args']; 557 557 } 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'] ); 561 561 ?> 562 562 <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> … … 1311 1311 <td><select name="link_rating" id="link_rating" size="1"> 1312 1312 <?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 ) { 1316 1316 echo ' selected="selected"'; 1317 1317 } 1318 echo( '>' . $ r. '</option>' );1318 echo( '>' . $parsed_args . '</option>' ); 1319 1319 } 1320 1320 ?> -
trunk/src/wp-admin/includes/ms.php
r45583 r45667 1090 1090 1091 1091 // Parse arguments 1092 $ r= wp_parse_args(1092 $parsed_args = wp_parse_args( 1093 1093 $args, 1094 1094 array( … … 1103 1103 1104 1104 // Loop through tabs 1105 foreach ( $ r['links'] as $link_id => $link ) {1105 foreach ( $parsed_args['links'] as $link_id => $link ) { 1106 1106 1107 1107 // 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'] ) ) { 1109 1109 continue; 1110 1110 } … … 1117 1117 1118 1118 // 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'] ) { 1120 1120 $classes[] = 'nav-tab-active'; 1121 1121 $aria_current = ' aria-current="page"'; … … 1126 1126 1127 1127 // 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'] ) ); 1129 1129 1130 1130 // Add link to nav links -
trunk/src/wp-admin/includes/template.php
r45657 r45667 101 101 $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); 102 102 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 ) ) { 106 106 $walker = new Walker_Category_Checklist; 107 107 } 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']; 113 113 114 114 $args = array( 'taxonomy' => $taxonomy ); … … 117 117 $args['disabled'] = ! current_user_can( $tax->cap->assign_terms ); 118 118 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']; 123 123 } elseif ( $post_id ) { 124 124 $args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) ); … … 126 126 $args['selected_cats'] = array(); 127 127 } 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']; 130 130 } else { 131 131 $args['popular_cats'] = get_terms( … … 157 157 $output = ''; 158 158 159 if ( $ r['checked_ontop'] ) {159 if ( $parsed_args['checked_ontop'] ) { 160 160 // 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) 161 161 $checked_categories = array(); … … 175 175 $output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) ); 176 176 177 if ( $ r['echo'] ) {177 if ( $parsed_args['echo'] ) { 178 178 echo $output; 179 179 } … … 2442 2442 */ 2443 2443 function wp_star_rating( $args = array() ) { 2444 $defaults = array(2444 $defaults = array( 2445 2445 'rating' => 0, 2446 2446 'type' => 'rating', … … 2448 2448 'echo' => true, 2449 2449 ); 2450 $ r= wp_parse_args( $args, $defaults );2450 $parsed_args = wp_parse_args( $args, $defaults ); 2451 2451 2452 2452 // 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'] ); 2454 2454 2455 2455 // Convert Percentage to star rating, 0..5 in .5 increments 2456 if ( 'percent' === $ r['type'] ) {2456 if ( 'percent' === $parsed_args['type'] ) { 2457 2457 $rating = round( $rating / 10, 0 ) / 2; 2458 2458 } … … 2463 2463 $empty_stars = 5 - $full_stars - $half_stars; 2464 2464 2465 if ( $ r['number'] ) {2465 if ( $parsed_args['number'] ) { 2466 2466 /* 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'] ) ); 2469 2469 } else { 2470 2470 /* translators: %s: the rating */ … … 2479 2479 $output .= '</div>'; 2480 2480 2481 if ( $ r['echo'] ) {2481 if ( $parsed_args['echo'] ) { 2482 2482 echo $output; 2483 2483 } -
trunk/src/wp-includes/bookmark-template.php
r45424 r45667 63 63 ); 64 64 65 $ r= wp_parse_args( $args, $defaults );65 $parsed_args = wp_parse_args( $args, $defaults ); 66 66 67 67 $output = ''; // Blank string to start with. … … 71 71 $bookmark->recently_updated = false; 72 72 } 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 ) { 75 75 $output .= '<em>'; 76 76 } … … 83 83 $title = $desc; 84 84 85 if ( $ r['show_updated'] ) {85 if ( $parsed_args['show_updated'] ) { 86 86 if ( '00' != substr( $bookmark->link_updated_f, 0, 2 ) ) { 87 87 $title .= ' ('; … … 96 96 } 97 97 } 98 $alt = ' alt="' . $name . ( $ r['show_description'] ? ' ' . $title : '' ) . '"';98 $alt = ' alt="' . $name . ( $parsed_args['show_description'] ? ' ' . $title : '' ) . '"'; 99 99 100 100 if ( '' != $title ) { … … 111 111 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>'; 112 112 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'] ) { 116 116 if ( strpos( $bookmark->link_image, 'http' ) === 0 ) { 117 117 $output .= "<img src=\"$bookmark->link_image\" $alt $title />"; … … 119 119 $output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title />"; 120 120 } 121 if ( $ r['show_name'] ) {121 if ( $parsed_args['show_name'] ) { 122 122 $output .= " $name"; 123 123 } … … 126 126 } 127 127 128 $output .= $ r['link_after'];128 $output .= $parsed_args['link_after']; 129 129 130 130 $output .= '</a>'; 131 131 132 if ( $ r['show_updated'] && $bookmark->recently_updated ) {132 if ( $parsed_args['show_updated'] && $bookmark->recently_updated ) { 133 133 $output .= '</em>'; 134 134 } 135 135 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( 142 142 'link_rating', 143 143 $bookmark->link_rating, … … 146 146 ); 147 147 } 148 $output .= $ r['after'] . "\n";148 $output .= $parsed_args['after'] . "\n"; 149 149 } // end while 150 150 … … 226 226 ); 227 227 228 $ r= wp_parse_args( $args, $defaults );228 $parsed_args = wp_parse_args( $args, $defaults ); 229 229 230 230 $output = ''; 231 231 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'] ); 234 234 } 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'] ) { 239 239 $cats = get_terms( 240 240 'link_category', 241 241 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'], 247 247 'hierarchical' => 0, 248 248 ) 249 249 ); 250 250 if ( empty( $cats ) ) { 251 $ r['categorize'] = false;251 $parsed_args['categorize'] = false; 252 252 } 253 253 } 254 254 255 if ( $ r['categorize'] ) {255 if ( $parsed_args['categorize'] ) { 256 256 // Split the bookmarks into ul's for each category 257 257 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 ) ); 259 259 $bookmarks = get_bookmarks( $params ); 260 260 if ( empty( $bookmarks ) ) { … … 263 263 $output .= str_replace( 264 264 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'] 267 267 ); 268 268 /** … … 275 275 $catname = apply_filters( 'link_category', $cat->name ); 276 276 277 $output .= $ r['title_before'];277 $output .= $parsed_args['title_before']; 278 278 $output .= $catname; 279 $output .= $ r['title_after'];279 $output .= $parsed_args['title_after']; 280 280 $output .= "\n\t<ul class='xoxo blogroll'>\n"; 281 $output .= _walk_bookmarks( $bookmarks, $ r);281 $output .= _walk_bookmarks( $bookmarks, $parsed_args ); 282 282 $output .= "\n\t</ul>\n"; 283 $output .= $ r['category_after'] . "\n";283 $output .= $parsed_args['category_after'] . "\n"; 284 284 } 285 285 } else { 286 286 //output one single list using title_li for the title 287 $bookmarks = get_bookmarks( $ r);287 $bookmarks = get_bookmarks( $parsed_args ); 288 288 289 289 if ( ! empty( $bookmarks ) ) { 290 if ( ! empty( $ r['title_li'] ) ) {290 if ( ! empty( $parsed_args['title_li'] ) ) { 291 291 $output .= str_replace( 292 292 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'] 295 295 ); 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']; 299 299 $output .= "\n\t<ul class='xoxo blogroll'>\n"; 300 $output .= _walk_bookmarks( $bookmarks, $ r);300 $output .= _walk_bookmarks( $bookmarks, $parsed_args ); 301 301 $output .= "\n\t</ul>\n"; 302 $output .= $ r['category_after'] . "\n";302 $output .= $parsed_args['category_after'] . "\n"; 303 303 } else { 304 $output .= _walk_bookmarks( $bookmarks, $ r);304 $output .= _walk_bookmarks( $bookmarks, $parsed_args ); 305 305 } 306 306 } … … 316 316 $html = apply_filters( 'wp_list_bookmarks', $output ); 317 317 318 if ( ! $ r['echo'] ) {318 if ( ! $parsed_args['echo'] ) { 319 319 return $html; 320 320 } -
trunk/src/wp-includes/bookmark.php
r45590 r45667 140 140 ); 141 141 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 ) ); 145 145 $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ); 146 if ( 'rand' !== $r['orderby'] && $cache ) { 146 147 if ( 'rand' !== $parsed_args['orderby'] && $cache ) { 147 148 if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { 148 149 $bookmarks = $cache[ $key ]; … … 160 161 * 161 162 * @param array $bookmarks List of the cached bookmarks. 162 * @param array $ rAn array of bookmark query arguments.163 * @param array $parsed_args An array of bookmark query arguments. 163 164 */ 164 return apply_filters( 'get_bookmarks', $bookmarks, $ r);165 return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args ); 165 166 } 166 167 } … … 171 172 172 173 $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'] ); 178 180 if ( count( $inclinks ) ) { 179 181 foreach ( $inclinks as $inclink ) { … … 191 193 192 194 $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'] ); 195 197 if ( count( $exlinks ) ) { 196 198 foreach ( $exlinks as $exlink ) { … … 207 209 } 208 210 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; 213 215 } else { 214 216 $cache[ $key ] = array(); 215 217 wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); 216 218 /** 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 ); 218 220 } 219 221 } 220 222 221 223 $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'] ) . '%'; 224 226 $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like ); 225 227 } … … 227 229 $category_query = ''; 228 230 $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'] ); 231 233 if ( count( $incategories ) ) { 232 234 foreach ( $incategories as $incat ) { … … 244 246 } 245 247 246 if ( $ r['show_updated'] ) {248 if ( $parsed_args['show_updated'] ) { 247 249 $recently_updated_test = ', IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated '; 248 250 } else { … … 250 252 } 251 253 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'] ); 255 257 $length = ''; 256 258 switch ( $orderby ) { … … 283 285 } 284 286 285 $order = strtoupper( $ r['order'] );287 $order = strtoupper( $parsed_args['order'] ); 286 288 if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) { 287 289 $order = 'ASC'; … … 289 291 290 292 $visible = ''; 291 if ( $ r['hide_invisible'] ) {293 if ( $parsed_args['hide_invisible'] ) { 292 294 $visible = "AND link_visible = 'Y'"; 293 295 } … … 296 298 $query .= " $exclusions $inclusions $search"; 297 299 $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']; 300 302 } 301 303 … … 308 310 309 311 /** 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 ); 311 313 } 312 314 -
trunk/src/wp-includes/category-template.php
r45599 r45667 366 366 } 367 367 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']; 376 377 377 378 $tab_index_attribute = ''; … … 381 382 382 383 // Avoid clashes with the 'name' param of get_terms(). 383 $get_terms_args = $ r;384 $get_terms_args = $parsed_args; 384 385 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 ) ) { 393 394 $output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n"; 394 395 } else { 395 396 $output = ''; 396 397 } 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'] ) ) { 398 399 399 400 /** … … 412 413 * @param WP_Term|null $category The category object, or null if there's no corresponding category. 413 414 */ 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 ); 415 416 $output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n"; 416 417 } … … 418 419 if ( ! empty( $categories ) ) { 419 420 420 if ( $ r['show_option_all'] ) {421 if ( $parsed_args['show_option_all'] ) { 421 422 422 423 /** 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'" : ''; 425 426 $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; 426 427 } 427 428 428 if ( $ r['show_option_none'] ) {429 if ( $parsed_args['show_option_none'] ) { 429 430 430 431 /** 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 ); 433 434 $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n"; 434 435 } 435 436 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. 438 439 } else { 439 440 $depth = -1; // Flat. 440 441 } 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 ) ) { 445 446 $output .= "</select>\n"; 446 447 } … … 451 452 * 452 453 * @param string $output HTML output. 453 * @param array $ rArguments used to build the drop-down.454 * @param array $parsed_args Arguments used to build the drop-down. 454 455 */ 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'] ) { 458 459 echo $output; 459 460 } … … 538 539 ); 539 540 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; 544 545 } 545 546 546 547 // Descendants of exclusions should be excluded too. 547 if ( true == $ r['hierarchical'] ) {548 if ( true == $parsed_args['hierarchical'] ) { 548 549 $exclude_tree = array(); 549 550 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'] ) ) { 567 568 return false; 568 569 } 569 570 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 ); 574 575 575 576 $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>'; 578 579 } 579 580 if ( empty( $categories ) ) { 580 581 if ( ! empty( $show_option_none ) ) { 581 if ( 'list' == $ r['style'] ) {582 if ( 'list' == $parsed_args['style'] ) { 582 583 $output .= '<li class="cat-item-none">' . $show_option_none . '</li>'; 583 584 } else { … … 591 592 592 593 // 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'] ); 594 595 if ( ! in_array( 'post', $taxonomy_object->object_type ) && ! in_array( 'page', $taxonomy_object->object_type ) ) { 595 596 foreach ( $taxonomy_object->object_type as $object_type ) { … … 614 615 615 616 $posts_page = esc_url( $posts_page ); 616 if ( 'list' == $ r['style'] ) {617 if ( 'list' == $parsed_args['style'] ) { 617 618 $output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>"; 618 619 } else { … … 621 622 } 622 623 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() ) ) { 624 625 $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(); 627 628 } 628 629 } 629 630 630 if ( $ r['hierarchical'] ) {631 $depth = $ r['depth'];631 if ( $parsed_args['hierarchical'] ) { 632 $depth = $parsed_args['depth']; 632 633 } else { 633 634 $depth = -1; // Flat. 634 635 } 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'] ) ) { 639 640 $output .= '</ul></li>'; 640 641 } … … 650 651 $html = apply_filters( 'wp_list_categories', $output, $args ); 651 652 652 if ( $ r['echo'] ) {653 if ( $parsed_args['echo'] ) { 653 654 echo $html; 654 655 } else { -
trunk/src/wp-includes/class-http.php
r45590 r45667 221 221 } 222 222 223 $ r= wp_parse_args( $args, $defaults );223 $parsed_args = wp_parse_args( $args, $defaults ); 224 224 /** 225 225 * Filters the arguments used in an HTTP request. … … 227 227 * @since 2.7.0 228 228 * 229 * @param array $ rAn array of HTTP request arguments.229 * @param array $parsed_args An array of HTTP request arguments. 230 230 * @param string $url The request URL. 231 231 */ 232 $ r = apply_filters( 'http_request_args', $r, $url );232 $parsed_args = apply_filters( 'http_request_args', $parsed_args, $url ); 233 233 234 234 // 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']; 237 237 } 238 238 … … 252 252 * 253 253 * @param false|array|WP_Error $preempt Whether to preempt an HTTP request's return value. Default false. 254 * @param array $ rHTTP request arguments.254 * @param array $parsed_args HTTP request arguments. 255 255 * @param string $url The request URL. 256 256 */ 257 $pre = apply_filters( 'pre_http_request', false, $ r, $url );257 $pre = apply_filters( 'pre_http_request', false, $parsed_args, $url ); 258 258 259 259 if ( false !== $pre ) { … … 262 262 263 263 if ( function_exists( 'wp_kses_bad_protocol' ) ) { 264 if ( $ r['reject_unsafe_urls'] ) {264 if ( $parsed_args['reject_unsafe_urls'] ) { 265 265 $url = wp_http_validate_url( $url ); 266 266 } … … 275 275 $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) ); 276 276 /** 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 ); 278 278 return $response; 279 279 } … … 282 282 $response = new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) ); 283 283 /** 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 ); 285 285 return $response; 286 286 } … … 288 288 // If we are streaming to a file but no filename was given drop it in the WP temp dir 289 289 // 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 ); 293 293 } 294 294 295 295 // 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'] ) ) ) { 298 298 $response = new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) ); 299 299 /** 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 ); 301 301 return $response; 302 302 } 303 303 } 304 304 305 if ( is_null( $ r['headers'] ) ) {306 $ r['headers'] = array();305 if ( is_null( $parsed_args['headers'] ) ) { 306 $parsed_args['headers'] = array(); 307 307 } 308 308 309 309 // 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']; 313 313 } 314 314 315 315 // 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']; 319 319 $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 ), 324 324 ); 325 325 … … 328 328 329 329 // 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'] ) { 331 331 $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) ); 332 332 } 333 333 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'] ) ) { 338 338 $options['follow_redirects'] = false; 339 339 } else { 340 $options['redirects'] = $ r['redirection'];340 $options['redirects'] = $parsed_args['redirection']; 341 341 } 342 342 343 343 // 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']; 346 346 } 347 347 348 348 // 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'] ); 351 351 } 352 352 353 353 // SSL certificate handling 354 if ( ! $ r['sslverify'] ) {354 if ( ! $parsed_args['sslverify'] ) { 355 355 $options['verify'] = false; 356 356 $options['verifyname'] = false; 357 357 } else { 358 $options['verify'] = $ r['sslcertificates'];358 $options['verify'] = $parsed_args['sslcertificates']; 359 359 } 360 360 … … 394 394 395 395 // 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'] ); 397 397 $response = $http_response->to_array(); 398 398 … … 413 413 * @param string $context Context under which the hook is fired. 414 414 * @param string $class HTTP transport used. 415 * @param array $ rHTTP request arguments.415 * @param array $parsed_args HTTP request arguments. 416 416 * @param string $url The request URL. 417 417 */ 418 do_action( 'http_api_debug', $response, 'response', 'Requests', $ r, $url );418 do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); 419 419 if ( is_wp_error( $response ) ) { 420 420 return $response; 421 421 } 422 422 423 if ( ! $ r['blocking'] ) {423 if ( ! $parsed_args['blocking'] ) { 424 424 return array( 425 425 'headers' => array(), … … 440 440 * 441 441 * @param array $response HTTP response. 442 * @param array $ rHTTP request arguments.442 * @param array $parsed_args HTTP request arguments. 443 443 * @param string $url The request URL. 444 444 */ 445 return apply_filters( 'http_response', $response, $ r, $url );445 return apply_filters( 'http_response', $response, $parsed_args, $url ); 446 446 } 447 447 … … 601 601 */ 602 602 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 ); 606 606 } 607 607 … … 618 618 */ 619 619 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 ); 623 623 } 624 624 … … 635 635 */ 636 636 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 ); 640 640 } 641 641 -
trunk/src/wp-includes/class-wp-ajax-response.php
r45590 r45667 74 74 ); 75 75 76 $ r= wp_parse_args( $args, $defaults );76 $parsed_args = wp_parse_args( $args, $defaults ); 77 77 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']; 84 84 85 85 if ( is_wp_error( $id ) ) { … … 119 119 120 120 $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 ) { 123 123 $s .= "<$k><![CDATA[$v]]></$k>"; 124 124 } -
trunk/src/wp-includes/class-wp-http-curl.php
r45590 r45667 80 80 ); 81 81 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'] ); 90 90 } 91 91 92 92 // Construct Cookie: header if any cookies are set. 93 WP_Http::buildCookieHeader( $ r);93 WP_Http::buildCookieHeader( $parsed_args ); 94 94 95 95 $handle = curl_init(); … … 110 110 } 111 111 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']; 114 114 if ( $is_local ) { 115 115 /** This filter is documented in wp-includes/class-wp-http-streams.php */ … … 124 124 * a value of 0 will allow an unlimited timeout. 125 125 */ 126 $timeout = (int) ceil( $ r['timeout'] );126 $timeout = (int) ceil( $parsed_args['timeout'] ); 127 127 curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, $timeout ); 128 128 curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout ); … … 134 134 135 135 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'] ); 140 140 141 141 /* … … 148 148 } 149 149 150 switch ( $ r['method'] ) {150 switch ( $parsed_args['method'] ) { 151 151 case 'HEAD': 152 152 curl_setopt( $handle, CURLOPT_NOBODY, true ); … … 154 154 case 'POST': 155 155 curl_setopt( $handle, CURLOPT_POST, true ); 156 curl_setopt( $handle, CURLOPT_POSTFIELDS, $ r['body'] );156 curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); 157 157 break; 158 158 case 'PUT': 159 159 curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, 'PUT' ); 160 curl_setopt( $handle, CURLOPT_POSTFIELDS, $ r['body'] );160 curl_setopt( $handle, CURLOPT_POSTFIELDS, $parsed_args['body'] ); 161 161 break; 162 162 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'] ); 166 166 } 167 167 break; 168 168 } 169 169 170 if ( true === $ r['blocking'] ) {170 if ( true === $parsed_args['blocking'] ) { 171 171 curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) ); 172 172 curl_setopt( $handle, CURLOPT_WRITEFUNCTION, array( $this, 'stream_body' ) ); … … 175 175 curl_setopt( $handle, CURLOPT_HEADER, false ); 176 176 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'] ); 179 179 } else { 180 180 $this->max_body_length = false; … … 182 182 183 183 // If streaming to a file open a file handle, and setup our curl streaming handler. 184 if ( $ r['stream'] ) {184 if ( $parsed_args['stream'] ) { 185 185 if ( ! WP_DEBUG ) { 186 $this->stream_handle = @fopen( $ r['filename'], 'w+' );186 $this->stream_handle = @fopen( $parsed_args['filename'], 'w+' ); 187 187 } else { 188 $this->stream_handle = fopen( $ r['filename'], 'w+' );188 $this->stream_handle = fopen( $parsed_args['filename'], 'w+' ); 189 189 } 190 190 if ( ! $this->stream_handle ) { … … 195 195 __( 'Could not open handle for %1$s to %2$s.' ), 196 196 'fopen()', 197 $ r['filename']197 $parsed_args['filename'] 198 198 ) 199 199 ); … … 203 203 } 204 204 205 if ( ! empty( $ r['headers'] ) ) {205 if ( ! empty( $parsed_args['headers'] ) ) { 206 206 // cURL expects full header strings in each element. 207 207 $headers = array(); 208 foreach ( $ r['headers'] as $name => $value ) {208 foreach ( $parsed_args['headers'] as $name => $value ) { 209 209 $headers[] = "{$name}: $value"; 210 210 } … … 212 212 } 213 213 214 if ( $ r['httpversion'] == '1.0' ) {214 if ( $parsed_args['httpversion'] == '1.0' ) { 215 215 curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 ); 216 216 } else { … … 227 227 * 228 228 * @param resource $handle The cURL handle returned by curl_init() (passed by reference). 229 * @param array $ rThe HTTP request arguments.229 * @param array $parsed_args The HTTP request arguments. 230 230 * @param string $url The request URL. 231 231 */ 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 ) ); 233 233 234 234 // 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'] ) { 236 236 curl_exec( $handle ); 237 237 … … 273 273 if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) { 274 274 if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) { 275 if ( $ r['stream'] ) {275 if ( $parsed_args['stream'] ) { 276 276 curl_close( $handle ); 277 277 fclose( $this->stream_handle ); … … 297 297 curl_close( $handle ); 298 298 299 if ( $ r['stream'] ) {299 if ( $parsed_args['stream'] ) { 300 300 fclose( $this->stream_handle ); 301 301 } … … 306 306 'response' => $theHeaders['response'], 307 307 'cookies' => $theHeaders['cookies'], 308 'filename' => $ r['filename'],308 'filename' => $parsed_args['filename'], 309 309 ); 310 310 311 311 // Handle redirects. 312 $redirect_response = WP_HTTP::handle_redirects( $url, $ r, $response );312 $redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response ); 313 313 if ( false !== $redirect_response ) { 314 314 return $redirect_response; 315 315 } 316 316 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'] ) ) { 318 318 $theBody = WP_Http_Encoding::decompress( $theBody ); 319 319 } -
trunk/src/wp-includes/class-wp-http-streams.php
r45611 r45667 39 39 ); 40 40 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'] ); 49 49 } 50 50 51 51 // Construct Cookie: header if any cookies are set. 52 WP_Http::buildCookieHeader( $ r);52 WP_Http::buildCookieHeader( $parsed_args ); 53 53 54 54 $arrURL = parse_url( $url ); … … 71 71 } 72 72 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']; 76 76 } 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'] ); 80 80 } 81 81 … … 91 91 $connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host; 92 92 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']; 95 95 if ( $is_local ) { 96 96 /** … … 118 118 'capture_peer_cert' => $ssl_verify, 119 119 'SNI_enabled' => true, 120 'cafile' => $ r['sslcertificates'],120 'cafile' => $parsed_args['sslcertificates'], 121 121 'allow_self_signed' => ! $ssl_verify, 122 122 ), … … 124 124 ); 125 125 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; 128 128 $connect_timeout = max( $timeout, 1 ); 129 129 … … 183 183 } 184 184 185 $strHeaders = strtoupper( $ r['method'] ) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";185 $strHeaders = strtoupper( $parsed_args['method'] ) . ' ' . $requestPath . ' HTTP/' . $parsed_args['httpversion'] . "\r\n"; 186 186 187 187 $include_port_in_host_header = ( … … 197 197 } 198 198 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 ) { 205 205 $strHeaders .= $header . ': ' . $headerValue . "\r\n"; 206 206 } 207 207 } else { 208 $strHeaders .= $ r['headers'];208 $strHeaders .= $parsed_args['headers']; 209 209 } 210 210 … … 215 215 $strHeaders .= "\r\n"; 216 216 217 if ( ! is_null( $ r['body'] ) ) {218 $strHeaders .= $ r['body'];217 if ( ! is_null( $parsed_args['body'] ) ) { 218 $strHeaders .= $parsed_args['body']; 219 219 } 220 220 221 221 fwrite( $handle, $strHeaders ); 222 222 223 if ( ! $ r['blocking'] ) {223 if ( ! $parsed_args['blocking'] ) { 224 224 stream_set_blocking( $handle, 0 ); 225 225 fclose( $handle ); … … 239 239 $keep_reading = true; 240 240 $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'] ); 243 243 } 244 244 245 245 // If streaming to a file setup the file handle. 246 if ( $ r['stream'] ) {246 if ( $parsed_args['stream'] ) { 247 247 if ( ! WP_DEBUG ) { 248 $stream_handle = @fopen( $ r['filename'], 'w+' );248 $stream_handle = @fopen( $parsed_args['filename'], 'w+' ); 249 249 } else { 250 $stream_handle = fopen( $ r['filename'], 'w+' );250 $stream_handle = fopen( $parsed_args['filename'], 'w+' ); 251 251 } 252 252 if ( ! $stream_handle ) { … … 257 257 __( 'Could not open handle for %1$s to %2$s.' ), 258 258 'fopen()', 259 $ r['filename']259 $parsed_args['filename'] 260 260 ) 261 261 ); … … 278 278 $this_block_size = strlen( $block ); 279 279 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 ); 282 282 $block = substr( $block, 0, $this_block_size ); 283 283 } … … 293 293 $bytes_written += $bytes_written_to_file; 294 294 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']; 296 296 } 297 297 … … 307 307 $bodyStarted = true; 308 308 } 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'] ) ); 310 310 } 311 311 … … 325 325 'response' => $arrHeaders['response'], 326 326 'cookies' => $arrHeaders['cookies'], 327 'filename' => $ r['filename'],327 'filename' => $parsed_args['filename'], 328 328 ); 329 329 330 330 // Handle redirects. 331 $redirect_response = WP_Http::handle_redirects( $url, $ r, $response );331 $redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response ); 332 332 if ( false !== $redirect_response ) { 333 333 return $redirect_response; … … 339 339 } 340 340 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'] ) ) { 342 342 $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); 343 343 } 344 344 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'] ); 347 347 } 348 348 -
trunk/src/wp-includes/comment-template.php
r45602 r45667 2015 2015 ); 2016 2016 2017 $ r= wp_parse_args( $args, $defaults );2017 $parsed_args = wp_parse_args( $args, $defaults ); 2018 2018 2019 2019 /** … … 2024 2024 * @see wp_list_comments() 2025 2025 * 2026 * @param array $ rAn 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 ); 2029 2029 2030 2030 // Figure out what comments we'll be looping through ($_comments) … … 2034 2034 return; 2035 2035 } 2036 if ( 'all' != $ r['type'] ) {2036 if ( 'all' != $parsed_args['type'] ) { 2037 2037 $comments_by_type = separate_comments( $comments ); 2038 if ( empty( $comments_by_type[ $ r['type'] ] ) ) {2038 if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { 2039 2039 return; 2040 2040 } 2041 $_comments = $comments_by_type[ $ r['type'] ];2041 $_comments = $comments_by_type[ $parsed_args['type'] ]; 2042 2042 } else { 2043 2043 $_comments = $comments; … … 2048 2048 * perform a separate comment query and allow Walker_Comment to paginate. 2049 2049 */ 2050 if ( $ r['page'] || $r['per_page'] ) {2050 if ( $parsed_args['page'] || $parsed_args['per_page'] ) { 2051 2051 $current_cpage = get_query_var( 'cpage' ); 2052 2052 if ( ! $current_cpage ) { … … 2055 2055 2056 2056 $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 ) { 2058 2058 $comment_args = array( 2059 2059 'post_id' => get_the_ID(), … … 2075 2075 $comments = get_comments( $comment_args ); 2076 2076 2077 if ( 'all' != $ r['type'] ) {2077 if ( 'all' != $parsed_args['type'] ) { 2078 2078 $comments_by_type = separate_comments( $comments ); 2079 if ( empty( $comments_by_type[ $ r['type'] ] ) ) {2079 if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { 2080 2080 return; 2081 2081 } 2082 2082 2083 $_comments = $comments_by_type[ $ r['type'] ];2083 $_comments = $comments_by_type[ $parsed_args['type'] ]; 2084 2084 } else { 2085 2085 $_comments = $comments; … … 2092 2092 return; 2093 2093 } 2094 if ( 'all' != $ r['type'] ) {2094 if ( 'all' != $parsed_args['type'] ) { 2095 2095 if ( empty( $wp_query->comments_by_type ) ) { 2096 2096 $wp_query->comments_by_type = separate_comments( $wp_query->comments ); 2097 2097 } 2098 if ( empty( $wp_query->comments_by_type[ $ r['type'] ] ) ) {2098 if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) { 2099 2099 return; 2100 2100 } 2101 $_comments = $wp_query->comments_by_type[ $ r['type'] ];2101 $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ]; 2102 2102 } else { 2103 2103 $_comments = $wp_query->comments; … … 2108 2108 $cpage = get_query_var( 'cpage' ); 2109 2109 if ( 'newest' === $default_comments_page ) { 2110 $ r['cpage'] = $cpage;2110 $parsed_args['cpage'] = $cpage; 2111 2111 2112 2112 /* … … 2115 2115 */ 2116 2116 } elseif ( $cpage == 1 ) { 2117 $ r['cpage'] = '';2117 $parsed_args['cpage'] = ''; 2118 2118 } else { 2119 $ r['cpage'] = $cpage;2119 $parsed_args['cpage'] = $cpage; 2120 2120 } 2121 2121 2122 $ r['page'] = 0;2123 $ r['per_page'] = 0;2122 $parsed_args['page'] = 0; 2123 $parsed_args['per_page'] = 0; 2124 2124 } 2125 2125 } 2126 2126 } 2127 2127 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'] ) { 2138 2138 if ( get_option( 'thread_comments' ) ) { 2139 $ r['max_depth'] = get_option( 'thread_comments_depth' );2139 $parsed_args['max_depth'] = get_option( 'thread_comments_depth' ); 2140 2140 } else { 2141 $ r['max_depth'] = -1;2141 $parsed_args['max_depth'] = -1; 2142 2142 } 2143 2143 } 2144 2144 2145 if ( '' === $ r['page'] ) {2145 if ( '' === $parsed_args['page'] ) { 2146 2146 if ( empty( $overridden_cpage ) ) { 2147 $ r['page'] = get_query_var( 'cpage' );2147 $parsed_args['page'] = get_query_var( 'cpage' ); 2148 2148 } 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'] ); 2152 2152 } 2153 2153 } 2154 2154 // 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' ) ); 2162 2162 } 2163 2163 2164 2164 wp_queue_comments_for_comment_meta_lazyload( $_comments ); 2165 2165 2166 if ( empty( $ r['walker'] ) ) {2166 if ( empty( $parsed_args['walker'] ) ) { 2167 2167 $walker = new Walker_Comment; 2168 2168 } 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 ); 2173 2173 2174 2174 $in_comment_loop = false; 2175 2175 2176 if ( $ r['echo'] ) {2176 if ( $parsed_args['echo'] ) { 2177 2177 echo $output; 2178 2178 } else { -
trunk/src/wp-includes/comment.php
r45611 r45667 165 165 } 166 166 167 $defaults = array(167 $defaults = array( 168 168 'status' => 1, 169 169 'post_id' => $post_id, 170 170 'order' => 'ASC', 171 171 ); 172 $ r= wp_parse_args( $args, $defaults );172 $parsed_args = wp_parse_args( $args, $defaults ); 173 173 174 174 $query = new WP_Comment_Query; 175 return $query->query( $ r);175 return $query->query( $parsed_args ); 176 176 } 177 177 -
trunk/src/wp-includes/deprecated.php
r45611 r45667 431 431 ); 432 432 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); 436 436 } 437 437 … … 636 636 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 637 637 638 $ r= wp_parse_args( $args );638 $parsed_args = wp_parse_args( $args ); 639 639 640 640 // 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); 656 656 } 657 657 … … 893 893 ); 894 894 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); 898 898 } 899 899 -
trunk/src/wp-includes/functions.php
r45611 r45667 3081 3081 */ 3082 3082 function _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 ); 3084 3084 3085 3085 if ( is_string( $message ) ) { 3086 if ( ! empty( $ r['additional_errors'] ) ) {3086 if ( ! empty( $parsed_args['additional_errors'] ) ) { 3087 3087 $message = array_merge( 3088 3088 array( $message ), 3089 wp_list_pluck( $ r['additional_errors'], 'message' )3089 wp_list_pluck( $parsed_args['additional_errors'], 'message' ) 3090 3090 ); 3091 3091 $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>"; … … 3097 3097 $have_gettext = function_exists( '__' ); 3098 3098 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']; 3101 3101 if ( function_exists( 'esc_url' ) ) { 3102 3102 $link_url = esc_url( $link_url ); 3103 3103 } 3104 $link_text = $ r['link_text'];3104 $link_text = $parsed_args['link_text']; 3105 3105 $message .= "\n<p><a href='{$link_url}'>{$link_text}</a></p>"; 3106 3106 } 3107 3107 3108 if ( isset( $ r['back_link'] ) && $r['back_link'] ) {3108 if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) { 3109 3109 $back_text = $have_gettext ? __( '« Back' ) : '« Back'; 3110 3110 $message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>"; … … 3114 3114 if ( ! headers_sent() ) { 3115 3115 header( 'Content-Type: text/html; charset=utf-8' ); 3116 status_header( $ r['response'] );3116 status_header( $parsed_args['response'] ); 3117 3117 nocache_headers(); 3118 3118 } 3119 3119 3120 $text_direction = $ r['text_direction'];3120 $text_direction = $parsed_args['text_direction']; 3121 3121 if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) { 3122 3122 $dir_attr = get_language_attributes(); … … 3259 3259 </html> 3260 3260 <?php 3261 if ( $ r['exit'] ) {3261 if ( $parsed_args['exit'] ) { 3262 3262 die(); 3263 3263 } … … 3283 3283 ); 3284 3284 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 ); 3286 3286 3287 3287 if ( ! headers_sent() ) { 3288 3288 // This is intentional. For backward-compatibility, support passing null here. 3289 3289 if ( null !== $args['response'] ) { 3290 status_header( $ r['response'] );3290 status_header( $parsed_args['response'] ); 3291 3291 } 3292 3292 nocache_headers(); … … 3299 3299 } 3300 3300 3301 if ( $ r['exit'] ) {3301 if ( $parsed_args['exit'] ) { 3302 3302 die( $message ); 3303 3303 } … … 3319 3319 */ 3320 3320 function _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 ); 3322 3322 3323 3323 $data = array( 3324 'code' => $ r['code'],3324 'code' => $parsed_args['code'], 3325 3325 'message' => $message, 3326 3326 'data' => array( 3327 'status' => $ r['response'],3327 'status' => $parsed_args['response'], 3328 3328 ), 3329 'additional_errors' => $ r['additional_errors'],3329 'additional_errors' => $parsed_args['additional_errors'], 3330 3330 ); 3331 3331 3332 3332 if ( ! headers_sent() ) { 3333 3333 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'] ); 3336 3336 } 3337 3337 nocache_headers(); … … 3339 3339 3340 3340 echo wp_json_encode( $data ); 3341 if ( $ r['exit'] ) {3341 if ( $parsed_args['exit'] ) { 3342 3342 die(); 3343 3343 } … … 3357 3357 */ 3358 3358 function _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 ); 3360 3360 3361 3361 $data = array( 3362 'code' => $ r['code'],3362 'code' => $parsed_args['code'], 3363 3363 'message' => $message, 3364 3364 'data' => array( 3365 'status' => $ r['response'],3365 'status' => $parsed_args['response'], 3366 3366 ), 3367 'additional_errors' => $ r['additional_errors'],3367 'additional_errors' => $parsed_args['additional_errors'], 3368 3368 ); 3369 3369 … … 3372 3372 header( 'X-Content-Type-Options: nosniff' ); 3373 3373 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'] ); 3376 3376 } 3377 3377 nocache_headers(); … … 3381 3381 $jsonp_callback = $_GET['_jsonp']; 3382 3382 echo '/**/' . $jsonp_callback . '(' . $result . ')'; 3383 if ( $ r['exit'] ) {3383 if ( $parsed_args['exit'] ) { 3384 3384 die(); 3385 3385 } … … 3403 3403 global $wp_xmlrpc_server; 3404 3404 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 ); 3406 3406 3407 3407 if ( ! headers_sent() ) { … … 3410 3410 3411 3411 if ( $wp_xmlrpc_server ) { 3412 $error = new IXR_Error( $ r['response'], $message );3412 $error = new IXR_Error( $parsed_args['response'], $message ); 3413 3413 $wp_xmlrpc_server->output( $error->getXml() ); 3414 3414 } 3415 if ( $ r['exit'] ) {3415 if ( $parsed_args['exit'] ) { 3416 3416 die(); 3417 3417 } … … 3431 3431 */ 3432 3432 function _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 ); 3434 3434 3435 3435 $message = htmlspecialchars( $message ); … … 3438 3438 $xml = <<<EOD 3439 3439 <error> 3440 <code>{$ r['code']}</code>3440 <code>{$parsed_args['code']}</code> 3441 3441 <title><![CDATA[{$title}]]></title> 3442 3442 <message><![CDATA[{$message}]]></message> 3443 3443 <data> 3444 <status>{$ r['response']}</status>3444 <status>{$parsed_args['response']}</status> 3445 3445 </data> 3446 3446 </error> … … 3450 3450 if ( ! headers_sent() ) { 3451 3451 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'] ); 3454 3454 } 3455 3455 nocache_headers(); … … 3457 3457 3458 3458 echo $xml; 3459 if ( $ r['exit'] ) {3459 if ( $parsed_args['exit'] ) { 3460 3460 die(); 3461 3461 } … … 3476 3476 */ 3477 3477 function _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'] ) { 3481 3481 if ( is_scalar( $message ) ) { 3482 3482 die( (string) $message ); … … 4108 4108 function wp_parse_args( $args, $defaults = '' ) { 4109 4109 if ( is_object( $args ) ) { 4110 $ r= get_object_vars( $args );4110 $parsed_args = get_object_vars( $args ); 4111 4111 } elseif ( is_array( $args ) ) { 4112 $ r=& $args;4112 $parsed_args =& $args; 4113 4113 } else { 4114 wp_parse_str( $args, $ r);4114 wp_parse_str( $args, $parsed_args ); 4115 4115 } 4116 4116 4117 4117 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; 4121 4121 } 4122 4122 -
trunk/src/wp-includes/general-template.php
r45590 r45667 1822 1822 ); 1823 1823 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'] ); 1827 1827 if ( ! is_post_type_viewable( $post_type_object ) ) { 1828 1828 return; 1829 1829 } 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'] ); 1842 1842 if ( $order !== 'ASC' ) { 1843 1843 $order = 'DESC'; … … 1847 1847 $archive_week_separator = '–'; 1848 1848 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'] ); 1850 1850 1851 1851 /** … … 1855 1855 * 1856 1856 * @param string $sql_where Portion of SQL query containing the WHERE clause. 1857 * @param array $ rAn 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 ); 1860 1860 1861 1861 /** … … 1864 1864 * @since 2.2.0 1865 1865 * 1866 * @param string $sql_join Portion of SQL query containing JOIN clause.1867 * @param array $ rAn 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 ); 1870 1870 1871 1871 $output = ''; … … 1873 1873 $last_changed = wp_cache_get_last_changed( 'posts' ); 1874 1874 1875 $limit = $ r['limit'];1876 1877 if ( 'monthly' == $ r['type'] ) {1875 $limit = $parsed_args['limit']; 1876 1877 if ( 'monthly' == $parsed_args['type'] ) { 1878 1878 $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"; 1879 1879 $key = md5( $query ); … … 1885 1885 } 1886 1886 if ( $results ) { 1887 $after = $ r['after'];1887 $after = $parsed_args['after']; 1888 1888 foreach ( (array) $results as $result ) { 1889 1889 $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 ); 1892 1892 } 1893 1893 /* translators: 1: month name, 2: 4-digit year */ 1894 1894 $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year ); 1895 if ( $ r['show_post_count'] ) {1896 $ r['after'] = ' (' . $result->posts . ')' . $after;1895 if ( $parsed_args['show_post_count'] ) { 1896 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1897 1897 } 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 ); 1900 1900 } 1901 1901 } 1902 } elseif ( 'yearly' == $ r['type'] ) {1902 } elseif ( 'yearly' == $parsed_args['type'] ) { 1903 1903 $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"; 1904 1904 $key = md5( $query ); … … 1910 1910 } 1911 1911 if ( $results ) { 1912 $after = $ r['after'];1912 $after = $parsed_args['after']; 1913 1913 foreach ( (array) $results as $result ) { 1914 1914 $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 ); 1917 1917 } 1918 1918 $text = sprintf( '%d', $result->year ); 1919 if ( $ r['show_post_count'] ) {1920 $ r['after'] = ' (' . $result->posts . ')' . $after;1919 if ( $parsed_args['show_post_count'] ) { 1920 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1921 1921 } 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 ); 1924 1924 } 1925 1925 } 1926 } elseif ( 'daily' == $ r['type'] ) {1926 } elseif ( 'daily' == $parsed_args['type'] ) { 1927 1927 $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"; 1928 1928 $key = md5( $query ); … … 1934 1934 } 1935 1935 if ( $results ) { 1936 $after = $ r['after'];1936 $after = $parsed_args['after']; 1937 1937 foreach ( (array) $results as $result ) { 1938 1938 $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 ); 1941 1941 } 1942 1942 $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth ); 1943 1943 $text = mysql2date( get_option( 'date_format' ), $date ); 1944 if ( $ r['show_post_count'] ) {1945 $ r['after'] = ' (' . $result->posts . ')' . $after;1944 if ( $parsed_args['show_post_count'] ) { 1945 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1946 1946 } 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 ); 1949 1949 } 1950 1950 } 1951 } elseif ( 'weekly' == $ r['type'] ) {1951 } elseif ( 'weekly' == $parsed_args['type'] ) { 1952 1952 $week = _wp_mysql_week( '`post_date`' ); 1953 1953 $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"; … … 1961 1961 $arc_w_last = ''; 1962 1962 if ( $results ) { 1963 $after = $ r['after'];1963 $after = $parsed_args['after']; 1964 1964 foreach ( (array) $results as $result ) { 1965 1965 if ( $result->week != $arc_w_last ) { … … 1976 1976 home_url( '/' ) 1977 1977 ); 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 ); 1980 1980 } 1981 1981 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 1982 if ( $ r['show_post_count'] ) {1983 $ r['after'] = ' (' . $result->posts . ')' . $after;1982 if ( $parsed_args['show_post_count'] ) { 1983 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1984 1984 } 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 ); 1987 1987 } 1988 1988 } 1989 1989 } 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 '; 1992 1992 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; 1993 1993 $key = md5( $query ); … … 2009 2009 } 2010 2010 $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 ); 2012 2012 } 2013 2013 } 2014 2014 } 2015 2015 } 2016 if ( $ r['echo'] ) {2016 if ( $parsed_args['echo'] ) { 2017 2017 echo $output; 2018 2018 } else { -
trunk/src/wp-includes/post-template.php
r45627 r45667 79 79 */ 80 80 function the_title_attribute( $args = '' ) { 81 $defaults = array(81 $defaults = array( 82 82 'before' => '', 83 83 'after' => '', … … 85 85 'post' => get_post(), 86 86 ); 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'] ); 90 90 91 91 if ( strlen( $title ) == 0 ) { … … 93 93 } 94 94 95 $title = $ r['before'] . $title . $r['after'];95 $title = $parsed_args['before'] . $title . $parsed_args['after']; 96 96 $title = esc_attr( strip_tags( $title ) ); 97 97 98 if ( $ r['echo'] ) {98 if ( $parsed_args['echo'] ) { 99 99 echo $title; 100 100 } else { … … 947 947 ); 948 948 949 $par ams = wp_parse_args( $args, $defaults );949 $parsed_args = wp_parse_args( $args, $defaults ); 950 950 951 951 /** … … 954 954 * @since 3.0.0 955 955 * 956 * @param array $par ams 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. 957 957 */ 958 $ r = apply_filters( 'wp_link_pages_args', $params );958 $parsed_args = apply_filters( 'wp_link_pages_args', $parsed_args ); 959 959 960 960 $output = ''; 961 961 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']; 964 964 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']; 966 966 if ( $i != $page || ! $more && 1 == $page ) { 967 967 $link = _wp_link_page( $i ) . $link . '</a>'; 968 968 } 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>'; 970 970 } 971 971 /** … … 980 980 981 981 // Use the custom links separator beginning with the second link. 982 $output .= ( 1 === $i ) ? ' ' : $ r['separator'];982 $output .= ( 1 === $i ) ? ' ' : $parsed_args['separator']; 983 983 $output .= $link; 984 984 } 985 $output .= $ r['after'];985 $output .= $parsed_args['after']; 986 986 } elseif ( $more ) { 987 $output .= $ r['before'];987 $output .= $parsed_args['before']; 988 988 $prev = $page - 1; 989 989 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>'; 991 991 992 992 /** This filter is documented in wp-includes/post-template.php */ … … 996 996 if ( $next <= $numpages ) { 997 997 if ( $prev ) { 998 $output .= $ r['separator'];998 $output .= $parsed_args['separator']; 999 999 } 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>'; 1001 1001 1002 1002 /** This filter is documented in wp-includes/post-template.php */ 1003 1003 $output .= apply_filters( 'wp_link_pages_link', $link, $next ); 1004 1004 } 1005 $output .= $ r['after'];1005 $output .= $parsed_args['after']; 1006 1006 } 1007 1007 } … … 1017 1017 $html = apply_filters( 'wp_link_pages', $output, $args ); 1018 1018 1019 if ( $ r['echo'] ) {1019 if ( $parsed_args['echo'] ) { 1020 1020 echo $html; 1021 1021 } … … 1182 1182 ); 1183 1183 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 ); 1187 1187 $output = ''; 1188 1188 // 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']; 1191 1191 } 1192 1192 1193 1193 if ( ! empty( $pages ) ) { 1194 1194 $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 ); 1207 1207 $output .= "</select>\n"; 1208 1208 } … … 1212 1212 * 1213 1213 * @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 $ rThe 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()` 1219 1219 */ 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'] ) { 1223 1223 echo $html; 1224 1224 } … … 1283 1283 ); 1284 1284 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 ) ) { 1288 1288 // invalid value, fall back to default. 1289 $ r['item_spacing'] = $defaults['item_spacing'];1289 $parsed_args['item_spacing'] = $defaults['item_spacing']; 1290 1290 } 1291 1291 … … 1294 1294 1295 1295 // 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'] ); 1297 1297 1298 1298 // 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(); 1300 1300 1301 1301 /** … … 1306 1306 * @param array $exclude_array An array of page IDs to exclude. 1307 1307 */ 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; 1309 1311 1310 1312 // Query pages. 1311 $r['hierarchical'] = 0; 1312 $pages = get_pages( $r ); 1313 $pages = get_pages( $parsed_args ); 1313 1314 1314 1315 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>'; 1317 1318 } 1318 1319 global $wp_query; … … 1326 1327 } 1327 1328 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'] ) { 1331 1332 $output .= '</ul></li>'; 1332 1333 } … … 1341 1342 * @see wp_list_pages() 1342 1343 * 1343 * @param string $output HTML output of the pages list.1344 * @param array $ rAn 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()` 1346 1347 */ 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'] ) { 1350 1351 echo $html; 1351 1352 } else { -
trunk/src/wp-includes/post.php
r45652 r45667 614 614 ); 615 615 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 ); 619 619 620 620 if ( ! $children ) { … … 622 622 } 623 623 624 if ( ! empty( $ r['fields'] ) ) {624 if ( ! empty( $parsed_args['fields'] ) ) { 625 625 return $children; 626 626 } … … 1955 1955 ); 1956 1956 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 included1970 $ 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; 1977 1977 1978 1978 $get_posts = new WP_Query; 1979 return $get_posts->query( $ r);1979 return $get_posts->query( $parsed_args ); 1980 1980 1981 1981 } … … 3382 3382 ); 3383 3383 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 ); 3387 3387 3388 3388 // Backward compatibility. Prior to 3.1 expected posts to be returned in array. … … 5112 5112 ); 5113 5113 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']; 5125 5125 5126 5126 // Make sure the post type is hierarchical. 5127 5127 $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 ) ) { 5129 5129 return false; 5130 5130 } … … 5143 5143 5144 5144 // $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 ) ) ) ); 5146 5146 $last_changed = wp_cache_get_last_changed( 'posts' ); 5147 5147 … … 5152 5152 $pages = array_map( 'get_post', $cache ); 5153 5153 /** 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 ); 5155 5155 return $pages; 5156 5156 } 5157 5157 5158 5158 $inclusions = ''; 5159 if ( ! empty( $ r['include'] ) ) {5159 if ( ! empty( $parsed_args['include'] ) ) { 5160 5160 $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include 5161 5161 $parent = -1; … … 5164 5164 $meta_value = ''; 5165 5165 $hierarchical = false; 5166 $incpages = wp_parse_id_list( $ r['include'] );5166 $incpages = wp_parse_id_list( $parsed_args['include'] ); 5167 5167 if ( ! empty( $incpages ) ) { 5168 5168 $inclusions = ' AND ID IN (' . implode( ',', $incpages ) . ')'; … … 5179 5179 5180 5180 $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'] ); 5183 5183 5184 5184 if ( ! empty( $post_authors ) ) { … … 5234 5234 5235 5235 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 ) ); 5237 5237 } else { 5238 5238 $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'] ); 5240 5240 } 5241 5241 … … 5262 5262 ); 5263 5263 5264 foreach ( explode( ',', $ r['sort_column'] ) as $orderby ) {5264 foreach ( explode( ',', $parsed_args['sort_column'] ) as $orderby ) { 5265 5265 $orderby = trim( $orderby ); 5266 5266 if ( ! in_array( $orderby, $allowed_keys ) ) { … … 5293 5293 $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title"; 5294 5294 5295 $sort_order = strtoupper( $ r['sort_order'] );5295 $sort_order = strtoupper( $parsed_args['sort_order'] ); 5296 5296 if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ) ) ) { 5297 5297 $sort_order = 'ASC'; … … 5312 5312 5313 5313 /** 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 ); 5315 5315 return $pages; 5316 5316 } … … 5329 5329 } 5330 5330 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'] ); 5333 5333 foreach ( $exclude as $id ) { 5334 5334 $children = get_page_children( $id, $pages ); … … 5362 5362 * 5363 5363 * @param array $pages List of pages to retrieve. 5364 * @param array $ rArray of get_pages() arguments.5364 * @param array $parsed_args Array of get_pages() arguments. 5365 5365 */ 5366 return apply_filters( 'get_pages', $pages, $ r);5366 return apply_filters( 'get_pages', $pages, $parsed_args ); 5367 5367 } 5368 5368 -
trunk/src/wp-includes/taxonomy.php
r45603 r45667 4296 4296 ); 4297 4297 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']; 4301 4301 } 4302 4302 -
trunk/src/wp-includes/user.php
r45639 r45667 1124 1124 $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; 1125 1125 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' ) ); 1129 1129 1130 1130 $fields = array( 'ID', 'user_login' ); 1131 1131 1132 $show = ! empty( $ r['show'] ) ? $r['show'] : 'display_name';1132 $show = ! empty( $parsed_args['show'] ) ? $parsed_args['show'] : 'display_name'; 1133 1133 if ( 'display_name_with_login' === $show ) { 1134 1134 $fields[] = 'display_name'; … … 1139 1139 $query_args['fields'] = $fields; 1140 1140 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']; 1144 1144 1145 1145 /** … … 1149 1149 * 1150 1150 * @param array $query_args The query arguments for get_users(). 1151 * @param array $ rThe 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 ); 1154 1154 1155 1155 $users = get_users( $query_args ); 1156 1156 1157 1157 $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'] ) { 1161 1161 $id = ''; 1162 1162 } 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"; 1166 1166 1167 1167 if ( $show_option_all ) { … … 1170 1170 1171 1171 if ( $show_option_none ) { 1172 $_selected = selected( $option_none_value, $ r['selected'], false );1172 $_selected = selected( $option_none_value, $parsed_args['selected'], false ); 1173 1173 $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n"; 1174 1174 } 1175 1175 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']; 1179 1179 foreach ( (array) $users as $user ) { 1180 1180 $user->ID = (int) $user->ID; 1181 if ( $user->ID === $ r['selected'] ) {1181 if ( $user->ID === $parsed_args['selected'] ) { 1182 1182 $found_selected = true; 1183 1183 } … … 1185 1185 1186 1186 if ( ! $found_selected ) { 1187 $users[] = get_userdata( $ r['selected'] );1187 $users[] = get_userdata( $parsed_args['selected'] ); 1188 1188 } 1189 1189 } … … 1199 1199 } 1200 1200 1201 $_selected = selected( $user->ID, $ r['selected'], false );1201 $_selected = selected( $user->ID, $parsed_args['selected'], false ); 1202 1202 $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n"; 1203 1203 } … … 1215 1215 $html = apply_filters( 'wp_dropdown_users', $output ); 1216 1216 1217 if ( $ r['echo'] ) {1217 if ( $parsed_args['echo'] ) { 1218 1218 echo $html; 1219 1219 }
Note: See TracChangeset
for help on using the changeset viewer.