Ticket #1989: 1989-no-whitespace.patch
File 1989-no-whitespace.patch, 5.2 KB (added by , 11 years ago) |
---|
-
includes/replies/template.php
661 661 function bbp_reply_revision_log( $reply_id = 0 ) { 662 662 echo bbp_get_reply_revision_log( $reply_id ); 663 663 } 664 664 665 /** 665 666 * Return the formatted revision log of the reply 666 667 * … … 696 697 return false; 697 698 698 699 // Get the actual revisions 699 $revisions = bbp_get_reply_revisions( $reply_id ); 700 701 $total = $limit = - 1; 702 $order = 'ASC'; 703 704 if ( empty( $_GET['bbp_reply_revisions_all'] ) || intval( $_GET['bbp_reply_revisions_all'] ) != $reply_id ) { 705 $total = bbp_get_reply_revision_count( $reply_id ); 706 $limit = (int) apply_filters( 'bbp_reply_revision_log_limit', 1 ); 707 $order = 'DESC'; 708 } 709 710 $revisions = bbp_get_reply_revisions( $reply_id, $limit, $order ); 711 700 712 if ( empty( $revisions ) ) 701 713 return false; 702 714 … … 726 738 727 739 } 728 740 741 // If there are more revisions to show 742 if ( $total > $limit ) { 743 $topic_id = bbp_get_reply_topic_id( $reply_id ); 744 $link_url = add_query_arg( 'bbp_reply_revisions_all', $reply_id, bbp_get_topic_permalink( $topic_id ) . '/#post-' . $reply_id ); 745 $link_text = esc_html__( sprintf( 'Show %d more', $total - $limit ) ); 746 747 $r .= sprintf( "<li class='bbp-reply-revision-log-more' data-id='%d'><a href='%s'>%s</a></li>", $reply_id, $link_url, $link_text ); 748 } 749 729 750 $r .= "\n" . '</ul>' . "\n\n"; 730 751 731 752 return apply_filters( 'bbp_get_reply_revision_log', $r, $reply_id ); 732 753 } 754 733 755 /** 734 756 * Return the raw revision log of the reply 735 757 * … … 755 777 * 756 778 * @since bbPress (r2782) 757 779 * 758 * @param int $reply_id Optional. Reply id 780 * @param int $reply_id Optional. Topic id 781 * @param int $count Optional. Amout of revisions to grab. 782 * @param string $order Optional. ASC/DESC Order of the results. 783 * 759 784 * @uses bbp_get_reply_id() To get the reply id 760 * @uses wp_get_post_revisions() To get the replyrevisions785 * @uses wp_get_post_revisions() To get the topic revisions 761 786 * @uses apply_filters() Calls 'bbp_get_reply_revisions' 762 787 * with the revisions and reply id 763 * @return string reply revisions 788 * 789 * @return string Reply revisions 764 790 */ 765 function bbp_get_reply_revisions( $reply_id = 0 ) {791 function bbp_get_reply_revisions( $reply_id = 0, $count = -1, $order = 'ASC' ) { 766 792 $reply_id = bbp_get_reply_id( $reply_id ); 767 $revisions = wp_get_post_revisions( $reply_id, array( 'order' => 'ASC') );793 $revisions = wp_get_post_revisions( $reply_id, array( 'order' => $order, 'posts_per_page' => $count ) ); 768 794 769 795 return apply_filters( 'bbp_get_reply_revisions', $revisions, $reply_id ); 770 796 } 771 797 798 772 799 /** 773 800 * Return the revision count of the reply 774 801 * -
includes/topics/template.php
885 885 function bbp_topic_revision_log( $topic_id = 0 ) { 886 886 echo bbp_get_topic_revision_log( $topic_id ); 887 887 } 888 888 889 /** 889 890 * Return the formatted revision log of the topic 890 891 * … … 910 911 if ( empty( $topic_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) 911 912 return false; 912 913 913 $revisions = bbp_get_topic_revisions( $topic_id ); 914 $total = $limit = - 1; 915 $order = 'ASC'; 916 917 if ( empty( $_GET['bbp_topic_revisions_all'] ) || intval( $_GET['bbp_topic_revisions_all'] ) != $topic_id ) { 918 $total = bbp_get_topic_revision_count( $topic_id ); 919 $limit = (int) apply_filters( 'bbp_topic_revision_log_limit', 1 ); 920 $order = 'DESC'; 921 } 922 923 $revisions = bbp_get_topic_revisions( $topic_id, $limit, $order ); 924 914 925 if ( empty( $revisions ) ) 915 926 return false; 916 927 … … 940 951 941 952 } 942 953 954 // If there are more revisions to show 955 if ( $total > $limit ) { 956 $link_url = add_query_arg( 'bbp_topic_revisions_all', $topic_id, bbp_get_topic_permalink( $topic_id ) . '/#post-' . $topic_id ); 957 $link_text = esc_html__( sprintf( 'Show %d more', $total - $limit ) ); 958 959 $r .= sprintf( "<li class='bbp-topic-revision-log-more' data-id='%d'><a href='%s'>%s</a></li>", $topic_id, $link_url, $link_text ); 960 } 961 943 962 $r .= "\n" . '</ul>' . "\n\n"; 944 963 945 964 return apply_filters( 'bbp_get_topic_revision_log', $r, $topic_id ); 946 965 } 966 947 967 /** 948 968 * Return the raw revision log of the topic 949 969 * … … 971 991 * @since bbPress (r2782) 972 992 * 973 993 * @param int $topic_id Optional. Topic id 994 * @param int $count Optional. Amout of revisions to grab. 995 * @param string $order Optional. ASC/DESC Order of the results. 996 * 974 997 * @uses bbp_get_topic_id() To get the topic id 975 998 * @uses wp_get_post_revisions() To get the topic revisions 976 999 * @uses apply_filters() Calls 'bbp_get_topic_revisions' 977 1000 * with the revisions and topic id 1001 * 978 1002 * @return string Topic revisions 979 1003 */ 980 function bbp_get_topic_revisions( $topic_id = 0 ) {1004 function bbp_get_topic_revisions( $topic_id = 0, $count = -1, $order = 'ASC' ) { 981 1005 $topic_id = bbp_get_topic_id( $topic_id ); 982 $revisions = wp_get_post_revisions( $topic_id, array( 'order' => 'ASC') );1006 $revisions = wp_get_post_revisions( $topic_id, array( 'order' => $order, 'posts_per_page' => $count ) ); 983 1007 984 1008 return apply_filters( 'bbp_get_topic_revisions', $revisions, $topic_id ); 985 1009 }