Ticket #38133: widgets2.diff
File widgets2.diff, 15.2 KB (added by , 8 years ago) |
---|
-
wp-includes/widgets/class-wp-nav-menu-widget.php
47 47 if ( !$nav_menu ) 48 48 return; 49 49 50 $title = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : ''; 50 51 /** 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 );52 $instance['title'] = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 52 53 53 54 echo $args['before_widget']; 54 55 55 if ( !empty($instance['title']))56 if ( isset( $instance['title'] ) && '' !== $instance['title'] ) 56 57 echo $args['before_title'] . $instance['title'] . $args['after_title']; 57 58 58 59 $nav_menu_args = array( … … 94 95 */ 95 96 public function update( $new_instance, $old_instance ) { 96 97 $instance = array(); 97 if ( ! empty( $new_instance['title'] )) {98 if ( isset( $new_instance['title'] ) && '' !== $new_instance['title'] ) { 98 99 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 99 100 } 100 101 if ( ! empty( $new_instance['nav_menu'] ) ) { -
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 = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : __( 'Archives' ); 48 49 /** 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 );50 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 50 51 51 52 echo $args['before_widget']; 52 if ( $title ) {53 if ( isset( $title ) && '' !== $title ) { 53 54 echo $args['before_title'] . $title . $args['after_title']; 54 55 } 55 56 -
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 = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : ''; 55 56 /** 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 );57 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 57 58 58 59 echo $args['before_widget']; 59 if ( $title ) {60 if ( isset( $title ) && '' !== $title ) { 60 61 echo $args['before_title'] . $title . $args['after_title']; 61 62 } 62 63 if ( 0 === self::$instance ) { -
wp-includes/widgets/class-wp-widget-categories.php
43 43 */ 44 44 public function widget( $args, $instance ) { 45 45 static $first_dropdown = true; 46 46 $title = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : __( 'Categories' ); 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', $title, $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
44 44 * @param array $instance Settings for the current Meta widget instance. 45 45 */ 46 46 public function widget( $args, $instance ) { 47 $title = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : __( 'Meta' ); 47 48 /** 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 );49 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 49 50 50 51 echo $args['before_widget']; 51 if ( $title ) {52 if ( isset( $title ) && '' !== $title ) { 52 53 echo $args['before_title'] . $title . $args['after_title']; 53 54 } 54 55 ?> -
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 45 $title = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : __( 'Pages' ); 46 46 /** 47 47 * Filters the widget title. 48 48 * … … 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', $title, $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
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 … … 61 61 $desc = ''; 62 62 $link = ''; 63 63 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))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 ( isset( $title ) && '' !== $title ) 67 67 $title = strip_tags( $rss->get_title() ); 68 68 $link = strip_tags( $rss->get_permalink() ); 69 while ( stristr( $link, 'http') != $link )70 $link = substr( $link, 1);69 while ( stristr( $link, 'http' ) != $link ) 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
42 42 * @param array $instance Settings for the current Search widget instance. 43 43 */ 44 44 public function widget( $args, $instance ) { 45 $title = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : ''; 46 45 47 /** 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 );48 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 47 49 48 50 echo $args['before_widget']; 49 if ( $title ) {51 if ( isset( $title ) && '' !== $title ) { 50 52 echo $args['before_title'] . $title . $args['after_title']; 51 53 } 52 54 -
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 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
43 43 * @param array $instance Settings for the current Text widget instance. 44 44 */ 45 45 public function widget( $args, $instance ) { 46 $title = ( isset( $instance['title'] ) && '' !== $instance['title'] ) ? $instance['title'] : ''; 46 47 47 48 /** 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 );49 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 49 50 50 $widget_text = ! empty( $instance['text'] )? $instance['text'] : '';51 $widget_text = isset( $instance['text'] ) && '' !== $instance['text'] ? $instance['text'] : ''; 51 52 52 53 /** 53 54 * Filters the content of the Text widget. … … 62 63 $text = apply_filters( 'widget_text', $widget_text, $instance, $this ); 63 64 64 65 echo $args['before_widget']; 65 if ( ! empty( $title )) {66 if ( isset( $title ) && '' !== $title ) { 66 67 echo $args['before_title'] . $title . $args['after_title']; 67 68 } ?> 68 <div class="textwidget"><?php echo !empty( $instance['filter'] )? wpautop( $text ) : $text; ?></div>69 <div class="textwidget"><?php echo isset( $instance['filter'] ) && '' !== $instance['filter'] ? wpautop( $text ) : $text; ?></div> 69 70 <?php 70 71 echo $args['after_widget']; 71 72 } … … 89 90 } else { 90 91 $instance['text'] = wp_kses_post( $new_instance['text'] ); 91 92 } 92 $instance['filter'] = ! empty( $new_instance['filter'] );93 $instance['filter'] = isset( $new_instance['filter'] ); 93 94 return $instance; 94 95 } 95 96