Changeset 4124
- Timestamp:
- 07/26/2012 02:09:59 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-widgets.php
r4121 r4124 527 527 $max_shown = !empty( $instance['max_shown'] ) ? (int) $instance['max_shown'] : 5; 528 528 $show_date = !empty( $instance['show_date'] ) ? 'on' : false; 529 $show_user = !empty( $instance['show_user'] ) ? 'on' : false; 529 530 $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : 'any'; 530 531 $order_by = !empty( $instance['order_by'] ) ? $instance['order_by'] : false; … … 596 597 597 598 $widget_query->the_post(); 598 $topic_id = bbp_get_topic_id( $widget_query->post->ID ); ?> 599 $topic_id = bbp_get_topic_id( $widget_query->post->ID ); 600 $author_link = bbp_get_topic_author_link( array( 'post_id' => $topic_id, 'type' => 'both', 'size' => 14 ) ); ?> 599 601 600 602 <li> 601 603 <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> 604 605 <?php if ( 'on' == $show_user ) : ?> 606 607 <?php printf( _x( 'by %1$s', 'widgets', 'bbpress' ), '<span class="topic-author">' . $author_link . '</span>' ); ?> 608 609 <?php endif; ?> 602 610 603 611 <?php if ( 'on' == $show_date ) : ?> … … 631 639 $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); 632 640 $instance['show_date'] = strip_tags( $new_instance['show_date'] ); 641 $instance['show_user'] = strip_tags( $new_instance['show_user'] ); 633 642 $instance['order_by'] = strip_tags( $new_instance['order_by'] ); 634 643 … … 649 658 $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; 650 659 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; 660 $show_user = !empty( $instance['show_user'] ) ? esc_attr( $instance['show_user'] ) : ''; 651 661 $order_by = !empty( $instance['order_by'] ) ? esc_attr( $instance['order_by'] ) : ''; ?> 652 662 … … 654 664 <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum topics to show:', 'bbpress' ); ?> <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> 655 665 <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $show_date ); ?> /></label></p> 666 <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show topic author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $show_user ); ?> /></label></p> 667 656 668 <p> 657 669 <label for="<?php echo $this->get_field_id( 'order_by' ); ?>"><?php _e( 'Order By:', 'bbpress' ); ?></label> … … 730 742 731 743 $title = apply_filters( 'bbp_replies_widget_title', $instance['title'] ); 732 $max_shown = !empty( $instance['max_shown'] ) ? $instance['max_shown'] : '5'; 733 $show_date = !empty( $instance['show_date'] ) ? 'on' : false; 744 $max_shown = !empty( $instance['max_shown'] ) ? $instance['max_shown'] : '5'; 745 $show_date = !empty( $instance['show_date'] ) ? 'on' : false; 746 $show_user = !empty( $instance['show_user'] ) ? 'on' : false; 734 747 $post_types = !empty( $instance['post_type'] ) ? array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ) : bbp_get_reply_post_type(); 735 748 … … 754 767 755 768 <li> 769 756 770 <?php 757 771 … … 760 774 $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . bbp_get_reply_excerpt( $reply_id, 50 ) . '">' . bbp_get_reply_topic_title( $reply_id ) . '</a>'; 761 775 762 /* translators: bbpress replies widget: 1: reply author, 2: reply link, 3: reply date, 4: reply time */ 763 if ( $show_date == 'on' ) { 764 printf( _x( '%1$s on %2$s %3$s, %4$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . get_the_date(), get_the_time() . '</div>' ); 765 } else { 766 printf( _x( '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link ); 767 } 776 // Reply author, link, and timestamp 777 if ( ( 'on' == $show_date ) && ( 'on' == $show_user ) ) : 778 779 // translators: 1: reply author, 2: reply link, 3: reply timestamp 780 printf( _x( '%1$s on %2$s %3$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' ); 781 782 // Reply link and timestamp 783 elseif ( $show_date == 'on' ) : 784 785 // translators: 1: reply link, 2: reply timestamp 786 printf( _x( '%1$s %2$s', 'widgets', 'bbpress' ), $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' ); 787 788 // Reply author and title 789 elseif ( $show_user == 'on' ) : 790 791 // translators: 1: reply author, 2: reply link 792 printf( _x( '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link ); 793 794 // Only the reply title 795 else : 796 797 // translators: 1: reply link 798 printf( _x( '%1$s', 'widgets', 'bbpress' ), $reply_link ); 799 800 endif; 768 801 769 802 ?> … … 793 826 $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); 794 827 $instance['show_date'] = strip_tags( $new_instance['show_date'] ); 828 $instance['show_user'] = strip_tags( $new_instance['show_user'] ); 795 829 796 830 return $instance; … … 809 843 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 810 844 $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; 811 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; ?> 845 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; 846 $show_user = !empty( $instance['show_user'] ) ? esc_attr( $instance['show_user'] ) : ''; ?> 812 847 813 848 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <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> 814 849 <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies to show:', 'bbpress' ); ?> <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> 815 850 <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $show_date ); ?> /></label></p> 851 <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show reply author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $show_user ); ?> /></label></p> 816 852 817 853 <?php
Note: See TracChangeset
for help on using the changeset viewer.