Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/15/2012 05:15:22 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Common:

  • Audit _is_ functions and make sure they return and filter correctly.
  • Add descriptions to phpdoc headers of common files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-common-template.php

    r3901 r3902  
    33/**
    44 * bbPress Common Template Tags
     5 *
     6 * Common template tags are ones that are used by more than one component, like
     7 * forums, topics, replies, users, topic tags, etc...
    58 *
    69 * @package bbPress
     
    293296 */
    294297function bbp_is_topic_tag() {
    295     $bbp = bbpress();
    296298
    297299    // Return false if editing a topic tag
     
    325327    // Check query
    326328    if ( !empty( $wp_query->bbp_is_topic_tag_edit ) && ( true == $wp_query->bbp_is_topic_tag_edit ) )
    327         return true;
     329        $retval = true;
    328330
    329331    // Editing in admin
     
    348350function bbp_is_custom_post_type() {
    349351
    350     // Current post type
    351     $post_type = get_post_type();
    352 
    353     // bbPress post types
    354     $bbp_post_types = array(
     352    // Assume false
     353    $retval = false;
     354
     355    // Viewing one of the bbPress post types
     356    if ( in_array( get_post_type(), array(
    355357        bbp_get_forum_post_type(),
    356358        bbp_get_topic_post_type(),
    357359        bbp_get_reply_post_type()
    358     );
    359 
    360     // Viewing one of the bbPress post types
    361     if ( in_array( $post_type, $bbp_post_types ) )
    362         return true;
    363 
    364     return false;
     360    ) ) )
     361        $retval = true;
     362
     363    return (bool) apply_filters( 'bbp_is_custom_post_type', $retval );
    365364}
    366365
     
    403402    // Check query
    404403    if ( !empty( $wp_query->bbp_is_reply_edit ) && ( true == $wp_query->bbp_is_reply_edit ) )
    405         return true;
     404        $retval = true;
    406405
    407406    // Editing in admin
     
    820819    /** Done ******************************************************************/
    821820
    822     return apply_filters( 'is_bbpress', $retval );
     821    return (bool) apply_filters( 'is_bbpress', $retval );
    823822}
    824823
Note: See TracChangeset for help on using the changeset viewer.