Skip to:
Content

bbPress.org

Changeset 2716


Ignore:
Timestamp:
12/11/2010 04:58:47 PM (16 years ago)
Author:
johnjamesjacoby
Message:

Fixes #1402 props GautamGupta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-widgets.php

    r2679 r2716  
    3939        if ( bbp_has_forums( $default ) ) :
    4040            echo "<ul>";
    41             while ( bbp_forums ( ) ) : bbp_the_forum();
     41            while ( bbp_forums() ) : bbp_the_forum();
    4242?>
    4343
     
    102102        echo $before_title . $title . $after_title;
    103103
    104         if ( ($pop_check < $max_shown) && bbp_has_topics( $default ) ) :
    105             echo "<ul>";
    106             while ( bbp_topics ( ) ) : bbp_the_topic();
    107 ?>
     104        if ( $pop_check < $max_shown && bbp_has_topics( $default ) ) :
     105            echo "<ul>";
     106            while ( bbp_topics() ) : bbp_the_topic();
     107?>
     108
    108109                <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' )
    109110                    _e( ', ' . bbp_get_topic_last_active() . ' ago' ); ?></li>
     111
    110112<?php
    111113            endwhile;
     
    113115        endif;
    114116
    115         if ( ($pop_check >= $max_shown) && bbp_has_topics( $default ) ) :
     117        if ( $pop_check >= $max_shown && bbp_has_topics( $default ) ) :
    116118            echo "<ul>";
    117119            while ( bbp_topics ( ) ) : bbp_the_topic();
     
    122124            foreach ( $topics as $topic_id => $topic_reply_count ) {
    123125?>
     126
    124127                <li><a class="bbp-forum-title" href="<?php bbp_topic_permalink( $topic_id ); ?>" title="<?php bbp_topic_title( $topic_id ); ?>"><?php bbp_topic_title( $topic_id ); ?></a><?php if ( $show_date == 'on' )
    125128                    _e( ', ' . bbp_get_topic_last_active( $topic_id ) . ' ago' ); ?></li>
     129
    126130<?php
    127131                $topic_count++;
     
    145149
    146150    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'] );
    151 ?>
     151        $title     = !empty( $instance['title'] )     ? esc_attr( $instance['title'] )     : '';
     152        $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : '';
     153        $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
     154        $pop_check = !empty( $instance['pop_check'] ) ? esc_attr( $instance['pop_check'] ) : '';
     155?>
     156
    152157        <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>
    153158        <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>
     
    192197            echo "<ul>";
    193198
    194             while ( bbp_replies ( ) ) : bbp_the_reply();
    195 ?>
     199            while ( bbp_replies() ) : bbp_the_reply();
     200?>
     201
    196202                <li>
    197203                    <a class="bbp-forum-title" href="<?php bbp_reply_permalink(); ?>" title="<?php bbp_reply_title(); ?>"><?php bbp_reply_title(); ?></a>
     
    200206
    201207                </li>
     208
    202209<?php
    203210            endwhile;
     
    221228        $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
    222229?>
     230
    223231        <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>
    224232        <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies 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>
     
    230238}
    231239
    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");' ) );
     240add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Forums_Widget");'  ) );
     241add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Topics_Widget");'  ) );
    234242add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Replies_Widget");' ) );
    235243
Note: See TracChangeset for help on using the changeset viewer.