BuddyPress - Version 2.2.6

Version Description

See: https://codex.buddypress.org/releases/version-2-2-6/

Download this release

Release Info

Developer netweb
Plugin Icon 128x128 BuddyPress
Version 2.2.6
Comparing to
See all releases

Code changes from version 2.3.7 to 2.2.6

Files changed (73) hide show
  1. bp-activity/admin/css/admin-rtl.css +0 -7
  2. bp-activity/admin/css/admin-rtl.min.css +1 -1
  3. bp-activity/admin/css/admin.css +0 -7
  4. bp-activity/admin/css/admin.min.css +1 -1
  5. bp-activity/admin/js/admin.min.js +1 -1
  6. bp-activity/bp-activity-actions.php +36 -41
  7. bp-activity/bp-activity-admin.php +37 -98
  8. bp-activity/bp-activity-akismet.php +64 -74
  9. bp-activity/bp-activity-cache.php +6 -6
  10. bp-activity/bp-activity-classes.php +2379 -3
  11. bp-activity/bp-activity-cssjs.php +2 -24
  12. bp-activity/bp-activity-filters.php +23 -50
  13. bp-activity/bp-activity-functions.php +217 -417
  14. bp-activity/bp-activity-loader.php +29 -32
  15. bp-activity/bp-activity-notifications.php +63 -69
  16. bp-activity/bp-activity-screens.php +13 -14
  17. bp-activity/bp-activity-template.php +341 -507
  18. bp-activity/classes/class-bp-activity-activity.php +0 -1800
  19. bp-activity/classes/class-bp-activity-feed.php +0 -446
  20. bp-activity/classes/class-bp-activity-query.php +0 -258
  21. bp-activity/js/mentions.js +29 -23
  22. bp-activity/js/mentions.min.js +2 -2
  23. bp-blogs/bp-blogs-activity.php +12 -6
  24. bp-blogs/bp-blogs-classes.php +564 -1
  25. bp-blogs/bp-blogs-filters.php +4 -6
  26. bp-blogs/bp-blogs-functions.php +22 -44
  27. bp-blogs/bp-blogs-loader.php +5 -25
  28. bp-blogs/bp-blogs-template.php +27 -45
  29. bp-blogs/bp-blogs-widgets.php +29 -45
  30. bp-blogs/classes/class-bp-blogs-blog.php +0 -608
  31. bp-core/admin/{bp-core-admin-actions.php → bp-core-actions.php} +29 -92
  32. bp-core/admin/{bp-core-admin-components.php → bp-core-components.php} +9 -29
  33. bp-core/admin/{bp-core-admin-functions.php → bp-core-functions.php} +28 -49
  34. bp-core/admin/{bp-core-admin-schema.php → bp-core-schema.php} +6 -19
  35. bp-core/admin/{bp-core-admin-settings.php → bp-core-settings.php} +25 -52
  36. bp-core/admin/{bp-core-admin-slugs.php → bp-core-slugs.php} +6 -36
  37. bp-core/admin/{bp-core-admin-tools.php → bp-core-tools.php} +5 -23
  38. bp-core/admin/css/common-rtl.css +0 -53
  39. bp-core/admin/css/common-rtl.min.css +1 -1
  40. bp-core/admin/css/common.css +0 -53
  41. bp-core/admin/css/common.min.css +1 -1
  42. bp-core/admin/images/avatar-ui.gif +0 -0
  43. bp-core/admin/images/member-types.png +0 -0
  44. bp-core/bp-core-actions.php +0 -1
  45. bp-core/bp-core-admin.php +125 -124
  46. bp-core/bp-core-attachments.php +0 -406
  47. bp-core/bp-core-avatars.php +204 -843
  48. bp-core/bp-core-buddybar.php +25 -43
  49. bp-core/bp-core-cache.php +0 -6
  50. bp-core/bp-core-caps.php +2 -64
  51. bp-core/bp-core-catchuri.php +30 -155
  52. bp-core/bp-core-classes.php +2965 -14
  53. bp-core/bp-core-component.php +47 -224
  54. bp-core/bp-core-cssjs.php +16 -91
  55. bp-core/bp-core-dependency.php +10 -266
  56. bp-core/bp-core-filters.php +8 -226
  57. bp-core/bp-core-functions.php +15 -423
  58. bp-core/bp-core-loader.php +9 -65
  59. bp-core/bp-core-moderation.php +2 -43
  60. bp-core/bp-core-options.php +6 -215
  61. bp-core/bp-core-taxonomy.php +0 -28
  62. bp-core/bp-core-template-loader.php +4 -90
  63. bp-core/bp-core-template.php +51 -552
  64. bp-core/bp-core-theme-compatibility.php +8 -78
  65. bp-core/bp-core-update.php +8 -90
  66. bp-core/bp-core-widgets.php +6 -45
  67. bp-core/classes/class-bp-attachment-avatar.php +0 -427
  68. bp-core/classes/class-bp-attachment.php +0 -518
  69. bp-core/classes/class-bp-button.php +0 -270
  70. bp-core/classes/class-bp-core-notification.php +0 -258
  71. bp-core/classes/class-bp-core-user.php +0 -958
  72. bp-core/classes/class-bp-date-query.php +0 -65
  73. bp-core/classes/class-bp-embed.php +0 -198
bp-activity/admin/css/admin-rtl.css CHANGED
@@ -44,7 +44,6 @@
44
  }
45
  #bp-activities-form .column-response img {
46
  float: right;
47
- margin-bottom: 5px;
48
  margin-left: 10px;
49
  margin-top: 1px;
50
  }
@@ -79,9 +78,3 @@
79
  .column-action {
80
  width: 12%;
81
  }
82
-
83
- @media screen and (max-width: 782px) {
84
- body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) {
85
- display: table-cell;
86
- }
87
- }
44
  }
45
  #bp-activities-form .column-response img {
46
  float: right;
 
47
  margin-left: 10px;
48
  margin-top: 1px;
49
  }
78
  .column-action {
79
  width: 12%;
80
  }
 
 
 
 
 
 
bp-activity/admin/css/admin-rtl.min.css CHANGED
@@ -1 +1 @@
1
- .akismet-status{float:left}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:left;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:right;margin-bottom:5px;margin-left:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-right:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:#fff}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}@media screen and (max-width:782px){body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column){display:table-cell}}
1
+ .akismet-status{float:left}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:left;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:right;margin-left:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-right:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:#fff}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}
bp-activity/admin/css/admin.css CHANGED
@@ -44,7 +44,6 @@
44
  }
45
  #bp-activities-form .column-response img {
46
  float: left;
47
- margin-bottom: 5px;
48
  margin-right: 10px;
49
  margin-top: 1px;
50
  }
@@ -79,9 +78,3 @@
79
  .column-action {
80
  width: 12%;
81
  }
82
-
83
- @media screen and (max-width: 782px) {
84
- body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column) {
85
- display: table-cell;
86
- }
87
- }
44
  }
45
  #bp-activities-form .column-response img {
46
  float: left;
 
47
  margin-right: 10px;
48
  margin-top: 1px;
49
  }
78
  .column-action {
79
  width: 12%;
80
  }
 
 
 
 
 
 
bp-activity/admin/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .akismet-status{float:right}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:left;margin-bottom:5px;margin-right:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-left:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:#fff}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}@media screen and (max-width:782px){body.toplevel_page_bp-activity .wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column){display:table-cell}}
1
+ .akismet-status{float:right}.akismet-status a{color:#AAA;font-style:italic}.akismet-history{margin:13px}.akismet-history div{margin-bottom:13px}.akismet-history span{color:#999}#wp-bp-activities-wrap{padding:5px 0}#bp-activities{height:120px}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px}.activity-errors{list-style-type:disc;margin-left:2em}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0}#bp_activity_action h3,#bp_activity_content h3{cursor:auto}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:#fff}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px}#bp_activity_link input{width:99%}#bp-activities-primaryid{margin-bottom:1em}.column-action{width:12%}
bp-activity/admin/js/admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! buddypress - v2.3.5 - 2015-11-11 5:23:00 AM UTC - https://wordpress.org/plugins/buddypress/ */
2
  !function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
1
+ /*! buddypress - v2.2.4 - 2015-11-11 5:04:26 AM UTC - https://wordpress.org/plugins/buddypress/ */
2
  !function(a){var b={init:function(){a(document).on("click",".row-actions a.reply",b.open),a(document).on("click","#bp-activities-container a.cancel",b.close),a(document).on("click","#bp-activities-container a.save",b.send),a(document).on("keyup","#bp-activities:visible",function(a){27===a.which&&b.close()})},open:function(){var b=a("#bp-activities-container").hide();return a(this).parents("tr").after(b),b.fadeIn("300"),a("#bp-activities").focus(),!1},close:function(){return a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide()}),!1},send:function(){a("#bp-replysubmit .error").hide(),a("#bp-replysubmit .waiting").show();var c={};return c["_ajax_nonce-bp-activity-admin-reply"]=a('#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]').val(),c.action="bp-activity-admin-reply",c.content=a("#bp-activities").val(),c.parent_id=a("#bp-activities-container").prev().data("parent_id"),c.root_id=a("#bp-activities-container").prev().data("root_id"),a.ajax({data:c,type:"POST",url:ajaxurl,error:function(a){b.error(a)},success:function(a){b.show(a)}}),!1},error:function(b){var c=b.statusText;a("#bp-replysubmit .waiting").hide(),b.responseText&&(c=b.responseText.replace(/<.[^<>]*?>/g,"")),c&&a("#bp-replysubmit .error").html(c).show()},show:function(c){var d,e,f;return"string"==typeof c?(b.error({responseText:c}),!1):(f=wpAjax.parseAjaxResponse(c),f.errors?(b.error({responseText:wpAjax.broken}),!1):(f=f.responses[0],void a("#bp-activities-container").fadeOut("200",function(){a("#bp-activities").val("").blur(),a("#bp-replysubmit .error").html("").hide(),a("#bp-replysubmit .waiting").hide(),a("#bp-activities-container").before(f.data),e=a("#activity-"+f.id),d=e.closest(".widefat").css("backgroundColor"),e.animate({backgroundColor:"#CEB"},300).animate({backgroundColor:d},300)})))}};a(document).ready(function(){b.init(),a("#bp_activity_action h3, #bp_activity_content h3").unbind("click"),"undefined"!=typeof postboxes&&postboxes.add_postbox_toggles(bp_activity_admin_vars.page)})}(jQuery);
bp-activity/bp-activity-actions.php CHANGED
@@ -33,8 +33,9 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
33
  /**
34
  * Catch and route requests for single activity item permalinks.
35
  *
36
- * @since BuddyPress (1.2.0)
37
  *
 
38
  * @uses bp_is_activity_component()
39
  * @uses bp_is_current_action()
40
  * @uses bp_action_variable()
@@ -120,7 +121,7 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
120
  /**
121
  * Delete specific activity item and redirect to previous page.
122
  *
123
- * @since BuddyPress (1.1.0)
124
  *
125
  * @param int $activity_id Activity id to be deleted. Defaults to 0.
126
  *
@@ -166,7 +167,7 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
166
  * @since BuddyPress (1.5.0)
167
  *
168
  * @param int $activity_id The activity ID.
169
- * @param int $user_id The user associated with the activity.
170
  */
171
  do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
172
 
@@ -182,7 +183,7 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
182
  * @since BuddyPress (1.1.0)
183
  *
184
  * @param int $activity_id The activity ID.
185
- * @param int $user_id The user associated with the activity.
186
  */
187
  do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
188
 
@@ -197,14 +198,14 @@ add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
197
  /**
198
  * Mark specific activity item as spam and redirect to previous page.
199
  *
200
- * @since BuddyPress (1.6.0)
201
  *
 
202
  * @param int $activity_id Activity id to be deleted. Defaults to 0.
203
- *
204
  * @return bool False on failure.
205
  */
206
  function bp_activity_action_spam_activity( $activity_id = 0 ) {
207
- $bp = buddypress();
208
 
209
  // Not viewing activity, or action is not spam, or Akismet isn't present
210
  if ( !bp_is_activity_component() || !bp_is_current_action( 'spam' ) || empty( $bp->activity->akismet ) )
@@ -235,7 +236,7 @@ function bp_activity_action_spam_activity( $activity_id = 0 ) {
235
  * @since BuddyPress (1.6.0)
236
  *
237
  * @param int $activity_id Activity ID to be marked as spam.
238
- * @param object $activity Activity object for the ID to be marked as spam.
239
  */
240
  do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
241
 
@@ -252,7 +253,7 @@ function bp_activity_action_spam_activity( $activity_id = 0 ) {
252
  * @since BuddyPress (1.6.0)
253
  *
254
  * @param int $activity_id Activity ID that was marked as spam.
255
- * @param int $user_id User ID associated with activity.
256
  */
257
  do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
258
 
@@ -267,7 +268,7 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
267
  /**
268
  * Post user/group activity update.
269
  *
270
- * @since BuddyPress (1.2.0)
271
  *
272
  * @uses is_user_logged_in()
273
  * @uses bp_is_activity_component()
@@ -299,7 +300,7 @@ function bp_activity_action_post_update() {
299
  *
300
  * @since BuddyPress (1.2.0)
301
  *
302
- * @param string $value Activity message being posted.
303
  */
304
  $content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
305
 
@@ -310,7 +311,7 @@ function bp_activity_action_post_update() {
310
  *
311
  * @since BuddyPress (1.2.0)
312
  *
313
- * @param string $value Item type to associate with.
314
  */
315
  $object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
316
  }
@@ -322,7 +323,7 @@ function bp_activity_action_post_update() {
322
  *
323
  * @since BuddyPress (1.2.0)
324
  *
325
- * @param string $value Chosen component to post activity to.
326
  */
327
  $item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
328
  }
@@ -350,7 +351,7 @@ function bp_activity_action_post_update() {
350
  *
351
  * @since BuddyPress (1.2.0)
352
  *
353
- * @param string $object Activity item being associated to.
354
  * @param string $item_id Component ID being posted to.
355
  * @param string $content Activity content being posted.
356
  */
@@ -371,7 +372,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
371
  /**
372
  * Post new activity comment.
373
  *
374
- * @since BuddyPress (1.2.0)
375
  *
376
  * @uses is_user_logged_in()
377
  * @uses bp_is_activity_component()
@@ -399,7 +400,7 @@ function bp_activity_action_post_comment() {
399
  *
400
  * @since BuddyPress (1.2.0)
401
  *
402
- * @param string $value ID of the activity being replied to.
403
  */
404
  $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
405
 
@@ -408,7 +409,7 @@ function bp_activity_action_post_comment() {
408
  *
409
  * @since BuddyPress (1.2.0)
410
  *
411
- * @param string $value Comment content being posted.
412
  */
413
  $content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
414
 
@@ -435,7 +436,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
435
  /**
436
  * Mark activity as favorite.
437
  *
438
- * @since BuddyPress (1.2.0)
439
  *
440
  * @uses is_user_logged_in()
441
  * @uses bp_is_activity_component()
@@ -469,7 +470,7 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
469
  /**
470
  * Remove activity from favorites.
471
  *
472
- * @since BuddyPress (1.2.0)
473
  *
474
  * @uses is_user_logged_in()
475
  * @uses bp_is_activity_component()
@@ -503,8 +504,9 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
503
  /**
504
  * Load the sitewide activity feed.
505
  *
506
- * @since BuddyPress (1.0.0)
507
  *
 
508
  * @uses bp_is_activity_component()
509
  * @uses bp_is_current_action()
510
  * @uses bp_is_user()
@@ -513,7 +515,7 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
513
  * @return bool False on failure.
514
  */
515
  function bp_activity_action_sitewide_feed() {
516
- $bp = buddypress();
517
 
518
  if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
519
  return false;
@@ -535,7 +537,7 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
535
  /**
536
  * Load a user's personal activity feed.
537
  *
538
- * @since BuddyPress (1.0.0)
539
  *
540
  * @uses bp_is_user_activity()
541
  * @uses bp_is_current_action()
@@ -565,7 +567,7 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
565
  /**
566
  * Load a user's friends' activity feed.
567
  *
568
- * @since BuddyPress (1.0.0)
569
  *
570
  * @uses bp_is_active()
571
  * @uses bp_is_user_activity()
@@ -598,7 +600,7 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
598
  /**
599
  * Load the activity feed for a user's groups.
600
  *
601
- * @since BuddyPress (1.2.0)
602
  *
603
  * @uses bp_is_active()
604
  * @uses bp_is_user_activity()
@@ -639,7 +641,7 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
639
  /**
640
  * Load a user's @mentions feed.
641
  *
642
- * @since BuddyPress (1.2.0)
643
  *
644
  * @uses bp_is_user_activity()
645
  * @uses bp_is_current_action()
@@ -676,7 +678,7 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
676
  /**
677
  * Load a user's favorites feed.
678
  *
679
- * @since BuddyPress (1.2.0)
680
  *
681
  * @uses bp_is_user_activity()
682
  * @uses bp_is_current_action()
@@ -711,37 +713,30 @@ add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
711
  /**
712
  * Loads Akismet filtering for activity.
713
  *
714
- * @since BuddyPress (1.6.0)
715
- * @since BuddyPress (2.3.0) We only support Akismet 3+.
 
716
  */
717
  function bp_activity_setup_akismet() {
718
- $bp = buddypress();
719
 
720
  // Bail if Akismet is not active
721
- if ( ! defined( 'AKISMET_VERSION' ) ) {
722
- return;
723
- }
724
-
725
- // Bail if older version of Akismet
726
- if ( ! class_exists( 'Akismet' ) ) {
727
  return;
728
- }
729
 
730
  // Bail if no Akismet key is set
731
- if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) ) {
732
  return;
733
- }
734
 
735
  /**
736
  * Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
737
  *
738
  * @since BuddyPress (1.6.0)
739
  *
740
- * @param bool $value Return value of bp_is_akismet_active boolean function.
741
  */
742
- if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
743
  return;
744
- }
745
 
746
  // Instantiate Akismet for BuddyPress
747
  $bp->activity->akismet = new BP_Akismet();
33
  /**
34
  * Catch and route requests for single activity item permalinks.
35
  *
36
+ * @since BuddyPress (1.2)
37
  *
38
+ * @global object $bp BuddyPress global settings
39
  * @uses bp_is_activity_component()
40
  * @uses bp_is_current_action()
41
  * @uses bp_action_variable()
121
  /**
122
  * Delete specific activity item and redirect to previous page.
123
  *
124
+ * @since BuddyPress (1.1)
125
  *
126
  * @param int $activity_id Activity id to be deleted. Defaults to 0.
127
  *
167
  * @since BuddyPress (1.5.0)
168
  *
169
  * @param int $activity_id The activity ID.
170
+ * @param int $user_id The user associated with the activity.
171
  */
172
  do_action( 'bp_activity_before_action_delete_activity', $activity_id, $activity->user_id );
173
 
183
  * @since BuddyPress (1.1.0)
184
  *
185
  * @param int $activity_id The activity ID.
186
+ * @param int $user_id The user associated with the activity.
187
  */
188
  do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id );
189
 
198
  /**
199
  * Mark specific activity item as spam and redirect to previous page.
200
  *
201
+ * @since BuddyPress (1.6)
202
  *
203
+ * @global object $bp BuddyPress global settings
204
  * @param int $activity_id Activity id to be deleted. Defaults to 0.
 
205
  * @return bool False on failure.
206
  */
207
  function bp_activity_action_spam_activity( $activity_id = 0 ) {
208
+ global $bp;
209
 
210
  // Not viewing activity, or action is not spam, or Akismet isn't present
211
  if ( !bp_is_activity_component() || !bp_is_current_action( 'spam' ) || empty( $bp->activity->akismet ) )
236
  * @since BuddyPress (1.6.0)
237
  *
238
  * @param int $activity_id Activity ID to be marked as spam.
239
+ * @param object $activity Activity object for the ID to be marked as spam.
240
  */
241
  do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity );
242
 
253
  * @since BuddyPress (1.6.0)
254
  *
255
  * @param int $activity_id Activity ID that was marked as spam.
256
+ * @param int $user_id User ID associated with activity.
257
  */
258
  do_action( 'bp_activity_action_spam_activity', $activity_id, $activity->user_id );
259
 
268
  /**
269
  * Post user/group activity update.
270
  *
271
+ * @since BuddyPress (1.2)
272
  *
273
  * @uses is_user_logged_in()
274
  * @uses bp_is_activity_component()
300
  *
301
  * @since BuddyPress (1.2.0)
302
  *
303
+ * @param string $whats-new Activity message being posted.
304
  */
305
  $content = apply_filters( 'bp_activity_post_update_content', $_POST['whats-new'] );
306
 
311
  *
312
  * @since BuddyPress (1.2.0)
313
  *
314
+ * @param string $whats-new-post-object Item type to associate with.
315
  */
316
  $object = apply_filters( 'bp_activity_post_update_object', $_POST['whats-new-post-object'] );
317
  }
323
  *
324
  * @since BuddyPress (1.2.0)
325
  *
326
+ * @param string $whats-new-post-in Chosen component to post activity to.
327
  */
328
  $item_id = apply_filters( 'bp_activity_post_update_item_id', $_POST['whats-new-post-in'] );
329
  }
351
  *
352
  * @since BuddyPress (1.2.0)
353
  *
354
+ * @param string $object Activity item being associated to.
355
  * @param string $item_id Component ID being posted to.
356
  * @param string $content Activity content being posted.
357
  */
372
  /**
373
  * Post new activity comment.
374
  *
375
+ * @since BuddyPress (1.2)
376
  *
377
  * @uses is_user_logged_in()
378
  * @uses bp_is_activity_component()
400
  *
401
  * @since BuddyPress (1.2.0)
402
  *
403
+ * @param string $comment_form_id ID of the activity being replied to.
404
  */
405
  $activity_id = apply_filters( 'bp_activity_post_comment_activity_id', $_POST['comment_form_id'] );
406
 
409
  *
410
  * @since BuddyPress (1.2.0)
411
  *
412
+ * @param string $ac_input_activity_id Comment content being posted.
413
  */
414
  $content = apply_filters( 'bp_activity_post_comment_content', $_POST['ac_input_' . $activity_id] );
415
 
436
  /**
437
  * Mark activity as favorite.
438
  *
439
+ * @since BuddyPress (1.2)
440
  *
441
  * @uses is_user_logged_in()
442
  * @uses bp_is_activity_component()
470
  /**
471
  * Remove activity from favorites.
472
  *
473
+ * @since BuddyPress (1.2)
474
  *
475
  * @uses is_user_logged_in()
476
  * @uses bp_is_activity_component()
504
  /**
505
  * Load the sitewide activity feed.
506
  *
507
+ * @since BuddyPress (1.0)
508
  *
509
+ * @global object $bp BuddyPress global settings
510
  * @uses bp_is_activity_component()
511
  * @uses bp_is_current_action()
512
  * @uses bp_is_user()
515
  * @return bool False on failure.
516
  */
517
  function bp_activity_action_sitewide_feed() {
518
+ global $bp;
519
 
520
  if ( ! bp_is_activity_component() || ! bp_is_current_action( 'feed' ) || bp_is_user() || ! empty( $bp->groups->current_group ) )
521
  return false;
537
  /**
538
  * Load a user's personal activity feed.
539
  *
540
+ * @since BuddyPress (1.0)
541
  *
542
  * @uses bp_is_user_activity()
543
  * @uses bp_is_current_action()
567
  /**
568
  * Load a user's friends' activity feed.
569
  *
570
+ * @since BuddyPress (1.0)
571
  *
572
  * @uses bp_is_active()
573
  * @uses bp_is_user_activity()
600
  /**
601
  * Load the activity feed for a user's groups.
602
  *
603
+ * @since BuddyPress (1.2)
604
  *
605
  * @uses bp_is_active()
606
  * @uses bp_is_user_activity()
641
  /**
642
  * Load a user's @mentions feed.
643
  *
644
+ * @since BuddyPress (1.2)
645
  *
646
  * @uses bp_is_user_activity()
647
  * @uses bp_is_current_action()
678
  /**
679
  * Load a user's favorites feed.
680
  *
681
+ * @since BuddyPress (1.2)
682
  *
683
  * @uses bp_is_user_activity()
684
  * @uses bp_is_current_action()
713
  /**
714
  * Loads Akismet filtering for activity.
715
  *
716
+ * @since BuddyPress (1.6)
717
+ *
718
+ * @global object $bp BuddyPress global settings
719
  */
720
  function bp_activity_setup_akismet() {
721
+ global $bp;
722
 
723
  // Bail if Akismet is not active
724
+ if ( ! defined( 'AKISMET_VERSION' ) )
 
 
 
 
 
725
  return;
 
726
 
727
  // Bail if no Akismet key is set
728
+ if ( ! bp_get_option( 'wordpress_api_key' ) && ! defined( 'WPCOM_API_KEY' ) )
729
  return;
 
730
 
731
  /**
732
  * Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
733
  *
734
  * @since BuddyPress (1.6.0)
735
  *
736
+ * @param bool bp_is_akismet_active Return value of bp_is_akismet_active boolean function.
737
  */
738
+ if ( ! apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) )
739
  return;
 
740
 
741
  // Instantiate Akismet for BuddyPress
742
  $bp->activity->akismet = new BP_Akismet();
bp-activity/bp-activity-admin.php CHANGED
@@ -52,8 +52,7 @@ add_action( bp_core_admin_hook(), 'bp_activity_add_admin_menu' );
52
  * @since BuddyPress (1.7.0)
53
  *
54
  * @param array $custom_menus The list of top-level BP menu items.
55
- *
56
- * @return array $custom_menus List of top-level BP menu items, with Activity added.
57
  */
58
  function bp_activity_admin_menu_order( $custom_menus = array() ) {
59
  array_push( $custom_menus, 'bp-activity' );
@@ -139,10 +138,10 @@ add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' );
139
  *
140
  * @since BuddyPress (1.6.0)
141
  *
142
- * @param string $value Will always be false unless another plugin filters it first.
143
- * @param string $option Screen option name.
 
144
  * @param string $new_value Screen option form value.
145
- *
146
  * @return string Option value. False to abandon update.
147
  */
148
  function bp_activity_admin_screen_options( $value, $option, $new_value ) {
@@ -162,9 +161,7 @@ function bp_activity_admin_screen_options( $value, $option, $new_value ) {
162
  *
163
  * @since BuddyPress (1.6.0)
164
  *
165
- * @param array $hidden Array of items to hide.
166
  * @param WP_Screen $screen Screen identifier.
167
- *
168
  * @return array Hidden Meta Boxes.
169
  */
170
  function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
@@ -191,12 +188,12 @@ add_filter( 'default_hidden_meta_boxes', 'bp_activity_admin_edit_hidden_metaboxe
191
  *
192
  * Does the following:
193
  * - Register contextual help and screen options for this admin page.
194
- * - Enqueues scripts and styles.
195
- * - Catches POST and GET requests related to Activity.
196
  *
197
  * @since BuddyPress (1.6.0)
198
  *
199
- * @global object $bp BuddyPress global settings.
200
  * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
201
  */
202
  function bp_activity_admin_load() {
@@ -245,8 +242,8 @@ function bp_activity_admin_load() {
245
  // Help panel - sidebar links
246
  get_current_screen()->set_help_sidebar(
247
  '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
248
- '<p>' . __( '<a href="https://codex.buddypress.org/administrator-guide/activity-stream-management-panels/">Managing Activity</a>', 'buddypress' ) . '</p>' .
249
- '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
250
  );
251
 
252
  // Register metaboxes for the edit screen.
@@ -256,7 +253,7 @@ function bp_activity_admin_load() {
256
  add_meta_box( 'bp_activity_type', _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', get_current_screen()->id, 'normal', 'core' );
257
  add_meta_box( 'bp_activity_userid', _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core' );
258
 
259
- // Enqueue JavaScript files
260
  wp_enqueue_script( 'postbox' );
261
  wp_enqueue_script( 'dashboard' );
262
  wp_enqueue_script( 'comment' );
@@ -290,7 +287,7 @@ function bp_activity_admin_load() {
290
  // Help panel - sidebar links
291
  get_current_screen()->set_help_sidebar(
292
  '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
293
- '<p>' . __( '<a href="https://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
294
  );
295
  }
296
 
@@ -414,8 +411,8 @@ function bp_activity_admin_load() {
414
  *
415
  * @since BuddyPress (1.6.0)
416
  *
417
- * @param array $value Array holding spam, not spam, deleted counts, error IDs.
418
- * @param string $redirect_to URL to redirect to.
419
  * @param array $activity_ids Original array of activity IDs.
420
  */
421
  do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
@@ -642,7 +639,7 @@ function bp_activity_admin_edit() {
642
  *
643
  * @since BuddyPress (1.6.0)
644
  *
645
- * @param array $value Array holding single activity object that was passed by reference.
646
  */
647
  do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
648
 
@@ -819,14 +816,16 @@ function bp_activity_admin_get_activity_actions() {
819
  }
820
 
821
  /**
822
- * Activity type metabox for the Activity admin edit screen.
823
  *
824
  * @since BuddyPress (1.6.0)
825
  *
 
 
826
  * @param object $item Activity item.
827
  */
828
  function bp_activity_admin_edit_metabox_type( $item ) {
829
- $bp = buddypress();
830
 
831
  $actions = array();
832
  $selected = $item->type;
@@ -891,8 +890,9 @@ function bp_activity_admin_edit_metabox_itemids( $item ) {
891
  *
892
  * @since BuddyPress (1.6.0)
893
  *
894
- * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
895
- * @global string $plugin_page The current plugin page.
 
896
  */
897
  function bp_activity_admin_index() {
898
  global $bp_activity_list_table, $plugin_page;
@@ -1004,7 +1004,7 @@ function bp_activity_admin_index() {
1004
  <a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'buddypress' ); ?></a>
1005
  <a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'buddypress' ); ?></a>
1006
 
1007
- <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
1008
  <span class="error" style="display:none;"></span>
1009
  <br class="clear" />
1010
  </p>
@@ -1023,7 +1023,7 @@ function bp_activity_admin_index() {
1023
  /**
1024
  * List table class for the Activity component admin page.
1025
  *
1026
- * @since BuddyPress (1.6.0)
1027
  */
1028
  class BP_Activity_List_Table extends WP_List_Table {
1029
 
@@ -1054,7 +1054,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1054
  protected $activity_user_id = array();
1055
 
1056
  /**
1057
- * If users can comment on blog & forum activity items.
1058
  *
1059
  * @since BuddyPress (2.2.2)
1060
  *
@@ -1197,7 +1197,6 @@ class BP_Activity_List_Table extends WP_List_Table {
1197
  $this->get_columns(),
1198
  array(),
1199
  $this->get_sortable_columns(),
1200
- $this->get_default_primary_column_name(),
1201
  );
1202
 
1203
  return $this->_column_headers;
@@ -1220,7 +1219,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1220
  function display() {
1221
  $this->display_tablenav( 'top' ); ?>
1222
 
1223
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
1224
  <thead>
1225
  <tr>
1226
  <?php $this->print_column_headers(); ?>
@@ -1277,11 +1276,11 @@ class BP_Activity_List_Table extends WP_List_Table {
1277
  * @since BuddyPress (1.6.0)
1278
  */
1279
  function get_views() {
1280
- $url_base = add_query_arg( array( 'page' => 'bp-activity' ), bp_get_admin_url( 'admin.php' ) ); ?>
1281
 
1282
  <ul class="subsubsub">
1283
  <li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
1284
- <li class="spam"><a href="<?php echo esc_url( add_query_arg( array( 'activity_status' => 'spam' ), $url_base ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
1285
 
1286
  <?php
1287
 
@@ -1291,7 +1290,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1291
  * @since BuddyPress (1.6.0)
1292
  *
1293
  * @param string $url_base Current URL base for view.
1294
- * @param string $view Current view being displayed.
1295
  */
1296
  do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
1297
  </ul>
@@ -1412,37 +1411,6 @@ class BP_Activity_List_Table extends WP_List_Table {
1412
  <?php
1413
  }
1414
 
1415
- /**
1416
- * Override WP_List_Table::row_actions().
1417
- *
1418
- * Basically a duplicate of the row_actions() method, but removes the
1419
- * unnecessary <button> addition.
1420
- *
1421
- * @since 2.3.3
1422
- * @since 2.3.4 Visibility set to public for compatibility with WP < 4.0.0.
1423
- *
1424
- * @param array $actions The list of actions
1425
- * @param bool $always_visible Whether the actions should be always visible
1426
- * @return string
1427
- */
1428
- public function row_actions( $actions, $always_visible = false ) {
1429
- $action_count = count( $actions );
1430
- $i = 0;
1431
-
1432
- if ( !$action_count )
1433
- return '';
1434
-
1435
- $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
1436
- foreach ( $actions as $action => $link ) {
1437
- ++$i;
1438
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
1439
- $out .= "<span class='$action'>$link$sep</span>";
1440
- }
1441
- $out .= '</div>';
1442
-
1443
- return $out;
1444
- }
1445
-
1446
  /**
1447
  * Checkbox column markup.
1448
  *
@@ -1525,7 +1493,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1525
 
1526
  // Rollover actions
1527
 
1528
- // Reply - JavaScript only; implemented by AJAX.
1529
  if ( 'spam' != $item_status ) {
1530
  if ( $this->can_comment( $item ) ) {
1531
  $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
@@ -1555,7 +1523,7 @@ class BP_Activity_List_Table extends WP_List_Table {
1555
  * @since BuddyPress (1.6.0)
1556
  *
1557
  * @param array $actions Array of available actions user could use.
1558
- * @param array $item Current item being added to page.
1559
  */
1560
  $actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
1561
 
@@ -1601,47 +1569,33 @@ class BP_Activity_List_Table extends WP_List_Table {
1601
  */
1602
  function column_response( $item ) {
1603
  // Is $item is a root activity?
1604
- ?>
1605
-
1606
- <div class="response-links">
1607
-
1608
- <?php
1609
- // Activity permalink
1610
- $activity_permalink = '';
1611
- if ( ! $item['is_spam'] ) {
1612
- $activity_permalink = sprintf( __( '<a href="%1$s" class="comments-view-item-link">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) );
1613
- }
1614
 
1615
  /**
1616
  * Filters default list of default root activity types.
1617
  *
1618
  * @since BuddyPress (1.6.0)
1619
  *
1620
- * @param array $value Array of default activity types.
1621
- * @param array $item Current item being displayed.
1622
  */
1623
  if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
1624
- echo $activity_permalink;
1625
-
1626
  $comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
1627
  $root_activity_url = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1628
 
1629
  // If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble
1630
  if ( $comment_count ) {
1631
  $title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );
1632
- printf( '<a href="%1$s" title="%2$s" class="post-com-count post-com-count-approved"><span class="comment-count comment-count-approved">%3$s</span></a>', esc_url( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) );
1633
  }
1634
 
1635
  // For non-root activities, display a link to the replied-to activity's author's profile
1636
  } else {
1637
  echo '<strong>' . get_avatar( $this->get_activity_user_id( $item['item_id'] ), '32' ) . ' ' . bp_core_get_userlink( $this->get_activity_user_id( $item['item_id'] ) ) . '</strong><br />';
1638
- echo $activity_permalink;
1639
  }
1640
- ?>
1641
 
1642
- </div>
1643
-
1644
- <?php
1645
  }
1646
 
1647
  /**
@@ -1653,7 +1607,6 @@ class BP_Activity_List_Table extends WP_List_Table {
1653
  * @since BuddyPress (1.6.0)
1654
  *
1655
  * @param int $activity_id Activity ID to retrieve User ID for.
1656
- *
1657
  * @return int User ID of the activity item in question.
1658
  */
1659
  protected function get_activity_user_id( $activity_id ) {
@@ -1687,14 +1640,13 @@ class BP_Activity_List_Table extends WP_List_Table {
1687
  * Checks if an activity item can be replied to.
1688
  *
1689
  * This method merges functionality from {@link bp_activity_can_comment()} and
1690
- * {@link bp_blogs_disable_activity_commenting()}. This is done because the activity
1691
  * list table doesn't use a BuddyPress activity loop, which prevents those
1692
  * functions from working as intended.
1693
  *
1694
  * @since BuddyPress (2.0.0)
1695
  *
1696
  * @param array $item An array version of the BP_Activity_Activity object.
1697
- *
1698
  * @return bool
1699
  */
1700
  protected function can_comment( $item ) {
@@ -1759,7 +1711,6 @@ class BP_Activity_List_Table extends WP_List_Table {
1759
  * @since BuddyPress (1.6.0)
1760
  *
1761
  * @param array $tree Source array.
1762
- *
1763
  * @return array Flattened array.
1764
  */
1765
  public static function flatten_activity_array( $tree ){
@@ -1776,16 +1727,4 @@ class BP_Activity_List_Table extends WP_List_Table {
1776
 
1777
  return $tree;
1778
  }
1779
-
1780
- /**
1781
- * Get name of default primary column
1782
- *
1783
- * @since BuddyPress (2.3.3)
1784
- * @access protected
1785
- *
1786
- * @return string
1787
- */
1788
- protected function get_default_primary_column_name() {
1789
- return 'author';
1790
- }
1791
  }
52
  * @since BuddyPress (1.7.0)
53
  *
54
  * @param array $custom_menus The list of top-level BP menu items.
55
+ * @return array $custom_menus List of top-level BP menu items, with Activity added
 
56
  */
57
  function bp_activity_admin_menu_order( $custom_menus = array() ) {
58
  array_push( $custom_menus, 'bp-activity' );
138
  *
139
  * @since BuddyPress (1.6.0)
140
  *
141
+ * @param string $value Will always be false unless another plugin filters it
142
+ * first.
143
+ * @param string $option Screen option name.
144
  * @param string $new_value Screen option form value.
 
145
  * @return string Option value. False to abandon update.
146
  */
147
  function bp_activity_admin_screen_options( $value, $option, $new_value ) {
161
  *
162
  * @since BuddyPress (1.6.0)
163
  *
 
164
  * @param WP_Screen $screen Screen identifier.
 
165
  * @return array Hidden Meta Boxes.
166
  */
167
  function bp_activity_admin_edit_hidden_metaboxes( $hidden, $screen ) {
188
  *
189
  * Does the following:
190
  * - Register contextual help and screen options for this admin page.
191
+ * - Enqueues scripts and styles
192
+ * - Catches POST and GET requests related to Activity
193
  *
194
  * @since BuddyPress (1.6.0)
195
  *
196
+ * @global object $bp BuddyPress global settings.
197
  * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
198
  */
199
  function bp_activity_admin_load() {
242
  // Help panel - sidebar links
243
  get_current_screen()->set_help_sidebar(
244
  '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
245
+ '<p>' . __( '<a href="http://codex.buddypress.org/buddypress-site-administration/managing-activity/">Managing Activity</a>', 'buddypress' ) . '</p>' .
246
+ '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
247
  );
248
 
249
  // Register metaboxes for the edit screen.
253
  add_meta_box( 'bp_activity_type', _x( 'Type', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_type', get_current_screen()->id, 'normal', 'core' );
254
  add_meta_box( 'bp_activity_userid', _x( 'Author ID', 'activity admin edit screen', 'buddypress' ), 'bp_activity_admin_edit_metabox_userid', get_current_screen()->id, 'normal', 'core' );
255
 
256
+ // Enqueue javascripts
257
  wp_enqueue_script( 'postbox' );
258
  wp_enqueue_script( 'dashboard' );
259
  wp_enqueue_script( 'comment' );
287
  // Help panel - sidebar links
288
  get_current_screen()->set_help_sidebar(
289
  '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
290
+ '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
291
  );
292
  }
293
 
411
  *
412
  * @since BuddyPress (1.6.0)
413
  *
414
+ * @param array Array holding spam, not spam, deleted counts, error IDs.
415
+ * @param string $redirect_to URL to redirect to.
416
  * @param array $activity_ids Original array of activity IDs.
417
  */
418
  do_action( 'bp_activity_admin_action_after', array( $spammed, $unspammed, $deleted, $errors ), $redirect_to, $activity_ids );
639
  *
640
  * @since BuddyPress (1.6.0)
641
  *
642
+ * @param array Array holding single activity object.
643
  */
644
  do_action_ref_array( 'bp_activity_admin_edit', array( &$activity ) ); ?>
645
 
816
  }
817
 
818
  /**
819
+ * Activity type metabox for the Activity admin edit screen
820
  *
821
  * @since BuddyPress (1.6.0)
822
  *
823
+ * @global object $bp BuddyPress global settings.
824
+ *
825
  * @param object $item Activity item.
826
  */
827
  function bp_activity_admin_edit_metabox_type( $item ) {
828
+ global $bp;
829
 
830
  $actions = array();
831
  $selected = $item->type;
890
  *
891
  * @since BuddyPress (1.6.0)
892
  *
893
+ * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list
894
+ * table.
895
+ * @global string $plugin_page The current plugin page.
896
  */
897
  function bp_activity_admin_index() {
898
  global $bp_activity_list_table, $plugin_page;
1004
  <a href="#" class="cancel button-secondary alignleft"><?php _e( 'Cancel', 'buddypress' ); ?></a>
1005
  <a href="#" class="save button-primary alignright"><?php _e( 'Reply', 'buddypress' ); ?></a>
1006
 
1007
+ <img class="waiting" style="display:none;" src="<?php echo esc_url( bp_get_admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
1008
  <span class="error" style="display:none;"></span>
1009
  <br class="clear" />
1010
  </p>
1023
  /**
1024
  * List table class for the Activity component admin page.
1025
  *
1026
+ * @since BuddyPress (1.6)
1027
  */
1028
  class BP_Activity_List_Table extends WP_List_Table {
1029
 
1054
  protected $activity_user_id = array();
1055
 
1056
  /**
1057
+ * If users can comment on blog & forum activity items
1058
  *
1059
  * @since BuddyPress (2.2.2)
1060
  *
1197
  $this->get_columns(),
1198
  array(),
1199
  $this->get_sortable_columns(),
 
1200
  );
1201
 
1202
  return $this->_column_headers;
1219
  function display() {
1220
  $this->display_tablenav( 'top' ); ?>
1221
 
1222
+ <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
1223
  <thead>
1224
  <tr>
1225
  <?php $this->print_column_headers(); ?>
1276
  * @since BuddyPress (1.6.0)
1277
  */
1278
  function get_views() {
1279
+ $url_base = bp_get_admin_url( 'admin.php?page=bp-activity' ); ?>
1280
 
1281
  <ul class="subsubsub">
1282
  <li class="all"><a href="<?php echo esc_url( $url_base ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
1283
+ <li class="spam"><a href="<?php echo esc_url( add_query_arg( 'activity_status', 'spam', $url_base ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%s)</span>', 'buddypress' ), number_format_i18n( $this->spam_count ) ); ?></a></li>
1284
 
1285
  <?php
1286
 
1290
  * @since BuddyPress (1.6.0)
1291
  *
1292
  * @param string $url_base Current URL base for view.
1293
+ * @param string $view Current view being displayed.
1294
  */
1295
  do_action( 'bp_activity_list_table_get_views', $url_base, $this->view ); ?>
1296
  </ul>
1411
  <?php
1412
  }
1413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1414
  /**
1415
  * Checkbox column markup.
1416
  *
1493
 
1494
  // Rollover actions
1495
 
1496
+ // Reply - javascript only; implemented by AJAX.
1497
  if ( 'spam' != $item_status ) {
1498
  if ( $this->can_comment( $item ) ) {
1499
  $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) );
1523
  * @since BuddyPress (1.6.0)
1524
  *
1525
  * @param array $actions Array of available actions user could use.
1526
+ * @param array $item Current item being added to page.
1527
  */
1528
  $actions = apply_filters( 'bp_activity_admin_comment_row_actions', array_filter( $actions ), $item );
1529
 
1569
  */
1570
  function column_response( $item ) {
1571
  // Is $item is a root activity?
 
 
 
 
 
 
 
 
 
 
1572
 
1573
  /**
1574
  * Filters default list of default root activity types.
1575
  *
1576
  * @since BuddyPress (1.6.0)
1577
  *
1578
+ * @param array Array of default activity types.
1579
+ * @param array $item Current item being displayed.
1580
  */
1581
  if ( empty( $item['item_id'] ) || ! in_array( $item['type'], apply_filters( 'bp_activity_admin_root_activity_types', array( 'activity_comment' ), $item ) ) ) {
 
 
1582
  $comment_count = !empty( $item['children'] ) ? bp_activity_recurse_comment_count( (object) $item ) : 0;
1583
  $root_activity_url = bp_get_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
1584
 
1585
  // If the activity has comments, display a link to the activity's permalink, with its comment count in a speech bubble
1586
  if ( $comment_count ) {
1587
  $title_attr = sprintf( _n( '%s related activity', '%s related activities', $comment_count, 'buddypress' ), number_format_i18n( $comment_count ) );
1588
+ printf( '<a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$s</span></a>', esc_url( $root_activity_url ), esc_attr( $title_attr ), number_format_i18n( $comment_count ) );
1589
  }
1590
 
1591
  // For non-root activities, display a link to the replied-to activity's author's profile
1592
  } else {
1593
  echo '<strong>' . get_avatar( $this->get_activity_user_id( $item['item_id'] ), '32' ) . ' ' . bp_core_get_userlink( $this->get_activity_user_id( $item['item_id'] ) ) . '</strong><br />';
 
1594
  }
 
1595
 
1596
+ // Activity permalink
1597
+ if ( ! $item['is_spam'] )
1598
+ printf( __( '<a href="%1$s">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) );
1599
  }
1600
 
1601
  /**
1607
  * @since BuddyPress (1.6.0)
1608
  *
1609
  * @param int $activity_id Activity ID to retrieve User ID for.
 
1610
  * @return int User ID of the activity item in question.
1611
  */
1612
  protected function get_activity_user_id( $activity_id ) {
1640
  * Checks if an activity item can be replied to.
1641
  *
1642
  * This method merges functionality from {@link bp_activity_can_comment()} and
1643
+ * {@link bp_blogs_disable_activity_commenting()}. This is done because the activity
1644
  * list table doesn't use a BuddyPress activity loop, which prevents those
1645
  * functions from working as intended.
1646
  *
1647
  * @since BuddyPress (2.0.0)
1648
  *
1649
  * @param array $item An array version of the BP_Activity_Activity object.
 
1650
  * @return bool
1651
  */
1652
  protected function can_comment( $item ) {
1711
  * @since BuddyPress (1.6.0)
1712
  *
1713
  * @param array $tree Source array.
 
1714
  * @return array Flattened array.
1715
  */
1716
  public static function flatten_activity_array( $tree ){
1727
 
1728
  return $tree;
1729
  }
 
 
 
 
 
 
 
 
 
 
 
 
1730
  }
bp-activity/bp-activity-akismet.php CHANGED
@@ -3,7 +3,7 @@
3
  * Akismet support for BuddyPress' Activity Stream.
4
  *
5
  * @package BuddyPress
6
- * @since BuddyPress (1.6.0)
7
  * @subpackage Activity
8
  */
9
 
@@ -13,8 +13,7 @@ defined( 'ABSPATH' ) || exit;
13
  /**
14
  * Akismet support for the Activity component.
15
  *
16
- * @since BuddyPress (1.6.0)
17
- * @since BuddyPress (2.3.0) We only support Akismet 3+.
18
  */
19
  class BP_Akismet {
20
  /**
@@ -22,14 +21,14 @@ class BP_Akismet {
22
  *
23
  * @access protected
24
  * @var BP_Activity_Activity
25
- * @since BuddyPress (1.6.0)
26
  */
27
  protected $last_activity = null;
28
 
29
  /**
30
  * Constructor.
31
  *
32
- * @since BuddyPress (1.6.0)
33
  */
34
  public function __construct() {
35
  $this->setup_actions();
@@ -38,7 +37,7 @@ class BP_Akismet {
38
  /**
39
  * Hook Akismet into the activity stream.
40
  *
41
- * @since BuddyPress (1.6.0)
42
  */
43
  protected function setup_actions() {
44
  // Add nonces to activity stream lists
@@ -70,11 +69,10 @@ class BP_Akismet {
70
  * This function lifted with love from the Akismet WordPress plugin's
71
  * akismet_comment_row_action() function. Thanks!
72
  *
73
- * @since BuddyPress (1.6.0)
74
  *
75
- * @param array $actions The hover links.
76
  * @param array $activity The activity for the current row being processed.
77
- *
78
  * @return array The hover links.
79
  */
80
  function comment_row_action( $actions, $activity ) {
@@ -131,9 +129,9 @@ class BP_Akismet {
131
  * the reply form of each activity item. The nonces are, in turn, used
132
  * by Akismet to help detect spam activity.
133
  *
134
- * @since BuddyPress (1.6.0)
135
  *
136
- * @see https://plugins.trac.wordpress.org/ticket/1232
137
  */
138
  public function add_activity_stream_nonce() {
139
  $form_id = '_bp_as_nonce';
@@ -160,13 +158,13 @@ class BP_Akismet {
160
  * This can't be done in BP_Akismet::check_activity() due to the
161
  * default AJAX implementation; see bp_dtheme_post_update().
162
  *
163
- * @since BuddyPress (1.6.0)
164
  *
165
  * @see bp_dtheme_post_update()
166
  *
167
- * @param string $content Activity update text.
168
- * @param int $user_id User ID.
169
- * @param int $activity_id Activity ID.
170
  */
171
  public function check_member_activity_update( $content, $user_id, $activity_id ) {
172
  // By default, only handle activity updates and activity comments.
@@ -186,7 +184,7 @@ class BP_Akismet {
186
  *
187
  * This function is intended to be used inside the activity stream loop.
188
  *
189
- * @since BuddyPress (1.6.0)
190
  */
191
  public function add_activity_spam_button() {
192
  if ( !bp_activity_user_can_mark_spam() )
@@ -214,7 +212,7 @@ class BP_Akismet {
214
  *
215
  * This function is intended to be used inside the activity stream loop.
216
  *
217
- * @since BuddyPress (1.6.0)
218
  */
219
  public function add_activity_comment_spam_button() {
220
  if ( !bp_activity_user_can_mark_spam() )
@@ -241,7 +239,7 @@ class BP_Akismet {
241
  /**
242
  * Get a filterable list of activity types that Akismet should automatically check for spam.
243
  *
244
- * @since BuddyPress (1.6.0)
245
  *
246
  * @static
247
  *
@@ -262,12 +260,10 @@ class BP_Akismet {
262
  /**
263
  * Mark activity item as spam.
264
  *
265
- * @since BuddyPress (1.6.0)
266
  *
267
- * @param BP_Activity_Activity $activity Activity item being spammed.
268
- * @param string $source Either "by_a_person" (e.g. a person has
269
- * manually marked the activity as spam) or
270
- * "by_akismet" (automatically spammed).
271
  */
272
  public function mark_as_spam( $activity, $source ) {
273
  // Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update()
@@ -279,10 +275,7 @@ class BP_Akismet {
279
  * @since BuddyPress (1.6.0)
280
  *
281
  * @param BP_Activity_Activity $activity Activity object being marked as spam.
282
- * @param string $source Source of the whom marked as spam.
283
- * Either "by_a_person" (e.g. a person has
284
- * manually marked the activity as spam)
285
- * or "by_akismet".
286
  */
287
  do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source );
288
  }
@@ -290,12 +283,10 @@ class BP_Akismet {
290
  /**
291
  * Mark activity item as ham.
292
  *
293
- * @since BuddyPress (1.6.0)
294
  *
295
- * @param BP_Activity_Activity $activity Activity item being hammed.
296
- * @param string $source Either "by_a_person" (e.g. a person has
297
- * manually marked the activity as ham) or
298
- * "by_akismet" (automatically hammed).
299
  */
300
  public function mark_as_ham( $activity, $source ) {
301
  // If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped.
@@ -308,10 +299,7 @@ class BP_Akismet {
308
  * @since BuddyPress (1.6.0)
309
  *
310
  * @param BP_Activity_Activity $activity Activity object being marked as ham.
311
- * @param string $source Source of the whom marked as ham.
312
- * Either "by_a_person" (e.g. a person has
313
- * manually marked the activity as ham) or
314
- * "by_akismet" (automatically hammed).
315
  */
316
  do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
317
  }
@@ -319,14 +307,12 @@ class BP_Akismet {
319
  /**
320
  * Build a data package for the Akismet service to inspect.
321
  *
322
- * @since BuddyPress (1.6.0)
323
  *
324
  * @see http://akismet.com/development/api/#comment-check
325
  * @static
326
  *
327
  * @param BP_Activity_Activity $activity Activity item data.
328
- *
329
- * @return array
330
  */
331
  public static function build_akismet_data_package( $activity ) {
332
  $userdata = get_userdata( $activity->user_id );
@@ -340,7 +326,7 @@ class BP_Akismet {
340
  $activity_data['comment_type'] = $activity->type;
341
  $activity_data['permalink'] = bp_activity_get_permalink( $activity->id, $activity );
342
  $activity_data['user_ID'] = $userdata->ID;
343
- $activity_data['user_role'] = Akismet::get_user_roles( $userdata->ID );
344
 
345
  /**
346
  * Get the nonce if the new activity was submitted through the "what's up, Paul?" form.
@@ -361,8 +347,8 @@ class BP_Akismet {
361
  *
362
  * @since BuddyPress (1.6.0)
363
  *
364
- * @param array $activity_data Array of activity data for Akismet to inspect.
365
- * @param BP_Activity_Activity $activity Activity item data.
366
  */
367
  return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity );
368
  }
@@ -370,7 +356,7 @@ class BP_Akismet {
370
  /**
371
  * Check if the activity item is spam or ham.
372
  *
373
- * @since BuddyPress (1.6.0)
374
  *
375
  * @see http://akismet.com/development/api/
376
  * @todo Spam counter?
@@ -405,9 +391,8 @@ class BP_Akismet {
405
  *
406
  * @since BuddyPress (1.6.0)
407
  *
408
- * @param BP_Activity_Activity $activity The activity item proven to be spam.
409
- * @param array $activity_data Array of activity data for item including
410
- * Akismet check results data.
411
  */
412
  do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) );
413
 
@@ -422,7 +407,7 @@ class BP_Akismet {
422
  /**
423
  * Update activity meta after a manual spam change (user-initiated).
424
  *
425
- * @since BuddyPress (1.6.0)
426
  *
427
  * @param BP_Activity_Activity $activity The activity to check.
428
  */
@@ -439,7 +424,7 @@ class BP_Akismet {
439
  /**
440
  * Update activity meta after a manual ham change (user-initiated).
441
  *
442
- * @since BuddyPress (1.6.0)
443
  *
444
  * @param BP_Activity_Activity $activity The activity to check.
445
  */
@@ -456,7 +441,7 @@ class BP_Akismet {
456
  /**
457
  * Update activity meta after an automatic spam check (not user-initiated).
458
  *
459
- * @since BuddyPress (1.6.0)
460
  *
461
  * @param BP_Activity_Activity $activity The activity to check.
462
  */
@@ -494,15 +479,23 @@ class BP_Akismet {
494
  *
495
  * Props to WordPress core Akismet plugin for a lot of this.
496
  *
497
- * @since BuddyPress (1.6.0)
498
  *
499
- * @param array $activity_data Packet of information to submit to Akismet.
500
- * @param string $check "check" or "submit".
501
- * @param string $spam "spam" or "ham".
502
  *
 
 
 
503
  * @return array $activity_data Activity data, with Akismet data added.
504
  */
505
  public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) {
 
 
 
 
 
 
506
  $query_string = $path = '';
507
 
508
  $activity_data['blog'] = bp_get_option( 'home' );
@@ -512,7 +505,7 @@ class BP_Akismet {
512
  $activity_data['user_agent'] = bp_core_current_user_ua();
513
  $activity_data['user_ip'] = bp_core_current_user_ip();
514
 
515
- if ( Akismet::is_test_mode() )
516
  $activity_data['is_test'] = 'true';
517
 
518
  // Loop through _POST args and rekey strings
@@ -540,13 +533,13 @@ class BP_Akismet {
540
  $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
541
 
542
  if ( 'check' == $check )
543
- $path = 'comment-check';
544
  elseif ( 'submit' == $check )
545
- $path = 'submit-' . $spam;
546
 
547
  // Send to Akismet
548
  add_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
549
- $response = Akismet::http_post( $query_string, $path );
550
  remove_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
551
 
552
  // Get the response
@@ -565,10 +558,9 @@ class BP_Akismet {
565
  /**
566
  * Filters user agent when sending to Akismet to add BuddyPress info.
567
  *
568
- * @since BuddyPress (1.6.0)
569
  *
570
  * @param string $user_agent User agent string, as generated by Akismet.
571
- *
572
  * @return string $user_agent Modified user agent string.
573
  */
574
  public function buddypress_ua( $user_agent ) {
@@ -579,7 +571,7 @@ class BP_Akismet {
579
  /**
580
  * Adds a "History" meta box to the activity edit screen.
581
  *
582
- * @since BuddyPress (1.6.0)
583
  *
584
  * @param string $screen_action The type of screen that has been requested.
585
  */
@@ -595,9 +587,9 @@ class BP_Akismet {
595
  /**
596
  * History meta box for the Activity admin edit screen.
597
  *
598
- * @since BuddyPress (1.6.0)
599
  *
600
- * @see https://buddypress.trac.wordpress.org/ticket/3907
601
  * @todo Update activity meta to allow >1 record with the same key (iterate through $history).
602
  *
603
  * @param object $item Activity item.
@@ -616,17 +608,17 @@ class BP_Akismet {
616
  /**
617
  * Update an activity item's Akismet history.
618
  *
619
- * @since BuddyPress (1.6.0)
620
  *
621
- * @param int $activity_id Activity item ID.
622
- * @param string $message Human-readable description of what's changed.
623
- * @param string $event The type of check we were carrying out.
624
  */
625
  public function update_activity_history( $activity_id = 0, $message = '', $event = '' ) {
626
  $event = array(
627
  'event' => $event,
628
  'message' => $message,
629
- 'time' => Akismet::_get_microtime(),
630
  'user' => bp_loggedin_user_id(),
631
  );
632
 
@@ -637,10 +629,9 @@ class BP_Akismet {
637
  /**
638
  * Get an activity item's Akismet history.
639
  *
640
- * @since BuddyPress (1.6.0)
641
  *
642
  * @param int $activity_id Activity item ID.
643
- *
644
  * @return array The activity item's Akismet history.
645
  */
646
  public function get_activity_history( $activity_id = 0 ) {
@@ -656,19 +647,18 @@ class BP_Akismet {
656
  }
657
 
658
  /**
659
- * Delete old spam activity meta data.
660
  *
661
  * This is done as a clean-up mechanism, as _bp_akismet_submission meta can
662
  * grow to be quite large.
663
  *
664
- * @since BuddyPress (1.6.0)
665
  *
 
666
  * @global wpdb $wpdb WordPress database object.
667
  */
668
  function bp_activity_akismet_delete_old_metadata() {
669
- global $wpdb;
670
-
671
- $bp = buddypress();
672
 
673
  /**
674
  * Filters the threshold for how many days old Akismet metadata needs to be before being automatically deleted.
3
  * Akismet support for BuddyPress' Activity Stream.
4
  *
5
  * @package BuddyPress
6
+ * @since BuddyPress (1.6)
7
  * @subpackage Activity
8
  */
9
 
13
  /**
14
  * Akismet support for the Activity component.
15
  *
16
+ * @since BuddyPress (1.6)
 
17
  */
18
  class BP_Akismet {
19
  /**
21
  *
22
  * @access protected
23
  * @var BP_Activity_Activity
24
+ * @since BuddyPress (1.6)
25
  */
26
  protected $last_activity = null;
27
 
28
  /**
29
  * Constructor.
30
  *
31
+ * @since BuddyPress (1.6)
32
  */
33
  public function __construct() {
34
  $this->setup_actions();
37
  /**
38
  * Hook Akismet into the activity stream.
39
  *
40
+ * @since BuddyPress (1.6)
41
  */
42
  protected function setup_actions() {
43
  // Add nonces to activity stream lists
69
  * This function lifted with love from the Akismet WordPress plugin's
70
  * akismet_comment_row_action() function. Thanks!
71
  *
72
+ * @since BuddyPress (1.6)
73
  *
74
+ * @param array $actions The hover links.
75
  * @param array $activity The activity for the current row being processed.
 
76
  * @return array The hover links.
77
  */
78
  function comment_row_action( $actions, $activity ) {
129
  * the reply form of each activity item. The nonces are, in turn, used
130
  * by Akismet to help detect spam activity.
131
  *
132
+ * @since BuddyPress (1.6)
133
  *
134
+ * @see http://plugins.trac.wordpress.org/ticket/1232
135
  */
136
  public function add_activity_stream_nonce() {
137
  $form_id = '_bp_as_nonce';
158
  * This can't be done in BP_Akismet::check_activity() due to the
159
  * default AJAX implementation; see bp_dtheme_post_update().
160
  *
161
+ * @since BuddyPress (1.6)
162
  *
163
  * @see bp_dtheme_post_update()
164
  *
165
+ * @param string $content Activity update text.
166
+ * @param int $user_id User ID.
167
+ * @param int $activity_id Activity ID.
168
  */
169
  public function check_member_activity_update( $content, $user_id, $activity_id ) {
170
  // By default, only handle activity updates and activity comments.
184
  *
185
  * This function is intended to be used inside the activity stream loop.
186
  *
187
+ * @since BuddyPress (1.6)
188
  */
189
  public function add_activity_spam_button() {
190
  if ( !bp_activity_user_can_mark_spam() )
212
  *
213
  * This function is intended to be used inside the activity stream loop.
214
  *
215
+ * @since BuddyPress (1.6)
216
  */
217
  public function add_activity_comment_spam_button() {
218
  if ( !bp_activity_user_can_mark_spam() )
239
  /**
240
  * Get a filterable list of activity types that Akismet should automatically check for spam.
241
  *
242
+ * @since BuddyPress (1.6)
243
  *
244
  * @static
245
  *
260
  /**
261
  * Mark activity item as spam.
262
  *
263
+ * @since BuddyPress (1.6)
264
  *
265
+ * @param BP_Activity_Activity $activity
266
+ * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed).
 
 
267
  */
268
  public function mark_as_spam( $activity, $source ) {
269
  // Record this item so we can do some tidyup in BP_Akismet::check_member_activity_update()
275
  * @since BuddyPress (1.6.0)
276
  *
277
  * @param BP_Activity_Activity $activity Activity object being marked as spam.
278
+ * @param string $source Source of the whom marked as spam. Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet".
 
 
 
279
  */
280
  do_action( 'bp_activity_akismet_mark_as_spam', $activity, $source );
281
  }
283
  /**
284
  * Mark activity item as ham.
285
  *
286
+ * @since BuddyPress (1.6)
287
  *
288
+ * @param BP_Activity_Activity $activity
289
+ * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed).
 
 
290
  */
291
  public function mark_as_ham( $activity, $source ) {
292
  // If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped.
299
  * @since BuddyPress (1.6.0)
300
  *
301
  * @param BP_Activity_Activity $activity Activity object being marked as ham.
302
+ * @param string $source Source of the whom marked as ham. Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed).
 
 
 
303
  */
304
  do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
305
  }
307
  /**
308
  * Build a data package for the Akismet service to inspect.
309
  *
310
+ * @since BuddyPress (1.6)
311
  *
312
  * @see http://akismet.com/development/api/#comment-check
313
  * @static
314
  *
315
  * @param BP_Activity_Activity $activity Activity item data.
 
 
316
  */
317
  public static function build_akismet_data_package( $activity ) {
318
  $userdata = get_userdata( $activity->user_id );
326
  $activity_data['comment_type'] = $activity->type;
327
  $activity_data['permalink'] = bp_activity_get_permalink( $activity->id, $activity );
328
  $activity_data['user_ID'] = $userdata->ID;
329
+ $activity_data['user_role'] = akismet_get_user_roles( $userdata->ID );
330
 
331
  /**
332
  * Get the nonce if the new activity was submitted through the "what's up, Paul?" form.
347
  *
348
  * @since BuddyPress (1.6.0)
349
  *
350
+ * @param array $activity_data Array of activity data for Akismet to inspect.
351
+ * @param BP_Activity_Activity $activity Activity item data.
352
  */
353
  return apply_filters( 'bp_akismet_build_akismet_data_package', $activity_data, $activity );
354
  }
356
  /**
357
  * Check if the activity item is spam or ham.
358
  *
359
+ * @since BuddyPress (1.6)
360
  *
361
  * @see http://akismet.com/development/api/
362
  * @todo Spam counter?
391
  *
392
  * @since BuddyPress (1.6.0)
393
  *
394
+ * @param BP_Activity_Activity $activity The activity item proven to be spam.
395
+ * @param array $activity_data Array of activity data for item including Akismet check results data.
 
396
  */
397
  do_action_ref_array( 'bp_activity_akismet_spam_caught', array( &$activity, $activity_data ) );
398
 
407
  /**
408
  * Update activity meta after a manual spam change (user-initiated).
409
  *
410
+ * @since BuddyPress (1.6)
411
  *
412
  * @param BP_Activity_Activity $activity The activity to check.
413
  */
424
  /**
425
  * Update activity meta after a manual ham change (user-initiated).
426
  *
427
+ * @since BuddyPress (1.6)
428
  *
429
  * @param BP_Activity_Activity $activity The activity to check.
430
  */
441
  /**
442
  * Update activity meta after an automatic spam check (not user-initiated).
443
  *
444
+ * @since BuddyPress (1.6)
445
  *
446
  * @param BP_Activity_Activity $activity The activity to check.
447
  */
479
  *
480
  * Props to WordPress core Akismet plugin for a lot of this.
481
  *
482
+ * @since BuddyPress (1.6)
483
  *
484
+ * @global string $akismet_api_host
485
+ * @global string $akismet_api_port
 
486
  *
487
+ * @param array $activity_data Packet of information to submit to Akismet.
488
+ * @param string $check "check" or "submit".
489
+ * @param string $spam "spam" or "ham".
490
  * @return array $activity_data Activity data, with Akismet data added.
491
  */
492
  public function send_akismet_request( $activity_data, $check = 'check', $spam = 'spam' ) {
493
+ global $akismet_api_host, $akismet_api_port;
494
+
495
+ // Check that host and port are set, if not, set them
496
+ if ( function_exists( 'akismet_init' ) && ( empty( $akismet_api_host ) || empty( $akismet_api_port ) ) )
497
+ akismet_init();
498
+
499
  $query_string = $path = '';
500
 
501
  $activity_data['blog'] = bp_get_option( 'home' );
505
  $activity_data['user_agent'] = bp_core_current_user_ua();
506
  $activity_data['user_ip'] = bp_core_current_user_ip();
507
 
508
+ if ( akismet_test_mode() )
509
  $activity_data['is_test'] = 'true';
510
 
511
  // Loop through _POST args and rekey strings
533
  $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&';
534
 
535
  if ( 'check' == $check )
536
+ $path = '/1.1/comment-check';
537
  elseif ( 'submit' == $check )
538
+ $path = '/1.1/submit-' . $spam;
539
 
540
  // Send to Akismet
541
  add_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
542
+ $response = akismet_http_post( $query_string, $akismet_api_host, $path, $akismet_api_port );
543
  remove_filter( 'akismet_ua', array( $this, 'buddypress_ua' ) );
544
 
545
  // Get the response
558
  /**
559
  * Filters user agent when sending to Akismet to add BuddyPress info.
560
  *
561
+ * @since BuddyPress (1.6)
562
  *
563
  * @param string $user_agent User agent string, as generated by Akismet.
 
564
  * @return string $user_agent Modified user agent string.
565
  */
566
  public function buddypress_ua( $user_agent ) {
571
  /**
572
  * Adds a "History" meta box to the activity edit screen.
573
  *
574
+ * @since BuddyPress (1.6)
575
  *
576
  * @param string $screen_action The type of screen that has been requested.
577
  */
587
  /**
588
  * History meta box for the Activity admin edit screen.
589
  *
590
+ * @since BuddyPress (1.6)
591
  *
592
+ * @see http://buddypress.trac.wordpress.org/ticket/3907
593
  * @todo Update activity meta to allow >1 record with the same key (iterate through $history).
594
  *
595
  * @param object $item Activity item.
608
  /**
609
  * Update an activity item's Akismet history.
610
  *
611
+ * @since BuddyPress (1.6)
612
  *
613
+ * @param int $activity_id Activity item ID.
614
+ * @param string $message Human-readable description of what's changed.
615
+ * @param string $event The type of check we were carrying out.
616
  */
617
  public function update_activity_history( $activity_id = 0, $message = '', $event = '' ) {
618
  $event = array(
619
  'event' => $event,
620
  'message' => $message,
621
+ 'time' => akismet_microtime(),
622
  'user' => bp_loggedin_user_id(),
623
  );
624
 
629
  /**
630
  * Get an activity item's Akismet history.
631
  *
632
+ * @since BuddyPress (1.6)
633
  *
634
  * @param int $activity_id Activity item ID.
 
635
  * @return array The activity item's Akismet history.
636
  */
637
  public function get_activity_history( $activity_id = 0 ) {
647
  }
648
 
649
  /**
650
+ * Delete old spam activity meta data
651
  *
652
  * This is done as a clean-up mechanism, as _bp_akismet_submission meta can
653
  * grow to be quite large.
654
  *
655
+ * @since BuddyPress (1.6)
656
  *
657
+ * @global object $bp BuddyPress global settings.
658
  * @global wpdb $wpdb WordPress database object.
659
  */
660
  function bp_activity_akismet_delete_old_metadata() {
661
+ global $bp, $wpdb;
 
 
662
 
663
  /**
664
  * Filters the threshold for how many days old Akismet metadata needs to be before being automatically deleted.
bp-activity/bp-activity-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Functions related to the BuddyPress Activity component and the WP Cache.
5
  *
6
- * @since BuddyPress (1.6.0)
7
  */
8
 
9
  // Exit if accessed directly
@@ -16,11 +16,11 @@ defined( 'ABSPATH' ) || exit;
16
  * in $activity_ids and adds it to the WP cache. This improves efficiency when
17
  * using querying activitymeta inline.
18
  *
19
- * @param int|string|array|bool $activity_ids Accepts a single activity ID, or a comma-
20
- * separated list or array of activity ids
21
  */
22
  function bp_activity_update_meta_cache( $activity_ids = false ) {
23
- $bp = buddypress();
24
 
25
  $cache_args = array(
26
  'object_ids' => $activity_ids,
@@ -37,7 +37,7 @@ function bp_activity_update_meta_cache( $activity_ids = false ) {
37
  /**
38
  * Clear a cached activity item when that item is updated.
39
  *
40
- * @since BuddyPress (2.0.0)
41
  *
42
  * @param BP_Activity_Activity $activity
43
  */
@@ -50,7 +50,7 @@ add_action( 'bp_activity_after_save', 'bp_activity_clear_cache_for_activity' );
50
  /**
51
  * Clear cached data for deleted activity items.
52
  *
53
- * @since BuddyPress (2.0.0)
54
  *
55
  * @param array $deleted_ids IDs of deleted activity items.
56
  */
3
  /**
4
  * Functions related to the BuddyPress Activity component and the WP Cache.
5
  *
6
+ * @since BuddyPress (1.6)
7
  */
8
 
9
  // Exit if accessed directly
16
  * in $activity_ids and adds it to the WP cache. This improves efficiency when
17
  * using querying activitymeta inline.
18
  *
19
+ * @param int|str|array $activity_ids Accepts a single activity ID, or a comma-
20
+ * separated list or array of activity ids
21
  */
22
  function bp_activity_update_meta_cache( $activity_ids = false ) {
23
+ global $bp;
24
 
25
  $cache_args = array(
26
  'object_ids' => $activity_ids,
37
  /**
38
  * Clear a cached activity item when that item is updated.
39
  *
40
+ * @since 2.0
41
  *
42
  * @param BP_Activity_Activity $activity
43
  */
50
  /**
51
  * Clear cached data for deleted activity items.
52
  *
53
+ * @since 2.0
54
  *
55
  * @param array $deleted_ids IDs of deleted activity items.
56
  */
bp-activity/bp-activity-classes.php CHANGED
@@ -9,6 +9,2382 @@
9
  // Exit if accessed directly
10
  defined( 'ABSPATH' ) || exit;
11
 
12
- require dirname( __FILE__ ) . '/classes/class-bp-activity-activity.php';
13
- require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
14
- require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';