Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/04/2024 02:30:49 AM (2 years ago)
Author:
espellcaste
Message:

WPCS: Part X: miscellaneous fixes for some of the files of the core component.

Follow-up to [13901]

See #9164 and #7228

File:
1 edited

Legend:

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

    r13878 r13903  
    2626function bp_core_check_for_flood( $user_id = 0 ) {
    2727
     28        $throttle_time = bp_get_option( '_bp_throttle_time' );
     29
    2830        // Option disabled. No flood checks.
    29         if ( !$throttle_time = bp_get_option( '_bp_throttle_time' ) ) {
     31        if ( ! $throttle_time ) {
    3032                return true;
    3133        }
    … …  
    3739
    3840        $last_posted = get_user_meta( $user_id, '_bp_last_posted', true );
    39         if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) ) {
     41        if ( isset( $last_posted ) && ( time() < ( $last_posted + $throttle_time ) ) && ! current_user_can( 'throttle' ) ) {
    4042                return false;
    4143        }
    … …  
    7981        // Define local variable(s).
    8082        $_post   = array();
    81         $matches = '';
     83        $matches = array();
    8284
    8385        /** User Data ************************************************************
    … …  
    119121                        foreach ( $matches[0] as $found_url ) {
    120122                                if ( 0 === strpos( $found_url, home_url() ) ) {
    121                                         $num_links -=1;
     123                                        --$num_links;
    122124                                }
    123125                        }
    … …  
    298300
    299301                // Skip empty lines.
    300                 if ( empty( $word ) ) { continue; }
     302                if ( empty( $word ) ) {
     303                        continue;
     304                }
    301305
    302306                // Do some escaping magic so that '#' chars in the
    … …  
    332336function bp_core_current_user_ip() {
    333337        $retval = '';
     338
    334339        if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
    335340                $retval = preg_replace( '/[^0-9a-fA-F:., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
    … …  
    354359 */
    355360function bp_core_current_user_ua() {
     361        $retval = '';
    356362
    357363        // Sanity check the user agent.
    358364        if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
    359365                $retval = substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 );
    360         } else {
    361                 $retval = '';
    362366        }
    363367
Note: See TracChangeset for help on using the changeset viewer.