Changeset 3192 for branches/plugin/bbp-includes/bbp-general-functions.php
- Timestamp:
- 05/21/2011 09:50:56 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.