WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/13/2014 04:47:11 AM (7 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in the_title_attribute().

See #22400.

File:
1 edited

Legend:

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

    r28357 r28383  
    7070 */
    7171function the_title_attribute( $args = '' ) {
    72     $defaults = array('before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post() );
    73     $r = wp_parse_args($args, $defaults);
    74     extract( $r, EXTR_SKIP );
    75 
    76     $title = get_the_title( $post );
    77 
    78     if ( strlen($title) == 0 )
     72    $defaults = array( 'before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post() );
     73    $r = wp_parse_args( $args, $defaults );
     74
     75    $title = get_the_title( $r['post'] );
     76
     77    if ( strlen( $title ) == 0 ) {
    7978        return;
    80 
    81     $title = $before . $title . $after;
    82     $title = esc_attr(strip_tags($title));
    83 
    84     if ( $echo )
     79    }
     80
     81    $title = $r['before'] . $title . $r['after'];
     82    $title = esc_attr( strip_tags( $title ) );
     83
     84    if ( $r['echo'] ) {
    8585        echo $title;
    86     else
     86    } else {
    8787        return $title;
     88    }
    8889}
    8990
Note: See TracChangeset for help on using the changeset viewer.