Make WordPress Core

Ticket #6684: widgets.php.diff

File widgets.php.diff, 3.9 KB (added by jhodgdon, 18 years ago)

Add filtering to all built-in widget titles

  • E:/EclipseWorkWeb/WordPressDev/wp-includes/widgets.php

     
    363363        extract( $args );
    364364        $options = get_option( 'widget_pages' );
    365365
    366         $title = empty( $options['title'] ) ? __( 'Pages' ) : $options['title'];
     366        $title = empty( $options['title'] ) ? __( 'Pages' ) : apply_filters('widget_title', $options['title']);
    367367        $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby'];
    368368        $exclude = empty( $options['exclude'] ) ? '' : $options['exclude'];
    369369
     
    454454        $options = get_option('widget_archives');
    455455        $c = $options['count'] ? '1' : '0';
    456456        $d = $options['dropdown'] ? '1' : '0';
    457         $title = empty($options['title']) ? __('Archives') : $options['title'];
     457        $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']);
    458458
    459459        echo $before_widget;
    460460        echo $before_title . $title . $after_title;
     
    502502function wp_widget_meta($args) {
    503503        extract($args);
    504504        $options = get_option('widget_meta');
    505         $title = empty($options['title']) ? __('Meta') : $options['title'];
     505        $title = empty($options['title']) ? __('Meta') : apply_filters('widget_title', $options['title']);
    506506?>
    507507                <?php echo $before_widget; ?>
    508508                        <?php echo $before_title . $title . $after_title; ?>
     
    536536function wp_widget_calendar($args) {
    537537        extract($args);
    538538        $options = get_option('widget_calendar');
    539         $title = $options['title'];
     539        $title = apply_filters('widget_title', $options['title']);
    540540        if ( empty($title) )
    541541                $title = '&nbsp;';
    542542        echo $before_widget . $before_title . $title . $after_title;
     
    573573        if ( !isset($options[$number]) )
    574574                return;
    575575
    576         $title = $options[$number]['title'];
     576        $title = apply_filters('widget_title', $options[$number]['title']);
    577577        $text = apply_filters( 'widget_text', $options[$number]['text'] );
    578578?>
    579579                <?php echo $before_widget; ?>
     
    685685        $h = $options[$number]['hierarchical'] ? '1' : '0';
    686686        $d = $options[$number]['dropdown'] ? '1' : '0';
    687687
    688         $title = empty($options[$number]['title']) ? __('Categories') : $options[$number]['title'];
     688        $title = empty($options[$number]['title']) ? __('Categories') : apply_filters('widget_title', $options[$number]['title']);
    689689
    690690        echo $before_widget;
    691691        echo $before_title . $title . $after_title;
     
    868868        ob_start();
    869869        extract($args);
    870870        $options = get_option('widget_recent_entries');
    871         $title = empty($options['title']) ? __('Recent Posts') : $options['title'];
     871        $title = empty($options['title']) ? __('Recent Posts') : apply_filters('widget_title', $options['title']);
    872872        if ( !$number = (int) $options['number'] )
    873873                $number = 10;
    874874        else if ( $number < 1 )
     
    931931        global $wpdb, $comments, $comment;
    932932        extract($args, EXTR_SKIP);
    933933        $options = get_option('widget_recent_comments');
    934         $title = empty($options['title']) ? __('Recent Comments') : $options['title'];
     934        $title = empty($options['title']) ? __('Recent Comments') : apply_filters('widget_title', $options['title']);
    935935        if ( !$number = (int) $options['number'] )
    936936                $number = 5;
    937937        else if ( $number < 1 )
     
    10371037                $title = $desc;
    10381038        if ( empty($title) )
    10391039                $title = __('Unknown Feed');
     1040    $title = apply_filters('widget_title', $title );
    10401041        $url = clean_url(strip_tags($url));
    10411042        if ( file_exists(dirname(__FILE__) . '/rss.png') )
    10421043                $icon = str_replace(ABSPATH, get_option('siteurl').'/', dirname(__FILE__)) . '/rss.png';
     
    13291330function wp_widget_tag_cloud($args) {
    13301331        extract($args);
    13311332        $options = get_option('widget_tag_cloud');
    1332         $title = empty($options['title']) ? __('Tags') : $options['title'];
     1333        $title = empty($options['title']) ? __('Tags') : apply_filters('widget_title', $options['title']);
    13331334
    13341335        echo $before_widget;
    13351336        echo $before_title . $title . $after_title;