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