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-admin/bbp-topics.php

    r3376 r3505  
    721721     */
    722722    function topics_row_actions( $actions, $topic ) {
    723         global $bbp;
    724723
    725724        if ( $topic->post_type == $this->post_type ) {
     
    735734                // Close
    736735                // Show the 'close' and 'open' link on published and closed posts only
    737                 if ( in_array( $topic->post_status, array( 'publish', $bbp->closed_status_id ) ) ) {
     736                if ( in_array( $topic->post_status, array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ) ) {
    738737                    $close_uri = esc_url( wp_nonce_url( add_query_arg( array( 'topic_id' => $topic->ID, 'action' => 'bbp_toggle_topic_close' ), remove_query_arg( array( 'bbp_topic_toggle_notice', 'topic_id', 'failed', 'super' ) ) ), 'close-topic_' . $topic->ID ) );
    739738                    if ( bbp_is_topic_open( $topic->ID ) )
     
    767766            // Do not show trash links for spam topics, or spam links for trashed topics
    768767            if ( current_user_can( 'delete_topic', $topic->ID ) ) {
    769                 if ( $bbp->trash_status_id == $topic->post_status ) {
     768                if ( bbp_get_trash_status_id() == $topic->post_status ) {
    770769                    $post_type_object   = get_post_type_object( bbp_get_topic_post_type() );
    771770                    $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash', 'bbpress' ) ) . "' href='" . wp_nonce_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $topic->ID ) ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) . "'>" . __( 'Restore', 'bbpress' ) . "</a>";
     
    774773                }
    775774
    776                 if ( $bbp->trash_status_id == $topic->post_status || !EMPTY_TRASH_DAYS ) {
     775                if ( bbp_get_trash_status_id() == $topic->post_status || !EMPTY_TRASH_DAYS ) {
    777776                    $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently', 'bbpress' ) ) . "' href='" . add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_topic_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $topic->ID, '', true ) ) . "'>" . __( 'Delete Permanently', 'bbpress' ) . "</a>";
    778                 } elseif ( $bbp->spam_status_id == $topic->post_status ) {
     777                } elseif ( bbp_get_spam_status_id() == $topic->post_status ) {
    779778                    unset( $actions['trash'] );
    780779                }
     
    949948    global $bbp;
    950949
     950    // Bail if bbPress is not loaded
     951    if ( 'bbPress' !== get_class( $bbp ) ) return;
     952
    951953    $bbp->admin->topics = new BBP_Topics_Admin();
    952954}
Note: See TracChangeset for help on using the changeset viewer.