Commit abefadb5 authored by lucha's avatar lucha

[auto] Plugin: buddypress 2.6.2

parent 4a2ca485
/*! buddypress - v2.5.3 - 2016-05-24 5:17:45 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
......@@ -17,7 +17,6 @@ defined( 'ABSPATH' ) || exit;
*
* @since 1.2.0
*
* @uses do_action() To call 'bp_register_activity_actions' hook.
*/
function bp_register_activity_actions() {
......@@ -35,18 +34,6 @@ add_action( 'bp_init', 'bp_register_activity_actions', 8 );
*
* @since 1.2.0
*
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses bp_action_variable()
* @uses bp_activity_get_specific()
* @uses bp_is_active()
* @uses bp_core_get_user_domain()
* @uses groups_get_group()
* @uses bp_get_group_permalink()
* @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook.
* @uses bp_core_redirect()
* @uses bp_get_root_domain()
*
* @return bool False on failure.
*/
function bp_activity_action_permalink_router() {
......@@ -122,17 +109,6 @@ add_action( 'bp_actions', 'bp_activity_action_permalink_router' );
*
* @since 1.1.0
*
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses bp_action_variable()
* @uses check_admin_referer()
* @uses bp_activity_user_can_delete()
* @uses do_action() Calls 'bp_activity_before_action_delete_activity' hook to allow actions to be taken before the activity is deleted.
* @uses bp_activity_delete()
* @uses bp_core_add_message()
* @uses do_action() Calls 'bp_activity_action_delete_activity' hook to allow actions to be taken after the activity is deleted.
* @uses bp_core_redirect()
*
* @param int $activity_id Activity id to be deleted. Defaults to 0.
* @return bool False on failure.
*/
......@@ -267,20 +243,6 @@ add_action( 'bp_actions', 'bp_activity_action_spam_activity' );
*
* @since 1.2.0
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses check_admin_referer()
* @uses apply_filters() To call 'bp_activity_post_update_content' hook.
* @uses apply_filters() To call 'bp_activity_post_update_object' hook.
* @uses apply_filters() To call 'bp_activity_post_update_item_id' hook.
* @uses bp_core_add_message()
* @uses bp_core_redirect()
* @uses bp_activity_post_update()
* @uses groups_post_update()
* @uses bp_core_redirect()
* @uses apply_filters() To call 'bp_activity_custom_update' hook.
*
* @return bool False on failure.
*/
function bp_activity_action_post_update() {
......@@ -371,17 +333,6 @@ add_action( 'bp_actions', 'bp_activity_action_post_update' );
*
* @since 1.2.0
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses check_admin_referer()
* @uses apply_filters() To call 'bp_activity_post_comment_activity_id' hook.
* @uses apply_filters() To call 'bp_activity_post_comment_content' hook.
* @uses bp_core_add_message()
* @uses bp_core_redirect()
* @uses bp_activity_new_comment()
* @uses wp_get_referer()
*
* @return bool False on failure.
*/
function bp_activity_action_post_comment() {
......@@ -435,16 +386,6 @@ add_action( 'bp_actions', 'bp_activity_action_post_comment' );
*
* @since 1.2.0
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses check_admin_referer()
* @uses bp_activity_add_user_favorite()
* @uses bp_action_variable()
* @uses bp_core_add_message()
* @uses bp_core_redirect()
* @uses wp_get_referer()
*
* @return bool False on failure.
*/
function bp_activity_action_mark_favorite() {
......@@ -469,16 +410,6 @@ add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
*
* @since 1.2.0
*
* @uses is_user_logged_in()
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses check_admin_referer()
* @uses bp_activity_remove_user_favorite()
* @uses bp_action_variable()
* @uses bp_core_add_message()
* @uses bp_core_redirect()
* @uses wp_get_referer()
*
* @return bool False on failure.
*/
function bp_activity_action_remove_favorite() {
......@@ -503,11 +434,6 @@ add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );
*
* @since 1.0.0
*
* @uses bp_is_activity_component()
* @uses bp_is_current_action()
* @uses bp_is_user()
* @uses status_header()
*
* @return bool False on failure.
*/
function bp_activity_action_sitewide_feed() {
......@@ -535,10 +461,6 @@ add_action( 'bp_actions', 'bp_activity_action_sitewide_feed' );
*
* @since 1.0.0
*
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
* @uses status_header()
*
* @return bool False on failure.
*/
function bp_activity_action_personal_feed() {
......@@ -565,13 +487,6 @@ add_action( 'bp_actions', 'bp_activity_action_personal_feed' );
*
* @since 1.0.0
*
* @uses bp_is_active()
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
* @uses bp_get_friends_slug()
* @uses bp_is_action_variable()
* @uses status_header()
*
* @return bool False on failure.
*/
function bp_activity_action_friends_feed() {
......@@ -598,13 +513,6 @@ add_action( 'bp_actions', 'bp_activity_action_friends_feed' );
*
* @since 1.2.0
*
* @uses bp_is_active()
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
* @uses bp_get_groups_slug()
* @uses bp_is_action_variable()
* @uses status_header()
*
* @return bool False on failure.
*/
function bp_activity_action_my_groups_feed() {
......@@ -639,11 +547,6 @@ add_action( 'bp_actions', 'bp_activity_action_my_groups_feed' );
*
* @since 1.2.0
*
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
* @uses bp_is_action_variable()
* @uses status_header()
*
* @return bool False on failure.
*/
function bp_activity_action_mentions_feed() {
......@@ -676,11 +579,6 @@ add_action( 'bp_actions', 'bp_activity_action_mentions_feed' );
*
* @since 1.2.0
*
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
* @uses bp_is_action_variable()
* @uses status_header()
*
* @return bool False on failure.
*/
function bp_activity_action_favorites_feed() {
......
......@@ -16,7 +16,9 @@ defined( 'ABSPATH' ) || exit;
// Include WP's list table class.
if ( !class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
require dirname( __FILE__ ) . '/classes/class-bp-activity-list-table.php';
if ( ! buddypress()->do_autoload ) {
require dirname( __FILE__ ) . '/classes/class-bp-activity-list-table.php';
}
// Per_page screen option. Has to be hooked in extremely early.
if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] )
......@@ -299,6 +301,7 @@ function bp_activity_admin_load() {
// Add accessible hidden heading and text for Activity screen pagination.
if ( bp_get_major_wp_version() >= 4.4 ) {
get_current_screen()->set_screen_reader_content( array(
/* translators: accessibility text */
'heading_pagination' => __( 'Activity list navigation', 'buddypress' ),
) );
}
......@@ -576,9 +579,9 @@ function bp_activity_admin_load() {
// If an error occurred, pass back the activity ID that failed.
if ( $error )
$redirect_to = add_query_arg( 'error', (int) $error, $redirect_to );
$redirect_to = add_query_arg( 'error', $error, $redirect_to );
else
$redirect_to = add_query_arg( 'updated', (int) $activity->id, $redirect_to );
$redirect_to = add_query_arg( 'updated', $activity->id, $redirect_to );
/**
* Filters URL to redirect to after saving.
......@@ -674,6 +677,10 @@ function bp_activity_admin_edit() {
<div id="bp_activity_action" class="postbox">
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
<div class="inside">
<label for="bp-activities-action" class="screen-reader-text"><?php
/* translators: accessibility text */
_e( 'Edit activity action', 'buddypress' );
?></label>
<?php wp_editor( stripslashes( $activity->action ), 'bp-activities-action', array( 'media_buttons' => false, 'textarea_rows' => 7, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
</div>
</div>
......@@ -681,6 +688,10 @@ function bp_activity_admin_edit() {
<div id="bp_activity_content" class="postbox">
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
<div class="inside">
<label for="bp-activities-content" class="screen-reader-text"><?php
/* translators: accessibility text */
_e( 'Edit activity content', 'buddypress' );
?></label>
<?php wp_editor( stripslashes( $activity->content ), 'bp-activities-content', array( 'media_buttons' => false, 'teeny' => true, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ) ) ); ?>
</div>
</div>
......@@ -704,10 +715,16 @@ function bp_activity_admin_edit() {
</form>
<?php else : ?>
<p>
<?php _e( 'No activity found with this ID.', 'buddypress' ); ?>
<a href="<?php echo esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ); ?>"><?php _e( 'Go back and try again.', 'buddypress' ); ?></a>
</p>
<p><?php
printf(
'%1$s <a href="%2$s">%3$s</a>',
__( 'No activity found with this ID.', 'buddypress' ),
esc_url( bp_get_admin_url( 'admin.php?page=bp-activity' ) ),
__( 'Go back and try again.', 'buddypress' )
);
?></p>
<?php endif; ?>
</div><!-- .wrap -->
......@@ -781,7 +798,10 @@ function bp_activity_admin_edit_metabox_status( $item ) {
function bp_activity_admin_edit_metabox_link( $item ) {
?>
<label class="screen-reader-text" for="bp-activities-link"><?php _e( 'Link', 'buddypress' ); ?></label>
<label class="screen-reader-text" for="bp-activities-link"><?php
/* translators: accessibility text */
_e( 'Link', 'buddypress' );
?></label>
<input type="url" name="bp-activities-link" id="bp-activities-link" value="<?php echo esc_url( $item->primary_link ); ?>" aria-describedby="bp-activities-link-description" />
<p id="bp-activities-link-description"><?php _e( 'Activity generated by posts and comments, forum topics and replies, and some plugins, uses the link field for a permalink back to the content item.', 'buddypress' ); ?></p>
......@@ -798,7 +818,10 @@ function bp_activity_admin_edit_metabox_link( $item ) {
function bp_activity_admin_edit_metabox_userid( $item ) {
?>
<label class="screen-reader-text" for="bp-activities-userid"><?php _e( 'Author ID', 'buddypress' ); ?></label>
<label class="screen-reader-text" for="bp-activities-userid"><?php
/* translators: accessibility text */
_e( 'Author ID', 'buddypress' );
?></label>
<input type="number" name="bp-activities-userid" id="bp-activities-userid" value="<?php echo esc_attr( $item->user_id ); ?>" min="1" />
<?php
......@@ -873,7 +896,10 @@ function bp_activity_admin_edit_metabox_type( $item ) {
?>
<label for="bp-activities-type" class="screen-reader-text"><?php esc_html_e( 'Select activity type', 'buddypress' ); ?></label>
<label for="bp-activities-type" class="screen-reader-text"><?php
/* translators: accessibility text */
esc_html_e( 'Select activity type', 'buddypress' );
?></label>
<select name="bp-activities-type" id="bp-activities-type">
<?php foreach ( $actions as $k => $v ) : ?>
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k, $selected ); ?>><?php echo esc_html( $v ); ?></option>
......@@ -1016,6 +1042,10 @@ function bp_activity_admin_index() {
<form method="get" action="">
<h3 id="bp-replyhead"><?php _e( 'Reply to Activity', 'buddypress' ); ?></h3>
<label for="bp-activities" class="screen-reader-text"><?php
/* translators: accessibility text */
_e( 'Reply', 'buddypress' );
?></label>
<?php wp_editor( '', 'bp-activities', array( 'dfw' => false, 'media_buttons' => false, 'quicktags' => array( 'buttons' => 'strong,em,link,block,del,ins,img,code,spell,close' ), 'tinymce' => false, ) ); ?>
<p id="bp-replysubmit" class="submit">
......
<?php
/**
* BuddyPress Activity Toolbar.
*
* Handles the activity functions related to the WordPress Toolbar.
*
* @package BuddyPress
* @subpackage Activity
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* Add the Activity top-level menu link when viewing single activity item.
*
* @since 2.6.0
*
* @return null Null if user does not have access to editing functionality.
*/
function bp_activity_admin_menu() {
global $wp_admin_bar;
// Only show if viewing a single activity item.
if ( ! bp_is_single_activity() ) {
return;
}
// Only show this menu to super admins
if ( ! bp_current_user_can( 'bp_moderate' ) ) {
return;
}
$activity_edit_link = add_query_arg( array(
'page' => 'bp-activity',
'aid' => bp_current_action(),
'action' => 'edit'
), bp_get_admin_url( 'admin.php' ) );
// Add the top-level Edit Activity button.
$wp_admin_bar->add_menu( array(
'id' => 'activity-admin',
'title' => __( 'Edit Activity', 'buddypress' ),
'href' => esc_url( $activity_edit_link ),
) );
}
add_action( 'admin_bar_menu', 'bp_activity_admin_menu', 99 );
......@@ -10,7 +10,9 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
if ( ! buddypress()->do_autoload ) {
require dirname( __FILE__ ) . '/classes/class-bp-akismet.php';
}
/**
* Delete old spam activity meta data.
......
......@@ -13,3 +13,8 @@ defined( 'ABSPATH' ) || exit;
require dirname( __FILE__ ) . '/classes/class-bp-activity-activity.php';
require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';
// Embeds - only applicable for WP 4.5+
if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( 'activity', 'embeds' ) ) {
require dirname( __FILE__ ) . '/classes/class-bp-activity-oembed-extension.php';
}
\ No newline at end of file
<?php
/**
* Functions related to embedding single activity items externally.
*
* Relies on WordPress 4.5.
*
* @since 2.6.0
*
* @package BuddyPress
* @subpackage ActivityEmbeds
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* Loads our activity oEmbed component.
*
* @since 2.6.0
*/
function bp_activity_setup_oembed() {
if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) && bp_is_active( 'activity', 'embeds' ) ) {
buddypress()->activity->oembed = new BP_Activity_oEmbed_Extension;
}
}
add_action( 'bp_loaded', 'bp_activity_setup_oembed' );
/**
* Catch links in embed excerpt so top.location.href can be added.
*
* Due to <iframe sandbox="allow-top-navigation">, links in embeds can only be
* clicked if invoked with top.location.href via JS.
*
* @since 2.6.0
*
* @param string $text Embed excerpt
* @return string
*/
function bp_activity_embed_excerpt_onclick_location_filter( $text ) {
return preg_replace_callback( '/<a\s+[^>]*href=\"([^\"]*)\"/iU', 'bp_activity_embed_excerpt_onclick_location_filter_callback', $text );
}
/**
* Add onclick="top.location.href" to a link.
*
* @since 2.6.0
*
* @param array $matches Items matched by bp_activity_embed_excerpt_onclick_location_filter().
* @return string
*/
function bp_activity_embed_excerpt_onclick_location_filter_callback( $matches ) {
return sprintf( '<a href="%1$s" onclick="top.location.href=\'%1$s\'"', $matches[1] );
}
/**
* Add inline styles for BP activity embeds.
*
* @since 2.6.0
*/
function bp_activity_embed_add_inline_styles() {
if ( false === bp_is_single_activity() ) {
return;
}
$min = bp_core_get_minified_asset_suffix();
if ( is_rtl() ) {
$css = bp_locate_template_asset( "css/embeds-activity-rtl{$min}.css" );
} else {
$css = bp_locate_template_asset( "css/embeds-activity{$min}.css" );
}
// Bail if file wasn't found.
if ( false === $css ) {
return;
}
// Grab contents of CSS file and do some rudimentary CSS protection.
$css = file_get_contents( $css['file'] );
$css = wp_kses( $css, array( "\'", '\"' ) );
printf( '<style type="text/css">%s</style>', $css );
}
add_action( 'embed_head', 'bp_activity_embed_add_inline_styles', 20 );
/**
* Query for the activity item on the activity embed template.
*
* Basically a wrapper for {@link bp_has_activities()}, but allows us to
* use the activity loop without requerying for it again.