Skip to:
Content

BuddyPress.org

Changeset 12527


Ignore:
Timestamp:
01/18/2020 12:30:19 PM (4 years ago)
Author:
imath
Message:

Activity: fix PHP Code standards in inline comments

Props passoniate

Fixes #8207
Fixes #8208
Fixes #8209
Fixes #8210

Location:
trunk/src/bp-activity
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r12523 r12527  
    7676    $root_id   = ! empty( $_REQUEST['root_id'] )   ? (int) $_REQUEST['root_id']   : 0;
    7777
    78     // $parent_id is required
     78    // $parent_id is required.
    7979    if ( empty( $parent_id ) )
    8080        die( '-1' );
  • trunk/src/bp-activity/bp-activity-adminbar.php

    r12495 r12527  
    2727    }
    2828
    29     // Only show this menu to super admins
     29    // Only show this menu to super admins.
    3030    if ( ! bp_current_user_can( 'bp_moderate' ) ) {
    3131        return;
  • trunk/src/bp-activity/bp-activity-akismet.php

    r11360 r12527  
    6161    $interval = max( 1, absint( $interval ) );
    6262
    63     // _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status
     63    // _bp_akismet_submission meta values are large, so expire them after $interval days regardless of the activity status.
    6464    $sql          = $wpdb->prepare( "SELECT a.id FROM {$bp->activity->table_name} a LEFT JOIN {$bp->activity->table_name_meta} m ON a.id = m.activity_id WHERE m.meta_key = %s AND DATE_SUB(%s, INTERVAL {$interval} DAY) > a.date_recorded LIMIT 10000", '_bp_akismet_submission', current_time( 'mysql', 1 ) );
    6565    $activity_ids = $wpdb->get_col( $sql );
  • trunk/src/bp-activity/bp-activity-embeds.php

    r12264 r12527  
    101101        $activity = reset( $activity );
    102102
    103         // No need to requery if we already got the embed activity
     103        // No need to requery if we already got the embed activity.
    104104        if ( (int) $activity_id === $activity->id ) {
    105105            return $activities_template->has_activities();
     
    262262            }
    263263
    264             // Thumb width
     264            // Thumb width.
    265265            $thumb_width = isset( $oembed->thumbnail_width ) && 'photo' !== $oembed->type && (int) $oembed->thumbnail_width < 550 ? (int) $oembed->thumbnail_width : $width;
    266266
     
    275275            }
    276276
    277             // Show description (non-oEmbed standard)
     277            // Show description (non-oEmbed standard).
    278278            if ( isset( $oembed->description ) ) {
    279279                $caption .= sprintf( '<div class="caption-description">%s</div>', apply_filters( 'bp_activity_get_embed_excerpt', $oembed->description ) );
  • trunk/src/bp-activity/bp-activity-functions.php

    r12393 r12527  
    598598
    599599        if ( ! empty( $track_post_type ) ) {
    600             // Set the post type comments tracking args
     600            // Set the post type comments tracking args.
    601601            if ( ! empty( $track_post_type->comments_tracking->action_id ) ) {
    602                 // Used to check support for comment tracking by activity type (new_post_type_comment)
     602                // Used to check support for comment tracking by activity type (new_post_type_comment).
    603603                $track_post_type->comments_tracking->comments_tracking = true;
    604604
     
    608608                $post_types_tracking_args[ $track_post_type->comments_tracking->action_id ] = $track_post_type->comments_tracking;
    609609
    610                 // Used to check support for comment tracking by activity type (new_post_type)
     610                // Used to check support for comment tracking by activity type (new_post_type).
    611611                $track_post_type->comments_tracking = true;
    612612            }
     
    651651         */
    652652        case 'post-type-comment-tracking' :
    653             // Set the activity track global if not set yet
     653            // Set the activity track global if not set yet.
    654654            if ( empty( $bp->activity->track ) ) {
    655655                $bp->activity->track = bp_activity_get_post_types_tracking_args();
     
    727727    $bp = buddypress();
    728728
    729     // Set the activity track global if not set yet
     729    // Set the activity track global if not set yet.
    730730    if ( empty( $bp->activity->track ) ) {
    731731        $bp->activity->track = bp_activity_get_post_types_tracking_args();
     
    17031703        'fields'            => 'all',
    17041704        'page'              => 1,            // Page 1 without a per_page will result in no pagination.
    1705         'per_page'          => false,        // results per page
    1706         'sort'              => 'DESC',       // sort ASC or DESC
     1705        'per_page'          => false,        // results per page.
     1706        'sort'              => 'DESC',       // sort ASC or DESC.
    17071707        'display_comments'  => false,        // False for no comments. 'stream' for within stream display, 'threaded' for below each activity item.
    17081708
    1709         'search_terms'      => false,        // Pass search terms as a string
    1710         'meta_query'        => false,        // Filter by activity meta. See WP_Meta_Query for format
     1709        'search_terms'      => false,        // Pass search terms as a string.
     1710        'meta_query'        => false,        // Filter by activity meta. See WP_Meta_Query for format.
    17111711        'date_query'        => false,        // Filter by date. See first parameter of WP_Date_Query for format.
    17121712        'filter_query'      => false,
    17131713        'show_hidden'       => false,        // Show activity items that are hidden site-wide?
    17141714        'exclude'           => false,        // Comma-separated list of activity IDs to exclude.
    1715         'in'                => false,        // Comma-separated list or array of activity IDs to which you
     1715        'in'                => false,        // Comma-separated list or array of activity IDs to which you.
    17161716                                             // want to limit the query.
    17171717        'spam'              => 'ham_only',   // 'ham_only' (default), 'spam_only' or 'all'.
     
    18621862    $r = bp_parse_args( $args, array(
    18631863        'id'                => false,                  // Pass an existing activity ID to update an existing entry.
    1864         'action'            => '',                     // The activity action - e.g. "Jon Doe posted an update"
    1865         'content'           => '',                     // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"
     1864        'action'            => '',                     // The activity action - e.g. "Jon Doe posted an update".
     1865        'content'           => '',                     // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!".
    18661866        'component'         => false,                  // The name/ID of the component e.g. groups, profile, mycomponent.
    18671867        'type'              => false,                  // The activity type e.g. activity_update, profile_updated.
     
    22992299 */
    23002300function bp_activity_post_type_comment( $comment_id = 0, $is_approved = true, $activity_post_object = null ) {
    2301     // Get the users comment
     2301    // Get the users comment.
    23022302    $post_type_comment = get_comment( $comment_id );
    23032303
    2304     // Don't record activity if the comment hasn't been approved
     2304    // Don't record activity if the comment hasn't been approved.
    23052305    if ( empty( $is_approved ) ) {
    23062306        return false;
    23072307    }
    23082308
    2309     // Don't record activity if no email address has been included
     2309    // Don't record activity if no email address has been included.
    23102310    if ( empty( $post_type_comment->comment_author_email ) ) {
    23112311        return false;
    23122312    }
    23132313
    2314     // Don't record activity if the comment has already been marked as spam
     2314    // Don't record activity if the comment has already been marked as spam.
    23152315    if ( 'spam' === $is_approved ) {
    23162316        return false;
     
    23202320    $user = get_user_by( 'email', $post_type_comment->comment_author_email );
    23212321
    2322     // If user isn't registered, don't record activity
     2322    // If user isn't registered, don't record activity.
    23232323    if ( empty( $user ) ) {
    23242324        return false;
    23252325    }
    23262326
    2327     // Get the user_id
     2327    // Get the user_id.
    23282328    $user_id = (int) $user->ID;
    23292329
    2330     // Get blog and post data
     2330    // Get blog and post data.
    23312331    $blog_id = get_current_blog_id();
    23322332
    2333     // Get the post
     2333    // Get the post.
    23342334    $post_type_comment->post = get_post( $post_type_comment->comment_post_ID );
    23352335
     
    23472347    $is_post_status_not_allowed = (bool) apply_filters( 'bp_activity_post_type_is_post_status_allowed', 'publish' !== $post_type_comment->post->post_status || ! empty( $post_type_comment->post->post_password ) );
    23482348
    2349     // If this is a password protected post, or not a public post don't record the comment
     2349    // If this is a password protected post, or not a public post don't record the comment.
    23502350    if ( $is_post_status_not_allowed ) {
    23512351        return false;
    23522352    }
    23532353
    2354     // Set post type
     2354    // Set post type.
    23552355    $post_type = $post_type_comment->post->post_type;
    23562356
     
    23592359        $activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
    23602360
    2361         // Bail if the activity type does not exist
     2361        // Bail if the activity type does not exist.
    23622362        if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
    23632363            return false;
     
    23652365    }
    23662366
    2367     // Set the $activity_comment_object
     2367    // Set the $activity_comment_object.
    23682368    $activity_comment_object = $activity_post_object->comments_tracking;
    23692369
     
    25042504        $activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
    25052505
    2506         // Bail if the activity type does not exist
     2506        // Bail if the activity type does not exist.
    25072507        if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
    25082508            return false;
     
    25102510    }
    25112511
    2512     // Set the $activity_comment_object
     2512    // Set the $activity_comment_object.
    25132513    $activity_comment_object = $activity_post_object->comments_tracking;
    25142514
     
    40334033    $activity_post_object = bp_activity_get_post_type_tracking_args( $post_type );
    40344034
    4035     // Bail if the activity type does not exist
     4035    // Bail if the activity type does not exist.
    40364036    if ( empty( $activity_post_object->comments_tracking->action_id ) ) {
    40374037        return false;
    40384038
    4039     // Set the $activity_comment_object
     4039    // Set the $activity_comment_object.
    40404040    } else {
    40414041        $activity_comment_object = $activity_post_object->comments_tracking;
    40424042    }
    40434043
    4044     // Init an empty activity ID
     4044    // Init an empty activity ID.
    40454045    $activity_id = 0;
    40464046
     
    40664066    }
    40674067
    4068     // Get the activity
     4068    // Get the activity.
    40694069    if ( bp_disable_blogforum_comments() ) {
    40704070        $activity_id = bp_activity_get_activity_id( array(
     
    40944094    }
    40954095
    4096     // Check activity item exists
     4096    // Check activity item exists.
    40974097    if ( empty( $activity_id ) ) {
    40984098        // If no activity exists, but the comment has been approved, record it into the activity table.
     
    41044104    }
    41054105
    4106     // Create an activity object
     4106    // Create an activity object.
    41074107    $activity = new BP_Activity_Activity( $activity_id );
    41084108    if ( empty( $activity->component ) ) {
     
    41104110    }
    41114111
    4112     // Spam/ham the activity if it's not already in that state
     4112    // Spam/ham the activity if it's not already in that state.
    41134113    if ( 'spam_activity' === $action && ! $activity->is_spam ) {
    41144114        bp_activity_mark_as_spam( $activity );
     
    41174117    }
    41184118
    4119     // Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated
     4119    // Add "new_post_type_comment" to the whitelisted activity types, so that the activity's Akismet history is generated.
    41204120    $post_type_comment_action = $activity_comment_object->action_id;
    41214121    $comment_akismet_history = function ( $activity_types ) use ( $post_type_comment_action ) {
     
    41264126    add_filter( 'bp_akismet_get_activity_types', $comment_akismet_history );
    41274127
    4128     // Make sure the activity change won't edit the comment if sync is on
     4128    // Make sure the activity change won't edit the comment if sync is on.
    41294129    remove_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
    41304130
    4131     // Save the updated activity
     4131    // Save the updated activity.
    41324132    $activity->save();
    41334133
    4134     // Restore the action
     4134    // Restore the action.
    41354135    add_action( 'bp_activity_before_save', 'bp_blogs_sync_activity_edit_to_post_comment', 20 );
    41364136
    4137     // Remove the "new_blog_comment" activity type whitelist so we don't break anything
     4137    // Remove the "new_blog_comment" activity type whitelist so we don't break anything.
    41384138    remove_filter( 'bp_akismet_get_activity_types', $comment_akismet_history );
    41394139}
  • trunk/src/bp-activity/screens/permalink.php

    r11885 r12527  
    2727    $activity = bp_activity_get_specific( array( 'activity_ids' => bp_action_variable( 0 ), 'show_hidden' => true ) );
    2828
    29     // 404 if activity does not exist
     29    // 404 if activity does not exist.
    3030    if ( empty( $activity['activities'][0] ) ) {
    3131        bp_do_404();
     
    107107    ) );
    108108
    109     // 404 if activity does not exist
     109    // 404 if activity does not exist.
    110110    if ( empty( $activity['activities'][0] ) || bp_action_variables() ) {
    111111        bp_do_404();
Note: See TracChangeset for help on using the changeset viewer.