Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/10/2011 10:27:19 PM (13 years ago)
Author:
johnjamesjacoby
Message:

API adjustments:

  • Refactor _status_ vars into callable functions.
  • Audit usage of $bbp global.
  • Perform get_class() checks on extensions to avoid errors if global $bbp is overloaded.
  • Bump DB version to 175.
File:
1 edited

Legend:

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

    r3501 r3505  
    7070
    7171    // Default status
    72     $default_status = join( ',', array( 'publish', $bbp->closed_status_id ) );
     72    $default_status = join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) );
    7373
    7474    // Skip topic_id if in the replies widget query
     
    8484        // What are the default allowed statuses (based on user caps)
    8585        if ( bbp_get_view_all( 'edit_others_replies' ) ) {
    86             $default_status = join( ',', array( 'publish', $bbp->closed_status_id, $bbp->spam_status_id, 'trash' ) );
     86            $default_status = join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), 'trash' ) );
    8787        }
    8888    }
     
    369369     */
    370370    function bbp_get_reply_url( $reply_id = 0, $redirect_to = '' ) {
    371         global $bbp, $wp_rewrite;
     371        global $wp_rewrite;
    372372
    373373        // Set needed variables
     
    692692    function bbp_get_reply_status( $reply_id = 0 ) {
    693693        $reply_id = bbp_get_reply_id( $reply_id );
    694 
    695694        return apply_filters( 'bbp_get_reply_status', get_post_status( $reply_id ), $reply_id );
    696695    }
     
    707706 */
    708707function bbp_is_reply_published( $reply_id = 0 ) {
    709     global $bbp;
    710 
    711708    $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) );
    712     return apply_filters( 'bbp_is_reply_published', 'publish' == $reply_status, $reply_id );
     709    return apply_filters( 'bbp_is_reply_published', bbp_get_public_status_id() == $reply_status, $reply_id );
    713710}
    714711
     
    724721 */
    725722function bbp_is_reply_spam( $reply_id = 0 ) {
    726     global $bbp;
    727 
    728723    $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) );
    729 
    730     return apply_filters( 'bbp_is_reply_spam', $bbp->spam_status_id == $reply_status, $reply_id );
     724    return apply_filters( 'bbp_is_reply_spam', bbp_get_spam_status_id() == $reply_status, $reply_id );
    731725}
    732726
     
    742736 */
    743737function bbp_is_reply_trash( $reply_id = 0 ) {
    744     global $bbp;
    745 
    746738    $reply_status = bbp_get_reply_status( bbp_get_reply_id( $reply_id ) );
    747 
    748     return apply_filters( 'bbp_is_reply_trash', $bbp->trash_status_id == $reply_status, $reply_id );
     739    return apply_filters( 'bbp_is_reply_trash', bbp_get_trash_status_id() == $reply_status, $reply_id );
    749740}
    750741
     
    13371328     */
    13381329    function bbp_get_reply_admin_links( $args = '' ) {
    1339         global $bbp;
    13401330
    13411331        $defaults = array (
     
    13831373        // See if links need to be unset
    13841374        $reply_status = bbp_get_reply_status( $r['id'] );
    1385         if ( in_array( $reply_status, array( $bbp->spam_status_id, $bbp->trash_status_id ) ) ) {
     1375        if ( in_array( $reply_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id() ) ) ) {
    13861376
    13871377            // Spam link shouldn't be visible on trashed topics
    1388             if ( $reply_status == $bbp->trash_status_id )
     1378            if ( $reply_status == bbp_get_trash_status_id() )
    13891379                unset( $r['links']['spam'] );
    13901380
    13911381            // Trash link shouldn't be visible on spam topics
    1392             elseif ( isset( $r['links']['trash'] ) && $reply_status == $bbp->spam_status_id )
     1382            elseif ( isset( $r['links']['trash'] ) && $reply_status == bbp_get_spam_status_id() )
    13931383                unset( $r['links']['trash'] );
    13941384        }
Note: See TracChangeset for help on using the changeset viewer.