Skip to:
Content

bbPress.org

Changeset 5441


Ignore:
Timestamp:
07/10/2014 03:54:41 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Bracketize extensions, and missed a spot in the admin.

Location:
trunk/src/includes
Files:
7 edited

Legend:

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

    r5440 r5441  
    532532    public function toggle_reply_notice() {
    533533
    534         if ( $this->bail() ) return;
     534        if ( $this->bail() ) {
     535            return;
     536        }
    535537
    536538        // Only proceed if GET is a reply toggle action
  • trunk/src/includes/extend/akismet.php

    r5321 r5441  
    6464
    6565        // Add the checks
    66         foreach ( $checks as $type => $functions )
    67             foreach ( $functions as $function => $priority )
     66        foreach ( $checks as $type => $functions ) {
     67            foreach ( $functions as $function => $priority ) {
    6868                add_filter( $function, array( $this, $type . '_post'  ), $priority );
     69            }
     70        }
    6971
    7072        // Update post meta
     
    103105
    104106        // Post is not published
    105         if ( bbp_get_public_status_id() !== $post_data['post_status'] )
     107        if ( bbp_get_public_status_id() !== $post_data['post_status'] ) {
    106108            return $post_data;
     109        }
    107110
    108111        // Cast the post_author to 0 if it's empty
    109         if ( empty( $post_data['post_author'] ) )
     112        if ( empty( $post_data['post_author'] ) ) {
    110113            $post_data['post_author'] = 0;
     114        }
    111115
    112116        /** Author ************************************************************/
     
    138142
    139143        // Use post parent for permalink
    140         if ( !empty( $post_data['post_parent'] ) )
     144        if ( !empty( $post_data['post_parent'] ) ) {
    141145            $post_permalink = get_permalink( $post_data['post_parent'] );
     146        }
    142147
    143148        // Put post_data back into usable array
     
    256261
    257262        // Bail if get_post() fails
    258         if ( empty( $_post ) )
     263        if ( empty( $_post ) ) {
    259264            return;
     265        }
    260266
    261267        // Bail if we're spamming, but the post_status isn't spam
    262         if ( ( 'spam' === $request_type ) && ( bbp_get_spam_status_id() !== $_post->post_status ) )
     268        if ( ( 'spam' === $request_type ) && ( bbp_get_spam_status_id() !== $_post->post_status ) ) {
    263269            return;
     270        }
    264271
    265272        // Set some default post_data
     
    282289        // Use the original version stored in post_meta if available
    283290        $as_submitted = get_post_meta( $post_id, '_bbp_akismet_as_submitted', true );
    284         if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) )
     291        if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) {
    285292            $post_data = array_merge( $post_data, $as_submitted );
     293        }
    286294
    287295        // Add the reporter IP address
     
    289297
    290298        // Add some reporter info
    291         if ( is_object( $current_user ) )
     299        if ( is_object( $current_user ) ) {
    292300            $post_data['reporter'] = $current_user->user_login;
     301        }
    293302
    294303        // Add the current site domain
    295         if ( is_object( $current_site ) )
     304        if ( is_object( $current_site ) ) {
    296305            $post_data['site_domain'] = $current_site->domain;
     306        }
    297307
    298308        // Place your slide beneath the microscope
     
    434444
    435445        // Ensure we have a post object
    436         if ( empty( $_post ) )
     446        if ( empty( $_post ) ) {
    437447            $_post = get_post( $post_id );
     448        }
    438449
    439450        // Set up Akismet last post data
    440         if ( !empty( $this->last_post ) )
     451        if ( !empty( $this->last_post ) ) {
    441452            $as_submitted = $this->last_post['bbp_post_as_submitted'];
     453        }
    442454
    443455        // wp_insert_post() might be called in other contexts. Ensure this is
     
    587599
    588600        // Save the terms for later in case the reply gets hammed
    589         if ( !empty( $terms ) )
     601        if ( !empty( $terms ) ) {
    590602            update_post_meta( $reply_id, '_bbp_akismet_spam_terms', $terms );
     603        }
    591604
    592605        // Keep the topic tags the same for now
     
    626639
    627640        // Use specific IP (if provided)
    628         if ( !empty( $ip ) && long2ip( ip2long( $ip ) ) )
     641        if ( !empty( $ip ) && long2ip( ip2long( $ip ) ) ) {
    629642            $http_host = $ip;
     643        }
    630644
    631645        // WP HTTP class is available
     
    651665
    652666            // Bail if the response is an error
    653             if ( is_wp_error( $response ) )
     667            if ( is_wp_error( $response ) ) {
    654668                return '';
     669            }
    655670
    656671            // No errors so return response
  • trunk/src/includes/extend/buddypress/activity.php

    r4995 r5441  
    271271
    272272        // Bail if no activity ID is in post meta
    273         if ( empty( $activity_id ) )
     273        if ( empty( $activity_id ) ) {
    274274            return null;
     275        }
    275276
    276277        // Get the activity stream item, bail if it doesn't exist
    277278        $existing = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all', ) );
    278         if ( empty( $existing['total'] ) || ( 1 !== (int) $existing['total'] ) )
     279        if ( empty( $existing['total'] ) || ( 1 !== (int) $existing['total'] ) ) {
    279280            return null;
     281        }
    280282
    281283        // Return the activity ID since we've verified the connection
     
    296298
    297299        // Already forced off, so comply
    298         if ( false === $can_comment )
     300        if ( false === $can_comment ) {
    299301            return $can_comment;
     302        }
    300303
    301304        // Check if blog & forum activity stream commenting is off
     
    383386
    384387        // Bail early if topic is by anonymous user
    385         if ( !empty( $anonymous_data ) )
    386             return;
     388        if ( !empty( $anonymous_data ) ) {
     389            return;
     390        }
    387391
    388392        // Bail if site is private
    389         if ( !bbp_is_site_public() )
    390             return;
     393        if ( !bbp_is_site_public() ) {
     394            return;
     395        }
    391396
    392397        // Validate activity data
     
    396401
    397402        // Bail if user is not active
    398         if ( bbp_is_user_inactive( $user_id ) )
    399             return;
     403        if ( bbp_is_user_inactive( $user_id ) ) {
     404            return;
     405        }
    400406
    401407        // Bail if topic is not published
    402         if ( !bbp_is_topic_published( $topic_id ) )
    403             return;
     408        if ( !bbp_is_topic_published( $topic_id ) ) {
     409            return;
     410        }
    404411
    405412        // User link for topic author
     
    451458
    452459        // Get activity ID, bail if it doesn't exist
    453         if ( $activity_id = $this->get_activity_id( $topic_id ) )
     460        $activity_id = $this->get_activity_id( $topic_id );
     461        if ( !empty( $activity_id ) ) {
    454462            return bp_activity_delete( array( 'id' => $activity_id ) );
     463        }
    455464
    456465        return false;
     
    460469     * Update the activity stream entry when a topic status changes
    461470     *
    462      * @param int $post_id
     471     * @param int $topic_id
    463472     * @param obj $post
    464473     * @uses get_post_type()
     
    475484
    476485        // Bail early if not a topic
    477         if ( get_post_type( $post ) !== bbp_get_topic_post_type() )
    478             return;
     486        if ( get_post_type( $post ) !== bbp_get_topic_post_type() ) {
     487            return;
     488        }
    479489
    480490        $topic_id = bbp_get_topic_id( $topic_id );
    481491
    482492        // Bail early if topic is by anonymous user
    483         if ( bbp_is_topic_anonymous( $topic_id ) )
    484             return;
     493        if ( bbp_is_topic_anonymous( $topic_id ) ) {
     494            return;
     495        }
    485496
    486497        // Action based on new status
     
    524535
    525536        // Do not log activity of anonymous users
    526         if ( !empty( $anonymous_data ) )
    527             return;
     537        if ( !empty( $anonymous_data ) ) {
     538            return;
     539        }
    528540
    529541        // Bail if site is private
    530         if ( !bbp_is_site_public() )
    531             return;
     542        if ( !bbp_is_site_public() ) {
     543            return;
     544        }
    532545
    533546        // Validate activity data
     
    538551
    539552        // Bail if user is not active
    540         if ( bbp_is_user_inactive( $user_id ) )
    541             return;
     553        if ( bbp_is_user_inactive( $user_id ) ) {
     554            return;
     555        }
    542556
    543557        // Bail if reply is not published
    544         if ( !bbp_is_reply_published( $reply_id ) )
    545             return;
     558        if ( !bbp_is_reply_published( $reply_id ) ) {
     559            return;
     560        }
    546561
    547562        // Setup links for activity stream
     
    597612
    598613        // Get activity ID, bail if it doesn't exist
    599         if ( $activity_id = $this->get_activity_id( $reply_id ) )
     614        $activity_id = $this->get_activity_id( $reply_id );
     615        if ( !empty( $activity_id ) ) {
    600616            return bp_activity_delete( array( 'id' => $activity_id ) );
     617        }
    601618
    602619        return false;
     
    606623     * Update the activity stream entry when a reply status changes
    607624     *
    608      * @param int $post_id
     625     * @param int $reply_id
    609626     * @param obj $post
    610627     * @uses get_post_type()
     
    622639
    623640        // Bail early if not a reply
    624         if ( get_post_type( $post ) !== bbp_get_reply_post_type() )
    625             return;
     641        if ( get_post_type( $post ) !== bbp_get_reply_post_type() ) {
     642            return;
     643        }
    626644
    627645        $reply_id = bbp_get_reply_id( $reply_id );
    628646
    629647        // Bail early if reply is by anonymous user
    630         if ( bbp_is_reply_anonymous( $reply_id ) )
    631             return;
     648        if ( bbp_is_reply_anonymous( $reply_id ) ) {
     649            return;
     650        }
    632651
    633652        // Action based on new status
  • trunk/src/includes/extend/buddypress/functions.php

    r5232 r5441  
    5757
    5858    // Easy empty checking
    59     if ( !empty( $user_id ) && is_numeric( $user_id ) )
     59    if ( !empty( $user_id ) && is_numeric( $user_id ) ) {
    6060        $bbp_user_id = $user_id;
     61    }
    6162
    6263    // Currently viewing or editing a user
    63     elseif ( ( true === $displayed_user_fallback ) && !empty( $did ) )
     64    elseif ( ( true === $displayed_user_fallback ) && !empty( $did ) ) {
    6465        $bbp_user_id = $did;
     66    }
    6567
    6668    // Maybe fallback on the current_user ID
    67     elseif ( ( true === $current_user_fallback ) && !empty( $lid ) )
     69    elseif ( ( true === $current_user_fallback ) && !empty( $lid ) ) {
    6870        $bbp_user_id = $lid;
     71    }
    6972
    7073    return $bbp_user_id;
     
    8184 */
    8285function bbp_filter_is_single_user( $is = false ) {
    83     if ( !empty( $is ) )
     86    if ( !empty( $is ) ) {
    8487        return $is;
     88    }
    8589
    8690    return bp_is_user();
     
    97101 */
    98102function bbp_filter_is_user_home( $is = false ) {
    99     if ( !empty( $is ) )
     103    if ( !empty( $is ) ) {
    100104        return $is;
     105    }
    101106
    102107    return bp_is_my_profile();
     
    293298
    294299    // Use current group if none is set
    295     if ( empty( $group_id ) )
     300    if ( empty( $group_id ) ) {
    296301        $group_id = bp_get_current_group_id();
     302    }
    297303
    298304    // Get the forums
    299     if ( !empty( $group_id ) )
     305    if ( !empty( $group_id ) ) {
    300306        $forum_ids = groups_get_groupmeta( $group_id, 'forum_id' );
     307    }
    301308
    302309    // Make sure result is an array
    303     if ( !is_array( $forum_ids ) )
     310    if ( !is_array( $forum_ids ) ) {
    304311        $forum_ids = (array) $forum_ids;
     312    }
    305313
    306314    // Trim out any empty array items
     
    322330
    323331    // Use current group if none is set
    324     if ( empty( $forum_id ) )
     332    if ( empty( $forum_id ) ) {
    325333        $forum_id = bbp_get_forum_id();
     334    }
    326335
    327336    // Get the forums
    328     if ( !empty( $forum_id ) )
     337    if ( !empty( $forum_id ) ) {
    329338        $group_ids = get_post_meta( $forum_id, '_bbp_group_ids', true );
     339    }
    330340
    331341    // Make sure result is an array
    332     if ( !is_array( $group_ids ) )
     342    if ( !is_array( $group_ids ) ) {
    333343        $group_ids = (array) $group_ids;
     344    }
    334345
    335346    // Trim out any empty array items
     
    348359
    349360    // Use current group if none is set
    350     if ( empty( $group_id ) )
     361    if ( empty( $group_id ) ) {
    351362        $group_id = bp_get_current_group_id();
     363    }
    352364
    353365    // Trim out any empties
     
    386398
    387399    // Use current group if none is set
    388     if ( empty( $group_id ) )
     400    if ( empty( $group_id ) ) {
    389401        $group_id = bp_get_current_group_id();
     402    }
    390403
    391404    // Get current group IDs
     
    411424
    412425    // Use current group if none is set
    413     if ( empty( $group_id ) )
     426    if ( empty( $group_id ) ) {
    414427        $group_id = bp_get_current_group_id();
     428    }
    415429
    416430    // Get current group IDs
     
    436450
    437451    // Use current group if none is set
    438     if ( empty( $group_id ) )
     452    if ( empty( $group_id ) ) {
    439453        $group_id = bp_get_current_group_id();
     454    }
    440455
    441456    // Get current group IDs
     
    461476
    462477    // Use current group if none is set
    463     if ( empty( $group_id ) )
     478    if ( empty( $group_id ) ) {
    464479        $group_id = bp_get_current_group_id();
     480    }
    465481
    466482    // Get current group IDs
     
    483499
    484500    // Use current group if none is set
    485     if ( empty( $group_id ) )
     501    if ( empty( $group_id ) ) {
    486502        $group_id = bp_get_current_group_id();
     503    }
    487504
    488505    // Get current group IDs
     
    556573
    557574    // Bail if user is not logged in or not looking at a group
    558     if ( ! is_user_logged_in() || ! bp_is_group() )
     575    if ( ! is_user_logged_in() || ! bp_is_group() ) {
    559576        return false;
     577    }
    560578
    561579    $bbp = bbpress();
    562580
    563581    // Set the global if not set
    564     if ( ! isset( $bbp->current_user->is_group_admin ) )
     582    if ( ! isset( $bbp->current_user->is_group_admin ) ) {
    565583        $bbp->current_user->is_group_admin = groups_is_user_admin( get_current_user_id(), bp_get_current_group_id() );
     584    }
    566585
    567586    // Return the value
     
    585604
    586605    // Bail if user is not logged in or not looking at a group
    587     if ( ! is_user_logged_in() || ! bp_is_group() )
     606    if ( ! is_user_logged_in() || ! bp_is_group() ) {
    588607        return false;
     608    }
    589609
    590610    $bbp = bbpress();
    591611
    592612    // Set the global if not set
    593     if ( ! isset( $bbp->current_user->is_group_mod ) )
     613    if ( ! isset( $bbp->current_user->is_group_mod ) ) {
    594614        $bbp->current_user->is_group_mod = groups_is_user_mod( get_current_user_id(), bp_get_current_group_id() );
     615    }
    595616
    596617    // Return the value
     
    614635
    615636    // Bail if user is not logged in or not looking at a group
    616     if ( ! is_user_logged_in() || ! bp_is_group() )
     637    if ( ! is_user_logged_in() || ! bp_is_group() ) {
    617638        return false;
     639    }
    618640
    619641    $bbp = bbpress();
    620642
    621643    // Set the global if not set
    622     if ( ! isset( $bbp->current_user->is_group_member ) )
     644    if ( ! isset( $bbp->current_user->is_group_member ) ) {
    623645        $bbp->current_user->is_group_member = groups_is_user_member( get_current_user_id(), bp_get_current_group_id() );
     646    }
    624647
    625648    // Return the value
     
    643666
    644667    // Bail if user is not logged in or not looking at a group
    645     if ( ! is_user_logged_in() || ! bp_is_group() )
     668    if ( ! is_user_logged_in() || ! bp_is_group() ) {
    646669        return false;
     670    }
    647671
    648672    $bbp = bbpress();
    649673
    650674    // Set the global if not set
    651     if ( ! isset( $bbp->current_user->is_group_banned ) )
     675    if ( ! isset( $bbp->current_user->is_group_banned ) ) {
    652676        $bbp->current_user->is_group_banned = groups_is_user_banned( get_current_user_id(), bp_get_current_group_id() );
     677    }
    653678
    654679    // Return the value
     
    672697
    673698    // Bail if user is not logged in or not looking at a group
    674     if ( ! is_user_logged_in() || ! bp_is_group() )
     699    if ( ! is_user_logged_in() || ! bp_is_group() ) {
    675700        return false;
     701    }
    676702
    677703    $bbp = bbpress();
    678704
    679705    // Set the global if not set
    680     if ( ! isset( $bbp->current_user->is_group_creator ) )
     706    if ( ! isset( $bbp->current_user->is_group_creator ) ) {
    681707        $bbp->current_user->is_group_creator = groups_is_user_creator( get_current_user_id(), bp_get_current_group_id() );
     708    }
    682709
    683710    // Return the value
  • trunk/src/includes/extend/buddypress/groups.php

    r5416 r5441  
    179179
    180180        // Bail if not viewing a single group
    181         if ( ! bp_is_group() )
     181        if ( ! bp_is_group() ) {
    182182            return;
     183        }
    183184
    184185        // Are forums enabled for this group?
     
    328329
    329330        // Bail if not a POST action
    330         if ( ! bbp_is_post_request() )
     331        if ( ! bbp_is_post_request() ) {
    331332            return;
     333        }
    332334
    333335        // Admin Nonce check
     
    466468
    467469        // Bail if not looking at this screen
    468         if ( !bp_is_group_creation_step( $this->slug ) )
     470        if ( !bp_is_group_creation_step( $this->slug ) ) {
    469471            return false;
     472        }
    470473
    471474        // Check for possibly empty group_id
     
    509512        $forum_ids    = bbp_get_group_forum_ids( $group_id );
    510513
    511         if ( !empty( $forum_ids ) )
     514        if ( !empty( $forum_ids ) ) {
    512515            $forum_id = (int) is_array( $forum_ids ) ? $forum_ids[0] : $forum_ids;
     516        }
    513517
    514518        // Create a forum, or not
     
    517521
    518522                // Bail if initial content was already created
    519                 if ( !empty( $forum_id ) )
     523                if ( !empty( $forum_id ) ) {
    520524                    return;
     525                }
    521526
    522527                // Set the default forum status
     
    605610
    606611        // Bail if no forum_id was passed
    607         if ( empty( $forum_args['forum_id'] ) )
     612        if ( empty( $forum_args['forum_id'] ) ) {
    608613            return;
     614        }
    609615
    610616        // Validate forum_id
     
    631637
    632638        // Bail if no forum_id was passed
    633         if ( empty( $forum_args['forum_id'] ) )
     639        if ( empty( $forum_args['forum_id'] ) ) {
    634640            return;
     641        }
    635642
    636643        // Validate forum_id
     
    662669
    663670        // Use the first forum ID
    664         if ( empty( $forum_ids ) )
     671        if ( empty( $forum_ids ) ) {
    665672            return;
     673        }
    666674
    667675        // Get the first forum ID
     
    689697
    690698        // Bail if group cannot be found
    691         if ( empty( $group ) )
     699        if ( empty( $group ) ) {
    692700            return false;
     701        }
    693702
    694703        // Set forum enabled status
     
    10331042
    10341043        // If this is a group of any kind, empty out the redirect URL
    1035         if ( bp_is_group_admin_screen( $this->slug ) )
     1044        if ( bp_is_group_admin_screen( $this->slug ) ) {
    10361045            $redirect_url = trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/admin/' . $this->slug );
     1046        }
    10371047
    10381048        return $redirect_url;
     
    11321142
    11331143        // if a forum is not enabled, we don't need to add this field
    1134         if ( ! bp_group_is_forum_enabled() )
    1135             return; ?>
     1144        if ( ! bp_group_is_forum_enabled() ) {
     1145            return;
     1146        } ?>
    11361147
    11371148        <input type="hidden" name="group-show-forum" id="group-show-forum" value="1" />
     
    11971208
    11981209        // Bail if the post isn't associated with a group
    1199         if ( empty( $group_ids ) )
     1210        if ( empty( $group_ids ) ) {
    12001211            return $url;
     1212        }
    12011213
    12021214        // @todo Multiple group forums/forum groups
     
    12681280        $new = $this->maybe_map_permalink_to_group( $reply_id );
    12691281
    1270         if ( empty( $new ) )
     1282        if ( empty( $new ) ) {
    12711283            return $url;
     1284        }
    12721285
    12731286        return trailingslashit( $new ) . bbpress()->edit_id  . '/';
     
    13341347        $new = $this->maybe_map_permalink_to_group( bbp_get_forum_id() );
    13351348
    1336         if ( empty( $new ) )
     1349        if ( empty( $new ) ) {
    13371350            return $args;
     1351        }
    13381352
    13391353        global $wp_rewrite;
     
    13571371    public function replies_pagination( $args ) {
    13581372        $new = $this->maybe_map_permalink_to_group( bbp_get_topic_id() );
    1359         if ( empty( $new ) )
     1373        if ( empty( $new ) ) {
    13601374            return $args;
     1375        }
    13611376
    13621377        global $wp_rewrite;
     
    13931408
    13941409        // Bail if not a group forum
    1395         if ( empty( $group_ids ) )
     1410        if ( empty( $group_ids ) ) {
    13961411            return;
     1412        }
    13971413
    13981414        // Use the first group ID
     
    14281444
    14291445        // Not posting from a BuddyPress group? stop now!
    1430         if ( empty( $group ) )
     1446        if ( empty( $group ) ) {
    14311447            return $args;
     1448        }
    14321449
    14331450        // Set the component to 'groups' so the activity item shows up in the group
  • trunk/src/includes/extend/buddypress/loader.php

    r5155 r5441  
    9090
    9191        // Define the parent forum ID
    92         if ( !defined( 'BP_FORUMS_PARENT_FORUM_ID' ) )
     92        if ( !defined( 'BP_FORUMS_PARENT_FORUM_ID' ) ) {
    9393            define( 'BP_FORUMS_PARENT_FORUM_ID', 1 );
     94        }
    9495
    9596        // Define a slug, if necessary
    96         if ( !defined( 'BP_FORUMS_SLUG' ) )
     97        if ( !defined( 'BP_FORUMS_SLUG' ) ) {
    9798            define( 'BP_FORUMS_SLUG', $this->id );
     99        }
    98100
    99101        // All arguments for forums component
     
    165167
    166168        // Stop if there is no user displayed or logged in
    167         if ( !is_user_logged_in() && !bp_displayed_user_id() )
     169        if ( !is_user_logged_in() && !bp_displayed_user_id() ) {
    168170            return;
     171        }
    169172
    170173        // Define local variable(s)
     
    182185
    183186        // Determine user to use
    184         if ( bp_displayed_user_id() )
     187        if ( bp_displayed_user_id() ) {
    185188            $user_domain = bp_displayed_user_domain();
    186         elseif ( bp_loggedin_user_domain() )
     189        } elseif ( bp_loggedin_user_domain() ) {
    187190            $user_domain = bp_loggedin_user_domain();
    188         else
     191        } else {
    189192            return;
     193        }
    190194
    191195        // User link
  • trunk/src/includes/extend/buddypress/members.php

    r4941 r5441  
    159159
    160160        // Special handling for forum component
    161         if ( ! bp_is_my_profile() )
     161        if ( ! bp_is_my_profile() ) {
    162162            return;
     163        }
    163164
    164165        global $wp_query;
Note: See TracChangeset for help on using the changeset viewer.