Ticket #1402: topic-widget-errors.diff
| File topic-widget-errors.diff, 3.4 KB (added by , 16 years ago) |
|---|
-
bbp-widgets.php
38 38 39 39 if ( bbp_has_forums( $default ) ) : 40 40 echo "<ul>"; 41 while ( bbp_forums () ) : bbp_the_forum();41 while ( bbp_forums() ) : bbp_the_forum(); 42 42 ?> 43 43 44 44 <li><a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?></a></li> … … 101 101 echo $before_widget; 102 102 echo $before_title . $title . $after_title; 103 103 104 if ( ($pop_check < $max_shown)&& bbp_has_topics( $default ) ) :104 if ( $pop_check < $max_shown && bbp_has_topics( $default ) ) : 105 105 echo "<ul>"; 106 while ( bbp_topics () ) : bbp_the_topic();106 while ( bbp_topics() ) : bbp_the_topic(); 107 107 ?> 108 108 <li><a class="bbp-forum-title" href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a><?php if ( $show_date == 'on' ) 109 109 _e( ', ' . bbp_get_topic_last_active() . ' ago' ); ?></li> … … 112 112 echo "</ul>"; 113 113 endif; 114 114 115 if ( ($pop_check >= $max_shown)&& bbp_has_topics( $default ) ) :115 if ( $pop_check >= $max_shown && bbp_has_topics( $default ) ) : 116 116 echo "<ul>"; 117 117 while ( bbp_topics ( ) ) : bbp_the_topic(); 118 118 $topics[bbp_get_topic_id()] = bbp_get_topic_reply_count(); … … 144 144 } 145 145 146 146 function form( $instance ) { 147 $title = esc_attr( $instance['title'] );148 $max_shown = esc_attr( $instance['max_shown'] );149 $show_date = esc_attr( $instance['show_date'] );150 $pop_check = esc_attr( $instance['pop_check'] );147 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 148 $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; 149 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; 150 $pop_check = !empty( $instance['pop_check'] ) ? esc_attr( $instance['pop_check'] ) : ''; 151 151 ?> 152 152 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> 153 153 <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum topics to show:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $max_shown; ?>" /></label></p> … … 191 191 if ( bbp_has_replies( $default ) ) : 192 192 echo "<ul>"; 193 193 194 while ( bbp_replies () ) : bbp_the_reply();194 while ( bbp_replies() ) : bbp_the_reply(); 195 195 ?> 196 196 <li> 197 197 <a class="bbp-forum-title" href="<?php bbp_reply_permalink(); ?>" title="<?php bbp_reply_title(); ?>"><?php bbp_reply_title(); ?></a> … … 229 229 230 230 } 231 231 232 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Forums_Widget");' ) );233 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Topics_Widget");' ) );232 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Forums_Widget");' ) ); 233 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Topics_Widget");' ) ); 234 234 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Replies_Widget");' ) ); 235 235 236 236 ?>