Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ai
noblogs-wp
Commits
def17b7b
Commit
def17b7b
authored
Jul 25, 2015
by
ale
Committed by
lucha
Oct 29, 2016
Browse files
[auto] Plugin: buddypress 2.3.2.1
parent
f31925a0
Changes
346
Expand all
Hide whitespace changes
Inline
Side-by-side
wp-content/plugins/buddypress/bp-activity/admin/css/admin-rtl.min.css
View file @
def17b7b
/*! buddypress - v2.1.0 - 2014-10-06 9:39:09 PM UTC - https://wordpress.org/plugins/buddypress/ */
.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%
}
\ No newline at end of file
wp-content/plugins/buddypress/bp-activity/admin/css/admin.min.css
View file @
def17b7b
/*! buddypress - v2.1.0 - 2014-10-06 9:39:09 PM UTC - https://wordpress.org/plugins/buddypress/ */
.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%
}
\ No newline at end of file
wp-content/plugins/buddypress/bp-activity/admin/js/admin.js
View file @
def17b7b
...
...
@@ -165,9 +165,11 @@ $(document).ready( function () {
$
(
'
#bp_activity_action h3, #bp_activity_content h3
'
).
unbind
(
'
click
'
);
// redo the post box toggles to reset the one made by comment.js in favor
// of activity administration page id so that metaboxes are still collapsible
// of activity administration page id so that metaboxes are still collapsible
// in single Activity Administration screen.
postboxes
.
add_postbox_toggles
(
bp_activity_admin_vars
.
page
);
if
(
typeof
postboxes
!==
'
undefined
'
)
{
postboxes
.
add_postbox_toggles
(
bp_activity_admin_vars
.
page
);
}
});
})(
jQuery
);
wp-content/plugins/buddypress/bp-activity/admin/js/admin.min.js
View file @
def17b7b
/*! buddypress - v2.1.0 - 2014-10-06 9:39:07 PM UTC - https://wordpress.org/plugins/buddypress/ */
!
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
"
),
postboxes
.
add_postbox_toggles
(
bp_activity_admin_vars
.
page
)})}(
jQuery
);
\ No newline at end of file
/*! buddypress - v2.3.1 - 2015-06-05 1:48:13 PM UTC - https://wordpress.org/plugins/buddypress/ */
!
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
);
\ No newline at end of file
wp-content/plugins/buddypress/bp-activity/bp-activity-actions.php
View file @
def17b7b
...
...
@@ -10,16 +10,22 @@
*/
// Exit if accessed directly
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
defined
(
'ABSPATH'
)
||
exit
;
/**
* Allow core components and dependent plugins to register activity actions.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses do_action() To call 'bp_register_activity_actions' hook.
*/
function
bp_register_activity_actions
()
{
/**
* Fires on bp_init to allow core components and dependent plugins to register activity actions.
*
* @since BuddyPress (1.2.0)
*/
do_action
(
'bp_register_activity_actions'
);
}
add_action
(
'bp_init'
,
'bp_register_activity_actions'
,
8
);
...
...
@@ -27,9 +33,8 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
/**
* Catch and route requests for single activity item permalinks.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @global object $bp BuddyPress global settings
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses bp_action_variable()
...
...
@@ -85,7 +90,7 @@ function bp_activity_action_permalink_router() {
}
// Set redirect to users' activity stream
}
else
if
(
!
empty
(
$activity
->
user_id
)
)
{
}
elseif
(
!
empty
(
$activity
->
user_id
)
)
{
$redirect
=
bp_core_get_user_domain
(
$activity
->
user_id
,
$activity
->
user_nicename
,
$activity
->
user_login
)
.
bp_get_activity_slug
()
.
'/'
.
$activity
->
id
.
'/'
;
}
...
...
@@ -96,7 +101,13 @@ function bp_activity_action_permalink_router() {
$redirect
=
add_query_arg
(
urlencode_deep
(
$query_frags
),
$redirect
);
}
// Allow redirect to be filtered
/**
* Filter the intended redirect url before the redirect occurs for the single activity item.
*
* @since BuddyPress (1.2.2)
*
* @param array Array with url to redirect to and activity related to the redirect.
*/
if
(
!
$redirect
=
apply_filters_ref_array
(
'bp_activity_permalink_redirect_url'
,
array
(
$redirect
,
&
$activity
)
)
)
{
bp_core_redirect
(
bp_get_root_domain
()
);
}
...
...
@@ -109,7 +120,7 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
/**
* Delete specific activity item and redirect to previous page.
*
* @since BuddyPress (1.1)
* @since BuddyPress (1.1
.0
)
*
* @param int $activity_id Activity id to be deleted. Defaults to 0.
*
...
...
@@ -149,7 +160,14 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
if
(
!
bp_activity_user_can_delete
(
$activity
)
)
return
false
;
// Call the action before the delete so plugins can still fetch information about it
/**
* Fires before the deletion so plugins can still fetch information about it.
*
* @since BuddyPress (1.5.0)
*
* @param int $activity_id The activity ID.
* @param int $user_id The user associated with the activity.
*/
do_action
(
'bp_activity_before_action_delete_activity'
,
$activity_id
,
$activity
->
user_id
);
// Delete the activity item and provide user feedback
...
...
@@ -158,6 +176,14 @@ function bp_activity_action_delete_activity( $activity_id = 0 ) {
else
bp_core_add_message
(
__
(
'There was an error when deleting that activity'
,
'buddypress'
),
'error'
);
/**
* Fires after the deletion so plugins can act afterwards based on the activity.
*
* @since BuddyPress (1.1.0)
*
* @param int $activity_id The activity ID.
* @param int $user_id The user associated with the activity.
*/
do_action
(
'bp_activity_action_delete_activity'
,
$activity_id
,
$activity
->
user_id
);
// Check for the redirect query arg, otherwise let WP handle things
...
...
@@ -171,14 +197,14 @@ add_action( 'bp_actions', 'bp_activity_action_delete_activity' );
/**
* Mark specific activity item as spam and redirect to previous page.
*
* @since BuddyPress (1.6)
* @since BuddyPress (1.6
.0
)
*
* @global object $bp BuddyPress global settings
* @param int $activity_id Activity id to be deleted. Defaults to 0.
*
* @return bool False on failure.
*/
function
bp_activity_action_spam_activity
(
$activity_id
=
0
)
{
global
$bp
;
$bp
=
buddypress
()
;
// Not viewing activity, or action is not spam, or Akismet isn't present
if
(
!
bp_is_activity_component
()
||
!
bp_is_current_action
(
'spam'
)
||
empty
(
$bp
->
activity
->
akismet
)
)
...
...
@@ -203,16 +229,31 @@ function bp_activity_action_spam_activity( $activity_id = 0 ) {
// Check nonce
check_admin_referer
(
'bp_activity_akismet_spam_'
.
$activity
->
id
);
// Call an action before the spamming so plugins can modify things if they want to
/**
* Fires before the marking activity as spam so plugins can modify things if they want to.
*
* @since BuddyPress (1.6.0)
*
* @param int $activity_id Activity ID to be marked as spam.
* @param object $activity Activity object for the ID to be marked as spam.
*/
do_action
(
'bp_activity_before_action_spam_activity'
,
$activity
->
id
,
$activity
);
// Mark as spam
bp_activity_mark_as_spam
(
$activity
);
$activity
->
save
();
// Tell the user the spamming has been succesful
// Tell the user the spamming has been succes
s
ful
bp_core_add_message
(
__
(
'The activity item has been marked as spam and is no longer visible.'
,
'buddypress'
)
);
/**
* Fires after the marking activity as spam so plugins can act afterwards based on the activity.
*
* @since BuddyPress (1.6.0)
*
* @param int $activity_id Activity ID that was marked as spam.
* @param int $user_id User ID associated with activity.
*/
do_action
(
'bp_activity_action_spam_activity'
,
$activity_id
,
$activity
->
user_id
);
// Check for the redirect query arg, otherwise let WP handle things
...
...
@@ -226,7 +267,7 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
/**
* Post user/group activity update.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
...
...
@@ -253,14 +294,36 @@ function bp_activity_action_post_update() {
// Check the nonce
check_admin_referer
(
'post_update'
,
'_wpnonce_post_update'
);
// Get activity info
/**
* Filters the content provided in the activity input field.
*
* @since BuddyPress (1.2.0)
*
* @param string $value Activity message being posted.
*/
$content
=
apply_filters
(
'bp_activity_post_update_content'
,
$_POST
[
'whats-new'
]
);
if
(
!
empty
(
$_POST
[
'whats-new-post-object'
]
)
)
{
/**
* Filters the item type that the activity update should be associated with.
*
* @since BuddyPress (1.2.0)
*
* @param string $value Item type to associate with.
*/
$object
=
apply_filters
(
'bp_activity_post_update_object'
,
$_POST
[
'whats-new-post-object'
]
);
}
if
(
!
empty
(
$_POST
[
'whats-new-post-in'
]
)
)
{
/**
* Filters what component the activity is being to.
*
* @since BuddyPress (1.2.0)
*
* @param string $value Chosen component to post activity to.
*/
$item_id
=
apply_filters
(
'bp_activity_post_update_item_id'
,
$_POST
[
'whats-new-post-in'
]
);
}
...
...
@@ -275,13 +338,22 @@ function bp_activity_action_post_update() {
$activity_id
=
bp_activity_post_update
(
array
(
'content'
=>
$content
)
);
// Post to groups object
}
else
if
(
'groups'
==
$object
&&
bp_is_active
(
'groups'
)
)
{
}
elseif
(
'groups'
==
$object
&&
bp_is_active
(
'groups'
)
)
{
if
(
(
int
)
$item_id
)
{
$activity_id
=
groups_post_update
(
array
(
'content'
=>
$content
,
'group_id'
=>
$item_id
)
);
}
// Special circumstance so let filters handle it
}
else
{
/**
* Filters activity object for BuddyPress core and plugin authors before posting activity update.
*
* @since BuddyPress (1.2.0)
*
* @param string $object Activity item being associated to.
* @param string $item_id Component ID being posted to.
* @param string $content Activity content being posted.
*/
$activity_id
=
apply_filters
(
'bp_activity_custom_update'
,
$object
,
$item_id
,
$content
);
}
...
...
@@ -289,7 +361,7 @@ function bp_activity_action_post_update() {
if
(
!
empty
(
$activity_id
)
)
bp_core_add_message
(
__
(
'Update Posted!'
,
'buddypress'
)
);
else
bp_core_add_message
(
__
(
'There was an error when posting your update
, p
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_add_message
(
__
(
'There was an error when posting your update
. P
lease try again.'
,
'buddypress'
),
'error'
);
// Redirect
bp_core_redirect
(
wp_get_referer
()
);
...
...
@@ -299,7 +371,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
/**
* Post new activity comment.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
...
...
@@ -322,7 +394,22 @@ function bp_activity_action_post_comment() {
// Check the nonce
check_admin_referer
(
'new_activity_comment'
,
'_wpnonce_new_activity_comment'
);
/**
* Filters the activity ID a comment will be in reply to.
*
* @since BuddyPress (1.2.0)
*
* @param string $value ID of the activity being replied to.
*/
$activity_id
=
apply_filters
(
'bp_activity_post_comment_activity_id'
,
$_POST
[
'comment_form_id'
]
);
/**
* Filters the comment content for a comment reply.
*
* @since BuddyPress (1.2.0)
*
* @param string $value Comment content being posted.
*/
$content
=
apply_filters
(
'bp_activity_post_comment_content'
,
$_POST
[
'ac_input_'
.
$activity_id
]
);
if
(
empty
(
$content
)
)
{
...
...
@@ -339,7 +426,7 @@ function bp_activity_action_post_comment() {
if
(
!
empty
(
$comment_id
)
)
bp_core_add_message
(
__
(
'Reply Posted!'
,
'buddypress'
)
);
else
bp_core_add_message
(
__
(
'There was an error posting that reply
, p
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_add_message
(
__
(
'There was an error posting that reply
. P
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_redirect
(
wp_get_referer
()
.
'#ac-form-'
.
$activity_id
);
}
...
...
@@ -348,7 +435,7 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
/**
* Mark activity as favorite.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
...
...
@@ -373,7 +460,7 @@ function bp_activity_action_mark_favorite() {
if
(
bp_activity_add_user_favorite
(
bp_action_variable
(
0
)
)
)
bp_core_add_message
(
__
(
'Activity marked as favorite.'
,
'buddypress'
)
);
else
bp_core_add_message
(
__
(
'There was an error marking that activity as a favorite
, p
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_add_message
(
__
(
'There was an error marking that activity as a favorite
. P
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_redirect
(
wp_get_referer
()
.
'#activity-'
.
bp_action_variable
(
0
)
);
}
...
...
@@ -382,7 +469,7 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
/**
* Remove activity from favorites.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
...
...
@@ -407,7 +494,7 @@ function bp_activity_action_remove_favorite() {
if
(
bp_activity_remove_user_favorite
(
bp_action_variable
(
0
)
)
)
bp_core_add_message
(
__
(
'Activity removed as favorite.'
,
'buddypress'
)
);
else
bp_core_add_message
(
__
(
'There was an error removing that activity as a favorite
, p
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_add_message
(
__
(
'There was an error removing that activity as a favorite
. P
lease try again.'
,
'buddypress'
),
'error'
);
bp_core_redirect
(
wp_get_referer
()
.
'#activity-'
.
bp_action_variable
(
0
)
);
}
...
...
@@ -416,9 +503,8 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
/**
* Load the sitewide activity feed.
*
* @since BuddyPress (1.0)
* @since BuddyPress (1.0
.0
)
*
* @global object $bp BuddyPress global settings
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses bp_is_user()
...
...
@@ -427,7 +513,7 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
* @return bool False on failure.
*/
function
bp_activity_action_sitewide_feed
()
{
global
$bp
;
$bp
=
buddypress
()
;
if
(
!
bp_is_activity_component
()
||
!
bp_is_current_action
(
'feed'
)
||
bp_is_user
()
||
!
empty
(
$bp
->
groups
->
current_group
)
)
return
false
;
...
...
@@ -449,7 +535,7 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
/**
* Load a user's personal activity feed.
*
* @since BuddyPress (1.0)
* @since BuddyPress (1.0
.0
)
*
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
...
...
@@ -479,7 +565,7 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
/**
* Load a user's friends' activity feed.
*
* @since BuddyPress (1.0)
* @since BuddyPress (1.0
.0
)
*
* @uses bp_is_active()
* @uses bp_is_user_activity()
...
...
@@ -512,7 +598,7 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
/**
* Load the activity feed for a user's groups.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses bp_is_active()
* @uses bp_is_user_activity()
...
...
@@ -553,7 +639,7 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
/**
* Load a user's @mentions feed.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
...
...
@@ -590,7 +676,7 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
/**
* Load a user's favorites feed.
*
* @since BuddyPress (1.2)
* @since BuddyPress (1.2
.0
)
*
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
...
...
@@ -625,24 +711,37 @@ add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
/**
* Loads Akismet filtering for activity.
*
* @since BuddyPress (1.6)
*
* @global object $bp BuddyPress global settings
* @since BuddyPress (1.6.0)
* @since BuddyPress (2.3.0) We only support Akismet 3+.
*/
function
bp_activity_setup_akismet
()
{
global
$bp
;
$bp
=
buddypress
()
;
// Bail if Akismet is not active
if
(
!
defined
(
'AKISMET_VERSION'
)
)
if
(
!
defined
(
'AKISMET_VERSION'
)
)
{
return
;
}
// Bail if older version of Akismet
if
(
!
class_exists
(
'Akismet'
)
)
{
return
;
}
// Bail if no Akismet key is set
if
(
!
bp_get_option
(
'wordpress_api_key'
)
&&
!
defined
(
'WPCOM_API_KEY'
)
)
if
(
!
bp_get_option
(
'wordpress_api_key'
)
&&
!
defined
(
'WPCOM_API_KEY'
)
)
{
return
;
}
// Bail if BuddyPress Activity Akismet support has been disabled by another plugin
if
(
!
apply_filters
(
'bp_activity_use_akismet'
,
bp_is_akismet_active
()
)
)
/**
* Filters if BuddyPress Activity Akismet support has been disabled by another plugin.
*
* @since BuddyPress (1.6.0)
*
* @param bool $value Return value of bp_is_akismet_active boolean function.
*/
if
(
!
apply_filters
(
'bp_activity_use_akismet'
,
bp_is_akismet_active
()
)
)
{
return
;
}
// Instantiate Akismet for BuddyPress
$bp
->
activity
->
akismet
=
new
BP_Akismet
();
...
...
@@ -659,10 +758,17 @@ function bp_ajax_get_suggestions() {
exit
;
}
$
results
=
bp_core_get_suggestions
(
array
(
$
args
=
array
(
'term'
=>
sanitize_text_field
(
$_GET
[
'term'
]
),
'type'
=>
sanitize_text_field
(
$_GET
[
'type'
]
),
)
);
);
// Support per-Group suggestions.
if
(
!
empty
(
$_GET
[
'group-id'
]
)
)
{
$args
[
'group_id'
]
=
absint
(
$_GET
[
'group-id'
]
);
}
$results
=
bp_core_get_suggestions
(
$args
);
if
(
is_wp_error
(
$results
)
)
{
wp_send_json_error
(
$results
->
get_error_message
()
);
...
...
@@ -672,3 +778,58 @@ function bp_ajax_get_suggestions() {
wp_send_json_success
(
$results
);
}
add_action
(
'wp_ajax_bp_get_suggestions'
,
'bp_ajax_get_suggestions'
);
/**
* Detect a change in post type status, and initiate an activity update if necessary.
*
* @since BuddyPress (2.2.0)
*
* @todo Support untrashing better.
*
* @param string $new_status New status for the post.
* @param string $old_status Old status for the post.
* @param object $post Post data.
*/
function
bp_activity_catch_transition_post_type_status
(
$new_status
,
$old_status
,
$post
)
{
if
(
!
post_type_supports
(
$post
->
post_type
,
'buddypress-activity'
)
)
{
return
;
}
// This is an edit.
if
(
$new_status
===
$old_status
)
{
// An edit of an existing post should update the existing activity item.
if
(
$new_status
==
'publish'
)
{
bp_activity_post_type_update
(
$post
);
}
return
;
}
// Publishing a previously unpublished post.
if
(
'publish'
===
$new_status
)
{
// Untrashing the post type - nothing here yet.
if
(
'trash'
==
$old_status
)
{
/**
* Fires if untrashing post in a post type.
*
* This is a variable filter that is dependent on the post type
* being untrashed.
*
* @since BuddyPress (2.2.0)
*
* @param WP_Post $post Post data.
*/
do_action
(
'bp_activity_post_type_untrash_'
.
$post
->
post_type
,
$post
);
}
else
{
// Record the post.
bp_activity_post_type_publish
(
$post
->
ID
,
$post
);
}
// Unpublishing a previously published post.
}
elseif
(
'publish'
===
$old_status
)
{
// Some form of pending status - only remove the activity entry
bp_activity_post_type_unpublish
(
$post
->
ID
,
$post
);
}
}
add_action
(
'transition_post_status'
,
'bp_activity_catch_transition_post_type_status'
,
10
,
3
);
wp-content/plugins/buddypress/bp-activity/bp-activity-admin.php
View file @
def17b7b
This diff is collapsed.
Click to expand it.
wp-content/plugins/buddypress/bp-activity/bp-activity-akismet.php
View file @
def17b7b
...
...
@@ -3,17 +3,18 @@
* Akismet support for BuddyPress' Activity Stream.
*
* @package BuddyPress
* @since BuddyPress (1.6)
* @since BuddyPress (1.6
.0
)
* @subpackage Activity
*/
// Exit if accessed directly
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
defined
(
'ABSPATH'
)
||
exit
;
/**
* Akismet support for the Activity component.
*
* @since BuddyPress (1.6)
* @since BuddyPress (1.6.0)
* @since BuddyPress (2.3.0) We only support Akismet 3+.
*/
class
BP_Akismet
{
/**
...
...
@@ -21,14 +22,14 @@ class BP_Akismet {
*
* @access protected
* @var BP_Activity_Activity
* @since BuddyPress (1.6)
* @since BuddyPress (1.6
.0
)
*/
protected
$last_activity
=
null
;
/**
* Constructor.
*
* @since BuddyPress (1.6)
* @since BuddyPress (1.6
.0
)
*/
public
function
__construct
()
{
$this
->
setup_actions
();
...
...
@@ -37,7 +38,7 @@ class BP_Akismet {
/**
* Hook Akismet into the activity stream.
*
* @since BuddyPress (1.6)
* @since BuddyPress (1.6
.0
)
*/
protected
function
setup_actions
()
{
// Add nonces to activity stream lists
...
...
@@ -69,10 +70,11 @@ class BP_Akismet {
* This function lifted with love from the Akismet WordPress plugin's
* akismet_comment_row_action() function. Thanks!
*
* @since BuddyPress (1.6)
* @since BuddyPress (1.6
.0
)
*
* @param array $actions The hover links.
* @param array $actions
The hover links.
* @param array $activity The activity for the current row being processed.
*
* @return array The hover links.
*/
function
comment_row_action
(
$actions
,
$activity
)
{
...
...
@@ -112,6 +114,13 @@ class BP_Akismet {
if
(
$desc
)
echo
'<span class="akismet-status"><a href="'
.
esc_url
(
bp_get_admin_url
(
'admin.php?page=bp-activity&action=edit&aid='
.
$activity
[
'id'
]
)
)
.
'#bp_activity_history">'
.
htmlspecialchars
(
$desc
)
.
'</a></span>'
;