Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/29/2020 08:36:15 PM (7 years ago)
Author:
imath
Message:

Blogs: fix PHP code standards & typos in inline comments

Props passoniate

Fixes #8222

File:
1 edited

Legend:

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

    r12393 r12544  
    288288        $blog_url = false;
    289289
    290         // Try to get the blog url from the activity object
     290        // Try to get the blog url from the activity object.
    291291        if ( isset( $activity->blog_url ) ) {
    292292                $blog_url = $activity->blog_url;
    … …  
    297297        $blog_name = false;
    298298
    299         // Try to get the blog name from the activity object
     299        // Try to get the blog name from the activity object.
    300300        if ( isset( $activity->blog_name ) ) {
    301301                $blog_name = $activity->blog_name;
    … …  
    314314        $post_url = false;
    315315
    316         // Try to get the post url from the activity object
     316        // Try to get the post url from the activity object.
    317317        if ( isset( $activity->post_url ) ) {
    318318                $post_url = $activity->post_url;
    … …  
    329329        $post_title = false;
    330330
    331         // Should be the case when the comment has just been published
     331        // Should be the case when the comment has just been published.
    332332        if ( isset( $activity->post_title ) ) {
    333333                $post_title = $activity->post_title;
    334334
    335         // If activity already exists try to get the post title from activity meta
     335        // If activity already exists try to get the post title from activity meta.
    336336        } elseif ( ! empty( $activity->id ) ) {
    337337                $post_title = bp_activity_get_meta( $activity->id, 'post_title' );
    … …  
    790790        }
    791791
    792         // Get associated post type and set default comment parent
     792        // Get associated post type and set default comment parent.
    793793        $post_type      = bp_activity_post_type_get_tracking_arg( $parent_activity->type, 'post_type' );
    794794        $comment_parent = 0;
    … …  
    806806                'comment_author_url'   => bp_core_get_user_domain( $params['user_id'], $user->user_nicename, $user->user_login ),
    807807                'comment_content'      => $params['content'],
    808                 'comment_type'         => '', // Could be interesting to add 'buddypress' here...
     808                'comment_type'         => '', // Could be interesting to add 'BuddyPress' here...
    809809                'comment_parent'       => (int) $comment_parent,
    810810                'user_id'              => $params['user_id'],
    … …  
    910910        $activity_ids[] = $activity_id;
    911911
    912         // Handle multisite
     912        // Handle multisite.
    913913        // switch to the blog where the comment was made.
    914914        switch_to_blog( $parent_activity->item_id );
    … …  
    924924        BP_Activity_Activity::rebuild_activity_comment_tree( $parent_activity_id );
    925925
    926         // Avoid the error message although the comments were successfully deleted
     926        // Avoid the error message although the comments were successfully deleted.
    927927        $deleted = true;
    928928
    … …  
    947947        }
    948948
    949         // fetch parent activity item
     949        // Fetch parent activity item.
    950950        $parent_activity = new BP_Activity_Activity( $activity->item_id );
    951951
    952         // if parent activity isn't a post type having the buddypress-activity support for comments, stop now!
     952        // If parent activity isn't a post type having the buddypress-activity support for comments, stop now!
    953953        if ( ! bp_activity_type_supports( $parent_activity->type, 'post-type-comment-tracking' ) ) {
    954954                return;
    … …  
    972972        switch_to_blog( $parent_activity->item_id );
    973973
    974         // Get the comment status
     974        // Get the comment status.
    975975        $post_comment_status = wp_get_comment_status( $post_comment_id );
    976976        $old_comment_status  = $post_comment_status;
    977977
    978         // No need to edit the activity, as it's the activity who's updating the comment
     978        // No need to edit the activity, as it's the activity who's updating the comment.
    979979        remove_action( 'transition_comment_status', 'bp_activity_transition_post_type_comment_status', 10 );
    980980        remove_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment', 10 );
    … …  
    996996        }
    997997
    998         // Restore actions
     998        // Restore actions.
    999999        add_action( 'transition_comment_status',     'bp_activity_transition_post_type_comment_status', 10, 3 );
    10001000        add_action( 'bp_activity_post_type_comment', 'bp_blogs_comment_sync_activity_comment',          10, 4 );
    … …  
    10551055        }
    10561056
    1057         // Get the associated post type
     1057        // Get the associated post type.
    10581058        $post_type = bp_activity_post_type_get_tracking_arg( $args['action'], 'post_type' );
    10591059
    1060         // Bail if this is not an activity associated with a post type
     1060        // Bail if this is not an activity associated with a post type.
    10611061        if ( empty( $post_type ) ) {
    10621062                return $args;
    10631063        }
    10641064
    1065         // Bail if this is an activity about posts and not comments
     1065        // Bail if this is an activity about posts and not comments.
    10661066        if ( bp_activity_post_type_get_tracking_arg( $args['action'], 'comment_action_id' ) ) {
    10671067                return $args;
    … …  
    12361236        // It's a post type supporting comment tracking.
    12371237        if ( bp_activity_type_supports( $type, 'post-type-comment-tracking' ) ) {
    1238                 // The activity type is supporting comments or replies
     1238                // The activity type is supporting comments or replies.
    12391239                if ( bp_activity_type_supports( $type, 'post-type-comment-reply' ) ) {
    12401240                        // Setup some globals we'll need to reference later.
    … …  
    12511251                                $retval = false;
    12521252                        }
    1253                 // The activity type does not support comments or replies
     1253                // The activity type does not support comments or replies.
    12541254                } else {
    12551255                        $retval = false;
    … …  
    12861286        }
    12871287
    1288         // Check the parent activity
     1288        // Check the parent activity.
    12891289        $parent_activity = new BP_Activity_Activity( bp_get_activity_item_id() );
    12901290
    … …  
    14391439                $bp = buddypress();
    14401440
    1441                 // Check if a comment action id is set for the parent activity
     1441                // Check if a comment action id is set for the parent activity.
    14421442                $comment_action_id = bp_activity_post_type_get_tracking_arg( $parent_activity->type, 'comment_action_id' );
    14431443
    1444                 // Use the action string callback for the activity type
     1444                // Use the action string callback for the activity type.
    14451445                if ( ! empty( $comment_action_id ) ) {
    14461446                        // Fake a 'new_{post_type}_comment' by cloning the activity object.
    14471447                        $object = clone $activity;
    14481448
    1449                         // Set the type of the activity to be a comment about a post type
     1449                        // Set the type of the activity to be a comment about a post type.
    14501450                        $object->type = $comment_action_id;
    14511451
    … …  
    14561456                        $object->secondary_item_id = $blog_comment_id;
    14571457
    1458                         // Get the format callback for this activity comment
     1458                        // Get the format callback for this activity comment.
    14591459                        $format_callback = bp_activity_post_type_get_tracking_arg( $comment_action_id, 'format_callback' );
    14601460
    1461                         // now format the activity action using the 'new_{post_type}_comment' action callback
     1461                        // Now format the activity action using the 'new_{post_type}_comment' action callback.
    14621462                        if ( is_callable( $format_callback ) ) {
    14631463                                $retval = call_user_func_array( $format_callback, array( '', $object ) );
Note: See TracChangeset for help on using the changeset viewer.