Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/21/2015 07:42:11 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Add brackets and whitespace in bp-core-moderation.php, and port recent updates from bbPress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-moderation.php

    r9351 r9392  
    3232
    3333        // Option disabled. No flood checks.
    34         if ( !$throttle_time = bp_get_option( '_bp_throttle_time' ) )
    35                 return true;
     34        if ( !$throttle_time = bp_get_option( '_bp_throttle_time' ) ) {
     35                return true;
     36        }
    3637
    3738        // Bail if no user ID passed
    38         if ( empty( $user_id ) )
     39        if ( empty( $user_id ) ) {
    3940                return false;
     41        }
    4042
    4143        $last_posted = get_user_meta( $user_id, '_bp_last_posted', true );
    42         if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) )
     44        if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) ) {
    4345                return false;
     46        }
    4447
    4548        return true;
    … …  
    6366
    6467        // Bail if super admin is author
    65         if ( is_super_admin( $user_id ) )
    66                 return true;
     68        if ( is_super_admin( $user_id ) ) {
     69                return true;
     70        }
    6771
    6872        // Define local variable(s)
    … …  
    7074        $match_out = '';
    7175
    72         /** Blacklist *************************************************************/
    73 
    74         // Get the moderation keys
    75         $blacklist = trim( get_option( 'moderation_keys' ) );
    76 
    77         // Bail if blacklist is empty
    78         if ( empty( $blacklist ) )
    79                 return true;
    80 
    8176        /** User Data *************************************************************/
    8277
    83         if ( !empty( $user_id ) ) {
     78        if ( ! empty( $user_id ) ) {
    8479
    8580                // Get author data
    … …  
    8782
    8883                // If data exists, map it
    89                 if ( !empty( $user ) ) {
     84                if ( ! empty( $user ) ) {
    9085                        $post['author'] = $user->display_name;
    9186                        $post['email']  = $user->user_email;
    … …  
    105100
    106101        $max_links = get_option( 'comment_max_links' );
    107         if ( !empty( $max_links ) ) {
     102        if ( ! empty( $max_links ) ) {
    108103
    109104                // How many links?
    … …  
    117112                        return false;
    118113                }
     114        }
     115
     116        /** Blacklist *************************************************************/
     117
     118        // Get the moderation keys
     119        $blacklist = trim( get_option( 'moderation_keys' ) );
     120
     121        // Bail if blacklist is empty
     122        if ( empty( $blacklist ) ) {
     123                return true;
    119124        }
    120125
    … …  
    171176
    172177        // Bail if super admin is author
    173         if ( is_super_admin( $user_id ) )
    174                 return true;
     178        if ( is_super_admin( $user_id ) ) {
     179                return true;
     180        }
    175181
    176182        // Define local variable
    177183        $post = array();
    178184
    179         /** Blacklist *************************************************************/
    180 
    181         // Get the moderation keys
    182         $blacklist = trim( get_option( 'blacklist_keys' ) );
    183 
    184         // Bail if blacklist is empty
    185         if ( empty( $blacklist ) )
    186                 return true;
    187 
    188185        /** User Data *************************************************************/
    189186
    190187        // Map current user data
    191         if ( !empty( $user_id ) ) {
     188        if ( ! empty( $user_id ) ) {
    192189
    193190                // Get author data
    … …  
    195192
    196193                // If data exists, map it
    197                 if ( !empty( $user ) ) {
     194                if ( ! empty( $user ) ) {
    198195                        $post['author'] = $user->display_name;
    199196                        $post['email']  = $user->user_email;
    … …  
    210207        $post['content'] = $content;
    211208
     209        /** Blacklist *************************************************************/
     210
     211        // Get the moderation keys
     212        $blacklist = trim( get_option( 'blacklist_keys' ) );
     213
     214        // Bail if blacklist is empty
     215        if ( empty( $blacklist ) ) {
     216                return true;
     217        }
     218
    212219        /** Words *****************************************************************/
    213220
    … …  
    267274
    268275        // Sanity check the user agent
    269         if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) )
     276        if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
    270277                $retval = substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 );
    271         else
     278        } else {
    272279                $retval = '';
     280        }
    273281
    274282        return apply_filters( 'bp_core_current_user_ua', $retval );
Note: See TracChangeset for help on using the changeset viewer.