Make WordPress Core

Changeset 28402


Ignore:
Timestamp:
05/15/2014 01:40:48 AM (9 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in Walker_Page::start_el().

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r28401 r28402  
    12671267     */
    12681268    function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
    1269         if ( $depth )
    1270             $indent = str_repeat("\t", $depth);
    1271         else
     1269        if ( $depth ) {
     1270            $indent = str_repeat( "\t", $depth );
     1271        } else {
    12721272            $indent = '';
    1273 
    1274         extract($args, EXTR_SKIP);
    1275         $css_class = array('page_item', 'page-item-'.$page->ID);
    1276 
    1277         if( isset( $args['pages_with_children'][ $page->ID ] ) )
     1273        }
     1274
     1275        $css_class = array( 'page_item', 'page-item-' . $page->ID );
     1276
     1277        if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
    12781278            $css_class[] = 'page_item_has_children';
    1279 
    1280         if ( !empty($current_page) ) {
     1279        }
     1280
     1281        if ( ! empty( $current_page ) ) {
    12811282            $_current_page = get_post( $current_page );
    1282             if ( in_array( $page->ID, $_current_page->ancestors ) )
     1283            if ( in_array( $page->ID, $_current_page->ancestors ) ) {
    12831284                $css_class[] = 'current_page_ancestor';
    1284             if ( $page->ID == $current_page )
     1285            }
     1286            if ( $page->ID == $current_page ) {
    12851287                $css_class[] = 'current_page_item';
    1286             elseif ( $_current_page && $page->ID == $_current_page->post_parent )
     1288            } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
    12871289                $css_class[] = 'current_page_parent';
     1290            }
    12881291        } elseif ( $page->ID == get_option('page_for_posts') ) {
    12891292            $css_class[] = 'current_page_parent';
     
    13041307         * @param int     $current_page ID of the current page.
    13051308         */
    1306         $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
    1307 
    1308         if ( '' === $page->post_title )
     1309        $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
     1310
     1311        if ( '' === $page->post_title ) {
    13091312            $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID );
     1313        }
     1314
     1315        $args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
     1316        $args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
    13101317
    13111318        /** This filter is documented in wp-includes/post-template.php */
    1312         $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
    1313 
    1314         if ( !empty($show_date) ) {
    1315             if ( 'modified' == $show_date )
     1319        $output .= $indent . sprintf(
     1320            '<li class="%s"><a href="%s">%s%s%s</a>',
     1321            $css_classes,
     1322            get_permalink( $page->ID ),
     1323            $args['link_before'],
     1324            apply_filters( 'the_title', $page->post_title, $page->ID ),
     1325            $args['link_after']
     1326        );
     1327
     1328        if ( ! empty( $args['show_date'] ) ) {
     1329            if ( 'modified' == $args['show_date'] ) {
    13161330                $time = $page->post_modified;
    1317             else
     1331            } else {
    13181332                $time = $page->post_date;
    1319 
    1320             $output .= " " . mysql2date($date_format, $time);
     1333            }
     1334
     1335            $date_format = empty( $args['date_format'] ) ? '' : $args['date_format'];
     1336            $output .= " " . mysql2date( $date_format, $time );
    13211337        }
    13221338    }
Note: See TracChangeset for help on using the changeset viewer.