Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/11/2014 09:54:15 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Breathing room for ! usages in Users component.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/users/template.php

    r5436 r5442  
    4242
    4343        // Easy empty checking
    44         if ( !empty( $user_id ) && is_numeric( $user_id ) ) {
     44        if ( ! empty( $user_id ) && is_numeric( $user_id ) ) {
    4545            $bbp_user_id = $user_id;
    4646
    4747        // Currently viewing or editing a user
    48         } elseif ( ( true === $displayed_user_fallback ) && !empty( $bbp->displayed_user->ID ) ) {
     48        } elseif ( ( true === $displayed_user_fallback ) && ! empty( $bbp->displayed_user->ID ) ) {
    4949            $bbp_user_id = $bbp->displayed_user->ID;
    5050
    5151        // Maybe fallback on the current_user ID
    52         } elseif ( ( true === $current_user_fallback ) && !empty( $bbp->current_user->ID ) ) {
     52        } elseif ( ( true === $current_user_fallback ) && ! empty( $bbp->current_user->ID ) ) {
    5353            $bbp_user_id = $bbp->current_user->ID;
    5454
     
    310310
    311311        // Maybe wrap the nicename
    312         $retval = !empty( $nicename ) ? ( $r['before'] . $nicename . $r['after'] ) : '';
     312        $retval = ! empty( $nicename ) ? ( $r['before'] . $nicename . $r['after'] ) : '';
    313313
    314314        // Filter and return
     
    460460            if ( empty( $user_nicename ) ) {
    461461                $user = get_userdata( $user_id );
    462                 if ( !empty( $user->user_nicename ) ) {
     462                if ( ! empty( $user->user_nicename ) ) {
    463463                    $user_nicename = $user->user_nicename;
    464464                }
     
    554554     */
    555555    function bbp_get_admin_link( $args = '' ) {
    556         if ( !current_user_can( 'moderate' ) ) {
     556        if ( ! current_user_can( 'moderate' ) ) {
    557557            return;
    558558        }
    559559
    560         if ( !empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) {
     560        if ( ! empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) {
    561561            $args = array( 'text' => $args );
    562562        }
     
    610610        // Get the author IP meta value
    611611        $author_ip = get_post_meta( $r['post_id'], '_bbp_author_ip', true );
    612         if ( !empty( $author_ip ) ) {
     612        if ( ! empty( $author_ip ) ) {
    613613            $author_ip = $r['before'] . $author_ip . $r['after'];
    614614
     
    11191119
    11201120            // Initial output is wrapped in a span, ajax output is hooked to this
    1121             if ( !empty( $wrap ) ) {
     1121            if ( ! empty( $wrap ) ) {
    11221122                $html = '<span id="subscription-toggle">' . $html . '</span>';
    11231123            }
     
    11501150
    11511151            // Initial output is wrapped in a span, ajax output is hooked to this
    1152             if ( !empty( $wrap ) ) {
     1152            if ( ! empty( $wrap ) ) {
    11531153                $html = '<span id="subscription-toggle">' . $html . '</span>';
    11541154            }
     
    12151215    $public_display['display_username'] = $bbp->displayed_user->user_login;
    12161216
    1217     if ( !empty( $bbp->displayed_user->nickname ) ) {
     1217    if ( ! empty( $bbp->displayed_user->nickname ) ) {
    12181218        $public_display['display_nickname']  = $bbp->displayed_user->nickname;
    12191219    }
    12201220
    1221     if ( !empty( $bbp->displayed_user->first_name ) ) {
     1221    if ( ! empty( $bbp->displayed_user->first_name ) ) {
    12221222        $public_display['display_firstname'] = $bbp->displayed_user->first_name;
    12231223    }
    12241224
    1225     if ( !empty( $bbp->displayed_user->last_name ) ) {
     1225    if ( ! empty( $bbp->displayed_user->last_name ) ) {
    12261226        $public_display['display_lastname']  = $bbp->displayed_user->last_name;
    12271227    }
    12281228
    1229     if ( !empty( $bbp->displayed_user->first_name ) && !empty( $bbp->displayed_user->last_name ) ) {
     1229    if ( ! empty( $bbp->displayed_user->first_name ) && ! empty( $bbp->displayed_user->last_name ) ) {
    12301230        $public_display['display_firstlast'] = $bbp->displayed_user->first_name . ' ' . $bbp->displayed_user->last_name;
    12311231        $public_display['display_lastfirst'] = $bbp->displayed_user->last_name  . ' ' . $bbp->displayed_user->first_name;
     
    12331233
    12341234    // Only add this if it isn't duplicated elsewhere
    1235     if ( !in_array( $bbp->displayed_user->display_name, $public_display ) ) {
     1235    if ( ! in_array( $bbp->displayed_user->display_name, $public_display ) ) {
    12361236        $public_display = array( 'display_displayname' => $bbp->displayed_user->display_name ) + $public_display;
    12371237    }
     
    14751475
    14761476    // loggedout was passed
    1477     if ( !empty( $_GET['loggedout'] ) && ( true === $_GET['loggedout'] ) ) {
     1477    if ( ! empty( $_GET['loggedout'] ) && ( true === $_GET['loggedout'] ) ) {
    14781478        bbp_add_error( 'loggedout', __( 'You are now logged out.', 'bbpress' ), 'message' );
    14791479
    14801480    // registration is disabled
    1481     } elseif ( !empty( $_GET['registration'] ) && ( 'disabled' === $_GET['registration'] ) ) {
     1481    } elseif ( ! empty( $_GET['registration'] ) && ( 'disabled' === $_GET['registration'] ) ) {
    14821482        bbp_add_error( 'registerdisabled', __( 'New user registration is currently not allowed.', 'bbpress' ) );
    14831483
    14841484    // Prompt user to check their email
    1485     } elseif ( !empty( $_GET['checkemail'] ) && in_array( $_GET['checkemail'], array( 'confirm', 'newpass', 'registered' ) ) ) {
     1485    } elseif ( ! empty( $_GET['checkemail'] ) && in_array( $_GET['checkemail'], array( 'confirm', 'newpass', 'registered' ) ) ) {
    14861486
    14871487        switch ( $_GET['checkemail'] ) {
     
    15221522
    15231523    // Bail if user is not logged in
    1524     if ( !is_user_logged_in() ) {
     1524    if ( ! is_user_logged_in() ) {
    15251525        return;
    15261526    }
    15271527
    15281528    // Setup the profile page to redirect to
    1529     $redirect_to = !empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() );
     1529    $redirect_to = ! empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() );
    15301530
    15311531    // Do a safe redirect and exit
     
    16711671
    16721672        // Neither a reply nor a topic, so could be a revision
    1673         if ( !empty( $r['post_id'] ) ) {
     1673        if ( ! empty( $r['post_id'] ) ) {
    16741674
    16751675            // Generate title with the display name of the author
    16761676            if ( empty( $r['link_title'] ) ) {
    1677                 $r['link_title'] = sprintf( !bbp_is_reply_anonymous( $r['post_id'] ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ), get_the_author_meta( 'display_name', $user_id ) );
     1677                $r['link_title'] = sprintf( ! bbp_is_reply_anonymous( $r['post_id'] ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ), get_the_author_meta( 'display_name', $user_id ) );
    16781678            }
    16791679
    16801680            // Assemble some link bits
    1681             $link_title = !empty( $r['link_title'] ) ? ' title="' . $r['link_title'] . '"' : '';
     1681            $link_title = ! empty( $r['link_title'] ) ? ' title="' . $r['link_title'] . '"' : '';
    16821682            $anonymous  = bbp_is_reply_anonymous( $r['post_id'] );
    16831683
     
    17501750
    17511751    // User is a keymaster
    1752     if ( !empty( $user_id ) && bbp_is_user_keymaster( $user_id ) ) {
     1752    if ( ! empty( $user_id ) && bbp_is_user_keymaster( $user_id ) ) {
    17531753        $retval = true;
    17541754
     
    17931793
    17941794    // Do not allow anonymous if not enabled
    1795     } elseif ( !is_user_logged_in() && bbp_allow_anonymous() ) {
     1795    } elseif ( ! is_user_logged_in() && bbp_allow_anonymous() ) {
    17961796        $retval = true;
    17971797
     
    18591859
    18601860    // Do not allow anonymous if not enabled
    1861     } elseif ( !is_user_logged_in() && bbp_allow_anonymous() ) {
     1861    } elseif ( ! is_user_logged_in() && bbp_allow_anonymous() ) {
    18621862        $retval = true;
    18631863
     
    18961896
    18971897    // Private forums
    1898     if ( !current_user_can( 'read_private_forums' ) ) {
     1898    if ( ! current_user_can( 'read_private_forums' ) ) {
    18991899        $private = bbp_get_private_forum_ids();
    19001900    }
    19011901
    19021902    // Hidden forums
    1903     if ( !current_user_can( 'read_hidden_forums' ) ) {
     1903    if ( ! current_user_can( 'read_hidden_forums' ) ) {
    19041904        $hidden  = bbp_get_hidden_forum_ids();
    19051905    }
     
    19091909
    19101910    // There are forums that need to be ex
    1911     if ( !empty( $forum_ids ) ) {
     1911    if ( ! empty( $forum_ids ) ) {
    19121912        $post__not_in = implode( ',', $forum_ids );
    19131913    }
Note: See TracChangeset for help on using the changeset viewer.