Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/14/2015 12:46:38 AM (11 years ago)
Author:
johnjamesjacoby
Message:

I think this building should be condemned. There's serious metal fatigue in all the load-bearing members, the wiring is substandard, it's completely inadequate for our power needs, and the neighborhood is like a demilitarized zone.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/functions.php

    r5827 r5829  
    129129
    130130        // Anonymous data checks out, so set cookies, etc...
    131         if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
     131        if ( ! empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
    132132            bbp_set_current_anonymous_user_data( $anonymous_data );
    133133        }
     
    179179
    180180    // Try to use the forum id of the topic
    181     if ( !isset( $_POST['bbp_forum_id'] ) && !empty( $topic_id ) ) {
     181    if ( ! isset( $_POST['bbp_forum_id'] ) && ! empty( $topic_id ) ) {
    182182        $forum_id = bbp_get_topic_forum_id( $topic_id );
    183183
     
    219219
    220220    // Forum exists
    221     if ( !empty( $forum_id ) ) {
     221    if ( ! empty( $forum_id ) ) {
    222222
    223223        // Forum is a category
     
    251251
    252252    // Remove kses filters from title and content for capable users and if the nonce is verified
    253     if ( current_user_can( 'unfiltered_html' ) && !empty( $_POST['_bbp_unfiltered_html_reply'] ) && wp_create_nonce( 'bbp-unfiltered-html-reply_' . $topic_id ) === $_POST['_bbp_unfiltered_html_reply'] ) {
     253    if ( current_user_can( 'unfiltered_html' ) && ! empty( $_POST['_bbp_unfiltered_html_reply'] ) && wp_create_nonce( 'bbp-unfiltered-html-reply_' . $topic_id ) === $_POST['_bbp_unfiltered_html_reply'] ) {
    254254        remove_filter( 'bbp_new_reply_pre_title',   'wp_filter_kses'      );
    255255        remove_filter( 'bbp_new_reply_pre_content', 'bbp_encode_bad',  10 );
     
    259259    /** Reply Title ***********************************************************/
    260260
    261     if ( !empty( $_POST['bbp_reply_title'] ) ) {
     261    if ( ! empty( $_POST['bbp_reply_title'] ) ) {
    262262        $reply_title = sanitize_text_field( $_POST['bbp_reply_title'] );
    263263    }
     
    268268    /** Reply Content *********************************************************/
    269269
    270     if ( !empty( $_POST['bbp_reply_content'] ) ) {
     270    if ( ! empty( $_POST['bbp_reply_content'] ) ) {
    271271        $reply_content = $_POST['bbp_reply_content'];
    272272    }
     
    282282    /** Reply Flooding ********************************************************/
    283283
    284     if ( !bbp_check_for_flood( $anonymous_data, $reply_author ) ) {
     284    if ( ! bbp_check_for_flood( $anonymous_data, $reply_author ) ) {
    285285        bbp_add_error( 'bbp_reply_flood', __( '<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress' ) );
    286286    }
     
    288288    /** Reply Duplicate *******************************************************/
    289289
    290     if ( !bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) ) {
     290    if ( ! bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) ) {
    291291        bbp_add_error( 'bbp_reply_duplicate', __( '<strong>ERROR</strong>: Duplicate reply detected; it looks as though you&#8217;ve already said that!', 'bbpress' ) );
    292292    }
     
    294294    /** Reply Blacklist *******************************************************/
    295295
    296     if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
     296    if ( ! bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    297297        bbp_add_error( 'bbp_reply_blacklist', __( '<strong>ERROR</strong>: Your reply cannot be created at this time.', 'bbpress' ) );
    298298    }
     
    301301
    302302    // Maybe put into moderation
    303     if ( !bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
     303    if ( ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    304304        $reply_status = bbp_get_pending_status_id();
    305305
     
    368368
    369369    // Check for missing reply_id or error
    370     if ( !empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
     370    if ( ! empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
    371371
    372372        /** Topic Tags ********************************************************/
     
    547547
    548548    // Remove kses filters from title and content for capable users and if the nonce is verified
    549     if ( current_user_can( 'unfiltered_html' ) && !empty( $_POST['_bbp_unfiltered_html_reply'] ) && wp_create_nonce( 'bbp-unfiltered-html-reply_' . $reply_id ) === $_POST['_bbp_unfiltered_html_reply'] ) {
     549    if ( current_user_can( 'unfiltered_html' ) && ! empty( $_POST['_bbp_unfiltered_html_reply'] ) && wp_create_nonce( 'bbp-unfiltered-html-reply_' . $reply_id ) === $_POST['_bbp_unfiltered_html_reply'] ) {
    550550        remove_filter( 'bbp_edit_reply_pre_title',   'wp_filter_kses'      );
    551551        remove_filter( 'bbp_edit_reply_pre_content', 'bbp_encode_bad',  10 );
     
    562562
    563563    // Forum exists
    564     if ( !empty( $forum_id ) && ( $forum_id !== bbp_get_reply_forum_id( $reply_id ) ) ) {
     564    if ( ! empty( $forum_id ) && ( $forum_id !== bbp_get_reply_forum_id( $reply_id ) ) ) {
    565565
    566566        // Forum is a category
     
    593593    /** Reply Title ***********************************************************/
    594594
    595     if ( !empty( $_POST['bbp_reply_title'] ) ) {
     595    if ( ! empty( $_POST['bbp_reply_title'] ) ) {
    596596        $reply_title = sanitize_text_field( $_POST['bbp_reply_title'] );
    597597    }
     
    602602    /** Reply Content *********************************************************/
    603603
    604     if ( !empty( $_POST['bbp_reply_content'] ) ) {
     604    if ( ! empty( $_POST['bbp_reply_content'] ) ) {
    605605        $reply_content = $_POST['bbp_reply_content'];
    606606    }
     
    616616    /** Reply Blacklist *******************************************************/
    617617
    618     if ( !bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
     618    if ( ! bbp_check_for_blacklist( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    619619        bbp_add_error( 'bbp_reply_blacklist', __( '<strong>ERROR</strong>: Your reply cannot be edited at this time.', 'bbpress' ) );
    620620    }
     
    623623
    624624    // Maybe put into moderation
    625     if ( !bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
     625    if ( ! bbp_check_for_moderation( $anonymous_data, $reply_author, $reply_title, $reply_content ) ) {
    626626
    627627        // Set post status to pending if public
     
    711711
    712712    // Revision Reason
    713     if ( !empty( $_POST['bbp_reply_edit_reason'] ) ) {
     713    if ( ! empty( $_POST['bbp_reply_edit_reason'] ) ) {
    714714        $reply_edit_reason = sanitize_text_field( $_POST['bbp_reply_edit_reason'] );
    715715    }
    716716
    717717    // Update revision log
    718     if ( !empty( $_POST['bbp_log_reply_edit'] ) && ( "1" === $_POST['bbp_log_reply_edit'] ) ) {
     718    if ( ! empty( $_POST['bbp_log_reply_edit'] ) && ( "1" === $_POST['bbp_log_reply_edit'] ) ) {
    719719        $revision_id = wp_save_post_revision( $reply_id );
    720         if ( !empty( $revision_id ) ) {
     720        if ( ! empty( $revision_id ) ) {
    721721            bbp_update_reply_revision_log( array(
    722722                'reply_id'    => $reply_id,
     
    730730    /** No Errors *************************************************************/
    731731
    732     if ( !empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
     732    if ( ! empty( $reply_id ) && !is_wp_error( $reply_id ) ) {
    733733
    734734        // Update counts, etc...
     
    816816
    817817    // Check forum_id
    818     if ( !empty( $topic_id ) && empty( $forum_id ) ) {
     818    if ( ! empty( $topic_id ) && empty( $forum_id ) ) {
    819819        $forum_id = bbp_get_topic_forum_id( $topic_id );
    820820    }
     
    823823    // It expects anonymous_data to be sanitized.
    824824    // Check bbp_filter_anonymous_post_data() for sanitization.
    825     if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
     825    if ( ! empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
    826826
    827827        // Parse arguments against default values
     
    849849
    850850    // Handle Subscription Checkbox
    851     if ( bbp_is_subscriptions_active() && !empty( $author_id ) && !empty( $topic_id ) ) {
     851    if ( bbp_is_subscriptions_active() && ! empty( $author_id ) && ! empty( $topic_id ) ) {
    852852        $subscribed = bbp_is_user_subscribed( $author_id, $topic_id );
    853         $subscheck  = ( !empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) ) ? true : false;
     853        $subscheck  = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) ) ? true : false;
    854854
    855855        // Subscribed and unsubscribing
     
    922922
    923923    // Reply was passed
    924     if ( !empty( $reply_id ) ) {
     924    if ( ! empty( $reply_id ) ) {
    925925
    926926        // Get the topic ID if none was passed
     
    947947
    948948    // Walk up ancestors
    949     if ( !empty( $ancestors ) ) {
     949    if ( ! empty( $ancestors ) ) {
    950950        foreach ( $ancestors as $ancestor ) {
    951951
     
    10361036
    10371037        // Loop through ancestors
    1038         if ( !empty( $ancestors ) ) {
     1038        if ( ! empty( $ancestors ) ) {
    10391039            foreach ( $ancestors as $ancestor ) {
    10401040
     
    10851085
    10861086        // Loop through ancestors
    1087         if ( !empty( $ancestors ) ) {
     1087        if ( ! empty( $ancestors ) ) {
    10881088            foreach ( $ancestors as $ancestor ) {
    10891089
     
    13111311
    13121312    // How to move
    1313     if ( !empty( $_POST['bbp_reply_move_option'] ) ) {
     1313    if ( ! empty( $_POST['bbp_reply_move_option'] ) ) {
    13141314        $move_option = (string) trim( $_POST['bbp_reply_move_option'] );
    13151315    }
    13161316
    13171317    // Invalid move option
    1318     if ( empty( $move_option ) || !in_array( $move_option, array( 'existing', 'topic' ) ) ) {
     1318    if ( empty( $move_option ) || ! in_array( $move_option, array( 'existing', 'topic' ) ) ) {
    13191319        bbp_add_error( 'bbp_move_reply_option', __( '<strong>ERROR</strong>: You need to choose a valid move option.', 'bbpress' ) );
    13201320
     
    13751375
    13761376                    // Use the new title that was passed
    1377                     if ( !empty( $_POST['bbp_reply_move_destination_title'] ) ) {
     1377                    if ( ! empty( $_POST['bbp_reply_move_destination_title'] ) ) {
    13781378                        $destination_topic_title = sanitize_text_field( $_POST['bbp_reply_move_destination_title'] );
    13791379
     
    15701570
    15711571    // Bail if actions aren't meant for this function
    1572     if ( !in_array( $action, $possible_actions ) ) {
     1572    if ( ! in_array( $action, $possible_actions ) ) {
    15731573        return;
    15741574    }
     
    16021602            $success    = $is_approve ? bbp_approve_reply( $reply_id ) : bbp_unapprove_reply( $reply_id );
    16031603            $failure    = $is_approve ? __( '<strong>ERROR</strong>: There was a problem approving the reply!', 'bbpress' ) : __( '<strong>ERROR</strong>: There was a problem unapproving the reply!', 'bbpress' );
    1604             $view_all   = !$is_approve;
     1604            $view_all   = ! $is_approve;
    16051605
    16061606            break;
     
    16131613            $success  = $is_spam ? bbp_unspam_reply( $reply_id ) : bbp_spam_reply( $reply_id );
    16141614            $failure  = $is_spam ? __( '<strong>ERROR</strong>: There was a problem unmarking the reply as spam!', 'bbpress' ) : __( '<strong>ERROR</strong>: There was a problem marking the reply as spam!', 'bbpress' );
    1615             $view_all = !$is_spam;
     1615            $view_all = ! $is_spam;
    16161616
    16171617            break;
     
    16711671
    16721672        // Add view all if needed
    1673         if ( !empty( $view_all ) ) {
     1673        if ( ! empty( $view_all ) ) {
    16741674            $reply_url = bbp_add_view_all( $reply_url, true );
    16751675        }
     
    19111911    $reply_id = bbp_get_reply_id( $reply_id );
    19121912
    1913     if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     1913    if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    19141914        return false;
    19151915    }
     
    19281928    $reply_id = bbp_get_reply_id( $reply_id );
    19291929
    1930     if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     1930    if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    19311931        return false;
    19321932    }
     
    19451945    $reply_id = bbp_get_reply_id( $reply_id );
    19461946
    1947     if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     1947    if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    19481948        return false;
    19491949    }
     
    19641964    $reply_id = bbp_get_reply_id( $reply_id );
    19651965
    1966     if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     1966    if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    19671967        return false;
    19681968    }
     
    19811981    $reply_id = bbp_get_reply_id( $reply_id );
    19821982
    1983     if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     1983    if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    19841984        return false;
    19851985    }
     
    19981998    $reply_id = bbp_get_reply_id( $reply_id );
    19991999
    2000     if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     2000    if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    20012001        return false;
    20022002    }
     
    21762176
    21772177    // User cannot access forum this topic is in
    2178     if ( bbp_is_single_topic() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) {
     2178    if ( bbp_is_single_topic() && ! bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) {
    21792179        return;
    21802180    }
     
    21832183    if ( bbp_is_single_topic() && bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) {
    21842184        $title = apply_filters( 'wp_title_rss', get_wp_title_rss( ' &#187; ' ) );
    2185     } elseif ( !bbp_show_lead_topic() ) {
     2185    } elseif ( ! bbp_show_lead_topic() ) {
    21862186        $title = ' &#187; ' .  __( 'All Posts',   'bbpress' );
    21872187    } else {
     
    23682368    // Get required data
    23692369    $reply_id       = bbp_get_reply_id( $reply_id );
    2370     $topic_id       = !empty( $topic_id ) ? bbp_get_topic_id( $topic_id ) : bbp_get_reply_topic_id( $reply_id );
     2370    $topic_id       = ! empty( $topic_id ) ? bbp_get_topic_id( $topic_id ) : bbp_get_reply_topic_id( $reply_id );
    23712371    $reply_position = 0;
    23722372
     
    23762376        // Make sure the topic has replies before running another query
    23772377        $reply_count = bbp_get_topic_reply_count( $topic_id, false );
    2378         if ( !empty( $reply_count ) ) {
     2378        if ( ! empty( $reply_count ) ) {
    23792379
    23802380            // Get reply id's
    23812381            $topic_replies = bbp_get_all_child_ids( $topic_id, bbp_get_reply_post_type() );
    2382             if ( !empty( $topic_replies ) ) {
     2382            if ( ! empty( $topic_replies ) ) {
    23832383
    23842384                // Reverse replies array and search for current reply position
Note: See TracChangeset for help on using the changeset viewer.