Ticket #38133: widgets.diff
File widgets.diff, 13.3 KB (added by , 8 years ago) |
---|
-
wp-includes/widgets/class-wp-nav-menu-widget.php
48 48 return; 49 49 50 50 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 51 $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );51 $instance['title'] = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : '', $instance, $this->id_base ); 52 52 53 53 echo $args['before_widget']; 54 54 55 if ( !empty($instance['title']))55 if ( isset( $instance['title'] ) && $instance['title'] !== '' ) 56 56 echo $args['before_title'] . $instance['title'] . $args['after_title']; 57 57 58 58 $nav_menu_args = array( … … 94 94 */ 95 95 public function update( $new_instance, $old_instance ) { 96 96 $instance = array(); 97 if ( ! empty( $new_instance['title'] )) {97 if ( isset( $new_instance['title'] ) && $new_instance['title'] !== '') { 98 98 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 99 99 } 100 100 if ( ! empty( $new_instance['nav_menu'] ) ) { -
wp-includes/widgets/class-wp-widget-archives.php
46 46 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 47 47 48 48 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 49 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base );49 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : __( 'Archives' ), $instance, $this->id_base ); 50 50 51 51 echo $args['before_widget']; 52 if ( $title) {52 if ( isset( $title ) && $title !== '' ) { 53 53 echo $args['before_title'] . $title . $args['after_title']; 54 54 } 55 55 -
wp-includes/widgets/class-wp-widget-calendar.php
53 53 */ 54 54 public function widget( $args, $instance ) { 55 55 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 56 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );56 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : '', $instance, $this->id_base ); 57 57 58 58 echo $args['before_widget']; 59 if ( $title) {59 if ( isset( $title ) && $title !== '' ) { 60 60 echo $args['before_title'] . $title . $args['after_title']; 61 61 } 62 62 if ( 0 === self::$instance ) { -
wp-includes/widgets/class-wp-widget-categories.php
45 45 static $first_dropdown = true; 46 46 47 47 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 48 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );48 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : __( 'Categories' ), $instance, $this->id_base ); 49 49 50 50 $c = ! empty( $instance['count'] ) ? '1' : '0'; 51 51 $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; … … 52 52 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 53 53 54 54 echo $args['before_widget']; 55 if ( $title) {55 if ( isset( $title ) && $title !== '' ) { 56 56 echo $args['before_title'] . $title . $args['after_title']; 57 57 } 58 58 -
wp-includes/widgets/class-wp-widget-meta.php
45 45 */ 46 46 public function widget( $args, $instance ) { 47 47 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 48 $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );48 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : __( 'Meta' ), $instance, $this->id_base ); 49 49 50 50 echo $args['before_widget']; 51 if ( $title) {51 if ( isset( $title ) && $title !== '' ) { 52 52 echo $args['before_title'] . $title . $args['after_title']; 53 53 } 54 54 ?> -
wp-includes/widgets/class-wp-widget-pages.php
52 52 * @param array $instance An array of the widget's settings. 53 53 * @param mixed $id_base The widget ID. 54 54 */ 55 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title'], $instance, $this->id_base );55 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : __( 'Pages' ), $instance, $this->id_base ); 56 56 57 57 $sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby']; 58 58 $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude']; … … 78 78 79 79 if ( ! empty( $out ) ) { 80 80 echo $args['before_widget']; 81 if ( $title) {81 if ( isset( $title ) && $title !== '' ) { 82 82 echo $args['before_title'] . $title . $args['after_title']; 83 83 } 84 84 ?> -
wp-includes/widgets/class-wp-widget-recent-comments.php
75 75 76 76 $output = ''; 77 77 78 $title = ( ! empty( $instance['title'] )) ? $instance['title'] : __( 'Recent Comments' );78 $title = ( isset( $instance['title'] ) && $instance['title'] !== '' ) ? $instance['title'] : __( 'Recent Comments' ); 79 79 80 80 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 81 81 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); … … 100 100 ) ) ); 101 101 102 102 $output .= $args['before_widget']; 103 if ( $title) {103 if ( isset( $title ) && $title !== '' ) { 104 104 $output .= $args['before_title'] . $title . $args['after_title']; 105 105 } 106 106 -
wp-includes/widgets/class-wp-widget-recent-posts.php
47 47 $args['widget_id'] = $this->id; 48 48 } 49 49 50 $title = ( ! empty( $instance['title'] )) ? $instance['title'] : __( 'Recent Posts' );50 $title = ( isset( $instance['title'] ) && $instance['title'] !== '' ) ? $instance['title'] : __( 'Recent Posts' ); 51 51 52 52 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 53 53 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); … … 76 76 if ($r->have_posts()) : 77 77 ?> 78 78 <?php echo $args['before_widget']; ?> 79 <?php if ( $title) {79 <?php if ( isset( $title ) && $title !== '' ) { 80 80 echo $args['before_title'] . $title . $args['after_title']; 81 81 } ?> 82 82 <ul> -
wp-includes/widgets/class-wp-widget-rss.php
63 63 64 64 if ( ! is_wp_error($rss) ) { 65 65 $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset')))); 66 if ( empty($title))66 if ( isset($title) && $title == '' ) 67 67 $title = strip_tags( $rss->get_title() ); 68 68 $link = strip_tags( $rss->get_permalink() ); 69 69 while ( stristr($link, 'http') != $link ) … … 70 70 $link = substr($link, 1); 71 71 } 72 72 73 if ( empty($title))73 if ( isset($title) && $title == '' ) 74 74 $title = empty($desc) ? __('Unknown Feed') : $desc; 75 75 76 76 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ … … 78 78 79 79 $url = strip_tags( $url ); 80 80 $icon = includes_url( 'images/rss.png' ); 81 if ( $title)81 if ( isset( $title) && $title !== '' ) 82 82 $title = '<a class="rsswidget" href="' . esc_url( $url ) . '"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="' . esc_url( $icon ) . '" alt="RSS" /></a> <a class="rsswidget" href="' . esc_url( $link ) . '">'. esc_html( $title ) . '</a>'; 83 83 84 84 echo $args['before_widget']; 85 if ( $title) {85 if ( isset( $title) && $title !== '' ) { 86 86 echo $args['before_title'] . $title . $args['after_title']; 87 87 } 88 88 wp_widget_rss_output( $rss, $instance ); -
wp-includes/widgets/class-wp-widget-search.php
43 43 */ 44 44 public function widget( $args, $instance ) { 45 45 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 46 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );46 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : '', $instance, $this->id_base ); 47 47 48 48 echo $args['before_widget']; 49 if ( $title) {49 if ( isset( $title ) && $title !== '' ) { 50 50 echo $args['before_title'] . $title . $args['after_title']; 51 51 } 52 52 -
wp-includes/widgets/class-wp-widget-tag-cloud.php
42 42 */ 43 43 public function widget( $args, $instance ) { 44 44 $current_taxonomy = $this->_get_current_taxonomy($instance); 45 if ( !empty($instance['title'])) {45 if ( isset($instance['title']) && $instance['title'] !== '' ) { 46 46 $title = $instance['title']; 47 47 } else { 48 48 if ( 'post_tag' == $current_taxonomy ) { … … 76 76 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 77 77 78 78 echo $args['before_widget']; 79 if ( $title) {79 if ( isset( $title ) && $title !== '' ) { 80 80 echo $args['before_title'] . $title . $args['after_title']; 81 81 } 82 82 … … 117 117 public function form( $instance ) { 118 118 $current_taxonomy = $this->_get_current_taxonomy($instance); 119 119 $title_id = $this->get_field_id( 'title' ); 120 $instance['title'] = ! empty( $instance['title'] )? esc_attr( $instance['title'] ) : '';120 $instance['title'] = isset( $instance['title'] ) && $instance['title'] !== '' ? esc_attr( $instance['title'] ) : ''; 121 121 122 122 echo '<p><label for="' . $title_id .'">' . __( 'Title:' ) . '</label> 123 123 <input type="text" class="widefat" id="' . $title_id .'" name="' . $this->get_field_name( 'title' ) .'" value="' . $instance['title'] .'" /> -
wp-includes/widgets/class-wp-widget-text.php
45 45 public function widget( $args, $instance ) { 46 46 47 47 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ 48 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );48 $title = apply_filters( 'widget_title', isset( $instance['title'] ) && $instance['title'] !== '' ? $instance['title'] : '', $instance, $this->id_base ); 49 49 50 $widget_text = ! empty( $instance['text'] )? $instance['text'] : '';50 $widget_text = isset( $instance['text'] ) && $instance['text'] !== '' ? $instance['text'] : ''; 51 51 52 52 /** 53 53 * Filters the content of the Text widget. … … 62 62 $text = apply_filters( 'widget_text', $widget_text, $instance, $this ); 63 63 64 64 echo $args['before_widget']; 65 if ( ! empty( $title )) {65 if ( isset( $title ) && $title !== '' ) { 66 66 echo $args['before_title'] . $title . $args['after_title']; 67 67 } ?> 68 <div class="textwidget"><?php echo !empty( $instance['filter'] )? wpautop( $text ) : $text; ?></div>68 <div class="textwidget"><?php echo isset( $instance['filter'] ) && $instance['filter'] !== '' ? wpautop( $text ) : $text; ?></div> 69 69 <?php 70 70 echo $args['after_widget']; 71 71 } … … 89 89 } else { 90 90 $instance['text'] = wp_kses_post( $new_instance['text'] ); 91 91 } 92 $instance['filter'] = ! empty( $new_instance['filter'] );92 $instance['filter'] = isset( $new_instance['filter'] ); 93 93 return $instance; 94 94 } 95 95