Ticket #45059: 45059.3.patch
File 45059.3.patch, 92.3 KB (added by , 6 years ago) |
---|
-
wp-admin/includes/meta-boxes.php
492 492 } else { 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' ); 500 500 $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); … … 555 555 } else { 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"> 563 563 <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> … … 1310 1310 <th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th> 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 ?> 1321 1321 </select> <?php _e( '(Leave at 0 for no rating.)' ); ?> -
wp-admin/includes/ms.php
1091 1091 ); 1092 1092 1093 1093 // Parse arguments 1094 $ r= wp_parse_args(1094 $parsed_args = wp_parse_args( 1095 1095 $args, 1096 1096 array( 1097 1097 'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0, … … 1104 1104 $screen_links = array(); 1105 1105 1106 1106 // Loop through tabs 1107 foreach ( $ r['links'] as $link_id => $link ) {1107 foreach ( $parsed_args['links'] as $link_id => $link ) { 1108 1108 1109 1109 // Skip link if user can't access 1110 if ( ! current_user_can( $link['cap'], $ r['blog_id'] ) ) {1110 if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) { 1111 1111 continue; 1112 1112 } 1113 1113 … … 1115 1115 $classes = array( 'nav-tab' ); 1116 1116 1117 1117 // Selected is set by the parent OR assumed by the $pagenow global 1118 if ( $ r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {1118 if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) { 1119 1119 $classes[] = 'nav-tab-active'; 1120 1120 } 1121 1121 … … 1123 1123 $esc_classes = implode( ' ', $classes ); 1124 1124 1125 1125 // Get the URL for this link 1126 $url = add_query_arg( array( 'id' => $ r['blog_id'] ), network_admin_url( $link['url'] ) );1126 $url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) ); 1127 1127 1128 1128 // Add link to nav links 1129 1129 $screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '">' . esc_html( $link['label'] ) . '</a>'; -
wp-admin/includes/template.php
100 100 */ 101 101 $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); 102 102 103 $ r= wp_parse_args( $params, $defaults );103 $parsed_args = wp_parse_args( $params, $defaults ); 104 104 105 if ( empty( $ r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {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'];108 $walker = $parsed_args['walker']; 109 109 } 110 110 111 $taxonomy = $ r['taxonomy'];112 $descendants_and_self = (int) $ r['descendants_and_self'];111 $taxonomy = $parsed_args['taxonomy']; 112 $descendants_and_self = (int) $parsed_args['descendants_and_self']; 113 113 114 114 $args = array( 'taxonomy' => $taxonomy ); 115 115 … … 116 116 $tax = get_taxonomy( $taxonomy ); 117 117 $args['disabled'] = ! current_user_can( $tax->cap->assign_terms ); 118 118 119 $args['list_only'] = ! empty( $ r['list_only'] );119 $args['list_only'] = ! empty( $parsed_args['list_only'] ); 120 120 121 if ( is_array( $ r['selected_cats'] ) ) {122 $args['selected_cats'] = $ r['selected_cats'];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' ) ) ); 125 125 } else { 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( 132 132 $taxonomy, … … 156 156 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(); 162 162 $keys = array_keys( $categories ); … … 174 174 // Then the rest of them 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 } 180 180 … … 2295 2295 * @return string Star rating HTML. 2296 2296 */ 2297 2297 function wp_star_rating( $args = array() ) { 2298 $defaults = array(2298 $defaults = array( 2299 2299 'rating' => 0, 2300 2300 'type' => 'rating', 2301 2301 'number' => 0, 2302 2302 'echo' => true, 2303 2303 ); 2304 $ r= wp_parse_args( $args, $defaults );2304 $parsed_args = wp_parse_args( $args, $defaults ); 2305 2305 2306 2306 // Non-English decimal places when the $rating is coming from a string 2307 $rating = (float) str_replace( ',', '.', $ r['rating'] );2307 $rating = (float) str_replace( ',', '.', $parsed_args['rating'] ); 2308 2308 2309 2309 // Convert Percentage to star rating, 0..5 in .5 increments 2310 if ( 'percent' === $ r['type'] ) {2310 if ( 'percent' === $parsed_args['type'] ) { 2311 2311 $rating = round( $rating / 10, 0 ) / 2; 2312 2312 } 2313 2313 … … 2316 2316 $half_stars = ceil( $rating - $full_stars ); 2317 2317 $empty_stars = 5 - $full_stars - $half_stars; 2318 2318 2319 if ( $ r['number'] ) {2319 if ( $parsed_args['number'] ) { 2320 2320 /* translators: 1: the rating, 2: the number of ratings */ 2321 $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $ r['number'] );2322 $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $ r['number'] ) );2321 $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] ); 2322 $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) ); 2323 2323 } else { 2324 2324 /* translators: %s: the rating */ 2325 2325 $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) ); … … 2332 2332 $output .= str_repeat( '<div class="star star-empty" aria-hidden="true"></div>', $empty_stars ); 2333 2333 $output .= '</div>'; 2334 2334 2335 if ( $ r['echo'] ) {2335 if ( $parsed_args['echo'] ) { 2336 2336 echo $output; 2337 2337 } 2338 2338 -
wp-includes/bookmark-template.php
62 62 'link_after' => '', 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. 68 68 … … 70 70 if ( ! isset( $bookmark->recently_updated ) ) { 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 } 77 77 $the_link = '#'; … … 82 82 $name = esc_attr( sanitize_bookmark_field( 'link_name', $bookmark->link_name, $bookmark->link_id, 'display' ) ); 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 .= ' ('; 88 88 $title .= sprintf( … … 95 95 $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 ) { 101 101 $title = ' title="' . $title . '"'; … … 110 110 } 111 111 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>'; 112 112 113 $output .= $ r['link_before'];113 $output .= $parsed_args['link_before']; 114 114 115 if ( $bookmark->link_image != null && $ r['show_images'] ) {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 />"; 118 118 } else { // If it's a relative path 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 } 124 124 } else { … … 125 125 $output .= $name; 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;136 if ( $parsed_args['show_description'] && '' != $desc ) { 137 $output .= $parsed_args['between'] . $desc; 138 138 } 139 139 140 if ( $ r['show_rating'] ) {141 $output .= $ r['between'] . sanitize_bookmark_field(140 if ( $parsed_args['show_rating'] ) { 141 $output .= $parsed_args['between'] . sanitize_bookmark_field( 142 142 'link_rating', 143 143 $bookmark->link_rating, 144 144 $bookmark->link_id, … … 145 145 'display' 146 146 ); 147 147 } 148 $output .= $ r['after'] . "\n";148 $output .= $parsed_args['after'] . "\n"; 149 149 } // end while 150 150 151 151 return $output; … … 225 225 'category_after' => '</li>', 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'] ) );235 $parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] ); 236 $parsed_args['class'] = trim( join( ' ', $parsed_args['class'] ) ); 237 237 238 if ( $ r['categorize'] ) {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 ) ) { 261 261 continue; … … 262 262 } 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 /** 269 269 * Filters the bookmarks category name. … … 274 274 */ 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 } 307 307 } … … 315 315 */ 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 } 321 321 echo $html; -
wp-includes/bookmark.php
136 136 'search' => '', 137 137 ); 138 138 139 $ r= wp_parse_args( $args, $defaults );139 $parsed_args = wp_parse_args( $args, $defaults ); 140 140 141 $key = md5( serialize( $ r) );141 $key = md5( serialize( $parsed_args ) ); 142 142 $cache = false; 143 if ( 'rand' !== $ r['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {143 if ( 'rand' !== $parsed_args['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) { 144 144 if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { 145 145 $bookmarks = $cache[ $key ]; 146 146 /** … … 156 156 * @see get_bookmarks() 157 157 * 158 158 * @param array $bookmarks List of the cached bookmarks. 159 * @param array $ rAn array of bookmark query arguments.159 * @param array $parsed_args An array of bookmark query arguments. 160 160 */ 161 return apply_filters( 'get_bookmarks', $bookmarks, $ r);161 return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args ); 162 162 } 163 163 } 164 164 … … 167 167 } 168 168 169 169 $inclusions = ''; 170 if ( ! empty( $ r['include'] ) ) {171 $ r['exclude'] = ''; //ignore exclude, category, and category_name params if using include172 $ r['category'] = '';173 $ r['category_name'] = '';174 $inclinks = preg_split( '/[\s,]+/', $r['include'] );170 if ( ! empty( $parsed_args['include'] ) ) { 171 $parsed_args['exclude'] = ''; //ignore exclude, category, and category_name params if using include 172 $parsed_args['category'] = ''; 173 $parsed_args['category_name'] = ''; 174 $inclinks = preg_split( '/[\s,]+/', $parsed_args['include'] ); 175 175 if ( count( $inclinks ) ) { 176 176 foreach ( $inclinks as $inclink ) { 177 177 if ( empty( $inclusions ) ) { … … 187 187 } 188 188 189 189 $exclusions = ''; 190 if ( ! empty( $ r['exclude'] ) ) {191 $exlinks = preg_split( '/[\s,]+/', $ r['exclude'] );190 if ( ! empty( $parsed_args['exclude'] ) ) { 191 $exlinks = preg_split( '/[\s,]+/', $parsed_args['exclude'] ); 192 192 if ( count( $exlinks ) ) { 193 193 foreach ( $exlinks as $exlink ) { 194 194 if ( empty( $exclusions ) ) { … … 203 203 $exclusions .= ')'; 204 204 } 205 205 206 if ( ! empty( $ r['category_name'] ) ) {207 if ( $ r['category'] = get_term_by( 'name', $r['category_name'], 'link_category' ) ) {208 $ r['category'] = $r['category']->term_id;206 if ( ! empty( $parsed_args['category_name'] ) ) { 207 if ( $parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' ) ) { 208 $parsed_args['category'] = $parsed_args['category']->term_id; 209 209 } else { 210 210 $cache[ $key ] = array(); 211 211 wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); 212 212 /** This filter is documented in wp-includes/bookmark.php */ 213 return apply_filters( 'get_bookmarks', array(), $ r);213 return apply_filters( 'get_bookmarks', array(), $parsed_args ); 214 214 } 215 215 } 216 216 217 217 $search = ''; 218 if ( ! empty( $ r['search'] ) ) {219 $like = '%' . $wpdb->esc_like( $ r['search'] ) . '%';218 if ( ! empty( $parsed_args['search'] ) ) { 219 $like = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%'; 220 220 $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like ); 221 221 } 222 222 223 223 $category_query = ''; 224 224 $join = ''; 225 if ( ! empty( $ r['category'] ) ) {226 $incategories = preg_split( '/[\s,]+/', $ r['category'] );225 if ( ! empty( $parsed_args['category'] ) ) { 226 $incategories = preg_split( '/[\s,]+/', $parsed_args['category'] ); 227 227 if ( count( $incategories ) ) { 228 228 foreach ( $incategories as $incat ) { 229 229 if ( empty( $category_query ) ) { … … 239 239 $join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id"; 240 240 } 241 241 242 if ( $ r['show_updated'] ) {242 if ( $parsed_args['show_updated'] ) { 243 243 $recently_updated_test = ', IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated '; 244 244 } else { 245 245 $recently_updated_test = ''; 246 246 } 247 247 248 $get_updated = ( $ r['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';248 $get_updated = ( $parsed_args['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : ''; 249 249 250 $orderby = strtolower( $ r['orderby'] );250 $orderby = strtolower( $parsed_args['orderby'] ); 251 251 $length = ''; 252 252 switch ( $orderby ) { 253 253 case 'length': … … 278 278 $orderby = 'link_name'; 279 279 } 280 280 281 $order = strtoupper( $ r['order'] );281 $order = strtoupper( $parsed_args['order'] ); 282 282 if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) { 283 283 $order = 'ASC'; 284 284 } 285 285 286 286 $visible = ''; 287 if ( $ r['hide_invisible'] ) {287 if ( $parsed_args['hide_invisible'] ) { 288 288 $visible = "AND link_visible = 'Y'"; 289 289 } 290 290 … … 291 291 $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; 292 292 $query .= " $exclusions $inclusions $search"; 293 293 $query .= " ORDER BY $orderby $order"; 294 if ( $ r['limit'] != -1 ) {295 $query .= ' LIMIT ' . $ r['limit'];294 if ( $parsed_args['limit'] != -1 ) { 295 $query .= ' LIMIT ' . $parsed_args['limit']; 296 296 } 297 297 298 298 $results = $wpdb->get_results( $query ); … … 303 303 } 304 304 305 305 /** This filter is documented in wp-includes/bookmark.php */ 306 return apply_filters( 'get_bookmarks', $results, $ r);306 return apply_filters( 'get_bookmarks', $results, $parsed_args ); 307 307 } 308 308 309 309 /** -
wp-includes/category-template.php
365 365 $args['taxonomy'] = 'link_category'; 366 366 } 367 367 368 $r = wp_parse_args( $args, $defaults ); 369 $option_none_value = $r['option_none_value']; 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']; 370 371 371 if ( ! isset( $ r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {372 $ r['pad_counts'] = true;372 if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) { 373 $parsed_args['pad_counts'] = true; 373 374 } 374 375 375 $tab_index = $ r['tab_index'];376 $tab_index = $parsed_args['tab_index']; 376 377 377 378 $tab_index_attribute = ''; 378 379 if ( (int) $tab_index > 0 ) { … … 380 381 } 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 $categories = get_terms( $parsed_args['taxonomy'], $get_terms_args ); 386 387 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' : '';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' : ''; 391 392 392 if ( ! $ r['hide_if_empty'] || ! empty( $categories ) ) {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 /** 400 401 * Filters a taxonomy drop-down display element. … … 411 412 * @param string $element Category name. 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 } 417 418 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 $output .= walk_category_dropdown_tree( $categories, $depth, $parsed_args ); 442 443 } 443 444 444 if ( ! $ r['hide_if_empty'] || ! empty( $categories ) ) {445 if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) { 445 446 $output .= "</select>\n"; 446 447 } 447 448 /** … … 450 451 * @since 2.1.0 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 $output = apply_filters( 'wp_dropdown_cats', $output, $parsed_args ); 456 457 457 if ( $ r['echo'] ) {458 if ( $parsed_args['echo'] ) { 458 459 echo $output; 459 460 } 460 461 return $output; … … 537 538 'use_desc_for_title' => 1, 538 539 ); 539 540 540 $ r= wp_parse_args( $args, $defaults );541 $parsed_args = wp_parse_args( $args, $defaults ); 541 542 542 if ( ! isset( $ r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {543 $ r['pad_counts'] = true;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'] ) );551 if ( $parsed_args['exclude_tree'] ) { 552 $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude_tree'] ) ); 552 553 } 553 554 554 if ( $ r['exclude'] ) {555 $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $ r['exclude'] ) );555 if ( $parsed_args['exclude'] ) { 556 $exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $parsed_args['exclude'] ) ); 556 557 } 557 558 558 $ r['exclude_tree'] = $exclude_tree;559 $ r['exclude'] = '';559 $parsed_args['exclude_tree'] = $exclude_tree; 560 $parsed_args['exclude'] = ''; 560 561 } 561 562 562 if ( ! isset( $ r['class'] ) ) {563 $ r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];563 if ( ! isset( $parsed_args['class'] ) ) { 564 $parsed_args['class'] = ( 'category' == $parsed_args['taxonomy'] ) ? 'categories' : $parsed_args['taxonomy']; 564 565 } 565 566 566 if ( ! taxonomy_exists( $ r['taxonomy'] ) ) {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'];571 $show_option_all = $parsed_args['show_option_all']; 572 $show_option_none = $parsed_args['show_option_none']; 572 573 573 $categories = get_categories( $ r);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 { 584 585 $output .= $show_option_none; … … 590 591 $posts_page = ''; 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 ) { 596 597 $_object_type = get_post_type_object( $object_type ); … … 613 614 } 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 { 619 620 $output .= "<a href='$posts_page'>$show_option_all</a>"; … … 620 621 } 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 $output .= walk_category_tree( $categories, $depth, $parsed_args ); 636 637 } 637 638 638 if ( $ r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {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 } 641 642 … … 649 650 */ 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 { 655 656 return $html; -
wp-includes/class-http.php
220 220 $defaults['redirection'] = 0; 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. 226 226 * 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 239 239 /** … … 251 251 * @since 2.9.0 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 ) { 260 260 return $pre; … … 261 261 } 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 } 267 267 if ( $url ) { … … 281 281 282 282 // If we are streaming to a file but no filename was given drop it in the WP temp dir 283 283 // and pick its name using the basename of the $url 284 if ( $ r['stream'] ) {285 if ( empty( $ r['filename'] ) ) {286 $ r['filename'] = get_temp_dir() . basename( $url );284 if ( $parsed_args['stream'] ) { 285 if ( empty( $parsed_args['filename'] ) ) { 286 $parsed_args['filename'] = get_temp_dir() . basename( $url ); 287 287 } 288 288 289 289 // Force some settings if we are streaming to a file and check for existence and perms of destination directory 290 $ r['blocking'] = true;291 if ( ! wp_is_writable( dirname( $ r['filename'] ) ) ) {290 $parsed_args['blocking'] = true; 291 if ( ! wp_is_writable( dirname( $parsed_args['filename'] ) ) ) { 292 292 return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) ); 293 293 } 294 294 } 295 295 296 if ( is_null( $ r['headers'] ) ) {297 $ r['headers'] = array();296 if ( is_null( $parsed_args['headers'] ) ) { 297 $parsed_args['headers'] = array(); 298 298 } 299 299 300 300 // WP allows passing in headers as a string, weirdly. 301 if ( ! is_array( $ r['headers'] ) ) {302 $processedHeaders = WP_Http::processHeaders( $r['headers'] );303 $ r['headers']= $processedHeaders['headers'];301 if ( ! is_array( $parsed_args['headers'] ) ) { 302 $processedHeaders = WP_Http::processHeaders( $parsed_args['headers'] ); 303 $parsed_args['headers'] = $processedHeaders['headers']; 304 304 } 305 305 306 306 // Setup arguments 307 $headers = $ r['headers'];308 $data = $ r['body'];309 $type = $ r['method'];307 $headers = $parsed_args['headers']; 308 $data = $parsed_args['body']; 309 $type = $parsed_args['method']; 310 310 $options = array( 311 'timeout' => $ r['timeout'],312 'useragent' => $ r['user-agent'],313 'blocking' => $ r['blocking'],314 'hooks' => new WP_HTTP_Requests_Hooks( $url, $ r),311 'timeout' => $parsed_args['timeout'], 312 'useragent' => $parsed_args['user-agent'], 313 'blocking' => $parsed_args['blocking'], 314 'hooks' => new WP_HTTP_Requests_Hooks( $url, $parsed_args ), 315 315 ); 316 316 317 317 // Ensure redirects follow browser behaviour. … … 318 318 $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) ); 319 319 320 320 // Validate redirected URLs. 321 if ( function_exists( 'wp_kses_bad_protocol' ) && $ r['reject_unsafe_urls'] ) {321 if ( function_exists( 'wp_kses_bad_protocol' ) && $parsed_args['reject_unsafe_urls'] ) { 322 322 $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) ); 323 323 } 324 324 325 if ( $ r['stream'] ) {326 $options['filename'] = $ r['filename'];325 if ( $parsed_args['stream'] ) { 326 $options['filename'] = $parsed_args['filename']; 327 327 } 328 if ( empty( $ r['redirection'] ) ) {328 if ( empty( $parsed_args['redirection'] ) ) { 329 329 $options['follow_redirects'] = false; 330 330 } else { 331 $options['redirects'] = $ r['redirection'];331 $options['redirects'] = $parsed_args['redirection']; 332 332 } 333 333 334 334 // Use byte limit, if we can 335 if ( isset( $ r['limit_response_size'] ) ) {336 $options['max_bytes'] = $ r['limit_response_size'];335 if ( isset( $parsed_args['limit_response_size'] ) ) { 336 $options['max_bytes'] = $parsed_args['limit_response_size']; 337 337 } 338 338 339 339 // If we've got cookies, use and convert them to Requests_Cookie. 340 if ( ! empty( $ r['cookies'] ) ) {341 $options['cookies'] = WP_Http::normalize_cookies( $ r['cookies'] );340 if ( ! empty( $parsed_args['cookies'] ) ) { 341 $options['cookies'] = WP_Http::normalize_cookies( $parsed_args['cookies'] ); 342 342 } 343 343 344 344 // SSL certificate handling 345 if ( ! $ r['sslverify'] ) {345 if ( ! $parsed_args['sslverify'] ) { 346 346 $options['verify'] = false; 347 347 $options['verifyname'] = false; 348 348 } else { 349 $options['verify'] = $ r['sslcertificates'];349 $options['verify'] = $parsed_args['sslcertificates']; 350 350 } 351 351 352 352 // All non-GET/HEAD requests should put the arguments in the form body. … … 384 384 $requests_response = Requests::request( $url, $headers, $data, $type, $options ); 385 385 386 386 // Convert the response into an array 387 $http_response = new WP_HTTP_Requests_Response( $requests_response, $ r['filename'] );387 $http_response = new WP_HTTP_Requests_Response( $requests_response, $parsed_args['filename'] ); 388 388 $response = $http_response->to_array(); 389 389 390 390 // Add the original object to the array. … … 403 403 * @param array|WP_Error $response HTTP response or WP_Error object. 404 404 * @param string $context Context under which the hook is fired. 405 405 * @param string $class HTTP transport used. 406 * @param array $ rHTTP request arguments.406 * @param array $parsed_args HTTP request arguments. 407 407 * @param string $url The request URL. 408 408 */ 409 do_action( 'http_api_debug', $response, 'response', 'Requests', $ r, $url );409 do_action( 'http_api_debug', $response, 'response', 'Requests', $parsed_args, $url ); 410 410 if ( is_wp_error( $response ) ) { 411 411 return $response; 412 412 } 413 413 414 if ( ! $ r['blocking'] ) {414 if ( ! $parsed_args['blocking'] ) { 415 415 return array( 416 416 'headers' => array(), 417 417 'body' => '', … … 430 430 * @since 2.9.0 431 431 * 432 432 * @param array $response HTTP response. 433 * @param array $ rHTTP request arguments.433 * @param array $parsed_args HTTP request arguments. 434 434 * @param string $url The request URL. 435 435 */ 436 return apply_filters( 'http_response', $response, $ r, $url );436 return apply_filters( 'http_response', $response, $parsed_args, $url ); 437 437 } 438 438 439 439 /** … … 591 591 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error 592 592 */ 593 593 public function post( $url, $args = array() ) { 594 $defaults = array( 'method' => 'POST' );595 $ r= wp_parse_args( $args, $defaults );596 return $this->request( $url, $ r);594 $defaults = array( 'method' => 'POST' ); 595 $parsed_args = wp_parse_args( $args, $defaults ); 596 return $this->request( $url, $parsed_args ); 597 597 } 598 598 599 599 /** … … 608 608 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error 609 609 */ 610 610 public function get( $url, $args = array() ) { 611 $defaults = array( 'method' => 'GET' );612 $ r= wp_parse_args( $args, $defaults );613 return $this->request( $url, $ r);611 $defaults = array( 'method' => 'GET' ); 612 $parsed_args = wp_parse_args( $args, $defaults ); 613 return $this->request( $url, $parsed_args ); 614 614 } 615 615 616 616 /** … … 625 625 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error 626 626 */ 627 627 public function head( $url, $args = array() ) { 628 $defaults = array( 'method' => 'HEAD' );629 $ r= wp_parse_args( $args, $defaults );630 return $this->request( $url, $ r);628 $defaults = array( 'method' => 'HEAD' ); 629 $parsed_args = wp_parse_args( $args, $defaults ); 630 return $this->request( $url, $parsed_args ); 631 631 } 632 632 633 633 /** -
wp-includes/class-wp-ajax-response.php
73 73 'supplemental' => array(), 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 ) ) { 86 86 $data = $id; … … 117 117 } 118 118 119 119 $s = ''; 120 if ( is_array( $ r['supplemental'] ) ) {121 foreach ( $ r['supplemental'] as $k => $v ) {120 if ( is_array( $parsed_args['supplemental'] ) ) { 121 foreach ( $parsed_args['supplemental'] as $k => $v ) { 122 122 $s .= "<$k><![CDATA[$v]]></$k>"; 123 123 } 124 124 $s = "<supplemental>$s</supplemental>"; -
wp-includes/class-wp-http-curl.php
79 79 'cookies' => array(), 80 80 ); 81 81 82 $ r= wp_parse_args( $args, $defaults );82 $parsed_args = wp_parse_args( $args, $defaults ); 83 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'] );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(); 96 96 … … 109 109 } 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 */ 116 116 $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify, $url ); … … 123 123 * CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since. 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 ); 129 129 … … 133 133 curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); 134 134 135 135 if ( $ssl_verify ) { 136 curl_setopt( $handle, CURLOPT_CAINFO, $ r['sslcertificates'] );136 curl_setopt( $handle, CURLOPT_CAINFO, $parsed_args['sslcertificates'] ); 137 137 } 138 138 139 curl_setopt( $handle, CURLOPT_USERAGENT, $ r['user-agent'] );139 curl_setopt( $handle, CURLOPT_USERAGENT, $parsed_args['user-agent'] ); 140 140 141 141 /* 142 142 * The option doesn't work with safe mode or when open_basedir is set, and there's … … 147 147 curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS ); 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 ); 153 153 break; 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' ) ); 173 173 } … … 174 174 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; 181 181 } 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 ) { 191 191 return new WP_Error( … … 194 194 /* translators: 1: fopen(), 2: file name */ 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 ); 200 200 } … … 202 202 $this->stream_handle = false; 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 } 211 211 curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); 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 { 217 217 curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); … … 226 226 * @since 2.8.0 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 238 238 if ( $curl_error = curl_error( $handle ) ) { … … 271 271 if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) { 272 272 if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error ) { 273 273 if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) { 274 if ( $ r['stream'] ) {274 if ( $parsed_args['stream'] ) { 275 275 curl_close( $handle ); 276 276 fclose( $this->stream_handle ); 277 277 return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); … … 294 294 295 295 curl_close( $handle ); 296 296 297 if ( $ r['stream'] ) {297 if ( $parsed_args['stream'] ) { 298 298 fclose( $this->stream_handle ); 299 299 } 300 300 … … 303 303 'body' => null, 304 304 'response' => $theHeaders['response'], 305 305 'cookies' => $theHeaders['cookies'], 306 'filename' => $ r['filename'],306 'filename' => $parsed_args['filename'], 307 307 ); 308 308 309 309 // Handle redirects. 310 if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $ r, $response ) ) ) {310 if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response ) ) ) { 311 311 return $redirect_response; 312 312 } 313 313 314 if ( true === $ r['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) {314 if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $theHeaders['headers'] ) ) { 315 315 $theBody = WP_Http_Encoding::decompress( $theBody ); 316 316 } 317 317 -
wp-includes/class-wp-http-streams.php
38 38 'cookies' => array(), 39 39 ); 40 40 41 $ r= wp_parse_args( $args, $defaults );41 $parsed_args = wp_parse_args( $args, $defaults ); 42 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'] );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 ); 55 55 … … 70 70 $arrURL['path'] = '/'; 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'];77 $arrURL['host'] = $parsed_args['headers']['host']; 78 78 } 79 unset( $ r['headers']['Host'], $r['headers']['host'] );79 unset( $parsed_args['headers']['Host'], $parsed_args['headers']['host'] ); 80 80 } 81 81 82 82 /* … … 90 90 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 /** 97 97 * Filters whether SSL should be verified for local requests. … … 117 117 //'CN_match' => $arrURL['host'], // This is handled by self::verify_ssl_certificate() 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 ), 123 123 ) 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 130 130 // Store error number. … … 180 180 $requestPath = $arrURL['path'] . ( isset( $arrURL['query'] ) ? '?' . $arrURL['query'] : '' ); 181 181 } 182 182 183 $strHeaders = strtoupper( $ r['method'] ) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";183 $strHeaders = strtoupper( $parsed_args['method'] ) . ' ' . $requestPath . ' HTTP/' . $parsed_args['httpversion'] . "\r\n"; 184 184 185 185 $include_port_in_host_header = ( 186 186 ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) || … … 194 194 $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n"; 195 195 } 196 196 197 if ( isset( $ r['user-agent'] ) ) {198 $strHeaders .= 'User-agent: ' . $ r['user-agent'] . "\r\n";197 if ( isset( $parsed_args['user-agent'] ) ) { 198 $strHeaders .= 'User-agent: ' . $parsed_args['user-agent'] . "\r\n"; 199 199 } 200 200 201 if ( is_array( $ r['headers'] ) ) {202 foreach ( (array) $ r['headers'] as $header => $headerValue ) {201 if ( is_array( $parsed_args['headers'] ) ) { 202 foreach ( (array) $parsed_args['headers'] as $header => $headerValue ) { 203 203 $strHeaders .= $header . ': ' . $headerValue . "\r\n"; 204 204 } 205 205 } else { 206 $strHeaders .= $ r['headers'];206 $strHeaders .= $parsed_args['headers']; 207 207 } 208 208 209 209 if ( $proxy->use_authentication() ) { … … 212 212 213 213 $strHeaders .= "\r\n"; 214 214 215 if ( ! is_null( $ r['body'] ) ) {216 $strHeaders .= $ r['body'];215 if ( ! is_null( $parsed_args['body'] ) ) { 216 $strHeaders .= $parsed_args['body']; 217 217 } 218 218 219 219 fwrite( $handle, $strHeaders ); 220 220 221 if ( ! $ r['blocking'] ) {221 if ( ! $parsed_args['blocking'] ) { 222 222 stream_set_blocking( $handle, 0 ); 223 223 fclose( $handle ); 224 224 return array( … … 236 236 $bodyStarted = false; 237 237 $keep_reading = true; 238 238 $block_size = 4096; 239 if ( isset( $ r['limit_response_size'] ) ) {240 $block_size = min( $block_size, $ r['limit_response_size'] );239 if ( isset( $parsed_args['limit_response_size'] ) ) { 240 $block_size = min( $block_size, $parsed_args['limit_response_size'] ); 241 241 } 242 242 243 243 // If streaming to a file setup the file handle. 244 if ( $ r['stream'] ) {244 if ( $parsed_args['stream'] ) { 245 245 if ( ! WP_DEBUG ) { 246 $stream_handle = @fopen( $ r['filename'], 'w+' );246 $stream_handle = @fopen( $parsed_args['filename'], 'w+' ); 247 247 } else { 248 $stream_handle = fopen( $ r['filename'], 'w+' );248 $stream_handle = fopen( $parsed_args['filename'], 'w+' ); 249 249 } 250 250 if ( ! $stream_handle ) { 251 251 return new WP_Error( … … 254 254 /* translators: 1: fopen(), 2: file name */ 255 255 __( 'Could not open handle for %1$s to %2$s.' ), 256 256 'fopen()', 257 $ r['filename']257 $parsed_args['filename'] 258 258 ) 259 259 ); 260 260 } … … 275 275 276 276 $this_block_size = strlen( $block ); 277 277 278 if ( isset( $ r['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $r['limit_response_size'] ) {279 $this_block_size = ( $ r['limit_response_size'] - $bytes_written );278 if ( isset( $parsed_args['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $parsed_args['limit_response_size'] ) { 279 $this_block_size = ( $parsed_args['limit_response_size'] - $bytes_written ); 280 280 $block = substr( $block, 0, $this_block_size ); 281 281 } 282 282 … … 290 290 291 291 $bytes_written += $bytes_written_to_file; 292 292 293 $keep_reading = ! isset( $ r['limit_response_size'] ) || $bytes_written < $r['limit_response_size'];293 $keep_reading = ! isset( $parsed_args['limit_response_size'] ) || $bytes_written < $parsed_args['limit_response_size']; 294 294 } 295 295 296 296 fclose( $stream_handle ); … … 304 304 $header_length = strpos( $strResponse, "\r\n\r\n" ) + 4; 305 305 $bodyStarted = true; 306 306 } 307 $keep_reading = ( ! $bodyStarted || ! isset( $ r['limit_response_size'] ) || strlen( $strResponse ) < ( $header_length + $r['limit_response_size'] ) );307 $keep_reading = ( ! $bodyStarted || ! isset( $parsed_args['limit_response_size'] ) || strlen( $strResponse ) < ( $header_length + $parsed_args['limit_response_size'] ) ); 308 308 } 309 309 310 310 $process = WP_Http::processResponse( $strResponse ); … … 322 322 'body' => null, 323 323 'response' => $arrHeaders['response'], 324 324 'cookies' => $arrHeaders['cookies'], 325 'filename' => $ r['filename'],325 'filename' => $parsed_args['filename'], 326 326 ); 327 327 328 328 // Handle redirects. 329 if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $ r, $response ) ) ) {329 if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response ) ) ) { 330 330 return $redirect_response; 331 331 } 332 332 … … 335 335 $process['body'] = WP_Http::chunkTransferDecode( $process['body'] ); 336 336 } 337 337 338 if ( true === $ r['decompress'] && true === WP_Http_Encoding::should_decode( $arrHeaders['headers'] ) ) {338 if ( true === $parsed_args['decompress'] && true === WP_Http_Encoding::should_decode( $arrHeaders['headers'] ) ) { 339 339 $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); 340 340 } 341 341 342 if ( isset( $ r['limit_response_size'] ) && strlen( $process['body'] ) > $r['limit_response_size'] ) {343 $process['body'] = substr( $process['body'], 0, $ r['limit_response_size'] );342 if ( isset( $parsed_args['limit_response_size'] ) && strlen( $process['body'] ) > $parsed_args['limit_response_size'] ) { 343 $process['body'] = substr( $process['body'], 0, $parsed_args['limit_response_size'] ); 344 344 } 345 345 346 346 $response['body'] = $process['body']; -
wp-includes/comment-template.php
2007 2007 'echo' => true, 2008 2008 ); 2009 2009 2010 $ r= wp_parse_args( $args, $defaults );2010 $parsed_args = wp_parse_args( $args, $defaults ); 2011 2011 2012 2012 /** 2013 2013 * Filters the arguments used in retrieving the comment list. … … 2016 2016 * 2017 2017 * @see wp_list_comments() 2018 2018 * 2019 * @param array $ rAn array of arguments for displaying comments.2019 * @param array $parsed_args An array of arguments for displaying comments. 2020 2020 */ 2021 $ r = apply_filters( 'wp_list_comments_args', $r);2021 $parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args ); 2022 2022 2023 2023 // Figure out what comments we'll be looping through ($_comments) 2024 2024 if ( null !== $comments ) { … … 2026 2026 if ( empty( $comments ) ) { 2027 2027 return; 2028 2028 } 2029 if ( 'all' != $ r['type'] ) {2029 if ( 'all' != $parsed_args['type'] ) { 2030 2030 $comments_by_type = separate_comments( $comments ); 2031 if ( empty( $comments_by_type[ $ r['type'] ] ) ) {2031 if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { 2032 2032 return; 2033 2033 } 2034 $_comments = $comments_by_type[ $ r['type'] ];2034 $_comments = $comments_by_type[ $parsed_args['type'] ]; 2035 2035 } else { 2036 2036 $_comments = $comments; 2037 2037 } … … 2040 2040 * If 'page' or 'per_page' has been passed, and does not match what's in $wp_query, 2041 2041 * perform a separate comment query and allow Walker_Comment to paginate. 2042 2042 */ 2043 if ( $ r['page'] || $r['per_page'] ) {2043 if ( $parsed_args['page'] || $parsed_args['per_page'] ) { 2044 2044 $current_cpage = get_query_var( 'cpage' ); 2045 2045 if ( ! $current_cpage ) { 2046 2046 $current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages; … … 2047 2047 } 2048 2048 2049 2049 $current_per_page = get_query_var( 'comments_per_page' ); 2050 if ( $ r['page'] != $current_cpage || $r['per_page'] != $current_per_page ) {2050 if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) { 2051 2051 $comment_args = array( 2052 2052 'post_id' => get_the_ID(), 2053 2053 'orderby' => 'comment_date_gmt', … … 2066 2066 2067 2067 $comments = get_comments( $comment_args ); 2068 2068 2069 if ( 'all' != $ r['type'] ) {2069 if ( 'all' != $parsed_args['type'] ) { 2070 2070 $comments_by_type = separate_comments( $comments ); 2071 if ( empty( $comments_by_type[ $ r['type'] ] ) ) {2071 if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) { 2072 2072 return; 2073 2073 } 2074 2074 2075 $_comments = $comments_by_type[ $ r['type'] ];2075 $_comments = $comments_by_type[ $parsed_args['type'] ]; 2076 2076 } else { 2077 2077 $_comments = $comments; 2078 2078 } … … 2083 2083 if ( empty( $wp_query->comments ) ) { 2084 2084 return; 2085 2085 } 2086 if ( 'all' != $ r['type'] ) {2086 if ( 'all' != $parsed_args['type'] ) { 2087 2087 if ( empty( $wp_query->comments_by_type ) ) { 2088 2088 $wp_query->comments_by_type = separate_comments( $wp_query->comments ); 2089 2089 } 2090 if ( empty( $wp_query->comments_by_type[ $ r['type'] ] ) ) {2090 if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) { 2091 2091 return; 2092 2092 } 2093 $_comments = $wp_query->comments_by_type[ $ r['type'] ];2093 $_comments = $wp_query->comments_by_type[ $parsed_args['type'] ]; 2094 2094 } else { 2095 2095 $_comments = $wp_query->comments; 2096 2096 } … … 2099 2099 $default_comments_page = get_option( 'default_comments_page' ); 2100 2100 $cpage = get_query_var( 'cpage' ); 2101 2101 if ( 'newest' === $default_comments_page ) { 2102 $ r['cpage'] = $cpage;2102 $parsed_args['cpage'] = $cpage; 2103 2103 2104 2104 /* 2105 2105 * When first page shows oldest comments, post permalink is the same as … … 2106 2106 * the comment permalink. 2107 2107 */ 2108 2108 } elseif ( $cpage == 1 ) { 2109 $ r['cpage'] = '';2109 $parsed_args['cpage'] = ''; 2110 2110 } else { 2111 $ r['cpage'] = $cpage;2111 $parsed_args['cpage'] = $cpage; 2112 2112 } 2113 2113 2114 $ r['page'] = 0;2115 $ r['per_page'] = 0;2114 $parsed_args['page'] = 0; 2115 $parsed_args['per_page'] = 0; 2116 2116 } 2117 2117 } 2118 2118 } 2119 2119 2120 if ( '' === $ r['per_page'] && get_option( 'page_comments' ) ) {2121 $ r['per_page'] = get_query_var( 'comments_per_page' );2120 if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) { 2121 $parsed_args['per_page'] = get_query_var( 'comments_per_page' ); 2122 2122 } 2123 2123 2124 if ( empty( $ r['per_page'] ) ) {2125 $ r['per_page'] = 0;2126 $ r['page'] = 0;2124 if ( empty( $parsed_args['per_page'] ) ) { 2125 $parsed_args['per_page'] = 0; 2126 $parsed_args['page'] = 0; 2127 2127 } 2128 2128 2129 if ( '' === $ r['max_depth'] ) {2129 if ( '' === $parsed_args['max_depth'] ) { 2130 2130 if ( get_option( 'thread_comments' ) ) { 2131 $ r['max_depth'] = get_option( 'thread_comments_depth' );2131 $parsed_args['max_depth'] = get_option( 'thread_comments_depth' ); 2132 2132 } else { 2133 $ r['max_depth'] = -1;2133 $parsed_args['max_depth'] = -1; 2134 2134 } 2135 2135 } 2136 2136 2137 if ( '' === $ r['page'] ) {2137 if ( '' === $parsed_args['page'] ) { 2138 2138 if ( empty( $overridden_cpage ) ) { 2139 $ r['page'] = get_query_var( 'cpage' );2139 $parsed_args['page'] = get_query_var( 'cpage' ); 2140 2140 } else { 2141 $threaded = ( -1 != $r['max_depth'] );2142 $ r['page'] = ( 'newest' == get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $r['per_page'], $threaded ) : 1;2143 set_query_var( 'cpage', $ r['page'] );2141 $threaded = ( -1 != $parsed_args['max_depth'] ); 2142 $parsed_args['page'] = ( 'newest' == get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $r['per_page'], $threaded ) : 1; 2143 set_query_var( 'cpage', $parsed_args['page'] ); 2144 2144 } 2145 2145 } 2146 2146 // Validation check 2147 $ r['page'] = intval( $r['page'] );2148 if ( 0 == $ r['page'] && 0 != $r['per_page'] ) {2149 $ r['page'] = 1;2147 $parsed_args['page'] = intval( $parsed_args['page'] ); 2148 if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) { 2149 $parsed_args['page'] = 1; 2150 2150 } 2151 2151 2152 if ( null === $ r['reverse_top_level'] ) {2153 $ r['reverse_top_level'] = ( 'desc' == get_option( 'comment_order' ) );2152 if ( null === $parsed_args['reverse_top_level'] ) { 2153 $parsed_args['reverse_top_level'] = ( 'desc' == get_option( 'comment_order' ) ); 2154 2154 } 2155 2155 2156 2156 wp_queue_comments_for_comment_meta_lazyload( $_comments ); 2157 2157 2158 if ( empty( $ r['walker'] ) ) {2158 if ( empty( $parsed_args['walker'] ) ) { 2159 2159 $walker = new Walker_Comment; 2160 2160 } else { 2161 $walker = $ r['walker'];2161 $walker = $parsed_args['walker']; 2162 2162 } 2163 2163 2164 $output = $walker->paged_walk( $_comments, $ r['max_depth'], $r['page'], $r['per_page'], $r);2164 $output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args ); 2165 2165 2166 2166 $in_comment_loop = false; 2167 2167 2168 if ( $ r['echo'] ) {2168 if ( $parsed_args['echo'] ) { 2169 2169 echo $output; 2170 2170 } else { 2171 2171 return $output; -
wp-includes/comment.php
163 163 return array(); 164 164 } 165 165 166 $defaults = array(166 $defaults = array( 167 167 'status' => 1, 168 168 'post_id' => $post_id, 169 169 'order' => 'ASC', 170 170 ); 171 $ r= wp_parse_args( $args, $defaults );171 $parsed_args = wp_parse_args( $args, $defaults ); 172 172 173 173 $query = new WP_Comment_Query; 174 return $query->query( $ r);174 return $query->query( $parsed_args ); 175 175 } 176 176 177 177 /** -
wp-includes/deprecated.php
430 430 'title_li' => '', 431 431 ); 432 432 433 $ r= wp_parse_args( $args, $defaults );433 $parsed_args = wp_parse_args( $args, $defaults ); 434 434 435 return wp_list_bookmarks($ r);435 return wp_list_bookmarks($parsed_args); 436 436 } 437 437 438 438 /** … … 635 635 function wp_list_cats($args = '') { 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'] = '';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 654 655 return wp_list_categories($ r);655 return wp_list_categories($parsed_args); 656 656 } 657 657 658 658 /** … … 892 892 'title_li' => '', 893 893 ); 894 894 895 $ r= wp_parse_args( $args, $defaults );895 $parsed_args = wp_parse_args( $args, $defaults ); 896 896 897 return wp_list_bookmarks($ r);897 return wp_list_bookmarks($parsed_args); 898 898 } 899 899 900 900 /** -
wp-includes/functions.php
2932 2932 * @param string|array $args Optional. Arguments to control behavior. Default empty array. 2933 2933 */ 2934 2934 function _default_wp_die_handler( $message, $title = '', $args = array() ) { 2935 $defaults = array( 'response' => 500 );2936 $ r= wp_parse_args( $args, $defaults );2935 $defaults = array( 'response' => 500 ); 2936 $parsed_args = wp_parse_args( $args, $defaults ); 2937 2937 2938 2938 $have_gettext = function_exists( '__' ); 2939 2939 … … 2960 2960 $message = "<p>$message</p>"; 2961 2961 } 2962 2962 2963 if ( isset( $ r['back_link'] ) && $r['back_link'] ) {2963 if ( isset( $parsed_args['back_link'] ) && $parsed_args['back_link'] ) { 2964 2964 $back_text = $have_gettext ? __( '« Back' ) : '« Back'; 2965 2965 $message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>"; 2966 2966 } … … 2967 2967 2968 2968 if ( ! did_action( 'admin_head' ) ) : 2969 2969 if ( ! headers_sent() ) { 2970 status_header( $ r['response'] );2970 status_header( $parsed_args['response'] ); 2971 2971 nocache_headers(); 2972 2972 header( 'Content-Type: text/html; charset=utf-8' ); 2973 2973 } … … 2977 2977 } 2978 2978 2979 2979 $text_direction = 'ltr'; 2980 if ( isset( $ r['text_direction'] ) && 'rtl' == $r['text_direction'] ) {2980 if ( isset( $parsed_args['text_direction'] ) && 'rtl' == $parsed_args['text_direction'] ) { 2981 2981 $text_direction = 'rtl'; 2982 2982 } elseif ( function_exists( 'is_rtl' ) && is_rtl() ) { 2983 2983 $text_direction = 'rtl'; … … 3144 3144 global $wp_xmlrpc_server; 3145 3145 $defaults = array( 'response' => 500 ); 3146 3146 3147 $ r= wp_parse_args( $args, $defaults );3147 $parsed_args = wp_parse_args( $args, $defaults ); 3148 3148 3149 3149 if ( $wp_xmlrpc_server ) { 3150 $error = new IXR_Error( $ r['response'], $message );3150 $error = new IXR_Error( $parsed_args['response'], $message ); 3151 3151 $wp_xmlrpc_server->output( $error->getXml() ); 3152 3152 } 3153 3153 die(); … … 3166 3166 * @param string|array $args Optional. Arguments to control behavior. Default empty array. 3167 3167 */ 3168 3168 function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { 3169 $defaults = array(3169 $defaults = array( 3170 3170 'response' => 200, 3171 3171 ); 3172 $ r= wp_parse_args( $args, $defaults );3172 $parsed_args = wp_parse_args( $args, $defaults ); 3173 3173 3174 if ( ! headers_sent() && null !== $ r['response'] ) {3175 status_header( $ r['response'] );3174 if ( ! headers_sent() && null !== $parsed_args['response'] ) { 3175 status_header( $parsed_args['response'] ); 3176 3176 } 3177 3177 3178 3178 if ( is_scalar( $message ) ) { -
wp-includes/general-template.php
1746 1746 'post_type' => 'post', 1747 1747 ); 1748 1748 1749 $ r= wp_parse_args( $args, $defaults );1749 $parsed_args = wp_parse_args( $args, $defaults ); 1750 1750 1751 $post_type_object = get_post_type_object( $ r['post_type'] );1751 $post_type_object = get_post_type_object( $parsed_args['post_type'] ); 1752 1752 if ( ! is_post_type_viewable( $post_type_object ) ) { 1753 1753 return; 1754 1754 } 1755 $ r['post_type'] = $post_type_object->name;1755 $parsed_args['post_type'] = $post_type_object->name; 1756 1756 1757 if ( '' == $ r['type'] ) {1758 $ r['type'] = 'monthly';1757 if ( '' == $parsed_args['type'] ) { 1758 $parsed_args['type'] = 'monthly'; 1759 1759 } 1760 1760 1761 if ( ! empty( $ r['limit'] ) ) {1762 $ r['limit'] = absint( $r['limit'] );1763 $ r['limit'] = ' LIMIT ' . $r['limit'];1761 if ( ! empty( $parsed_args['limit'] ) ) { 1762 $parsed_args['limit'] = absint( $parsed_args['limit'] ); 1763 $parsed_args['limit'] = ' LIMIT ' . $parsed_args['limit']; 1764 1764 } 1765 1765 1766 $order = strtoupper( $ r['order'] );1766 $order = strtoupper( $parsed_args['order'] ); 1767 1767 if ( $order !== 'ASC' ) { 1768 1768 $order = 'DESC'; 1769 1769 } … … 1771 1771 // this is what will separate dates on weekly archive links 1772 1772 $archive_week_separator = '–'; 1773 1773 1774 $sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $ r['post_type'] );1774 $sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $parsed_args['post_type'] ); 1775 1775 1776 1776 /** 1777 1777 * Filters the SQL WHERE clause for retrieving archives. … … 1779 1779 * @since 2.2.0 1780 1780 * 1781 1781 * @param string $sql_where Portion of SQL query containing the WHERE clause. 1782 * @param array $ rAn array of default arguments.1782 * @param array $parsed_args An array of default arguments. 1783 1783 */ 1784 $where = apply_filters( 'getarchives_where', $sql_where, $ r);1784 $where = apply_filters( 'getarchives_where', $sql_where, $parsed_args ); 1785 1785 1786 1786 /** 1787 1787 * Filters the SQL JOIN clause for retrieving archives. … … 1789 1789 * @since 2.2.0 1790 1790 * 1791 1791 * @param string $sql_join Portion of SQL query containing JOIN clause. 1792 * @param array $ rAn array of default arguments.1792 * @param array $parsed_args An array of default arguments. 1793 1793 */ 1794 $join = apply_filters( 'getarchives_join', '', $ r);1794 $join = apply_filters( 'getarchives_join', '', $parsed_args ); 1795 1795 1796 1796 $output = ''; 1797 1797 1798 1798 $last_changed = wp_cache_get_last_changed( 'posts' ); 1799 1799 1800 $limit = $ r['limit'];1800 $limit = $parsed_args['limit']; 1801 1801 1802 if ( 'monthly' == $ r['type'] ) {1802 if ( 'monthly' == $parsed_args['type'] ) { 1803 1803 $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"; 1804 1804 $key = md5( $query ); 1805 1805 $key = "wp_get_archives:$key:$last_changed"; … … 1808 1808 wp_cache_set( $key, $results, 'posts' ); 1809 1809 } 1810 1810 if ( $results ) { 1811 $after = $ r['after'];1811 $after = $parsed_args['after']; 1812 1812 foreach ( (array) $results as $result ) { 1813 1813 $url = get_month_link( $result->year, $result->month ); 1814 if ( 'post' !== $ r['post_type'] ) {1815 $url = add_query_arg( 'post_type', $ r['post_type'], $url );1814 if ( 'post' !== $parsed_args['post_type'] ) { 1815 $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); 1816 1816 } 1817 1817 /* translators: 1: month name, 2: 4-digit year */ 1818 1818 $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year ); 1819 if ( $ r['show_post_count'] ) {1820 $ r['after'] = ' (' . $result->posts . ')' . $after;1819 if ( $parsed_args['show_post_count'] ) { 1820 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1821 1821 } 1822 $output .= get_archives_link( $url, $text, $ r['format'], $r['before'], $r['after'] );1822 $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'] ); 1823 1823 } 1824 1824 } 1825 } elseif ( 'yearly' == $ r['type'] ) {1825 } elseif ( 'yearly' == $parsed_args['type'] ) { 1826 1826 $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"; 1827 1827 $key = md5( $query ); 1828 1828 $key = "wp_get_archives:$key:$last_changed"; … … 1831 1831 wp_cache_set( $key, $results, 'posts' ); 1832 1832 } 1833 1833 if ( $results ) { 1834 $after = $ r['after'];1834 $after = $parsed_args['after']; 1835 1835 foreach ( (array) $results as $result ) { 1836 1836 $url = get_year_link( $result->year ); 1837 if ( 'post' !== $ r['post_type'] ) {1838 $url = add_query_arg( 'post_type', $ r['post_type'], $url );1837 if ( 'post' !== $parsed_args['post_type'] ) { 1838 $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); 1839 1839 } 1840 1840 $text = sprintf( '%d', $result->year ); 1841 if ( $ r['show_post_count'] ) {1842 $ r['after'] = ' (' . $result->posts . ')' . $after;1841 if ( $parsed_args['show_post_count'] ) { 1842 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1843 1843 } 1844 $output .= get_archives_link( $url, $text, $ r['format'], $r['before'], $r['after'] );1844 $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'] ); 1845 1845 } 1846 1846 } 1847 } elseif ( 'daily' == $ r['type'] ) {1847 } elseif ( 'daily' == $parsed_args['type'] ) { 1848 1848 $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"; 1849 1849 $key = md5( $query ); 1850 1850 $key = "wp_get_archives:$key:$last_changed"; … … 1853 1853 wp_cache_set( $key, $results, 'posts' ); 1854 1854 } 1855 1855 if ( $results ) { 1856 $after = $ r['after'];1856 $after = $parsed_args['after']; 1857 1857 foreach ( (array) $results as $result ) { 1858 1858 $url = get_day_link( $result->year, $result->month, $result->dayofmonth ); 1859 if ( 'post' !== $ r['post_type'] ) {1860 $url = add_query_arg( 'post_type', $ r['post_type'], $url );1859 if ( 'post' !== $parsed_args['post_type'] ) { 1860 $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); 1861 1861 } 1862 1862 $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth ); 1863 1863 $text = mysql2date( get_option( 'date_format' ), $date ); 1864 if ( $ r['show_post_count'] ) {1865 $ r['after'] = ' (' . $result->posts . ')' . $after;1864 if ( $parsed_args['show_post_count'] ) { 1865 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1866 1866 } 1867 $output .= get_archives_link( $url, $text, $ r['format'], $r['before'], $r['after'] );1867 $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'] ); 1868 1868 } 1869 1869 } 1870 } elseif ( 'weekly' == $ r['type'] ) {1870 } elseif ( 'weekly' == $parsed_args['type'] ) { 1871 1871 $week = _wp_mysql_week( '`post_date`' ); 1872 1872 $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"; 1873 1873 $key = md5( $query ); … … 1878 1878 } 1879 1879 $arc_w_last = ''; 1880 1880 if ( $results ) { 1881 $after = $ r['after'];1881 $after = $parsed_args['after']; 1882 1882 foreach ( (array) $results as $result ) { 1883 1883 if ( $result->week != $arc_w_last ) { 1884 1884 $arc_year = $result->yr; … … 1893 1893 ), 1894 1894 home_url( '/' ) 1895 1895 ); 1896 if ( 'post' !== $ r['post_type'] ) {1897 $url = add_query_arg( 'post_type', $ r['post_type'], $url );1896 if ( 'post' !== $parsed_args['post_type'] ) { 1897 $url = add_query_arg( 'post_type', $parsed_args['post_type'], $url ); 1898 1898 } 1899 1899 $text = $arc_week_start . $archive_week_separator . $arc_week_end; 1900 if ( $ r['show_post_count'] ) {1901 $ r['after'] = ' (' . $result->posts . ')' . $after;1900 if ( $parsed_args['show_post_count'] ) { 1901 $parsed_args['after'] = ' (' . $result->posts . ')' . $after; 1902 1902 } 1903 $output .= get_archives_link( $url, $text, $ r['format'], $r['before'], $r['after'] );1903 $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'] ); 1904 1904 } 1905 1905 } 1906 1906 } 1907 } elseif ( ( 'postbypost' == $ r['type'] ) || ( 'alpha' == $r['type'] ) ) {1908 $orderby = ( 'alpha' == $ r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';1907 } elseif ( ( 'postbypost' == $parsed_args['type'] ) || ( 'alpha' == $parsed_args['type'] ) ) { 1908 $orderby = ( 'alpha' == $parsed_args['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; 1909 1909 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; 1910 1910 $key = md5( $query ); 1911 1911 $key = "wp_get_archives:$key:$last_changed"; … … 1923 1923 } else { 1924 1924 $text = $result->ID; 1925 1925 } 1926 $output .= get_archives_link( $url, $text, $ r['format'], $r['before'], $r['after'] );1926 $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'] ); 1927 1927 } 1928 1928 } 1929 1929 } 1930 1930 } 1931 if ( $ r['echo'] ) {1931 if ( $parsed_args['echo'] ) { 1932 1932 echo $output; 1933 1933 } else { 1934 1934 return $output; -
wp-includes/post-template.php
78 78 * @return string|void String when echo is false. 79 79 */ 80 80 function the_title_attribute( $args = '' ) { 81 $defaults = array(81 $defaults = array( 82 82 'before' => '', 83 83 'after' => '', 84 84 'echo' => true, 85 85 'post' => get_post(), 86 86 ); 87 $ r= wp_parse_args( $args, $defaults );87 $parsed_args = wp_parse_args( $args, $defaults ); 88 88 89 $title = get_the_title( $ r['post'] );89 $title = get_the_title( $parsed_args['post'] ); 90 90 91 91 if ( strlen( $title ) == 0 ) { 92 92 return; 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 { 101 101 return $title; … … 1148 1148 'value_field' => 'ID', 1149 1149 ); 1150 1150 1151 $ r= wp_parse_args( $args, $defaults );1151 $parsed_args = wp_parse_args( $args, $defaults ); 1152 1152 1153 $pages = get_pages( $ r);1153 $pages = get_pages( $parsed_args ); 1154 1154 $output = ''; 1155 1155 // Back-compat with old system where both id and name were based on $name argument 1156 if ( empty( $ r['id'] ) ) {1157 $ r['id'] = $r['name'];1156 if ( empty( $parsed_args['id'] ) ) { 1157 $parsed_args['id'] = $parsed_args['name']; 1158 1158 } 1159 1159 1160 1160 if ( ! empty( $pages ) ) { 1161 1161 $class = ''; 1162 if ( ! empty( $ r['class'] ) ) {1163 $class = " class='" . esc_attr( $ r['class'] ) . "'";1162 if ( ! empty( $parsed_args['class'] ) ) { 1163 $class = " class='" . esc_attr( $parsed_args['class'] ) . "'"; 1164 1164 } 1165 1165 1166 $output = "<select name='" . esc_attr( $ r['name'] ) . "'" . $class . " id='" . esc_attr( $r['id'] ) . "'>\n";1167 if ( $ r['show_option_no_change'] ) {1168 $output .= "\t<option value=\"-1\">" . $ r['show_option_no_change'] . "</option>\n";1166 $output = "<select name='" . esc_attr( $parsed_args['name'] ) . "'" . $class . " id='" . esc_attr( $parsed_args['id'] ) . "'>\n"; 1167 if ( $parsed_args['show_option_no_change'] ) { 1168 $output .= "\t<option value=\"-1\">" . $parsed_args['show_option_no_change'] . "</option>\n"; 1169 1169 } 1170 if ( $ r['show_option_none'] ) {1171 $output .= "\t<option value=\"" . esc_attr( $ r['option_none_value'] ) . '">' . $r['show_option_none'] . "</option>\n";1170 if ( $parsed_args['show_option_none'] ) { 1171 $output .= "\t<option value=\"" . esc_attr( $parsed_args['option_none_value'] ) . '">' . $parsed_args['show_option_none'] . "</option>\n"; 1172 1172 } 1173 $output .= walk_page_dropdown_tree( $pages, $ r['depth'], $r);1173 $output .= walk_page_dropdown_tree( $pages, $parsed_args['depth'], $parsed_args ); 1174 1174 $output .= "</select>\n"; 1175 1175 } 1176 1176 -
wp-includes/post.php
550 550 'post_parent' => 0, 551 551 ); 552 552 553 $ r= wp_parse_args( $args, $defaults );553 $parsed_args = wp_parse_args( $args, $defaults ); 554 554 555 $children = get_posts( $ r);555 $children = get_posts( $parsed_args ); 556 556 557 557 if ( ! $children ) { 558 558 return $kids; 559 559 } 560 560 561 if ( ! empty( $ r['fields'] ) ) {561 if ( ! empty( $parsed_args['fields'] ) ) { 562 562 return $children; 563 563 } 564 564 … … 1860 1860 'suppress_filters' => true, 1861 1861 ); 1862 1862 1863 $ r= wp_parse_args( $args, $defaults );1864 if ( empty( $ r['post_status'] ) ) {1865 $ r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';1863 $parsed_args = wp_parse_args( $args, $defaults ); 1864 if ( empty( $parsed_args['post_status'] ) ) { 1865 $parsed_args['post_status'] = ( 'attachment' == $parsed_args['post_type'] ) ? 'inherit' : 'publish'; 1866 1866 } 1867 if ( ! empty( $ r['numberposts'] ) && empty( $r['posts_per_page'] ) ) {1868 $ r['posts_per_page'] = $r['numberposts'];1867 if ( ! empty( $parsed_args['numberposts'] ) && empty( $parsed_args['posts_per_page'] ) ) { 1868 $parsed_args['posts_per_page'] = $parsed_args['numberposts']; 1869 1869 } 1870 if ( ! empty( $ r['category'] ) ) {1871 $ r['cat'] = $r['category'];1870 if ( ! empty( $parsed_args['category'] ) ) { 1871 $parsed_args['cat'] = $parsed_args['category']; 1872 1872 } 1873 if ( ! empty( $ r['include'] ) ) {1874 $incposts = wp_parse_id_list( $r['include'] );1875 $ r['posts_per_page'] = count( $incposts ); // only the number of posts included1876 $ r['post__in'] = $incposts;1877 } elseif ( ! empty( $ r['exclude'] ) ) {1878 $ r['post__not_in'] = wp_parse_id_list( $r['exclude'] );1873 if ( ! empty( $parsed_args['include'] ) ) { 1874 $incposts = wp_parse_id_list( $parsed_args['include'] ); 1875 $parsed_args['posts_per_page'] = count( $incposts ); // only the number of posts included 1876 $parsed_args['post__in'] = $incposts; 1877 } elseif ( ! empty( $parsed_args['exclude'] ) ) { 1878 $parsed_args['post__not_in'] = wp_parse_id_list( $parsed_args['exclude'] ); 1879 1879 } 1880 1880 1881 $ r['ignore_sticky_posts'] = true;1882 $ r['no_found_rows'] = true;1881 $parsed_args['ignore_sticky_posts'] = true; 1882 $parsed_args['no_found_rows'] = true; 1883 1883 1884 1884 $get_posts = new WP_Query; 1885 return $get_posts->query( $ r);1885 return $get_posts->query( $parsed_args ); 1886 1886 1887 1887 } 1888 1888 … … 3240 3240 'suppress_filters' => true, 3241 3241 ); 3242 3242 3243 $ r= wp_parse_args( $args, $defaults );3243 $parsed_args = wp_parse_args( $args, $defaults ); 3244 3244 3245 $results = get_posts( $ r);3245 $results = get_posts( $parsed_args ); 3246 3246 3247 3247 // Backward compatibility. Prior to 3.1 expected posts to be returned in array. 3248 3248 if ( ARRAY_A == $output ) { … … 4937 4937 'post_status' => 'publish', 4938 4938 ); 4939 4939 4940 $ r= wp_parse_args( $args, $defaults );4940 $parsed_args = wp_parse_args( $args, $defaults ); 4941 4941 4942 $number = (int) $ r['number'];4943 $offset = (int) $ r['offset'];4944 $child_of = (int) $ r['child_of'];4945 $hierarchical = $ r['hierarchical'];4946 $exclude = $ r['exclude'];4947 $meta_key = $ r['meta_key'];4948 $meta_value = $ r['meta_value'];4949 $parent = $ r['parent'];4950 $post_status = $ r['post_status'];4942 $number = (int) $parsed_args['number']; 4943 $offset = (int) $parsed_args['offset']; 4944 $child_of = (int) $parsed_args['child_of']; 4945 $hierarchical = $parsed_args['hierarchical']; 4946 $exclude = $parsed_args['exclude']; 4947 $meta_key = $parsed_args['meta_key']; 4948 $meta_value = $parsed_args['meta_value']; 4949 $parent = $parsed_args['parent']; 4950 $post_status = $parsed_args['post_status']; 4951 4951 4952 4952 // Make sure the post type is hierarchical. 4953 4953 $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); 4954 if ( ! in_array( $ r['post_type'], $hierarchical_post_types ) ) {4954 if ( ! in_array( $parsed_args['post_type'], $hierarchical_post_types ) ) { 4955 4955 return false; 4956 4956 } 4957 4957 … … 4968 4968 } 4969 4969 4970 4970 // $args can be whatever, only use the args defined in defaults to compute the key. 4971 $key = md5( serialize( wp_array_slice_assoc( $ r, array_keys( $defaults ) ) ) );4971 $key = md5( serialize( wp_array_slice_assoc( $parsed_args, array_keys( $defaults ) ) ) ); 4972 4972 $last_changed = wp_cache_get_last_changed( 'posts' ); 4973 4973 4974 4974 $cache_key = "get_pages:$key:$last_changed"; … … 4976 4976 // Convert to WP_Post instances. 4977 4977 $pages = array_map( 'get_post', $cache ); 4978 4978 /** This filter is documented in wp-includes/post.php */ 4979 $pages = apply_filters( 'get_pages', $pages, $ r);4979 $pages = apply_filters( 'get_pages', $pages, $parsed_args ); 4980 4980 return $pages; 4981 4981 } 4982 4982 4983 4983 $inclusions = ''; 4984 if ( ! empty( $ r['include'] ) ) {4984 if ( ! empty( $parsed_args['include'] ) ) { 4985 4985 $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include 4986 4986 $parent = -1; 4987 4987 $exclude = ''; … … 4988 4988 $meta_key = ''; 4989 4989 $meta_value = ''; 4990 4990 $hierarchical = false; 4991 $incpages = wp_parse_id_list( $ r['include'] );4991 $incpages = wp_parse_id_list( $parsed_args['include'] ); 4992 4992 if ( ! empty( $incpages ) ) { 4993 4993 $inclusions = ' AND ID IN (' . implode( ',', $incpages ) . ')'; 4994 4994 } … … 5003 5003 } 5004 5004 5005 5005 $author_query = ''; 5006 if ( ! empty( $ r['authors'] ) ) {5007 $post_authors = preg_split( '/[\s,]+/', $ r['authors'] );5006 if ( ! empty( $parsed_args['authors'] ) ) { 5007 $post_authors = preg_split( '/[\s,]+/', $parsed_args['authors'] ); 5008 5008 5009 5009 if ( ! empty( $post_authors ) ) { 5010 5010 foreach ( $post_authors as $post_author ) { … … 5058 5058 } 5059 5059 5060 5060 if ( 1 == count( $post_status ) ) { 5061 $where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $ r['post_type'], reset( $post_status ) );5061 $where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $parsed_args['post_type'], reset( $post_status ) ); 5062 5062 } else { 5063 5063 $post_status = implode( "', '", $post_status ); 5064 $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $ r['post_type'] );5064 $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $parsed_args['post_type'] ); 5065 5065 } 5066 5066 5067 5067 $orderby_array = array(); … … 5086 5086 'comment_count', 5087 5087 ); 5088 5088 5089 foreach ( explode( ',', $ r['sort_column'] ) as $orderby ) {5089 foreach ( explode( ',', $parsed_args['sort_column'] ) as $orderby ) { 5090 5090 $orderby = trim( $orderby ); 5091 5091 if ( ! in_array( $orderby, $allowed_keys ) ) { 5092 5092 continue; … … 5117 5117 } 5118 5118 $sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title"; 5119 5119 5120 $sort_order = strtoupper( $ r['sort_order'] );5120 $sort_order = strtoupper( $parsed_args['sort_order'] ); 5121 5121 if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ) ) ) { 5122 5122 $sort_order = 'ASC'; 5123 5123 } … … 5134 5134 5135 5135 if ( empty( $pages ) ) { 5136 5136 /** This filter is documented in wp-includes/post.php */ 5137 $pages = apply_filters( 'get_pages', array(), $ r);5137 $pages = apply_filters( 'get_pages', array(), $parsed_args ); 5138 5138 return $pages; 5139 5139 } 5140 5140 … … 5151 5151 $pages = get_page_children( $child_of, $pages ); 5152 5152 } 5153 5153 5154 if ( ! empty( $ r['exclude_tree'] ) ) {5155 $exclude = wp_parse_id_list( $ r['exclude_tree'] );5154 if ( ! empty( $parsed_args['exclude_tree'] ) ) { 5155 $exclude = wp_parse_id_list( $parsed_args['exclude_tree'] ); 5156 5156 foreach ( $exclude as $id ) { 5157 5157 $children = get_page_children( $id, $pages ); 5158 5158 foreach ( $children as $child ) { … … 5184 5184 * @since 2.1.0 5185 5185 * 5186 5186 * @param array $pages List of pages to retrieve. 5187 * @param array $ rArray of get_pages() arguments.5187 * @param array $parsed_args Array of get_pages() arguments. 5188 5188 */ 5189 return apply_filters( 'get_pages', $pages, $ r);5189 return apply_filters( 'get_pages', $pages, $parsed_args ); 5190 5190 } 5191 5191 5192 5192 // -
wp-includes/taxonomy.php
4322 4322 'after' => '', 4323 4323 ); 4324 4324 4325 $ r= wp_parse_args( $args, $defaults );4325 $parsed_args = wp_parse_args( $args, $defaults ); 4326 4326 4327 echo $ r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after'];4327 echo $parsed_args['before'] . join( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after']; 4328 4328 } 4329 4329 4330 4330 /** -
wp-includes/user.php
1104 1104 1105 1105 $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; 1106 1106 1107 $ r= wp_parse_args( $args, $defaults );1107 $parsed_args = wp_parse_args( $args, $defaults ); 1108 1108 1109 $query_args = wp_array_slice_assoc( $ r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in' ) );1109 $query_args = wp_array_slice_assoc( $parsed_args, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who', 'role', 'role__in', 'role__not_in' ) ); 1110 1110 1111 1111 $fields = array( 'ID', 'user_login' ); 1112 1112 1113 $show = ! empty( $ r['show'] ) ? $r['show'] : 'display_name';1113 $show = ! empty( $parsed_args['show'] ) ? $parsed_args['show'] : 'display_name'; 1114 1114 if ( 'display_name_with_login' === $show ) { 1115 1115 $fields[] = 'display_name'; 1116 1116 } else { … … 1119 1119 1120 1120 $query_args['fields'] = $fields; 1121 1121 1122 $show_option_all = $ r['show_option_all'];1123 $show_option_none = $ r['show_option_none'];1124 $option_none_value = $ r['option_none_value'];1122 $show_option_all = $parsed_args['show_option_all']; 1123 $show_option_none = $parsed_args['show_option_none']; 1124 $option_none_value = $parsed_args['option_none_value']; 1125 1125 1126 1126 /** 1127 1127 * Filters the query arguments for the list of users in the dropdown. … … 1129 1129 * @since 4.4.0 1130 1130 * 1131 1131 * @param array $query_args The query arguments for get_users(). 1132 * @param array $ rThe arguments passed to wp_dropdown_users() combined with the defaults.1132 * @param array $parsed_args The arguments passed to wp_dropdown_users() combined with the defaults. 1133 1133 */ 1134 $query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $ r);1134 $query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $parsed_args ); 1135 1135 1136 1136 $users = get_users( $query_args ); 1137 1137 1138 1138 $output = ''; 1139 if ( ! empty( $users ) && ( empty( $ r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {1140 $name = esc_attr( $ r['name'] );1141 if ( $ r['multi'] && ! $r['id'] ) {1139 if ( ! empty( $users ) && ( empty( $parsed_args['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) { 1140 $name = esc_attr( $parsed_args['name'] ); 1141 if ( $parsed_args['multi'] && ! $parsed_args['id'] ) { 1142 1142 $id = ''; 1143 1143 } else { 1144 $id = $ r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'";1144 $id = $parsed_args['id'] ? " id='" . esc_attr( $parsed_args['id'] ) . "'" : " id='$name'"; 1145 1145 } 1146 $output = "<select name='{$name}'{$id} class='" . $ r['class'] . "'>\n";1146 $output = "<select name='{$name}'{$id} class='" . $parsed_args['class'] . "'>\n"; 1147 1147 1148 1148 if ( $show_option_all ) { 1149 1149 $output .= "\t<option value='0'>$show_option_all</option>\n"; … … 1150 1150 } 1151 1151 1152 1152 if ( $show_option_none ) { 1153 $_selected = selected( $option_none_value, $ r['selected'], false );1153 $_selected = selected( $option_none_value, $parsed_args['selected'], false ); 1154 1154 $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n"; 1155 1155 } 1156 1156 1157 if ( $ r['include_selected'] && ( $r['selected'] > 0 ) ) {1158 $found_selected = false;1159 $ r['selected'] = (int) $r['selected'];1157 if ( $parsed_args['include_selected'] && ( $parsed_args['selected'] > 0 ) ) { 1158 $found_selected = false; 1159 $parsed_args['selected'] = (int) $parsed_args['selected']; 1160 1160 foreach ( (array) $users as $user ) { 1161 1161 $user->ID = (int) $user->ID; 1162 if ( $user->ID === $ r['selected'] ) {1162 if ( $user->ID === $parsed_args['selected'] ) { 1163 1163 $found_selected = true; 1164 1164 } 1165 1165 } 1166 1166 1167 1167 if ( ! $found_selected ) { 1168 $users[] = get_userdata( $ r['selected'] );1168 $users[] = get_userdata( $parsed_args['selected'] ); 1169 1169 } 1170 1170 } 1171 1171 … … 1179 1179 $display = '(' . $user->user_login . ')'; 1180 1180 } 1181 1181 1182 $_selected = selected( $user->ID, $ r['selected'], false );1182 $_selected = selected( $user->ID, $parsed_args['selected'], false ); 1183 1183 $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n"; 1184 1184 } 1185 1185 … … 1195 1195 */ 1196 1196 $html = apply_filters( 'wp_dropdown_users', $output ); 1197 1197 1198 if ( $ r['echo'] ) {1198 if ( $parsed_args['echo'] ) { 1199 1199 echo $html; 1200 1200 } 1201 1201 return $html;