Changeset 5680 for trunk/src/includes/topics/template.php
- Timestamp:
- 04/15/2015 02:14:20 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/topics/template.php (modified) (38 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r5676 r5680 258 258 $sticky_offset++; 259 259 260 $sticky = $bbp->topic_query->posts[ $post_offset];260 $sticky = $bbp->topic_query->posts[ $post_offset ]; 261 261 262 262 // Remove sticky from current position … … 267 267 268 268 // Cleanup 269 unset( $stickies[ $sticky_index] );269 unset( $stickies[ $sticky_index ] ); 270 270 unset( $sticky ); 271 271 } … … 406 406 407 407 // Pagination settings with filter 408 $bbp_topic_pagination = apply_filters( 'bbp_topic_pagination', array (408 $bbp_topic_pagination = apply_filters( 'bbp_topic_pagination', array( 409 409 'base' => $base, 410 410 'format' => '', … … 895 895 } 896 896 897 // Pagination settings898 $pagination =array(897 // Add pagination to query object 898 $pagination_links = paginate_links( array( 899 899 'base' => $base, 900 900 'format' => '', … … 905 905 'end_size' => 3, 906 906 'add_args' => ( bbp_get_view_all() ) ? array( 'view' => 'all' ) : false 907 ); 908 909 // Add pagination to query object 910 $pagination_links = paginate_links( $pagination ); 907 ) ); 908 911 909 if ( ! empty( $pagination_links ) ) { 912 910 … … 979 977 */ 980 978 function bbp_get_topic_revision_log( $topic_id = 0 ) { 979 981 980 // Create necessary variables 982 981 $topic_id = bbp_get_topic_id( $topic_id ); … … 992 991 } 993 992 994 $r = "\n\n" . '<ul id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '" class="bbp-topic-revision-log">' . "\n\n";993 $retval = "\n\n" . '<ul id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '" class="bbp-topic-revision-log">' . "\n\n"; 995 994 996 995 // Loop through revisions 997 996 foreach ( (array) $revisions as $revision ) { 998 997 999 if ( empty( $revision_log[ $revision->ID] ) ) {998 if ( empty( $revision_log[ $revision->ID ] ) ) { 1000 999 $author_id = $revision->post_author; 1001 1000 $reason = ''; 1002 1001 } else { 1003 $author_id = $revision_log[ $revision->ID]['author'];1004 $reason = $revision_log[ $revision->ID]['reason'];1002 $author_id = $revision_log[ $revision->ID ]['author']; 1003 $reason = $revision_log[ $revision->ID ]['reason']; 1005 1004 } 1006 1005 … … 1008 1007 $since = bbp_get_time_since( bbp_convert_date( $revision->post_modified ) ); 1009 1008 1010 $r .= "\t" . '<li id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '-item-' . esc_attr( $revision->ID ) . '" class="bbp-topic-revision-log-item">' . "\n";1009 $retval .= "\t" . '<li id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '-item-' . esc_attr( $revision->ID ) . '" class="bbp-topic-revision-log-item">' . "\n"; 1011 1010 if ( ! empty( $reason ) ) { 1012 $r .= "\t\t" . sprintf( __( 'This topic was modified %1$s by %2$s. Reason: %3$s', 'bbpress' ), esc_html( $since ), $author, esc_html( $reason ) ) . "\n";1011 $retval .= "\t\t" . sprintf( __( 'This topic was modified %1$s by %2$s. Reason: %3$s', 'bbpress' ), esc_html( $since ), $author, esc_html( $reason ) ) . "\n"; 1013 1012 } else { 1014 $r .= "\t\t" . sprintf( __( 'This topic was modified %1$s by %2$s.','bbpress' ), esc_html( $since ), $author ) . "\n";1013 $retval .= "\t\t" . sprintf( __( 'This topic was modified %1$s by %2$s.', 'bbpress' ), esc_html( $since ), $author ) . "\n"; 1015 1014 } 1016 $r .= "\t" . '</li>' . "\n"; 1017 1018 } 1019 1020 $r .= "\n" . '</ul>' . "\n\n"; 1021 1022 return apply_filters( 'bbp_get_topic_revision_log', $r, $topic_id ); 1015 $retval .= "\t" . '</li>' . "\n"; 1016 } 1017 1018 $retval .= "\n" . '</ul>' . "\n\n"; 1019 1020 return apply_filters( 'bbp_get_topic_revision_log', $retval, $topic_id ); 1023 1021 } 1024 1022 /** … … 1159 1157 $forum_id = bbp_get_topic_forum_id( $topic_id ); 1160 1158 $stickies = bbp_get_stickies( $forum_id ); 1161 1162 if ( in_array( $topic_id, $stickies ) || ( ! empty( $check_super ) && bbp_is_topic_super_sticky( $topic_id ) ) ) { 1163 return true; 1164 } 1165 1166 return false; 1159 $retval = in_array( $topic_id, $stickies ); 1160 1161 // Maybe check super stickies 1162 if ( ( false === $retval ) && ( true === $check_super ) ) { 1163 $retval = bbp_is_topic_super_sticky( $topic_id ); 1164 } 1165 1166 return (bool) apply_filters( 'bbp_is_topic_sticky', $retval, $topic_id, $check_super ); 1167 1167 } 1168 1168 … … 1180 1180 $topic_id = bbp_get_topic_id( $topic_id ); 1181 1181 $stickies = bbp_get_super_stickies( $topic_id ); 1182 1183 return in_array( $topic_id, $stickies ); 1182 $retval = in_array( $topic_id, $stickies ); 1183 1184 return (bool) apply_filters( 'bbp_is_topic_super_sticky', $retval, $topic_id ); 1184 1185 } 1185 1186 … … 1196 1197 */ 1197 1198 function bbp_is_topic_published( $topic_id = 0 ) { 1198 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_public_status_id(); 1199 $topic_id = bbp_get_topic_id( $topic_id ); 1200 $status = bbp_get_public_status_id(); 1201 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1202 1199 1203 return (bool) apply_filters( 'bbp_is_topic_published', (bool) $topic_status, $topic_id ); 1200 1204 } … … 1212 1216 */ 1213 1217 function bbp_is_topic_spam( $topic_id = 0 ) { 1214 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_spam_status_id(); 1218 $topic_id = bbp_get_topic_id( $topic_id ); 1219 $status = bbp_get_spam_status_id(); 1220 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1221 1215 1222 return (bool) apply_filters( 'bbp_is_topic_spam', (bool) $topic_status, $topic_id ); 1216 1223 } … … 1228 1235 */ 1229 1236 function bbp_is_topic_trash( $topic_id = 0 ) { 1230 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_trash_status_id(); 1237 $topic_id = bbp_get_topic_id( $topic_id ); 1238 $status = bbp_get_trash_status_id(); 1239 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1240 1231 1241 return (bool) apply_filters( 'bbp_is_topic_trash', (bool) $topic_status, $topic_id ); 1232 1242 } … … 1244 1254 */ 1245 1255 function bbp_is_topic_pending( $topic_id = 0 ) { 1246 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_pending_status_id(); 1256 $topic_id = bbp_get_topic_id( $topic_id ); 1257 $status = bbp_get_pending_status_id(); 1258 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1259 1247 1260 return (bool) apply_filters( 'bbp_is_topic_pending', (bool) $topic_status, $topic_id ); 1248 1261 } … … 1260 1273 */ 1261 1274 function bbp_is_topic_private( $topic_id = 0 ) { 1262 $topic_status = bbp_get_topic_status( bbp_get_topic_id( $topic_id ) ) === bbp_get_private_status_id(); 1275 $topic_id = bbp_get_topic_id( $topic_id ); 1276 $status = bbp_get_private_status_id(); 1277 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1278 1263 1279 return (bool) apply_filters( 'bbp_is_topic_private', (bool) $topic_status, $topic_id ); 1264 1280 } … … 1536 1552 // Tweak link title if empty 1537 1553 if ( empty( $r['link_title'] ) ) { 1538 $link_title = sprintf( empty( $anonymous ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ), bbp_get_topic_author_display_name( $topic_id ) ); 1554 $title = empty( $anonymous ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ); 1555 $author = bbp_get_topic_author_display_name( $topic_id ); 1556 $link_title = sprintf( $title, $author ); 1539 1557 1540 1558 // Use what was passed if not … … 1721 1739 ), 'get_topic_author_role' ); 1722 1740 1723 $topic_id = bbp_get_topic_id( $r['topic_id'] );1724 $role = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) );1741 $topic_id = bbp_get_topic_id( $r['topic_id'] ); 1742 $role = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) ); 1725 1743 1726 1744 // Backwards compatibilty with old 'class' argument … … 1910 1928 'before' => ' | ', 1911 1929 'after' => '', 1912 'subscribe' => __( 'Subscribe', 'bbpress' ),1913 'unsubscribe' => __( 'Unsubscribe', 'bbpress' )1914 ), 'get_ forum_subscribe_link' );1930 'subscribe' => esc_html__( 'Subscribe', 'bbpress' ), 1931 'unsubscribe' => esc_html__( 'Unsubscribe', 'bbpress' ) 1932 ), 'get_topic_subscribe_link' ); 1915 1933 1916 1934 // Get the link 1917 1935 $retval = bbp_get_user_subscribe_link( $r ); 1918 1936 1919 return apply_filters( 'bbp_get_topic_subscribe_link', $retval, $r );1937 return apply_filters( 'bbp_get_topic_subscribe_link', $retval, $r, $args ); 1920 1938 } 1921 1939 … … 1955 1973 'before' => '', 1956 1974 'after' => '', 1957 'favorite' => __( 'Favorite', 'bbpress' ),1958 'favorited' => __( 'Unfavorite', 'bbpress' )1959 ), 'get_ forum_favorite_link' );1975 'favorite' => esc_html__( 'Favorite', 'bbpress' ), 1976 'favorited' => esc_html__( 'Unfavorite', 'bbpress' ) 1977 ), 'get_topic_favorite_link' ); 1960 1978 1961 1979 // Get the link 1962 1980 $retval = bbp_get_user_favorites_link( $r ); 1963 1981 1964 return apply_filters( 'bbp_get_topic_favorite_link', $retval, $r );1982 return apply_filters( 'bbp_get_topic_favorite_link', $retval, $r, $args ); 1965 1983 } 1966 1984 … … 2023 2041 function bbp_get_topic_last_reply_title( $topic_id = 0 ) { 2024 2042 $topic_id = bbp_get_topic_id( $topic_id ); 2025 return apply_filters( 'bbp_get_topic_last_topic_title', bbp_get_reply_title( bbp_get_topic_last_reply_id( $topic_id ) ), $topic_id ); 2043 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 2044 $retval = bbp_get_reply_title( $reply_id ); 2045 2046 return apply_filters( 'bbp_get_topic_last_topic_title', $retval, $topic_id, $reply_id ); 2026 2047 } 2027 2048 … … 2052 2073 function bbp_get_topic_last_reply_permalink( $topic_id = 0 ) { 2053 2074 $topic_id = bbp_get_topic_id( $topic_id ); 2054 return apply_filters( 'bbp_get_topic_last_reply_permalink', bbp_get_reply_permalink( bbp_get_topic_last_reply_id( $topic_id ) ) ); 2075 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 2076 $retval = bbp_get_reply_permalink( $reply_id ); 2077 2078 return apply_filters( 'bbp_get_topic_last_reply_permalink', $retval, $topic_id, $reply_id ); 2055 2079 } 2056 2080 … … 2090 2114 } 2091 2115 2092 return apply_filters( 'bbp_get_topic_last_reply_url', $reply_url );2116 return apply_filters( 'bbp_get_topic_last_reply_url', $reply_url, $topic_id, $reply_id ); 2093 2117 } 2094 2118 … … 2129 2153 $anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>'; 2130 2154 } else { 2131 $anchor = __( 'No Replies', 'bbpress' );2155 $anchor = esc_html__( 'No Replies', 'bbpress' ); 2132 2156 } 2133 2157 … … 2187 2211 2188 2212 // Extra text 2189 $extra = sprintf( __( ' (+ %d hidden)', 'bbpress' ), $deleted );2213 $extra = sprintf( esc_html__( ' (+ %d hidden)', 'bbpress' ), $deleted ); 2190 2214 2191 2215 // No link … … 2479 2503 2480 2504 // Parse arguments against default values 2481 $r = bbp_parse_args( $args, array (2505 $r = bbp_parse_args( $args, array( 2482 2506 'id' => bbp_get_topic_id(), 2483 2507 'before' => '<span class="bbp-admin-links">', … … 2758 2782 'link_after' => '', 2759 2783 'sep' => ' | ', 2760 'close_text' => _x( 'Close', 'Topic Status', 'bbpress' ),2761 'open_text' => _x( 'Open', 'Topic Status', 'bbpress' )2784 'close_text' => esc_html_x( 'Close', 'Topic Status', 'bbpress' ), 2785 'open_text' => esc_html_x( 'Open', 'Topic Status', 'bbpress' ) 2762 2786 ), 'get_topic_close_link' ); 2763 2787 … … 2819 2843 'link_after' => '', 2820 2844 'sep' => ' | ', 2821 'approve_text' => _x( 'Approve', 'Pending Status', 'bbpress' ),2822 'unapprove_text' => _x( 'Unapprove', 'Pending Status', 'bbpress' )2845 'approve_text' => esc_html_x( 'Approve', 'Pending Status', 'bbpress' ), 2846 'unapprove_text' => esc_html_x( 'Unapprove', 'Pending Status', 'bbpress' ) 2823 2847 ), 'get_topic_approve_link' ); 2824 2848 … … 3089 3113 */ 3090 3114 function bbp_forum_pagination_count() { 3091 echo bbp_get_forum_pagination_count();3115 echo esc_html( bbp_get_forum_pagination_count() ); 3092 3116 } 3093 3117 /** … … 3125 3149 3126 3150 // Filter and return 3127 return apply_filters( 'bbp_get_forum_pagination_count', esc_html( $retstr ));3151 return apply_filters( 'bbp_get_forum_pagination_count', $retstr ); 3128 3152 } 3129 3153 … … 3309 3333 3310 3334 // Return the results 3311 return apply_filters( 'bbp_get_form_topic_type_dropdown', ob_get_clean(), $r );3335 return apply_filters( 'bbp_get_form_topic_type_dropdown', ob_get_clean(), $r, $args ); 3312 3336 } 3313 3337 … … 3392 3416 3393 3417 // Return the results 3394 return apply_filters( 'bbp_get_form_topic_status_dropdown', ob_get_clean(), $r );3418 return apply_filters( 'bbp_get_form_topic_status_dropdown', ob_get_clean(), $r, $args ); 3395 3419 } 3396 3420 … … 3477 3501 3478 3502 // Return filtered result 3479 return apply_filters( 'bbp_get_single_topic_description', $retstr, $r );3503 return apply_filters( 'bbp_get_single_topic_description', $retstr, $r, $args ); 3480 3504 } 3481 3505 … … 3582 3606 } 3583 3607 3584 return (int) apply_filters( 'bbp_get_topic_tag_id', (int) $retval, $tag );3608 return (int) apply_filters( 'bbp_get_topic_tag_id', (int) $retval, $tag, $term ); 3585 3609 } 3586 3610 … … 3626 3650 } 3627 3651 3628 return apply_filters( 'bbp_get_topic_tag_name', $retval );3652 return apply_filters( 'bbp_get_topic_tag_name', $retval, $tag, $term ); 3629 3653 } 3630 3654 … … 3670 3694 } 3671 3695 3672 return apply_filters( 'bbp_get_topic_tag_slug', $retval );3696 return apply_filters( 'bbp_get_topic_tag_slug', $retval, $tag, $term ); 3673 3697 } 3674 3698 … … 3714 3738 } 3715 3739 3716 return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag );3740 return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag, $term ); 3717 3741 } 3718 3742 … … 3767 3791 } 3768 3792 3769 return apply_filters( 'bbp_get_topic_tag_edit_link', $retval, $tag );3793 return apply_filters( 'bbp_get_topic_tag_edit_link', $retval, $tag, $term ); 3770 3794 } 3771 3795 … … 3820 3844 } 3821 3845 3822 return apply_filters( 'bbp_get_topic_tag_description', $retval, $r );3846 return apply_filters( 'bbp_get_topic_tag_description', $retval, $r, $args, $tag, $term ); 3823 3847 } 3824 3848
Note: See TracChangeset
for help on using the changeset viewer.