Skip to:
Content

bbPress.org

Changeset 5432


Ignore:
Timestamp:
07/09/2014 10:33:59 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Bracketize topics component.

Location:
trunk/src/includes/topics
Files:
2 edited

Legend:

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

    r5412 r5432  
    4646
    4747    // Bail if no topic was added
    48     if ( empty( $topic_id ) )
     48    if ( empty( $topic_id ) ) {
    4949        return false;
     50    }
    5051
    5152    // Parse arguments against default values
     
    115116
    116117    // Bail if action is not bbp-new-topic
    117     if ( 'bbp-new-topic' !== $action )
     118    if ( 'bbp-new-topic' !== $action ) {
    118119        return;
     120    }
    119121
    120122    // Nonce check
     
    165167    /** Topic Title ***********************************************************/
    166168
    167     if ( !empty( $_POST['bbp_topic_title'] ) )
     169    if ( !empty( $_POST['bbp_topic_title'] ) ) {
    168170        $topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) );
     171    }
    169172
    170173    // Filter and sanitize
     
    172175
    173176    // No topic title
    174     if ( empty( $topic_title ) )
     177    if ( empty( $topic_title ) ) {
    175178        bbp_add_error( 'bbp_topic_title', __( '<strong>ERROR</strong>: Your topic needs a title.', 'bbpress' ) );
     179    }
    176180
    177181    /** Topic Content *********************************************************/
    178182
    179     if ( !empty( $_POST['bbp_topic_content'] ) )
     183    if ( !empty( $_POST['bbp_topic_content'] ) ) {
    180184        $topic_content = $_POST['bbp_topic_content'];
     185    }
    181186
    182187    // Filter and sanitize
     
    184189
    185190    // No topic content
    186     if ( empty( $topic_content ) )
     191    if ( empty( $topic_content ) ) {
    187192        bbp_add_error( 'bbp_topic_content', __( '<strong>ERROR</strong>: Your topic cannot be empty.', 'bbpress' ) );
     193    }
    188194
    189195    /** Topic Forum ***********************************************************/
     
    257263    /** Topic Flooding ********************************************************/
    258264
    259     if ( !bbp_check_for_flood( $anonymous_data, $topic_author ) )
     265    if ( !bbp_check_for_flood( $anonymous_data, $topic_author ) ) {
    260266        bbp_add_error( 'bbp_topic_flood', __( '<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress' ) );
     267    }
    261268
    262269    /** Topic Duplicate *******************************************************/
    263270
    264     if ( !bbp_check_for_duplicate( array( 'post_type' => bbp_get_topic_post_type(), 'post_author' => $topic_author, 'post_content' => $topic_content, 'anonymous_data' => $anonymous_data ) ) )
     271    if ( !bbp_check_for_duplicate( array( 'post_type' => bbp_get_topic_post_type(), 'post_author' => $topic_author, 'post_content' => $topic_content, 'anonymous_data' => $anonymous_data ) ) ) {
    265272        bbp_add_error( 'bbp_topic_duplicate', __( '<strong>ERROR</strong>: Duplicate topic detected; it looks as though you&#8217;ve already said that!', 'bbpress' ) );
     273    }
    266274
    267275    /** Topic Blacklist *******************************************************/
    268276
    269     if ( !bbp_check_for_blacklist( $anonymous_data, $topic_author, $topic_title, $topic_content ) )
     277    if ( !bbp_check_for_blacklist( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    270278        bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be created at this time.', 'bbpress' ) );
     279    }
    271280
    272281    /** Topic Status **********************************************************/
     
    306315
    307316    // Bail if errors
    308     if ( bbp_has_errors() )
     317    if ( bbp_has_errors() ) {
    309318        return;
     319    }
    310320
    311321    /** No Errors *************************************************************/
     
    468478
    469479    // Bail if action is not bbp-edit-topic
    470     if ( 'bbp-edit-topic' !== $action )
     480    if ( 'bbp-edit-topic' !== $action ) {
    471481        return;
     482    }
    472483
    473484    // Define local variable(s)
     
    575586    /** Topic Title ***********************************************************/
    576587
    577     if ( !empty( $_POST['bbp_topic_title'] ) )
     588    if ( !empty( $_POST['bbp_topic_title'] ) ) {
    578589        $topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) );
     590    }
    579591
    580592    // Filter and sanitize
     
    582594
    583595    // No topic title
    584     if ( empty( $topic_title ) )
     596    if ( empty( $topic_title ) ) {
    585597        bbp_add_error( 'bbp_edit_topic_title', __( '<strong>ERROR</strong>: Your topic needs a title.', 'bbpress' ) );
     598    }
    586599
    587600    /** Topic Content *********************************************************/
    588601
    589     if ( !empty( $_POST['bbp_topic_content'] ) )
     602    if ( !empty( $_POST['bbp_topic_content'] ) ) {
    590603        $topic_content = $_POST['bbp_topic_content'];
     604    }
    591605
    592606    // Filter and sanitize
     
    594608
    595609    // No topic content
    596     if ( empty( $topic_content ) )
     610    if ( empty( $topic_content ) ) {
    597611        bbp_add_error( 'bbp_edit_topic_content', __( '<strong>ERROR</strong>: Your topic cannot be empty.', 'bbpress' ) );
     612    }
    598613
    599614    /** Topic Blacklist *******************************************************/
    600615
    601     if ( !bbp_check_for_blacklist( $anonymous_data, $topic_author, $topic_title, $topic_content ) )
     616    if ( !bbp_check_for_blacklist( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    602617        bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be edited at this time.', 'bbpress' ) );
     618    }
    603619
    604620    /** Topic Status **********************************************************/
     
    630646
    631647        // Explode by comma
    632         if ( strstr( $terms, ',' ) )
     648        if ( strstr( $terms, ',' ) ) {
    633649            $terms = explode( ',', $terms );
     650        }
    634651
    635652        // Add topic tag ID as main key
     
    650667
    651668    // Bail if errors
    652     if ( bbp_has_errors() )
     669    if ( bbp_has_errors() ) {
    653670        return;
     671    }
    654672
    655673    /** No Errors *************************************************************/
     
    764782
    765783        // Add view all?
    766         if ( !empty( $view_all ) )
     784        if ( !empty( $view_all ) ) {
    767785            $topic_url = bbp_add_view_all( $topic_url );
     786        }
    768787
    769788        // Allow to be filtered
     
    823842
    824843    // Bail if there is no topic
    825     if ( empty( $topic_id ) )
     844    if ( empty( $topic_id ) ) {
    826845        return;
     846    }
    827847
    828848    // Check author_id
    829     if ( empty( $author_id ) )
     849    if ( empty( $author_id ) ) {
    830850        $author_id = bbp_get_current_user_id();
     851    }
    831852
    832853    // Check forum_id
    833     if ( empty( $forum_id ) )
     854    if ( empty( $forum_id ) ) {
    834855        $forum_id = bbp_get_topic_forum_id( $topic_id );
     856    }
    835857
    836858    // If anonymous post, store name, email, website and ip in post_meta.
     
    11321154
    11331155    // Bail if action is not bbp-merge-topic
    1134     if ( 'bbp-merge-topic' !== $action )
     1156    if ( 'bbp-merge-topic' !== $action ) {
    11351157        return;
     1158    }
    11361159
    11371160    // Define local variable(s)
     
    11691192
    11701193    // Topic id
    1171     if ( empty( $_POST['bbp_destination_topic'] ) )
     1194    if ( empty( $_POST['bbp_destination_topic'] ) ) {
    11721195        bbp_add_error( 'bbp_merge_topic_destination_id', __( '<strong>ERROR</strong>: Destination topic ID not found.', 'bbpress' ) );
    1173     else
     1196    } else {
    11741197        $destination_topic_id = (int) $_POST['bbp_destination_topic'];
     1198    }
    11751199
    11761200    // Destination topic not found
    1177     if ( !$destination_topic = bbp_get_topic( $destination_topic_id ) )
     1201    if ( !$destination_topic = bbp_get_topic( $destination_topic_id ) ) {
    11781202        bbp_add_error( 'bbp_merge_topic_destination_not_found', __( '<strong>ERROR</strong>: The topic you want to merge to was not found.', 'bbpress' ) );
     1203    }
    11791204
    11801205    // Cannot edit destination topic
    1181     if ( !current_user_can( 'edit_topic', $destination_topic->ID ) )
     1206    if ( !current_user_can( 'edit_topic', $destination_topic->ID ) ) {
    11821207        bbp_add_error( 'bbp_merge_topic_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the destination topic.', 'bbpress' ) );
     1208    }
    11831209
    11841210    // Bail if errors
    1185     if ( bbp_has_errors() )
     1211    if ( bbp_has_errors() ) {
    11861212        return;
     1213    }
    11871214
    11881215    /** No Errors *************************************************************/
     
    12191246
    12201247            // Shift the subscriber if told to
    1221             if ( !empty( $_POST['bbp_topic_subscribers'] ) && ( "1" === $_POST['bbp_topic_subscribers'] ) && bbp_is_subscriptions_active() )
     1248            if ( !empty( $_POST['bbp_topic_subscribers'] ) && ( "1" === $_POST['bbp_topic_subscribers'] ) && bbp_is_subscriptions_active() ) {
    12221249                bbp_add_user_subscription( $subscriber, $destination_topic->ID );
     1250            }
    12231251
    12241252            // Remove old subscription
     
    12391267
    12401268            // Shift the favoriter if told to
    1241             if ( !empty( $_POST['bbp_topic_favoriters'] ) && "1" === $_POST['bbp_topic_favoriters'] )
     1269            if ( !empty( $_POST['bbp_topic_favoriters'] ) && "1" === $_POST['bbp_topic_favoriters'] ) {
    12421270                bbp_add_user_favorite( $favoriter, $destination_topic->ID );
     1271            }
    12431272
    12441273            // Remove old favorite
     
    12561285
    12571286        // Shift the tags if told to
    1258         if ( !empty( $_POST['bbp_topic_tags'] ) && ( "1" === $_POST['bbp_topic_tags'] ) )
     1287        if ( !empty( $_POST['bbp_topic_tags'] ) && ( "1" === $_POST['bbp_topic_tags'] ) ) {
    12591288            wp_set_post_terms( $destination_topic->ID, $source_topic_tags, bbp_get_topic_tag_tax_id(), true );
     1289        }
    12601290
    12611291        // Delete the tags from the source topic
     
    14201450
    14211451    // Bail if action is not 'bbp-split-topic'
    1422     if ( 'bbp-split-topic' !== $action )
     1452    if ( 'bbp-split-topic' !== $action ) {
    14231453        return;
     1454    }
    14241455
    14251456    global $wpdb;
     
    14331464    /** Split Reply ***********************************************************/
    14341465
    1435     if ( empty( $_POST['bbp_reply_id'] ) )
     1466    if ( empty( $_POST['bbp_reply_id'] ) ) {
    14361467        bbp_add_error( 'bbp_split_topic_reply_id', __( '<strong>ERROR</strong>: Reply ID to split the topic from not found!', 'bbpress' ) );
    1437     else
     1468    } else {
    14381469        $from_reply_id = (int) $_POST['bbp_reply_id'];
     1470    }
    14391471
    14401472    $from_reply = bbp_get_reply( $from_reply_id );
    14411473
    14421474    // Reply exists
    1443     if ( empty( $from_reply ) )
     1475    if ( empty( $from_reply ) ) {
    14441476        bbp_add_error( 'bbp_split_topic_r_not_found', __( '<strong>ERROR</strong>: The reply you want to split from was not found.', 'bbpress' ) );
     1477    }
    14451478
    14461479    /** Topic to Split ********************************************************/
     
    14501483
    14511484    // No topic
    1452     if ( empty( $source_topic ) )
     1485    if ( empty( $source_topic ) ) {
    14531486        bbp_add_error( 'bbp_split_topic_source_not_found', __( '<strong>ERROR</strong>: The topic you want to split was not found.', 'bbpress' ) );
     1487    }
    14541488
    14551489    // Nonce check failed
     
    14601494
    14611495    // Use cannot edit topic
    1462     if ( !current_user_can( 'edit_topic', $source_topic->ID ) )
     1496    if ( !current_user_can( 'edit_topic', $source_topic->ID ) ) {
    14631497        bbp_add_error( 'bbp_split_topic_source_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the source topic.', 'bbpress' ) );
     1498    }
    14641499
    14651500    // How to Split
    1466     if ( !empty( $_POST['bbp_topic_split_option'] ) )
     1501    if ( !empty( $_POST['bbp_topic_split_option'] ) ) {
    14671502        $split_option = (string) trim( $_POST['bbp_topic_split_option'] );
     1503    }
    14681504
    14691505    // Invalid split option
     
    14811517
    14821518                // Get destination topic id
    1483                 if ( empty( $_POST['bbp_destination_topic'] ) )
     1519                if ( empty( $_POST['bbp_destination_topic'] ) ) {
    14841520                    bbp_add_error( 'bbp_split_topic_destination_id', __( '<strong>ERROR</strong>: Destination topic ID not found!', 'bbpress' ) );
    1485                 else
     1521                } else {
    14861522                    $destination_topic_id = (int) $_POST['bbp_destination_topic'];
     1523                }
    14871524
    14881525                // Get the destination topic
     
    14901527
    14911528                // No destination topic
    1492                 if ( empty( $destination_topic ) )
     1529                if ( empty( $destination_topic ) ) {
    14931530                    bbp_add_error( 'bbp_split_topic_destination_not_found', __( '<strong>ERROR</strong>: The topic you want to split to was not found!', 'bbpress' ) );
     1531                }
    14941532
    14951533                // User cannot edit the destination topic
    1496                 if ( !current_user_can( 'edit_topic', $destination_topic->ID ) )
     1534                if ( !current_user_can( 'edit_topic', $destination_topic->ID ) ) {
    14971535                    bbp_add_error( 'bbp_split_topic_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the destination topic!', 'bbpress' ) );
     1536                }
    14981537
    14991538                break;
     
    15451584
    15461585    // Bail if there are errors
    1547     if ( bbp_has_errors() )
     1586    if ( bbp_has_errors() ) {
    15481587        return;
     1588    }
    15491589
    15501590    /** No Errors - Do the Spit ***********************************************/
     
    17871827
    17881828    // Bail if required POST actions aren't passed
    1789     if ( empty( $_POST['tag-id'] ) )
     1829    if ( empty( $_POST['tag-id'] ) ) {
    17901830        return;
     1831    }
    17911832
    17921833    // Setup possible get actions
     
    17981839
    17991840    // Bail if actions aren't meant for this function
    1800     if ( !in_array( $action, $possible_actions ) )
     1841    if ( !in_array( $action, $possible_actions ) ) {
    18011842        return;
     1843    }
    18021844
    18031845    // Setup vars
     
    18761918
    18771919            // If term does not exist, create it
    1878             if ( !$tag = term_exists( $name, bbp_get_topic_tag_tax_id() ) )
     1920            if ( !$tag = term_exists( $name, bbp_get_topic_tag_tax_id() ) ) {
    18791921                $tag = wp_insert_term( $name, bbp_get_topic_tag_tax_id() );
     1922            }
    18801923
    18811924            // Problem inserting the new term
     
    20612104
    20622105    // Bail if required GET actions aren't passed
    2063     if ( empty( $_GET['topic_id'] ) )
     2106    if ( empty( $_GET['topic_id'] ) ) {
    20642107        return;
     2108    }
    20652109
    20662110    // Setup possible get actions
     
    20732117
    20742118    // Bail if actions aren't meant for this function
    2075     if ( !in_array( $action, $possible_actions ) )
     2119    if ( !in_array( $action, $possible_actions ) ) {
    20762120        return;
     2121    }
    20772122
    20782123    $failure   = '';                         // Empty failure string
     
    20852130    // Make sure topic exists
    20862131    $topic = bbp_get_topic( $topic_id );
    2087     if ( empty( $topic ) )
     2132    if ( empty( $topic ) ) {
    20882133        return;
     2134    }
    20892135
    20902136    // What is the user doing here?
     
    21342180            $sub_action = !empty( $_GET['sub_action'] ) && in_array( $_GET['sub_action'], array( 'trash', 'untrash', 'delete' ) ) ? $_GET['sub_action'] : false;
    21352181
    2136             if ( empty( $sub_action ) )
     2182            if ( empty( $sub_action ) ) {
    21372183                break;
     2184            }
    21382185
    21392186            switch ( $sub_action ) {
     
    22122259
    22132260    // Bail if no topic
    2214     if ( empty( $topic_id ) )
     2261    if ( empty( $topic_id ) ) {
    22152262        return;
     2263    }
    22162264
    22172265    // Get users
     
    22442292
    22452293    // Subscriptions are not active
    2246     if ( !bbp_is_subscriptions_active() )
     2294    if ( !bbp_is_subscriptions_active() ) {
    22472295        return;
     2296    }
    22482297
    22492298    $topic_id = bbp_get_topic_id( $topic_id );
    22502299
    22512300    // Bail if no topic
    2252     if ( empty( $topic_id ) )
     2301    if ( empty( $topic_id ) ) {
    22532302        return;
     2303    }
    22542304
    22552305    // Get users
     
    34353485
    34363486    // If return val is empty, set it to default
    3437     if ( empty( $retval ) )
     3487    if ( empty( $retval ) ) {
    34383488        $retval = $default;
     3489    }
    34393490
    34403491    // Filter and return
     
    34583509
    34593510    // If return val is empty, set it to default
    3460     if ( empty( $retval ) )
     3511    if ( empty( $retval ) ) {
    34613512        $retval = $default;
     3513    }
    34623514
    34633515    // Filter and return
     
    35383590
    35393591    // User cannot access this forum
    3540     if ( bbp_is_single_forum() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_forum_id() ) ) )
     3592    if ( bbp_is_single_forum() && !bbp_user_can_view_forum( array( 'forum_id' => bbp_get_forum_id() ) ) ) {
    35413593        return;
     3594    }
    35423595
    35433596    // Display the feed
  • trunk/src/includes/topics/template.php

    r5329 r5432  
    104104
    105105    // Never separate the lead topic in feeds
    106     if ( is_feed() )
     106    if ( is_feed() ) {
    107107        return false;
     108    }
    108109
    109110    return (bool) apply_filters( 'bbp_show_lead_topic', (bool) $show_lead );
     
    205206
    206207    // Set post_parent back to 0 if originally set to 'any'
    207     if ( 'any' === $r['post_parent'] )
     208    if ( 'any' === $r['post_parent'] ) {
    208209        $r['post_parent'] = 0;
     210    }
    209211
    210212    // Limited the number of pages shown
    211     if ( !empty( $r['max_num_pages'] ) )
     213    if ( !empty( $r['max_num_pages'] ) ) {
    212214        $bbp->topic_query->max_num_pages = $r['max_num_pages'];
     215    }
    213216
    214217    /** Stickies **************************************************************/
     
    328331
    329332    // If no limit to posts per page, set it to the current post_count
    330     if ( -1 === $r['posts_per_page'] )
     333    if ( -1 === $r['posts_per_page'] ) {
    331334        $r['posts_per_page'] = $bbp->topic_query->post_count;
     335    }
    332336
    333337    // Add pagination values to query object
     
    339343
    340344        // Limit the number of topics shown based on maximum allowed pages
    341         if ( ( !empty( $r['max_num_pages'] ) ) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count )
     345        if ( ( !empty( $r['max_num_pages'] ) ) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count ) {
    342346            $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
     347        }
    343348
    344349        // If pretty permalinks are enabled, make our pagination pretty
     
    430435
    431436    // Reset the post data when finished
    432     if ( empty( $have_posts ) )
     437    if ( empty( $have_posts ) ) {
    433438        wp_reset_postdata();
     439    }
    434440
    435441    return $have_posts;
     
    531537
    532538    // Use topic ID
    533     if ( empty( $topic ) || is_numeric( $topic ) )
     539    if ( empty( $topic ) || is_numeric( $topic ) ) {
    534540        $topic = bbp_get_topic_id( $topic );
     541    }
    535542
    536543    // Attempt to load the topic
    537544    $topic = get_post( $topic, OBJECT, $filter );
    538     if ( empty( $topic ) )
     545    if ( empty( $topic ) ) {
    539546        return $topic;
     547    }
    540548
    541549    // Bail if post_type is not a topic
    542     if ( $topic->post_type !== bbp_get_topic_post_type() )
     550    if ( $topic->post_type !== bbp_get_topic_post_type() ) {
    543551        return null;
     552    }
    544553
    545554    // Tweak the data type to return
     
    554563        $_topic = array_values( get_object_vars( $topic ) );
    555564        return $_topic;
    556 
    557565    }
    558566
     
    566574 *
    567575 * @param int $topic_id Optional. Topic id
    568  * @param $string $redirect_to Optional. Pass a redirect value for use with
     576 * @param string $redirect_to Optional. Pass a redirect value for use with
    569577 *                              shortcodes and other fun things.
    570578 * @uses bbp_get_topic_permalink() To get the topic permalink
     
    579587     *
    580588     * @param int $topic_id Optional. Topic id
    581      * @param $string $redirect_to Optional. Pass a redirect value for use with
     589     * @param string $redirect_to Optional. Pass a redirect value for use with
    582590     *                              shortcodes and other fun things.
    583591     * @uses bbp_get_topic_id() To get the topic id
     
    708716
    709717        // Check if password is required
    710         if ( post_password_required( $topic_id ) )
     718        if ( post_password_required( $topic_id ) ) {
    711719            return get_the_password_form();
     720        }
    712721
    713722        $content = get_post_field( 'post_content', $topic_id );
     
    876885
    877886        // Bump if topic is in loop
    878         if ( !bbp_show_lead_topic() )
     887        if ( !bbp_show_lead_topic() ) {
    879888            $total++;
     889        }
    880890
    881891        // Pagination settings
     
    924934
    925935    // Bail if in admin or feed
    926     if ( is_admin() || is_feed() )
     936    if ( is_admin() || is_feed() ) {
    927937        return;
     938    }
    928939
    929940    // Validate the ID
     
    966977        $revision_log = bbp_get_topic_raw_revision_log( $topic_id );
    967978
    968         if ( empty( $topic_id ) || empty( $revision_log ) || !is_array( $revision_log ) )
     979        if ( empty( $topic_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) {
    969980            return false;
     981        }
    970982
    971983        $revisions = bbp_get_topic_revisions( $topic_id );
    972         if ( empty( $revisions ) )
     984        if ( empty( $revisions ) ) {
    973985            return false;
     986        }
    974987
    975988        $r = "\n\n" . '<ul id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '" class="bbp-topic-revision-log">' . "\n\n";
     
    11411154    $stickies = bbp_get_stickies( $forum_id );
    11421155
    1143     if ( in_array( $topic_id, $stickies ) || ( !empty( $check_super ) && bbp_is_topic_super_sticky( $topic_id ) ) )
     1156    if ( in_array( $topic_id, $stickies ) || ( !empty( $check_super ) && bbp_is_topic_super_sticky( $topic_id ) ) ) {
    11441157        return true;
     1158    }
    11451159
    11461160    return false;
     
    12281242    $retval   = false;
    12291243
    1230     if ( !bbp_get_topic_author_id( $topic_id ) )
     1244    if ( !bbp_get_topic_author_id( $topic_id ) ) {
    12311245        $retval = true;
    12321246
    1233     elseif ( get_post_meta( $topic_id, '_bbp_anonymous_name',  true ) )
     1247    } elseif ( get_post_meta( $topic_id, '_bbp_anonymous_name',  true ) ) {
    12341248        $retval = true;
    12351249
    1236     elseif ( get_post_meta( $topic_id, '_bbp_anonymous_email', true ) )
     1250    } elseif ( get_post_meta( $topic_id, '_bbp_anonymous_email', true ) ) {
    12371251        $retval = true;
     1252    }
    12381253
    12391254    // The topic is by an anonymous user
     
    13671382
    13681383        // If nothing could be found anywhere, use Anonymous
    1369         if ( empty( $author_name ) )
     1384        if ( empty( $author_name ) ) {
    13701385            $author_name = __( 'Anonymous', 'bbpress' );
     1386        }
    13711387
    13721388        // Encode possible UTF8 display names
    1373         if ( seems_utf8( $author_name ) === false )
     1389        if ( seems_utf8( $author_name ) === false ) {
    13741390            $author_name = utf8_encode( $author_name );
     1391        }
    13751392
    13761393        return apply_filters( 'bbp_get_topic_author_display_name', $author_name, $topic_id );
     
    19301947        $reply_id = get_post_meta( $topic_id, '_bbp_last_reply_id', true );
    19311948
    1932         if ( empty( $reply_id ) )
     1949        if ( empty( $reply_id ) ) {
    19331950            $reply_id = $topic_id;
     1951        }
    19341952
    19351953        return (int) apply_filters( 'bbp_get_topic_last_reply_id', (int) $reply_id, $topic_id );
     
    20612079        $time_since = bbp_get_topic_last_active_time( $topic_id );
    20622080
    2063         if ( !empty( $time_since ) )
     2081        if ( !empty( $time_since ) ) {
    20642082            $anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>';
    2065         else
     2083        } else {
    20662084            $anchor = __( 'No Replies', 'bbpress' );
     2085        }
    20672086
    20682087        return apply_filters( 'bbp_get_topic_freshness_link', $anchor, $topic_id, $time_since, $link_url, $title );
     
    21082127
    21092128        // First link never has view=all
    2110         if ( bbp_get_view_all( 'edit_others_replies' ) )
     2129        if ( bbp_get_view_all( 'edit_others_replies' ) ) {
    21112130            $retval .= "<a href='" . esc_url( bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ) ) . "'>$replies</a>";
    2112         else
     2131        } else {
    21132132            $retval .= $replies;
     2133        }
    21142134
    21152135        // Any deleted replies?
     
    22922312
    22932313        // Bail if topic-tags are off
    2294         if ( ! bbp_allow_topic_tags() )
     2314        if ( ! bbp_allow_topic_tags() ) {
    22952315            return;
     2316        }
    22962317
    22972318        // Parse arguments against default values
     
    25112532
    25122533        // Bail if no uri
    2513         if ( empty( $uri ) )
     2534        if ( empty( $uri ) ) {
    25142535            return;
     2536        }
    25152537
    25162538        $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after'];
     
    25492571
    25502572        $topic = bbp_get_topic( bbp_get_topic_id( $topic_id ) );
    2551         if ( empty( $topic ) )
     2573        if ( empty( $topic ) ) {
    25522574            return;
     2575        }
    25532576
    25542577        // Remove view=all link from edit
     
    26932716        $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    26942717
    2695         if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
     2718        if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
    26962719            return;
     2720        }
    26972721
    26982722        $display = bbp_is_topic_open( $topic->ID ) ? $r['close_text'] : $r['open_text'];
     
    27542778        $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    27552779
    2756         if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
     2780        if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
    27572781            return;
     2782        }
    27582783
    27592784        $is_sticky = bbp_is_topic_sticky( $topic->ID );
     
    28232848        $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    28242849
    2825         if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
     2850        if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
    28262851            return;
     2852        }
    28272853
    28282854        $uri    = add_query_arg( array( 'action' => 'merge' ), bbp_get_topic_edit_url( $topic->ID ) );
     
    28802906        $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    28812907
    2882         if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) )
     2908        if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
    28832909            return;
     2910        }
    28842911
    28852912        $display = bbp_is_topic_spam( $topic->ID ) ? $r['unspam_text'] : $r['spam_text'];
     
    29302957
    29312958        // Bail if no reply or user cannot reply
    2932         if ( empty( $topic ) || ! bbp_current_user_can_access_create_reply_form() )
     2959        if ( empty( $topic ) || ! bbp_current_user_can_access_create_reply_form() ) {
    29332960            return;
     2961        }
    29342962
    29352963        $uri = '#new-post';
     
    29672995        $bbp = bbpress();
    29682996
    2969         if ( empty( $bbp->topic_query ) )
     2997        if ( empty( $bbp->topic_query ) ) {
    29702998            return false;
     2999        }
    29713000
    29723001        // Set pagination values
     
    30113040        $bbp = bbpress();
    30123041
    3013         if ( empty( $bbp->topic_query ) )
     3042        if ( empty( $bbp->topic_query ) ) {
    30143043            return false;
     3044        }
    30153045
    30163046        return apply_filters( 'bbp_get_forum_pagination_links', $bbp->topic_query->pagination_links );
     
    30323062
    30333063    // Bail if not viewing a topic
    3034     if ( !bbp_is_single_topic() )
     3064    if ( !bbp_is_single_topic() ) {
    30353065        return;
     3066    }
    30363067
    30373068    // Get the topic_status
     
    30593090    // Filter notice text and bail if empty
    30603091    $notice_text = apply_filters( 'bbp_topic_notices', $notice_text, $topic_status, bbp_get_topic_id() );
    3061     if ( empty( $notice_text ) )
     3092    if ( empty( $notice_text ) ) {
    30623093        return;
     3094    }
    30633095
    30643096    bbp_add_error( 'topic_notice', $notice_text, 'message' );
     
    31763208 * @since bbPress (r5059)
    31773209 *
    3178  * @param int $topic_id The topic id to use
     3210 * @param $args This function supports these arguments:
     3211 *  - select_id: Select id. Defaults to bbp_open_close_topic
     3212 *  - tab: Tabindex
     3213 *  - topic_id: Topic id
     3214 *  - selected: Override the selected option
    31793215 */
    31803216function bbp_form_topic_status_dropdown( $args = '' ) {
Note: See TracChangeset for help on using the changeset viewer.