Skip to:
Content

bbPress.org

Changeset 5443


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

Breathing room for ! usages in Topics component.

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

Legend:

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

    r5079 r5443  
    7979                                // Get the post
    8080                                $_post = get_post( $args[0] );
    81                                 if ( !empty( $_post ) ) {
     81                                if ( ! empty( $_post ) ) {
    8282
    8383                                        // Get caps for post type object
    … …  
    134134                        // Get the post
    135135                        $_post = get_post( $args[0] );
    136                         if ( !empty( $_post ) ) {
     136                        if ( ! empty( $_post ) ) {
    137137
    138138                                // Get caps for post type object
    … …  
    145145
    146146                                // User is author so allow edit if not in admin
    147                                 } elseif ( !is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
     147                                } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
    148148                                        $caps[] = $post_type->cap->edit_posts;
    149149
    … …  
    162162                        // Get the post
    163163                        $_post = get_post( $args[0] );
    164                         if ( !empty( $_post ) ) {
     164                        if ( ! empty( $_post ) ) {
    165165
    166166                                // Get caps for post type object
  • trunk/src/includes/topics/functions.php

    r5432 r5443  
    7070        // Update the forum
    7171        $forum_id = bbp_get_topic_forum_id( $topic_id );
    72         if ( !empty( $forum_id ) ) {
     72        if ( ! empty( $forum_id ) ) {
    7373                bbp_update_forum( array( 'forum_id' => $forum_id ) );
    7474        }
    … …  
    141141
    142142                // Anonymous data checks out, so set cookies, etc...
    143                 if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
     143                if ( ! empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
    144144                        bbp_set_current_anonymous_user_data( $anonymous_data );
    145145                }
    … …  
    149149
    150150                // User cannot create topics
    151                 if ( !current_user_can( 'publish_topics' ) ) {
     151                if ( ! current_user_can( 'publish_topics' ) ) {
    152152                        bbp_add_error( 'bbp_topic_permissions', __( '<strong>ERROR</strong>: You do not have permission to create new topics.', 'bbpress' ) );
    153153                        return;
    … …  
    159159
    160160        // Remove kses filters from title and content for capable users and if the nonce is verified
    161         if ( current_user_can( 'unfiltered_html' ) && !empty( $_POST['_bbp_unfiltered_html_topic'] ) && wp_create_nonce( 'bbp-unfiltered-html-topic_new' ) === $_POST['_bbp_unfiltered_html_topic'] ) {
     161        if ( current_user_can( 'unfiltered_html' ) && ! empty( $_POST['_bbp_unfiltered_html_topic'] ) && wp_create_nonce( 'bbp-unfiltered-html-topic_new' ) === $_POST['_bbp_unfiltered_html_topic'] ) {
    162162                remove_filter( 'bbp_new_topic_pre_title',   'wp_filter_kses'      );
    163163                remove_filter( 'bbp_new_topic_pre_content', 'bbp_encode_bad',  10 );
    … …  
    167167        /** Topic Title ***********************************************************/
    168168
    169         if ( !empty( $_POST['bbp_topic_title'] ) ) {
     169        if ( ! empty( $_POST['bbp_topic_title'] ) ) {
    170170                $topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) );
    171171        }
    … …  
    181181        /** Topic Content *********************************************************/
    182182
    183         if ( !empty( $_POST['bbp_topic_content'] ) ) {
     183        if ( ! empty( $_POST['bbp_topic_content'] ) ) {
    184184                $topic_content = $_POST['bbp_topic_content'];
    185185        }
    … …  
    232232
    233233        // Forum exists
    234         if ( !empty( $forum_id ) ) {
     234        if ( ! empty( $forum_id ) ) {
    235235
    236236                // Forum is a category
    … …  
    242242
    243243                        // Forum is closed and user cannot access
    244                         if ( bbp_is_forum_closed( $forum_id ) && !current_user_can( 'edit_forum', $forum_id ) ) {
     244                        if ( bbp_is_forum_closed( $forum_id ) && ! current_user_can( 'edit_forum', $forum_id ) ) {
    245245                                bbp_add_error( 'bbp_new_topic_forum_closed', __( '<strong>ERROR</strong>: This forum has been closed to new topics.', 'bbpress' ) );
    246246                        }
    … …  
    248248                        // Forum is private and user cannot access
    249249                        if ( bbp_is_forum_private( $forum_id ) ) {
    250                                 if ( !current_user_can( 'read_private_forums' ) ) {
     250                                if ( ! current_user_can( 'read_private_forums' ) ) {
    251251                                        bbp_add_error( 'bbp_new_topic_forum_private', __( '<strong>ERROR</strong>: This forum is private and you do not have the capability to read or create new topics in it.', 'bbpress' ) );
    252252                                }
    … …  
    254254                        // Forum is hidden and user cannot access
    255255                        } elseif ( bbp_is_forum_hidden( $forum_id ) ) {
    256                                 if ( !current_user_can( 'read_hidden_forums' ) ) {
     256                                if ( ! current_user_can( 'read_hidden_forums' ) ) {
    257257                                        bbp_add_error( 'bbp_new_topic_forum_hidden', __( '<strong>ERROR</strong>: This forum is hidden and you do not have the capability to read or create new topics in it.', 'bbpress' ) );
    258258                                }
    … …  
    263263        /** Topic Flooding ********************************************************/
    264264
    265         if ( !bbp_check_for_flood( $anonymous_data, $topic_author ) ) {
     265        if ( ! bbp_check_for_flood( $anonymous_data, $topic_author ) ) {
    266266                bbp_add_error( 'bbp_topic_flood', __( '<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress' ) );
    267267        }
    … …  
    269269        /** Topic Duplicate *******************************************************/
    270270
    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 ) ) ) {
     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 ) ) ) {
    272272                bbp_add_error( 'bbp_topic_duplicate', __( '<strong>ERROR</strong>: Duplicate topic detected; it looks as though you&#8217;ve already said that!', 'bbpress' ) );
    273273        }
    … …  
    275275        /** Topic Blacklist *******************************************************/
    276276
    277         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 ) ) {
    278278                bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be created at this time.', 'bbpress' ) );
    279279        }
    … …  
    282282
    283283        // Maybe put into moderation
    284         if ( !bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
     284        if ( ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    285285                $topic_status = bbp_get_pending_status_id();
    286286
    287287        // Check a whitelist of possible topic status ID's
    288         } elseif ( !empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
     288        } elseif ( ! empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
    289289                $topic_status = $_POST['bbp_topic_status'];
    290290
    … …  
    296296        /** Topic Tags ************************************************************/
    297297
    298         if ( bbp_allow_topic_tags() && !empty( $_POST['bbp_topic_tags'] ) ) {
     298        if ( bbp_allow_topic_tags() && ! empty( $_POST['bbp_topic_tags'] ) ) {
    299299
    300300                // Escape tag input
    … …  
    339339        /** No Errors *************************************************************/
    340340
    341         if ( !empty( $topic_id ) && !is_wp_error( $topic_id ) ) {
     341        if ( ! empty( $topic_id ) && ! is_wp_error( $topic_id ) ) {
    342342
    343343                /** Trash Check *******************************************************/
    … …  
    371371
    372372                // Sticky check after 'bbp_new_topic' action so forum ID meta is set
    373                 if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
     373                if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
    374374
    375375                        // What's the caps?
    … …  
    410410
    411411                // Add view all?
    412                 if ( bbp_get_view_all() || !empty( $view_all ) ) {
     412                if ( bbp_get_view_all() || ! empty( $view_all ) ) {
    413413
    414414                        // User can moderate, so redirect to topic with view all set
    … …  
    512512
    513513                        // User cannot edit this topic
    514                         if ( !current_user_can( 'edit_topic', $topic_id ) ) {
     514                        if ( ! current_user_can( 'edit_topic', $topic_id ) ) {
    515515                                bbp_add_error( 'bbp_edit_topic_permissions', __( '<strong>ERROR</strong>: You do not have permission to edit that topic.', 'bbpress' ) );
    516516                        }
    … …  
    534534
    535535        // Remove kses filters from title and content for capable users and if the nonce is verified
    536         if ( current_user_can( 'unfiltered_html' ) && !empty( $_POST['_bbp_unfiltered_html_topic'] ) && ( wp_create_nonce( 'bbp-unfiltered-html-topic_' . $topic_id ) === $_POST['_bbp_unfiltered_html_topic'] ) ) {
     536        if ( current_user_can( 'unfiltered_html' ) && ! empty( $_POST['_bbp_unfiltered_html_topic'] ) && ( wp_create_nonce( 'bbp-unfiltered-html-topic_' . $topic_id ) === $_POST['_bbp_unfiltered_html_topic'] ) ) {
    537537                remove_filter( 'bbp_edit_topic_pre_title',   'wp_filter_kses'      );
    538538                remove_filter( 'bbp_edit_topic_pre_content', 'bbp_encode_bad',  10 );
    … …  
    555555
    556556        // Forum exists
    557         if ( !empty( $forum_id ) && ( $forum_id !== $current_forum_id ) ) {
     557        if ( ! empty( $forum_id ) && ( $forum_id !== $current_forum_id ) ) {
    558558
    559559                // Forum is a category
    … …  
    565565
    566566                        // Forum is closed and user cannot access
    567                         if ( bbp_is_forum_closed( $forum_id ) && !current_user_can( 'edit_forum', $forum_id ) ) {
     567                        if ( bbp_is_forum_closed( $forum_id ) && ! current_user_can( 'edit_forum', $forum_id ) ) {
    568568                                bbp_add_error( 'bbp_edit_topic_forum_closed', __( '<strong>ERROR</strong>: This forum has been closed to new topics.', 'bbpress' ) );
    569569                        }
    … …  
    571571                        // Forum is private and user cannot access
    572572                        if ( bbp_is_forum_private( $forum_id ) ) {
    573                                 if ( !current_user_can( 'read_private_forums' ) ) {
     573                                if ( ! current_user_can( 'read_private_forums' ) ) {
    574574                                        bbp_add_error( 'bbp_edit_topic_forum_private', __( '<strong>ERROR</strong>: This forum is private and you do not have the capability to read or create new topics in it.', 'bbpress' ) );
    575575                                }
    … …  
    577577                        // Forum is hidden and user cannot access
    578578                        } elseif ( bbp_is_forum_hidden( $forum_id ) ) {
    579                                 if ( !current_user_can( 'read_hidden_forums' ) ) {
     579                                if ( ! current_user_can( 'read_hidden_forums' ) ) {
    580580                                        bbp_add_error( 'bbp_edit_topic_forum_hidden', __( '<strong>ERROR</strong>: This forum is hidden and you do not have the capability to read or create new topics in it.', 'bbpress' ) );
    581581                                }
    … …  
    586586        /** Topic Title ***********************************************************/
    587587
    588         if ( !empty( $_POST['bbp_topic_title'] ) ) {
     588        if ( ! empty( $_POST['bbp_topic_title'] ) ) {
    589589                $topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) );
    590590        }
    … …  
    600600        /** Topic Content *********************************************************/
    601601
    602         if ( !empty( $_POST['bbp_topic_content'] ) ) {
     602        if ( ! empty( $_POST['bbp_topic_content'] ) ) {
    603603                $topic_content = $_POST['bbp_topic_content'];
    604604        }
    … …  
    614614        /** Topic Blacklist *******************************************************/
    615615
    616         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 ) ) {
    617617                bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be edited at this time.', 'bbpress' ) );
    618618        }
    … …  
    621621
    622622        // Maybe put into moderation
    623         if ( !bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
     623        if ( ! bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) ) {
    624624
    625625                // Set post status to pending if public or closed
    … …  
    629629
    630630        // Check a whitelist of possible topic status ID's
    631         } elseif ( !empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
     631        } elseif ( ! empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
    632632                $topic_status = $_POST['bbp_topic_status'];
    633633
    … …  
    703703        /** No Errors *************************************************************/
    704704
    705         if ( !empty( $topic_id ) && !is_wp_error( $topic_id ) ) {
     705        if ( ! empty( $topic_id ) && ! is_wp_error( $topic_id ) ) {
    706706
    707707                // Update counts, etc...
    … …  
    711711
    712712                // Revision Reason
    713                 if ( !empty( $_POST['bbp_topic_edit_reason'] ) ) {
     713                if ( ! empty( $_POST['bbp_topic_edit_reason'] ) ) {
    714714                        $topic_edit_reason = esc_attr( strip_tags( $_POST['bbp_topic_edit_reason'] ) );
    715715                }
    716716
    717717                // Update revision log
    718                 if ( !empty( $_POST['bbp_log_topic_edit'] ) && ( "1" === $_POST['bbp_log_topic_edit'] ) )  {
     718                if ( ! empty( $_POST['bbp_log_topic_edit'] ) && ( "1" === $_POST['bbp_log_topic_edit'] ) )  {
    719719                        $revision_id = wp_save_post_revision( $topic_id );
    720720                        if ( ! empty( $revision_id ) ) {
    … …  
    739739                /** Stickies **********************************************************/
    740740
    741                 if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( bbp_get_topic_types() ) ) ) {
     741                if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( bbp_get_topic_types() ) ) ) {
    742742
    743743                        // What's the caps?
    … …  
    782782
    783783                // Add view all?
    784                 if ( !empty( $view_all ) ) {
     784                if ( ! empty( $view_all ) ) {
    785785                        $topic_url = bbp_add_view_all( $topic_url );
    786786                }
    … …  
    859859        // It expects anonymous_data to be sanitized.
    860860        // Check bbp_filter_anonymous_post_data() for sanitization.
    861         if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
     861        if ( ! empty( $anonymous_data ) && is_array( $anonymous_data ) ) {
    862862
    863863                // Parse arguments against default values
    … …  
    879879
    880880        } else {
    881                 if ( empty( $is_edit ) && !current_user_can( 'throttle' ) ) {
     881                if ( empty( $is_edit ) && ! current_user_can( 'throttle' ) ) {
    882882                        bbp_update_user_last_posted( $author_id );
    883883                }
    … …  
    885885
    886886        // Handle Subscription Checkbox
    887         if ( bbp_is_subscriptions_active() && !empty( $author_id ) ) {
     887        if ( bbp_is_subscriptions_active() && ! empty( $author_id ) ) {
    888888                $subscribed = bbp_is_user_subscribed( $author_id, $topic_id );
    889                 $subscheck  = ( !empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) ) ? true : false;
     889                $subscheck  = ( ! empty( $_POST['bbp_topic_subscription'] ) && ( 'bbp_subscribe' === $_POST['bbp_topic_subscription'] ) ) ? true : false;
    890890
    891891                // Subscribed and unsubscribing
    … …  
    952952
    953953        // Topic was passed
    954         if ( !empty( $topic_id ) ) {
     954        if ( ! empty( $topic_id ) ) {
    955955
    956956                // Get the forum ID if none was passed
    … …  
    976976
    977977        // Loop through ancestors
    978         if ( !empty( $ancestors ) ) {
     978        if ( ! empty( $ancestors ) ) {
    979979                foreach ( $ancestors as $ancestor ) {
    980980
    … …  
    10331033
    10341034        // Only proceed if stickies are found
    1035         if ( !empty( $old_stickies ) ) {
     1035        if ( ! empty( $old_stickies ) ) {
    10361036
    10371037                // Define local variables
    … …  
    10781078
    10791079        // Loop through ancestors and update them
    1080         if ( !empty( $old_forum_ancestors ) ) {
     1080        if ( ! empty( $old_forum_ancestors ) ) {
    10811081                foreach ( $old_forum_ancestors as $ancestor ) {
    10821082                        if ( bbp_is_forum( $ancestor ) ) {
    … …  
    10911091
    10921092        // Make sure we're not walking twice
    1093         if ( !in_array( $new_forum_id, $old_forum_ancestors ) ) {
     1093        if ( ! in_array( $new_forum_id, $old_forum_ancestors ) ) {
    10941094
    10951095                // Get topic ancestors
    … …  
    11001100
    11011101                // Loop through ancestors and update them
    1102                 if ( !empty( $new_forum_ancestors ) ) {
     1102                if ( ! empty( $new_forum_ancestors ) ) {
    11031103                        foreach ( $new_forum_ancestors as $ancestor ) {
    11041104                                if ( bbp_is_forum( $ancestor ) ) {
    … …  
    11841184
    11851185        // Cannot edit source topic
    1186         if ( !current_user_can( 'edit_topic', $source_topic->ID ) ) {
     1186        if ( ! current_user_can( 'edit_topic', $source_topic->ID ) ) {
    11871187                bbp_add_error( 'bbp_merge_topic_source_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the source topic.', 'bbpress' ) );
    11881188                return;
    … …  
    12041204
    12051205        // Cannot edit destination topic
    1206         if ( !current_user_can( 'edit_topic', $destination_topic->ID ) ) {
     1206        if ( ! current_user_can( 'edit_topic', $destination_topic->ID ) ) {
    12071207                bbp_add_error( 'bbp_merge_topic_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the destination topic.', 'bbpress' ) );
    12081208        }
    … …  
    12401240
    12411241        // Remove the topic from everybody's subscriptions
    1242         if ( !empty( $subscribers ) ) {
     1242        if ( ! empty( $subscribers ) ) {
    12431243
    12441244                // Loop through each user
    … …  
    12461246
    12471247                        // Shift the subscriber if told to
    1248                         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() ) {
    12491249                                bbp_add_user_subscription( $subscriber, $destination_topic->ID );
    12501250                        }
    … …  
    12611261
    12621262        // Remove the topic from everybody's favorites
    1263         if ( !empty( $favoriters ) ) {
     1263        if ( ! empty( $favoriters ) ) {
    12641264
    12651265                // Loop through each user
    … …  
    12671267
    12681268                        // Shift the favoriter if told to
    1269                         if ( !empty( $_POST['bbp_topic_favoriters'] ) && "1" === $_POST['bbp_topic_favoriters'] ) {
     1269                        if ( ! empty( $_POST['bbp_topic_favoriters'] ) && "1" === $_POST['bbp_topic_favoriters'] ) {
    12701270                                bbp_add_user_favorite( $favoriter, $destination_topic->ID );
    12711271                        }
    … …  
    12821282
    12831283        // Tags to possibly merge
    1284         if ( !empty( $source_topic_tags ) && !is_wp_error( $source_topic_tags ) ) {
     1284        if ( ! empty( $source_topic_tags ) && ! is_wp_error( $source_topic_tags ) ) {
    12851285
    12861286                // Shift the tags if told to
    1287                 if ( !empty( $_POST['bbp_topic_tags'] ) && ( "1" === $_POST['bbp_topic_tags'] ) ) {
     1287                if ( ! empty( $_POST['bbp_topic_tags'] ) && ( "1" === $_POST['bbp_topic_tags'] ) ) {
    12881288                        wp_set_post_terms( $destination_topic->ID, $source_topic_tags, bbp_get_topic_tag_tax_id(), true );
    12891289                }
    … …  
    13121312        array_unshift( $replies, $source_topic );
    13131313
    1314         if ( !empty( $replies ) ) {
     1314        if ( ! empty( $replies ) ) {
    13151315
    13161316                /** Merge Replies *****************************************************/
    … …  
    14941494
    14951495        // Use cannot edit topic
    1496         if ( !current_user_can( 'edit_topic', $source_topic->ID ) ) {
     1496        if ( ! current_user_can( 'edit_topic', $source_topic->ID ) ) {
    14971497                bbp_add_error( 'bbp_split_topic_source_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the source topic.', 'bbpress' ) );
    14981498        }
    14991499
    15001500        // How to Split
    1501         if ( !empty( $_POST['bbp_topic_split_option'] ) ) {
     1501        if ( ! empty( $_POST['bbp_topic_split_option'] ) ) {
    15021502                $split_option = (string) trim( $_POST['bbp_topic_split_option'] );
    15031503        }
    15041504
    15051505        // Invalid split option
    1506         if ( empty( $split_option ) || !in_array( $split_option, array( 'existing', 'reply' ) ) ) {
     1506        if ( empty( $split_option ) || ! in_array( $split_option, array( 'existing', 'reply' ) ) ) {
    15071507                bbp_add_error( 'bbp_split_topic_option', __( '<strong>ERROR</strong>: You need to choose a valid split option.', 'bbpress' ) );
    15081508
    … …  
    15321532
    15331533                                // User cannot edit the destination topic
    1534                                 if ( !current_user_can( 'edit_topic', $destination_topic->ID ) ) {
     1534                                if ( ! current_user_can( 'edit_topic', $destination_topic->ID ) ) {
    15351535                                        bbp_add_error( 'bbp_split_topic_destination_permission', __( '<strong>ERROR</strong>: You do not have the permissions to edit the destination topic!', 'bbpress' ) );
    15361536                                }
    … …  
    15461546
    15471547                                        // Use the new title that was passed
    1548                                         if ( !empty( $_POST['bbp_topic_split_destination_title'] ) ) {
     1548                                        if ( ! empty( $_POST['bbp_topic_split_destination_title'] ) ) {
    15491549                                                $destination_topic_title = esc_attr( strip_tags( $_POST['bbp_topic_split_destination_title'] ) );
    15501550
    … …  
    16121612
    16131613        // Copy the subscribers
    1614         if ( !empty( $_POST['bbp_topic_subscribers'] ) && "1" === $_POST['bbp_topic_subscribers'] && bbp_is_subscriptions_active() ) {
     1614        if ( ! empty( $_POST['bbp_topic_subscribers'] ) && "1" === $_POST['bbp_topic_subscribers'] && bbp_is_subscriptions_active() ) {
    16151615
    16161616                // Get the subscribers
    16171617                $subscribers = bbp_get_topic_subscribers( $source_topic->ID );
    16181618
    1619                 if ( !empty( $subscribers ) ) {
     1619                if ( ! empty( $subscribers ) ) {
    16201620
    16211621                        // Add subscribers to new topic
    … …  
    16291629
    16301630        // Copy the favoriters if told to
    1631         if ( !empty( $_POST['bbp_topic_favoriters'] ) && ( "1" === $_POST['bbp_topic_favoriters'] ) ) {
     1631        if ( ! empty( $_POST['bbp_topic_favoriters'] ) && ( "1" === $_POST['bbp_topic_favoriters'] ) ) {
    16321632
    16331633                // Get the favoriters
    16341634                $favoriters = bbp_get_topic_favoriters( $source_topic->ID );
    16351635
    1636                 if ( !empty( $favoriters ) ) {
     1636                if ( ! empty( $favoriters ) ) {
    16371637
    16381638                        // Add the favoriters to new topic
    … …  
    16461646
    16471647        // Copy the tags if told to
    1648         if ( !empty( $_POST['bbp_topic_tags'] ) && ( "1" === $_POST['bbp_topic_tags'] ) ) {
     1648        if ( ! empty( $_POST['bbp_topic_tags'] ) && ( "1" === $_POST['bbp_topic_tags'] ) ) {
    16491649
    16501650                // Get the source topic tags
    16511651                $source_topic_tags = wp_get_post_terms( $source_topic->ID, bbp_get_topic_tag_tax_id(), array( 'fields' => 'names' ) );
    16521652
    1653                 if ( !empty( $source_topic_tags ) ) {
     1653                if ( ! empty( $source_topic_tags ) ) {
    16541654                        wp_set_post_terms( $destination_topic->ID, $source_topic_tags, bbp_get_topic_tag_tax_id(), true );
    16551655                }
    … …  
    16631663
    16641664        // Make sure there are replies to loop through
    1665         if ( !empty( $replies ) && !is_wp_error( $replies ) ) {
     1665        if ( ! empty( $replies ) && ! is_wp_error( $replies ) ) {
    16661666
    16671667                // Calculate starting point for reply positions
    … …  
    17091709
    17101710                        // Not a reply to a reply that moved over
    1711                         if ( !in_array( $reply_to, $reply_ids ) ) {
     1711                        if ( ! in_array( $reply_to, $reply_ids ) ) {
    17121712                                bbp_update_reply_to( $reply->ID, 0 );
    17131713                        }
    … …  
    18391839
    18401840        // Bail if actions aren't meant for this function
    1841         if ( !in_array( $action, $possible_actions ) ) {
     1841        if ( ! in_array( $action, $possible_actions ) ) {
    18421842                return;
    18431843        }
    … …  
    18661866
    18671867                        // Can user edit topic tags?
    1868                         if ( !current_user_can( 'edit_topic_tags' ) ) {
     1868                        if ( ! current_user_can( 'edit_topic_tags' ) ) {
    18691869                                bbp_add_error( 'bbp_manage_topic_tag_update_permissions', __( '<strong>ERROR</strong>: You do not have the permissions to edit the topic tags.', 'bbpress' ) );
    18701870                                return;
    … …  
    18781878
    18791879                        // Attempt to update the tag
    1880                         $slug        = !empty( $_POST['tag-slug']        ) ? $_POST['tag-slug']        : '';
    1881                         $description = !empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : '';
     1880                        $slug        = ! empty( $_POST['tag-slug']        ) ? $_POST['tag-slug']        : '';
     1881                        $description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : '';
    18821882                        $tag         = wp_update_term( $tag_id, bbp_get_topic_tag_tax_id(), array( 'name' => $name, 'slug' => $slug, 'description' => $description ) );
    18831883
    … …  
    19061906
    19071907                        // Can user edit topic tags?
    1908                         if ( !current_user_can( 'edit_topic_tags' ) ) {
     1908                        if ( ! current_user_can( 'edit_topic_tags' ) ) {
    19091909                                bbp_add_error( 'bbp_manage_topic_tag_merge_permissions', __( '<strong>ERROR</strong>: You do not have the permissions to edit the topic tags.', 'bbpress' ) );
    19101910                                return;
    … …  
    19641964
    19651965                        // Can user delete topic tags?
    1966                         if ( !current_user_can( 'delete_topic_tags' ) ) {
     1966                        if ( ! current_user_can( 'delete_topic_tags' ) ) {
    19671967                                bbp_add_error( 'bbp_manage_topic_tag_delete_permissions', __( '<strong>ERROR</strong>: You do not have the permissions to delete the topic tags.', 'bbpress' ) );
    19681968                                return;
    … …  
    19901990
    19911991        // Redirect back
    1992         $redirect = ( !empty( $redirect ) && !is_wp_error( $redirect ) ) ? $redirect : home_url();
     1992        $redirect = ( ! empty( $redirect ) && ! is_wp_error( $redirect ) ) ? $redirect : home_url();
    19931993        wp_safe_redirect( $redirect );
    19941994
    … …  
    20462046function bbp_get_stickies( $forum_id = 0 ) {
    20472047        $stickies = empty( $forum_id ) ? bbp_get_super_stickies() : get_post_meta( $forum_id, '_bbp_sticky_topics', true );
    2048         $stickies = ( empty( $stickies ) || !is_array( $stickies ) ) ? array() : $stickies;
     2048        $stickies = ( empty( $stickies ) || ! is_array( $stickies ) ) ? array() : $stickies;
    20492049
    20502050        return apply_filters( 'bbp_get_stickies', $stickies, (int) $forum_id );
    … …  
    20622062function bbp_get_super_stickies() {
    20632063        $stickies = get_option( '_bbp_super_sticky_topics', array() );
    2064         $stickies = ( empty( $stickies ) || !is_array( $stickies ) ) ? array() : $stickies;
     2064        $stickies = ( empty( $stickies ) || ! is_array( $stickies ) ) ? array() : $stickies;
    20652065
    20662066        return apply_filters( 'bbp_get_super_stickies', $stickies );
    … …  
    21172117
    21182118        // Bail if actions aren't meant for this function
    2119         if ( !in_array( $action, $possible_actions ) ) {
     2119        if ( ! in_array( $action, $possible_actions ) ) {
    21202120                return;
    21212121        }
    … …  
    21352135
    21362136        // What is the user doing here?
    2137         if ( !current_user_can( 'edit_topic', $topic->ID ) || ( 'bbp_toggle_topic_trash' === $action && !current_user_can( 'delete_topic', $topic->ID ) ) ) {
     2137        if ( ! current_user_can( 'edit_topic', $topic->ID ) || ( 'bbp_toggle_topic_trash' === $action && ! current_user_can( 'delete_topic', $topic->ID ) ) ) {
    21382138                bbp_add_error( 'bbp_toggle_topic_permission', __( '<strong>ERROR:</strong> You do not have the permission to do that.', 'bbpress' ) );
    21392139                return;
    … …  
    21582158
    21592159                        $is_sticky = bbp_is_topic_sticky( $topic_id );
    2160                         $is_super  = false === $is_sticky && !empty( $_GET['super'] ) && ( "1" === $_GET['super'] ) ? true : false;
     2160                        $is_super  = false === $is_sticky && ! empty( $_GET['super'] ) && ( "1" === $_GET['super'] ) ? true : false;
    21612161                        $success   = true  === $is_sticky ? bbp_unstick_topic( $topic_id ) : bbp_stick_topic( $topic_id, $is_super );
    21622162                        $failure   = true  === $is_sticky ? __( '<strong>ERROR</strong>: There was a problem unsticking the topic.', 'bbpress' ) : __( '<strong>ERROR</strong>: There was a problem sticking the topic.', 'bbpress' );
    … …  
    21782178                case 'bbp_toggle_topic_trash' :
    21792179
    2180                         $sub_action = !empty( $_GET['sub_action'] ) && in_array( $_GET['sub_action'], array( 'trash', 'untrash', 'delete' ) ) ? $_GET['sub_action'] : false;
     2180                        $sub_action = ! empty( $_GET['sub_action'] ) && in_array( $_GET['sub_action'], array( 'trash', 'untrash', 'delete' ) ) ? $_GET['sub_action'] : false;
    21812181
    21822182                        if ( empty( $sub_action ) ) {
    … …  
    22182218
    22192219        // No errors
    2220         if ( false !== $success && !is_wp_error( $success ) ) {
     2220        if ( false !== $success && ! is_wp_error( $success ) ) {
    22212221
    22222222                // Redirect back to the topic's forum
    … …  
    22672267
    22682268        // Users exist
    2269         if ( !empty( $users ) ) {
     2269        if ( ! empty( $users ) ) {
    22702270
    22712271                // Loop through users
    … …  
    22922292
    22932293        // Subscriptions are not active
    2294         if ( !bbp_is_subscriptions_active() ) {
     2294        if ( ! bbp_is_subscriptions_active() ) {
    22952295                return;
    22962296        }
    … …  
    23072307
    23082308        // Users exist
    2309         if ( !empty( $users ) ) {
     2309        if ( ! empty( $users ) ) {
    23102310
    23112311                // Loop through users
    … …  
    25362536
    25372537        // Adjust last_id's based on last_reply post_type
    2538         if ( empty( $active_id ) || !bbp_is_reply( $active_id ) ) {
     2538        if ( empty( $active_id ) || ! bbp_is_reply( $active_id ) ) {
    25392539                $active_id = $topic_id;
    25402540        }
    … …  
    25762576
    25772577        // Update only if published
    2578         if ( !empty( $new_time ) ) {
     2578        if ( ! empty( $new_time ) ) {
    25792579                update_post_meta( $topic_id, '_bbp_last_active_time', $new_time );
    25802580        }
    … …  
    26172617
    26182618        // Adjust last_id's based on last_reply post_type
    2619         if ( empty( $reply_id ) || !bbp_is_reply( $reply_id ) ) {
     2619        if ( empty( $reply_id ) || ! bbp_is_reply( $reply_id ) ) {
    26202620                $reply_id = 0;
    26212621        }
    … …  
    29332933        ) );
    29342934
    2935         if ( !empty( $replies->posts ) ) {
     2935        if ( ! empty( $replies->posts ) ) {
    29362936
    29372937                // Prevent debug notices
    … …  
    29762976
    29772977        // Topic has tags
    2978         if ( !empty( $terms ) ) {
     2978        if ( ! empty( $terms ) ) {
    29792979
    29802980                // Loop through and collect term names
    … …  
    29842984
    29852985                // Topic terms have slugs
    2986                 if ( !empty( $term_names ) ) {
     2986                if ( ! empty( $term_names ) ) {
    29872987
    29882988                        // Add the original post status as post meta for future restoration
    … …  
    30703070
    30713071        // There are replies to untrash
    3072         if ( !empty( $pre_spammed_replies ) ) {
     3072        if ( ! empty( $pre_spammed_replies ) ) {
    30733073
    30743074                // Maybe reverse the trashed replies array
    … …  
    31053105
    31063106        // Delete pre-spam topic tag meta
    3107         if ( !empty( $terms ) ) {
     3107        if ( ! empty( $terms ) ) {
    31083108                delete_post_meta( $topic_id, '_bbp_spam_topic_tags' );
    31093109        }
    … …  
    31493149        do_action( 'bbp_stick_topic', $topic_id, $super );
    31503150
    3151         if ( !is_array( $stickies ) ) {
     3151        if ( ! is_array( $stickies ) ) {
    31523152                $stickies   = array( $topic_id );
    31533153        } else {
    … …  
    31673167        // Reset keys
    31683168        $stickies = array_values( $stickies );
    3169         $success  = !empty( $super ) ? update_option( '_bbp_super_sticky_topics', $stickies ) : update_post_meta( $forum_id, '_bbp_sticky_topics', $stickies );
     3169        $success  = ! empty( $super ) ? update_option( '_bbp_super_sticky_topics', $stickies ) : update_post_meta( $forum_id, '_bbp_sticky_topics', $stickies );
    31703170
    31713171        do_action( 'bbp_stuck_topic', $topic_id, $super, $success );
    … …  
    32033203        if ( empty( $stickies ) ) {
    32043204                $success = true;
    3205         } elseif ( !in_array( $topic_id, $stickies ) ) {
     3205        } elseif ( ! in_array( $topic_id, $stickies ) ) {
    32063206                $success = true;
    32073207        } elseif ( false === $offset ) {
    … …  
    32103210                array_splice( $stickies, $offset, 1 );
    32113211                if ( empty( $stickies ) ) {
    3212                         $success = !empty( $super ) ? delete_option( '_bbp_super_sticky_topics'            ) : delete_post_meta( $forum_id, '_bbp_sticky_topics'            );
     3212                        $success = ! empty( $super ) ? delete_option( '_bbp_super_sticky_topics'            ) : delete_post_meta( $forum_id, '_bbp_sticky_topics'            );
    32133213                } else {
    3214                         $success = !empty( $super ) ? update_option( '_bbp_super_sticky_topics', $stickies ) : update_post_meta( $forum_id, '_bbp_sticky_topics', $stickies );
     3214                        $success = ! empty( $super ) ? update_option( '_bbp_super_sticky_topics', $stickies ) : update_post_meta( $forum_id, '_bbp_sticky_topics', $stickies );
    32153215                }
    32163216        }
    … …  
    33383338        ) );
    33393339
    3340         if ( !empty( $replies->posts ) ) {
     3340        if ( ! empty( $replies->posts ) ) {
    33413341
    33423342                // Prevent debug notices
    … …  
    33973397
    33983398        // There are replies to untrash
    3399         if ( !empty( $pre_trashed_replies ) ) {
     3399        if ( ! empty( $pre_trashed_replies ) ) {
    34003400
    34013401                // Maybe reverse the trashed replies array
    … …  
    35353535                $terms[] = $term->name;
    35363536        }
    3537         $terms = !empty( $terms ) ? implode( $sep, $terms ) : '';
     3537        $terms = ! empty( $terms ) ? implode( $sep, $terms ) : '';
    35383538
    35393539        return apply_filters( 'bbp_get_topic_tags', $terms, $topic_id );
    … …  
    35903590
    35913591        // User cannot access this forum
    3592         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() ) ) ) {
    35933593                return;
    35943594        }
    … …  
    36813681
    36823682        // User cannot edit topic, so redirect back to topic
    3683         if ( !current_user_can( 'edit_topic', bbp_get_topic_id() ) ) {
     3683        if ( ! current_user_can( 'edit_topic', bbp_get_topic_id() ) ) {
    36843684                wp_safe_redirect( bbp_get_topic_permalink() );
    36853685                exit();
    … …  
    37063706
    37073707        // Bail if current user cannot edit topic tags
    3708         if ( !current_user_can( 'edit_topic_tags', bbp_get_topic_tag_id() ) ) {
     3708        if ( ! current_user_can( 'edit_topic_tags', bbp_get_topic_tag_id() ) ) {
    37093709                wp_safe_redirect( bbp_get_topic_tag_link() );
    37103710                exit();
  • trunk/src/includes/topics/template.php

    r5434 r5443  
    145145
    146146        // Other defaults
    147         $default_topic_search  = !empty( $_REQUEST['ts'] ) ? $_REQUEST['ts'] : false;
     147        $default_topic_search  = ! empty( $_REQUEST['ts'] ) ? $_REQUEST['ts'] : false;
    148148        $default_show_stickies = (bool) ( bbp_is_single_forum() || bbp_is_topic_archive() ) && ( false === $default_topic_search );
    149149        $default_post_parent   = bbp_is_single_forum() ? bbp_get_forum_id() : 'any';
    … …  
    211211
    212212        // Limited the number of pages shown
    213         if ( !empty( $r['max_num_pages'] ) ) {
     213        if ( ! empty( $r['max_num_pages'] ) ) {
    214214                $bbp->topic_query->max_num_pages = $r['max_num_pages'];
    215215        }
    … …  
    218218
    219219        // Put sticky posts at the top of the posts array
    220         if ( !empty( $r['show_stickies'] ) && $r['paged'] <= 1 ) {
     220        if ( ! empty( $r['show_stickies'] ) && $r['paged'] <= 1 ) {
    221221
    222222                // Get super stickies and stickies in this forum
    … …  
    224224
    225225                // Get stickies for current forum
    226                 if ( !empty( $r['post_parent'] ) ) {
     226                if ( ! empty( $r['post_parent'] ) ) {
    227227                        $stickies = array_merge( $stickies, bbp_get_stickies( $r['post_parent'] ) );
    228228                }
    … …  
    232232
    233233                // We have stickies
    234                 if ( is_array( $stickies ) && !empty( $stickies ) ) {
     234                if ( is_array( $stickies ) && ! empty( $stickies ) ) {
    235235
    236236                        // Start the offset at -1 so first sticky is at correct 0 offset
    … …  
    273273
    274274                        // If any posts have been excluded specifically, Ignore those that are sticky.
    275                         if ( !empty( $stickies ) && !empty( $r['post__not_in'] ) ) {
     275                        if ( ! empty( $stickies ) && ! empty( $r['post__not_in'] ) ) {
    276276                                $stickies = array_diff( $stickies, $r['post__not_in'] );
    277277                        }
    278278
    279279                        // Fetch sticky posts that weren't in the query results
    280                         if ( !empty( $stickies ) ) {
     280                        if ( ! empty( $stickies ) ) {
    281281
    282282                                // Query to use in get_posts to get sticky posts
    … …  
    311311                                // Get all stickies
    312312                                $sticky_posts = get_posts( $sticky_query );
    313                                 if ( !empty( $sticky_posts ) ) {
     313                                if ( ! empty( $sticky_posts ) ) {
    314314
    315315                                        // Get a count of the visible stickies
    … …  
    343343
    344344                // Limit the number of topics shown based on maximum allowed pages
    345                 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 ) {
    346346                        $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
    347347                }
    … …  
    490490
    491491                // Easy empty checking
    492                 if ( !empty( $topic_id ) && is_numeric( $topic_id ) ) {
     492                if ( ! empty( $topic_id ) && is_numeric( $topic_id ) ) {
    493493                        $bbp_topic_id = $topic_id;
    494494
    495495                // Currently inside a topic loop
    496                 } elseif ( !empty( $bbp->topic_query->in_the_loop ) && isset( $bbp->topic_query->post->ID ) ) {
     496                } elseif ( ! empty( $bbp->topic_query->in_the_loop ) && isset( $bbp->topic_query->post->ID ) ) {
    497497                        $bbp_topic_id = $bbp->topic_query->post->ID;
    498498
    499499                // Currently inside a search loop
    500                 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_topic( $bbp->search_query->post->ID ) ) {
     500                } elseif ( ! empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_topic( $bbp->search_query->post->ID ) ) {
    501501                        $bbp_topic_id = $bbp->search_query->post->ID;
    502502
    503503                // Currently viewing/editing a topic, likely alone
    504                 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && !empty( $bbp->current_topic_id ) ) {
     504                } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && ! empty( $bbp->current_topic_id ) ) {
    505505                        $bbp_topic_id = $bbp->current_topic_id;
    506506
    … …  
    600600
    601601                // Use the redirect address
    602                 if ( !empty( $redirect_to ) ) {
     602                if ( ! empty( $redirect_to ) ) {
    603603                        $topic_permalink = esc_url_raw( $redirect_to );
    604604
    … …  
    674674                        // Set root text to page title
    675675                        $page = bbp_get_page_by_path( bbp_get_topic_archive_slug() );
    676                         if ( !empty( $page ) ) {
     676                        if ( ! empty( $page ) ) {
    677677                                $title = get_the_title( $page->ID );
    678678
    … …  
    770770                }
    771771
    772                 if ( !empty( $length ) && ( $excerpt_length > $length ) ) {
     772                if ( ! empty( $length ) && ( $excerpt_length > $length ) ) {
    773773                        $excerpt  = substr( $excerpt, 0, $length - 1 );
    774774                        $excerpt .= '&hellip;';
    … …  
    808808
    809809                // 4 days, 4 hours ago
    810                 if ( !empty( $humanize ) ) {
    811                         $gmt_s  = !empty( $gmt ) ? 'U' : 'G';
     810                if ( ! empty( $humanize ) ) {
     811                        $gmt_s  = ! empty( $gmt ) ? 'U' : 'G';
    812812                        $date   = get_post_time( $gmt_s, $gmt, $topic_id );
    813813                        $time   = false; // For filter below
    … …  
    885885
    886886                // Bump if topic is in loop
    887                 if ( !bbp_show_lead_topic() ) {
     887                if ( ! bbp_show_lead_topic() ) {
    888888                        $total++;
    889889                }
    … …  
    903903                // Add pagination to query object
    904904                $pagination_links = paginate_links( $pagination );
    905                 if ( !empty( $pagination_links ) ) {
     905                if ( ! empty( $pagination_links ) ) {
    906906
    907907                        // Remove first page from pagination
    … …  
    977977                $revision_log = bbp_get_topic_raw_revision_log( $topic_id );
    978978
    979                 if ( empty( $topic_id ) || empty( $revision_log ) || !is_array( $revision_log ) ) {
     979                if ( empty( $topic_id ) || empty( $revision_log ) || ! is_array( $revision_log ) ) {
    980980                        return false;
    981981                }
    … …  
    10031003
    10041004                        $r .= "\t" . '<li id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '-item-' . esc_attr( $revision->ID ) . '" class="bbp-topic-revision-log-item">' . "\n";
    1005                         if ( !empty( $reason ) ) {
     1005                        if ( ! empty( $reason ) ) {
    10061006                                $r .= "\t\t" . sprintf( __( 'This topic was modified %1$s by %2$s. Reason: %3$s', 'bbpress' ), esc_html( $since ), $author, esc_html( $reason ) ) . "\n";
    10071007                        } else {
    … …  
    11151115 */
    11161116function bbp_is_topic_open( $topic_id = 0 ) {
    1117         return !bbp_is_topic_closed( $topic_id );
     1117        return ! bbp_is_topic_closed( $topic_id );
    11181118}
    11191119
    … …  
    11541154        $stickies = bbp_get_stickies( $forum_id );
    11551155
    1156         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 ) ) ) {
    11571157                return true;
    11581158        }
    … …  
    12421242        $retval   = false;
    12431243
    1244         if ( !bbp_get_topic_author_id( $topic_id ) ) {
     1244        if ( ! bbp_get_topic_author_id( $topic_id ) ) {
    12451245                $retval = true;
    12461246
    … …  
    12921292                $topic_id = bbp_get_topic_id( $topic_id );
    12931293
    1294                 if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     1294                if ( ! bbp_is_topic_anonymous( $topic_id ) ) {
    12951295                        $author = get_the_author_meta( 'display_name', bbp_get_topic_author_id( $topic_id ) );
    12961296                } else {
    … …  
    13631363
    13641364                // Check for anonymous user
    1365                 if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     1365                if ( ! bbp_is_topic_anonymous( $topic_id ) ) {
    13661366
    13671367                        // Get the author ID
    … …  
    14271427
    14281428                $topic_id = bbp_get_topic_id( $topic_id );
    1429                 if ( !empty( $topic_id ) ) {
    1430                         if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     1429                if ( ! empty( $topic_id ) ) {
     1430                        if ( ! bbp_is_topic_anonymous( $topic_id ) ) {
    14311431                                $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
    14321432                        } else {
    … …  
    14901490
    14911491                // Topic ID is good
    1492                 if ( !empty( $topic_id ) ) {
     1492                if ( ! empty( $topic_id ) ) {
    14931493
    14941494                        // Get some useful topic information
    … …  
    15061506
    15071507                        // Setup title and author_links array
    1508                         $link_title   = !empty( $link_title ) ? ' title="' . esc_attr( $link_title ) . '"' : '';
     1508                        $link_title   = ! empty( $link_title ) ? ' title="' . esc_attr( $link_title ) . '"' : '';
    15091509                        $author_links = array();
    15101510
    … …  
    15821582
    15831583                // Check for anonymous user or non-existant user
    1584                 if ( !bbp_is_topic_anonymous( $topic_id ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) {
     1584                if ( ! bbp_is_topic_anonymous( $topic_id ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) {
    15851585                        $author_url = bbp_get_user_profile_url( bbp_get_topic_author_id( $topic_id ) );
    15861586                } else {
    … …  
    16271627
    16281628                // Not anonymous user
    1629                 if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     1629                if ( ! bbp_is_topic_anonymous( $topic_id ) ) {
    16301630
    16311631                        // Use topic author email address
    16321632                        $user_id      = bbp_get_topic_author_id( $topic_id );
    16331633                        $user         = get_userdata( $user_id );
    1634                         $author_email = !empty( $user->user_email ) ? $user->user_email : '';
     1634                        $author_email = ! empty( $user->user_email ) ? $user->user_email : '';
    16351635
    16361636                // Anonymous
    … …  
    18151815                if ( empty( $last_active ) ) {
    18161816                        $reply_id = bbp_get_topic_last_reply_id( $topic_id );
    1817                         if ( !empty( $reply_id ) ) {
     1817                        if ( ! empty( $reply_id ) ) {
    18181818                                $last_active = get_post_field( 'post_date', $reply_id );
    18191819                        } else {
    … …  
    18221822                }
    18231823
    1824                 $last_active = !empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : '';
     1824                $last_active = ! empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : '';
    18251825
    18261826                // Return the time since
    … …  
    20372037                $reply_id = bbp_get_topic_last_reply_id( $topic_id );
    20382038
    2039                 if ( !empty( $reply_id ) && ( $reply_id !== $topic_id ) ) {
     2039                if ( ! empty( $reply_id ) && ( $reply_id !== $topic_id ) ) {
    20402040                        $reply_url = bbp_get_reply_url( $reply_id );
    20412041                } else {
    … …  
    20792079                $time_since = bbp_get_topic_last_active_time( $topic_id );
    20802080
    2081                 if ( !empty( $time_since ) ) {
     2081                if ( ! empty( $time_since ) ) {
    20822082                        $anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>';
    20832083                } else {
    … …  
    21372137
    21382138                // This forum has hidden topics
    2139                 if ( !empty( $deleted ) && current_user_can( 'edit_others_replies' ) ) {
     2139                if ( ! empty( $deleted ) && current_user_can( 'edit_others_replies' ) ) {
    21402140
    21412141                        // Extra text
    … …  
    23322332
    23332333                        // If terms exist, explode them and compile the return value
    2334                         if ( !empty( $terms ) ) {
     2334                        if ( ! empty( $terms ) ) {
    23352335                                $terms  = implode( $r['sep'], $terms );
    23362336                                $retval = $r['before'] . $terms . $r['after'];
    … …  
    25202520
    25212521                // Bypass check if user has caps
    2522                 if ( !current_user_can( 'edit_others_topics' ) ) {
     2522                if ( ! current_user_can( 'edit_others_topics' ) ) {
    25232523
    25242524                        // User cannot edit or it is past the lock time
    2525                         if ( empty( $topic ) || !current_user_can( 'edit_topic', $topic->ID ) || bbp_past_edit_lock( $topic->post_date_gmt ) ) {
     2525                        if ( empty( $topic ) || ! current_user_can( 'edit_topic', $topic->ID ) || bbp_past_edit_lock( $topic->post_date_gmt ) ) {
    25262526                                return;
    25272527                        }
    … …  
    26482648                $topic   = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    26492649
    2650                 if ( empty( $topic ) || !current_user_can( 'delete_topic', $topic->ID ) ) {
     2650                if ( empty( $topic ) || ! current_user_can( 'delete_topic', $topic->ID ) ) {
    26512651                        return;
    26522652                }
    … …  
    26582658                }
    26592659
    2660                 if ( bbp_is_topic_trash( $topic->ID ) || !EMPTY_TRASH_DAYS ) {
     2660                if ( bbp_is_topic_trash( $topic->ID ) || ! empty_TRASH_DAYS ) {
    26612661                        $actions['delete']  = '<a title="' . esc_attr__( 'Delete this item permanently',     'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'delete',  'topic_id' => $topic->ID ) ), 'delete-'  . $topic->post_type . '_' . $topic->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-topic-delete-link">' . $r['delete_text'] . '</a>';
    26622662                }
    … …  
    27162716                $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    27172717
    2718                 if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
     2718                if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {
    27192719                        return;
    27202720                }
    … …  
    27782778                $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    27792779
    2780                 if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
     2780                if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {
    27812781                        return;
    27822782                }
    … …  
    28482848                $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    28492849
    2850                 if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
     2850                if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {
    28512851                        return;
    28522852                }
    … …  
    29062906                $topic = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    29072907
    2908                 if ( empty( $topic ) || !current_user_can( 'moderate', $topic->ID ) ) {
     2908                if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {
    29092909                        return;
    29102910                }
    … …  
    30033003                $from_num  = bbp_number_format( $start_num );
    30043004                $to_num    = bbp_number_format( ( $start_num + ( $bbp->topic_query->posts_per_page - 1 ) > $bbp->topic_query->found_posts ) ? $bbp->topic_query->found_posts : $start_num + ( $bbp->topic_query->posts_per_page - 1 ) );
    3005                 $total_int = (int) !empty( $bbp->topic_query->found_posts ) ? $bbp->topic_query->found_posts : $bbp->topic_query->post_count;
     3005                $total_int = (int) ! empty( $bbp->topic_query->found_posts ) ? $bbp->topic_query->found_posts : $bbp->topic_query->post_count;
    30063006                $total     = bbp_number_format( $total_int );
    30073007
    … …  
    30623062
    30633063        // Bail if not viewing a topic
    3064         if ( !bbp_is_single_topic() ) {
     3064        if ( ! bbp_is_single_topic() ) {
    30653065                return;
    30663066        }
    … …  
    31823182
    31833183                // Used variables
    3184                 $tab = !empty( $r['tab'] ) ? ' tabindex="' . (int) $r['tab'] . '"' : '';
     3184                $tab = ! empty( $r['tab'] ) ? ' tabindex="' . (int) $r['tab'] . '"' : '';
    31853185
    31863186                // Start an output buffer, we'll finish it after the select loop
    … …  
    33483348                // Topic has replies
    33493349                $last_reply = bbp_get_topic_last_reply_id( $topic_id );
    3350                 if ( !empty( $last_reply ) ) {
     3350                if ( ! empty( $last_reply ) ) {
    33513351                        $last_updated_by = bbp_get_author_link( array( 'post_id' => $last_reply, 'size' => $r['size'] ) );
    33523352                        $retstr          = sprintf( esc_html__( 'This topic contains %1$s, has %2$s, and was last updated by %3$s %4$s.', 'bbpress' ), $reply_count, $voice_count, $last_updated_by, $time_since );
    … …  
    34653465
    34663466                // Add before and after if description exists
    3467                 if ( !empty( $term->term_id ) ) {
     3467                if ( ! empty( $term->term_id ) ) {
    34683468                        $retval = $term->term_id;
    34693469
    … …  
    35093509
    35103510                // Add before and after if description exists
    3511                 if ( !empty( $term->name ) ) {
     3511                if ( ! empty( $term->name ) ) {
    35123512                        $retval = $term->name;
    35133513
    … …  
    35533553
    35543554                // Add before and after if description exists
    3555                 if ( !empty( $term->slug ) ) {
     3555                if ( ! empty( $term->slug ) ) {
    35563556                        $retval = $term->slug;
    35573557
    … …  
    35973597
    35983598                // Add before and after if description exists
    3599                 if ( !empty( $term->term_id ) ) {
     3599                if ( ! empty( $term->term_id ) ) {
    36003600                        $retval = get_term_link( $term, bbp_get_topic_tag_tax_id() );
    36013601
    … …  
    36423642
    36433643                // Add before and after if description exists
    3644                 if ( !empty( $term->term_id ) ) {
     3644                if ( ! empty( $term->term_id ) ) {
    36453645
    36463646                        $bbp = bbpress();
    … …  
    37053705
    37063706                // Add before and after if description exists
    3707                 if ( !empty( $term->description ) ) {
     3707                if ( ! empty( $term->description ) ) {
    37083708                        $retval = $r['before'] . $term->description . $r['after'];
    37093709
    … …  
    38453845
    38463846                        // Topic exists
    3847                         if ( !empty( $topic_id ) ) {
     3847                        if ( ! empty( $topic_id ) ) {
    38483848
    38493849                                // Topic is spammed so display pre-spam terms
    … …  
    38743874
    38753875                        // Set the return value
    3876                         $topic_tags = ( !empty( $new_terms ) ) ? implode( ', ', $new_terms ) : '';
     3876                        $topic_tags = ( ! empty( $new_terms ) ) ? implode( ', ', $new_terms ) : '';
    38773877
    38783878                // No data
Note: See TracChangeset for help on using the changeset viewer.