Changeset 3192
- Timestamp:
- 05/21/2011 09:50:56 AM (15 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 2 edited
-
bbp-core-compatibility.php (modified) (1 diff)
-
bbp-general-functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3190 r3192 800 800 } 801 801 802 /** Helpers *******************************************************************/ 803 804 /** 805 * Remove the canonical redirect to allow pretty pagination 806 * 807 * @since bbPress (r2628) 808 * 809 * @param string $redirect_url Redirect url 810 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks 811 * @uses bbp_is_topic() To check if it's a topic page 812 * @uses bbp_get_paged() To get the current page number 813 * @uses bbp_is_forum() To check if it's a forum page 814 * @return bool|string False if it's a topic/forum and their first page, 815 * otherwise the redirect url 816 */ 817 function bbp_redirect_canonical( $redirect_url ) { 818 global $wp_rewrite; 819 820 if ( $wp_rewrite->using_permalinks() ) { 821 if ( bbp_is_topic() && 1 < bbp_get_paged() ) 822 $redirect_url = false; 823 elseif ( bbp_is_forum() && 1 < bbp_get_paged() ) 824 $redirect_url = false; 825 } 826 827 return $redirect_url; 828 } 829 830 /** 831 * Sets the 404 status. 832 * 833 * Used primarily with topics/replies inside hidden forums. 834 * 835 * @since bbPress (r3051) 836 * 837 * @global WP_Query $wp_query 838 * @uses WP_Query::set_404() 839 */ 840 function bbp_set_404() { 841 global $wp_query; 842 843 if ( ! isset( $wp_query ) ) { 844 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' ); 845 return false; 846 } 847 848 $wp_query->set_404(); 849 } 850 851 802 852 ?> -
branches/plugin/bbp-includes/bbp-general-functions.php
r3181 r3192 78 78 */ 79 79 function bbp_number_format( $number, $decimals = false ) { 80 80 81 // If empty, set $number to '0' 81 82 if ( empty( $number ) || !is_numeric( $number ) ) … … 158 159 159 160 // We add our own full stop. 160 while ( substr( $reason, -1 ) == '.' ) {161 while ( substr( $reason, -1 ) == '.' ) 161 162 $reason = substr( $reason, 0, -1 ); 162 }163 163 164 164 // Trim again … … 182 182 function bbp_show_lead_topic( $show_lead = false ) { 183 183 return apply_filters( 'bbp_show_lead_topic', (bool) $show_lead ); 184 }185 186 /**187 * Remove the canonical redirect to allow pretty pagination188 *189 * @since bbPress (r2628)190 *191 * @param string $redirect_url Redirect url192 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks193 * @uses bbp_is_topic() To check if it's a topic page194 * @uses bbp_get_paged() To get the current page number195 * @uses bbp_is_forum() To check if it's a forum page196 * @return bool|string False if it's a topic/forum and their first page,197 * otherwise the redirect url198 */199 function bbp_redirect_canonical( $redirect_url ) {200 global $wp_rewrite;201 202 if ( $wp_rewrite->using_permalinks() ) {203 if ( bbp_is_topic() && 1 < bbp_get_paged() )204 $redirect_url = false;205 elseif ( bbp_is_forum() && 1 < bbp_get_paged() )206 $redirect_url = false;207 }208 209 return $redirect_url;210 }211 212 /**213 * Sets the 404 status.214 *215 * Used primarily with topics/replies inside hidden forums.216 *217 * @since bbPress (r3051)218 *219 * @global WP_Query $wp_query220 * @uses WP_Query::set_404()221 */222 function bbp_set_404() {223 global $wp_query;224 225 if ( ! isset( $wp_query ) ) {226 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );227 return false;228 }229 230 $wp_query->set_404();231 184 } 232 185
Note: See TracChangeset
for help on using the changeset viewer.