From 7b8d797355b78149a4a0bdeff82aa9eb0e4e1ea6 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 15 May 2014 01:22:15 +0000 Subject: [PATCH] Eliminate use of `extract()` in `wp_list_pages()` which, surprisingly, didn't even use any of the extracted variables. See #22400. Built from https://develop.svn.wordpress.org/trunk@28401 git-svn-id: http://core.svn.wordpress.org/trunk@28228 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 1abf9f4c10..a1b44a7e19 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1001,24 +1001,23 @@ function wp_dropdown_pages( $args = '' ) { function wp_list_pages( $args = '' ) { $defaults = array( 'depth' => 0, 'show_date' => '', - 'date_format' => get_option('date_format'), + 'date_format' => get_option( 'date_format' ), 'child_of' => 0, 'exclude' => '', - 'title_li' => __('Pages'), 'echo' => 1, + 'title_li' => __( 'Pages' ), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '', 'walker' => '', ); $r = wp_parse_args( $args, $defaults ); - extract( $r, EXTR_SKIP ); $output = ''; $current_page = 0; // sanitize, mostly to keep spaces out - $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']); + $r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] ); // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array) - $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array(); + $exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array(); /** * Filter the array of pages to exclude from the pages list. @@ -1031,12 +1030,12 @@ function wp_list_pages( $args = '' ) { // Query pages. $r['hierarchical'] = 0; - $pages = get_pages($r); + $pages = get_pages( $r ); - if ( !empty($pages) ) { - if ( $r['title_li'] ) + if ( ! empty( $pages ) ) { + if ( $r['title_li'] ) { $output .= ''; + } } /** @@ -1060,15 +1060,16 @@ function wp_list_pages( $args = '' ) { * * @see wp_list_pages() * - * @param string $output HTML output of the pages list. + * @param string $html HTML output of the pages list. * @param array $r An array of page-listing arguments. */ - $output = apply_filters( 'wp_list_pages', $output, $r ); + $html = apply_filters( 'wp_list_pages', $output, $r ); - if ( $r['echo'] ) - echo $output; - else - return $output; + if ( $r['echo'] ) { + echo $html; + } else { + return $html; + } } /**