Version Description
= 9.2.0 = See: https://codex.buddypress.org/releases/version-9-2-0/
= 9.1.1 = See: https://codex.buddypress.org/releases/version-9-1-1/
= 9.0.0 = See: https://codex.buddypress.org/releases/version-9-0-0/
= 8.0.0 = See: https://codex.buddypress.org/releases/version-8-0-0/
= 7.3.0 = See: https://codex.buddypress.org/releases/version-7-3-0/
= 7.2.1 = See: https://codex.buddypress.org/releases/version-7-2-1/
= 7.2.0 = See: https://codex.buddypress.org/releases/version-7-2-0/
= 7.1.0 = See: https://codex.buddypress.org/releases/version-7-1-0/
= 7.0.0 = See: https://codex.buddypress.org/releases/version-7-0-0/
= 6.4.0 = See: https://codex.buddypress.org/releases/version-6-4-0/
= 6.3.0 = See: https://codex.buddypress.org/releases/version-6-3-0/
= 6.2.0 = See: https://codex.buddypress.org/releases/version-6-2-0/
= 6.1.0 = See: https://codex.buddypress.org/releases/version-6-1-0/
= 6.0.0 = See: https://codex.buddypress.org/releases/version-6-0-0/
= 5.2.0 = See: https://codex.buddypress.org/releases/version-5-2-0/
= 5.1.2 = See: https://codex.buddypress.org/releases/version-5-1-2/
= 5.1.1 = See: https://codex.buddypress.org/releases/version-5-1-1/
= 5.1.0 = See: https://codex.buddypress.org/releases/version-5-1-0/
= 5.0.0 = See: https://codex.buddypress.org/releases/version-5-0-0/
Release Info
Developer | imath |
Plugin | BuddyPress |
Version | 10.0.0-RC1 |
Comparing to | |
See all releases |
Code changes from version 9.2.0 to 10.0.0-RC1
- bp-activity/admin/css/admin-rtl.css +15 -0
- bp-activity/admin/css/admin-rtl.min.css +1 -1
- bp-activity/admin/css/admin.css +15 -0
- bp-activity/admin/css/admin.min.css +1 -1
- bp-activity/bp-activity-admin.php +2 -2
- bp-activity/bp-activity-blocks.php +1 -1
- bp-activity/bp-activity-cache.php +5 -0
- bp-activity/bp-activity-filters.php +6 -1
- bp-activity/bp-activity-functions.php +226 -148
- bp-activity/bp-activity-template.php +344 -77
- bp-activity/classes/class-bp-activity-activity.php +151 -88
- bp-activity/classes/class-bp-activity-component.php +21 -2
- bp-activity/classes/class-bp-activity-feed.php +48 -43
- bp-activity/classes/class-bp-activity-list-table.php +4 -4
- bp-activity/classes/class-bp-activity-template.php +6 -1
- bp-activity/classes/class-bp-rest-activity-endpoint.php +16 -8
- bp-activity/js/blocks/embed-activity.js +5 -17
- bp-activity/js/blocks/embed-activity.js.map +1 -1
- bp-activity/js/blocks/latest-activities.js +3 -3
- bp-activity/js/blocks/latest-activities.js.map +1 -1
- bp-blogs/bp-blogs-activity.php +25 -20
- bp-blogs/bp-blogs-blocks.php +1 -1
- bp-blogs/bp-blogs-functions.php +47 -39
- bp-blogs/bp-blogs-template.php +82 -55
- bp-blogs/bp-blogs-widgets.php +10 -1
- bp-blogs/classes/class-bp-blogs-blog.php +77 -30
- bp-blogs/classes/class-bp-blogs-component.php +21 -2
- bp-blogs/classes/class-bp-blogs-recent-posts-widget.php +8 -7
- bp-blogs/classes/class-bp-blogs-template.php +55 -22
- bp-blogs/classes/class-bp-rest-blogs-endpoint.php +36 -27
- bp-blogs/js/blocks/recent-posts.js +3 -3
- bp-core/admin/bp-core-admin-actions.php +33 -0
- bp-core/admin/bp-core-admin-components.php +3 -6
- bp-core/admin/bp-core-admin-functions.php +218 -52
- bp-core/admin/bp-core-admin-optouts.php +4 -11
- bp-core/admin/bp-core-admin-schema.php +8 -1
- bp-core/admin/bp-core-admin-settings.php +33 -9
- bp-core/admin/bp-core-admin-slugs.php +45 -51
- bp-core/admin/bp-core-admin-tools.php +2 -6
- bp-core/admin/bp-core-admin-types.php +5 -2
- bp-core/admin/css/common-rtl.css +156 -3
- bp-core/admin/css/common-rtl.min.css +1 -1
- bp-core/admin/css/common.css +156 -3
- bp-core/admin/css/common.min.css +1 -1
- bp-core/admin/css/hello-rtl.css +1 -0
- bp-core/admin/css/hello-rtl.min.css +1 -1
- bp-core/admin/css/hello.css +1 -0
- bp-core/admin/css/hello.min.css +1 -1
- bp-core/admin/js/backcompat-admin-tabs.js +66 -0
- bp-core/admin/js/backcompat-admin-tabs.min.js +1 -0
- bp-core/admin/js/bp-thickbox.js +52 -0
- bp-core/admin/js/bp-thickbox.min.js +1 -0
- bp-core/admin/js/dismissible-admin-notices.js +4 -16
- bp-core/admin/js/dismissible-admin-notices.js.map +1 -0
- bp-core/admin/js/dismissible-admin-notices.min.js +0 -1
- bp-core/admin/js/hello.js +5 -30
- bp-core/admin/js/hello.min.js +1 -1
- bp-core/bp-core-attachments.php +252 -96
- bp-core/bp-core-avatars.php +542 -63
- bp-core/bp-core-blocks.php +39 -24
- bp-core/bp-core-buddybar.php +79 -38
- bp-core/bp-core-cache.php +11 -8
- bp-core/bp-core-catchuri.php +19 -4
- bp-core/bp-core-filters.php +73 -15
- bp-core/bp-core-functions.php +105 -52
- bp-core/bp-core-rest-api.php +6 -13
- bp-core/bp-core-template-loader.php +14 -3
- bp-core/bp-core-template.php +33 -17
- bp-core/bp-core-theme-compatibility.php +70 -64
- bp-core/bp-core-update.php +44 -0
- bp-core/bp-core-widgets.php +78 -1
- bp-core/bp-core-wpabstraction.php +2 -67
- bp-core/classes/class-bp-admin.php +392 -62
- bp-core/classes/class-bp-attachment-avatar.php +48 -8
- bp-core/classes/class-bp-attachment.php +102 -21
- bp-core/classes/class-bp-button.php +4 -1
- bp-core/classes/class-bp-component.php +44 -11
- bp-core/classes/class-bp-core-login-widget.php +7 -3
- bp-core/classes/class-bp-core-nav.php +23 -6
- bp-core/classes/class-bp-core-oembed-extension.php +12 -9
- bp-core/classes/class-bp-core.php +6 -2
- bp-core/classes/class-bp-date-query.php +70 -3
- bp-core/classes/class-bp-embed.php +4 -1
- bp-core/classes/class-bp-invitation-manager.php +62 -44
- bp-core/classes/class-bp-invitation.php +44 -36
- bp-core/classes/class-bp-suggestions.php +4 -1
- bp-core/classes/class-bp-user-query.php +39 -19
- bp-core/css/avatar-rtl.css +47 -0
- bp-core/css/avatar-rtl.min.css +1 -1
- bp-core/css/avatar.css +47 -0
- bp-core/css/avatar.min.css +1 -1
- bp-core/css/blocks/login-form-rtl.css +5 -0
- bp-core/css/blocks/login-form-rtl.min.css +1 -1
- bp-core/css/blocks/login-form.css +5 -0
- bp-core/css/blocks/login-form.min.css +1 -1
- bp-core/deprecated/1.2.php +4 -1
- bp-core/deprecated/1.5.php +5 -1
- bp-core/deprecated/10.0.php +62 -0
- bp-core/images/bp-settings-screen.png +0 -0
- bp-core/images/bp-widget-blocks.jpg +0 -0
- bp-core/images/edit-pages-screen.png +0 -0
- bp-core/images/hello-buddypress-addons.png +0 -0
- bp-core/images/latest-activities.jpg +0 -0
- bp-core/images/legacy-widget-to-block.jpg +0 -0
- bp-core/images/logging-activities.png +0 -0
- bp-core/images/prevent-spammer-registration.png +0 -0
- bp-core/js/avatar.js +218 -2
- bp-core/js/avatar.min.js +1 -1
- bp-core/js/block-components.js +4 -22
- bp-core/js/block-components.js.map +1 -1
- bp-core/js/block-data.js +14 -33
- bp-core/js/block-data.js.map +1 -1
- bp-core/js/blocks/login-form.js +3 -3
- bp-core/js/blocks/login-form.js.map +1 -1
- bp-core/js/blocks/primary-nav.js +3 -3
- bp-core/js/blocks/primary-nav.js.map +1 -1
- bp-core/js/bp-api-request.js +7 -28
- bp-core/js/bp-api-request.min.js +1 -1
- bp-core/js/bp-plupload.js +1 -1
- bp-core/js/cover-image.js +19 -13
- bp-core/js/cover-image.min.js +1 -1
- bp-core/js/dynamic-widget-block.js +1 -1
- bp-core/js/dynamic-widget-block.js.map +1 -1
- bp-core/js/vendor/jquery-scroll-to.min.js +1 -1
- bp-core/js/vendor/jquery.atwho.min.js +1 -1
- bp-core/js/vendor/livestamp.min.js +1 -1
- bp-core/js/vendor/moment-js/moment.min.js +1 -1
- bp-core/sass/blocks/login-form.scss +4 -0
- bp-friends/actions/add-friend.php +14 -10
- bp-friends/actions/remove-friend.php +14 -10
- bp-friends/bp-friends-activity.php +45 -34
- bp-friends/bp-friends-blocks.php +22 -19
- bp-friends/bp-friends-cache.php +18 -17
- bp-friends/bp-friends-cssjs.php +1 -3
- bp-friends/bp-friends-filters.php +5 -8
- bp-friends/bp-friends-functions.php +86 -85
- bp-friends/bp-friends-loader.php +1 -1
- bp-friends/bp-friends-notifications.php +19 -18
- bp-friends/bp-friends-template.php +55 -36
- bp-friends/bp-friends-widgets.php +12 -3
- bp-friends/classes/class-bp-core-friends-widget.php +23 -19
- bp-friends/classes/class-bp-friends-component.php +17 -13
- bp-friends/classes/class-bp-friends-friendship.php +160 -84
- bp-friends/classes/class-bp-rest-friends-endpoint.php +22 -14
- bp-friends/js/blocks/friends.js +4 -4
- bp-friends/js/blocks/friends.js.map +1 -1
- bp-friends/js/friends.js +1 -1
- bp-friends/js/friends.js.map +1 -1
- bp-friends/screens/my-friends.php +1 -1
- bp-friends/screens/requests.php +1 -1
- bp-groups/actions/create.php +9 -5
- bp-groups/admin/css/admin-rtl.css +15 -0
- bp-groups/admin/css/admin-rtl.min.css +1 -1
- bp-groups/admin/css/admin.css +15 -0
- bp-groups/admin/css/admin.min.css +1 -1
- bp-groups/bp-groups-activity.php +28 -20
- bp-groups/bp-groups-admin.php +3 -2
- bp-groups/bp-groups-blocks.php +22 -17
- bp-groups/bp-groups-cssjs.php +2 -5
- bp-groups/bp-groups-functions.php +201 -91
@@ -64,6 +64,21 @@
|
|
64 |
margin-right: 2em;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
#bp_activity_action div.inside,
|
68 |
#bp_activity_content div.inside {
|
69 |
line-height: 0;
|
64 |
margin-right: 2em;
|
65 |
}
|
66 |
|
67 |
+
.activitybox {
|
68 |
+
position: relative;
|
69 |
+
min-width: 255px;
|
70 |
+
border: 1px solid #c3c4c7;
|
71 |
+
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
72 |
+
background: #fff;
|
73 |
+
margin-bottom: 20px;
|
74 |
+
padding: 0;
|
75 |
+
line-height: 1;
|
76 |
+
}
|
77 |
+
|
78 |
+
.activitybox .inside {
|
79 |
+
padding: 0 12px 12px;
|
80 |
+
}
|
81 |
+
|
82 |
#bp_activity_action div.inside,
|
83 |
#bp_activity_content div.inside {
|
84 |
line-height: 0;
|
@@ -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.4;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%}ul.bp-activity-delete-list{list-style-type:disc;margin:4px 26px}@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.4;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}.activitybox{position:relative;min-width:255px;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgb(0 0 0 / 4%);background:#fff;margin-bottom:20px;padding:0;line-height:1}.activitybox .inside{padding:0 12px 12px}#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%}ul.bp-activity-delete-list{list-style-type:disc;margin:4px 26px}@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}}
|
@@ -64,6 +64,21 @@
|
|
64 |
margin-left: 2em;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
#bp_activity_action div.inside,
|
68 |
#bp_activity_content div.inside {
|
69 |
line-height: 0;
|
64 |
margin-left: 2em;
|
65 |
}
|
66 |
|
67 |
+
.activitybox {
|
68 |
+
position: relative;
|
69 |
+
min-width: 255px;
|
70 |
+
border: 1px solid #c3c4c7;
|
71 |
+
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
72 |
+
background: #fff;
|
73 |
+
margin-bottom: 20px;
|
74 |
+
padding: 0;
|
75 |
+
line-height: 1;
|
76 |
+
}
|
77 |
+
|
78 |
+
.activitybox .inside {
|
79 |
+
padding: 0 12px 12px;
|
80 |
+
}
|
81 |
+
|
82 |
#bp_activity_action div.inside,
|
83 |
#bp_activity_content div.inside {
|
84 |
line-height: 0;
|
@@ -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.4;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%}ul.bp-activity-delete-list{list-style-type:disc;margin:4px 26px}@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.4;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}.activitybox{position:relative;min-width:255px;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgb(0 0 0 / 4%);background:#fff;margin-bottom:20px;padding:0;line-height:1}.activitybox .inside{padding:0 12px 12px}#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%}ul.bp-activity-delete-list{list-style-type:disc;margin:4px 26px}@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}}
|
@@ -775,7 +775,7 @@ function bp_activity_admin_edit() {
|
|
775 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
776 |
<div id="post-body-content">
|
777 |
<div id="postdiv">
|
778 |
-
<div id="bp_activity_action" class="
|
779 |
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
|
780 |
<div class="inside">
|
781 |
<label for="bp-activities-action" class="screen-reader-text"><?php
|
@@ -786,7 +786,7 @@ function bp_activity_admin_edit() {
|
|
786 |
</div>
|
787 |
</div>
|
788 |
|
789 |
-
<div id="bp_activity_content" class="
|
790 |
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
|
791 |
<div class="inside">
|
792 |
<label for="bp-activities-content" class="screen-reader-text"><?php
|
775 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
776 |
<div id="post-body-content">
|
777 |
<div id="postdiv">
|
778 |
+
<div id="bp_activity_action" class="activitybox">
|
779 |
<h2><?php _e( 'Action', 'buddypress' ); ?></h2>
|
780 |
<div class="inside">
|
781 |
<label for="bp-activities-action" class="screen-reader-text"><?php
|
786 |
</div>
|
787 |
</div>
|
788 |
|
789 |
+
<div id="bp_activity_content" class="activitybox">
|
790 |
<h2><?php _e( 'Content', 'buddypress' ); ?></h2>
|
791 |
<div class="inside">
|
792 |
<label for="bp-activities-content" class="screen-reader-text"><?php
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
* @return string HTML output.
|
22 |
*/
|
23 |
function bp_activity_render_latest_activities_block( $attributes = array() ) {
|
24 |
-
$block_args =
|
25 |
$attributes,
|
26 |
array(
|
27 |
'title' => __( 'Latest updates', 'buddypress' ),
|
21 |
* @return string HTML output.
|
22 |
*/
|
23 |
function bp_activity_render_latest_activities_block( $attributes = array() ) {
|
24 |
+
$block_args = bp_parse_args(
|
25 |
$attributes,
|
26 |
array(
|
27 |
'title' => __( 'Latest updates', 'buddypress' ),
|
@@ -47,6 +47,11 @@ function bp_activity_update_meta_cache( $activity_ids = false ) {
|
|
47 |
function bp_activity_clear_cache_for_activity( $activity ) {
|
48 |
wp_cache_delete( $activity->id, 'bp_activity' );
|
49 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
add_action( 'bp_activity_after_save', 'bp_activity_clear_cache_for_activity' );
|
52 |
|
47 |
function bp_activity_clear_cache_for_activity( $activity ) {
|
48 |
wp_cache_delete( $activity->id, 'bp_activity' );
|
49 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
50 |
+
|
51 |
+
// Clear the comments cache for the parent activity ID.
|
52 |
+
if ( 'activity_comment' === $activity->type ) {
|
53 |
+
wp_cache_delete( $activity->item_id, 'bp_activity_comments' );
|
54 |
+
}
|
55 |
}
|
56 |
add_action( 'bp_activity_after_save', 'bp_activity_clear_cache_for_activity' );
|
57 |
|
@@ -439,7 +439,12 @@ function bp_activity_truncate_entry( $text, $args = array() ) {
|
|
439 |
|
440 |
$excerpt_length = bp_activity_get_excerpt_length();
|
441 |
|
442 |
-
$args =
|
|
|
|
|
|
|
|
|
|
|
443 |
|
444 |
// Run the text through the excerpt function. If it's too short, the original text will be returned.
|
445 |
$excerpt = bp_create_excerpt( $text, $excerpt_length, $args );
|
439 |
|
440 |
$excerpt_length = bp_activity_get_excerpt_length();
|
441 |
|
442 |
+
$args = bp_parse_args(
|
443 |
+
$args,
|
444 |
+
array(
|
445 |
+
'ending' => __( '…', 'buddypress' ),
|
446 |
+
)
|
447 |
+
);
|
448 |
|
449 |
// Run the text through the excerpt function. If it's too short, the original text will be returned.
|
450 |
$excerpt = bp_create_excerpt( $text, $excerpt_length, $args );
|
@@ -493,7 +493,11 @@ function bp_activity_get_post_type_tracking_args( $post_type ) {
|
|
493 |
);
|
494 |
|
495 |
if ( ! empty( $post_type_object->bp_activity ) ) {
|
496 |
-
$post_type_activity = bp_parse_args(
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
|
499 |
$post_type_activity = (object) $post_type_activity;
|
@@ -705,6 +709,33 @@ function bp_activity_type_supports( $activity_type = '', $feature = '' ) {
|
|
705 |
$retval = true;
|
706 |
}
|
707 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
}
|
709 |
|
710 |
return $retval;
|
@@ -1770,60 +1801,66 @@ function bp_activity_format_activity_action_custom_post_type_comment( $action, $
|
|
1770 |
*/
|
1771 |
function bp_activity_get( $args = '' ) {
|
1772 |
|
1773 |
-
$r = bp_parse_args(
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
|
|
1793 |
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
|
|
|
|
1806 |
|
1807 |
-
$activity = BP_Activity_Activity::get(
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
|
|
|
|
|
|
1827 |
|
1828 |
/**
|
1829 |
* Filters the requested activity item(s).
|
@@ -1844,26 +1881,31 @@ function bp_activity_get( $args = '' ) {
|
|
1844 |
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
1845 |
*
|
1846 |
* @param array|string $args {
|
|
|
1847 |
* All arguments and defaults are shared with BP_Activity_Activity::get(),
|
1848 |
* except for the following:
|
1849 |
* @type string|int|array Single activity ID, comma-separated list of IDs,
|
1850 |
* or array of IDs.
|
1851 |
* }
|
1852 |
-
* @return array
|
1853 |
*/
|
1854 |
function bp_activity_get_specific( $args = '' ) {
|
1855 |
|
1856 |
-
$r = bp_parse_args(
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
|
|
|
|
|
|
|
|
1867 |
|
1868 |
$get_args = array(
|
1869 |
'display_comments' => $r['display_comments'],
|
@@ -1877,16 +1919,18 @@ function bp_activity_get_specific( $args = '' ) {
|
|
1877 |
'update_meta_cache' => $r['update_meta_cache'],
|
1878 |
);
|
1879 |
|
|
|
|
|
1880 |
/**
|
1881 |
* Filters the requested specific activity item.
|
1882 |
*
|
1883 |
* @since 1.2.0
|
1884 |
*
|
1885 |
-
* @param
|
1886 |
-
* @param array
|
1887 |
-
* @param array
|
1888 |
*/
|
1889 |
-
return apply_filters( 'bp_activity_get_specific',
|
1890 |
}
|
1891 |
|
1892 |
/**
|
@@ -1931,28 +1975,32 @@ function bp_activity_get_specific( $args = '' ) {
|
|
1931 |
*/
|
1932 |
function bp_activity_add( $args = '' ) {
|
1933 |
|
1934 |
-
$r = bp_parse_args(
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
|
|
|
|
|
|
|
|
1949 |
|
1950 |
// Make sure we are backwards compatible.
|
1951 |
-
if ( empty( $r['component'] ) && !empty( $r['component_name'] ) ) {
|
1952 |
$r['component'] = $r['component_name'];
|
1953 |
}
|
1954 |
|
1955 |
-
if ( empty( $r['type'] ) && !empty( $r['component_action'] ) ) {
|
1956 |
$r['type'] = $r['component_action'];
|
1957 |
}
|
1958 |
|
@@ -1977,7 +2025,7 @@ function bp_activity_add( $args = '' ) {
|
|
1977 |
|
1978 |
if ( 'wp_error' === $r['error_type'] && is_wp_error( $save ) ) {
|
1979 |
return $save;
|
1980 |
-
} elseif ('bool' === $r['error_type'] && false === $save ) {
|
1981 |
return false;
|
1982 |
}
|
1983 |
|
@@ -2011,6 +2059,7 @@ function bp_activity_add( $args = '' ) {
|
|
2011 |
* @since 1.2.0
|
2012 |
*
|
2013 |
* @param array|string $args {
|
|
|
2014 |
* @type string $content The content of the activity update.
|
2015 |
* @type int $user_id Optional. Defaults to the logged-in user.
|
2016 |
* @type string $error_type Optional. Error type to return. Either 'bool' or 'wp_error'. Defaults to
|
@@ -2021,17 +2070,28 @@ function bp_activity_add( $args = '' ) {
|
|
2021 |
*/
|
2022 |
function bp_activity_post_update( $args = '' ) {
|
2023 |
|
2024 |
-
$r =
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2029 |
|
2030 |
-
if ( empty( $r['content'] ) || !strlen( trim( $r['content'] ) ) ) {
|
2031 |
return false;
|
2032 |
}
|
2033 |
|
2034 |
if ( bp_is_user_inactive( $r['user_id'] ) ) {
|
|
|
|
|
|
|
|
|
2035 |
return false;
|
2036 |
}
|
2037 |
|
@@ -2280,6 +2340,11 @@ function bp_activity_post_type_update( $post = null ) {
|
|
2280 |
// Update the activity entry.
|
2281 |
$activity = new BP_Activity_Activity( $activity_id );
|
2282 |
|
|
|
|
|
|
|
|
|
|
|
2283 |
if ( ! empty( $post->post_content ) ) {
|
2284 |
$activity_summary = bp_activity_create_summary( $post->post_content, (array) $activity );
|
2285 |
|
@@ -2645,17 +2710,19 @@ add_action( 'delete_comment', 'bp_activity_post_type_remove_comment', 10, 1 );
|
|
2645 |
*/
|
2646 |
function bp_activity_new_comment( $args = '' ) {
|
2647 |
$bp = buddypress();
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
|
|
|
|
2659 |
|
2660 |
// Error type is boolean; need to initialize some variables for backpat.
|
2661 |
if ( 'bool' === $r['error_type'] ) {
|
@@ -2724,7 +2791,7 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2724 |
$comment_id = bp_activity_add( array(
|
2725 |
'id' => $r['id'],
|
2726 |
'content' => $comment_content,
|
2727 |
-
'component' =>
|
2728 |
'type' => 'activity_comment',
|
2729 |
'primary_link' => $r['primary_link'],
|
2730 |
'user_id' => $r['user_id'],
|
@@ -2804,16 +2871,19 @@ function bp_activity_new_comment( $args = '' ) {
|
|
2804 |
*/
|
2805 |
function bp_activity_get_activity_id( $args = '' ) {
|
2806 |
|
2807 |
-
$r = bp_parse_args(
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
|
|
|
|
|
|
|
2817 |
|
2818 |
/**
|
2819 |
* Filters the activity ID being requested.
|
@@ -2825,16 +2895,7 @@ function bp_activity_get_activity_id( $args = '' ) {
|
|
2825 |
* @param array $r Parsed function arguments.
|
2826 |
* @param array $args Arguments passed to the function.
|
2827 |
*/
|
2828 |
-
return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id(
|
2829 |
-
$r['user_id'],
|
2830 |
-
$r['component'],
|
2831 |
-
$r['type'],
|
2832 |
-
$r['item_id'],
|
2833 |
-
$r['secondary_item_id'],
|
2834 |
-
$r['action'],
|
2835 |
-
$r['content'],
|
2836 |
-
$r['date_recorded']
|
2837 |
-
), $r, $args );
|
2838 |
}
|
2839 |
|
2840 |
/**
|
@@ -2864,19 +2925,22 @@ function bp_activity_get_activity_id( $args = '' ) {
|
|
2864 |
function bp_activity_delete( $args = '' ) {
|
2865 |
|
2866 |
// Pass one or more the of following variables to delete by those variables.
|
2867 |
-
$args = bp_parse_args(
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
|
|
|
|
|
|
2880 |
|
2881 |
/**
|
2882 |
* Fires before an activity item proceeds to be deleted.
|
@@ -2938,20 +3002,22 @@ function bp_activity_delete( $args = '' ) {
|
|
2938 |
* @since 1.1.0
|
2939 |
* @deprecated 1.2.0
|
2940 |
*
|
2941 |
-
*
|
2942 |
* @param array|string $args See BP_Activity_Activity::get for a
|
2943 |
* description of accepted arguments.
|
2944 |
* @return bool True on success, false on failure.
|
2945 |
*/
|
2946 |
function bp_activity_delete_by_item_id( $args = '' ) {
|
2947 |
|
2948 |
-
$r = bp_parse_args(
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
|
|
|
|
|
|
2955 |
|
2956 |
return bp_activity_delete( $r );
|
2957 |
}
|
@@ -3547,8 +3613,14 @@ function bp_activity_mark_as_spam( &$activity, $source = 'by_a_person' ) {
|
|
3547 |
// Clear the activity stream first page cache.
|
3548 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
3549 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3550 |
// Clear the activity comment cache for this activity item.
|
3551 |
-
wp_cache_delete( $
|
3552 |
|
3553 |
// If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity.
|
3554 |
if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
|
@@ -3594,8 +3666,14 @@ function bp_activity_mark_as_ham( &$activity, $source = 'by_a_person' ) {
|
|
3594 |
// Clear the activity stream first page cache.
|
3595 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
3596 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3597 |
// Clear the activity comment cache for this activity item.
|
3598 |
-
wp_cache_delete( $
|
3599 |
|
3600 |
// If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity.
|
3601 |
if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
|
493 |
);
|
494 |
|
495 |
if ( ! empty( $post_type_object->bp_activity ) ) {
|
496 |
+
$post_type_activity = bp_parse_args(
|
497 |
+
(array) $post_type_object->bp_activity,
|
498 |
+
$post_type_activity,
|
499 |
+
$post_type . '_tracking_args'
|
500 |
+
);
|
501 |
}
|
502 |
|
503 |
$post_type_activity = (object) $post_type_activity;
|
709 |
$retval = true;
|
710 |
}
|
711 |
break;
|
712 |
+
|
713 |
+
/**
|
714 |
+
* Does this activity type support `generated-content`?
|
715 |
+
*/
|
716 |
+
case 'generated-content' :
|
717 |
+
/*
|
718 |
+
* @todo `bp_activity_set_action()` should be improved to include a supports
|
719 |
+
* argument or best we should create a `bp_register_activity_type()` function
|
720 |
+
* to mimic the way WordPress registers post types. For now we'll use a non
|
721 |
+
* extendable workaround.
|
722 |
+
*/
|
723 |
+
$activity_types = array( 'new_member', 'new_avatar' );
|
724 |
+
|
725 |
+
if ( bp_is_active( 'friends' ) ) {
|
726 |
+
array_push( $activity_types, 'friendship_created' );
|
727 |
+
}
|
728 |
+
|
729 |
+
if ( bp_is_active( 'groups' ) ) {
|
730 |
+
array_push( $activity_types, 'created_group', 'joined_group' );
|
731 |
+
}
|
732 |
+
|
733 |
+
if ( bp_is_active( 'xprofile' ) ) {
|
734 |
+
array_push( $activity_types, 'updated_profile' );
|
735 |
+
}
|
736 |
+
|
737 |
+
$retval = in_array( $activity_type, $activity_types, true );
|
738 |
+
break;
|
739 |
}
|
740 |
|
741 |
return $retval;
|
1801 |
*/
|
1802 |
function bp_activity_get( $args = '' ) {
|
1803 |
|
1804 |
+
$r = bp_parse_args(
|
1805 |
+
$args,
|
1806 |
+
array(
|
1807 |
+
'max' => false, // Maximum number of results to return.
|
1808 |
+
'fields' => 'all',
|
1809 |
+
'page' => 1, // Page 1 without a per_page will result in no pagination.
|
1810 |
+
'per_page' => false, // results per page.
|
1811 |
+
'sort' => 'DESC', // sort ASC or DESC.
|
1812 |
+
'display_comments' => false, // False for no comments. 'stream' for within stream display, 'threaded' for below each activity item.
|
1813 |
+
'search_terms' => false, // Pass search terms as a string.
|
1814 |
+
'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format.
|
1815 |
+
'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format.
|
1816 |
+
'filter_query' => false,
|
1817 |
+
'show_hidden' => false, // Show activity items that are hidden site-wide?
|
1818 |
+
'exclude' => false, // Comma-separated list of activity IDs to exclude.
|
1819 |
+
'in' => false, // Comma-separated list or array of activity IDs to which you want to limit the query.
|
1820 |
+
'spam' => 'ham_only', // 'ham_only' (default), 'spam_only' or 'all'.
|
1821 |
+
'update_meta_cache' => true,
|
1822 |
+
'count_total' => false,
|
1823 |
+
'count_total_only' => false,
|
1824 |
+
'scope' => false,
|
1825 |
|
1826 |
+
/**
|
1827 |
+
* Pass filters as an array -- all filter items can be multiple values comma separated:
|
1828 |
+
* array(
|
1829 |
+
* 'user_id' => false, // User ID to filter on.
|
1830 |
+
* 'object' => false, // Object to filter on e.g. groups, profile, status, friends.
|
1831 |
+
* 'action' => false, // Action to filter on e.g. activity_update, profile_updated.
|
1832 |
+
* 'primary_id' => false, // Object ID to filter on e.g. a group_id or blog_id etc.
|
1833 |
+
* 'secondary_id' => false, // Secondary object ID to filter on e.g. a post_id.
|
1834 |
+
* );
|
1835 |
+
*/
|
1836 |
+
'filter' => array()
|
1837 |
+
),
|
1838 |
+
'activity_get'
|
1839 |
+
);
|
1840 |
|
1841 |
+
$activity = BP_Activity_Activity::get(
|
1842 |
+
array(
|
1843 |
+
'page' => $r['page'],
|
1844 |
+
'per_page' => $r['per_page'],
|
1845 |
+
'max' => $r['max'],
|
1846 |
+
'sort' => $r['sort'],
|
1847 |
+
'search_terms' => $r['search_terms'],
|
1848 |
+
'meta_query' => $r['meta_query'],
|
1849 |
+
'date_query' => $r['date_query'],
|
1850 |
+
'filter_query' => $r['filter_query'],
|
1851 |
+
'filter' => $r['filter'],
|
1852 |
+
'scope' => $r['scope'],
|
1853 |
+
'display_comments' => $r['display_comments'],
|
1854 |
+
'show_hidden' => $r['show_hidden'],
|
1855 |
+
'exclude' => $r['exclude'],
|
1856 |
+
'in' => $r['in'],
|
1857 |
+
'spam' => $r['spam'],
|
1858 |
+
'update_meta_cache' => $r['update_meta_cache'],
|
1859 |
+
'count_total' => $r['count_total'],
|
1860 |
+
'count_total_only' => $r['count_total_only'],
|
1861 |
+
'fields' => $r['fields'],
|
1862 |
+
)
|
1863 |
+
);
|
1864 |
|
1865 |
/**
|
1866 |
* Filters the requested activity item(s).
|
1881 |
* @see BP_Activity_Activity::get() For more information on accepted arguments.
|
1882 |
*
|
1883 |
* @param array|string $args {
|
1884 |
+
* An array of arguments.
|
1885 |
* All arguments and defaults are shared with BP_Activity_Activity::get(),
|
1886 |
* except for the following:
|
1887 |
* @type string|int|array Single activity ID, comma-separated list of IDs,
|
1888 |
* or array of IDs.
|
1889 |
* }
|
1890 |
+
* @return array See BP_Activity_Activity::get() for description.
|
1891 |
*/
|
1892 |
function bp_activity_get_specific( $args = '' ) {
|
1893 |
|
1894 |
+
$r = bp_parse_args(
|
1895 |
+
$args,
|
1896 |
+
array(
|
1897 |
+
'activity_ids' => false, // A single activity_id or array of IDs.
|
1898 |
+
'display_comments' => false, // True or false to display threaded comments for these specific activity items.
|
1899 |
+
'max' => false, // Maximum number of results to return.
|
1900 |
+
'page' => 1, // Page 1 without a per_page will result in no pagination.
|
1901 |
+
'per_page' => false, // Results per page.
|
1902 |
+
'show_hidden' => true, // When fetching specific items, show all.
|
1903 |
+
'sort' => 'DESC', // Sort ASC or DESC.
|
1904 |
+
'spam' => 'ham_only', // Retrieve items marked as spam.
|
1905 |
+
'update_meta_cache' => true,
|
1906 |
+
),
|
1907 |
+
'activity_get_specific'
|
1908 |
+
);
|
1909 |
|
1910 |
$get_args = array(
|
1911 |
'display_comments' => $r['display_comments'],
|
1919 |
'update_meta_cache' => $r['update_meta_cache'],
|
1920 |
);
|
1921 |
|
1922 |
+
$activity = BP_Activity_Activity::get( $get_args );
|
1923 |
+
|
1924 |
/**
|
1925 |
* Filters the requested specific activity item.
|
1926 |
*
|
1927 |
* @since 1.2.0
|
1928 |
*
|
1929 |
+
* @param array $activity The array returned has two keys: total and activity.
|
1930 |
+
* @param array $args Original passed in arguments.
|
1931 |
+
* @param array $get_args Constructed arguments used with request.
|
1932 |
*/
|
1933 |
+
return apply_filters( 'bp_activity_get_specific', $activity, $args, $get_args );
|
1934 |
}
|
1935 |
|
1936 |
/**
|
1975 |
*/
|
1976 |
function bp_activity_add( $args = '' ) {
|
1977 |
|
1978 |
+
$r = bp_parse_args(
|
1979 |
+
$args,
|
1980 |
+
array(
|
1981 |
+
'id' => false, // Pass an existing activity ID to update an existing entry.
|
1982 |
+
'action' => '', // The activity action - e.g. "Jon Doe posted an update".
|
1983 |
+
'content' => '', // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!".
|
1984 |
+
'component' => false, // The name/ID of the component e.g. groups, profile, mycomponent.
|
1985 |
+
'type' => false, // The activity type e.g. activity_update, profile_updated.
|
1986 |
+
'primary_link' => '', // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink).
|
1987 |
+
'user_id' => bp_loggedin_user_id(), // Optional: The user to record the activity for, can be false if this activity is not for a user.
|
1988 |
+
'item_id' => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id.
|
1989 |
+
'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id.
|
1990 |
+
'recorded_time' => bp_core_current_time(), // The GMT time that this activity was recorded.
|
1991 |
+
'hide_sitewide' => false, // Should this be hidden on the sitewide activity stream?
|
1992 |
+
'is_spam' => false, // Is this activity item to be marked as spam?
|
1993 |
+
'error_type' => 'bool',
|
1994 |
+
),
|
1995 |
+
'activity_add'
|
1996 |
+
);
|
1997 |
|
1998 |
// Make sure we are backwards compatible.
|
1999 |
+
if ( empty( $r['component'] ) && ! empty( $r['component_name'] ) ) {
|
2000 |
$r['component'] = $r['component_name'];
|
2001 |
}
|
2002 |
|
2003 |
+
if ( empty( $r['type'] ) && ! empty( $r['component_action'] ) ) {
|
2004 |
$r['type'] = $r['component_action'];
|
2005 |
}
|
2006 |
|
2025 |
|
2026 |
if ( 'wp_error' === $r['error_type'] && is_wp_error( $save ) ) {
|
2027 |
return $save;
|
2028 |
+
} elseif ( 'bool' === $r['error_type'] && false === $save ) {
|
2029 |
return false;
|
2030 |
}
|
2031 |
|
2059 |
* @since 1.2.0
|
2060 |
*
|
2061 |
* @param array|string $args {
|
2062 |
+
* An array of arguments.
|
2063 |
* @type string $content The content of the activity update.
|
2064 |
* @type int $user_id Optional. Defaults to the logged-in user.
|
2065 |
* @type string $error_type Optional. Error type to return. Either 'bool' or 'wp_error'. Defaults to
|
2070 |
*/
|
2071 |
function bp_activity_post_update( $args = '' ) {
|
2072 |
|
2073 |
+
$r = bp_parse_args(
|
2074 |
+
$args,
|
2075 |
+
array(
|
2076 |
+
'content' => false,
|
2077 |
+
'user_id' => bp_loggedin_user_id(),
|
2078 |
+
'error_type' => 'bool',
|
2079 |
+
)
|
2080 |
+
);
|
2081 |
+
|
2082 |
+
if ( empty( $r['content'] ) || ! strlen( trim( $r['content'] ) ) ) {
|
2083 |
+
if ( 'wp_error' === $r['error_type'] ) {
|
2084 |
+
return new WP_Error( 'bp_activity_missing_content', __( 'Please enter some content to post.', 'buddypress' ) );
|
2085 |
+
}
|
2086 |
|
|
|
2087 |
return false;
|
2088 |
}
|
2089 |
|
2090 |
if ( bp_is_user_inactive( $r['user_id'] ) ) {
|
2091 |
+
if ( 'wp_error' === $r['error_type'] ) {
|
2092 |
+
return new WP_Error( 'bp_activity_inactive_user', __( 'User account has not yet been activated.', 'buddypress' ) );
|
2093 |
+
}
|
2094 |
+
|
2095 |
return false;
|
2096 |
}
|
2097 |
|
2340 |
// Update the activity entry.
|
2341 |
$activity = new BP_Activity_Activity( $activity_id );
|
2342 |
|
2343 |
+
// Check if the Post author has changed.
|
2344 |
+
if ( (int) $post->post_author !== (int) $activity->user_id ) {
|
2345 |
+
$activity->user_id = (int) $post->post_author;
|
2346 |
+
}
|
2347 |
+
|
2348 |
if ( ! empty( $post->post_content ) ) {
|
2349 |
$activity_summary = bp_activity_create_summary( $post->post_content, (array) $activity );
|
2350 |
|
2710 |
*/
|
2711 |
function bp_activity_new_comment( $args = '' ) {
|
2712 |
$bp = buddypress();
|
2713 |
+
$r = bp_parse_args(
|
2714 |
+
$args,
|
2715 |
+
array(
|
2716 |
+
'id' => false,
|
2717 |
+
'content' => false,
|
2718 |
+
'user_id' => bp_loggedin_user_id(),
|
2719 |
+
'activity_id' => false, // ID of the root activity item.
|
2720 |
+
'parent_id' => false, // ID of a parent comment (optional).
|
2721 |
+
'primary_link' => '',
|
2722 |
+
'skip_notification' => false,
|
2723 |
+
'error_type' => 'bool',
|
2724 |
+
)
|
2725 |
+
);
|
2726 |
|
2727 |
// Error type is boolean; need to initialize some variables for backpat.
|
2728 |
if ( 'bool' === $r['error_type'] ) {
|
2791 |
$comment_id = bp_activity_add( array(
|
2792 |
'id' => $r['id'],
|
2793 |
'content' => $comment_content,
|
2794 |
+
'component' => $bp->activity->id,
|
2795 |
'type' => 'activity_comment',
|
2796 |
'primary_link' => $r['primary_link'],
|
2797 |
'user_id' => $r['user_id'],
|
2871 |
*/
|
2872 |
function bp_activity_get_activity_id( $args = '' ) {
|
2873 |
|
2874 |
+
$r = bp_parse_args(
|
2875 |
+
$args,
|
2876 |
+
array(
|
2877 |
+
'user_id' => false,
|
2878 |
+
'component' => false,
|
2879 |
+
'type' => false,
|
2880 |
+
'item_id' => false,
|
2881 |
+
'secondary_item_id' => false,
|
2882 |
+
'action' => false,
|
2883 |
+
'content' => false,
|
2884 |
+
'date_recorded' => false,
|
2885 |
+
)
|
2886 |
+
);
|
2887 |
|
2888 |
/**
|
2889 |
* Filters the activity ID being requested.
|
2895 |
* @param array $r Parsed function arguments.
|
2896 |
* @param array $args Arguments passed to the function.
|
2897 |
*/
|
2898 |
+
return apply_filters( 'bp_activity_get_activity_id', BP_Activity_Activity::get_id( $r ), $r, $args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2899 |
}
|
2900 |
|
2901 |
/**
|
2925 |
function bp_activity_delete( $args = '' ) {
|
2926 |
|
2927 |
// Pass one or more the of following variables to delete by those variables.
|
2928 |
+
$args = bp_parse_args(
|
2929 |
+
$args,
|
2930 |
+
array(
|
2931 |
+
'id' => false,
|
2932 |
+
'action' => false,
|
2933 |
+
'content' => false,
|
2934 |
+
'component' => false,
|
2935 |
+
'type' => false,
|
2936 |
+
'primary_link' => false,
|
2937 |
+
'user_id' => false,
|
2938 |
+
'item_id' => false,
|
2939 |
+
'secondary_item_id' => false,
|
2940 |
+
'date_recorded' => false,
|
2941 |
+
'hide_sitewide' => false,
|
2942 |
+
)
|
2943 |
+
);
|
2944 |
|
2945 |
/**
|
2946 |
* Fires before an activity item proceeds to be deleted.
|
3002 |
* @since 1.1.0
|
3003 |
* @deprecated 1.2.0
|
3004 |
*
|
|
|
3005 |
* @param array|string $args See BP_Activity_Activity::get for a
|
3006 |
* description of accepted arguments.
|
3007 |
* @return bool True on success, false on failure.
|
3008 |
*/
|
3009 |
function bp_activity_delete_by_item_id( $args = '' ) {
|
3010 |
|
3011 |
+
$r = bp_parse_args(
|
3012 |
+
$args,
|
3013 |
+
array(
|
3014 |
+
'item_id' => false,
|
3015 |
+
'component' => false,
|
3016 |
+
'type' => false,
|
3017 |
+
'user_id' => false,
|
3018 |
+
'secondary_item_id' => false,
|
3019 |
+
)
|
3020 |
+
);
|
3021 |
|
3022 |
return bp_activity_delete( $r );
|
3023 |
}
|
3613 |
// Clear the activity stream first page cache.
|
3614 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
3615 |
|
3616 |
+
if ( 'activity_comment' === $activity->type ) {
|
3617 |
+
$activity_id = $activity->item_id;
|
3618 |
+
} else {
|
3619 |
+
$activity_id = $activity->id;
|
3620 |
+
}
|
3621 |
+
|
3622 |
// Clear the activity comment cache for this activity item.
|
3623 |
+
wp_cache_delete( $activity_id, 'bp_activity_comments' );
|
3624 |
|
3625 |
// If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity.
|
3626 |
if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
|
3666 |
// Clear the activity stream first page cache.
|
3667 |
wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
|
3668 |
|
3669 |
+
if ( 'activity_comment' === $activity->type ) {
|
3670 |
+
$activity_id = $activity->item_id;
|
3671 |
+
} else {
|
3672 |
+
$activity_id = $activity->id;
|
3673 |
+
}
|
3674 |
+
|
3675 |
// Clear the activity comment cache for this activity item.
|
3676 |
+
wp_cache_delete( $activity_id, 'bp_activity_comments' );
|
3677 |
|
3678 |
// If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity.
|
3679 |
if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
|
@@ -245,41 +245,45 @@ function bp_has_activities( $args = '' ) {
|
|
245 |
|
246 |
// Note: any params used for filtering can be a single value, or multiple
|
247 |
// values comma separated.
|
248 |
-
$r = bp_parse_args(
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
|
|
|
|
|
|
|
|
283 |
|
284 |
/*
|
285 |
* Smart Overrides.
|
@@ -885,6 +889,26 @@ function bp_activity_type() {
|
|
885 |
return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
|
886 |
}
|
887 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
888 |
/**
|
889 |
* Output the activity action name.
|
890 |
*
|
@@ -1049,7 +1073,11 @@ function bp_activity_avatar( $args = '' ) {
|
|
1049 |
'user_id' => false
|
1050 |
);
|
1051 |
|
1052 |
-
$r =
|
|
|
|
|
|
|
|
|
1053 |
extract( $r, EXTR_SKIP );
|
1054 |
|
1055 |
if ( !isset( $height ) && !isset( $width ) ) {
|
@@ -1152,16 +1180,20 @@ function bp_activity_secondary_avatar( $args = '' ) {
|
|
1152 |
function bp_get_activity_secondary_avatar( $args = '' ) {
|
1153 |
global $activities_template;
|
1154 |
|
1155 |
-
$r =
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
|
|
|
|
|
|
|
|
1165 |
extract( $r, EXTR_SKIP );
|
1166 |
|
1167 |
// Set item_id and object (default to user).
|
@@ -1328,9 +1360,12 @@ function bp_activity_action( $args = array() ) {
|
|
1328 |
function bp_get_activity_action( $args = array() ) {
|
1329 |
global $activities_template;
|
1330 |
|
1331 |
-
$r =
|
1332 |
-
|
1333 |
-
|
|
|
|
|
|
|
1334 |
|
1335 |
/**
|
1336 |
* Filters the activity action before the action is inserted as meta.
|
@@ -1369,7 +1404,6 @@ function bp_activity_action( $args = array() ) {
|
|
1369 |
* Output the activity content body.
|
1370 |
*
|
1371 |
* @since 1.2.0
|
1372 |
-
*
|
1373 |
*/
|
1374 |
function bp_activity_content_body() {
|
1375 |
echo bp_get_activity_content_body();
|
@@ -1407,6 +1441,7 @@ function bp_activity_content_body() {
|
|
1407 |
* Does the activity have content?
|
1408 |
*
|
1409 |
* @since 1.2.0
|
|
|
1410 |
*
|
1411 |
* @global object $activities_template {@link BP_Activity_Template}
|
1412 |
*
|
@@ -1415,13 +1450,224 @@ function bp_activity_content_body() {
|
|
1415 |
function bp_activity_has_content() {
|
1416 |
global $activities_template;
|
1417 |
|
1418 |
-
|
1419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1420 |
}
|
1421 |
|
1422 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1423 |
}
|
1424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1425 |
/**
|
1426 |
* Output the activity content.
|
1427 |
*
|
@@ -2662,6 +2908,8 @@ function bp_activity_delete_link() {
|
|
2662 |
// Determine if we're on a single activity page, and customize accordingly.
|
2663 |
if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
|
2664 |
$class = 'delete-activity-single';
|
|
|
|
|
2665 |
}
|
2666 |
|
2667 |
$link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
|
@@ -2698,11 +2946,18 @@ function bp_activity_delete_url() {
|
|
2698 |
function bp_get_activity_delete_url() {
|
2699 |
global $activities_template;
|
2700 |
|
2701 |
-
$
|
|
|
|
|
|
|
|
|
|
|
2702 |
|
2703 |
// Determine if we're on a single activity page, and customize accordingly.
|
2704 |
if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
|
2705 |
$url = add_query_arg( array( 'redirect_to' => wp_get_referer() ), $url );
|
|
|
|
|
2706 |
}
|
2707 |
|
2708 |
$url = wp_nonce_url( $url, 'bp_activity_delete_link' );
|
@@ -2812,9 +3067,12 @@ function bp_activity_filter_links( $args = false ) {
|
|
2812 |
*/
|
2813 |
function bp_get_activity_filter_links( $args = false ) {
|
2814 |
|
2815 |
-
$r =
|
2816 |
-
|
2817 |
-
|
|
|
|
|
|
|
2818 |
|
2819 |
// Define local variable.
|
2820 |
$component_links = array();
|
@@ -3238,16 +3496,19 @@ function bp_send_public_message_button( $args = '' ) {
|
|
3238 |
*/
|
3239 |
function bp_get_send_public_message_button( $args = '' ) {
|
3240 |
|
3241 |
-
$r = bp_parse_args(
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
|
|
|
|
|
|
3251 |
|
3252 |
/**
|
3253 |
* Filters the public message button HTML.
|
@@ -3305,12 +3566,15 @@ function bp_activity_post_form_action() {
|
|
3305 |
*/
|
3306 |
function bp_activity_comments_user_avatars( $args = array() ) {
|
3307 |
|
3308 |
-
$r = bp_parse_args(
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
|
|
|
|
|
|
3314 |
|
3315 |
// Get the user IDs of everyone who has left a comment to the current activity item.
|
3316 |
$user_ids = bp_activity_get_comments_user_ids();
|
@@ -3472,10 +3736,13 @@ function bp_displayed_user_mentionname() {
|
|
3472 |
*/
|
3473 |
function bp_activity_types_list( $output = 'select', $args = '' ) {
|
3474 |
|
3475 |
-
$args = bp_parse_args(
|
3476 |
-
|
3477 |
-
|
3478 |
-
|
|
|
|
|
|
|
3479 |
|
3480 |
$activities = bp_activity_get_types();
|
3481 |
natsort( $activities );
|
245 |
|
246 |
// Note: any params used for filtering can be a single value, or multiple
|
247 |
// values comma separated.
|
248 |
+
$r = bp_parse_args(
|
249 |
+
$args,
|
250 |
+
array(
|
251 |
+
'display_comments' => 'threaded', // False for none, stream/threaded - show comments in the stream or threaded under items.
|
252 |
+
'include' => $include, // Pass an activity_id or string of IDs comma-separated.
|
253 |
+
'exclude' => false, // Pass an activity_id or string of IDs comma-separated.
|
254 |
+
'in' => false, // Comma-separated list or array of activity IDs among which to search.
|
255 |
+
'sort' => 'DESC', // Sort DESC or ASC.
|
256 |
+
'page' => 1, // Which page to load.
|
257 |
+
'per_page' => 20, // Number of items per page.
|
258 |
+
'page_arg' => 'acpage', // See https://buddypress.trac.wordpress.org/ticket/3679.
|
259 |
+
'max' => false, // Max number to return.
|
260 |
+
'fields' => 'all',
|
261 |
+
'count_total' => false,
|
262 |
+
'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide?
|
263 |
+
'spam' => 'ham_only', // Hide spammed items.
|
264 |
+
|
265 |
+
// Scope - pre-built activity filters for a user (friends/groups/favorites/mentions).
|
266 |
+
'scope' => $scope,
|
267 |
+
|
268 |
+
// Filtering.
|
269 |
+
'user_id' => $user_id, // user_id to filter on.
|
270 |
+
'object' => $object, // Object to filter on e.g. groups, profile, status, friends.
|
271 |
+
'action' => false, // Action to filter on e.g. activity_update, profile_updated.
|
272 |
+
'primary_id' => $primary_id, // Object ID to filter on e.g. a group_id or blog_id etc.
|
273 |
+
'secondary_id' => false, // Secondary object ID to filter on e.g. a post_id.
|
274 |
+
'offset' => false, // Return only items >= this ID.
|
275 |
+
'since' => false, // Return only items recorded since this Y-m-d H:i:s date.
|
276 |
+
|
277 |
+
'meta_query' => false, // Filter on activity meta. See WP_Meta_Query for format.
|
278 |
+
'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format.
|
279 |
+
'filter_query' => false, // Advanced filtering. See BP_Activity_Query for format.
|
280 |
+
|
281 |
+
// Searching.
|
282 |
+
'search_terms' => $search_terms_default,
|
283 |
+
'update_meta_cache' => true,
|
284 |
+
),
|
285 |
+
'has_activities'
|
286 |
+
);
|
287 |
|
288 |
/*
|
289 |
* Smart Overrides.
|
889 |
return apply_filters( 'bp_get_activity_type', $activities_template->activity->type );
|
890 |
}
|
891 |
|
892 |
+
/**
|
893 |
+
* Return the activity type template part name.
|
894 |
+
*
|
895 |
+
* @since 10.0.0
|
896 |
+
*
|
897 |
+
* @global object $activities_template {@link BP_Activity_Template}
|
898 |
+
*
|
899 |
+
* @return string The activity type template part name.
|
900 |
+
*/
|
901 |
+
function bp_activity_type_part() {
|
902 |
+
global $activities_template;
|
903 |
+
|
904 |
+
$name = '';
|
905 |
+
if ( isset( $activities_template->activity->type ) && $activities_template->activity->type ) {
|
906 |
+
$name = str_replace( '_', '-', $activities_template->activity->type );
|
907 |
+
}
|
908 |
+
|
909 |
+
return $name;
|
910 |
+
}
|
911 |
+
|
912 |
/**
|
913 |
* Output the activity action name.
|
914 |
*
|
1073 |
'user_id' => false
|
1074 |
);
|
1075 |
|
1076 |
+
$r = bp_parse_args(
|
1077 |
+
$args,
|
1078 |
+
$defaults
|
1079 |
+
);
|
1080 |
+
|
1081 |
extract( $r, EXTR_SKIP );
|
1082 |
|
1083 |
if ( !isset( $height ) && !isset( $width ) ) {
|
1180 |
function bp_get_activity_secondary_avatar( $args = '' ) {
|
1181 |
global $activities_template;
|
1182 |
|
1183 |
+
$r = bp_parse_args(
|
1184 |
+
$args,
|
1185 |
+
array(
|
1186 |
+
'alt' => '',
|
1187 |
+
'type' => 'thumb',
|
1188 |
+
'width' => 20,
|
1189 |
+
'height' => 20,
|
1190 |
+
'class' => 'avatar',
|
1191 |
+
'link_class' => '',
|
1192 |
+
'linked' => true,
|
1193 |
+
'email' => false,
|
1194 |
+
)
|
1195 |
+
);
|
1196 |
+
|
1197 |
extract( $r, EXTR_SKIP );
|
1198 |
|
1199 |
// Set item_id and object (default to user).
|
1360 |
function bp_get_activity_action( $args = array() ) {
|
1361 |
global $activities_template;
|
1362 |
|
1363 |
+
$r = bp_parse_args(
|
1364 |
+
$args,
|
1365 |
+
array(
|
1366 |
+
'no_timestamp' => false,
|
1367 |
+
)
|
1368 |
+
);
|
1369 |
|
1370 |
/**
|
1371 |
* Filters the activity action before the action is inserted as meta.
|
1404 |
* Output the activity content body.
|
1405 |
*
|
1406 |
* @since 1.2.0
|
|
|
1407 |
*/
|
1408 |
function bp_activity_content_body() {
|
1409 |
echo bp_get_activity_content_body();
|
1441 |
* Does the activity have content?
|
1442 |
*
|
1443 |
* @since 1.2.0
|
1444 |
+
* @since 10.0.0 Generate a richer content for activity types supporting the feature.
|
1445 |
*
|
1446 |
* @global object $activities_template {@link BP_Activity_Template}
|
1447 |
*
|
1450 |
function bp_activity_has_content() {
|
1451 |
global $activities_template;
|
1452 |
|
1453 |
+
$has_content = ! empty( $activities_template->activity->content );
|
1454 |
+
if ( ! $has_content ) {
|
1455 |
+
$activity_type = bp_get_activity_type();
|
1456 |
+
|
1457 |
+
if ( bp_activity_type_supports( $activity_type, 'generated-content' ) ) {
|
1458 |
+
$bp = buddypress();
|
1459 |
+
$generated_content = new stdClass();
|
1460 |
+
$activity = $activities_template->activity;
|
1461 |
+
$user_id = $activity->user_id;
|
1462 |
+
|
1463 |
+
// Set generated content properties.
|
1464 |
+
if ( 'new_avatar' === $activity_type ) {
|
1465 |
+
$avatars = bp_avatar_get_version( $user_id, 'user', bp_get_activity_date_recorded() );
|
1466 |
+
|
1467 |
+
if ( $avatars && 1 === count( $avatars ) ) {
|
1468 |
+
$avatar = reset( $avatars );
|
1469 |
+
$historical_avatar = trailingslashit( $avatar->parent_dir_url ) . $avatar->name;
|
1470 |
+
|
1471 |
+
// Add historical avatar to the current activity.
|
1472 |
+
$generated_content->user_profile_photo = array(
|
1473 |
+
'value' => $historical_avatar,
|
1474 |
+
'sanitize_callback' => 'esc_url',
|
1475 |
+
);
|
1476 |
+
|
1477 |
+
// Do not use a generated content.
|
1478 |
+
} else {
|
1479 |
+
return false;
|
1480 |
+
}
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
if ( in_array( $activity_type, array( 'new_member', 'friendship_created', 'updated_profile' ), true ) ) {
|
1484 |
+
if ( 'friendship_created' === $activity_type ) {
|
1485 |
+
$user_id = $activity->secondary_item_id;
|
1486 |
+
}
|
1487 |
+
|
1488 |
+
if ( isset( $bp->avatar->show_avatars ) && $bp->avatar->show_avatars ) {
|
1489 |
+
$generated_content->user_profile_photo = array(
|
1490 |
+
'value' => bp_core_fetch_avatar(
|
1491 |
+
array(
|
1492 |
+
'item_id' => $user_id,
|
1493 |
+
'object' => 'user',
|
1494 |
+
'type' => 'full',
|
1495 |
+
'width' => bp_core_avatar_full_width(),
|
1496 |
+
'height' => bp_core_avatar_full_height(),
|
1497 |
+
'html' => false,
|
1498 |
+
)
|
1499 |
+
),
|
1500 |
+
'sanitize_callback' => 'esc_url',
|
1501 |
+
);
|
1502 |
+
}
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
// Set common generated content properties.
|
1506 |
+
if ( in_array( $activity_type, array( 'new_avatar', 'new_member', 'friendship_created', 'updated_profile' ), true ) ) {
|
1507 |
+
$generated_content->user_url = array(
|
1508 |
+
'value' => bp_core_get_user_domain( $user_id ),
|
1509 |
+
'sanitize_callback' => 'esc_url',
|
1510 |
+
);
|
1511 |
+
|
1512 |
+
$generated_content->user_display_name = array(
|
1513 |
+
'value' => bp_core_get_user_displayname( $user_id ),
|
1514 |
+
'sanitize_callback' => 'esc_html',
|
1515 |
+
);
|
1516 |
+
|
1517 |
+
$generated_content->user_mention_name = array(
|
1518 |
+
'value' => bp_activity_get_user_mentionname( $user_id ),
|
1519 |
+
'sanitize_callback' => 'esc_html',
|
1520 |
+
);
|
1521 |
+
|
1522 |
+
$generated_content->user_mention_url = array(
|
1523 |
+
'value' => wp_nonce_url(
|
1524 |
+
add_query_arg(
|
1525 |
+
array(
|
1526 |
+
'r' => $generated_content->user_mention_name['value'],
|
1527 |
+
),
|
1528 |
+
bp_get_activity_directory_permalink()
|
1529 |
+
)
|
1530 |
+
),
|
1531 |
+
'sanitize_callback' => 'esc_url',
|
1532 |
+
);
|
1533 |
+
|
1534 |
+
if ( bp_displayed_user_use_cover_image_header() ) {
|
1535 |
+
$generated_content->user_cover_image = array(
|
1536 |
+
'value' => bp_attachments_get_attachment(
|
1537 |
+
'url',
|
1538 |
+
array(
|
1539 |
+
'object_dir' => 'members',
|
1540 |
+
'item_id' => $user_id,
|
1541 |
+
)
|
1542 |
+
),
|
1543 |
+
'sanitize_callback' => 'esc_url',
|
1544 |
+
);
|
1545 |
+
}
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
if ( 'created_group' === $activity_type || 'joined_group' === $activity_type ) {
|
1549 |
+
$group = bp_get_group( $activity->item_id );
|
1550 |
+
|
1551 |
+
if ( isset( $bp->avatar->show_avatars ) && $bp->avatar->show_avatars && ! bp_disable_group_avatar_uploads() ) {
|
1552 |
+
$generated_content->group_profile_photo = array(
|
1553 |
+
'value' => bp_core_fetch_avatar(
|
1554 |
+
array(
|
1555 |
+
'item_id' => $group->id,
|
1556 |
+
'object' => 'group',
|
1557 |
+
'type' => 'full',
|
1558 |
+
'width' => bp_core_avatar_full_width(),
|
1559 |
+
'height' => bp_core_avatar_full_height(),
|
1560 |
+
'html' => false,
|
1561 |
+
)
|
1562 |
+
),
|
1563 |
+
'sanitize_callback' => 'esc_url',
|
1564 |
+
);
|
1565 |
+
}
|
1566 |
+
|
1567 |
+
$generated_content->group_url = array(
|
1568 |
+
'value' => bp_get_group_permalink( $group ),
|
1569 |
+
'sanitize_callback' => 'esc_url',
|
1570 |
+
);
|
1571 |
+
|
1572 |
+
$generated_content->group_name = array(
|
1573 |
+
'value' => bp_get_group_name( $group ),
|
1574 |
+
'sanitize_callback' => 'esc_html',
|
1575 |
+
);
|
1576 |
+
|
1577 |
+
if ( bp_group_use_cover_image_header() ) {
|
1578 |
+
$generated_content->group_cover_image = array(
|
1579 |
+
'value' => bp_get_group_cover_url( $group ),
|
1580 |
+
'sanitize_callback' => 'esc_url',
|
1581 |
+
);
|
1582 |
+
}
|
1583 |
+
}
|
1584 |
+
|
1585 |
+
// Update the corresponding entry into the activities template global.
|
1586 |
+
if ( get_object_vars( $generated_content ) ) {
|
1587 |
+
$activity_id = $activities_template->activity->id;
|
1588 |
+
$activity_index = 0;
|
1589 |
+
|
1590 |
+
// Find the activity index.
|
1591 |
+
while ( (int) $activities_template->activities[ $activity_index ]->id !== (int) $activity_id ) {
|
1592 |
+
$activity_index++;
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
// Add the generated content object.
|
1596 |
+
$activities_template->activities[ $activity_index ]->generated_content = $generated_content;
|
1597 |
+
$has_content = true;
|
1598 |
+
}
|
1599 |
+
}
|
1600 |
}
|
1601 |
|
1602 |
+
return $has_content;
|
1603 |
+
}
|
1604 |
+
|
1605 |
+
/**
|
1606 |
+
* Does this property has been generated?
|
1607 |
+
*
|
1608 |
+
* @since 10.0.0
|
1609 |
+
*
|
1610 |
+
* @param string $property The name of the property to check into the generated content.
|
1611 |
+
* @return bool True if the property is not empty. False otherwise.
|
1612 |
+
*/
|
1613 |
+
function bp_activity_has_generated_content_part( $property = '' ) {
|
1614 |
+
return bp_activity_get_generated_content_part( $property, 'boolean' );
|
1615 |
}
|
1616 |
|
1617 |
+
/**
|
1618 |
+
* Outputs a property of the activity generated content.
|
1619 |
+
*
|
1620 |
+
* @since 10.0.0
|
1621 |
+
*
|
1622 |
+
* @param string $property The name of the property to check into the generated content.
|
1623 |
+
*/
|
1624 |
+
function bp_activity_generated_content_part( $property = '' ) {
|
1625 |
+
echo bp_activity_get_generated_content_part( $property );
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
/**
|
1629 |
+
* Returns the property of the activity generated content.
|
1630 |
+
*
|
1631 |
+
* @since 10.0.0
|
1632 |
+
*
|
1633 |
+
* @param string $property The name of the property to check into the generated content.
|
1634 |
+
* @param string $return Whether to return the property value or a boolean to check it exists.
|
1635 |
+
* @return bool|string A boolean when requested, false if there is no value, the HTML output otherwise.
|
1636 |
+
*/
|
1637 |
+
function bp_activity_get_generated_content_part( $property = '', $return = '' ) {
|
1638 |
+
global $activities_template;
|
1639 |
+
|
1640 |
+
if ( ! isset( $activities_template->activity->generated_content->{$property} ) ) {
|
1641 |
+
return false;
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
$content_part = $activities_template->activity->generated_content->{$property};
|
1645 |
+
|
1646 |
+
if ( ! isset( $content_part['value'] ) || ! $content_part['value'] ) {
|
1647 |
+
return false;
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
if ( 'boolean' === $return ) {
|
1651 |
+
return true;
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
/**
|
1655 |
+
* Filter here to edit the generated content part.
|
1656 |
+
*
|
1657 |
+
* @since 10.0.0
|
1658 |
+
*
|
1659 |
+
* @param string $value The generated content part.
|
1660 |
+
* @param string $property The property the content part is attached to.
|
1661 |
+
*/
|
1662 |
+
$value = apply_filters( 'bp_activity_get_generated_content_part', $content_part['value'], $property );
|
1663 |
+
|
1664 |
+
if ( isset( $content_part['sanitize_callback'] ) && $content_part['sanitize_callback'] ) {
|
1665 |
+
return call_user_func( $content_part['sanitize_callback'], $value );
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
return $value;
|
1669 |
+
}
|
1670 |
+
|
1671 |
/**
|
1672 |
* Output the activity content.
|
1673 |
*
|
2908 |
// Determine if we're on a single activity page, and customize accordingly.
|
2909 |
if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
|
2910 |
$class = 'delete-activity-single';
|
2911 |
+
} elseif ( 'activity_comment' === bp_get_activity_type() ) {
|
2912 |
+
$class = 'acomment-delete';
|
2913 |
}
|
2914 |
|
2915 |
$link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action ' . $class . ' confirm" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
|
2946 |
function bp_get_activity_delete_url() {
|
2947 |
global $activities_template;
|
2948 |
|
2949 |
+
$activity_id = 0;
|
2950 |
+
if ( isset( $activities_template->activity->id ) ) {
|
2951 |
+
$activity_id = (int) $activities_template->activity->id;
|
2952 |
+
}
|
2953 |
+
|
2954 |
+
$url = trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activity_id );
|
2955 |
|
2956 |
// Determine if we're on a single activity page, and customize accordingly.
|
2957 |
if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
|
2958 |
$url = add_query_arg( array( 'redirect_to' => wp_get_referer() ), $url );
|
2959 |
+
} elseif ( 'activity_comment' === bp_get_activity_type() ) {
|
2960 |
+
$url = add_query_arg( 'cid', $activity_id, $url );
|
2961 |
}
|
2962 |
|
2963 |
$url = wp_nonce_url( $url, 'bp_activity_delete_link' );
|
3067 |
*/
|
3068 |
function bp_get_activity_filter_links( $args = false ) {
|
3069 |
|
3070 |
+
$r = bp_parse_args(
|
3071 |
+
$args,
|
3072 |
+
array(
|
3073 |
+
'style' => 'list',
|
3074 |
+
)
|
3075 |
+
);
|
3076 |
|
3077 |
// Define local variable.
|
3078 |
$component_links = array();
|
3496 |
*/
|
3497 |
function bp_get_send_public_message_button( $args = '' ) {
|
3498 |
|
3499 |
+
$r = bp_parse_args(
|
3500 |
+
$args,
|
3501 |
+
array(
|
3502 |
+
'id' => 'public_message',
|
3503 |
+
'component' => 'activity',
|
3504 |
+
'must_be_logged_in' => true,
|
3505 |
+
'block_self' => true,
|
3506 |
+
'wrapper_id' => 'post-mention',
|
3507 |
+
'link_href' => bp_get_send_public_message_link(),
|
3508 |
+
'link_text' => __( 'Public Message', 'buddypress' ),
|
3509 |
+
'link_class' => 'activity-button mention',
|
3510 |
+
)
|
3511 |
+
);
|
3512 |
|
3513 |
/**
|
3514 |
* Filters the public message button HTML.
|
3566 |
*/
|
3567 |
function bp_activity_comments_user_avatars( $args = array() ) {
|
3568 |
|
3569 |
+
$r = bp_parse_args(
|
3570 |
+
$args,
|
3571 |
+
array(
|
3572 |
+
'height' => false,
|
3573 |
+
'html' => true,
|
3574 |
+
'type' => 'thumb',
|
3575 |
+
'width' => false,
|
3576 |
+
)
|
3577 |
+
);
|
3578 |
|
3579 |
// Get the user IDs of everyone who has left a comment to the current activity item.
|
3580 |
$user_ids = bp_activity_get_comments_user_ids();
|
3736 |
*/
|
3737 |
function bp_activity_types_list( $output = 'select', $args = '' ) {
|
3738 |
|
3739 |
+
$args = bp_parse_args(
|
3740 |
+
$args,
|
3741 |
+
array(
|
3742 |
+
'checkbox_name' => 'bp_activity_types',
|
3743 |
+
'selected' => array(),
|
3744 |
+
)
|
3745 |
+
);
|
3746 |
|
3747 |
$activities = bp_activity_get_types();
|
3748 |
natsort( $activities );
|
@@ -341,6 +341,7 @@ class BP_Activity_Activity {
|
|
341 |
* @since 1.2.0
|
342 |
* @since 2.4.0 Introduced the `$fields` parameter.
|
343 |
* @since 2.9.0 Introduced the `$order_by` parameter.
|
|
|
344 |
*
|
345 |
* @see BP_Activity_Activity::get_filter_sql() for a description of the
|
346 |
* 'filter' parameter.
|
@@ -372,6 +373,8 @@ class BP_Activity_Activity {
|
|
372 |
* @type bool $update_meta_cache Whether to pre-fetch metadata for queried activity items. Default: true.
|
373 |
* @type string|bool $count_total If true, an additional DB query is run to count the total activity items
|
374 |
* for the query. Default: false.
|
|
|
|
|
375 |
* }
|
376 |
* @return array The array returned has two keys:
|
377 |
* - 'total' is the count of located activities
|
@@ -383,13 +386,13 @@ class BP_Activity_Activity {
|
|
383 |
$function_args = func_get_args();
|
384 |
|
385 |
// Backward compatibility with old method of passing arguments.
|
386 |
-
if ( !is_array( $args ) || count( $function_args ) > 1 ) {
|
387 |
_deprecated_argument(
|
388 |
__METHOD__,
|
389 |
'1.6',
|
390 |
sprintf(
|
391 |
/* translators: 1: the name of the method. 2: the name of the file. */
|
392 |
-
|
393 |
__METHOD__,
|
394 |
__FILE__
|
395 |
)
|
@@ -413,27 +416,31 @@ class BP_Activity_Activity {
|
|
413 |
}
|
414 |
|
415 |
$bp = buddypress();
|
416 |
-
$r =
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
|
|
|
|
|
|
|
|
437 |
|
438 |
// Select conditions.
|
439 |
$select_sql = "SELECT DISTINCT a.id";
|
@@ -504,10 +511,10 @@ class BP_Activity_Activity {
|
|
504 |
}
|
505 |
}
|
506 |
|
507 |
-
//
|
508 |
$sort = $r['sort'];
|
509 |
-
if (
|
510 |
-
$sort =
|
511 |
}
|
512 |
|
513 |
switch( $r['order_by'] ) {
|
@@ -626,6 +633,10 @@ class BP_Activity_Activity {
|
|
626 |
'has_more_items' => null,
|
627 |
);
|
628 |
|
|
|
|
|
|
|
|
|
629 |
/**
|
630 |
* Filters if BuddyPress should use legacy query structure over current structure for version 2.0+.
|
631 |
*
|
@@ -637,7 +648,7 @@ class BP_Activity_Activity {
|
|
637 |
* @param BP_Activity_Activity $value Current method being called.
|
638 |
* @param array $r Parsed arguments passed into method.
|
639 |
*/
|
640 |
-
if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $r ) ) {
|
641 |
|
642 |
// Legacy queries joined against the user table.
|
643 |
$select_sql = "SELECT DISTINCT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
|
@@ -689,7 +700,7 @@ class BP_Activity_Activity {
|
|
689 |
$activities[ $i ]->is_spam = (int) $ac->is_spam;
|
690 |
}
|
691 |
|
692 |
-
}
|
693 |
// Query first for activity IDs.
|
694 |
$activity_ids_sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY {$order_by} {$sort}, a.id {$sort}";
|
695 |
|
@@ -742,7 +753,7 @@ class BP_Activity_Activity {
|
|
742 |
}
|
743 |
}
|
744 |
|
745 |
-
if ( 'ids' !== $r['fields'] ) {
|
746 |
// Get the fullnames of users so we don't have to query in the loop.
|
747 |
$activities = self::append_user_fullnames( $activities );
|
748 |
|
@@ -769,9 +780,8 @@ class BP_Activity_Activity {
|
|
769 |
|
770 |
$retval['activities'] = $activities;
|
771 |
|
772 |
-
//
|
773 |
-
if ( ! empty( $r['count_total'] ) ) {
|
774 |
-
|
775 |
/**
|
776 |
* Filters the total activities MySQL statement.
|
777 |
*
|
@@ -782,6 +792,17 @@ class BP_Activity_Activity {
|
|
782 |
* @param string $sort Sort direction for query.
|
783 |
*/
|
784 |
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
$cached = bp_core_get_incremented_cache( $total_activities_sql, $cache_group );
|
786 |
if ( false === $cached ) {
|
787 |
$total_activities = $wpdb->get_var( $total_activities_sql );
|
@@ -790,7 +811,8 @@ class BP_Activity_Activity {
|
|
790 |
$total_activities = $cached;
|
791 |
}
|
792 |
|
793 |
-
|
|
|
794 |
if ( (int) $total_activities > (int) $r['max'] ) {
|
795 |
$total_activities = $r['max'];
|
796 |
}
|
@@ -1010,9 +1032,6 @@ class BP_Activity_Activity {
|
|
1010 |
*
|
1011 |
* We use BP_Date_Query, which extends WP_Date_Query, to do the heavy lifting
|
1012 |
* of parsing the date_query array and creating the necessary SQL clauses.
|
1013 |
-
* However, since BP_Activity_Activity::get() builds its SQL differently than
|
1014 |
-
* WP_Query, we have to alter the return value (stripping the leading AND
|
1015 |
-
* keyword from the query).
|
1016 |
*
|
1017 |
* @since 2.1.0
|
1018 |
*
|
@@ -1021,15 +1040,7 @@ class BP_Activity_Activity {
|
|
1021 |
* @return string
|
1022 |
*/
|
1023 |
public static function get_date_query_sql( $date_query = array() ) {
|
1024 |
-
$
|
1025 |
-
|
1026 |
-
// Date query.
|
1027 |
-
if ( ! empty( $date_query ) && is_array( $date_query ) ) {
|
1028 |
-
$date_query = new BP_Date_Query( $date_query, 'date_recorded' );
|
1029 |
-
$sql = preg_replace( '/^\sAND/', '', $date_query->get_sql() );
|
1030 |
-
}
|
1031 |
-
|
1032 |
-
return $sql;
|
1033 |
}
|
1034 |
|
1035 |
/**
|
@@ -1155,7 +1166,12 @@ class BP_Activity_Activity {
|
|
1155 |
* @return array
|
1156 |
*/
|
1157 |
public static function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
|
1158 |
-
_deprecated_function(
|
|
|
|
|
|
|
|
|
|
|
1159 |
return BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids );
|
1160 |
}
|
1161 |
|
@@ -1163,61 +1179,105 @@ class BP_Activity_Activity {
|
|
1163 |
* Get the first activity ID that matches a set of criteria.
|
1164 |
*
|
1165 |
* @since 1.2.0
|
|
|
1166 |
*
|
1167 |
-
* @
|
1168 |
-
*
|
1169 |
-
*
|
1170 |
-
*
|
1171 |
-
*
|
1172 |
-
*
|
1173 |
-
*
|
1174 |
-
*
|
1175 |
-
*
|
1176 |
-
*
|
|
|
1177 |
* @return int|false Activity ID on success, false if none is found.
|
1178 |
*/
|
1179 |
-
public static function get_id( $
|
1180 |
global $wpdb;
|
1181 |
|
1182 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1183 |
|
1184 |
$where_args = false;
|
1185 |
|
1186 |
-
if ( ! empty( $user_id ) ) {
|
1187 |
-
$where_args[] = $wpdb->prepare(
|
1188 |
}
|
1189 |
|
1190 |
-
if ( ! empty( $component ) ) {
|
1191 |
-
$where_args[] = $wpdb->prepare(
|
1192 |
}
|
1193 |
|
1194 |
-
if ( ! empty( $type ) ) {
|
1195 |
-
$where_args[] = $wpdb->prepare(
|
1196 |
}
|
1197 |
|
1198 |
-
if ( ! empty( $item_id ) ) {
|
1199 |
-
$where_args[] = $wpdb->prepare(
|
1200 |
}
|
1201 |
|
1202 |
-
if ( ! empty( $secondary_item_id ) ) {
|
1203 |
-
$where_args[] = $wpdb->prepare(
|
1204 |
}
|
1205 |
|
1206 |
-
if ( ! empty( $action ) ) {
|
1207 |
-
$where_args[] = $wpdb->prepare(
|
1208 |
}
|
1209 |
|
1210 |
-
if ( ! empty( $content ) ) {
|
1211 |
-
$where_args[] = $wpdb->prepare(
|
1212 |
}
|
1213 |
|
1214 |
-
if ( ! empty( $date_recorded ) ) {
|
1215 |
-
$where_args[] = $wpdb->prepare(
|
1216 |
}
|
1217 |
|
1218 |
if ( ! empty( $where_args ) ) {
|
|
|
1219 |
$where_sql = 'WHERE ' . join( ' AND ', $where_args );
|
1220 |
-
$result
|
1221 |
|
1222 |
return is_numeric( $result ) ? (int) $result : false;
|
1223 |
}
|
@@ -1252,19 +1312,22 @@ class BP_Activity_Activity {
|
|
1252 |
global $wpdb;
|
1253 |
|
1254 |
$bp = buddypress();
|
1255 |
-
$r =
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
|
|
|
|
|
|
1268 |
|
1269 |
// Setup empty array from where query arguments.
|
1270 |
$where_args = array();
|
341 |
* @since 1.2.0
|
342 |
* @since 2.4.0 Introduced the `$fields` parameter.
|
343 |
* @since 2.9.0 Introduced the `$order_by` parameter.
|
344 |
+
* @since 10.0.0 Introduced the `$count_total_only` parameter.
|
345 |
*
|
346 |
* @see BP_Activity_Activity::get_filter_sql() for a description of the
|
347 |
* 'filter' parameter.
|
373 |
* @type bool $update_meta_cache Whether to pre-fetch metadata for queried activity items. Default: true.
|
374 |
* @type string|bool $count_total If true, an additional DB query is run to count the total activity items
|
375 |
* for the query. Default: false.
|
376 |
+
* @type bool $count_total_only If true, only the DB query to count the total activity items is run.
|
377 |
+
* Default: false.
|
378 |
* }
|
379 |
* @return array The array returned has two keys:
|
380 |
* - 'total' is the count of located activities
|
386 |
$function_args = func_get_args();
|
387 |
|
388 |
// Backward compatibility with old method of passing arguments.
|
389 |
+
if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
|
390 |
_deprecated_argument(
|
391 |
__METHOD__,
|
392 |
'1.6',
|
393 |
sprintf(
|
394 |
/* translators: 1: the name of the method. 2: the name of the file. */
|
395 |
+
esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ),
|
396 |
__METHOD__,
|
397 |
__FILE__
|
398 |
)
|
416 |
}
|
417 |
|
418 |
$bp = buddypress();
|
419 |
+
$r = bp_parse_args(
|
420 |
+
$args,
|
421 |
+
array(
|
422 |
+
'page' => 1, // The current page.
|
423 |
+
'per_page' => 25, // Activity items per page.
|
424 |
+
'max' => false, // Max number of items to return.
|
425 |
+
'fields' => 'all', // Fields to include.
|
426 |
+
'sort' => 'DESC', // ASC or DESC.
|
427 |
+
'order_by' => 'date_recorded', // Column to order by.
|
428 |
+
'exclude' => false, // Array of ids to exclude.
|
429 |
+
'in' => false, // Array of ids to limit query by (IN).
|
430 |
+
'meta_query' => false, // Filter by activitymeta.
|
431 |
+
'date_query' => false, // Filter by date.
|
432 |
+
'filter_query' => false, // Advanced filtering - see BP_Activity_Query.
|
433 |
+
'filter' => false, // See self::get_filter_sql().
|
434 |
+
'scope' => false, // Preset activity arguments.
|
435 |
+
'search_terms' => false, // Terms to search by.
|
436 |
+
'display_comments' => false, // Whether to include activity comments.
|
437 |
+
'show_hidden' => false, // Show items marked hide_sitewide.
|
438 |
+
'spam' => 'ham_only', // Spam status.
|
439 |
+
'update_meta_cache' => true, // Whether or not to update meta cache.
|
440 |
+
'count_total' => false, // Whether or not to use count_total.
|
441 |
+
'count_total_only' => false, // Whether to only get the total count.
|
442 |
+
)
|
443 |
+
);
|
444 |
|
445 |
// Select conditions.
|
446 |
$select_sql = "SELECT DISTINCT a.id";
|
511 |
}
|
512 |
}
|
513 |
|
514 |
+
// Sanitize 'order'.
|
515 |
$sort = $r['sort'];
|
516 |
+
if ( 'DESC' !== $sort ) {
|
517 |
+
$sort = bp_esc_sql_order( $sort );
|
518 |
}
|
519 |
|
520 |
switch( $r['order_by'] ) {
|
633 |
'has_more_items' => null,
|
634 |
);
|
635 |
|
636 |
+
// Init the activity list.
|
637 |
+
$activities = array();
|
638 |
+
$only_get_count = (bool) $r['count_total_only'];
|
639 |
+
|
640 |
/**
|
641 |
* Filters if BuddyPress should use legacy query structure over current structure for version 2.0+.
|
642 |
*
|
648 |
* @param BP_Activity_Activity $value Current method being called.
|
649 |
* @param array $r Parsed arguments passed into method.
|
650 |
*/
|
651 |
+
if ( ! $only_get_count && apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $r ) ) {
|
652 |
|
653 |
// Legacy queries joined against the user table.
|
654 |
$select_sql = "SELECT DISTINCT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
|
700 |
$activities[ $i ]->is_spam = (int) $ac->is_spam;
|
701 |
}
|
702 |
|
703 |
+
} elseif ( ! $only_get_count ) {
|
704 |
// Query first for activity IDs.
|
705 |
$activity_ids_sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY {$order_by} {$sort}, a.id {$sort}";
|
706 |
|
753 |
}
|
754 |
}
|
755 |
|
756 |
+
if ( $activities && 'ids' !== $r['fields'] ) {
|
757 |
// Get the fullnames of users so we don't have to query in the loop.
|
758 |
$activities = self::append_user_fullnames( $activities );
|
759 |
|
780 |
|
781 |
$retval['activities'] = $activities;
|
782 |
|
783 |
+
// Only query the count total if requested.
|
784 |
+
if ( ! empty( $r['count_total'] ) || $only_get_count ) {
|
|
|
785 |
/**
|
786 |
* Filters the total activities MySQL statement.
|
787 |
*
|
792 |
* @param string $sort Sort direction for query.
|
793 |
*/
|
794 |
$total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
|
795 |
+
|
796 |
+
/*
|
797 |
+
* Queries that include 'last_activity' are cached separately,
|
798 |
+
* since they are generally much less long-lived.
|
799 |
+
*/
|
800 |
+
if ( preg_match( '/a\.type NOT IN \([^\)]*\'last_activity\'[^\)]*\)/', $total_activities_sql ) ) {
|
801 |
+
$cache_group = 'bp_activity';
|
802 |
+
} else {
|
803 |
+
$cache_group = 'bp_activity_with_last_activity';
|
804 |
+
}
|
805 |
+
|
806 |
$cached = bp_core_get_incremented_cache( $total_activities_sql, $cache_group );
|
807 |
if ( false === $cached ) {
|
808 |
$total_activities = $wpdb->get_var( $total_activities_sql );
|
811 |
$total_activities = $cached;
|
812 |
}
|
813 |
|
814 |
+
// If $max is set, only return up to the max results.
|
815 |
+
if ( ! empty( $r['max'] ) ) {
|
816 |
if ( (int) $total_activities > (int) $r['max'] ) {
|
817 |
$total_activities = $r['max'];
|
818 |
}
|
1032 |
*
|
1033 |
* We use BP_Date_Query, which extends WP_Date_Query, to do the heavy lifting
|
1034 |
* of parsing the date_query array and creating the necessary SQL clauses.
|
|
|
|
|
|
|
1035 |
*
|
1036 |
* @since 2.1.0
|
1037 |
*
|
1040 |
* @return string
|
1041 |
*/
|
1042 |
public static function get_date_query_sql( $date_query = array() ) {
|
1043 |
+
return BP_Date_Query::get_where_sql( $date_query, 'a.date_recorded' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1044 |
}
|
1045 |
|
1046 |
/**
|
1166 |
* @return array
|
1167 |
*/
|
1168 |
public static function get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) {
|
1169 |
+
_deprecated_function(
|
1170 |
+
__FUNCTION__,
|
1171 |
+
'1.5',
|
1172 |
+
'Use BP_Activity_Activity::get() with the "in" parameter instead.'
|
1173 |
+
);
|
1174 |
+
|
1175 |
return BP_Activity_Activity::get( $max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids );
|
1176 |
}
|
1177 |
|
1179 |
* Get the first activity ID that matches a set of criteria.
|
1180 |
*
|
1181 |
* @since 1.2.0
|
1182 |
+
* @since 10.0.0 Parameters were made optional.
|
1183 |
*
|
1184 |
+
* @param array $args {
|
1185 |
+
* An array of arguments. All items are optional.
|
1186 |
+
* @type int $user_id User ID to filter by.
|
1187 |
+
* @type string $component Component to filter by.
|
1188 |
+
* @type string $type Activity type to filter by.
|
1189 |
+
* @type int $item_id Associated item to filter by.
|
1190 |
+
* @type int $secondary_item_id Secondary associated item to filter by.
|
1191 |
+
* @type string $action Action to filter by.
|
1192 |
+
* @type string $content Content to filter by.
|
1193 |
+
* @type string $date_recorded Date to filter by.
|
1194 |
+
* }
|
1195 |
* @return int|false Activity ID on success, false if none is found.
|
1196 |
*/
|
1197 |
+
public static function get_id( $args = array() ) {
|
1198 |
global $wpdb;
|
1199 |
|
1200 |
+
$function_args = func_get_args();
|
1201 |
+
|
1202 |
+
// Backward compatibility with old method of passing arguments.
|
1203 |
+
if ( ! is_array( $args ) || count( $function_args ) > 1 ) {
|
1204 |
+
_deprecated_argument(
|
1205 |
+
__METHOD__,
|
1206 |
+
'10.0.0',
|
1207 |
+
sprintf(
|
1208 |
+
/* translators: 1: the name of the method. 2: the name of the file. */
|
1209 |
+
esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ),
|
1210 |
+
__METHOD__,
|
1211 |
+
__FILE__
|
1212 |
+
)
|
1213 |
+
);
|
1214 |
+
|
1215 |
+
$old_args_keys = array(
|
1216 |
+
0 => 'user_id',
|
1217 |
+
1 => 'component',
|
1218 |
+
2 => 'type',
|
1219 |
+
3 => 'item_id',
|
1220 |
+
4 => 'secondary_item_id',
|
1221 |
+
5 => 'action',
|
1222 |
+
6 => 'content',
|
1223 |
+
7 => 'date_recorded',
|
1224 |
+
);
|
1225 |
+
|
1226 |
+
$args = bp_core_parse_args_array( $old_args_keys, $function_args );
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
$r = bp_parse_args(
|
1230 |
+
$args,
|
1231 |
+
array(
|
1232 |
+
'user_id' => false,
|
1233 |
+
'component' => false,
|
1234 |
+
'type' => false,
|
1235 |
+
'item_id' => false,
|
1236 |
+
'secondary_item_id' => false,
|
1237 |
+
'action' => false,
|
1238 |
+
'content' => false,
|
1239 |
+
'date_recorded' => false,
|
1240 |
+
)
|
1241 |
+
);
|
1242 |
|
1243 |
$where_args = false;
|
1244 |
|
1245 |
+
if ( ! empty( $r['user_id'] ) ) {
|
1246 |
+
$where_args[] = $wpdb->prepare( 'user_id = %d', $r['user_id'] );
|
1247 |
}
|
1248 |
|
1249 |
+
if ( ! empty( $r['component'] ) ) {
|
1250 |
+
$where_args[] = $wpdb->prepare( 'component = %s', $r['component'] );
|
1251 |
}
|
1252 |
|
1253 |
+
if ( ! empty( $r['type'] ) ) {
|
1254 |
+
$where_args[] = $wpdb->prepare( 'type = %s', $r['type'] );
|
1255 |
}
|
1256 |
|
1257 |
+
if ( ! empty( $r['item_id'] ) ) {
|
1258 |
+
$where_args[] = $wpdb->prepare( 'item_id = %d', $r['item_id'] );
|
1259 |
}
|
1260 |
|
1261 |
+
if ( ! empty( $r['secondary_item_id'] ) ) {
|
1262 |
+
$where_args[] = $wpdb->prepare( 'secondary_item_id = %d', $r['secondary_item_id'] );
|
1263 |
}
|
1264 |
|
1265 |
+
if ( ! empty( $r['action'] ) ) {
|
1266 |
+
$where_args[] = $wpdb->prepare( 'action = %s', $r['action'] );
|
1267 |
}
|
1268 |
|
1269 |
+
if ( ! empty( $r['content'] ) ) {
|
1270 |
+
$where_args[] = $wpdb->prepare( 'content = %s', $r['content'] );
|
1271 |
}
|
1272 |
|
1273 |
+
if ( ! empty( $r['date_recorded'] ) ) {
|
1274 |
+
$where_args[] = $wpdb->prepare( 'date_recorded = %s', $r['date_recorded'] );
|
1275 |
}
|
1276 |
|
1277 |
if ( ! empty( $where_args ) ) {
|
1278 |
+
$bp = buddypress();
|
1279 |
$where_sql = 'WHERE ' . join( ' AND ', $where_args );
|
1280 |
+
$result = $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" );
|
1281 |
|
1282 |
return is_numeric( $result ) ? (int) $result : false;
|
1283 |
}
|
1312 |
global $wpdb;
|
1313 |
|
1314 |
$bp = buddypress();
|
1315 |
+
$r = bp_parse_args(
|
1316 |
+
$args,
|
1317 |
+
array(
|
1318 |
+
'id' => false,
|
1319 |
+
'action' => false,
|
1320 |
+
'content' => false,
|
1321 |
+
'component' => false,
|
1322 |
+
'type' => false,
|
1323 |
+
'primary_link' => false,
|
1324 |
+
'user_id' => false,
|
1325 |
+
'item_id' => false,
|
1326 |
+
'secondary_item_id' => false,
|
1327 |
+
'date_recorded' => false,
|
1328 |
+
'hide_sitewide' => false,
|
1329 |
+
)
|
1330 |
+
);
|
1331 |
|
1332 |
// Setup empty array from where query arguments.
|
1333 |
$where_args = array();
|
@@ -367,7 +367,7 @@ class BP_Activity_Component extends BP_Component {
|
|
367 |
'parent' => 'my-account-' . $this->id,
|
368 |
'id' => 'my-account-' . $this->id . '-personal',
|
369 |
'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ),
|
370 |
-
'href' => $activity_link,
|
371 |
'position' => 10
|
372 |
);
|
373 |
|
@@ -499,8 +499,8 @@ class BP_Activity_Component extends BP_Component {
|
|
499 |
'wp-components',
|
500 |
'wp-i18n',
|
501 |
'wp-block-editor',
|
|
|
502 |
'bp-block-data',
|
503 |
-
'bp-block-components',
|
504 |
),
|
505 |
'style' => 'bp-latest-activities-block',
|
506 |
'style_url' => plugins_url( 'css/blocks/latest-activities.css', dirname( __FILE__ ) ),
|
@@ -546,4 +546,23 @@ class BP_Activity_Component extends BP_Component {
|
|
546 |
|
547 |
parent::blocks_init( $blocks );
|
548 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
}
|
367 |
'parent' => 'my-account-' . $this->id,
|
368 |
'id' => 'my-account-' . $this->id . '-personal',
|
369 |
'title' => _x( 'Personal', 'My Account Activity sub nav', 'buddypress' ),
|
370 |
+
'href' => trailingslashit( $activity_link . 'just-me' ),
|
371 |
'position' => 10
|
372 |
);
|
373 |
|
499 |
'wp-components',
|
500 |
'wp-i18n',
|
501 |
'wp-block-editor',
|
502 |
+
'wp-server-side-render',
|
503 |
'bp-block-data',
|
|
|
504 |
),
|
505 |
'style' => 'bp-latest-activities-block',
|
506 |
'style_url' => plugins_url( 'css/blocks/latest-activities.css', dirname( __FILE__ ) ),
|
546 |
|
547 |
parent::blocks_init( $blocks );
|
548 |
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Add the Activity directory state.
|
552 |
+
*
|
553 |
+
* @since 10.0.0
|
554 |
+
*
|
555 |
+
* @param array $states Optional. See BP_Component::admin_directory_states() for description.
|
556 |
+
* @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description.
|
557 |
+
* @return array See BP_Component::admin_directory_states() for description.
|
558 |
+
*/
|
559 |
+
public function admin_directory_states( $states = array(), $post = null ) {
|
560 |
+
$bp = buddypress();
|
561 |
+
|
562 |
+
if ( isset( $bp->pages->activity->id ) && (int) $bp->pages->activity->id === (int) $post->ID ) {
|
563 |
+
$states['page_for_activity_directory'] = _x( 'BP Activity Page', 'page label', 'buddypress' );
|
564 |
+
}
|
565 |
+
|
566 |
+
return parent::admin_directory_states( $states, $post );
|
567 |
+
}
|
568 |
}
|
@@ -104,43 +104,46 @@ class BP_Activity_Feed {
|
|
104 |
);
|
105 |
} else {
|
106 |
// Setup data.
|
107 |
-
$this->data =
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
144 |
|
145 |
/**
|
146 |
* Fires before the feed is setup so plugins can modify.
|
@@ -195,12 +198,14 @@ class BP_Activity_Feed {
|
|
195 |
$this->ttl = (int) $this->ttl;
|
196 |
$this->update_period = strip_tags( $this->update_period );
|
197 |
$this->update_frequency = (int) $this->update_frequency;
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
|
|
204 |
|
205 |
}
|
206 |
|
104 |
);
|
105 |
} else {
|
106 |
// Setup data.
|
107 |
+
$this->data = bp_parse_args(
|
108 |
+
$args,
|
109 |
+
array(
|
110 |
+
// Internal identifier for the RSS feed - should be alphanumeric only.
|
111 |
+
'id' => '',
|
112 |
+
|
113 |
+
// RSS title - should be plain-text.
|
114 |
+
'title' => '',
|
115 |
+
|
116 |
+
// Relevant link for the RSS feed.
|
117 |
+
'link' => '',
|
118 |
+
|
119 |
+
// RSS description - should be plain-text.
|
120 |
+
'description' => '',
|
121 |
+
|
122 |
+
// Time-to-live - number of minutes to cache the data before an aggregator
|
123 |
+
// requests it again. This is only acknowledged if the RSS client supports it
|
124 |
+
//
|
125 |
+
// See: http://www.rssboard.org/rss-profile#element-channel-ttl.
|
126 |
+
// See: http://www.kbcafe.com/rss/rssfeedstate.html#ttl.
|
127 |
+
'ttl' => '30',
|
128 |
+
|
129 |
+
// Syndication module - similar to ttl, but not really supported by RSS
|
130 |
+
// clients
|
131 |
+
//
|
132 |
+
// See: http://web.resource.org/rss/1.0/modules/syndication/#description.
|
133 |
+
// See: http://www.kbcafe.com/rss/rssfeedstate.html#syndicationmodule.
|
134 |
+
'update_period' => 'hourly',
|
135 |
+
'update_frequency' => 2,
|
136 |
+
|
137 |
+
// Number of items to display.
|
138 |
+
'max' => 50,
|
139 |
+
|
140 |
+
// Activity arguments passed to bp_has_activities().
|
141 |
+
'activity_args' => array(),
|
142 |
+
|
143 |
+
// The activity feed is enabled.
|
144 |
+
'enabled' => false,
|
145 |
+
)
|
146 |
+
);
|
147 |
|
148 |
/**
|
149 |
* Fires before the feed is setup so plugins can modify.
|
198 |
$this->ttl = (int) $this->ttl;
|
199 |
$this->update_period = strip_tags( $this->update_period );
|
200 |
$this->update_frequency = (int) $this->update_frequency;
|
201 |
+
$this->activity_args = bp_parse_args(
|
202 |
+
$this->activity_args,
|
203 |
+
array(
|
204 |
+
'max' => $this->max,
|
205 |
+
'per_page' => $this->max,
|
206 |
+
'display_comments' => 'stream',
|
207 |
+
)
|
208 |
+
);
|
209 |
|
210 |
}
|
211 |
|
@@ -156,7 +156,7 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
156 |
'display_comments' => 'stream',
|
157 |
'show_hidden' => true,
|
158 |
'spam' => 'spam_only',
|
159 |
-
'
|
160 |
) );
|
161 |
$this->spam_count = $spams['total'];
|
162 |
unset( $spams );
|
@@ -214,9 +214,9 @@ class BP_Activity_List_Table extends WP_List_Table {
|
|
214 |
} elseif ( 'single' !== $this->view ) {
|
215 |
$count_activities = bp_activity_get(
|
216 |
array(
|
217 |
-
'fields'
|
218 |
-
'show_hidden'
|
219 |
-
'
|
220 |
)
|
221 |
);
|
222 |
|
156 |
'display_comments' => 'stream',
|
157 |
'show_hidden' => true,
|
158 |
'spam' => 'spam_only',
|
159 |
+
'count_total_only' => true,
|
160 |
) );
|
161 |
$this->spam_count = $spams['total'];
|
162 |
unset( $spams );
|
214 |
} elseif ( 'single' !== $this->view ) {
|
215 |
$count_activities = bp_activity_get(
|
216 |
array(
|
217 |
+
'fields' => 'ids',
|
218 |
+
'show_hidden' => true,
|
219 |
+
'count_total_only' => true,
|
220 |
)
|
221 |
);
|
222 |
|
@@ -186,7 +186,12 @@ class BP_Activity_Template {
|
|
186 |
'spam' => 'ham_only',
|
187 |
'update_meta_cache' => true,
|
188 |
);
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
190 |
extract( $r );
|
191 |
|
192 |
$this->pag_arg = sanitize_key( $r['page_arg'] );
|
186 |
'spam' => 'ham_only',
|
187 |
'update_meta_cache' => true,
|
188 |
);
|
189 |
+
|
190 |
+
$r = bp_parse_args(
|
191 |
+
$args,
|
192 |
+
$defaults
|
193 |
+
);
|
194 |
+
|
195 |
extract( $r );
|
196 |
|
197 |
$this->pag_arg = sanitize_key( $r['page_arg'] );
|
@@ -905,7 +905,8 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
905 |
'raw' => $activity->content,
|
906 |
'rendered' => $this->render_item( $activity ),
|
907 |
),
|
908 |
-
'date' => bp_rest_prepare_date_response( $activity->date_recorded ),
|
|
|
909 |
'id' => $activity->id,
|
910 |
'link' => bp_activity_get_permalink( $activity->id ),
|
911 |
'primary_item_id' => $activity->item_id,
|
@@ -1039,13 +1040,12 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
1039 |
if ( ! empty( $schema['properties']['primary_item_id'] ) && ! empty( $request->get_param( 'primary_item_id' ) ) ) {
|
1040 |
$item_id = (int) $request->get_param( 'primary_item_id' );
|
1041 |
|
1042 |
-
//
|
|
|
|
|
|
|
1043 |
if ( bp_is_active( 'groups' ) && isset( $prepared_activity->component ) && buddypress()->groups->id === $prepared_activity->component ) {
|
1044 |
$prepared_activity->group_id = $item_id;
|
1045 |
-
|
1046 |
-
// Use a generic item ID for other components.
|
1047 |
-
} else {
|
1048 |
-
$prepared_activity->item_id = $item_id;
|
1049 |
}
|
1050 |
}
|
1051 |
|
@@ -1370,8 +1370,16 @@ class BP_REST_Activity_Endpoint extends WP_REST_Controller {
|
|
1370 |
),
|
1371 |
'date' => array(
|
1372 |
'context' => array( 'view', 'edit', 'embed' ),
|
1373 |
-
'description' => __(
|
1374 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1375 |
'format' => 'date-time',
|
1376 |
),
|
1377 |
'status' => array(
|
905 |
'raw' => $activity->content,
|
906 |
'rendered' => $this->render_item( $activity ),
|
907 |
),
|
908 |
+
'date' => bp_rest_prepare_date_response( $activity->date_recorded, get_date_from_gmt( $activity->date_recorded ) ),
|
909 |
+
'date_gmt' => bp_rest_prepare_date_response( $activity->date_recorded ),
|
910 |
'id' => $activity->id,
|
911 |
'link' => bp_activity_get_permalink( $activity->id ),
|
912 |
'primary_item_id' => $activity->item_id,
|
1040 |
if ( ! empty( $schema['properties']['primary_item_id'] ) && ! empty( $request->get_param( 'primary_item_id' ) ) ) {
|
1041 |
$item_id = (int) $request->get_param( 'primary_item_id' );
|
1042 |
|
1043 |
+
// Use a generic item ID.
|
1044 |
+
$prepared_activity->item_id = $item_id;
|
1045 |
+
|
1046 |
+
// Set the group ID, used in the `groups_post_update` helper function only.
|
1047 |
if ( bp_is_active( 'groups' ) && isset( $prepared_activity->component ) && buddypress()->groups->id === $prepared_activity->component ) {
|
1048 |
$prepared_activity->group_id = $item_id;
|
|
|
|
|
|
|
|
|
1049 |
}
|
1050 |
}
|
1051 |
|
1370 |
),
|
1371 |
'date' => array(
|
1372 |
'context' => array( 'view', 'edit', 'embed' ),
|
1373 |
+
'description' => __( 'The date the activity was published, in the site\'s timezone.', 'buddypress' ),
|
1374 |
+
'readonly' => true,
|
1375 |
+
'type' => array( 'string', 'null' ),
|
1376 |
+
'format' => 'date-time',
|
1377 |
+
),
|
1378 |
+
'date_gmt' => array(
|
1379 |
+
'context' => array( 'view', 'edit' ),
|
1380 |
+
'description' => __( 'The date the activity was published, as GMT.', 'buddypress' ),
|
1381 |
+
'readonly' => true,
|
1382 |
+
'type' => array( 'string', 'null' ),
|
1383 |
'format' => 'date-time',
|
1384 |
),
|
1385 |
'status' => array(
|
@@ -1,20 +1,8 @@
|
|
1 |
-
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"
|
2 |
-
|
3 |
-
},{}],"
|
4 |
-
|
5 |
-
},{}],"jEQo":[function(require,module,exports) {
|
6 |
-
function e(e,o){(null==o||o>e.length)&&(o=e.length);for(var l=0,r=new Array(o);l<o;l++)r[l]=e[l];return r}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
7 |
-
},{}],"Dbv9":[function(require,module,exports) {
|
8 |
-
var r=require("./arrayLikeToArray.js");function e(e,t){if(e){if("string"==typeof e)return r(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(e,t):void 0}}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
9 |
-
},{"./arrayLikeToArray.js":"jEQo"}],"MWEO":[function(require,module,exports) {
|
10 |
-
function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
11 |
-
},{}],"DERy":[function(require,module,exports) {
|
12 |
-
var e=require("./arrayWithHoles.js"),r=require("./iterableToArrayLimit.js"),o=require("./unsupportedIterableToArray.js"),t=require("./nonIterableRest.js");function u(u,s){return e(u)||r(u,s)||o(u,s)||t()}module.exports=u,module.exports.__esModule=!0,module.exports.default=module.exports;
|
13 |
-
},{"./arrayWithHoles.js":"DCTP","./iterableToArrayLimit.js":"LoeL","./unsupportedIterableToArray.js":"Dbv9","./nonIterableRest.js":"MWEO"}],"Sjre":[function(require,module,exports) {
|
14 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("@babel/runtime/helpers/slicedToArray"));function t(e){return e&&e.__esModule?e:{default:e}}var r=wp,i=r.element,l=i.createElement,o=i.Fragment,a=i.useState,n=r.i18n.__,s=r.components,d=s.Placeholder,u=s.Disabled,c=s.SandBox,p=s.Button,b=s.ExternalLink,m=s.Spinner,y=s.ToolbarGroup,v=s.ToolbarButton,h=r.compose.compose,f=r.data.withSelect,_=r.blockEditor,g=_.RichText,w=_.BlockControls,k=bp,E=k.blockData.embedScriptURL,x=function(t){var r=t.attributes,i=t.setAttributes,s=t.isSelected,h=t.preview,f=t.fetching,_=r.url,k=r.caption,x=n("BuddyPress Activity URL","buddypress"),P=a(_),L=(0,e.default)(P,2),N=L[0],R=L[1],S=a(!_),B=(0,e.default)(S,2),T=B[0],U=B[1],A=l(w,null,l(y,null,l(v,{icon:"edit",title:n("Edit URL","buddypress"),onClick:function(e){e&&e.preventDefault(),U(!0)}})));return T?l(d,{icon:"buddicons-activity",label:x,className:"wp-block-embed",instructions:n("Paste the link to the activity content you want to display on your site.","buddypress")},l("form",{onSubmit:function(e){e&&e.preventDefault(),U(!1),i({url:N})}},l("input",{type:"url",value:N||"",className:"components-placeholder__input","aria-label":x,placeholder:n("Enter URL to embed here…","buddypress"),onChange:function(e){return R(e.target.value)}}),l(p,{isPrimary:!0,type:"submit"},n("Embed","buddypress"))),l("div",{className:"components-placeholder__learn-more"},l(b,{href:n("https://codex.buddypress.org/activity-embeds/")},n("Learn more about activity embeds","buddypress")))):f?l("div",{className:"wp-block-embed is-loading"},l(m,null),l("p",null,n("Embedding…","buddypress"))):h&&h.x_buddypress&&"activity"===h.x_buddypress?l(o,null,!T&&A,l("figure",{className:"wp-block-embed is-type-bp-activity"},l("div",{className:"wp-block-embed__wrapper"},l(u,null,l(c,{html:h&&h.html?h.html:"",scripts:[E]}))),(!g.isEmpty(k)||s)&&l(g,{tagName:"figcaption",placeholder:n("Write caption…","buddypress"),value:k,onChange:function(e){return i({caption:e})},inlineToolbar:!0}))):l(o,null,A,l(d,{icon:"buddicons-activity",label:x},l("p",{className:"components-placeholder__error"},n("The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.","buddypress"))))},P=h([f(function(e,t){var r=t.attributes.url,i=e("core"),l=i.getEmbedPreview,o=i.isRequestingEmbedPreview;return{preview:!!r&&l(r),fetching:!!r&&o(r)}})])(x),L=P;exports.default=L;
|
15 |
-
},{"@babel/runtime/helpers/slicedToArray":"DERy"}],"zmBI":[function(require,module,exports) {
|
16 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=wp,t=e.blockEditor.RichText,a=e.element.createElement,r=function(e){var r=e.attributes,i=r.url,c=r.caption;return i?a("figure",{className:"wp-block-embed is-type-bp-activity"},a("div",{className:"wp-block-embed__wrapper"},"\n".concat(i,"\n")),!t.isEmpty(c)&&a(t.Content,{tagName:"figcaption",value:c})):null},i=r;exports.default=i;
|
17 |
},{}],"hBDw":[function(require,module,exports) {
|
18 |
-
"use strict";var t=i(require("./embed-activity/edit")),e=i(require("./embed-activity/save"));function i(t){return t&&t.__esModule?t:{default:t}}
|
19 |
},{"./embed-activity/edit":"Sjre","./embed-activity/save":"zmBI"}]},{},["hBDw"], null)
|
20 |
//# sourceMappingURL=/bp-activity/js/blocks/embed-activity.js.map
|
1 |
+
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Sjre":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{element:{createElement:e,Fragment:t,useState:s},i18n:{__:i},components:{Placeholder:l,Disabled:o,SandBox:r,Button:a,ExternalLink:n,Spinner:d,ToolbarGroup:c,ToolbarButton:p},compose:{compose:u},data:{withSelect:b},blockEditor:{RichText:m,BlockControls:y}}=wp,{blockData:{embedScriptURL:v}}=bp,h=({attributes:u,setAttributes:b,isSelected:h,preview:g,fetching:_})=>{const{url:w,caption:f}=u,k=i("BuddyPress Activity URL","buddypress"),[E,x]=s(w),[P,L]=s(!w),N=e=>{e&&e.preventDefault(),L(!1),b({url:E})},R=e(y,null,e(c,null,e(p,{icon:"edit",title:i("Edit URL","buddypress"),onClick:e=>{e&&e.preventDefault(),L(!0)}})));return P?e(l,{icon:"buddicons-activity",label:k,className:"wp-block-embed",instructions:i("Paste the link to the activity content you want to display on your site.","buddypress")},e("form",{onSubmit:N},e("input",{type:"url",value:E||"",className:"components-placeholder__input","aria-label":k,placeholder:i("Enter URL to embed here…","buddypress"),onChange:e=>x(e.target.value)}),e(a,{isPrimary:!0,type:"submit"},i("Embed","buddypress"))),e("div",{className:"components-placeholder__learn-more"},e(n,{href:i("https://codex.buddypress.org/activity-embeds/")},i("Learn more about activity embeds","buddypress")))):_?e("div",{className:"wp-block-embed is-loading"},e(d,null),e("p",null,i("Embedding…","buddypress"))):g&&g.x_buddypress&&"activity"===g.x_buddypress?e(t,null,!P&&R,e("figure",{className:"wp-block-embed is-type-bp-activity"},e("div",{className:"wp-block-embed__wrapper"},e(o,null,e(r,{html:g&&g.html?g.html:"",scripts:[v]}))),(!m.isEmpty(f)||h)&&e(m,{tagName:"figcaption",placeholder:i("Write caption…","buddypress"),value:f,onChange:e=>b({caption:e}),inlineToolbar:!0}))):e(t,null,R,e(l,{icon:"buddicons-activity",label:k},e("p",{className:"components-placeholder__error"},i("The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.","buddypress"))))},g=u([b((e,t)=>{const{url:s}=t.attributes,{getEmbedPreview:i,isRequestingEmbedPreview:l}=e("core");return{preview:!!s&&i(s),fetching:!!s&&l(s)}})])(h);var _=g;exports.default=_;
|
3 |
+
},{}],"zmBI":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blockEditor:{RichText:e},element:{createElement:t}}=wp,a=({attributes:a})=>{const{url:r,caption:i}=a;return r?t("figure",{className:"wp-block-embed is-type-bp-activity"},t("div",{className:"wp-block-embed__wrapper"},`\n${r}\n`),!e.isEmpty(i)&&t(e.Content,{tagName:"figcaption",value:i})):null};var r=a;exports.default=r;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
},{}],"hBDw":[function(require,module,exports) {
|
6 |
+
"use strict";var t=i(require("./embed-activity/edit")),e=i(require("./embed-activity/save"));function i(t){return t&&t.__esModule?t:{default:t}}const{i18n:{__:r},blocks:{registerBlockType:s}}=wp;s("bp/embed-activity",{title:r("Embed an activity","buddypress"),description:r("Add a block that displays the activity content pulled from this or other community sites.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-activity"},category:"buddypress",attributes:{url:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption"}},supports:{align:!0},edit:t.default,save:e.default});
|
7 |
},{"./embed-activity/edit":"Sjre","./embed-activity/save":"zmBI"}]},{},["hBDw"], null)
|
8 |
//# sourceMappingURL=/bp-activity/js/blocks/embed-activity.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","bp-activity/js/blocks/embed-activity/edit.js","bp-activity/js/blocks/embed-activity/save.js","bp-activity/js/blocks/embed-activity.js"],"names":["_arrayWithHoles","arr","Array","isArray","module","exports","__esModule","_iterableToArrayLimit","i","_i","Symbol","iterator","_arr","_s","_e","_n","_d","call","next","done","push","value","length","err","_arrayLikeToArray","len","arr2","arrayLikeToArray","require","_unsupportedIterableToArray","o","minLen","n","Object","prototype","toString","slice","constructor","name","from","test","_nonIterableRest","TypeError","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","_slicedToArray","editEmbedActivityBlock","wp","element","createElement","Fragment","useState","__","i18n","components","Placeholder","Disabled","SandBox","Button","ExternalLink","Spinner","ToolbarGroup","ToolbarButton","compose","withSelect","data","blockEditor","RichText","BlockControls","bp","embedScriptURL","blockData","EditEmbedActivity","attributes","setAttributes","isSelected","preview","fetching","url","caption","label","setURL","isEditingURL","setIsEditingURL","editToolbar","event","preventDefault","target","html","isEmpty","select","ownProps","getEmbedPreview","isRequestingEmbedPreview","saveEmbedActivityBlock","registerBlockType","blocks","title","description","icon","background","foreground","src","category","type","source","selector","supports","align","edit","save"],"mappings":"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","file":"embed-activity.js","sourceRoot":"../src/js","sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayWithHoles = require(\"./arrayWithHoles.js\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableRest = require(\"./nonIterableRest.js\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tSandBox,\n\t\tButton,\n\t\tExternalLink,\n\t\tSpinner,\n\t\tToolbarGroup,\n\t\tToolbarButton,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\tblockEditor: {\n\t\tRichText,\n\t\tBlockControls,\n\t}\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\n const {\n\tblockData: {\n\t\tembedScriptURL,\n\t}\n} = bp;\n\nconst EditEmbedActivity = ( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tpreview,\n\tfetching\n} ) => {\n\tconst { url, caption } = attributes;\n\tconst label = __( 'BuddyPress Activity URL', 'buddypress' );\n\tconst [ value, setURL ] = useState( url );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( ! url );\n\n\tconst onSubmit = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: value } );\n\t};\n\n\tconst switchBackToURLInput = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( true );\n\t};\n\n\tconst editToolbar = (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\ttitle={ __( 'Edit URL', 'buddypress' ) }\n\t\t\t\t\tonClick={ switchBackToURLInput }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tif ( isEditingURL ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\tlabel={ label }\n\t\t\t\tclassName=\"wp-block-embed\"\n\t\t\t\tinstructions={ __( 'Paste the link to the activity content you want to display on your site.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( event ) => setURL( event.target.value ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button isPrimary type=\"submit\">\n\t\t\t\t\t\t{ __( 'Embed', 'buddypress' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t\t<div className=\"components-placeholder__learn-more\">\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://codex.buddypress.org/activity-embeds/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Learn more about activity embeds', 'buddypress' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</div>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<div className=\"wp-block-embed is-loading\">\n\t\t\t\t<Spinner />\n\t\t\t\t<p>{ __( 'Embedding…', 'buddypress' ) }</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! preview || ! preview['x_buddypress'] || 'activity' !== preview['x_buddypress'] ) {\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ editToolbar }\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\t\tlabel={ label }\n\t\t\t\t>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t{ __( 'The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.', 'buddypress' ) }\n\t\t\t\t\t</p>\n\t\t\t\t</Placeholder>\n\t\t\t</Fragment>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t{ ! isEditingURL && editToolbar }\n\t\t\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<Disabled>\n\t\t\t\t\t\t<SandBox\n\t\t\t\t\t\t\thtml={ preview && preview.html ? preview.html : '' }\n\t\t\t\t\t\t\tscripts={ [ embedScriptURL ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Disabled>\n\t\t\t\t</div>\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\tplaceholder={ __( 'Write caption…', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t</Fragment>\n\t);\n}\n\nconst editEmbedActivityBlock = compose( [\n\twithSelect( ( select, ownProps ) => {\n\t\tconst { url } = ownProps.attributes;\n\t\tconst {\n\t\t\tgetEmbedPreview,\n\t\t\tisRequestingEmbedPreview,\n\t\t} = select( 'core' );\n\n\t\tconst preview = !! url && getEmbedPreview( url );\n\t\tconst fetching = !! url && isRequestingEmbedPreview( url );\n\n\t\treturn {\n\t\t\tpreview: preview,\n\t\t\tfetching: fetching,\n\t\t};\n\t} ),\n] )( EditEmbedActivity );\n\nexport default editEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tRichText,\n\t},\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\nconst saveEmbedActivityBlock = ( { attributes } ) => {\n\tconst { url, caption } = attributes;\n\n\tif ( ! url ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t{\n\t\t\t`\\n${ url }\\n` /* URL needs to be on its own line. */\n\t\t}\n\t\t</div>\n\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"figcaption\"\n\t\t\t\tvalue={ caption }\n\t\t\t/>\n\t\t) }\n\t</figure>\n\t);\n};\n\nexport default saveEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editEmbedActivityBlock from './embed-activity/edit';\nimport saveEmbedActivityBlock from './embed-activity/save';\n\nregisterBlockType( 'bp/embed-activity', {\n\ttitle: __( 'Embed an activity', 'buddypress' ),\n\tdescription: __( 'Add a block that displays the activity content pulled from this or other community sites.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-activity',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\turl: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcaption: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'figcaption',\n\t\t},\n\t},\n\tsupports: {\n\t\talign: true,\n\t},\n\tedit: editEmbedActivityBlock,\n\tsave: saveEmbedActivityBlock,\n} );\n"]}
|
1 |
+
{"version":3,"sources":["bp-activity/js/blocks/embed-activity/edit.js","bp-activity/js/blocks/embed-activity/save.js","bp-activity/js/blocks/embed-activity.js"],"names":["editEmbedActivityBlock","element","createElement","Fragment","useState","i18n","__","components","Placeholder","Disabled","SandBox","Button","ExternalLink","Spinner","ToolbarGroup","ToolbarButton","compose","data","withSelect","blockEditor","RichText","BlockControls","wp","blockData","embedScriptURL","bp","EditEmbedActivity","attributes","setAttributes","isSelected","preview","fetching","url","caption","label","value","setURL","isEditingURL","setIsEditingURL","onSubmit","event","preventDefault","editToolbar","target","html","isEmpty","select","ownProps","getEmbedPreview","isRequestingEmbedPreview","saveEmbedActivityBlock","blocks","registerBlockType","title","description","icon","background","foreground","src","category","type","source","selector","supports","align","edit","save"],"mappings":"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","file":"embed-activity.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t\tFragment,\n\t\tuseState,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tcomponents: {\n\t\tPlaceholder,\n\t\tDisabled,\n\t\tSandBox,\n\t\tButton,\n\t\tExternalLink,\n\t\tSpinner,\n\t\tToolbarGroup,\n\t\tToolbarButton,\n\t},\n\tcompose: {\n\t\tcompose,\n\t},\n\tdata: {\n\t\twithSelect,\n\t},\n\tblockEditor: {\n\t\tRichText,\n\t\tBlockControls,\n\t}\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\n const {\n\tblockData: {\n\t\tembedScriptURL,\n\t}\n} = bp;\n\nconst EditEmbedActivity = ( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tpreview,\n\tfetching\n} ) => {\n\tconst { url, caption } = attributes;\n\tconst label = __( 'BuddyPress Activity URL', 'buddypress' );\n\tconst [ value, setURL ] = useState( url );\n\tconst [ isEditingURL, setIsEditingURL ] = useState( ! url );\n\n\tconst onSubmit = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( false );\n\t\tsetAttributes( { url: value } );\n\t};\n\n\tconst switchBackToURLInput = ( event ) => {\n\t\tif ( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tsetIsEditingURL( true );\n\t};\n\n\tconst editToolbar = (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\ticon=\"edit\"\n\t\t\t\t\ttitle={ __( 'Edit URL', 'buddypress' ) }\n\t\t\t\t\tonClick={ switchBackToURLInput }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tif ( isEditingURL ) {\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\tlabel={ label }\n\t\t\t\tclassName=\"wp-block-embed\"\n\t\t\t\tinstructions={ __( 'Paste the link to the activity content you want to display on your site.', 'buddypress' ) }\n\t\t\t>\n\t\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…', 'buddypress' ) }\n\t\t\t\t\t\tonChange={ ( event ) => setURL( event.target.value ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<Button isPrimary type=\"submit\">\n\t\t\t\t\t\t{ __( 'Embed', 'buddypress' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t\t<div className=\"components-placeholder__learn-more\">\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://codex.buddypress.org/activity-embeds/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Learn more about activity embeds', 'buddypress' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</div>\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\tif ( fetching ) {\n\t\treturn (\n\t\t\t<div className=\"wp-block-embed is-loading\">\n\t\t\t\t<Spinner />\n\t\t\t\t<p>{ __( 'Embedding…', 'buddypress' ) }</p>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! preview || ! preview['x_buddypress'] || 'activity' !== preview['x_buddypress'] ) {\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t{ editToolbar }\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon=\"buddicons-activity\"\n\t\t\t\t\tlabel={ label }\n\t\t\t\t>\n\t\t\t\t\t<p className=\"components-placeholder__error\">\n\t\t\t\t\t\t{ __( 'The URL you provided is not a permalink to a public BuddyPress Activity. Please use another URL.', 'buddypress' ) }\n\t\t\t\t\t</p>\n\t\t\t\t</Placeholder>\n\t\t\t</Fragment>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t{ ! isEditingURL && editToolbar }\n\t\t\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t\t\t\t<Disabled>\n\t\t\t\t\t\t<SandBox\n\t\t\t\t\t\t\thtml={ preview && preview.html ? preview.html : '' }\n\t\t\t\t\t\t\tscripts={ [ embedScriptURL ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Disabled>\n\t\t\t\t</div>\n\t\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\t\tplaceholder={ __( 'Write caption…', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ caption }\n\t\t\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\t\t\tinlineToolbar\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</figure>\n\t\t</Fragment>\n\t);\n}\n\nconst editEmbedActivityBlock = compose( [\n\twithSelect( ( select, ownProps ) => {\n\t\tconst { url } = ownProps.attributes;\n\t\tconst {\n\t\t\tgetEmbedPreview,\n\t\t\tisRequestingEmbedPreview,\n\t\t} = select( 'core' );\n\n\t\tconst preview = !! url && getEmbedPreview( url );\n\t\tconst fetching = !! url && isRequestingEmbedPreview( url );\n\n\t\treturn {\n\t\t\tpreview: preview,\n\t\t\tfetching: fetching,\n\t\t};\n\t} ),\n] )( EditEmbedActivity );\n\nexport default editEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tRichText,\n\t},\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\nconst saveEmbedActivityBlock = ( { attributes } ) => {\n\tconst { url, caption } = attributes;\n\n\tif ( ! url ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t<figure className=\"wp-block-embed is-type-bp-activity\">\n\t\t<div className=\"wp-block-embed__wrapper\">\n\t\t{\n\t\t\t`\\n${ url }\\n` /* URL needs to be on its own line. */\n\t\t}\n\t\t</div>\n\t\t{ ! RichText.isEmpty( caption ) && (\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"figcaption\"\n\t\t\t\tvalue={ caption }\n\t\t\t/>\n\t\t) }\n\t</figure>\n\t);\n};\n\nexport default saveEmbedActivityBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editEmbedActivityBlock from './embed-activity/edit';\nimport saveEmbedActivityBlock from './embed-activity/save';\n\nregisterBlockType( 'bp/embed-activity', {\n\ttitle: __( 'Embed an activity', 'buddypress' ),\n\tdescription: __( 'Add a block that displays the activity content pulled from this or other community sites.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-activity',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\turl: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcaption: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'figcaption',\n\t\t},\n\t},\n\tsupports: {\n\t\talign: true,\n\t},\n\tedit: editEmbedActivityBlock,\n\tsave: saveEmbedActivityBlock,\n} );\n"]}
|
@@ -1,8 +1,8 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"DIzr":[function(require,module,exports) {
|
2 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
3 |
},{}],"yqpU":[function(require,module,exports) {
|
4 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
5 |
},{}],"q3eE":[function(require,module,exports) {
|
6 |
-
"use strict";var t=i(require("./latest-activities/edit")),e=i(require("./latest-activities/transforms"));function i(t){return t&&t.__esModule?t:{default:t}}
|
7 |
},{"./latest-activities/edit":"DIzr","./latest-activities/transforms":"yqpU"}]},{},["q3eE"], null)
|
8 |
//# sourceMappingURL=/bp-activity/js/blocks/latest-activities.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"DIzr":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blockEditor:{InspectorControls:e},components:{Disabled:t,PanelBody:l,RangeControl:s,SelectControl:i,TextControl:a},element:{Fragment:o,createElement:n},i18n:{__:r},serverSideRender:p}=wp,{blockData:{currentPostId:d,activityTypes:u}}=bp,b=({attributes:b,setAttributes:c})=>{const{postId:m,maxActivities:v,type:y,title:x}=b,C=d(),g=u();return!m&&C&&(c({postId:C}),b.postId||(b.postId=C)),n(o,null,n(e,null,n(l,{title:r("Settings","buddypress"),initialOpen:!0,className:"bp-latest-activities"},n(a,{label:r("Title","buddypress"),value:x,onChange:e=>{c({title:e})}}),n(s,{label:r("Maximum amount to display","buddypress"),value:v,onChange:e=>c({maxActivities:e}),min:1,max:10,required:!0}),n(i,{multiple:!0,label:r("Type","buddypress"),value:y,options:g,onChange:e=>{c({type:e})}}))),n(t,null,n(p,{block:"bp/latest-activities",attributes:b})))};var c=b;exports.default=c;
|
3 |
},{}],"yqpU":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blocks:{createBlock:e}}=wp,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!(null==t||!t.raw)&&"bp_latest_activities"===e,transform:({instance:t})=>{const a=/i:\d*;s:\d*:"(.*?)";/gim;let s,i=[];for(;null!==(s=a.exec(t.raw.type));)s.index===a.lastIndex&&a.lastIndex++,s.forEach((e,t)=>{1===t&&i.push(e)});return e("bp/latest-activities",{title:t.raw.title,maxActivities:parseInt(t.raw.max,10),type:i})}}]};var a=t;exports.default=a;
|
5 |
},{}],"q3eE":[function(require,module,exports) {
|
6 |
+
"use strict";var t=i(require("./latest-activities/edit")),e=i(require("./latest-activities/transforms"));function i(t){return t&&t.__esModule?t:{default:t}}const{blocks:{registerBlockType:s},i18n:{__:r}}=wp;s("bp/latest-activities",{title:r("Latest Activities","buddypress"),description:r("Display the latest updates of the post author (when used into a page or post), of the displayed user (when viewing their profile) or of your community.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-activity"},category:"buddypress",attributes:{title:{type:"string",default:r("Latest updates","buddypress")},maxActivities:{type:"number",default:5},type:{type:"array",default:["activity_update"]},postId:{type:"number",default:0}},edit:t.default,transforms:e.default});
|
7 |
},{"./latest-activities/edit":"DIzr","./latest-activities/transforms":"yqpU"}]},{},["q3eE"], null)
|
8 |
//# sourceMappingURL=/bp-activity/js/blocks/latest-activities.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["bp-activity/js/blocks/latest-activities/edit.js","bp-activity/js/blocks/latest-activities/transforms.js","bp-activity/js/blocks/latest-activities.js"],"names":["editDynamicActivitiesBlock","
|
1 |
+
{"version":3,"sources":["bp-activity/js/blocks/latest-activities/edit.js","bp-activity/js/blocks/latest-activities/transforms.js","bp-activity/js/blocks/latest-activities.js"],"names":["editDynamicActivitiesBlock","blockEditor","InspectorControls","components","Disabled","PanelBody","RangeControl","SelectControl","TextControl","element","Fragment","createElement","i18n","__","serverSideRender","ServerSideRender","wp","blockData","currentPostId","activityTypes","bp","attributes","setAttributes","postId","maxActivities","type","title","post","types","text","value","option","transforms","blocks","createBlock","from","isMatch","idBase","instance","raw","transform","regex","matches","exec","index","lastIndex","forEach","match","groupIndex","push","parseInt","max","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":"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","file":"latest-activities.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tSelectControl,\n\t\tTextControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tserverSideRender: ServerSideRender,\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockData: {\n\t\tcurrentPostId,\n\t\tactivityTypes,\n\t}\n} = bp;\n\nconst editDynamicActivitiesBlock = ( { attributes, setAttributes } ) => {\n\tconst { postId, maxActivities, type, title } = attributes;\n\tconst post = currentPostId();\n\tconst types = activityTypes();\n\n\tif ( ! postId && post ) {\n\t\tsetAttributes( { postId: post } );\n\t\tif ( ! attributes.postId ) {\n\t\t\tattributes.postId = post;\n\t\t}\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true } className=\"bp-latest-activities\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Maximum amount to display', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxActivities }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxActivities: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tmultiple\n\t\t\t\t\t\tlabel={ __( 'Type', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ type }\n\t\t\t\t\t\toptions={ types }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { type: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/latest-activities\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editDynamicActivitiesBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Nouveau Activity Widget to Activity Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_latest_activities';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\tconst regex = /i:\\d*;s:\\d*:\"(.*?)\";/gmi;\n\t\t\t\tlet types = [];\n\t\t\t\tlet matches;\n\n\t\t\t\twhile ( ( matches = regex.exec( instance.raw.type ) ) !== null ) {\n\t\t\t\t\tif ( matches.index === regex.lastIndex ) {\n\t\t\t\t\t\tregex.lastIndex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tmatches.forEach( ( match, groupIndex ) => {\n\t\t\t\t\t\tif ( 1 === groupIndex ) {\n\t\t\t\t\t\t\ttypes.push( match );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( 'bp/latest-activities', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t\tmaxActivities: parseInt( instance.raw.max, 10 ),\n\t\t\t\t\ttype: types,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editDynamicActivitiesBlock from './latest-activities/edit';\nimport transforms from './latest-activities/transforms';\n\nregisterBlockType( 'bp/latest-activities', {\n\ttitle: __( 'Latest Activities', 'buddypress' ),\n\tdescription: __( 'Display the latest updates of the post author (when used into a page or post), of the displayed user (when viewing their profile) or of your community.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-activity',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: __( 'Latest updates', 'buddypress' ),\n\t\t},\n\t\tmaxActivities: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 5\n\t\t},\n\t\ttype: {\n\t\t\ttype: 'array',\n\t\t\tdefault: ['activity_update'],\n\t\t},\n\t\tpostId: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\tedit: editDynamicActivitiesBlock,\n\ttransforms: transforms,\n} );\n"]}
|
@@ -465,20 +465,22 @@ add_filter( 'bp_activity_prefetch_object_data', 'bp_blogs_prefetch_activity_obje
|
|
465 |
* @return WP_Error|bool|int On success, returns the activity ID. False on failure.
|
466 |
*/
|
467 |
function bp_blogs_record_activity( $args = '' ) {
|
468 |
-
$defaults = array(
|
469 |
-
'user_id' => bp_loggedin_user_id(),
|
470 |
-
'action' => '',
|
471 |
-
'content' => '',
|
472 |
-
'primary_link' => '',
|
473 |
-
'component' => buddypress()->blogs->id,
|
474 |
-
'type' => false,
|
475 |
-
'item_id' => false,
|
476 |
-
'secondary_item_id' => false,
|
477 |
-
'recorded_time' => bp_core_current_time(),
|
478 |
-
'hide_sitewide' => false
|
479 |
-
);
|
480 |
|
481 |
-
$r =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
|
483 |
if ( ! empty( $r['action'] ) ) {
|
484 |
|
@@ -534,13 +536,16 @@ function bp_blogs_record_activity( $args = '' ) {
|
|
534 |
* @return bool True on success, false on failure.
|
535 |
*/
|
536 |
function bp_blogs_delete_activity( $args = '' ) {
|
537 |
-
$r = bp_parse_args(
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
|
|
|
|
|
|
544 |
|
545 |
bp_activity_delete_by_item_id( $r );
|
546 |
}
|
465 |
* @return WP_Error|bool|int On success, returns the activity ID. False on failure.
|
466 |
*/
|
467 |
function bp_blogs_record_activity( $args = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
|
469 |
+
$r = bp_parse_args(
|
470 |
+
$args,
|
471 |
+
array(
|
472 |
+
'user_id' => bp_loggedin_user_id(),
|
473 |
+
'action' => '',
|
474 |
+
'content' => '',
|
475 |
+
'primary_link' => '',
|
476 |
+
'component' => buddypress()->blogs->id,
|
477 |
+
'type' => false,
|
478 |
+
'item_id' => false,
|
479 |
+
'secondary_item_id' => false,
|
480 |
+
'recorded_time' => bp_core_current_time(),
|
481 |
+
'hide_sitewide' => false,
|
482 |
+
)
|
483 |
+
);
|
484 |
|
485 |
if ( ! empty( $r['action'] ) ) {
|
486 |
|
536 |
* @return bool True on success, false on failure.
|
537 |
*/
|
538 |
function bp_blogs_delete_activity( $args = '' ) {
|
539 |
+
$r = bp_parse_args(
|
540 |
+
$args,
|
541 |
+
array(
|
542 |
+
'item_id' => false,
|
543 |
+
'component' => buddypress()->blogs->id,
|
544 |
+
'type' => false,
|
545 |
+
'user_id' => false,
|
546 |
+
'secondary_item_id' => false,
|
547 |
+
)
|
548 |
+
);
|
549 |
|
550 |
bp_activity_delete_by_item_id( $r );
|
551 |
}
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
* @return string HTML output.
|
22 |
*/
|
23 |
function bp_blogs_render_recent_posts_block( $attributes = array() ) {
|
24 |
-
$block_args =
|
25 |
$attributes,
|
26 |
array(
|
27 |
'title' => __( 'Recent Networkwide Posts', 'buddypress' ),
|
21 |
* @return string HTML output.
|
22 |
*/
|
23 |
function bp_blogs_render_recent_posts_block( $attributes = array() ) {
|
24 |
+
$block_args = bp_parse_args(
|
25 |
$attributes,
|
26 |
array(
|
27 |
'title' => __( 'Recent Networkwide Posts', 'buddypress' ),
|
@@ -26,6 +26,10 @@ function bp_blogs_has_directory() {
|
|
26 |
/**
|
27 |
* Retrieve a set of blogs.
|
28 |
*
|
|
|
|
|
|
|
|
|
29 |
* @see BP_Blogs_Blog::get() for a description of arguments and return value.
|
30 |
*
|
31 |
* @param array|string $args {
|
@@ -37,6 +41,7 @@ function bp_blogs_has_directory() {
|
|
37 |
* @type string|bool $search_terms Default: false.
|
38 |
* @type int $per_page Default: 20.
|
39 |
* @type int $page Default: 1.
|
|
|
40 |
* @type bool $update_meta_cache Whether to pre-fetch blogmeta. Default: true.
|
41 |
* }
|
42 |
* @return array See {@link BP_Blogs_Blog::get()}.
|
@@ -44,26 +49,23 @@ function bp_blogs_has_directory() {
|
|
44 |
function bp_blogs_get_blogs( $args = '' ) {
|
45 |
|
46 |
// Parse query arguments.
|
47 |
-
$r = bp_parse_args(
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
// Get the blogs.
|
58 |
-
$blogs = BP_Blogs_Blog::get(
|
59 |
-
$r['type'],
|
60 |
-
$r['per_page'],
|
61 |
-
$r['page'],
|
62 |
-
$r['user_id'],
|
63 |
-
$r['search_terms'],
|
64 |
-
$r['update_meta_cache'],
|
65 |
-
$r['include_blog_ids']
|
66 |
-
);
|
67 |
|
68 |
/**
|
69 |
* Filters a set of blogs.
|
@@ -87,24 +89,27 @@ function bp_blogs_get_blogs( $args = '' ) {
|
|
87 |
*
|
88 |
* @param array $args {
|
89 |
* Array of arguments.
|
90 |
-
* @type int
|
91 |
-
* @type int
|
92 |
-
* @type array
|
93 |
-
* @type array
|
94 |
* }
|
95 |
-
*
|
96 |
* @return bool
|
97 |
*/
|
98 |
function bp_blogs_record_existing_blogs( $args = array() ) {
|
99 |
global $wpdb;
|
100 |
|
101 |
// Query for all sites in network.
|
102 |
-
$r = bp_parse_args(
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
108 |
|
109 |
// Truncate all BP blogs tables if starting fresh.
|
110 |
if ( empty( $r['offset'] ) && empty( $r['blog_ids'] ) ) {
|
@@ -566,8 +571,7 @@ add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2
|
|
566 |
* Deletes the 'url' blogmeta for a site.
|
567 |
*
|
568 |
* Fires when a site's details are updated, which generally happens when
|
569 |
-
* editing a site under "Network Admin > Sites".
|
570 |
-
* correct hook was 'refresh_blog_details'; afterward, 'clean_site_cache'.
|
571 |
*
|
572 |
* @since 2.3.0
|
573 |
*
|
@@ -576,12 +580,7 @@ add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2
|
|
576 |
function bp_blogs_delete_url_blogmeta( $site_id = 0 ) {
|
577 |
bp_blogs_delete_blogmeta( (int) $site_id, 'url' );
|
578 |
}
|
579 |
-
|
580 |
-
if ( bp_is_running_wp( '4.9.0' ) ) {
|
581 |
-
add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' );
|
582 |
-
} else {
|
583 |
-
add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' );
|
584 |
-
}
|
585 |
|
586 |
/**
|
587 |
* Record activity metadata about a published blog post.
|
@@ -1259,7 +1258,13 @@ function bp_blogs_get_all_blogs( $limit = null, $page = null ) {
|
|
1259 |
* @return array See {@BP_Blogs_Blog::get()}.
|
1260 |
*/
|
1261 |
function bp_blogs_get_random_blogs( $limit = null, $page = null ) {
|
1262 |
-
return BP_Blogs_Blog::get(
|
|
|
|
|
|
|
|
|
|
|
|
|
1263 |
}
|
1264 |
|
1265 |
/**
|
@@ -1531,7 +1536,10 @@ function bp_blogs_get_signup_form_submitted_vars() {
|
|
1531 |
'blog_public' => 0,
|
1532 |
);
|
1533 |
|
1534 |
-
$submitted_vars =
|
|
|
|
|
|
|
1535 |
|
1536 |
return array_map( 'wp_unslash', array_intersect_key( $submitted_vars, $exprected_vars ) );
|
1537 |
}
|
26 |
/**
|
27 |
* Retrieve a set of blogs.
|
28 |
*
|
29 |
+
* @since 1.2.0
|
30 |
+
* @since 2.0.0 Added $include_blog_ids, $update_meta_cache parameters
|
31 |
+
* @since 10.0.0 Added $date_query parameter
|
32 |
+
*
|
33 |
* @see BP_Blogs_Blog::get() for a description of arguments and return value.
|
34 |
*
|
35 |
* @param array|string $args {
|
41 |
* @type string|bool $search_terms Default: false.
|
42 |
* @type int $per_page Default: 20.
|
43 |
* @type int $page Default: 1.
|
44 |
+
* @type array $date_query Default: false.
|
45 |
* @type bool $update_meta_cache Whether to pre-fetch blogmeta. Default: true.
|
46 |
* }
|
47 |
* @return array See {@link BP_Blogs_Blog::get()}.
|
49 |
function bp_blogs_get_blogs( $args = '' ) {
|
50 |
|
51 |
// Parse query arguments.
|
52 |
+
$r = bp_parse_args(
|
53 |
+
$args,
|
54 |
+
array(
|
55 |
+
'type' => 'active', // 'active', 'alphabetical', 'newest', or 'random'.
|
56 |
+
'include_blog_ids' => false, // Array of blog IDs to include.
|
57 |
+
'user_id' => false, // Limit to blogs this user can post to.
|
58 |
+
'search_terms' => false, // Limit to blogs matching these search terms.
|
59 |
+
'per_page' => 20, // The number of results to return per page.
|
60 |
+
'page' => 1, // The page to return if limiting per page.
|
61 |
+
'date_query' => false, // Filter blogs by date query.
|
62 |
+
'update_meta_cache' => true, // Whether to pre-fetch blogmeta.
|
63 |
+
),
|
64 |
+
'blogs_get_blogs'
|
65 |
+
);
|
66 |
|
67 |
// Get the blogs.
|
68 |
+
$blogs = BP_Blogs_Blog::get( $r );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
/**
|
71 |
* Filters a set of blogs.
|
89 |
*
|
90 |
* @param array $args {
|
91 |
* Array of arguments.
|
92 |
+
* @type int $offset The offset to use.
|
93 |
+
* @type int $limit The number of blogs to record at one time.
|
94 |
+
* @type array $blog_ids Blog IDs to record. If empty, all blogs will be recorded.
|
95 |
+
* @type array $site_id The network site ID to use.
|
96 |
* }
|
|
|
97 |
* @return bool
|
98 |
*/
|
99 |
function bp_blogs_record_existing_blogs( $args = array() ) {
|
100 |
global $wpdb;
|
101 |
|
102 |
// Query for all sites in network.
|
103 |
+
$r = bp_parse_args(
|
104 |
+
$args,
|
105 |
+
array(
|
106 |
+
'offset' => (int) bp_get_option( '_bp_record_blogs_offset' ),
|
107 |
+
'limit' => 50,
|
108 |
+
'blog_ids' => array(),
|
109 |
+
'site_id' => $wpdb->siteid,
|
110 |
+
),
|
111 |
+
'record_existing_blogs'
|
112 |
+
);
|
113 |
|
114 |
// Truncate all BP blogs tables if starting fresh.
|
115 |
if ( empty( $r['offset'] ) && empty( $r['blog_ids'] ) ) {
|
571 |
* Deletes the 'url' blogmeta for a site.
|
572 |
*
|
573 |
* Fires when a site's details are updated, which generally happens when
|
574 |
+
* editing a site under "Network Admin > Sites".
|
|
|
575 |
*
|
576 |
* @since 2.3.0
|
577 |
*
|
580 |
function bp_blogs_delete_url_blogmeta( $site_id = 0 ) {
|
581 |
bp_blogs_delete_blogmeta( (int) $site_id, 'url' );
|
582 |
}
|
583 |
+
add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' );
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
/**
|
586 |
* Record activity metadata about a published blog post.
|
1258 |
* @return array See {@BP_Blogs_Blog::get()}.
|
1259 |
*/
|
1260 |
function bp_blogs_get_random_blogs( $limit = null, $page = null ) {
|
1261 |
+
return BP_Blogs_Blog::get(
|
1262 |
+
array(
|
1263 |
+
'type' => 'random',
|
1264 |
+
'limit' => $limit,
|
1265 |
+
'page' => $page
|
1266 |
+
)
|
1267 |
+
);
|
1268 |
}
|
1269 |
|
1270 |
/**
|
1536 |
'blog_public' => 0,
|
1537 |
);
|
1538 |
|
1539 |
+
$submitted_vars = bp_parse_args(
|
1540 |
+
$_POST,
|
1541 |
+
$exprected_vars
|
1542 |
+
);
|
1543 |
|
1544 |
return array_map( 'wp_unslash', array_intersect_key( $submitted_vars, $exprected_vars ) );
|
1545 |
}
|
@@ -97,6 +97,8 @@ function bp_blogs_directory_permalink() {
|
|
97 |
|
98 |
/**
|
99 |
* Rewind the blogs and reset blog index.
|
|
|
|
|
100 |
*/
|
101 |
function bp_rewind_blogs() {
|
102 |
global $blogs_template;
|
@@ -109,9 +111,15 @@ function bp_rewind_blogs() {
|
|
109 |
*
|
110 |
* Based on the $args passed, bp_has_blogs() populates the $blogs_template
|
111 |
* global, enabling the use of BuddyPress templates and template functions to
|
112 |
-
* display a list of
|
113 |
*
|
114 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
*
|
116 |
* @param array|string $args {
|
117 |
* Arguments for limiting the contents of the blogs loop. Most arguments
|
@@ -120,9 +128,6 @@ function bp_rewind_blogs() {
|
|
120 |
* and because bp_has_blogs() determines some default arguments in a
|
121 |
* dynamic fashion, we list all accepted arguments here as well.
|
122 |
*
|
123 |
-
* Arguments can be passed as an associative array, or as a URL query
|
124 |
-
* string (eg, 'user_id=4&per_page=3').
|
125 |
-
*
|
126 |
* @type int $page Which page of results to fetch. Using page=1 without
|
127 |
* per_page will result in no pagination. Default: 1.
|
128 |
* @type int|bool $per_page Number of results per page. Default: 20.
|
@@ -133,12 +138,14 @@ function bp_rewind_blogs() {
|
|
133 |
* @type string $type The order in which results should be fetched.
|
134 |
* 'active', 'alphabetical', 'newest', or 'random'.
|
135 |
* @type array $include_blog_ids Array of blog IDs to limit results to.
|
136 |
-
* @type string $sort 'ASC' or 'DESC'. Default: 'DESC'.
|
137 |
* @type string $search_terms Limit results by a search term. Default: the value of `$_REQUEST['s']` or
|
138 |
* `$_REQUEST['sites_search']`, if present.
|
139 |
* @type int $user_id The ID of the user whose blogs should be retrieved.
|
140 |
* When viewing a user profile page, 'user_id' defaults to the
|
141 |
* ID of the displayed user. Otherwise the default is false.
|
|
|
|
|
|
|
142 |
* }
|
143 |
* @return bool Returns true when blogs are found, otherwise false.
|
144 |
*/
|
@@ -155,17 +162,22 @@ function bp_has_blogs( $args = '' ) {
|
|
155 |
}
|
156 |
|
157 |
// Parse arguments.
|
158 |
-
$r = bp_parse_args(
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
// Set per_page to maximum if max is enforced.
|
171 |
if ( ! empty( $r['max'] ) && ( (int) $r['per_page'] > (int) $r['max'] ) ) {
|
@@ -173,7 +185,7 @@ function bp_has_blogs( $args = '' ) {
|
|
173 |
}
|
174 |
|
175 |
// Get the blogs.
|
176 |
-
$blogs_template = new BP_Blogs_Template( $r
|
177 |
|
178 |
/**
|
179 |
* Filters whether or not there are blogs to list.
|
@@ -349,19 +361,23 @@ function bp_blog_avatar( $args = '' ) {
|
|
349 |
}
|
350 |
|
351 |
// Parse the arguments.
|
352 |
-
$r = bp_parse_args(
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
|
|
|
|
|
|
365 |
|
366 |
/**
|
367 |
* If the `admin_user_id` was provided, make the Blog avatar
|
@@ -631,9 +647,12 @@ function bp_blog_last_active( $args = array() ) {
|
|
631 |
global $blogs_template;
|
632 |
|
633 |
// Parse the activity format.
|
634 |
-
$r = bp_parse_args(
|
635 |
-
|
636 |
-
|
|
|
|
|
|
|
637 |
|
638 |
// Backwards compatibility for anyone forcing a 'true' active_format.
|
639 |
if ( true === $r['active_format'] ) {
|
@@ -687,9 +706,12 @@ function bp_blog_latest_post( $args = array() ) {
|
|
687 |
function bp_get_blog_latest_post( $args = array() ) {
|
688 |
global $blogs_template;
|
689 |
|
690 |
-
$r =
|
691 |
-
|
692 |
-
|
|
|
|
|
|
|
693 |
|
694 |
$retval = bp_get_blog_latest_post_title();
|
695 |
|
@@ -1548,19 +1570,20 @@ function bp_blogs_visit_blog_button( $args = '' ) {
|
|
1548 |
* @return string The HTML for the Visit button.
|
1549 |
*/
|
1550 |
function bp_get_blogs_visit_blog_button( $args = '' ) {
|
1551 |
-
$
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
|
|
|
|
|
|
1560 |
);
|
1561 |
|
1562 |
-
$button = wp_parse_args( $args, $defaults );
|
1563 |
-
|
1564 |
/**
|
1565 |
* Filters the button for visiting a blog in a loop.
|
1566 |
*
|
@@ -1596,13 +1619,17 @@ add_action( 'bp_members_admin_user_stats', 'bp_blogs_profile_stats', 9, 1 );
|
|
1596 |
function bp_blogs_get_profile_stats( $args = '' ) {
|
1597 |
|
1598 |
// Parse the args.
|
1599 |
-
$r = bp_parse_args(
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
|
|
|
|
|
|
|
|
1606 |
|
1607 |
// Allow completely overloaded output.
|
1608 |
if ( is_multisite() && empty( $r['output'] ) ) {
|
97 |
|
98 |
/**
|
99 |
* Rewind the blogs and reset blog index.
|
100 |
+
*
|
101 |
+
* @global BP_Blogs_Template $blogs_template {@link BP_Blogs_Template}
|
102 |
*/
|
103 |
function bp_rewind_blogs() {
|
104 |
global $blogs_template;
|
111 |
*
|
112 |
* Based on the $args passed, bp_has_blogs() populates the $blogs_template
|
113 |
* global, enabling the use of BuddyPress templates and template functions to
|
114 |
+
* display a list of blogs.
|
115 |
*
|
116 |
+
* @since 1.0.0
|
117 |
+
* @since 1.2.0 Added $type, $page, $search_terms parameters
|
118 |
+
* @since 1.6.0 Added $page_arg parameter
|
119 |
+
* @since 2.0.0 Added $include_blog_ids, $update_meta_cache parameters
|
120 |
+
* @since 10.0.0 Added $date_query parameter
|
121 |
+
*
|
122 |
+
* @global BP_Blogs_Template $blogs_template {@link BP_Blogs_Template}
|
123 |
*
|
124 |
* @param array|string $args {
|
125 |
* Arguments for limiting the contents of the blogs loop. Most arguments
|
128 |
* and because bp_has_blogs() determines some default arguments in a
|
129 |
* dynamic fashion, we list all accepted arguments here as well.
|
130 |
*
|
|
|
|
|
|
|
131 |
* @type int $page Which page of results to fetch. Using page=1 without
|
132 |
* per_page will result in no pagination. Default: 1.
|
133 |
* @type int|bool $per_page Number of results per page. Default: 20.
|
138 |
* @type string $type The order in which results should be fetched.
|
139 |
* 'active', 'alphabetical', 'newest', or 'random'.
|
140 |
* @type array $include_blog_ids Array of blog IDs to limit results to.
|
|
|
141 |
* @type string $search_terms Limit results by a search term. Default: the value of `$_REQUEST['s']` or
|
142 |
* `$_REQUEST['sites_search']`, if present.
|
143 |
* @type int $user_id The ID of the user whose blogs should be retrieved.
|
144 |
* When viewing a user profile page, 'user_id' defaults to the
|
145 |
* ID of the displayed user. Otherwise the default is false.
|
146 |
+
* @type array $date_query Filter results by site last activity date. See first parameter of
|
147 |
+
* {@link WP_Date_Query::__construct()} for syntax. Only applicable if
|
148 |
+
* $type is either 'newest' or 'active'.
|
149 |
* }
|
150 |
* @return bool Returns true when blogs are found, otherwise false.
|
151 |
*/
|
162 |
}
|
163 |
|
164 |
// Parse arguments.
|
165 |
+
$r = bp_parse_args(
|
166 |
+
$args,
|
167 |
+
array(
|
168 |
+
'type' => 'active',
|
169 |
+
'page_arg' => 'bpage', // See https://buddypress.trac.wordpress.org/ticket/3679.
|
170 |
+
'page' => 1,
|
171 |
+
'per_page' => 20,
|
172 |
+
'max' => false,
|
173 |
+
'user_id' => bp_displayed_user_id(), // Pass a user_id to limit to only blogs this user is a member of.
|
174 |
+
'include_blog_ids' => false,
|
175 |
+
'search_terms' => $search_terms_default,
|
176 |
+
'date_query' => false,
|
177 |
+
'update_meta_cache' => true,
|
178 |
+
),
|
179 |
+
'has_blogs'
|
180 |
+
);
|
181 |
|
182 |
// Set per_page to maximum if max is enforced.
|
183 |
if ( ! empty( $r['max'] ) && ( (int) $r['per_page'] > (int) $r['max'] ) ) {
|
185 |
}
|
186 |
|
187 |
// Get the blogs.
|
188 |
+
$blogs_template = new BP_Blogs_Template( $r );
|
189 |
|
190 |
/**
|
191 |
* Filters whether or not there are blogs to list.
|
361 |
}
|
362 |
|
363 |
// Parse the arguments.
|
364 |
+
$r = bp_parse_args(
|
365 |
+
$args,
|
366 |
+
array(
|
367 |
+
'item_id' => $blog_id,
|
368 |
+
'avatar_dir' => 'blog-avatars',
|
369 |
+
'object' => 'blog',
|
370 |
+
'type' => 'full',
|
371 |
+
'width' => false,
|
372 |
+
'height' => false,
|
373 |
+
'class' => 'avatar',
|
374 |
+
'id' => false,
|
375 |
+
'alt' => $alt_attribute,
|
376 |
+
'no_grav' => false,
|
377 |
+
'html' => true,
|
378 |
+
),
|
379 |
+
'blog_avatar'
|
380 |
+
);
|
381 |
|
382 |
/**
|
383 |
* If the `admin_user_id` was provided, make the Blog avatar
|
647 |
global $blogs_template;
|
648 |
|
649 |
// Parse the activity format.
|
650 |
+
$r = bp_parse_args(
|
651 |
+
$args,
|
652 |
+
array(
|
653 |
+
'active_format' => true,
|
654 |
+
)
|
655 |
+
);
|
656 |
|
657 |
// Backwards compatibility for anyone forcing a 'true' active_format.
|
658 |
if ( true === $r['active_format'] ) {
|
706 |
function bp_get_blog_latest_post( $args = array() ) {
|
707 |
global $blogs_template;
|
708 |
|
709 |
+
$r = bp_parse_args(
|
710 |
+
$args,
|
711 |
+
array(
|
712 |
+
'latest_format' => true,
|
713 |
+
)
|
714 |
+
);
|
715 |
|
716 |
$retval = bp_get_blog_latest_post_title();
|
717 |
|
1570 |
* @return string The HTML for the Visit button.
|
1571 |
*/
|
1572 |
function bp_get_blogs_visit_blog_button( $args = '' ) {
|
1573 |
+
$button = bp_parse_args(
|
1574 |
+
$args,
|
1575 |
+
array(
|
1576 |
+
'id' => 'visit_blog',
|
1577 |
+
'component' => 'blogs',
|
1578 |
+
'must_be_logged_in' => false,
|
1579 |
+
'block_self' => false,
|
1580 |
+
'wrapper_class' => 'blog-button visit',
|
1581 |
+
'link_href' => bp_get_blog_permalink(),
|
1582 |
+
'link_class' => 'blog-button visit',
|
1583 |
+
'link_text' => __( 'Visit Site', 'buddypress' ),
|
1584 |
+
)
|
1585 |
);
|
1586 |
|
|
|
|
|
1587 |
/**
|
1588 |
* Filters the button for visiting a blog in a loop.
|
1589 |
*
|
1619 |
function bp_blogs_get_profile_stats( $args = '' ) {
|
1620 |
|
1621 |
// Parse the args.
|
1622 |
+
$r = bp_parse_args(
|
1623 |
+
$args,
|
1624 |
+
array(
|
1625 |
+
'before' => '<li class="bp-blogs-profile-stats">',
|
1626 |
+
'after' => '</li>',
|
1627 |
+
'user_id' => bp_displayed_user_id(),
|
1628 |
+
'blogs' => 0,
|
1629 |
+
'output' => '',
|
1630 |
+
),
|
1631 |
+
'blogs_get_profile_stats'
|
1632 |
+
);
|
1633 |
|
1634 |
// Allow completely overloaded output.
|
1635 |
if ( is_multisite() && empty( $r['output'] ) ) {
|
@@ -10,6 +10,15 @@
|
|
10 |
// Exit if accessed directly.
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Register the widgets for the Blogs component.
|
15 |
*/
|
@@ -17,7 +26,7 @@ function bp_blogs_register_widgets() {
|
|
17 |
global $wpdb;
|
18 |
|
19 |
if ( bp_is_active( 'activity' ) && bp_is_root_blog( $wpdb->blogid ) ) {
|
20 |
-
add_action( 'widgets_init',
|
21 |
}
|
22 |
}
|
23 |
add_action( 'bp_register_widgets', 'bp_blogs_register_widgets' );
|
10 |
// Exit if accessed directly.
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
13 |
+
/**
|
14 |
+
* Registers the Recent Posts Legacy Widget.
|
15 |
+
*
|
16 |
+
* @since 10.0.0
|
17 |
+
*/
|
18 |
+
function bp_blogs_register_recent_posts_widget() {
|
19 |
+
register_widget( 'BP_Blogs_Recent_Posts_Widget' );
|
20 |
+
}
|
21 |
+
|
22 |
/**
|
23 |
* Register the widgets for the Blogs component.
|
24 |
*/
|
26 |
global $wpdb;
|
27 |
|
28 |
if ( bp_is_active( 'activity' ) && bp_is_root_blog( $wpdb->blogid ) ) {
|
29 |
+
add_action( 'widgets_init', 'bp_blogs_register_recent_posts_widget' );
|
30 |
}
|
31 |
}
|
32 |
add_action( 'bp_register_widgets', 'bp_blogs_register_widgets' );
|
@@ -163,46 +163,93 @@ class BP_Blogs_Blog {
|
|
163 |
/**
|
164 |
* Retrieve a set of blog-user associations.
|
165 |
*
|
166 |
-
* @
|
167 |
-
*
|
168 |
-
*
|
169 |
-
*
|
170 |
-
*
|
171 |
-
*
|
172 |
-
*
|
173 |
-
*
|
174 |
-
*
|
175 |
-
*
|
176 |
-
*
|
177 |
-
*
|
178 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
* @return array Multidimensional results array, structured as follows:
|
180 |
* 'blogs' - Array of located blog objects
|
181 |
* 'total' - A count of the total blogs matching the filter params
|
182 |
*/
|
183 |
-
public static function get(
|
184 |
global $wpdb;
|
185 |
|
186 |
$bp = buddypress();
|
187 |
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
$hidden_sql = "AND wb.public = 1";
|
190 |
-
else
|
191 |
$hidden_sql = '';
|
|
|
|
|
|
|
192 |
|
193 |
-
$
|
194 |
|
195 |
-
$
|
196 |
|
197 |
-
switch ( $type ) {
|
198 |
case 'active': default:
|
199 |
-
$
|
|
|
200 |
break;
|
201 |
case 'alphabetical':
|
202 |
$order_sql = "ORDER BY bm_name.meta_value ASC";
|
203 |
break;
|
204 |
case 'newest':
|
205 |
-
$
|
|
|
206 |
break;
|
207 |
case 'random':
|
208 |
$order_sql = "ORDER BY RAND()";
|
@@ -210,14 +257,14 @@ class BP_Blogs_Blog {
|
|
210 |
}
|
211 |
|
212 |
$include_sql = '';
|
213 |
-
$include_blog_ids = array_filter( wp_parse_id_list( $include_blog_ids ) );
|
214 |
if ( ! empty( $include_blog_ids ) ) {
|
215 |
$blog_ids_sql = implode( ',', $include_blog_ids );
|
216 |
$include_sql = " AND b.blog_id IN ({$blog_ids_sql})";
|
217 |
}
|
218 |
|
219 |
-
if ( ! empty( $search_terms ) ) {
|
220 |
-
$search_terms_like = '%' . bp_esc_like( $search_terms ) . '%';
|
221 |
$search_terms_sql = $wpdb->prepare( 'AND (bm_name.meta_value LIKE %s OR bm_description.meta_value LIKE %s)', $search_terms_like, $search_terms_like );
|
222 |
} else {
|
223 |
$search_terms_sql = '';
|
@@ -235,7 +282,7 @@ class BP_Blogs_Blog {
|
|
235 |
WHERE
|
236 |
wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}
|
237 |
AND bm.meta_key = 'last_activity' AND bm_name.meta_key = 'name' AND bm_description.meta_key = 'description'
|
238 |
-
{$search_terms_sql} {$user_sql} {$include_sql}
|
239 |
GROUP BY b.blog_id {$order_sql} {$pag_sql}
|
240 |
" );
|
241 |
|
@@ -244,13 +291,13 @@ class BP_Blogs_Blog {
|
|
244 |
FROM
|
245 |
{$bp->blogs->table_name} b
|
246 |
LEFT JOIN {$wpdb->base_prefix}blogs wb ON (b.blog_id = wb.blog_id)
|
|
|
247 |
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_name ON (b.blog_id = bm_name.blog_id)
|
248 |
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_description ON (b.blog_id = bm_description.blog_id)
|
249 |
WHERE
|
250 |
wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}
|
251 |
-
AND
|
252 |
-
|
253 |
-
{$search_terms_sql} {$user_sql} {$include_sql}
|
254 |
" );
|
255 |
|
256 |
$blog_ids = array();
|
@@ -258,7 +305,7 @@ class BP_Blogs_Blog {
|
|
258 |
$blog_ids[] = (int) $blog->blog_id;
|
259 |
}
|
260 |
|
261 |
-
$paged_blogs = BP_Blogs_Blog::get_blog_extras( $paged_blogs, $blog_ids, $type );
|
262 |
|
263 |
// Integer casting.
|
264 |
foreach ( (array) $paged_blogs as $key => $data ) {
|
@@ -266,7 +313,7 @@ class BP_Blogs_Blog {
|
|
266 |
$paged_blogs[ $key ]->admin_user_id = (int) $paged_blogs[ $key ]->admin_user_id;
|
267 |
}
|
268 |
|
269 |
-
if ( $update_meta_cache ) {
|
270 |
bp_blogs_update_meta_cache( $blog_ids );
|
271 |
}
|
272 |
|
163 |
/**
|
164 |
* Retrieve a set of blog-user associations.
|
165 |
*
|
166 |
+
* @since 1.2.0
|
167 |
+
* @since 10.0.0 Converted to array as main function argument. Added $date_query parameter.
|
168 |
+
*
|
169 |
+
* @param array $data {
|
170 |
+
* Array of site data to query for.
|
171 |
+
* @type string $type The order in which results should be returned.
|
172 |
+
* 'active', 'alphabetical', 'newest', or 'random'.
|
173 |
+
* @type int|bool $limit Optional. The maximum records to return.
|
174 |
+
* Default: false.
|
175 |
+
* @type int|bool $page Optional. The page of records to return.
|
176 |
+
* Default: false (unlimited results).
|
177 |
+
* @type int $user_id Optional. ID of the user whose blogs are being
|
178 |
+
* retrieved. Default: 0.
|
179 |
+
* @type string|bool $search_terms Optional. Search by text stored in
|
180 |
+
* blogmeta (such as the blog name). Default: false.
|
181 |
+
* @type bool $update_meta_cache Whether to pre-fetch metadata for
|
182 |
+
* blogs. Default: true.
|
183 |
+
* @type array|bool $include_blog_ids Optional. Array of blog IDs to include.
|
184 |
+
* @type array $date_query Optional. Filter results by site last activity date. See first
|
185 |
+
* paramter of {@link WP_Date_Query::__construct()} for syntax. Only
|
186 |
+
* applicable if $type is either 'newest' or 'active'.
|
187 |
+
* }
|
188 |
* @return array Multidimensional results array, structured as follows:
|
189 |
* 'blogs' - Array of located blog objects
|
190 |
* 'total' - A count of the total blogs matching the filter params
|
191 |
*/
|
192 |
+
public static function get( ...$args ) {
|
193 |
global $wpdb;
|
194 |
|
195 |
$bp = buddypress();
|
196 |
|
197 |
+
// Backward compatibility with old method of passing arguments.
|
198 |
+
if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
|
199 |
+
_deprecated_argument( __METHOD__, '10.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
|
200 |
+
|
201 |
+
$old_args_keys = [
|
202 |
+
0 => 'type',
|
203 |
+
1 => 'limit',
|
204 |
+
2 => 'page',
|
205 |
+
3 => 'user_id',
|
206 |
+
4 => 'search_terms',
|
207 |
+
5 => 'update_meta_cache',
|
208 |
+
6 => 'include_blog_ids',
|
209 |
+
];
|
210 |
+
|
211 |
+
$args = bp_core_parse_args_array( $old_args_keys, $args );
|
212 |
+
} else {
|
213 |
+
$args = reset( $args );
|
214 |
+
}
|
215 |
+
|
216 |
+
$r = wp_parse_args(
|
217 |
+
$args,
|
218 |
+
array(
|
219 |
+
'type' => 'active',
|
220 |
+
'limit' => false,
|
221 |
+
'page' => false,
|
222 |
+
'user_id' => 0,
|
223 |
+
'search_terms' => false,
|
224 |
+
'update_meta_cache' => true,
|
225 |
+
'include_blog_ids' => false,
|
226 |
+
'date_query' => false,
|
227 |
+
)
|
228 |
+
);
|
229 |
+
|
230 |
+
if ( ! is_user_logged_in() || ( ! bp_current_user_can( 'bp_moderate' ) && ( $r['user_id'] != bp_loggedin_user_id() ) ) ) {
|
231 |
$hidden_sql = "AND wb.public = 1";
|
232 |
+
} else {
|
233 |
$hidden_sql = '';
|
234 |
+
}
|
235 |
+
|
236 |
+
$pag_sql = ( $r['limit'] && $r['page'] ) ? $wpdb->prepare( " LIMIT %d, %d", intval( ( $r['page'] - 1 ) * $r['limit']), intval( $r['limit'] ) ) : '';
|
237 |
|
238 |
+
$user_sql = ! empty( $r['user_id'] ) ? $wpdb->prepare( " AND b.user_id = %d", $r['user_id'] ) : '';
|
239 |
|
240 |
+
$date_query_sql = '';
|
241 |
|
242 |
+
switch ( $r['type'] ) {
|
243 |
case 'active': default:
|
244 |
+
$date_query_sql = BP_Date_Query::get_where_sql( $r['date_query'], 'bm.meta_value', true );
|
245 |
+
$order_sql = "ORDER BY bm.meta_value DESC";
|
246 |
break;
|
247 |
case 'alphabetical':
|
248 |
$order_sql = "ORDER BY bm_name.meta_value ASC";
|
249 |
break;
|
250 |
case 'newest':
|
251 |
+
$date_query_sql = BP_Date_Query::get_where_sql( $r['date_query'], 'wb.registered', true );
|
252 |
+
$order_sql = "ORDER BY wb.registered DESC";
|
253 |
break;
|
254 |
case 'random':
|
255 |
$order_sql = "ORDER BY RAND()";
|
257 |
}
|
258 |
|
259 |
$include_sql = '';
|
260 |
+
$include_blog_ids = array_filter( wp_parse_id_list( $r['include_blog_ids'] ) );
|
261 |
if ( ! empty( $include_blog_ids ) ) {
|
262 |
$blog_ids_sql = implode( ',', $include_blog_ids );
|
263 |
$include_sql = " AND b.blog_id IN ({$blog_ids_sql})";
|
264 |
}
|
265 |
|
266 |
+
if ( ! empty( $r['search_terms'] ) ) {
|
267 |
+
$search_terms_like = '%' . bp_esc_like( $r['search_terms'] ) . '%';
|
268 |
$search_terms_sql = $wpdb->prepare( 'AND (bm_name.meta_value LIKE %s OR bm_description.meta_value LIKE %s)', $search_terms_like, $search_terms_like );
|
269 |
} else {
|
270 |
$search_terms_sql = '';
|
282 |
WHERE
|
283 |
wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}
|
284 |
AND bm.meta_key = 'last_activity' AND bm_name.meta_key = 'name' AND bm_description.meta_key = 'description'
|
285 |
+
{$search_terms_sql} {$user_sql} {$include_sql} {$date_query_sql}
|
286 |
GROUP BY b.blog_id {$order_sql} {$pag_sql}
|
287 |
" );
|
288 |
|
291 |
FROM
|
292 |
{$bp->blogs->table_name} b
|
293 |
LEFT JOIN {$wpdb->base_prefix}blogs wb ON (b.blog_id = wb.blog_id)
|
294 |
+
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm ON (b.blog_id = bm.blog_id)
|
295 |
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_name ON (b.blog_id = bm_name.blog_id)
|
296 |
LEFT JOIN {$bp->blogs->table_name_blogmeta} bm_description ON (b.blog_id = bm_description.blog_id)
|
297 |
WHERE
|
298 |
wb.archived = '0' AND wb.spam = 0 AND wb.mature = 0 AND wb.deleted = 0 {$hidden_sql}
|
299 |
+
AND bm.meta_key = 'last_activity' AND bm_name.meta_key = 'name' AND bm_description.meta_key = 'description'
|
300 |
+
{$search_terms_sql} {$user_sql} {$include_sql} {$date_query_sql}
|
|
|
301 |
" );
|
302 |
|
303 |
$blog_ids = array();
|
305 |
$blog_ids[] = (int) $blog->blog_id;
|
306 |
}
|
307 |
|
308 |
+
$paged_blogs = BP_Blogs_Blog::get_blog_extras( $paged_blogs, $blog_ids, $r['type'] );
|
309 |
|
310 |
// Integer casting.
|
311 |
foreach ( (array) $paged_blogs as $key => $data ) {
|
313 |
$paged_blogs[ $key ]->admin_user_id = (int) $paged_blogs[ $key ]->admin_user_id;
|
314 |
}
|
315 |
|
316 |
+
if ( $r['update_meta_cache'] ) {
|
317 |
bp_blogs_update_meta_cache( $blog_ids );
|
318 |
}
|
319 |
|
@@ -296,7 +296,7 @@ class BP_Blogs_Component extends BP_Component {
|
|
296 |
'parent' => 'my-account-' . $this->id,
|
297 |
'id' => 'my-account-' . $this->id . '-my-sites',
|
298 |
'title' => __( 'My Sites', 'buddypress' ),
|
299 |
-
'href' => $blogs_link,
|
300 |
'position' => 10
|
301 |
);
|
302 |
|
@@ -408,7 +408,7 @@ class BP_Blogs_Component extends BP_Component {
|
|
408 |
'wp-components',
|
409 |
'wp-i18n',
|
410 |
'wp-block-editor',
|
411 |
-
'
|
412 |
),
|
413 |
'style' => 'bp-recent-posts-block',
|
414 |
'style_url' => plugins_url( 'css/blocks/recent-posts.css', dirname( __FILE__ ) ),
|
@@ -432,4 +432,23 @@ class BP_Blogs_Component extends BP_Component {
|
|
432 |
|
433 |
parent::blocks_init( $blocks );
|
434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
}
|
296 |
'parent' => 'my-account-' . $this->id,
|
297 |
'id' => 'my-account-' . $this->id . '-my-sites',
|
298 |
'title' => __( 'My Sites', 'buddypress' ),
|
299 |
+
'href' => trailingslashit( $blogs_link . 'my-sites' ),
|
300 |
'position' => 10
|
301 |
);
|
302 |
|
408 |
'wp-components',
|
409 |
'wp-i18n',
|
410 |
'wp-block-editor',
|
411 |
+
'wp-server-side-render',
|
412 |
),
|
413 |
'style' => 'bp-recent-posts-block',
|
414 |
'style_url' => plugins_url( 'css/blocks/recent-posts.css', dirname( __FILE__ ) ),
|
432 |
|
433 |
parent::blocks_init( $blocks );
|
434 |
}
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Add the Sites directory states.
|
438 |
+
*
|
439 |
+
* @since 10.0.0
|
440 |
+
*
|
441 |
+
* @param array $states Optional. See BP_Component::admin_directory_states() for description.
|
442 |
+
* @param WP_Post $post Optional. See BP_Component::admin_directory_states() for description.
|
443 |
+
* @return array See BP_Component::admin_directory_states() for description.
|
444 |
+
*/
|
445 |
+
public function admin_directory_states( $states = array(), $post = null ) {
|
446 |
+
$bp = buddypress();
|
447 |
+
|
448 |
+
if ( isset( $bp->pages->blogs->id ) && (int) $bp->pages->blogs->id === (int) $post->ID ) {
|
449 |
+
$states['page_for_sites_directory'] = _x( 'BP Sites Page', 'page label', 'buddypress' );
|
450 |
+
}
|
451 |
+
|
452 |
+
return parent::admin_directory_states( $states, $post );
|
453 |
+
}
|
454 |
}
|
@@ -150,15 +150,16 @@ class BP_Blogs_Recent_Posts_Widget extends WP_Widget {
|
|
150 |
* Output the networkwide posts widget options form.
|
151 |
*
|
152 |
* @param array $instance Settings for this widget.
|
153 |
-
*
|
154 |
-
* @return void
|
155 |
*/
|
156 |
public function form( $instance ) {
|
157 |
-
$instance =
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
162 |
|
163 |
$max_limit = bp_get_widget_max_count_limit( __CLASS__ );
|
164 |
|
150 |
* Output the networkwide posts widget options form.
|
151 |
*
|
152 |
* @param array $instance Settings for this widget.
|
|
|
|
|
153 |
*/
|
154 |
public function form( $instance ) {
|
155 |
+
$instance = bp_parse_args(
|
156 |
+
(array) $instance,
|
157 |
+
array(
|
158 |
+
'title' => __( 'Recent Networkwide Posts', 'buddypress' ),
|
159 |
+
'max_posts' => 10,
|
160 |
+
'link_title' => false,
|
161 |
+
)
|
162 |
+
);
|
163 |
|
164 |
$max_limit = bp_get_widget_max_count_limit( __CLASS__ );
|
165 |
|
@@ -83,25 +83,57 @@ class BP_Blogs_Template {
|
|
83 |
/**
|
84 |
* Constructor method.
|
85 |
*
|
|
|
|
|
|
|
86 |
* @see BP_Blogs_Blog::get() for a description of parameters.
|
87 |
*
|
88 |
-
* @param
|
89 |
-
*
|
90 |
-
*
|
91 |
-
* @param string $max See {@link BP_Blogs_Blog::get()}.
|
92 |
-
* @param string $user_id See {@link BP_Blogs_Blog::get()}.
|
93 |
-
* @param string $search_terms See {@link BP_Blogs_Blog::get()}.
|
94 |
-
* @param string $page_arg The string used as a query parameter in
|
95 |
-
* pagination links. Default: 'bpage'.
|
96 |
-
* @param bool $update_meta_cache Whether to pre-fetch metadata for
|
97 |
-
* queried blogs.
|
98 |
-
* @param array|bool $include_blog_ids Array of blog IDs to include.
|
99 |
*/
|
100 |
-
public function __construct(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
$this->pag_arg = sanitize_key( $page_arg );
|
103 |
-
$this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $page
|
104 |
-
$this->pag_num = bp_sanitize_pagination_arg( 'num',
|
105 |
|
106 |
// Backwards compatibility support for blogs by first letter.
|
107 |
if ( ! empty( $_REQUEST['letter'] ) ) {
|
@@ -110,18 +142,19 @@ class BP_Blogs_Template {
|
|
110 |
// Typical blogs query.
|
111 |
} else {
|
112 |
$this->blogs = bp_blogs_get_blogs( array(
|
113 |
-
'type' => $type,
|
114 |
'per_page' => $this->pag_num,
|
115 |
'page' => $this->pag_page,
|
116 |
-
'user_id' => $user_id,
|
117 |
-
'search_terms' => $search_terms,
|
118 |
-
'update_meta_cache' => $update_meta_cache,
|
119 |
-
'include_blog_ids' => $include_blog_ids,
|
|
|
120 |
) );
|
121 |
}
|
122 |
|
123 |
// Set the total blog count.
|
124 |
-
if ( empty( $max ) || ( $max >= (int) $this->blogs['total'] ) ) {
|
125 |
$this->total_blog_count = (int) $this->blogs['total'];
|
126 |
} else {
|
127 |
$this->total_blog_count = (int) $max;
|
@@ -134,7 +167,7 @@ class BP_Blogs_Template {
|
|
134 |
$blog_count = count( $this->blogs );
|
135 |
|
136 |
// Set the current blog count.
|
137 |
-
if ( empty( $max ) || ( $max >= (int) $blog_count ) ) {
|
138 |
$this->blog_count = (int) $blog_count;
|
139 |
} else {
|
140 |
$this->blog_count = (int) $max;
|
83 |
/**
|
84 |
* Constructor method.
|
85 |
*
|
86 |
+
* @since 1.2.0
|
87 |
+
* @since 10.0.0 Converted to array as main function argument. Added $date_query parameter.
|
88 |
+
*
|
89 |
* @see BP_Blogs_Blog::get() for a description of parameters.
|
90 |
*
|
91 |
+
* @param array $args {
|
92 |
+
* Array of arguments. See {@link BP_Blogs_Blog::get()}.
|
93 |
+
* }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
*/
|
95 |
+
public function __construct( ...$args ) {
|
96 |
+
// Backward compatibility with old method of passing arguments.
|
97 |
+
if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
|
98 |
+
_deprecated_argument( __METHOD__, '10.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
|
99 |
+
|
100 |
+
$old_args_keys = [
|
101 |
+
0 => 'type',
|
102 |
+
1 => 'page',
|
103 |
+
2 => 'per_page',
|
104 |
+
3 => 'max',
|
105 |
+
4 => 'user_id',
|
106 |
+
5 => 'search_terms',
|
107 |
+
6 => 'page_arg',
|
108 |
+
7 => 'update_meta_cache',
|
109 |
+
8 => 'include_blog_ids',
|
110 |
+
];
|
111 |
+
|
112 |
+
$args = bp_core_parse_args_array( $old_args_keys, $args );
|
113 |
+
} else {
|
114 |
+
$args = reset( $args );
|
115 |
+
}
|
116 |
+
|
117 |
+
$r = bp_parse_args(
|
118 |
+
$args,
|
119 |
+
array(
|
120 |
+
'type' => '',
|
121 |
+
'page' => false,
|
122 |
+
'per_page' => false,
|
123 |
+
'max' => false,
|
124 |
+
'user_id' => false,
|
125 |
+
'search_terms' => false,
|
126 |
+
'page_arg' => 'bpage',
|
127 |
+
'update_meta_cache' => true,
|
128 |
+
'include_blog_ids' => false,
|
129 |
+
'date_query' => false,
|
130 |
+
),
|
131 |
+
'blogs_template'
|
132 |
+
);
|
133 |
|
134 |
+
$this->pag_arg = sanitize_key( $r['page_arg'] );
|
135 |
+
$this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page'] );
|
136 |
+
$this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] );
|
137 |
|
138 |
// Backwards compatibility support for blogs by first letter.
|
139 |
if ( ! empty( $_REQUEST['letter'] ) ) {
|
142 |
// Typical blogs query.
|
143 |
} else {
|
144 |
$this->blogs = bp_blogs_get_blogs( array(
|
145 |
+
'type' => $r['type'],
|
146 |
'per_page' => $this->pag_num,
|
147 |
'page' => $this->pag_page,
|
148 |
+
'user_id' => $r['user_id'],
|
149 |
+
'search_terms' => $r['search_terms'],
|
150 |
+
'update_meta_cache' => $r['update_meta_cache'],
|
151 |
+
'include_blog_ids' => $r['include_blog_ids'],
|
152 |
+
'date_query' => $r['date_query']
|
153 |
) );
|
154 |
}
|
155 |
|
156 |
// Set the total blog count.
|
157 |
+
if ( empty( $r['max'] ) || ( $r['max'] >= (int) $this->blogs['total'] ) ) {
|
158 |
$this->total_blog_count = (int) $this->blogs['total'];
|
159 |
} else {
|
160 |
$this->total_blog_count = (int) $max;
|
167 |
$blog_count = count( $this->blogs );
|
168 |
|
169 |
// Set the current blog count.
|
170 |
+
if ( empty( $r['max'] ) || ( $r['max'] >= (int) $blog_count ) ) {
|
171 |
$this->blog_count = (int) $blog_count;
|
172 |
} else {
|
173 |
$this->blog_count = (int) $max;
|
@@ -403,18 +403,19 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
403 |
*/
|
404 |
public function prepare_item_for_response( $blog, $request ) {
|
405 |
$data = array(
|
406 |
-
'id'
|
407 |
-
'user_id'
|
408 |
-
'name'
|
409 |
-
'domain'
|
410 |
-
'path'
|
411 |
-
'permalink'
|
412 |
-
'
|
|
|
|
|
|
|
413 |
'raw' => $blog->description,
|
414 |
'rendered' => apply_filters( 'bp_get_blog_description', $blog->description ),
|
415 |
),
|
416 |
-
'last_activity' => bp_rest_prepare_date_response( $blog->last_activity ),
|
417 |
-
'lastest_post_id' => 0,
|
418 |
);
|
419 |
|
420 |
if ( ! empty( $blog->latest_post->ID ) ) {
|
@@ -426,16 +427,16 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
426 |
$data['avatar_urls'] = array(
|
427 |
'thumb' => bp_get_blog_avatar(
|
428 |
array(
|
429 |
-
'type'
|
430 |
-
'blog_id'
|
431 |
-
'html'
|
432 |
)
|
433 |
),
|
434 |
'full' => bp_get_blog_avatar(
|
435 |
array(
|
436 |
-
'type'
|
437 |
-
'blog_id'
|
438 |
-
'html'
|
439 |
)
|
440 |
),
|
441 |
);
|
@@ -517,7 +518,7 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
517 |
* @param stdClass $blog Blog object.
|
518 |
* @return string
|
519 |
*/
|
520 |
-
protected function
|
521 |
|
522 |
// Bail early.
|
523 |
if ( empty( $blog->domain ) && empty( $blog->path ) ) {
|
@@ -644,19 +645,19 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
644 |
'title' => 'bp_blogs',
|
645 |
'type' => 'object',
|
646 |
'properties' => array(
|
647 |
-
'id'
|
648 |
'context' => array( 'view', 'edit', 'embed' ),
|
649 |
'description' => __( 'A unique numeric ID for the blog.', 'buddypress' ),
|
650 |
'readonly' => true,
|
651 |
'type' => 'integer',
|
652 |
),
|
653 |
-
'user_id'
|
654 |
'context' => array( 'view', 'edit', 'embed' ),
|
655 |
'description' => __( 'A unique numeric ID for the blog admin.', 'buddypress' ),
|
656 |
'readonly' => true,
|
657 |
'type' => 'integer',
|
658 |
),
|
659 |
-
'name'
|
660 |
'context' => array( 'view', 'edit', 'embed' ),
|
661 |
'description' => __( 'The name of the blog.', 'buddypress' ),
|
662 |
'readonly' => true,
|
@@ -665,14 +666,14 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
665 |
'sanitize_callback' => 'sanitize_text_field',
|
666 |
),
|
667 |
),
|
668 |
-
'permalink'
|
669 |
'context' => array( 'view', 'edit', 'embed' ),
|
670 |
'description' => __( 'The permalink of the blog.', 'buddypress' ),
|
671 |
'readonly' => true,
|
672 |
'type' => 'string',
|
673 |
'format' => 'uri',
|
674 |
),
|
675 |
-
'description'
|
676 |
'context' => array( 'view', 'edit', 'embed' ),
|
677 |
'description' => __( 'The description of the blog.', 'buddypress' ),
|
678 |
'type' => 'object',
|
@@ -694,25 +695,33 @@ class BP_REST_Blogs_Endpoint extends WP_REST_Controller {
|
|
694 |
),
|
695 |
),
|
696 |
),
|
697 |
-
'path'
|
698 |
'context' => array( 'view', 'edit', 'embed' ),
|
699 |
'description' => __( 'The path of the blog.', 'buddypress' ),
|
700 |
'readonly' => true,
|
701 |
'type' => 'string',
|
702 |
),
|
703 |
-
'domain'
|
704 |
'context' => array( 'view', 'edit', 'embed' ),
|
705 |
'description' => __( 'The domain of the blog.', 'buddypress' ),
|
706 |
'readonly' => true,
|
707 |
'type' => 'string',
|
708 |
),
|
709 |
-
'last_activity'
|
710 |
'context' => array( 'view', 'edit', 'embed' ),
|
711 |
-
'description' => __(
|
712 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
'format' => 'date-time',
|
714 |
),
|
715 |
-
'lastest_post_id'
|
716 |
'context' => array( 'view', 'edit', 'embed' ),
|
717 |
'description' => __( 'The latest post ID from the blog', 'buddypress' ),
|
718 |
'type' => 'integer',
|
403 |
*/
|
404 |
public function prepare_item_for_response( $blog, $request ) {
|
405 |
$data = array(
|
406 |
+
'id' => absint( $blog->blog_id ),
|
407 |
+
'user_id' => absint( $blog->admin_user_id ),
|
408 |
+
'name' => apply_filters( 'bp_get_blog_name', $blog->name ),
|
409 |
+
'domain' => (string) $blog->domain,
|
410 |
+
'path' => (string) $blog->path,
|
411 |
+
'permalink' => $this->get_blog_permalink( $blog ),
|
412 |
+
'last_activity' => bp_rest_prepare_date_response( $blog->last_activity, get_date_from_gmt( $blog->last_activity ) ),
|
413 |
+
'last_activity_gmt' => bp_rest_prepare_date_response( $blog->last_activity ),
|
414 |
+
'lastest_post_id' => 0,
|
415 |
+
'description' => array(
|
416 |
'raw' => $blog->description,
|
417 |
'rendered' => apply_filters( 'bp_get_blog_description', $blog->description ),
|
418 |
),
|
|
|
|
|
419 |
);
|
420 |
|
421 |
if ( ! empty( $blog->latest_post->ID ) ) {
|
427 |
$data['avatar_urls'] = array(
|
428 |
'thumb' => bp_get_blog_avatar(
|
429 |
array(
|
430 |
+
'type' => 'thumb',
|
431 |
+
'blog_id' => $blog->blog_id,
|
432 |
+
'html' => false,
|
433 |
)
|
434 |
),
|
435 |
'full' => bp_get_blog_avatar(
|
436 |
array(
|
437 |
+
'type' => 'full',
|
438 |
+
'blog_id' => $blog->blog_id,
|
439 |
+
'html' => false,
|
440 |
)
|
441 |
),
|
442 |
);
|
518 |
* @param stdClass $blog Blog object.
|
519 |
* @return string
|
520 |
*/
|
521 |
+
protected function get_blog_permalink( $blog ) {
|
522 |
|
523 |
// Bail early.
|
524 |
if ( empty( $blog->domain ) && empty( $blog->path ) ) {
|
645 |
'title' => 'bp_blogs',
|
646 |
'type' => 'object',
|
647 |
'properties' => array(
|
648 |
+
'id' => array(
|
649 |
'context' => array( 'view', 'edit', 'embed' ),
|
650 |
'description' => __( 'A unique numeric ID for the blog.', 'buddypress' ),
|
651 |
'readonly' => true,
|
652 |
'type' => 'integer',
|
653 |
),
|
654 |
+
'user_id' => array(
|
655 |
'context' => array( 'view', 'edit', 'embed' ),
|
656 |
'description' => __( 'A unique numeric ID for the blog admin.', 'buddypress' ),
|
657 |
'readonly' => true,
|
658 |
'type' => 'integer',
|
659 |
),
|
660 |
+
'name' => array(
|
661 |
'context' => array( 'view', 'edit', 'embed' ),
|
662 |
'description' => __( 'The name of the blog.', 'buddypress' ),
|
663 |
'readonly' => true,
|
666 |
'sanitize_callback' => 'sanitize_text_field',
|
667 |
),
|
668 |
),
|
669 |
+
'permalink' => array(
|
670 |
'context' => array( 'view', 'edit', 'embed' ),
|
671 |
'description' => __( 'The permalink of the blog.', 'buddypress' ),
|
672 |
'readonly' => true,
|
673 |
'type' => 'string',
|
674 |
'format' => 'uri',
|
675 |
),
|
676 |
+
'description' => array(
|
677 |
'context' => array( 'view', 'edit', 'embed' ),
|
678 |
'description' => __( 'The description of the blog.', 'buddypress' ),
|
679 |
'type' => 'object',
|
695 |
),
|
696 |
),
|
697 |
),
|
698 |
+
'path' => array(
|
699 |
'context' => array( 'view', 'edit', 'embed' ),
|
700 |
'description' => __( 'The path of the blog.', 'buddypress' ),
|
701 |
'readonly' => true,
|
702 |
'type' => 'string',
|
703 |
),
|
704 |
+
'domain' => array(
|
705 |
'context' => array( 'view', 'edit', 'embed' ),
|
706 |
'description' => __( 'The domain of the blog.', 'buddypress' ),
|
707 |
'readonly' => true,
|
708 |
'type' => 'string',
|
709 |
),
|
710 |
+
'last_activity' => array(
|
711 |
'context' => array( 'view', 'edit', 'embed' ),
|
712 |
+
'description' => __( 'The date of the last activity from the blog, in the site\'s timezone.', 'buddypress' ),
|
713 |
+
'readonly' => true,
|
714 |
+
'type' => array( 'string', 'null' ),
|
715 |
+
'format' => 'date-time',
|
716 |
+
),
|
717 |
+
'last_activity_gmt' => array(
|
718 |
+
'context' => array( 'view', 'edit' ),
|
719 |
+
'description' => __( 'The date of the last activity from the blog, as GMT.', 'buddypress' ),
|
720 |
+
'readonly' => true,
|
721 |
+
'type' => array( 'string', 'null' ),
|
722 |
'format' => 'date-time',
|
723 |
),
|
724 |
+
'lastest_post_id' => array(
|
725 |
'context' => array( 'view', 'edit', 'embed' ),
|
726 |
'description' => __( 'The latest post ID from the blog', 'buddypress' ),
|
727 |
'type' => 'integer',
|
@@ -1,8 +1,8 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Pfcj":[function(require,module,exports) {
|
2 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
3 |
},{}],"D8sC":[function(require,module,exports) {
|
4 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
5 |
},{}],"PMBS":[function(require,module,exports) {
|
6 |
-
"use strict";var e=s(require("./recent-posts/edit")),t=s(require("./recent-posts/transforms"));function s(e){return e&&e.__esModule?e:{default:e}}
|
7 |
},{"./recent-posts/edit":"Pfcj","./recent-posts/transforms":"D8sC"}]},{},["PMBS"], null)
|
8 |
//# sourceMappingURL=/bp-blogs/js/blocks/recent-posts.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Pfcj":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blockEditor:{InspectorControls:e},components:{Disabled:t,PanelBody:l,RangeControl:o,TextControl:s,ToggleControl:n},element:{Fragment:r,createElement:i},i18n:{__:a},serverSideRender:d}=wp,u=({attributes:u,setAttributes:b})=>{const{title:p,maxPosts:c,linkTitle:g}=u;return i(r,null,i(e,null,i(l,{title:a("Settings","buddypress"),initialOpen:!0},i(s,{label:a("Title","buddypress"),value:p,onChange:e=>{b({title:e})}}),i(o,{label:a("Max posts to show","buddypress"),value:c,onChange:e=>b({maxPosts:e}),min:1,max:10,required:!0}),i(n,{label:a("Link block title to Blogs directory","buddypress"),checked:!!g,onChange:()=>{b({linkTitle:!g})}}))),i(t,null,i(d,{block:"bp/recent-posts",attributes:u})))};var b=u;exports.default=b;
|
3 |
},{}],"D8sC":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blocks:{createBlock:e}}=wp,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!(null==t||!t.raw)&&"bp_blogs_recent_posts_widget"===e,transform:({instance:t})=>e("bp/recent-posts",{title:t.raw.title,maxPosts:t.raw.max_posts,linkTitle:t.raw.link_title})}]};var s=t;exports.default=s;
|
5 |
},{}],"PMBS":[function(require,module,exports) {
|
6 |
+
"use strict";var e=s(require("./recent-posts/edit")),t=s(require("./recent-posts/transforms"));function s(e){return e&&e.__esModule?e:{default:e}}const{blocks:{registerBlockType:r},i18n:{__:o}}=wp;r("bp/recent-posts",{title:o("Recent Networkwide Posts","buddypress"),description:o("A list of recently published posts from across your network.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"wordpress"},category:"buddypress",attributes:{title:{type:"string",default:o("Recent Networkwide Posts","buddypress")},maxPosts:{type:"number",default:10},linkTitle:{type:"boolean",default:!1}},edit:e.default,transforms:t.default});
|
7 |
},{"./recent-posts/edit":"Pfcj","./recent-posts/transforms":"D8sC"}]},{},["PMBS"], null)
|
8 |
//# sourceMappingURL=/bp-blogs/js/blocks/recent-posts.js.map
|
@@ -59,6 +59,9 @@ add_action( 'bp_admin_init', 'bp_do_activation_redirect', 1 );
|
|
59 |
// Add a new separator.
|
60 |
add_action( 'bp_admin_menu', 'bp_admin_separator' );
|
61 |
|
|
|
|
|
|
|
62 |
/**
|
63 |
* When a new site is created in a multisite installation, run the activation
|
64 |
* routine on that site.
|
@@ -234,3 +237,33 @@ function bp_register_admin_settings() {
|
|
234 |
*/
|
235 |
do_action( 'bp_register_admin_settings' );
|
236 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
// Add a new separator.
|
60 |
add_action( 'bp_admin_menu', 'bp_admin_separator' );
|
61 |
|
62 |
+
// Add a filter to include BP Components directory pages display states.
|
63 |
+
add_filter( 'display_post_states', 'bp_admin_display_directory_states', 10, 2 );
|
64 |
+
|
65 |
/**
|
66 |
* When a new site is created in a multisite installation, run the activation
|
67 |
* routine on that site.
|
237 |
*/
|
238 |
do_action( 'bp_register_admin_settings' );
|
239 |
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Dedicated filter to inform about BP components directory page states.
|
243 |
+
*
|
244 |
+
* @since 10.0.0
|
245 |
+
*
|
246 |
+
* @param string[] $post_states An array of post display states.
|
247 |
+
* @param WP_Post $post The current post object.
|
248 |
+
*/
|
249 |
+
function bp_admin_display_directory_states( $post_states = array(), $post = null ) {
|
250 |
+
/**
|
251 |
+
* Filter here to add BP Directory pages.
|
252 |
+
*
|
253 |
+
* Used internaly by BP_Component->admin_directory_states(). Please use the dynamic
|
254 |
+
* filter in BP_Component->admin_directory_states() to edit the directory state
|
255 |
+
* according to the component's ID.
|
256 |
+
*
|
257 |
+
* @since 10.0.0
|
258 |
+
*
|
259 |
+
* @param array $value An empty array.
|
260 |
+
* @param WP_Post $post The current post object.
|
261 |
+
*/
|
262 |
+
$directory_page_states = apply_filters( 'bp_admin_display_directory_states', array(), $post );
|
263 |
+
|
264 |
+
if ( $directory_page_states ) {
|
265 |
+
$post_states = array_merge( $post_states, $directory_page_states );
|
266 |
+
}
|
267 |
+
|
268 |
+
return $post_states;
|
269 |
+
}
|
@@ -17,14 +17,11 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
*
|
18 |
*/
|
19 |
function bp_core_admin_components_settings() {
|
20 |
-
|
21 |
-
|
22 |
-
<div class="wrap">
|
23 |
|
24 |
-
|
25 |
-
<hr class="wp-header-end">
|
26 |
|
27 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Components', 'buddypress' ) ); ?></h2>
|
28 |
<form action="" method="post" id="bp-admin-component-form">
|
29 |
|
30 |
<?php bp_core_admin_components_options(); ?>
|
17 |
*
|
18 |
*/
|
19 |
function bp_core_admin_components_settings() {
|
20 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Components', 'buddypress' ) );
|
21 |
+
?>
|
|
|
22 |
|
23 |
+
<div class="buddypress-body">
|
|
|
24 |
|
|
|
25 |
<form action="" method="post" id="bp-admin-component-form">
|
26 |
|
27 |
<?php bp_core_admin_components_options(); ?>
|
@@ -284,7 +284,7 @@ function bp_core_activation_notice() {
|
|
284 |
|
285 |
// Activate and Register are special cases. They are not components but they need WP pages.
|
286 |
// If user registration is disabled, we can skip this step.
|
287 |
-
if (
|
288 |
$wp_page_components[] = array(
|
289 |
'id' => 'activate',
|
290 |
'name' => __( 'Activate', 'buddypress' ),
|
@@ -390,6 +390,53 @@ function bp_do_activation_redirect() {
|
|
390 |
|
391 |
/** UI/Styling ****************************************************************/
|
392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
/**
|
394 |
* Output the tabs in the admin area.
|
395 |
*
|
@@ -400,10 +447,10 @@ function bp_do_activation_redirect() {
|
|
400 |
* @param string $context The context of use for the tabs. Defaults to 'settings'.
|
401 |
* Possible values are 'settings' & 'tools'.
|
402 |
*/
|
403 |
-
function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) {
|
404 |
$tabs_html = '';
|
405 |
-
$idle_class = 'nav-tab';
|
406 |
-
$active_class = 'nav-tab
|
407 |
|
408 |
/**
|
409 |
* Filters the admin tabs to be displayed.
|
@@ -412,26 +459,123 @@ function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) {
|
|
412 |
*
|
413 |
* @param array $value Array of tabs to output to the admin area.
|
414 |
*/
|
415 |
-
$tabs
|
|
|
416 |
|
417 |
// Loop through tabs and build navigation.
|
418 |
foreach ( array_values( $tabs ) as $tab_data ) {
|
419 |
-
$is_current
|
420 |
-
$tab_class
|
421 |
-
$tabs_html
|
422 |
}
|
423 |
|
424 |
-
echo
|
|
|
|
|
425 |
|
|
|
426 |
/**
|
427 |
* Fires after the output of tabs for the admin area.
|
428 |
*
|
429 |
* @since 1.5.0
|
430 |
* @since 8.0.0 Adds the `$context` parameter.
|
|
|
431 |
*
|
432 |
* @param string $context The context of use for the tabs.
|
433 |
*/
|
434 |
-
do_action( 'bp_admin_tabs', $context );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
}
|
436 |
|
437 |
/**
|
@@ -449,44 +593,9 @@ function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) {
|
|
449 |
$tabs = array();
|
450 |
|
451 |
if ( 'settings' === $context ) {
|
452 |
-
$tabs =
|
453 |
-
'0' => array(
|
454 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
|
455 |
-
'name' => __( 'Components', 'buddypress' ),
|
456 |
-
),
|
457 |
-
'2' => array(
|
458 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
|
459 |
-
'name' => __( 'Options', 'buddypress' ),
|
460 |
-
),
|
461 |
-
'1' => array(
|
462 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
|
463 |
-
'name' => __( 'Pages', 'buddypress' ),
|
464 |
-
),
|
465 |
-
'3' => array(
|
466 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ),
|
467 |
-
'name' => __( 'Credits', 'buddypress' ),
|
468 |
-
),
|
469 |
-
);
|
470 |
} elseif ( 'tools' === $context ) {
|
471 |
-
$
|
472 |
-
if ( bp_core_do_network_admin() ) {
|
473 |
-
$tools_page = 'admin.php';
|
474 |
-
}
|
475 |
-
|
476 |
-
$tabs = array(
|
477 |
-
'0' => array(
|
478 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ),
|
479 |
-
'name' => __( 'Repair', 'buddypress' ),
|
480 |
-
),
|
481 |
-
'1' => array(
|
482 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-members-invitations' ), $tools_page ) ),
|
483 |
-
'name' => __( 'Manage Invitations', 'buddypress' ),
|
484 |
-
),
|
485 |
-
'2' => array(
|
486 |
-
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-optouts' ), $tools_page ) ),
|
487 |
-
'name' => __( 'Manage Opt-outs', 'buddypress' ),
|
488 |
-
),
|
489 |
-
);
|
490 |
}
|
491 |
|
492 |
/**
|
@@ -501,6 +610,43 @@ function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) {
|
|
501 |
return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context );
|
502 |
}
|
503 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
/** Help **********************************************************************/
|
505 |
|
506 |
/**
|
@@ -1270,17 +1416,30 @@ function bp_core_admin_notice_dismiss_callback() {
|
|
1270 |
wp_send_json_error();
|
1271 |
}
|
1272 |
|
1273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1274 |
wp_send_json_error();
|
1275 |
}
|
1276 |
|
1277 |
$notice_id = wp_unslash( $_POST['notice_id'] );
|
|
|
|
|
|
|
1278 |
|
1279 |
-
if ( ! wp_verify_nonce( $
|
1280 |
wp_send_json_error();
|
1281 |
}
|
1282 |
|
1283 |
-
bp_update_option( "bp-dismissed-notice
|
1284 |
|
1285 |
wp_send_json_success();
|
1286 |
}
|
@@ -1291,12 +1450,19 @@ add_action( 'wp_ajax_bp_dismiss_notice', 'bp_core_admin_notice_dismiss_callback'
|
|
1291 |
*
|
1292 |
* @since 2.8.0
|
1293 |
*
|
1294 |
-
* @param string $classes CSS classes for the body tag in the admin, a
|
1295 |
*
|
1296 |
* @return string
|
1297 |
*/
|
1298 |
function bp_core_admin_body_classes( $classes ) {
|
1299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1300 |
}
|
1301 |
add_filter( 'admin_body_class', 'bp_core_admin_body_classes' );
|
1302 |
|
284 |
|
285 |
// Activate and Register are special cases. They are not components but they need WP pages.
|
286 |
// If user registration is disabled, we can skip this step.
|
287 |
+
if ( bp_allow_access_to_registration_pages() ) {
|
288 |
$wp_page_components[] = array(
|
289 |
'id' => 'activate',
|
290 |
'name' => __( 'Activate', 'buddypress' ),
|
390 |
|
391 |
/** UI/Styling ****************************************************************/
|
392 |
|
393 |
+
/**
|
394 |
+
* Outputs the BP Admin Tabbed header.
|
395 |
+
*
|
396 |
+
* @since 10.0.0
|
397 |
+
*
|
398 |
+
* @param string $title The title of the Admin page.
|
399 |
+
* @param string $active_tab The current displayed tab.
|
400 |
+
* @param string $context The context of use for the tabs. Defaults to 'settings'.
|
401 |
+
* Possible values are 'settings' & 'tools'.
|
402 |
+
*/
|
403 |
+
function bp_core_admin_tabbed_screen_header( $title = '', $active_tab = '', $context = 'settings' ) {
|
404 |
+
$bp = buddypress();
|
405 |
+
|
406 |
+
// Globalize the active tab for backcompat purpose.
|
407 |
+
$bp->admin->active_nav_tab = $active_tab;
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Fires before the output of the BP Admin tabbed screen header.
|
411 |
+
*
|
412 |
+
* @since 10.0.0
|
413 |
+
*
|
414 |
+
* @param string $active_tab The BP Admin active tab.
|
415 |
+
* @param string $context The context of use for the tabs.
|
416 |
+
*/
|
417 |
+
do_action( 'bp_core_admin_tabbed_screen_header', $active_tab, $context );
|
418 |
+
?>
|
419 |
+
<div class="buddypress-header">
|
420 |
+
<div class="buddypress-title-section">
|
421 |
+
<h1><span class="bp-badge"></span> <?php echo esc_html( $title ); ?></h1>
|
422 |
+
</div>
|
423 |
+
<nav class="buddypress-tabs-wrapper">
|
424 |
+
<?php if ( isset( $bp->admin->nav_tabs ) ) : ?>
|
425 |
+
<?php foreach ( $bp->admin->nav_tabs as $nav_tab ) : ?>
|
426 |
+
|
427 |
+
<?php echo $nav_tab; ?>
|
428 |
+
|
429 |
+
<?php endforeach; ?>
|
430 |
+
<?php else : ?>
|
431 |
+
<?php bp_core_admin_tabs( esc_html( $active_tab ), $context ); ?>
|
432 |
+
<?php endif; ?>
|
433 |
+
</nav>
|
434 |
+
</div>
|
435 |
+
|
436 |
+
<hr class="wp-header-end">
|
437 |
+
<?php
|
438 |
+
}
|
439 |
+
|
440 |
/**
|
441 |
* Output the tabs in the admin area.
|
442 |
*
|
447 |
* @param string $context The context of use for the tabs. Defaults to 'settings'.
|
448 |
* Possible values are 'settings' & 'tools'.
|
449 |
*/
|
450 |
+
function bp_core_admin_tabs( $active_tab = '', $context = 'settings', $echo = true ) {
|
451 |
$tabs_html = '';
|
452 |
+
$idle_class = 'buddypress-nav-tab';
|
453 |
+
$active_class = 'buddypress-nav-tab active';
|
454 |
|
455 |
/**
|
456 |
* Filters the admin tabs to be displayed.
|
459 |
*
|
460 |
* @param array $value Array of tabs to output to the admin area.
|
461 |
*/
|
462 |
+
$tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) );
|
463 |
+
$tabs_html = array();
|
464 |
|
465 |
// Loop through tabs and build navigation.
|
466 |
foreach ( array_values( $tabs ) as $tab_data ) {
|
467 |
+
$is_current = (bool) ( $tab_data['name'] == $active_tab );
|
468 |
+
$tab_class = $is_current ? $active_class : $idle_class;
|
469 |
+
$tabs_html[] = '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>';
|
470 |
}
|
471 |
|
472 |
+
if ( ! $echo ) {
|
473 |
+
return $tabs_html;
|
474 |
+
}
|
475 |
|
476 |
+
echo implode( "\n", $tabs_html );
|
477 |
/**
|
478 |
* Fires after the output of tabs for the admin area.
|
479 |
*
|
480 |
* @since 1.5.0
|
481 |
* @since 8.0.0 Adds the `$context` parameter.
|
482 |
+
* @since 10.0.0 Adds the `$active_tab` parameter.
|
483 |
*
|
484 |
* @param string $context The context of use for the tabs.
|
485 |
*/
|
486 |
+
do_action( 'bp_admin_tabs', $context, $active_tab );
|
487 |
+
}
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Returns the BP Admin settings tabs.
|
491 |
+
*
|
492 |
+
* @since 10.0.0
|
493 |
+
*
|
494 |
+
* @param bool $apply_filters Whether to apply filters or not.
|
495 |
+
* @return array The BP Admin settings tabs.
|
496 |
+
*/
|
497 |
+
function bp_core_get_admin_settings_tabs( $apply_filters = true ) {
|
498 |
+
$settings_tabs = array(
|
499 |
+
'0' => array(
|
500 |
+
'id' => 'bp-components',
|
501 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
|
502 |
+
'name' => __( 'Components', 'buddypress' ),
|
503 |
+
),
|
504 |
+
'2' => array(
|
505 |
+
'id' => 'bp-settings',
|
506 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
|
507 |
+
'name' => __( 'Options', 'buddypress' ),
|
508 |
+
),
|
509 |
+
'1' => array(
|
510 |
+
'id' => 'bp-page-settings',
|
511 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
|
512 |
+
'name' => __( 'Pages', 'buddypress' ),
|
513 |
+
),
|
514 |
+
'3' => array(
|
515 |
+
'id' => 'bp-credits',
|
516 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ),
|
517 |
+
'name' => __( 'Credits', 'buddypress' ),
|
518 |
+
),
|
519 |
+
);
|
520 |
+
|
521 |
+
if ( ! $apply_filters ) {
|
522 |
+
return $settings_tabs;
|
523 |
+
}
|
524 |
+
|
525 |
+
/**
|
526 |
+
* Filter here to edit the BP Admin settings tabs.
|
527 |
+
*
|
528 |
+
* @since 10.0.0
|
529 |
+
*
|
530 |
+
* @param array $settings_tabs The BP Admin settings tabs.
|
531 |
+
*/
|
532 |
+
return apply_filters( 'bp_core_get_admin_settings_tabs', $settings_tabs );
|
533 |
+
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Returns the BP Admin tools tabs.
|
537 |
+
*
|
538 |
+
* @since 10.0.0
|
539 |
+
*
|
540 |
+
* @param bool $apply_filters Whether to apply filters or not.
|
541 |
+
* @return array The BP Admin tools tabs.
|
542 |
+
*/
|
543 |
+
function bp_core_get_admin_tools_tabs( $apply_filters = true ) {
|
544 |
+
$tools_page = 'tools.php';
|
545 |
+
if ( bp_core_do_network_admin() ) {
|
546 |
+
$tools_page = 'admin.php';
|
547 |
+
}
|
548 |
+
|
549 |
+
$tools_tabs = array(
|
550 |
+
'0' => array(
|
551 |
+
'id' => 'bp-tools',
|
552 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ),
|
553 |
+
'name' => __( 'Repair', 'buddypress' ),
|
554 |
+
),
|
555 |
+
'1' => array(
|
556 |
+
'id' => 'bp-members-invitations',
|
557 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-members-invitations' ), $tools_page ) ),
|
558 |
+
'name' => __( 'Manage Invitations', 'buddypress' ),
|
559 |
+
),
|
560 |
+
'2' => array(
|
561 |
+
'id' => 'bp-optouts',
|
562 |
+
'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-optouts' ), $tools_page ) ),
|
563 |
+
'name' => __( 'Manage Opt-outs', 'buddypress' ),
|
564 |
+
),
|
565 |
+
);
|
566 |
+
|
567 |
+
if ( ! $apply_filters ) {
|
568 |
+
return $tools_tabs;
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Filter here to edit the BP Admin tools tabs.
|
573 |
+
*
|
574 |
+
* @since 10.0.0
|
575 |
+
*
|
576 |
+
* @param array $tools_tabs The BP Admin tools tabs.
|
577 |
+
*/
|
578 |
+
return apply_filters( 'bp_core_get_admin_tools_tabs', $tools_tabs );
|
579 |
}
|
580 |
|
581 |
/**
|
593 |
$tabs = array();
|
594 |
|
595 |
if ( 'settings' === $context ) {
|
596 |
+
$tabs = bp_core_get_admin_settings_tabs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
} elseif ( 'tools' === $context ) {
|
598 |
+
$tabs = bp_core_get_admin_tools_tabs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
}
|
600 |
|
601 |
/**
|
610 |
return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context );
|
611 |
}
|
612 |
|
613 |
+
/**
|
614 |
+
* Makes sure plugins using `bp_core_admin_tabs()` to output their custom BP Admin Tabs are well displayed
|
615 |
+
* inside the 10.0.0 tabbed header.
|
616 |
+
*
|
617 |
+
* @since 10.0.0
|
618 |
+
*
|
619 |
+
* @param string $context The context of use for the tabs.
|
620 |
+
* @param string $active_tab The active tab.
|
621 |
+
*/
|
622 |
+
function bp_backcompat_admin_tabs( $context = '', $active_tab = '' ) {
|
623 |
+
$bp = buddypress();
|
624 |
+
|
625 |
+
// Only add the back compat for Settings or Tools sub pages.
|
626 |
+
if ( 'settings' !== $context && 'tools' !== $context ) {
|
627 |
+
return;
|
628 |
+
}
|
629 |
+
|
630 |
+
// Globalize the active tab for backcompat purpose.
|
631 |
+
if ( ! $bp->admin->active_nav_tab || $active_tab !== $bp->admin->active_nav_tab ) {
|
632 |
+
_doing_it_wrong(
|
633 |
+
'bp_core_admin_tabs()',
|
634 |
+
__( 'BuddyPress Settings and Tools Screens are now using a new tabbed header. Please use `bp_core_admin_tabbed_screen_header()` instead of bp_core_admin_tabs() to output tabs.', 'buddypress' ),
|
635 |
+
'10.0.0'
|
636 |
+
);
|
637 |
+
|
638 |
+
// Let's try to use JavaScript to force the use of the 10.0.0 Admin tabbed screen header.
|
639 |
+
wp_enqueue_script(
|
640 |
+
'bp-backcompat-admin-tabs',
|
641 |
+
sprintf( '%1$sbackcompat-admin-tabs%2$s.js', $bp->admin->js_url, bp_core_get_minified_asset_suffix() ),
|
642 |
+
array(),
|
643 |
+
bp_get_version(),
|
644 |
+
true
|
645 |
+
);
|
646 |
+
}
|
647 |
+
}
|
648 |
+
add_action( 'bp_admin_tabs', 'bp_backcompat_admin_tabs', 1, 2 );
|
649 |
+
|
650 |
/** Help **********************************************************************/
|
651 |
|
652 |
/**
|
1416 |
wp_send_json_error();
|
1417 |
}
|
1418 |
|
1419 |
+
$nonce_data = array();
|
1420 |
+
if ( isset( $_SERVER['HTTP_X_BP_NONCE'] ) ) {
|
1421 |
+
$nonce_data = array(
|
1422 |
+
'nonce' => $_SERVER['HTTP_X_BP_NONCE'],
|
1423 |
+
'action' => 'bp_dismiss_admin_notice',
|
1424 |
+
);
|
1425 |
+
} elseif ( isset( $_POST['nonce'] ) ) {
|
1426 |
+
$nonce_data['nonce'] = $_POST['nonce'];
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
if ( empty( $nonce_data['nonce'] ) || empty( $_POST['notice_id'] ) ) {
|
1430 |
wp_send_json_error();
|
1431 |
}
|
1432 |
|
1433 |
$notice_id = wp_unslash( $_POST['notice_id'] );
|
1434 |
+
if ( ! isset( $nonce_data['action'] ) ) {
|
1435 |
+
$nonce_data['action'] = 'bp-dismissible-notice-' . $notice_id;
|
1436 |
+
}
|
1437 |
|
1438 |
+
if ( ! wp_verify_nonce( $nonce_data['nonce'], $nonce_data['action'] ) ) {
|
1439 |
wp_send_json_error();
|
1440 |
}
|
1441 |
|
1442 |
+
bp_update_option( "bp-dismissed-notice-{$notice_id}", true );
|
1443 |
|
1444 |
wp_send_json_success();
|
1445 |
}
|
1450 |
*
|
1451 |
* @since 2.8.0
|
1452 |
*
|
1453 |
+
* @param string $classes CSS classes for the body tag in the admin, a space separated string.
|
1454 |
*
|
1455 |
* @return string
|
1456 |
*/
|
1457 |
function bp_core_admin_body_classes( $classes ) {
|
1458 |
+
$bp = buddypress();
|
1459 |
+
|
1460 |
+
$bp_class = ' buddypress';
|
1461 |
+
if ( isset( $bp->admin->nav_tabs ) && $bp->admin->nav_tabs ) {
|
1462 |
+
$bp_class .= ' bp-is-tabbed-screen';
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
return $classes . $bp_class;
|
1466 |
}
|
1467 |
add_filter( 'admin_body_class', 'bp_core_admin_body_classes' );
|
1468 |
|
@@ -316,14 +316,10 @@ function bp_core_optouts_admin_index() {
|
|
316 |
$_SERVER['REQUEST_URI']
|
317 |
);
|
318 |
|
|
|
319 |
?>
|
320 |
|
321 |
-
<div class="
|
322 |
-
<h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1>
|
323 |
-
<hr class="wp-header-end">
|
324 |
-
|
325 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?></h2>
|
326 |
-
|
327 |
<?php
|
328 |
if ( $usersearch ) {
|
329 |
$num_results = (int) $bp_optouts_list_table->total_items;
|
@@ -425,13 +421,10 @@ function bp_core_optouts_admin_manage( $action = '' ) {
|
|
425 |
'optouts_' . $action
|
426 |
);
|
427 |
|
|
|
428 |
?>
|
429 |
|
430 |
-
<div class="
|
431 |
-
<h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1>
|
432 |
-
<hr class="wp-header-end">
|
433 |
-
|
434 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?></h2>
|
435 |
|
436 |
<p><?php echo esc_html( $helper_text ); ?></p>
|
437 |
|
316 |
$_SERVER['REQUEST_URI']
|
317 |
);
|
318 |
|
319 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' );
|
320 |
?>
|
321 |
|
322 |
+
<div class="buddypress-body">
|
|
|
|
|
|
|
|
|
|
|
323 |
<?php
|
324 |
if ( $usersearch ) {
|
325 |
$num_results = (int) $bp_optouts_list_table->total_items;
|
421 |
'optouts_' . $action
|
422 |
);
|
423 |
|
424 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' );
|
425 |
?>
|
426 |
|
427 |
+
<div class="buddypress-body">
|
|
|
|
|
|
|
|
|
428 |
|
429 |
<p><?php echo esc_html( $helper_text ); ?></p>
|
430 |
|
@@ -524,7 +524,14 @@ function bp_core_install_emails() {
|
|
524 |
continue;
|
525 |
}
|
526 |
|
527 |
-
$post_id = wp_insert_post(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
if ( ! $post_id ) {
|
529 |
continue;
|
530 |
}
|
524 |
continue;
|
525 |
}
|
526 |
|
527 |
+
$post_id = wp_insert_post(
|
528 |
+
bp_parse_args(
|
529 |
+
$email,
|
530 |
+
$defaults,
|
531 |
+
'install_email_' . $id
|
532 |
+
)
|
533 |
+
);
|
534 |
+
|
535 |
if ( ! $post_id ) {
|
536 |
continue;
|
537 |
}
|
@@ -192,7 +192,7 @@ function bp_admin_setting_callback_members_invitations() {
|
|
192 |
<input id="bp-enable-members-invitations" name="bp-enable-members-invitations" type="checkbox" value="1" <?php checked( bp_get_members_invitations_allowed() ); ?> />
|
193 |
<label for="bp-enable-members-invitations"><?php _e( 'Allow registered members to invite people to join this network', 'buddypress' ); ?></label>
|
194 |
<?php if ( ! bp_get_signup_allowed() ) : ?>
|
195 |
-
<p class="description"><?php
|
196 |
<?php endif; ?>
|
197 |
<?php
|
198 |
/**
|
@@ -203,6 +203,36 @@ function bp_admin_setting_callback_members_invitations() {
|
|
203 |
do_action( 'bp_admin_settings_after_members_invitations' );
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
/** XProfile ******************************************************************/
|
207 |
|
208 |
/**
|
@@ -288,16 +318,10 @@ function bp_core_admin_settings() {
|
|
288 |
|
289 |
// We're saving our own options, until the WP Settings API is updated to work with Multisite.
|
290 |
$form_action = add_query_arg( 'page', 'bp-settings', bp_get_admin_url( 'admin.php' ) );
|
291 |
-
|
292 |
?>
|
293 |
|
294 |
-
<div class="
|
295 |
-
|
296 |
-
<h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?></h1>
|
297 |
-
<hr class="wp-header-end">
|
298 |
-
|
299 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Options', 'buddypress' ) ); ?></h2>
|
300 |
-
|
301 |
<form action="<?php echo esc_url( $form_action ) ?>" method="post">
|
302 |
|
303 |
<?php settings_fields( 'buddypress' ); ?>
|
192 |
<input id="bp-enable-members-invitations" name="bp-enable-members-invitations" type="checkbox" value="1" <?php checked( bp_get_members_invitations_allowed() ); ?> />
|
193 |
<label for="bp-enable-members-invitations"><?php _e( 'Allow registered members to invite people to join this network', 'buddypress' ); ?></label>
|
194 |
<?php if ( ! bp_get_signup_allowed() ) : ?>
|
195 |
+
<p class="description"><?php esc_html_e( 'Public registration is currently disabled. However, invitees will still be able to register if network invitations are enabled.', 'buddypress' ); ?></p>
|
196 |
<?php endif; ?>
|
197 |
<?php
|
198 |
/**
|
203 |
do_action( 'bp_admin_settings_after_members_invitations' );
|
204 |
}
|
205 |
|
206 |
+
/**
|
207 |
+
* Allow new users to request membership to the network.
|
208 |
+
*
|
209 |
+
* @since 10.0.0
|
210 |
+
*/
|
211 |
+
function bp_admin_setting_callback_membership_requests() {
|
212 |
+
?>
|
213 |
+
<input id="bp-enable-membership-requests" name="bp-enable-membership-requests" type="checkbox" value="1" <?php checked( bp_get_membership_requests_required( 'raw' ) ); ?> <?php disabled( bp_get_signup_allowed() ); ?> />
|
214 |
+
<label for="bp-enable-membership-requests"><?php esc_html_e( 'Allow visitors to request site membership. If enabled, an administrator must approve each new site membership request.', 'buddypress' ); ?></label>
|
215 |
+
<?php if ( bp_get_signup_allowed() ) : ?>
|
216 |
+
<?php if ( is_multisite() ) : ?>
|
217 |
+
<p class="description"><?php esc_html_e( 'With a WP multisite setup, to require membership requests for new signups, choose one of the following two options from the Network Settings > Registration Settings pane:', 'buddypress' ); ?><p>
|
218 |
+
<ul>
|
219 |
+
<li><p class="description"><?php esc_html_e( 'To allow the submission of membership requests but not allow site creation requests, select "Registration is disabled".', 'buddypress' ) ?></p></li>
|
220 |
+
<li><p class="description"><?php esc_html_e( 'To allow the submission of membership requests and to allow new sites to be created by your users, choose "Logged in users may register new sites".', 'buddypress' ) ?></p></li>
|
221 |
+
</ul>
|
222 |
+
<p class="description"><?php esc_html_e( 'The other two options, "User accounts may be registered" and "Both sites and user accounts can be registered," are open in nature and membership requests will not be enabled if one of those options is selected.', 'buddypress' ); ?><p>
|
223 |
+
<?php else : ?>
|
224 |
+
<p class="description"><?php esc_html_e( 'Public registration is currently enabled. If you wish to require approval for new memberships, disable public registration and enable the membership requests feature.', 'buddypress' ); ?></p>
|
225 |
+
<?php endif; ?>
|
226 |
+
<?php endif; ?>
|
227 |
+
<?php
|
228 |
+
/**
|
229 |
+
* Fires after the output of the membership requests settings section.
|
230 |
+
*
|
231 |
+
* @since 10.0.0
|
232 |
+
*/
|
233 |
+
do_action( 'bp_admin_settings_after_membership_requests' );
|
234 |
+
}
|
235 |
+
|
236 |
/** XProfile ******************************************************************/
|
237 |
|
238 |
/**
|
318 |
|
319 |
// We're saving our own options, until the WP Settings API is updated to work with Multisite.
|
320 |
$form_action = add_query_arg( 'page', 'bp-settings', bp_get_admin_url( 'admin.php' ) );
|
321 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Options', 'buddypress' ) );
|
322 |
?>
|
323 |
|
324 |
+
<div class="buddypress-body">
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
<form action="<?php echo esc_url( $form_action ) ?>" method="post">
|
326 |
|
327 |
<?php settings_fields( 'buddypress' ); ?>
|
@@ -17,14 +17,10 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
* @todo Use settings API
|
18 |
*/
|
19 |
function bp_core_admin_slugs_settings() {
|
|
|
20 |
?>
|
21 |
|
22 |
-
<div class="
|
23 |
-
|
24 |
-
<h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?> </h1>
|
25 |
-
<hr class="wp-header-end">
|
26 |
-
|
27 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Pages', 'buddypress' ) ); ?></h2>
|
28 |
<form action="" method="post" id="bp-admin-page-form">
|
29 |
|
30 |
<?php bp_core_admin_slugs_options(); ?>
|
@@ -183,15 +179,55 @@ function bp_core_admin_slugs_options() {
|
|
183 |
|
184 |
$static_pages = bp_core_admin_get_static_pages();
|
185 |
|
186 |
-
if ( !empty( $static_pages ) ) : ?>
|
187 |
|
188 |
<h3><?php esc_html_e( 'Registration', 'buddypress' ); ?></h3>
|
189 |
|
190 |
-
<?php if (
|
191 |
<p>
|
192 |
<?php esc_html_e( 'Associate WordPress Pages with the following BuddyPress Registration pages.', 'buddypress' ); ?>
|
193 |
<?php esc_html_e( 'These pages will only be reachable by users who are not logged in.', 'buddypress' ); ?>
|
194 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
<?php else : ?>
|
196 |
<?php if ( is_multisite() ) : ?>
|
197 |
<p>
|
@@ -222,49 +258,7 @@ function bp_core_admin_slugs_options() {
|
|
222 |
?>
|
223 |
</p>
|
224 |
<?php endif; ?>
|
225 |
-
<?php endif;
|
226 |
-
|
227 |
-
<table class="form-table">
|
228 |
-
<tbody>
|
229 |
-
|
230 |
-
<?php if ( bp_get_signup_allowed() || bp_get_members_invitations_allowed() ) : foreach ( $static_pages as $name => $label ) : ?>
|
231 |
-
|
232 |
-
<tr valign="top">
|
233 |
-
<th scope="row">
|
234 |
-
<label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
|
235 |
-
</th>
|
236 |
-
|
237 |
-
<td>
|
238 |
-
|
239 |
-
<?php if ( ! bp_is_root_blog() ) switch_to_blog( bp_get_root_blog_id() ); ?>
|
240 |
-
|
241 |
-
<?php echo wp_dropdown_pages( array(
|
242 |
-
'name' => 'bp_pages[' . esc_attr( $name ) . ']',
|
243 |
-
'echo' => false,
|
244 |
-
'show_option_none' => __( '- None -', 'buddypress' ),
|
245 |
-
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
|
246 |
-
) ) ?>
|
247 |
-
|
248 |
-
<?php if ( ! bp_is_root_blog() ) restore_current_blog(); ?>
|
249 |
-
|
250 |
-
</td>
|
251 |
-
</tr>
|
252 |
-
|
253 |
-
<?php endforeach; endif; ?>
|
254 |
-
|
255 |
-
<?php
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Fires after the display of default static pages for BuddyPress setup.
|
259 |
-
*
|
260 |
-
* @since 1.5.0
|
261 |
-
*/
|
262 |
-
do_action( 'bp_active_external_pages' ); ?>
|
263 |
-
|
264 |
-
</tbody>
|
265 |
-
</table>
|
266 |
-
|
267 |
-
<?php
|
268 |
endif;
|
269 |
}
|
270 |
|
17 |
* @todo Use settings API
|
18 |
*/
|
19 |
function bp_core_admin_slugs_settings() {
|
20 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Pages', 'buddypress' ) );
|
21 |
?>
|
22 |
|
23 |
+
<div class="buddypress-body">
|
|
|
|
|
|
|
|
|
|
|
24 |
<form action="" method="post" id="bp-admin-page-form">
|
25 |
|
26 |
<?php bp_core_admin_slugs_options(); ?>
|
179 |
|
180 |
$static_pages = bp_core_admin_get_static_pages();
|
181 |
|
182 |
+
if ( ! empty( $static_pages ) ) : ?>
|
183 |
|
184 |
<h3><?php esc_html_e( 'Registration', 'buddypress' ); ?></h3>
|
185 |
|
186 |
+
<?php if ( bp_allow_access_to_registration_pages() ) : ?>
|
187 |
<p>
|
188 |
<?php esc_html_e( 'Associate WordPress Pages with the following BuddyPress Registration pages.', 'buddypress' ); ?>
|
189 |
<?php esc_html_e( 'These pages will only be reachable by users who are not logged in.', 'buddypress' ); ?>
|
190 |
</p>
|
191 |
+
|
192 |
+
<table class="form-table">
|
193 |
+
<tbody>
|
194 |
+
|
195 |
+
<?php foreach ( $static_pages as $name => $label ) : ?>
|
196 |
+
|
197 |
+
<tr valign="top">
|
198 |
+
<th scope="row">
|
199 |
+
<label for="bp_pages[<?php echo esc_attr( $name ) ?>]"><?php echo esc_html( $label ) ?></label>
|
200 |
+
</th>
|
201 |
+
|
202 |
+
<td>
|
203 |
+
|
204 |
+
<?php if ( ! bp_is_root_blog() ) switch_to_blog( bp_get_root_blog_id() ); ?>
|
205 |
+
|
206 |
+
<?php echo wp_dropdown_pages( array(
|
207 |
+
'name' => 'bp_pages[' . esc_attr( $name ) . ']',
|
208 |
+
'echo' => false,
|
209 |
+
'show_option_none' => __( '- None -', 'buddypress' ),
|
210 |
+
'selected' => !empty( $existing_pages[$name] ) ? $existing_pages[$name] : false
|
211 |
+
) ) ?>
|
212 |
+
|
213 |
+
<?php if ( ! bp_is_root_blog() ) restore_current_blog(); ?>
|
214 |
+
|
215 |
+
</td>
|
216 |
+
</tr>
|
217 |
+
|
218 |
+
<?php endforeach; ?>
|
219 |
+
|
220 |
+
<?php
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Fires after the display of default static pages for BuddyPress setup.
|
224 |
+
*
|
225 |
+
* @since 1.5.0
|
226 |
+
*/
|
227 |
+
do_action( 'bp_active_external_pages' ); ?>
|
228 |
+
|
229 |
+
</tbody>
|
230 |
+
</table>
|
231 |
<?php else : ?>
|
232 |
<?php if ( is_multisite() ) : ?>
|
233 |
<p>
|
258 |
?>
|
259 |
</p>
|
260 |
<?php endif; ?>
|
261 |
+
<?php endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
endif;
|
263 |
}
|
264 |
|
@@ -16,13 +16,9 @@ defined( 'ABSPATH' ) || exit;
|
|
16 |
* @since 2.0.0
|
17 |
*/
|
18 |
function bp_core_admin_tools() {
|
|
|
19 |
?>
|
20 |
-
<div class="
|
21 |
-
|
22 |
-
<h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Tools', 'buddypress' ) ?></h1>
|
23 |
-
<hr class="wp-header-end">
|
24 |
-
|
25 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Repair', 'buddypress' ), 'tools' ); ?></h2>
|
26 |
|
27 |
<p><?php esc_html_e( 'BuddyPress keeps track of various relationships between members, groups, and activity items.', 'buddypress' ); ?></p>
|
28 |
<p><?php esc_html_e( 'Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?></p>
|
16 |
* @since 2.0.0
|
17 |
*/
|
18 |
function bp_core_admin_tools() {
|
19 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Repair', 'buddypress' ), 'tools' );
|
20 |
?>
|
21 |
+
<div class="buddypress-body">
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
<p><?php esc_html_e( 'BuddyPress keeps track of various relationships between members, groups, and activity items.', 'buddypress' ); ?></p>
|
24 |
<p><?php esc_html_e( 'Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?></p>
|
@@ -181,9 +181,12 @@ function bp_core_admin_update_type( $args = array() ) {
|
|
181 |
$metadata = bp_core_admin_get_type_default_meta_values( $type_taxonomy );
|
182 |
|
183 |
// Merge customs with defaults.
|
184 |
-
$metas =
|
|
|
|
|
|
|
185 |
|
186 |
-
// Validate metadata
|
187 |
$metas = array_intersect_key( $metas, $metadata );
|
188 |
|
189 |
foreach ( $metas as $meta_key => $meta_value ) {
|
181 |
$metadata = bp_core_admin_get_type_default_meta_values( $type_taxonomy );
|
182 |
|
183 |
// Merge customs with defaults.
|
184 |
+
$metas = bp_parse_args(
|
185 |
+
$args,
|
186 |
+
$metadata
|
187 |
+
);
|
188 |
|
189 |
+
// Validate metadata.
|
190 |
$metas = array_intersect_key( $metas, $metadata );
|
191 |
|
192 |
foreach ( $metas as $meta_key => $meta_value ) {
|
@@ -35,7 +35,7 @@ TABLE OF CONTENTS:
|
|
35 |
.bp-badge {
|
36 |
color: #d84800;
|
37 |
display: inline-block;
|
38 |
-
font: 400 150px/1 dashicons
|
39 |
}
|
40 |
|
41 |
.bp-badge:before {
|
@@ -120,12 +120,12 @@ TABLE OF CONTENTS:
|
|
120 |
margin-left: 10px;
|
121 |
padding-bottom: 15px;
|
122 |
height: 70px;
|
123 |
-
width:
|
124 |
}
|
125 |
|
126 |
.bp-about-wrap .compact .wp-person {
|
127 |
height: auto;
|
128 |
-
width:
|
129 |
padding-bottom: 0;
|
130 |
margin-bottom: 0;
|
131 |
}
|
@@ -556,3 +556,156 @@ body.post-type-bp-email .categorydiv label {
|
|
556 |
#buddypress-update.not-shiny .update-message:before {
|
557 |
content: "\f534";
|
558 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
.bp-badge {
|
36 |
color: #d84800;
|
37 |
display: inline-block;
|
38 |
+
font: 400 150px/1 dashicons;
|
39 |
}
|
40 |
|
41 |
.bp-badge:before {
|
120 |
margin-left: 10px;
|
121 |
padding-bottom: 15px;
|
122 |
height: 70px;
|
123 |
+
width: 250px;
|
124 |
}
|
125 |
|
126 |
.bp-about-wrap .compact .wp-person {
|
127 |
height: auto;
|
128 |
+
width: 150px;
|
129 |
padding-bottom: 0;
|
130 |
margin-bottom: 0;
|
131 |
}
|
556 |
#buddypress-update.not-shiny .update-message:before {
|
557 |
content: "\f534";
|
558 |
}
|
559 |
+
|
560 |
+
.buddypress .bp-welcome-panel {
|
561 |
+
position: relative;
|
562 |
+
overflow: auto;
|
563 |
+
margin: 16px 0;
|
564 |
+
padding: 23px 10px 0;
|
565 |
+
border: 1px solid #c3c4c7;
|
566 |
+
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
567 |
+
background: #fff;
|
568 |
+
background-image: none;
|
569 |
+
font-size: 13px;
|
570 |
+
line-height: 1.7;
|
571 |
+
}
|
572 |
+
|
573 |
+
.buddypress .bp-welcome-panel-close {
|
574 |
+
position: absolute;
|
575 |
+
top: 10px;
|
576 |
+
left: 10px;
|
577 |
+
padding: 10px 21px 10px 15px;
|
578 |
+
font-size: 13px;
|
579 |
+
line-height: 1.23076923;
|
580 |
+
text-decoration: none;
|
581 |
+
}
|
582 |
+
|
583 |
+
.buddypress .bp-welcome-panel-close:before {
|
584 |
+
position: absolute;
|
585 |
+
top: 8px;
|
586 |
+
right: 0;
|
587 |
+
transition: all 0.1s ease-in-out;
|
588 |
+
margin: 0;
|
589 |
+
background: 100% 0;
|
590 |
+
color: #787c82;
|
591 |
+
content: "\f153";
|
592 |
+
display: block;
|
593 |
+
font: 600 16px/20px dashicons;
|
594 |
+
height: 20px;
|
595 |
+
text-align: center;
|
596 |
+
width: 20px;
|
597 |
+
-webkit-font-smoothing: antialiased;
|
598 |
+
-moz-osx-font-smoothing: grayscale;
|
599 |
+
}
|
600 |
+
|
601 |
+
.buddypress .bp-welcome-panel-close:hover:before {
|
602 |
+
color: #d63638;
|
603 |
+
}
|
604 |
+
|
605 |
+
.buddypress .bp-welcome-panel-content {
|
606 |
+
margin-right: 13px;
|
607 |
+
max-width: 1500px;
|
608 |
+
}
|
609 |
+
|
610 |
+
.buddypress .bp-welcome-panel-content h2 {
|
611 |
+
line-height: 32px;
|
612 |
+
margin-bottom: 1em;
|
613 |
+
}
|
614 |
+
|
615 |
+
.buddypress .bp-welcome-panel-content p {
|
616 |
+
padding-bottom: 23px;
|
617 |
+
font-size: 14px;
|
618 |
+
}
|
619 |
+
|
620 |
+
/*------------------------------------------------------------------------------
|
621 |
+
* 7.0 Admins page with tabbed nav.
|
622 |
+
*----------------------------------------------------------------------------*/
|
623 |
+
body.bp-is-tabbed-screen #wpcontent {
|
624 |
+
padding-right: 0;
|
625 |
+
}
|
626 |
+
|
627 |
+
.buddypress-header {
|
628 |
+
text-align: center;
|
629 |
+
margin: 0 0 1rem;
|
630 |
+
background: #fff;
|
631 |
+
border-bottom: 1px solid #dcdcde;
|
632 |
+
}
|
633 |
+
|
634 |
+
.buddypress-title-section {
|
635 |
+
display: flex;
|
636 |
+
align-items: center;
|
637 |
+
justify-content: center;
|
638 |
+
flex-direction: column;
|
639 |
+
clear: both;
|
640 |
+
padding: 1rem 0;
|
641 |
+
}
|
642 |
+
|
643 |
+
.buddypress-title-section h1 {
|
644 |
+
display: inline-block;
|
645 |
+
font-weight: 600;
|
646 |
+
margin: 0 0.8rem;
|
647 |
+
font-size: 23px;
|
648 |
+
padding: 9px 0 4px;
|
649 |
+
line-height: 1.3;
|
650 |
+
}
|
651 |
+
|
652 |
+
.buddypress-title-section h1 .bp-badge,
|
653 |
+
.buddypress .bp-welcome-panel-content h2 .bp-badge {
|
654 |
+
font-size: 32px;
|
655 |
+
vertical-align: top;
|
656 |
+
}
|
657 |
+
|
658 |
+
.buddypress-tabs-wrapper {
|
659 |
+
|
660 |
+
/* IE 11 */
|
661 |
+
display: -ms-inline-grid;
|
662 |
+
-ms-grid-columns: 1fr 1fr;
|
663 |
+
vertical-align: top;
|
664 |
+
|
665 |
+
/* modern browsers */
|
666 |
+
display: inline-grid; /* stylelint-disable-line declaration-block-no-duplicate-properties */
|
667 |
+
grid-template-columns: 1fr 1fr;
|
668 |
+
}
|
669 |
+
|
670 |
+
.buddypress-tabs-wrapper .buddypress-nav-tab {
|
671 |
+
display: block;
|
672 |
+
text-decoration: none;
|
673 |
+
color: inherit;
|
674 |
+
padding: 0.5rem 1rem 1rem;
|
675 |
+
margin: 0 1rem;
|
676 |
+
transition: box-shadow 0.5s ease-in-out;
|
677 |
+
}
|
678 |
+
|
679 |
+
.buddypress-tabs-wrapper .buddypress-nav-tab.active {
|
680 |
+
box-shadow: inset 0 -3px #3582c4;
|
681 |
+
font-weight: 600;
|
682 |
+
}
|
683 |
+
|
684 |
+
.buddypress-body {
|
685 |
+
max-width: 800px;
|
686 |
+
margin: 0 auto;
|
687 |
+
}
|
688 |
+
|
689 |
+
.buddypress-body .form-table {
|
690 |
+
border: 1px solid #dcdcde;
|
691 |
+
background-color: #fff;
|
692 |
+
padding: 0.5rem 1rem;
|
693 |
+
border-collapse: inherit;
|
694 |
+
}
|
695 |
+
|
696 |
+
/* Media queries */
|
697 |
+
@media screen and (max-width: 782px) {
|
698 |
+
|
699 |
+
.buddypress-body {
|
700 |
+
margin: 0 12px;
|
701 |
+
width: auto;
|
702 |
+
}
|
703 |
+
}
|
704 |
+
|
705 |
+
@media only screen and (max-width: 1004px) {
|
706 |
+
|
707 |
+
.buddypress-body {
|
708 |
+
margin: 0 22px;
|
709 |
+
width: auto;
|
710 |
+
}
|
711 |
+
}
|
@@ -1 +1 @@
|
|
1 |
-
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -5px 0 -15px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-left:10px;padding-bottom:15px;height:70px;width:280px}.bp-about-wrap .compact .wp-person{height:auto;width:180px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:right;margin:0 0 10px 10px;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-left:20px;margin-right:10px}.bp-about-wrap .bp-about-wrap h1{margin-left:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:right;width:18px;height:18px;margin-left:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:-1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;left:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(-50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{left:0;text-align:left;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(-15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:right;margin-left:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-right:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-right:0;width:100%}.bp-new-notice-panel .button-primary{margin-right:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:right;padding-right:25px;text-indent:-25px}.block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo{color:#d84800}#buddypress-update.not-shiny .update-message{border-right:0;padding-right:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
|
1 |
+
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -5px 0 -15px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-left:10px;padding-bottom:15px;height:70px;width:250px}.bp-about-wrap .compact .wp-person{height:auto;width:150px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:right;margin:0 0 10px 10px;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-left:20px;margin-right:10px}.bp-about-wrap .bp-about-wrap h1{margin-left:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:right;width:18px;height:18px;margin-left:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:-1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;left:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(-50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{left:0;text-align:left;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(-15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:right;margin-left:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-right:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-right:0;width:100%}.bp-new-notice-panel .button-primary{margin-right:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:right;padding-right:25px;text-indent:-25px}.block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo{color:#d84800}#buddypress-update.not-shiny .update-message{border-right:0;padding-right:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}.buddypress .bp-welcome-panel{position:relative;overflow:auto;margin:16px 0;padding:23px 10px 0;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgb(0 0 0 / 4%);background:#fff;background-image:none;font-size:13px;line-height:1.7}.buddypress .bp-welcome-panel-close{position:absolute;top:10px;left:10px;padding:10px 21px 10px 15px;font-size:13px;line-height:1.23076923;text-decoration:none}.buddypress .bp-welcome-panel-close:before{position:absolute;top:8px;right:0;transition:all .1s ease-in-out;margin:0;background:100% 0;color:#787c82;content:"\f153";display:block;font:600 16px/20px dashicons;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.buddypress .bp-welcome-panel-close:hover:before{color:#d63638}.buddypress .bp-welcome-panel-content{margin-right:13px;max-width:1500px}.buddypress .bp-welcome-panel-content h2{line-height:32px;margin-bottom:1em}.buddypress .bp-welcome-panel-content p{padding-bottom:23px;font-size:14px}body.bp-is-tabbed-screen #wpcontent{padding-right:0}.buddypress-header{text-align:center;margin:0 0 1rem;background:#fff;border-bottom:1px solid #dcdcde}.buddypress-title-section{display:flex;align-items:center;justify-content:center;flex-direction:column;clear:both;padding:1rem 0}.buddypress-title-section h1{display:inline-block;font-weight:600;margin:0 .8rem;font-size:23px;padding:9px 0 4px;line-height:1.3}.buddypress .bp-welcome-panel-content h2 .bp-badge,.buddypress-title-section h1 .bp-badge{font-size:32px;vertical-align:top}.buddypress-tabs-wrapper{display:-ms-inline-grid;-ms-grid-columns:1fr 1fr;vertical-align:top;display:inline-grid;grid-template-columns:1fr 1fr}.buddypress-tabs-wrapper .buddypress-nav-tab{display:block;text-decoration:none;color:inherit;padding:.5rem 1rem 1rem;margin:0 1rem;transition:box-shadow .5s ease-in-out}.buddypress-tabs-wrapper .buddypress-nav-tab.active{box-shadow:inset 0 -3px #3582c4;font-weight:600}.buddypress-body{max-width:800px;margin:0 auto}.buddypress-body .form-table{border:1px solid #dcdcde;background-color:#fff;padding:.5rem 1rem;border-collapse:inherit}@media screen and (max-width:782px){.buddypress-body{margin:0 12px;width:auto}}@media only screen and (max-width:1004px){.buddypress-body{margin:0 22px;width:auto}}
|
@@ -35,7 +35,7 @@ TABLE OF CONTENTS:
|
|
35 |
.bp-badge {
|
36 |
color: #d84800;
|
37 |
display: inline-block;
|
38 |
-
font: 400 150px/1 dashicons
|
39 |
}
|
40 |
|
41 |
.bp-badge:before {
|
@@ -120,12 +120,12 @@ TABLE OF CONTENTS:
|
|
120 |
margin-right: 10px;
|
121 |
padding-bottom: 15px;
|
122 |
height: 70px;
|
123 |
-
width:
|
124 |
}
|
125 |
|
126 |
.bp-about-wrap .compact .wp-person {
|
127 |
height: auto;
|
128 |
-
width:
|
129 |
padding-bottom: 0;
|
130 |
margin-bottom: 0;
|
131 |
}
|
@@ -556,3 +556,156 @@ body.post-type-bp-email .categorydiv label {
|
|
556 |
#buddypress-update.not-shiny .update-message:before {
|
557 |
content: "\f534";
|
558 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
.bp-badge {
|
36 |
color: #d84800;
|
37 |
display: inline-block;
|
38 |
+
font: 400 150px/1 dashicons;
|
39 |
}
|
40 |
|
41 |
.bp-badge:before {
|
120 |
margin-right: 10px;
|
121 |
padding-bottom: 15px;
|
122 |
height: 70px;
|
123 |
+
width: 250px;
|
124 |
}
|
125 |
|
126 |
.bp-about-wrap .compact .wp-person {
|
127 |
height: auto;
|
128 |
+
width: 150px;
|
129 |
padding-bottom: 0;
|
130 |
margin-bottom: 0;
|
131 |
}
|
556 |
#buddypress-update.not-shiny .update-message:before {
|
557 |
content: "\f534";
|
558 |
}
|
559 |
+
|
560 |
+
.buddypress .bp-welcome-panel {
|
561 |
+
position: relative;
|
562 |
+
overflow: auto;
|
563 |
+
margin: 16px 0;
|
564 |
+
padding: 23px 10px 0;
|
565 |
+
border: 1px solid #c3c4c7;
|
566 |
+
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
567 |
+
background: #fff;
|
568 |
+
background-image: none;
|
569 |
+
font-size: 13px;
|
570 |
+
line-height: 1.7;
|
571 |
+
}
|
572 |
+
|
573 |
+
.buddypress .bp-welcome-panel-close {
|
574 |
+
position: absolute;
|
575 |
+
top: 10px;
|
576 |
+
right: 10px;
|
577 |
+
padding: 10px 15px 10px 21px;
|
578 |
+
font-size: 13px;
|
579 |
+
line-height: 1.23076923;
|
580 |
+
text-decoration: none;
|
581 |
+
}
|
582 |
+
|
583 |
+
.buddypress .bp-welcome-panel-close:before {
|
584 |
+
position: absolute;
|
585 |
+
top: 8px;
|
586 |
+
left: 0;
|
587 |
+
transition: all 0.1s ease-in-out;
|
588 |
+
margin: 0;
|
589 |
+
background: 0 0;
|
590 |
+
color: #787c82;
|
591 |
+
content: "\f153";
|
592 |
+
display: block;
|
593 |
+
font: 600 16px/20px dashicons;
|
594 |
+
height: 20px;
|
595 |
+
text-align: center;
|
596 |
+
width: 20px;
|
597 |
+
-webkit-font-smoothing: antialiased;
|
598 |
+
-moz-osx-font-smoothing: grayscale;
|
599 |
+
}
|
600 |
+
|
601 |
+
.buddypress .bp-welcome-panel-close:hover:before {
|
602 |
+
color: #d63638;
|
603 |
+
}
|
604 |
+
|
605 |
+
.buddypress .bp-welcome-panel-content {
|
606 |
+
margin-left: 13px;
|
607 |
+
max-width: 1500px;
|
608 |
+
}
|
609 |
+
|
610 |
+
.buddypress .bp-welcome-panel-content h2 {
|
611 |
+
line-height: 32px;
|
612 |
+
margin-bottom: 1em;
|
613 |
+
}
|
614 |
+
|
615 |
+
.buddypress .bp-welcome-panel-content p {
|
616 |
+
padding-bottom: 23px;
|
617 |
+
font-size: 14px;
|
618 |
+
}
|
619 |
+
|
620 |
+
/*------------------------------------------------------------------------------
|
621 |
+
* 7.0 Admins page with tabbed nav.
|
622 |
+
*----------------------------------------------------------------------------*/
|
623 |
+
body.bp-is-tabbed-screen #wpcontent {
|
624 |
+
padding-left: 0;
|
625 |
+
}
|
626 |
+
|
627 |
+
.buddypress-header {
|
628 |
+
text-align: center;
|
629 |
+
margin: 0 0 1rem;
|
630 |
+
background: #fff;
|
631 |
+
border-bottom: 1px solid #dcdcde;
|
632 |
+
}
|
633 |
+
|
634 |
+
.buddypress-title-section {
|
635 |
+
display: flex;
|
636 |
+
align-items: center;
|
637 |
+
justify-content: center;
|
638 |
+
flex-direction: column;
|
639 |
+
clear: both;
|
640 |
+
padding: 1rem 0;
|
641 |
+
}
|
642 |
+
|
643 |
+
.buddypress-title-section h1 {
|
644 |
+
display: inline-block;
|
645 |
+
font-weight: 600;
|
646 |
+
margin: 0 0.8rem;
|
647 |
+
font-size: 23px;
|
648 |
+
padding: 9px 0 4px;
|
649 |
+
line-height: 1.3;
|
650 |
+
}
|
651 |
+
|
652 |
+
.buddypress-title-section h1 .bp-badge,
|
653 |
+
.buddypress .bp-welcome-panel-content h2 .bp-badge {
|
654 |
+
font-size: 32px;
|
655 |
+
vertical-align: top;
|
656 |
+
}
|
657 |
+
|
658 |
+
.buddypress-tabs-wrapper {
|
659 |
+
|
660 |
+
/* IE 11 */
|
661 |
+
display: -ms-inline-grid;
|
662 |
+
-ms-grid-columns: 1fr 1fr;
|
663 |
+
vertical-align: top;
|
664 |
+
|
665 |
+
/* modern browsers */
|
666 |
+
display: inline-grid; /* stylelint-disable-line declaration-block-no-duplicate-properties */
|
667 |
+
grid-template-columns: 1fr 1fr;
|
668 |
+
}
|
669 |
+
|
670 |
+
.buddypress-tabs-wrapper .buddypress-nav-tab {
|
671 |
+
display: block;
|
672 |
+
text-decoration: none;
|
673 |
+
color: inherit;
|
674 |
+
padding: 0.5rem 1rem 1rem;
|
675 |
+
margin: 0 1rem;
|
676 |
+
transition: box-shadow 0.5s ease-in-out;
|
677 |
+
}
|
678 |
+
|
679 |
+
.buddypress-tabs-wrapper .buddypress-nav-tab.active {
|
680 |
+
box-shadow: inset 0 -3px #3582c4;
|
681 |
+
font-weight: 600;
|
682 |
+
}
|
683 |
+
|
684 |
+
.buddypress-body {
|
685 |
+
max-width: 800px;
|
686 |
+
margin: 0 auto;
|
687 |
+
}
|
688 |
+
|
689 |
+
.buddypress-body .form-table {
|
690 |
+
border: 1px solid #dcdcde;
|
691 |
+
background-color: #fff;
|
692 |
+
padding: 0.5rem 1rem;
|
693 |
+
border-collapse: inherit;
|
694 |
+
}
|
695 |
+
|
696 |
+
/* Media queries */
|
697 |
+
@media screen and (max-width: 782px) {
|
698 |
+
|
699 |
+
.buddypress-body {
|
700 |
+
margin: 0 12px;
|
701 |
+
width: auto;
|
702 |
+
}
|
703 |
+
}
|
704 |
+
|
705 |
+
@media only screen and (max-width: 1004px) {
|
706 |
+
|
707 |
+
.buddypress-body {
|
708 |
+
margin: 0 22px;
|
709 |
+
width: auto;
|
710 |
+
}
|
711 |
+
}
|
@@ -1 +1 @@
|
|
1 |
-
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -15px 0 -5px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-right:10px;padding-bottom:15px;height:70px;width:280px}.bp-about-wrap .compact .wp-person{height:auto;width:180px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:left;margin:0 10px 10px 0;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-right:20px;margin-left:10px}.bp-about-wrap .bp-about-wrap h1{margin-right:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;right:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{right:0;text-align:right;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:left;margin-right:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-left:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-left:0;width:100%}.bp-new-notice-panel .button-primary{margin-left:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:left;padding-left:25px;text-indent:-25px}.block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo{color:#d84800}#buddypress-update.not-shiny .update-message{border-left:0;padding-left:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
|
1 |
+
.bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons}.bp-badge:before{content:"\f448"}.index_page_bp-about code,.settings_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}.bp-about-wrap{position:relative;max-width:1050px;font-size:15px}.bp-about-wrap img{margin:0;max-width:100%;height:auto;vertical-align:middle}.bp-about-wrap p{line-height:1.5;font-size:14px}.bp-about-wrap h2{margin:40px 0 .6em;font-size:2.7em;line-height:1.3;font-weight:300;text-align:center}.bp-about-wrap h3{margin:1.25em 0 .6em;font-size:1.4em;line-height:1.5}.bp-about-wrap code{font-size:14px;font-weight:400}.bp-about-wrap .about-description{margin-top:1.4em;font-weight:400;line-height:1.6;font-size:19px}.bp-about-wrap h3.wp-people-group{margin:2.6em 0 1.33em;padding:0;font-size:16px;line-height:inherit}.bp-about-wrap .wp-people-group{padding:0 5px;margin:0 -15px 0 -5px}.bp-about-wrap .compact{margin-bottom:0}.bp-about-wrap .wp-person{display:inline-block;vertical-align:top;margin-right:10px;padding-bottom:15px;height:70px;width:250px}.bp-about-wrap .compact .wp-person{height:auto;width:150px;padding-bottom:0;margin-bottom:0}.bp-about-wrap .wp-person .gravatar{float:left;margin:0 10px 10px 0;padding:1px;width:60px;height:60px}.bp-about-wrap .compact .wp-person .gravatar{width:30px;height:30px}.bp-about-wrap .wp-person .web{margin:6px 0 2px;font-size:16px;font-weight:400;line-height:2;text-decoration:none}.bp-about-wrap .wp-person .title{display:block}.bp-about-wrap p.wp-credits-list a{white-space:nowrap}@media only screen and (max-width:500px){.bp-about-wrap{margin-right:20px;margin-left:10px}.bp-about-wrap .bp-about-wrap h1{margin-right:0}}#adminmenu #toplevel_page_bp-activity .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-activity_user .wp-menu-image:before{content:"\f452"}#adminmenu #toplevel_page_bp-groups .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-groups_user .wp-menu-image:before{content:"\f456"}#adminmenu #toplevel_page_bp-notifications .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-notifications_user .wp-menu-image:before{content:"\f439"}#adminmenu #toplevel_page_bp-messages .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-messages_user .wp-menu-image:before{content:"\f457"}#adminmenu #toplevel_page_bp-friends .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-friends_user .wp-menu-image:before{content:"\f454"}#adminmenu #toplevel_page_bp-settings .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_network .wp-menu-image:before,#adminmenu #toplevel_page_bp-settings_user .wp-menu-image:before{content:"\f108"}#adminmenu li.toplevel_page_bp-components .wp-menu-image,#adminmenu li.toplevel_page_bp-general-settings .wp-menu-image{content:"\f448"}.settings_page_bp-components td.plugin-title span{float:left;width:18px;height:18px;margin-right:5px}.settings_page_bp-components td.plugin-title span:before{font-family:dashicons;font-size:18px}.settings_page_bp-components tr.activity td.plugin-title span:before{content:"\f452"}.settings_page_bp-components tr.notifications td.plugin-title span:before{content:"\f339"}.settings_page_bp-components tr.xprofile td.plugin-title span:before{content:"\f336"}.settings_page_bp-components tr.settings td.plugin-title span:before{content:"\f108"}.settings_page_bp-components tr.groups td.plugin-title span:before{content:"\f456"}.settings_page_bp-components tr.messages td.plugin-title span:before{content:"\f457"}.settings_page_bp-components tr.blogs td.plugin-title span:before{content:"\f120"}.settings_page_bp-components tr.friends td.plugin-title span:before{content:"\f454"}.settings_page_bp-components tr.core td.plugin-title span:before{content:"\f448"}.settings_page_bp-components tr.members td.plugin-title span:before{content:"\f307"}.settings_page_bp-page-settings .button-secondary .dashicons{position:relative;top:3px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{width:25%}@media screen and (max-width:782px){.settings_page_bp-components td.plugin-title span{margin-top:5px}#bp-admin-component-form .wp-list-table.plugins .plugin-title{display:block;width:auto}#bp-admin-component-form .subsubsub{margin-bottom:0;padding-bottom:35px}}#adminmenu .toplevel_page_network-tools div.wp-menu-image:before{content:""}body.tools-php .bp-tools dt{font-size:1.1em;color:#646970;font-weight:600;margin:1em 0 .5em 0}body.tools-php .bp-tools dd{margin:0}body.tools_page_bp-members-invitations .nav-tab-wrapper,body.tools_page_bp-optouts .nav-tab-wrapper{margin-bottom:1em}.bp-tooltip{position:relative}.bp-tooltip:after{background:#fff;border:1px solid #aaa;border-collapse:separate;border-radius:1px;box-shadow:1px 1px 0 1px rgba(132,132,132,.3);color:#000;content:attr(data-bp-tooltip);display:none;font-family:sans-serif;font-size:11px;font-weight:400;letter-spacing:normal;line-height:1.5;margin-top:10px;max-width:240px;opacity:0;padding:3px 6px;position:absolute;right:50%;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;top:100%;transform:translateX(50%);transition:opacity 2s ease-out;white-space:pre;word-wrap:break-word;z-index:998}.bp-hello-close .bp-tooltip:after{right:0;text-align:right;transform:translateX(0)}.bp-hello-social .bp-tooltip:after{bottom:120%;margin-bottom:20px;margin-top:0;top:auto;transform:translateX(15%)}.bp-tooltip:active:after,.bp-tooltip:focus:after,.bp-tooltip:hover:after{display:inline-block;opacity:1;overflow:visible;text-decoration:none;z-index:999}body.site-users-php th#role,body.users-php th#role,body.users_page_bp-signups th#count_sent{width:10%}body.site-users-php th#email,body.site-users-php th#name,body.users-php th#email,body.users-php th#name,body.users-php th#registered,body.users_page_bp-signups th#date_sent,body.users_page_bp-signups th#email,body.users_page_bp-signups th#name,body.users_page_bp-signups th#registered{width:15%}body.users-php th#blogs,body.users_page_bp-signups th#blogs{width:20%}body.users_page_bp-signups td.count_sent,body.users_page_bp-signups th.column-count_sent{text-align:center}.bp-signups-list table{margin:1em 0}.bp-signups-list .column-fields{font-weight:700}.bp-new-notice-panel{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);font-size:13px;line-height:2.1;margin:1.5em 0 3em;overflow:auto;padding:10px 25px 25px;position:relative}.bp-new-notice-panel label{clear:both;float:left;margin-right:3%;width:20%}.bp-new-notice-panel input,.bp-new-notice-panel textarea{clear:none;margin-bottom:1em;width:75%}.bp-new-notice-panel input[type=text]:after,.bp-new-notice-panel textarea:after{clear:both;content:" ";display:table}.bp-new-notice-panel .button-primary{margin-left:23%;width:auto}.bp-notice-about{font-size:1em;margin-bottom:1em}.bp-new-notice{margin-bottom:1em;margin-top:0}.bp-notices-list{margin-bottom:0}@media screen and (max-width:782px){.bp-new-notice-panel{margin-bottom:1.5em}.bp-new-notice-panel input,.bp-new-notice-panel textarea{margin-left:0;width:100%}.bp-new-notice-panel .button-primary{margin-left:0;width:auto}.bp-new-notice-panel .button{max-width:45%;word-wrap:break-word}.bp-notice-about{margin-top:0;margin-bottom:1em}.bp-new-notice{margin-bottom:.5em}}body.post-type-bp-email #excerpt{height:auto}body.post-type-bp-email th#situation{width:20%}body.post-type-bp-email td.column-situation ul{margin:0}body.post-type-bp-email .categorydiv label{display:block;float:left;padding-left:25px;text-indent:-25px}.block-editor-inserter__panel-header span.dashicons-buddicons-buddypress-logo{color:#d84800}#buddypress-update.not-shiny .update-message{border-left:0;padding-left:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}.buddypress .bp-welcome-panel{position:relative;overflow:auto;margin:16px 0;padding:23px 10px 0;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgb(0 0 0 / 4%);background:#fff;background-image:none;font-size:13px;line-height:1.7}.buddypress .bp-welcome-panel-close{position:absolute;top:10px;right:10px;padding:10px 15px 10px 21px;font-size:13px;line-height:1.23076923;text-decoration:none}.buddypress .bp-welcome-panel-close:before{position:absolute;top:8px;left:0;transition:all .1s ease-in-out;margin:0;background:0 0;color:#787c82;content:"\f153";display:block;font:600 16px/20px dashicons;height:20px;text-align:center;width:20px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.buddypress .bp-welcome-panel-close:hover:before{color:#d63638}.buddypress .bp-welcome-panel-content{margin-left:13px;max-width:1500px}.buddypress .bp-welcome-panel-content h2{line-height:32px;margin-bottom:1em}.buddypress .bp-welcome-panel-content p{padding-bottom:23px;font-size:14px}body.bp-is-tabbed-screen #wpcontent{padding-left:0}.buddypress-header{text-align:center;margin:0 0 1rem;background:#fff;border-bottom:1px solid #dcdcde}.buddypress-title-section{display:flex;align-items:center;justify-content:center;flex-direction:column;clear:both;padding:1rem 0}.buddypress-title-section h1{display:inline-block;font-weight:600;margin:0 .8rem;font-size:23px;padding:9px 0 4px;line-height:1.3}.buddypress .bp-welcome-panel-content h2 .bp-badge,.buddypress-title-section h1 .bp-badge{font-size:32px;vertical-align:top}.buddypress-tabs-wrapper{display:-ms-inline-grid;-ms-grid-columns:1fr 1fr;vertical-align:top;display:inline-grid;grid-template-columns:1fr 1fr}.buddypress-tabs-wrapper .buddypress-nav-tab{display:block;text-decoration:none;color:inherit;padding:.5rem 1rem 1rem;margin:0 1rem;transition:box-shadow .5s ease-in-out}.buddypress-tabs-wrapper .buddypress-nav-tab.active{box-shadow:inset 0 -3px #3582c4;font-weight:600}.buddypress-body{max-width:800px;margin:0 auto}.buddypress-body .form-table{border:1px solid #dcdcde;background-color:#fff;padding:.5rem 1rem;border-collapse:inherit}@media screen and (max-width:782px){.buddypress-body{margin:0 12px;width:auto}}@media only screen and (max-width:1004px){.buddypress-body{margin:0 22px;width:auto}}
|
@@ -70,6 +70,7 @@ TABLE OF CONTENTS:
|
|
70 |
}
|
71 |
|
72 |
div.dashicons {
|
|
|
73 |
width: fit-content;
|
74 |
}
|
75 |
|
70 |
}
|
71 |
|
72 |
div.dashicons {
|
73 |
+
width: -moz-fit-content;
|
74 |
width: fit-content;
|
75 |
}
|
76 |
|
@@ -1 +1 @@
|
|
1 |
-
:root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px
|
1 |
+
:root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px/0.6 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important}.bp-hello-social li a:hover:before{transition:all .1s ease-in-out;color:var(--bp-hello-color-primary)}.bp-hello-social li a.support:before{content:"\f448"}.bp-hello-social li a.twitter:before{content:"\f301"}div.dashicons{width:-moz-fit-content;width:fit-content}div.dashicons.big{font-size:128px;display:block;color:var(--bp-hello-color-primary);height:128px;width:128px}#plugin-information-footer{display:flex;flex-wrap:wrap;padding:0 16px;height:auto}#plugin-information-footer .dashicons-heart{color:#be3631}.bp-hello-social-cta,.bp-hello-social-links{flex-basis:50%}.bp-hello-social-links ul{display:inline-block}.bp-hello-social li{position:relative;bottom:-5px;display:inline-block;list-style-type:none;margin-bottom:0}.bp-hello-social li:last-child a{margin-right:4px}#bp-hello-container{display:none}.bp-hello-content{padding:0 25px;padding-bottom:20px}#dynamic-content{padding-bottom:40px;display:none}#dynamic-content.show{display:block}.plugin-details-modal #TB_title{height:0;background:0 0;border:none}#TB_window.plugin-details-modal.thickbox-loading:before{z-index:10;margin-top:40px;background-color:none}.bp-hello-aligncenter *{margin:10px auto}.bp-hello-alignleft{float:right}.bp-hello-alignleft:after{content:"";clear:right}.bp-hello-alignright{float:left}.bp-hello-alignright:after{content:"";clear:left}.bp-hello-divider{clear:both;border:none;margin-bottom:20px}.bp-hello-social-cta{text-align:right}.bp-hello-social-links{text-align:left}.bp-hello-social li a{text-decoration:none}#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-772x250.png)}#plugin-information-title h1{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h1{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:20px;line-height:1.68;box-sizing:border-box;max-width:85%;padding:0 15px;margin-top:30px;color:#fff;background:rgba(30,30,30,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}.bp-hello-content{background-color:#fff}.bp-hello-content img{border-radius:2px;max-width:100%}.bp-hello-content iframe{width:100%}.bp-hello-content .bp-hello-alignleft img,.bp-hello-content .bp-hello-alignright img{max-width:200px}@media screen and (min-width:770px){#plugin-information-title.with-banner h1{font-size:30px;line-height:2;margin-top:174px;max-width:100%}}@media only screen and (min-width:1024px){.bp-hello-content{padding:0 30px 20px}.bp-hello-content p{font-size:14px}}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-1544x500.png)}}
|
@@ -70,6 +70,7 @@ TABLE OF CONTENTS:
|
|
70 |
}
|
71 |
|
72 |
div.dashicons {
|
|
|
73 |
width: fit-content;
|
74 |
}
|
75 |
|
70 |
}
|
71 |
|
72 |
div.dashicons {
|
73 |
+
width: -moz-fit-content;
|
74 |
width: fit-content;
|
75 |
}
|
76 |
|
@@ -1 +1 @@
|
|
1 |
-
:root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px
|
1 |
+
:root{--bp-hello-color-primary:#d34600;--bp-hello-color-secondary:#e5e5e5;--bp-hello-container-size:15%}.bp-hello-content p{font-size:16px}.bp-hello-content ol,.bp-hello-content ul{list-style:inherit}.bp-hello-content h3{font-size:1.1em;font-weight:500}.bp-hello-social li a:before{color:#23282d;font:400 30px/0.6 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:none!important}.bp-hello-social li a:hover:before{transition:all .1s ease-in-out;color:var(--bp-hello-color-primary)}.bp-hello-social li a.support:before{content:"\f448"}.bp-hello-social li a.twitter:before{content:"\f301"}div.dashicons{width:-moz-fit-content;width:fit-content}div.dashicons.big{font-size:128px;display:block;color:var(--bp-hello-color-primary);height:128px;width:128px}#plugin-information-footer{display:flex;flex-wrap:wrap;padding:0 16px;height:auto}#plugin-information-footer .dashicons-heart{color:#be3631}.bp-hello-social-cta,.bp-hello-social-links{flex-basis:50%}.bp-hello-social-links ul{display:inline-block}.bp-hello-social li{position:relative;bottom:-5px;display:inline-block;list-style-type:none;margin-bottom:0}.bp-hello-social li:last-child a{margin-left:4px}#bp-hello-container{display:none}.bp-hello-content{padding:0 25px;padding-bottom:20px}#dynamic-content{padding-bottom:40px;display:none}#dynamic-content.show{display:block}.plugin-details-modal #TB_title{height:0;background:0 0;border:none}#TB_window.plugin-details-modal.thickbox-loading:before{z-index:10;margin-top:40px;background-color:none}.bp-hello-aligncenter *{margin:10px auto}.bp-hello-alignleft{float:left}.bp-hello-alignleft:after{content:"";clear:left}.bp-hello-alignright{float:right}.bp-hello-alignright:after{content:"";clear:right}.bp-hello-divider{clear:both;border:none;margin-bottom:20px}.bp-hello-social-cta{text-align:left}.bp-hello-social-links{text-align:right}.bp-hello-social li a{text-decoration:none}#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-772x250.png)}#plugin-information-title h1{font-size:1em;font-weight:600;padding:0;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#plugin-information-title.with-banner h1{position:relative;font-family:"Helvetica Neue",sans-serif;display:inline-block;font-size:20px;line-height:1.68;box-sizing:border-box;max-width:85%;padding:0 15px;margin-top:30px;color:#fff;background:rgba(30,30,30,.9);text-shadow:0 1px 3px rgba(0,0,0,.4);box-shadow:0 0 30px rgba(255,255,255,.1);border-radius:8px}.bp-hello-content{background-color:#fff}.bp-hello-content img{border-radius:2px;max-width:100%}.bp-hello-content iframe{width:100%}.bp-hello-content .bp-hello-alignleft img,.bp-hello-content .bp-hello-alignright img{max-width:200px}@media screen and (min-width:770px){#plugin-information-title.with-banner h1{font-size:30px;line-height:2;margin-top:174px;max-width:100%}}@media only screen and (min-width:1024px){.bp-hello-content{padding:0 30px 20px}.bp-hello-content p{font-size:14px}}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#plugin-information-title.with-banner{background-image:url(https://ps.w.org/buddypress/assets/banner-1544x500.png)}}
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function() {
|
2 |
+
var bpBackCompatAdminTabs = function() {
|
3 |
+
var wrap = document.querySelector( '.nav-tab-wrapper' ).closest( '.wrap' );
|
4 |
+
|
5 |
+
if ( wrap ) {
|
6 |
+
// 1. Add the tabbed class to the body tag.
|
7 |
+
document.body.classList.add( 'bp-is-tabbed-screen' );
|
8 |
+
|
9 |
+
// 2. Make the wrapping div the BuddyPress body.
|
10 |
+
wrap.classList.add( 'buddypress-body' );
|
11 |
+
wrap.classList.remove( 'wrap' );
|
12 |
+
|
13 |
+
// 3. Create the BuddyPress header.
|
14 |
+
var buddypressHeader = document.createElement( 'div' );
|
15 |
+
buddypressHeader.classList.add( 'buddypress-header' );
|
16 |
+
|
17 |
+
var headings = wrap.querySelectorAll( 'h1' );
|
18 |
+
var buddypressTitleSection = document.createElement( 'div' );
|
19 |
+
buddypressTitleSection.classList.add( 'buddypress-title-section' );
|
20 |
+
|
21 |
+
// 4. Move the document title in it.
|
22 |
+
if ( headings && headings[0] ) {
|
23 |
+
var buddyPressLogo = document.createElement( 'span' );
|
24 |
+
buddyPressLogo.classList.add( 'bp-badge' );
|
25 |
+
headings[0].innerHTML = ' ' + headings[0].innerHTML;
|
26 |
+
headings[0].prepend( buddyPressLogo );
|
27 |
+
buddypressTitleSection.appendChild( headings[0] );
|
28 |
+
}
|
29 |
+
|
30 |
+
buddypressHeader.appendChild( buddypressTitleSection );
|
31 |
+
|
32 |
+
// 5. Move the tabs in it.
|
33 |
+
var headerNavTabs = document.createElement( 'nav' );
|
34 |
+
headerNavTabs.classList.add( 'buddypress-tabs-wrapper' );
|
35 |
+
|
36 |
+
var bpAdminTabs = document.querySelectorAll( '.buddypress-nav-tab' );
|
37 |
+
var columns = [];
|
38 |
+
bpAdminTabs.forEach( function( tabItem ) {
|
39 |
+
headerNavTabs.appendChild( tabItem );
|
40 |
+
columns.push( '1fr' );
|
41 |
+
} );
|
42 |
+
|
43 |
+
// 6. Add the header's nav tabs into the header.
|
44 |
+
buddypressHeader.appendChild( headerNavTabs );
|
45 |
+
|
46 |
+
// 7. Edit the number of grid columns.
|
47 |
+
if ( columns.length > 0 ) {
|
48 |
+
headerNavTabs.setAttribute( 'style', '-ms-grid-columns: ' + columns.join( ' ' ) + '; grid-template-columns: ' + columns.join( ' ' ) + ';');
|
49 |
+
}
|
50 |
+
|
51 |
+
// 8. Create the header's separator.
|
52 |
+
var headerSeparator = document.createElement( 'hr' );
|
53 |
+
headerSeparator.classList.add( 'wp-header-end' );
|
54 |
+
|
55 |
+
// 9. Insert the BuddyPress header into the document.
|
56 |
+
document.querySelector('#wpbody-content').insertBefore( buddypressHeader, wrap );
|
57 |
+
document.querySelector('#wpbody-content').insertBefore( headerSeparator, wrap );
|
58 |
+
}
|
59 |
+
};
|
60 |
+
|
61 |
+
if ( 'loading' === document.readyState ) {
|
62 |
+
document.addEventListener( 'DOMContentLoaded', bpBackCompatAdminTabs );
|
63 |
+
} else {
|
64 |
+
bpBackCompatAdminTabs;
|
65 |
+
}
|
66 |
+
} )();
|
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(){function e(){var e,t,d,n,s,a,r=document.querySelector(".nav-tab-wrapper").closest(".wrap");r&&(document.body.classList.add("bp-is-tabbed-screen"),r.classList.add("buddypress-body"),r.classList.remove("wrap"),(e=document.createElement("div")).classList.add("buddypress-header"),t=r.querySelectorAll("h1"),(a=document.createElement("div")).classList.add("buddypress-title-section"),t&&t[0]&&((d=document.createElement("span")).classList.add("bp-badge"),t[0].innerHTML=" "+t[0].innerHTML,t[0].prepend(d),a.appendChild(t[0])),e.appendChild(a),(n=document.createElement("nav")).classList.add("buddypress-tabs-wrapper"),a=document.querySelectorAll(".buddypress-nav-tab"),s=[],a.forEach(function(e){n.appendChild(e),s.push("1fr")}),e.appendChild(n),0<s.length&&n.setAttribute("style","-ms-grid-columns: "+s.join(" ")+"; grid-template-columns: "+s.join(" ")+";"),(a=document.createElement("hr")).classList.add("wp-header-end"),document.querySelector("#wpbody-content").insertBefore(e,r),document.querySelector("#wpbody-content").insertBefore(a,r))}"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",e)}();
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Improves the Thickbox library for BuddyPress needs.
|
3 |
+
*
|
4 |
+
* @since 10.0.0
|
5 |
+
*/
|
6 |
+
( function( $ ) {
|
7 |
+
window.bpAdjustThickbox = function( label, padding ) {
|
8 |
+
$( '#TB_window' ).attr( {
|
9 |
+
'role': 'dialog',
|
10 |
+
'aria-label': label
|
11 |
+
} )
|
12 |
+
.addClass( 'plugin-details-modal' )
|
13 |
+
.removeClass( 'thickbox-loading' );
|
14 |
+
|
15 |
+
|
16 |
+
if ( ! padding ) {
|
17 |
+
padding = 0;
|
18 |
+
}
|
19 |
+
|
20 |
+
$( '#TB_ajaxContent' ).prop( 'style', 'height: 100%; width: auto; padding: ' + padding + '; border: none;' );
|
21 |
+
|
22 |
+
try {
|
23 |
+
var tabbables = $( ':tabbable', '#TB_ajaxContent' ), lastTabbable = tabbables.last();
|
24 |
+
|
25 |
+
// Move the focus to the Modal's close button once the last Hello link was tabbed out.
|
26 |
+
$( '#TB_window' ).on( 'keydown', function( event ) {
|
27 |
+
var keyCode;
|
28 |
+
|
29 |
+
if ( event.key !== undefined ) {
|
30 |
+
keyCode = event.key;
|
31 |
+
} else {
|
32 |
+
// event.keyCode is deprecated.
|
33 |
+
keyCode = event.keyCode;
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( 9 === keyCode && ! event.shiftKey && $( lastTabbable ).prop( 'classList' ).value === $( event.target ).prop( 'classList' ).value ) {
|
37 |
+
event.preventDefault();
|
38 |
+
|
39 |
+
$( '#TB_closeWindowButton' ).trigger( 'focus' );
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( 9 === keyCode && event.shiftKey && 'TB_closeWindowButton' === $( event.target ).prop( 'id' ) ) {
|
43 |
+
event.preventDefault();
|
44 |
+
|
45 |
+
$( lastTabbable ).trigger( 'focus' );
|
46 |
+
}
|
47 |
+
} );
|
48 |
+
} catch ( error ) {
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
};
|
52 |
+
} ( jQuery ) );
|
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(a){window.bpAdjustThickbox=function(t,e){a("#TB_window").attr({role:"dialog","aria-label":t}).addClass("plugin-details-modal").removeClass("thickbox-loading"),e=e||0,a("#TB_ajaxContent").prop("style","height: 100%; width: auto; padding: "+e+"; border: none;");try{var o=a(":tabbable","#TB_ajaxContent").last();a("#TB_window").on("keydown",function(t){var e=void 0!==t.key?t.key:t.keyCode;9!==e||t.shiftKey||a(o).prop("classList").value!==a(t.target).prop("classList").value||(t.preventDefault(),a("#TB_closeWindowButton").trigger("focus")),9===e&&t.shiftKey&&"TB_closeWindowButton"===a(t.target).prop("id")&&(t.preventDefault(),a(o).trigger("focus"))})}catch(t){return}}}(jQuery);
|
@@ -1,16 +1,4 @@
|
|
1 |
-
(function(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
var notice_id = $notice.data( 'noticeid' );
|
6 |
-
$.post( {
|
7 |
-
url: ajaxurl,
|
8 |
-
data: {
|
9 |
-
action: 'bp_dismiss_notice',
|
10 |
-
nonce: $( '#bp-dismissible-nonce-' + notice_id ).val(),
|
11 |
-
notice_id: $notice.data( 'noticeid' )
|
12 |
-
}
|
13 |
-
} );
|
14 |
-
} );
|
15 |
-
});
|
16 |
-
}(jQuery));
|
1 |
+
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"XBG5":[function(require,module,exports) {
|
2 |
+
window.bp=window.bp||{},bp.DismissibleAdminNotices=class{constructor(t){this.settings=t||{}}start(){const{url:t,nonce:e}=this.settings;t&&e&&document.querySelectorAll(".bp-is-dismissible").forEach(s=>{s.addEventListener("click",s=>{s.preventDefault();const n=s.target;if(n.classList.contains("loading"))return;n.classList.add("loading");const{notice_id:i}=n.dataset,o=n.closest(".bp-notice-container"),c=new Headers({"X-BP-Nonce":e}),d=new FormData;d.append("action","bp_dismiss_notice"),d.append("notice_id",i),fetch(t,{method:"POST",headers:c,body:d}).then(t=>t.json()).then(t=>{const{success:e}=t;e?o.remove():n.classList.remove("loading")})})})}};const t=window.bpDismissibleAdminNoticesSettings||{},e=new bp.DismissibleAdminNotices(t);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e.start()):e.start();
|
3 |
+
},{}]},{},["XBG5"], null)
|
4 |
+
//# sourceMappingURL=/bp-core/admin/js/dismissible-admin-notices.js.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["bp-core/admin/js/dismissible-admin-notices.js"],"names":["window","bp","DismissibleAdminNotices","constructor","settings","start","url","nonce","document","querySelectorAll","forEach","notice","addEventListener","event","preventDefault","noticeLink","target","classList","contains","add","notice_id","dataset","noticeContainer","closest","noticeHeaders","Headers","noticeData","FormData","append","fetch","method","headers","body","then","response","json","data","success","remove","bpDismissibleAdminNoticesSettings","bpDismissibleAdminNotices","readyState"],"mappings":";AACAA,OAAOC,GAAKD,OAAOC,IAAM,GAOzBA,GAAGC,wBAA0B,MAC5BC,YAAaC,GACPA,KAAAA,SAAWA,GAAY,GAG7BC,QACO,MAAA,IAAEC,EAAF,MAAOC,GAAU,KAAKH,SAErBE,GAASC,GAIhBC,SAASC,iBAAkB,sBAAuBC,QAAWC,IAC5DA,EAAOC,iBAAkB,QAAWC,IACnCA,EAAMC,iBAEAC,MAAAA,EAAaF,EAAMG,OACpBD,GAAAA,EAAWE,UAAUC,SAAU,WACnC,OAIDH,EAAWE,UAAUE,IAAK,WAGpB,MAAA,UAAEC,GAAcL,EAAWM,QAC3BC,EAAkBP,EAAWQ,QAAS,wBAGtCC,EAAgB,IAAIC,QAAS,CACnBlB,aAAAA,IAIVmB,EAAa,IAAIC,SACvBD,EAAWE,OAAQ,SAAU,qBAC7BF,EAAWE,OAAQ,YAAaR,GAEhCS,MAAOvB,EAAK,CACXwB,OAAQ,OACRC,QAASP,EACTQ,KAAMN,IACHO,KAAQC,GACJA,EAASC,QACbF,KAAQG,IACL,MAAA,QAAEC,GAAYD,EAEfC,EACJf,EAAgBgB,SAEhBvB,EAAWE,UAAUqB,OAAQ,mBAQnC,MAAMlC,EAAWJ,OAAOuC,mCAAqC,GACvDC,EAA4B,IAAIvC,GAAGC,wBAAyBE,GAE7D,YAAcI,SAASiC,WAC3BjC,SAASI,iBAAkB,mBAAoB4B,EAA0BnC,SAEzEmC,EAA0BnC","file":"dismissible-admin-notices.js","sourceRoot":"../src/js","sourcesContent":["// Use the bp global.\nwindow.bp = window.bp || {};\n\n/**\n * Use an XHR request to dismiss admin notices.\n *\n * @since 10.0.0\n */\nbp.DismissibleAdminNotices = class {\n\tconstructor( settings ) {\n\t\tthis.settings = settings || {};\n\t}\n\n\tstart() {\n\t\tconst { url, nonce } = this.settings;\n\n\t\tif ( ! url || ! nonce ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdocument.querySelectorAll( '.bp-is-dismissible' ).forEach( ( notice ) => {\n\t\t\tnotice.addEventListener( 'click', ( event ) => {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst noticeLink = event.target;\n\t\t\t\tif ( noticeLink.classList.contains( 'loading' ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Prevent multiple clicks.\n\t\t\t\tnoticeLink.classList.add( 'loading' );\n\n\t\t\t\t// Set the notice ID & notice container.\n\t\t\t\tconst { notice_id } = noticeLink.dataset;\n\t\t\t\tconst noticeContainer = noticeLink.closest( '.bp-notice-container' );\n\n\t\t\t\t// Set notice headers.\n\t\t\t\tconst noticeHeaders = new Headers( {\n\t\t\t\t\t'X-BP-Nonce' : nonce,\n\t\t\t\t} );\n\n\t\t\t\t// Set notice data.\n\t\t\t\tconst noticeData = new FormData();\n\t\t\t\tnoticeData.append( 'action', 'bp_dismiss_notice' );\n\t\t\t\tnoticeData.append( 'notice_id', notice_id );\n\n\t\t\t\tfetch( url, {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: noticeHeaders,\n\t\t\t\t\tbody: noticeData,\n\t\t\t\t} ).then( ( response ) => {\n\t\t\t\t\treturn response.json();\n\t\t\t\t} ).then( ( data ) => {\n\t\t\t\t\tconst { success } = data;\n\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tnoticeContainer.remove();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnoticeLink.classList.remove( 'loading' );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t}\n}\n\nconst settings = window.bpDismissibleAdminNoticesSettings || {};\nconst bpDismissibleAdminNotices = new bp.DismissibleAdminNotices( settings );\n\nif ( 'loading' === document.readyState ) {\n\tdocument.addEventListener( 'DOMContentLoaded', bpDismissibleAdminNotices.start() );\n} else {\n\tbpDismissibleAdminNotices.start();\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1 |
-
!function(s){s(document).ready(function(){s(".bp-is-dismissible .notice-dismiss").click(function(){var i=s(this).closest(".notice"),n=i.data("noticeid");s.post({url:ajaxurl,data:{action:"bp_dismiss_notice",nonce:s("#bp-dismissible-nonce-"+n).val(),notice_id:i.data("noticeid")}})})})}(jQuery);
|
|
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @since 3.0.0
|
6 |
*/
|
7 |
-
(function( $,
|
8 |
// Bail if not set
|
9 |
if ( typeof bpHelloStrings === 'undefined' ) {
|
10 |
return;
|
@@ -19,32 +19,7 @@
|
|
19 |
}
|
20 |
|
21 |
window.tb_show( 'BuddyPress', '#TB_inline?inlineId=bp-hello-container' );
|
22 |
-
|
23 |
-
$( '#TB_window' ).attr( {
|
24 |
-
'role': 'dialog',
|
25 |
-
'aria-label': bpHelloStrings.modalLabel
|
26 |
-
} )
|
27 |
-
.addClass( 'plugin-details-modal' )
|
28 |
-
.removeClass( 'thickbox-loading' );
|
29 |
-
|
30 |
-
$( '#TB_ajaxContent' ).prop( 'style', 'height: 100%; width: auto; padding: 0; border: none;' );
|
31 |
-
|
32 |
-
var tabbables = $( ':tabbable', '#TB_ajaxContent' ), lastTabbable = tabbables.last();
|
33 |
-
|
34 |
-
// Move the focus to the Modal's close button once the last Hello link was tabbed out.
|
35 |
-
$( '#TB_window' ).on( 'keydown', function( event ) {
|
36 |
-
if ( 9 === event.keyCode && ! event.shiftKey && $( lastTabbable ).prop( 'classList' ).value === $( event.target ).prop( 'classList' ).value ) {
|
37 |
-
event.preventDefault();
|
38 |
-
|
39 |
-
$( '#TB_closeWindowButton' ).focus();
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( 9 === event.keyCode && event.shiftKey && 'TB_closeWindowButton' === $( event.target ).prop( 'id' ) ) {
|
43 |
-
event.preventDefault();
|
44 |
-
|
45 |
-
$( lastTabbable ).focus();
|
46 |
-
}
|
47 |
-
} );
|
48 |
};
|
49 |
|
50 |
/**
|
@@ -79,7 +54,7 @@
|
|
79 |
|
80 |
$( '#TB_window' ).addClass( 'thickbox-loading' );
|
81 |
|
82 |
-
|
83 |
url: anchor.data( 'endpoint' ),
|
84 |
type: 'GET',
|
85 |
beforeSend: function( xhr, settings ) {
|
@@ -118,8 +93,8 @@
|
|
118 |
} );
|
119 |
|
120 |
// Init modal after the screen's loaded.
|
121 |
-
$(
|
122 |
bpHelloOpenModal();
|
123 |
} );
|
124 |
|
125 |
-
}( jQuery, window.
|
4 |
*
|
5 |
* @since 3.0.0
|
6 |
*/
|
7 |
+
(function( $, wp ) {
|
8 |
// Bail if not set
|
9 |
if ( typeof bpHelloStrings === 'undefined' ) {
|
10 |
return;
|
19 |
}
|
20 |
|
21 |
window.tb_show( 'BuddyPress', '#TB_inline?inlineId=bp-hello-container' );
|
22 |
+
window.bpAdjustThickbox( bpHelloStrings.modalLabel );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
};
|
24 |
|
25 |
/**
|
54 |
|
55 |
$( '#TB_window' ).addClass( 'thickbox-loading' );
|
56 |
|
57 |
+
wp.apiRequest( {
|
58 |
url: anchor.data( 'endpoint' ),
|
59 |
type: 'GET',
|
60 |
beforeSend: function( xhr, settings ) {
|
93 |
} );
|
94 |
|
95 |
// Init modal after the screen's loaded.
|
96 |
+
$( function() {
|
97 |
bpHelloOpenModal();
|
98 |
} );
|
99 |
|
100 |
+
}( jQuery, window.wp || {} ) );
|
@@ -1 +1 @@
|
|
1 |
-
!function(o,t){var
|
1 |
+
!function(o,t){var i;"undefined"!=typeof bpHelloStrings&&(i=function(n){n=n||bpHelloStrings.pageNotFound,o("#dynamic-content").html(o("<div></div>").prop("id","message").addClass("notice notice-error error").html(o("<p></p>").html(n)))},o("#plugin-information-tabs").on("click","a",function(n){n.preventDefault();var n=o(n.currentTarget),e=o("#dynamic-content");n.hasClass("dynamic")?(o("#top-features").hide(),e.html(""),e.addClass("show"),o("#TB_window").addClass("thickbox-loading"),t.apiRequest({url:n.data("endpoint"),type:"GET",beforeSend:function(n,e){e.url=e.url.replace("&_wpnonce=none","")},data:{context:"view",slug:n.data("slug"),_wpnonce:"none"}}).done(function(n){n=_.first(n);n&&n.content?e.html(n.content.rendered):i()}).fail(function(n){return!(!n||!n.message)&&void i(n.message)}).always(function(){o("#TB_window").removeClass("thickbox-loading")})):(o("#top-features").show(),e.html(""),e.removeClass("show"))}),o(function(){!function(){if("function"!=typeof window.tb_show)return;window.tb_show("BuddyPress","#TB_inline?inlineId=bp-hello-container"),window.bpAdjustThickbox(bpHelloStrings.modalLabel)}()}))}(jQuery,window.wp||{});
|
@@ -91,11 +91,14 @@ function bp_attachments_cover_image_upload_dir( $args = array() ) {
|
|
91 |
$object_directory = 'groups';
|
92 |
}
|
93 |
|
94 |
-
$r = bp_parse_args(
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
99 |
|
100 |
// Set the subdir.
|
101 |
$subdir = '/' . $r['object_directory'] . '/' . $r['object_id'] . '/cover-image';
|
@@ -160,7 +163,8 @@ function bp_attachments_get_max_upload_file_size( $type = '' ) {
|
|
160 |
*/
|
161 |
function bp_attachments_get_allowed_types( $type = 'avatar' ) {
|
162 |
// Defaults to BuddyPress supported image extensions.
|
163 |
-
$exts
|
|
|
164 |
|
165 |
/**
|
166 |
* It's not a BuddyPress feature, get the allowed extensions
|
@@ -170,37 +174,33 @@ function bp_attachments_get_allowed_types( $type = 'avatar' ) {
|
|
170 |
// Reset the default exts.
|
171 |
$exts = array();
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
if ( '' !== $type ) {
|
193 |
-
$allowed_mimes = preg_grep( '/' . addcslashes( $type, '/.+-' ) . '/', $allowed_mimes );
|
194 |
-
}
|
195 |
|
196 |
-
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
break;
|
204 |
}
|
205 |
}
|
206 |
|
@@ -229,8 +229,18 @@ function bp_attachments_get_allowed_mimes( $type = '', $allowed_types = array()
|
|
229 |
$allowed_types = bp_attachments_get_allowed_types( $type );
|
230 |
}
|
231 |
|
232 |
-
$
|
233 |
-
$allowed_mimes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
/**
|
236 |
* Include jpg type if jpeg is set
|
@@ -286,16 +296,20 @@ function bp_attachments_create_item_type( $type = 'avatar', $args = array() ) {
|
|
286 |
return false;
|
287 |
}
|
288 |
|
289 |
-
$r = bp_parse_args(
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
299 |
|
300 |
if ( empty( $r['item_id'] ) || empty( $r['object'] ) || ! file_exists( $r['image'] ) || ! @getimagesize( $r['image'] ) ) {
|
301 |
return false;
|
@@ -395,24 +409,28 @@ function bp_attachments_create_item_type( $type = 'avatar', $args = array() ) {
|
|
395 |
|
396 |
// It's an avatar, we need to crop it.
|
397 |
if ( 'avatar' === $type ) {
|
398 |
-
$created = bp_core_avatar_handle_crop(
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
|
|
408 |
|
409 |
// It's a cover image we need to fit it to feature's dimensions.
|
410 |
} elseif ( 'cover_image' === $type ) {
|
411 |
-
$cover_image = bp_attachments_cover_image_generate_file(
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
|
|
|
|
416 |
|
417 |
$created = ! empty( $cover_image['cover_file'] );
|
418 |
}
|
@@ -445,12 +463,16 @@ function bp_attachments_get_attachment( $data = 'url', $args = array() ) {
|
|
445 |
// Default value.
|
446 |
$attachment_data = false;
|
447 |
|
448 |
-
$r = bp_parse_args(
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
|
|
|
|
|
|
|
|
454 |
|
455 |
/**
|
456 |
* Filters whether or not to handle fetching a BuddyPress image attachment.
|
@@ -697,21 +719,25 @@ function bp_attachments_enqueue_scripts( $class = '' ) {
|
|
697 |
}
|
698 |
|
699 |
// Get an instance of the class and get the script data.
|
700 |
-
$attachment
|
701 |
-
$script_data
|
702 |
-
|
703 |
-
$args = bp_parse_args(
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
|
|
|
|
|
|
|
|
715 |
|
716 |
if ( empty( $args['action'] ) || empty( $args['file_data_name'] ) ) {
|
717 |
return new WP_Error( 'missing_parameter' );
|
@@ -765,23 +791,58 @@ function bp_attachments_enqueue_scripts( $class = '' ) {
|
|
765 |
// Avatar only need 1 file and 1 only!
|
766 |
$defaults['multi_selection'] = false;
|
767 |
|
768 |
-
// Does the object already has an avatar set
|
769 |
$has_avatar = $defaults['multipart_params']['bp_params']['has_avatar'];
|
770 |
|
771 |
-
// What is the object the avatar belongs to
|
772 |
$object = $defaults['multipart_params']['bp_params']['object'];
|
773 |
|
|
|
|
|
|
|
774 |
// Init the Avatar nav.
|
775 |
$avatar_nav = array(
|
776 |
-
'upload'
|
777 |
-
|
778 |
-
|
779 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
780 |
);
|
781 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
// Create the Camera Nav if the WebCam capture feature is enabled.
|
783 |
if ( bp_avatar_use_webcam() && 'user' === $object ) {
|
784 |
-
$avatar_nav['camera'] = array(
|
|
|
|
|
|
|
|
|
785 |
|
786 |
// Set warning messages.
|
787 |
$strings['camera_warnings'] = array(
|
@@ -1021,7 +1082,7 @@ function bp_attachments_get_cover_image_settings( $component = 'members' ) {
|
|
1021 |
}
|
1022 |
|
1023 |
// Set default args.
|
1024 |
-
$default_args =
|
1025 |
$args,
|
1026 |
array(
|
1027 |
'components' => array(),
|
@@ -1049,7 +1110,11 @@ function bp_attachments_get_cover_image_settings( $component = 'members' ) {
|
|
1049 |
*
|
1050 |
* @param array $settings The cover image settings
|
1051 |
*/
|
1052 |
-
$settings = bp_parse_args(
|
|
|
|
|
|
|
|
|
1053 |
|
1054 |
// Handle deprecated xProfile fitler.
|
1055 |
if ( 'members' === $component ) {
|
@@ -1281,10 +1346,14 @@ function bp_attachments_cover_image_ajax_upload() {
|
|
1281 |
bp_attachments_json_response( false, $is_html4 );
|
1282 |
}
|
1283 |
|
1284 |
-
$bp_params = bp_parse_args(
|
1285 |
-
'
|
1286 |
-
|
1287 |
-
|
|
|
|
|
|
|
|
|
1288 |
|
1289 |
$bp_params['item_id'] = (int) $bp_params['item_id'];
|
1290 |
$bp_params['object'] = sanitize_text_field( $bp_params['object'] );
|
@@ -1567,3 +1636,90 @@ function bp_attachments_cover_image_ajax_delete() {
|
|
1567 |
}
|
1568 |
}
|
1569 |
add_action( 'wp_ajax_bp_cover_image_delete', 'bp_attachments_cover_image_ajax_delete' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$object_directory = 'groups';
|
92 |
}
|
93 |
|
94 |
+
$r = bp_parse_args(
|
95 |
+
$args,
|
96 |
+
array(
|
97 |
+
'object_id' => $object_id,
|
98 |
+
'object_directory' => $object_directory,
|
99 |
+
),
|
100 |
+
'cover_image_upload_dir'
|
101 |
+
);
|
102 |
|
103 |
// Set the subdir.
|
104 |
$subdir = '/' . $r['object_directory'] . '/' . $r['object_id'] . '/cover-image';
|
163 |
*/
|
164 |
function bp_attachments_get_allowed_types( $type = 'avatar' ) {
|
165 |
// Defaults to BuddyPress supported image extensions.
|
166 |
+
$exts = array( 'jpeg', 'gif', 'png' );
|
167 |
+
$wp_exts = wp_get_ext_types();
|
168 |
|
169 |
/**
|
170 |
* It's not a BuddyPress feature, get the allowed extensions
|
174 |
// Reset the default exts.
|
175 |
$exts = array();
|
176 |
|
177 |
+
if ( 'video' === $type ) {
|
178 |
+
$exts = wp_get_video_extensions();
|
179 |
+
} elseif ( 'audio' === $type ) {
|
180 |
+
$exts = wp_get_audio_extensions();
|
181 |
+
} elseif ( isset( $wp_exts[ $type ] ) ) {
|
182 |
+
$exts = $wp_exts[ $type ];
|
183 |
+
} else {
|
184 |
+
$allowed_mimes = get_allowed_mime_types();
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Search for allowed mimes matching the type.
|
188 |
+
*
|
189 |
+
* Eg: using 'application/vnd.oasis' as the $type
|
190 |
+
* parameter will get all OpenOffice extensions supported
|
191 |
+
* by WordPress and allowed for the current user.
|
192 |
+
*/
|
193 |
+
if ( '' !== $type ) {
|
194 |
+
$allowed_mimes = preg_grep( '/' . addcslashes( $type, '/.+-' ) . '/', $allowed_mimes );
|
195 |
+
}
|
|
|
|
|
|
|
196 |
|
197 |
+
$allowed_types = array_keys( $allowed_mimes );
|
198 |
|
199 |
+
// Loop to explode keys using '|'.
|
200 |
+
foreach ( $allowed_types as $allowed_type ) {
|
201 |
+
$t = explode( '|', $allowed_type );
|
202 |
+
$exts = array_merge( $exts, (array) $t );
|
203 |
+
}
|
|
|
204 |
}
|
205 |
}
|
206 |
|
229 |
$allowed_types = bp_attachments_get_allowed_types( $type );
|
230 |
}
|
231 |
|
232 |
+
$wp_mimes = wp_get_mime_types();
|
233 |
+
$allowed_mimes = array();
|
234 |
+
|
235 |
+
foreach ( $allowed_types as $allowed_type ) {
|
236 |
+
$filetype = wp_check_filetype( '.' . $allowed_type, $wp_mimes );
|
237 |
+
|
238 |
+
if ( false === $filetype['ext'] || false === $filetype['type'] ) {
|
239 |
+
continue;
|
240 |
+
}
|
241 |
+
|
242 |
+
$allowed_mimes[ $filetype['ext'] ] = $filetype['type'];
|
243 |
+
}
|
244 |
|
245 |
/**
|
246 |
* Include jpg type if jpeg is set
|
296 |
return false;
|
297 |
}
|
298 |
|
299 |
+
$r = bp_parse_args(
|
300 |
+
$args,
|
301 |
+
array(
|
302 |
+
'item_id' => 0,
|
303 |
+
'object' => 'user',
|
304 |
+
'component' => '',
|
305 |
+
'image' => '',
|
306 |
+
'crop_w' => 0,
|
307 |
+
'crop_h' => 0,
|
308 |
+
'crop_x' => 0,
|
309 |
+
'crop_y' => 0,
|
310 |
+
),
|
311 |
+
'create_item_' . $type
|
312 |
+
);
|
313 |
|
314 |
if ( empty( $r['item_id'] ) || empty( $r['object'] ) || ! file_exists( $r['image'] ) || ! @getimagesize( $r['image'] ) ) {
|
315 |
return false;
|
409 |
|
410 |
// It's an avatar, we need to crop it.
|
411 |
if ( 'avatar' === $type ) {
|
412 |
+
$created = bp_core_avatar_handle_crop(
|
413 |
+
array(
|
414 |
+
'object' => $r['object'],
|
415 |
+
'avatar_dir' => trim( dirname( $attachment_data['subdir'] ), '/' ),
|
416 |
+
'item_id' => (int) $r['item_id'],
|
417 |
+
'original_file' => trailingslashit( $attachment_data['subdir'] ) . $image_file_name,
|
418 |
+
'crop_w' => $r['crop_w'],
|
419 |
+
'crop_h' => $r['crop_h'],
|
420 |
+
'crop_x' => $r['crop_x'],
|
421 |
+
'crop_y' => $r['crop_y']
|
422 |
+
)
|
423 |
+
);
|
424 |
|
425 |
// It's a cover image we need to fit it to feature's dimensions.
|
426 |
} elseif ( 'cover_image' === $type ) {
|
427 |
+
$cover_image = bp_attachments_cover_image_generate_file(
|
428 |
+
array(
|
429 |
+
'file' => $image_file_path,
|
430 |
+
'component' => $r['component'],
|
431 |
+
'cover_image_dir' => $attachment_data['path']
|
432 |
+
)
|
433 |
+
);
|
434 |
|
435 |
$created = ! empty( $cover_image['cover_file'] );
|
436 |
}
|
463 |
// Default value.
|
464 |
$attachment_data = false;
|
465 |
|
466 |
+
$r = bp_parse_args(
|
467 |
+
$args,
|
468 |
+
array(
|
469 |
+
'object_dir' => 'members',
|
470 |
+
'item_id' => bp_loggedin_user_id(),
|
471 |
+
'type' => 'cover-image',
|
472 |
+
'file' => '',
|
473 |
+
),
|
474 |
+
'attachments_get_attachment_src'
|
475 |
+
);
|
476 |
|
477 |
/**
|
478 |
* Filters whether or not to handle fetching a BuddyPress image attachment.
|
719 |
}
|
720 |
|
721 |
// Get an instance of the class and get the script data.
|
722 |
+
$attachment = new $class;
|
723 |
+
$script_data = $attachment->script_data();
|
724 |
+
|
725 |
+
$args = bp_parse_args(
|
726 |
+
$script_data,
|
727 |
+
array(
|
728 |
+
'action' => '',
|
729 |
+
'file_data_name' => '',
|
730 |
+
'max_file_size' => 0,
|
731 |
+
'browse_button' => 'bp-browse-button',
|
732 |
+
'container' => 'bp-upload-ui',
|
733 |
+
'drop_element' => 'drag-drop-area',
|
734 |
+
'bp_params' => array(),
|
735 |
+
'extra_css' => array(),
|
736 |
+
'extra_js' => array(),
|
737 |
+
'feedback_messages' => array(),
|
738 |
+
),
|
739 |
+
'attachments_enqueue_scripts'
|
740 |
+
);
|
741 |
|
742 |
if ( empty( $args['action'] ) || empty( $args['file_data_name'] ) ) {
|
743 |
return new WP_Error( 'missing_parameter' );
|
791 |
// Avatar only need 1 file and 1 only!
|
792 |
$defaults['multi_selection'] = false;
|
793 |
|
794 |
+
// Does the object already has an avatar set?
|
795 |
$has_avatar = $defaults['multipart_params']['bp_params']['has_avatar'];
|
796 |
|
797 |
+
// What is the object the avatar belongs to?
|
798 |
$object = $defaults['multipart_params']['bp_params']['object'];
|
799 |
|
800 |
+
// Get The item id.
|
801 |
+
$item_id = $defaults['multipart_params']['bp_params']['item_id'];
|
802 |
+
|
803 |
// Init the Avatar nav.
|
804 |
$avatar_nav = array(
|
805 |
+
'upload' => array(
|
806 |
+
'id' => 'upload',
|
807 |
+
'caption' => __( 'Upload', 'buddypress' ),
|
808 |
+
'order' => 0
|
809 |
+
),
|
810 |
+
'delete' => array(
|
811 |
+
'id' => 'delete',
|
812 |
+
'caption' => __( 'Delete', 'buddypress' ),
|
813 |
+
'order' => 100,
|
814 |
+
'hide' => (int) ! $has_avatar
|
815 |
+
),
|
816 |
);
|
817 |
|
818 |
+
if ( 'user' === $object ) {
|
819 |
+
// Look inside history to see if the user previously uploaded avatars.
|
820 |
+
$avatars_history = bp_avatar_get_avatars_history( $item_id, $object );
|
821 |
+
|
822 |
+
if ( $avatars_history ) {
|
823 |
+
ksort( $avatars_history );
|
824 |
+
$settings['history'] = array_values( $avatars_history );
|
825 |
+
$settings['historyNonces'] = array(
|
826 |
+
'recylePrevious' => wp_create_nonce( 'bp_avatar_recycle_previous' ),
|
827 |
+
'deletePrevious' => wp_create_nonce( 'bp_avatar_delete_previous' ),
|
828 |
+
);
|
829 |
+
|
830 |
+
$avatar_nav['recycle'] = array(
|
831 |
+
'id' => 'recycle',
|
832 |
+
'caption' => __( 'Recycle', 'buddypress' ),
|
833 |
+
'order' => 20,
|
834 |
+
'hide' => (int) empty( $avatars_history ),
|
835 |
+
);
|
836 |
+
}
|
837 |
+
}
|
838 |
+
|
839 |
// Create the Camera Nav if the WebCam capture feature is enabled.
|
840 |
if ( bp_avatar_use_webcam() && 'user' === $object ) {
|
841 |
+
$avatar_nav['camera'] = array(
|
842 |
+
'id' => 'camera',
|
843 |
+
'caption' => __( 'Take Photo', 'buddypress' ),
|
844 |
+
'order' => 10
|
845 |
+
);
|
846 |
|
847 |
// Set warning messages.
|
848 |
$strings['camera_warnings'] = array(
|
1082 |
}
|
1083 |
|
1084 |
// Set default args.
|
1085 |
+
$default_args = bp_parse_args(
|
1086 |
$args,
|
1087 |
array(
|
1088 |
'components' => array(),
|
1110 |
*
|
1111 |
* @param array $settings The cover image settings
|
1112 |
*/
|
1113 |
+
$settings = bp_parse_args(
|
1114 |
+
$args,
|
1115 |
+
$default_args,
|
1116 |
+
$component . '_cover_image_settings'
|
1117 |
+
);
|
1118 |
|
1119 |
// Handle deprecated xProfile fitler.
|
1120 |
if ( 'members' === $component ) {
|
1346 |
bp_attachments_json_response( false, $is_html4 );
|
1347 |
}
|
1348 |
|
1349 |
+
$bp_params = bp_parse_args(
|
1350 |
+
$_POST['bp_params'],
|
1351 |
+
array(
|
1352 |
+
'object' => 'user',
|
1353 |
+
'item_id' => bp_loggedin_user_id(),
|
1354 |
+
),
|
1355 |
+
'attachments_cover_image_ajax_upload'
|
1356 |
+
);
|
1357 |
|
1358 |
$bp_params['item_id'] = (int) $bp_params['item_id'];
|
1359 |
$bp_params['object'] = sanitize_text_field( $bp_params['object'] );
|
1636 |
}
|
1637 |
}
|
1638 |
add_action( 'wp_ajax_bp_cover_image_delete', 'bp_attachments_cover_image_ajax_delete' );
|
1639 |
+
|
1640 |
+
/**
|
1641 |
+
* List the files of a directory.
|
1642 |
+
*
|
1643 |
+
* @since 10.0.0
|
1644 |
+
*
|
1645 |
+
* @param string $directory_path Absolute path of a directory.
|
1646 |
+
* @return array The file objects list of the directory.
|
1647 |
+
*/
|
1648 |
+
function bp_attachments_list_directory_files( $directory_path = '' ) {
|
1649 |
+
if ( ! is_dir( $directory_path ) ) {
|
1650 |
+
return array();
|
1651 |
+
}
|
1652 |
+
|
1653 |
+
$files = array();
|
1654 |
+
$iterator = new FilesystemIterator( $directory_path, FilesystemIterator::SKIP_DOTS );
|
1655 |
+
|
1656 |
+
foreach ( $iterator as $file ) {
|
1657 |
+
$_file = new stdClass();
|
1658 |
+
|
1659 |
+
$_file->name = $file->getfilename();
|
1660 |
+
$_file->path = $file->getPathname();
|
1661 |
+
$_file->size = $file->getSize();
|
1662 |
+
$_file->type = $file->getType();
|
1663 |
+
$_file->mime_type = mime_content_type( $_file->path );
|
1664 |
+
$_file->last_modified = $file->getMTime();
|
1665 |
+
$_file->latest_access_date = $file->getATime();
|
1666 |
+
$_file->id = pathinfo( $_file->name, PATHINFO_FILENAME );
|
1667 |
+
$files[ $_file->id ] = $_file;
|
1668 |
+
}
|
1669 |
+
|
1670 |
+
return $files;
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
/**
|
1674 |
+
* List the files of a directory recursively and eventually find a file using its ID.
|
1675 |
+
*
|
1676 |
+
* @since 10.0.0
|
1677 |
+
*
|
1678 |
+
* @param string $directory_path Absolute path of a directory.
|
1679 |
+
* @param string $find The file ID to find into the directory or its children.
|
1680 |
+
* @return array The file objects list of the directory and subdirectories.
|
1681 |
+
*/
|
1682 |
+
function bp_attachments_list_directory_files_recursively( $directory_path = '', $find = '' ) {
|
1683 |
+
if ( ! is_dir( $directory_path ) ) {
|
1684 |
+
return array();
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
$files = array();
|
1688 |
+
$directory = new RecursiveDirectoryIterator( $directory_path, FilesystemIterator::SKIP_DOTS );
|
1689 |
+
$iterator = new RecursiveIteratorIterator( $directory, RecursiveIteratorIterator::CHILD_FIRST );
|
1690 |
+
$bp_upload = bp_upload_dir();
|
1691 |
+
$basedir = str_replace( '\\', '/', $bp_upload['basedir'] );
|
1692 |
+
|
1693 |
+
foreach ( $iterator as $file ) {
|
1694 |
+
$_file = new stdClass();
|
1695 |
+
|
1696 |
+
$_file->name = $file->getfilename();
|
1697 |
+
$_file->path = $file->getPathname();
|
1698 |
+
$_file->size = $file->getSize();
|
1699 |
+
$_file->type = $file->getType();
|
1700 |
+
$_file->mime_type = mime_content_type( $_file->path );
|
1701 |
+
$_file->last_modified = $file->getMTime();
|
1702 |
+
$_file->latest_access_date = $file->getATime();
|
1703 |
+
$_file->parent_dir_path = str_replace( '\\', '/', dirname( $_file->path ) );
|
1704 |
+
$_file->parent_dir_url = str_replace( $basedir, $bp_upload['baseurl'], $_file->parent_dir_path );
|
1705 |
+
$_file->id = pathinfo( $_file->name, PATHINFO_FILENAME );
|
1706 |
+
|
1707 |
+
// Ensure URL is https if SSL is set/forced.
|
1708 |
+
if ( is_ssl() ) {
|
1709 |
+
$_file->parent_dir_url = str_replace( 'http://', 'https://', $_file->parent_dir_url );
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
$file_id = $_file->id;
|
1713 |
+
if ( $_file->parent_dir_path !== $directory_path ) {
|
1714 |
+
$file_id = trailingslashit( str_replace( trailingslashit( $directory_path ), '', $_file->parent_dir_path ) ) . $file_id;
|
1715 |
+
}
|
1716 |
+
|
1717 |
+
$files[ $file_id ] = $_file;
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
if ( $find ) {
|
1721 |
+
return wp_filter_object_list( $files, array( 'id' => $find ) );
|
1722 |
+
}
|
1723 |
+
|
1724 |
+
return $files;
|
1725 |
+
}
|
@@ -231,25 +231,28 @@ function bp_core_fetch_avatar( $args = '' ) {
|
|
231 |
}
|
232 |
|
233 |
// Set the default variables array and parse it against incoming $args array.
|
234 |
-
$params =
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
253 |
|
254 |
/* Set item_id ***********************************************************/
|
255 |
|
@@ -765,7 +768,10 @@ function bp_core_delete_existing_avatar( $args = '' ) {
|
|
765 |
'avatar_dir' => false
|
766 |
);
|
767 |
|
768 |
-
$args =
|
|
|
|
|
|
|
769 |
|
770 |
/**
|
771 |
* Filters whether or not to handle deleting an existing avatar.
|
@@ -975,6 +981,7 @@ function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
|
|
975 |
}
|
976 |
|
977 |
// Maybe resize.
|
|
|
978 |
$bp->avatar_admin->resized = $avatar_attachment->shrink( $bp->avatar_admin->original['file'], $ui_available_width );
|
979 |
$bp->avatar_admin->image = new stdClass();
|
980 |
|
@@ -997,8 +1004,16 @@ function bp_core_avatar_handle_upload( $file, $upload_dir_filter ) {
|
|
997 |
|
998 |
// If the uploaded image is smaller than the "full" dimensions, throw a warning.
|
999 |
if ( $avatar_attachment->is_too_small( $bp->avatar_admin->image->file ) ) {
|
1000 |
-
|
1001 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1002 |
}
|
1003 |
|
1004 |
// Set the url value for the image.
|
@@ -1161,12 +1176,14 @@ add_action( 'wp_ajax_bp_avatar_upload', 'bp_avatar_ajax_upload' );
|
|
1161 |
* Handle avatar webcam capture.
|
1162 |
*
|
1163 |
* @since 2.3.0
|
|
|
1164 |
*
|
1165 |
* @param string $data Base64 encoded image.
|
1166 |
* @param int $item_id Item to associate.
|
1167 |
-
* @return
|
|
|
1168 |
*/
|
1169 |
-
function bp_avatar_handle_capture( $data = '', $item_id = 0 ) {
|
1170 |
if ( empty( $data ) || empty( $item_id ) ) {
|
1171 |
return false;
|
1172 |
}
|
@@ -1222,6 +1239,10 @@ function bp_avatar_handle_capture( $data = '', $item_id = 0 ) {
|
|
1222 |
// Crop to default values.
|
1223 |
$crop_args = array( 'item_id' => $item_id, 'original_file' => $avatar_to_crop, 'crop_x' => 0, 'crop_y' => 0 );
|
1224 |
|
|
|
|
|
|
|
|
|
1225 |
return bp_core_avatar_handle_crop( $crop_args );
|
1226 |
} else {
|
1227 |
return false;
|
@@ -1232,6 +1253,7 @@ function bp_avatar_handle_capture( $data = '', $item_id = 0 ) {
|
|
1232 |
* Crop an uploaded avatar.
|
1233 |
*
|
1234 |
* @since 1.1.0
|
|
|
1235 |
*
|
1236 |
* @param array|string $args {
|
1237 |
* Array of function parameters.
|
@@ -1250,20 +1272,24 @@ function bp_avatar_handle_capture( $data = '', $item_id = 0 ) {
|
|
1250 |
* @type int $crop_x The horizontal starting point of the crop. Default: 0.
|
1251 |
* @type int $crop_y The vertical starting point of the crop. Default: 0.
|
1252 |
* }
|
1253 |
-
* @return
|
|
|
1254 |
*/
|
1255 |
-
function bp_core_avatar_handle_crop( $args = '' ) {
|
1256 |
-
|
1257 |
-
$r =
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
|
|
|
|
|
|
1267 |
|
1268 |
/**
|
1269 |
* Filters whether or not to handle cropping.
|
@@ -1288,6 +1314,10 @@ function bp_core_avatar_handle_crop( $args = '' ) {
|
|
1288 |
return false;
|
1289 |
}
|
1290 |
|
|
|
|
|
|
|
|
|
1291 |
return true;
|
1292 |
}
|
1293 |
|
@@ -1307,12 +1337,15 @@ function bp_avatar_ajax_set() {
|
|
1307 |
// Check the nonce.
|
1308 |
check_admin_referer( 'bp_avatar_cropstore', 'nonce' );
|
1309 |
|
1310 |
-
$avatar_data =
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
|
|
|
|
|
|
1316 |
|
1317 |
if ( empty( $avatar_data['object'] ) || empty( $avatar_data['item_id'] ) || empty( $avatar_data['original_file'] ) ) {
|
1318 |
wp_send_json_error();
|
@@ -1331,19 +1364,25 @@ function bp_avatar_ajax_set() {
|
|
1331 |
$webcam_avatar = base64_decode( $webcam_avatar );
|
1332 |
}
|
1333 |
|
1334 |
-
|
|
|
|
|
1335 |
wp_send_json_error( array(
|
1336 |
'feedback_code' => 1
|
1337 |
) );
|
1338 |
|
1339 |
} else {
|
1340 |
$return = array(
|
1341 |
-
'avatar' => esc_url(
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
|
|
|
|
|
|
|
|
1347 |
'feedback_code' => 2,
|
1348 |
'item_id' => $avatar_data['item_id'],
|
1349 |
);
|
@@ -1355,12 +1394,14 @@ function bp_avatar_ajax_set() {
|
|
1355 |
* Fires if the new avatar was successfully captured.
|
1356 |
*
|
1357 |
* @since 6.0.0
|
|
|
1358 |
*
|
1359 |
-
* @param string $item_id
|
1360 |
-
* @param string $type
|
1361 |
-
* @param array $avatar_data
|
|
|
1362 |
*/
|
1363 |
-
do_action( 'bp_members_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'], $avatar_data );
|
1364 |
|
1365 |
wp_send_json_success( $return );
|
1366 |
}
|
@@ -1392,14 +1433,20 @@ function bp_avatar_ajax_set() {
|
|
1392 |
);
|
1393 |
|
1394 |
// Handle crop.
|
1395 |
-
|
|
|
|
|
1396 |
$return = array(
|
1397 |
-
'avatar' => esc_url(
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
|
|
|
|
|
|
|
|
1403 |
'feedback_code' => 2,
|
1404 |
'item_id' => $avatar_data['item_id'],
|
1405 |
);
|
@@ -1409,10 +1456,10 @@ function bp_avatar_ajax_set() {
|
|
1409 |
do_action_deprecated( 'xprofile_avatar_uploaded', array( (int) $avatar_data['item_id'], $avatar_data['type'], $r ), '6.0.0', 'bp_members_avatar_uploaded' );
|
1410 |
|
1411 |
/** This action is documented in bp-core/bp-core-avatars.php */
|
1412 |
-
do_action( 'bp_members_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'], $r );
|
1413 |
} elseif ( 'group' === $avatar_data['object'] ) {
|
1414 |
/** This action is documented in bp-groups/bp-groups-screens.php */
|
1415 |
-
do_action( 'groups_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'], $r );
|
1416 |
}
|
1417 |
|
1418 |
wp_send_json_success( $return );
|
@@ -2101,3 +2148,435 @@ function bp_avatar_template_check() {
|
|
2101 |
bp_attachments_get_template_part( 'avatars/index' );
|
2102 |
}
|
2103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
|
233 |
// Set the default variables array and parse it against incoming $args array.
|
234 |
+
$params = bp_parse_args(
|
235 |
+
$args,
|
236 |
+
array(
|
237 |
+
'item_id' => false,
|
238 |
+
'object' => 'user',
|
239 |
+
'type' => 'thumb',
|
240 |
+
'avatar_dir' => false,
|
241 |
+
'width' => false,
|
242 |
+
'height' => false,
|
243 |
+
'class' => 'avatar',
|
244 |
+
'css_id' => false,
|
245 |
+
'alt' => '',
|
246 |
+
'email' => false,
|
247 |
+
'no_grav' => null,
|
248 |
+
'html' => true,
|
249 |
+
'title' => '',
|
250 |
+
'extra_attr' => '',
|
251 |
+
'scheme' => null,
|
252 |
+
'rating' => get_option( 'avatar_rating' ),
|
253 |
+
'force_default' => false,
|
254 |
+
)
|
255 |
+
);
|
256 |
|
257 |
/* Set item_id ***********************************************************/
|
258 |
|
768 |
'avatar_dir' => false
|
769 |
);
|
770 |
|
771 |
+
$args = bp_parse_args(
|
772 |
+
$args,
|
773 |
+
$defaults
|
774 |
+
);
|
775 |
|
776 |
/**
|
777 |
* Filters whether or not to handle deleting an existing avatar.
|
981 |
}
|
982 |
|
983 |
// Maybe resize.
|
984 |
+
$original_file_size = $avatar_attachment->get_image_data( $bp->avatar_admin->original['file'] );
|
985 |
$bp->avatar_admin->resized = $avatar_attachment->shrink( $bp->avatar_admin->original['file'], $ui_available_width );
|
986 |
$bp->avatar_admin->image = new stdClass();
|
987 |
|
1004 |
|
1005 |
// If the uploaded image is smaller than the "full" dimensions, throw a warning.
|
1006 |
if ( $avatar_attachment->is_too_small( $bp->avatar_admin->image->file ) ) {
|
1007 |
+
if ( isset( $original_file_size['width'] ) && $original_file_size['width'] > bp_core_avatar_full_width() ) {
|
1008 |
+
$aspect_ratio = number_format_i18n( bp_core_avatar_full_width() / bp_core_avatar_full_height(), 2 );
|
1009 |
+
|
1010 |
+
/* translators: %s: the value of the aspect ratio. */
|
1011 |
+
bp_core_add_message( sprintf( __( 'The aspect ratio of the image you selected is too great compared to the profile photo one. For best results, upload a picture having an aspect ratio closer to %s.', 'buddypress' ), $aspect_ratio ), 'error' );
|
1012 |
+
} else {
|
1013 |
+
|
1014 |
+
/* translators: 1: the advised width size in pixels. 2: the advised height size in pixels. */
|
1015 |
+
bp_core_add_message( sprintf( __( 'You have selected an image that is smaller than recommended. For best results, upload a picture larger than %1$d x %2$d pixels.', 'buddypress' ), bp_core_avatar_full_width(), bp_core_avatar_full_height() ), 'error' );
|
1016 |
+
}
|
1017 |
}
|
1018 |
|
1019 |
// Set the url value for the image.
|
1176 |
* Handle avatar webcam capture.
|
1177 |
*
|
1178 |
* @since 2.3.0
|
1179 |
+
* @since 10.0.0 Adds the `$return` param to eventually return the crop result.
|
1180 |
*
|
1181 |
* @param string $data Base64 encoded image.
|
1182 |
* @param int $item_id Item to associate.
|
1183 |
+
* @param string $return Whether to get the crop `array` or a `boolean`. Defaults to `boolean`.
|
1184 |
+
* @return array|bool True on success, false on failure.
|
1185 |
*/
|
1186 |
+
function bp_avatar_handle_capture( $data = '', $item_id = 0, $return = 'boolean' ) {
|
1187 |
if ( empty( $data ) || empty( $item_id ) ) {
|
1188 |
return false;
|
1189 |
}
|
1239 |
// Crop to default values.
|
1240 |
$crop_args = array( 'item_id' => $item_id, 'original_file' => $avatar_to_crop, 'crop_x' => 0, 'crop_y' => 0 );
|
1241 |
|
1242 |
+
if ( 'array' === $return ) {
|
1243 |
+
return bp_core_avatar_handle_crop( $crop_args, 'array' );
|
1244 |
+
}
|
1245 |
+
|
1246 |
return bp_core_avatar_handle_crop( $crop_args );
|
1247 |
} else {
|
1248 |
return false;
|
1253 |
* Crop an uploaded avatar.
|
1254 |
*
|
1255 |
* @since 1.1.0
|
1256 |
+
* @since 10.0.0 Adds the `$return` param to eventually return the crop result.
|
1257 |
*
|
1258 |
* @param array|string $args {
|
1259 |
* Array of function parameters.
|
1272 |
* @type int $crop_x The horizontal starting point of the crop. Default: 0.
|
1273 |
* @type int $crop_y The vertical starting point of the crop. Default: 0.
|
1274 |
* }
|
1275 |
+
* @param string $return Whether to get the crop `array` or a `boolean`. Defaults to `boolean`.
|
1276 |
+
* @return array|bool True or the crop result on success, false on failure.
|
1277 |
*/
|
1278 |
+
function bp_core_avatar_handle_crop( $args = '', $return = 'boolean' ) {
|
1279 |
+
|
1280 |
+
$r = bp_parse_args(
|
1281 |
+
$args,
|
1282 |
+
array(
|
1283 |
+
'object' => 'user',
|
1284 |
+
'avatar_dir' => 'avatars',
|
1285 |
+
'item_id' => false,
|
1286 |
+
'original_file' => false,
|
1287 |
+
'crop_w' => bp_core_avatar_full_width(),
|
1288 |
+
'crop_h' => bp_core_avatar_full_height(),
|
1289 |
+
'crop_x' => 0,
|
1290 |
+
'crop_y' => 0,
|
1291 |
+
)
|
1292 |
+
);
|
1293 |
|
1294 |
/**
|
1295 |
* Filters whether or not to handle cropping.
|
1314 |
return false;
|
1315 |
}
|
1316 |
|
1317 |
+
if ( 'array' === $return ) {
|
1318 |
+
return $cropped;
|
1319 |
+
}
|
1320 |
+
|
1321 |
return true;
|
1322 |
}
|
1323 |
|
1337 |
// Check the nonce.
|
1338 |
check_admin_referer( 'bp_avatar_cropstore', 'nonce' );
|
1339 |
|
1340 |
+
$avatar_data = bp_parse_args(
|
1341 |
+
$_POST,
|
1342 |
+
array(
|
1343 |
+
'crop_w' => bp_core_avatar_full_width(),
|
1344 |
+
'crop_h' => bp_core_avatar_full_height(),
|
1345 |
+
'crop_x' => 0,
|
1346 |
+
'crop_y' => 0,
|
1347 |
+
)
|
1348 |
+
);
|
1349 |
|
1350 |
if ( empty( $avatar_data['object'] ) || empty( $avatar_data['item_id'] ) || empty( $avatar_data['original_file'] ) ) {
|
1351 |
wp_send_json_error();
|
1364 |
$webcam_avatar = base64_decode( $webcam_avatar );
|
1365 |
}
|
1366 |
|
1367 |
+
$cropped_webcam_avatar = bp_avatar_handle_capture( $webcam_avatar, $avatar_data['item_id'], 'array' );
|
1368 |
+
|
1369 |
+
if ( ! $cropped_webcam_avatar ) {
|
1370 |
wp_send_json_error( array(
|
1371 |
'feedback_code' => 1
|
1372 |
) );
|
1373 |
|
1374 |
} else {
|
1375 |
$return = array(
|
1376 |
+
'avatar' => esc_url(
|
1377 |
+
bp_core_fetch_avatar(
|
1378 |
+
array(
|
1379 |
+
'object' => $avatar_data['object'],
|
1380 |
+
'item_id' => $avatar_data['item_id'],
|
1381 |
+
'html' => false,
|
1382 |
+
'type' => 'full',
|
1383 |
+
)
|
1384 |
+
)
|
1385 |
+
),
|
1386 |
'feedback_code' => 2,
|
1387 |
'item_id' => $avatar_data['item_id'],
|
1388 |
);
|
1394 |
* Fires if the new avatar was successfully captured.
|
1395 |
*
|
1396 |
* @since 6.0.0
|
1397 |
+
* @since 10.0.0 Adds a new param: an array containing the full, thumb avatar and the timestamp.
|
1398 |
*
|
1399 |
+
* @param string $item_id Inform about the user id the avatar was set for.
|
1400 |
+
* @param string $type Inform about the way the avatar was set ('camera').
|
1401 |
+
* @param array $avatar_data Array of parameters passed to the crop handler.
|
1402 |
+
* @param array $cropped_webcam_avatar Array containing the full, thumb avatar and the timestamp.
|
1403 |
*/
|
1404 |
+
do_action( 'bp_members_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'], $avatar_data, $cropped_webcam_avatar );
|
1405 |
|
1406 |
wp_send_json_success( $return );
|
1407 |
}
|
1433 |
);
|
1434 |
|
1435 |
// Handle crop.
|
1436 |
+
$cropped_avatar = bp_core_avatar_handle_crop( $r, 'array' );
|
1437 |
+
|
1438 |
+
if ( $cropped_avatar ) {
|
1439 |
$return = array(
|
1440 |
+
'avatar' => esc_url(
|
1441 |
+
bp_core_fetch_avatar(
|
1442 |
+
array(
|
1443 |
+
'object' => $avatar_data['object'],
|
1444 |
+
'item_id' => $avatar_data['item_id'],
|
1445 |
+
'html' => false,
|
1446 |
+
'type' => 'full',
|
1447 |
+
)
|
1448 |
+
)
|
1449 |
+
),
|
1450 |
'feedback_code' => 2,
|
1451 |
'item_id' => $avatar_data['item_id'],
|
1452 |
);
|
1456 |
do_action_deprecated( 'xprofile_avatar_uploaded', array( (int) $avatar_data['item_id'], $avatar_data['type'], $r ), '6.0.0', 'bp_members_avatar_uploaded' );
|
1457 |
|
1458 |
/** This action is documented in bp-core/bp-core-avatars.php */
|
1459 |
+
do_action( 'bp_members_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'], $r, $cropped_avatar );
|
1460 |
} elseif ( 'group' === $avatar_data['object'] ) {
|
1461 |
/** This action is documented in bp-groups/bp-groups-screens.php */
|
1462 |
+
do_action( 'groups_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'], $r, $cropped_avatar );
|
1463 |
}
|
1464 |
|
1465 |
wp_send_json_success( $return );
|
2148 |
bp_attachments_get_template_part( 'avatars/index' );
|
2149 |
}
|
2150 |
}
|
2151 |
+
|
2152 |
+
/**
|
2153 |
+
* Get a specific version of an avatar from its history.
|
2154 |
+
*
|
2155 |
+
* @since 10.0.0
|
2156 |
+
*
|
2157 |
+
* @param int $item_id The item ID we need the avatar version for.
|
2158 |
+
* @param string $object The object the item ID relates to.
|
2159 |
+
* @param int|string $timestamp An integer Unix timestamp or a date string of the format 'Y-m-d h:i:s'.
|
2160 |
+
* @param string $type The type of avatar we need. Possible values are `thumb` and `full`.
|
2161 |
+
* @return array A list of matching results, an empty array if no avatars were found.
|
2162 |
+
*/
|
2163 |
+
function bp_avatar_get_version( $item_id = 0, $object = 'user', $timestamp = '', $type = 'full' ) {
|
2164 |
+
if ( ! $item_id || ! $timestamp ) {
|
2165 |
+
return array();
|
2166 |
+
}
|
2167 |
+
|
2168 |
+
if ( ! is_numeric( $timestamp ) ) {
|
2169 |
+
$timestamp = strtotime( $timestamp );
|
2170 |
+
}
|
2171 |
+
|
2172 |
+
$avatar_id = $timestamp . '-bpfull';
|
2173 |
+
if ( 'full' !== $type ) {
|
2174 |
+
$avatar_id = $timestamp . '-bpthumb';
|
2175 |
+
}
|
2176 |
+
|
2177 |
+
$avatar_dir = 'avatars';
|
2178 |
+
if ( 'user' !== $object ) {
|
2179 |
+
$avatar_dir = sanitize_key( $object ) . '-avatars';
|
2180 |
+
}
|
2181 |
+
|
2182 |
+
// The object avatar directory we are looking into to get the avatar url.
|
2183 |
+
$object_avatar_dir = trailingslashit( bp_core_avatar_upload_path() ) . $avatar_dir . '/' . $item_id;
|
2184 |
+
|
2185 |
+
return bp_attachments_list_directory_files_recursively( $object_avatar_dir, $avatar_id );
|
2186 |
+
}
|
2187 |
+
|
2188 |
+
/**
|
2189 |
+
* Get the list of previous avatars in history
|
2190 |
+
*
|
2191 |
+
* @since 10.0.0
|
2192 |
+
*
|
2193 |
+
* @param int $item_id The item ID we need the avatar version for.
|
2194 |
+
* @param string $object The object the item ID relates to.
|
2195 |
+
* @param string $type Get the `full`, `thumb` or `both` versions.
|
2196 |
+
* @return array The list of previous uploaded avatars.
|
2197 |
+
*/
|
2198 |
+
function bp_avatar_get_avatars_history( $item_id = 0, $object = 'user', $type = 'full' ) {
|
2199 |
+
if ( ! $item_id ) {
|
2200 |
+
return array();
|
2201 |
+
}
|
2202 |
+
|
2203 |
+
$avatar_dir = 'avatars';
|
2204 |
+
if ( 'user' !== $object ) {
|
2205 |
+
$avatar_dir = sanitize_key( $object ) . '-avatars';
|
2206 |
+
}
|
2207 |
+
|
2208 |
+
// The user avatar directory we are looking into to get the avatar url.
|
2209 |
+
$history_dir = trailingslashit( bp_core_avatar_upload_path() ) . $avatar_dir . '/' . $item_id . '/history';
|
2210 |
+
$historic_avatars = bp_attachments_list_directory_files( $history_dir );
|
2211 |
+
|
2212 |
+
if ( ! $historic_avatars ) {
|
2213 |
+
return array();
|
2214 |
+
}
|
2215 |
+
|
2216 |
+
$avatars = array();
|
2217 |
+
$history_url = trailingslashit( bp_core_avatar_url() ) . $avatar_dir . '/' . $item_id . '/history';
|
2218 |
+
|
2219 |
+
foreach ( $historic_avatars as $historic_avatar ) {
|
2220 |
+
$prefix = str_replace( array( '-bpfull', '-bpthumb' ), '', $historic_avatar->id );
|
2221 |
+
$gmdate = gmdate( 'Y-m-d H:i:s', $historic_avatar->last_modified );
|
2222 |
+
$date = strtotime( get_date_from_gmt( $gmdate ) );
|
2223 |
+
|
2224 |
+
$avatars[ $historic_avatar->id ] = (object) array(
|
2225 |
+
'id' => $historic_avatar->id,
|
2226 |
+
'name' => $historic_avatar->name,
|
2227 |
+
'date' => sprintf(
|
2228 |
+
'%1$s (%2$s)',
|
2229 |
+
date_i18n( get_option( 'date_format' ), $date ),
|
2230 |
+
date_i18n( get_option( 'time_format' ), $date )
|
2231 |
+
),
|
2232 |
+
'type' => str_replace( $prefix . '-bp', '', $historic_avatar->id ),
|
2233 |
+
'url' => $history_url . '/' . $historic_avatar->name,
|
2234 |
+
);
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
if ( 'both' === $type ) {
|
2238 |
+
return $avatars;
|
2239 |
+
}
|
2240 |
+
|
2241 |
+
return wp_filter_object_list( $avatars, array( 'type' => $type ) );
|
2242 |
+
}
|
2243 |
+
|
2244 |
+
/**
|
2245 |
+
* Recycle a previously uploaded avatar as the current avatar.
|
2246 |
+
*
|
2247 |
+
* @since 10.0.0
|
2248 |
+
*/
|
2249 |
+
function bp_avatar_ajax_recycle_previous_avatar() {
|
2250 |
+
if ( ! bp_is_post_request() ) {
|
2251 |
+
wp_send_json_error();
|
2252 |
+
}
|
2253 |
+
|
2254 |
+
$avatar_data = bp_parse_args(
|
2255 |
+
$_POST,
|
2256 |
+
array(
|
2257 |
+
'object' => '',
|
2258 |
+
'item_id' => 0,
|
2259 |
+
'avatar_id' => '',
|
2260 |
+
)
|
2261 |
+
);
|
2262 |
+
|
2263 |
+
if ( ! $avatar_data['object'] || ! $avatar_data['item_id'] || ! $avatar_data['avatar_id'] ) {
|
2264 |
+
wp_send_json_error();
|
2265 |
+
}
|
2266 |
+
|
2267 |
+
// Check the nonce.
|
2268 |
+
check_admin_referer( 'bp_avatar_recycle_previous', 'nonce' );
|
2269 |
+
|
2270 |
+
// Capability check.
|
2271 |
+
if ( ! bp_attachments_current_user_can( 'edit_avatar', $avatar_data ) ) {
|
2272 |
+
wp_send_json_error();
|
2273 |
+
}
|
2274 |
+
|
2275 |
+
// Set the Avatar Attachment Instance.
|
2276 |
+
$avatar_attachment = new BP_Attachment_Avatar();
|
2277 |
+
$object = sanitize_key( $avatar_data['object'] );
|
2278 |
+
|
2279 |
+
if ( 'user' === $object ) {
|
2280 |
+
$avatar_dir = 'avatars';
|
2281 |
+
} else {
|
2282 |
+
$avatar_dir = $object . '-avatars';
|
2283 |
+
}
|
2284 |
+
|
2285 |
+
$item_id = (int) $avatar_data['item_id'];
|
2286 |
+
$avatar_dir_path = $avatar_attachment->upload_path . '/' . $avatar_dir . '/' . $item_id;
|
2287 |
+
$current_avatars = bp_attachments_list_directory_files( $avatar_dir_path );
|
2288 |
+
$revision_errors = array();
|
2289 |
+
|
2290 |
+
// This path will be needed to get the avatar revision object.
|
2291 |
+
$avatar_full_revision_path = '';
|
2292 |
+
|
2293 |
+
// Add a revision of the current avatar if it's not a mystery man!
|
2294 |
+
if ( $current_avatars ) {
|
2295 |
+
foreach( $current_avatars as $current_avatar ) {
|
2296 |
+
if ( ! isset( $current_avatar->name, $current_avatar->id, $current_avatar->path ) ) {
|
2297 |
+
continue;
|
2298 |
+
}
|
2299 |
+
|
2300 |
+
$is_full = preg_match( "/-bpfull/", $current_avatar->name );
|
2301 |
+
$is_thumb = preg_match( "/-bpthumb/", $current_avatar->name );
|
2302 |
+
|
2303 |
+
if ( $is_full || $is_thumb ) {
|
2304 |
+
// Add a revision of the current avatar.
|
2305 |
+
$revision = $avatar_attachment->add_revision(
|
2306 |
+
'avatar',
|
2307 |
+
array(
|
2308 |
+
'file_abspath' => $current_avatar->path,
|
2309 |
+
'file_id' => $current_avatar->id,
|
2310 |
+
)
|
2311 |
+
);
|
2312 |
+
|
2313 |
+
if ( is_wp_error( $revision ) ) {
|
2314 |
+
$revision_errors[] = $revision->get_error_message();
|
2315 |
+
} elseif ( $is_full ) {
|
2316 |
+
$avatar_full_revision_path = $revision->path;
|
2317 |
+
}
|
2318 |
+
}
|
2319 |
+
}
|
2320 |
+
}
|
2321 |
+
|
2322 |
+
// No errors, let's recycle the previous avatar.
|
2323 |
+
if ( ! $revision_errors ) {
|
2324 |
+
$avatar_id = sanitize_file_name( $avatar_data['avatar_id'] );
|
2325 |
+
$suffix = '-bpfull';
|
2326 |
+
$history_dir = trailingslashit( bp_core_avatar_upload_path() ) . $avatar_dir . '/' . $item_id . '/history';
|
2327 |
+
$avatars = bp_attachments_list_directory_files( $history_dir );
|
2328 |
+
|
2329 |
+
if ( ! isset( $avatars[ $avatar_id ] ) ) {
|
2330 |
+
wp_send_json_error(
|
2331 |
+
array(
|
2332 |
+
'message' => __( 'The profile photo you want to recycle cannot be found.', 'buddypress' ),
|
2333 |
+
)
|
2334 |
+
);
|
2335 |
+
}
|
2336 |
+
|
2337 |
+
// Init recycle vars.
|
2338 |
+
$recycle_timestamp = bp_core_current_time( true, 'timestamp' );
|
2339 |
+
$recycle_errors = array();
|
2340 |
+
$avatar_types = array(
|
2341 |
+
'full' => '',
|
2342 |
+
'thumb' => '',
|
2343 |
+
);
|
2344 |
+
|
2345 |
+
// Use the found previous avatar.
|
2346 |
+
$avatar = $avatars[ $avatar_id ];
|
2347 |
+
$avatar_types['full'] = $avatar->path;
|
2348 |
+
$avatar_types['thumb'] = str_replace( $suffix, '-bpthumb', $avatar->path );
|
2349 |
+
$historical_types = $avatar_types;
|
2350 |
+
|
2351 |
+
// It's a legacy avatar, we need to crop it again and remove the thumb file that is not using a timestamp in its name.
|
2352 |
+
if ( ! file_exists( $avatar_types['thumb'] ) ) {
|
2353 |
+
$full_avatar_path = $avatar_dir_path . '/' . str_replace( 'bpfull', 'original-file', wp_basename( $avatar->path ) );
|
2354 |
+
|
2355 |
+
// Move the full version back to avatar dir.
|
2356 |
+
rename( $avatar->path, $full_avatar_path );
|
2357 |
+
|
2358 |
+
$avatar_types = $avatar_attachment->crop(
|
2359 |
+
array(
|
2360 |
+
'original_file' => $full_avatar_path,
|
2361 |
+
'avatar_dir' => $avatar_dir,
|
2362 |
+
'object' => $object,
|
2363 |
+
'item_id' => $item_id,
|
2364 |
+
)
|
2365 |
+
);
|
2366 |
+
|
2367 |
+
// loop into the history directory to delete the legacy thumb version file.
|
2368 |
+
foreach ( $avatars as $avatar_object ) {
|
2369 |
+
$timestamp = str_replace( array( '-bpthumb', '-bpfull' ), '', $avatar_object->id );
|
2370 |
+
|
2371 |
+
if ( ! is_numeric( $timestamp ) && false !== strpos( $avatar_object->id, '-bpthumb' ) ) {
|
2372 |
+
@unlink( $avatar_object->path );
|
2373 |
+
}
|
2374 |
+
}
|
2375 |
+
} else {
|
2376 |
+
foreach( $avatar_types as $type_key => $avatar_path ) {
|
2377 |
+
$filename = wp_basename( $avatar_path );
|
2378 |
+
$avatar_id = pathinfo( $filename, PATHINFO_FILENAME );
|
2379 |
+
$recycle_path = $avatar_dir_path . '/' . str_replace( $avatar_id, $recycle_timestamp . '-bp' . $type_key, $filename );
|
2380 |
+
|
2381 |
+
if ( ! rename( $avatar_path, $recycle_path ) ) {
|
2382 |
+
$recycle_errors[] = __( 'An unexpected error occured while recycling the previous profile photo.', 'buddypress' );
|
2383 |
+
} else {
|
2384 |
+
$avatar_types[ $type_key ] = $recycle_path;
|
2385 |
+
}
|
2386 |
+
}
|
2387 |
+
|
2388 |
+
$avatar_types = array_merge(
|
2389 |
+
$avatar_types,
|
2390 |
+
array(
|
2391 |
+
'timestamp' => $recycle_timestamp,
|
2392 |
+
)
|
2393 |
+
);
|
2394 |
+
}
|
2395 |
+
|
2396 |
+
// No errors, fire the hook used when an avatar is set.
|
2397 |
+
if ( ! $recycle_errors && $historical_types['full'] !== $avatar_types['full'] ) {
|
2398 |
+
$r = array(
|
2399 |
+
'item_id' => $item_id,
|
2400 |
+
'object' => $object,
|
2401 |
+
'avatar_dir' => $avatar_dir,
|
2402 |
+
);
|
2403 |
+
|
2404 |
+
$action_hook = 'bp_members_avatar_uploaded';
|
2405 |
+
if ( 'group' === $object ) {
|
2406 |
+
$action_hook = 'groups_avatar_uploaded';
|
2407 |
+
}
|
2408 |
+
|
2409 |
+
/** This action is documented in bp-core/bp-core-avatars.php */
|
2410 |
+
do_action( $action_hook, $item_id, 'recycle', $r, $avatar_types );
|
2411 |
+
} else {
|
2412 |
+
$recycle_error = reset( $recycle_errors );
|
2413 |
+
|
2414 |
+
wp_send_json_error(
|
2415 |
+
array(
|
2416 |
+
'message' => join( "\n", $recycle_error ),
|
2417 |
+
)
|
2418 |
+
);
|
2419 |
+
}
|
2420 |
+
} else {
|
2421 |
+
wp_send_json_error(
|
2422 |
+
array(
|
2423 |
+
'message' => join( "\n", $revision_errors ),
|
2424 |
+
)
|
2425 |
+
);
|
2426 |
+
}
|
2427 |
+
|
2428 |
+
$return = array(
|
2429 |
+
'avatar' => esc_url(
|
2430 |
+
bp_core_fetch_avatar(
|
2431 |
+
array(
|
2432 |
+
'object' => $object,
|
2433 |
+
'item_id' => $item_id,
|
2434 |
+
'html' => false,
|
2435 |
+
'type' => 'full',
|
2436 |
+
)
|
2437 |
+
)
|
2438 |
+
),
|
2439 |
+
'feedback_code' => 5,
|
2440 |
+
'item_id' => $item_id,
|
2441 |
+
);
|
2442 |
+
|
2443 |
+
// Get the created revision object if it exists.
|
2444 |
+
if ( $avatar_full_revision_path ) {
|
2445 |
+
$history_dir = dirname( $avatar_full_revision_path );
|
2446 |
+
$avatars_history = bp_attachments_list_directory_files( $history_dir );
|
2447 |
+
$latest_id = pathinfo( wp_basename( $avatar_full_revision_path ), PATHINFO_FILENAME );
|
2448 |
+
|
2449 |
+
if ( isset( $avatars_history[ $latest_id ] ) ) {
|
2450 |
+
$gmdate = gmdate( 'Y-m-d H:i:s', $avatars_history[ $latest_id ]->last_modified );
|
2451 |
+
$date = strtotime( get_date_from_gmt( $gmdate ) );
|
2452 |
+
$history_url = trailingslashit( bp_core_avatar_url() ) . $avatar_dir . '/' . $item_id . '/history';
|
2453 |
+
|
2454 |
+
// Prepare the avatar object for JavaScript.
|
2455 |
+
$avatars_history[ $latest_id ]->date = sprintf(
|
2456 |
+
'%1$s (%2$s)',
|
2457 |
+
date_i18n( get_option( 'date_format' ), $date ),
|
2458 |
+
date_i18n( get_option( 'time_format' ), $date )
|
2459 |
+
);
|
2460 |
+
$avatars_history[ $latest_id ]->type = 'full';
|
2461 |
+
$avatars_history[ $latest_id ]->url = $history_url . '/' . $avatars_history[ $latest_id ]->name;
|
2462 |
+
|
2463 |
+
// Remove the path.
|
2464 |
+
unset( $avatars_history[ $latest_id ]->path );
|
2465 |
+
|
2466 |
+
// Set the new object to add to the revision list.
|
2467 |
+
$return['historicalAvatar'] = $avatars_history[ $latest_id ];
|
2468 |
+
}
|
2469 |
+
}
|
2470 |
+
|
2471 |
+
wp_send_json_success( $return );
|
2472 |
+
}
|
2473 |
+
add_action( 'wp_ajax_bp_avatar_recycle_previous', 'bp_avatar_ajax_recycle_previous_avatar' );
|
2474 |
+
|
2475 |
+
/**
|
2476 |
+
* Delete a previously uploaded avatar from avatars history.
|
2477 |
+
*
|
2478 |
+
* @since 10.0.0
|
2479 |
+
*/
|
2480 |
+
function bp_avatar_ajax_delete_previous_avatar() {
|
2481 |
+
if ( ! bp_is_post_request() ) {
|
2482 |
+
wp_send_json_error();
|
2483 |
+
}
|
2484 |
+
|
2485 |
+
$avatar_data = bp_parse_args(
|
2486 |
+
$_POST,
|
2487 |
+
array(
|
2488 |
+
'object' => '',
|
2489 |
+
'item_id' => 0,
|
2490 |
+
'avatar_id' => '',
|
2491 |
+
)
|
2492 |
+
);
|
2493 |
+
|
2494 |
+
if ( ! $avatar_data['object'] || ! $avatar_data['item_id'] || ! $avatar_data['avatar_id'] ) {
|
2495 |
+
wp_send_json_error();
|
2496 |
+
}
|
2497 |
+
|
2498 |
+
// Check the nonce.
|
2499 |
+
check_admin_referer( 'bp_avatar_delete_previous', 'nonce' );
|
2500 |
+
|
2501 |
+
// Capability check.
|
2502 |
+
if ( ! bp_attachments_current_user_can( 'edit_avatar', $avatar_data ) ) {
|
2503 |
+
wp_send_json_error();
|
2504 |
+
}
|
2505 |
+
|
2506 |
+
$object = sanitize_key( $avatar_data['object'] );
|
2507 |
+
if ( 'user' === $object ) {
|
2508 |
+
$avatar_dir = 'avatars';
|
2509 |
+
} else {
|
2510 |
+
$avatar_dir = $object . '-avatars';
|
2511 |
+
}
|
2512 |
+
|
2513 |
+
$item_id = (int) $avatar_data['item_id'];
|
2514 |
+
$avatar_id = sanitize_file_name( $avatar_data['avatar_id'] );
|
2515 |
+
$suffix = '-bpfull';
|
2516 |
+
$history_dir = trailingslashit( bp_core_avatar_upload_path() ) . $avatar_dir . '/' . $item_id . '/history';
|
2517 |
+
$avatars = bp_attachments_list_directory_files( $history_dir );
|
2518 |
+
|
2519 |
+
if ( ! isset( $avatars[ $avatar_id ] ) ) {
|
2520 |
+
wp_send_json_error(
|
2521 |
+
array(
|
2522 |
+
'message' => __( 'The profile photo you want to delete cannot be found.', 'buddypress' ),
|
2523 |
+
)
|
2524 |
+
);
|
2525 |
+
}
|
2526 |
+
|
2527 |
+
$avatar_types = array(
|
2528 |
+
'full' => '',
|
2529 |
+
'thumb' => '',
|
2530 |
+
);
|
2531 |
+
|
2532 |
+
// Use the found previous avatar.
|
2533 |
+
$avatar = $avatars[ $avatar_id ];
|
2534 |
+
$avatar_types['full'] = $avatar->path;
|
2535 |
+
$avatar_types['thumb'] = str_replace( $suffix, '-bpthumb', $avatar->path );
|
2536 |
+
|
2537 |
+
// It's a legacy avatar, we need to find the thumb version using file last modified date.
|
2538 |
+
if ( ! file_exists( $avatar_types['thumb'] ) ) {
|
2539 |
+
$avatar_types['thumb'] = '';
|
2540 |
+
$possible_thumb_avatars = wp_list_pluck( $avatars, 'last_modified', 'id' );
|
2541 |
+
|
2542 |
+
foreach ( $possible_thumb_avatars as $type_id => $modified_date ) {
|
2543 |
+
$timediff = $avatar->last_modified - $modified_date;
|
2544 |
+
if ( 1000 >= absint( $timediff ) && $avatar_id !== $type_id ) {
|
2545 |
+
$avatar_types['thumb'] = $avatars[ $type_id ]->path;
|
2546 |
+
break;
|
2547 |
+
}
|
2548 |
+
}
|
2549 |
+
}
|
2550 |
+
|
2551 |
+
// Remove the files.
|
2552 |
+
foreach ( $avatar_types as $avatar_path ) {
|
2553 |
+
if ( ! $avatar_path ) {
|
2554 |
+
continue;
|
2555 |
+
}
|
2556 |
+
|
2557 |
+
@unlink( $avatar_path );
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
$timestamp = str_replace( '-bpfull', '', $avatar_id );
|
2561 |
+
if ( ! is_numeric( $timestamp ) ) {
|
2562 |
+
$timestamp = $avatar->last_modified;
|
2563 |
+
}
|
2564 |
+
|
2565 |
+
/**
|
2566 |
+
* Hook here to run custom code once the previous avatar has been deleted.
|
2567 |
+
*
|
2568 |
+
* @since 10.0.0
|
2569 |
+
*
|
2570 |
+
* @param int $item_id The object ID.
|
2571 |
+
* @param int $timestamp The avatar timestamp.
|
2572 |
+
*/
|
2573 |
+
do_action( "bp_previous_{$object}_avatar_deleted", $item_id, $timestamp );
|
2574 |
+
|
2575 |
+
// Finally inform about the deletion success.
|
2576 |
+
wp_send_json_success(
|
2577 |
+
array(
|
2578 |
+
'feedback_code' => 6,
|
2579 |
+
)
|
2580 |
+
);
|
2581 |
+
}
|
2582 |
+
add_action( 'wp_ajax_bp_avatar_delete_previous', 'bp_avatar_ajax_delete_previous_avatar' );
|
@@ -11,7 +11,7 @@
|
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
13 |
/**
|
14 |
-
* BuddyPress blocks require
|
15 |
*
|
16 |
* @since 6.0.0
|
17 |
*
|
@@ -19,7 +19,14 @@ defined( 'ABSPATH' ) || exit;
|
|
19 |
* False otherwise.
|
20 |
*/
|
21 |
function bp_support_blocks() {
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
/**
|
@@ -30,11 +37,6 @@ function bp_support_blocks() {
|
|
30 |
* Uses a dependency to `wp-editor` otherwise.
|
31 |
*/
|
32 |
function bp_register_block_components() {
|
33 |
-
$server_side_renderer_dep = 'wp-server-side-render';
|
34 |
-
if ( bp_is_running_wp( '5.3.0', '<' ) ) {
|
35 |
-
$server_side_renderer_dep = 'wp-editor';
|
36 |
-
}
|
37 |
-
|
38 |
wp_register_script(
|
39 |
'bp-block-components',
|
40 |
plugins_url( 'js/block-components.js', __FILE__ ),
|
@@ -44,7 +46,6 @@ function bp_register_block_components() {
|
|
44 |
'wp-i18n',
|
45 |
'wp-api-fetch',
|
46 |
'wp-url',
|
47 |
-
$server_side_renderer_dep,
|
48 |
),
|
49 |
bp_get_version(),
|
50 |
false
|
@@ -221,12 +222,22 @@ add_filter( 'widget_block_dynamic_classname', 'bp_widget_block_dynamic_classname
|
|
221 |
* @return string HTML output.
|
222 |
*/
|
223 |
function bp_blocks_get_login_widget_registration_link( $content = '', $args = array() ) {
|
224 |
-
if ( isset( $args['form_id'] ) && 'bp-login-widget-form' === $args['form_id']
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
}
|
231 |
|
232 |
$action_output = '';
|
@@ -257,10 +268,11 @@ function bp_blocks_get_login_widget_registration_link( $content = '', $args = ar
|
|
257 |
* @return string HTML output.
|
258 |
*/
|
259 |
function bp_block_render_login_form_block( $attributes = array() ) {
|
260 |
-
$block_args =
|
261 |
$attributes,
|
262 |
array(
|
263 |
-
'title'
|
|
|
264 |
)
|
265 |
);
|
266 |
|
@@ -338,6 +350,8 @@ function bp_block_render_login_form_block( $attributes = array() ) {
|
|
338 |
}
|
339 |
} else {
|
340 |
$action_output = '';
|
|
|
|
|
341 |
if ( has_action( 'bp_before_login_widget_loggedout' ) ) {
|
342 |
ob_start();
|
343 |
/**
|
@@ -357,14 +371,15 @@ function bp_block_render_login_form_block( $attributes = array() ) {
|
|
357 |
|
358 |
$widget_content .= wp_login_form(
|
359 |
array(
|
360 |
-
'echo'
|
361 |
-
'form_id'
|
362 |
-
'id_username'
|
363 |
-
'label_username'
|
364 |
-
'id_password'
|
365 |
-
'label_password'
|
366 |
-
'id_remember'
|
367 |
-
'id_submit'
|
|
|
368 |
)
|
369 |
);
|
370 |
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
13 |
/**
|
14 |
+
* BuddyPress blocks require the BP REST API.
|
15 |
*
|
16 |
* @since 6.0.0
|
17 |
*
|
19 |
* False otherwise.
|
20 |
*/
|
21 |
function bp_support_blocks() {
|
22 |
+
/**
|
23 |
+
* Filter here, returning `false`, to completely disable BuddyPress blocks.
|
24 |
+
*
|
25 |
+
* @since 10.0.0
|
26 |
+
*
|
27 |
+
* @param bool $value True if the BP REST API is available. False otherwise.
|
28 |
+
*/
|
29 |
+
return apply_filters( 'bp_support_blocks', bp_rest_api_is_available() );
|
30 |
}
|
31 |
|
32 |
/**
|
37 |
* Uses a dependency to `wp-editor` otherwise.
|
38 |
*/
|
39 |
function bp_register_block_components() {
|
|
|
|
|
|
|
|
|
|
|
40 |
wp_register_script(
|
41 |
'bp-block-components',
|
42 |
plugins_url( 'js/block-components.js', __FILE__ ),
|
46 |
'wp-i18n',
|
47 |
'wp-api-fetch',
|
48 |
'wp-url',
|
|
|
49 |
),
|
50 |
bp_get_version(),
|
51 |
false
|
222 |
* @return string HTML output.
|
223 |
*/
|
224 |
function bp_blocks_get_login_widget_registration_link( $content = '', $args = array() ) {
|
225 |
+
if ( isset( $args['form_id'] ) && 'bp-login-widget-form' === $args['form_id'] ) {
|
226 |
+
if ( bp_get_signup_allowed() ) {
|
227 |
+
$content .= sprintf(
|
228 |
+
'<p class="bp-login-widget-register-link"><a href="%1$s">%2$s</a></p>',
|
229 |
+
esc_url( bp_get_signup_page() ),
|
230 |
+
esc_html__( 'Register', 'buddypress' )
|
231 |
+
);
|
232 |
+
}
|
233 |
+
|
234 |
+
if ( isset( $args['include_pwd_link'] ) && true === $args['include_pwd_link'] ) {
|
235 |
+
$content .= sprintf(
|
236 |
+
'<p class="bp-login-widget-pwd-link"><a href="%1$s">%2$s</a></p>',
|
237 |
+
esc_url( wp_lostpassword_url( bp_get_root_domain() ) ),
|
238 |
+
esc_html__( 'Lost your password?', 'buddypress' )
|
239 |
+
);
|
240 |
+
}
|
241 |
}
|
242 |
|
243 |
$action_output = '';
|
268 |
* @return string HTML output.
|
269 |
*/
|
270 |
function bp_block_render_login_form_block( $attributes = array() ) {
|
271 |
+
$block_args = bp_parse_args(
|
272 |
$attributes,
|
273 |
array(
|
274 |
+
'title' => '',
|
275 |
+
'forgotPwdLink' => false,
|
276 |
)
|
277 |
);
|
278 |
|
350 |
}
|
351 |
} else {
|
352 |
$action_output = '';
|
353 |
+
$pwd_link = (bool) $block_args['forgotPwdLink'];
|
354 |
+
|
355 |
if ( has_action( 'bp_before_login_widget_loggedout' ) ) {
|
356 |
ob_start();
|
357 |
/**
|
371 |
|
372 |
$widget_content .= wp_login_form(
|
373 |
array(
|
374 |
+
'echo' => false,
|
375 |
+
'form_id' => 'bp-login-widget-form',
|
376 |
+
'id_username' => 'bp-login-widget-user-login',
|
377 |
+
'label_username' => __( 'Username', 'buddypress' ),
|
378 |
+
'id_password' => 'bp-login-widget-user-pass',
|
379 |
+
'label_password' => __( 'Password', 'buddypress' ),
|
380 |
+
'id_remember' => 'bp-login-widget-rememberme',
|
381 |
+
'id_submit' => 'bp-login-widget-submit',
|
382 |
+
'include_pwd_link' => $pwd_link,
|
383 |
)
|
384 |
);
|
385 |
|
@@ -50,10 +50,13 @@ function bp_core_new_nav_item( $args, $component = 'members' ) {
|
|
50 |
'site_admin_only' => false, // Can only site admins see this nav item?
|
51 |
'position' => 99, // Index of where this nav item should be positioned.
|
52 |
'screen_function' => false, // The name of the function to run when clicked.
|
53 |
-
'default_subnav_slug' => false
|
54 |
);
|
55 |
|
56 |
-
$r =
|
|
|
|
|
|
|
57 |
|
58 |
// Validate nav link data.
|
59 |
$nav_item = bp_core_create_nav_link( $r, $component );
|
@@ -130,7 +133,10 @@ function bp_core_create_nav_link( $args = '', $component = 'members' ) {
|
|
130 |
'default_subnav_slug' => false // The slug of the default subnav item to select when clicked.
|
131 |
);
|
132 |
|
133 |
-
$r =
|
|
|
|
|
|
|
134 |
|
135 |
// If we don't have the required info we need, don't create this nav item.
|
136 |
if ( empty( $r['name'] ) || empty( $r['slug'] ) ) {
|
@@ -217,7 +223,10 @@ function bp_core_register_nav_screen_function( $args = '' ) {
|
|
217 |
'default_subnav_slug' => false // The slug of the default subnav item to select when clicked.
|
218 |
);
|
219 |
|
220 |
-
$r =
|
|
|
|
|
|
|
221 |
|
222 |
// If we don't have the required info we need, don't register this screen function.
|
223 |
if ( empty( $r['slug'] ) ) {
|
@@ -314,7 +323,10 @@ function bp_core_new_nav_default( $args = '' ) {
|
|
314 |
'subnav_slug' => false // The slug of the subnav item to select when clicked.
|
315 |
);
|
316 |
|
317 |
-
$r =
|
|
|
|
|
|
|
318 |
|
319 |
// This is specific to Members - it's not available in Groups.
|
320 |
$parent_nav = $bp->members->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );
|
@@ -325,18 +337,41 @@ function bp_core_new_nav_default( $args = '' ) {
|
|
325 |
|
326 |
$parent_nav = reset( $parent_nav );
|
327 |
|
328 |
-
if ( ! empty( $parent_nav->screen_function ) ) {
|
329 |
-
// Remove our screen hook if screen function is callable.
|
330 |
-
if ( is_callable( $parent_nav->screen_function ) ) {
|
331 |
-
remove_action( 'bp_screens', $parent_nav->screen_function, 3 );
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
// Edit the screen function for the parent nav.
|
336 |
-
$bp->members->nav->edit_nav(
|
337 |
-
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
if ( bp_is_current_component( $parent_nav->slug ) ) {
|
342 |
|
@@ -506,20 +541,23 @@ function bp_core_new_subnav_item( $args, $component = null ) {
|
|
506 |
function bp_core_create_subnav_link( $args = '', $component = 'members' ) {
|
507 |
$bp = buddypress();
|
508 |
|
509 |
-
$r =
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
|
|
|
|
|
|
523 |
|
524 |
// If we don't have the required info we need, don't create this subnav item.
|
525 |
if ( empty( $r['name'] ) || empty( $r['slug'] ) || empty( $r['parent_slug'] ) || empty( $r['parent_url'] ) || empty( $r['screen_function'] ) )
|
@@ -602,14 +640,17 @@ function bp_core_create_subnav_link( $args = '', $component = 'members' ) {
|
|
602 |
function bp_core_register_subnav_screen_function( $args = '', $component = 'members' ) {
|
603 |
$bp = buddypress();
|
604 |
|
605 |
-
$r =
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
|
|
|
|
|
|
613 |
|
614 |
/*
|
615 |
* Hook the screen function for the added subnav item. But this only needs to
|
50 |
'site_admin_only' => false, // Can only site admins see this nav item?
|
51 |
'position' => 99, // Index of where this nav item should be positioned.
|
52 |
'screen_function' => false, // The name of the function to run when clicked.
|
53 |
+
'default_subnav_slug' => false, // The slug of the default subnav item to select when clicked.
|
54 |
);
|
55 |
|
56 |
+
$r = bp_parse_args(
|
57 |
+
$args,
|
58 |
+
$defaults
|
59 |
+
);
|
60 |
|
61 |
// Validate nav link data.
|
62 |
$nav_item = bp_core_create_nav_link( $r, $component );
|
133 |
'default_subnav_slug' => false // The slug of the default subnav item to select when clicked.
|
134 |
);
|
135 |
|
136 |
+
$r = bp_parse_args(
|
137 |
+
$args,
|
138 |
+
$defaults
|
139 |
+
);
|
140 |
|
141 |
// If we don't have the required info we need, don't create this nav item.
|
142 |
if ( empty( $r['name'] ) || empty( $r['slug'] ) ) {
|
223 |
'default_subnav_slug' => false // The slug of the default subnav item to select when clicked.
|
224 |
);
|
225 |
|
226 |
+
$r = bp_parse_args(
|
227 |
+
$args,
|
228 |
+
$defaults
|
229 |
+
);
|
230 |
|
231 |
// If we don't have the required info we need, don't register this screen function.
|
232 |
if ( empty( $r['slug'] ) ) {
|
323 |
'subnav_slug' => false // The slug of the subnav item to select when clicked.
|
324 |
);
|
325 |
|
326 |
+
$r = bp_parse_args(
|
327 |
+
$args,
|
328 |
+
$defaults
|
329 |
+
);
|
330 |
|
331 |
// This is specific to Members - it's not available in Groups.
|
332 |
$parent_nav = $bp->members->nav->get_primary( array( 'slug' => $r['parent_slug'] ), false );
|
337 |
|
338 |
$parent_nav = reset( $parent_nav );
|
339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
// Edit the screen function for the parent nav.
|
341 |
+
$bp->members->nav->edit_nav(
|
342 |
+
array(
|
343 |
+
'screen_function' => &$r['screen_function'],
|
344 |
+
'default_subnav_slug' => $r['subnav_slug'],
|
345 |
+
),
|
346 |
+
$parent_nav->slug
|
347 |
+
);
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Update secondary nav items:
|
351 |
+
* - The previous default nav item needs to have its slug added to its link property.
|
352 |
+
* - The new default nav item needs to have its slug removed from its link property.
|
353 |
+
*/
|
354 |
+
$previous_default_subnav = $bp->members->nav->get( $parent_nav->slug . '/' . $parent_nav->default_subnav_slug );
|
355 |
+
|
356 |
+
// Edit the link of the previous default nav item.
|
357 |
+
$bp->members->nav->edit_nav(
|
358 |
+
array(
|
359 |
+
'link' => trailingslashit( $previous_default_subnav->link . $previous_default_subnav->slug ),
|
360 |
+
),
|
361 |
+
$previous_default_subnav->slug,
|
362 |
+
$parent_nav->slug
|
363 |
+
);
|
364 |
+
|
365 |
+
$new_default_subnav = $bp->members->nav->get( $parent_nav->slug . '/' . $r['subnav_slug'] );
|
366 |
+
|
367 |
+
// Edit the link of the new default nav item.
|
368 |
+
$bp->members->nav->edit_nav(
|
369 |
+
array(
|
370 |
+
'link' => rtrim( untrailingslashit( $new_default_subnav->link ), $new_default_subnav->slug ),
|
371 |
+
),
|
372 |
+
$new_default_subnav->slug,
|
373 |
+
$parent_nav->slug
|
374 |
+
);
|
375 |
|
376 |
if ( bp_is_current_component( $parent_nav->slug ) ) {
|
377 |
|
541 |
function bp_core_create_subnav_link( $args = '', $component = 'members' ) {
|
542 |
$bp = buddypress();
|
543 |
|
544 |
+
$r = bp_parse_args(
|
545 |
+
$args,
|
546 |
+
array(
|
547 |
+
'name' => false, // Display name for the nav item.
|
548 |
+
'slug' => false, // URL slug for the nav item.
|
549 |
+
'parent_slug' => false, // URL slug of the parent nav item.
|
550 |
+
'parent_url' => false, // URL of the parent item.
|
551 |
+
'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item.
|
552 |
+
'user_has_access' => true, // Can the logged in user see this nav item?
|
553 |
+
'no_access_url' => '',
|
554 |
+
'site_admin_only' => false, // Can only site admins see this nav item?
|
555 |
+
'position' => 90, // Index of where this nav item should be positioned.
|
556 |
+
'screen_function' => false, // The name of the function to run when clicked.
|
557 |
+
'link' => '', // The link for the subnav item; optional, not usually required.
|
558 |
+
'show_in_admin_bar' => false, // Show the Manage link in the current group's "Edit" Admin Bar menu.
|
559 |
+
)
|
560 |
+
);
|
561 |
|
562 |
// If we don't have the required info we need, don't create this subnav item.
|
563 |
if ( empty( $r['name'] ) || empty( $r['slug'] ) || empty( $r['parent_slug'] ) || empty( $r['parent_url'] ) || empty( $r['screen_function'] ) )
|
640 |
function bp_core_register_subnav_screen_function( $args = '', $component = 'members' ) {
|
641 |
$bp = buddypress();
|
642 |
|
643 |
+
$r = bp_parse_args(
|
644 |
+
$args,
|
645 |
+
array(
|
646 |
+
'slug' => false, // URL slug for the screen.
|
647 |
+
'parent_slug' => false, // URL slug of the parent screen.
|
648 |
+
'user_has_access' => true, // Can the user visit this screen?
|
649 |
+
'no_access_url' => '',
|
650 |
+
'site_admin_only' => false, // Can only site admins visit this screen?
|
651 |
+
'screen_function' => false, // The name of the function to run when clicked.
|
652 |
+
)
|
653 |
+
);
|
654 |
|
655 |
/*
|
656 |
* Hook the screen function for the added subnav item. But this only needs to
|
@@ -199,15 +199,18 @@ function bp_get_non_cached_ids( $item_ids, $cache_group ) {
|
|
199 |
function bp_update_meta_cache( $args = array() ) {
|
200 |
global $wpdb;
|
201 |
|
202 |
-
$
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
|
|
|
|
|
|
209 |
);
|
210 |
-
|
211 |
extract( $r );
|
212 |
|
213 |
if ( empty( $object_ids ) || empty( $object_type ) || empty( $meta_table ) || empty( $cache_group ) ) {
|
199 |
function bp_update_meta_cache( $args = array() ) {
|
200 |
global $wpdb;
|
201 |
|
202 |
+
$r = bp_parse_args(
|
203 |
+
$args,
|
204 |
+
array(
|
205 |
+
'object_ids' => array(), // Comma-separated list or array of item ids.
|
206 |
+
'object_type' => '', // Canonical component id: groups, members, etc.
|
207 |
+
'cache_group' => '', // Cache group.
|
208 |
+
'meta_table' => '', // Name of the table containing the metadata.
|
209 |
+
'object_column' => '', // DB column for the object ids (group_id, etc).
|
210 |
+
'cache_key_prefix' => '', // Prefix to use when creating cache key names. Eg 'bp_groups_groupmeta'.
|
211 |
+
)
|
212 |
);
|
213 |
+
|
214 |
extract( $r );
|
215 |
|
216 |
if ( empty( $object_ids ) || empty( $object_type ) || empty( $meta_table ) || empty( $cache_group ) ) {
|
@@ -248,8 +248,15 @@ function bp_core_set_uri_globals() {
|
|
248 |
}
|
249 |
|
250 |
// This is not a BuddyPress page, so just return.
|
251 |
-
if ( empty( $matches ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
return false;
|
|
|
253 |
|
254 |
$wp_rewrite->use_verbose_page_rules = false;
|
255 |
|
@@ -643,7 +650,10 @@ function bp_core_no_access( $args = '' ) {
|
|
643 |
'message' => __( 'You must log in to access the page you requested.', 'buddypress' )
|
644 |
);
|
645 |
|
646 |
-
$r =
|
|
|
|
|
|
|
647 |
|
648 |
/**
|
649 |
* Filters the arguments used for user redirecting when visiting access controlled areas.
|
@@ -873,9 +883,14 @@ function bp_get_canonical_url( $args = array() ) {
|
|
873 |
$bp = buddypress();
|
874 |
|
875 |
$defaults = array(
|
876 |
-
'include_query_args' => false // Include URL arguments, eg ?foo=bar&foo2=bar2.
|
|
|
|
|
|
|
|
|
|
|
877 |
);
|
878 |
-
|
879 |
extract( $r );
|
880 |
|
881 |
// Special case: when a BuddyPress directory (eg example.com/members)
|
248 |
}
|
249 |
|
250 |
// This is not a BuddyPress page, so just return.
|
251 |
+
if ( empty( $matches ) ) {
|
252 |
+
/**
|
253 |
+
* Fires when the the current page is not a BuddyPress one.
|
254 |
+
*
|
255 |
+
* @since 10.0.0
|
256 |
+
*/
|
257 |
+
do_action( 'is_not_buddypress' );
|
258 |
return false;
|
259 |
+
}
|
260 |
|
261 |
$wp_rewrite->use_verbose_page_rules = false;
|
262 |
|
650 |
'message' => __( 'You must log in to access the page you requested.', 'buddypress' )
|
651 |
);
|
652 |
|
653 |
+
$r = bp_parse_args(
|
654 |
+
$args,
|
655 |
+
$defaults
|
656 |
+
);
|
657 |
|
658 |
/**
|
659 |
* Filters the arguments used for user redirecting when visiting access controlled areas.
|
883 |
$bp = buddypress();
|
884 |
|
885 |
$defaults = array(
|
886 |
+
'include_query_args' => false, // Include URL arguments, eg ?foo=bar&foo2=bar2.
|
887 |
+
);
|
888 |
+
|
889 |
+
$r = bp_parse_args(
|
890 |
+
$args,
|
891 |
+
$defaults
|
892 |
);
|
893 |
+
|
894 |
extract( $r );
|
895 |
|
896 |
// Special case: when a BuddyPress directory (eg example.com/members)
|
@@ -461,6 +461,12 @@ add_filter( 'update_welcome_email', 'bp_core_filter_blog_welcome_email', 10, 4 )
|
|
461 |
* @return bool Returns false to stop original WPMU function from continuing.
|
462 |
*/
|
463 |
function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
$args = array(
|
465 |
'tokens' => array(
|
466 |
'activate-site.url' => esc_url( bp_get_activation_page() . '?key=' . urlencode( $key ) ),
|
@@ -473,21 +479,30 @@ function bp_core_activation_signup_blog_notification( $domain, $path, $title, $u
|
|
473 |
),
|
474 |
);
|
475 |
|
476 |
-
$
|
477 |
-
array(
|
478 |
-
'user_login' => $user,
|
479 |
-
)
|
480 |
-
);
|
481 |
-
|
482 |
$salutation = $user;
|
483 |
-
if ( $
|
484 |
-
$signup = $signups['signups'][0];
|
485 |
if ( isset( $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
|
486 |
$salutation = $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ];
|
487 |
}
|
488 |
}
|
489 |
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
|
492 |
// Return false to stop the original WPMU function from continuing.
|
493 |
return false;
|
@@ -508,6 +523,7 @@ add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_not
|
|
508 |
* @return false|string Returns false to stop original WPMU function from continuing.
|
509 |
*/
|
510 |
function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
|
|
|
511 |
if ( is_admin() ) {
|
512 |
|
513 |
// If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications.
|
@@ -521,17 +537,21 @@ function bp_core_activation_signup_user_notification( $user, $user_email, $key,
|
|
521 |
return $user;
|
522 |
}
|
523 |
|
524 |
-
|
525 |
-
* There can be a case where the user was created without the skip confirmation
|
526 |
-
* And the super admin goes in pending accounts to resend it. In this case, as the
|
527 |
-
* meta['password'] is not set, the activation url must be WordPress one.
|
528 |
-
*/
|
529 |
} elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {
|
|
|
|
|
|
|
|
|
|
|
530 |
$is_hashpass_in_meta = maybe_unserialize( $meta );
|
531 |
|
532 |
if ( empty( $is_hashpass_in_meta['password'] ) ) {
|
533 |
return $user;
|
534 |
}
|
|
|
|
|
|
|
535 |
}
|
536 |
}
|
537 |
|
@@ -556,13 +576,51 @@ function bp_core_activation_signup_user_notification( $user, $user_email, $key,
|
|
556 |
'user.id' => $user_id,
|
557 |
),
|
558 |
);
|
559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
|
561 |
// Return false to stop the original WPMU function from continuing.
|
562 |
return false;
|
563 |
}
|
564 |
add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
|
565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
/**
|
567 |
* Filter the page title for BuddyPress pages.
|
568 |
*
|
461 |
* @return bool Returns false to stop original WPMU function from continuing.
|
462 |
*/
|
463 |
function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) {
|
464 |
+
$is_signup_resend = false;
|
465 |
+
if ( is_admin() && buddypress()->members->admin->signups_page == get_current_screen()->id ) {
|
466 |
+
// The admin is just approving/sending/resending the verification email.
|
467 |
+
$is_signup_resend = true;
|
468 |
+
}
|
469 |
+
|
470 |
$args = array(
|
471 |
'tokens' => array(
|
472 |
'activate-site.url' => esc_url( bp_get_activation_page() . '?key=' . urlencode( $key ) ),
|
479 |
),
|
480 |
);
|
481 |
|
482 |
+
$signup = bp_members_get_signup_by( 'activation_key', $key );
|
|
|
|
|
|
|
|
|
|
|
483 |
$salutation = $user;
|
484 |
+
if ( $signup && bp_is_active( 'xprofile' ) ) {
|
|
|
485 |
if ( isset( $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ] ) ) {
|
486 |
$salutation = $signup->meta[ 'field_' . bp_xprofile_fullname_field_id() ];
|
487 |
}
|
488 |
}
|
489 |
|
490 |
+
/**
|
491 |
+
* Filters if BuddyPress should send an activation key for a new multisite signup.
|
492 |
+
*
|
493 |
+
* @since 10.0.0
|
494 |
+
*
|
495 |
+
* @param string $user The user's login name.
|
496 |
+
* @param string $user_email The user's email address.
|
497 |
+
* @param string $key The activation key created in wpmu_signup_blog().
|
498 |
+
* @param bool $is_signup_resend Is the site admin sending this email?
|
499 |
+
* @param string $domain The new blog domain.
|
500 |
+
* @param string $path The new blog path.
|
501 |
+
* @param string $title The site title.
|
502 |
+
*/
|
503 |
+
if ( apply_filters( 'bp_core_signup_send_activation_key_multisite_blog', true, $user, $user_email, $key, $is_signup_resend, $domain, $path, $title ) ) {
|
504 |
+
bp_send_email( 'core-user-registration-with-blog', array( array( $user_email => $salutation ) ), $args );
|
505 |
+
}
|
506 |
|
507 |
// Return false to stop the original WPMU function from continuing.
|
508 |
return false;
|
523 |
* @return false|string Returns false to stop original WPMU function from continuing.
|
524 |
*/
|
525 |
function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
|
526 |
+
$is_signup_resend = false;
|
527 |
if ( is_admin() ) {
|
528 |
|
529 |
// If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications.
|
537 |
return $user;
|
538 |
}
|
539 |
|
540 |
+
// The site admin is approving/resending from the "manage signups" screen.
|
|
|
|
|
|
|
|
|
541 |
} elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {
|
542 |
+
/*
|
543 |
+
* There can be a case where the user was created without the skip confirmation
|
544 |
+
* And the super admin goes in pending accounts to resend it. In this case, as the
|
545 |
+
* meta['password'] is not set, the activation url must be WordPress one.
|
546 |
+
*/
|
547 |
$is_hashpass_in_meta = maybe_unserialize( $meta );
|
548 |
|
549 |
if ( empty( $is_hashpass_in_meta['password'] ) ) {
|
550 |
return $user;
|
551 |
}
|
552 |
+
|
553 |
+
// Or the admin is just approving/sending/resending the verification email.
|
554 |
+
$is_signup_resend = true;
|
555 |
}
|
556 |
}
|
557 |
|
576 |
'user.id' => $user_id,
|
577 |
),
|
578 |
);
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Filters if BuddyPress should send an activation key for a new multisite signup.
|
582 |
+
*
|
583 |
+
* @since 10.0.0
|
584 |
+
*
|
585 |
+
* @param string $user The user's login name.
|
586 |
+
* @param string $user_email The user's email address.
|
587 |
+
* @param string $key The activation key created in wpmu_signup_blog().
|
588 |
+
* @param bool $is_signup_resend Is the site admin sending this email?
|
589 |
+
*/
|
590 |
+
if ( apply_filters( 'bp_core_signup_send_activation_key_multisite', true, $user, $user_email, $key, $is_signup_resend ) ) {
|
591 |
+
bp_send_email( 'core-user-registration', array( array( $user_email => $salutation ) ), $args );
|
592 |
+
}
|
593 |
|
594 |
// Return false to stop the original WPMU function from continuing.
|
595 |
return false;
|
596 |
}
|
597 |
add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
|
598 |
|
599 |
+
/**
|
600 |
+
* Ensure that some meta values are set for new multisite signups.
|
601 |
+
*
|
602 |
+
* @since 10.0.0
|
603 |
+
*
|
604 |
+
* @see wpmu_signup_user() for a full description of params.
|
605 |
+
*
|
606 |
+
* @param array $meta Signup meta data. Default empty array.
|
607 |
+
* @return array Signup meta data.
|
608 |
+
*/
|
609 |
+
function bp_core_add_meta_to_multisite_signups( $meta ) {
|
610 |
+
|
611 |
+
// Ensure that sent_date and count_sent are set in meta.
|
612 |
+
if ( ! isset( $meta['sent_date'] ) ) {
|
613 |
+
$meta['sent_date'] = '0000-00-00 00:00:00';
|
614 |
+
}
|
615 |
+
if ( ! isset( $meta['count_sent'] ) ) {
|
616 |
+
$meta['count_sent'] = 0;
|
617 |
+
}
|
618 |
+
|
619 |
+
return $meta;
|
620 |
+
}
|
621 |
+
add_filter( 'signup_user_meta', 'bp_core_add_meta_to_multisite_signups' );
|
622 |
+
add_filter( 'signup_site_meta', 'bp_core_add_meta_to_multisite_signups' );
|
623 |
+
|
624 |
/**
|
625 |
* Filter the page title for BuddyPress pages.
|
626 |
*
|
@@ -92,7 +92,7 @@ function bp_is_running_wp( $version, $compare = '>=' ) {
|
|
92 |
*
|
93 |
* @since 1.2.6
|
94 |
*
|
95 |
-
* @global
|
96 |
*
|
97 |
* @return string Filtered database prefix.
|
98 |
*/
|
@@ -230,7 +230,7 @@ function bp_core_number_format( $number = 0, $decimals = false ) {
|
|
230 |
* 'arg3' => array(),
|
231 |
* 'arg4' => false,
|
232 |
* );
|
233 |
-
* $r =
|
234 |
*
|
235 |
* The first argument, $old_args_keys, is an array that matches the parameter positions (keys) to
|
236 |
* the new $args keys (values):
|
@@ -253,9 +253,9 @@ function bp_core_number_format( $number = 0, $decimals = false ) {
|
|
253 |
function bp_core_parse_args_array( $old_args_keys, $func_args ) {
|
254 |
$new_args = array();
|
255 |
|
256 |
-
foreach( $old_args_keys as $arg_num => $arg_key ) {
|
257 |
-
if ( isset( $func_args[$arg_num] ) ) {
|
258 |
-
$new_args[$arg_key] = $func_args[$arg_num];
|
259 |
}
|
260 |
}
|
261 |
|
@@ -290,7 +290,7 @@ function bp_parse_args( $args, $defaults = array(), $filter_key = '' ) {
|
|
290 |
}
|
291 |
|
292 |
// Passively filter the args before the parse.
|
293 |
-
if ( !empty( $filter_key ) ) {
|
294 |
|
295 |
/**
|
296 |
* Filters the arguments key before parsing if filter key provided.
|
@@ -305,12 +305,12 @@ function bp_parse_args( $args, $defaults = array(), $filter_key = '' ) {
|
|
305 |
}
|
306 |
|
307 |
// Parse.
|
308 |
-
if ( is_array( $defaults ) && !empty( $defaults ) ) {
|
309 |
$r = array_merge( $defaults, $r );
|
310 |
}
|
311 |
|
312 |
// Aggressively filter the args after the parse.
|
313 |
-
if ( !empty( $filter_key ) ) {
|
314 |
|
315 |
/**
|
316 |
* Filters the arguments key after parsing if filter key provided.
|
@@ -383,6 +383,7 @@ function bp_esc_sql_order( $order = '' ) {
|
|
383 |
*
|
384 |
* @since 2.1.0
|
385 |
*
|
|
|
386 |
* @see wpdb::esc_like() for more details on proper use.
|
387 |
*
|
388 |
* @param string $text The raw text to be escaped.
|
@@ -394,9 +395,9 @@ function bp_esc_like( $text ) {
|
|
394 |
|
395 |
if ( method_exists( $wpdb, 'esc_like' ) ) {
|
396 |
return $wpdb->esc_like( $text );
|
397 |
-
} else {
|
398 |
-
return addcslashes( $text, '_%\\' );
|
399 |
}
|
|
|
|
|
400 |
}
|
401 |
|
402 |
/**
|
@@ -501,6 +502,7 @@ function bp_core_get_packaged_component_ids() {
|
|
501 |
* Fetch a list of BP directory pages from the appropriate meta table.
|
502 |
*
|
503 |
* @since 1.5.0
|
|
|
504 |
*
|
505 |
* @param string $status 'active' to return only pages associated with active components, 'all' to return all saved
|
506 |
* pages. When running save routines, use 'all' to avoid removing data related to inactive
|
@@ -510,6 +512,21 @@ function bp_core_get_packaged_component_ids() {
|
|
510 |
*/
|
511 |
function bp_core_get_directory_page_ids( $status = 'active' ) {
|
512 |
$page_ids = bp_get_option( 'bp-pages', array() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
// Loop through pages.
|
515 |
foreach ( $page_ids as $component_name => $page_id ) {
|
@@ -535,6 +552,10 @@ function bp_core_get_directory_page_ids( $status = 'active' ) {
|
|
535 |
}
|
536 |
}
|
537 |
|
|
|
|
|
|
|
|
|
538 |
/**
|
539 |
* Filters the list of BP directory pages from the appropriate meta table.
|
540 |
*
|
@@ -702,7 +723,7 @@ function bp_core_add_page_mappings( $components, $existing = 'keep' ) {
|
|
702 |
|
703 |
// Register and Activate are not components, but need pages when
|
704 |
// registration is enabled.
|
705 |
-
if (
|
706 |
foreach ( array( 'register', 'activate' ) as $slug ) {
|
707 |
if ( ! isset( $pages[ $slug ] ) ) {
|
708 |
$pages_to_create[ $slug ] = $page_titles[ $slug ];
|
@@ -1195,7 +1216,7 @@ function bp_core_current_time( $gmt = true, $type = 'mysql' ) {
|
|
1195 |
*/
|
1196 |
function bp_core_time_diff( $args = array() ) {
|
1197 |
$retval = null;
|
1198 |
-
$r =
|
1199 |
$args,
|
1200 |
array(
|
1201 |
'older_date' => 0,
|
@@ -2847,7 +2868,11 @@ function bp_nav_menu_get_item_url( $slug ) {
|
|
2847 |
* @return array|WP_Error Array of results. If there were any problems, returns a WP_Error object.
|
2848 |
*/
|
2849 |
function bp_core_get_suggestions( $args ) {
|
2850 |
-
$args = bp_parse_args(
|
|
|
|
|
|
|
|
|
2851 |
|
2852 |
if ( ! $args['type'] ) {
|
2853 |
return new WP_Error( 'missing_parameter' );
|
@@ -3271,13 +3296,6 @@ function bp_register_type_meta( $type_tax, $meta_key, array $args ) {
|
|
3271 |
return false;
|
3272 |
}
|
3273 |
|
3274 |
-
// register_term_meta() was introduced in WP 4.9.8.
|
3275 |
-
if ( ! bp_is_running_wp( '4.9.8' ) ) {
|
3276 |
-
$args['object_subtype'] = $type_tax;
|
3277 |
-
|
3278 |
-
return register_meta( 'term', $meta_key, $args );
|
3279 |
-
}
|
3280 |
-
|
3281 |
return register_term_meta( $type_tax, $meta_key, $args );
|
3282 |
}
|
3283 |
|
@@ -3536,15 +3554,17 @@ function bp_send_email( $email_type, $to, $args = array() ) {
|
|
3536 |
}
|
3537 |
}
|
3538 |
|
3539 |
-
$args = bp_parse_args(
|
3540 |
-
|
3541 |
-
|
3542 |
-
|
|
|
|
|
|
|
3543 |
|
3544 |
/*
|
3545 |
* Build the email.
|
3546 |
*/
|
3547 |
-
|
3548 |
$email = bp_get_email( $email_type );
|
3549 |
if ( is_wp_error( $email ) ) {
|
3550 |
return $email;
|
@@ -3683,15 +3703,13 @@ function bp_email_get_appearance_settings() {
|
|
3683 |
)
|
3684 |
);
|
3685 |
|
3686 |
-
|
3687 |
-
|
3688 |
-
|
3689 |
-
|
3690 |
-
|
3691 |
-
|
3692 |
-
|
3693 |
-
);
|
3694 |
-
}
|
3695 |
}
|
3696 |
|
3697 |
$default_args = array(
|
@@ -3799,6 +3817,8 @@ function bp_core_replace_tokens_in_text( $text, $tokens ) {
|
|
3799 |
* Get a list of emails for populating the email post type.
|
3800 |
*
|
3801 |
* @since 2.5.1
|
|
|
|
|
3802 |
*
|
3803 |
* @return array
|
3804 |
*/
|
@@ -3959,6 +3979,22 @@ function bp_email_get_schema() {
|
|
3959 |
/* translators: do not remove {} brackets or translate its contents. */
|
3960 |
'post_excerpt' => __( "{{inviter.name}} has invited you to join the site \"{{site.name}}\".\n\n{{usermessage}}\n\nTo accept your invitation, visit: {{{invite.accept_url}}}\n\nTo learn more about the site, visit: {{{site.url}}}.\nTo view {{inviter.name}}'s profile, visit: {{{inviter.url}}}", 'buddypress' ),
|
3961 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3962 |
) );
|
3963 |
}
|
3964 |
|
@@ -4131,25 +4167,42 @@ function bp_email_get_type_schema( $field = 'description' ) {
|
|
4131 |
),
|
4132 |
);
|
4133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4134 |
$types = array(
|
4135 |
-
'activity-comment'
|
4136 |
-
'activity-comment-author'
|
4137 |
-
'activity-at-message'
|
4138 |
-
'groups-at-message'
|
4139 |
-
'core-user-registration'
|
4140 |
-
'core-user-registration-with-blog'
|
4141 |
-
'friends-request'
|
4142 |
-
'friends-request-accepted'
|
4143 |
-
'groups-details-updated'
|
4144 |
-
'groups-invitation'
|
4145 |
-
'groups-member-promoted'
|
4146 |
-
'groups-membership-request'
|
4147 |
-
'messages-unread'
|
4148 |
-
'settings-verify-email-change'
|
4149 |
-
'groups-membership-request-accepted'
|
4150 |
-
'groups-membership-request-rejected'
|
4151 |
-
'core-user-activation'
|
4152 |
-
'bp-members-invitation'
|
|
|
|
|
4153 |
);
|
4154 |
|
4155 |
if ( $field !== 'all' ) {
|
92 |
*
|
93 |
* @since 1.2.6
|
94 |
*
|
95 |
+
* @global wpdb $wpdb WordPress database object.
|
96 |
*
|
97 |
* @return string Filtered database prefix.
|
98 |
*/
|
230 |
* 'arg3' => array(),
|
231 |
* 'arg4' => false,
|
232 |
* );
|
233 |
+
* $r = bp_parse_args( $args, $defaults ); // ...
|
234 |
*
|
235 |
* The first argument, $old_args_keys, is an array that matches the parameter positions (keys) to
|
236 |
* the new $args keys (values):
|
253 |
function bp_core_parse_args_array( $old_args_keys, $func_args ) {
|
254 |
$new_args = array();
|
255 |
|
256 |
+
foreach ( $old_args_keys as $arg_num => $arg_key ) {
|
257 |
+
if ( isset( $func_args[ $arg_num ] ) ) {
|
258 |
+
$new_args[ $arg_key ] = $func_args[ $arg_num ];
|
259 |
}
|
260 |
}
|
261 |
|
290 |
}
|
291 |
|
292 |
// Passively filter the args before the parse.
|
293 |
+
if ( ! empty( $filter_key ) ) {
|
294 |
|
295 |
/**
|
296 |
* Filters the arguments key before parsing if filter key provided.
|
305 |
}
|
306 |
|
307 |
// Parse.
|
308 |
+
if ( is_array( $defaults ) && ! empty( $defaults ) ) {
|
309 |
$r = array_merge( $defaults, $r );
|
310 |
}
|
311 |
|
312 |
// Aggressively filter the args after the parse.
|
313 |
+
if ( ! empty( $filter_key ) ) {
|
314 |
|
315 |
/**
|
316 |
* Filters the arguments key after parsing if filter key provided.
|
383 |
*
|
384 |
* @since 2.1.0
|
385 |
*
|
386 |
+
* @global wpdb $wpdb WordPress database object.
|
387 |
* @see wpdb::esc_like() for more details on proper use.
|
388 |
*
|
389 |
* @param string $text The raw text to be escaped.
|
395 |
|
396 |
if ( method_exists( $wpdb, 'esc_like' ) ) {
|
397 |
return $wpdb->esc_like( $text );
|
|
|
|
|
398 |
}
|
399 |
+
|
400 |
+
return addcslashes( $text, '_%\\' );
|
401 |
}
|
402 |
|
403 |
/**
|
502 |
* Fetch a list of BP directory pages from the appropriate meta table.
|
503 |
*
|
504 |
* @since 1.5.0
|
505 |
+
* @since 10.0.0 Eventually switch the current site to BP root's one on multisite configs.
|
506 |
*
|
507 |
* @param string $status 'active' to return only pages associated with active components, 'all' to return all saved
|
508 |
* pages. When running save routines, use 'all' to avoid removing data related to inactive
|
512 |
*/
|
513 |
function bp_core_get_directory_page_ids( $status = 'active' ) {
|
514 |
$page_ids = bp_get_option( 'bp-pages', array() );
|
515 |
+
$switched = false;
|
516 |
+
|
517 |
+
/*
|
518 |
+
* Make sure to switch the current site to BP root's one, if needed.
|
519 |
+
*
|
520 |
+
* @see https://buddypress.trac.wordpress.org/ticket/8592
|
521 |
+
*/
|
522 |
+
if ( is_multisite() ) {
|
523 |
+
$bp_site_id = bp_get_root_blog_id();
|
524 |
+
|
525 |
+
if ( $bp_site_id !== get_current_blog_id() ) {
|
526 |
+
switch_to_blog( $bp_site_id );
|
527 |
+
$switched = true;
|
528 |
+
}
|
529 |
+
}
|
530 |
|
531 |
// Loop through pages.
|
532 |
foreach ( $page_ids as $component_name => $page_id ) {
|
552 |
}
|
553 |
}
|
554 |
|
555 |
+
if ( true === $switched ) {
|
556 |
+
restore_current_blog();
|
557 |
+
}
|
558 |
+
|
559 |
/**
|
560 |
* Filters the list of BP directory pages from the appropriate meta table.
|
561 |
*
|
723 |
|
724 |
// Register and Activate are not components, but need pages when
|
725 |
// registration is enabled.
|
726 |
+
if ( bp_allow_access_to_registration_pages() ) {
|
727 |
foreach ( array( 'register', 'activate' ) as $slug ) {
|
728 |
if ( ! isset( $pages[ $slug ] ) ) {
|
729 |
$pages_to_create[ $slug ] = $page_titles[ $slug ];
|
1216 |
*/
|
1217 |
function bp_core_time_diff( $args = array() ) {
|
1218 |
$retval = null;
|
1219 |
+
$r = bp_parse_args(
|
1220 |
$args,
|
1221 |
array(
|
1222 |
'older_date' => 0,
|
2868 |
* @return array|WP_Error Array of results. If there were any problems, returns a WP_Error object.
|
2869 |
*/
|
2870 |
function bp_core_get_suggestions( $args ) {
|
2871 |
+
$args = bp_parse_args(
|
2872 |
+
$args,
|
2873 |
+
array(),
|
2874 |
+
'get_suggestions'
|
2875 |
+
);
|
2876 |
|
2877 |
if ( ! $args['type'] ) {
|
2878 |
return new WP_Error( 'missing_parameter' );
|
3296 |
return false;
|
3297 |
}
|
3298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3299 |
return register_term_meta( $type_tax, $meta_key, $args );
|
3300 |
}
|
3301 |
|
3554 |
}
|
3555 |
}
|
3556 |
|
3557 |
+
$args = bp_parse_args(
|
3558 |
+
$args,
|
3559 |
+
array(
|
3560 |
+
'tokens' => array(),
|
3561 |
+
),
|
3562 |
+
'send_email'
|
3563 |
+
);
|
3564 |
|
3565 |
/*
|
3566 |
* Build the email.
|
3567 |
*/
|
|
|
3568 |
$email = bp_get_email( $email_type );
|
3569 |
if ( is_wp_error( $email ) ) {
|
3570 |
return $email;
|
3703 |
)
|
3704 |
);
|
3705 |
|
3706 |
+
$privacy_policy_url = get_privacy_policy_url();
|
3707 |
+
if ( $privacy_policy_url ) {
|
3708 |
+
$footer_text[] = sprintf(
|
3709 |
+
'<a href="%s">%s</a>',
|
3710 |
+
esc_url( $privacy_policy_url ),
|
3711 |
+
esc_html__( 'Privacy Policy', 'buddypress' )
|
3712 |
+
);
|
|
|
|
|
3713 |
}
|
3714 |
|
3715 |
$default_args = array(
|
3817 |
* Get a list of emails for populating the email post type.
|
3818 |
*
|
3819 |
* @since 2.5.1
|
3820 |
+
* @since 10.0.0 Added members-membership-request and
|
3821 |
+
* members-membership-request-rejected email types.
|
3822 |
*
|
3823 |
* @return array
|
3824 |
*/
|
3979 |
/* translators: do not remove {} brackets or translate its contents. */
|
3980 |
'post_excerpt' => __( "{{inviter.name}} has invited you to join the site \"{{site.name}}\".\n\n{{usermessage}}\n\nTo accept your invitation, visit: {{{invite.accept_url}}}\n\nTo learn more about the site, visit: {{{site.url}}}.\nTo view {{inviter.name}}'s profile, visit: {{{inviter.url}}}", 'buddypress' ),
|
3981 |
),
|
3982 |
+
'members-membership-request' => array(
|
3983 |
+
/* translators: do not remove {} brackets or translate its contents. */
|
3984 |
+
'post_title' => __( '{{requesting-user.user_login}} would like to join {{site.name}}', 'buddypress' ),
|
3985 |
+
/* translators: do not remove {} brackets or translate its contents. */
|
3986 |
+
'post_content' => __( "{{requesting-user.user_login}} would like to join the site: "{{site.name}}".\n\n<a href=\"{{{manage.url}}}\">Manage the request</a>.", 'buddypress' ),
|
3987 |
+
/* translators: do not remove {} brackets or translate its contents. */
|
3988 |
+
'post_excerpt' => __( "{{requesting-user.user_login}} would like to join the site \"{{site.name}}\".\n\nTo manage the request, visit: {{{manage.url}}}.", 'buddypress' ),
|
3989 |
+
),
|
3990 |
+
'members-membership-request-rejected' => array(
|
3991 |
+
/* translators: do not remove {} brackets or translate its contents. */
|
3992 |
+
'post_title' => __( 'Your request to join {{site.name}} has been declined', 'buddypress' ),
|
3993 |
+
/* translators: do not remove {} brackets or translate its contents. */
|
3994 |
+
'post_content' => __( "Sorry, your request to join the site "{{site.name}}" has been declined.", 'buddypress' ),
|
3995 |
+
/* translators: do not remove {} brackets or translate its contents. */
|
3996 |
+
'post_excerpt' => __( "Sorry, your request to join the site \"{{site.name}}\" has been declined.", 'buddypress' ),
|
3997 |
+
),
|
3998 |
) );
|
3999 |
}
|
4000 |
|
4167 |
),
|
4168 |
);
|
4169 |
|
4170 |
+
$members_membership_request = array(
|
4171 |
+
'description' => __( 'Someone has requested membership on this site.', 'buddypress' ),
|
4172 |
+
'named_salutation' => true,
|
4173 |
+
'unsubscribe' => array(
|
4174 |
+
'meta_key' => 'notification_members_membership_request',
|
4175 |
+
'message' => __( 'You will no longer receive emails when people submit requests to join this site.', 'buddypress' ),
|
4176 |
+
),
|
4177 |
+
);
|
4178 |
+
|
4179 |
+
$members_membership_request_rejected = array(
|
4180 |
+
'description' => __( 'A site membership request has been rejected.', 'buddypress' ),
|
4181 |
+
'named_salutation' => false,
|
4182 |
+
'unsubscribe' => false,
|
4183 |
+
);
|
4184 |
+
|
4185 |
$types = array(
|
4186 |
+
'activity-comment' => $activity_comment,
|
4187 |
+
'activity-comment-author' => $activity_comment_author,
|
4188 |
+
'activity-at-message' => $activity_at_message,
|
4189 |
+
'groups-at-message' => $groups_at_message,
|
4190 |
+
'core-user-registration' => $core_user_registration,
|
4191 |
+
'core-user-registration-with-blog' => $core_user_registration_with_blog,
|
4192 |
+
'friends-request' => $friends_request,
|
4193 |
+
'friends-request-accepted' => $friends_request_accepted,
|
4194 |
+
'groups-details-updated' => $groups_details_updated,
|
4195 |
+
'groups-invitation' => $groups_invitation,
|
4196 |
+
'groups-member-promoted' => $groups_member_promoted,
|
4197 |
+
'groups-membership-request' => $groups_membership_request,
|
4198 |
+
'messages-unread' => $messages_unread,
|
4199 |
+
'settings-verify-email-change' => $settings_verify_email_change,
|
4200 |
+
'groups-membership-request-accepted' => $groups_membership_request_accepted,
|
4201 |
+
'groups-membership-request-rejected' => $groups_membership_request_rejected,
|
4202 |
+
'core-user-activation' => $core_user_activation,
|
4203 |
+
'bp-members-invitation' => $members_invitation,
|
4204 |
+
'members-membership-request' => $members_membership_request,
|
4205 |
+
'members-membership-request-rejected' => $members_membership_request_rejected,
|
4206 |
);
|
4207 |
|
4208 |
if ( $field !== 'all' ) {
|
@@ -50,36 +50,30 @@ function bp_rest_api_is_available() {
|
|
50 |
/**
|
51 |
* Filter here to disable the BP REST API.
|
52 |
*
|
53 |
-
* The BP REST API requires at least WordPress 4.7.0
|
54 |
*
|
55 |
* @since 5.0.0
|
56 |
*
|
57 |
* @param boolean $value True if the BP REST API is available. False otherwise.
|
58 |
*/
|
59 |
-
return apply_filters( 'bp_rest_api_is_available',
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
* Register the jQuery.ajax wrapper for BP REST API requests.
|
64 |
*
|
65 |
* @since 5.0.0
|
|
|
66 |
*/
|
67 |
function bp_rest_api_register_request_script() {
|
68 |
if ( ! bp_rest_api_is_available() ) {
|
69 |
return;
|
70 |
}
|
71 |
|
72 |
-
$dependencies = array( 'jquery' );
|
73 |
-
|
74 |
-
// The wrapper for WP REST API requests was introduced in WordPress 4.9.0.
|
75 |
-
if ( wp_script_is( 'wp-api-request', 'registered' ) ) {
|
76 |
-
$dependencies = array( 'wp-api-request' );
|
77 |
-
}
|
78 |
-
|
79 |
wp_register_script(
|
80 |
'bp-api-request',
|
81 |
sprintf( '%1$sbp-core/js/bp-api-request%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
|
82 |
-
|
83 |
bp_get_version(),
|
84 |
true
|
85 |
);
|
@@ -88,9 +82,8 @@ function bp_rest_api_register_request_script() {
|
|
88 |
'bp-api-request',
|
89 |
'bpApiSettings',
|
90 |
array(
|
91 |
-
'
|
92 |
-
'
|
93 |
-
'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ),
|
94 |
)
|
95 |
);
|
96 |
}
|
50 |
/**
|
51 |
* Filter here to disable the BP REST API.
|
52 |
*
|
53 |
+
* The BP REST API requires at least WordPress 4.7.0.
|
54 |
*
|
55 |
* @since 5.0.0
|
56 |
*
|
57 |
* @param boolean $value True if the BP REST API is available. False otherwise.
|
58 |
*/
|
59 |
+
return apply_filters( 'bp_rest_api_is_available', bp_rest_in_buddypress() ) || bp_rest_is_plugin_active();
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
* Register the jQuery.ajax wrapper for BP REST API requests.
|
64 |
*
|
65 |
* @since 5.0.0
|
66 |
+
* @deprecated 10.0.0
|
67 |
*/
|
68 |
function bp_rest_api_register_request_script() {
|
69 |
if ( ! bp_rest_api_is_available() ) {
|
70 |
return;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
wp_register_script(
|
74 |
'bp-api-request',
|
75 |
sprintf( '%1$sbp-core/js/bp-api-request%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
|
76 |
+
array( 'jquery', 'wp-api-request' ),
|
77 |
bp_get_version(),
|
78 |
true
|
79 |
);
|
82 |
'bp-api-request',
|
83 |
'bpApiSettings',
|
84 |
array(
|
85 |
+
'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ),
|
86 |
+
'deprecatedWarning' => __( 'The bp.apiRequest function is deprecated since BuddyPress 10.0.0, please use wp.apiRequest instead.', 'buddypress' ),
|
|
|
87 |
)
|
88 |
);
|
89 |
}
|
@@ -453,11 +453,22 @@ function bp_get_query_template( $type, $templates = array() ) {
|
|
453 |
*/
|
454 |
$templates = apply_filters( "bp_get_{$type}_template", $templates );
|
455 |
|
456 |
-
|
457 |
-
|
|
|
|
|
458 |
$templates = bp_set_theme_compat_templates( $templates );
|
459 |
$template = bp_locate_template( $templates );
|
460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
461 |
|
462 |
/**
|
463 |
* Filters the path to a template file.
|
453 |
*/
|
454 |
$templates = apply_filters( "bp_get_{$type}_template", $templates );
|
455 |
|
456 |
+
/*
|
457 |
+
* Filter possible templates, try to match one, and set any BuddyPress theme
|
458 |
+
* compat properties so they can be cross-checked later.
|
459 |
+
*/
|
460 |
$templates = bp_set_theme_compat_templates( $templates );
|
461 |
$template = bp_locate_template( $templates );
|
462 |
+
|
463 |
+
/*
|
464 |
+
* The current theme is using the WordPress Full Site Editing feature.
|
465 |
+
* BuddyPress then needs to use the WordPress template canvas to retrieve the community content.
|
466 |
+
*/
|
467 |
+
if ( current_theme_supports( 'block-templates' ) && $template === get_theme_file_path( 'index.php' ) ) {
|
468 |
+
$template = ABSPATH . WPINC . '/template-canvas.php';
|
469 |
+
}
|
470 |
+
|
471 |
+
$template = bp_set_theme_compat_template( $template );
|
472 |
|
473 |
/**
|
474 |
* Filters the path to a template file.
|
@@ -880,14 +880,18 @@ function bp_create_excerpt( $text, $length = 225, $options = array() ) {
|
|
880 |
// Backward compatibility. The third argument used to be a boolean $filter_shortcodes.
|
881 |
$filter_shortcodes_default = is_bool( $options ) ? $options : true;
|
882 |
|
883 |
-
$r = bp_parse_args(
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
|
|
|
|
|
|
|
|
891 |
|
892 |
// Save the original text, to be passed along to the filter.
|
893 |
$original_text = $text;
|
@@ -1214,12 +1218,16 @@ function bp_registration_needs_activation() {
|
|
1214 |
*/
|
1215 |
function bp_get_email_subject( $args = array() ) {
|
1216 |
|
1217 |
-
$r = bp_parse_args(
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
|
|
|
|
|
|
|
|
1223 |
|
1224 |
$subject = $r['before'] . wp_specialchars_decode( bp_get_option( 'blogname', $r['default'] ), ENT_QUOTES ) . $r['after'] . ' ' . $r['text'];
|
1225 |
|
@@ -3184,7 +3192,11 @@ function bp_get_title_parts( $seplocation = 'right' ) {
|
|
3184 |
|
3185 |
// Sign up page.
|
3186 |
} elseif ( bp_is_register_page() ) {
|
3187 |
-
|
|
|
|
|
|
|
|
|
3188 |
|
3189 |
// Activation page.
|
3190 |
} elseif ( bp_is_activation_page() ) {
|
@@ -3671,7 +3683,11 @@ function bp_nav_menu( $args = array() ) {
|
|
3671 |
'menu_id' => '',
|
3672 |
'walker' => '',
|
3673 |
);
|
3674 |
-
|
|
|
|
|
|
|
|
|
3675 |
|
3676 |
/**
|
3677 |
* Filters the parsed bp_nav_menu arguments.
|
@@ -3872,7 +3888,7 @@ function bp_is_widget_block_active( $block_name = '', $widget_id_base = '' ) {
|
|
3872 |
'block' => false,
|
3873 |
);
|
3874 |
|
3875 |
-
if ( $block_name && bp_is_running_wp( '5.
|
3876 |
$widget_blocks = get_option( 'widget_block', array() );
|
3877 |
$sidebars = wp_get_sidebars_widgets();
|
3878 |
|
880 |
// Backward compatibility. The third argument used to be a boolean $filter_shortcodes.
|
881 |
$filter_shortcodes_default = is_bool( $options ) ? $options : true;
|
882 |
|
883 |
+
$r = bp_parse_args(
|
884 |
+
$options,
|
885 |
+
array(
|
886 |
+
'ending' => __( ' […]', 'buddypress' ),
|
887 |
+
'exact' => false,
|
888 |
+
'html' => true,
|
889 |
+
'filter_shortcodes' => $filter_shortcodes_default,
|
890 |
+
'strip_tags' => false,
|
891 |
+
'remove_links' => false,
|
892 |
+
),
|
893 |
+
'create_excerpt'
|
894 |
+
);
|
895 |
|
896 |
// Save the original text, to be passed along to the filter.
|
897 |
$original_text = $text;
|
1218 |
*/
|
1219 |
function bp_get_email_subject( $args = array() ) {
|
1220 |
|
1221 |
+
$r = bp_parse_args(
|
1222 |
+
$args,
|
1223 |
+
array(
|
1224 |
+
'before' => '[',
|
1225 |
+
'after' => ']',
|
1226 |
+
'default' => __( 'Community', 'buddypress' ),
|
1227 |
+
'text' => '',
|
1228 |
+
),
|
1229 |
+
'get_email_subject'
|
1230 |
+
);
|
1231 |
|
1232 |
$subject = $r['before'] . wp_specialchars_decode( bp_get_option( 'blogname', $r['default'] ), ENT_QUOTES ) . $r['after'] . ' ' . $r['text'];
|
1233 |
|
3192 |
|
3193 |
// Sign up page.
|
3194 |
} elseif ( bp_is_register_page() ) {
|
3195 |
+
if ( bp_get_membership_requests_required() ) {
|
3196 |
+
$bp_title_parts = array( __( 'Request Membership', 'buddypress' ) );
|
3197 |
+
} else {
|
3198 |
+
$bp_title_parts = array( __( 'Create an Account', 'buddypress' ) );
|
3199 |
+
}
|
3200 |
|
3201 |
// Activation page.
|
3202 |
} elseif ( bp_is_activation_page() ) {
|
3683 |
'menu_id' => '',
|
3684 |
'walker' => '',
|
3685 |
);
|
3686 |
+
|
3687 |
+
$args = bp_parse_args(
|
3688 |
+
$args,
|
3689 |
+
$defaults
|
3690 |
+
);
|
3691 |
|
3692 |
/**
|
3693 |
* Filters the parsed bp_nav_menu arguments.
|
3888 |
'block' => false,
|
3889 |
);
|
3890 |
|
3891 |
+
if ( $block_name && bp_is_running_wp( '5.8.0', '>=' ) ) {
|
3892 |
$widget_blocks = get_option( 'widget_block', array() );
|
3893 |
$sidebars = wp_get_sidebars_widgets();
|
3894 |
|
@@ -549,71 +549,77 @@ function bp_theme_compat_reset_post( $args = array() ) {
|
|
549 |
|
550 |
// Switch defaults if post is set.
|
551 |
if ( isset( $wp_query->post ) ) {
|
552 |
-
$dummy =
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
|
|
|
|
|
|
584 |
} else {
|
585 |
-
$dummy =
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
|
|
|
|
|
|
617 |
}
|
618 |
|
619 |
// Bail if dummy post is empty.
|
549 |
|
550 |
// Switch defaults if post is set.
|
551 |
if ( isset( $wp_query->post ) ) {
|
552 |
+
$dummy = bp_parse_args(
|
553 |
+
$args,
|
554 |
+
array(
|
555 |
+
'ID' => $wp_query->post->ID,
|
556 |
+
'post_status' => $wp_query->post->post_status,
|
557 |
+
'post_author' => $wp_query->post->post_author,
|
558 |
+
'post_parent' => $wp_query->post->post_parent,
|
559 |
+
'post_type' => $wp_query->post->post_type,
|
560 |
+
'post_date' => $wp_query->post->post_date,
|
561 |
+
'post_date_gmt' => $wp_query->post->post_date_gmt,
|
562 |
+
'post_modified' => $wp_query->post->post_modified,
|
563 |
+
'post_modified_gmt' => $wp_query->post->post_modified_gmt,
|
564 |
+
'post_content' => $wp_query->post->post_content,
|
565 |
+
'post_title' => $wp_query->post->post_title,
|
566 |
+
'post_excerpt' => $wp_query->post->post_excerpt,
|
567 |
+
'post_content_filtered' => $wp_query->post->post_content_filtered,
|
568 |
+
'post_mime_type' => $wp_query->post->post_mime_type,
|
569 |
+
'post_password' => $wp_query->post->post_password,
|
570 |
+
'post_name' => $wp_query->post->post_name,
|
571 |
+
'guid' => $wp_query->post->guid,
|
572 |
+
'menu_order' => $wp_query->post->menu_order,
|
573 |
+
'pinged' => $wp_query->post->pinged,
|
574 |
+
'to_ping' => $wp_query->post->to_ping,
|
575 |
+
'ping_status' => $wp_query->post->ping_status,
|
576 |
+
'comment_status' => $wp_query->post->comment_status,
|
577 |
+
'comment_count' => $wp_query->post->comment_count,
|
578 |
+
'filter' => $wp_query->post->filter,
|
579 |
+
|
580 |
+
'is_404' => false,
|
581 |
+
'is_page' => false,
|
582 |
+
'is_single' => false,
|
583 |
+
'is_archive' => false,
|
584 |
+
'is_tax' => false,
|
585 |
+
)
|
586 |
+
);
|
587 |
} else {
|
588 |
+
$dummy = bp_parse_args(
|
589 |
+
$args,
|
590 |
+
array(
|
591 |
+
'ID' => -9999,
|
592 |
+
'post_status' => 'public',
|
593 |
+
'post_author' => 0,
|
594 |
+
'post_parent' => 0,
|
595 |
+
'post_type' => 'page',
|
596 |
+
'post_date' => 0,
|
597 |
+
'post_date_gmt' => 0,
|
598 |
+
'post_modified' => 0,
|
599 |
+
'post_modified_gmt' => 0,
|
600 |
+
'post_content' => '',
|
601 |
+
'post_title' => '',
|
602 |
+
'post_excerpt' => '',
|
603 |
+
'post_content_filtered' => '',
|
604 |
+
'post_mime_type' => '',
|
605 |
+
'post_password' => '',
|
606 |
+
'post_name' => '',
|
607 |
+
'guid' => '',
|
608 |
+
'menu_order' => 0,
|
609 |
+
'pinged' => '',
|
610 |
+
'to_ping' => '',
|
611 |
+
'ping_status' => '',
|
612 |
+
'comment_status' => 'closed',
|
613 |
+
'comment_count' => 0,
|
614 |
+
'filter' => 'raw',
|
615 |
+
|
616 |
+
'is_404' => false,
|
617 |
+
'is_page' => false,
|
618 |
+
'is_single' => false,
|
619 |
+
'is_archive' => false,
|
620 |
+
'is_tax' => false,
|
621 |
+
)
|
622 |
+
);
|
623 |
}
|
624 |
|
625 |
// Bail if dummy post is empty.
|
@@ -278,6 +278,12 @@ function bp_version_updater() {
|
|
278 |
if ( $raw_db_version < 12850 ) {
|
279 |
bp_update_to_8_0();
|
280 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
}
|
282 |
|
283 |
/* All done! *************************************************************/
|
@@ -704,6 +710,44 @@ function bp_core_get_8_0_upgrade_email_schema( $emails ) {
|
|
704 |
return $new_emails;
|
705 |
}
|
706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
707 |
/**
|
708 |
* Updates the component field for new_members type.
|
709 |
*
|
278 |
if ( $raw_db_version < 12850 ) {
|
279 |
bp_update_to_8_0();
|
280 |
}
|
281 |
+
|
282 |
+
// Version 10.0.0.
|
283 |
+
if ( $raw_db_version < 13165 ) {
|
284 |
+
bp_update_to_10_0();
|
285 |
+
}
|
286 |
+
|
287 |
}
|
288 |
|
289 |
/* All done! *************************************************************/
|
710 |
return $new_emails;
|
711 |
}
|
712 |
|
713 |
+
/**
|
714 |
+
* 10.0.0 update routine.
|
715 |
+
*
|
716 |
+
* - Install new BP Emails for membership requests.
|
717 |
+
*
|
718 |
+
* @since 10.0.0
|
719 |
+
*/
|
720 |
+
function bp_update_to_10_0() {
|
721 |
+
|
722 |
+
// Install membership request emails.
|
723 |
+
add_filter( 'bp_email_get_schema', 'bp_core_get_10_0_upgrade_email_schema' );
|
724 |
+
|
725 |
+
bp_core_install_emails();
|
726 |
+
|
727 |
+
remove_filter( 'bp_email_get_schema', 'bp_core_get_10_0_upgrade_email_schema' );
|
728 |
+
}
|
729 |
+
|
730 |
+
/**
|
731 |
+
* Select only the emails that need to be installed with version 10.0.
|
732 |
+
*
|
733 |
+
* @since 10.0.0
|
734 |
+
*
|
735 |
+
* @param array $emails The array of emails schema.
|
736 |
+
*/
|
737 |
+
function bp_core_get_10_0_upgrade_email_schema( $emails ) {
|
738 |
+
$new_emails = array();
|
739 |
+
|
740 |
+
if ( isset( $emails['members-membership-request'] ) ) {
|
741 |
+
$new_emails['members-membership-request'] = $emails['members-membership-request'];
|
742 |
+
}
|
743 |
+
|
744 |
+
if ( isset( $emails['members-membership-request-rejected'] ) ) {
|
745 |
+
$new_emails['members-membership-request-rejected'] = $emails['members-membership-request-rejected'];
|
746 |
+
}
|
747 |
+
|
748 |
+
return $new_emails;
|
749 |
+
}
|
750 |
+
|
751 |
/**
|
752 |
* Updates the component field for new_members type.
|
753 |
*
|
@@ -10,12 +10,89 @@
|
|
10 |
// Exit if accessed directly.
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Register bp-core widgets.
|
15 |
*
|
16 |
* @since 1.0.0
|
17 |
*/
|
18 |
function bp_core_register_widgets() {
|
19 |
-
add_action( 'widgets_init',
|
20 |
}
|
21 |
add_action( 'bp_register_widgets', 'bp_core_register_widgets' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
// Exit if accessed directly.
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
13 |
+
/**
|
14 |
+
* Should BuddyPress load Legacy Widgets?
|
15 |
+
*
|
16 |
+
* @since 10.0.0
|
17 |
+
*
|
18 |
+
* @return bool False if BuddyPress shouldn't load Legacy Widgets. True otherwise.
|
19 |
+
*/
|
20 |
+
function bp_core_retain_legacy_widgets() {
|
21 |
+
$theme_supports = current_theme_supports( 'widgets-block-editor' );
|
22 |
+
$wp_supports = bp_is_running_wp( '5.8.0' );
|
23 |
+
|
24 |
+
/** This filter is documented in wp-includes/widgets.php */
|
25 |
+
$block_widgets_enabled = $theme_supports && apply_filters( 'use_widgets_block_editor', $wp_supports );
|
26 |
+
|
27 |
+
$retain_legacy_widgets = true;
|
28 |
+
if ( $block_widgets_enabled ) {
|
29 |
+
$retain_legacy_widgets = false;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Filter here to force Legacy Widgets to be retained or not.
|
34 |
+
*
|
35 |
+
* @since 10.0.0
|
36 |
+
*
|
37 |
+
* @param bool $retain_legacy_widgets False if BuddyPress shouldn't load Legacy Widgets. True otherwise.
|
38 |
+
*/
|
39 |
+
return apply_filters( 'bp_core_retain_legacy_widgets', $retain_legacy_widgets );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Registers the Login widget.
|
44 |
+
*
|
45 |
+
* @since 10.0.0
|
46 |
+
*/
|
47 |
+
function bp_core_register_login_widget() {
|
48 |
+
register_widget( 'BP_Core_Login_Widget' );
|
49 |
+
}
|
50 |
+
|
51 |
/**
|
52 |
* Register bp-core widgets.
|
53 |
*
|
54 |
* @since 1.0.0
|
55 |
*/
|
56 |
function bp_core_register_widgets() {
|
57 |
+
add_action( 'widgets_init', 'bp_core_register_login_widget' );
|
58 |
}
|
59 |
add_action( 'bp_register_widgets', 'bp_core_register_widgets' );
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Checks whether BuddyPress should unhook Legacy Widget registrations.
|
63 |
+
*
|
64 |
+
* @since 10.0.0
|
65 |
+
*/
|
66 |
+
function bp_core_maybe_unhook_legacy_widgets() {
|
67 |
+
if ( bp_core_retain_legacy_widgets() ) {
|
68 |
+
return;
|
69 |
+
}
|
70 |
+
|
71 |
+
$callbacks = array(
|
72 |
+
'bp_core_register_login_widget',
|
73 |
+
'bp_members_register_members_widget',
|
74 |
+
'bp_members_register_whos_online_widget',
|
75 |
+
'bp_members_register_recently_active_widget',
|
76 |
+
);
|
77 |
+
|
78 |
+
if ( bp_is_active( 'friends' ) ) {
|
79 |
+
$callbacks[] = 'bp_friends_register_friends_widget';
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( bp_is_active( 'groups' ) ) {
|
83 |
+
$callbacks[] = 'bp_groups_register_groups_widget';
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( bp_is_active( 'messages' ) ) {
|
87 |
+
$callbacks[] = 'bp_messages_register_sitewide_notices_widget';
|
88 |
+
}
|
89 |
+
|
90 |
+
if ( bp_is_active( 'blogs' ) && bp_is_active( 'activity' ) && bp_is_root_blog() ) {
|
91 |
+
$callbacks[] = 'bp_blogs_register_recent_posts_widget';
|
92 |
+
}
|
93 |
+
|
94 |
+
foreach ( $callbacks as $callback ) {
|
95 |
+
remove_action( 'widgets_init', $callback );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
add_action( 'widgets_init', 'bp_core_maybe_unhook_legacy_widgets', 0 );
|
@@ -308,28 +308,6 @@ if ( !function_exists( 'mb_strrpos' ) ) {
|
|
308 |
}
|
309 |
}
|
310 |
|
311 |
-
/**
|
312 |
-
* Returns the name of the hook to use once a WordPress Site is inserted into the Database.
|
313 |
-
*
|
314 |
-
* WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back
|
315 |
-
* to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current
|
316 |
-
* WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier
|
317 |
-
* versions of WordPress.
|
318 |
-
*
|
319 |
-
* @since 6.0.0
|
320 |
-
*
|
321 |
-
* @return string The name of the hook to use.
|
322 |
-
*/
|
323 |
-
function bp_insert_site_hook() {
|
324 |
-
$wp_hook = 'wpmu_new_blog';
|
325 |
-
|
326 |
-
if ( function_exists( 'wp_insert_site' ) ) {
|
327 |
-
$wp_hook = 'wp_initialize_site';
|
328 |
-
}
|
329 |
-
|
330 |
-
return $wp_hook;
|
331 |
-
}
|
332 |
-
|
333 |
/**
|
334 |
* Catch the new site data for a later use.
|
335 |
*
|
@@ -399,29 +377,7 @@ function bp_insert_site( $site, $args_or_user_id = null, $domain = '', $path = '
|
|
399 |
*/
|
400 |
do_action( 'bp_insert_site', $site_id, $user_id, $domain, $path, $network_id, $meta );
|
401 |
}
|
402 |
-
add_action(
|
403 |
-
|
404 |
-
/**
|
405 |
-
* Returns the name of the hook to use once a WordPress Site is deleted.
|
406 |
-
*
|
407 |
-
* WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back
|
408 |
-
* to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the
|
409 |
-
* current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for
|
410 |
-
* earlier versions of WordPress.
|
411 |
-
*
|
412 |
-
* @since 6.0.0
|
413 |
-
*
|
414 |
-
* @return string The name of the hook to use.
|
415 |
-
*/
|
416 |
-
function bp_delete_site_hook() {
|
417 |
-
$wp_hook = 'delete_blog';
|
418 |
-
|
419 |
-
if ( function_exists( 'wp_delete_site' ) ) {
|
420 |
-
$wp_hook = 'wp_validate_site_deletion';
|
421 |
-
}
|
422 |
-
|
423 |
-
return $wp_hook;
|
424 |
-
}
|
425 |
|
426 |
/**
|
427 |
* Makes sure the `bp_delete_site` hook is fired if site's deletion
|
@@ -471,25 +427,4 @@ function bp_delete_site( $site_id_or_error, $drop_or_site = false ) {
|
|
471 |
*/
|
472 |
do_action( 'bp_delete_site', $site_id, $drop );
|
473 |
}
|
474 |
-
add_action(
|
475 |
-
|
476 |
-
if ( ! function_exists( 'wp_parse_list' ) ) {
|
477 |
-
/**
|
478 |
-
* Cleans up an array, comma- or space-separated list of scalar values.
|
479 |
-
*
|
480 |
-
* As BuddyPress supports older WordPress versions than 5.1 (4.9 & 5.0),
|
481 |
-
* the BP REST API needs this function to be available.
|
482 |
-
*
|
483 |
-
* @since 7.0.0
|
484 |
-
*
|
485 |
-
* @param array|string $list List of values.
|
486 |
-
* @return array Sanitized array of values.
|
487 |
-
*/
|
488 |
-
function wp_parse_list( $list ) {
|
489 |
-
if ( ! is_array( $list ) ) {
|
490 |
-
return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
|
491 |
-
}
|
492 |
-
|
493 |
-
return $list;
|
494 |
-
}
|
495 |
-
}
|
308 |
}
|
309 |
}
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
/**
|
312 |
* Catch the new site data for a later use.
|
313 |
*
|
377 |
*/
|
378 |
do_action( 'bp_insert_site', $site_id, $user_id, $domain, $path, $network_id, $meta );
|
379 |
}
|
380 |
+
add_action( 'wp_initialize_site', 'bp_insert_site' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
|
382 |
/**
|
383 |
* Makes sure the `bp_delete_site` hook is fired if site's deletion
|
427 |
*/
|
428 |
do_action( 'bp_delete_site', $site_id, $drop );
|
429 |
}
|
430 |
+
add_action( 'wp_validate_site_deletion', 'bp_delete_site', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -75,6 +75,30 @@ class BP_Admin {
|
|
75 |
*/
|
76 |
public $notices = array();
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
/** Methods ***************************************************************/
|
79 |
|
80 |
/**
|
@@ -179,6 +203,9 @@ class BP_Admin {
|
|
179 |
// BuddyPress Types administration.
|
180 |
add_action( 'load-edit-tags.php', array( 'BP_Admin_Types', 'register_types_admin' ) );
|
181 |
|
|
|
|
|
|
|
182 |
/* Filters ***********************************************************/
|
183 |
|
184 |
// Add link to settings page.
|
@@ -191,6 +218,10 @@ class BP_Admin {
|
|
191 |
|
192 |
// Emails
|
193 |
add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
|
196 |
/**
|
@@ -229,7 +260,7 @@ class BP_Admin {
|
|
229 |
);
|
230 |
|
231 |
// Add the option pages.
|
232 |
-
$
|
233 |
$this->settings_page,
|
234 |
__( 'BuddyPress Components', 'buddypress' ),
|
235 |
__( 'BuddyPress', 'buddypress' ),
|
@@ -238,7 +269,10 @@ class BP_Admin {
|
|
238 |
'bp_core_admin_components_settings'
|
239 |
);
|
240 |
|
241 |
-
$
|
|
|
|
|
|
|
242 |
$this->settings_page,
|
243 |
__( 'BuddyPress Pages', 'buddypress' ),
|
244 |
__( 'BuddyPress Pages', 'buddypress' ),
|
@@ -247,7 +281,10 @@ class BP_Admin {
|
|
247 |
'bp_core_admin_slugs_settings'
|
248 |
);
|
249 |
|
250 |
-
$
|
|
|
|
|
|
|
251 |
$this->settings_page,
|
252 |
__( 'BuddyPress Options', 'buddypress' ),
|
253 |
__( 'BuddyPress Options', 'buddypress' ),
|
@@ -256,8 +293,11 @@ class BP_Admin {
|
|
256 |
'bp_core_admin_settings'
|
257 |
);
|
258 |
|
|
|
|
|
|
|
259 |
// Credits.
|
260 |
-
$
|
261 |
$this->settings_page,
|
262 |
__( 'BuddyPress Credits', 'buddypress' ),
|
263 |
__( 'BuddyPress Credits', 'buddypress' ),
|
@@ -266,6 +306,9 @@ class BP_Admin {
|
|
266 |
array( $this, 'credits_screen' )
|
267 |
);
|
268 |
|
|
|
|
|
|
|
269 |
// For consistency with non-Multisite, we add a Tools menu in
|
270 |
// the Network Admin as a home for our Tools panel.
|
271 |
if ( is_multisite() && bp_core_do_network_admin() ) {
|
@@ -293,7 +336,10 @@ class BP_Admin {
|
|
293 |
$tools_parent = 'tools.php';
|
294 |
}
|
295 |
|
296 |
-
|
|
|
|
|
|
|
297 |
$tools_parent,
|
298 |
__( 'BuddyPress Tools', 'buddypress' ),
|
299 |
__( 'BuddyPress', 'buddypress' ),
|
@@ -302,7 +348,10 @@ class BP_Admin {
|
|
302 |
'bp_core_admin_tools'
|
303 |
);
|
304 |
|
305 |
-
$
|
|
|
|
|
|
|
306 |
$tools_parent,
|
307 |
__( 'Manage Opt-outs', 'buddypress' ),
|
308 |
__( 'Manage Opt-outs', 'buddypress' ),
|
@@ -311,6 +360,9 @@ class BP_Admin {
|
|
311 |
'bp_core_optouts_admin'
|
312 |
);
|
313 |
|
|
|
|
|
|
|
314 |
// For network-wide configs, add a link to (the root site's) Emails screen.
|
315 |
if ( is_network_admin() && bp_is_network_activated() ) {
|
316 |
$email_labels = bp_get_email_post_type_labels();
|
@@ -333,6 +385,26 @@ class BP_Admin {
|
|
333 |
foreach( $hooks as $hook ) {
|
334 |
add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
|
335 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
|
338 |
/**
|
@@ -417,6 +489,12 @@ class BP_Admin {
|
|
417 |
register_setting( 'buddypress', 'bp-enable-members-invitations', 'intval' );
|
418 |
}
|
419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
/* XProfile Section **************************************************/
|
421 |
|
422 |
if ( bp_is_active( 'xprofile' ) ) {
|
@@ -521,6 +599,22 @@ class BP_Admin {
|
|
521 |
) );
|
522 |
}
|
523 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
/**
|
525 |
* Add some general styling to the admin area.
|
526 |
*
|
@@ -573,11 +667,6 @@ class BP_Admin {
|
|
573 |
* @since 4.0.0
|
574 |
*/
|
575 |
public function add_privacy_policy_content() {
|
576 |
-
// Nothing to do if we're running < WP 4.9.6.
|
577 |
-
if ( bp_is_running_wp( '4.9.6', '<' ) ) {
|
578 |
-
return;
|
579 |
-
}
|
580 |
-
|
581 |
$suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>';
|
582 |
$content = '';
|
583 |
|
@@ -668,56 +757,112 @@ class BP_Admin {
|
|
668 |
<div class="bp-hello-content">
|
669 |
<div id="dynamic-content"></div>
|
670 |
<div id="top-features">
|
671 |
-
<h2><?php esc_html_e( '
|
672 |
<figure class="bp-hello-aligncenter">
|
673 |
-
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/
|
674 |
</figure>
|
675 |
<p>
|
676 |
-
<?php esc_html_e( '
|
677 |
</p>
|
678 |
<p>
|
679 |
-
<?php esc_html_e( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
</p>
|
681 |
<figure class="bp-hello-aligncenter">
|
682 |
-
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/
|
683 |
</figure>
|
684 |
<p>
|
685 |
-
|
686 |
-
</p>
|
687 |
-
<h3>
|
688 |
<?php
|
689 |
printf(
|
690 |
-
/*
|
691 |
-
esc_html__( '
|
692 |
-
|
|
|
|
|
|
|
|
|
693 |
);
|
694 |
?>
|
695 |
-
</
|
|
|
|
|
|
|
|
|
696 |
<figure class="bp-hello-aligncenter">
|
697 |
-
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/
|
698 |
</figure>
|
699 |
<p>
|
700 |
-
<?php esc_html_e( 'As shown in the image above,
|
701 |
</p>
|
|
|
|
|
|
|
702 |
<p>
|
703 |
-
<?php esc_html_e( '
|
704 |
</p>
|
705 |
|
706 |
<hr class="bp-hello-divider"/>
|
707 |
|
708 |
-
<h2><?php esc_html_e( '
|
709 |
<p>
|
710 |
-
<?php esc_html_e( '
|
711 |
</p>
|
712 |
<p>
|
713 |
-
<?php esc_html_e( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
</p>
|
715 |
|
716 |
<hr class="bp-hello-divider"/>
|
717 |
|
718 |
<h2><?php esc_html_e( 'Under the hood', 'buddypress' ); ?></h2>
|
719 |
<p>
|
720 |
-
<?php esc_html_e( '
|
721 |
<?php esc_html_e( 'Click on the "Changelog" tab to discover them all!', 'buddypress' ); ?>
|
722 |
</p>
|
723 |
<figure class="bp-hello-aligncenter">
|
@@ -761,10 +906,10 @@ class BP_Admin {
|
|
761 |
<?php
|
762 |
printf(
|
763 |
/* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
|
764 |
-
_n( 'Built with %1$s by <a href="%2$s">%3$d volunteer</a>.', 'Built with %1$s by <a href="%2$s">%3$d volunteers</a>.',
|
765 |
'<span class="dashicons dashicons-heart"></span>',
|
766 |
esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
|
767 |
-
number_format_i18n(
|
768 |
);
|
769 |
?>
|
770 |
</p>
|
@@ -810,14 +955,10 @@ class BP_Admin {
|
|
810 |
* @since 1.7.0
|
811 |
*/
|
812 |
public function credits_screen() {
|
|
|
813 |
?>
|
814 |
|
815 |
-
<div class="
|
816 |
-
|
817 |
-
<h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?></h1>
|
818 |
-
<hr class="wp-header-end">
|
819 |
-
|
820 |
-
<h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Credits', 'buddypress' ) ); ?></h2>
|
821 |
|
822 |
<p class="about-description"><?php esc_html_e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
|
823 |
|
@@ -928,9 +1069,9 @@ class BP_Admin {
|
|
928 |
<a class="web" href="https://profiles.wordpress.org/vapvarun"><img alt="" class="gravatar" src="//gravatar.com/avatar/78a3bf7eb3a1132fc667f96f2631e448?s=120">
|
929 |
Varun Dubey</a>
|
930 |
</li>
|
931 |
-
<li class="wp-person" id="wp-person-
|
932 |
-
<a class="web" href="https://profiles.wordpress.org/
|
933 |
-
|
934 |
</li>
|
935 |
</ul>
|
936 |
|
@@ -944,30 +1085,44 @@ class BP_Admin {
|
|
944 |
?>
|
945 |
</h3>
|
946 |
<p class="wp-credits-list">
|
|
|
|
|
947 |
<a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
|
948 |
-
<a href="https://profiles.wordpress.org/
|
949 |
-
<a href="https://profiles.wordpress.org/
|
950 |
<a href="https://profiles.wordpress.org/dancaragea/">Dan Caragea (dancaragea)</a>,
|
951 |
-
<a href="https://profiles.wordpress.org/
|
952 |
-
<a href="https://profiles.wordpress.org/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
953 |
<a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
954 |
-
<a href="https://profiles.wordpress.org/
|
955 |
-
<a href="https://profiles.wordpress.org/
|
|
|
|
|
|
|
|
|
|
|
956 |
<a href="https://profiles.wordpress.org/markscottrobson/">Mark Robson (markscottrobson)</a>,
|
957 |
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
958 |
-
<a href="https://profiles.wordpress.org/modemlooper/">modemlooper</a>,
|
959 |
<a href="https://profiles.wordpress.org/niftythree/">Nifty (niftythree)</a>,
|
|
|
|
|
960 |
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
961 |
-
<a href="https://profiles.wordpress.org/nekojonez/">Pieterjan Deneys (nekojonez)</a>,
|
962 |
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
963 |
<a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
|
964 |
-
<a href="https://profiles.wordpress.org/
|
965 |
-
<a href="https://profiles.wordpress.org/
|
966 |
-
<a href="https://profiles.wordpress.org/
|
967 |
-
<a href="https://profiles.wordpress.org/
|
968 |
-
<a href="https://profiles.wordpress.org/
|
969 |
-
<a href="https://github.com/tkserver">TKServer</a>,
|
970 |
-
<a href="https://profiles.wordpress.org/vapvarun/">Varun Dubey (vapvarun)</a>.
|
971 |
</p>
|
972 |
|
973 |
<h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
|
@@ -1050,12 +1205,19 @@ class BP_Admin {
|
|
1050 |
}
|
1051 |
|
1052 |
// Grab email situations for the current post.
|
1053 |
-
$
|
|
|
1054 |
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1059 |
}
|
1060 |
|
1061 |
/** Helpers ***************************************************************/
|
@@ -1210,19 +1372,187 @@ class BP_Admin {
|
|
1210 |
'footer' => true,
|
1211 |
),
|
1212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1213 |
// 3.0
|
1214 |
'bp-hello-js' => array(
|
1215 |
'file' => "{$url}hello{$min}.js",
|
1216 |
-
'dependencies' => array( 'thickbox', '
|
1217 |
'footer' => true,
|
1218 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1219 |
) );
|
1220 |
|
1221 |
$version = bp_get_version();
|
1222 |
|
1223 |
foreach ( $scripts as $id => $script ) {
|
1224 |
wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1225 |
}
|
1226 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1227 |
}
|
1228 |
endif; // End class_exists check.
|
75 |
*/
|
76 |
public $notices = array();
|
77 |
|
78 |
+
/**
|
79 |
+
* BuddyPress admin screens nav tabs.
|
80 |
+
*
|
81 |
+
* @since 10.0.0
|
82 |
+
* @var array()
|
83 |
+
*/
|
84 |
+
public $nav_tabs = array();
|
85 |
+
|
86 |
+
/**
|
87 |
+
* BuddyPress admin active nav tab.
|
88 |
+
*
|
89 |
+
* @since 10.0.0
|
90 |
+
* @var string()
|
91 |
+
*/
|
92 |
+
public $active_nav_tab = '';
|
93 |
+
|
94 |
+
/**
|
95 |
+
* BuddyPress admin screens submenu pages.
|
96 |
+
*
|
97 |
+
* @since 10.0.0
|
98 |
+
* @var array()
|
99 |
+
*/
|
100 |
+
public $submenu_pages = array();
|
101 |
+
|
102 |
/** Methods ***************************************************************/
|
103 |
|
104 |
/**
|
203 |
// BuddyPress Types administration.
|
204 |
add_action( 'load-edit-tags.php', array( 'BP_Admin_Types', 'register_types_admin' ) );
|
205 |
|
206 |
+
// Official BuddyPress supported Add-ons.
|
207 |
+
add_action( 'install_plugins_bp-add-ons', array( $this, 'display_addons_table' ) );
|
208 |
+
|
209 |
/* Filters ***********************************************************/
|
210 |
|
211 |
// Add link to settings page.
|
218 |
|
219 |
// Emails
|
220 |
add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
|
221 |
+
|
222 |
+
// Official BuddyPress supported Add-ons.
|
223 |
+
add_filter( 'install_plugins_tabs', array( $this, 'addons_tab' ) );
|
224 |
+
add_filter( 'install_plugins_table_api_args_bp-add-ons', array( $this,'addons_args' ) );
|
225 |
}
|
226 |
|
227 |
/**
|
260 |
);
|
261 |
|
262 |
// Add the option pages.
|
263 |
+
$bp_components_page = add_submenu_page(
|
264 |
$this->settings_page,
|
265 |
__( 'BuddyPress Components', 'buddypress' ),
|
266 |
__( 'BuddyPress', 'buddypress' ),
|
269 |
'bp_core_admin_components_settings'
|
270 |
);
|
271 |
|
272 |
+
$this->submenu_pages['settings']['bp-components'] = $bp_components_page;
|
273 |
+
$hooks[] = $bp_components_page;
|
274 |
+
|
275 |
+
$bp_page_settings_page = add_submenu_page(
|
276 |
$this->settings_page,
|
277 |
__( 'BuddyPress Pages', 'buddypress' ),
|
278 |
__( 'BuddyPress Pages', 'buddypress' ),
|
281 |
'bp_core_admin_slugs_settings'
|
282 |
);
|
283 |
|
284 |
+
$this->submenu_pages['settings']['bp-page-settings'] = $bp_page_settings_page;
|
285 |
+
$hooks[] = $bp_page_settings_page;
|
286 |
+
|
287 |
+
$bp_settings_page = add_submenu_page(
|
288 |
$this->settings_page,
|
289 |
__( 'BuddyPress Options', 'buddypress' ),
|
290 |
__( 'BuddyPress Options', 'buddypress' ),
|
293 |
'bp_core_admin_settings'
|
294 |
);
|
295 |
|
296 |
+
$this->submenu_pages['settings']['bp-settings'] = $bp_settings_page;
|
297 |
+
$hooks[] = $bp_settings_page;
|
298 |
+
|
299 |
// Credits.
|
300 |
+
$bp_credits_page = add_submenu_page(
|
301 |
$this->settings_page,
|
302 |
__( 'BuddyPress Credits', 'buddypress' ),
|
303 |
__( 'BuddyPress Credits', 'buddypress' ),
|
306 |
array( $this, 'credits_screen' )
|
307 |
);
|
308 |
|
309 |
+
$this->submenu_pages['settings']['bp-credits'] = $bp_credits_page;
|
310 |
+
$hooks[] = $bp_credits_page;
|
311 |
+
|
312 |
// For consistency with non-Multisite, we add a Tools menu in
|
313 |
// the Network Admin as a home for our Tools panel.
|
314 |
if ( is_multisite() && bp_core_do_network_admin() ) {
|
336 |
$tools_parent = 'tools.php';
|
337 |
}
|
338 |
|
339 |
+
// Init the Tools submenu pages global.
|
340 |
+
$this->submenu_pages['tools'] = array();
|
341 |
+
|
342 |
+
$bp_repair_tools = add_submenu_page(
|
343 |
$tools_parent,
|
344 |
__( 'BuddyPress Tools', 'buddypress' ),
|
345 |
__( 'BuddyPress', 'buddypress' ),
|
348 |
'bp_core_admin_tools'
|
349 |
);
|
350 |
|
351 |
+
$this->submenu_pages['tools']['bp-tools'] = $bp_repair_tools;
|
352 |
+
$hooks[] = $bp_repair_tools;
|
353 |
+
|
354 |
+
$bp_optouts_tools = add_submenu_page(
|
355 |
$tools_parent,
|
356 |
__( 'Manage Opt-outs', 'buddypress' ),
|
357 |
__( 'Manage Opt-outs', 'buddypress' ),
|
360 |
'bp_core_optouts_admin'
|
361 |
);
|
362 |
|
363 |
+
$this->submenu_pages['tools']['bp-optouts'] = $bp_optouts_tools;
|
364 |
+
$hooks[] = $bp_optouts_tools;
|
365 |
+
|
366 |
// For network-wide configs, add a link to (the root site's) Emails screen.
|
367 |
if ( is_network_admin() && bp_is_network_activated() ) {
|
368 |
$email_labels = bp_get_email_post_type_labels();
|
385 |
foreach( $hooks as $hook ) {
|
386 |
add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
|
387 |
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Fires before adding inline styles for BP Admin tabs.
|
391 |
+
*
|
392 |
+
* @since 10.0.0
|
393 |
+
*
|
394 |
+
* @param array $submenu_pages The BP_Admin submenu pages passed by reference.
|
395 |
+
*/
|
396 |
+
do_action_ref_array( 'bp_admin_submenu_pages', array( &$this->submenu_pages ) );
|
397 |
+
|
398 |
+
foreach( $this->submenu_pages as $subpage_type => $subpage_hooks ) {
|
399 |
+
foreach ( $subpage_hooks as $subpage_hook ) {
|
400 |
+
add_action( "admin_print_styles-{$subpage_hook}", array( $this, 'add_inline_styles' ), 20 );
|
401 |
+
|
402 |
+
// When BuddyPress is activated on the network, the settings screens need an admin notice when settings have been updated.
|
403 |
+
if ( is_network_admin() && bp_is_network_activated() && 'settings' === $subpage_type && 'settings_page_bp-credits' !== $subpage_hook ) {
|
404 |
+
add_action( "load-{$subpage_hook}", array( $this, 'admin_load' ) );
|
405 |
+
}
|
406 |
+
}
|
407 |
+
}
|
408 |
}
|
409 |
|
410 |
/**
|
489 |
register_setting( 'buddypress', 'bp-enable-members-invitations', 'intval' );
|
490 |
}
|
491 |
|
492 |
+
// Membership requests.
|
493 |
+
if ( bp_is_active( 'members', 'membership_requests' ) ) {
|
494 |
+
add_settings_field( 'bp-enable-membership-requests', __( 'Membership Requests', 'buddypress' ), 'bp_admin_setting_callback_membership_requests', 'buddypress', 'bp_members' );
|
495 |
+
register_setting( 'buddypress', 'bp-enable-membership-requests', 'intval' );
|
496 |
+
}
|
497 |
+
|
498 |
/* XProfile Section **************************************************/
|
499 |
|
500 |
if ( bp_is_active( 'xprofile' ) ) {
|
599 |
) );
|
600 |
}
|
601 |
|
602 |
+
/**
|
603 |
+
* Displays an admin notice to inform settings have been saved.
|
604 |
+
*
|
605 |
+
* The notice is only displayed inside the Network Admin when
|
606 |
+
* BuddyPress is network activated.
|
607 |
+
*
|
608 |
+
* @since 10.0.0
|
609 |
+
*/
|
610 |
+
public function admin_load() {
|
611 |
+
if ( ! isset( $_GET['updated'] ) ) {
|
612 |
+
return;
|
613 |
+
}
|
614 |
+
|
615 |
+
bp_core_add_admin_notice( __( 'Settings saved.', 'buddypress' ), 'updated' );
|
616 |
+
}
|
617 |
+
|
618 |
/**
|
619 |
* Add some general styling to the admin area.
|
620 |
*
|
667 |
* @since 4.0.0
|
668 |
*/
|
669 |
public function add_privacy_policy_content() {
|
|
|
|
|
|
|
|
|
|
|
670 |
$suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>';
|
671 |
$content = '';
|
672 |
|
757 |
<div class="bp-hello-content">
|
758 |
<div id="dynamic-content"></div>
|
759 |
<div id="top-features">
|
760 |
+
<h2><?php esc_html_e( 'Site Membership Requests', 'buddypress' ); ?></h2>
|
761 |
<figure class="bp-hello-aligncenter">
|
762 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/prevent-spammer-registration.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Site Membership Requests list.', 'buddypress' ); ?>" />
|
763 |
</figure>
|
764 |
<p>
|
765 |
+
<?php esc_html_e( 'Take control of your site’s membership! With site membership requests, new in BuddyPress 10.0.0, administrators can significantly reduce the number of spam users trolling their sites.', 'buddypress' ); ?>
|
766 |
</p>
|
767 |
<p>
|
768 |
+
<?php esc_html_e( 'When requests are enabled, visitors may submit a membership request, which must be manually approved by a site administrator.', 'buddypress' ); ?>
|
769 |
+
<?php
|
770 |
+
printf(
|
771 |
+
/* translators: %s is the placeholder for the link to the BuddyPress Codex documentation page. */
|
772 |
+
esc_html__( '%s about this feature.', 'buddypress' ),
|
773 |
+
sprintf(
|
774 |
+
'<a href="%1$s">%2$s</a>',
|
775 |
+
esc_url( 'https://codex.buddypress.org/administrator-guide/alternative-registration-workflows/#membership-requests-available-in-buddypress-10' ),
|
776 |
+
esc_html__( 'Read more', 'buddypress' )
|
777 |
+
)
|
778 |
+
);
|
779 |
+
?>
|
780 |
+
</p>
|
781 |
+
|
782 |
+
<hr class="bp-hello-divider"/>
|
783 |
+
|
784 |
+
<h2><?php esc_html_e( 'More engaging logging activities', 'buddypress' ); ?></h2>
|
785 |
+
<p>
|
786 |
+
<?php esc_html_e( 'These simple activities about specific user interactions or events (e.g.: you and me are now friends) are more visually attractive to improve user engagement in your community.', 'buddypress' ); ?>
|
787 |
</p>
|
788 |
<figure class="bp-hello-aligncenter">
|
789 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/logging-activities.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the new avatar secondary activity.', 'buddypress' ); ?>" />
|
790 |
</figure>
|
791 |
<p>
|
792 |
+
<?php esc_html_e( 'The most impressive new activity is that which is generated when a user updates their profile photo: it will include the profile photo that spurred the creation of the activity item, even if it has been updated since.', 'buddypress' ); ?>
|
|
|
|
|
793 |
<?php
|
794 |
printf(
|
795 |
+
/* translators: %s is the placeholder for the link to the BuddyPress Development blog. */
|
796 |
+
esc_html__( 'Learn more about it reading this %s.', 'buddypress' ),
|
797 |
+
sprintf(
|
798 |
+
'<a href="%1$s">%2$s</a>',
|
799 |
+
esc_url( 'https://bpdevel.wordpress.com/2022/01/06/more-engaging-logging-activities-in-10-0-0/' ),
|
800 |
+
esc_html__( 'Developer note', 'buddypress' )
|
801 |
+
)
|
802 |
);
|
803 |
?>
|
804 |
+
</p>
|
805 |
+
|
806 |
+
<hr class="bp-hello-divider"/>
|
807 |
+
|
808 |
+
<h2><?php esc_html_e( 'Administration: improved BuddyPress management experience', 'buddypress' ); ?></h2>
|
809 |
<figure class="bp-hello-aligncenter">
|
810 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-settings-screen.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the BuddyPress settings screen.', 'buddypress' ); ?>" />
|
811 |
</figure>
|
812 |
<p>
|
813 |
+
<?php esc_html_e( 'As shown in the image above, the BuddyPress administration screens are now using the layout WordPress uses for its tabbed administration screens such as the Site-Health or Privacy ones.', 'buddypress' ); ?>
|
814 |
</p>
|
815 |
+
<figure class="bp-hello-aligncenter">
|
816 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/edit-pages-screen.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Edit Pages screen.', 'buddypress' ); ?>" />
|
817 |
+
</figure>
|
818 |
<p>
|
819 |
+
<?php esc_html_e( 'Knowing the WordPress pages BuddyPress uses for its front-end directory screens is easier, a status information informs you about the role of all BuddyPress pages.', 'buddypress' ); ?>
|
820 |
</p>
|
821 |
|
822 |
<hr class="bp-hello-divider"/>
|
823 |
|
824 |
+
<h2><?php esc_html_e( 'A new area to discover our current and future BuddyPress Add-ons.', 'buddypress' ); ?></h2>
|
825 |
<p>
|
826 |
+
<?php esc_html_e( 'BuddyPress Add-ons are experimental plugins, beta features packaged as plugins, that will be made available into the official WordPress.org plugins directory so that it’s easier for you to test them and give the development team your feedback.', 'buddypress' ); ?>
|
827 |
</p>
|
828 |
<p>
|
829 |
+
<?php esc_html_e( 'The more we are to get involved into the future of our open source project, the brighter it will be and the faster we’ll be able to include great new features!', 'buddypress' ); ?>
|
830 |
+
</p>
|
831 |
+
|
832 |
+
<figure class="bp-hello-aligncenter">
|
833 |
+
<img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/hello-buddypress-addons.png' ); ?>" alt="<?php esc_attr_e( 'Illustration showing the Edit Pages screen.', 'buddypress' ); ?>" />
|
834 |
+
</figure>
|
835 |
+
|
836 |
+
<p>
|
837 |
+
<?php esc_html_e( 'BuddyPress Add-ons are also stable complementary BP Components or BP Blocks, we choose to keep independent from the core of BuddyPress to leave you the choice to use it or not.', 'buddypress' ); ?>
|
838 |
+
<?php
|
839 |
+
printf(
|
840 |
+
/* translators: %s is the placeholder for the link to the BuddyPress Add-ons administration page. */
|
841 |
+
esc_html__( 'The BP Search Block is a first example of this second category of add-ons, give it a try installing it from your %s administration screen.', 'buddypress' ),
|
842 |
+
sprintf(
|
843 |
+
'<a href="%1$s">%2$s</a>',
|
844 |
+
esc_url( add_query_arg( 'tab', 'bp-add-ons', network_admin_url( 'plugin-install.php' ) ) ),
|
845 |
+
esc_html__( 'BuddyPress Add-ons', 'buddypress' )
|
846 |
+
)
|
847 |
+
);
|
848 |
+
?>
|
849 |
+
</p>
|
850 |
+
|
851 |
+
<hr class="bp-hello-divider"/>
|
852 |
+
|
853 |
+
<h2><?php esc_html_e( 'Ready for Twenty Twenty-Two!', 'buddypress' ); ?></h2>
|
854 |
+
<p>
|
855 |
+
<?php esc_html_e( 'WordPress 5.9 will introduce Full Site Editing featuring the new default theme Twenty Twenty-Two.', 'buddypress' ); ?>
|
856 |
+
</p>
|
857 |
+
<p>
|
858 |
+
<?php esc_html_e( 'The needed adjustments to our BP Theme Compatibility API were made so that you can enjoy this amazing feature making sure the BuddyPress generated content integrates optimally within themes supporting it.', 'buddypress' ); ?>
|
859 |
</p>
|
860 |
|
861 |
<hr class="bp-hello-divider"/>
|
862 |
|
863 |
<h2><?php esc_html_e( 'Under the hood', 'buddypress' ); ?></h2>
|
864 |
<p>
|
865 |
+
<?php esc_html_e( '10.0.0 comes with more than 70 changes including performance improvements to the BP Notifications, the BP Activity & the BP Signups API; Date Queries support for Members, Groups and Sites loops; new BP Avatar UI Recycle tab, improved inline documentation/translators comments and code formatting.', 'buddypress' ); ?>
|
866 |
<?php esc_html_e( 'Click on the "Changelog" tab to discover them all!', 'buddypress' ); ?>
|
867 |
</p>
|
868 |
<figure class="bp-hello-aligncenter">
|
906 |
<?php
|
907 |
printf(
|
908 |
/* translators: 1: heart dashicons. 2: BP Credits screen url. 3: number of BuddyPress contributors to this version. */
|
909 |
+
_n( 'Built with %1$s by <a href="%2$s">%3$d volunteer</a>.', 'Built with %1$s by <a href="%2$s">%3$d volunteers</a>.', 38, 'buddypress' ),
|
910 |
'<span class="dashicons dashicons-heart"></span>',
|
911 |
esc_url( bp_get_admin_url( 'admin.php?page=bp-credits' ) ),
|
912 |
+
number_format_i18n( 38 )
|
913 |
);
|
914 |
?>
|
915 |
</p>
|
955 |
* @since 1.7.0
|
956 |
*/
|
957 |
public function credits_screen() {
|
958 |
+
bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Credits', 'buddypress' ) );
|
959 |
?>
|
960 |
|
961 |
+
<div class="buddypress-body bp-about-wrap">
|
|
|
|
|
|
|
|
|
|
|
962 |
|
963 |
<p class="about-description"><?php esc_html_e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
|
964 |
|
1069 |
<a class="web" href="https://profiles.wordpress.org/vapvarun"><img alt="" class="gravatar" src="//gravatar.com/avatar/78a3bf7eb3a1132fc667f96f2631e448?s=120">
|
1070 |
Varun Dubey</a>
|
1071 |
</li>
|
1072 |
+
<li class="wp-person" id="wp-person-oztaser">
|
1073 |
+
<a class="web" href="https://profiles.wordpress.org/oztaser/"><img alt="" class="gravatar" src="//gravatar.com/avatar/06eb4dd13c0113bf826968ae16a13e52?s=120">
|
1074 |
+
Adil Öztaşer</a>
|
1075 |
</li>
|
1076 |
</ul>
|
1077 |
|
1085 |
?>
|
1086 |
</h3>
|
1087 |
<p class="wp-credits-list">
|
1088 |
+
<a href="https://github.com/Achilles4400">Achilles4400</a>,
|
1089 |
+
<a href="https://profiles.wordpress.org/oztaser/">Adil Öztaşer (oztaser)</a>,
|
1090 |
<a href="https://profiles.wordpress.org/boonebgorges/">Boone B Gorges (boonebgorges)</a>,
|
1091 |
+
<a href="https://profiles.wordpress.org/needle/">Christian Wach (needle)</a>,
|
1092 |
+
<a href="https://profiles.wordpress.org/comminski/">comminski</a>,
|
1093 |
<a href="https://profiles.wordpress.org/dancaragea/">Dan Caragea (dancaragea)</a>,
|
1094 |
+
<a href="https://profiles.wordpress.org/dcavins/">David Cavins (dcavins)</a>,
|
1095 |
+
<a href="https://profiles.wordpress.org/dhavalkasvala/">Dhaval Kasavala (dhavalkasvala)</a>,
|
1096 |
+
<a href="https://profiles.wordpress.org/dd32/">Dion Hulse (dd32)</a>,
|
1097 |
+
<a href="https://github.com/durdenx">durdenx</a>,
|
1098 |
+
<a href="https://profiles.wordpress.org/ellucinda/">ellucinda</a>,
|
1099 |
+
<a href="https://profiles.wordpress.org/vanpop/">Evan Stein (vanpop)</a>,
|
1100 |
+
<a href="https://profiles.wordpress.org/garyj/">Gary Jones (garyj)</a>,
|
1101 |
+
<a href="https://profiles.wordpress.org/hasanuzzamanshamim/">Hasanuzzaman (hasanuzzamanshamim)</a>,
|
1102 |
+
<a href="https://github.com/jakubrak">jakubrak</a>,
|
1103 |
+
<a href="https://profiles.wordpress.org/jean-david/">Jean-David Daviet (Jean-David)</a>,
|
1104 |
+
<a href="https://profiles.wordpress.org/jenfraggle/">Jennifer Burnett (jenfraggle)</a>
|
1105 |
<a href="https://profiles.wordpress.org/johnjamesjacoby/">John James Jacoby (johnjamesjacoby)</a>,
|
1106 |
+
<a href="https://profiles.wordpress.org/josett225/">josett225</a>,
|
1107 |
+
<a href="https://profiles.wordpress.org/ketan_chawda/">Ketan Chawda (ketan_chawda)</a>,
|
1108 |
+
<a href="https://profiles.wordpress.org/konnektiv/">konnektiv</a>,
|
1109 |
+
<a href="https://profiles.wordpress.org/offereins/">Laurens Offereins (Offereins)</a>,
|
1110 |
+
<a href="https://profiles.wordpress.org/magland/">magland</a>,
|
1111 |
+
<a href="https://profiles.wordpress.org/mandro/">mandro</a>,
|
1112 |
+
<a href="https://github.com/marioshtika">marioshtika</a>,
|
1113 |
<a href="https://profiles.wordpress.org/markscottrobson/">Mark Robson (markscottrobson)</a>,
|
1114 |
<a href="https://profiles.wordpress.org/imath/">Mathieu Viet (imath)</a>,
|
|
|
1115 |
<a href="https://profiles.wordpress.org/niftythree/">Nifty (niftythree)</a>,
|
1116 |
+
<a href="https://profiles.wordpress.org/nunks/">nunks</a>,
|
1117 |
+
<a href="https://profiles.wordpress.org/oddev56/">oddev56</a>,
|
1118 |
<a href="https://profiles.wordpress.org/DJPaul/">Paul Gibbs (DJPaul)</a>,
|
|
|
1119 |
<a href="https://profiles.wordpress.org/r-a-y/">r-a-y</a>,
|
1120 |
<a href="https://profiles.wordpress.org/espellcaste/">Renato Alves (espellcaste)</a>,
|
1121 |
+
<a href="https://profiles.wordpress.org/rigsbyx/">rigsbyx</a>,
|
1122 |
+
<a href="https://profiles.wordpress.org/thomaslhotta/">thomaslhotta</a>,
|
1123 |
+
<a href="https://profiles.wordpress.org/vapvarun/">Varun Dubey (vapvarun)</a>,
|
1124 |
+
<a href="https://profiles.wordpress.org/venutius/">venutius</a>,
|
1125 |
+
<a href="https://profiles.wordpress.org/yesbutmaybeno/">yesbutmaybeno</a>.
|
|
|
|
|
1126 |
</p>
|
1127 |
|
1128 |
<h3 class="wp-people-group"><?php esc_html_e( 'With our thanks to these Open Source projects', 'buddypress' ); ?></h3>
|
1205 |
}
|
1206 |
|
1207 |
// Grab email situations for the current post.
|
1208 |
+
$terms = get_the_terms( $post_id, bp_get_email_tax_type() );
|
1209 |
+
$taxonomy_object = get_taxonomy( bp_get_email_tax_type() );
|
1210 |
|
1211 |
+
if ( is_wp_error( $terms ) || ! $terms ) {
|
1212 |
+
printf( '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>', $taxonomy_object->labels->no_terms );
|
1213 |
+
} else {
|
1214 |
+
$situations = wp_list_pluck( $terms, 'description' );
|
1215 |
+
|
1216 |
+
// Output each situation as a list item.
|
1217 |
+
echo '<ul><li>';
|
1218 |
+
echo implode( '</li><li>', $situations );
|
1219 |
+
echo '</li></ul>';
|
1220 |
+
}
|
1221 |
}
|
1222 |
|
1223 |
/** Helpers ***************************************************************/
|
1372 |
'footer' => true,
|
1373 |
),
|
1374 |
|
1375 |
+
// 10.0
|
1376 |
+
'bp-thickbox' => array(
|
1377 |
+
'file' => "{$url}bp-thickbox{$min}.js",
|
1378 |
+
'dependencies' => array( 'thickbox' ),
|
1379 |
+
'footer' => true,
|
1380 |
+
),
|
1381 |
+
|
1382 |
// 3.0
|
1383 |
'bp-hello-js' => array(
|
1384 |
'file' => "{$url}hello{$min}.js",
|
1385 |
+
'dependencies' => array( 'bp-thickbox', 'wp-api-request' ),
|
1386 |
'footer' => true,
|
1387 |
),
|
1388 |
+
|
1389 |
+
// 10.0
|
1390 |
+
'bp-dismissible-admin-notices' => array(
|
1391 |
+
'file' => "{$url}dismissible-admin-notices.js",
|
1392 |
+
'dependencies' => array(),
|
1393 |
+
'footer' => true,
|
1394 |
+
'extra' => array(
|
1395 |
+
'name' => 'bpDismissibleAdminNoticesSettings',
|
1396 |
+
'data' => array(
|
1397 |
+
'url' => bp_core_ajax_url(),
|
1398 |
+
'nonce' => wp_create_nonce( 'bp_dismiss_admin_notice' ),
|
1399 |
+
),
|
1400 |
+
),
|
1401 |
+
),
|
1402 |
) );
|
1403 |
|
1404 |
$version = bp_get_version();
|
1405 |
|
1406 |
foreach ( $scripts as $id => $script ) {
|
1407 |
wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
|
1408 |
+
|
1409 |
+
if ( isset( $script['extra'] ) ) {
|
1410 |
+
// List the block specific props.
|
1411 |
+
wp_add_inline_script(
|
1412 |
+
$id,
|
1413 |
+
sprintf( 'var %1$s = %2$s;', $script['extra']['name'], wp_json_encode( $script['extra']['data'] ) ),
|
1414 |
+
'before'
|
1415 |
+
);
|
1416 |
+
}
|
1417 |
+
}
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
/**
|
1421 |
+
* Adds inline styles to adapt the number of grid columns according to the number of BP Admin tabs.
|
1422 |
+
*
|
1423 |
+
* @since 10.0.0
|
1424 |
+
*/
|
1425 |
+
public function add_inline_styles() {
|
1426 |
+
$screen = get_current_screen();
|
1427 |
+
|
1428 |
+
if ( ! isset( $screen->id ) ) {
|
1429 |
+
return;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
// We might need to edit this id, see below code.
|
1433 |
+
$screen_id = $screen->id;
|
1434 |
+
|
1435 |
+
// Multisite configs adds a '-network' suffix to page hooknames inside the Network Admin screens.
|
1436 |
+
if ( is_multisite() && is_network_admin() && bp_is_network_activated() ) {
|
1437 |
+
$screen_id = str_replace( '-network', '', $screen_id );
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
$current_settings_tab_id = array_search( $screen_id, $this->submenu_pages['settings'], true );
|
1441 |
+
$current_tools_tab_id = array_search( $screen_id, $this->submenu_pages['tools'], true );
|
1442 |
+
$current_tab_id = '';
|
1443 |
+
$tabs = array();
|
1444 |
+
$context = '';
|
1445 |
+
|
1446 |
+
if ( $current_settings_tab_id ) {
|
1447 |
+
$current_tab_id = $current_settings_tab_id;
|
1448 |
+
$tabs = wp_list_pluck( bp_core_get_admin_settings_tabs(), 'name', 'id' );
|
1449 |
+
$context = 'settings';
|
1450 |
+
} elseif ( $current_tools_tab_id ) {
|
1451 |
+
$current_tab_id = $current_tools_tab_id;
|
1452 |
+
$tabs = wp_list_pluck( bp_core_get_admin_tools_tabs(), 'name', 'id' );
|
1453 |
+
$context = 'tools';
|
1454 |
+
}
|
1455 |
+
|
1456 |
+
if ( $current_tab_id && isset( $tabs[ $current_tab_id ] ) ) {
|
1457 |
+
$this->nav_tabs = bp_core_admin_tabs( $tabs[ $current_tab_id ], $context, false );
|
1458 |
+
$grid_columns = array_fill( 0, count( $this->nav_tabs ), '1fr');
|
1459 |
+
$help_tab_css = '';
|
1460 |
+
|
1461 |
+
if ( $screen->get_help_tabs() ) {
|
1462 |
+
$help_tab_css = '#screen-meta { margin-right: 0; } #screen-meta-links { position: absolute; right: 0; }';
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
wp_add_inline_style(
|
1466 |
+
'bp-admin-common-css',
|
1467 |
+
sprintf(
|
1468 |
+
'.buddypress-tabs-wrapper {
|
1469 |
+
-ms-grid-columns: %1$s;
|
1470 |
+
grid-template-columns: %1$s;
|
1471 |
+
}
|
1472 |
+
%2$s',
|
1473 |
+
implode( " ", $grid_columns ),
|
1474 |
+
$help_tab_css
|
1475 |
+
)
|
1476 |
+
);
|
1477 |
}
|
1478 |
}
|
1479 |
+
|
1480 |
+
/**
|
1481 |
+
* Add a "BuddyPress Add-ons" tab to the Add Plugins Admin screen.
|
1482 |
+
*
|
1483 |
+
* @since 10.0.0
|
1484 |
+
*
|
1485 |
+
* @param array $tabs The list of "Add Plugins" Tabs (Featured, Recommended, etc..).
|
1486 |
+
* @return array The same list including the "BuddyPress Add-ons" tab.
|
1487 |
+
*/
|
1488 |
+
public function addons_tab( $tabs = array() ) {
|
1489 |
+
$keys = array_keys( $tabs );
|
1490 |
+
$index = array_search( 'favorites', $keys, true );
|
1491 |
+
|
1492 |
+
// Makes sure the "BuddyPress Add-ons" tab is right after the "Favorites" one.
|
1493 |
+
$new_tabs = array_merge(
|
1494 |
+
array_slice( $tabs, 0, $index + 1, true ),
|
1495 |
+
array(
|
1496 |
+
'bp-add-ons' => __( 'BuddyPress Add-ons', 'buddypress' ),
|
1497 |
+
),
|
1498 |
+
$tabs
|
1499 |
+
);
|
1500 |
+
|
1501 |
+
return $new_tabs;
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
/**
|
1505 |
+
* Customize the Plugins API query arguments.
|
1506 |
+
*
|
1507 |
+
* The most important argument is the $user one which is set to "buddypress".
|
1508 |
+
* Using this key and value will fetch the plugins the w.org "buddypress" user favorited.
|
1509 |
+
*
|
1510 |
+
* @since 10.0.0
|
1511 |
+
*
|
1512 |
+
* @global int $paged The current page of the Plugin results.
|
1513 |
+
* @param false|array $args `false` by default.
|
1514 |
+
* @return array The "BuddyPress add-ons" args.
|
1515 |
+
*/
|
1516 |
+
public function addons_args( $args = false ) {
|
1517 |
+
global $paged;
|
1518 |
+
|
1519 |
+
return array(
|
1520 |
+
'page' => $paged,
|
1521 |
+
'per_page' => 10,
|
1522 |
+
'locale' => get_user_locale(),
|
1523 |
+
'user' => 'buddypress',
|
1524 |
+
);
|
1525 |
+
}
|
1526 |
+
|
1527 |
+
/**
|
1528 |
+
* Displays the list of "BuddyPress Add-ons".
|
1529 |
+
*
|
1530 |
+
* @since 10.0.0
|
1531 |
+
*/
|
1532 |
+
public function display_addons_table() {
|
1533 |
+
$notice_id = 'bp100-welcome-addons';
|
1534 |
+
$dismissed = bp_get_option( "bp-dismissed-notice-{$notice_id}", false );
|
1535 |
+
|
1536 |
+
if ( ! $dismissed ) {
|
1537 |
+
// Enqueue the Script to Ajax Dismiss an Admin notice.
|
1538 |
+
wp_enqueue_script( 'bp-dismissible-admin-notices' );
|
1539 |
+
|
1540 |
+
?>
|
1541 |
+
<div class="bp-welcome-panel bp-notice-container">
|
1542 |
+
<a class="bp-welcome-panel-close bp-is-dismissible" href="#" data-notice_id="<?php echo esc_attr( $notice_id ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel', 'buddypress' ); ?>"><?php esc_html_e( 'Dismiss', 'buddypress' ); ?></a>
|
1543 |
+
<div class="bp-welcome-panel-content">
|
1544 |
+
<h2><span class="bp-badge"></span> <?php esc_html_e( 'Hello BuddyPress Add-ons!', 'buddypress' ); ?></h2>
|
1545 |
+
<p class="about-description">
|
1546 |
+
<?php esc_html_e( 'Add-ons are features as Plugins or Blocks maintained by the BuddyPress development team & hosted on the WordPress.org plugins directory.', 'buddypress' ); ?>
|
1547 |
+
<?php esc_html_e( 'Thanks to this new tab inside your Dashboard screen to add plugins, you’ll be able to find them faster and eventually contribute to beta features early to give the BuddyPress development team your feedbacks.', 'buddypress' ); ?>
|
1548 |
+
</p>
|
1549 |
+
</div>
|
1550 |
+
</div>
|
1551 |
+
<?php
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
// Display the "buddypress" favorites.
|
1555 |
+
display_plugins_table();
|
1556 |
+
}
|
1557 |
}
|
1558 |
endif; // End class_exists check.
|
@@ -199,7 +199,7 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
199 |
* @see BP_Attachment::crop for the list of parameters
|
200 |
*
|
201 |
* @param array $args Array of arguments for the cropping.
|
202 |
-
* @return array The cropped avatars (full and
|
203 |
*/
|
204 |
public function crop( $args = array() ) {
|
205 |
// Bail if the original file is missing.
|
@@ -255,10 +255,36 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
255 |
|
256 |
/**
|
257 |
* Check that the new avatar doesn't have the same name as the
|
258 |
-
* old one before
|
259 |
*/
|
260 |
if ( ! empty( $existing_avatar ) && $existing_avatar !== $this->url . $relative_path ) {
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
// Make sure we at least have minimal data for cropping.
|
@@ -272,11 +298,16 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
272 |
|
273 |
// Get the file extension.
|
274 |
$data = @getimagesize( $absolute_path );
|
275 |
-
$ext = $data['mime']
|
276 |
|
277 |
$args['original_file'] = $absolute_path;
|
278 |
$args['src_abs'] = false;
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
280 |
|
281 |
foreach ( $avatar_types as $key_type => $type ) {
|
282 |
if ( 'thumb' === $key_type ) {
|
@@ -287,7 +318,7 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
287 |
$args['dst_h'] = bp_core_avatar_full_height();
|
288 |
}
|
289 |
|
290 |
-
$filename = wp_unique_filename( $avatar_folder_dir,
|
291 |
$args['dst_file'] = $avatar_folder_dir . '/' . $filename;
|
292 |
|
293 |
$avatar_types[ $key_type ] = parent::crop( $args );
|
@@ -296,8 +327,13 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
296 |
// Remove the original.
|
297 |
@unlink( $absolute_path );
|
298 |
|
299 |
-
// Return the full
|
300 |
-
return
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
|
303 |
/**
|
@@ -382,6 +418,8 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
382 |
2 => __( 'Your new profile photo was uploaded successfully.', 'buddypress' ),
|
383 |
3 => __( 'There was a problem deleting your profile photo. Please try again.', 'buddypress' ),
|
384 |
4 => __( 'Your profile photo was deleted successfully!', 'buddypress' ),
|
|
|
|
|
385 |
);
|
386 |
} elseif ( ! empty( $group_id ) ) {
|
387 |
$script_data['bp_params'] = array(
|
@@ -400,6 +438,8 @@ class BP_Attachment_Avatar extends BP_Attachment {
|
|
400 |
2 => __( 'The group profile photo was uploaded successfully.', 'buddypress' ),
|
401 |
3 => __( 'There was a problem deleting the group profile photo. Please try again.', 'buddypress' ),
|
402 |
4 => __( 'The group profile photo was deleted successfully!', 'buddypress' ),
|
|
|
|
|
403 |
);
|
404 |
} else {
|
405 |
|
199 |
* @see BP_Attachment::crop for the list of parameters
|
200 |
*
|
201 |
* @param array $args Array of arguments for the cropping.
|
202 |
+
* @return array The cropped avatars (full, thumb and the timestamp).
|
203 |
*/
|
204 |
public function crop( $args = array() ) {
|
205 |
// Bail if the original file is missing.
|
255 |
|
256 |
/**
|
257 |
* Check that the new avatar doesn't have the same name as the
|
258 |
+
* old one before moving the previous one into history.
|
259 |
*/
|
260 |
if ( ! empty( $existing_avatar ) && $existing_avatar !== $this->url . $relative_path ) {
|
261 |
+
// Add a new revision for the existing avatar.
|
262 |
+
$avatars = bp_attachments_list_directory_files( $avatar_folder_dir );
|
263 |
+
|
264 |
+
if ( $avatars ) {
|
265 |
+
foreach ( $avatars as $avatar_file ) {
|
266 |
+
if ( ! isset( $avatar_file->name, $avatar_file->id, $avatar_file->path ) ) {
|
267 |
+
continue;
|
268 |
+
}
|
269 |
+
|
270 |
+
$is_full = preg_match( "/-bpfull/", $avatar_file->name );
|
271 |
+
$is_thumb = preg_match( "/-bpthumb/", $avatar_file->name );
|
272 |
+
|
273 |
+
if ( $is_full || $is_thumb ) {
|
274 |
+
$revision = $this->add_revision(
|
275 |
+
'avatar',
|
276 |
+
array(
|
277 |
+
'file_abspath' => $avatar_file->path,
|
278 |
+
'file_id' => $avatar_file->id,
|
279 |
+
)
|
280 |
+
);
|
281 |
+
|
282 |
+
if ( is_wp_error( $revision ) ) {
|
283 |
+
error_log( $revision->get_error_message() );
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
}
|
288 |
}
|
289 |
|
290 |
// Make sure we at least have minimal data for cropping.
|
298 |
|
299 |
// Get the file extension.
|
300 |
$data = @getimagesize( $absolute_path );
|
301 |
+
$ext = $data['mime'] === 'image/png' ? 'png' : 'jpg';
|
302 |
|
303 |
$args['original_file'] = $absolute_path;
|
304 |
$args['src_abs'] = false;
|
305 |
+
|
306 |
+
$avatar_types = array(
|
307 |
+
'full' => '',
|
308 |
+
'thumb' => '',
|
309 |
+
);
|
310 |
+
$timestamp = bp_core_current_time( true, 'timestamp' );
|
311 |
|
312 |
foreach ( $avatar_types as $key_type => $type ) {
|
313 |
if ( 'thumb' === $key_type ) {
|
318 |
$args['dst_h'] = bp_core_avatar_full_height();
|
319 |
}
|
320 |
|
321 |
+
$filename = wp_unique_filename( $avatar_folder_dir, $timestamp . "-bp{$key_type}.{$ext}" );
|
322 |
$args['dst_file'] = $avatar_folder_dir . '/' . $filename;
|
323 |
|
324 |
$avatar_types[ $key_type ] = parent::crop( $args );
|
327 |
// Remove the original.
|
328 |
@unlink( $absolute_path );
|
329 |
|
330 |
+
// Return the full, thumb cropped avatars and the timestamp.
|
331 |
+
return array_merge(
|
332 |
+
$avatar_types,
|
333 |
+
array(
|
334 |
+
'timestamp' => $timestamp,
|
335 |
+
)
|
336 |
+
);
|
337 |
}
|
338 |
|
339 |
/**
|
418 |
2 => __( 'Your new profile photo was uploaded successfully.', 'buddypress' ),
|
419 |
3 => __( 'There was a problem deleting your profile photo. Please try again.', 'buddypress' ),
|
420 |
4 => __( 'Your profile photo was deleted successfully!', 'buddypress' ),
|
421 |
+
5 => __( 'Your profile photo was recycled successfully!', 'buddypress' ),
|
422 |
+
6 => __( 'The profile photo was permanently deleted successfully!', 'buddypress' ),
|
423 |
);
|
424 |
} elseif ( ! empty( $group_id ) ) {
|
425 |
$script_data['bp_params'] = array(
|
438 |
2 => __( 'The group profile photo was uploaded successfully.', 'buddypress' ),
|
439 |
3 => __( 'There was a problem deleting the group profile photo. Please try again.', 'buddypress' ),
|
440 |
4 => __( 'The group profile photo was deleted successfully!', 'buddypress' ),
|
441 |
+
5 => __( 'The group profile photo was recycled successfully!', 'buddypress' ),
|
442 |
+
6 => __( 'The group profile photo was permanently deleted successfully!', 'buddypress' ),
|
443 |
);
|
444 |
} else {
|
445 |
|
@@ -81,7 +81,11 @@ abstract class BP_Attachment {
|
|
81 |
*/
|
82 |
$this->default_args['original_max_filesize'] = (int) wp_max_upload_size();
|
83 |
|
84 |
-
$params = bp_parse_args(
|
|
|
|
|
|
|
|
|
85 |
|
86 |
foreach ( $params as $key => $param ) {
|
87 |
if ( 'upload_error_strings' === $key ) {
|
@@ -443,17 +447,21 @@ abstract class BP_Attachment {
|
|
443 |
public function crop( $args = array() ) {
|
444 |
$wp_error = new WP_Error();
|
445 |
|
446 |
-
$r = bp_parse_args(
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
457 |
|
458 |
if ( empty( $r['original_file'] ) || ! file_exists( $r['original_file'] ) ) {
|
459 |
$wp_error->add( 'crop_error', __( 'Cropping the file failed: missing source file.', 'buddypress' ) );
|
@@ -551,6 +559,75 @@ abstract class BP_Attachment {
|
|
551 |
return $script_data;
|
552 |
}
|
553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
/**
|
555 |
* Get full data for an image
|
556 |
*
|
@@ -622,15 +699,19 @@ abstract class BP_Attachment {
|
|
622 |
return new WP_Error( 'missing_parameter' );
|
623 |
}
|
624 |
|
625 |
-
$r = bp_parse_args(
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
|
|
|
|
|
|
|
|
634 |
|
635 |
// Make sure we have to edit the image.
|
636 |
if ( empty( $r['max_w'] ) && empty( $r['max_h'] ) && empty( $r['rotate'] ) && empty( $r['file'] ) ) {
|
81 |
*/
|
82 |
$this->default_args['original_max_filesize'] = (int) wp_max_upload_size();
|
83 |
|
84 |
+
$params = bp_parse_args(
|
85 |
+
$args,
|
86 |
+
$this->default_args,
|
87 |
+
$this->action . '_upload_params'
|
88 |
+
);
|
89 |
|
90 |
foreach ( $params as $key => $param ) {
|
91 |
if ( 'upload_error_strings' === $key ) {
|
447 |
public function crop( $args = array() ) {
|
448 |
$wp_error = new WP_Error();
|
449 |
|
450 |
+
$r = bp_parse_args(
|
451 |
+
$args,
|
452 |
+
array(
|
453 |
+
'original_file' => '',
|
454 |
+
'crop_x' => 0,
|
455 |
+
'crop_y' => 0,
|
456 |
+
'crop_w' => 0,
|
457 |
+
'crop_h' => 0,
|
458 |
+
'dst_w' => 0,
|
459 |
+
'dst_h' => 0,
|
460 |
+
'src_abs' => false,
|
461 |
+
'dst_file' => false,
|
462 |
+
),
|
463 |
+
'bp_attachment_crop_args'
|
464 |
+
);
|
465 |
|
466 |
if ( empty( $r['original_file'] ) || ! file_exists( $r['original_file'] ) ) {
|
467 |
$wp_error->add( 'crop_error', __( 'Cropping the file failed: missing source file.', 'buddypress' ) );
|
559 |
return $script_data;
|
560 |
}
|
561 |
|
562 |
+
/**
|
563 |
+
* Adds a new revision of a file.
|
564 |
+
*
|
565 |
+
* @since 10.0.0
|
566 |
+
*
|
567 |
+
* @param string $attachment_type The attachement type (eg: avatar).
|
568 |
+
* @param array $args {
|
569 |
+
* @type string $file_abspath The source file (absolute path) for the attachment.
|
570 |
+
* @type string $file_id Optional. The file ID to use as a suffix for the revision directory.
|
571 |
+
* }
|
572 |
+
* @return object|WP_Error An object informing about the URL an Path to a revision file, a WP_Error object on failure.
|
573 |
+
*/
|
574 |
+
public function add_revision( $attachment_type, $args = array() ) {
|
575 |
+
$r = bp_parse_args(
|
576 |
+
$args,
|
577 |
+
array(
|
578 |
+
'file_abspath' => '',
|
579 |
+
'file_id' => '',
|
580 |
+
),
|
581 |
+
'attachment_' . $attachment_type . '_add_revision'
|
582 |
+
);
|
583 |
+
|
584 |
+
if ( ! $r['file_abspath'] ) {
|
585 |
+
return new WP_Error( 'missing_parameter', __( 'The absolute path to your file is missing.', 'buddypress' ) );
|
586 |
+
|
587 |
+
// Make sure it's coming from an uploaded file.
|
588 |
+
} elseif ( false === strpos( $r['file_abspath'], $this->upload_path ) ) {
|
589 |
+
return new WP_Error( 'forbidden_path', __( 'The absolute path to your file is not allowed.', 'buddypress' ) );
|
590 |
+
|
591 |
+
} else {
|
592 |
+
$filepath = $r['file_abspath'];
|
593 |
+
}
|
594 |
+
|
595 |
+
$dirname = trailingslashit( dirname( $filepath ) );
|
596 |
+
$filename = sanitize_file_name( wp_basename( $filepath ) );
|
597 |
+
|
598 |
+
if ( ! $r['file_id'] ) {
|
599 |
+
$r['file_id'] = $filename;
|
600 |
+
}
|
601 |
+
|
602 |
+
$file_id = wp_hash( $r['file_id'] );
|
603 |
+
|
604 |
+
// Set the revision name & dir.
|
605 |
+
$revision_name = '';
|
606 |
+
$revision_dir = $dirname . '._revisions_' . $file_id;
|
607 |
+
|
608 |
+
// Avatars and Cover Images are specific attachments.
|
609 |
+
if ( 'avatar' === $attachment_type || 'cover_image' === $attachment_type ) {
|
610 |
+
$revision_dir = $dirname . 'history';
|
611 |
+
}
|
612 |
+
|
613 |
+
// Create the revision directory if it doesn't exist yet.
|
614 |
+
if ( ! is_dir( $revision_dir ) ) {
|
615 |
+
mkdir( $revision_dir );
|
616 |
+
}
|
617 |
+
|
618 |
+
$revision_name = wp_unique_filename( $revision_dir, $filename );
|
619 |
+
$revision_path = trailingslashit( $revision_dir ) . $revision_name;
|
620 |
+
|
621 |
+
if ( ! rename( $filepath, $revision_path ) ) {
|
622 |
+
return new WP_Error( 'adding_revision_failed', __( 'An unexpected error occured while adding the revision.', 'buddypress' ) );
|
623 |
+
}
|
624 |
+
|
625 |
+
return (object) array(
|
626 |
+
'url' => str_replace( trailingslashit( $this->upload_path ), trailingslashit( $this->url ), $revision_path ),
|
627 |
+
'path' => $revision_path,
|
628 |
+
);
|
629 |
+
}
|
630 |
+
|
631 |
/**
|
632 |
* Get full data for an image
|
633 |
*
|
699 |
return new WP_Error( 'missing_parameter' );
|
700 |
}
|
701 |
|
702 |
+
$r = bp_parse_args(
|
703 |
+
$args,
|
704 |
+
array(
|
705 |
+
'file' => '',
|
706 |
+
'max_w' => 0,
|
707 |
+
'max_h' => 0,
|
708 |
+
'crop' => false,
|
709 |
+
'rotate' => 0,
|
710 |
+
'quality' => 90,
|
711 |
+
'save' => true,
|
712 |
+
),
|
713 |
+
'attachment_' . $attachment_type . '_edit_image'
|
714 |
+
);
|
715 |
|
716 |
// Make sure we have to edit the image.
|
717 |
if ( empty( $r['max_w'] ) && empty( $r['max_h'] ) && empty( $r['rotate'] ) && empty( $r['file'] ) ) {
|
@@ -236,7 +236,10 @@ class BP_Button {
|
|
236 |
*/
|
237 |
public function __construct( $args = '' ) {
|
238 |
|
239 |
-
$r =
|
|
|
|
|
|
|
240 |
|
241 |
// Backward compatibility with deprecated parameters.
|
242 |
$r = $this->backward_compatibility_args( $r );
|
236 |
*/
|
237 |
public function __construct( $args = '' ) {
|
238 |
|
239 |
+
$r = bp_parse_args(
|
240 |
+
$args,
|
241 |
+
get_class_vars( __CLASS__ )
|
242 |
+
);
|
243 |
|
244 |
// Backward compatibility with deprecated parameters.
|
245 |
$r = $this->backward_compatibility_args( $r );
|
@@ -234,17 +234,20 @@ class BP_Component {
|
|
234 |
* }
|
235 |
*/
|
236 |
public function setup_globals( $args = array() ) {
|
237 |
-
$r =
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
|
|
248 |
|
249 |
/** Slugs ************************************************************
|
250 |
*/
|
@@ -506,6 +509,9 @@ class BP_Component {
|
|
506 |
add_action( 'bp_blocks_init', array( $this, 'blocks_init' ), 10 );
|
507 |
}
|
508 |
|
|
|
|
|
|
|
509 |
/**
|
510 |
* Fires at the end of the setup_actions method inside BP_Component.
|
511 |
*
|
@@ -984,5 +990,32 @@ class BP_Component {
|
|
984 |
*/
|
985 |
do_action( 'bp_' . $this->id . '_blocks_init' );
|
986 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
}
|
988 |
endif; // BP_Component.
|
234 |
* }
|
235 |
*/
|
236 |
public function setup_globals( $args = array() ) {
|
237 |
+
$r = bp_parse_args(
|
238 |
+
$args,
|
239 |
+
array(
|
240 |
+
'slug' => $this->id,
|
241 |
+
'root_slug' => '',
|
242 |
+
'has_directory' => false,
|
243 |
+
'directory_title' => '',
|
244 |
+
'notification_callback' => '',
|
245 |
+
'search_string' => '',
|
246 |
+
'global_tables' => '',
|
247 |
+
'meta_tables' => '',
|
248 |
+
'block_globals' => array(),
|
249 |
+
)
|
250 |
+
);
|
251 |
|
252 |
/** Slugs ************************************************************
|
253 |
*/
|
509 |
add_action( 'bp_blocks_init', array( $this, 'blocks_init' ), 10 );
|
510 |
}
|
511 |
|
512 |
+
// Set directory page states.
|
513 |
+
add_filter( 'bp_admin_display_directory_states', array( $this, 'admin_directory_states' ), 10, 2 );
|
514 |
+
|
515 |
/**
|
516 |
* Fires at the end of the setup_actions method inside BP_Component.
|
517 |
*
|
990 |
*/
|
991 |
do_action( 'bp_' . $this->id . '_blocks_init' );
|
992 |
}
|
993 |
+
|
994 |
+
/**
|
995 |
+
* Add component's directory states.
|
996 |
+
*
|
997 |
+
* @since 10.0.0
|
998 |
+
*
|
999 |
+
* @param string[] $states An array of post display states.
|
1000 |
+
* @param WP_Post $post The current post object.
|
1001 |
+
* @return array The component's directory states.
|
1002 |
+
*/
|
1003 |
+
public function admin_directory_states( $states = array(), $post = null ) {
|
1004 |
+
if ( $this->has_directory ) {
|
1005 |
+
/**
|
1006 |
+
* Filter here to edit the component's directory states.
|
1007 |
+
*
|
1008 |
+
* This is a dynamic hook that is based on the component string ID.
|
1009 |
+
*
|
1010 |
+
* @since 10.0.0
|
1011 |
+
*
|
1012 |
+
* @param string[] $states An array of post display states.
|
1013 |
+
* @param WP_Post $post The current post object.
|
1014 |
+
*/
|
1015 |
+
return apply_filters( 'bp_' . $this->id . '_admin_directory_states', $states, $post );
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
return $states;
|
1019 |
+
}
|
1020 |
}
|
1021 |
endif; // BP_Component.
|
@@ -174,9 +174,13 @@ class BP_Core_Login_Widget extends WP_Widget {
|
|
174 |
*/
|
175 |
public function form( $instance = array() ) {
|
176 |
|
177 |
-
$settings =
|
178 |
-
|
179 |
-
|
|
|
|
|
|
|
|
|
180 |
|
181 |
<p>
|
182 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'buddypress' ); ?>
|
174 |
*/
|
175 |
public function form( $instance = array() ) {
|
176 |
|
177 |
+
$settings = bp_parse_args(
|
178 |
+
$instance,
|
179 |
+
array(
|
180 |
+
'title' => '',
|
181 |
+
)
|
182 |
+
);
|
183 |
+
?>
|
184 |
|
185 |
<p>
|
186 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'buddypress' ); ?>
|
@@ -175,8 +175,13 @@ class BP_Core_Nav {
|
|
175 |
return false;
|
176 |
}
|
177 |
|
178 |
-
$nav_item
|
179 |
-
$this->nav[ $this->object_id ][ $slug ] = new BP_Core_Nav_Item(
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
// Return the edited object.
|
182 |
return $this->nav[ $this->object_id ][ $slug ];
|
@@ -190,8 +195,10 @@ class BP_Core_Nav {
|
|
190 |
}
|
191 |
|
192 |
$sub_item = reset( $sub_items );
|
193 |
-
|
194 |
-
|
|
|
|
|
195 |
|
196 |
// When we have parents, it's for life, we can't change them!
|
197 |
if ( empty( $params['parent_slug'] ) || $parent_slug !== $params['parent_slug'] ) {
|
@@ -325,7 +332,12 @@ class BP_Core_Nav {
|
|
325 |
* @return array The list of primary objects nav
|
326 |
*/
|
327 |
public function get_primary( $args = array(), $sort = true ) {
|
328 |
-
$params =
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
// This parameter is not overridable.
|
331 |
if ( empty( $params['primary'] ) ) {
|
@@ -355,7 +367,12 @@ class BP_Core_Nav {
|
|
355 |
* @return bool|array The list of secondary objects nav, or false if none set.
|
356 |
*/
|
357 |
public function get_secondary( $args = array(), $sort = true ) {
|
358 |
-
$params =
|
|
|
|
|
|
|
|
|
|
|
359 |
|
360 |
// No need to search children if the parent is not set.
|
361 |
if ( empty( $params['parent_slug'] ) && empty( $params['secondary'] ) ) {
|
175 |
return false;
|
176 |
}
|
177 |
|
178 |
+
$nav_item = reset( $nav_items );
|
179 |
+
$this->nav[ $this->object_id ][ $slug ] = new BP_Core_Nav_Item(
|
180 |
+
bp_parse_args(
|
181 |
+
$args,
|
182 |
+
(array) $nav_item
|
183 |
+
)
|
184 |
+
);
|
185 |
|
186 |
// Return the edited object.
|
187 |
return $this->nav[ $this->object_id ][ $slug ];
|
195 |
}
|
196 |
|
197 |
$sub_item = reset( $sub_items );
|
198 |
+
$params = bp_parse_args(
|
199 |
+
$args,
|
200 |
+
(array) $sub_item
|
201 |
+
);
|
202 |
|
203 |
// When we have parents, it's for life, we can't change them!
|
204 |
if ( empty( $params['parent_slug'] ) || $parent_slug !== $params['parent_slug'] ) {
|
332 |
* @return array The list of primary objects nav
|
333 |
*/
|
334 |
public function get_primary( $args = array(), $sort = true ) {
|
335 |
+
$params = bp_parse_args(
|
336 |
+
$args,
|
337 |
+
array(
|
338 |
+
'primary' => true,
|
339 |
+
)
|
340 |
+
);
|
341 |
|
342 |
// This parameter is not overridable.
|
343 |
if ( empty( $params['primary'] ) ) {
|
367 |
* @return bool|array The list of secondary objects nav, or false if none set.
|
368 |
*/
|
369 |
public function get_secondary( $args = array(), $sort = true ) {
|
370 |
+
$params = bp_parse_args(
|
371 |
+
$args,
|
372 |
+
array(
|
373 |
+
'parent_slug' => '',
|
374 |
+
)
|
375 |
+
);
|
376 |
|
377 |
// No need to search children if the parent is not set.
|
378 |
if ( empty( $params['parent_slug'] ) && empty( $params['secondary'] ) ) {
|
@@ -367,15 +367,18 @@ abstract class BP_Core_oEmbed_Extension {
|
|
367 |
* @return array
|
368 |
*/
|
369 |
protected function get_oembed_response_data( $item, $width ) {
|
370 |
-
$data =
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
379 |
|
380 |
/** This filter is documented in /wp-includes/embed.php */
|
381 |
$min_max_width = apply_filters( 'oembed_min_max_width', array(
|
367 |
* @return array
|
368 |
*/
|
369 |
protected function get_oembed_response_data( $item, $width ) {
|
370 |
+
$data = bp_parse_args(
|
371 |
+
$item,
|
372 |
+
array(
|
373 |
+
'version' => '1.0',
|
374 |
+
'provider_name' => get_bloginfo( 'name' ),
|
375 |
+
'provider_url' => get_home_url(),
|
376 |
+
'author_name' => get_bloginfo( 'name' ),
|
377 |
+
'author_url' => get_home_url(),
|
378 |
+
'title' => ucfirst( $this->slug_endpoint ),
|
379 |
+
'type' => 'rich',
|
380 |
+
)
|
381 |
+
);
|
382 |
|
383 |
/** This filter is documented in /wp-includes/embed.php */
|
384 |
$min_max_width = apply_filters( 'oembed_min_max_width', array(
|
@@ -392,15 +392,19 @@ class BP_Core extends BP_Component {
|
|
392 |
'wp-components',
|
393 |
'wp-i18n',
|
394 |
'wp-block-editor',
|
395 |
-
'
|
396 |
),
|
397 |
'style' => 'bp-login-form-block',
|
398 |
'style_url' => plugins_url( 'css/blocks/login-form.css', dirname( __FILE__ ) ),
|
399 |
'attributes' => array(
|
400 |
-
'title'
|
401 |
'type' => 'string',
|
402 |
'default' => '',
|
403 |
),
|
|
|
|
|
|
|
|
|
404 |
),
|
405 |
'render_callback' => 'bp_block_render_login_form_block',
|
406 |
),
|
392 |
'wp-components',
|
393 |
'wp-i18n',
|
394 |
'wp-block-editor',
|
395 |
+
'wp-server-side-render',
|
396 |
),
|
397 |
'style' => 'bp-login-form-block',
|
398 |
'style_url' => plugins_url( 'css/blocks/login-form.css', dirname( __FILE__ ) ),
|
399 |
'attributes' => array(
|
400 |
+
'title' => array(
|
401 |
'type' => 'string',
|
402 |
'default' => '',
|
403 |
),
|
404 |
+
'forgotPwdLink' => array(
|
405 |
+
'type' => 'boolean',
|
406 |
+
'default' => false,
|
407 |
+
),
|
408 |
),
|
409 |
'render_callback' => 'bp_block_render_login_form_block',
|
410 |
),
|
@@ -32,20 +32,37 @@ class BP_Date_Query extends WP_Date_Query {
|
|
32 |
*/
|
33 |
public $column;
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* Constructor.
|
37 |
*
|
38 |
-
* @
|
39 |
-
* @
|
|
|
|
|
|
|
|
|
40 |
*
|
41 |
* @see WP_Date_Query::__construct()
|
42 |
*/
|
43 |
-
public function __construct( $date_query, $column = '' ) {
|
44 |
if ( ! empty( $column ) ) {
|
45 |
$this->column = $column;
|
46 |
add_filter( 'date_query_valid_columns', array( $this, 'register_date_column' ) );
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
49 |
parent::__construct( $date_query, $column );
|
50 |
}
|
51 |
|
@@ -66,5 +83,55 @@ class BP_Date_Query extends WP_Date_Query {
|
|
66 |
$retval[] = $this->column;
|
67 |
return $retval;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
endif;
|
32 |
*/
|
33 |
public $column;
|
34 |
|
35 |
+
/**
|
36 |
+
* Whether to prepend the 'AND' operator to the WHERE SQL clause.
|
37 |
+
*
|
38 |
+
* @since 10.0.0
|
39 |
+
*
|
40 |
+
* @var bool
|
41 |
+
*/
|
42 |
+
public $prepend_and = false;
|
43 |
+
|
44 |
/**
|
45 |
* Constructor.
|
46 |
*
|
47 |
+
* @since 2.1.0
|
48 |
+
* @since 10.0.0 Added $prepend_and argument.
|
49 |
+
*
|
50 |
+
* @param array $date_query Date query arguments.
|
51 |
+
* @param string $column The DB column to query against.
|
52 |
+
* @param bool $prepend_and Whether to prepend the 'AND' operator to the WHERE SQL clause.
|
53 |
*
|
54 |
* @see WP_Date_Query::__construct()
|
55 |
*/
|
56 |
+
public function __construct( $date_query, $column = '', $prepend_and = false ) {
|
57 |
if ( ! empty( $column ) ) {
|
58 |
$this->column = $column;
|
59 |
add_filter( 'date_query_valid_columns', array( $this, 'register_date_column' ) );
|
60 |
}
|
61 |
|
62 |
+
if ( ! empty( $prepend_and ) ) {
|
63 |
+
$this->prepend_and = true;
|
64 |
+
}
|
65 |
+
|
66 |
parent::__construct( $date_query, $column );
|
67 |
}
|
68 |
|
83 |
$retval[] = $this->column;
|
84 |
return $retval;
|
85 |
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Generate SQL clauses to be appended to a main query.
|
89 |
+
*
|
90 |
+
* Since BuddyPress builds its SQL queries differently than WP_Query, we have
|
91 |
+
* to override the parent method to remove the leading 'AND' operator from the
|
92 |
+
* WHERE clause.
|
93 |
+
*
|
94 |
+
* @since 10.0.0
|
95 |
+
*
|
96 |
+
* @return array {
|
97 |
+
* Array containing JOIN and WHERE SQL clauses to append to the main query.
|
98 |
+
*
|
99 |
+
* @type string $join SQL fragment to append to the main JOIN clause.
|
100 |
+
* @type string $where SQL fragment to append to the main WHERE clause.
|
101 |
+
* }
|
102 |
+
*/
|
103 |
+
protected function get_sql_clauses() {
|
104 |
+
// If we want to have the leading 'AND' operator, just use parent method.
|
105 |
+
if ( $this->prepend_and ) {
|
106 |
+
return parent::get_sql_clauses();
|
107 |
+
}
|
108 |
+
|
109 |
+
// If we're here, that means we do not want the leading 'AND' operator.
|
110 |
+
return $this->get_sql_for_query( $this->queries );
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Helper method to generate and fetch the WHERE SQL clause for a date query.
|
115 |
+
*
|
116 |
+
* See {@link BP_Date_Query::__construct()} for all argument documentation.
|
117 |
+
*
|
118 |
+
* @since 10.0.0
|
119 |
+
*
|
120 |
+
* @param array $date_query Date query arguments.
|
121 |
+
* @param string $column DB column to query against date.
|
122 |
+
* @param bool $prepend_and Whether to prepend the 'AND' operator to the WHERE clause.
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
+
public static function get_where_sql( $date_query = array(), $column = '', $prepend_and = false ) {
|
126 |
+
$sql = '';
|
127 |
+
|
128 |
+
// Generate and fetch the WHERE clause for a date query.
|
129 |
+
if ( ! empty( $date_query ) && is_array( $date_query ) && ! empty( $column ) ) {
|
130 |
+
$date_query = new self( $date_query, $column, $prepend_and );
|
131 |
+
$sql = $date_query->get_sql();
|
132 |
+
}
|
133 |
+
|
134 |
+
return $sql;
|
135 |
+
}
|
136 |
}
|
137 |
endif;
|
@@ -80,7 +80,10 @@ class BP_Embed extends WP_Embed {
|
|
80 |
return '';
|
81 |
|
82 |
$rawattr = $attr;
|
83 |
-
$attr
|
|
|
|
|
|
|
84 |
|
85 |
// Use kses to convert & into & and we need to undo this
|
86 |
// See https://core.trac.wordpress.org/ticket/11311.
|
80 |
return '';
|
81 |
|
82 |
$rawattr = $attr;
|
83 |
+
$attr = bp_parse_args(
|
84 |
+
$attr,
|
85 |
+
wp_embed_defaults()
|
86 |
+
);
|
87 |
|
88 |
// Use kses to convert & into & and we need to undo this
|
89 |
// See https://core.trac.wordpress.org/ticket/11311.
|
@@ -81,18 +81,22 @@ abstract class BP_Invitation_Manager {
|
|
81 |
*/
|
82 |
public function add_invitation( $args = array() ) {
|
83 |
|
84 |
-
$r = bp_parse_args(
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
|
97 |
// Invitations must have an invitee and inviter.
|
98 |
if ( ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['inviter_id'] ) ) {
|
@@ -223,7 +227,7 @@ abstract class BP_Invitation_Manager {
|
|
223 |
* @type int $item_id ID associated with the invitation and class.
|
224 |
* @type int $secondary_item_id secondary ID associated with the
|
225 |
* invitation and class.
|
226 |
-
* @type string $type
|
227 |
* @type string $content Extra information provided by the requester
|
228 |
* or inviter.
|
229 |
* @type string $date_modified Date the invitation was last modified.
|
@@ -235,18 +239,22 @@ abstract class BP_Invitation_Manager {
|
|
235 |
*/
|
236 |
public function add_request( $args = array() ) {
|
237 |
|
238 |
-
$r = bp_parse_args(
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
250 |
|
251 |
// If there is no invitee, bail.
|
252 |
if ( ! ( $r['user_id'] || $r['invitee_email'] ) ) {
|
@@ -501,17 +509,22 @@ abstract class BP_Invitation_Manager {
|
|
501 |
*
|
502 |
* @return int|bool Number of rows updated on success, false on failure.
|
503 |
*/
|
504 |
-
|
505 |
-
|
506 |
-
$r = bp_parse_args(
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
|
|
|
|
|
|
|
|
|
|
515 |
$r['class'] = $this->class_name;
|
516 |
|
517 |
if ( ! $r['id'] && ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['class'] && $r['item_id'] ) ) {
|
@@ -554,14 +567,19 @@ abstract class BP_Invitation_Manager {
|
|
554 |
*
|
555 |
* @return bool Number of rows updated on success, false on failure.
|
556 |
*/
|
557 |
-
|
558 |
-
|
559 |
-
$r = bp_parse_args(
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
|
|
|
|
|
|
|
|
|
|
565 |
$r['class'] = $this->class_name;
|
566 |
|
567 |
if ( ! ( $r['user_id'] && $r['class'] && $r['item_id'] ) ) {
|
81 |
*/
|
82 |
public function add_invitation( $args = array() ) {
|
83 |
|
84 |
+
$r = bp_parse_args(
|
85 |
+
$args,
|
86 |
+
array(
|
87 |
+
'user_id' => 0,
|
88 |
+
'invitee_email' => '',
|
89 |
+
'inviter_id' => 0,
|
90 |
+
'item_id' => 0,
|
91 |
+
'secondary_item_id' => 0,
|
92 |
+
'type' => 'invite',
|
93 |
+
'content' => '',
|
94 |
+
'date_modified' => bp_core_current_time(),
|
95 |
+
'send_invite' => 0,
|
96 |
+
'accepted' => 0,
|
97 |
+
),
|
98 |
+
'add_invitation'
|
99 |
+
);
|
100 |
|
101 |
// Invitations must have an invitee and inviter.
|
102 |
if ( ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['inviter_id'] ) ) {
|
227 |
* @type int $item_id ID associated with the invitation and class.
|
228 |
* @type int $secondary_item_id secondary ID associated with the
|
229 |
* invitation and class.
|
230 |
+
* @type string $type Type of record this is: 'invite' or 'request'.
|
231 |
* @type string $content Extra information provided by the requester
|
232 |
* or inviter.
|
233 |
* @type string $date_modified Date the invitation was last modified.
|
239 |
*/
|
240 |
public function add_request( $args = array() ) {
|
241 |
|
242 |
+
$r = bp_parse_args(
|
243 |
+
$args,
|
244 |
+
array(
|
245 |
+
'user_id' => 0,
|
246 |
+
'inviter_id' => 0,
|
247 |
+
'invitee_email' => '',
|
248 |
+
'item_id' => 0,
|
249 |
+
'secondary_item_id' => 0,
|
250 |
+
'type' => 'request',
|
251 |
+
'content' => '',
|
252 |
+
'date_modified' => bp_core_current_time(),
|
253 |
+
'invite_sent' => 0,
|
254 |
+
'accepted' => 0,
|
255 |
+
),
|
256 |
+
'add_request'
|
257 |
+
);
|
258 |
|
259 |
// If there is no invitee, bail.
|
260 |
if ( ! ( $r['user_id'] || $r['invitee_email'] ) ) {
|
509 |
*
|
510 |
* @return int|bool Number of rows updated on success, false on failure.
|
511 |
*/
|
512 |
+
public function accept_invitation( $args = array() ) {
|
513 |
+
|
514 |
+
$r = bp_parse_args(
|
515 |
+
$args,
|
516 |
+
array(
|
517 |
+
'id' => false,
|
518 |
+
'user_id' => 0,
|
519 |
+
'invitee_email' => '',
|
520 |
+
'item_id' => null,
|
521 |
+
'secondary_item_id' => null,
|
522 |
+
'invite_sent' => 'sent',
|
523 |
+
'date_modified' => bp_core_current_time(),
|
524 |
+
),
|
525 |
+
'accept_invitation'
|
526 |
+
);
|
527 |
+
|
528 |
$r['class'] = $this->class_name;
|
529 |
|
530 |
if ( ! $r['id'] && ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['class'] && $r['item_id'] ) ) {
|
567 |
*
|
568 |
* @return bool Number of rows updated on success, false on failure.
|
569 |
*/
|
570 |
+
public function accept_request( $args = array() ) {
|
571 |
+
|
572 |
+
$r = bp_parse_args(
|
573 |
+
$args,
|
574 |
+
array(
|
575 |
+
'user_id' => 0,
|
576 |
+
'item_id' => null,
|
577 |
+
'secondary_item_id' => null,
|
578 |
+
'date_modified' => bp_core_current_time(),
|
579 |
+
),
|
580 |
+
'accept_request'
|
581 |
+
);
|
582 |
+
|
583 |
$r['class'] = $this->class_name;
|
584 |
|
585 |
if ( ! ( $r['user_id'] && $r['class'] && $r['item_id'] ) ) {
|
@@ -742,24 +742,28 @@ class BP_Invitation {
|
|
742 |
$invites_table_name = BP_Invitation_Manager::get_table_name();
|
743 |
|
744 |
// Parse the arguments.
|
745 |
-
$r
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
|
|
|
|
|
|
|
|
763 |
|
764 |
$sql = array(
|
765 |
'select' => "SELECT",
|
@@ -866,24 +870,28 @@ class BP_Invitation {
|
|
866 |
global $wpdb;
|
867 |
$invites_table_name = BP_Invitation_Manager::get_table_name();
|
868 |
|
869 |
-
$r
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
|
|
|
|
|
|
|
|
887 |
|
888 |
// Build the query
|
889 |
$select_sql = "SELECT COUNT(*)";
|
742 |
$invites_table_name = BP_Invitation_Manager::get_table_name();
|
743 |
|
744 |
// Parse the arguments.
|
745 |
+
$r = bp_parse_args(
|
746 |
+
$args,
|
747 |
+
array(
|
748 |
+
'id' => false,
|
749 |
+
'user_id' => false,
|
750 |
+
'inviter_id' => false,
|
751 |
+
'invitee_email' => false,
|
752 |
+
'class' => false,
|
753 |
+
'item_id' => false,
|
754 |
+
'secondary_item_id' => false,
|
755 |
+
'type' => 'all',
|
756 |
+
'invite_sent' => 'all',
|
757 |
+
'accepted' => 'pending',
|
758 |
+
'search_terms' => '',
|
759 |
+
'order_by' => false,
|
760 |
+
'sort_order' => false,
|
761 |
+
'page' => false,
|
762 |
+
'per_page' => false,
|
763 |
+
'fields' => 'all',
|
764 |
+
),
|
765 |
+
'bp_invitations_invitation_get'
|
766 |
+
);
|
767 |
|
768 |
$sql = array(
|
769 |
'select' => "SELECT",
|
870 |
global $wpdb;
|
871 |
$invites_table_name = BP_Invitation_Manager::get_table_name();
|
872 |
|
873 |
+
$r = bp_parse_args(
|
874 |
+
$args,
|
875 |
+
array(
|
876 |
+
'id' => false,
|
877 |
+
'user_id' => false,
|
878 |
+
'inviter_id' => false,
|
879 |
+
'invitee_email' => false,
|
880 |
+
'class' => false,
|
881 |
+
'item_id' => false,
|
882 |
+
'secondary_item_id' => false,
|
883 |
+
'type' => 'all',
|
884 |
+
'invite_sent' => 'all',
|
885 |
+
'accepted' => 'pending',
|
886 |
+
'search_terms' => '',
|
887 |
+
'order_by' => false,
|
888 |
+
'sort_order' => false,
|
889 |
+
'page' => false,
|
890 |
+
'per_page' => false,
|
891 |
+
'fields' => 'all',
|
892 |
+
),
|
893 |
+
'bp_invitations_invitation_get_total_count'
|
894 |
+
);
|
895 |
|
896 |
// Build the query
|
897 |
$select_sql = "SELECT COUNT(*)";
|
@@ -80,7 +80,10 @@ abstract class BP_Suggestions {
|
|
80 |
* }
|
81 |
*/
|
82 |
public function set_query( array $args = array() ) {
|
83 |
-
$this->args =
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
/**
|
80 |
* }
|
81 |
*/
|
82 |
public function set_query( array $args = array() ) {
|
83 |
+
$this->args = bp_parse_args(
|
84 |
+
$args,
|
85 |
+
$this->default_args
|
86 |
+
);
|
87 |
}
|
88 |
|
89 |
/**
|
@@ -17,6 +17,7 @@ defined( 'ABSPATH' ) || exit;
|
|
17 |
* Member directories, the Friends component, etc.
|
18 |
*
|
19 |
* @since 1.7.0
|
|
|
20 |
*
|
21 |
* @param array $query {
|
22 |
* Query arguments. All items are optional.
|
@@ -49,6 +50,9 @@ defined( 'ABSPATH' ) || exit;
|
|
49 |
* associated with $meta_key matches $meta_value. Default: false.
|
50 |
* @type array $xprofile_query Filter results by xprofile data. Requires the xprofile component.
|
51 |
* See {@see BP_XProfile_Query} for details.
|
|
|
|
|
|
|
52 |
* @type bool $populate_extras True if you want to fetch extra metadata
|
53 |
* about returned users, such as total group and friend counts.
|
54 |
* @type string $count_total Determines how BP_User_Query will do a count of total users matching
|
@@ -154,25 +158,29 @@ class BP_User_Query {
|
|
154 |
$this->setup_hooks();
|
155 |
|
156 |
if ( ! empty( $this->query_vars_raw ) ) {
|
157 |
-
$this->query_vars =
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
176 |
|
177 |
/**
|
178 |
* Fires before the construction of the BP_User_Query query.
|
@@ -279,6 +287,12 @@ class BP_User_Query {
|
|
279 |
$sql['orderby'] = "ORDER BY u.date_recorded";
|
280 |
$sql['order'] = "DESC";
|
281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
break;
|
283 |
|
284 |
// 'active', 'newest', and 'random' queries
|
@@ -301,6 +315,12 @@ class BP_User_Query {
|
|
301 |
$sql['order'] = "DESC";
|
302 |
}
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
break;
|
305 |
|
306 |
// 'popular' sorts by the 'total_friend_count' usermeta.
|
17 |
* Member directories, the Friends component, etc.
|
18 |
*
|
19 |
* @since 1.7.0
|
20 |
+
* @since 10.0.0 Added $date_query parameter.
|
21 |
*
|
22 |
* @param array $query {
|
23 |
* Query arguments. All items are optional.
|
50 |
* associated with $meta_key matches $meta_value. Default: false.
|
51 |
* @type array $xprofile_query Filter results by xprofile data. Requires the xprofile component.
|
52 |
* See {@see BP_XProfile_Query} for details.
|
53 |
+
* @type array $date_query Filter results by member last activity date. See first parameter of
|
54 |
+
* {@link WP_Date_Query::__construct()} for syntax. Only applicable if
|
55 |
+
* $type is either 'active', 'random', 'newest', or 'online'.
|
56 |
* @type bool $populate_extras True if you want to fetch extra metadata
|
57 |
* about returned users, such as total group and friend counts.
|
58 |
* @type string $count_total Determines how BP_User_Query will do a count of total users matching
|
158 |
$this->setup_hooks();
|
159 |
|
160 |
if ( ! empty( $this->query_vars_raw ) ) {
|
161 |
+
$this->query_vars = bp_parse_args(
|
162 |
+
$this->query_vars_raw,
|
163 |
+
array(
|
164 |
+
'type' => 'newest',
|
165 |
+
'per_page' => 0,
|
166 |
+
'page' => 1,
|
167 |
+
'user_id' => 0,
|
168 |
+
'search_terms' => false,
|
169 |
+
'search_wildcard' => 'both',
|
170 |
+
'include' => false,
|
171 |
+
'exclude' => false,
|
172 |
+
'user_ids' => false,
|
173 |
+
'member_type' => '',
|
174 |
+
'member_type__in' => '',
|
175 |
+
'member_type__not_in' => '',
|
176 |
+
'meta_key' => false,
|
177 |
+
'meta_value' => false,
|
178 |
+
'xprofile_query' => false,
|
179 |
+
'date_query' => false,
|
180 |
+
'populate_extras' => true,
|
181 |
+
'count_total' => 'count_query',
|
182 |
+
)
|
183 |
+
);
|
184 |
|
185 |
/**
|
186 |
* Fires before the construction of the BP_User_Query query.
|
287 |
$sql['orderby'] = "ORDER BY u.date_recorded";
|
288 |
$sql['order'] = "DESC";
|
289 |
|
290 |
+
// Date query.
|
291 |
+
$date_query = BP_Date_Query::get_where_sql( $date_query, 'u.date_recorded' );
|
292 |
+
if ( ! empty( $date_query ) ) {
|
293 |
+
$sql['where']['date_query'] = $date_query;
|
294 |
+
}
|
295 |
+
|
296 |
break;
|
297 |
|
298 |
// 'active', 'newest', and 'random' queries
|
315 |
$sql['order'] = "DESC";
|
316 |
}
|
317 |
|
318 |
+
// Date query.
|
319 |
+
$date_query = BP_Date_Query::get_where_sql( $date_query, 'u.date_recorded' );
|
320 |
+
if ( ! empty( $date_query ) ) {
|
321 |
+
$sql['where']['date_query'] = $date_query;
|
322 |
+
}
|
323 |
+
|
324 |
break;
|
325 |
|
326 |
// 'popular' sorts by the 'total_friend_count' usermeta.
|
@@ -397,6 +397,53 @@ body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning {
|
|
397 |
line-height: inherit;
|
398 |
}
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
@media screen and (min-width: 810px) {
|
401 |
|
402 |
.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop {
|
397 |
line-height: inherit;
|
398 |
}
|
399 |
|
400 |
+
.avatars-history {
|
401 |
+
display: flex;
|
402 |
+
flex-direction: row;
|
403 |
+
}
|
404 |
+
|
405 |
+
.avatar-history-list {
|
406 |
+
order: 1;
|
407 |
+
width: 80%;
|
408 |
+
max-height: 250px;
|
409 |
+
overflow-y: auto;
|
410 |
+
}
|
411 |
+
|
412 |
+
.avatar-history-list label {
|
413 |
+
display: block;
|
414 |
+
margin: 0 auto;
|
415 |
+
width: 60px;
|
416 |
+
}
|
417 |
+
|
418 |
+
.avatar-history-table td .avatar {
|
419 |
+
vertical-align: middle;
|
420 |
+
}
|
421 |
+
|
422 |
+
.avatar-history-table td .avatar.selected {
|
423 |
+
border: solid 4px #065288;
|
424 |
+
}
|
425 |
+
|
426 |
+
.avatar-history-actions {
|
427 |
+
order: 2;
|
428 |
+
margin-right: 1em;
|
429 |
+
text-align: center;
|
430 |
+
}
|
431 |
+
|
432 |
+
.avatar-history-actions p.warning {
|
433 |
+
text-align: right;
|
434 |
+
}
|
435 |
+
|
436 |
+
.avatar-history-actions button.delete:not(.disabled):hover {
|
437 |
+
background-color: #800;
|
438 |
+
color: #fff;
|
439 |
+
}
|
440 |
+
|
441 |
+
.avatar-history-actions button.delete:not(.disabled) {
|
442 |
+
background-color: #fdc;
|
443 |
+
border: 1px solid #a00;
|
444 |
+
color: #800;
|
445 |
+
}
|
446 |
+
|
447 |
@media screen and (min-width: 810px) {
|
448 |
|
449 |
.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop {
|
@@ -1 +1 @@
|
|
1 |
-
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:left;height:22px;line-height:2;margin:6px 0 0 10px;margin-bottom:2px;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:right!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-right-radius:4px;border-top-left-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:inherit}.moxie-shim.moxie-shim-html5 input{cursor:pointer}.drag-drop #drag-drop-area{box-sizing:border-box;display:table;height:100%;width:100%}.drag-drop .drag-drop-inside{display:table-cell;padding:40px 0;text-align:center;vertical-align:middle}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop .drag-drop-inside p{color:#767676;font-size:110%;margin:5px 0;text-align:center}.drag-drop-inside p.drag-drop-info{margin-top:0}#avatar-to-crop{margin:0 auto 20px;text-align:right}#bp-webcam-avatar #avatar-to-crop{float:right;margin:0 0 20px}#avatar-to-crop .jcrop-holder{margin:0 auto}.avatar-crop-management{clear:right;overflow:hidden;padding-top:20px;text-align:center}#bp-webcam-avatar .avatar-crop-management{clear:none;float:none;overflow:visible;padding-top:0;width:auto}#avatar-crop-pane{margin:0 auto;overflow:hidden}#bp-webcam-avatar #avatar-to-crop{border:1px solid #eee;max-width:100%;width:100%}@media screen and (min-width:801px){#bp-webcam-avatar #avatar-to-crop{max-width:64%;width:64%}}#avatar-crop-actions a{display:block}#bp-webcam-avatar #avatar-crop-actions{float:right;margin:0 0 20px;width:50%}#avatar-crop-actions a.button{margin-top:10px}#bp-webcam-avatar #avatar-crop-actions a.button{display:block;margin:0 0 5px;padding:4px 0;width:100%}#avatar-crop-pane canvas,#avatar-crop-pane img,#avatar-to-crop img,#avatar-upload-form img,#create-group-form img,#group-settings-form img{border:none!important;max-width:none!important}#bp-webcam-avatar video{float:right;margin-bottom:0;max-width:100%;width:100%;transform:scaleX(-1)}#bp-webcam-avatar #avatar-crop-pane{border:2px dashed #bbb;clear:right;float:left;margin:0 0 10px 40px;overflow:hidden}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{max-width:150px;max-height:150px}#avatar-crop-pane canvas{height:auto;width:100%;max-width:100%}.group-avatar .bp-avatar .avatar-crop-management{margin-right:0;padding-top:0;width:auto}.bp-avatar .item{overflow:hidden}.bp-avatar .avatar-crop-management.adjust{float:right;clear:none;padding-top:0}.bp-avatar #avatar-to-crop.adjust{float:right;margin-left:20px}@media screen and (max-width:480px){#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions,#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{width:auto}}@media screen and (min-width:801px){#bp-webcam-avatar .avatar-crop-management{clear:none;float:left}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none;margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{float:right;width:100%}}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent{height:95%!important;width:95%!important}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{display:block;padding:10px 15px}.wp-admin #TB_window .bp-avatar #avatar-to-crop{float:right;margin:0}.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{margin-bottom:20px}@media screen and (min-width:783px){.wp-admin #TB_window .bp-avatar .avatar-crop-management{clear:none;float:right;margin-right:20px;padding-top:0;text-align:center}}.wp-admin #TB_window .bp-avatar #avatar-to-crop video{width:100%}.wp-admin #TB_window .bp-avatar .avatar-crop-management a.button{height:auto;line-height:inherit}@media screen and (min-width:810px){.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{max-width:none;width:76%}.wp-admin #TB_window #bp-webcam-avatar .avatar-crop-management{max-width:none;width:auto}}
|
1 |
+
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:left;height:22px;line-height:2;margin:6px 0 0 10px;margin-bottom:2px;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:right!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-right-radius:4px;border-top-left-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:inherit}.moxie-shim.moxie-shim-html5 input{cursor:pointer}.drag-drop #drag-drop-area{box-sizing:border-box;display:table;height:100%;width:100%}.drag-drop .drag-drop-inside{display:table-cell;padding:40px 0;text-align:center;vertical-align:middle}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop .drag-drop-inside p{color:#767676;font-size:110%;margin:5px 0;text-align:center}.drag-drop-inside p.drag-drop-info{margin-top:0}#avatar-to-crop{margin:0 auto 20px;text-align:right}#bp-webcam-avatar #avatar-to-crop{float:right;margin:0 0 20px}#avatar-to-crop .jcrop-holder{margin:0 auto}.avatar-crop-management{clear:right;overflow:hidden;padding-top:20px;text-align:center}#bp-webcam-avatar .avatar-crop-management{clear:none;float:none;overflow:visible;padding-top:0;width:auto}#avatar-crop-pane{margin:0 auto;overflow:hidden}#bp-webcam-avatar #avatar-to-crop{border:1px solid #eee;max-width:100%;width:100%}@media screen and (min-width:801px){#bp-webcam-avatar #avatar-to-crop{max-width:64%;width:64%}}#avatar-crop-actions a{display:block}#bp-webcam-avatar #avatar-crop-actions{float:right;margin:0 0 20px;width:50%}#avatar-crop-actions a.button{margin-top:10px}#bp-webcam-avatar #avatar-crop-actions a.button{display:block;margin:0 0 5px;padding:4px 0;width:100%}#avatar-crop-pane canvas,#avatar-crop-pane img,#avatar-to-crop img,#avatar-upload-form img,#create-group-form img,#group-settings-form img{border:none!important;max-width:none!important}#bp-webcam-avatar video{float:right;margin-bottom:0;max-width:100%;width:100%;transform:scaleX(-1)}#bp-webcam-avatar #avatar-crop-pane{border:2px dashed #bbb;clear:right;float:left;margin:0 0 10px 40px;overflow:hidden}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{max-width:150px;max-height:150px}#avatar-crop-pane canvas{height:auto;width:100%;max-width:100%}.group-avatar .bp-avatar .avatar-crop-management{margin-right:0;padding-top:0;width:auto}.bp-avatar .item{overflow:hidden}.bp-avatar .avatar-crop-management.adjust{float:right;clear:none;padding-top:0}.bp-avatar #avatar-to-crop.adjust{float:right;margin-left:20px}@media screen and (max-width:480px){#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions,#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{width:auto}}@media screen and (min-width:801px){#bp-webcam-avatar .avatar-crop-management{clear:none;float:left}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none;margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{float:right;width:100%}}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent{height:95%!important;width:95%!important}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{display:block;padding:10px 15px}.wp-admin #TB_window .bp-avatar #avatar-to-crop{float:right;margin:0}.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{margin-bottom:20px}@media screen and (min-width:783px){.wp-admin #TB_window .bp-avatar .avatar-crop-management{clear:none;float:right;margin-right:20px;padding-top:0;text-align:center}}.wp-admin #TB_window .bp-avatar #avatar-to-crop video{width:100%}.wp-admin #TB_window .bp-avatar .avatar-crop-management a.button{height:auto;line-height:inherit}.avatars-history{display:flex;flex-direction:row}.avatar-history-list{order:1;width:80%;max-height:250px;overflow-y:auto}.avatar-history-list label{display:block;margin:0 auto;width:60px}.avatar-history-table td .avatar{vertical-align:middle}.avatar-history-table td .avatar.selected{border:solid 4px #065288}.avatar-history-actions{order:2;margin-right:1em;text-align:center}.avatar-history-actions p.warning{text-align:right}.avatar-history-actions button.delete:not(.disabled):hover{background-color:#800;color:#fff}.avatar-history-actions button.delete:not(.disabled){background-color:#fdc;border:1px solid #a00;color:#800}@media screen and (min-width:810px){.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{max-width:none;width:76%}.wp-admin #TB_window #bp-webcam-avatar .avatar-crop-management{max-width:none;width:auto}}
|
@@ -397,6 +397,53 @@ body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning {
|
|
397 |
line-height: inherit;
|
398 |
}
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
@media screen and (min-width: 810px) {
|
401 |
|
402 |
.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop {
|
397 |
line-height: inherit;
|
398 |
}
|
399 |
|
400 |
+
.avatars-history {
|
401 |
+
display: flex;
|
402 |
+
flex-direction: row;
|
403 |
+
}
|
404 |
+
|
405 |
+
.avatar-history-list {
|
406 |
+
order: 1;
|
407 |
+
width: 80%;
|
408 |
+
max-height: 250px;
|
409 |
+
overflow-y: auto;
|
410 |
+
}
|
411 |
+
|
412 |
+
.avatar-history-list label {
|
413 |
+
display: block;
|
414 |
+
margin: 0 auto;
|
415 |
+
width: 60px;
|
416 |
+
}
|
417 |
+
|
418 |
+
.avatar-history-table td .avatar {
|
419 |
+
vertical-align: middle;
|
420 |
+
}
|
421 |
+
|
422 |
+
.avatar-history-table td .avatar.selected {
|
423 |
+
border: solid 4px #065288;
|
424 |
+
}
|
425 |
+
|
426 |
+
.avatar-history-actions {
|
427 |
+
order: 2;
|
428 |
+
margin-left: 1em;
|
429 |
+
text-align: center;
|
430 |
+
}
|
431 |
+
|
432 |
+
.avatar-history-actions p.warning {
|
433 |
+
text-align: left;
|
434 |
+
}
|
435 |
+
|
436 |
+
.avatar-history-actions button.delete:not(.disabled):hover {
|
437 |
+
background-color: #800;
|
438 |
+
color: #fff;
|
439 |
+
}
|
440 |
+
|
441 |
+
.avatar-history-actions button.delete:not(.disabled) {
|
442 |
+
background-color: #fdc;
|
443 |
+
border: 1px solid #a00;
|
444 |
+
color: #800;
|
445 |
+
}
|
446 |
+
|
447 |
@media screen and (min-width: 810px) {
|
448 |
|
449 |
.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop {
|
@@ -1 +1 @@
|
|
1 |
-
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:right;height:22px;line-height:2;margin:6px 10px 0 0;margin-bottom:2px;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:left!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:inherit}.moxie-shim.moxie-shim-html5 input{cursor:pointer}.drag-drop #drag-drop-area{box-sizing:border-box;display:table;height:100%;width:100%}.drag-drop .drag-drop-inside{display:table-cell;padding:40px 0;text-align:center;vertical-align:middle}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop .drag-drop-inside p{color:#767676;font-size:110%;margin:5px 0;text-align:center}.drag-drop-inside p.drag-drop-info{margin-top:0}#avatar-to-crop{margin:0 auto 20px;text-align:left}#bp-webcam-avatar #avatar-to-crop{float:left;margin:0 0 20px}#avatar-to-crop .jcrop-holder{margin:0 auto}.avatar-crop-management{clear:left;overflow:hidden;padding-top:20px;text-align:center}#bp-webcam-avatar .avatar-crop-management{clear:none;float:none;overflow:visible;padding-top:0;width:auto}#avatar-crop-pane{margin:0 auto;overflow:hidden}#bp-webcam-avatar #avatar-to-crop{border:1px solid #eee;max-width:100%;width:100%}@media screen and (min-width:801px){#bp-webcam-avatar #avatar-to-crop{max-width:64%;width:64%}}#avatar-crop-actions a{display:block}#bp-webcam-avatar #avatar-crop-actions{float:left;margin:0 0 20px;width:50%}#avatar-crop-actions a.button{margin-top:10px}#bp-webcam-avatar #avatar-crop-actions a.button{display:block;margin:0 0 5px;padding:4px 0;width:100%}#avatar-crop-pane canvas,#avatar-crop-pane img,#avatar-to-crop img,#avatar-upload-form img,#create-group-form img,#group-settings-form img{border:none!important;max-width:none!important}#bp-webcam-avatar video{float:left;margin-bottom:0;max-width:100%;width:100%;transform:scaleX(-1)}#bp-webcam-avatar #avatar-crop-pane{border:2px dashed #bbb;clear:left;float:right;margin:0 40px 10px 0;overflow:hidden}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{max-width:150px;max-height:150px}#avatar-crop-pane canvas{height:auto;width:100%;max-width:100%}.group-avatar .bp-avatar .avatar-crop-management{margin-left:0;padding-top:0;width:auto}.bp-avatar .item{overflow:hidden}.bp-avatar .avatar-crop-management.adjust{float:left;clear:none;padding-top:0}.bp-avatar #avatar-to-crop.adjust{float:left;margin-right:20px}@media screen and (max-width:480px){#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions,#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{width:auto}}@media screen and (min-width:801px){#bp-webcam-avatar .avatar-crop-management{clear:none;float:right}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none;margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{float:left;width:100%}}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent{height:95%!important;width:95%!important}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{display:block;padding:10px 15px}.wp-admin #TB_window .bp-avatar #avatar-to-crop{float:left;margin:0}.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{margin-bottom:20px}@media screen and (min-width:783px){.wp-admin #TB_window .bp-avatar .avatar-crop-management{clear:none;float:left;margin-left:20px;padding-top:0;text-align:center}}.wp-admin #TB_window .bp-avatar #avatar-to-crop video{width:100%}.wp-admin #TB_window .bp-avatar .avatar-crop-management a.button{height:auto;line-height:inherit}@media screen and (min-width:810px){.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{max-width:none;width:76%}.wp-admin #TB_window #bp-webcam-avatar .avatar-crop-management{max-width:none;width:auto}}
|
1 |
+
div.bp-avatar-status,div.bp-cover-image-status{clear:both;margin:1em 0}div.bp-avatar-status p.updated,div.bp-cover-image-status p.updated{display:block;padding:10px 15px}div.bp-avatar-status p.success,div.bp-cover-image-status p.success{background-color:#efc;border:1px solid #591;color:#250}div.bp-avatar-status p.error,div.bp-cover-image-status p.error{background-color:#fdc;border:1px solid #a00;color:#800}div.bp-avatar-status .bp-progress,div.bp-cover-image-status .bp-progress{background:0 0;border:1px solid #d1d1d1;float:right;height:22px;line-height:2;margin:6px 10px 0 0;margin-bottom:2px;padding:0;overflow:hidden;width:200px}div.bp-avatar-status .bp-bar,div.bp-cover-image-status .bp-bar{background-color:#c3ff88;width:0;height:100%;z-index:9}.bp-uploader-progress div.error{background-color:#fdc;border:1px solid #a00;color:#800;display:block;font-size:90%;padding:10px 15px}#buddypress p.warning,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{background-color:#ffd;border:1px solid #cb2;color:#440;display:block;font-size:90%;margin:1em 0;padding:10px 15px}div.bp-avatar-nav{background:0 0;clear:both;margin:10px 0;overflow:hidden}.avatar-nav-items{margin:0;padding:0}.bp-avatar-nav .avatar-nav-items li.avatar-nav-item{float:left!important;margin:0;list-style:none}.avatar-nav-items li a{display:block;padding:5px 10px;text-decoration:none}.bp-avatar-nav ul:after,.bp-avatar-nav ul:before{content:" ";display:table}.bp-avatar-nav ul:after{clear:both}.bp-avatar-nav ul{border-bottom:1px solid #ccc;margin-bottom:10px}.bp-avatar-nav ul.avatar-nav-items li.current{border:1px solid #ccc;border-bottom-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px;margin-bottom:-1px}.bp-avatar-nav li.current a{background:0 0;color:inherit;font-weight:700;opacity:.8;outline:0}#drag-drop-area{border:4px dashed #bbb;height:200px}.drag-drop.drag-over #drag-drop-area{border-color:#83b4d8}.drag-drop-inside p{display:none}.drag-drop-inside p.drag-drop-buttons{margin-top:80px;text-align:center}.drag-drop .drag-drop-inside p.drag-drop-buttons{margin:auto;text-align:inherit}.moxie-shim.moxie-shim-html5 input{cursor:pointer}.drag-drop #drag-drop-area{box-sizing:border-box;display:table;height:100%;width:100%}.drag-drop .drag-drop-inside{display:table-cell;padding:40px 0;text-align:center;vertical-align:middle}.drag-drop .drag-drop-inside p,.drag-drop-inside p.drag-drop-buttons{display:block}.drag-drop .drag-drop-inside p{color:#767676;font-size:110%;margin:5px 0;text-align:center}.drag-drop-inside p.drag-drop-info{margin-top:0}#avatar-to-crop{margin:0 auto 20px;text-align:left}#bp-webcam-avatar #avatar-to-crop{float:left;margin:0 0 20px}#avatar-to-crop .jcrop-holder{margin:0 auto}.avatar-crop-management{clear:left;overflow:hidden;padding-top:20px;text-align:center}#bp-webcam-avatar .avatar-crop-management{clear:none;float:none;overflow:visible;padding-top:0;width:auto}#avatar-crop-pane{margin:0 auto;overflow:hidden}#bp-webcam-avatar #avatar-to-crop{border:1px solid #eee;max-width:100%;width:100%}@media screen and (min-width:801px){#bp-webcam-avatar #avatar-to-crop{max-width:64%;width:64%}}#avatar-crop-actions a{display:block}#bp-webcam-avatar #avatar-crop-actions{float:left;margin:0 0 20px;width:50%}#avatar-crop-actions a.button{margin-top:10px}#bp-webcam-avatar #avatar-crop-actions a.button{display:block;margin:0 0 5px;padding:4px 0;width:100%}#avatar-crop-pane canvas,#avatar-crop-pane img,#avatar-to-crop img,#avatar-upload-form img,#create-group-form img,#group-settings-form img{border:none!important;max-width:none!important}#bp-webcam-avatar video{float:left;margin-bottom:0;max-width:100%;width:100%;transform:scaleX(-1)}#bp-webcam-avatar #avatar-crop-pane{border:2px dashed #bbb;clear:left;float:right;margin:0 40px 10px 0;overflow:hidden}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{max-width:150px;max-height:150px}#avatar-crop-pane canvas{height:auto;width:100%;max-width:100%}.group-avatar .bp-avatar .avatar-crop-management{margin-left:0;padding-top:0;width:auto}.bp-avatar .item{overflow:hidden}.bp-avatar .avatar-crop-management.adjust{float:left;clear:none;padding-top:0}.bp-avatar #avatar-to-crop.adjust{float:left;margin-right:20px}@media screen and (max-width:480px){#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions,#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{width:auto}}@media screen and (min-width:801px){#bp-webcam-avatar .avatar-crop-management{clear:none;float:right}#bp-webcam-avatar .avatar-crop-management #avatar-crop-pane{float:none;margin:0 auto 10px}#bp-webcam-avatar .avatar-crop-management #avatar-crop-actions{float:left;width:100%}}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent{height:95%!important;width:95%!important}body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.profile_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.updated,body.users_page_bp-profile-edit.modal-open #TB_ajaxContent p.warning{display:block;padding:10px 15px}.wp-admin #TB_window .bp-avatar #avatar-to-crop{float:left;margin:0}.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{margin-bottom:20px}@media screen and (min-width:783px){.wp-admin #TB_window .bp-avatar .avatar-crop-management{clear:none;float:left;margin-left:20px;padding-top:0;text-align:center}}.wp-admin #TB_window .bp-avatar #avatar-to-crop video{width:100%}.wp-admin #TB_window .bp-avatar .avatar-crop-management a.button{height:auto;line-height:inherit}.avatars-history{display:flex;flex-direction:row}.avatar-history-list{order:1;width:80%;max-height:250px;overflow-y:auto}.avatar-history-list label{display:block;margin:0 auto;width:60px}.avatar-history-table td .avatar{vertical-align:middle}.avatar-history-table td .avatar.selected{border:solid 4px #065288}.avatar-history-actions{order:2;margin-left:1em;text-align:center}.avatar-history-actions p.warning{text-align:left}.avatar-history-actions button.delete:not(.disabled):hover{background-color:#800;color:#fff}.avatar-history-actions button.delete:not(.disabled){background-color:#fdc;border:1px solid #a00;color:#800}@media screen and (min-width:810px){.wp-admin #TB_window .bp-avatar #bp-webcam-avatar #avatar-to-crop{max-width:none;width:76%}.wp-admin #TB_window #bp-webcam-avatar .avatar-crop-management{max-width:none;width:auto}}
|
@@ -26,6 +26,7 @@
|
|
26 |
|
27 |
#bp-login-widget-form .login-submit,
|
28 |
#bp-login-widget-form .bp-login-widget-register-link {
|
|
|
29 |
width: fit-content;
|
30 |
display: inline;
|
31 |
}
|
@@ -34,3 +35,7 @@
|
|
34 |
margin-right: 1em;
|
35 |
vertical-align: super;
|
36 |
}
|
|
|
|
|
|
|
|
26 |
|
27 |
#bp-login-widget-form .login-submit,
|
28 |
#bp-login-widget-form .bp-login-widget-register-link {
|
29 |
+
width: -moz-fit-content;
|
30 |
width: fit-content;
|
31 |
display: inline;
|
32 |
}
|
35 |
margin-right: 1em;
|
36 |
vertical-align: super;
|
37 |
}
|
38 |
+
|
39 |
+
#bp-login-widget-form .bp-login-widget-pwd-link {
|
40 |
+
font-size: 80%;
|
41 |
+
}
|
@@ -1 +1 @@
|
|
1 |
-
.widget_bp_core_login_widget .bp-login-widget-user-avatar{float:right}.widget_bp_core_login_widget .bp-login-widget-user-links{margin-right:70px}#bp-login-widget-form label{display:block;font-weight:600;margin:15px 0 5px;width:auto}#bp-login-widget-form input[type=password],#bp-login-widget-form input[type=text]{width:100%;background-color:#fafafa;border:1px solid #d6d6d6;border-radius:0;font:inherit;font-size:100%;padding:.5em}#bp-login-widget-form .bp-login-widget-register-link,#bp-login-widget-form .login-submit{width:fit-content;display:inline}#bp-login-widget-form .bp-login-widget-register-link{margin-right:1em;vertical-align:super}
|
1 |
+
.widget_bp_core_login_widget .bp-login-widget-user-avatar{float:right}.widget_bp_core_login_widget .bp-login-widget-user-links{margin-right:70px}#bp-login-widget-form label{display:block;font-weight:600;margin:15px 0 5px;width:auto}#bp-login-widget-form input[type=password],#bp-login-widget-form input[type=text]{width:100%;background-color:#fafafa;border:1px solid #d6d6d6;border-radius:0;font:inherit;font-size:100%;padding:.5em}#bp-login-widget-form .bp-login-widget-register-link,#bp-login-widget-form .login-submit{width:-moz-fit-content;width:fit-content;display:inline}#bp-login-widget-form .bp-login-widget-register-link{margin-right:1em;vertical-align:super}#bp-login-widget-form .bp-login-widget-pwd-link{font-size:80%}
|
@@ -26,6 +26,7 @@
|
|
26 |
|
27 |
#bp-login-widget-form .login-submit,
|
28 |
#bp-login-widget-form .bp-login-widget-register-link {
|
|
|
29 |
width: fit-content;
|
30 |
display: inline;
|
31 |
}
|
@@ -34,3 +35,7 @@
|
|
34 |
margin-left: 1em;
|
35 |
vertical-align: super;
|
36 |
}
|
|
|
|
|
|
|
|
26 |
|
27 |
#bp-login-widget-form .login-submit,
|
28 |
#bp-login-widget-form .bp-login-widget-register-link {
|
29 |
+
width: -moz-fit-content;
|
30 |
width: fit-content;
|
31 |
display: inline;
|
32 |
}
|
35 |
margin-left: 1em;
|
36 |
vertical-align: super;
|
37 |
}
|
38 |
+
|
39 |
+
#bp-login-widget-form .bp-login-widget-pwd-link {
|
40 |
+
font-size: 80%;
|
41 |
+
}
|
@@ -1 +1 @@
|
|
1 |
-
.widget_bp_core_login_widget .bp-login-widget-user-avatar{float:left}.widget_bp_core_login_widget .bp-login-widget-user-links{margin-left:70px}#bp-login-widget-form label{display:block;font-weight:600;margin:15px 0 5px;width:auto}#bp-login-widget-form input[type=password],#bp-login-widget-form input[type=text]{width:100%;background-color:#fafafa;border:1px solid #d6d6d6;border-radius:0;font:inherit;font-size:100%;padding:.5em}#bp-login-widget-form .bp-login-widget-register-link,#bp-login-widget-form .login-submit{width:fit-content;display:inline}#bp-login-widget-form .bp-login-widget-register-link{margin-left:1em;vertical-align:super}
|
1 |
+
.widget_bp_core_login_widget .bp-login-widget-user-avatar{float:left}.widget_bp_core_login_widget .bp-login-widget-user-links{margin-left:70px}#bp-login-widget-form label{display:block;font-weight:600;margin:15px 0 5px;width:auto}#bp-login-widget-form input[type=password],#bp-login-widget-form input[type=text]{width:100%;background-color:#fafafa;border:1px solid #d6d6d6;border-radius:0;font:inherit;font-size:100%;padding:.5em}#bp-login-widget-form .bp-login-widget-register-link,#bp-login-widget-form .login-submit{width:-moz-fit-content;width:fit-content;display:inline}#bp-login-widget-form .bp-login-widget-register-link{margin-left:1em;vertical-align:super}#bp-login-widget-form .bp-login-widget-pwd-link{font-size:80%}
|
@@ -44,7 +44,10 @@ function bp_activity_get_sitewide( $args = '' ) {
|
|
44 |
'filter' => array()
|
45 |
);
|
46 |
|
47 |
-
$args =
|
|
|
|
|
|
|
48 |
|
49 |
return apply_filters( 'bp_activity_get_sitewide', BP_Activity_Activity::get( $args ), $r );
|
50 |
}
|
44 |
'filter' => array()
|
45 |
);
|
46 |
|
47 |
+
$args = bp_parse_args(
|
48 |
+
$args,
|
49 |
+
$defaults
|
50 |
+
);
|
51 |
|
52 |
return apply_filters( 'bp_activity_get_sitewide', BP_Activity_Activity::get( $args ), $r );
|
53 |
}
|
@@ -97,7 +97,11 @@ function bp_core_add_admin_menu_page( $args = '' ) {
|
|
97 |
'position' => 100
|
98 |
);
|
99 |
|
100 |
-
$r =
|
|
|
|
|
|
|
|
|
101 |
extract( $r, EXTR_SKIP );
|
102 |
|
103 |
$file = plugin_basename( $file );
|
97 |
'position' => 100
|
98 |
);
|
99 |
|
100 |
+
$r = bp_parse_args(
|
101 |
+
$args,
|
102 |
+
$defaults
|
103 |
+
);
|
104 |
+
|
105 |
extract( $r, EXTR_SKIP );
|
106 |
|
107 |
$file = plugin_basename( $file );
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Deprecated functions.
|
4 |
+
*
|
5 |
+
* @package BuddyPress
|
6 |
+
* @deprecated 10.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Returns the name of the hook to use once a WordPress Site is inserted into the Database.
|
16 |
+
*
|
17 |
+
* WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back
|
18 |
+
* to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current
|
19 |
+
* WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier
|
20 |
+
* versions of WordPress.
|
21 |
+
*
|
22 |
+
* @since 6.0.0
|
23 |
+
* @deprecated 10.0.0
|
24 |
+
*
|
25 |
+
* @return string The name of the hook to use.
|
26 |
+
*/
|
27 |
+
function bp_insert_site_hook() {
|
28 |
+
_deprecated_function( __FUNCTION__, '10.0.0' );
|
29 |
+
|
30 |
+
$wp_hook = 'wpmu_new_blog';
|
31 |
+
|
32 |
+
if ( function_exists( 'wp_insert_site' ) ) {
|
33 |
+
$wp_hook = 'wp_initialize_site';
|
34 |
+
}
|
35 |
+
|
36 |
+
return $wp_hook;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Returns the name of the hook to use once a WordPress Site is deleted.
|
41 |
+
*
|
42 |
+
* WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back
|
43 |
+
* to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the
|
44 |
+
* current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for
|
45 |
+
* earlier versions of WordPress.
|
46 |
+
*
|
47 |
+
* @since 6.0.0
|
48 |
+
* @deprecated 10.0.0
|
49 |
+
*
|
50 |
+
* @return string The name of the hook to use.
|
51 |
+
*/
|
52 |
+
function bp_delete_site_hook() {
|
53 |
+
_deprecated_function( __FUNCTION__, '10.0.0' );
|
54 |
+
|
55 |
+
$wp_hook = 'delete_blog';
|
56 |
+
|
57 |
+
if ( function_exists( 'wp_delete_site' ) ) {
|
58 |
+
$wp_hook = 'wp_validate_site_deletion';
|
59 |
+
}
|
60 |
+
|
61 |
+
return $wp_hook;
|
62 |
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -39,6 +39,9 @@ window.bp = window.bp || {};
|
|
39 |
// The Avatar Attachment object.
|
40 |
this.Attachment = new Backbone.Model();
|
41 |
|
|
|
|
|
|
|
42 |
// Wait till the queue is reset.
|
43 |
bp.Uploader.filesQueue.on( 'reset', this.cropView, this );
|
44 |
|
@@ -115,6 +118,10 @@ window.bp = window.bp || {};
|
|
115 |
case 'delete':
|
116 |
this.deleteView();
|
117 |
break;
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
},
|
120 |
|
@@ -303,7 +310,7 @@ window.bp = window.bp || {};
|
|
303 |
} );
|
304 |
},
|
305 |
|
306 |
-
deleteView:function() {
|
307 |
// Create the delete model.
|
308 |
var delete_model = new Backbone.Model( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
|
309 |
'object',
|
@@ -332,7 +339,7 @@ window.bp = window.bp || {};
|
|
332 |
this.views.remove( { id: 'delete', view: deleteView } );
|
333 |
}
|
334 |
|
335 |
-
// Remove the avatar
|
336 |
bp.ajax.post( 'bp_avatar_delete', {
|
337 |
json: true,
|
338 |
item_id: model.get( 'item_id' ),
|
@@ -407,6 +414,126 @@ window.bp = window.bp || {};
|
|
407 |
} );
|
408 |
|
409 |
this.warning.inject( '.bp-avatar-status' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
};
|
412 |
|
@@ -677,6 +804,95 @@ window.bp = window.bp || {};
|
|
677 |
}
|
678 |
} );
|
679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
bp.Avatar.start();
|
681 |
|
682 |
})( window.bp, jQuery );
|
39 |
// The Avatar Attachment object.
|
40 |
this.Attachment = new Backbone.Model();
|
41 |
|
42 |
+
// The Avatars history.
|
43 |
+
this.historicAvatars = null;
|
44 |
+
|
45 |
// Wait till the queue is reset.
|
46 |
bp.Uploader.filesQueue.on( 'reset', this.cropView, this );
|
47 |
|
118 |
case 'delete':
|
119 |
this.deleteView();
|
120 |
break;
|
121 |
+
|
122 |
+
case 'recycle':
|
123 |
+
this.recycleView();
|
124 |
+
break;
|
125 |
}
|
126 |
},
|
127 |
|
310 |
} );
|
311 |
},
|
312 |
|
313 |
+
deleteView: function() {
|
314 |
// Create the delete model.
|
315 |
var delete_model = new Backbone.Model( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
|
316 |
'object',
|
339 |
this.views.remove( { id: 'delete', view: deleteView } );
|
340 |
}
|
341 |
|
342 |
+
// Remove the avatar!
|
343 |
bp.ajax.post( 'bp_avatar_delete', {
|
344 |
json: true,
|
345 |
item_id: model.get( 'item_id' ),
|
414 |
} );
|
415 |
|
416 |
this.warning.inject( '.bp-avatar-status' );
|
417 |
+
},
|
418 |
+
|
419 |
+
recycleView: function() {
|
420 |
+
if ( ! this.historicAvatars ) {
|
421 |
+
this.historicAvatars = new Backbone.Collection( BP_Uploader.settings.history );
|
422 |
+
}
|
423 |
+
|
424 |
+
// Create the recycle view.
|
425 |
+
var recycleView = new bp.Views.RecycleAvatar( { collection: this.historicAvatars } );
|
426 |
+
|
427 |
+
// Add it to views.
|
428 |
+
this.views.add( { id: 'recycle', view: recycleView } );
|
429 |
+
|
430 |
+
// Display it.
|
431 |
+
recycleView.inject( '.bp-avatar' );
|
432 |
+
},
|
433 |
+
|
434 |
+
recycleHistoricAvatar: function( model ) {
|
435 |
+
var self = this;
|
436 |
+
model.set( 'selected', false );
|
437 |
+
|
438 |
+
// Recycle the avatar.
|
439 |
+
bp.ajax.post( 'bp_avatar_recycle_previous', {
|
440 |
+
json: true,
|
441 |
+
item_id: BP_Uploader.settings.defaults.multipart_params.bp_params.item_id,
|
442 |
+
avatar_id: model.get( 'id' ),
|
443 |
+
object: BP_Uploader.settings.defaults.multipart_params.bp_params.object,
|
444 |
+
nonce: BP_Uploader.settings.historyNonces.recylePrevious
|
445 |
+
} ).done( function( response ) {
|
446 |
+
if ( response.historicalAvatar ) {
|
447 |
+
model.collection.add( response.historicalAvatar );
|
448 |
+
}
|
449 |
+
|
450 |
+
model.collection.remove( model );
|
451 |
+
|
452 |
+
if ( response.feedback_code ) {
|
453 |
+
var avatarStatus = new bp.Views.AvatarStatus( {
|
454 |
+
value : BP_Uploader.strings.feedback_messages[ response.feedback_code ],
|
455 |
+
type : 'success'
|
456 |
+
} );
|
457 |
+
|
458 |
+
self.views.add( {
|
459 |
+
id : 'status',
|
460 |
+
view : avatarStatus
|
461 |
+
} );
|
462 |
+
|
463 |
+
avatarStatus.inject( '.bp-avatar-status' );
|
464 |
+
}
|
465 |
+
|
466 |
+
// Update each avatars of the page.
|
467 |
+
$( '.' + BP_Uploader.settings.defaults.multipart_params.bp_params.object + '-' + response.item_id + '-avatar' ).each( function() {
|
468 |
+
$( this ).prop( 'src', response.avatar );
|
469 |
+
} );
|
470 |
+
|
471 |
+
} ).fail( function( response ) {
|
472 |
+
var error_message = BP_Uploader.strings.default_error;
|
473 |
+
if ( response && response.message ) {
|
474 |
+
error_message = response.message;
|
475 |
+
}
|
476 |
+
|
477 |
+
var avatarStatus = new bp.Views.AvatarStatus( {
|
478 |
+
value : error_message,
|
479 |
+
type : 'error'
|
480 |
+
} );
|
481 |
+
|
482 |
+
self.views.add( {
|
483 |
+
id : 'status',
|
484 |
+
view : avatarStatus
|
485 |
+
} );
|
486 |
+
|
487 |
+
avatarStatus.inject( '.bp-avatar-status' );
|
488 |
+
} );
|
489 |
+
},
|
490 |
+
|
491 |
+
deletePreviousAvatar: function( model ) {
|
492 |
+
var self = this;
|
493 |
+
model.set( 'selected', false );
|
494 |
+
|
495 |
+
// Recycle the avatar.
|
496 |
+
bp.ajax.post( 'bp_avatar_delete_previous', {
|
497 |
+
json: true,
|
498 |
+
item_id: BP_Uploader.settings.defaults.multipart_params.bp_params.item_id,
|
499 |
+
avatar_id: model.get( 'id' ),
|
500 |
+
object: BP_Uploader.settings.defaults.multipart_params.bp_params.object,
|
501 |
+
nonce: BP_Uploader.settings.historyNonces.deletePrevious
|
502 |
+
} ).done( function( response ) {
|
503 |
+
model.collection.remove( model );
|
504 |
+
|
505 |
+
if ( response.feedback_code ) {
|
506 |
+
var avatarStatus = new bp.Views.AvatarStatus( {
|
507 |
+
value : BP_Uploader.strings.feedback_messages[ response.feedback_code ],
|
508 |
+
type : 'success'
|
509 |
+
} );
|
510 |
+
|
511 |
+
self.views.add( {
|
512 |
+
id : 'status',
|
513 |
+
view : avatarStatus
|
514 |
+
} );
|
515 |
+
|
516 |
+
avatarStatus.inject( '.bp-avatar-status' );
|
517 |
+
}
|
518 |
+
|
519 |
+
} ).fail( function( response ) {
|
520 |
+
var error_message = BP_Uploader.strings.default_error;
|
521 |
+
if ( response && response.message ) {
|
522 |
+
error_message = response.message;
|
523 |
+
}
|
524 |
+
|
525 |
+
var avatarStatus = new bp.Views.AvatarStatus( {
|
526 |
+
value : error_message,
|
527 |
+
type : 'error'
|
528 |
+
} );
|
529 |
+
|
530 |
+
self.views.add( {
|
531 |
+
id : 'status',
|
532 |
+
view : avatarStatus
|
533 |
+
} );
|
534 |
+
|
535 |
+
avatarStatus.inject( '.bp-avatar-status' );
|
536 |
+
} );
|
537 |
}
|
538 |
};
|
539 |
|
804 |
}
|
805 |
} );
|
806 |
|
807 |
+
bp.Views.HistoryAvatarsItem = bp.View.extend( {
|
808 |
+
tagName: 'tr',
|
809 |
+
className: 'historic-avatar',
|
810 |
+
template: bp.template( 'bp-avatar-recycle-history-item' ),
|
811 |
+
|
812 |
+
events: {
|
813 |
+
'change input[name="avatar_id"]': 'selectAvatar'
|
814 |
+
},
|
815 |
+
|
816 |
+
initialize: function() {
|
817 |
+
this.model.on( 'change:selected', this.toggleSelection, this );
|
818 |
+
this.model.on( 'remove', this.clearView, this );
|
819 |
+
},
|
820 |
+
|
821 |
+
toggleSelection: function( model, selected ) {
|
822 |
+
if ( true === selected ) {
|
823 |
+
this.$el.parent().find( '#' + model.get( 'id' ) ).addClass( 'selected' );
|
824 |
+
} else {
|
825 |
+
this.$el.parent().find( '#' + model.get( 'id' ) ).removeClass( 'selected' );
|
826 |
+
this.$el.parent().find( '#avatar_' + model.get( 'id' ) ).prop( 'checked', false );
|
827 |
+
}
|
828 |
+
},
|
829 |
+
|
830 |
+
selectAvatar: function( event ) {
|
831 |
+
event.preventDefault();
|
832 |
+
|
833 |
+
if ( event.currentTarget.checked ) {
|
834 |
+
var self = this;
|
835 |
+
|
836 |
+
_.each( this.model.collection.models, function( model ) {
|
837 |
+
self.$el.parent().find( '#' + model.id ).removeClass( 'selected' );
|
838 |
+
model.set( 'selected', false, { silent: true } );
|
839 |
+
} );
|
840 |
+
|
841 |
+
this.model.set( 'selected', true );
|
842 |
+
}
|
843 |
+
},
|
844 |
+
|
845 |
+
clearView: function() {
|
846 |
+
this.views.view.remove();
|
847 |
+
}
|
848 |
+
} );
|
849 |
+
|
850 |
+
bp.Views.RecycleAvatar = bp.View.extend( {
|
851 |
+
tagName: 'div',
|
852 |
+
id: 'bp-avatars-history-container',
|
853 |
+
template: bp.template( 'bp-avatar-recycle' ),
|
854 |
+
|
855 |
+
events: {
|
856 |
+
'click button.avatar-history-action': 'doAvatarAction'
|
857 |
+
},
|
858 |
+
|
859 |
+
initialize: function() {
|
860 |
+
_.each( this.collection.models, function( model ) {
|
861 |
+
this.views.add( '#bp-avatars-history-list', new bp.Views.HistoryAvatarsItem( { model: model } ) );
|
862 |
+
}, this );
|
863 |
+
|
864 |
+
this.collection.on( 'change:selected', this.updateButtonStatus, this );
|
865 |
+
this.collection.on( 'add', this.addView, this );
|
866 |
+
},
|
867 |
+
|
868 |
+
addView: function( model ) {
|
869 |
+
this.views.add( '#bp-avatars-history-list', new bp.Views.HistoryAvatarsItem( { model: model } ) );
|
870 |
+
},
|
871 |
+
|
872 |
+
updateButtonStatus: function( model ) {
|
873 |
+
if ( true === model.get( 'selected' ) ) {
|
874 |
+
this.$el.find( 'button.disabled' ).removeClass( 'disabled' );
|
875 |
+
}
|
876 |
+
},
|
877 |
+
|
878 |
+
doAvatarAction: function( event ) {
|
879 |
+
event.preventDefault();
|
880 |
+
var buttonClasses = event.currentTarget.classList,
|
881 |
+
selected = this.collection.findWhere( { selected: true } );
|
882 |
+
|
883 |
+
if ( ! buttonClasses.contains( 'disabled' ) && selected ) {
|
884 |
+
// Make sure it's not possible to fire 2 actions at the same time.
|
885 |
+
this.$el.find( 'button.avatar-history-action' ).addClass( 'disabled' );
|
886 |
+
|
887 |
+
if ( buttonClasses.contains( 'recycle' ) ) {
|
888 |
+
bp.Avatar.recycleHistoricAvatar( selected );
|
889 |
+
} else if ( buttonClasses.contains( 'delete' ) ) {
|
890 |
+
bp.Avatar.deletePreviousAvatar( selected );
|
891 |
+
}
|
892 |
+
}
|
893 |
+
}
|
894 |
+
} );
|
895 |
+
|
896 |
bp.Avatar.start();
|
897 |
|
898 |
})( window.bp, jQuery );
|
@@ -1 +1 @@
|
|
1 |
-
window.bp=window.bp||{},function(v,c){"undefined"!=typeof BP_Uploader&&(v.Models=v.Models||{},v.Collections=v.Collections||{},v.Views=v.Views||{},v.Avatar={start:function(){var e=this;this.removeLegacyUI(),this.views=new Backbone.Collection,this.jcropapi={},this.warning=null,this.setupNav(),this.avatars=v.Uploader.filesUploaded,this.Attachment=new Backbone.Model,v.Uploader.filesQueue.on("reset",this.cropView,this),c("body.wp-admin").on("tb_unload","#TB_window",function(){e.resetViews()}),c("body.wp-admin").on("click",".bp-members-avatar-user-edit",function(){e.resetViews()})},removeLegacyUI:function(){c("#avatar-upload-form").length?(c("#avatar-upload").remove(),c("#avatar-upload-form p").remove()):c("#group-settings-form").length?(c("#group-settings-form p").each(function(e){0!==e&&c(this).remove()}),c("#delete-group-avatar-button").length&&c("#delete-group-avatar-button").remove()):c("#group-create-body").length?(c(".main-column p #file").remove(),c(".main-column p #upload").remove()):c("#bp_members_user_admin_avatar a.bp-members-avatar-user-admin").length&&c("#bp_members_user_admin_avatar a.bp-members-avatar-user-admin").remove()},setView:function(e){switch(_.isUndefined(this.views.models)||_.each(this.views.models,function(e){e.get("view").remove()},this),this.views.reset(),_.isUndefined(this.avatars)||this.avatars.reset(),_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),e){case"upload":this.uploaderView();break;case"delete":this.deleteView()}},resetViews:function(){this.nav.trigger("bp-avatar-view:changed","upload"),_.each(this.navItems.models,function(e){"upload"===e.id?e.set({active:1}):e.set({active:0})})},setupNav:function(){var a,i,s=this;this.navItems=new Backbone.Collection,_.each(BP_Uploader.settings.nav,function(e,t){_.isObject(e)&&((i=0)===t&&(a=e.id,i=1),s.navItems.add({id:e.id,name:e.caption,href:"#",active:i,hide:_.isUndefined(e.hide)?0:e.hide}))}),this.nav=new v.Views.Nav({collection:this.navItems}),this.nav.inject(".bp-avatar-nav"),this.setView(a),this.nav.on("bp-avatar-view:changed",_.bind(this.setView,this))},uploaderView:function(){v.Uploader.filesQueue.on("add",this.uploadProgress,this);var e=new v.Views.Uploader;this.views.add({id:"upload",view:e}),e.inject(".bp-avatar")},uploadProgress:function(){var e=new v.Views.uploaderStatus({collection:v.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:e}):this.views.set({id:"status",view:e}),e.inject(".bp-avatar-status")},cropView:function(){var e;_.isEmpty(this.avatars.models)||(_.isUndefined(this.views.get("status"))||((e=this.views.get("status")).get("view").remove(),this.views.remove({id:"status",view:e})),e=new v.Views.Avatars({collection:this.avatars}),this.views.add({id:"crop",view:e}),e.inject(".bp-avatar"))},setAvatar:function(a){var e,i=this;_.isUndefined(this.views.get("crop"))||(_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),(e=this.views.get("crop")).get("view").remove(),this.views.remove({id:"crop",view:e})),v.ajax.post("bp_avatar_set",{json:!0,original_file:a.get("url"),crop_w:a.get("w"),crop_h:a.get("h"),crop_x:a.get("x"),crop_y:a.get("y"),item_id:a.get("item_id"),object:a.get("object"),type:_.isUndefined(a.get("type"))?"crop":a.get("type"),nonce:a.get("nonces").set}).done(function(e){var t=new v.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status"),c("."+a.get("object")+"-"+e.item_id+"-avatar").each(function(){c(this).prop("src",e.avatar)}),v.Avatar.navItems.get("delete").set({hide:0}),i.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:e.avatar,action:"uploaded"}))}).fail(function(e){var t=BP_Uploader.strings.default_error;_.isUndefined(e)||(t=BP_Uploader.strings.feedback_messages[e.feedback_code]);t=new v.Views.AvatarStatus({value:t,type:"error"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")})},deleteView:function(){var e=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces")),e=new v.Views.DeleteAvatar({model:e});this.views.add({id:"delete",view:e}),e.inject(".bp-avatar")},deleteAvatar:function(a){var e,i=this;_.isUndefined(this.views.get("delete"))||((e=this.views.get("delete")).get("view").remove(),this.views.remove({id:"delete",view:e})),v.ajax.post("bp_avatar_delete",{json:!0,item_id:a.get("item_id"),object:a.get("object"),nonce:a.get("nonces").remove}).done(function(e){var t=new v.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status"),c("."+a.get("object")+"-"+e.item_id+"-avatar").each(function(){c(this).prop("src",e.avatar)}),v.Avatar.navItems.get("delete").set({active:0,hide:1}),i.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:e.avatar,action:"deleted"}))}).fail(function(e){var t=BP_Uploader.strings.default_error;_.isUndefined(e)||(t=BP_Uploader.strings.feedback_messages[e.feedback_code]);t=new v.Views.AvatarStatus({value:t,type:"error"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(e){this.removeWarning(),this.warning=new v.Views.uploaderWarning({value:e}),this.warning.inject(".bp-avatar-status")}},v.Views.Nav=v.View.extend({tagName:"ul",className:"avatar-nav-items",events:{"click .bp-avatar-nav-item":"toggleView"},initialize:function(){1!==_.findWhere(this.collection.models,{id:"delete"}).get("hide")&&v.Avatar.displayWarning(BP_Uploader.strings.has_avatar_warning),_.each(this.collection.models,this.addNavItem,this),this.collection.on("change:hide",this.showHideNavItem,this)},addNavItem:function(e){1!==e.get("hide")&&this.views.add(new v.Views.NavItem({model:e}))},showHideNavItem:function(t){var a=null;_.each(this.views._views[""],function(e){1===e.model.get("hide")&&e.remove(),t.get("id")===e.model.get("id")&&(a=!0)}),_.isBoolean(a)||this.addNavItem(t)},toggleView:function(e){e.preventDefault(),v.Avatar.removeWarning();var t=c(e.target).data("nav");_.each(this.collection.models,function(e){e.id===t?(e.set({active:1}),this.trigger("bp-avatar-view:changed",e.id)):e.set({active:0})},this)}}),v.Views.NavItem=v.View.extend({tagName:"li",className:"avatar-nav-item",template:v.template("bp-avatar-nav"),initialize:function(){1===this.model.get("active")&&(this.el.className+=" current"),this.el.id+="bp-avatar-"+this.model.get("id"),this.model.on("change:active",this.setCurrentNav,this)},setCurrentNav:function(e){1===e.get("active")?this.$el.addClass("current"):this.$el.removeClass("current")}}),v.Views.Avatars=v.View.extend({className:"items",initialize:function(){_.each(this.collection.models,this.addItemView,this)},addItemView:function(e){var t={full_h:150,full_w:150};_.isUndefined(BP_Uploader.settings.crop.full_h)||_.isUndefined(BP_Uploader.settings.crop.full_w)||(t.full_h=BP_Uploader.settings.crop.full_h,t.full_w=BP_Uploader.settings.crop.full_w),e.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces"),t)),this.views.add(new v.Views.Avatar({model:e}))}}),v.Views.Avatar=v.View.extend({className:"item",template:v.template("bp-avatar-item"),events:{"click .avatar-crop-submit":"cropAvatar"},initialize:function(){_.defaults(this.options,{full_h:BP_Uploader.settings.crop.full_h,full_w:BP_Uploader.settings.crop.full_w,aspectRatio:1}),!1!==this.model.get("feedback")&&v.Avatar.displayWarning(this.model.get("feedback")),this.on("ready",this.initCropper)},initCropper:function(){var e,t,a,i,s,n,o=this,r=this.$el.find("#avatar-to-crop img"),d=this.$el.width(),l={};_.isUndefined(this.options.full_h)||_.isUndefined(this.options.full_w)||(this.options.aspectRatio=this.options.full_w/this.options.full_h),l.w=this.model.get("width"),l.h=this.model.get("height"),this.options.full_w+l.w+20<d&&(c("#avatar-to-crop").addClass("adjust"),this.$el.find(".avatar-crop-management").addClass("adjust")),l.h<=l.w?(e=Math.round(l.h/4),t=(s=n=Math.round(l.h/2))+e,i=n+(a=(l.w-n)/2)):(a=Math.round(l.w/4),s=n=Math.round(l.w/2),i=n+a,t=s+(e=(l.h-s)/2)),r.Jcrop({onChange:_.bind(o.showPreview,o),onSelect:_.bind(o.showPreview,o),aspectRatio:o.options.aspectRatio,setSelect:[a,e,i,t]},function(){v.Avatar.jcropapi=this})},cropAvatar:function(e){e.preventDefault(),v.Avatar.setAvatar(this.model)},showPreview:function(e){var t,a;e.w&&e.h&&0<parseInt(e.w,10)&&(t=this.options.full_w,a=this.options.full_h,t=t/e.w,a=a/e.h,this.model.set({x:e.x,y:e.y,w:e.w,h:e.h}),c("#avatar-crop-preview").css({maxWidth:"none",width:Math.round(t*this.model.get("width"))+"px",height:Math.round(a*this.model.get("height"))+"px",marginLeft:"-"+Math.round(t*this.model.get("x"))+"px",marginTop:"-"+Math.round(a*this.model.get("y"))+"px"}))}}),v.Views.AvatarStatus=v.View.extend({tagName:"p",className:"updated",id:"bp-avatar-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),v.Views.DeleteAvatar=v.View.extend({tagName:"div",id:"bp-delete-avatar-container",template:v.template("bp-avatar-delete"),events:{"click #bp-delete-avatar":"deleteAvatar"},deleteAvatar:function(e){e.preventDefault(),v.Avatar.deleteAvatar(this.model)}}),v.Avatar.start())}(window.bp,jQuery);
|
1 |
+
window.bp=window.bp||{},function(c,v){"undefined"!=typeof BP_Uploader&&(c.Models=c.Models||{},c.Collections=c.Collections||{},c.Views=c.Views||{},c.Avatar={start:function(){var e=this;this.removeLegacyUI(),this.views=new Backbone.Collection,this.jcropapi={},this.warning=null,this.setupNav(),this.avatars=c.Uploader.filesUploaded,this.Attachment=new Backbone.Model,this.historicAvatars=null,c.Uploader.filesQueue.on("reset",this.cropView,this),v("body.wp-admin").on("tb_unload","#TB_window",function(){e.resetViews()}),v("body.wp-admin").on("click",".bp-members-avatar-user-edit",function(){e.resetViews()})},removeLegacyUI:function(){v("#avatar-upload-form").length?(v("#avatar-upload").remove(),v("#avatar-upload-form p").remove()):v("#group-settings-form").length?(v("#group-settings-form p").each(function(e){0!==e&&v(this).remove()}),v("#delete-group-avatar-button").length&&v("#delete-group-avatar-button").remove()):v("#group-create-body").length?(v(".main-column p #file").remove(),v(".main-column p #upload").remove()):v("#bp_members_user_admin_avatar a.bp-members-avatar-user-admin").length&&v("#bp_members_user_admin_avatar a.bp-members-avatar-user-admin").remove()},setView:function(e){switch(_.isUndefined(this.views.models)||_.each(this.views.models,function(e){e.get("view").remove()},this),this.views.reset(),_.isUndefined(this.avatars)||this.avatars.reset(),_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),e){case"upload":this.uploaderView();break;case"delete":this.deleteView();break;case"recycle":this.recycleView()}},resetViews:function(){this.nav.trigger("bp-avatar-view:changed","upload"),_.each(this.navItems.models,function(e){"upload"===e.id?e.set({active:1}):e.set({active:0})})},setupNav:function(){var a,i,s=this;this.navItems=new Backbone.Collection,_.each(BP_Uploader.settings.nav,function(e,t){_.isObject(e)&&((i=0)===t&&(a=e.id,i=1),s.navItems.add({id:e.id,name:e.caption,href:"#",active:i,hide:_.isUndefined(e.hide)?0:e.hide}))}),this.nav=new c.Views.Nav({collection:this.navItems}),this.nav.inject(".bp-avatar-nav"),this.setView(a),this.nav.on("bp-avatar-view:changed",_.bind(this.setView,this))},uploaderView:function(){c.Uploader.filesQueue.on("add",this.uploadProgress,this);var e=new c.Views.Uploader;this.views.add({id:"upload",view:e}),e.inject(".bp-avatar")},uploadProgress:function(){var e=new c.Views.uploaderStatus({collection:c.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:e}):this.views.set({id:"status",view:e}),e.inject(".bp-avatar-status")},cropView:function(){var e;_.isEmpty(this.avatars.models)||(_.isUndefined(this.views.get("status"))||((e=this.views.get("status")).get("view").remove(),this.views.remove({id:"status",view:e})),e=new c.Views.Avatars({collection:this.avatars}),this.views.add({id:"crop",view:e}),e.inject(".bp-avatar"))},setAvatar:function(a){var e,i=this;_.isUndefined(this.views.get("crop"))||(_.isEmpty(this.jcropapi)||(this.jcropapi.destroy(),this.jcropapi={}),(e=this.views.get("crop")).get("view").remove(),this.views.remove({id:"crop",view:e})),c.ajax.post("bp_avatar_set",{json:!0,original_file:a.get("url"),crop_w:a.get("w"),crop_h:a.get("h"),crop_x:a.get("x"),crop_y:a.get("y"),item_id:a.get("item_id"),object:a.get("object"),type:_.isUndefined(a.get("type"))?"crop":a.get("type"),nonce:a.get("nonces").set}).done(function(e){var t=new c.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status"),v("."+a.get("object")+"-"+e.item_id+"-avatar").each(function(){v(this).prop("src",e.avatar)}),c.Avatar.navItems.get("delete").set({hide:0}),i.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:e.avatar,action:"uploaded"}))}).fail(function(e){var t=BP_Uploader.strings.default_error;_.isUndefined(e)||(t=BP_Uploader.strings.feedback_messages[e.feedback_code]);t=new c.Views.AvatarStatus({value:t,type:"error"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")})},deleteView:function(){var e=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces")),e=new c.Views.DeleteAvatar({model:e});this.views.add({id:"delete",view:e}),e.inject(".bp-avatar")},deleteAvatar:function(a){var e,i=this;_.isUndefined(this.views.get("delete"))||((e=this.views.get("delete")).get("view").remove(),this.views.remove({id:"delete",view:e})),c.ajax.post("bp_avatar_delete",{json:!0,item_id:a.get("item_id"),object:a.get("object"),nonce:a.get("nonces").remove}).done(function(e){var t=new c.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status"),v("."+a.get("object")+"-"+e.item_id+"-avatar").each(function(){v(this).prop("src",e.avatar)}),c.Avatar.navItems.get("delete").set({active:0,hide:1}),i.Attachment.set(_.extend(_.pick(a.attributes,["object","item_id"]),{url:e.avatar,action:"deleted"}))}).fail(function(e){var t=BP_Uploader.strings.default_error;_.isUndefined(e)||(t=BP_Uploader.strings.feedback_messages[e.feedback_code]);t=new c.Views.AvatarStatus({value:t,type:"error"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(e){this.removeWarning(),this.warning=new c.Views.uploaderWarning({value:e}),this.warning.inject(".bp-avatar-status")},recycleView:function(){this.historicAvatars||(this.historicAvatars=new Backbone.Collection(BP_Uploader.settings.history));var e=new c.Views.RecycleAvatar({collection:this.historicAvatars});this.views.add({id:"recycle",view:e}),e.inject(".bp-avatar")},recycleHistoricAvatar:function(a){var i=this;a.set("selected",!1),c.ajax.post("bp_avatar_recycle_previous",{json:!0,item_id:BP_Uploader.settings.defaults.multipart_params.bp_params.item_id,avatar_id:a.get("id"),object:BP_Uploader.settings.defaults.multipart_params.bp_params.object,nonce:BP_Uploader.settings.historyNonces.recylePrevious}).done(function(e){var t;e.historicalAvatar&&a.collection.add(e.historicalAvatar),a.collection.remove(a),e.feedback_code&&(t=new c.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"}),i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")),v("."+BP_Uploader.settings.defaults.multipart_params.bp_params.object+"-"+e.item_id+"-avatar").each(function(){v(this).prop("src",e.avatar)})}).fail(function(e){var t=BP_Uploader.strings.default_error;e&&e.message&&(t=e.message);t=new c.Views.AvatarStatus({value:t,type:"error"});i.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")})},deletePreviousAvatar:function(t){var a=this;t.set("selected",!1),c.ajax.post("bp_avatar_delete_previous",{json:!0,item_id:BP_Uploader.settings.defaults.multipart_params.bp_params.item_id,avatar_id:t.get("id"),object:BP_Uploader.settings.defaults.multipart_params.bp_params.object,nonce:BP_Uploader.settings.historyNonces.deletePrevious}).done(function(e){t.collection.remove(t),e.feedback_code&&(e=new c.Views.AvatarStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"}),a.views.add({id:"status",view:e}),e.inject(".bp-avatar-status"))}).fail(function(e){var t=BP_Uploader.strings.default_error;e&&e.message&&(t=e.message);t=new c.Views.AvatarStatus({value:t,type:"error"});a.views.add({id:"status",view:t}),t.inject(".bp-avatar-status")})}},c.Views.Nav=c.View.extend({tagName:"ul",className:"avatar-nav-items",events:{"click .bp-avatar-nav-item":"toggleView"},initialize:function(){1!==_.findWhere(this.collection.models,{id:"delete"}).get("hide")&&c.Avatar.displayWarning(BP_Uploader.strings.has_avatar_warning),_.each(this.collection.models,this.addNavItem,this),this.collection.on("change:hide",this.showHideNavItem,this)},addNavItem:function(e){1!==e.get("hide")&&this.views.add(new c.Views.NavItem({model:e}))},showHideNavItem:function(t){var a=null;_.each(this.views._views[""],function(e){1===e.model.get("hide")&&e.remove(),t.get("id")===e.model.get("id")&&(a=!0)}),_.isBoolean(a)||this.addNavItem(t)},toggleView:function(e){e.preventDefault(),c.Avatar.removeWarning();var t=v(e.target).data("nav");_.each(this.collection.models,function(e){e.id===t?(e.set({active:1}),this.trigger("bp-avatar-view:changed",e.id)):e.set({active:0})},this)}}),c.Views.NavItem=c.View.extend({tagName:"li",className:"avatar-nav-item",template:c.template("bp-avatar-nav"),initialize:function(){1===this.model.get("active")&&(this.el.className+=" current"),this.el.id+="bp-avatar-"+this.model.get("id"),this.model.on("change:active",this.setCurrentNav,this)},setCurrentNav:function(e){1===e.get("active")?this.$el.addClass("current"):this.$el.removeClass("current")}}),c.Views.Avatars=c.View.extend({className:"items",initialize:function(){_.each(this.collection.models,this.addItemView,this)},addItemView:function(e){var t={full_h:150,full_w:150};_.isUndefined(BP_Uploader.settings.crop.full_h)||_.isUndefined(BP_Uploader.settings.crop.full_w)||(t.full_h=BP_Uploader.settings.crop.full_h,t.full_w=BP_Uploader.settings.crop.full_w),e.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,"object","item_id","nonces"),t)),this.views.add(new c.Views.Avatar({model:e}))}}),c.Views.Avatar=c.View.extend({className:"item",template:c.template("bp-avatar-item"),events:{"click .avatar-crop-submit":"cropAvatar"},initialize:function(){_.defaults(this.options,{full_h:BP_Uploader.settings.crop.full_h,full_w:BP_Uploader.settings.crop.full_w,aspectRatio:1}),!1!==this.model.get("feedback")&&c.Avatar.displayWarning(this.model.get("feedback")),this.on("ready",this.initCropper)},initCropper:function(){var e,t,a,i,s,n,r=this,o=this.$el.find("#avatar-to-crop img"),d=this.$el.width(),l={};_.isUndefined(this.options.full_h)||_.isUndefined(this.options.full_w)||(this.options.aspectRatio=this.options.full_w/this.options.full_h),l.w=this.model.get("width"),l.h=this.model.get("height"),this.options.full_w+l.w+20<d&&(v("#avatar-to-crop").addClass("adjust"),this.$el.find(".avatar-crop-management").addClass("adjust")),l.h<=l.w?(e=Math.round(l.h/4),t=(s=n=Math.round(l.h/2))+e,i=n+(a=(l.w-n)/2)):(a=Math.round(l.w/4),s=n=Math.round(l.w/2),i=n+a,t=s+(e=(l.h-s)/2)),o.Jcrop({onChange:_.bind(r.showPreview,r),onSelect:_.bind(r.showPreview,r),aspectRatio:r.options.aspectRatio,setSelect:[a,e,i,t]},function(){c.Avatar.jcropapi=this})},cropAvatar:function(e){e.preventDefault(),c.Avatar.setAvatar(this.model)},showPreview:function(e){var t,a;e.w&&e.h&&0<parseInt(e.w,10)&&(t=this.options.full_w,a=this.options.full_h,t=t/e.w,a=a/e.h,this.model.set({x:e.x,y:e.y,w:e.w,h:e.h}),v("#avatar-crop-preview").css({maxWidth:"none",width:Math.round(t*this.model.get("width"))+"px",height:Math.round(a*this.model.get("height"))+"px",marginLeft:"-"+Math.round(t*this.model.get("x"))+"px",marginTop:"-"+Math.round(a*this.model.get("y"))+"px"}))}}),c.Views.AvatarStatus=c.View.extend({tagName:"p",className:"updated",id:"bp-avatar-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),c.Views.DeleteAvatar=c.View.extend({tagName:"div",id:"bp-delete-avatar-container",template:c.template("bp-avatar-delete"),events:{"click #bp-delete-avatar":"deleteAvatar"},deleteAvatar:function(e){e.preventDefault(),c.Avatar.deleteAvatar(this.model)}}),c.Views.HistoryAvatarsItem=c.View.extend({tagName:"tr",className:"historic-avatar",template:c.template("bp-avatar-recycle-history-item"),events:{'change input[name="avatar_id"]':"selectAvatar"},initialize:function(){this.model.on("change:selected",this.toggleSelection,this),this.model.on("remove",this.clearView,this)},toggleSelection:function(e,t){!0===t?this.$el.parent().find("#"+e.get("id")).addClass("selected"):(this.$el.parent().find("#"+e.get("id")).removeClass("selected"),this.$el.parent().find("#avatar_"+e.get("id")).prop("checked",!1))},selectAvatar:function(e){var t;e.preventDefault(),e.currentTarget.checked&&(t=this,_.each(this.model.collection.models,function(e){t.$el.parent().find("#"+e.id).removeClass("selected"),e.set("selected",!1,{silent:!0})}),this.model.set("selected",!0))},clearView:function(){this.views.view.remove()}}),c.Views.RecycleAvatar=c.View.extend({tagName:"div",id:"bp-avatars-history-container",template:c.template("bp-avatar-recycle"),events:{"click button.avatar-history-action":"doAvatarAction"},initialize:function(){_.each(this.collection.models,function(e){this.views.add("#bp-avatars-history-list",new c.Views.HistoryAvatarsItem({model:e}))},this),this.collection.on("change:selected",this.updateButtonStatus,this),this.collection.on("add",this.addView,this)},addView:function(e){this.views.add("#bp-avatars-history-list",new c.Views.HistoryAvatarsItem({model:e}))},updateButtonStatus:function(e){!0===e.get("selected")&&this.$el.find("button.disabled").removeClass("disabled")},doAvatarAction:function(e){e.preventDefault();var t=e.currentTarget.classList,e=this.collection.findWhere({selected:!0});!t.contains("disabled")&&e&&(this.$el.find("button.avatar-history-action").addClass("disabled"),t.contains("recycle")?c.Avatar.recycleHistoricAvatar(e):t.contains("delete")&&c.Avatar.deletePreviousAvatar(e))}}),c.Avatar.start())}(window.bp,jQuery);
|
@@ -1,26 +1,8 @@
|
|
1 |
-
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"
|
2 |
-
|
3 |
-
},{}],"WiqS":[function(require,module,exports) {
|
4 |
-
function e(e,r){for(var o=0;o<r.length;o++){var t=r[o];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function r(r,o,t){return o&&e(r.prototype,o),t&&e(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}module.exports=r,module.exports.__esModule=!0,module.exports.default=module.exports;
|
5 |
-
},{}],"NS7G":[function(require,module,exports) {
|
6 |
-
function e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
7 |
-
},{}],"zqo5":[function(require,module,exports) {
|
8 |
-
function e(o,t){return module.exports=e=Object.setPrototypeOf||function(e,o){return e.__proto__=o,e},module.exports.__esModule=!0,module.exports.default=module.exports,e(o,t)}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
9 |
-
},{}],"RISo":[function(require,module,exports) {
|
10 |
-
var e=require("./setPrototypeOf.js");function o(o,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),t&&e(o,t)}module.exports=o,module.exports.__esModule=!0,module.exports.default=module.exports;
|
11 |
-
},{"./setPrototypeOf.js":"zqo5"}],"xOn8":[function(require,module,exports) {
|
12 |
-
function o(e){return module.exports=o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},module.exports.__esModule=!0,module.exports.default=module.exports,o(e)}module.exports=o,module.exports.__esModule=!0,module.exports.default=module.exports;
|
13 |
-
},{}],"oXYo":[function(require,module,exports) {
|
14 |
-
var e=require("./typeof.js").default,r=require("./assertThisInitialized.js");function o(o,t){if(t&&("object"===e(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return r(o)}module.exports=o,module.exports.__esModule=!0,module.exports.default=module.exports;
|
15 |
-
},{"./typeof.js":"xOn8","./assertThisInitialized.js":"NS7G"}],"goD2":[function(require,module,exports) {
|
16 |
-
function e(o){return module.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},module.exports.__esModule=!0,module.exports.default=module.exports,e(o)}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
17 |
-
},{}],"W80x":[function(require,module,exports) {
|
18 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=o(require("@babel/runtime/helpers/classCallCheck")),t=o(require("@babel/runtime/helpers/createClass")),r=o(require("@babel/runtime/helpers/assertThisInitialized")),a=o(require("@babel/runtime/helpers/inherits")),s=o(require("@babel/runtime/helpers/possibleConstructorReturn")),n=o(require("@babel/runtime/helpers/getPrototypeOf"));function o(e){return e&&e.__esModule?e:{default:e}}function u(e){var t=l();return function(){var r,a=(0,n.default)(e);if(t){var o=(0,n.default)(this).constructor;r=Reflect.construct(a,arguments,o)}else r=a.apply(this,arguments);return(0,s.default)(this,r)}}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}var c=wp,i=c.apiFetch,m=c.components.Popover,p=c.element,h=p.Component,f=p.Fragment,d=p.createElement,b=c.i18n.__,v=c.url.addQueryArgs,_=function(s){(0,a.default)(o,s);var n=u(o);function o(){var t;return(0,e.default)(this,o),(t=n.apply(this,arguments)).state={search:"",items:[],error:""},t.searchItemName=t.searchItemName.bind((0,r.default)(t)),t.selectItemName=t.selectItemName.bind((0,r.default)(t)),t}return(0,t.default)(o,[{key:"searchItemName",value:function(e){var t=this,r=this.state.search,a=this.props,s=a.component,n=a.objectQueryArgs;this.setState({search:e}),e.length<r.length&&this.setState({items:[]});var o="/buddypress/v1/"+s,u={};e&&(u.search=encodeURIComponent(e)),n&&(u=Object.assign(u,n)),i({path:v(o,u)}).then(function(e){t.setState({items:e})},function(e){t.setState({error:e.message})})}},{key:"selectItemName",value:function(e,t){var r=this.props.onSelectItem;return e.preventDefault(),this.setState({search:"",items:[],error:""}),r({itemID:t})}},{key:"render",value:function(){var e,t=this,r=this.state,a=r.search,s=r.items,n=this.props,o=n.ariaLabel,u=n.placeholder,l=n.useAvatar,c=n.slugValue;return o||(o=b("Item's name","buddypress")),u||(u=b("Enter Item's name here…","buddypress")),s.length&&(e=s.map(function(e){return d("button",{type:"button",key:"editor-autocompleters__item-item-"+e.id,role:"option","aria-selected":"true",className:"components-button components-autocomplete__result editor-autocompleters__user",onClick:function(r){return t.selectItemName(r,e.id)}},l&&d("img",{key:"avatar",className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls.thumb.replaceAll("&","&")}),d("span",{key:"name",className:"editor-autocompleters__user-name"},e.name),c&&null!==c(e)&&d("span",{key:"slug",className:"editor-autocompleters__user-slug"},c(e)))})),d(f,null,d("input",{type:"text",value:a,className:"components-placeholder__input","aria-label":o,placeholder:u,onChange:function(e){return t.searchItemName(e.target.value)}}),0!==s.length&&d(m,{className:"components-autocomplete__popover",focusOnMount:!1,position:"bottom left"},d("div",{className:"components-autocomplete__results"},e)))}}]),o}(h),y=_;exports.default=y;
|
19 |
-
},{"@babel/runtime/helpers/classCallCheck":"IC7x","@babel/runtime/helpers/createClass":"WiqS","@babel/runtime/helpers/assertThisInitialized":"NS7G","@babel/runtime/helpers/inherits":"RISo","@babel/runtime/helpers/possibleConstructorReturn":"oXYo","@babel/runtime/helpers/getPrototypeOf":"goD2"}],"fOJU":[function(require,module,exports) {
|
20 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var e=wp,r=e.element.createElement;function t(e){var t=wp.serverSideRender?wp.serverSideRender:wp.editor.ServerSideRender;return r(t,e)}
|
21 |
},{}],"iA92":[function(require,module,exports) {
|
22 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("./autocompleter"))
|
23 |
-
},{"./autocompleter":"W80x"
|
24 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockComponents",{enumerable:!0,get:function(){return e.default}});var e=t(require("./components"));function t(e){return e&&e.__esModule?e:{default:e}}
|
25 |
},{"./components":"iA92"}]},{},["Ee8M"], "bpBlock")
|
26 |
//# sourceMappingURL=/block-components.js.map
|
1 |
+
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"W80x":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{apiFetch:e,components:{Popover:t},element:{Component:s,Fragment:a,createElement:r},i18n:{__:o},url:{addQueryArgs:l}}=wp;class n extends s{constructor(){super(...arguments),this.state={search:"",items:[],error:""},this.searchItemName=this.searchItemName.bind(this),this.selectItemName=this.selectItemName.bind(this)}searchItemName(t){const{search:s}=this.state,{component:a,objectQueryArgs:r}=this.props;this.setState({search:t}),t.length<s.length&&this.setState({items:[]});let o="/buddypress/v1/"+a,n={};t&&(n.search=encodeURIComponent(t)),r&&(n=Object.assign(n,r)),e({path:l(o,n)}).then(e=>{this.setState({items:e})},e=>{this.setState({error:e.message})})}selectItemName(e,t){const{onSelectItem:s}=this.props;return e.preventDefault(),this.setState({search:"",items:[],error:""}),s({itemID:t})}render(){const{search:e,items:s}=this.state;let l,{ariaLabel:n,placeholder:m,useAvatar:c,slugValue:i}=this.props;return n||(n=o("Item's name","buddypress")),m||(m=o("Enter Item's name here…","buddypress")),s.length&&(l=s.map(e=>r("button",{type:"button",key:"editor-autocompleters__item-item-"+e.id,role:"option","aria-selected":"true",className:"components-button components-autocomplete__result editor-autocompleters__user",onClick:t=>this.selectItemName(t,e.id)},c&&r("img",{key:"avatar",className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls.thumb.replaceAll("&","&")}),r("span",{key:"name",className:"editor-autocompleters__user-name"},e.name),i&&null!==i(e)&&r("span",{key:"slug",className:"editor-autocompleters__user-slug"},i(e))))),r(a,null,r("input",{type:"text",value:e,className:"components-placeholder__input","aria-label":n,placeholder:m,onChange:e=>this.searchItemName(e.target.value)}),0!==s.length&&r(t,{className:"components-autocomplete__popover",focusOnMount:!1,position:"bottom left"},r("div",{className:"components-autocomplete__results"},l)))}}var m=n;exports.default=m;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
},{}],"iA92":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("./autocompleter"));function t(e){return e&&e.__esModule?e:{default:e}}var r={AutoCompleter:e.default};exports.default=r;
|
5 |
+
},{"./autocompleter":"W80x"}],"Ee8M":[function(require,module,exports) {
|
6 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockComponents",{enumerable:!0,get:function(){return e.default}});var e=t(require("./components"));function t(e){return e&&e.__esModule?e:{default:e}}
|
7 |
},{"./components":"iA92"}]},{},["Ee8M"], "bpBlock")
|
8 |
//# sourceMappingURL=/block-components.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../../../../node_modules/@babel/runtime/helpers/createClass.js","../../../../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../../../node_modules/@babel/runtime/helpers/inherits.js","../../../../../node_modules/@babel/runtime/helpers/typeof.js","../../../../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","components/autocompleter.js","components/server-side-render.js","components/index.js","block-components.js"],"names":["_classCallCheck","instance","Constructor","TypeError","module","exports","__esModule","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","prototype","_assertThisInitialized","self","ReferenceError","_setPrototypeOf","o","p","setPrototypeOf","__proto__","require","_inherits","subClass","superClass","create","constructor","value","_typeof","obj","Symbol","iterator","assertThisInitialized","_possibleConstructorReturn","call","_getPrototypeOf","getPrototypeOf","AutoCompleter","wp","apiFetch","Popover","components","element","Component","Fragment","createElement","__","i18n","addQueryArgs","url","arguments","state","search","items","error","searchItemName","bind","selectItemName","component","objectQueryArgs","setState","path","queryArgs","encodeURIComponent","assign","then","message","event","itemID","onSelectItem","preventDefault","itemsList","ariaLabel","placeholder","useAvatar","slugValue","map","item","id","avatar_urls","thumb","replaceAll","name","ServerSideRender","CompatibiltyServerSideRender","serverSideRender","editor"],"mappings":"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","file":"block-components.js","sourceRoot":"../../../src/js/bp-core/js/block-components","sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nmodule.exports = _createClass, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\n\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\n\nvar assertThisInitialized = require(\"./assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n\tcomponents: {\n\t\tPopover,\n\t},\n\telement: {\n\t\tComponent,\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\nclass AutoCompleter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t};\n\n\t\tthis.searchItemName = this.searchItemName.bind( this );\n\t\tthis.selectItemName = this.selectItemName.bind( this );\n\t}\n\n\tsearchItemName( value ) {\n\t\tconst { search } = this.state;\n\t\tconst { component, objectQueryArgs } = this.props;\n\t\tthis.setState( { search: value } );\n\n\t\tif ( value.length < search.length ) {\n\t\t\tthis.setState( { items: [] } );\n\t\t}\n\n\t\tlet path= '/buddypress/v1/' + component;\n\t\tlet queryArgs = {};\n\n\t\tif ( value ) {\n\t\t\tqueryArgs.search = encodeURIComponent( value );\n\t\t}\n\n\t\tif ( objectQueryArgs ) {\n\t\t\tqueryArgs = Object.assign( queryArgs, objectQueryArgs );\n\t\t}\n\n\t\tapiFetch( { path: addQueryArgs( path, queryArgs ) } ).then( items => {\n\t\t\tthis.setState( { items: items } );\n\t\t}, error => {\n\t\t\tthis.setState( { error: error.message } );\n\t\t} );\n\t}\n\n\tselectItemName( event, itemID ) {\n\t\tconst { onSelectItem } = this.props;\n\t\tevent.preventDefault();\n\n\t\tthis.setState( {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t} );\n\n\t\treturn onSelectItem( { itemID: itemID } );\n\t}\n\n\trender() {\n\t\tconst { search, items } = this.state;\n\t\tlet { ariaLabel, placeholder, useAvatar, slugValue } = this.props;\n\t\tlet itemsList;\n\n\t\tif ( ! ariaLabel ) {\n\t\t\tariaLabel = __( 'Item\\'s name', 'buddypress' );\n\t\t}\n\n\t\tif ( ! placeholder ) {\n\t\t\tplaceholder = __( 'Enter Item\\'s name here…', 'buddypress' );\n\t\t}\n\n\t\tif ( items.length ) {\n\t\t\titemsList = items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\" key={ 'editor-autocompleters__item-item-' + item.id }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected=\"true\"\n\t\t\t\t\t\tclassName=\"components-button components-autocomplete__result editor-autocompleters__user\"\n\t\t\t\t\t\tonClick={ ( event ) => this.selectItemName( event, item.id ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ useAvatar && (\n\t\t\t\t\t\t\t<img key=\"avatar\" className=\"editor-autocompleters__user-avatar\" alt=\"\" src={ item.avatar_urls.thumb.replaceAll( '&', '&' ) } />\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<span key=\"name\" className=\"editor-autocompleters__user-name\">{ item.name }</span>\n\n\t\t\t\t\t\t{ slugValue && null !== slugValue( item ) && (\n\t\t\t\t\t\t\t<span key=\"slug\" className=\"editor-autocompleters__user-slug\">{ slugValue( item ) }</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tonChange={ ( event ) => this.searchItemName( event.target.value ) }\n\t\t\t\t/>\n\t\t\t\t{ 0 !== items.length &&\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\t\tposition=\"bottom left\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"components-autocomplete__results\">\n\t\t\t\t\t\t\t{ itemsList }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t);\n\t}\n}\n\nexport default AutoCompleter;\n","/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\n/**\n * Compatibility Server Side Render.\n *\n * @since 9.0.0\n */\n export default function ServerSideRender( props ) {\n\tconst CompatibiltyServerSideRender = wp.serverSideRender ? wp.serverSideRender : wp.editor.ServerSideRender;\n\n\treturn (\n\t\t<CompatibiltyServerSideRender { ...props } />\n\t);\n}\n","/**\n * BuddyPress components.\n */\nimport AutoCompleter from './autocompleter';\nimport ServerSideRender from './server-side-render';\n\nexport default {\n\tAutoCompleter,\n\tServerSideRender,\n};\n","export { default as blockComponents } from './components';\n"]}
|
1 |
+
{"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../../../../node_modules/@babel/runtime/helpers/createClass.js","../../../../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../../../node_modules/@babel/runtime/helpers/inherits.js","../../../../../node_modules/@babel/runtime/helpers/typeof.js","../../../../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","components/autocompleter.js","components/server-side-render.js","components/index.js","block-components.js"],"names":["AutoCompleter","wp","apiFetch","Popover","components","element","Component","Fragment","createElement","__","i18n","addQueryArgs","url","arguments","state","search","items","error","searchItemName","bind","selectItemName","value","props","component","objectQueryArgs","setState","length","path","queryArgs","encodeURIComponent","Object","assign","then","message","event","itemID","onSelectItem","preventDefault","itemsList","ariaLabel","placeholder","useAvatar","slugValue","map","item","id","avatar_urls","thumb","replaceAll","name","target","ServerSideRender","CompatibiltyServerSideRender","serverSideRender","editor"],"mappings":"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","file":"block-components.js","sourceRoot":"../../../src/js/bp-core/js/block-components","sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n\tcomponents: {\n\t\tPopover,\n\t},\n\telement: {\n\t\tComponent,\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\nclass AutoCompleter extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t};\n\n\t\tthis.searchItemName = this.searchItemName.bind( this );\n\t\tthis.selectItemName = this.selectItemName.bind( this );\n\t}\n\n\tsearchItemName( value ) {\n\t\tconst { search } = this.state;\n\t\tconst { component, objectQueryArgs } = this.props;\n\t\tthis.setState( { search: value } );\n\n\t\tif ( value.length < search.length ) {\n\t\t\tthis.setState( { items: [] } );\n\t\t}\n\n\t\tlet path= '/buddypress/v1/' + component;\n\t\tlet queryArgs = {};\n\n\t\tif ( value ) {\n\t\t\tqueryArgs.search = encodeURIComponent( value );\n\t\t}\n\n\t\tif ( objectQueryArgs ) {\n\t\t\tqueryArgs = Object.assign( queryArgs, objectQueryArgs );\n\t\t}\n\n\t\tapiFetch( { path: addQueryArgs( path, queryArgs ) } ).then( items => {\n\t\t\tthis.setState( { items: items } );\n\t\t}, error => {\n\t\t\tthis.setState( { error: error.message } );\n\t\t} );\n\t}\n\n\tselectItemName( event, itemID ) {\n\t\tconst { onSelectItem } = this.props;\n\t\tevent.preventDefault();\n\n\t\tthis.setState( {\n\t\t\tsearch: '',\n\t\t\titems: [],\n\t\t\terror: '',\n\t\t} );\n\n\t\treturn onSelectItem( { itemID: itemID } );\n\t}\n\n\trender() {\n\t\tconst { search, items } = this.state;\n\t\tlet { ariaLabel, placeholder, useAvatar, slugValue } = this.props;\n\t\tlet itemsList;\n\n\t\tif ( ! ariaLabel ) {\n\t\t\tariaLabel = __( 'Item\\'s name', 'buddypress' );\n\t\t}\n\n\t\tif ( ! placeholder ) {\n\t\t\tplaceholder = __( 'Enter Item\\'s name here…', 'buddypress' );\n\t\t}\n\n\t\tif ( items.length ) {\n\t\t\titemsList = items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\" key={ 'editor-autocompleters__item-item-' + item.id }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected=\"true\"\n\t\t\t\t\t\tclassName=\"components-button components-autocomplete__result editor-autocompleters__user\"\n\t\t\t\t\t\tonClick={ ( event ) => this.selectItemName( event, item.id ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ useAvatar && (\n\t\t\t\t\t\t\t<img key=\"avatar\" className=\"editor-autocompleters__user-avatar\" alt=\"\" src={ item.avatar_urls.thumb.replaceAll( '&', '&' ) } />\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<span key=\"name\" className=\"editor-autocompleters__user-name\">{ item.name }</span>\n\n\t\t\t\t\t\t{ slugValue && null !== slugValue( item ) && (\n\t\t\t\t\t\t\t<span key=\"slug\" className=\"editor-autocompleters__user-slug\">{ slugValue( item ) }</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</button>\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tonChange={ ( event ) => this.searchItemName( event.target.value ) }\n\t\t\t\t/>\n\t\t\t\t{ 0 !== items.length &&\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\t\tposition=\"bottom left\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"components-autocomplete__results\">\n\t\t\t\t\t\t\t{ itemsList }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Popover>\n\t\t\t\t}\n\t\t\t</Fragment>\n\t\t);\n\t}\n}\n\nexport default AutoCompleter;\n","/**\n * WordPress dependencies.\n */\nconst {\n\telement: {\n\t\tcreateElement,\n\t},\n} = wp;\n\n/**\n * Compatibility Server Side Render.\n *\n * @since 9.0.0\n */\n export default function ServerSideRender( props ) {\n\tconst CompatibiltyServerSideRender = wp.serverSideRender ? wp.serverSideRender : wp.editor.ServerSideRender;\n\n\treturn (\n\t\t<CompatibiltyServerSideRender { ...props } />\n\t);\n}\n","/**\n * BuddyPress components.\n */\nimport AutoCompleter from './autocompleter';\nimport ServerSideRender from './server-side-render';\n\nexport default {\n\tAutoCompleter,\n\tServerSideRender,\n};\n","export { default as blockComponents } from './components';\n"]}
|
@@ -1,41 +1,22 @@
|
|
1 |
-
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"
|
2 |
-
|
3 |
-
},{}],"LoeL":[function(require,module,exports) {
|
4 |
-
function l(l,e){var r=null==l?null:"undefined"!=typeof Symbol&&l[Symbol.iterator]||l["@@iterator"];if(null!=r){var t,o,u=[],n=!0,a=!1;try{for(r=r.call(l);!(n=(t=r.next()).done)&&(u.push(t.value),!e||u.length!==e);n=!0);}catch(d){a=!0,o=d}finally{try{n||null==r.return||r.return()}finally{if(a)throw o}}return u}}module.exports=l,module.exports.__esModule=!0,module.exports.default=module.exports;
|
5 |
-
},{}],"jEQo":[function(require,module,exports) {
|
6 |
-
function e(e,o){(null==o||o>e.length)&&(o=e.length);for(var l=0,r=new Array(o);l<o;l++)r[l]=e[l];return r}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
7 |
-
},{}],"Dbv9":[function(require,module,exports) {
|
8 |
-
var r=require("./arrayLikeToArray.js");function e(e,t){if(e){if("string"==typeof e)return r(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(e,t):void 0}}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
9 |
-
},{"./arrayLikeToArray.js":"jEQo"}],"MWEO":[function(require,module,exports) {
|
10 |
-
function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
11 |
-
},{}],"DERy":[function(require,module,exports) {
|
12 |
-
var e=require("./arrayWithHoles.js"),r=require("./iterableToArrayLimit.js"),o=require("./unsupportedIterableToArray.js"),t=require("./nonIterableRest.js");function u(u,s){return e(u)||r(u,s)||o(u,s)||t()}module.exports=u,module.exports.__esModule=!0,module.exports.default=module.exports;
|
13 |
-
},{"./arrayWithHoles.js":"DCTP","./iterableToArrayLimit.js":"LoeL","./unsupportedIterableToArray.js":"Dbv9","./nonIterableRest.js":"MWEO"}],"Ih1j":[function(require,module,exports) {
|
14 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.STORE_KEY=void 0;var e="bp/core";exports.STORE_KEY=e;
|
15 |
},{}],"DDtj":[function(require,module,exports) {
|
16 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=void 0;
|
17 |
},{}],"gg2v":[function(require,module,exports) {
|
18 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;
|
19 |
},{}],"NTbX":[function(require,module,exports) {
|
20 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.
|
21 |
-
},{"./action-types":"gg2v"}],"
|
22 |
-
var
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=s;var e=r(require("@babel/runtime/regenerator")),t=require("./actions");function r(e){return e&&e.__esModule?e:{default:e}}var n=e.default.mark(s);function s(){var r;return e.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,t.fetchFromAPI)("/buddypress/v1/components?status=active",!0);case 2:return r=e.sent,e.next=5,(0,t.getActiveComponents)(r);case 5:case"end":return e.stop()}},n)}
|
28 |
-
},{"@babel/runtime/regenerator":"BxGn","./actions":"NTbX"}],"cQfh":[function(require,module,exports) {
|
29 |
-
function e(e,o,r){return o in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}module.exports=e,module.exports.__esModule=!0,module.exports.default=module.exports;
|
30 |
-
},{}],"yrui":[function(require,module,exports) {
|
31 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("@babel/runtime/helpers/defineProperty")),t=require("./action-types");function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(r){(0,e.default)(t,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}var c={components:[]},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case t.TYPES.GET_ACTIVE_COMPONENTS:return o(o({},e),{},{components:r.list})}return e},u=i;exports.default=u;
|
32 |
-
},{"@babel/runtime/helpers/defineProperty":"cQfh","./action-types":"gg2v"}],"KdPQ":[function(require,module,exports) {
|
33 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.controls=void 0;var e=wp,r=e.apiFetch,t={FETCH_FROM_API:function(e){var t=e.path,o=e.parse;return r({path:t,parse:o})}};exports.controls=t;
|
34 |
},{}],"QFc2":[function(require,module,exports) {
|
35 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.BP_CORE_STORE_KEY=void 0;var e=require("./constants"),r=
|
36 |
},{"./constants":"Ih1j","./selectors":"DDtj","./actions":"NTbX","./resolvers":"SaI5","./reducers":"yrui","./controls":"KdPQ"}],"qcHp":[function(require,module,exports) {
|
37 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.
|
38 |
-
},{"
|
39 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("./utils"));function t(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(t=function(e){return e?n:r})(e)}function r(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=t(r);if(n&&n.has(e))return n.get(e);var o={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=u?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}var n={isActive:e.default,activityTypes:e.activityTypes,loggedInUser:e.loggedInUser,postAuhor:e.postAuhor,currentPostId:e.currentPostId,getCurrentWidgetsSidebar:e.getCurrentWidgetsSidebar};exports.default=n;
|
40 |
},{"./utils":"qcHp"}],"tYf0":[function(require,module,exports) {
|
41 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockData",{enumerable:!0,get:function(){return e.default}});var e=t(require("./data"));function t(e){return e&&e.__esModule?e:{default:e}}
|
1 |
+
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Ih1j":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.STORE_KEY=void 0;const e="bp/core";exports.STORE_KEY="bp/core";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
},{}],"DDtj":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=void 0;const e=e=>e.components||[];exports.getActiveComponents=e;
|
5 |
},{}],"gg2v":[function(require,module,exports) {
|
6 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;const e={GET_ACTIVE_COMPONENTS:"GET_ACTIVE_COMPONENTS",FETCH_FROM_API:"FETCH_FROM_API"};exports.TYPES=e;
|
7 |
},{}],"NTbX":[function(require,module,exports) {
|
8 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=t,exports.fetchFromAPI=r;var e=require("./action-types");function t(t){return{type:e.TYPES.GET_ACTIVE_COMPONENTS,list:t}}function r(t,r){return{type:e.TYPES.FETCH_FROM_API,path:t,parse:r}}
|
9 |
+
},{"./action-types":"gg2v"}],"SaI5":[function(require,module,exports) {
|
10 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveComponents=t;var e=require("./actions");function*t(){const t=yield(0,e.fetchFromAPI)("/buddypress/v1/components?status=active",!0);yield(0,e.getActiveComponents)(t)}
|
11 |
+
},{"./actions":"NTbX"}],"yrui":[function(require,module,exports) {
|
12 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./action-types");const t={components:[]},r=(r=t,s)=>{switch(s.type){case e.TYPES.GET_ACTIVE_COMPONENTS:return{...r,components:s.list}}return r};var s=r;exports.default=s;
|
13 |
+
},{"./action-types":"gg2v"}],"KdPQ":[function(require,module,exports) {
|
14 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.controls=void 0;const{apiFetch:e}=wp,t={FETCH_FROM_API:({path:t,parse:o})=>e({path:t,parse:o})};exports.controls=t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
},{}],"QFc2":[function(require,module,exports) {
|
16 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.BP_CORE_STORE_KEY=void 0;var e=require("./constants"),r=c(require("./selectors")),t=c(require("./actions")),o=c(require("./resolvers")),n=s(require("./reducers")),u=require("./controls");function s(e){return e&&e.__esModule?e:{default:e}}function a(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,t=new WeakMap;return(a=function(e){return e?t:r})(e)}function c(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a(r);if(t&&t.has(e))return t.get(e);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var s=n?Object.getOwnPropertyDescriptor(e,u):null;s&&(s.get||s.set)?Object.defineProperty(o,u,s):o[u]=e[u]}return o.default=e,t&&t.set(e,o),o}const{data:{registerStore:i}}=wp;i(e.STORE_KEY,{reducer:n.default,actions:t,selectors:r,controls:u.controls,resolvers:o});const l=e.STORE_KEY;exports.BP_CORE_STORE_KEY=l;var f=l;exports.default=f;
|
17 |
},{"./constants":"Ih1j","./selectors":"DDtj","./actions":"NTbX","./resolvers":"SaI5","./reducers":"yrui","./controls":"KdPQ"}],"qcHp":[function(require,module,exports) {
|
18 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isActive=s,exports.activityTypes=i,exports.loggedInUser=c,exports.postAuhor=d,exports.currentPostId=a,exports.getCurrentWidgetsSidebar=f,exports.default=void 0;var e=t(require("./register"));function t(e){return e&&e.__esModule?e:{default:e}}const{data:{useSelect:r}}=wp,{find:n,get:o}=lodash;function s(t,s=""){const u=r(t=>t(e.default).getActiveComponents(),[]),i=n(u,["name",t]);return s?o(i,["features",s]):!!i}var u=s;function i(){const t=r(t=>t(e.default).getActiveComponents(),[]),s=n(t,["name","activity"]);if(!s)return[];const u=o(s,["features","types"]);let i=[];return Object.entries(u).forEach(([e,t])=>{i.push({label:t,value:e})}),i}function c(){return r(e=>{return e("core")?e("core").getCurrentUser():{}},[])}function d(){return r(e=>{const t=e("core/editor"),r=e("core");if(t&&r){const e=t.getCurrentPostAttribute("author"),o=r.getAuthors();return n(o,["id",e])}return{}},[])}function a(){return r(e=>{const t=e("core/editor");return t?t.getCurrentPostId():0},[])}function f(e=""){return r(t=>{const r=t("core/block-editor"),o=t("core/edit-widgets");if(e&&o&&r){const t=r.getBlocks(),o=r.getBlockParents(e);let s=[];return t.forEach(({clientId:e,attributes:t})=>{s.push({id:t.id,isCurrent:-1!==o.indexOf(e)})}),n(s,["isCurrent",!0])}return{}},[])}exports.default=u;
|
19 |
+
},{"./register":"QFc2"}],"xHVY":[function(require,module,exports) {
|
20 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=r(require("./utils"));function t(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(t=function(e){return e?n:r})(e)}function r(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=t(r);if(n&&n.has(e))return n.get(e);var o={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=u?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=e[i]}return o.default=e,n&&n.set(e,o),o}var n={isActive:e.default,activityTypes:e.activityTypes,loggedInUser:e.loggedInUser,postAuhor:e.postAuhor,currentPostId:e.currentPostId,getCurrentWidgetsSidebar:e.getCurrentWidgetsSidebar};exports.default=n;
|
21 |
},{"./utils":"qcHp"}],"tYf0":[function(require,module,exports) {
|
22 |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"blockData",{enumerable:!0,get:function(){return e.default}});var e=t(require("./data"));function t(e){return e&&e.__esModule?e:{default:e}}
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","data/constants.js","data/selectors.js","data/action-types.js","data/actions.js","../../../../../node_modules/regenerator-runtime/runtime.js","../../../../../node_modules/@babel/runtime/regenerator/index.js","data/resolvers.js","../../../../../node_modules/@babel/runtime/helpers/defineProperty.js","data/reducers.js","data/controls.js","data/register.js","data/utils.js","data/index.js","block-data.js"],"names":["_arrayWithHoles","arr","Array","isArray","module","exports","__esModule","_iterableToArrayLimit","i","_i","Symbol","iterator","_arr","_s","_e","_n","_d","call","next","done","push","value","length","err","_arrayLikeToArray","len","arr2","arrayLikeToArray","require","_unsupportedIterableToArray","o","minLen","n","Object","prototype","toString","slice","constructor","name","from","test","_nonIterableRest","TypeError","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","_slicedToArray","STORE_KEY","getActiveComponents","state","components","TYPES","GET_ACTIVE_COMPONENTS","FETCH_FROM_API","list","type","types","fetchFromAPI","path","parse","_defineProperty","obj","key","defineProperty","enumerable","configurable","writable","reducer","DEFAULT_STATE","action","wp","apiFetch","controls","BP_CORE_STORE_KEY","registerStore","data","actions","selectors","resolvers","useSelect","lodash","find","get","isActive","component","feature","select","activeComponent","activityTypes","activityComponent","activityTypesList","entries","forEach","label","loggedInUser","store","getCurrentUser","postAuhor","editorStore","coreStore","postAuthorId","getCurrentPostAttribute","authorsList","getAuthors","currentPostId","getCurrentPostId","getCurrentWidgetsSidebar","widgetClientId","currentWidgetsSidebar","blockEditorStore","widgetsStore","areas","getBlocks","parents","getBlockParents","sidebars","clientId","attributes","id","isCurrent","indexOf"],"mappings":"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","file":"block-data.js","sourceRoot":"../../../src/js/bp-core/js/block-assets","sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayWithHoles = require(\"./arrayWithHoles.js\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableRest = require(\"./nonIterableRest.js\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/**\n * Identifier key for BP Core store reducer.\n *\n * @type {string}\n */\nexport const STORE_KEY = 'bp/core';\n","/**\n * Returns the list of Active BP Components.\n *\n * @param {Object} state The current state.\n * @return {array} The list of Active BP Components.\n */\nexport const getActiveComponents = ( state ) => {\n\treturn state.components || [];\n};\n","\n/**\n * Action types.\n *\n * @type {Object}\n */\nexport const TYPES = {\n\tGET_ACTIVE_COMPONENTS: 'GET_ACTIVE_COMPONENTS',\n\tFETCH_FROM_API: 'FETCH_FROM_API',\n};\n","/**\n * Internal dependencies.\n */\nimport { TYPES as types } from './action-types';\n\n/**\n * Returns the list of active components.\n *\n * @return {Object} Object for action.\n */\n export function getActiveComponents( list ) {\n\treturn {\n\t\ttype: types.GET_ACTIVE_COMPONENTS,\n\t\tlist,\n\t};\n}\n\n/**\n * Returns an action object used to fetch something from the API.\n *\n * @param {string} path Endpoint path.\n * @param {boolean} parse Should we parse the request.\n * @return {Object} Object for action.\n */\nexport function fetchFromAPI( path, parse ) {\n\treturn {\n\t\ttype: types.FETCH_FROM_API,\n\t\tpath,\n\t\tparse,\n\t};\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Internal dependencies.\n */\nimport {\n\tfetchFromAPI,\n\tgetActiveComponents as getActiveComponentsList,\n} from './actions';\n\n/**\n * Resolver for retrieving active BP Components.\n */\nexport function* getActiveComponents() {\n\tconst list = yield fetchFromAPI(\n\t\t'/buddypress/v1/components?status=active',\n\t\ttrue\n\t);\n\tyield getActiveComponentsList( list );\n}\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/**\n * Internal dependencies\n */\nimport { TYPES as types } from './action-types';\n\n/**\n * Default state.\n */\nconst DEFAULT_STATE = {\n\tcomponents: [],\n};\n\n/**\n * Reducer for the BuddyPress data store.\n *\n * @param {Object} state The current state in the store.\n * @param {Object} action Action object.\n *\n * @return {Object} New or existing state.\n */\nconst reducer = ( state = DEFAULT_STATE, action ) => {\n\tswitch ( action.type ) {\n\t\tcase types.GET_ACTIVE_COMPONENTS:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcomponents: action.list,\n\t\t\t};\n\t}\n\n\treturn state;\n};\n\nexport default reducer;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n} = wp;\n\n/**\n * Default export for registering the controls with the store.\n *\n * @return {Object} An object with the controls to register with the store on\n * the controls property of the registration object.\n */\nexport const controls = {\n\tFETCH_FROM_API( { path, parse } ) {\n\t\treturn apiFetch( { path, parse } );\n\t},\n};\n","/**\n * WordPress dependencies.\n */\nconst {\n\tdata: {\n\t\tregisterStore,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport { STORE_KEY } from './constants';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as resolvers from './resolvers';\nimport reducer from './reducers';\nimport { controls } from './controls';\n\nregisterStore( STORE_KEY, {\n\treducer,\n\tactions,\n\tselectors,\n\tcontrols,\n\tresolvers,\n} );\n\nexport const BP_CORE_STORE_KEY = STORE_KEY;\n\nexport default BP_CORE_STORE_KEY;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tdata: {\n\t\tuseSelect,\n\t},\n} = wp;\n\n/**\n * External dependencies.\n */\nconst {\n\tfind,\n\tget,\n} = lodash;\n\n/**\n * Internal dependencies.\n */\nimport BP_CORE_STORE_KEY from './register';\n\n/**\n * Checks whether a component or the feature of an active component is enabled.\n *\n * @since 9.0.0\n *\n * @param {string} component (required) The component to check.\n * @param {string} feature (optional) The feature to check.\n * @return {boolean} Whether a component or the feature of an active component is enabled.\n */\nexport function isActive( component, feature = '' ) {\n\tconst components = useSelect( ( select ) => {\n\t\treturn select( BP_CORE_STORE_KEY ).getActiveComponents();\n\t}, [] );\n\n\tconst activeComponent = find( components, ['name', component] );\n\n\tif ( ! feature ) {\n\t\treturn !! activeComponent;\n\t}\n\n\treturn get( activeComponent, [ 'features', feature ] );\n}\n\nexport default isActive;\n\n/**\n * Checks whether a component or the feature of an active component is enabled.\n *\n * @since 9.0.0\n *\n * @return {array} An array of objects keyed by activity types.\n */\n export function activityTypes() {\n\tconst components = useSelect( ( select ) => {\n\t\treturn select( BP_CORE_STORE_KEY ).getActiveComponents();\n\t}, [] );\n\n\tconst activityComponent = find( components, ['name', 'activity'] );\n\n\tif ( ! activityComponent ) {\n\t\treturn [];\n\t}\n\n\tconst activityTypes = get( activityComponent, [ 'features', 'types' ] );\n\tlet activityTypesList = [];\n\n\tObject.entries( activityTypes ).forEach( ( [ type, label ] ) => {\n\t\tactivityTypesList.push(\n\t\t\t{\n\t\t\t\tlabel: label,\n\t\t\t\tvalue: type,\n\t\t\t}\n\t\t)\n\t} );\n\n\treturn activityTypesList;\n}\n\n/**\n * Returns the logged in user object.\n *\n * @since 9.0.0\n *\n * @return {Object} The logged in user object.\n */\nexport function loggedInUser() {\n\tconst loggedInUser = useSelect( ( select ) => {\n\t\tconst store = select( 'core' );\n\n\t\tif ( store ) {\n\t\t\treturn select( 'core' ).getCurrentUser();\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn loggedInUser;\n}\n\n/**\n * Returns the post author user object.\n *\n * @since 9.0.0\n *\n * @return {Object} The post author user object.\n */\nexport function postAuhor() {\n\tconst postAuhor = useSelect( ( select ) => {\n\t\tconst editorStore = select( 'core/editor' );\n\t\tconst coreStore = select( 'core' );\n\n\t\tif ( editorStore && coreStore ) {\n\t\t\tconst postAuthorId = editorStore.getCurrentPostAttribute( 'author' );\n\t\t\tconst authorsList = coreStore.getAuthors();\n\n\t\t\treturn find( authorsList, ['id', postAuthorId] );\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn postAuhor;\n}\n\n/**\n * Returns the current post ID.\n *\n * @since 9.0.0\n *\n * @return {integer} The current post ID.\n */\nexport function currentPostId() {\n\tconst currentPostId = useSelect( ( select ) => {\n\t\tconst store = select( 'core/editor' );\n\n\t\tif ( store ) {\n\t\t\treturn store.getCurrentPostId();\n\t\t}\n\n\t\treturn 0;\n\t}, [] );\n\n\treturn currentPostId;\n}\n\n/**\n * Get the current sidebar of a Widget Block.\n *\n * @since 9.0.0\n *\n * @param {string} widgetClientId clientId of the sidebar widget.\n * @return {object} An object containing the sidebar Id.\n */\nexport function getCurrentWidgetsSidebar( widgetClientId = '' ) {\n\tconst currentWidgetsSidebar = useSelect( ( select ) => {\n\t\tconst blockEditorStore = select( 'core/block-editor' );\n\t\tconst widgetsStore = select( 'core/edit-widgets' );\n\n\t\tif ( widgetClientId && widgetsStore && blockEditorStore ) {\n\t\t\tconst areas = blockEditorStore.getBlocks();\n\t\t\tconst parents = blockEditorStore.getBlockParents( widgetClientId );\n\t\t\tlet sidebars = [];\n\n\t\t\tareas.forEach( ( { clientId, attributes } ) => {\n\t\t\t\tsidebars.push( {\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tisCurrent: -1 !== parents.indexOf( clientId ),\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\treturn find( sidebars, ['isCurrent', true ] );\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn currentWidgetsSidebar;\n}\n","// Data.\nimport isActive, { activityTypes, loggedInUser, postAuhor, currentPostId, getCurrentWidgetsSidebar } from './utils';\n\nexport default {\n\tisActive,\n\tactivityTypes,\n\tloggedInUser,\n\tpostAuhor,\n\tcurrentPostId,\n\tgetCurrentWidgetsSidebar,\n};\n","export { default as blockData } from './data';\n"]}
|
1 |
+
{"version":3,"sources":["../../../../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../../../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../../../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../../../../node_modules/@babel/runtime/helpers/slicedToArray.js","data/constants.js","data/selectors.js","data/action-types.js","data/actions.js","../../../../../node_modules/regenerator-runtime/runtime.js","../../../../../node_modules/@babel/runtime/regenerator/index.js","data/resolvers.js","../../../../../node_modules/@babel/runtime/helpers/defineProperty.js","data/reducers.js","data/controls.js","data/register.js","data/utils.js","data/index.js","block-data.js"],"names":["STORE_KEY","getActiveComponents","state","components","TYPES","GET_ACTIVE_COMPONENTS","FETCH_FROM_API","list","type","types","fetchFromAPI","path","parse","reducer","DEFAULT_STATE","action","wp","apiFetch","controls","BP_CORE_STORE_KEY","registerStore","data","actions","selectors","resolvers","useSelect","lodash","find","get","isActive","component","feature","select","activeComponent","activityTypes","activityComponent","activityTypesList","Object","entries","forEach","label","push","value","loggedInUser","store","getCurrentUser","postAuhor","editorStore","coreStore","postAuthorId","getCurrentPostAttribute","authorsList","getAuthors","currentPostId","getCurrentPostId","getCurrentWidgetsSidebar","widgetClientId","currentWidgetsSidebar","blockEditorStore","widgetsStore","areas","getBlocks","parents","getBlockParents","sidebars","clientId","attributes","id","isCurrent","indexOf"],"mappings":"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","file":"block-data.js","sourceRoot":"../../../src/js/bp-core/js/block-assets","sourcesContent":["function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;","var arrayLikeToArray = require(\"./arrayLikeToArray\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(n);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/**\n * Identifier key for BP Core store reducer.\n *\n * @type {string}\n */\nexport const STORE_KEY = 'bp/core';\n","/**\n * Returns the list of Active BP Components.\n *\n * @param {Object} state The current state.\n * @return {array} The list of Active BP Components.\n */\nexport const getActiveComponents = ( state ) => {\n\treturn state.components || [];\n};\n","\n/**\n * Action types.\n *\n * @type {Object}\n */\nexport const TYPES = {\n\tGET_ACTIVE_COMPONENTS: 'GET_ACTIVE_COMPONENTS',\n\tFETCH_FROM_API: 'FETCH_FROM_API',\n};\n","/**\n * Internal dependencies.\n */\nimport { TYPES as types } from './action-types';\n\n/**\n * Returns the list of active components.\n *\n * @return {Object} Object for action.\n */\n export function getActiveComponents( list ) {\n\treturn {\n\t\ttype: types.GET_ACTIVE_COMPONENTS,\n\t\tlist,\n\t};\n}\n\n/**\n * Returns an action object used to fetch something from the API.\n *\n * @param {string} path Endpoint path.\n * @param {boolean} parse Should we parse the request.\n * @return {Object} Object for action.\n */\nexport function fetchFromAPI( path, parse ) {\n\treturn {\n\t\ttype: types.FETCH_FROM_API,\n\t\tpath,\n\t\tparse,\n\t};\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Internal dependencies.\n */\nimport {\n\tfetchFromAPI,\n\tgetActiveComponents as getActiveComponentsList,\n} from './actions';\n\n/**\n * Resolver for retrieving active BP Components.\n */\nexport function* getActiveComponents() {\n\tconst list = yield fetchFromAPI(\n\t\t'/buddypress/v1/components?status=active',\n\t\ttrue\n\t);\n\tyield getActiveComponentsList( list );\n}\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","/**\n * Internal dependencies\n */\nimport { TYPES as types } from './action-types';\n\n/**\n * Default state.\n */\nconst DEFAULT_STATE = {\n\tcomponents: [],\n};\n\n/**\n * Reducer for the BuddyPress data store.\n *\n * @param {Object} state The current state in the store.\n * @param {Object} action Action object.\n *\n * @return {Object} New or existing state.\n */\nconst reducer = ( state = DEFAULT_STATE, action ) => {\n\tswitch ( action.type ) {\n\t\tcase types.GET_ACTIVE_COMPONENTS:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcomponents: action.list,\n\t\t\t};\n\t}\n\n\treturn state;\n};\n\nexport default reducer;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tapiFetch,\n} = wp;\n\n/**\n * Default export for registering the controls with the store.\n *\n * @return {Object} An object with the controls to register with the store on\n * the controls property of the registration object.\n */\nexport const controls = {\n\tFETCH_FROM_API( { path, parse } ) {\n\t\treturn apiFetch( { path, parse } );\n\t},\n};\n","/**\n * WordPress dependencies.\n */\nconst {\n\tdata: {\n\t\tregisterStore,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport { STORE_KEY } from './constants';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as resolvers from './resolvers';\nimport reducer from './reducers';\nimport { controls } from './controls';\n\nregisterStore( STORE_KEY, {\n\treducer,\n\tactions,\n\tselectors,\n\tcontrols,\n\tresolvers,\n} );\n\nexport const BP_CORE_STORE_KEY = STORE_KEY;\n\nexport default BP_CORE_STORE_KEY;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tdata: {\n\t\tuseSelect,\n\t},\n} = wp;\n\n/**\n * External dependencies.\n */\nconst {\n\tfind,\n\tget,\n} = lodash;\n\n/**\n * Internal dependencies.\n */\nimport BP_CORE_STORE_KEY from './register';\n\n/**\n * Checks whether a component or the feature of an active component is enabled.\n *\n * @since 9.0.0\n *\n * @param {string} component (required) The component to check.\n * @param {string} feature (optional) The feature to check.\n * @return {boolean} Whether a component or the feature of an active component is enabled.\n */\nexport function isActive( component, feature = '' ) {\n\tconst components = useSelect( ( select ) => {\n\t\treturn select( BP_CORE_STORE_KEY ).getActiveComponents();\n\t}, [] );\n\n\tconst activeComponent = find( components, ['name', component] );\n\n\tif ( ! feature ) {\n\t\treturn !! activeComponent;\n\t}\n\n\treturn get( activeComponent, [ 'features', feature ] );\n}\n\nexport default isActive;\n\n/**\n * Checks whether a component or the feature of an active component is enabled.\n *\n * @since 9.0.0\n *\n * @return {array} An array of objects keyed by activity types.\n */\n export function activityTypes() {\n\tconst components = useSelect( ( select ) => {\n\t\treturn select( BP_CORE_STORE_KEY ).getActiveComponents();\n\t}, [] );\n\n\tconst activityComponent = find( components, ['name', 'activity'] );\n\n\tif ( ! activityComponent ) {\n\t\treturn [];\n\t}\n\n\tconst activityTypes = get( activityComponent, [ 'features', 'types' ] );\n\tlet activityTypesList = [];\n\n\tObject.entries( activityTypes ).forEach( ( [ type, label ] ) => {\n\t\tactivityTypesList.push(\n\t\t\t{\n\t\t\t\tlabel: label,\n\t\t\t\tvalue: type,\n\t\t\t}\n\t\t)\n\t} );\n\n\treturn activityTypesList;\n}\n\n/**\n * Returns the logged in user object.\n *\n * @since 9.0.0\n *\n * @return {Object} The logged in user object.\n */\nexport function loggedInUser() {\n\tconst loggedInUser = useSelect( ( select ) => {\n\t\tconst store = select( 'core' );\n\n\t\tif ( store ) {\n\t\t\treturn select( 'core' ).getCurrentUser();\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn loggedInUser;\n}\n\n/**\n * Returns the post author user object.\n *\n * @since 9.0.0\n *\n * @return {Object} The post author user object.\n */\nexport function postAuhor() {\n\tconst postAuhor = useSelect( ( select ) => {\n\t\tconst editorStore = select( 'core/editor' );\n\t\tconst coreStore = select( 'core' );\n\n\t\tif ( editorStore && coreStore ) {\n\t\t\tconst postAuthorId = editorStore.getCurrentPostAttribute( 'author' );\n\t\t\tconst authorsList = coreStore.getAuthors();\n\n\t\t\treturn find( authorsList, ['id', postAuthorId] );\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn postAuhor;\n}\n\n/**\n * Returns the current post ID.\n *\n * @since 9.0.0\n *\n * @return {integer} The current post ID.\n */\nexport function currentPostId() {\n\tconst currentPostId = useSelect( ( select ) => {\n\t\tconst store = select( 'core/editor' );\n\n\t\tif ( store ) {\n\t\t\treturn store.getCurrentPostId();\n\t\t}\n\n\t\treturn 0;\n\t}, [] );\n\n\treturn currentPostId;\n}\n\n/**\n * Get the current sidebar of a Widget Block.\n *\n * @since 9.0.0\n *\n * @param {string} widgetClientId clientId of the sidebar widget.\n * @return {object} An object containing the sidebar Id.\n */\nexport function getCurrentWidgetsSidebar( widgetClientId = '' ) {\n\tconst currentWidgetsSidebar = useSelect( ( select ) => {\n\t\tconst blockEditorStore = select( 'core/block-editor' );\n\t\tconst widgetsStore = select( 'core/edit-widgets' );\n\n\t\tif ( widgetClientId && widgetsStore && blockEditorStore ) {\n\t\t\tconst areas = blockEditorStore.getBlocks();\n\t\t\tconst parents = blockEditorStore.getBlockParents( widgetClientId );\n\t\t\tlet sidebars = [];\n\n\t\t\tareas.forEach( ( { clientId, attributes } ) => {\n\t\t\t\tsidebars.push( {\n\t\t\t\t\tid: attributes.id,\n\t\t\t\t\tisCurrent: -1 !== parents.indexOf( clientId ),\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\treturn find( sidebars, ['isCurrent', true ] );\n\t\t}\n\n\t\treturn {};\n\t}, [] );\n\n\treturn currentWidgetsSidebar;\n}\n","// Data.\nimport isActive, { activityTypes, loggedInUser, postAuhor, currentPostId, getCurrentWidgetsSidebar } from './utils';\n\nexport default {\n\tisActive,\n\tactivityTypes,\n\tloggedInUser,\n\tpostAuhor,\n\tcurrentPostId,\n\tgetCurrentWidgetsSidebar,\n};\n","export { default as blockData } from './data';\n"]}
|
@@ -1,8 +1,8 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"ploe":[function(require,module,exports) {
|
2 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
3 |
},{}],"RDNZ":[function(require,module,exports) {
|
4 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
5 |
},{}],"A1QM":[function(require,module,exports) {
|
6 |
-
"use strict";var r
|
7 |
},{"./login-form/edit":"ploe","./login-form/transforms":"RDNZ"}]},{},["A1QM"], null)
|
8 |
//# sourceMappingURL=/bp-core/js/blocks/login-form.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"ploe":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blockEditor:{InspectorControls:e},components:{Disabled:t,PanelBody:l,TextControl:o,ToggleControl:n},element:{Fragment:r,createElement:s},i18n:{__:i},serverSideRender:d}=wp,u=({attributes:u,setAttributes:a})=>{const{title:b,forgotPwdLink:p}=u;return s(r,null,s(e,null,s(l,{title:i("Settings","buddypress"),initialOpen:!0},s(o,{label:i("Title","buddypress"),value:b,onChange:e=>{a({title:e})}}),s(n,{label:i("Include the link to reset the user password","buddypress"),checked:!!p,onChange:()=>{a({forgotPwdLink:!p})}}))),s(t,null,s(d,{block:"bp/login-form",attributes:u})))};var a=u;exports.default=a;
|
3 |
},{}],"RDNZ":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blocks:{createBlock:e}}=wp,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!(null==t||!t.raw)&&"bp_core_login_widget"===e,transform:({instance:t})=>e("bp/login-form",{title:t.raw.title})}]};var o=t;exports.default=o;
|
5 |
},{}],"A1QM":[function(require,module,exports) {
|
6 |
+
"use strict";var o=r(require("./login-form/edit")),e=r(require("./login-form/transforms"));function r(o){return o&&o.__esModule?o:{default:o}}const{blocks:{registerBlockType:t},i18n:{__:i}}=wp;t("bp/login-form",{title:i("Login Form","buddypress"),description:i("Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"admin-users"},category:"buddypress",attributes:{title:{type:"string",default:""},forgotPwdLink:{type:"boolean",default:!1}},edit:o.default,transforms:e.default});
|
7 |
},{"./login-form/edit":"ploe","./login-form/transforms":"RDNZ"}]},{},["A1QM"], null)
|
8 |
//# sourceMappingURL=/bp-core/js/blocks/login-form.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["bp-core/js/blocks/login-form/edit.js","bp-core/js/blocks/login-form/transforms.js","bp-core/js/blocks/login-form.js"],"names":["editLoginForm","
|
1 |
+
{"version":3,"sources":["bp-core/js/blocks/login-form/edit.js","bp-core/js/blocks/login-form/transforms.js","bp-core/js/blocks/login-form.js"],"names":["editLoginForm","blockEditor","InspectorControls","components","Disabled","PanelBody","TextControl","ToggleControl","element","Fragment","createElement","i18n","__","serverSideRender","ServerSideRender","wp","attributes","setAttributes","title","forgotPwdLink","text","transforms","blocks","createBlock","from","type","isMatch","idBase","instance","raw","transform","registerBlockType","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAqDeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAlDf,MACCC,aAAa,kBACZC,GAEDC,YAAY,SACXC,EADW,UAEXC,EAFW,YAGXC,EAHW,cAIXC,GAEDC,SAAS,SACRC,EADQ,cAERC,GAEDC,MAAM,GACLC,GAEDC,iBAAkBC,GACfC,GAEEf,EAAgB,EAAIgB,WAAAA,EAAYC,cAAAA,MAC/B,MAAA,MAAEC,EAAF,cAAQC,GAAkBH,EAG/B,OAAA,EAAC,EACA,KAAA,EAAC,EACA,KAAA,EAAC,EAAD,CAAW,MAAQJ,EAAI,WAAY,cAAiB,aAAc,GACjE,EAAC,EAAD,CACC,MAAQA,EAAI,QAAS,cACrB,MAAQM,EACR,SAAaE,IACZH,EAAe,CAAEC,MAAOE,OAG1B,EAAC,EAAD,CACC,MAAQR,EAAI,8CAA+C,cAC3D,UAAaO,EACb,SAAW,KACVF,EAAe,CAAEE,eAAiBA,SAKtC,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,gBAAgB,WAAaH,OAM1ChB,IAAAA,EAAAA,EAAAA,QAAAA,QAAAA;;AClBAqB,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAhCd,MACAC,QAAQ,YACPC,IAEER,GAOEM,EAAa,CAClBG,KAAM,CACL,CACCC,KAAM,QACNH,OAAQ,CAAE,sBACVI,QAAS,EAAIC,OAAAA,EAAQC,SAAAA,OACbA,MAAAA,IAAAA,EAAUC,MAIC,yBAAXF,EAERG,UAAW,EAAIF,SAAAA,KACPL,EAAa,gBAAiB,CACpCL,MAAOU,EAASC,IAAIX,WAOVG,IAAAA,EAAAA,EAAAA,QAAAA,QAAAA;;ACjBf,aAHA,IAAA,EAAA,EAAA,QAAA,sBACA,EAAA,EAAA,QAAA,4BAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,MACCC,QAAQ,kBACPS,GAEDpB,MAAM,GACLC,IAEEG,GAQJgB,EAAmB,gBAAiB,CACnCb,MAAON,EAAI,aAAc,cACzBoB,YAAapB,EAAI,4FAA6F,cAC9GqB,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,eAENC,SAAU,aACVrB,WAAY,CACXE,MAAO,CACNO,KAAM,SACNa,QAAS,IAEVnB,cAAe,CACdM,KAAM,UACNa,SAAS,IAGXC,KAAMvC,EAnB6B,QAoBnCqB,WAAYA,EAAAA","file":"login-form.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tTextControl,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tserverSideRender: ServerSideRender,\n} = wp;\n\nconst editLoginForm = ( { attributes, setAttributes } ) => {\n\tconst { title,forgotPwdLink } = attributes;\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( text ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: text } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Include the link to reset the user password', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! forgotPwdLink }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { forgotPwdLink: ! forgotPwdLink } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/login-form\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editLoginForm;\n","/**\n * WordPress dependencies.\n */\n const {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Login Form Widget to Login Form Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_login_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/login-form', {\n\t\t\t\t\ttitle: instance.raw.title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editLoginForm from './login-form/edit';\nimport transforms from './login-form/transforms';\n\nregisterBlockType( 'bp/login-form', {\n\ttitle: __( 'Login Form', 'buddypress' ),\n\tdescription: __( 'Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'admin-users',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\tforgotPwdLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tedit: editLoginForm,\n\ttransforms: transforms,\n} );\n"]}
|
@@ -1,8 +1,8 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Sw79":[function(require,module,exports) {
|
2 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
3 |
},{}],"uKqo":[function(require,module,exports) {
|
4 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
5 |
},{}],"ygAa":[function(require,module,exports) {
|
6 |
-
"use strict";var
|
7 |
},{"./primary-nav/edit":"Sw79","./primary-nav/transforms":"uKqo"}]},{},["ygAa"], null)
|
8 |
//# sourceMappingURL=/bp-core/js/blocks/primary-nav.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Sw79":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blockEditor:{InspectorControls:e},components:{Disabled:t,Notice:s,PanelBody:i,ToggleControl:r},element:{Fragment:d,createElement:l},i18n:{__:n},serverSideRender:a}=wp,{blockData:{getCurrentWidgetsSidebar:o}}=bp,u=({attributes:u,setAttributes:b,clientId:p})=>{const{displayTitle:c}=u,y=o(p);return y&&y.id&&-1!==["sidebar-buddypress-members","sidebar-buddypress-groups"].indexOf(y.id)?l(s,{status:"error",isDismissible:!1},l("p",null,n("The BuddyPress Primary Navigation block shouldn't be used into this widget area. Please remove it.","buddypress"))):l(d,null,l(e,null,l(i,{title:n("Settings","buddypress"),initialOpen:!0},l(r,{label:n("Include navigation title","buddypress"),checked:!!c,onChange:()=>{b({displayTitle:!c})}}))),l(t,null,l(a,{block:"bp/primary-nav",attributes:u})))};var b=u;exports.default=b;
|
3 |
},{}],"uKqo":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blocks:{createBlock:e}}=wp,t={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!(null==t||!t.raw)&&"bp_nouveau_sidebar_object_nav_widget"===e,transform:({instance:t})=>e("bp/primary-nav",{displayTitle:t.raw.bp_nouveau_widget_title})}]};var a=t;exports.default=a;
|
5 |
},{}],"ygAa":[function(require,module,exports) {
|
6 |
+
"use strict";var e=t(require("./primary-nav/edit")),r=t(require("./primary-nav/transforms"));function t(e){return e&&e.__esModule?e:{default:e}}const{blocks:{registerBlockType:i},i18n:{__:s}}=wp;i("bp/primary-nav",{title:s("Primary navigation","buddypress"),description:s("Displays BuddyPress primary nav in the sidebar of your site. Make sure to use it as the first widget of the sidebar and only once.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-community"},category:"buddypress",attributes:{displayTitle:{type:"boolean",default:!0}},edit:e.default,transforms:r.default});
|
7 |
},{"./primary-nav/edit":"Sw79","./primary-nav/transforms":"uKqo"}]},{},["ygAa"], null)
|
8 |
//# sourceMappingURL=/bp-core/js/blocks/primary-nav.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["bp-core/js/blocks/primary-nav/edit.js","bp-core/js/blocks/primary-nav/transforms.js","bp-core/js/blocks/primary-nav.js"],"names":["editPrimaryNavBlock","
|
1 |
+
{"version":3,"sources":["bp-core/js/blocks/primary-nav/edit.js","bp-core/js/blocks/primary-nav/transforms.js","bp-core/js/blocks/primary-nav.js"],"names":["editPrimaryNavBlock","blockEditor","InspectorControls","components","Disabled","Notice","PanelBody","ToggleControl","element","Fragment","createElement","i18n","__","serverSideRender","ServerSideRender","wp","blockData","getCurrentWidgetsSidebar","bp","attributes","setAttributes","clientId","displayTitle","currentSidebar","id","indexOf","transforms","blocks","createBlock","from","type","isMatch","idBase","instance","raw","transform","bp_nouveau_widget_title","registerBlockType","title","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAmEeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAhEf,MACCC,aAAa,kBACZC,GAEDC,YAAY,SACXC,EADW,OAEXC,EAFW,UAGXC,EAHW,cAIXC,GAEDC,SAAS,SACRC,EADQ,cAERC,GAEDC,MAAM,GACLC,GAEDC,iBAAkBC,GACfC,IAMHC,WAAW,yBACVC,IAEEC,GAEElB,EAAsB,EAAImB,WAAAA,EAAYC,cAAAA,EAAeC,SAAAA,MACpD,MAAA,aAAEC,GAAiBH,EACnBI,EAAiBN,EAA0BI,GAG5CE,OAAAA,GAAkBA,EAAeC,KAAO,IAFpB,CAAC,6BAA8B,6BAEYC,QAASF,EAAeC,IAE1F,EAAC,EAAD,CAAQ,OAAO,QAAQ,eAAgB,GACtC,EACGZ,IAAAA,KAAAA,EAAI,qGAAuG,gBAOhH,EAAC,EACA,KAAA,EAAC,EACA,KAAA,EAAC,EAAD,CAAW,MAAQA,EAAI,WAAY,cAAiB,aAAc,GACjE,EAAC,EAAD,CACC,MAAQA,EAAI,2BAA4B,cACxC,UAAaU,EACb,SAAW,KACVF,EAAe,CAAEE,cAAgBA,SAKrC,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,iBAAiB,WAAaH,OAM3CnB,IAAAA,EAAAA,EAAAA,QAAAA,QAAAA;;AChCA0B,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAhCd,MACAC,QAAQ,YACPC,IAEEb,GAOEW,EAAa,CAClBG,KAAM,CACL,CACCC,KAAM,QACNH,OAAQ,CAAE,sBACVI,QAAS,EAAIC,OAAAA,EAAQC,SAAAA,OACbA,MAAAA,IAAAA,EAAUC,MAIC,yCAAXF,EAERG,UAAW,EAAIF,SAAAA,KACPL,EAAa,iBAAkB,CACrCN,aAAcW,EAASC,IAAIE,6BAOjBV,IAAAA,EAAAA,EAAAA,QAAAA,QAAAA;;ACjBf,aAHA,IAAA,EAAA,EAAA,QAAA,uBACA,EAAA,EAAA,QAAA,6BAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,MACCC,QAAQ,kBACPU,GAED1B,MAAM,GACLC,IAEEG,GAQJsB,EAAmB,iBAAkB,CACpCC,MAAO1B,EAAI,qBAAsB,cACjC2B,YAAa3B,EAAI,qIAAsI,cACvJ4B,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,uBAENC,SAAU,aACVzB,WAAY,CACXG,aAAc,CACbQ,KAAM,UACNe,SAAS,IAGXC,KAAM9C,EAf8B,QAgBpC0B,WAAYA,EAAAA","file":"primary-nav.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tNotice,\n\t\tPanelBody,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tserverSideRender: ServerSideRender,\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockData: {\n\t\tgetCurrentWidgetsSidebar,\n\t}\n} = bp;\n\nconst editPrimaryNavBlock = ( { attributes, setAttributes, clientId } ) => {\n\tconst { displayTitle } = attributes;\n\tconst currentSidebar = getCurrentWidgetsSidebar( clientId );\n\tconst disabledSidebars = ['sidebar-buddypress-members', 'sidebar-buddypress-groups'];\n\n\tif ( currentSidebar && currentSidebar.id && -1 !== disabledSidebars.indexOf( currentSidebar.id ) ) {\n\t\treturn (\n\t\t\t<Notice status=\"error\" isDismissible={ false }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __( 'The BuddyPress Primary Navigation block shouldn\\'t be used into this widget area. Please remove it.', 'buddypress' ) }\n\t\t\t\t</p>\n\t\t\t</Notice>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Include navigation title', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! displayTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { displayTitle: ! displayTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/primary-nav\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editPrimaryNavBlock;\n","/**\n * WordPress dependencies.\n */\n const {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Primary Nav Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_nouveau_sidebar_object_nav_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/primary-nav', {\n\t\t\t\t\tdisplayTitle: instance.raw.bp_nouveau_widget_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editPrimaryNavBlock from './primary-nav/edit';\nimport transforms from './primary-nav/transforms';\n\nregisterBlockType( 'bp/primary-nav', {\n\ttitle: __( 'Primary navigation', 'buddypress' ),\n\tdescription: __( 'Displays BuddyPress primary nav in the sidebar of your site. Make sure to use it as the first widget of the sidebar and only once.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-community',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\tdisplayTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t},\n\tedit: editPrimaryNavBlock,\n\ttransforms: transforms,\n} );\n"]}
|
@@ -2,12 +2,13 @@
|
|
2 |
* jQuery.ajax wrapper for BP REST API requests.
|
3 |
*
|
4 |
* @since 5.0.0
|
|
|
5 |
* @output bp-core/js/bp-api-request.js
|
6 |
*/
|
7 |
/* global bpApiSettings */
|
8 |
window.bp = window.bp || {};
|
9 |
|
10 |
-
( function( wp, bp
|
11 |
// Bail if not set.
|
12 |
if ( typeof bpApiSettings === 'undefined' ) {
|
13 |
return;
|
@@ -15,39 +16,17 @@ window.bp = window.bp || {};
|
|
15 |
|
16 |
bp.isRestEnabled = true;
|
17 |
|
18 |
-
// Polyfill wp.apiRequest
|
19 |
bp.apiRequest = function( options ) {
|
|
|
|
|
20 |
var bpRequest;
|
21 |
|
22 |
if ( ! options.dataType ) {
|
23 |
options.dataType = 'json';
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
if ( wp.apiRequest ) {
|
28 |
-
bpRequest = wp.apiRequest( options );
|
29 |
-
|
30 |
-
// WordPress is < 4.9.0.
|
31 |
-
} else {
|
32 |
-
var url = bpApiSettings.root;
|
33 |
-
|
34 |
-
if ( options.path ) {
|
35 |
-
url = url + options.path.replace( /^\//, '' );
|
36 |
-
}
|
37 |
-
|
38 |
-
if ( ! options.url ) {
|
39 |
-
options.url = url;
|
40 |
-
}
|
41 |
-
|
42 |
-
// Add The nonce only when needed.
|
43 |
-
if ( -1 !== options.url.indexOf( url ) ) {
|
44 |
-
options.beforeSend = function( xhr ) {
|
45 |
-
xhr.setRequestHeader( 'X-WP-Nonce', bpApiSettings.nonce );
|
46 |
-
};
|
47 |
-
}
|
48 |
-
|
49 |
-
bpRequest = $.ajax( options );
|
50 |
-
}
|
51 |
|
52 |
return bpRequest.then( null, function( result ) {
|
53 |
var errorObject = {
|
@@ -66,4 +45,4 @@ window.bp = window.bp || {};
|
|
66 |
} );
|
67 |
};
|
68 |
|
69 |
-
} )( window.wp || {}, window.bp
|
2 |
* jQuery.ajax wrapper for BP REST API requests.
|
3 |
*
|
4 |
* @since 5.0.0
|
5 |
+
* @deprecated 10.0.0
|
6 |
* @output bp-core/js/bp-api-request.js
|
7 |
*/
|
8 |
/* global bpApiSettings */
|
9 |
window.bp = window.bp || {};
|
10 |
|
11 |
+
( function( wp, bp ) {
|
12 |
// Bail if not set.
|
13 |
if ( typeof bpApiSettings === 'undefined' ) {
|
14 |
return;
|
16 |
|
17 |
bp.isRestEnabled = true;
|
18 |
|
19 |
+
// Polyfill wp.apiRequest.
|
20 |
bp.apiRequest = function( options ) {
|
21 |
+
window.console.log( bpApiSettings.deprecatedWarning );
|
22 |
+
|
23 |
var bpRequest;
|
24 |
|
25 |
if ( ! options.dataType ) {
|
26 |
options.dataType = 'json';
|
27 |
}
|
28 |
|
29 |
+
bpRequest = wp.apiRequest( options );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
return bpRequest.then( null, function( result ) {
|
32 |
var errorObject = {
|
45 |
} );
|
46 |
};
|
47 |
|
48 |
+
} )( window.wp || {}, window.bp );
|
@@ -1 +1 @@
|
|
1 |
-
window.bp=window.bp||{},function(
|
1 |
+
window.bp=window.bp||{},function(n,e){"undefined"!=typeof bpApiSettings&&(e.isRestEnabled=!0,e.apiRequest=function(e){return window.console.log(bpApiSettings.deprecatedWarning),e.dataType||(e.dataType="json"),n.apiRequest(e).then(null,function(e){var n={code:"unexpected_error",message:bpApiSettings.unexpectedError,data:{status:404}};return n=e&&e.responseJSON?e.responseJSON:n})})}(window.wp||{},window.bp);
|
@@ -80,7 +80,7 @@ window.bp = window.bp || {};
|
|
80 |
* checked during the upload process to eventually adapt the resized avatar.
|
81 |
*/
|
82 |
if ( 'bp_avatar_upload' === uploader.settings.multipart_params.action ) {
|
83 |
-
|
84 |
}
|
85 |
|
86 |
if ( uploader.features.dragdrop && ! self.params.browser.mobile ) {
|
80 |
* checked during the upload process to eventually adapt the resized avatar.
|
81 |
*/
|
82 |
if ( 'bp_avatar_upload' === uploader.settings.multipart_params.action ) {
|
83 |
+
uploader.settings.multipart_params.bp_params.ui_available_width = container.width();
|
84 |
}
|
85 |
|
86 |
if ( uploader.features.dragdrop && ! self.params.browser.mobile ) {
|
@@ -193,25 +193,31 @@ window.bp = window.bp || {};
|
|
193 |
},
|
194 |
|
195 |
uploadResult: function( model ) {
|
196 |
-
var
|
197 |
|
198 |
if ( ! _.isUndefined( model.get( 'url' ) ) ) {
|
|
|
199 |
|
200 |
// Image is too small.
|
201 |
-
if ( 0 ===
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
}
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
// Update the header of the page.
|
217 |
$( '#header-cover-image' ).css( {
|
193 |
},
|
194 |
|
195 |
uploadResult: function( model ) {
|
196 |
+
var feedbackCode, feedbackViews = [];
|
197 |
|
198 |
if ( ! _.isUndefined( model.get( 'url' ) ) ) {
|
199 |
+
feedbackCode = model.get( 'feedback_code' );
|
200 |
|
201 |
// Image is too small.
|
202 |
+
if ( 0 === feedbackCode ) {
|
203 |
+
feedbackCode = 1;
|
204 |
+
feedbackViews.push(
|
205 |
+
new bp.Views.CoverImageStatus( {
|
206 |
+
value : BP_Uploader.strings.cover_image_warnings.dimensions,
|
207 |
+
type : 'warning'
|
208 |
+
} )
|
209 |
+
);
|
210 |
}
|
211 |
|
212 |
+
feedbackViews.unshift(
|
213 |
+
new bp.Views.CoverImageStatus( {
|
214 |
+
value : BP_Uploader.strings.feedback_messages[ feedbackCode ],
|
215 |
+
type : 'success'
|
216 |
+
} )
|
217 |
+
);
|
218 |
+
|
219 |
+
// Success, Rock n roll!
|
220 |
+
this.views.set( '.bp-uploader-progress', feedbackViews );
|
221 |
|
222 |
// Update the header of the page.
|
223 |
$( '#header-cover-image' ).css( {
|
@@ -1 +1 @@
|
|
1 |
-
window.bp=window.bp||{},function(a,n){"undefined"!=typeof BP_Uploader&&(a.Models=a.Models||{},a.Collections=a.Collections||{},a.Views=a.Views||{},a.CoverImage={start:function(){this.views=new Backbone.Collection,this.warning=null,this.Attachment=new Backbone.Model,this.uploaderView(),this.displayWarning(BP_Uploader.strings.cover_image_warnings.dimensions),!0===BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image&&this.deleteView()},uploaderView:function(){a.Uploader.filesQueue.on("add",this.uploadProgress,this);var e=new a.Views.Uploader;this.views.add({id:"upload",view:e}),e.inject(".bp-cover-image")},uploadProgress:function(){var e=new a.Views.coverImageUploadProgress({collection:a.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:e}):this.views.set({id:"status",view:e}),e.inject(".bp-cover-image-status")},deleteView:function(){var e=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id","nonces"]));_.isUndefined(this.views.get("delete"))&&(e=new a.Views.DeleteCoverImage({model:e}),this.views.add({id:"delete",view:e}),e.inject(".bp-cover-image-manage"))},deleteCoverImage:function(
|
1 |
+
window.bp=window.bp||{},function(a,n){"undefined"!=typeof BP_Uploader&&(a.Models=a.Models||{},a.Collections=a.Collections||{},a.Views=a.Views||{},a.CoverImage={start:function(){this.views=new Backbone.Collection,this.warning=null,this.Attachment=new Backbone.Model,this.uploaderView(),this.displayWarning(BP_Uploader.strings.cover_image_warnings.dimensions),!0===BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image&&this.deleteView()},uploaderView:function(){a.Uploader.filesQueue.on("add",this.uploadProgress,this);var e=new a.Views.Uploader;this.views.add({id:"upload",view:e}),e.inject(".bp-cover-image")},uploadProgress:function(){var e=new a.Views.coverImageUploadProgress({collection:a.Uploader.filesQueue});_.isUndefined(this.views.get("status"))?this.views.add({id:"status",view:e}):this.views.set({id:"status",view:e}),e.inject(".bp-cover-image-status")},deleteView:function(){var e=new Backbone.Model(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id","nonces"]));_.isUndefined(this.views.get("delete"))&&(e=new a.Views.DeleteCoverImage({model:e}),this.views.add({id:"delete",view:e}),e.inject(".bp-cover-image-manage"))},deleteCoverImage:function(i){var e,s=this;_.isUndefined(this.views.get("delete"))||((e=this.views.get("delete")).get("view").remove(),this.views.remove({id:"delete",view:e})),a.ajax.post("bp_cover_image_delete",{json:!0,item_id:i.get("item_id"),object:i.get("object"),nonce:i.get("nonces").remove}).done(function(e){var t=new a.Views.CoverImageStatus({value:BP_Uploader.strings.feedback_messages[e.feedback_code],type:"success"});s.views.add({id:"status",view:t}),t.inject(".bp-cover-image-status"),""===e.reset_url?n("#header-cover-image").css({"background-image":"none"}):n("#header-cover-image").css({"background-image":"url( "+e.reset_url+" )"}),BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image=!1,s.Attachment.set(_.extend(_.pick(i.attributes,["object","item_id"]),{url:e.reset_url,action:"deleted"}))}).fail(function(e){var t=BP_Uploader.strings.default_error;_.isUndefined(e)||(t=BP_Uploader.strings.feedback_messages[e.feedback_code]);t=new a.Views.CoverImageStatus({value:t,type:"error"});s.views.add({id:"status",view:t}),t.inject(".bp-cover-image-status"),a.CoverImage.deleteView()})},removeWarning:function(){_.isNull(this.warning)||this.warning.remove()},displayWarning:function(e){this.removeWarning(),this.warning=new a.Views.uploaderWarning({value:e}),this.warning.inject(".bp-cover-image-status")}},a.Views.coverImageUploadProgress=a.Views.uploaderStatus.extend({className:"files",initialize:function(){a.Views.uploaderStatus.prototype.initialize.apply(this,arguments),this.collection.on("change:url",this.uploadResult,this)},uploadResult:function(e){var t,i=[];_.isUndefined(e.get("url"))||(0===(t=e.get("feedback_code"))&&(t=1,i.push(new a.Views.CoverImageStatus({value:BP_Uploader.strings.cover_image_warnings.dimensions,type:"warning"}))),i.unshift(new a.Views.CoverImageStatus({value:BP_Uploader.strings.feedback_messages[t],type:"success"})),this.views.set(".bp-uploader-progress",i),n("#header-cover-image").css({"background-image":"url( "+e.get("url")+" )"}),a.CoverImage.deleteView(),a.CoverImage.Attachment.set(_.extend(_.pick(BP_Uploader.settings.defaults.multipart_params.bp_params,["object","item_id"]),{url:e.get("url"),action:"uploaded"})))}}),a.Views.CoverImageStatus=a.View.extend({tagName:"p",className:"updated",id:"bp-cover-image-feedback",initialize:function(){this.el.className+=" "+this.options.type,this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),a.Views.DeleteCoverImage=a.View.extend({tagName:"div",id:"bp-delete-cover-image-container",template:a.template("bp-cover-image-delete"),events:{"click #bp-delete-cover-image":"deleteCoverImage"},deleteCoverImage:function(e){e.preventDefault(),a.CoverImage.deleteCoverImage(this.model)}}),a.CoverImage.start())}(window.bp,jQuery);
|
@@ -1,4 +1,4 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"eNhW":[function(require,module,exports) {
|
2 |
-
|
3 |
},{}]},{},["eNhW"], null)
|
4 |
//# sourceMappingURL=/bp-core/js/dynamic-widget-block.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"eNhW":[function(require,module,exports) {
|
2 |
+
const{url:{addQueryArgs:t}}=wp,{template:s}=lodash;window.bp=window.bp||{},bp.dynamicWidgetBlock=class{constructor(t,s){const{path:e,root:o,nonce:i}=t;this.path=e,this.root=o,this.nonce=i,this.blocks=s,this.blocks.forEach((t,s)=>{const{type:e}=t.query_args||"active",{body:o}=t.preloaded||[];this.blocks[s].items={active:[],newest:[],popular:[],alphabetical:[]},!this.blocks[s].items[e].length&&o&&o.length&&(this.blocks[s].items[e]=o)})}useTemplate(t){return s(document.querySelector("#tmpl-"+t).innerHTML,{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"})}loop(){}getItems(s="active",e=0){this.blocks[e].query_args.type=s,this.blocks[e].items[s].length?this.loop(this.blocks[e].items[s],this.blocks[e].selector,s):fetch(t(this.root+this.path,this.blocks[e].query_args),{method:"GET",headers:{"X-WP-Nonce":this.nonce}}).then(t=>t.json()).then(t=>{this.blocks[e].items[s]=t,this.loop(this.blocks[e].items[s],this.blocks[e].selector,s)})}};
|
3 |
},{}]},{},["eNhW"], null)
|
4 |
//# sourceMappingURL=/bp-core/js/dynamic-widget-block.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["bp-core/js/dynamic-widget-block.js"],"names":["wp","addQueryArgs","url","lodash","template","window","bp","dynamicWidgetBlock","settings","blocks","path","root","nonce","forEach","block","i","type","query_args","body","preloaded","items","length","tmpl","document","querySelector","innerHTML","evaluate","interpolate","escape","variable","blockIndex","loop","selector","fetch","method","headers","then","response","json","data"],"mappings":";AAwBA,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,UAAA,IAAA,EAAA,UAAA,GAAA,OAAA,eAAA,EAAA,EAAA,IAAA,IAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,GAAA,EAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,GAAA,
|
1 |
+
{"version":3,"sources":["bp-core/js/dynamic-widget-block.js"],"names":["wp","addQueryArgs","url","lodash","template","window","bp","dynamicWidgetBlock","settings","blocks","path","root","nonce","forEach","block","i","type","query_args","body","preloaded","items","length","tmpl","document","querySelector","innerHTML","evaluate","interpolate","escape","variable","blockIndex","loop","selector","fetch","method","headers","then","response","json","data"],"mappings":";AAwBA,SAAA,EAAA,EAAA,GAAA,KAAA,aAAA,GAAA,MAAA,IAAA,UAAA,qCAAA,SAAA,EAAA,EAAA,GAAA,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,OAAA,IAAA,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,UAAA,IAAA,EAAA,UAAA,GAAA,OAAA,eAAA,EAAA,EAAA,IAAA,IAAA,SAAA,EAAA,EAAA,EAAA,GAAA,OAAA,GAAA,EAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,GAAA,EArBA,IAIIA,EAAAA,GAFFC,EADDC,EAAAA,IACCD,aASEE,EAAAA,OADHC,EAAAA,EAAAA,SAIDC,OAAOC,GAAKD,OAAOC,IAAM,GAOzBA,GAAGC,mBAAH,WACcC,SAAAA,EAAAA,EAAUC,GAAS,IAAA,EAAA,KAAA,EAAA,KAAA,GACvBC,IAAAA,EAAsBF,EAAtBE,KAAMC,EAAgBH,EAAhBG,KAAMC,EAAUJ,EAAVI,MACfF,KAAAA,KAAOA,EACPC,KAAAA,KAAOA,EACPC,KAAAA,MAAQA,EACb,KAAKH,OAASA,EAETA,KAAAA,OAAOI,QAAS,SAAEC,EAAOC,GACZD,IAATE,GAASF,EAAMG,YAAc,UAA7BD,KACAE,GAASJ,EAAMK,WAAa,IAA5BD,KAER,EAAKT,OAAQM,GAAIK,MAAQ,CACd,OAAA,GACA,OAAA,GACC,QAAA,GACK,aAAA,KAGV,EAAKX,OAAQM,GAAIK,MAAOJ,GAAOK,QAAUH,GAAQA,EAAKG,SAC5D,EAAKZ,OAAQM,GAAIK,MAAOJ,GAASE,KApBrC,OAAA,EAAA,EAAA,CAAA,CAAA,IAAA,cAyBC,MAAA,SAAaI,GAQLlB,OAAAA,EAAUmB,SAASC,cAAe,SAAWF,GAAOG,UAP3C,CACfC,SAAa,kBACbC,YAAa,0BACbC,OAAa,2BACbC,SAAa,WA9BhB,CAAA,IAAA,OAoCC,MAAA,cApCD,CAAA,IAAA,WAwCC,MAAA,WAA4C,IAAA,EAAA,KAAlCb,EAAO,UAAA,OAAA,QAAA,IAAA,UAAA,GAAA,UAAA,GAAA,SAAUc,EAAa,UAAA,OAAA,QAAA,IAAA,UAAA,GAAA,UAAA,GAAA,EAClCrB,KAAAA,OAAQqB,GAAab,WAAWD,KAAOA,EAEvC,KAAKP,OAAQqB,GAAaV,MAAOJ,GAAOK,OACvCU,KAAAA,KAAM,KAAKtB,OAAQqB,GAAaV,MAAOJ,GAAQ,KAAKP,OAAQqB,GAAaE,SAAUhB,GAExFiB,MAAOhC,EAAc,KAAKU,KAAO,KAAKD,KAAM,KAAKD,OAAQqB,GAAab,YAAc,CACnFiB,OAAQ,MACRC,QAAS,CACO,aAAA,KAAKvB,SAElBwB,KACH,SAAEC,GAAcA,OAAAA,EAASC,SACxBF,KACD,SAAEG,GACD,EAAK9B,OAAQqB,GAAaV,MAAOJ,GAASuB,EAC1C,EAAKR,KAAM,EAAKtB,OAAQqB,GAAaV,MAAOJ,GAAQ,EAAKP,OAAQqB,GAAaE,SAAUhB,SAxD7F,EAAA","file":"dynamic-widget-block.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\turl: {\n\t\taddQueryArgs,\n\t},\n} = wp;\n\n/**\n * External dependencies.\n */\nconst {\n\ttemplate,\n} = lodash;\n\n// Use the bp global.\nwindow.bp = window.bp || {};\n\n/**\n * Generic class to be used by Dynamic Widget Blocks.\n *\n * @since 9.0.0\n */\nbp.dynamicWidgetBlock = class bpDynamicWidgetBlock {\n\tconstructor( settings, blocks ) {\n\t\tconst { path, root, nonce } = settings;\n\t\tthis.path = path;\n\t\tthis.root = root;\n\t\tthis.nonce = nonce,\n\t\tthis.blocks = blocks;\n\n\t\tthis.blocks.forEach( ( block, i ) => {\n\t\t\tconst { type } = block.query_args || 'active';\n\t\t\tconst { body } = block.preloaded || [];\n\n\t\t\tthis.blocks[ i ].items = {\n\t\t\t\t'active': [],\n\t\t\t\t'newest': [],\n\t\t\t\t'popular': [],\n\t\t\t\t'alphabetical': [],\n\t\t\t}\n\n\t\t\tif ( ! this.blocks[ i ].items[ type ].length && body && body.length ) {\n\t\t\t\tthis.blocks[ i ].items[ type ] = body;\n\t\t\t}\n\t\t} );\n\t}\n\n\tuseTemplate( tmpl ) {\n\t\tconst options = {\n\t\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\t\tinterpolate: /\\{\\{\\{([\\s\\S]+?)\\}\\}\\}/g,\n\t\t\tescape: /\\{\\{([^\\}]+?)\\}\\}(?!\\})/g,\n\t\t\tvariable: 'data'\n\t\t};\n\n\t\treturn template( document.querySelector( '#tmpl-' + tmpl ).innerHTML, options );\n\t}\n\n\tloop() {\n\t\t// This method needs to be overriden.\n\t}\n\n\tgetItems( type = 'active', blockIndex = 0 ) {\n\t\tthis.blocks[ blockIndex ].query_args.type = type;\n\n\t\tif ( this.blocks[ blockIndex ].items[ type ].length ) {\n\t\t\tthis.loop( this.blocks[ blockIndex ].items[ type ], this.blocks[ blockIndex ].selector, type );\n\t\t} else {\n\t\t\tfetch( addQueryArgs( this.root + this.path, this.blocks[ blockIndex ].query_args ), {\n\t\t\t\tmethod: 'GET',\n\t\t\t\theaders: {\n\t\t\t\t\t'X-WP-Nonce' : this.nonce,\n\t\t\t\t}\n\t\t\t} ).then(\n\t\t\t\t( response ) => response.json()\n\t\t\t).then(\n\t\t\t\t( data ) => {\n\t\t\t\t\tthis.blocks[ blockIndex ].items[ type ] = data;\n\t\t\t\t\tthis.loop( this.blocks[ blockIndex ].items[ type ], this.blocks[ blockIndex ].selector, type );\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n};\n"]}
|
@@ -1 +1 @@
|
|
1 |
-
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(r){"use strict";var w=r.scrollTo=function(e,t,o){return r(window).scrollTo(e,t,o)};function i(e){return!e.nodeName||-1!==r.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])}function t(e){return"function"==typeof e}function n(e){return t(e)||r.isPlainObject(e)?e:{top:e,left:e}}return w.defaults={axis:"xy",duration:0,limit:!0},r.fn.scrollTo=function(e,o,h){"object"==typeof o&&(h=o,o=0),"
|
1 |
+
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(r){"use strict";var w=r.scrollTo=function(e,t,o){return r(window).scrollTo(e,t,o)};function i(e){return!e.nodeName||-1!==r.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])}function t(e){return"function"==typeof e}function n(e){return t(e)||r.isPlainObject(e)?e:{top:e,left:e}}return w.defaults={axis:"xy",duration:0,limit:!0},r.fn.scrollTo=function(e,o,h){"object"==typeof o&&(h=o,o=0),"max"===e&&(e=9e9),h=r.extend({},w.defaults,h="function"==typeof h?{onAfter:h}:h),o=o||h.duration;var x=h.queue&&1<h.axis.length;return x&&(o/=2),h.offset=n(h.offset),h.over=n(h.over),this.each(function(){if(null!==e){var f,u=i(this),a=u?this.contentWindow||window:this,c=r(a),l=e,d={};switch(typeof l){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(l)){l=n(l);break}l=u?r(l):r(l,a);case"object":if(0===l.length)return;(l.is||l.style)&&(f=(l=r(l)).offset())}var m=t(h.offset)&&h.offset(a,l)||h.offset;r.each(h.axis.split(""),function(e,t){var o="x"===t?"Left":"Top",n=o.toLowerCase(),r="scroll"+o,i=c[r](),s=w.max(a,t);f?(d[r]=f[n]+(u?0:i-c.offset()[n]),h.margin&&(d[r]-=parseInt(l.css("margin"+o),10)||0,d[r]-=parseInt(l.css("border"+o+"Width"),10)||0),d[r]+=m[n]||0,h.over[n]&&(d[r]+=l["x"===t?"width":"height"]()*h.over[n])):(n=l[n],d[r]=n.slice&&"%"===n.slice(-1)?parseFloat(n)/100*s:n),h.limit&&/^\d+$/.test(d[r])&&(d[r]=d[r]<=0?0:Math.min(d[r],s)),!e&&1<h.axis.length&&(i===d[r]?d={}:x&&(p(h.onAfterFirst),d={}))}),p(h.onAfter)}function p(e){var t=r.extend({},h,{queue:!0,duration:o,complete:e&&function(){e.call(a,l,h)}});c.animate(d,t)}})},w.max=function(e,t){var o="x"===t?"Width":"Height",n="scroll"+o;if(!i(e))return e[n]-r(e)[o.toLowerCase()]();t="client"+o,o=e.ownerDocument||e.document,e=o.documentElement,o=o.body;return Math.max(e[n],o[n])-Math.min(e[t],o[t])},r.Tween.propHooks.scrollLeft=r.Tween.propHooks.scrollTop={get:function(e){return r(e.elem)[e.prop]()},set:function(e){var t=this.get(e);if(e.options.interrupt&&e._last&&e._last!==t)return r(e.elem).stop();var o=Math.round(e.now);t!==o&&(r(e.elem)[e.prop](o),e._last=this.get(e))}},w});
|
@@ -1 +1 @@
|
|
1 |
-
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(function(l){var i,h;function t(t){this.currentFlag=null,this.controllers={},this.aliasMaps={},this.$inputor=l(t),this.setupRootElement(),this.listen()}h={ESC:27,TAB:9,ENTER:13,CTRL:17,A:65,P:80,N:78,LEFT:37,UP:38,RIGHT:39,DOWN:40,BACKSPACE:8,SPACE:32},i={beforeSave:function(t){return n.arrayToDefaultHash(t)},matcher:function(t,e,i,r){var n;return t=t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i&&(t="(?:^|\\s)"+t),n=decodeURI("%C3%80"),i=decodeURI("%C3%BF"),(e=new RegExp(t+"([A-Za-z"+n+"-"+i+"0-9_"+(r?" ":"")+"'.+-]*)$|"+t+"([^\\x00-\\xff]*)$","gi").exec(e))?e[2]||e[1]:null},filter:function(t,e,i){for(var r,n=[],o=0,s=e.length;o<s;o++)r=e[o],~new String(r[i]).toLowerCase().indexOf(t.toLowerCase())&&n.push(r);return n},remoteFilter:null,sorter:function(t,e,i){var r,n,o,s;if(!t)return e;for(r=[],n=0,s=e.length;n<s;n++)(o=e[n]).atwho_order=new String(o[i]).toLowerCase().indexOf(t.toLowerCase()),-1<o.atwho_order&&r.push(o);return r.sort(function(t,e){return t.atwho_order-e.atwho_order})},tplEval:function(t,r){var e=t;try{return(e="string"!=typeof t?t(r):e).replace(/\$\{([^\}]*)\}/g,function(t,e,i){return r[e]})}catch(t){return""}},highlighter:function(t,e){return e?(e=new RegExp(">\\s*([^<]*?)("+e.replace("+","\\+")+")([^<]*)\\s*<","ig"),t.replace(e,function(t,e,i,r){return"> "+e+"<strong>"+i+"</strong>"+r+" <"})):t},beforeInsert:function(t,e,i){return t},beforeReposition:function(t){return t},afterMatchFailed:function(t,e){}},t.prototype.createContainer=function(t){var e;return null!=(e=this.$el)&&e.remove(),l(t.body).append(this.$el=l("<div class='atwho-container'></div>"))},t.prototype.setupRootElement=function(e,t){if(null==t&&(t=!1),e)this.window=e.contentWindow,this.document=e.contentDocument||this.window.document,this.iframe=e;else{this.document=this.$inputor[0].ownerDocument,this.window=this.document.defaultView||this.document.parentWindow;try{this.iframe=this.window.frameElement}catch(t){if(e=t,this.iframe=null,l.fn.atwho.debug)throw new Error("iframe auto-discovery is failed.\nPlease use `setIframe` to set the target iframe manually.\n"+e)}}return this.createContainer((this.iframeAsRoot=t)?this.document:document)},t.prototype.controller=function(t){var e,i,r,n;if(this.aliasMaps[t])i=this.controllers[this.aliasMaps[t]];else for(r in n=this.controllers)if(e=n[r],r===t){i=e;break}return i||this.controllers[this.currentFlag]},t.prototype.setContextFor=function(t){return this.currentFlag=t,this},t.prototype.reg=function(t,e){var i=(i=this.controllers)[t]||(i[t]=new(this.$inputor.is("[contentEditable]")?u:d)(this,t));return e.alias&&(this.aliasMaps[e.alias]=t),i.init(e),this},t.prototype.listen=function(){return this.$inputor.on("compositionstart",(a=this,function(t){var e;return null!=(e=a.controller())&&e.view.hide(),a.isComposing=!0,null})).on("compositionend",(s=this,function(t){return s.isComposing=!1,setTimeout(function(t){return s.dispatch(t)}),null})).on("keyup.atwhoInner",(o=this,function(t){return o.onKeyup(t)})).on("keydown.atwhoInner",(r=this,function(t){return r.onKeydown(t)})).on("blur.atwhoInner",(i=this,function(t){var e;if(e=i.controller())return e.expectedQueryCBId=null,e.view.hide(t,e.getOpt("displayTimeout"))})).on("click.atwhoInner",(e=this,function(t){return e.dispatch(t)})).on("scroll.atwhoInner",(n=this,function(){var r=n.$inputor.scrollTop();return function(t){var e,i=t.target.scrollTop;return r!==i&&null!=(e=n.controller())&&e.view.hide(t),r=i,!0}}()));var n,e,i,r,o,s,a},t.prototype.shutdown=function(){var t,e=this.controllers;for(t in e)e[t].destroy(),delete this.controllers[t];return this.$inputor.off(".atwhoInner"),this.$el.remove()},t.prototype.dispatch=function(t){var e,i,r=this.controllers,n=[];for(e in r)i=r[e],n.push(i.lookUp(t));return n},t.prototype.onKeyup=function(t){var e;switch(t.keyCode){case h.ESC:t.preventDefault(),null!=(e=this.controller())&&e.view.hide();break;case h.DOWN:case h.UP:case h.CTRL:case h.ENTER:l.noop();break;case h.P:case h.N:t.ctrlKey||this.dispatch(t);break;default:this.dispatch(t)}},t.prototype.onKeydown=function(t){var e,i=null!=(e=this.controller())?e.view:void 0;if(i&&i.visible())switch(t.keyCode){case h.ESC:t.preventDefault(),i.hide(t);break;case h.UP:t.preventDefault(),i.prev();break;case h.DOWN:t.preventDefault(),i.next();break;case h.P:if(!t.ctrlKey)return;t.preventDefault(),i.prev();break;case h.N:if(!t.ctrlKey)return;t.preventDefault(),i.next();break;case h.TAB:case h.ENTER:case h.SPACE:if(!i.visible())return;if(!this.controller().getOpt("spaceSelectsMatch")&&t.keyCode===h.SPACE)return;if(!this.controller().getOpt("tabSelectsMatch")&&t.keyCode===h.TAB)return;i.highlighted()?(t.preventDefault(),i.choose(t)):i.hide(t);break;default:l.noop()}};var o=t,r=[].slice;function e(t,e){this.app=t,this.at=e,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.expectedQueryCBId=null,this.setting=null,this.query=null,this.pos=0,this.range=null,0===(this.$el=l("#atwho-ground-"+this.id,this.app.$el)).length&&this.app.$el.append(this.$el=l("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new c(this),this.view=new p(this)}e.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},e.prototype.init=function(t){return this.setting=l.extend({},this.setting||l.fn.atwho.default,t),this.view.init(),this.model.reload(this.setting.data)},e.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},e.prototype.callDefault=function(){var e=arguments[0],t=2<=arguments.length?r.call(arguments,1):[];try{return i[e].apply(this,t)}catch(t){return l.error(t+" Or maybe At.js doesn't have function "+e)}},e.prototype.trigger=function(t,e){var i;return(e=null==e?[]:e).push(this),i=this.getOpt("alias"),this.$inputor.trigger(i?t+"-"+i+".atwho":t+".atwho",e)},e.prototype.callbacks=function(t){return this.getOpt("callbacks")[t]||i[t]},e.prototype.getOpt=function(t,e){try{return this.setting[t]}catch(t){return null}},e.prototype.insertContentFor=function(t){var e=this.getOpt("insertTpl"),t=l.extend({},t.data("item-data"),{"atwho-at":this.at});return this.callbacks("tplEval").call(this,e,t,"onInsert")},e.prototype.renderView=function(t){var e=this.getOpt("searchKey");return t=this.callbacks("sorter").call(this,this.query.text,t.slice(0,1001),e),this.view.render(t.slice(0,this.getOpt("limit")))},e.arrayToDefaultHash=function(t){var e,i,r,n;if(!Array.isArray(t))return t;for(n=[],e=0,r=t.length;e<r;e++)i=t[e],l.isPlainObject(i)?n.push(i):n.push({name:i});return n},e.prototype.lookUp=function(t){var e;if((!t||"click"!==t.type||this.getOpt("lookUpOnClick"))&&(!this.getOpt("suspendOnComposing")||!this.app.isComposing))return(e=this.catchQuery(t))?(this.app.setContextFor(this.at),(t=this.getOpt("delay"))?this._delayLookUp(e,t):this._lookUp(e)):this.expectedQueryCBId=null,e},e.prototype._delayLookUp=function(t,e){var i,r,n=Date.now?Date.now():(new Date).getTime();return this.previousCallTime||(this.previousCallTime=n),0<(i=e-(n-this.previousCallTime))&&i<e?(this.previousCallTime=n,this._stopDelayedCall(),this.delayedCallTimeout=setTimeout((r=this,function(){return r.previousCallTime=0,r.delayedCallTimeout=null,r._lookUp(t)}),e)):(this._stopDelayedCall(),this.previousCallTime!==n&&(this.previousCallTime=0),this._lookUp(t))},e.prototype._stopDelayedCall=function(){if(this.delayedCallTimeout)return clearTimeout(this.delayedCallTimeout),this.delayedCallTimeout=null},e.prototype._generateQueryCBId=function(){return{}},e.prototype._lookUp=function(t){var e=function(t,e){if(t===this.expectedQueryCBId)return e&&0<e.length?this.renderView(this.constructor.arrayToDefaultHash(e)):this.view.hide()};return this.expectedQueryCBId=this._generateQueryCBId(),this.model.query(t.text,l.proxy(e,this,this.expectedQueryCBId))};var n=e,s={}.hasOwnProperty;function a(){return a.__super__.constructor.apply(this,arguments)}(function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype})(a,n),a.prototype.catchQuery=function(){var t=this.$inputor.val(),e=this.$inputor.caret("pos",{iframe:this.app.iframe}),i=t.slice(0,e),t=this.callbacks("matcher").call(this,this.at,i,this.getOpt("startWithSpace"),this.getOpt("acceptSpaceBar")),i="string"==typeof t;if(!(i&&t.length<this.getOpt("minLen",0)))return i&&t.length<=this.getOpt("maxLen",20)?(e=(i=e-t.length)+t.length,this.pos=i,this.trigger("matched",[this.at,(t={text:t,headPos:i,endPos:e}).text])):(t=null,this.view.hide()),this.query=t},a.prototype.rect=function(){var t,e;if(t=this.$inputor.caret("offset",this.pos-1,{iframe:this.app.iframe}))return this.app.iframe&&!this.app.iframeAsRoot&&(e=l(this.app.iframe).offset(),t.left+=e.left,t.top+=e.top),e=this.app.document.selection?0:2,{left:t.left,top:t.top,bottom:t.top+t.height+e}},a.prototype.insert=function(t,e){var i=this.$inputor,r=i.val(),n=r.slice(0,Math.max(this.query.headPos-this.at.length,0)),o=""===(o=this.getOpt("suffix"))?o:o||" ",r=""+n+(t+=o)+r.slice(this.query.endPos||0);return i.val(r),i.caret("pos",n.length+t.length,{iframe:this.app.iframe}),i.is(":focus")||i.trigger("focus"),i.trigger("change")};var u,c,p,f,d=a,s={}.hasOwnProperty;function g(){return g.__super__.constructor.apply(this,arguments)}function y(t){this.context=t,this.at=this.context.at,this.storage=this.context.$inputor}function v(t){this.context=t,this.$el=l("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>"),this.$elUl=this.$el.children(),this.timeoutID=null,this.context.$el.append(this.$el),this.bindEvent()}(function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype})(g,n),g.prototype._getRange=function(){var t=this.app.window.getSelection();if(0<t.rangeCount)return t.getRangeAt(0)},g.prototype._setRange=function(t,e,i){if((i=null==i?this._getRange():i)&&e)return e=l(e)[0],"after"===t?(i.setEndAfter(e),i.setStartAfter(e)):(i.setEndBefore(e),i.setStartBefore(e)),i.collapse(!1),this._clearRange(i)},g.prototype._clearRange=function(t){var e;if(null==t&&(t=this._getRange()),e=this.app.window.getSelection(),null==this.ctrl_a_pressed)return e.removeAllRanges(),e.addRange(t)},g.prototype._movingEvent=function(t){var e;return"click"===t.type||(e=t.which)===h.RIGHT||e===h.LEFT||e===h.UP||e===h.DOWN},g.prototype._unwrap=function(t){var e;return(e=(t=l(t).unwrap().get(0)).nextSibling)&&e.nodeValue&&(t.nodeValue+=e.nodeValue,l(e).remove()),t},g.prototype.catchQuery=function(t){var e,i,r,n,o,s,a;if((a=this._getRange())&&a.collapsed){if(t.which===h.ENTER)return(i=l(a.startContainer).closest(".atwho-query")).contents().unwrap(),i.is(":empty")&&i.remove(),(i=l(".atwho-query",this.app.document)).text(i.text()).contents().last().unwrap(),void this._clearRange();if(/firefox/i.test(navigator.userAgent)){if(l(a.startContainer).is(this.$inputor))return void this._clearRange();t.which===h.BACKSPACE&&a.startContainer.nodeType===document.ELEMENT_NODE&&0<=(o=a.startOffset-1)?((r=a.cloneRange()).setStart(a.startContainer,o),l(r.cloneContents()).contents().last().is(".atwho-inserted")&&(o=l(a.startContainer).contents().get(o),this._setRange("after",l(o).contents().last()))):t.which===h.LEFT&&a.startContainer.nodeType===document.TEXT_NODE&&(e=l(a.startContainer.previousSibling)).is(".atwho-inserted")&&0===a.startOffset&&this._setRange("after",e.contents().last())}if(l(a.startContainer).closest(".atwho-inserted").addClass("atwho-query").siblings().removeClass("atwho-query"),0<(i=l(".atwho-query",this.app.document)).length&&i.is(":empty")&&0===i.text().length&&i.remove(),this._movingEvent(t)||i.removeClass("atwho-inserted"),0<i.length)switch(t.which){case h.LEFT:return this._setRange("before",i.get(0),a),void i.removeClass("atwho-query");case h.RIGHT:return this._setRange("after",i.get(0).nextSibling,a),void i.removeClass("atwho-query")}return 0<i.length&&(s=i.attr("data-atwho-at-query"))&&(i.empty().html(s).attr("data-atwho-at-query",null),this._setRange("after",i.get(0),a)),(r=a.cloneRange()).setStart(a.startContainer,0),r="string"==typeof(s=this.callbacks("matcher").call(this,this.at,r.toString(),this.getOpt("startWithSpace"),this.getOpt("acceptSpaceBar"))),0===i.length&&r&&0<=(n=a.startOffset-this.at.length-s.length)&&(a.setStart(a.startContainer,n),i=l("<span/>",this.app.document).attr(this.getOpt("editableAtwhoQueryAttrs")).addClass("atwho-query"),a.surroundContents(i.get(0)),(n=i.contents().last().get(0))&&(/firefox/i.test(navigator.userAgent)?(a.setStart(n,n.length),a.setEnd(n,n.length),this._clearRange(a)):this._setRange("after",n,a))),r&&s.length<this.getOpt("minLen",0)?void 0:r&&s.length<=this.getOpt("maxLen",20)?(this.trigger("matched",[this.at,(s={text:s,el:i}).text]),this.query=s):(this.view.hide(),this.query={el:i},0<=i.text().indexOf(this.at)&&(this._movingEvent(t)&&i.hasClass("atwho-inserted")?i.removeClass("atwho-query"):!1!==this.callbacks("afterMatchFailed").call(this,this.at,i)&&this._setRange("after",this._unwrap(i.text(i.text()).contents().first()))),null)}},g.prototype.rect=function(){var t,e=this.query.el.offset();if(e&&this.query.el[0].getClientRects().length)return this.app.iframe&&!this.app.iframeAsRoot&&(t=l(this.app.iframe).offset(),e.left+=t.left-this.$inputor.scrollLeft(),e.top+=t.top-this.$inputor.scrollTop()),e.bottom=e.top+this.query.el.height(),e},g.prototype.insert=function(t,e){var i;return this.$inputor.is(":focus")||this.$inputor.focus(),(i=this.getOpt("functionOverrides")).insert?i.insert.call(this,t,e):(i=""===(i=this.getOpt("suffix"))?i:i||" ",e=e.data("item-data"),this.query.el.removeClass("atwho-query").addClass("atwho-inserted").html(t).attr("data-atwho-at-query",""+e["atwho-at"]+this.query.text).attr("contenteditable","false"),(e=this._getRange())&&(this.query.el.length&&e.setEndAfter(this.query.el[0]),e.collapse(!1),e.insertNode(i=this.app.document.createTextNode(""+i)),this._setRange("after",i,e)),this.$inputor.is(":focus")||this.$inputor.focus(),this.$inputor.change())},u=g,y.prototype.destroy=function(){return this.storage.data(this.at,null)},y.prototype.saved=function(){return 0<this.fetch()},y.prototype.query=function(t,e){var i=this.fetch(),r=this.context.getOpt("searchKey");return i=this.context.callbacks("filter").call(this.context,t,i,r)||[],r=this.context.callbacks("remoteFilter"),0<i.length||!r&&0===i.length?e(i):r.call(this.context,t,e)},y.prototype.fetch=function(){return this.storage.data(this.at)||[]},y.prototype.save=function(t){return this.storage.data(this.at,this.context.callbacks("beforeSave").call(this.context,t||[]))},y.prototype.load=function(t){if(!this.saved()&&t)return this._load(t)},y.prototype.reload=function(t){return this._load(t)},y.prototype._load=function(t){return"string"==typeof t?l.ajax(t,{dataType:"json"}).done((e=this,function(t){return e.save(t)})):this.save(t);var e},c=y,v.prototype.init=function(){var t=this.context.getOpt("alias")||this.context.at.charCodeAt(0),e=this.context.getOpt("headerTpl");return e&&1===this.$el.children().length&&this.$el.prepend(e),this.$el.attr({id:"at-view-"+t})},v.prototype.destroy=function(){return this.$el.remove()},v.prototype.bindEvent=function(){var e,i=this.$el.find("ul"),r=0,n=0;return i.on("mousemove.atwho-view","li",function(t){var e;if((r!==t.clientX||n!==t.clientY)&&(r=t.clientX,n=t.clientY,!(e=l(t.currentTarget)).hasClass("cur")))return i.find(".cur").removeClass("cur"),e.addClass("cur")}).on("click.atwho-view","li",(e=this,function(t){return i.find(".cur").removeClass("cur"),l(t.currentTarget).addClass("cur"),e.choose(t),t.preventDefault()}))},v.prototype.visible=function(){return l.expr.pseudos.visible(this.$el[0])},v.prototype.highlighted=function(){return 0<this.$el.find(".cur").length},v.prototype.choose=function(t){var e,i;if((e=this.$el.find(".cur")).length&&(i=this.context.insertContentFor(e),this.context._stopDelayedCall(),this.context.insert(this.context.callbacks("beforeInsert").call(this.context,i,e,t),e),this.context.trigger("inserted",[e,t]),this.hide(t)),this.context.getOpt("hideWithoutSuffix"))return this.stopShowing=!0},v.prototype.reposition=function(t){var e=this.context.app.iframeAsRoot?this.context.app.window:window;return t.bottom+this.$el.height()-l(e).scrollTop()>l(e).height()&&(t.bottom=t.top-this.$el.height()),t.left>(e=l(e).width()-this.$el.width()-5)&&(t.left=e),e={left:t.left,top:t.bottom},null!=(t=this.context.callbacks("beforeReposition"))&&t.call(this.context,e),this.$el.offset(e),this.context.trigger("reposition",[e])},v.prototype.next=function(){var t=this.$el.find(".cur").removeClass("cur").next();return(t=!t.length?this.$el.find("li:first"):t).addClass("cur"),t=(t=t[0]).offsetTop+t.offsetHeight+(t.nextSibling?t.nextSibling.offsetHeight:0),this.scrollTop(Math.max(0,t-this.$el.height()))},v.prototype.prev=function(){var t=this.$el.find(".cur").removeClass("cur").prev();return(t=!t.length?this.$el.find("li:last"):t).addClass("cur"),t=(t=t[0]).offsetTop+t.offsetHeight+(t.nextSibling?t.nextSibling.offsetHeight:0),this.scrollTop(Math.max(0,t-this.$el.height()))},v.prototype.scrollTop=function(t){var e=this.context.getOpt("scrollDuration");return e?this.$elUl.animate({scrollTop:t},e):this.$elUl.scrollTop(t)},v.prototype.show=function(){var t;if(!this.stopShowing)return this.visible()||(this.$el.show(),this.$el.scrollTop(0),this.context.trigger("shown")),(t=this.context.rect())?this.reposition(t):void 0;this.stopShowing=!1},v.prototype.hide=function(t,e){var i;if(this.visible())return isNaN(e)?(this.$el.hide(),this.context.trigger("hidden",[t])):(i=this,t=function(){return i.hide()},clearTimeout(this.timeoutID),this.timeoutID=setTimeout(t,e))},v.prototype.render=function(t){var e,i,r,n,o,s;if(Array.isArray(t)&&0<t.length){for(this.$el.find("ul").empty(),e=this.$el.find("ul"),s=this.context.getOpt("displayTpl"),i=0,n=t.length;i<n;i++)r=t[i],r=l.extend({},r,{"atwho-at":this.context.at}),o=this.context.callbacks("tplEval").call(this.context,s,r,"onDisplay"),(o=l(this.context.callbacks("highlighter").call(this.context,o,this.context.query.text))).data("item-data",r),e.append(o);return this.show(),this.context.getOpt("highlightFirst")?e.find("li:first").addClass("cur"):void 0}this.hide()},p=v,f={load:function(t,e){if(t=this.controller(t))return t.model.load(e)},isSelecting:function(){var t;return!(null==(t=this.controller())||!t.view.visible())},hide:function(){var t;return null!=(t=this.controller())?t.view.hide():void 0},reposition:function(){var t;if(t=this.controller())return t.view.reposition(t.rect())},setIframe:function(t,e){return this.setupRootElement(t,e),null},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},l.fn.atwho=function(i){var r=arguments,n=null;return this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function(){var t,e;return(e=(t=l(this)).data("atwho"))||t.data("atwho",e=new o(this)),"object"!=typeof i&&i?f[i]&&e?n=f[i].apply(e,Array.prototype.slice.call(r,1)):l.error("Method "+i+" does not exist on jQuery.atwho"):e.reg(i.at,i)}),null!=n?n:this},l.fn.atwho.default={at:void 0,alias:void 0,data:null,displayTpl:"<li>${name}</li>",insertTpl:"${atwho-at}${name}",headerTpl:null,callbacks:i,functionOverrides:{},searchKey:"name",suffix:void 0,hideWithoutSuffix:!1,startWithSpace:!0,acceptSpaceBar:!1,highlightFirst:!0,limit:5,maxLen:20,minLen:0,displayTimeout:300,delay:null,spaceSelectsMatch:!1,tabSelectsMatch:!0,editableAtwhoQueryAttrs:{},scrollDuration:150,suspendOnComposing:!0,lookUpOnClick:!0},l.fn.atwho.debug=!1});
|
1 |
+
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(function(l){var i,h;function t(t){this.currentFlag=null,this.controllers={},this.aliasMaps={},this.$inputor=l(t),this.setupRootElement(),this.listen()}h={ESC:27,TAB:9,ENTER:13,CTRL:17,A:65,P:80,N:78,LEFT:37,UP:38,RIGHT:39,DOWN:40,BACKSPACE:8,SPACE:32},i={beforeSave:function(t){return n.arrayToDefaultHash(t)},matcher:function(t,e,i,r){var n;return t=t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i&&(t="(?:^|\\s)"+t),n=decodeURI("%C3%80"),i=decodeURI("%C3%BF"),(e=new RegExp(t+"([A-Za-z"+n+"-"+i+"0-9_"+(r?" ":"")+"'.+-]*)$|"+t+"([^\\x00-\\xff]*)$","gi").exec(e))?e[2]||e[1]:null},filter:function(t,e,i){for(var r,n=[],o=0,s=e.length;o<s;o++)r=e[o],~new String(r[i]).toLowerCase().indexOf(t.toLowerCase())&&n.push(r);return n},remoteFilter:null,sorter:function(t,e,i){var r,n,o,s;if(!t)return e;for(r=[],n=0,s=e.length;n<s;n++)(o=e[n]).atwho_order=new String(o[i]).toLowerCase().indexOf(t.toLowerCase()),-1<o.atwho_order&&r.push(o);return r.sort(function(t,e){return t.atwho_order-e.atwho_order})},tplEval:function(t,r){var e=t;try{return(e="string"!=typeof t?t(r):e).replace(/\$\{([^\}]*)\}/g,function(t,e,i){return r[e]})}catch(t){return""}},highlighter:function(t,e){return e?(e=new RegExp(">\\s*([^<]*?)("+e.replace("+","\\+")+")([^<]*)\\s*<","ig"),t.replace(e,function(t,e,i,r){return"> "+e+"<strong>"+i+"</strong>"+r+" <"})):t},beforeInsert:function(t,e,i){return t},beforeReposition:function(t){return t},afterMatchFailed:function(t,e){}},t.prototype.createContainer=function(t){var e;return null!=(e=this.$el)&&e.remove(),l(t.body).append(this.$el=l("<div class='atwho-container'></div>"))},t.prototype.setupRootElement=function(e,t){if(null==t&&(t=!1),e)this.window=e.contentWindow,this.document=e.contentDocument||this.window.document,this.iframe=e;else{this.document=this.$inputor[0].ownerDocument,this.window=this.document.defaultView||this.document.parentWindow;try{this.iframe=this.window.frameElement}catch(t){if(e=t,this.iframe=null,l.fn.atwho.debug)throw new Error("iframe auto-discovery is failed.\nPlease use `setIframe` to set the target iframe manually.\n"+e)}}return this.createContainer((this.iframeAsRoot=t)?this.document:document)},t.prototype.controller=function(t){var e,i,r,n;if(this.aliasMaps[t])i=this.controllers[this.aliasMaps[t]];else for(r in n=this.controllers)if(e=n[r],r===t){i=e;break}return i||this.controllers[this.currentFlag]},t.prototype.setContextFor=function(t){return this.currentFlag=t,this},t.prototype.reg=function(t,e){var i=(i=this.controllers)[t]||(i[t]=new(this.$inputor.is("[contentEditable]")?c:g)(this,t));return e.alias&&(this.aliasMaps[e.alias]=t),i.init(e),this},t.prototype.listen=function(){return this.$inputor.on("compositionstart",(a=this,function(t){var e;return null!=(e=a.controller())&&e.view.hide(),a.isComposing=!0,null})).on("compositionend",(s=this,function(t){return s.isComposing=!1,setTimeout(function(t){return s.dispatch(t)}),null})).on("keyup.atwhoInner",(o=this,function(t){return o.onKeyup(t)})).on("keydown.atwhoInner",(r=this,function(t){return r.onKeydown(t)})).on("blur.atwhoInner",(i=this,function(t){var e;if(e=i.controller())return e.expectedQueryCBId=null,e.view.hide(t,e.getOpt("displayTimeout"))})).on("click.atwhoInner",(e=this,function(t){return e.dispatch(t)})).on("scroll.atwhoInner",(n=this,function(){var r=n.$inputor.scrollTop();return function(t){var e,i=t.target.scrollTop;return r!==i&&null!=(e=n.controller())&&e.view.hide(t),r=i,!0}}()));var n,e,i,r,o,s,a},t.prototype.shutdown=function(){var t,e=this.controllers;for(t in e)e[t].destroy(),delete this.controllers[t];return this.$inputor.off(".atwhoInner"),this.$el.remove()},t.prototype.dispatch=function(t){var e,i,r=this.controllers,n=[];for(e in r)i=r[e],n.push(i.lookUp(t));return n},t.prototype.onKeyup=function(t){var e;switch(t.keyCode){case h.ESC:t.preventDefault(),null!=(e=this.controller())&&e.view.hide();break;case h.DOWN:case h.UP:case h.CTRL:case h.ENTER:l.noop();break;case h.P:case h.N:t.ctrlKey||this.dispatch(t);break;default:this.dispatch(t)}},t.prototype.onKeydown=function(t){var e,i=null!=(e=this.controller())?e.view:void 0;if(i&&i.visible())switch(t.keyCode){case h.ESC:t.preventDefault(),i.hide(t);break;case h.UP:t.preventDefault(),i.prev();break;case h.DOWN:t.preventDefault(),i.next();break;case h.P:if(!t.ctrlKey)return;t.preventDefault(),i.prev();break;case h.N:if(!t.ctrlKey)return;t.preventDefault(),i.next();break;case h.TAB:case h.ENTER:case h.SPACE:if(!i.visible())return;if(!this.controller().getOpt("spaceSelectsMatch")&&t.keyCode===h.SPACE)return;if(!this.controller().getOpt("tabSelectsMatch")&&t.keyCode===h.TAB)return;i.highlighted()?(t.preventDefault(),i.choose(t)):i.hide(t);break;default:l.noop()}};var o=t,r=[].slice;function e(t,e){this.app=t,this.at=e,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.expectedQueryCBId=null,this.setting=null,this.query=null,this.pos=0,this.range=null,0===(this.$el=l("#atwho-ground-"+this.id,this.app.$el)).length&&this.app.$el.append(this.$el=l("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new p(this),this.view=new f(this)}e.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},e.prototype.init=function(t){return this.setting=l.extend({},this.setting||l.fn.atwho.default,t),this.view.init(),this.model.reload(this.setting.data)},e.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},e.prototype.callDefault=function(){var e=arguments[0],t=2<=arguments.length?r.call(arguments,1):[];try{return i[e].apply(this,t)}catch(t){return l.error(t+" Or maybe At.js doesn't have function "+e)}},e.prototype.trigger=function(t,e){var i;return(e=null==e?[]:e).push(this),i=this.getOpt("alias"),this.$inputor.trigger(i?t+"-"+i+".atwho":t+".atwho",e)},e.prototype.callbacks=function(t){return this.getOpt("callbacks")[t]||i[t]},e.prototype.getOpt=function(t,e){try{return this.setting[t]}catch(t){return null}},e.prototype.insertContentFor=function(t){var e=this.getOpt("insertTpl"),t=l.extend({},t.data("item-data"),{"atwho-at":this.at});return this.callbacks("tplEval").call(this,e,t,"onInsert")},e.prototype.renderView=function(t){var e=this.getOpt("searchKey");return t=this.callbacks("sorter").call(this,this.query.text,t.slice(0,1001),e),this.view.render(t.slice(0,this.getOpt("limit")))},e.arrayToDefaultHash=function(t){var e,i,r,n;if(!Array.isArray(t))return t;for(n=[],e=0,r=t.length;e<r;e++)i=t[e],l.isPlainObject(i)?n.push(i):n.push({name:i});return n},e.prototype.lookUp=function(t){var e;if((!t||"click"!==t.type||this.getOpt("lookUpOnClick"))&&(!this.getOpt("suspendOnComposing")||!this.app.isComposing))return(e=this.catchQuery(t))?(this.app.setContextFor(this.at),(t=this.getOpt("delay"))?this._delayLookUp(e,t):this._lookUp(e)):this.expectedQueryCBId=null,e},e.prototype._delayLookUp=function(t,e){var i,r,n=Date.now?Date.now():(new Date).getTime();return this.previousCallTime||(this.previousCallTime=n),0<(i=e-(n-this.previousCallTime))&&i<e?(this.previousCallTime=n,this._stopDelayedCall(),this.delayedCallTimeout=setTimeout((r=this,function(){return r.previousCallTime=0,r.delayedCallTimeout=null,r._lookUp(t)}),e)):(this._stopDelayedCall(),this.previousCallTime!==n&&(this.previousCallTime=0),this._lookUp(t))},e.prototype._stopDelayedCall=function(){if(this.delayedCallTimeout)return clearTimeout(this.delayedCallTimeout),this.delayedCallTimeout=null},e.prototype._generateQueryCBId=function(){return{}},e.prototype._lookUp=function(t){var e=function(t,e){if(t===this.expectedQueryCBId)return e&&0<e.length?this.renderView(this.constructor.arrayToDefaultHash(e)):this.view.hide()};return this.expectedQueryCBId=this._generateQueryCBId(),this.model.query(t.text,l.proxy(e,this,this.expectedQueryCBId))};var n,s=function(t,e){for(var i in e)a.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;function u(){return u.__super__.constructor.apply(this,arguments)}s(u,n=e),u.prototype.catchQuery=function(){var t=this.$inputor.val(),e=this.$inputor.caret("pos",{iframe:this.app.iframe}),i=t.slice(0,e),t=this.callbacks("matcher").call(this,this.at,i,this.getOpt("startWithSpace"),this.getOpt("acceptSpaceBar")),i="string"==typeof t;if(!(i&&t.length<this.getOpt("minLen",0)))return i&&t.length<=this.getOpt("maxLen",20)?(e=(i=e-t.length)+t.length,this.pos=i,this.trigger("matched",[this.at,(t={text:t,headPos:i,endPos:e}).text])):(t=null,this.view.hide()),this.query=t},u.prototype.rect=function(){var t,e;if(t=this.$inputor.caret("offset",this.pos-1,{iframe:this.app.iframe}))return this.app.iframe&&!this.app.iframeAsRoot&&(e=l(this.app.iframe).offset(),t.left+=e.left,t.top+=e.top),e=this.app.document.selection?0:2,{left:t.left,top:t.top,bottom:t.top+t.height+e}},u.prototype.insert=function(t,e){var i=this.$inputor,r=i.val(),n=r.slice(0,Math.max(this.query.headPos-this.at.length,0)),o=""===(o=this.getOpt("suffix"))?o:o||" ",r=""+n+(t+=o)+r.slice(this.query.endPos||0);return i.val(r),i.caret("pos",n.length+t.length,{iframe:this.app.iframe}),i.is(":focus")||i.trigger("focus"),i.trigger("change")};var c,p,f,d,g=u,s=function(t,e){for(var i in e)a.call(e,i)&&(t[i]=e[i]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;function y(){return y.__super__.constructor.apply(this,arguments)}function v(t){this.context=t,this.at=this.context.at,this.storage=this.context.$inputor}function w(t){this.context=t,this.$el=l("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>"),this.$elUl=this.$el.children(),this.timeoutID=null,this.context.$el.append(this.$el),this.bindEvent()}s(y,n),y.prototype._getRange=function(){var t=this.app.window.getSelection();if(0<t.rangeCount)return t.getRangeAt(0)},y.prototype._setRange=function(t,e,i){if((i=null==i?this._getRange():i)&&e)return e=l(e)[0],"after"===t?(i.setEndAfter(e),i.setStartAfter(e)):(i.setEndBefore(e),i.setStartBefore(e)),i.collapse(!1),this._clearRange(i)},y.prototype._clearRange=function(t){var e;if(null==t&&(t=this._getRange()),e=this.app.window.getSelection(),null==this.ctrl_a_pressed)return e.removeAllRanges(),e.addRange(t)},y.prototype._movingEvent=function(t){var e;return"click"===t.type||(e=t.which)===h.RIGHT||e===h.LEFT||e===h.UP||e===h.DOWN},y.prototype._unwrap=function(t){var e;return(e=(t=l(t).unwrap().get(0)).nextSibling)&&e.nodeValue&&(t.nodeValue+=e.nodeValue,l(e).remove()),t},y.prototype.catchQuery=function(t){var e,i,r,n,o,s,a;if((a=this._getRange())&&a.collapsed){if(t.which===h.ENTER)return(i=l(a.startContainer).closest(".atwho-query")).contents().unwrap(),i.is(":empty")&&i.remove(),(i=l(".atwho-query",this.app.document)).text(i.text()).contents().last().unwrap(),void this._clearRange();if(/firefox/i.test(navigator.userAgent)){if(l(a.startContainer).is(this.$inputor))return void this._clearRange();t.which===h.BACKSPACE&&a.startContainer.nodeType===document.ELEMENT_NODE&&0<=(o=a.startOffset-1)?((r=a.cloneRange()).setStart(a.startContainer,o),l(r.cloneContents()).contents().last().is(".atwho-inserted")&&(o=l(a.startContainer).contents().get(o),this._setRange("after",l(o).contents().last()))):t.which===h.LEFT&&a.startContainer.nodeType===document.TEXT_NODE&&(e=l(a.startContainer.previousSibling)).is(".atwho-inserted")&&0===a.startOffset&&this._setRange("after",e.contents().last())}if(l(a.startContainer).closest(".atwho-inserted").addClass("atwho-query").siblings().removeClass("atwho-query"),0<(i=l(".atwho-query",this.app.document)).length&&i.is(":empty")&&0===i.text().length&&i.remove(),this._movingEvent(t)||i.removeClass("atwho-inserted"),0<i.length)switch(t.which){case h.LEFT:return this._setRange("before",i.get(0),a),void i.removeClass("atwho-query");case h.RIGHT:return this._setRange("after",i.get(0).nextSibling,a),void i.removeClass("atwho-query")}return 0<i.length&&(s=i.attr("data-atwho-at-query"))&&(i.empty().html(s).attr("data-atwho-at-query",null),this._setRange("after",i.get(0),a)),(r=a.cloneRange()).setStart(a.startContainer,0),r="string"==typeof(s=this.callbacks("matcher").call(this,this.at,r.toString(),this.getOpt("startWithSpace"),this.getOpt("acceptSpaceBar"))),0===i.length&&r&&0<=(n=a.startOffset-this.at.length-s.length)&&(a.setStart(a.startContainer,n),i=l("<span/>",this.app.document).attr(this.getOpt("editableAtwhoQueryAttrs")).addClass("atwho-query"),a.surroundContents(i.get(0)),(n=i.contents().last().get(0))&&(/firefox/i.test(navigator.userAgent)?(a.setStart(n,n.length),a.setEnd(n,n.length),this._clearRange(a)):this._setRange("after",n,a))),r&&s.length<this.getOpt("minLen",0)?void 0:r&&s.length<=this.getOpt("maxLen",20)?(this.trigger("matched",[this.at,(s={text:s,el:i}).text]),this.query=s):(this.view.hide(),this.query={el:i},0<=i.text().indexOf(this.at)&&(this._movingEvent(t)&&i.hasClass("atwho-inserted")?i.removeClass("atwho-query"):!1!==this.callbacks("afterMatchFailed").call(this,this.at,i)&&this._setRange("after",this._unwrap(i.text(i.text()).contents().first()))),null)}},y.prototype.rect=function(){var t,e=this.query.el.offset();if(e&&this.query.el[0].getClientRects().length)return this.app.iframe&&!this.app.iframeAsRoot&&(t=l(this.app.iframe).offset(),e.left+=t.left-this.$inputor.scrollLeft(),e.top+=t.top-this.$inputor.scrollTop()),e.bottom=e.top+this.query.el.height(),e},y.prototype.insert=function(t,e){var i;return this.$inputor.is(":focus")||this.$inputor.focus(),(i=this.getOpt("functionOverrides")).insert?i.insert.call(this,t,e):(i=""===(i=this.getOpt("suffix"))?i:i||" ",e=e.data("item-data"),this.query.el.removeClass("atwho-query").addClass("atwho-inserted").html(t).attr("data-atwho-at-query",""+e["atwho-at"]+this.query.text).attr("contenteditable","false"),(e=this._getRange())&&(this.query.el.length&&e.setEndAfter(this.query.el[0]),e.collapse(!1),e.insertNode(i=this.app.document.createTextNode(""+i)),this._setRange("after",i,e)),this.$inputor.is(":focus")||this.$inputor.focus(),this.$inputor.change())},c=y,v.prototype.destroy=function(){return this.storage.data(this.at,null)},v.prototype.saved=function(){return 0<this.fetch()},v.prototype.query=function(t,e){var i=this.fetch(),r=this.context.getOpt("searchKey");return i=this.context.callbacks("filter").call(this.context,t,i,r)||[],r=this.context.callbacks("remoteFilter"),0<i.length||!r&&0===i.length?e(i):r.call(this.context,t,e)},v.prototype.fetch=function(){return this.storage.data(this.at)||[]},v.prototype.save=function(t){return this.storage.data(this.at,this.context.callbacks("beforeSave").call(this.context,t||[]))},v.prototype.load=function(t){if(!this.saved()&&t)return this._load(t)},v.prototype.reload=function(t){return this._load(t)},v.prototype._load=function(t){return"string"==typeof t?l.ajax(t,{dataType:"json"}).done((e=this,function(t){return e.save(t)})):this.save(t);var e},p=v,w.prototype.init=function(){var t=this.context.getOpt("alias")||this.context.at.charCodeAt(0),e=this.context.getOpt("headerTpl");return e&&1===this.$el.children().length&&this.$el.prepend(e),this.$el.attr({id:"at-view-"+t})},w.prototype.destroy=function(){return this.$el.remove()},w.prototype.bindEvent=function(){var e,i=this.$el.find("ul"),r=0,n=0;return i.on("mousemove.atwho-view","li",function(t){var e;if((r!==t.clientX||n!==t.clientY)&&(r=t.clientX,n=t.clientY,!(e=l(t.currentTarget)).hasClass("cur")))return i.find(".cur").removeClass("cur"),e.addClass("cur")}).on("click.atwho-view","li",(e=this,function(t){return i.find(".cur").removeClass("cur"),l(t.currentTarget).addClass("cur"),e.choose(t),t.preventDefault()}))},w.prototype.visible=function(){return l.expr.pseudos.visible(this.$el[0])},w.prototype.highlighted=function(){return 0<this.$el.find(".cur").length},w.prototype.choose=function(t){var e,i;if((e=this.$el.find(".cur")).length&&(i=this.context.insertContentFor(e),this.context._stopDelayedCall(),this.context.insert(this.context.callbacks("beforeInsert").call(this.context,i,e,t),e),this.context.trigger("inserted",[e,t]),this.hide(t)),this.context.getOpt("hideWithoutSuffix"))return this.stopShowing=!0},w.prototype.reposition=function(t){var e=this.context.app.iframeAsRoot?this.context.app.window:window;return t.bottom+this.$el.height()-l(e).scrollTop()>l(e).height()&&(t.bottom=t.top-this.$el.height()),t.left>(e=l(e).width()-this.$el.width()-5)&&(t.left=e),e={left:t.left,top:t.bottom},null!=(t=this.context.callbacks("beforeReposition"))&&t.call(this.context,e),this.$el.offset(e),this.context.trigger("reposition",[e])},w.prototype.next=function(){var t=this.$el.find(".cur").removeClass("cur").next();return(t=!t.length?this.$el.find("li:first"):t).addClass("cur"),t=(t=t[0]).offsetTop+t.offsetHeight+(t.nextSibling?t.nextSibling.offsetHeight:0),this.scrollTop(Math.max(0,t-this.$el.height()))},w.prototype.prev=function(){var t=this.$el.find(".cur").removeClass("cur").prev();return(t=!t.length?this.$el.find("li:last"):t).addClass("cur"),t=(t=t[0]).offsetTop+t.offsetHeight+(t.nextSibling?t.nextSibling.offsetHeight:0),this.scrollTop(Math.max(0,t-this.$el.height()))},w.prototype.scrollTop=function(t){var e=this.context.getOpt("scrollDuration");return e?this.$elUl.animate({scrollTop:t},e):this.$elUl.scrollTop(t)},w.prototype.show=function(){var t;if(!this.stopShowing)return this.visible()||(this.$el.show(),this.$el.scrollTop(0),this.context.trigger("shown")),(t=this.context.rect())?this.reposition(t):void 0;this.stopShowing=!1},w.prototype.hide=function(t,e){var i;if(this.visible())return isNaN(e)?(this.$el.hide(),this.context.trigger("hidden",[t])):(i=this,t=function(){return i.hide()},clearTimeout(this.timeoutID),this.timeoutID=setTimeout(t,e))},w.prototype.render=function(t){var e,i,r,n,o,s;if(Array.isArray(t)&&0<t.length){for(this.$el.find("ul").empty(),e=this.$el.find("ul"),s=this.context.getOpt("displayTpl"),i=0,n=t.length;i<n;i++)r=t[i],r=l.extend({},r,{"atwho-at":this.context.at}),o=this.context.callbacks("tplEval").call(this.context,s,r,"onDisplay"),(o=l(this.context.callbacks("highlighter").call(this.context,o,this.context.query.text))).data("item-data",r),e.append(o);return this.show(),this.context.getOpt("highlightFirst")?e.find("li:first").addClass("cur"):void 0}this.hide()},f=w,d={load:function(t,e){if(t=this.controller(t))return t.model.load(e)},isSelecting:function(){var t;return!(null==(t=this.controller())||!t.view.visible())},hide:function(){var t;return null!=(t=this.controller())?t.view.hide():void 0},reposition:function(){var t;if(t=this.controller())return t.view.reposition(t.rect())},setIframe:function(t,e){return this.setupRootElement(t,e),null},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},l.fn.atwho=function(i){var r=arguments,n=null;return this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function(){var t,e;return(e=(t=l(this)).data("atwho"))||t.data("atwho",e=new o(this)),"object"!=typeof i&&i?d[i]&&e?n=d[i].apply(e,Array.prototype.slice.call(r,1)):l.error("Method "+i+" does not exist on jQuery.atwho"):e.reg(i.at,i)}),null!=n?n:this},l.fn.atwho.default={at:void 0,alias:void 0,data:null,displayTpl:"<li>${name}</li>",insertTpl:"${atwho-at}${name}",headerTpl:null,callbacks:i,functionOverrides:{},searchKey:"name",suffix:void 0,hideWithoutSuffix:!1,startWithSpace:!0,acceptSpaceBar:!1,highlightFirst:!0,limit:5,maxLen:20,minLen:0,displayTimeout:300,delay:null,spaceSelectsMatch:!1,tabSelectsMatch:!0,editableAtwhoQueryAttrs:{},scrollDuration:150,suspendOnComposing:!0,lookUpOnClick:!0},l.fn.atwho.debug=!1});
|
@@ -1 +1 @@
|
|
1 |
-
!function(o,m){function e(t,a){var e=t.data("livestampdata");"number"==typeof a&&(a*=1e3),t.removeAttr("data-livestamp").removeData("livestamp"),a=m(a),m.isMoment(a)&&!isNaN(+a)&&((e=o.extend({},{original:t.contents()},e)).moment=m(a),t.data("livestampdata",e).empty(),
|
1 |
+
!function(o,m){function e(t,a){var e=t.data("livestampdata");"number"==typeof a&&(a*=1e3),t.removeAttr("data-livestamp").removeData("livestamp"),a=m(a),m.isMoment(a)&&!isNaN(+a)&&((e=o.extend({},{original:t.contents()},e)).moment=m(a),t.data("livestampdata",e).empty(),n.push(t[0]))}var a=1e3,t=!1,n=o([]),i=function(){t||(r.update(),setTimeout(i,a))},r={update:function(){o("[data-livestamp]").each(function(){var t=o(this);e(t,t.data("livestamp"))});var i=[];n.each(function(){var t,a,e=o(this),n=e.data("livestampdata");void 0===n?i.push(this):!m.isMoment(n.moment)||(t=e.html())!=(a=n.moment.fromNow())&&(n=o.Event("change.livestamp"),e.trigger(n,[t,a]),n.isDefaultPrevented()||e.html(a))}),n=n.not(i)},pause:function(){t=!0},resume:function(){t=!1,i()},interval:function(t){if(void 0===t)return a;a=t}},s={add:function(t,a){return"number"==typeof a&&(a*=1e3),a=m(a),m.isMoment(a)&&!isNaN(+a)&&(t.each(function(){e(o(this),a)}),r.update()),t},destroy:function(e){return n=n.not(e),e.each(function(){var t=o(this),a=t.data("livestampdata");if(void 0===a)return e;t.html(a.original||"").removeData("livestampdata")}),e},isLivestamp:function(t){return void 0!==t.data("livestampdata")}};o.livestamp=r,o(function(){r.resume()}),o.fn.livestamp=function(t,a){return s[t]||(a=t,t="add"),s[t](this,a)}}(jQuery,moment);
|
@@ -1 +1 @@
|
|
1 |
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e;function h(){return e.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function o(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function i(e,t){for(var n=[],s=0;s<e.length;++s)n.push(t(e[s],s));return n}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return St(e,t,n,s,!0).utc()}function f(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}),e._pf}function d(e){if(null==e._isValid){var t=f(e),n=_.call(t.parsedDateParts,function(e){return null!=e}),n=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return n;e._isValid=n}return e._isValid}function r(e){var t=l(NaN);return null!=e?u(f(t),e):f(t).userInvalidated=!0,t}function m(e){return void 0===e}var _=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},y=h.momentProperties=[];function g(e,t){var n,s,i;if(m(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),m(t._i)||(e._i=t._i),m(t._f)||(e._f=t._f),m(t._l)||(e._l=t._l),m(t._strict)||(e._strict=t._strict),m(t._tzm)||(e._tzm=t._tzm),m(t._isUTC)||(e._isUTC=t._isUTC),m(t._offset)||(e._offset=t._offset),m(t._pf)||(e._pf=f(t)),m(t._locale)||(e._locale=t._locale),0<y.length)for(n in y)m(i=t[s=y[n]])||(e[s]=i);return e}var t=!1;function p(e){g(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),!1===t&&(t=!0,h.updateOffset(this),t=!1)}function w(e){return e instanceof p||null!=e&&null!=e._isAMomentObject}function v(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function S(e){var t=+e,e=0;return e=0!=t&&isFinite(t)?v(t):e}function M(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&S(e[a])!==S(t[a]))&&r++;return r+i}function k(e){!1===h.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return u(function(){if(null!=h.deprecationHandler&&h.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}k(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var D={};function Y(e,t){null!=h.deprecationHandler&&h.deprecationHandler(e,t),D[e]||(k(t),D[e]=!0)}function x(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function O(e,t){var n,s=u({},e);for(n in t)c(t,n)&&(o(e[n])&&o(t[n])?(s[n]={},u(s[n],e[n]),u(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&o(e[n])&&(s[n]=u({},s[n]));return s}function b(e){null!=e&&this.set(e)}h.suppressDeprecationWarnings=!1,h.deprecationHandler=null;var T=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};var P={};function W(e,t){var n=e.toLowerCase();P[n]=P[n+"s"]=P[t]=e}function R(e){return"string"==typeof e?P[e]||P[e.toLowerCase()]:void 0}function U(e){var t,n,s={};for(n in e)c(e,n)&&(t=R(n))&&(s[t]=e[n]);return s}var C={};function F(e,t){C[e]=t}function H(t,n){return function(e){return null!=e?(G(this,t,e),h.updateOffset(this,n),this):L(this,t)}}function L(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function G(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function V(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var j=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,E=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,A={},I={};function N(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(I[e]=i),t&&(I[t[0]]=function(){return V(i.apply(this,arguments),t[1],t[2])}),n&&(I[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function z(e,t){return e.isValid()?(t=Z(t,e.localeData()),A[t]=A[t]||function(s){for(var e,i=s.match(j),t=0,r=i.length;t<r;t++)I[i[t]]?i[t]=I[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=i[n]instanceof Function?i[n].call(e,s):i[n];return t}}(t),A[t](e)):e.localeData().invalidDate()}function Z(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(E.lastIndex=0;0<=n&&E.test(e);)e=e.replace(E,s),E.lastIndex=0,--n;return e}var q=/\d/,$=/\d\d/,B=/\d{3}/,J=/\d{4}/,Q=/[+-]?\d{6}/,X=/\d\d?/,K=/\d\d\d\d?/,ee=/\d\d\d\d\d\d?/,te=/\d{1,3}/,ne=/\d{1,4}/,se=/[+-]?\d{1,6}/,ie=/\d+/,re=/[+-]?\d+/,ae=/Z|[+-]\d\d:?\d\d/gi,oe=/Z|[+-]\d\d(?::?\d\d)?/gi,ue=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,le={};function de(e,n,s){le[e]=x(n)?n:function(e,t){return e&&s?s:n}}function he(e,t){return c(le,e)?le[e](t._strict,t._locale):new RegExp(ce(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function ce(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var fe={};function me(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),"number"==typeof n&&(s=function(e,t){t[n]=S(e)}),t=0;t<e.length;t++)fe[e[t]]=s}function _e(e,i){me(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var ye,ge=0,pe=1,we=2,ve=3,Se=4,Me=5,ke=6,De=7,Ye=8;function xe(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}ye=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},N("M",["MM",2],"Mo",function(){return this.month()+1}),N("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),N("MMMM",0,0,function(e){return this.localeData().months(this,e)}),W("month","M"),F("month",8),de("M",X),de("MM",X,$),de("MMM",function(e,t){return t.monthsShortRegex(e)}),de("MMMM",function(e,t){return t.monthsRegex(e)}),me(["M","MM"],function(e,t){t[pe]=S(e)-1}),me(["MMM","MMMM"],function(e,t,n,s){s=n._locale.monthsParse(e,s,n._strict);null!=s?t[pe]=s:f(n).invalidMonth=e});var Oe=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,be="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var Te="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Pe(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=S(t);else if("number"!=typeof(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),xe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function We(e){return null!=e?(Pe(this,e),h.updateOffset(this,!0),this):L(this,"Month")}var Re=ue;var Ue=ue;function Ce(){function e(e,t){return t.length-e.length}for(var t,n=[],s=[],i=[],r=0;r<12;r++)t=l([2e3,r]),n.push(this.monthsShort(t,"")),s.push(this.months(t,"")),i.push(this.months(t,"")),i.push(this.monthsShort(t,""));for(n.sort(e),s.sort(e),i.sort(e),r=0;r<12;r++)n[r]=ce(n[r]),s[r]=ce(s[r]);for(r=0;r<24;r++)i[r]=ce(i[r]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function Fe(e){return He(e)?366:365}function He(e){return e%4==0&&e%100!=0||e%400==0}N("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),N(0,["YY",2],0,function(){return this.year()%100}),N(0,["YYYY",4],0,"year"),N(0,["YYYYY",5],0,"year"),N(0,["YYYYYY",6,!0],0,"year"),W("year","y"),F("year",1),de("Y",re),de("YY",X,$),de("YYYY",ne,J),de("YYYYY",se,Q),de("YYYYYY",se,Q),me(["YYYYY","YYYYYY"],ge),me("YYYY",function(e,t){t[ge]=2===e.length?h.parseTwoDigitYear(e):S(e)}),me("YY",function(e,t){t[ge]=h.parseTwoDigitYear(e)}),me("Y",function(e,t){t[ge]=parseInt(e,10)}),h.parseTwoDigitYear=function(e){return S(e)+(68<S(e)?1900:2e3)};var Le=H("FullYear",!0);function Ge(e,t,n,s,i,r,a){a=new Date(e,t,n,s,i,r,a);return e<100&&0<=e&&isFinite(a.getFullYear())&&a.setFullYear(e),a}function Ve(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&0<=e&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function je(e,t,n){n=7+t-n;return n-(7+Ve(e,0,n).getUTCDay()-t)%7-1}function Ee(e,t,n,s,i){var r,i=1+7*(t-1)+(7+n-s)%7+je(e,s,i),i=i<=0?Fe(r=e-1)+i:i>Fe(e)?(r=e+1,i-Fe(e)):(r=e,i);return{year:r,dayOfYear:i}}function Ae(e,t,n){var s,i,r=je(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+Ie(i=e.year()-1,t,n):r>Ie(e.year(),t,n)?(s=r-Ie(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function Ie(e,t,n){var s=je(e,t,n),n=je(e+1,t,n);return(Fe(e)-s+n)/7}N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),W("week","w"),W("isoWeek","W"),F("week",5),F("isoWeek",5),de("w",X),de("ww",X,$),de("W",X),de("WW",X,$),_e(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=S(e)});N("d",0,"do","day"),N("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),N("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),N("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),W("day","d"),W("weekday","e"),W("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),de("d",X),de("e",X),de("E",X),de("dd",function(e,t){return t.weekdaysMinRegex(e)}),de("ddd",function(e,t){return t.weekdaysShortRegex(e)}),de("dddd",function(e,t){return t.weekdaysRegex(e)}),_e(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:f(n).invalidWeekday=e}),_e(["d","e","E"],function(e,t,n,s){t[s]=S(e)});var Ne="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ue;var $e=ue;var Be=ue;function Je(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=this.weekdaysMin(s,""),n=this.weekdaysShort(s,""),s=this.weekdays(s,""),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);for(i.sort(e),r.sort(e),a.sort(e),o.sort(e),u=0;u<7;u++)r[u]=ce(r[u]),a[u]=ce(a[u]),o[u]=ce(o[u]);this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,t){N(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ke(e,t){return t._meridiemParse}N("H",["HH",2],0,"hour"),N("h",["hh",2],0,Qe),N("k",["kk",2],0,function(){return this.hours()||24}),N("hmm",0,0,function(){return""+Qe.apply(this)+V(this.minutes(),2)}),N("hmmss",0,0,function(){return""+Qe.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),W("hour","h"),F("hour",13),de("a",Ke),de("A",Ke),de("H",X),de("h",X),de("HH",X,$),de("hh",X,$),de("hmm",K),de("hmmss",ee),de("Hmm",K),de("Hmmss",ee),me(["H","HH"],ve),me(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),me(["h","hh"],function(e,t,n){t[ve]=S(e),f(n).bigHour=!0}),me("hmm",function(e,t,n){var s=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s)),f(n).bigHour=!0}),me("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s,2)),t[Me]=S(e.substr(i)),f(n).bigHour=!0}),me("Hmm",function(e,t,n){var s=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s))}),me("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s,2)),t[Me]=S(e.substr(i))});var et,tt=H("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",ordinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:be,monthsShort:Te,week:{dow:0,doy:6},weekdays:Ne,weekdaysMin:Ze,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},st={};function it(e){return e&&e.toLowerCase().replace("_","-")}function rt(e){var t;if(!st[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),at(t)}catch(e){}return st[e]}function at(e,t){var n;return(et=e&&(n=m(t)?ut(e):ot(e,t))?n:et)._abbr}function ot(e,t){if(null===t)return delete st[e],null;var n=nt;return t.abbr=e,null!=st[e]?(Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=st[e]._config):null!=t.parentLocale&&(null!=st[t.parentLocale]?n=st[t.parentLocale]._config:Y("parentLocaleUndefined","specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/")),st[e]=new b(O(n,t)),at(e),st[e]}function ut(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return et;if(!a(e)){if(t=rt(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=it(e[r]).split("-")).length,n=(n=it(e[r+1]))?n.split("-"):null;0<t;){if(s=rt(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&M(i,n,!0)>=t-1)break;t--}r++}return null}(e)}function lt(e){var t=e._a;return t&&-2===f(e).overflow&&(t=t[pe]<0||11<t[pe]?pe:t[we]<1||t[we]>xe(t[ge],t[pe])?we:t[ve]<0||24<t[ve]||24===t[ve]&&(0!==t[Se]||0!==t[Me]||0!==t[ke])?ve:t[Se]<0||59<t[Se]?Se:t[Me]<0||59<t[Me]?Me:t[ke]<0||999<t[ke]?ke:-1,f(e)._overflowDayOfYear&&(t<ge||we<t)&&(t=we),f(e)._overflowWeeks&&-1===t&&(t=De),f(e)._overflowWeekday&&-1===t&&(t=Ye),f(e).overflow=t),e}var dt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,ht=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,ct=/Z|[+-]\d\d(?::?\d\d)?/,ft=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],mt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],_t=/^\/?Date\((\-?\d+)/i;function yt(e){var t,n,s,i,r,a,o=e._i,u=dt.exec(o)||ht.exec(o);if(u){for(f(e).iso=!0,t=0,n=ft.length;t<n;t++)if(ft[t][1].exec(u[1])){i=ft[t][0],s=!1!==ft[t][2];break}if(null!=i){if(u[3]){for(t=0,n=mt.length;t<n;t++)if(mt[t][1].exec(u[3])){r=(u[2]||" ")+mt[t][0];break}if(null==r)return void(e._isValid=!1)}if(s||null==r){if(u[4]){if(!ct.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),wt(e)}else e._isValid=!1}else e._isValid=!1}else e._isValid=!1}function gt(e,t,n){return null!=e?e:null!=t?t:n}function pt(e){var t,n,s,i,r=[];if(!e._d){for(s=e,i=new Date(h.now()),n=s._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()],e._w&&null==e._a[we]&&null==e._a[pe]&&function(e){var t,n,s,i,r,a,o;null!=(t=e._w).GG||null!=t.W||null!=t.E?(r=1,a=4,n=gt(t.GG,e._a[ge],Ae(Mt(),1,4).year),s=gt(t.W,1),((i=gt(t.E,1))<1||7<i)&&(o=!0)):(r=e._locale._week.dow,a=e._locale._week.doy,n=gt(t.gg,e._a[ge],Ae(Mt(),r,a).year),s=gt(t.w,1),null!=t.d?((i=t.d)<0||6<i)&&(o=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(o=!0)):i=r);s<1||s>Ie(n,r,a)?f(e)._overflowWeeks=!0:null!=o?f(e)._overflowWeekday=!0:(a=Ee(n,s,i,r,a),e._a[ge]=a.year,e._dayOfYear=a.dayOfYear)}(e),e._dayOfYear&&(i=gt(e._a[ge],n[ge]),e._dayOfYear>Fe(i)&&(f(e)._overflowDayOfYear=!0),i=Ve(i,0,e._dayOfYear),e._a[pe]=i.getUTCMonth(),e._a[we]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=r[t]=n[t];for(;t<7;t++)e._a[t]=r[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ve]&&0===e._a[Se]&&0===e._a[Me]&&0===e._a[ke]&&(e._nextDay=!0,e._a[ve]=0),e._d=(e._useUTC?Ve:Ge).apply(null,r),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ve]=24)}}function wt(e){if(e._f!==h.ISO_8601){e._a=[],f(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=Z(e._f,e._locale).match(j)||[],d=0;d<l.length;d++)n=l[d],(t=(a.match(he(n,e))||[])[0])&&(0<(i=a.substr(0,a.indexOf(t))).length&&f(e).unusedInput.push(i),a=a.slice(a.indexOf(t)+t.length),u+=t.length),I[n]?(t?f(e).empty=!1:f(e).unusedTokens.push(n),s=n,r=e,null!=(i=t)&&c(fe,s)&&fe[s](i,r._a,r,s)):e._strict&&!t&&f(e).unusedTokens.push(n);f(e).charsLeftOver=o-u,0<a.length&&f(e).unusedInput.push(a),e._a[ve]<=12&&!0===f(e).bigHour&&0<e._a[ve]&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[ve]=function(e,t,n){if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((n=e.isPM(n))&&t<12&&(t+=12),t=n||12!==t?t:0):t}(e._locale,e._a[ve],e._meridiem),pt(e),lt(e)}else yt(e)}function vt(e){var t=e._i,n=e._f;return e._locale=e._locale||ut(e._l),null===t||void 0===n&&""===t?r({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),w(t)?new p(lt(t)):(a(n)?function(e){var t,n,s,i,r;if(0===e._f.length)return f(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=g({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],wt(t),d(t)&&(r+=f(t).charsLeftOver,r+=10*f(t).unusedTokens.length,f(t).score=r,(null==s||r<s)&&(s=r,n=t));u(e,n||t)}(e):s(t)?e._d=t:n?wt(e):void 0===(n=(t=e)._i)?t._d=new Date(h.now()):s(n)?t._d=new Date(n.valueOf()):"string"==typeof n?function(e){var t=_t.exec(e._i);null===t?(yt(e),!1===e._isValid&&(delete e._isValid,h.createFromInputFallback(e))):e._d=new Date(+t[1])}(t):a(n)?(t._a=i(n.slice(0),function(e){return parseInt(e,10)}),pt(t)):"object"==typeof n?function(e){var t;e._d||(t=U(e._i),e._a=i([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),pt(e))}(t):"number"==typeof n?t._d=new Date(n):h.createFromInputFallback(t),d(e)||(e._d=null),e))}function St(e,t,n,s,i){var r={};return"boolean"==typeof n&&(s=n,n=void 0),(o(e)&&function(e){for(var t in e)return;return 1}(e)||a(e)&&0===e.length)&&(e=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=i,r._l=n,r._i=e,r._f=t,r._strict=s,(r=new p(lt(vt(r=r))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function Mt(e,t,n,s){return St(e,t,n,s,!1)}h.createFromInputFallback=n("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),h.ISO_8601=function(){};ue=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Mt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:r()}),K=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Mt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:r()});function kt(e,t){var n,s;if(!(t=1===t.length&&a(t[0])?t[0]:t).length)return Mt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}function Dt(e){var t=U(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||0,a=t.day||0,o=t.hour||0,u=t.minute||0,e=t.second||0,t=t.millisecond||0;this._milliseconds=+t+1e3*e+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ut(),this._bubble()}function Yt(e){return e instanceof Dt}function xt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ot(e,n){N(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+V(~~(e/60),2)+n+V(~~e%60,2)})}Ot("Z",":"),Ot("ZZ",""),de("Z",oe),de("ZZ",oe),me(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Tt(oe,e)});var bt=/([\+\-]|\d\d)/gi;function Tt(e,t){t=(t||"").match(e)||[],e=((t[t.length-1]||[])+"").match(bt)||["-",0,0],t=60*e[1]+S(e[2]);return"+"===e[0]?t:-t}function Pt(e,t){var n;return t._isUTC?(n=t.clone(),t=(w(e)||s(e)?e:Mt(e)).valueOf()-n.valueOf(),n._d.setTime(n._d.valueOf()+t),h.updateOffset(n,!1),n):Mt(e).local()}function Wt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Rt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}h.updateOffset=function(){};var Ut=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ct=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;function Ft(e,t){var n,s=e,i=null;return Yt(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(s={},t?s[t]=e:s.milliseconds=e):(i=Ut.exec(e))?(n="-"===i[1]?-1:1,s={y:0,d:S(i[we])*n,h:S(i[ve])*n,m:S(i[Se])*n,s:S(i[Me])*n,ms:S(xt(1e3*i[ke]))*n}):(i=Ct.exec(e))?(n="-"===i[1]?-1:1,s={y:Ht(i[2],n),M:Ht(i[3],n),w:Ht(i[4],n),d:Ht(i[5],n),h:Ht(i[6],n),m:Ht(i[7],n),s:Ht(i[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(n=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Pt(t,e),e.isBefore(t)?n=Lt(e,t):((n=Lt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Mt(s.from),Mt(s.to)),(s={}).ms=n.milliseconds,s.M=n.months),s=new Dt(s),Yt(e)&&c(e,"_locale")&&(s._locale=e._locale),s}function Ht(e,t){e=e&&parseFloat(e.replace(",","."));return(isNaN(e)?0:e)*t}function Lt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Gt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Y(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),Vt(this,Ft(e="string"==typeof e?+e:e,t),s),this}}function Vt(e,t,n,s){var i=t._milliseconds,r=xt(t._days),t=xt(t._months);e.isValid()&&(s=null==s||s,i&&e._d.setTime(e._d.valueOf()+i*n),r&&G(e,"Date",L(e,"Date")+r*n),t&&Pe(e,L(e,"Month")+t*n),s&&h.updateOffset(e,r||t))}Ft.fn=Dt.prototype;ee=Gt(1,"add"),be=Gt(-1,"subtract");function jt(e){return void 0===e?this._locale._abbr:(null!=(e=ut(e))&&(this._locale=e),this)}h.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",h.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";Te=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Et(){return this._locale}function At(e,t){N(0,[e,e.length],0,t)}function It(e,t,n,s,i){var r;return null==e?Ae(this,s,i).year:(r=Ie(e,s,i),function(e,t,n,s,i){i=Ee(e,t,n,s,i),i=Ve(i.year,0,i.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}.call(this,e,t=r<t?r:t,n,s,i))}N(0,["gg",2],0,function(){return this.weekYear()%100}),N(0,["GG",2],0,function(){return this.isoWeekYear()%100}),At("gggg","weekYear"),At("ggggg","weekYear"),At("GGGG","isoWeekYear"),At("GGGGG","isoWeekYear"),W("weekYear","gg"),W("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),de("G",re),de("g",re),de("GG",X,$),de("gg",X,$),de("GGGG",ne,J),de("gggg",ne,J),de("GGGGG",se,Q),de("ggggg",se,Q),_e(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=S(e)}),_e(["gg","GG"],function(e,t,n,s){t[s]=h.parseTwoDigitYear(e)}),N("Q",0,"Qo","quarter"),W("quarter","Q"),F("quarter",7),de("Q",q),me("Q",function(e,t){t[pe]=3*(S(e)-1)}),N("D",["DD",2],"Do","date"),W("date","D"),F("date",9),de("D",X),de("DD",X,$),de("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),me(["D","DD"],we),me("Do",function(e,t){t[we]=S(e.match(X)[0])});Ne=H("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),W("dayOfYear","DDD"),F("dayOfYear",4),de("DDD",te),de("DDDD",B),me(["DDD","DDDD"],function(e,t,n){n._dayOfYear=S(e)}),N("m",["mm",2],0,"minute"),W("minute","m"),F("minute",14),de("m",X),de("mm",X,$),me(["m","mm"],Se);Ze=H("Minutes",!1);N("s",["ss",2],0,"second"),W("second","s"),F("second",15),de("s",X),de("ss",X,$),me(["s","ss"],Me);var Nt,ze=H("Seconds",!1);for(N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return 10*this.millisecond()}),N(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),N(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),N(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),N(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),N(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),W("millisecond","ms"),F("millisecond",16),de("S",te,q),de("SS",te,$),de("SSS",te,B),Nt="SSSS";Nt.length<=9;Nt+="S")de(Nt,ie);function zt(e,t){t[ke]=S(1e3*("0."+e))}for(Nt="S";Nt.length<=9;Nt+="S")me(Nt,zt);ne=H("Milliseconds",!1);N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");J=p.prototype;J.add=ee,J.calendar=function(e,t){var n=e||Mt(),e=Pt(n,this).startOf("day"),e=h.calendarFormat(this,e)||"sameElse",t=t&&(x(t[e])?t[e].call(this,n):t[e]);return this.format(t||this.localeData().calendar(e,this,Mt(n)))},J.clone=function(){return new p(this)},J.diff=function(e,t,n){var s,i;return this.isValid()&&(s=Pt(e,this)).isValid()?(e=6e4*(s.utcOffset()-this.utcOffset()),"year"===(t=R(t))||"month"===t||"quarter"===t?(i=function(e,t){var n,s=12*(t.year()-e.year())+(t.month()-e.month()),i=e.clone().add(s,"months");i=t-i<0?(n=e.clone().add(s-1,"months"),(t-i)/(i-n)):(n=e.clone().add(1+s,"months"),(t-i)/(n-i));return-(s+i)||0}(this,s),"quarter"===t?i/=3:"year"===t&&(i/=12)):(s=this-s,i="second"===t?s/1e3:"minute"===t?s/6e4:"hour"===t?s/36e5:"day"===t?(s-e)/864e5:"week"===t?(s-e)/6048e5:s),n?i:v(i)):NaN},J.endOf=function(e){return void 0===(e=R(e))||"millisecond"===e?this:this.startOf(e="date"===e?"day":e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms")},J.format=function(e){return e=e||(this.isUtc()?h.defaultFormatUtc:h.defaultFormat),e=z(this,e),this.localeData().postformat(e)},J.from=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||Mt(e).isValid())?Ft({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},J.fromNow=function(e){return this.from(Mt(),e)},J.to=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||Mt(e).isValid())?Ft({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},J.toNow=function(e){return this.to(Mt(),e)},J.get=function(e){return x(this[e=R(e)])?this[e]():this},J.invalidAt=function(){return f(this).overflow},J.isAfter=function(e,t){return e=w(e)?e:Mt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=R(m(t)?"millisecond":t))?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},J.isBefore=function(e,t){return e=w(e)?e:Mt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=R(m(t)?"millisecond":t))?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},J.isBetween=function(e,t,n,s){return("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},J.isSame=function(e,t){var e=w(e)?e:Mt(e);return!(!this.isValid()||!e.isValid())&&("millisecond"===(t=R(t||"millisecond"))?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},J.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},J.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},J.isValid=function(){return d(this)},J.lang=Te,J.locale=jt,J.localeData=Et,J.max=K,J.min=ue,J.parsingFlags=function(){return u({},f(this))},J.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)n.push({unit:t,priority:C[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=U(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(x(this[e=R(e)]))return this[e](t);return this},J.startOf=function(e){switch(e=R(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},J.subtract=be,J.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},J.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},J.toDate=function(){return new Date(this.valueOf())},J.toISOString=function(){var e=this.clone().utc();return 0<e.year()&&e.year()<=9999?x(Date.prototype.toISOString)?this.toDate().toISOString():z(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):z(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},J.toJSON=function(){return this.isValid()?this.toISOString():null},J.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},J.unix=function(){return Math.floor(this.valueOf()/1e3)},J.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},J.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},J.year=Le,J.isLeapYear=function(){return He(this.year())},J.weekYear=function(e){return It.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},J.isoWeekYear=function(e){return It.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},J.quarter=J.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},J.month=We,J.daysInMonth=function(){return xe(this.year(),this.month())},J.week=J.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},J.isoWeek=J.isoWeeks=function(e){var t=Ae(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},J.weeksInYear=function(){var e=this.localeData()._week;return Ie(this.year(),e.dow,e.doy)},J.isoWeeksInYear=function(){return Ie(this.year(),1,4)},J.date=Ne,J.day=J.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},J.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},J.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t=(t=e,e=this.localeData(),"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?t:t-7)},J.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},J.hour=J.hours=tt,J.minute=J.minutes=Ze,J.second=J.seconds=ze,J.millisecond=J.milliseconds=ne,J.utcOffset=function(e,t){var n,s=this._offset||0;return this.isValid()?null!=e?("string"==typeof e?e=Tt(oe,e):Math.abs(e)<16&&(e*=60),!this._isUTC&&t&&(n=Wt(this)),this._offset=e,this._isUTC=!0,null!=n&&this.add(n,"m"),s!==e&&(!t||this._changeInProgress?Vt(this,Ft(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,h.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?s:Wt(this):null!=e?this:NaN},J.utc=function(e){return this.utcOffset(0,e)},J.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Wt(this),"m")),this},J.parseZone=function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&(0===Tt(ae,this._i)?this.utcOffset(0,!0):this.utcOffset(Tt(ae,this._i))),this},J.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Mt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},J.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},J.isLocal=function(){return!!this.isValid()&&!this._isUTC},J.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},J.isUtc=Rt,J.isUTC=Rt,J.zoneAbbr=function(){return this._isUTC?"UTC":""},J.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},J.dates=n("dates accessor is deprecated. Use date instead.",Ne),J.months=n("months accessor is deprecated. Use month instead",We),J.years=n("years accessor is deprecated. Use year instead",Le),J.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),J.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!m(this._isDSTShifted))return this._isDSTShifted;var e,t={};return g(t,this),(t=vt(t))._a?(e=(t._isUTC?l:Mt)(t._a),this._isDSTShifted=this.isValid()&&0<M(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted});se=J;function Zt(e){return e}Q=b.prototype;function qt(e,t,n,s){var i=ut(),t=l().set(s,t);return i[n](t,e)}function $t(e,t,n){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return qt(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=qt(e,i,n,"month");return s}function Bt(e,t,n,s){t=("boolean"==typeof e?"number"==typeof t&&(n=t,t=void 0):(t=e,e=!1,"number"==typeof(n=t)&&(n=t,t=void 0)),t||"");var i=ut(),r=e?i._week.dow:0;if(null!=n)return qt(t,(n+r)%7,s,"day");for(var a=[],o=0;o<7;o++)a[o]=qt(t,(o+r)%7,s,"day");return a}Q.calendar=function(e,t,n){return x(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,n):e},Q.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},Q.invalidDate=function(){return this._invalidDate},Q.ordinal=function(e){return this._ordinal.replace("%d",e)},Q.preparse=Zt,Q.postformat=Zt,Q.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return x(i)?i(e,t,n,s):i.replace(/%d/i,e)},Q.pastFuture=function(e,t){return x(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},Q.set=function(e){var t,n;for(n in e)x(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},Q.months=function(e,t){return e?(a(this._months)?this._months:this._months[(this._months.isFormat||Oe).test(t)?"format":"standalone"])[e.month()]:this._months},Q.monthsShort=function(e,t){return e?(a(this._monthsShort)?this._monthsShort:this._monthsShort[Oe.test(t)?"format":"standalone"])[e.month()]:this._monthsShort},Q.monthsParse=function(e,t,n){var s,i;if(this._monthsParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=ye.call(this._shortMonthsParse,e))?i:null:-1!==(i=ye.call(this._longMonthsParse,e))?i:null:"MMM"===t?-1!==(i=ye.call(this._shortMonthsParse,e))||-1!==(i=ye.call(this._longMonthsParse,e))?i:null:-1!==(i=ye.call(this._longMonthsParse,e))||-1!==(i=ye.call(this._shortMonthsParse,e))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(i="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},Q.monthsRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ce.call(this),e?this._monthsStrictRegex:this._monthsRegex):(c(this,"_monthsRegex")||(this._monthsRegex=Ue),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},Q.monthsShortRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ce.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(c(this,"_monthsShortRegex")||(this._monthsShortRegex=Re),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},Q.week=function(e){return Ae(e,this._week.dow,this._week.doy).week},Q.firstDayOfYear=function(){return this._week.doy},Q.firstDayOfWeek=function(){return this._week.dow},Q.weekdays=function(e,t){return e?(a(this._weekdays)?this._weekdays:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"])[e.day()]:this._weekdays},Q.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},Q.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},Q.weekdaysParse=function(e,t,n){var s,i;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=ye.call(this._weekdaysParse,e))?i:null:"ddd"===t?-1!==(i=ye.call(this._shortWeekdaysParse,e))?i:null:-1!==(i=ye.call(this._minWeekdaysParse,e))?i:null:"dddd"===t?-1!==(i=ye.call(this._weekdaysParse,e))||-1!==(i=ye.call(this._shortWeekdaysParse,e))||-1!==(i=ye.call(this._minWeekdaysParse,e))?i:null:"ddd"===t?-1!==(i=ye.call(this._shortWeekdaysParse,e))||-1!==(i=ye.call(this._weekdaysParse,e))||-1!==(i=ye.call(this._minWeekdaysParse,e))?i:null:-1!==(i=ye.call(this._minWeekdaysParse,e))||-1!==(i=ye.call(this._weekdaysParse,e))||-1!==(i=ye.call(this._shortWeekdaysParse,e))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[s]||(i="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},Q.weekdaysRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||Je.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(c(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},Q.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||Je.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(c(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=$e),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Q.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||Je.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(c(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Q.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},Q.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},at("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===S(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),h.lang=n("moment.lang is deprecated. Use moment.locale instead.",at),h.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ut);var Jt=Math.abs;function Qt(e,t,n,s){n=Ft(t,n);return e._milliseconds+=s*n._milliseconds,e._days+=s*n._days,e._months+=s*n._months,e._bubble()}function Xt(e){return e<0?Math.floor(e):Math.ceil(e)}function Kt(e){return 4800*e/146097}function en(e){return 146097*e/4800}function tn(e){return function(){return this.as(e)}}q=tn("ms"),$=tn("s"),te=tn("m"),B=tn("h"),ee=tn("d"),K=tn("w"),ue=tn("M"),be=tn("y");function nn(e){return function(){return this._data[e]}}tt=nn("milliseconds"),Ze=nn("seconds"),ze=nn("minutes"),ne=nn("hours"),Ne=nn("days"),Le=nn("months"),J=nn("years");var sn=Math.round,rn={s:45,m:45,h:22,d:26,M:11};function an(e,t,n){var s=Ft(e).abs(),i=sn(s.as("s")),r=sn(s.as("m")),a=sn(s.as("h")),o=sn(s.as("d")),u=sn(s.as("M")),s=sn(s.as("y")),s=(i<rn.s?["s",i]:r<=1&&["m"])||r<rn.m&&["mm",r]||a<=1&&["h"]||a<rn.h&&["hh",a]||o<=1&&["d"]||o<rn.d&&["dd",o]||u<=1&&["M"]||u<rn.M&&["MM",u]||s<=1&&["y"]||["yy",s];return s[2]=t,s[3]=0<+e,s[4]=n,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,s)}var on=Math.abs;function un(){var e=on(this._milliseconds)/1e3,t=on(this._days),n=on(this._months),s=v(e/60),i=v(s/60);e%=60,s%=60;var r=v(n/12),a=n%=12,n=t,t=i,i=s,s=e,e=this.asSeconds();return e?(e<0?"-":"")+"P"+(r?r+"Y":"")+(a?a+"M":"")+(n?n+"D":"")+(t||i||s?"T":"")+(t?t+"H":"")+(i?i+"M":"")+(s?s+"S":""):"P0D"}Q=Dt.prototype;return Q.abs=function(){var e=this._data;return this._milliseconds=Jt(this._milliseconds),this._days=Jt(this._days),this._months=Jt(this._months),e.milliseconds=Jt(e.milliseconds),e.seconds=Jt(e.seconds),e.minutes=Jt(e.minutes),e.hours=Jt(e.hours),e.months=Jt(e.months),e.years=Jt(e.years),this},Q.add=function(e,t){return Qt(this,e,t,1)},Q.subtract=function(e,t){return Qt(this,e,t,-1)},Q.as=function(e){var t,n,s=this._milliseconds;if("month"===(e=R(e))||"year"===e)return t=this._days+s/864e5,n=this._months+Kt(t),"month"===e?n:n/12;switch(t=this._days+Math.round(en(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},Q.asMilliseconds=q,Q.asSeconds=$,Q.asMinutes=te,Q.asHours=B,Q.asDays=ee,Q.asWeeks=K,Q.asMonths=ue,Q.asYears=be,Q.valueOf=function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},Q._bubble=function(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data;return 0<=e&&0<=t&&0<=n||e<=0&&t<=0&&n<=0||(e+=864e5*Xt(en(n)+t),n=t=0),s.milliseconds=e%1e3,e=v(e/1e3),s.seconds=e%60,e=v(e/60),s.minutes=e%60,e=v(e/60),s.hours=e%24,t+=v(e/24),n+=e=v(Kt(t)),t-=Xt(en(e)),e=v(n/12),n%=12,s.days=t,s.months=n,s.years=e,this},Q.get=function(e){return this[(e=R(e))+"s"]()},Q.milliseconds=tt,Q.seconds=Ze,Q.minutes=ze,Q.hours=ne,Q.days=Ne,Q.weeks=function(){return v(this.days()/7)},Q.months=Le,Q.years=J,Q.humanize=function(e){var t=this.localeData(),n=an(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)},Q.toISOString=un,Q.toString=un,Q.toJSON=un,Q.locale=jt,Q.localeData=Et,Q.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",un),Q.lang=Te,N("X",0,0,"unix"),N("x",0,0,"valueOf"),de("x",re),de("X",/[+-]?\d+(\.\d{1,3})?/),me("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),me("x",function(e,t,n){n._d=new Date(S(e))}),h.version="2.15.1",e=Mt,h.fn=se,h.min=function(){return kt("isBefore",[].slice.call(arguments,0))},h.max=function(){return kt("isAfter",[].slice.call(arguments,0))},h.now=function(){return Date.now?Date.now():+new Date},h.utc=l,h.unix=function(e){return Mt(1e3*e)},h.months=function(e,t){return $t(e,t,"months")},h.isDate=s,h.locale=at,h.invalid=r,h.duration=Ft,h.isMoment=w,h.weekdays=function(e,t,n){return Bt(e,t,n,"weekdays")},h.parseZone=function(){return Mt.apply(null,arguments).parseZone()},h.localeData=ut,h.isDuration=Yt,h.monthsShort=function(e,t){return $t(e,t,"monthsShort")},h.weekdaysMin=function(e,t,n){return Bt(e,t,n,"weekdaysMin")},h.defineLocale=ot,h.updateLocale=function(e,t){var n;return null!=t?(n=nt,(t=new b(t=O(n=null!=st[e]?st[e]._config:n,t))).parentLocale=st[e],st[e]=t,at(e)):null!=st[e]&&(null!=st[e].parentLocale?st[e]=st[e].parentLocale:null!=st[e]&&delete st[e]),st[e]},h.locales=function(){return T(st)},h.weekdaysShort=function(e,t,n){return Bt(e,t,n,"weekdaysShort")},h.normalizeUnits=R,h.relativeTimeRounding=function(e){return void 0===e?sn:"function"==typeof e&&(sn=e,!0)},h.relativeTimeThreshold=function(e,t){return void 0!==rn[e]&&(void 0===t?rn[e]:(rn[e]=t,!0))},h.calendarFormat=function(e,t){return(t=e.diff(t,"days",!0))<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"},h.prototype=se,h});
|
1 |
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e;function h(){return e.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function o(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function i(e,t){for(var n=[],s=0;s<e.length;++s)n.push(t(e[s],s));return n}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return St(e,t,n,s,!0).utc()}function f(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}),e._pf}function d(e){if(null==e._isValid){var t=f(e),n=_.call(t.parsedDateParts,function(e){return null!=e}),n=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return n;e._isValid=n}return e._isValid}function r(e){var t=l(NaN);return null!=e?u(f(t),e):f(t).userInvalidated=!0,t}function m(e){return void 0===e}var _=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},y=h.momentProperties=[];function g(e,t){var n,s,i;if(m(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),m(t._i)||(e._i=t._i),m(t._f)||(e._f=t._f),m(t._l)||(e._l=t._l),m(t._strict)||(e._strict=t._strict),m(t._tzm)||(e._tzm=t._tzm),m(t._isUTC)||(e._isUTC=t._isUTC),m(t._offset)||(e._offset=t._offset),m(t._pf)||(e._pf=f(t)),m(t._locale)||(e._locale=t._locale),0<y.length)for(n in y)m(i=t[s=y[n]])||(e[s]=i);return e}var t=!1;function p(e){g(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),!1===t&&(t=!0,h.updateOffset(this),t=!1)}function w(e){return e instanceof p||null!=e&&null!=e._isAMomentObject}function v(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function S(e){var t=+e,e=0;return e=0!=t&&isFinite(t)?v(t):e}function M(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&S(e[a])!==S(t[a]))&&r++;return r+i}function k(e){!1===h.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return u(function(){if(null!=h.deprecationHandler&&h.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}k(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var D={};function Y(e,t){null!=h.deprecationHandler&&h.deprecationHandler(e,t),D[e]||(k(t),D[e]=!0)}function x(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function O(e,t){var n,s=u({},e);for(n in t)c(t,n)&&(o(e[n])&&o(t[n])?(s[n]={},u(s[n],e[n]),u(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&o(e[n])&&(s[n]=u({},s[n]));return s}function b(e){null!=e&&this.set(e)}h.suppressDeprecationWarnings=!1,h.deprecationHandler=null;var T=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};var P={};function W(e,t){var n=e.toLowerCase();P[n]=P[n+"s"]=P[t]=e}function R(e){return"string"==typeof e?P[e]||P[e.toLowerCase()]:void 0}function U(e){var t,n,s={};for(n in e)c(e,n)&&(t=R(n))&&(s[t]=e[n]);return s}var C={};function F(e,t){C[e]=t}function H(t,n){return function(e){return null!=e?(G(this,t,e),h.updateOffset(this,n),this):L(this,t)}}function L(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function G(e,t,n){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](n)}function V(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var j=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,E=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,A={},I={};function N(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(I[e]=i),t&&(I[t[0]]=function(){return V(i.apply(this,arguments),t[1],t[2])}),n&&(I[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function z(e,t){return e.isValid()?(t=Z(t,e.localeData()),A[t]=A[t]||function(s){for(var e,i=s.match(j),t=0,r=i.length;t<r;t++)I[i[t]]?i[t]=I[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=i[n]instanceof Function?i[n].call(e,s):i[n];return t}}(t),A[t](e)):e.localeData().invalidDate()}function Z(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(E.lastIndex=0;0<=n&&E.test(e);)e=e.replace(E,s),E.lastIndex=0,--n;return e}var q=/\d/,$=/\d\d/,B=/\d{3}/,J=/\d{4}/,Q=/[+-]?\d{6}/,X=/\d\d?/,K=/\d\d\d\d?/,ee=/\d\d\d\d\d\d?/,te=/\d{1,3}/,ne=/\d{1,4}/,se=/[+-]?\d{1,6}/,ie=/\d+/,re=/[+-]?\d+/,ae=/Z|[+-]\d\d:?\d\d/gi,oe=/Z|[+-]\d\d(?::?\d\d)?/gi,ue=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,le={};function de(e,n,s){le[e]=x(n)?n:function(e,t){return e&&s?s:n}}function he(e,t){return c(le,e)?le[e](t._strict,t._locale):new RegExp(ce(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function ce(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var fe={};function me(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),"number"==typeof n&&(s=function(e,t){t[n]=S(e)}),t=0;t<e.length;t++)fe[e[t]]=s}function _e(e,i){me(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var ye,ge=0,pe=1,we=2,ve=3,Se=4,Me=5,ke=6,De=7,Ye=8;function xe(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}ye=Array.prototype.indexOf||function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},N("M",["MM",2],"Mo",function(){return this.month()+1}),N("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),N("MMMM",0,0,function(e){return this.localeData().months(this,e)}),W("month","M"),F("month",8),de("M",X),de("MM",X,$),de("MMM",function(e,t){return t.monthsShortRegex(e)}),de("MMMM",function(e,t){return t.monthsRegex(e)}),me(["M","MM"],function(e,t){t[pe]=S(e)-1}),me(["MMM","MMMM"],function(e,t,n,s){s=n._locale.monthsParse(e,s,n._strict);null!=s?t[pe]=s:f(n).invalidMonth=e});var Oe=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,be="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var Te="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Pe(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=S(t);else if("number"!=typeof(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),xe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function We(e){return null!=e?(Pe(this,e),h.updateOffset(this,!0),this):L(this,"Month")}var Re=ue;var Ue=ue;function Ce(){function e(e,t){return t.length-e.length}for(var t,n=[],s=[],i=[],r=0;r<12;r++)t=l([2e3,r]),n.push(this.monthsShort(t,"")),s.push(this.months(t,"")),i.push(this.months(t,"")),i.push(this.monthsShort(t,""));for(n.sort(e),s.sort(e),i.sort(e),r=0;r<12;r++)n[r]=ce(n[r]),s[r]=ce(s[r]);for(r=0;r<24;r++)i[r]=ce(i[r]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function Fe(e){return He(e)?366:365}function He(e){return e%4==0&&e%100!=0||e%400==0}N("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),N(0,["YY",2],0,function(){return this.year()%100}),N(0,["YYYY",4],0,"year"),N(0,["YYYYY",5],0,"year"),N(0,["YYYYYY",6,!0],0,"year"),W("year","y"),F("year",1),de("Y",re),de("YY",X,$),de("YYYY",ne,J),de("YYYYY",se,Q),de("YYYYYY",se,Q),me(["YYYYY","YYYYYY"],ge),me("YYYY",function(e,t){t[ge]=2===e.length?h.parseTwoDigitYear(e):S(e)}),me("YY",function(e,t){t[ge]=h.parseTwoDigitYear(e)}),me("Y",function(e,t){t[ge]=parseInt(e,10)}),h.parseTwoDigitYear=function(e){return S(e)+(68<S(e)?1900:2e3)};var Le=H("FullYear",!0);function Ge(e,t,n,s,i,r,a){a=new Date(e,t,n,s,i,r,a);return e<100&&0<=e&&isFinite(a.getFullYear())&&a.setFullYear(e),a}function Ve(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&0<=e&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function je(e,t,n){n=7+t-n;return n-(7+Ve(e,0,n).getUTCDay()-t)%7-1}function Ee(e,t,n,s,i){var r,i=1+7*(t-1)+(7+n-s)%7+je(e,s,i),i=i<=0?Fe(r=e-1)+i:i>Fe(e)?(r=e+1,i-Fe(e)):(r=e,i);return{year:r,dayOfYear:i}}function Ae(e,t,n){var s,i,r=je(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+Ie(i=e.year()-1,t,n):r>Ie(e.year(),t,n)?(s=r-Ie(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function Ie(e,t,n){var s=je(e,t,n),n=je(e+1,t,n);return(Fe(e)-s+n)/7}N("w",["ww",2],"wo","week"),N("W",["WW",2],"Wo","isoWeek"),W("week","w"),W("isoWeek","W"),F("week",5),F("isoWeek",5),de("w",X),de("ww",X,$),de("W",X),de("WW",X,$),_e(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=S(e)});N("d",0,"do","day"),N("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),N("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),N("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),N("e",0,0,"weekday"),N("E",0,0,"isoWeekday"),W("day","d"),W("weekday","e"),W("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),de("d",X),de("e",X),de("E",X),de("dd",function(e,t){return t.weekdaysMinRegex(e)}),de("ddd",function(e,t){return t.weekdaysShortRegex(e)}),de("dddd",function(e,t){return t.weekdaysRegex(e)}),_e(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:f(n).invalidWeekday=e}),_e(["d","e","E"],function(e,t,n,s){t[s]=S(e)});var Ne="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var Ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var qe=ue;var $e=ue;var Be=ue;function Je(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=this.weekdaysMin(s,""),n=this.weekdaysShort(s,""),s=this.weekdays(s,""),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);for(i.sort(e),r.sort(e),a.sort(e),o.sort(e),u=0;u<7;u++)r[u]=ce(r[u]),a[u]=ce(a[u]),o[u]=ce(o[u]);this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,t){N(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ke(e,t){return t._meridiemParse}N("H",["HH",2],0,"hour"),N("h",["hh",2],0,Qe),N("k",["kk",2],0,function(){return this.hours()||24}),N("hmm",0,0,function(){return""+Qe.apply(this)+V(this.minutes(),2)}),N("hmmss",0,0,function(){return""+Qe.apply(this)+V(this.minutes(),2)+V(this.seconds(),2)}),N("Hmm",0,0,function(){return""+this.hours()+V(this.minutes(),2)}),N("Hmmss",0,0,function(){return""+this.hours()+V(this.minutes(),2)+V(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),W("hour","h"),F("hour",13),de("a",Ke),de("A",Ke),de("H",X),de("h",X),de("HH",X,$),de("hh",X,$),de("hmm",K),de("hmmss",ee),de("Hmm",K),de("Hmmss",ee),me(["H","HH"],ve),me(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),me(["h","hh"],function(e,t,n){t[ve]=S(e),f(n).bigHour=!0}),me("hmm",function(e,t,n){var s=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s)),f(n).bigHour=!0}),me("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s,2)),t[Me]=S(e.substr(i)),f(n).bigHour=!0}),me("Hmm",function(e,t,n){var s=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s))}),me("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ve]=S(e.substr(0,s)),t[Se]=S(e.substr(s,2)),t[Me]=S(e.substr(i))});var et,tt=H("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",ordinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:be,monthsShort:Te,week:{dow:0,doy:6},weekdays:Ne,weekdaysMin:Ze,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},st={};function it(e){return e&&e.toLowerCase().replace("_","-")}function rt(e){var t;if(!st[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),at(t)}catch(e){}return st[e]}function at(e,t){var n;return(et=e&&(n=m(t)?ut(e):ot(e,t))?n:et)._abbr}function ot(e,t){if(null===t)return delete st[e],null;var n=nt;return t.abbr=e,null!=st[e]?(Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=st[e]._config):null!=t.parentLocale&&(null!=st[t.parentLocale]?n=st[t.parentLocale]._config:Y("parentLocaleUndefined","specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/")),st[e]=new b(O(n,t)),at(e),st[e]}function ut(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return et;if(!a(e)){if(t=rt(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=it(e[r]).split("-")).length,n=(n=it(e[r+1]))?n.split("-"):null;0<t;){if(s=rt(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&M(i,n,!0)>=t-1)break;t--}r++}return null}(e)}function lt(e){var t=e._a;return t&&-2===f(e).overflow&&(t=t[pe]<0||11<t[pe]?pe:t[we]<1||t[we]>xe(t[ge],t[pe])?we:t[ve]<0||24<t[ve]||24===t[ve]&&(0!==t[Se]||0!==t[Me]||0!==t[ke])?ve:t[Se]<0||59<t[Se]?Se:t[Me]<0||59<t[Me]?Me:t[ke]<0||999<t[ke]?ke:-1,f(e)._overflowDayOfYear&&(t<ge||we<t)&&(t=we),f(e)._overflowWeeks&&-1===t&&(t=De),f(e)._overflowWeekday&&-1===t&&(t=Ye),f(e).overflow=t),e}var dt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,ht=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,ct=/Z|[+-]\d\d(?::?\d\d)?/,ft=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],mt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],_t=/^\/?Date\((\-?\d+)/i;function yt(e){var t,n,s,i,r,a,o=e._i,u=dt.exec(o)||ht.exec(o);if(u){for(f(e).iso=!0,t=0,n=ft.length;t<n;t++)if(ft[t][1].exec(u[1])){i=ft[t][0],s=!1!==ft[t][2];break}if(null!=i){if(u[3]){for(t=0,n=mt.length;t<n;t++)if(mt[t][1].exec(u[3])){r=(u[2]||" ")+mt[t][0];break}if(null==r)return void(e._isValid=!1)}if(s||null==r){if(u[4]){if(!ct.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),wt(e)}else e._isValid=!1}else e._isValid=!1}else e._isValid=!1}function gt(e,t,n){return null!=e?e:null!=t?t:n}function pt(e){var t,n,s,i,r=[];if(!e._d){for(s=e,i=new Date(h.now()),n=s._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()],e._w&&null==e._a[we]&&null==e._a[pe]&&function(e){var t,n,s,i,r,a,o;null!=(t=e._w).GG||null!=t.W||null!=t.E?(r=1,a=4,n=gt(t.GG,e._a[ge],Ae(Mt(),1,4).year),s=gt(t.W,1),((i=gt(t.E,1))<1||7<i)&&(o=!0)):(r=e._locale._week.dow,a=e._locale._week.doy,n=gt(t.gg,e._a[ge],Ae(Mt(),r,a).year),s=gt(t.w,1),null!=t.d?((i=t.d)<0||6<i)&&(o=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(o=!0)):i=r);s<1||s>Ie(n,r,a)?f(e)._overflowWeeks=!0:null!=o?f(e)._overflowWeekday=!0:(a=Ee(n,s,i,r,a),e._a[ge]=a.year,e._dayOfYear=a.dayOfYear)}(e),e._dayOfYear&&(i=gt(e._a[ge],n[ge]),e._dayOfYear>Fe(i)&&(f(e)._overflowDayOfYear=!0),i=Ve(i,0,e._dayOfYear),e._a[pe]=i.getUTCMonth(),e._a[we]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=r[t]=n[t];for(;t<7;t++)e._a[t]=r[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ve]&&0===e._a[Se]&&0===e._a[Me]&&0===e._a[ke]&&(e._nextDay=!0,e._a[ve]=0),e._d=(e._useUTC?Ve:Ge).apply(null,r),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ve]=24)}}function wt(e){if(e._f!==h.ISO_8601){e._a=[],f(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=Z(e._f,e._locale).match(j)||[],d=0;d<l.length;d++)n=l[d],(t=(a.match(he(n,e))||[])[0])&&(0<(i=a.substr(0,a.indexOf(t))).length&&f(e).unusedInput.push(i),a=a.slice(a.indexOf(t)+t.length),u+=t.length),I[n]?(t?f(e).empty=!1:f(e).unusedTokens.push(n),s=n,r=e,null!=(i=t)&&c(fe,s)&&fe[s](i,r._a,r,s)):e._strict&&!t&&f(e).unusedTokens.push(n);f(e).charsLeftOver=o-u,0<a.length&&f(e).unusedInput.push(a),e._a[ve]<=12&&!0===f(e).bigHour&&0<e._a[ve]&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[ve]=function(e,t,n){if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((n=e.isPM(n))&&t<12&&(t+=12),t=n||12!==t?t:0):t}(e._locale,e._a[ve],e._meridiem),pt(e),lt(e)}else yt(e)}function vt(e){var t=e._i,n=e._f;return e._locale=e._locale||ut(e._l),null===t||void 0===n&&""===t?r({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),w(t)?new p(lt(t)):(a(n)?function(e){var t,n,s,i,r;if(0===e._f.length)return f(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=g({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],wt(t),d(t)&&(r+=f(t).charsLeftOver,r+=10*f(t).unusedTokens.length,f(t).score=r,(null==s||r<s)&&(s=r,n=t));u(e,n||t)}(e):s(t)?e._d=t:n?wt(e):void 0===(n=(t=e)._i)?t._d=new Date(h.now()):s(n)?t._d=new Date(n.valueOf()):"string"==typeof n?function(e){var t=_t.exec(e._i);null===t?(yt(e),!1===e._isValid&&(delete e._isValid,h.createFromInputFallback(e))):e._d=new Date(+t[1])}(t):a(n)?(t._a=i(n.slice(0),function(e){return parseInt(e,10)}),pt(t)):"object"==typeof n?function(e){var t;e._d||(t=U(e._i),e._a=i([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),pt(e))}(t):"number"==typeof n?t._d=new Date(n):h.createFromInputFallback(t),d(e)||(e._d=null),e))}function St(e,t,n,s,i){var r={};return"boolean"==typeof n&&(s=n,n=void 0),(o(e)&&function(e){for(var t in e)return;return 1}(e)||a(e)&&0===e.length)&&(e=void 0),r._isAMomentObject=!0,r._useUTC=r._isUTC=i,r._l=n,r._i=e,r._f=t,r._strict=s,(r=new p(lt(vt(r=r))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function Mt(e,t,n,s){return St(e,t,n,s,!1)}h.createFromInputFallback=n("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),h.ISO_8601=function(){};ue=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Mt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:r()}),K=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Mt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:r()});function kt(e,t){var n,s;if(!(t=1===t.length&&a(t[0])?t[0]:t).length)return Mt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}function Dt(e){var t=U(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||0,a=t.day||0,o=t.hour||0,u=t.minute||0,e=t.second||0,t=t.millisecond||0;this._milliseconds=+t+1e3*e+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=ut(),this._bubble()}function Yt(e){return e instanceof Dt}function xt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ot(e,n){N(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+V(~~(e/60),2)+n+V(~~e%60,2)})}Ot("Z",":"),Ot("ZZ",""),de("Z",oe),de("ZZ",oe),me(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Tt(oe,e)});var bt=/([\+\-]|\d\d)/gi;function Tt(e,t){t=(t||"").match(e)||[],e=((t[t.length-1]||[])+"").match(bt)||["-",0,0],t=60*e[1]+S(e[2]);return"+"===e[0]?t:-t}function Pt(e,t){var n;return t._isUTC?(n=t.clone(),t=(w(e)||s(e)?e:Mt(e)).valueOf()-n.valueOf(),n._d.setTime(n._d.valueOf()+t),h.updateOffset(n,!1),n):Mt(e).local()}function Wt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Rt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}h.updateOffset=function(){};var Ut=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ct=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;function Ft(e,t){var n,s=e,i=null;return Yt(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(s={},t?s[t]=e:s.milliseconds=e):(i=Ut.exec(e))?(n="-"===i[1]?-1:1,s={y:0,d:S(i[we])*n,h:S(i[ve])*n,m:S(i[Se])*n,s:S(i[Me])*n,ms:S(xt(1e3*i[ke]))*n}):(i=Ct.exec(e))?(n="-"===i[1]?-1:1,s={y:Ht(i[2],n),M:Ht(i[3],n),w:Ht(i[4],n),d:Ht(i[5],n),h:Ht(i[6],n),m:Ht(i[7],n),s:Ht(i[8],n)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(n=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Pt(t,e),e.isBefore(t)?n=Lt(e,t):((n=Lt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Mt(s.from),Mt(s.to)),(s={}).ms=n.milliseconds,s.M=n.months),s=new Dt(s),Yt(e)&&c(e,"_locale")&&(s._locale=e._locale),s}function Ht(e,t){e=e&&parseFloat(e.replace(",","."));return(isNaN(e)?0:e)*t}function Lt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Gt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Y(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),Vt(this,Ft(e="string"==typeof e?+e:e,t),s),this}}function Vt(e,t,n,s){var i=t._milliseconds,r=xt(t._days),t=xt(t._months);e.isValid()&&(s=null==s||s,i&&e._d.setTime(e._d.valueOf()+i*n),r&&G(e,"Date",L(e,"Date")+r*n),t&&Pe(e,L(e,"Month")+t*n),s&&h.updateOffset(e,r||t))}Ft.fn=Dt.prototype;ee=Gt(1,"add"),be=Gt(-1,"subtract");function jt(e){return void 0===e?this._locale._abbr:(null!=(e=ut(e))&&(this._locale=e),this)}h.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",h.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";Te=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Et(){return this._locale}function At(e,t){N(0,[e,e.length],0,t)}function It(e,t,n,s,i){var r;return null==e?Ae(this,s,i).year:(r=Ie(e,s,i),function(e,t,n,s,i){i=Ee(e,t,n,s,i),i=Ve(i.year,0,i.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}.call(this,e,t=r<t?r:t,n,s,i))}N(0,["gg",2],0,function(){return this.weekYear()%100}),N(0,["GG",2],0,function(){return this.isoWeekYear()%100}),At("gggg","weekYear"),At("ggggg","weekYear"),At("GGGG","isoWeekYear"),At("GGGGG","isoWeekYear"),W("weekYear","gg"),W("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),de("G",re),de("g",re),de("GG",X,$),de("gg",X,$),de("GGGG",ne,J),de("gggg",ne,J),de("GGGGG",se,Q),de("ggggg",se,Q),_e(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=S(e)}),_e(["gg","GG"],function(e,t,n,s){t[s]=h.parseTwoDigitYear(e)}),N("Q",0,"Qo","quarter"),W("quarter","Q"),F("quarter",7),de("Q",q),me("Q",function(e,t){t[pe]=3*(S(e)-1)}),N("D",["DD",2],"Do","date"),W("date","D"),F("date",9),de("D",X),de("DD",X,$),de("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),me(["D","DD"],we),me("Do",function(e,t){t[we]=S(e.match(X)[0])});Ne=H("Date",!0);N("DDD",["DDDD",3],"DDDo","dayOfYear"),W("dayOfYear","DDD"),F("dayOfYear",4),de("DDD",te),de("DDDD",B),me(["DDD","DDDD"],function(e,t,n){n._dayOfYear=S(e)}),N("m",["mm",2],0,"minute"),W("minute","m"),F("minute",14),de("m",X),de("mm",X,$),me(["m","mm"],Se);Ze=H("Minutes",!1);N("s",["ss",2],0,"second"),W("second","s"),F("second",15),de("s",X),de("ss",X,$),me(["s","ss"],Me);var Nt,ze=H("Seconds",!1);for(N("S",0,0,function(){return~~(this.millisecond()/100)}),N(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),N(0,["SSS",3],0,"millisecond"),N(0,["SSSS",4],0,function(){return 10*this.millisecond()}),N(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),N(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),N(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),N(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),N(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),W("millisecond","ms"),F("millisecond",16),de("S",te,q),de("SS",te,$),de("SSS",te,B),Nt="SSSS";Nt.length<=9;Nt+="S")de(Nt,ie);function zt(e,t){t[ke]=S(1e3*("0."+e))}for(Nt="S";Nt.length<=9;Nt+="S")me(Nt,zt);ne=H("Milliseconds",!1);N("z",0,0,"zoneAbbr"),N("zz",0,0,"zoneName");J=p.prototype;J.add=ee,J.calendar=function(e,t){var n=e||Mt(),e=Pt(n,this).startOf("day"),e=h.calendarFormat(this,e)||"sameElse",t=t&&(x(t[e])?t[e].call(this,n):t[e]);return this.format(t||this.localeData().calendar(e,this,Mt(n)))},J.clone=function(){return new p(this)},J.diff=function(e,t,n){var s,i;return this.isValid()&&(s=Pt(e,this)).isValid()?(e=6e4*(s.utcOffset()-this.utcOffset()),"year"===(t=R(t))||"month"===t||"quarter"===t?(i=function(e,t){var n,s=12*(t.year()-e.year())+(t.month()-e.month()),i=e.clone().add(s,"months");i=t-i<0?(n=e.clone().add(s-1,"months"),(t-i)/(i-n)):(n=e.clone().add(1+s,"months"),(t-i)/(n-i));return-(s+i)||0}(this,s),"quarter"===t?i/=3:"year"===t&&(i/=12)):(s=this-s,i="second"===t?s/1e3:"minute"===t?s/6e4:"hour"===t?s/36e5:"day"===t?(s-e)/864e5:"week"===t?(s-e)/6048e5:s),n?i:v(i)):NaN},J.endOf=function(e){return void 0===(e=R(e))||"millisecond"===e?this:this.startOf(e="date"===e?"day":e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms")},J.format=function(e){return e=e||(this.isUtc()?h.defaultFormatUtc:h.defaultFormat),e=z(this,e),this.localeData().postformat(e)},J.from=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||Mt(e).isValid())?Ft({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},J.fromNow=function(e){return this.from(Mt(),e)},J.to=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||Mt(e).isValid())?Ft({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},J.toNow=function(e){return this.to(Mt(),e)},J.get=function(e){return x(this[e=R(e)])?this[e]():this},J.invalidAt=function(){return f(this).overflow},J.isAfter=function(e,t){return e=w(e)?e:Mt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=R(m(t)?"millisecond":t))?this.valueOf()>e.valueOf():e.valueOf()<this.clone().startOf(t).valueOf())},J.isBefore=function(e,t){return e=w(e)?e:Mt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=R(m(t)?"millisecond":t))?this.valueOf()<e.valueOf():this.clone().endOf(t).valueOf()<e.valueOf())},J.isBetween=function(e,t,n,s){return("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},J.isSame=function(e,t){return e=w(e)?e:Mt(e),!(!this.isValid()||!e.isValid())&&("millisecond"===(t=R(t||"millisecond"))?this.valueOf()===e.valueOf():(e=e.valueOf(),this.clone().startOf(t).valueOf()<=e&&e<=this.clone().endOf(t).valueOf()))},J.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},J.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},J.isValid=function(){return d(this)},J.lang=Te,J.locale=jt,J.localeData=Et,J.max=K,J.min=ue,J.parsingFlags=function(){return u({},f(this))},J.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)n.push({unit:t,priority:C[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=U(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(x(this[e=R(e)]))return this[e](t);return this},J.startOf=function(e){switch(e=R(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},J.subtract=be,J.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},J.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},J.toDate=function(){return new Date(this.valueOf())},J.toISOString=function(){var e=this.clone().utc();return 0<e.year()&&e.year()<=9999?x(Date.prototype.toISOString)?this.toDate().toISOString():z(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):z(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},J.toJSON=function(){return this.isValid()?this.toISOString():null},J.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},J.unix=function(){return Math.floor(this.valueOf()/1e3)},J.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},J.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},J.year=Le,J.isLeapYear=function(){return He(this.year())},J.weekYear=function(e){return It.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},J.isoWeekYear=function(e){return It.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},J.quarter=J.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},J.month=We,J.daysInMonth=function(){return xe(this.year(),this.month())},J.week=J.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},J.isoWeek=J.isoWeeks=function(e){var t=Ae(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},J.weeksInYear=function(){var e=this.localeData()._week;return Ie(this.year(),e.dow,e.doy)},J.isoWeeksInYear=function(){return Ie(this.year(),1,4)},J.date=Ne,J.day=J.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},J.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},J.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t=(t=e,e=this.localeData(),"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?t:t-7)},J.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},J.hour=J.hours=tt,J.minute=J.minutes=Ze,J.second=J.seconds=ze,J.millisecond=J.milliseconds=ne,J.utcOffset=function(e,t){var n,s=this._offset||0;return this.isValid()?null!=e?("string"==typeof e?e=Tt(oe,e):Math.abs(e)<16&&(e*=60),!this._isUTC&&t&&(n=Wt(this)),this._offset=e,this._isUTC=!0,null!=n&&this.add(n,"m"),s!==e&&(!t||this._changeInProgress?Vt(this,Ft(e-s,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,h.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?s:Wt(this):null!=e?this:NaN},J.utc=function(e){return this.utcOffset(0,e)},J.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Wt(this),"m")),this},J.parseZone=function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&(0===Tt(ae,this._i)?this.utcOffset(0,!0):this.utcOffset(Tt(ae,this._i))),this},J.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Mt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},J.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},J.isLocal=function(){return!!this.isValid()&&!this._isUTC},J.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},J.isUtc=Rt,J.isUTC=Rt,J.zoneAbbr=function(){return this._isUTC?"UTC":""},J.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},J.dates=n("dates accessor is deprecated. Use date instead.",Ne),J.months=n("months accessor is deprecated. Use month instead",We),J.years=n("years accessor is deprecated. Use year instead",Le),J.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),J.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!m(this._isDSTShifted))return this._isDSTShifted;var e,t={};return g(t,this),(t=vt(t))._a?(e=(t._isUTC?l:Mt)(t._a),this._isDSTShifted=this.isValid()&&0<M(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted});se=J;function Zt(e){return e}Q=b.prototype;function qt(e,t,n,s){var i=ut(),t=l().set(s,t);return i[n](t,e)}function $t(e,t,n){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return qt(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=qt(e,i,n,"month");return s}function Bt(e,t,n,s){t=("boolean"==typeof e?"number"==typeof t&&(n=t,t=void 0):(t=e,e=!1,"number"==typeof(n=t)&&(n=t,t=void 0)),t||"");var i=ut(),r=e?i._week.dow:0;if(null!=n)return qt(t,(n+r)%7,s,"day");for(var a=[],o=0;o<7;o++)a[o]=qt(t,(o+r)%7,s,"day");return a}Q.calendar=function(e,t,n){return x(e=this._calendar[e]||this._calendar.sameElse)?e.call(t,n):e},Q.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},Q.invalidDate=function(){return this._invalidDate},Q.ordinal=function(e){return this._ordinal.replace("%d",e)},Q.preparse=Zt,Q.postformat=Zt,Q.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return x(i)?i(e,t,n,s):i.replace(/%d/i,e)},Q.pastFuture=function(e,t){return x(e=this._relativeTime[0<e?"future":"past"])?e(t):e.replace(/%s/i,t)},Q.set=function(e){var t,n;for(n in e)x(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},Q.months=function(e,t){return e?(a(this._months)?this._months:this._months[(this._months.isFormat||Oe).test(t)?"format":"standalone"])[e.month()]:this._months},Q.monthsShort=function(e,t){return e?(a(this._monthsShort)?this._monthsShort:this._monthsShort[Oe.test(t)?"format":"standalone"])[e.month()]:this._monthsShort},Q.monthsParse=function(e,t,n){var s,i;if(this._monthsParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=l([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=ye.call(this._shortMonthsParse,e))?i:null:-1!==(i=ye.call(this._longMonthsParse,e))?i:null:"MMM"===t?-1!==(i=ye.call(this._shortMonthsParse,e))||-1!==(i=ye.call(this._longMonthsParse,e))?i:null:-1!==(i=ye.call(this._longMonthsParse,e))||-1!==(i=ye.call(this._shortMonthsParse,e))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=l([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(i="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},Q.monthsRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ce.call(this),e?this._monthsStrictRegex:this._monthsRegex):(c(this,"_monthsRegex")||(this._monthsRegex=Ue),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},Q.monthsShortRegex=function(e){return this._monthsParseExact?(c(this,"_monthsRegex")||Ce.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(c(this,"_monthsShortRegex")||(this._monthsShortRegex=Re),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},Q.week=function(e){return Ae(e,this._week.dow,this._week.doy).week},Q.firstDayOfYear=function(){return this._week.doy},Q.firstDayOfWeek=function(){return this._week.dow},Q.weekdays=function(e,t){return e?(a(this._weekdays)?this._weekdays:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"])[e.day()]:this._weekdays},Q.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},Q.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},Q.weekdaysParse=function(e,t,n){var s,i;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,e=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=l([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=ye.call(this._weekdaysParse,e))?i:null:"ddd"===t?-1!==(i=ye.call(this._shortWeekdaysParse,e))?i:null:-1!==(i=ye.call(this._minWeekdaysParse,e))?i:null:"dddd"===t?-1!==(i=ye.call(this._weekdaysParse,e))||-1!==(i=ye.call(this._shortWeekdaysParse,e))||-1!==(i=ye.call(this._minWeekdaysParse,e))?i:null:"ddd"===t?-1!==(i=ye.call(this._shortWeekdaysParse,e))||-1!==(i=ye.call(this._weekdaysParse,e))||-1!==(i=ye.call(this._minWeekdaysParse,e))?i:null:-1!==(i=ye.call(this._minWeekdaysParse,e))||-1!==(i=ye.call(this._weekdaysParse,e))||-1!==(i=ye.call(this._shortWeekdaysParse,e))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=l([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".",".?")+"$","i")),this._weekdaysParse[s]||(i="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},Q.weekdaysRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||Je.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(c(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},Q.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||Je.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(c(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=$e),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Q.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(c(this,"_weekdaysRegex")||Je.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(c(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Be),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Q.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},Q.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},at("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===S(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),h.lang=n("moment.lang is deprecated. Use moment.locale instead.",at),h.langData=n("moment.langData is deprecated. Use moment.localeData instead.",ut);var Jt=Math.abs;function Qt(e,t,n,s){n=Ft(t,n);return e._milliseconds+=s*n._milliseconds,e._days+=s*n._days,e._months+=s*n._months,e._bubble()}function Xt(e){return e<0?Math.floor(e):Math.ceil(e)}function Kt(e){return 4800*e/146097}function en(e){return 146097*e/4800}function tn(e){return function(){return this.as(e)}}q=tn("ms"),$=tn("s"),te=tn("m"),B=tn("h"),ee=tn("d"),K=tn("w"),ue=tn("M"),be=tn("y");function nn(e){return function(){return this._data[e]}}tt=nn("milliseconds"),Ze=nn("seconds"),ze=nn("minutes"),ne=nn("hours"),Ne=nn("days"),Le=nn("months"),J=nn("years");var sn=Math.round,rn={s:45,m:45,h:22,d:26,M:11};function an(e,t,n){var s=Ft(e).abs(),i=sn(s.as("s")),r=sn(s.as("m")),a=sn(s.as("h")),o=sn(s.as("d")),u=sn(s.as("M")),s=sn(s.as("y")),s=(i<rn.s?["s",i]:r<=1&&["m"])||r<rn.m&&["mm",r]||a<=1&&["h"]||a<rn.h&&["hh",a]||o<=1&&["d"]||o<rn.d&&["dd",o]||u<=1&&["M"]||u<rn.M&&["MM",u]||s<=1&&["y"]||["yy",s];return s[2]=t,s[3]=0<+e,s[4]=n,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,s)}var on=Math.abs;function un(){var e=on(this._milliseconds)/1e3,t=on(this._days),n=on(this._months),s=v(e/60),i=v(s/60);e%=60,s%=60;var r=v(n/12),a=n%=12,n=t,t=i,i=s,s=e,e=this.asSeconds();return e?(e<0?"-":"")+"P"+(r?r+"Y":"")+(a?a+"M":"")+(n?n+"D":"")+(t||i||s?"T":"")+(t?t+"H":"")+(i?i+"M":"")+(s?s+"S":""):"P0D"}Q=Dt.prototype;return Q.abs=function(){var e=this._data;return this._milliseconds=Jt(this._milliseconds),this._days=Jt(this._days),this._months=Jt(this._months),e.milliseconds=Jt(e.milliseconds),e.seconds=Jt(e.seconds),e.minutes=Jt(e.minutes),e.hours=Jt(e.hours),e.months=Jt(e.months),e.years=Jt(e.years),this},Q.add=function(e,t){return Qt(this,e,t,1)},Q.subtract=function(e,t){return Qt(this,e,t,-1)},Q.as=function(e){var t,n,s=this._milliseconds;if("month"===(e=R(e))||"year"===e)return t=this._days+s/864e5,n=this._months+Kt(t),"month"===e?n:n/12;switch(t=this._days+Math.round(en(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},Q.asMilliseconds=q,Q.asSeconds=$,Q.asMinutes=te,Q.asHours=B,Q.asDays=ee,Q.asWeeks=K,Q.asMonths=ue,Q.asYears=be,Q.valueOf=function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},Q._bubble=function(){var e=this._milliseconds,t=this._days,n=this._months,s=this._data;return 0<=e&&0<=t&&0<=n||e<=0&&t<=0&&n<=0||(e+=864e5*Xt(en(n)+t),n=t=0),s.milliseconds=e%1e3,e=v(e/1e3),s.seconds=e%60,e=v(e/60),s.minutes=e%60,e=v(e/60),s.hours=e%24,t+=v(e/24),n+=e=v(Kt(t)),t-=Xt(en(e)),e=v(n/12),n%=12,s.days=t,s.months=n,s.years=e,this},Q.get=function(e){return this[(e=R(e))+"s"]()},Q.milliseconds=tt,Q.seconds=Ze,Q.minutes=ze,Q.hours=ne,Q.days=Ne,Q.weeks=function(){return v(this.days()/7)},Q.months=Le,Q.years=J,Q.humanize=function(e){var t=this.localeData(),n=an(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)},Q.toISOString=un,Q.toString=un,Q.toJSON=un,Q.locale=jt,Q.localeData=Et,Q.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",un),Q.lang=Te,N("X",0,0,"unix"),N("x",0,0,"valueOf"),de("x",re),de("X",/[+-]?\d+(\.\d{1,3})?/),me("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),me("x",function(e,t,n){n._d=new Date(S(e))}),h.version="2.15.1",e=Mt,h.fn=se,h.min=function(){return kt("isBefore",[].slice.call(arguments,0))},h.max=function(){return kt("isAfter",[].slice.call(arguments,0))},h.now=function(){return Date.now?Date.now():+new Date},h.utc=l,h.unix=function(e){return Mt(1e3*e)},h.months=function(e,t){return $t(e,t,"months")},h.isDate=s,h.locale=at,h.invalid=r,h.duration=Ft,h.isMoment=w,h.weekdays=function(e,t,n){return Bt(e,t,n,"weekdays")},h.parseZone=function(){return Mt.apply(null,arguments).parseZone()},h.localeData=ut,h.isDuration=Yt,h.monthsShort=function(e,t){return $t(e,t,"monthsShort")},h.weekdaysMin=function(e,t,n){return Bt(e,t,n,"weekdaysMin")},h.defineLocale=ot,h.updateLocale=function(e,t){return null!=t?((t=new b(t=O(null!=st[e]?st[e]._config:nt,t))).parentLocale=st[e],st[e]=t,at(e)):null!=st[e]&&(null!=st[e].parentLocale?st[e]=st[e].parentLocale:null!=st[e]&&delete st[e]),st[e]},h.locales=function(){return T(st)},h.weekdaysShort=function(e,t,n){return Bt(e,t,n,"weekdaysShort")},h.normalizeUnits=R,h.relativeTimeRounding=function(e){return void 0===e?sn:"function"==typeof e&&(sn=e,!0)},h.relativeTimeThreshold=function(e,t){return void 0!==rn[e]&&(void 0===t?rn[e]:(rn[e]=t,!0))},h.calendarFormat=function(e,t){return(t=e.diff(t,"days",!0))<-6?"sameElse":t<-1?"lastWeek":t<0?"lastDay":t<1?"sameDay":t<2?"nextDay":t<7?"nextWeek":"sameElse"},h.prototype=se,h});
|
@@ -40,4 +40,8 @@
|
|
40 |
margin-left: 1em;
|
41 |
vertical-align: super;
|
42 |
}
|
|
|
|
|
|
|
|
|
43 |
}
|
40 |
margin-left: 1em;
|
41 |
vertical-align: super;
|
42 |
}
|
43 |
+
|
44 |
+
.bp-login-widget-pwd-link {
|
45 |
+
font-size: 80%;
|
46 |
+
}
|
47 |
}
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Friends: Add action
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
* @subpackage FriendsActions
|
@@ -13,29 +13,33 @@
|
|
13 |
* @since 1.0.1
|
14 |
*/
|
15 |
function friends_action_add_friend() {
|
16 |
-
if ( !bp_is_friends_component() || !bp_is_current_action( 'add-friend' ) )
|
17 |
return false;
|
|
|
18 |
|
19 |
-
|
|
|
20 |
return false;
|
|
|
21 |
|
22 |
-
if ( $potential_friend_id
|
23 |
return false;
|
|
|
24 |
|
25 |
$friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id );
|
26 |
|
27 |
-
if ( 'not_friends'
|
28 |
|
29 |
-
if ( !check_admin_referer( 'friends_add_friend' ) )
|
30 |
return false;
|
|
|
31 |
|
32 |
-
if ( !friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {
|
33 |
bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' );
|
34 |
} else {
|
35 |
bp_core_add_message( __( 'Friendship requested', 'buddypress' ) );
|
36 |
}
|
37 |
-
|
38 |
-
} elseif ( 'is_friend' == $friendship_status ) {
|
39 |
bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' );
|
40 |
} else {
|
41 |
bp_core_add_message( __( 'You already have a pending friendship request with this user', 'buddypress' ), 'error' );
|
@@ -45,4 +49,4 @@ function friends_action_add_friend() {
|
|
45 |
|
46 |
return false;
|
47 |
}
|
48 |
-
add_action( 'bp_actions', 'friends_action_add_friend' );
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Friends: Add action.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
* @subpackage FriendsActions
|
13 |
* @since 1.0.1
|
14 |
*/
|
15 |
function friends_action_add_friend() {
|
16 |
+
if ( ! bp_is_friends_component() || ! bp_is_current_action( 'add-friend' ) ) {
|
17 |
return false;
|
18 |
+
}
|
19 |
|
20 |
+
$potential_friend_id = (int) bp_action_variable( 0 );
|
21 |
+
if ( ! $potential_friend_id ) {
|
22 |
return false;
|
23 |
+
}
|
24 |
|
25 |
+
if ( bp_loggedin_user_id() === $potential_friend_id ) {
|
26 |
return false;
|
27 |
+
}
|
28 |
|
29 |
$friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id );
|
30 |
|
31 |
+
if ( 'not_friends' === $friendship_status ) {
|
32 |
|
33 |
+
if ( ! check_admin_referer( 'friends_add_friend' ) ) {
|
34 |
return false;
|
35 |
+
}
|
36 |
|
37 |
+
if ( ! friends_add_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {
|
38 |
bp_core_add_message( __( 'Friendship could not be requested.', 'buddypress' ), 'error' );
|
39 |
} else {
|
40 |
bp_core_add_message( __( 'Friendship requested', 'buddypress' ) );
|
41 |
}
|
42 |
+
} elseif ( 'is_friend' === $friendship_status ) {
|
|
|
43 |
bp_core_add_message( __( 'You are already friends with this user', 'buddypress' ), 'error' );
|
44 |
} else {
|
45 |
bp_core_add_message( __( 'You already have a pending friendship request with this user', 'buddypress' ), 'error' );
|
49 |
|
50 |
return false;
|
51 |
}
|
52 |
+
add_action( 'bp_actions', 'friends_action_add_friend' );
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Friends: Remove action
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
* @subpackage FriendsActions
|
@@ -13,29 +13,33 @@
|
|
13 |
* @since 1.0.1
|
14 |
*/
|
15 |
function friends_action_remove_friend() {
|
16 |
-
if ( !bp_is_friends_component() || !bp_is_current_action( 'remove-friend' ) )
|
17 |
return false;
|
|
|
18 |
|
19 |
-
|
|
|
20 |
return false;
|
|
|
21 |
|
22 |
-
if ( $potential_friend_id
|
23 |
return false;
|
|
|
24 |
|
25 |
$friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id );
|
26 |
|
27 |
-
if ( 'is_friend'
|
28 |
|
29 |
-
if ( !check_admin_referer( 'friends_remove_friend' ) )
|
30 |
return false;
|
|
|
31 |
|
32 |
-
if ( !friends_remove_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {
|
33 |
bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' );
|
34 |
} else {
|
35 |
bp_core_add_message( __( 'Friendship canceled', 'buddypress' ) );
|
36 |
}
|
37 |
-
|
38 |
-
} elseif ( 'not_friends' == $friendship_status ) {
|
39 |
bp_core_add_message( __( 'You are not yet friends with this user', 'buddypress' ), 'error' );
|
40 |
} else {
|
41 |
bp_core_add_message( __( 'You have a pending friendship request with this user', 'buddypress' ), 'error' );
|
@@ -45,4 +49,4 @@ function friends_action_remove_friend() {
|
|
45 |
|
46 |
return false;
|
47 |
}
|
48 |
-
add_action( 'bp_actions', 'friends_action_remove_friend' );
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Friends: Remove action.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
* @subpackage FriendsActions
|
13 |
* @since 1.0.1
|
14 |
*/
|
15 |
function friends_action_remove_friend() {
|
16 |
+
if ( ! bp_is_friends_component() || ! bp_is_current_action( 'remove-friend' ) ) {
|
17 |
return false;
|
18 |
+
}
|
19 |
|
20 |
+
$potential_friend_id = (int) bp_action_variable( 0 );
|
21 |
+
if ( ! $potential_friend_id ) {
|
22 |
return false;
|
23 |
+
}
|
24 |
|
25 |
+
if ( bp_loggedin_user_id() === $potential_friend_id ) {
|
26 |
return false;
|
27 |
+
}
|
28 |
|
29 |
$friendship_status = BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), $potential_friend_id );
|
30 |
|
31 |
+
if ( 'is_friend' === $friendship_status ) {
|
32 |
|
33 |
+
if ( ! check_admin_referer( 'friends_remove_friend' ) ) {
|
34 |
return false;
|
35 |
+
}
|
36 |
|
37 |
+
if ( ! friends_remove_friend( bp_loggedin_user_id(), $potential_friend_id ) ) {
|
38 |
bp_core_add_message( __( 'Friendship could not be canceled.', 'buddypress' ), 'error' );
|
39 |
} else {
|
40 |
bp_core_add_message( __( 'Friendship canceled', 'buddypress' ) );
|
41 |
}
|
42 |
+
} elseif ( 'not_friends' === $friendship_status ) {
|
|
|
43 |
bp_core_add_message( __( 'You are not yet friends with this user', 'buddypress' ), 'error' );
|
44 |
} else {
|
45 |
bp_core_add_message( __( 'You have a pending friendship request with this user', 'buddypress' ), 'error' );
|
49 |
|
50 |
return false;
|
51 |
}
|
52 |
+
add_action( 'bp_actions', 'friends_action_remove_friend' );
|
@@ -39,18 +39,21 @@ function friends_record_activity( $args = '' ) {
|
|
39 |
return false;
|
40 |
}
|
41 |
|
42 |
-
$r =
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
54 |
|
55 |
return bp_activity_add( $r );
|
56 |
}
|
@@ -69,7 +72,6 @@ function friends_record_activity( $args = '' ) {
|
|
69 |
* 'friendship_accepted').
|
70 |
* @type int $user_id ID of the user associated with the activity item.
|
71 |
* }
|
72 |
-
* @return bool True on success, false on failure.
|
73 |
*/
|
74 |
function friends_delete_activity( $args ) {
|
75 |
if ( ! bp_is_active( 'activity' ) ) {
|
@@ -80,7 +82,7 @@ function friends_delete_activity( $args ) {
|
|
80 |
'component' => buddypress()->friends->id,
|
81 |
'item_id' => $args['item_id'],
|
82 |
'type' => $args['type'],
|
83 |
-
'user_id' => $args['user_id']
|
84 |
) );
|
85 |
}
|
86 |
|
@@ -88,10 +90,12 @@ function friends_delete_activity( $args ) {
|
|
88 |
* Register the activity actions for bp-friends.
|
89 |
*
|
90 |
* @since 1.1.0
|
|
|
|
|
91 |
*/
|
92 |
function friends_register_activity_actions() {
|
93 |
|
94 |
-
if ( !bp_is_active( 'activity' ) ) {
|
95 |
return false;
|
96 |
}
|
97 |
|
@@ -135,7 +139,7 @@ add_action( 'bp_register_activity_actions', 'friends_register_activity_actions'
|
|
135 |
*
|
136 |
* @param string $action Activity action string.
|
137 |
* @param object $activity Activity data.
|
138 |
-
* @return string
|
139 |
*/
|
140 |
function bp_friends_format_activity_action_friendship_accepted( $action, $activity ) {
|
141 |
$initiator_link = bp_core_get_userlink( $activity->user_id );
|
@@ -170,7 +174,7 @@ function bp_friends_format_activity_action_friendship_accepted( $action, $activi
|
|
170 |
*
|
171 |
* @param string $action Static activity action.
|
172 |
* @param object $activity Activity data.
|
173 |
-
* @return string
|
174 |
*/
|
175 |
function bp_friends_format_activity_action_friendship_created( $action, $activity ) {
|
176 |
$initiator_link = bp_core_get_userlink( $activity->user_id );
|
@@ -269,19 +273,19 @@ function bp_friends_filter_activity_scope( $retval = array(), $filter = array()
|
|
269 |
array(
|
270 |
'column' => 'user_id',
|
271 |
'compare' => 'IN',
|
272 |
-
'value' => (array) $friends
|
273 |
),
|
274 |
|
275 |
// We should only be able to view sitewide activity content for friends.
|
276 |
array(
|
277 |
'column' => 'hide_sitewide',
|
278 |
-
'value' => 0
|
279 |
),
|
280 |
|
281 |
// Overrides.
|
282 |
'override' => array(
|
283 |
'filter' => array( 'user_id' => 0 ),
|
284 |
-
'show_hidden' => true
|
285 |
),
|
286 |
);
|
287 |
|
@@ -354,7 +358,7 @@ function bp_friends_filter_activity_just_me_scope( $retval = array(), $filter =
|
|
354 |
'column' => 'secondary_item_id',
|
355 |
'value' => $user_id,
|
356 |
),
|
357 |
-
)
|
358 |
);
|
359 |
|
360 |
// Juggle back override value.
|
@@ -372,12 +376,11 @@ add_filter( 'bp_activity_set_just-me_scope_args', 'bp_friends_filter_activity_ju
|
|
372 |
*
|
373 |
* @since 1.9.0
|
374 |
*
|
375 |
-
* @param int
|
376 |
-
* @param int
|
377 |
-
* @param int
|
378 |
-
* @param object|bool $friendship Optional Friendship object.
|
379 |
*/
|
380 |
-
function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id
|
381 |
if ( ! bp_is_active( 'activity' ) ) {
|
382 |
return;
|
383 |
}
|
@@ -387,10 +390,10 @@ function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_use
|
|
387 |
'user_id' => $initiator_user_id,
|
388 |
'type' => 'friendship_created',
|
389 |
'item_id' => $friendship_id,
|
390 |
-
'secondary_item_id' => $friend_user_id
|
391 |
) );
|
392 |
}
|
393 |
-
add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10,
|
394 |
|
395 |
/**
|
396 |
* Deletes friendship activity items when a user is deleted.
|
@@ -404,11 +407,13 @@ function bp_friends_delete_activity_on_user_delete( $user_id = 0 ) {
|
|
404 |
return;
|
405 |
}
|
406 |
|
407 |
-
bp_activity_delete(
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
|
|
|
|
412 |
}
|
413 |
add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
|
414 |
|
@@ -420,6 +425,12 @@ add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' )
|
|
420 |
* @param int $friendship_id ID of the friendship.
|
421 |
*/
|
422 |
function bp_friends_delete_activity_on_friendship_delete( $friendship_id ) {
|
423 |
-
friends_delete_activity(
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
}
|
425 |
add_action( 'friends_friendship_deleted', 'bp_friends_delete_activity_on_friendship_delete' );
|
39 |
return false;
|
40 |
}
|
41 |
|
42 |
+
$r = bp_parse_args(
|
43 |
+
$args,
|
44 |
+
array(
|
45 |
+
'user_id' => bp_loggedin_user_id(),
|
46 |
+
'action' => '',
|
47 |
+
'content' => '',
|
48 |
+
'primary_link' => '',
|
49 |
+
'component' => buddypress()->friends->id,
|
50 |
+
'type' => false,
|
51 |
+
'item_id' => false,
|
52 |
+
'secondary_item_id' => false,
|
53 |
+
'recorded_time' => bp_core_current_time(),
|
54 |
+
'hide_sitewide' => false,
|
55 |
+
)
|
56 |
+
);
|
57 |
|
58 |
return bp_activity_add( $r );
|
59 |
}
|
72 |
* 'friendship_accepted').
|
73 |
* @type int $user_id ID of the user associated with the activity item.
|
74 |
* }
|
|
|
75 |
*/
|
76 |
function friends_delete_activity( $args ) {
|
77 |
if ( ! bp_is_active( 'activity' ) ) {
|
82 |
'component' => buddypress()->friends->id,
|
83 |
'item_id' => $args['item_id'],
|
84 |
'type' => $args['type'],
|
85 |
+
'user_id' => $args['user_id'],
|
86 |
) );
|
87 |
}
|
88 |
|
90 |
* Register the activity actions for bp-friends.
|
91 |
*
|
92 |
* @since 1.1.0
|
93 |
+
*
|
94 |
+
* @return bool False if activity component is not active.
|
95 |
*/
|
96 |
function friends_register_activity_actions() {
|
97 |
|
98 |
+
if ( ! bp_is_active( 'activity' ) ) {
|
99 |
return false;
|
100 |
}
|
101 |
|
139 |
*
|
140 |
* @param string $action Activity action string.
|
141 |
* @param object $activity Activity data.
|
142 |
+
* @return string Formatted activity action.
|
143 |
*/
|
144 |
function bp_friends_format_activity_action_friendship_accepted( $action, $activity ) {
|
145 |
$initiator_link = bp_core_get_userlink( $activity->user_id );
|
174 |
*
|
175 |
* @param string $action Static activity action.
|
176 |
* @param object $activity Activity data.
|
177 |
+
* @return string Formatted activity action.
|
178 |
*/
|
179 |
function bp_friends_format_activity_action_friendship_created( $action, $activity ) {
|
180 |
$initiator_link = bp_core_get_userlink( $activity->user_id );
|
273 |
array(
|
274 |
'column' => 'user_id',
|
275 |
'compare' => 'IN',
|
276 |
+
'value' => (array) $friends,
|
277 |
),
|
278 |
|
279 |
// We should only be able to view sitewide activity content for friends.
|
280 |
array(
|
281 |
'column' => 'hide_sitewide',
|
282 |
+
'value' => 0,
|
283 |
),
|
284 |
|
285 |
// Overrides.
|
286 |
'override' => array(
|
287 |
'filter' => array( 'user_id' => 0 ),
|
288 |
+
'show_hidden' => true,
|
289 |
),
|
290 |
);
|
291 |
|
358 |
'column' => 'secondary_item_id',
|
359 |
'value' => $user_id,
|
360 |
),
|
361 |
+
),
|
362 |
);
|
363 |
|
364 |
// Juggle back override value.
|
376 |
*
|
377 |
* @since 1.9.0
|
378 |
*
|
379 |
+
* @param int $friendship_id ID of the friendship.
|
380 |
+
* @param int $initiator_user_id ID of friendship initiator.
|
381 |
+
* @param int $friend_user_id ID of user whose friendship is requested.
|
|
|
382 |
*/
|
383 |
+
function bp_friends_friendship_accepted_activity( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
384 |
if ( ! bp_is_active( 'activity' ) ) {
|
385 |
return;
|
386 |
}
|
390 |
'user_id' => $initiator_user_id,
|
391 |
'type' => 'friendship_created',
|
392 |
'item_id' => $friendship_id,
|
393 |
+
'secondary_item_id' => $friend_user_id,
|
394 |
) );
|
395 |
}
|
396 |
+
add_action( 'friends_friendship_accepted', 'bp_friends_friendship_accepted_activity', 10, 3 );
|
397 |
|
398 |
/**
|
399 |
* Deletes friendship activity items when a user is deleted.
|
407 |
return;
|
408 |
}
|
409 |
|
410 |
+
bp_activity_delete(
|
411 |
+
array(
|
412 |
+
'component' => buddypress()->friends->id,
|
413 |
+
'type' => 'friendship_created',
|
414 |
+
'secondary_item_id' => $user_id,
|
415 |
+
)
|
416 |
+
);
|
417 |
}
|
418 |
add_action( 'friends_remove_data', 'bp_friends_delete_activity_on_user_delete' );
|
419 |
|
425 |
* @param int $friendship_id ID of the friendship.
|
426 |
*/
|
427 |
function bp_friends_delete_activity_on_friendship_delete( $friendship_id ) {
|
428 |
+
friends_delete_activity(
|
429 |
+
array(
|
430 |
+
'item_id' => $friendship_id,
|
431 |
+
'type' => 'friendship_created',
|
432 |
+
'user_id' => 0,
|
433 |
+
)
|
434 |
+
);
|
435 |
}
|
436 |
add_action( 'friends_friendship_deleted', 'bp_friends_delete_activity_on_friendship_delete' );
|
@@ -8,9 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly.
|
11 |
-
|
12 |
-
exit;
|
13 |
-
}
|
14 |
|
15 |
/**
|
16 |
* Adds specific script data for the BP Friends blocks.
|
@@ -26,6 +24,23 @@ function bp_friends_blocks_add_script_data() {
|
|
26 |
return;
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
// Include the common JS template.
|
30 |
echo bp_get_dynamic_template_part( 'assets/widgets/friends.php' );
|
31 |
|
@@ -46,7 +61,7 @@ function bp_friends_blocks_add_script_data() {
|
|
46 |
* @return string HTML output.
|
47 |
*/
|
48 |
function bp_friends_render_friends_block( $attributes = array() ) {
|
49 |
-
$block_args =
|
50 |
$attributes,
|
51 |
array(
|
52 |
'maxFriends' => 5,
|
@@ -97,7 +112,7 @@ function bp_friends_render_friends_block( $attributes = array() ) {
|
|
97 |
|
98 |
$link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_friends_slug() );
|
99 |
|
100 |
-
/* translators: %s
|
101 |
$title = sprintf( __( '%s\'s Friends', 'buddypress' ), bp_core_get_user_displayname( $user_id ) );
|
102 |
|
103 |
// Set the Block's title.
|
@@ -166,7 +181,7 @@ function bp_friends_render_friends_block( $attributes = array() ) {
|
|
166 |
/* translators: %s: total friend count */
|
167 |
$extra = sprintf( _n( '%s friend', '%s friends', $user->total_friend_count, 'buddypress' ), number_format_i18n( $user->total_friend_count ) );
|
168 |
} else {
|
169 |
-
/* translators: %s:
|
170 |
$extra = sprintf( __( 'Active %s', 'buddypress' ), bp_core_time_since( $user->last_activity ) );
|
171 |
}
|
172 |
|
@@ -209,10 +224,7 @@ function bp_friends_render_friends_block( $attributes = array() ) {
|
|
209 |
$path
|
210 |
);
|
211 |
|
212 |
-
$preloaded_friends =
|
213 |
-
if ( bp_is_running_wp( '5.0.0' ) ) {
|
214 |
-
$preloaded_friends = rest_preload_api_request( '', $default_path );
|
215 |
-
}
|
216 |
|
217 |
buddypress()->friends->block_globals['bp/friends']->items[ $widget_id ] = (object) array(
|
218 |
'selector' => $widget_id,
|
@@ -224,15 +236,6 @@ function bp_friends_render_friends_block( $attributes = array() ) {
|
|
224 |
if ( ! has_action( 'wp_footer', 'bp_friends_blocks_add_script_data', 1 ) ) {
|
225 |
wp_set_script_translations( 'bp-friends-script', 'buddypress' );
|
226 |
wp_enqueue_script( 'bp-friends-script' );
|
227 |
-
wp_localize_script(
|
228 |
-
'bp-friends-script',
|
229 |
-
'bpFriendsSettings',
|
230 |
-
array(
|
231 |
-
'path' => ltrim( $path, '/' ),
|
232 |
-
'root' => esc_url_raw( get_rest_url() ),
|
233 |
-
'nonce' => wp_create_nonce( 'wp_rest' ),
|
234 |
-
)
|
235 |
-
);
|
236 |
|
237 |
add_action( 'wp_footer', 'bp_friends_blocks_add_script_data', 1 );
|
238 |
}
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly.
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
12 |
|
13 |
/**
|
14 |
* Adds specific script data for the BP Friends blocks.
|
24 |
return;
|
25 |
}
|
26 |
|
27 |
+
$path = sprintf(
|
28 |
+
'/%1$s/%2$s/%3$s',
|
29 |
+
bp_rest_namespace(),
|
30 |
+
bp_rest_version(),
|
31 |
+
buddypress()->members->id
|
32 |
+
);
|
33 |
+
|
34 |
+
wp_localize_script(
|
35 |
+
'bp-friends-script',
|
36 |
+
'bpFriendsSettings',
|
37 |
+
array(
|
38 |
+
'path' => ltrim( $path, '/' ),
|
39 |
+
'root' => esc_url_raw( get_rest_url() ),
|
40 |
+
'nonce' => wp_create_nonce( 'wp_rest' ),
|
41 |
+
)
|
42 |
+
);
|
43 |
+
|
44 |
// Include the common JS template.
|
45 |
echo bp_get_dynamic_template_part( 'assets/widgets/friends.php' );
|
46 |
|
61 |
* @return string HTML output.
|
62 |
*/
|
63 |
function bp_friends_render_friends_block( $attributes = array() ) {
|
64 |
+
$block_args = bp_parse_args(
|
65 |
$attributes,
|
66 |
array(
|
67 |
'maxFriends' => 5,
|
112 |
|
113 |
$link = trailingslashit( bp_core_get_user_domain( $user_id ) . bp_get_friends_slug() );
|
114 |
|
115 |
+
/* translators: %s: member name */
|
116 |
$title = sprintf( __( '%s\'s Friends', 'buddypress' ), bp_core_get_user_displayname( $user_id ) );
|
117 |
|
118 |
// Set the Block's title.
|
181 |
/* translators: %s: total friend count */
|
182 |
$extra = sprintf( _n( '%s friend', '%s friends', $user->total_friend_count, 'buddypress' ), number_format_i18n( $user->total_friend_count ) );
|
183 |
} else {
|
184 |
+
/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
|
185 |
$extra = sprintf( __( 'Active %s', 'buddypress' ), bp_core_time_since( $user->last_activity ) );
|
186 |
}
|
187 |
|
224 |
$path
|
225 |
);
|
226 |
|
227 |
+
$preloaded_friends = rest_preload_api_request( '', $default_path );
|
|
|
|
|
|
|
228 |
|
229 |
buddypress()->friends->block_globals['bp/friends']->items[ $widget_id ] = (object) array(
|
230 |
'selector' => $widget_id,
|
236 |
if ( ! has_action( 'wp_footer', 'bp_friends_blocks_add_script_data', 1 ) ) {
|
237 |
wp_set_script_translations( 'bp-friends-script', 'buddypress' );
|
238 |
wp_enqueue_script( 'bp-friends-script' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
add_action( 'wp_footer', 'bp_friends_blocks_add_script_data', 1 );
|
241 |
}
|
@@ -23,16 +23,18 @@ defined( 'ABSPATH' ) || exit;
|
|
23 |
* @return bool
|
24 |
*/
|
25 |
function friends_clear_friend_object_cache( $friendship_id ) {
|
26 |
-
|
|
|
27 |
return false;
|
|
|
28 |
|
29 |
-
wp_cache_delete( 'friends_friend_ids_' .
|
30 |
-
wp_cache_delete( 'friends_friend_ids_' .
|
31 |
}
|
32 |
|
33 |
// List actions to clear object caches on.
|
34 |
add_action( 'friends_friendship_accepted', 'friends_clear_friend_object_cache' );
|
35 |
-
add_action( 'friends_friendship_deleted',
|
36 |
|
37 |
/**
|
38 |
* Clear friendship caches on friendship changes.
|
@@ -42,12 +44,11 @@ add_action( 'friends_friendship_deleted', 'friends_clear_friend_object_cache' )
|
|
42 |
* @param int $friendship_id ID of the friendship that has changed.
|
43 |
* @param int $initiator_user_id ID of the first user.
|
44 |
* @param int $friend_user_id ID of the second user.
|
45 |
-
* @return bool
|
46 |
*/
|
47 |
function bp_friends_clear_bp_friends_friendships_cache( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
48 |
// Clear friendship ID cache for each user.
|
49 |
wp_cache_delete( $initiator_user_id, 'bp_friends_friendships_for_user' );
|
50 |
-
wp_cache_delete( $friend_user_id,
|
51 |
|
52 |
// Clear the friendship object cache.
|
53 |
wp_cache_delete( $friendship_id, 'bp_friends_friendships' );
|
@@ -59,8 +60,8 @@ function bp_friends_clear_bp_friends_friendships_cache( $friendship_id, $initiat
|
|
59 |
bp_friends_delete_cached_friendships_on_friendship_save( $friendship );
|
60 |
}
|
61 |
add_action( 'friends_friendship_requested', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
|
62 |
-
add_action( 'friends_friendship_accepted',
|
63 |
-
add_action( 'friends_friendship_deleted',
|
64 |
|
65 |
/**
|
66 |
* Clear friendship caches on friendship changes.
|
@@ -68,12 +69,12 @@ add_action( 'friends_friendship_deleted', 'bp_friends_clear_bp_friends_friends
|
|
68 |
* @since 2.7.0
|
69 |
*
|
70 |
* @param int $friendship_id The friendship ID.
|
71 |
-
* @param BP_Friends_Friendship $friendship
|
72 |
*/
|
73 |
-
function bp_friends_clear_bp_friends_friendships_cache_remove( $friendship_id,
|
74 |
// Clear friendship ID cache for each user.
|
75 |
wp_cache_delete( $friendship->initiator_user_id, 'bp_friends_friendships_for_user' );
|
76 |
-
wp_cache_delete( $friendship->friend_user_id,
|
77 |
|
78 |
// Clear the friendship object cache.
|
79 |
wp_cache_delete( $friendship_id, 'bp_friends_friendships' );
|
@@ -82,7 +83,7 @@ function bp_friends_clear_bp_friends_friendships_cache_remove( $friendship_id, B
|
|
82 |
bp_friends_delete_cached_friendships_on_friendship_save( $friendship );
|
83 |
}
|
84 |
add_action( 'friends_friendship_withdrawn', 'bp_friends_clear_bp_friends_friendships_cache_remove', 10, 2 );
|
85 |
-
add_action( 'friends_friendship_rejected',
|
86 |
|
87 |
/**
|
88 |
* Clear the friend request cache for the user not initiating the friendship.
|
@@ -110,7 +111,7 @@ function bp_friends_clear_request_cache_on_save( $friendship_id, $initiator_user
|
|
110 |
bp_friends_clear_request_cache( $friend_user_id );
|
111 |
}
|
112 |
add_action( 'friends_friendship_requested', 'bp_friends_clear_request_cache_on_save', 10, 3 );
|
113 |
-
add_action( 'friends_friendship_accepted',
|
114 |
|
115 |
/**
|
116 |
* Clear the friend request cache when a friendship is removed.
|
@@ -120,20 +121,20 @@ add_action( 'friends_friendship_accepted', 'bp_friends_clear_request_cache_on_s
|
|
120 |
* @since 2.0.0
|
121 |
*
|
122 |
* @param int $friendship_id The friendship ID.
|
123 |
-
* @param BP_Friends_Friendship $friendship
|
124 |
*/
|
125 |
-
function bp_friends_clear_request_cache_on_remove( $friendship_id,
|
126 |
bp_friends_clear_request_cache( $friendship->friend_user_id );
|
127 |
}
|
128 |
add_action( 'friends_friendship_withdrawn', 'bp_friends_clear_request_cache_on_remove', 10, 2 );
|
129 |
-
add_action( 'friends_friendship_rejected',
|
130 |
|
131 |
/**
|
132 |
* Delete individual friendships from the cache when they are changed.
|
133 |
*
|
134 |
* @since 3.0.0
|
135 |
*
|
136 |
-
* @param BP_Friends_Friendship $friendship
|
137 |
*/
|
138 |
function bp_friends_delete_cached_friendships_on_friendship_save( $friendship ) {
|
139 |
bp_core_delete_incremented_cache( $friendship->friend_user_id . ':' . $friendship->initiator_user_id, 'bp_friends' );
|
23 |
* @return bool
|
24 |
*/
|
25 |
function friends_clear_friend_object_cache( $friendship_id ) {
|
26 |
+
$friendship = new BP_Friends_Friendship( $friendship_id );
|
27 |
+
if ( ! $friendship ) {
|
28 |
return false;
|
29 |
+
}
|
30 |
|
31 |
+
wp_cache_delete( 'friends_friend_ids_' . $friendship->initiator_user_id, 'bp' );
|
32 |
+
wp_cache_delete( 'friends_friend_ids_' . $friendship->friend_user_id, 'bp' );
|
33 |
}
|
34 |
|
35 |
// List actions to clear object caches on.
|
36 |
add_action( 'friends_friendship_accepted', 'friends_clear_friend_object_cache' );
|
37 |
+
add_action( 'friends_friendship_deleted', 'friends_clear_friend_object_cache' );
|
38 |
|
39 |
/**
|
40 |
* Clear friendship caches on friendship changes.
|
44 |
* @param int $friendship_id ID of the friendship that has changed.
|
45 |
* @param int $initiator_user_id ID of the first user.
|
46 |
* @param int $friend_user_id ID of the second user.
|
|
|
47 |
*/
|
48 |
function bp_friends_clear_bp_friends_friendships_cache( $friendship_id, $initiator_user_id, $friend_user_id ) {
|
49 |
// Clear friendship ID cache for each user.
|
50 |
wp_cache_delete( $initiator_user_id, 'bp_friends_friendships_for_user' );
|
51 |
+
wp_cache_delete( $friend_user_id, 'bp_friends_friendships_for_user' );
|
52 |
|
53 |
// Clear the friendship object cache.
|
54 |
wp_cache_delete( $friendship_id, 'bp_friends_friendships' );
|
60 |
bp_friends_delete_cached_friendships_on_friendship_save( $friendship );
|
61 |
}
|
62 |
add_action( 'friends_friendship_requested', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
|
63 |
+
add_action( 'friends_friendship_accepted', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
|
64 |
+
add_action( 'friends_friendship_deleted', 'bp_friends_clear_bp_friends_friendships_cache', 10, 3 );
|
65 |
|
66 |
/**
|
67 |
* Clear friendship caches on friendship changes.
|
69 |
* @since 2.7.0
|
70 |
*
|
71 |
* @param int $friendship_id The friendship ID.
|
72 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
73 |
*/
|
74 |
+
function bp_friends_clear_bp_friends_friendships_cache_remove( $friendship_id, $friendship ) {
|
75 |
// Clear friendship ID cache for each user.
|
76 |
wp_cache_delete( $friendship->initiator_user_id, 'bp_friends_friendships_for_user' );
|
77 |
+
wp_cache_delete( $friendship->friend_user_id, 'bp_friends_friendships_for_user' );
|
78 |
|
79 |
// Clear the friendship object cache.
|
80 |
wp_cache_delete( $friendship_id, 'bp_friends_friendships' );
|
83 |
bp_friends_delete_cached_friendships_on_friendship_save( $friendship );
|
84 |
}
|
85 |
add_action( 'friends_friendship_withdrawn', 'bp_friends_clear_bp_friends_friendships_cache_remove', 10, 2 );
|
86 |
+
add_action( 'friends_friendship_rejected', 'bp_friends_clear_bp_friends_friendships_cache_remove', 10, 2 );
|
87 |
|
88 |
/**
|
89 |
* Clear the friend request cache for the user not initiating the friendship.
|
111 |
bp_friends_clear_request_cache( $friend_user_id );
|
112 |
}
|
113 |
add_action( 'friends_friendship_requested', 'bp_friends_clear_request_cache_on_save', 10, 3 );
|
114 |
+
add_action( 'friends_friendship_accepted', 'bp_friends_clear_request_cache_on_save', 10, 3 );
|
115 |
|
116 |
/**
|
117 |
* Clear the friend request cache when a friendship is removed.
|
121 |
* @since 2.0.0
|
122 |
*
|
123 |
* @param int $friendship_id The friendship ID.
|
124 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
125 |
*/
|
126 |
+
function bp_friends_clear_request_cache_on_remove( $friendship_id, $friendship ) {
|
127 |
bp_friends_clear_request_cache( $friendship->friend_user_id );
|
128 |
}
|
129 |
add_action( 'friends_friendship_withdrawn', 'bp_friends_clear_request_cache_on_remove', 10, 2 );
|
130 |
+
add_action( 'friends_friendship_rejected', 'bp_friends_clear_request_cache_on_remove', 10, 2 );
|
131 |
|
132 |
/**
|
133 |
* Delete individual friendships from the cache when they are changed.
|
134 |
*
|
135 |
* @since 3.0.0
|
136 |
*
|
137 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
138 |
*/
|
139 |
function bp_friends_delete_cached_friendships_on_friendship_save( $friendship ) {
|
140 |
bp_core_delete_incremented_cache( $friendship->friend_user_id . ':' . $friendship->initiator_user_id, 'bp_friends' );
|
@@ -8,9 +8,7 @@
|
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly.
|
11 |
-
|
12 |
-
exit;
|
13 |
-
}
|
14 |
|
15 |
/**
|
16 |
* Registers the script to manage the dynamic part of the Friends widget/block.
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly.
|
11 |
+
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
12 |
|
13 |
/**
|
14 |
* Registers the script to manage the dynamic part of the Friends widget/block.
|
@@ -12,7 +12,7 @@ defined( 'ABSPATH' ) || exit;
|
|
12 |
|
13 |
// Format numerical output.
|
14 |
add_filter( 'friends_get_total_friend_count', 'bp_core_number_format' );
|
15 |
-
add_filter( 'bp_get_total_friend_count',
|
16 |
|
17 |
/**
|
18 |
* Filter BP_User_Query::populate_extras to add confirmed friendship status.
|
@@ -22,17 +22,15 @@ add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
|
|
22 |
*
|
23 |
* @since 1.7.0
|
24 |
*
|
25 |
-
* @global WPDB $wpdb WordPress database access object.
|
26 |
-
*
|
27 |
* @param BP_User_Query $user_query The BP_User_Query object.
|
28 |
* @param string $user_ids_sql Comma-separated list of user IDs to fetch extra
|
29 |
* data for, as determined by BP_User_Query.
|
30 |
*/
|
31 |
-
function bp_friends_filter_user_query_populate_extras(
|
32 |
-
global $wpdb;
|
33 |
|
34 |
// Stop if user isn't logged in.
|
35 |
-
|
|
|
36 |
return;
|
37 |
}
|
38 |
|
@@ -44,11 +42,10 @@ function bp_friends_filter_user_query_populate_extras( BP_User_Query $user_query
|
|
44 |
foreach ( $maybe_friend_ids as $friend_id ) {
|
45 |
$status = BP_Friends_Friendship::check_is_friend( $user_id, $friend_id );
|
46 |
$user_query->results[ $friend_id ]->friendship_status = $status;
|
47 |
-
if ( 'is_friend'
|
48 |
$user_query->results[ $friend_id ]->is_friend = 1;
|
49 |
}
|
50 |
}
|
51 |
-
|
52 |
}
|
53 |
add_filter( 'bp_user_query_populate_extras', 'bp_friends_filter_user_query_populate_extras', 4, 2 );
|
54 |
|
12 |
|
13 |
// Format numerical output.
|
14 |
add_filter( 'friends_get_total_friend_count', 'bp_core_number_format' );
|
15 |
+
add_filter( 'bp_get_total_friend_count', 'bp_core_number_format' );
|
16 |
|
17 |
/**
|
18 |
* Filter BP_User_Query::populate_extras to add confirmed friendship status.
|
22 |
*
|
23 |
* @since 1.7.0
|
24 |
*
|
|
|
|
|
25 |
* @param BP_User_Query $user_query The BP_User_Query object.
|
26 |
* @param string $user_ids_sql Comma-separated list of user IDs to fetch extra
|
27 |
* data for, as determined by BP_User_Query.
|
28 |
*/
|
29 |
+
function bp_friends_filter_user_query_populate_extras( $user_query, $user_ids_sql ) {
|
|
|
30 |
|
31 |
// Stop if user isn't logged in.
|
32 |
+
$user_id = bp_loggedin_user_id();
|
33 |
+
if ( ! $user_id ) {
|
34 |
return;
|
35 |
}
|
36 |
|
42 |
foreach ( $maybe_friend_ids as $friend_id ) {
|
43 |
$status = BP_Friends_Friendship::check_is_friend( $user_id, $friend_id );
|
44 |
$user_query->results[ $friend_id ]->friendship_status = $status;
|
45 |
+
if ( 'is_friend' === $status ) {
|
46 |
$user_query->results[ $friend_id ]->is_friend = 1;
|
47 |
}
|
48 |
}
|
|
|
49 |
}
|
50 |
add_filter( 'bp_user_query_populate_extras', 'bp_friends_filter_user_query_populate_extras', 4, 2 );
|
51 |
|
@@ -33,7 +33,7 @@ defined( 'ABSPATH' ) || exit;
|
|
33 |
function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false ) {
|
34 |
|
35 |
// You cannot be friends with yourself!
|
36 |
-
if ( $initiator_userid
|
37 |
return false;
|
38 |
}
|
39 |
|
@@ -77,10 +77,10 @@ function friends_add_friend( $initiator_userid, $friend_userid, $force_accept =
|
|
77 |
*
|
78 |
* @since 1.0.0
|
79 |
*
|
80 |
-
* @param int
|
81 |
-
* @param int
|
82 |
-
* @param int
|
83 |
-
* @param
|
84 |
*/
|
85 |
do_action( 'friends_friendship_' . $action, $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
86 |
|
@@ -161,7 +161,7 @@ function friends_remove_friend( $initiator_userid, $friend_userid ) {
|
|
161 |
function friends_accept_friendship( $friendship_id ) {
|
162 |
|
163 |
// Get the friendship data.
|
164 |
-
$friendship = new BP_Friends_Friendship( $friendship_id,
|
165 |
|
166 |
// Accepting friendship.
|
167 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::accept( $friendship_id ) ) {
|
@@ -174,10 +174,10 @@ function friends_accept_friendship( $friendship_id ) {
|
|
174 |
*
|
175 |
* @since 1.0.0
|
176 |
*
|
177 |
-
* @param int
|
178 |
-
* @param int
|
179 |
-
* @param int
|
180 |
-
* @param
|
181 |
*/
|
182 |
do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
183 |
|
@@ -196,7 +196,7 @@ function friends_accept_friendship( $friendship_id ) {
|
|
196 |
* @return bool True on success, false on failure.
|
197 |
*/
|
198 |
function friends_reject_friendship( $friendship_id ) {
|
199 |
-
$friendship = new BP_Friends_Friendship( $friendship_id,
|
200 |
|
201 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::reject( $friendship_id ) ) {
|
202 |
|
@@ -205,10 +205,11 @@ function friends_reject_friendship( $friendship_id ) {
|
|
205 |
*
|
206 |
* @since 1.0.0
|
207 |
*
|
208 |
-
* @param int $friendship_id ID of the
|
209 |
-
* @param BP_Friends_Friendship $
|
210 |
*/
|
211 |
do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) );
|
|
|
212 |
return true;
|
213 |
}
|
214 |
|
@@ -227,7 +228,7 @@ function friends_reject_friendship( $friendship_id ) {
|
|
227 |
*/
|
228 |
function friends_withdraw_friendship( $initiator_userid, $friend_userid ) {
|
229 |
$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
|
230 |
-
$friendship = new BP_Friends_Friendship( $friendship_id,
|
231 |
|
232 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::withdraw( $friendship_id ) ) {
|
233 |
|
@@ -240,9 +241,9 @@ function friends_withdraw_friendship( $initiator_userid, $friend_userid ) {
|
|
240 |
* @since 1.9.0
|
241 |
*
|
242 |
* @param int $friendship_id ID of the friendship.
|
243 |
-
* @param BP_Friends_Friendship $friendship
|
244 |
*/
|
245 |
-
do_action_ref_array( 'friends_friendship_withdrawn',
|
246 |
|
247 |
return true;
|
248 |
}
|
@@ -260,11 +261,7 @@ function friends_withdraw_friendship( $initiator_userid, $friend_userid ) {
|
|
260 |
* @return bool Returns true if the two users are friends, otherwise false.
|
261 |
*/
|
262 |
function friends_check_friendship( $user_id, $possible_friend_id ) {
|
263 |
-
|
264 |
-
if ( 'is_friend' == BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id ) )
|
265 |
-
return true;
|
266 |
-
|
267 |
-
return false;
|
268 |
}
|
269 |
|
270 |
/**
|
@@ -274,6 +271,8 @@ function friends_check_friendship( $user_id, $possible_friend_id ) {
|
|
274 |
*
|
275 |
* @since 1.2.0
|
276 |
*
|
|
|
|
|
277 |
* @param int $user_id ID of the first user.
|
278 |
* @param int $possible_friend_id ID of the other user.
|
279 |
* @return string Friend status of the two users.
|
@@ -301,12 +300,14 @@ function friends_check_friendship_status( $user_id, $possible_friend_id ) {
|
|
301 |
* @return int Friend count of the user.
|
302 |
*/
|
303 |
function friends_get_total_friend_count( $user_id = 0 ) {
|
304 |
-
if ( empty( $user_id ) )
|
305 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
|
|
306 |
|
307 |
$count = bp_get_user_meta( $user_id, 'total_friend_count', true );
|
308 |
-
if ( empty( $count ) )
|
309 |
$count = 0;
|
|
|
310 |
|
311 |
/**
|
312 |
* Filters the total friend count for a given user.
|
@@ -315,7 +316,7 @@ function friends_get_total_friend_count( $user_id = 0 ) {
|
|
315 |
*
|
316 |
* @param int $count Total friend count for a given user.
|
317 |
*/
|
318 |
-
return apply_filters( 'friends_get_total_friend_count', $count );
|
319 |
}
|
320 |
|
321 |
/**
|
@@ -329,11 +330,13 @@ function friends_get_total_friend_count( $user_id = 0 ) {
|
|
329 |
function friends_check_user_has_friends( $user_id ) {
|
330 |
$friend_count = friends_get_total_friend_count( $user_id );
|
331 |
|
332 |
-
if ( empty( $friend_count ) )
|
333 |
return false;
|
|
|
334 |
|
335 |
-
if ( !(int) $friend_count )
|
336 |
return false;
|
|
|
337 |
|
338 |
return true;
|
339 |
}
|
@@ -345,7 +348,7 @@ function friends_check_user_has_friends( $user_id ) {
|
|
345 |
*
|
346 |
* @param int $initiator_user_id ID of the first user.
|
347 |
* @param int $friend_user_id ID of the second user.
|
348 |
-
* @return int|null ID of the friendship if found, otherwise
|
349 |
*/
|
350 |
function friends_get_friendship_id( $initiator_user_id, $friend_user_id ) {
|
351 |
return BP_Friends_Friendship::get_friendship_id( $initiator_user_id, $friend_user_id );
|
@@ -406,7 +409,7 @@ function friends_get_friendship_request_user_ids( $user_id ) {
|
|
406 |
*
|
407 |
* @since 1.0.0
|
408 |
*
|
409 |
-
* @see
|
410 |
*
|
411 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
412 |
* @param int $per_page Optional. Number of results to return per page.
|
@@ -444,7 +447,7 @@ function friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filte
|
|
444 |
*
|
445 |
* @since 1.0.0
|
446 |
*
|
447 |
-
* @see
|
448 |
*
|
449 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
450 |
* @param int $per_page Optional. Number of results to return per page.
|
@@ -482,7 +485,7 @@ function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter
|
|
482 |
*
|
483 |
* @since 1.0.0
|
484 |
*
|
485 |
-
* @see
|
486 |
*
|
487 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
488 |
* @param int $per_page Optional. Number of results to return per page.
|
@@ -524,7 +527,7 @@ function friends_get_newest( $user_id, $per_page = 0, $page = 0, $filter = '' )
|
|
524 |
* arguments and return value.
|
525 |
*
|
526 |
* @param array $friend_ids See BP_Friends_Friendship::get_bulk_last_active().
|
527 |
-
* @return array
|
528 |
*/
|
529 |
function friends_get_bulk_last_active( $friend_ids ) {
|
530 |
return BP_Friends_Friendship::get_bulk_last_active( $friend_ids );
|
@@ -546,8 +549,9 @@ function friends_get_bulk_last_active( $friend_ids ) {
|
|
546 |
function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
547 |
|
548 |
// Default to logged in user id.
|
549 |
-
if ( empty( $user_id ) )
|
550 |
$user_id = bp_loggedin_user_id();
|
|
|
551 |
|
552 |
// Only group admins can invited previously banned users.
|
553 |
$user_is_admin = (bool) groups_is_user_admin( $user_id, $group_id );
|
@@ -560,13 +564,20 @@ function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
|
560 |
*
|
561 |
* @since 1.5.4
|
562 |
*
|
563 |
-
* @param array $value
|
|
|
|
|
|
|
|
|
564 |
*/
|
565 |
-
$args = apply_filters(
|
566 |
-
'
|
567 |
-
|
568 |
-
|
569 |
-
|
|
|
|
|
|
|
570 |
|
571 |
// User has friends.
|
572 |
if ( bp_has_members( $args ) ) {
|
@@ -588,25 +599,28 @@ function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
|
588 |
$friend_user_id = bp_get_member_user_id();
|
589 |
|
590 |
// Skip friend if already in the group.
|
591 |
-
if ( groups_is_user_member( $friend_user_id, $group_id ) )
|
592 |
continue;
|
|
|
593 |
|
594 |
// Skip friend if not group admin and user banned from group.
|
595 |
-
if ( ( false === $user_is_admin ) && groups_is_user_banned( $friend_user_id, $group_id ) )
|
596 |
continue;
|
|
|
597 |
|
598 |
// Friend is safe, so add it to the array of possible friends.
|
599 |
$friends[] = array(
|
600 |
'id' => $friend_user_id,
|
601 |
-
'full_name' => bp_get_member_name()
|
602 |
);
|
603 |
|
604 |
endwhile;
|
605 |
}
|
606 |
|
607 |
// If no friends, explicitly set to false.
|
608 |
-
if ( empty( $friends ) )
|
609 |
$friends = false;
|
|
|
610 |
|
611 |
/**
|
612 |
* Filters the list of potential friends that can be invited to this group.
|
@@ -633,7 +647,7 @@ function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
|
633 |
*
|
634 |
* @param int $user_id ID of the user whose friends are being counted.
|
635 |
* @param int $group_id ID of the group friends are being invited to.
|
636 |
-
* @return int
|
637 |
*/
|
638 |
function friends_count_invitable_friends( $user_id, $group_id ) {
|
639 |
return BP_Friends_Friendship::get_invitable_friend_count( $user_id, $group_id );
|
@@ -666,17 +680,21 @@ function friends_get_friend_count_for_user( $user_id ) {
|
|
666 |
* @return array Array of BP_Core_User objects corresponding to friends.
|
667 |
*/
|
668 |
function friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page = 0 ) {
|
669 |
-
|
670 |
$user_ids = BP_Friends_Friendship::search_users( $search_terms, $user_id, $pag_num, $pag_page );
|
671 |
|
672 |
-
if ( empty( $user_ids ) )
|
673 |
return false;
|
|
|
674 |
|
675 |
$users = array();
|
676 |
-
for ( $i = 0, $count = count( $user_ids ); $i < $count; ++$i )
|
677 |
-
$users[] = new BP_Core_User( $user_ids[$i] );
|
|
|
678 |
|
679 |
-
return array(
|
|
|
|
|
|
|
680 |
}
|
681 |
|
682 |
/**
|
@@ -689,7 +707,7 @@ function friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page
|
|
689 |
*/
|
690 |
function friends_is_friendship_confirmed( $friendship_id ) {
|
691 |
$friendship = new BP_Friends_Friendship( $friendship_id );
|
692 |
-
return $friendship->is_confirmed;
|
693 |
}
|
694 |
|
695 |
/**
|
@@ -708,13 +726,12 @@ function friends_is_friendship_confirmed( $friendship_id ) {
|
|
708 |
* will --.
|
709 |
*/
|
710 |
function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
|
711 |
-
|
712 |
-
|
713 |
-
bp_update_user_meta( $
|
714 |
-
bp_update_user_meta( $friend_user_id, 'total_friend_count', (int)bp_get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 );
|
715 |
} else {
|
716 |
-
bp_update_user_meta( $initiator_user_id, 'total_friend_count', (int)bp_get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 );
|
717 |
-
bp_update_user_meta( $friend_user_id, 'total_friend_count', (int)bp_get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 );
|
718 |
}
|
719 |
}
|
720 |
|
@@ -756,7 +773,7 @@ function friends_remove_data( $user_id ) {
|
|
756 |
*/
|
757 |
do_action( 'friends_remove_data', $user_id );
|
758 |
}
|
759 |
-
add_action( 'wpmu_delete_user',
|
760 |
add_action( 'bp_make_spam_user', 'friends_remove_data' );
|
761 |
|
762 |
/**
|
@@ -805,9 +822,8 @@ function bp_friends_prime_mentions_results() {
|
|
805 |
}
|
806 |
|
807 |
$friends_query = array(
|
808 |
-
'count_total' => '',
|
809 |
'populate_extras' => false,
|
810 |
-
|
811 |
'type' => 'alphabetical',
|
812 |
'user_id' => get_current_user_id(),
|
813 |
);
|
@@ -850,7 +866,7 @@ add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_res
|
|
850 |
* @param int $friend_id ID of the request recipient.
|
851 |
*/
|
852 |
function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
|
853 |
-
if ( 'no'
|
854 |
return;
|
855 |
}
|
856 |
|
@@ -887,7 +903,7 @@ add_action( 'friends_friendship_requested', 'friends_notification_new_request',
|
|
887 |
* @param int $friend_id ID of the request recipient.
|
888 |
*/
|
889 |
function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
|
890 |
-
if ( 'no'
|
891 |
return;
|
892 |
}
|
893 |
|
@@ -903,7 +919,7 @@ function friends_notification_accepted_request( $friendship_id, $initiator_id, $
|
|
903 |
'friend.name' => bp_core_get_user_displayname( $friend_id ),
|
904 |
'friendship.id' => $friendship_id,
|
905 |
'initiator.id' => $initiator_id,
|
906 |
-
'unsubscribe'
|
907 |
),
|
908 |
);
|
909 |
bp_send_email( 'friends-request-accepted', $initiator_id, $args );
|
@@ -920,13 +936,10 @@ add_action( 'friends_friendship_accepted', 'friends_notification_accepted_reques
|
|
920 |
* @return array An array of personal data.
|
921 |
*/
|
922 |
function bp_friends_personal_data_exporter( $email_address, $page ) {
|
923 |
-
$number
|
924 |
-
|
925 |
-
$email_address = trim( $email_address );
|
926 |
-
|
927 |
$data_to_export = array();
|
928 |
-
|
929 |
-
$user = get_user_by( 'email', $email_address );
|
930 |
|
931 |
if ( ! $user ) {
|
932 |
return array(
|
@@ -941,8 +954,6 @@ function bp_friends_personal_data_exporter( $email_address, $page ) {
|
|
941 |
'per_page' => $number,
|
942 |
) );
|
943 |
|
944 |
-
$user_data_to_export = array();
|
945 |
-
|
946 |
foreach ( $friendships as $friendship ) {
|
947 |
if ( (int) $user->ID === (int) $friendship->initiator_user_id ) {
|
948 |
$friend_id = $friendship->friend_user_id;
|
@@ -994,13 +1005,10 @@ function bp_friends_personal_data_exporter( $email_address, $page ) {
|
|
994 |
* @return array An array of personal data.
|
995 |
*/
|
996 |
function bp_friends_pending_sent_requests_personal_data_exporter( $email_address, $page ) {
|
997 |
-
$number
|
998 |
-
|
999 |
-
$email_address = trim( $email_address );
|
1000 |
-
|
1001 |
$data_to_export = array();
|
1002 |
-
|
1003 |
-
$user = get_user_by( 'email', $email_address );
|
1004 |
|
1005 |
if ( ! $user ) {
|
1006 |
return array(
|
@@ -1016,8 +1024,6 @@ function bp_friends_pending_sent_requests_personal_data_exporter( $email_address
|
|
1016 |
'per_page' => $number,
|
1017 |
) );
|
1018 |
|
1019 |
-
$user_data_to_export = array();
|
1020 |
-
|
1021 |
foreach ( $friendships as $friendship ) {
|
1022 |
$item_data = array(
|
1023 |
array(
|
@@ -1057,13 +1063,10 @@ function bp_friends_pending_sent_requests_personal_data_exporter( $email_address
|
|
1057 |
* @return array An array of personal data.
|
1058 |
*/
|
1059 |
function bp_friends_pending_received_requests_personal_data_exporter( $email_address, $page ) {
|
1060 |
-
$number
|
1061 |
-
|
1062 |
-
$email_address = trim( $email_address );
|
1063 |
-
|
1064 |
$data_to_export = array();
|
1065 |
-
|
1066 |
-
$user = get_user_by( 'email', $email_address );
|
1067 |
|
1068 |
if ( ! $user ) {
|
1069 |
return array(
|
@@ -1079,8 +1082,6 @@ function bp_friends_pending_received_requests_personal_data_exporter( $email_add
|
|
1079 |
'per_page' => $number,
|
1080 |
) );
|
1081 |
|
1082 |
-
$user_data_to_export = array();
|
1083 |
-
|
1084 |
foreach ( $friendships as $friendship ) {
|
1085 |
$item_data = array(
|
1086 |
array(
|
33 |
function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false ) {
|
34 |
|
35 |
// You cannot be friends with yourself!
|
36 |
+
if ( $initiator_userid === $friend_userid ) {
|
37 |
return false;
|
38 |
}
|
39 |
|
77 |
*
|
78 |
* @since 1.0.0
|
79 |
*
|
80 |
+
* @param int $id ID of the pending friendship connection.
|
81 |
+
* @param int $initiator_user_id ID of the friendship initiator.
|
82 |
+
* @param int $friend_user_id ID of the friend user.
|
83 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
84 |
*/
|
85 |
do_action( 'friends_friendship_' . $action, $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
86 |
|
161 |
function friends_accept_friendship( $friendship_id ) {
|
162 |
|
163 |
// Get the friendship data.
|
164 |
+
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
|
165 |
|
166 |
// Accepting friendship.
|
167 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::accept( $friendship_id ) ) {
|
174 |
*
|
175 |
* @since 1.0.0
|
176 |
*
|
177 |
+
* @param int $id ID of the pending friendship object.
|
178 |
+
* @param int $initiator_user_id ID of the friendship initiator.
|
179 |
+
* @param int $friend_user_id ID of the user requested friendship with.
|
180 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
181 |
*/
|
182 |
do_action( 'friends_friendship_accepted', $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id, $friendship );
|
183 |
|
196 |
* @return bool True on success, false on failure.
|
197 |
*/
|
198 |
function friends_reject_friendship( $friendship_id ) {
|
199 |
+
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
|
200 |
|
201 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::reject( $friendship_id ) ) {
|
202 |
|
205 |
*
|
206 |
* @since 1.0.0
|
207 |
*
|
208 |
+
* @param int $friendship_id ID of the friendship.
|
209 |
+
* @param BP_Friends_Friendship $friendship The friendship object. Passed by reference.
|
210 |
*/
|
211 |
do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) );
|
212 |
+
|
213 |
return true;
|
214 |
}
|
215 |
|
228 |
*/
|
229 |
function friends_withdraw_friendship( $initiator_userid, $friend_userid ) {
|
230 |
$friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid );
|
231 |
+
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
|
232 |
|
233 |
if ( empty( $friendship->is_confirmed ) && BP_Friends_Friendship::withdraw( $friendship_id ) ) {
|
234 |
|
241 |
* @since 1.9.0
|
242 |
*
|
243 |
* @param int $friendship_id ID of the friendship.
|
244 |
+
* @param BP_Friends_Friendship $friendship The friendship object. Passed by reference.
|
245 |
*/
|
246 |
+
do_action_ref_array( 'friends_friendship_withdrawn', array( $friendship_id, &$friendship ) );
|
247 |
|
248 |
return true;
|
249 |
}
|
261 |
* @return bool Returns true if the two users are friends, otherwise false.
|
262 |
*/
|
263 |
function friends_check_friendship( $user_id, $possible_friend_id ) {
|
264 |
+
return ( 'is_friend' === BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id ) );
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
/**
|
271 |
*
|
272 |
* @since 1.2.0
|
273 |
*
|
274 |
+
* @global BP_Core_Members_Template $members_template
|
275 |
+
*
|
276 |
* @param int $user_id ID of the first user.
|
277 |
* @param int $possible_friend_id ID of the other user.
|
278 |
* @return string Friend status of the two users.
|
300 |
* @return int Friend count of the user.
|
301 |
*/
|
302 |
function friends_get_total_friend_count( $user_id = 0 ) {
|
303 |
+
if ( empty( $user_id ) ) {
|
304 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
305 |
+
}
|
306 |
|
307 |
$count = bp_get_user_meta( $user_id, 'total_friend_count', true );
|
308 |
+
if ( empty( $count ) ) {
|
309 |
$count = 0;
|
310 |
+
}
|
311 |
|
312 |
/**
|
313 |
* Filters the total friend count for a given user.
|
316 |
*
|
317 |
* @param int $count Total friend count for a given user.
|
318 |
*/
|
319 |
+
return apply_filters( 'friends_get_total_friend_count', (int) $count );
|
320 |
}
|
321 |
|
322 |
/**
|
330 |
function friends_check_user_has_friends( $user_id ) {
|
331 |
$friend_count = friends_get_total_friend_count( $user_id );
|
332 |
|
333 |
+
if ( empty( $friend_count ) ) {
|
334 |
return false;
|
335 |
+
}
|
336 |
|
337 |
+
if ( ! (int) $friend_count ) {
|
338 |
return false;
|
339 |
+
}
|
340 |
|
341 |
return true;
|
342 |
}
|
348 |
*
|
349 |
* @param int $initiator_user_id ID of the first user.
|
350 |
* @param int $friend_user_id ID of the second user.
|
351 |
+
* @return int|null ID of the friendship if found, otherwise null.
|
352 |
*/
|
353 |
function friends_get_friendship_id( $initiator_user_id, $friend_user_id ) {
|
354 |
return BP_Friends_Friendship::get_friendship_id( $initiator_user_id, $friend_user_id );
|
409 |
*
|
410 |
* @since 1.0.0
|
411 |
*
|
412 |
+
* @see bp_core_get_users() for a description of return value.
|
413 |
*
|
414 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
415 |
* @param int $per_page Optional. Number of results to return per page.
|
447 |
*
|
448 |
* @since 1.0.0
|
449 |
*
|
450 |
+
* @see bp_core_get_users() for a description of return value.
|
451 |
*
|
452 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
453 |
* @param int $per_page Optional. Number of results to return per page.
|
485 |
*
|
486 |
* @since 1.0.0
|
487 |
*
|
488 |
+
* @see bp_core_get_users() for a description of return value.
|
489 |
*
|
490 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
491 |
* @param int $per_page Optional. Number of results to return per page.
|
527 |
* arguments and return value.
|
528 |
*
|
529 |
* @param array $friend_ids See BP_Friends_Friendship::get_bulk_last_active().
|
530 |
+
* @return array See BP_Friends_Friendship::get_bulk_last_active().
|
531 |
*/
|
532 |
function friends_get_bulk_last_active( $friend_ids ) {
|
533 |
return BP_Friends_Friendship::get_bulk_last_active( $friend_ids );
|
549 |
function friends_get_friends_invite_list( $user_id = 0, $group_id = 0 ) {
|
550 |
|
551 |
// Default to logged in user id.
|
552 |
+
if ( empty( $user_id ) ) {
|
553 |
$user_id = bp_loggedin_user_id();
|
554 |
+
}
|
555 |
|
556 |
// Only group admins can invited previously banned users.
|
557 |
$user_is_admin = (bool) groups_is_user_admin( $user_id, $group_id );
|
564 |
*
|
565 |
* @since 1.5.4
|
566 |
*
|
567 |
+
* @param array $value {
|
568 |
+
* @type int $user_id User ID whose friends too see can be invited.
|
569 |
+
* @type string $type Type of order to return a list of members.
|
570 |
+
* @type int $per_page Number of friends per page.
|
571 |
+
* }
|
572 |
*/
|
573 |
+
$args = apply_filters(
|
574 |
+
'bp_friends_pre_get_invite_list',
|
575 |
+
array(
|
576 |
+
'user_id' => $user_id,
|
577 |
+
'type' => 'alphabetical',
|
578 |
+
'per_page' => 0,
|
579 |
+
)
|
580 |
+
);
|
581 |
|
582 |
// User has friends.
|
583 |
if ( bp_has_members( $args ) ) {
|
599 |
$friend_user_id = bp_get_member_user_id();
|
600 |
|
601 |
// Skip friend if already in the group.
|
602 |
+
if ( groups_is_user_member( $friend_user_id, $group_id ) ) {
|
603 |
continue;
|
604 |
+
}
|
605 |
|
606 |
// Skip friend if not group admin and user banned from group.
|
607 |
+
if ( ( false === $user_is_admin ) && groups_is_user_banned( $friend_user_id, $group_id ) ) {
|
608 |
continue;
|
609 |
+
}
|
610 |
|
611 |
// Friend is safe, so add it to the array of possible friends.
|
612 |
$friends[] = array(
|
613 |
'id' => $friend_user_id,
|
614 |
+
'full_name' => bp_get_member_name(),
|
615 |
);
|
616 |
|
617 |
endwhile;
|
618 |
}
|
619 |
|
620 |
// If no friends, explicitly set to false.
|
621 |
+
if ( empty( $friends ) ) {
|
622 |
$friends = false;
|
623 |
+
}
|
624 |
|
625 |
/**
|
626 |
* Filters the list of potential friends that can be invited to this group.
|
647 |
*
|
648 |
* @param int $user_id ID of the user whose friends are being counted.
|
649 |
* @param int $group_id ID of the group friends are being invited to.
|
650 |
+
* @return int Eligible friend count.
|
651 |
*/
|
652 |
function friends_count_invitable_friends( $user_id, $group_id ) {
|
653 |
return BP_Friends_Friendship::get_invitable_friend_count( $user_id, $group_id );
|
680 |
* @return array Array of BP_Core_User objects corresponding to friends.
|
681 |
*/
|
682 |
function friends_search_users( $search_terms, $user_id, $pag_num = 0, $pag_page = 0 ) {
|
|
|
683 |
$user_ids = BP_Friends_Friendship::search_users( $search_terms, $user_id, $pag_num, $pag_page );
|
684 |
|
685 |
+
if ( empty( $user_ids ) ) {
|
686 |
return false;
|
687 |
+
}
|
688 |
|
689 |
$users = array();
|
690 |
+
for ( $i = 0, $count = count( $user_ids ); $i < $count; ++$i ) {
|
691 |
+
$users[] = new BP_Core_User( $user_ids[ $i ] );
|
692 |
+
}
|
693 |
|
694 |
+
return array(
|
695 |
+
'users' => $users,
|
696 |
+
'count' => BP_Friends_Friendship::search_users_count( $search_terms ),
|
697 |
+
);
|
698 |
}
|
699 |
|
700 |
/**
|
707 |
*/
|
708 |
function friends_is_friendship_confirmed( $friendship_id ) {
|
709 |
$friendship = new BP_Friends_Friendship( $friendship_id );
|
710 |
+
return (bool) $friendship->is_confirmed;
|
711 |
}
|
712 |
|
713 |
/**
|
726 |
* will --.
|
727 |
*/
|
728 |
function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) {
|
729 |
+
if ( 'add' === $status ) {
|
730 |
+
bp_update_user_meta( $initiator_user_id, 'total_friend_count', (int) bp_get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 );
|
731 |
+
bp_update_user_meta( $friend_user_id, 'total_friend_count', (int) bp_get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 );
|
|
|
732 |
} else {
|
733 |
+
bp_update_user_meta( $initiator_user_id, 'total_friend_count', (int) bp_get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 );
|
734 |
+
bp_update_user_meta( $friend_user_id, 'total_friend_count', (int) bp_get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 );
|
735 |
}
|
736 |
}
|
737 |
|
773 |
*/
|
774 |
do_action( 'friends_remove_data', $user_id );
|
775 |
}
|
776 |
+
add_action( 'wpmu_delete_user', 'friends_remove_data' );
|
777 |
add_action( 'bp_make_spam_user', 'friends_remove_data' );
|
778 |
|
779 |
/**
|
822 |
}
|
823 |
|
824 |
$friends_query = array(
|
825 |
+
'count_total' => '', // Prevents total count.
|
826 |
'populate_extras' => false,
|
|
|
827 |
'type' => 'alphabetical',
|
828 |
'user_id' => get_current_user_id(),
|
829 |
);
|
866 |
* @param int $friend_id ID of the request recipient.
|
867 |
*/
|
868 |
function friends_notification_new_request( $friendship_id, $initiator_id, $friend_id ) {
|
869 |
+
if ( 'no' === bp_get_user_meta( (int) $friend_id, 'notification_friends_friendship_request', true ) ) {
|
870 |
return;
|
871 |
}
|
872 |
|
903 |
* @param int $friend_id ID of the request recipient.
|
904 |
*/
|
905 |
function friends_notification_accepted_request( $friendship_id, $initiator_id, $friend_id ) {
|
906 |
+
if ( 'no' === bp_get_user_meta( (int) $initiator_id, 'notification_friends_friendship_accepted', true ) ) {
|
907 |
return;
|
908 |
}
|
909 |
|
919 |
'friend.name' => bp_core_get_user_displayname( $friend_id ),
|
920 |
'friendship.id' => $friendship_id,
|
921 |
'initiator.id' => $initiator_id,
|
922 |
+
'unsubscribe' => esc_url( bp_email_get_unsubscribe_link( $unsubscribe_args ) ),
|
923 |
),
|
924 |
);
|
925 |
bp_send_email( 'friends-request-accepted', $initiator_id, $args );
|
936 |
* @return array An array of personal data.
|
937 |
*/
|
938 |
function bp_friends_personal_data_exporter( $email_address, $page ) {
|
939 |
+
$number = 50;
|
940 |
+
$email_address = trim( $email_address );
|
|
|
|
|
941 |
$data_to_export = array();
|
942 |
+
$user = get_user_by( 'email', $email_address );
|
|
|
943 |
|
944 |
if ( ! $user ) {
|
945 |
return array(
|
954 |
'per_page' => $number,
|
955 |
) );
|
956 |
|
|
|
|
|
957 |
foreach ( $friendships as $friendship ) {
|
958 |
if ( (int) $user->ID === (int) $friendship->initiator_user_id ) {
|
959 |
$friend_id = $friendship->friend_user_id;
|
1005 |
* @return array An array of personal data.
|
1006 |
*/
|
1007 |
function bp_friends_pending_sent_requests_personal_data_exporter( $email_address, $page ) {
|
1008 |
+
$number = 50;
|
1009 |
+
$email_address = trim( $email_address );
|
|
|
|
|
1010 |
$data_to_export = array();
|
1011 |
+
$user = get_user_by( 'email', $email_address );
|
|
|
1012 |
|
1013 |
if ( ! $user ) {
|
1014 |
return array(
|
1024 |
'per_page' => $number,
|
1025 |
) );
|
1026 |
|
|
|
|
|
1027 |
foreach ( $friendships as $friendship ) {
|
1028 |
$item_data = array(
|
1029 |
array(
|
1063 |
* @return array An array of personal data.
|
1064 |
*/
|
1065 |
function bp_friends_pending_received_requests_personal_data_exporter( $email_address, $page ) {
|
1066 |
+
$number = 50;
|
1067 |
+
$email_address = trim( $email_address );
|
|
|
|
|
1068 |
$data_to_export = array();
|
1069 |
+
$user = get_user_by( 'email', $email_address );
|
|
|
1070 |
|
1071 |
if ( ! $user ) {
|
1072 |
return array(
|
1082 |
'per_page' => $number,
|
1083 |
) );
|
1084 |
|
|
|
|
|
1085 |
foreach ( $friendships as $friendship ) {
|
1086 |
$item_data = array(
|
1087 |
array(
|
@@ -5,7 +5,7 @@
|
|
5 |
* The friends component is for users to create relationships with each other.
|
6 |
*
|
7 |
* @package BuddyPress
|
8 |
-
* @subpackage
|
9 |
* @since 1.5.0
|
10 |
*/
|
11 |
|
5 |
* The friends component is for users to create relationships with each other.
|
6 |
*
|
7 |
* @package BuddyPress
|
8 |
+
* @subpackage FriendsLoader
|
9 |
* @since 1.5.0
|
10 |
*/
|
11 |
|
@@ -43,7 +43,7 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
|
|
43 |
$amount = 'multiple';
|
44 |
} else {
|
45 |
/* translators: %s: friend name */
|
46 |
-
$text = sprintf( __( '%s accepted your friendship request', 'buddypress' ),
|
47 |
$amount = 'single';
|
48 |
}
|
49 |
|
@@ -61,7 +61,7 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
|
|
61 |
$amount = 'multiple';
|
62 |
} else {
|
63 |
/* translators: %s: friend name */
|
64 |
-
$text = sprintf( __( 'You have a friendship request from %s', 'buddypress' ),
|
65 |
$amount = 'single';
|
66 |
}
|
67 |
|
@@ -69,7 +69,7 @@ function friends_format_notifications( $action, $item_id, $secondary_item_id, $t
|
|
69 |
}
|
70 |
|
71 |
// Return either an HTML link or an array, depending on the requested format.
|
72 |
-
if ( 'string'
|
73 |
|
74 |
/**
|
75 |
* Filters the format of friendship notifications based on type and amount * of notifications pending.
|
@@ -176,8 +176,8 @@ add_action( 'friends_friendship_requested', 'bp_friends_friendship_requested_not
|
|
176 |
*
|
177 |
* @since 1.9.0
|
178 |
*
|
179 |
-
* @param int
|
180 |
-
* @param
|
181 |
*/
|
182 |
function bp_friends_mark_friendship_rejected_notifications_by_item_id( $friendship_id, $friendship ) {
|
183 |
bp_notifications_mark_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, buddypress()->friends->id, 'friendship_request' );
|
@@ -215,8 +215,8 @@ add_action( 'friends_friendship_accepted', 'bp_friends_add_friendship_accepted_n
|
|
215 |
*
|
216 |
* @since 1.9.0
|
217 |
*
|
218 |
-
* @param int
|
219 |
-
* @param
|
220 |
*/
|
221 |
function bp_friends_mark_friendship_withdrawn_notifications_by_item_id( $friendship_id, $friendship ) {
|
222 |
bp_notifications_delete_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, buddypress()->friends->id, 'friendship_request' );
|
@@ -242,33 +242,34 @@ add_action( 'friends_remove_data', 'bp_friends_remove_notifications_data', 10, 1
|
|
242 |
*/
|
243 |
function friends_screen_notification_settings() {
|
244 |
|
245 |
-
if (
|
246 |
-
$send_requests
|
|
|
247 |
|
248 |
-
if (
|
249 |
$accept_requests = 'yes'; ?>
|
250 |
|
251 |
<table class="notification-settings" id="friends-notification-settings">
|
252 |
<thead>
|
253 |
<tr>
|
254 |
<th class="icon"></th>
|
255 |
-
<th class="title"><?php _ex( 'Friends', 'Friend settings on notification settings page', 'buddypress' ) ?></th>
|
256 |
-
<th class="yes"><?php
|
257 |
-
<th class="no"><?php
|
258 |
</tr>
|
259 |
</thead>
|
260 |
|
261 |
<tbody>
|
262 |
<tr id="friends-notification-settings-request">
|
263 |
<td></td>
|
264 |
-
<td><?php _ex( 'A member sends you a friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
265 |
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-yes" value="yes" <?php checked( $send_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-request-yes" class="bp-screen-reader-text"><?php
|
266 |
/* translators: accessibility text */
|
267 |
-
|
268 |
?></label></td>
|
269 |
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-no" value="no" <?php checked( $send_requests, 'no', true ) ?>/><label for="notification-friends-friendship-request-no" class="bp-screen-reader-text"><?php
|
270 |
/* translators: accessibility text */
|
271 |
-
|
272 |
?></label></td>
|
273 |
</tr>
|
274 |
<tr id="friends-notification-settings-accepted">
|
@@ -276,11 +277,11 @@ function friends_screen_notification_settings() {
|
|
276 |
<td><?php _ex( 'A member accepts your friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
277 |
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-yes" value="yes" <?php checked( $accept_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-accepted-yes" class="bp-screen-reader-text"><?php
|
278 |
/* translators: accessibility text */
|
279 |
-
|
280 |
?></label></td>
|
281 |
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-no" value="no" <?php checked( $accept_requests, 'no', true ) ?>/><label for="notification-friends-friendship-accepted-no" class="bp-screen-reader-text"><?php
|
282 |
/* translators: accessibility text */
|
283 |
-
|
284 |
?></label></td>
|
285 |
</tr>
|
286 |
|
43 |
$amount = 'multiple';
|
44 |
} else {
|
45 |
/* translators: %s: friend name */
|
46 |
+
$text = sprintf( __( '%s accepted your friendship request', 'buddypress' ), bp_core_get_user_displayname( $item_id ) );
|
47 |
$amount = 'single';
|
48 |
}
|
49 |
|
61 |
$amount = 'multiple';
|
62 |
} else {
|
63 |
/* translators: %s: friend name */
|
64 |
+
$text = sprintf( __( 'You have a friendship request from %s', 'buddypress' ), bp_core_get_user_displayname( $item_id ) );
|
65 |
$amount = 'single';
|
66 |
}
|
67 |
|
69 |
}
|
70 |
|
71 |
// Return either an HTML link or an array, depending on the requested format.
|
72 |
+
if ( 'string' === $format ) {
|
73 |
|
74 |
/**
|
75 |
* Filters the format of friendship notifications based on type and amount * of notifications pending.
|
176 |
*
|
177 |
* @since 1.9.0
|
178 |
*
|
179 |
+
* @param int $friendship_id Friendship ID (not used).
|
180 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
181 |
*/
|
182 |
function bp_friends_mark_friendship_rejected_notifications_by_item_id( $friendship_id, $friendship ) {
|
183 |
bp_notifications_mark_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, buddypress()->friends->id, 'friendship_request' );
|
215 |
*
|
216 |
* @since 1.9.0
|
217 |
*
|
218 |
+
* @param int $friendship_id Friendship ID (not used).
|
219 |
+
* @param BP_Friends_Friendship $friendship The friendship object.
|
220 |
*/
|
221 |
function bp_friends_mark_friendship_withdrawn_notifications_by_item_id( $friendship_id, $friendship ) {
|
222 |
bp_notifications_delete_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, buddypress()->friends->id, 'friendship_request' );
|
242 |
*/
|
243 |
function friends_screen_notification_settings() {
|
244 |
|
245 |
+
if ( ! $send_requests = bp_get_user_meta( bp_displayed_user_id(), 'notification_friends_friendship_request', true ) ) {
|
246 |
+
$send_requests = 'yes';
|
247 |
+
}
|
248 |
|
249 |
+
if ( ! $accept_requests = bp_get_user_meta( bp_displayed_user_id(), 'notification_friends_friendship_accepted', true ) )
|
250 |
$accept_requests = 'yes'; ?>
|
251 |
|
252 |
<table class="notification-settings" id="friends-notification-settings">
|
253 |
<thead>
|
254 |
<tr>
|
255 |
<th class="icon"></th>
|
256 |
+
<th class="title"><?php _ex( 'Friends', 'Friend settings on notification settings page', 'buddypress' ); ?></th>
|
257 |
+
<th class="yes"><?php esc_html_e( 'Yes', 'buddypress' ); ?></th>
|
258 |
+
<th class="no"><?php esc_html_e( 'No', 'buddypress' ); ?></th>
|
259 |
</tr>
|
260 |
</thead>
|
261 |
|
262 |
<tbody>
|
263 |
<tr id="friends-notification-settings-request">
|
264 |
<td></td>
|
265 |
+
<td><?php _ex( 'A member sends you a friendship request', 'Friend settings on notification settings page', 'buddypress' ); ?></td>
|
266 |
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-yes" value="yes" <?php checked( $send_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-request-yes" class="bp-screen-reader-text"><?php
|
267 |
/* translators: accessibility text */
|
268 |
+
esc_html_e( 'Yes, send email', 'buddypress' );
|
269 |
?></label></td>
|
270 |
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" id="notification-friends-friendship-request-no" value="no" <?php checked( $send_requests, 'no', true ) ?>/><label for="notification-friends-friendship-request-no" class="bp-screen-reader-text"><?php
|
271 |
/* translators: accessibility text */
|
272 |
+
esc_html_e( 'No, do not send email', 'buddypress' );
|
273 |
?></label></td>
|
274 |
</tr>
|
275 |
<tr id="friends-notification-settings-accepted">
|
277 |
<td><?php _ex( 'A member accepts your friendship request', 'Friend settings on notification settings page', 'buddypress' ) ?></td>
|
278 |
<td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-yes" value="yes" <?php checked( $accept_requests, 'yes', true ) ?>/><label for="notification-friends-friendship-accepted-yes" class="bp-screen-reader-text"><?php
|
279 |
/* translators: accessibility text */
|
280 |
+
esc_html_e( 'Yes, send email', 'buddypress' );
|
281 |
?></label></td>
|
282 |
<td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" id="notification-friends-friendship-accepted-no" value="no" <?php checked( $accept_requests, 'no', true ) ?>/><label for="notification-friends-friendship-accepted-no" class="bp-screen-reader-text"><?php
|
283 |
/* translators: accessibility text */
|
284 |
+
esc_html_e( 'No, do not send email', 'buddypress' );
|
285 |
?></label></td>
|
286 |
</tr>
|
287 |
|
@@ -14,7 +14,6 @@ defined( 'ABSPATH' ) || exit;
|
|
14 |
* Output the friends component slug.
|
15 |
*
|
16 |
* @since 1.5.0
|
17 |
-
*
|
18 |
*/
|
19 |
function bp_friends_slug() {
|
20 |
echo bp_get_friends_slug();
|
@@ -42,7 +41,6 @@ function bp_friends_slug() {
|
|
42 |
* Output the friends component root slug.
|
43 |
*
|
44 |
* @since 1.5.0
|
45 |
-
*
|
46 |
*/
|
47 |
function bp_friends_root_slug() {
|
48 |
echo bp_get_friends_root_slug();
|
@@ -245,6 +243,8 @@ function bp_member_total_friend_count() {
|
|
245 |
*
|
246 |
* Return value is a string of the form "x friends".
|
247 |
*
|
|
|
|
|
248 |
* @since 1.2.0
|
249 |
*
|
250 |
* @return string A string of the form "x friends".
|
@@ -295,10 +295,11 @@ function bp_potential_friend_id( $user_id = 0 ) {
|
|
295 |
function bp_get_potential_friend_id( $user_id = 0 ) {
|
296 |
global $friends_template;
|
297 |
|
298 |
-
if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) )
|
299 |
$user_id = $friends_template->friendship->friend->id;
|
300 |
-
elseif ( empty( $user_id ) && !isset( $friends_template->friendship->friend ) )
|
301 |
$user_id = bp_displayed_user_id();
|
|
|
302 |
|
303 |
/**
|
304 |
* Filters the ID of current user in the friend request loop.
|
@@ -319,25 +320,29 @@ function bp_potential_friend_id( $user_id = 0 ) {
|
|
319 |
*
|
320 |
* @param int $user_id ID of the potential friend. Default: the value of
|
321 |
* {@link bp_get_potential_friend_id()}.
|
322 |
-
* @return string 'is_friend', 'not_friends', or 'pending'.
|
323 |
*/
|
324 |
function bp_is_friend( $user_id = 0 ) {
|
325 |
|
326 |
-
if ( !is_user_logged_in() )
|
327 |
return false;
|
|
|
328 |
|
329 |
-
if ( empty( $user_id ) )
|
330 |
$user_id = bp_get_potential_friend_id( $user_id );
|
|
|
331 |
|
332 |
-
if ( bp_loggedin_user_id()
|
333 |
return false;
|
|
|
334 |
|
335 |
/**
|
336 |
* Filters the status of friendship between logged in user and given user.
|
337 |
*
|
338 |
* @since 1.2.10
|
339 |
*
|
340 |
-
* @param string $value
|
|
|
341 |
*/
|
342 |
return apply_filters( 'bp_is_friend', friends_check_friendship_status( bp_loggedin_user_id(), $user_id ), $user_id );
|
343 |
}
|
@@ -363,20 +368,22 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
363 |
* @param int $potential_friend_id ID of the user to whom the button
|
364 |
* applies. Default: value of {@link bp_get_potential_friend_id()}.
|
365 |
* @param bool $friend_status Not currently used.
|
366 |
-
* @return
|
367 |
*/
|
368 |
function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
|
369 |
|
370 |
-
if ( empty( $potential_friend_id ) )
|
371 |
$potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
|
|
|
372 |
|
373 |
$is_friend = bp_is_friend( $potential_friend_id );
|
374 |
|
375 |
-
if ( empty( $is_friend ) )
|
376 |
return false;
|
|
|
377 |
|
378 |
switch ( $is_friend ) {
|
379 |
-
case 'pending'
|
380 |
$button = array(
|
381 |
'id' => 'pending',
|
382 |
'component' => 'friends',
|
@@ -388,11 +395,11 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
388 |
'link_text' => __( 'Cancel Friendship Request', 'buddypress' ),
|
389 |
'link_id' => 'friend-' . $potential_friend_id,
|
390 |
'link_rel' => 'remove',
|
391 |
-
'link_class' => 'friendship-button pending_friend requested'
|
392 |
);
|
393 |
break;
|
394 |
|
395 |
-
case 'awaiting_response'
|
396 |
$button = array(
|
397 |
'id' => 'awaiting_response',
|
398 |
'component' => 'friends',
|
@@ -404,11 +411,11 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
404 |
'link_text' => __( 'Friendship Requested', 'buddypress' ),
|
405 |
'link_id' => 'friend-' . $potential_friend_id,
|
406 |
'link_rel' => 'remove',
|
407 |
-
'link_class' => 'friendship-button awaiting_response_friend requested'
|
408 |
);
|
409 |
break;
|
410 |
|
411 |
-
case 'is_friend'
|
412 |
$button = array(
|
413 |
'id' => 'is_friend',
|
414 |
'component' => 'friends',
|
@@ -420,7 +427,7 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
420 |
'link_text' => __( 'Cancel Friendship', 'buddypress' ),
|
421 |
'link_id' => 'friend-' . $potential_friend_id,
|
422 |
'link_rel' => 'remove',
|
423 |
-
'link_class' => 'friendship-button is_friend remove'
|
424 |
);
|
425 |
break;
|
426 |
|
@@ -436,7 +443,7 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
436 |
'link_text' => __( 'Add Friend', 'buddypress' ),
|
437 |
'link_id' => 'friend-' . $potential_friend_id,
|
438 |
'link_rel' => 'add',
|
439 |
-
'link_class' => 'friendship-button not_friends add'
|
440 |
);
|
441 |
break;
|
442 |
}
|
@@ -458,18 +465,20 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
|
|
458 |
*
|
459 |
* @param int $user_id Optional. Default: the displayed user's ID, or the
|
460 |
* logged-in user's ID.
|
461 |
-
* @return
|
462 |
* otherwise false.
|
463 |
*/
|
464 |
function bp_get_friend_ids( $user_id = 0 ) {
|
465 |
|
466 |
-
if ( empty( $user_id ) )
|
467 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
|
|
468 |
|
469 |
$friend_ids = friends_get_friend_user_ids( $user_id );
|
470 |
|
471 |
-
if ( empty( $friend_ids ) )
|
472 |
return false;
|
|
|
473 |
|
474 |
return implode( ',', friends_get_friend_user_ids( $user_id ) );
|
475 |
}
|
@@ -487,17 +496,17 @@ function bp_get_friend_ids( $user_id = 0 ) {
|
|
487 |
* @return array|int An array of user IDs if found, or a 0 if none are found.
|
488 |
*/
|
489 |
function bp_get_friendship_requests( $user_id = 0 ) {
|
490 |
-
if (
|
491 |
$user_id = bp_displayed_user_id();
|
492 |
}
|
493 |
|
494 |
-
if (
|
495 |
return 0;
|
496 |
}
|
497 |
|
498 |
$requests = friends_get_friendship_request_user_ids( $user_id );
|
499 |
|
500 |
-
if ( !empty( $requests ) ) {
|
501 |
$requests = implode( ',', (array) $requests );
|
502 |
} else {
|
503 |
$requests = 0;
|
@@ -528,6 +537,8 @@ function bp_friend_friendship_id() {
|
|
528 |
*
|
529 |
* @since 1.2.0
|
530 |
*
|
|
|
|
|
531 |
* @return int ID of the friendship.
|
532 |
*/
|
533 |
function bp_get_friend_friendship_id() {
|
@@ -561,6 +572,8 @@ function bp_friend_accept_request_link() {
|
|
561 |
*
|
562 |
* @since 1.0.0
|
563 |
*
|
|
|
|
|
564 |
* @return string accept-friendship URL.
|
565 |
*/
|
566 |
function bp_get_friend_accept_request_link() {
|
@@ -596,6 +609,8 @@ function bp_friend_reject_request_link() {
|
|
596 |
*
|
597 |
* @since 1.0.0
|
598 |
*
|
|
|
|
|
599 |
* @return string reject-friendship URL.
|
600 |
*/
|
601 |
function bp_get_friend_reject_request_link() {
|
@@ -655,9 +670,8 @@ function bp_total_friend_count( $user_id = 0 ) {
|
|
655 |
*
|
656 |
* @since 1.2.0
|
657 |
*
|
658 |
-
* @
|
659 |
-
*
|
660 |
-
* @param int $user_id See {@link bp_friend_get_total_requests_count().
|
661 |
*/
|
662 |
function bp_friend_total_requests_count( $user_id = 0 ) {
|
663 |
echo bp_friend_get_total_requests_count( $user_id );
|
@@ -672,8 +686,9 @@ function bp_friend_total_requests_count( $user_id = 0 ) {
|
|
672 |
* @return int Friend count.
|
673 |
*/
|
674 |
function bp_friend_get_total_requests_count( $user_id = 0 ) {
|
675 |
-
if ( empty( $user_id ) )
|
676 |
$user_id = bp_loggedin_user_id();
|
|
|
677 |
|
678 |
/**
|
679 |
* Filters the total friendship request count for a given user.
|
@@ -712,13 +727,17 @@ add_action( 'bp_members_admin_user_stats', 'bp_friends_profile_stats', 7, 1 );
|
|
712 |
function bp_friends_get_profile_stats( $args = '' ) {
|
713 |
|
714 |
// Parse the args.
|
715 |
-
$r = bp_parse_args(
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
|
|
|
|
|
|
|
|
722 |
|
723 |
// Allow completely overloaded output.
|
724 |
if ( empty( $r['output'] ) ) {
|
14 |
* Output the friends component slug.
|
15 |
*
|
16 |
* @since 1.5.0
|
|
|
17 |
*/
|
18 |
function bp_friends_slug() {
|
19 |
echo bp_get_friends_slug();
|
41 |
* Output the friends component root slug.
|
42 |
*
|
43 |
* @since 1.5.0
|
|
|
44 |
*/
|
45 |
function bp_friends_root_slug() {
|
46 |
echo bp_get_friends_root_slug();
|
243 |
*
|
244 |
* Return value is a string of the form "x friends".
|
245 |
*
|
246 |
+
* @global BP_Core_Members_Template $members_template
|
247 |
+
*
|
248 |
* @since 1.2.0
|
249 |
*
|
250 |
* @return string A string of the form "x friends".
|
295 |
function bp_get_potential_friend_id( $user_id = 0 ) {
|
296 |
global $friends_template;
|
297 |
|
298 |
+
if ( empty( $user_id ) && isset( $friends_template->friendship->friend ) ) {
|
299 |
$user_id = $friends_template->friendship->friend->id;
|
300 |
+
} elseif ( empty( $user_id ) && ! isset( $friends_template->friendship->friend ) ) {
|
301 |
$user_id = bp_displayed_user_id();
|
302 |
+
}
|
303 |
|
304 |
/**
|
305 |
* Filters the ID of current user in the friend request loop.
|
320 |
*
|
321 |
* @param int $user_id ID of the potential friend. Default: the value of
|
322 |
* {@link bp_get_potential_friend_id()}.
|
323 |
+
* @return bool|string 'is_friend', 'not_friends', or 'pending'.
|
324 |
*/
|
325 |
function bp_is_friend( $user_id = 0 ) {
|
326 |
|
327 |
+
if ( ! is_user_logged_in() ) {
|
328 |
return false;
|
329 |
+
}
|
330 |
|
331 |
+
if ( empty( $user_id ) ) {
|
332 |
$user_id = bp_get_potential_friend_id( $user_id );
|
333 |
+
}
|
334 |
|
335 |
+
if ( bp_loggedin_user_id() === $user_id ) {
|
336 |
return false;
|
337 |
+
}
|
338 |
|
339 |
/**
|
340 |
* Filters the status of friendship between logged in user and given user.
|
341 |
*
|
342 |
* @since 1.2.10
|
343 |
*
|
344 |
+
* @param string $value String status of friendship. Possible values are 'is_friend', 'not_friends', 'pending'.
|
345 |
+
* @param int $user_id ID of the potential friend.
|
346 |
*/
|
347 |
return apply_filters( 'bp_is_friend', friends_check_friendship_status( bp_loggedin_user_id(), $user_id ), $user_id );
|
348 |
}
|
368 |
* @param int $potential_friend_id ID of the user to whom the button
|
369 |
* applies. Default: value of {@link bp_get_potential_friend_id()}.
|
370 |
* @param bool $friend_status Not currently used.
|
371 |
+
* @return bool|string HTML for the Add Friend button. False if already friends.
|
372 |
*/
|
373 |
function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
|
374 |
|
375 |
+
if ( empty( $potential_friend_id ) ) {
|
376 |
$potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
|
377 |
+
}
|
378 |
|
379 |
$is_friend = bp_is_friend( $potential_friend_id );
|
380 |
|
381 |
+
if ( empty( $is_friend ) ) {
|
382 |
return false;
|
383 |
+
}
|
384 |
|
385 |
switch ( $is_friend ) {
|
386 |
+
case 'pending':
|
387 |
$button = array(
|
388 |
'id' => 'pending',
|
389 |
'component' => 'friends',
|
395 |
'link_text' => __( 'Cancel Friendship Request', 'buddypress' ),
|
396 |
'link_id' => 'friend-' . $potential_friend_id,
|
397 |
'link_rel' => 'remove',
|
398 |
+
'link_class' => 'friendship-button pending_friend requested',
|
399 |
);
|
400 |
break;
|
401 |
|
402 |
+
case 'awaiting_response':
|
403 |
$button = array(
|
404 |
'id' => 'awaiting_response',
|
405 |
'component' => 'friends',
|
411 |
'link_text' => __( 'Friendship Requested', 'buddypress' ),
|
412 |
'link_id' => 'friend-' . $potential_friend_id,
|
413 |
'link_rel' => 'remove',
|
414 |
+
'link_class' => 'friendship-button awaiting_response_friend requested',
|
415 |
);
|
416 |
break;
|
417 |
|
418 |
+
case 'is_friend':
|
419 |
$button = array(
|
420 |
'id' => 'is_friend',
|
421 |
'component' => 'friends',
|
427 |
'link_text' => __( 'Cancel Friendship', 'buddypress' ),
|
428 |
'link_id' => 'friend-' . $potential_friend_id,
|
429 |
'link_rel' => 'remove',
|
430 |
+
'link_class' => 'friendship-button is_friend remove',
|
431 |
);
|
432 |
break;
|
433 |
|
443 |
'link_text' => __( 'Add Friend', 'buddypress' ),
|
444 |
'link_id' => 'friend-' . $potential_friend_id,
|
445 |
'link_rel' => 'add',
|
446 |
+
'link_class' => 'friendship-button not_friends add',
|
447 |
);
|
448 |
break;
|
449 |
}
|
465 |
*
|
466 |
* @param int $user_id Optional. Default: the displayed user's ID, or the
|
467 |
* logged-in user's ID.
|
468 |
+
* @return bool|string A comma-separated list of friend IDs if any are found,
|
469 |
* otherwise false.
|
470 |
*/
|
471 |
function bp_get_friend_ids( $user_id = 0 ) {
|
472 |
|
473 |
+
if ( empty( $user_id ) ) {
|
474 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
475 |
+
}
|
476 |
|
477 |
$friend_ids = friends_get_friend_user_ids( $user_id );
|
478 |
|
479 |
+
if ( empty( $friend_ids ) ) {
|
480 |
return false;
|
481 |
+
}
|
482 |
|
483 |
return implode( ',', friends_get_friend_user_ids( $user_id ) );
|
484 |
}
|
496 |
* @return array|int An array of user IDs if found, or a 0 if none are found.
|
497 |
*/
|
498 |
function bp_get_friendship_requests( $user_id = 0 ) {
|
499 |
+
if ( ! $user_id ) {
|
500 |
$user_id = bp_displayed_user_id();
|
501 |
}
|
502 |
|
503 |
+
if ( ! $user_id ) {
|
504 |
return 0;
|
505 |
}
|
506 |
|
507 |
$requests = friends_get_friendship_request_user_ids( $user_id );
|
508 |
|
509 |
+
if ( ! empty( $requests ) ) {
|
510 |
$requests = implode( ',', (array) $requests );
|
511 |
} else {
|
512 |
$requests = 0;
|
537 |
*
|
538 |
* @since 1.2.0
|
539 |
*
|
540 |
+
* @global BP_Core_Members_Template $members_template
|
541 |
+
*
|
542 |
* @return int ID of the friendship.
|
543 |
*/
|
544 |
function bp_get_friend_friendship_id() {
|
572 |
*
|
573 |
* @since 1.0.0
|
574 |
*
|
575 |
+
* @global BP_Core_Members_Template $members_template
|
576 |
+
*
|
577 |
* @return string accept-friendship URL.
|
578 |
*/
|
579 |
function bp_get_friend_accept_request_link() {
|
609 |
*
|
610 |
* @since 1.0.0
|
611 |
*
|
612 |
+
* @global BP_Core_Members_Template $members_template
|
613 |
+
*
|
614 |
* @return string reject-friendship URL.
|
615 |
*/
|
616 |
function bp_get_friend_reject_request_link() {
|
670 |
*
|
671 |
* @since 1.2.0
|
672 |
*
|
673 |
+
* @param int $user_id ID of the user whose requests are being counted.
|
674 |
+
* Default: ID of the logged-in user.
|
|
|
675 |
*/
|
676 |
function bp_friend_total_requests_count( $user_id = 0 ) {
|
677 |
echo bp_friend_get_total_requests_count( $user_id );
|
686 |
* @return int Friend count.
|
687 |
*/
|
688 |
function bp_friend_get_total_requests_count( $user_id = 0 ) {
|
689 |
+
if ( empty( $user_id ) ) {
|
690 |
$user_id = bp_loggedin_user_id();
|
691 |
+
}
|
692 |
|
693 |
/**
|
694 |
* Filters the total friendship request count for a given user.
|
727 |
function bp_friends_get_profile_stats( $args = '' ) {
|
728 |
|
729 |
// Parse the args.
|
730 |
+
$r = bp_parse_args(
|
731 |
+
$args,
|
732 |
+
array(
|
733 |
+
'before' => '<li class="bp-friends-profile-stats">',
|
734 |
+
'after' => '</li>',
|
735 |
+
'user_id' => bp_displayed_user_id(),
|
736 |
+
'friends' => 0,
|
737 |
+
'output' => '',
|
738 |
+
),
|
739 |
+
'friends_get_profile_stats'
|
740 |
+
);
|
741 |
|
742 |
// Allow completely overloaded output.
|
743 |
if ( empty( $r['output'] ) ) {
|
@@ -3,13 +3,22 @@
|
|
3 |
* BuddyPress Friends Widgets.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
-
* @subpackage
|
7 |
* @since 1.9.0
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly.
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Register the friends widget.
|
15 |
*
|
@@ -27,7 +36,7 @@ function bp_friends_register_widgets() {
|
|
27 |
return;
|
28 |
}
|
29 |
|
30 |
-
add_action( 'widgets_init',
|
31 |
}
|
32 |
add_action( 'bp_register_widgets', 'bp_friends_register_widgets' );
|
33 |
|
@@ -86,7 +95,7 @@ function bp_core_ajax_widget_friends() {
|
|
86 |
|
87 |
<?php else: ?>
|
88 |
<?php echo "-1[[SPLIT]]<li>"; ?>
|
89 |
-
<?php
|
90 |
<?php echo "</li>"; ?>
|
91 |
<?php endif;
|
92 |
}
|
3 |
* BuddyPress Friends Widgets.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
+
* @subpackage FriendsWidgets
|
7 |
* @since 1.9.0
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly.
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
|
13 |
+
/**
|
14 |
+
* Registers the Friends Legacy Widget.
|
15 |
+
*
|
16 |
+
* @since 10.0.0
|
17 |
+
*/
|
18 |
+
function bp_friends_register_friends_widget() {
|
19 |
+
register_widget( 'BP_Core_Friends_Widget' );
|
20 |
+
}
|
21 |
+
|
22 |
/**
|
23 |
* Register the friends widget.
|
24 |
*
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
+
add_action( 'widgets_init', 'bp_friends_register_friends_widget' );
|
40 |
}
|
41 |
add_action( 'bp_register_widgets', 'bp_friends_register_widgets' );
|
42 |
|
95 |
|
96 |
<?php else: ?>
|
97 |
<?php echo "-1[[SPLIT]]<li>"; ?>
|
98 |
+
<?php esc_html_e( 'There were no members found, please try another filter.', 'buddypress' ); ?>
|
99 |
<?php echo "</li>"; ?>
|
100 |
<?php endif;
|
101 |
}
|
@@ -3,7 +3,7 @@
|
|
3 |
* BuddyPress Friends Widget.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
-
* @subpackage
|
7 |
* @since 1.9.0
|
8 |
*/
|
9 |
|
@@ -23,7 +23,7 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
23 |
* @since 1.9.0
|
24 |
* @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
|
25 |
*/
|
26 |
-
function __construct() {
|
27 |
$widget_ops = array(
|
28 |
'description' => __( 'A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.', 'buddypress' ),
|
29 |
'classname' => 'widget_bp_core_friends_widget buddypress widget',
|
@@ -52,10 +52,12 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
52 |
*
|
53 |
* @since 1.9.0
|
54 |
*
|
|
|
|
|
55 |
* @param array $args Widget arguments.
|
56 |
* @param array $instance The widget settings, as saved by the user.
|
57 |
*/
|
58 |
-
function widget( $args, $instance ) {
|
59 |
global $members_template;
|
60 |
|
61 |
extract( $args );
|
@@ -64,8 +66,8 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
64 |
return;
|
65 |
}
|
66 |
|
67 |
-
$user_id
|
68 |
-
$link
|
69 |
$instance['title'] = sprintf( __( "%s's Friends", 'buddypress' ), bp_get_displayed_user_fullname() );
|
70 |
|
71 |
if ( empty( $instance['friend_default'] ) ) {
|
@@ -158,7 +160,7 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
158 |
* @param array $old_instance The parameters as previously saved to the database.
|
159 |
* @return array $instance The processed settings to save.
|
160 |
*/
|
161 |
-
function update( $new_instance, $old_instance ) {
|
162 |
$instance = $old_instance;
|
163 |
|
164 |
$instance['max_friends'] = absint( $new_instance['max_friends'] );
|
@@ -174,34 +176,36 @@ class BP_Core_Friends_Widget extends WP_Widget {
|
|
174 |
* @since 1.9.0
|
175 |
*
|
176 |
* @param array $instance The saved widget settings.
|
177 |
-
* @return void
|
178 |
*/
|
179 |
-
function form( $instance ) {
|
180 |
$defaults = array(
|
181 |
-
'max_friends'
|
182 |
'friend_default' => 'active',
|
183 |
-
'link_title'
|
|
|
|
|
|
|
|
|
|
|
184 |
);
|
185 |
-
$instance = wp_parse_args( (array) $instance, $defaults );
|
186 |
|
187 |
-
$max_friends
|
188 |
$friend_default = $instance['friend_default'];
|
189 |
-
$link_title
|
190 |
?>
|
191 |
|
192 |
<p><label for="<?php echo $this->get_field_id( 'link_title' ); ?>"><input type="checkbox" name="<?php echo $this->get_field_name('link_title'); ?>" id="<?php echo $this->get_field_id( 'link_title' ); ?>" value="1" <?php checked( $link_title ); ?> /> <?php _e( 'Link widget title to Members directory', 'buddypress' ); ?></label></p>
|
193 |
|
194 |
-
<p><label for="<?php echo $this->get_field_id( 'max_friends' ); ?>"><?php
|
195 |
|
196 |
<p>
|
197 |
-
<label for="<?php echo $this->get_field_id( 'friend_default' ) ?>"><?php
|
198 |
<select name="<?php echo $this->get_field_name( 'friend_default' ); ?>" id="<?php echo $this->get_field_id( 'friend_default' ); ?>">
|
199 |
-
<option value="newest" <?php selected( $friend_default, 'newest' ); ?>><?php
|
200 |
-
<option value="active" <?php selected( $friend_default, 'active' )
|
201 |
-
<option value="popular" <?php selected( $friend_default, 'popular' ); ?>><?php
|
202 |
</select>
|
203 |
</p>
|
204 |
-
|
205 |
<?php
|
206 |
}
|
207 |
}
|
3 |
* BuddyPress Friends Widget.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
+
* @subpackage FriendsWidget
|
7 |
* @since 1.9.0
|
8 |
*/
|
9 |
|
23 |
* @since 1.9.0
|
24 |
* @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
|
25 |
*/
|
26 |
+
public function __construct() {
|
27 |
$widget_ops = array(
|
28 |
'description' => __( 'A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.', 'buddypress' ),
|
29 |
'classname' => 'widget_bp_core_friends_widget buddypress widget',
|
52 |
*
|
53 |
* @since 1.9.0
|
54 |
*
|
55 |
+
* @global BP_Core_Members_Template $members_template
|
56 |
+
*
|
57 |
* @param array $args Widget arguments.
|
58 |
* @param array $instance The widget settings, as saved by the user.
|
59 |
*/
|
60 |
+
public function widget( $args, $instance ) {
|
61 |
global $members_template;
|
62 |
|
63 |
extract( $args );
|
66 |
return;
|
67 |
}
|
68 |
|
69 |
+
$user_id = bp_displayed_user_id();
|
70 |
+
$link = trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() );
|
71 |
$instance['title'] = sprintf( __( "%s's Friends", 'buddypress' ), bp_get_displayed_user_fullname() );
|
72 |
|
73 |
if ( empty( $instance['friend_default'] ) ) {
|
160 |
* @param array $old_instance The parameters as previously saved to the database.
|
161 |
* @return array $instance The processed settings to save.
|
162 |
*/
|
163 |
+
public function update( $new_instance, $old_instance ) {
|
164 |
$instance = $old_instance;
|
165 |
|
166 |
$instance['max_friends'] = absint( $new_instance['max_friends'] );
|
176 |
* @since 1.9.0
|
177 |
*
|
178 |
* @param array $instance The saved widget settings.
|
|
|
179 |
*/
|
180 |
+
public function form( $instance ) {
|
181 |
$defaults = array(
|
182 |
+
'max_friends' => 5,
|
183 |
'friend_default' => 'active',
|
184 |
+
'link_title' => false,
|
185 |
+
);
|
186 |
+
|
187 |
+
$instance = bp_parse_args(
|
188 |
+
(array) $instance,
|
189 |
+
$defaults
|
190 |
);
|
|
|
191 |
|
192 |
+
$max_friends = $instance['max_friends'];
|
193 |
$friend_default = $instance['friend_default'];
|
194 |
+
$link_title = (bool) $instance['link_title'];
|
195 |
?>
|
196 |
|
197 |
<p><label for="<?php echo $this->get_field_id( 'link_title' ); ?>"><input type="checkbox" name="<?php echo $this->get_field_name('link_title'); ?>" id="<?php echo $this->get_field_id( 'link_title' ); ?>" value="1" <?php checked( $link_title ); ?> /> <?php _e( 'Link widget title to Members directory', 'buddypress' ); ?></label></p>
|
198 |
|
199 |
+
<p><label for="<?php echo $this->get_field_id( 'max_friends' ); ?>"><?php esc_html_e( 'Max friends to show:', 'buddypress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_friends' ); ?>" name="<?php echo $this->get_field_name( 'max_friends' ); ?>" type="text" value="<?php echo absint( $max_friends ); ?>" style="width: 30%" /></label></p>
|
200 |
|
201 |
<p>
|
202 |
+
<label for="<?php echo $this->get_field_id( 'friend_default' ) ?>"><?php esc_html_e( 'Default friends to show:', 'buddypress' ); ?></label>
|
203 |
<select name="<?php echo $this->get_field_name( 'friend_default' ); ?>" id="<?php echo $this->get_field_id( 'friend_default' ); ?>">
|
204 |
+
<option value="newest" <?php selected( $friend_default, 'newest' ); ?>><?php esc_html_e( 'Newest', 'buddypress' ); ?></option>
|
205 |
+
<option value="active" <?php selected( $friend_default, 'active' ); ?>><?php esc_html_e( 'Active', 'buddypress' ); ?></option>
|
206 |
+
<option value="popular" <?php selected( $friend_default, 'popular' ); ?>><?php esc_html_e( 'Popular', 'buddypress' ); ?></option>
|
207 |
</select>
|
208 |
</p>
|
|
|
209 |
<?php
|
210 |
}
|
211 |
}
|
@@ -5,7 +5,7 @@
|
|
5 |
* The friends component is for users to create relationships with each other.
|
6 |
*
|
7 |
* @package BuddyPress
|
8 |
-
* @subpackage
|
9 |
* @since 1.5.0
|
10 |
*/
|
11 |
|
@@ -30,7 +30,7 @@ class BP_Friends_Component extends BP_Component {
|
|
30 |
_x( 'Friend Connections', 'Friends screen page <title>', 'buddypress' ),
|
31 |
buddypress()->plugin_dir,
|
32 |
array(
|
33 |
-
'adminbar_myaccount_order' => 60
|
34 |
)
|
35 |
);
|
36 |
}
|
@@ -104,6 +104,8 @@ class BP_Friends_Component extends BP_Component {
|
|
104 |
*
|
105 |
* @since 1.5.0
|
106 |
*
|
|
|
|
|
107 |
* @see BP_Component::setup_globals() for description of parameters.
|
108 |
*
|
109 |
* @param array $args See {@link BP_Component::setup_globals()}.
|
@@ -193,7 +195,7 @@ class BP_Friends_Component extends BP_Component {
|
|
193 |
'position' => 60,
|
194 |
'screen_function' => 'friends_screen_my_friends',
|
195 |
'default_subnav_slug' => 'my-friends',
|
196 |
-
'item_css_id' => $this->id
|
197 |
);
|
198 |
|
199 |
// Add the subnav items to the friends nav item.
|
@@ -204,7 +206,7 @@ class BP_Friends_Component extends BP_Component {
|
|
204 |
'parent_slug' => $slug,
|
205 |
'screen_function' => 'friends_screen_my_friends',
|
206 |
'position' => 10,
|
207 |
-
'item_css_id' => 'friends-my-friends'
|
208 |
);
|
209 |
|
210 |
$sub_nav[] = array(
|
@@ -214,7 +216,7 @@ class BP_Friends_Component extends BP_Component {
|
|
214 |
'parent_slug' => $slug,
|
215 |
'screen_function' => 'friends_screen_requests',
|
216 |
'position' => 20,
|
217 |
-
'user_has_access' => $access
|
218 |
);
|
219 |
|
220 |
parent::setup_nav( $main_nav, $sub_nav );
|
@@ -240,7 +242,7 @@ class BP_Friends_Component extends BP_Component {
|
|
240 |
|
241 |
// Pending friend requests.
|
242 |
$count = count( friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) );
|
243 |
-
if ( !empty( $count ) ) {
|
244 |
$title = sprintf(
|
245 |
/* translators: %s: Pending friend request count for the current user */
|
246 |
_x( 'Friends %s', 'My Account Friends menu', 'buddypress' ),
|
@@ -252,8 +254,8 @@ class BP_Friends_Component extends BP_Component {
|
|
252 |
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
253 |
);
|
254 |
} else {
|
255 |
-
$title = _x( 'Friends',
|
256 |
-
$pending = _x( 'No Pending Requests','My Account Friends menu sub nav', 'buddypress' );
|
257 |
}
|
258 |
|
259 |
// Add the "My Account" sub menus.
|
@@ -261,7 +263,7 @@ class BP_Friends_Component extends BP_Component {
|
|
261 |
'parent' => buddypress()->my_account_menu_id,
|
262 |
'id' => 'my-account-' . $this->id,
|
263 |
'title' => $title,
|
264 |
-
'href' => $friends_link
|
265 |
);
|
266 |
|
267 |
// My Friends.
|
@@ -269,8 +271,8 @@ class BP_Friends_Component extends BP_Component {
|
|
269 |
'parent' => 'my-account-' . $this->id,
|
270 |
'id' => 'my-account-' . $this->id . '-friendships',
|
271 |
'title' => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ),
|
272 |
-
'href' => $friends_link,
|
273 |
-
'position' => 10
|
274 |
);
|
275 |
|
276 |
// Requests.
|
@@ -279,7 +281,7 @@ class BP_Friends_Component extends BP_Component {
|
|
279 |
'id' => 'my-account-' . $this->id . '-requests',
|
280 |
'title' => $pending,
|
281 |
'href' => trailingslashit( $friends_link . 'requests' ),
|
282 |
-
'position' => 20
|
283 |
);
|
284 |
}
|
285 |
|
@@ -290,6 +292,8 @@ class BP_Friends_Component extends BP_Component {
|
|
290 |
* Set up the title for pages and <title>.
|
291 |
*
|
292 |
* @since 1.5.0
|
|
|
|
|
293 |
*/
|
294 |
public function setup_title() {
|
295 |
|
@@ -366,8 +370,8 @@ class BP_Friends_Component extends BP_Component {
|
|
366 |
'wp-components',
|
367 |
'wp-i18n',
|
368 |
'wp-block-editor',
|
|
|
369 |
'bp-block-data',
|
370 |
-
'bp-block-components',
|
371 |
),
|
372 |
'style' => 'bp-friends-block',
|
373 |
'style_url' => plugins_url( 'css/blocks/friends.css', dirname( __FILE__ ) ),
|
5 |
* The friends component is for users to create relationships with each other.
|
6 |
*
|
7 |
* @package BuddyPress
|
8 |
+
* @subpackage FriendsComponent
|
9 |
* @since 1.5.0
|
10 |
*/
|
11 |
|
30 |
_x( 'Friend Connections', 'Friends screen page <title>', 'buddypress' ),
|
31 |
buddypress()->plugin_dir,
|
32 |
array(
|
33 |
+
'adminbar_myaccount_order' => 60,
|
34 |
)
|
35 |
);
|
36 |
}
|
104 |
*
|
105 |
* @since 1.5.0
|
106 |
*
|
107 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
108 |
+
*
|
109 |
* @see BP_Component::setup_globals() for description of parameters.
|
110 |
*
|
111 |
* @param array $args See {@link BP_Component::setup_globals()}.
|
195 |
'position' => 60,
|
196 |
'screen_function' => 'friends_screen_my_friends',
|
197 |
'default_subnav_slug' => 'my-friends',
|
198 |
+
'item_css_id' => $this->id,
|
199 |
);
|
200 |
|
201 |
// Add the subnav items to the friends nav item.
|
206 |
'parent_slug' => $slug,
|
207 |
'screen_function' => 'friends_screen_my_friends',
|
208 |
'position' => 10,
|
209 |
+
'item_css_id' => 'friends-my-friends',
|
210 |
);
|
211 |
|
212 |
$sub_nav[] = array(
|
216 |
'parent_slug' => $slug,
|
217 |
'screen_function' => 'friends_screen_requests',
|
218 |
'position' => 20,
|
219 |
+
'user_has_access' => $access,
|
220 |
);
|
221 |
|
222 |
parent::setup_nav( $main_nav, $sub_nav );
|
242 |
|
243 |
// Pending friend requests.
|
244 |
$count = count( friends_get_friendship_request_user_ids( bp_loggedin_user_id() ) );
|
245 |
+
if ( ! empty( $count ) ) {
|
246 |
$title = sprintf(
|
247 |
/* translators: %s: Pending friend request count for the current user */
|
248 |
_x( 'Friends %s', 'My Account Friends menu', 'buddypress' ),
|
254 |
'<span class="count">' . bp_core_number_format( $count ) . '</span>'
|
255 |
);
|
256 |
} else {
|
257 |
+
$title = _x( 'Friends', 'My Account Friends menu', 'buddypress' );
|
258 |
+
$pending = _x( 'No Pending Requests', 'My Account Friends menu sub nav', 'buddypress' );
|
259 |
}
|
260 |
|
261 |
// Add the "My Account" sub menus.
|
263 |
'parent' => buddypress()->my_account_menu_id,
|
264 |
'id' => 'my-account-' . $this->id,
|
265 |
'title' => $title,
|
266 |
+
'href' => $friends_link,
|
267 |
);
|
268 |
|
269 |
// My Friends.
|
271 |
'parent' => 'my-account-' . $this->id,
|
272 |
'id' => 'my-account-' . $this->id . '-friendships',
|
273 |
'title' => _x( 'Friendships', 'My Account Friends menu sub nav', 'buddypress' ),
|
274 |
+
'href' => trailingslashit( $friends_link . 'my-friends' ),
|
275 |
+
'position' => 10,
|
276 |
);
|
277 |
|
278 |
// Requests.
|
281 |
'id' => 'my-account-' . $this->id . '-requests',
|
282 |
'title' => $pending,
|
283 |
'href' => trailingslashit( $friends_link . 'requests' ),
|
284 |
+
'position' => 20,
|
285 |
);
|
286 |
}
|
287 |
|
292 |
* Set up the title for pages and <title>.
|
293 |
*
|
294 |
* @since 1.5.0
|
295 |
+
*
|
296 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
297 |
*/
|
298 |
public function setup_title() {
|
299 |
|
370 |
'wp-components',
|
371 |
'wp-i18n',
|
372 |
'wp-block-editor',
|
373 |
+
'wp-server-side-render',
|
374 |
'bp-block-data',
|
|
|
375 |
),
|
376 |
'style' => 'bp-friends-block',
|
377 |
'style_url' => plugins_url( 'css/blocks/friends.css', dirname( __FILE__ ) ),
|
@@ -3,7 +3,7 @@
|
|
3 |
* BuddyPress Friends Classes.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
-
* @subpackage
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
|
@@ -97,15 +97,30 @@ class BP_Friends_Friendship {
|
|
97 |
* Constructor method.
|
98 |
*
|
99 |
* @since 1.5.0
|
|
|
100 |
*
|
101 |
* @param int|null $id Optional. The ID of an existing friendship.
|
102 |
* @param bool $is_request Deprecated.
|
103 |
-
* @param bool $populate_friend_details True if friend details should be queried.
|
104 |
*/
|
105 |
public function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
$this->is_request = $is_request;
|
107 |
|
108 |
-
if ( !empty( $id ) ) {
|
109 |
$this->id = (int) $id;
|
110 |
$this->populate_friend_details = $populate_friend_details;
|
111 |
$this->populate( $this->id );
|
@@ -116,6 +131,9 @@ class BP_Friends_Friendship {
|
|
116 |
* Set up data about the current friendship.
|
117 |
*
|
118 |
* @since 1.0.0
|
|
|
|
|
|
|
119 |
*/
|
120 |
public function populate() {
|
121 |
global $wpdb;
|
@@ -145,7 +163,7 @@ class BP_Friends_Friendship {
|
|
145 |
$this->date_created = $friendship->date_created;
|
146 |
|
147 |
if ( ! empty( $this->populate_friend_details ) ) {
|
148 |
-
if ( $this->friend_user_id
|
149 |
$this->friend = new BP_Core_User( $this->initiator_user_id );
|
150 |
} else {
|
151 |
$this->friend = new BP_Core_User( $this->friend_user_id );
|
@@ -158,6 +176,9 @@ class BP_Friends_Friendship {
|
|
158 |
*
|
159 |
* @since 1.0.0
|
160 |
*
|
|
|
|
|
|
|
161 |
* @return bool True on success, false on failure.
|
162 |
*/
|
163 |
public function save() {
|
@@ -166,22 +187,22 @@ class BP_Friends_Friendship {
|
|
166 |
$bp = buddypress();
|
167 |
|
168 |
$this->initiator_user_id = apply_filters( 'friends_friendship_initiator_user_id_before_save', $this->initiator_user_id, $this->id );
|
169 |
-
$this->friend_user_id = apply_filters( 'friends_friendship_friend_user_id_before_save',
|
170 |
-
$this->is_confirmed = apply_filters( 'friends_friendship_is_confirmed_before_save',
|
171 |
-
$this->is_limited = apply_filters( 'friends_friendship_is_limited_before_save',
|
172 |
-
$this->date_created = apply_filters( 'friends_friendship_date_created_before_save',
|
173 |
|
174 |
/**
|
175 |
* Fires before processing and saving the current friendship request.
|
176 |
*
|
177 |
* @since 1.0.0
|
178 |
*
|
179 |
-
* @param BP_Friends_Friendship $value Current friendship
|
180 |
*/
|
181 |
do_action_ref_array( 'friends_friendship_before_save', array( &$this ) );
|
182 |
|
183 |
// Update.
|
184 |
-
if (!empty( $this->id ) ) {
|
185 |
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
|
186 |
|
187 |
// Save.
|
@@ -195,7 +216,7 @@ class BP_Friends_Friendship {
|
|
195 |
*
|
196 |
* @since 1.0.0
|
197 |
*
|
198 |
-
* @param BP_Friends_Friendship $value Current friendship
|
199 |
*/
|
200 |
do_action_ref_array( 'friends_friendship_after_save', array( &$this ) );
|
201 |
|
@@ -207,6 +228,9 @@ class BP_Friends_Friendship {
|
|
207 |
*
|
208 |
* @since 1.0.0
|
209 |
*
|
|
|
|
|
|
|
210 |
* @return bool|int
|
211 |
*/
|
212 |
public function delete() {
|
@@ -224,8 +248,8 @@ class BP_Friends_Friendship {
|
|
224 |
*
|
225 |
* @since 2.6.0
|
226 |
*
|
227 |
-
* @param int
|
228 |
-
* @param array
|
229 |
* Optional. Filter parameters.
|
230 |
* @type int $id ID of specific friendship to retrieve.
|
231 |
* @type int $initiator_user_id ID of friendship initiator.
|
@@ -233,9 +257,9 @@ class BP_Friends_Friendship {
|
|
233 |
* @type int $is_confirmed Whether the friendship has been accepted.
|
234 |
* @type int $is_limited Whether the friendship is limited.
|
235 |
* @type string $order_by Column name to order by.
|
236 |
-
* @type string $sort_order ASC or DESC. Default DESC.
|
237 |
* }
|
238 |
-
* @param string $operator
|
239 |
*
|
240 |
* @return array $friendships Array of friendship objects.
|
241 |
*/
|
@@ -245,17 +269,21 @@ class BP_Friends_Friendship {
|
|
245 |
$user_id = bp_loggedin_user_id();
|
246 |
}
|
247 |
|
248 |
-
$r = bp_parse_args(
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
|
|
|
|
|
|
|
|
259 |
|
260 |
// First, we get all friendships that involve the user.
|
261 |
$friendship_ids = wp_cache_get( $user_id, 'bp_friends_friendships_for_user' );
|
@@ -341,7 +369,7 @@ class BP_Friends_Friendship {
|
|
341 |
}
|
342 |
|
343 |
// Adjust the sort direction of the results.
|
344 |
-
if ( 'ASC' ===
|
345 |
// `true` to preserve keys.
|
346 |
$friendships = array_reverse( $friendships, true );
|
347 |
}
|
@@ -360,6 +388,9 @@ class BP_Friends_Friendship {
|
|
360 |
*
|
361 |
* @since 2.7.0
|
362 |
*
|
|
|
|
|
|
|
363 |
* @param int $user_id ID of the user.
|
364 |
* @return array
|
365 |
*/
|
@@ -387,12 +418,11 @@ class BP_Friends_Friendship {
|
|
387 |
* @return array $fids IDs of friends for provided user.
|
388 |
*/
|
389 |
public static function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
|
390 |
-
global $wpdb;
|
391 |
|
392 |
if ( ! empty( $friend_requests_only ) ) {
|
393 |
$args = array(
|
394 |
-
'is_confirmed'
|
395 |
-
'friend_user_id' => $user_id
|
396 |
);
|
397 |
} else {
|
398 |
$args = array(
|
@@ -427,7 +457,7 @@ class BP_Friends_Friendship {
|
|
427 |
$friendship_id = null;
|
428 |
|
429 |
// Can't friend yourself.
|
430 |
-
if ( $user_id
|
431 |
return $friendship_id;
|
432 |
}
|
433 |
|
@@ -437,8 +467,9 @@ class BP_Friends_Friendship {
|
|
437 |
*/
|
438 |
$args = array(
|
439 |
'initiator_user_id' => $friend_id,
|
440 |
-
'friend_user_id' => $friend_id
|
441 |
);
|
|
|
442 |
$result = self::get_friendships( $user_id, $args, 'OR' );
|
443 |
if ( $result ) {
|
444 |
$friendship_id = current( $result )->id;
|
@@ -453,7 +484,7 @@ class BP_Friends_Friendship {
|
|
453 |
*
|
454 |
* @param int $user_id The ID of the user who has received the
|
455 |
* friendship requests.
|
456 |
-
* @return array|bool An array of user IDs
|
457 |
*/
|
458 |
public static function get_friendship_request_user_ids( $user_id ) {
|
459 |
$friend_requests = wp_cache_get( $user_id, 'bp_friends_requests' );
|
@@ -483,7 +514,6 @@ class BP_Friends_Friendship {
|
|
483 |
* @return int Friend count for the user.
|
484 |
*/
|
485 |
public static function total_friend_count( $user_id = 0 ) {
|
486 |
-
global $wpdb;
|
487 |
|
488 |
if ( empty( $user_id ) ) {
|
489 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
@@ -494,9 +524,7 @@ class BP_Friends_Friendship {
|
|
494 |
* This function will recalculate, update and return.
|
495 |
*/
|
496 |
|
497 |
-
$args
|
498 |
-
'is_confirmed' => 1,
|
499 |
-
);
|
500 |
$friendships = self::get_friendships( $user_id, $args );
|
501 |
$count = count( $friendships );
|
502 |
|
@@ -513,8 +541,13 @@ class BP_Friends_Friendship {
|
|
513 |
/**
|
514 |
* Search the friends of a user by a search string.
|
515 |
*
|
|
|
|
|
516 |
* @since 1.0.0
|
517 |
*
|
|
|
|
|
|
|
518 |
* @param string $filter The search string, matched against xprofile
|
519 |
* fields (if available), or usermeta 'nickname' field.
|
520 |
* @param int $user_id ID of the user whose friends are being searched.
|
@@ -530,31 +563,32 @@ class BP_Friends_Friendship {
|
|
530 |
public static function search_friends( $filter, $user_id, $limit = null, $page = null ) {
|
531 |
global $wpdb;
|
532 |
|
533 |
-
|
534 |
-
* TODO: Optimize this function.
|
535 |
-
*/
|
536 |
|
537 |
-
if ( empty( $user_id ) )
|
538 |
$user_id = bp_loggedin_user_id();
|
|
|
539 |
|
540 |
// Only search for matching strings at the beginning of the
|
541 |
// name (@todo - figure out why this restriction).
|
542 |
$search_terms_like = bp_esc_like( $filter ) . '%';
|
543 |
|
544 |
$pag_sql = '';
|
545 |
-
if ( !empty( $limit ) && !empty( $page ) )
|
546 |
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
|
|
|
547 |
|
548 |
-
|
|
|
549 |
return false;
|
|
|
550 |
|
551 |
// Get all the user ids for the current user's friends.
|
552 |
$fids = implode( ',', wp_parse_id_list( $friend_ids ) );
|
553 |
|
554 |
-
if ( empty( $fids ) )
|
555 |
return false;
|
556 |
-
|
557 |
-
$bp = buddypress();
|
558 |
|
559 |
// Filter the user_ids based on the search criteria.
|
560 |
if ( bp_is_active( 'xprofile' ) ) {
|
@@ -568,10 +602,14 @@ class BP_Friends_Friendship {
|
|
568 |
$filtered_friend_ids = $wpdb->get_col( $sql );
|
569 |
$total_friend_ids = $wpdb->get_var( $total_sql );
|
570 |
|
571 |
-
if ( empty( $filtered_friend_ids ) )
|
572 |
return false;
|
|
|
573 |
|
574 |
-
return array(
|
|
|
|
|
|
|
575 |
}
|
576 |
|
577 |
/**
|
@@ -592,37 +630,38 @@ class BP_Friends_Friendship {
|
|
592 |
* 'is_friend', 'pending', and 'awaiting_response'.
|
593 |
*/
|
594 |
public static function check_is_friend( $initiator_userid, $possible_friend_userid ) {
|
595 |
-
global $wpdb;
|
596 |
|
597 |
if ( empty( $initiator_userid ) || empty( $possible_friend_userid ) ) {
|
598 |
return false;
|
599 |
}
|
600 |
|
601 |
// Can't friend yourself.
|
602 |
-
if ( $initiator_userid
|
603 |
return 'not_friends';
|
604 |
}
|
605 |
|
606 |
-
|
607 |
|
608 |
return bp_core_get_incremented_cache( $initiator_userid . ':' . $possible_friend_userid, 'bp_friends' );
|
609 |
}
|
610 |
|
611 |
-
|
612 |
/**
|
613 |
* Find uncached friendships between a user and one or more other users and cache them.
|
614 |
*
|
615 |
* @since 3.0.0
|
616 |
*
|
617 |
-
* @
|
|
|
|
|
|
|
618 |
* to check friendships statuses.
|
619 |
* @param int|array|string $possible_friend_ids The IDs of the one or more users
|
620 |
* to check friendship status with primary user.
|
621 |
-
* @return null
|
622 |
*/
|
623 |
public static function update_bp_friends_cache( $user_id, $possible_friend_ids ) {
|
624 |
global $wpdb;
|
625 |
-
|
|
|
626 |
$possible_friend_ids = wp_parse_id_list( $possible_friend_ids );
|
627 |
|
628 |
$fetch = array();
|
@@ -633,6 +672,7 @@ class BP_Friends_Friendship {
|
|
633 |
$fetch[] = $friend_id;
|
634 |
}
|
635 |
}
|
|
|
636 |
if ( empty( $fetch ) ) {
|
637 |
return;
|
638 |
}
|
@@ -679,13 +719,11 @@ class BP_Friends_Friendship {
|
|
679 |
* @return array $retval Array of last_active values + user_ids.
|
680 |
*/
|
681 |
public static function get_bulk_last_active( $user_ids ) {
|
682 |
-
global $wpdb;
|
683 |
-
|
684 |
$last_activities = BP_Core_User::get_last_activity( $user_ids );
|
685 |
|
686 |
// Sort and structure as expected in legacy function.
|
687 |
usort( $last_activities, function( $a, $b ) {
|
688 |
-
if ( $a['date_recorded']
|
689 |
return 0;
|
690 |
}
|
691 |
|
@@ -694,7 +732,7 @@ class BP_Friends_Friendship {
|
|
694 |
|
695 |
$retval = array();
|
696 |
foreach ( $last_activities as $last_activity ) {
|
697 |
-
$u
|
698 |
$u->last_activity = $last_activity['date_recorded'];
|
699 |
$u->user_id = $last_activity['user_id'];
|
700 |
|
@@ -709,10 +747,13 @@ class BP_Friends_Friendship {
|
|
709 |
*
|
710 |
* @since 1.0.0
|
711 |
*
|
|
|
|
|
|
|
712 |
* @param int $friendship_id ID of the friendship to be accepted.
|
713 |
* @return int Number of database rows updated.
|
714 |
*/
|
715 |
-
public static function accept($friendship_id) {
|
716 |
global $wpdb;
|
717 |
|
718 |
$bp = buddypress();
|
@@ -725,10 +766,13 @@ class BP_Friends_Friendship {
|
|
725 |
*
|
726 |
* @since 1.6.0
|
727 |
*
|
|
|
|
|
|
|
728 |
* @param int $friendship_id ID of the friendship to be withdrawn.
|
729 |
* @return int Number of database rows deleted.
|
730 |
*/
|
731 |
-
public static function withdraw($friendship_id) {
|
732 |
global $wpdb;
|
733 |
|
734 |
$bp = buddypress();
|
@@ -741,10 +785,13 @@ class BP_Friends_Friendship {
|
|
741 |
*
|
742 |
* @since 1.0.0
|
743 |
*
|
|
|
|
|
|
|
744 |
* @param int $friendship_id ID of the friendship to be rejected.
|
745 |
* @return int Number of database rows deleted.
|
746 |
*/
|
747 |
-
public static function reject($friendship_id) {
|
748 |
global $wpdb;
|
749 |
|
750 |
$bp = buddypress();
|
@@ -759,6 +806,9 @@ class BP_Friends_Friendship {
|
|
759 |
*
|
760 |
* @since 1.0.0
|
761 |
*
|
|
|
|
|
|
|
762 |
* @param string $filter String to search by.
|
763 |
* @param int $user_id A user ID param that is unused.
|
764 |
* @param int|null $limit Optional. Max number of records to return.
|
@@ -777,8 +827,9 @@ class BP_Friends_Friendship {
|
|
777 |
$users_table = $wpdb->base_prefix . 'users';
|
778 |
|
779 |
$pag_sql = '';
|
780 |
-
if ( !empty( $limit ) && !empty( $page ) )
|
781 |
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * intval( $limit ) ), intval( $limit ) );
|
|
|
782 |
|
783 |
$bp = buddypress();
|
784 |
|
@@ -789,10 +840,11 @@ class BP_Friends_Friendship {
|
|
789 |
$sql = $wpdb->prepare( "SELECT DISTINCT user_id as id FROM {$usermeta_table} WHERE meta_value LIKE %s ORDER BY d.value DESC {$pag_sql}", $search_terms_like );
|
790 |
}
|
791 |
|
792 |
-
$filtered_fids = $wpdb->get_col($sql);
|
793 |
|
794 |
-
if ( empty( $filtered_fids ) )
|
795 |
return false;
|
|
|
796 |
|
797 |
return $filtered_fids;
|
798 |
}
|
@@ -804,6 +856,9 @@ class BP_Friends_Friendship {
|
|
804 |
*
|
805 |
* @since 1.0.0
|
806 |
*
|
|
|
|
|
|
|
807 |
* @param string $filter Search term.
|
808 |
* @return int Count of users matching the search term.
|
809 |
*/
|
@@ -826,10 +881,11 @@ class BP_Friends_Friendship {
|
|
826 |
$sql = $wpdb->prepare( "SELECT COUNT(DISTINCT user_id) FROM {$usermeta_table} WHERE meta_value LIKE %s", $search_terms_like );
|
827 |
}
|
828 |
|
829 |
-
$user_count = $wpdb->get_col($sql);
|
830 |
|
831 |
-
if ( empty( $user_count ) )
|
832 |
return false;
|
|
|
833 |
|
834 |
return $user_count[0];
|
835 |
}
|
@@ -841,14 +897,19 @@ class BP_Friends_Friendship {
|
|
841 |
*
|
842 |
* @since 1.0.0
|
843 |
*
|
|
|
|
|
|
|
844 |
* @param array $user_ids Array of user IDs.
|
845 |
-
* @return array User IDs, sorted by the associated display names.
|
|
|
846 |
*/
|
847 |
public static function sort_by_name( $user_ids ) {
|
848 |
global $wpdb;
|
849 |
|
850 |
-
if ( !bp_is_active( 'xprofile' ) )
|
851 |
return false;
|
|
|
852 |
|
853 |
$bp = buddypress();
|
854 |
|
@@ -862,6 +923,9 @@ class BP_Friends_Friendship {
|
|
862 |
*
|
863 |
* @since 1.0.0
|
864 |
*
|
|
|
|
|
|
|
865 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
866 |
* @param int $total_friends Optional. Number of random friends to get.
|
867 |
* Default: 5.
|
@@ -877,14 +941,15 @@ class BP_Friends_Friendship {
|
|
877 |
$results = $wpdb->get_results( $sql );
|
878 |
|
879 |
for ( $i = 0, $count = count( $results ); $i < $count; ++$i ) {
|
880 |
-
$fids[] = ( $results[$i]->friend_user_id
|
881 |
}
|
882 |
|
883 |
// Remove duplicates.
|
884 |
-
if ( count( $fids ) > 0 )
|
885 |
return array_flip( array_flip( $fids ) );
|
886 |
-
|
887 |
-
|
|
|
888 |
}
|
889 |
|
890 |
/**
|
@@ -896,34 +961,39 @@ class BP_Friends_Friendship {
|
|
896 |
* - users who have a pending invite to the group
|
897 |
* - users who have been banned from the group
|
898 |
*
|
899 |
-
* @since 1.0.0
|
900 |
* @todo Need to do a group component check before using group functions.
|
901 |
*
|
|
|
|
|
902 |
* @param int $user_id ID of the user whose friends are being counted.
|
903 |
* @param int $group_id ID of the group friends are being invited to.
|
904 |
-
* @return int
|
905 |
*/
|
906 |
public static function get_invitable_friend_count( $user_id, $group_id ) {
|
907 |
|
|
|
|
|
|
|
|
|
908 |
// Setup some data we'll use below.
|
909 |
$is_group_admin = groups_is_user_admin( $user_id, $group_id );
|
910 |
-
$friend_ids =
|
911 |
$invitable_count = 0;
|
912 |
|
913 |
for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) {
|
914 |
|
915 |
// If already a member, they cannot be invited again.
|
916 |
-
if ( groups_is_user_member( (int) $friend_ids[$i], $group_id ) ) {
|
917 |
continue;
|
918 |
}
|
919 |
|
920 |
// If user already has invite, they cannot be added.
|
921 |
-
if ( groups_check_user_has_invite( (int) $friend_ids[$i], $group_id ) ) {
|
922 |
continue;
|
923 |
}
|
924 |
|
925 |
// If user is not group admin and friend is banned, they cannot be invited.
|
926 |
-
if ( ( false === $is_group_admin ) && groups_is_user_banned( (int) $friend_ids[$i], $group_id ) ) {
|
927 |
continue;
|
928 |
}
|
929 |
|
@@ -938,6 +1008,9 @@ class BP_Friends_Friendship {
|
|
938 |
*
|
939 |
* @since 2.7.0
|
940 |
*
|
|
|
|
|
|
|
941 |
* @param int|string|array $friendship_ids Single friendship ID or comma-separated/array list of friendship IDs.
|
942 |
* @return array
|
943 |
*/
|
@@ -956,18 +1029,17 @@ class BP_Friends_Friendship {
|
|
956 |
* @since 1.0.0
|
957 |
*
|
958 |
* @param int $friendship_id ID of the friendship.
|
959 |
-
* @return null|stdClass
|
960 |
*/
|
961 |
public static function get_user_ids_for_friendship( $friendship_id ) {
|
962 |
-
|
963 |
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
|
964 |
|
965 |
if ( empty( $friendship->id ) ) {
|
966 |
return null;
|
967 |
}
|
968 |
|
969 |
-
$retval
|
970 |
-
$retval->friend_user_id
|
971 |
$retval->initiator_user_id = $friendship->initiator_user_id;
|
972 |
|
973 |
return $retval;
|
@@ -978,6 +1050,9 @@ class BP_Friends_Friendship {
|
|
978 |
*
|
979 |
* @since 1.0.0
|
980 |
*
|
|
|
|
|
|
|
981 |
* @param int $user_id ID of the user being expunged.
|
982 |
*/
|
983 |
public static function delete_all_for_user( $user_id ) {
|
@@ -1017,7 +1092,8 @@ class BP_Friends_Friendship {
|
|
1017 |
foreach ( (array) $friend_ids as $friend_id ) {
|
1018 |
// Delete cached friendships.
|
1019 |
wp_cache_delete( $friend_id, 'bp_friends_friendships_for_user' );
|
1020 |
-
|
|
|
1021 |
}
|
1022 |
|
1023 |
// Delete cached friendships.
|
3 |
* BuddyPress Friends Classes.
|
4 |
*
|
5 |
* @package BuddyPress
|
6 |
+
* @subpackage FriendsFriendship
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
|
97 |
* Constructor method.
|
98 |
*
|
99 |
* @since 1.5.0
|
100 |
+
* @since 10.0.0 Updated to add deprecated notice for `$is_request`.
|
101 |
*
|
102 |
* @param int|null $id Optional. The ID of an existing friendship.
|
103 |
* @param bool $is_request Deprecated.
|
104 |
+
* @param bool $populate_friend_details Optional. True if friend details should be queried.
|
105 |
*/
|
106 |
public function __construct( $id = null, $is_request = false, $populate_friend_details = true ) {
|
107 |
+
|
108 |
+
if ( false !== $is_request ) {
|
109 |
+
_deprecated_argument(
|
110 |
+
__METHOD__,
|
111 |
+
'1.5.0',
|
112 |
+
sprintf(
|
113 |
+
/* translators: 1: the name of the method. 2: the name of the file. */
|
114 |
+
esc_html__( '%1$s no longer accepts $is_request. See the inline documentation at %2$s for more details.', 'buddypress' ),
|
115 |
+
__METHOD__,
|
116 |
+
__FILE__
|
117 |
+
)
|
118 |
+
);
|
119 |
+
}
|
120 |
+
|
121 |
$this->is_request = $is_request;
|
122 |
|
123 |
+
if ( ! empty( $id ) ) {
|
124 |
$this->id = (int) $id;
|
125 |
$this->populate_friend_details = $populate_friend_details;
|
126 |
$this->populate( $this->id );
|
131 |
* Set up data about the current friendship.
|
132 |
*
|
133 |
* @since 1.0.0
|
134 |
+
*
|
135 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
136 |
+
* @global wpdb $wpdb WordPress database object.
|
137 |
*/
|
138 |
public function populate() {
|
139 |
global $wpdb;
|
163 |
$this->date_created = $friendship->date_created;
|
164 |
|
165 |
if ( ! empty( $this->populate_friend_details ) ) {
|
166 |
+
if ( bp_displayed_user_id() === $this->friend_user_id ) {
|
167 |
$this->friend = new BP_Core_User( $this->initiator_user_id );
|
168 |
} else {
|
169 |
$this->friend = new BP_Core_User( $this->friend_user_id );
|
176 |
*
|
177 |
* @since 1.0.0
|
178 |
*
|
179 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
180 |
+
* @global wpdb $wpdb WordPress database object.
|
181 |
+
*
|
182 |
* @return bool True on success, false on failure.
|
183 |
*/
|
184 |
public function save() {
|
187 |
$bp = buddypress();
|
188 |
|
189 |
$this->initiator_user_id = apply_filters( 'friends_friendship_initiator_user_id_before_save', $this->initiator_user_id, $this->id );
|
190 |
+
$this->friend_user_id = apply_filters( 'friends_friendship_friend_user_id_before_save', $this->friend_user_id, $this->id );
|
191 |
+
$this->is_confirmed = apply_filters( 'friends_friendship_is_confirmed_before_save', $this->is_confirmed, $this->id );
|
192 |
+
$this->is_limited = apply_filters( 'friends_friendship_is_limited_before_save', $this->is_limited, $this->id );
|
193 |
+
$this->date_created = apply_filters( 'friends_friendship_date_created_before_save', $this->date_created, $this->id );
|
194 |
|
195 |
/**
|
196 |
* Fires before processing and saving the current friendship request.
|
197 |
*
|
198 |
* @since 1.0.0
|
199 |
*
|
200 |
+
* @param BP_Friends_Friendship $value Current friendship object. Passed by reference.
|
201 |
*/
|
202 |
do_action_ref_array( 'friends_friendship_before_save', array( &$this ) );
|
203 |
|
204 |
// Update.
|
205 |
+
if ( ! empty( $this->id ) ) {
|
206 |
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
|
207 |
|
208 |
// Save.
|
216 |
*
|
217 |
* @since 1.0.0
|
218 |
*
|
219 |
+
* @param BP_Friends_Friendship $value Current friendship object. Passed by reference.
|
220 |
*/
|
221 |
do_action_ref_array( 'friends_friendship_after_save', array( &$this ) );
|
222 |
|
228 |
*
|
229 |
* @since 1.0.0
|
230 |
*
|
231 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
232 |
+
* @global wpdb $wpdb WordPress database object.
|
233 |
+
*
|
234 |
* @return bool|int
|
235 |
*/
|
236 |
public function delete() {
|
248 |
*
|
249 |
* @since 2.6.0
|
250 |
*
|
251 |
+
* @param int $user_id ID of the user whose friends are being retrieved.
|
252 |
+
* @param array $args {
|
253 |
* Optional. Filter parameters.
|
254 |
* @type int $id ID of specific friendship to retrieve.
|
255 |
* @type int $initiator_user_id ID of friendship initiator.
|
257 |
* @type int $is_confirmed Whether the friendship has been accepted.
|
258 |
* @type int $is_limited Whether the friendship is limited.
|
259 |
* @type string $order_by Column name to order by.
|
260 |
+
* @type string $sort_order Optional. ASC or DESC. Default: 'DESC'.
|
261 |
* }
|
262 |
+
* @param string $operator Optional. Operator to use in `wp_list_filter()`.
|
263 |
*
|
264 |
* @return array $friendships Array of friendship objects.
|
265 |
*/
|
269 |
$user_id = bp_loggedin_user_id();
|
270 |
}
|
271 |
|
272 |
+
$r = bp_parse_args(
|
273 |
+
$args,
|
274 |
+
array(
|
275 |
+
'id' => null,
|
276 |
+
'initiator_user_id' => null,
|
277 |
+
'friend_user_id' => null,
|
278 |
+
'is_confirmed' => null,
|
279 |
+
'is_limited' => null,
|
280 |
+
'order_by' => 'date_created',
|
281 |
+
'sort_order' => 'DESC',
|
282 |
+
'page' => null,
|
283 |
+
'per_page' => null,
|
284 |
+
),
|
285 |
+
'bp_get_user_friendships'
|
286 |
+
);
|
287 |
|
288 |
// First, we get all friendships that involve the user.
|
289 |
$friendship_ids = wp_cache_get( $user_id, 'bp_friends_friendships_for_user' );
|
369 |
}
|
370 |
|
371 |
// Adjust the sort direction of the results.
|
372 |
+
if ( 'ASC' === bp_esc_sql_order( $r['sort_order'] ) ) {
|
373 |
// `true` to preserve keys.
|
374 |
$friendships = array_reverse( $friendships, true );
|
375 |
}
|
388 |
*
|
389 |
* @since 2.7.0
|
390 |
*
|
391 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
392 |
+
* @global wpdb $wpdb WordPress database object.
|
393 |
+
*
|
394 |
* @param int $user_id ID of the user.
|
395 |
* @return array
|
396 |
*/
|
418 |
* @return array $fids IDs of friends for provided user.
|
419 |
*/
|
420 |
public static function get_friend_user_ids( $user_id, $friend_requests_only = false, $assoc_arr = false ) {
|
|
|
421 |
|
422 |
if ( ! empty( $friend_requests_only ) ) {
|
423 |
$args = array(
|
424 |
+
'is_confirmed' => 0,
|
425 |
+
'friend_user_id' => $user_id,
|
426 |
);
|
427 |
} else {
|
428 |
$args = array(
|
457 |
$friendship_id = null;
|
458 |
|
459 |
// Can't friend yourself.
|
460 |
+
if ( $user_id === $friend_id ) {
|
461 |
return $friendship_id;
|
462 |
}
|
463 |
|
467 |
*/
|
468 |
$args = array(
|
469 |
'initiator_user_id' => $friend_id,
|
470 |
+
'friend_user_id' => $friend_id,
|
471 |
);
|
472 |
+
|
473 |
$result = self::get_friendships( $user_id, $args, 'OR' );
|
474 |
if ( $result ) {
|
475 |
$friendship_id = current( $result )->id;
|
484 |
*
|
485 |
* @param int $user_id The ID of the user who has received the
|
486 |
* friendship requests.
|
487 |
+
* @return array|bool An array of user IDs or false if none are found.
|
488 |
*/
|
489 |
public static function get_friendship_request_user_ids( $user_id ) {
|
490 |
$friend_requests = wp_cache_get( $user_id, 'bp_friends_requests' );
|
514 |
* @return int Friend count for the user.
|
515 |
*/
|
516 |
public static function total_friend_count( $user_id = 0 ) {
|
|
|
517 |
|
518 |
if ( empty( $user_id ) ) {
|
519 |
$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
|
524 |
* This function will recalculate, update and return.
|
525 |
*/
|
526 |
|
527 |
+
$args = array( 'is_confirmed' => 1 );
|
|
|
|
|
528 |
$friendships = self::get_friendships( $user_id, $args );
|
529 |
$count = count( $friendships );
|
530 |
|
541 |
/**
|
542 |
* Search the friends of a user by a search string.
|
543 |
*
|
544 |
+
* @todo Optimize this function.
|
545 |
+
*
|
546 |
* @since 1.0.0
|
547 |
*
|
548 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
549 |
+
* @global wpdb $wpdb WordPress database object.
|
550 |
+
*
|
551 |
* @param string $filter The search string, matched against xprofile
|
552 |
* fields (if available), or usermeta 'nickname' field.
|
553 |
* @param int $user_id ID of the user whose friends are being searched.
|
563 |
public static function search_friends( $filter, $user_id, $limit = null, $page = null ) {
|
564 |
global $wpdb;
|
565 |
|
566 |
+
$bp = buddypress();
|
|
|
|
|
567 |
|
568 |
+
if ( empty( $user_id ) ) {
|
569 |
$user_id = bp_loggedin_user_id();
|
570 |
+
}
|
571 |
|
572 |
// Only search for matching strings at the beginning of the
|
573 |
// name (@todo - figure out why this restriction).
|
574 |
$search_terms_like = bp_esc_like( $filter ) . '%';
|
575 |
|
576 |
$pag_sql = '';
|
577 |
+
if ( ! empty( $limit ) && ! empty( $page ) ) {
|
578 |
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
|
579 |
+
}
|
580 |
|
581 |
+
$friend_ids = self::get_friend_user_ids( $user_id );
|
582 |
+
if ( ! $friend_ids ) {
|
583 |
return false;
|
584 |
+
}
|
585 |
|
586 |
// Get all the user ids for the current user's friends.
|
587 |
$fids = implode( ',', wp_parse_id_list( $friend_ids ) );
|
588 |
|
589 |
+
if ( empty( $fids ) ) {
|
590 |
return false;
|
591 |
+
}
|
|
|
592 |
|
593 |
// Filter the user_ids based on the search criteria.
|
594 |
if ( bp_is_active( 'xprofile' ) ) {
|
602 |
$filtered_friend_ids = $wpdb->get_col( $sql );
|
603 |
$total_friend_ids = $wpdb->get_var( $total_sql );
|
604 |
|
605 |
+
if ( empty( $filtered_friend_ids ) ) {
|
606 |
return false;
|
607 |
+
}
|
608 |
|
609 |
+
return array(
|
610 |
+
'friends' => array_map( 'intval', $filtered_friend_ids ),
|
611 |
+
'total' => (int) $total_friend_ids,
|
612 |
+
);
|
613 |
}
|
614 |
|
615 |
/**
|
630 |
* 'is_friend', 'pending', and 'awaiting_response'.
|
631 |
*/
|
632 |
public static function check_is_friend( $initiator_userid, $possible_friend_userid ) {
|
|
|
633 |
|
634 |
if ( empty( $initiator_userid ) || empty( $possible_friend_userid ) ) {
|
635 |
return false;
|
636 |
}
|
637 |
|
638 |
// Can't friend yourself.
|
639 |
+
if ( $initiator_userid === $possible_friend_userid ) {
|
640 |
return 'not_friends';
|
641 |
}
|
642 |
|
643 |
+
self::update_bp_friends_cache( $initiator_userid, $possible_friend_userid );
|
644 |
|
645 |
return bp_core_get_incremented_cache( $initiator_userid . ':' . $possible_friend_userid, 'bp_friends' );
|
646 |
}
|
647 |
|
|
|
648 |
/**
|
649 |
* Find uncached friendships between a user and one or more other users and cache them.
|
650 |
*
|
651 |
* @since 3.0.0
|
652 |
*
|
653 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
654 |
+
* @global wpdb $wpdb WordPress database object.
|
655 |
+
*
|
656 |
+
* @param int $user_id The ID of the primary user for whom we want
|
657 |
* to check friendships statuses.
|
658 |
* @param int|array|string $possible_friend_ids The IDs of the one or more users
|
659 |
* to check friendship status with primary user.
|
|
|
660 |
*/
|
661 |
public static function update_bp_friends_cache( $user_id, $possible_friend_ids ) {
|
662 |
global $wpdb;
|
663 |
+
|
664 |
+
$bp = buddypress();
|
665 |
$possible_friend_ids = wp_parse_id_list( $possible_friend_ids );
|
666 |
|
667 |
$fetch = array();
|
672 |
$fetch[] = $friend_id;
|
673 |
}
|
674 |
}
|
675 |
+
|
676 |
if ( empty( $fetch ) ) {
|
677 |
return;
|
678 |
}
|
719 |
* @return array $retval Array of last_active values + user_ids.
|
720 |
*/
|
721 |
public static function get_bulk_last_active( $user_ids ) {
|
|
|
|
|
722 |
$last_activities = BP_Core_User::get_last_activity( $user_ids );
|
723 |
|
724 |
// Sort and structure as expected in legacy function.
|
725 |
usort( $last_activities, function( $a, $b ) {
|
726 |
+
if ( $a['date_recorded'] === $b['date_recorded'] ) {
|
727 |
return 0;
|
728 |
}
|
729 |
|
732 |
|
733 |
$retval = array();
|
734 |
foreach ( $last_activities as $last_activity ) {
|
735 |
+
$u = new stdClass();
|
736 |
$u->last_activity = $last_activity['date_recorded'];
|
737 |
$u->user_id = $last_activity['user_id'];
|
738 |
|
747 |
*
|
748 |
* @since 1.0.0
|
749 |
*
|
750 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
751 |
+
* @global wpdb $wpdb WordPress database object.
|
752 |
+
*
|
753 |
* @param int $friendship_id ID of the friendship to be accepted.
|
754 |
* @return int Number of database rows updated.
|
755 |
*/
|
756 |
+
public static function accept( $friendship_id ) {
|
757 |
global $wpdb;
|
758 |
|
759 |
$bp = buddypress();
|
766 |
*
|
767 |
* @since 1.6.0
|
768 |
*
|
769 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
770 |
+
* @global wpdb $wpdb WordPress database object.
|
771 |
+
*
|
772 |
* @param int $friendship_id ID of the friendship to be withdrawn.
|
773 |
* @return int Number of database rows deleted.
|
774 |
*/
|
775 |
+
public static function withdraw( $friendship_id ) {
|
776 |
global $wpdb;
|
777 |
|
778 |
$bp = buddypress();
|
785 |
*
|
786 |
* @since 1.0.0
|
787 |
*
|
788 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
789 |
+
* @global wpdb $wpdb WordPress database object.
|
790 |
+
*
|
791 |
* @param int $friendship_id ID of the friendship to be rejected.
|
792 |
* @return int Number of database rows deleted.
|
793 |
*/
|
794 |
+
public static function reject( $friendship_id ) {
|
795 |
global $wpdb;
|
796 |
|
797 |
$bp = buddypress();
|
806 |
*
|
807 |
* @since 1.0.0
|
808 |
*
|
809 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
810 |
+
* @global wpdb $wpdb WordPress database object.
|
811 |
+
*
|
812 |
* @param string $filter String to search by.
|
813 |
* @param int $user_id A user ID param that is unused.
|
814 |
* @param int|null $limit Optional. Max number of records to return.
|
827 |
$users_table = $wpdb->base_prefix . 'users';
|
828 |
|
829 |
$pag_sql = '';
|
830 |
+
if ( ! empty( $limit ) && ! empty( $page ) ) {
|
831 |
$pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * intval( $limit ) ), intval( $limit ) );
|
832 |
+
}
|
833 |
|
834 |
$bp = buddypress();
|
835 |
|
840 |
$sql = $wpdb->prepare( "SELECT DISTINCT user_id as id FROM {$usermeta_table} WHERE meta_value LIKE %s ORDER BY d.value DESC {$pag_sql}", $search_terms_like );
|
841 |
}
|
842 |
|
843 |
+
$filtered_fids = $wpdb->get_col( $sql );
|
844 |
|
845 |
+
if ( empty( $filtered_fids ) ) {
|
846 |
return false;
|
847 |
+
}
|
848 |
|
849 |
return $filtered_fids;
|
850 |
}
|
856 |
*
|
857 |
* @since 1.0.0
|
858 |
*
|
859 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
860 |
+
* @global wpdb $wpdb WordPress database object.
|
861 |
+
*
|
862 |
* @param string $filter Search term.
|
863 |
* @return int Count of users matching the search term.
|
864 |
*/
|
881 |
$sql = $wpdb->prepare( "SELECT COUNT(DISTINCT user_id) FROM {$usermeta_table} WHERE meta_value LIKE %s", $search_terms_like );
|
882 |
}
|
883 |
|
884 |
+
$user_count = $wpdb->get_col( $sql );
|
885 |
|
886 |
+
if ( empty( $user_count ) ) {
|
887 |
return false;
|
888 |
+
}
|
889 |
|
890 |
return $user_count[0];
|
891 |
}
|
897 |
*
|
898 |
* @since 1.0.0
|
899 |
*
|
900 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
901 |
+
* @global wpdb $wpdb WordPress database object.
|
902 |
+
*
|
903 |
* @param array $user_ids Array of user IDs.
|
904 |
+
* @return array|bool User IDs, sorted by the associated display names.
|
905 |
+
* False if XProfile component is not active.
|
906 |
*/
|
907 |
public static function sort_by_name( $user_ids ) {
|
908 |
global $wpdb;
|
909 |
|
910 |
+
if ( ! bp_is_active( 'xprofile' ) ) {
|
911 |
return false;
|
912 |
+
}
|
913 |
|
914 |
$bp = buddypress();
|
915 |
|
923 |
*
|
924 |
* @since 1.0.0
|
925 |
*
|
926 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
927 |
+
* @global wpdb $wpdb WordPress database object.
|
928 |
+
*
|
929 |
* @param int $user_id ID of the user whose friends are being retrieved.
|
930 |
* @param int $total_friends Optional. Number of random friends to get.
|
931 |
* Default: 5.
|
941 |
$results = $wpdb->get_results( $sql );
|
942 |
|
943 |
for ( $i = 0, $count = count( $results ); $i < $count; ++$i ) {
|
944 |
+
$fids[] = ( $results[ $i ]->friend_user_id === $user_id ) ? $results[ $i ]->initiator_user_id : $results[ $i ]->friend_user_id;
|
945 |
}
|
946 |
|
947 |
// Remove duplicates.
|
948 |
+
if ( count( $fids ) > 0 ) {
|
949 |
return array_flip( array_flip( $fids ) );
|
950 |
+
}
|
951 |
+
|
952 |
+
return false;
|
953 |
}
|
954 |
|
955 |
/**
|
961 |
* - users who have a pending invite to the group
|
962 |
* - users who have been banned from the group
|
963 |
*
|
|
|
964 |
* @todo Need to do a group component check before using group functions.
|
965 |
*
|
966 |
+
* @since 1.0.0
|
967 |
+
*
|
968 |
* @param int $user_id ID of the user whose friends are being counted.
|
969 |
* @param int $group_id ID of the group friends are being invited to.
|
970 |
+
* @return bool|int False if group component is not active, and friend count.
|
971 |
*/
|
972 |
public static function get_invitable_friend_count( $user_id, $group_id ) {
|
973 |
|
974 |
+
if ( ! bp_is_active( 'group' ) ) {
|
975 |
+
return false;
|
976 |
+
}
|
977 |
+
|
978 |
// Setup some data we'll use below.
|
979 |
$is_group_admin = groups_is_user_admin( $user_id, $group_id );
|
980 |
+
$friend_ids = self::get_friend_user_ids( $user_id );
|
981 |
$invitable_count = 0;
|
982 |
|
983 |
for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) {
|
984 |
|
985 |
// If already a member, they cannot be invited again.
|
986 |
+
if ( groups_is_user_member( (int) $friend_ids[ $i ], $group_id ) ) {
|
987 |
continue;
|
988 |
}
|
989 |
|
990 |
// If user already has invite, they cannot be added.
|
991 |
+
if ( groups_check_user_has_invite( (int) $friend_ids[ $i ], $group_id ) ) {
|
992 |
continue;
|
993 |
}
|
994 |
|
995 |
// If user is not group admin and friend is banned, they cannot be invited.
|
996 |
+
if ( ( false === $is_group_admin ) && groups_is_user_banned( (int) $friend_ids[ $i ], $group_id ) ) {
|
997 |
continue;
|
998 |
}
|
999 |
|
1008 |
*
|
1009 |
* @since 2.7.0
|
1010 |
*
|
1011 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
1012 |
+
* @global wpdb $wpdb WordPress database object.
|
1013 |
+
*
|
1014 |
* @param int|string|array $friendship_ids Single friendship ID or comma-separated/array list of friendship IDs.
|
1015 |
* @return array
|
1016 |
*/
|
1029 |
* @since 1.0.0
|
1030 |
*
|
1031 |
* @param int $friendship_id ID of the friendship.
|
1032 |
+
* @return null|stdClass
|
1033 |
*/
|
1034 |
public static function get_user_ids_for_friendship( $friendship_id ) {
|
|
|
1035 |
$friendship = new BP_Friends_Friendship( $friendship_id, false, false );
|
1036 |
|
1037 |
if ( empty( $friendship->id ) ) {
|
1038 |
return null;
|
1039 |
}
|
1040 |
|
1041 |
+
$retval = new StdClass();
|
1042 |
+
$retval->friend_user_id = $friendship->friend_user_id;
|
1043 |
$retval->initiator_user_id = $friendship->initiator_user_id;
|
1044 |
|
1045 |
return $retval;
|
1050 |
*
|
1051 |
* @since 1.0.0
|
1052 |
*
|
1053 |
+
* @global BuddyPress $bp The one true BuddyPress instance.
|
1054 |
+
* @global wpdb $wpdb WordPress database object.
|
1055 |
+
*
|
1056 |
* @param int $user_id ID of the user being expunged.
|
1057 |
*/
|
1058 |
public static function delete_all_for_user( $user_id ) {
|
1092 |
foreach ( (array) $friend_ids as $friend_id ) {
|
1093 |
// Delete cached friendships.
|
1094 |
wp_cache_delete( $friend_id, 'bp_friends_friendships_for_user' );
|
1095 |
+
|
1096 |
+
self::total_friend_count( $friend_id );
|
1097 |
}
|
1098 |
|
1099 |
// Delete cached friendships.
|
@@ -637,11 +637,12 @@ class BP_REST_Friends_Endpoint extends WP_REST_Controller {
|
|
637 |
*/
|
638 |
public function prepare_item_for_response( $friendship, $request ) {
|
639 |
$data = array(
|
640 |
-
'id'
|
641 |
-
'initiator_id'
|
642 |
-
'friend_id'
|
643 |
-
'is_confirmed'
|
644 |
-
'date_created'
|
|
|
645 |
);
|
646 |
|
647 |
$context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
|
@@ -683,11 +684,11 @@ class BP_REST_Friends_Endpoint extends WP_REST_Controller {
|
|
683 |
'collection' => array(
|
684 |
'href' => rest_url( $base ),
|
685 |
),
|
686 |
-
'initiator'
|
687 |
'href' => bp_rest_get_object_url( $friendship->initiator_user_id, 'members' ),
|
688 |
'embeddable' => true,
|
689 |
),
|
690 |
-
'friend'
|
691 |
'href' => bp_rest_get_object_url( $friendship->friend_user_id, 'members' ),
|
692 |
'embeddable' => true,
|
693 |
),
|
@@ -819,32 +820,39 @@ class BP_REST_Friends_Endpoint extends WP_REST_Controller {
|
|
819 |
'title' => 'bp_friends',
|
820 |
'type' => 'object',
|
821 |
'properties' => array(
|
822 |
-
'id'
|
823 |
'context' => array( 'view', 'edit' ),
|
824 |
'description' => __( 'Unique numeric identifier of the friendship.', 'buddypress' ),
|
825 |
'type' => 'integer',
|
826 |
),
|
827 |
-
'initiator_id'
|
828 |
'context' => array( 'view', 'edit' ),
|
829 |
'description' => __( 'The unique numeric identifier of the user who is requesting the Friendship.', 'buddypress' ),
|
830 |
'type' => 'integer',
|
831 |
),
|
832 |
-
'friend_id'
|
833 |
'context' => array( 'view', 'edit' ),
|
834 |
'description' => __( 'The unique numeric identifier of the user who is invited to agree to the Friendship request.', 'buddypress' ),
|
835 |
'type' => 'integer',
|
836 |
),
|
837 |
-
'is_confirmed'
|
838 |
'context' => array( 'view', 'edit' ),
|
839 |
'description' => __( 'Whether the friendship been confirmed/accepted.', 'buddypress' ),
|
840 |
'readonly' => true,
|
841 |
'type' => 'boolean',
|
842 |
),
|
843 |
-
'date_created'
|
844 |
'context' => array( 'view', 'edit' ),
|
845 |
-
'description' => __(
|
846 |
'readonly' => true,
|
847 |
-
'type' => 'string',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
848 |
'format' => 'date-time',
|
849 |
),
|
850 |
),
|
637 |
*/
|
638 |
public function prepare_item_for_response( $friendship, $request ) {
|
639 |
$data = array(
|
640 |
+
'id' => (int) $friendship->id,
|
641 |
+
'initiator_id' => (int) $friendship->initiator_user_id,
|
642 |
+
'friend_id' => (int) $friendship->friend_user_id,
|
643 |
+
'is_confirmed' => (bool) $friendship->is_confirmed,
|
644 |
+
'date_created' => bp_rest_prepare_date_response( $friendship->date_created, get_date_from_gmt( $friendship->date_created ) ),
|
645 |
+
'date_created_gmt' => bp_rest_prepare_date_response( $friendship->date_created ),
|
646 |
);
|
647 |
|
648 |
$context = ! empty( $request->get_param( 'context' ) ) ? $request->get_param( 'context' ) : 'view';
|
684 |
'collection' => array(
|
685 |
'href' => rest_url( $base ),
|
686 |
),
|
687 |
+
'initiator' => array(
|
688 |
'href' => bp_rest_get_object_url( $friendship->initiator_user_id, 'members' ),
|
689 |
'embeddable' => true,
|
690 |
),
|
691 |
+
'friend' => array(
|
692 |
'href' => bp_rest_get_object_url( $friendship->friend_user_id, 'members' ),
|
693 |
'embeddable' => true,
|
694 |
),
|
820 |
'title' => 'bp_friends',
|
821 |
'type' => 'object',
|
822 |
'properties' => array(
|
823 |
+
'id' => array(
|
824 |
'context' => array( 'view', 'edit' ),
|
825 |
'description' => __( 'Unique numeric identifier of the friendship.', 'buddypress' ),
|
826 |
'type' => 'integer',
|
827 |
),
|
828 |
+
'initiator_id' => array(
|
829 |
'context' => array( 'view', 'edit' ),
|
830 |
'description' => __( 'The unique numeric identifier of the user who is requesting the Friendship.', 'buddypress' ),
|
831 |
'type' => 'integer',
|
832 |
),
|
833 |
+
'friend_id' => array(
|
834 |
'context' => array( 'view', 'edit' ),
|
835 |
'description' => __( 'The unique numeric identifier of the user who is invited to agree to the Friendship request.', 'buddypress' ),
|
836 |
'type' => 'integer',
|
837 |
),
|
838 |
+
'is_confirmed' => array(
|
839 |
'context' => array( 'view', 'edit' ),
|
840 |
'description' => __( 'Whether the friendship been confirmed/accepted.', 'buddypress' ),
|
841 |
'readonly' => true,
|
842 |
'type' => 'boolean',
|
843 |
),
|
844 |
+
'date_created' => array(
|
845 |
'context' => array( 'view', 'edit' ),
|
846 |
+
'description' => __( 'The date the friendship was created, in the site\'s timezone.', 'buddypress' ),
|
847 |
'readonly' => true,
|
848 |
+
'type' => array( 'string', 'null' ),
|
849 |
+
'format' => 'date-time',
|
850 |
+
),
|
851 |
+
'date_created_gmt' => array(
|
852 |
+
'context' => array( 'view', 'edit' ),
|
853 |
+
'description' => __( 'The date the friendship was created, as GMT.', 'buddypress' ),
|
854 |
+
'readonly' => true,
|
855 |
+
'type' => array( 'string', 'null' ),
|
856 |
'format' => 'date-time',
|
857 |
),
|
858 |
),
|
@@ -1,10 +1,10 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"CSIX":[function(require,module,exports) {
|
2 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;
|
3 |
},{}],"qXsY":[function(require,module,exports) {
|
4 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants")
|
5 |
},{"./constants":"CSIX"}],"fch3":[function(require,module,exports) {
|
6 |
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;
|
7 |
},{}],"Z2R5":[function(require,module,exports) {
|
8 |
-
"use strict";var e=r(require("./friends/edit")),t=r(require("./friends/transforms"));function r(e){return e&&e.__esModule?e:{default:e}}
|
9 |
},{"./friends/edit":"qXsY","./friends/transforms":"fch3"}]},{},["Z2R5"], null)
|
10 |
//# sourceMappingURL=/bp-friends/js/blocks/friends.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"CSIX":[function(require,module,exports) {
|
2 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TYPES=void 0;const{i18n:{__:e}}=wp,s=[{label:e("Newest","buddypress"),value:"newest"},{label:e("Active","buddypress"),value:"active"},{label:e("Popular","buddypress"),value:"popular"}];exports.TYPES=s;
|
3 |
},{}],"qXsY":[function(require,module,exports) {
|
4 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=require("./constants");const{blockEditor:{InspectorControls:t},components:{Disabled:n,PanelBody:r,RangeControl:l,SelectControl:o,ToggleControl:s},element:{Fragment:i,createElement:a},i18n:{__:d},serverSideRender:u}=wp,{blockData:{currentPostId:b}}=bp,p=({attributes:p,setAttributes:c})=>{const{postId:f,maxFriends:m,friendDefault:g,linkTitle:k}=p,v=b();return!f&&v&&c({postId:v}),a(i,null,a(t,null,a(r,{title:d("Settings","buddypress"),initialOpen:!0},a(l,{label:d("Max friends to show","buddypress"),value:m,onChange:e=>c({maxFriends:e}),min:1,max:10,required:!0}),a(o,{label:d("Default members to show","buddypress"),value:g,options:e.TYPES,onChange:e=>{c({friendDefault:e})}}),a(s,{label:d("Link block title to Member's profile friends page","buddypress"),checked:!!k,onChange:()=>{c({linkTitle:!k})}}))),a(n,null,a(u,{block:"bp/friends",attributes:p})))};var c=p;exports.default=c;
|
5 |
},{"./constants":"CSIX"}],"fch3":[function(require,module,exports) {
|
6 |
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const{blocks:{createBlock:e}}=wp,r={from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:r})=>!(null==r||!r.raw)&&"bp_core_friends_widget"===e,transform:({instance:r})=>e("bp/friends",{maxFriends:r.raw.max_friends,friendDefault:r.raw.friend_default,linkTitle:r.raw.link_title})}]};var t=r;exports.default=t;
|
7 |
},{}],"Z2R5":[function(require,module,exports) {
|
8 |
+
"use strict";var e=r(require("./friends/edit")),t=r(require("./friends/transforms"));function r(e){return e&&e.__esModule?e:{default:e}}const{blocks:{registerBlockType:d},i18n:{__:s}}=wp;d("bp/friends",{title:s("Friends List","buddypress"),description:s("A dynamic list of recently active, popular, and newest friends of the post author (when used into a page or post) or of the displayed member (when used in a widgetized area). If author/member data is not available the block is not displayed.","buddypress"),icon:{background:"#fff",foreground:"#d84800",src:"buddicons-friends"},category:"buddypress",attributes:{maxFriends:{type:"number",default:5},friendDefault:{type:"string",default:"active"},linkTitle:{type:"boolean",default:!1},postId:{type:"number",default:0}},edit:e.default,transforms:t.default});
|
9 |
},{"./friends/edit":"qXsY","./friends/transforms":"fch3"}]},{},["Z2R5"], null)
|
10 |
//# sourceMappingURL=/bp-friends/js/blocks/friends.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["bp-friends/js/blocks/friends/constants.js","bp-friends/js/blocks/friends/edit.js","bp-friends/js/blocks/friends/transforms.js","bp-friends/js/blocks/friends.js"],"names":["
|
1 |
+
{"version":3,"sources":["bp-friends/js/blocks/friends/constants.js","bp-friends/js/blocks/friends/edit.js","bp-friends/js/blocks/friends/transforms.js","bp-friends/js/blocks/friends.js"],"names":["i18n","__","wp","TYPES","label","value","editDynamicFriendsBlock","blockEditor","InspectorControls","components","Disabled","PanelBody","RangeControl","SelectControl","ToggleControl","element","Fragment","createElement","serverSideRender","ServerSideRender","blockData","currentPostId","bp","attributes","setAttributes","postId","maxFriends","friendDefault","linkTitle","post","option","transforms","blocks","createBlock","from","type","isMatch","idBase","instance","raw","transform","max_friends","friend_default","link_title","registerBlockType","title","description","icon","background","foreground","src","category","default","edit"],"mappings":";AAcO,aAAA,OAAA,eAAA,QAAA,aAAA,CAAA,OAAA,IAAA,QAAA,WAAA,EAXP,MACCA,MAAM,GACLC,IAEEC,GAOSC,EAAQ,CACpB,CACCC,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,SAAU,cACrBI,MAAO,UAER,CACCD,MAAOH,EAAI,UAAW,cACtBI,MAAO,YAXF,QAAA,MAAA;;ACsEQC,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAhDf,IAAA,EAAA,QAAA,eAjCA,MACCC,aAAa,kBACZC,GAEDC,YAAY,SACXC,EADW,UAEXC,EAFW,aAGXC,EAHW,cAIXC,EAJW,cAKXC,GAEDC,SAAS,SACRC,EADQ,cAERC,GAEDjB,MAAM,GACLC,GAEDiB,iBAAkBC,GACfjB,IAMHkB,WAAW,cACVC,IAEEC,GAOEhB,EAA0B,EAAIiB,WAAAA,EAAYC,cAAAA,MACzC,MAAA,OAAEC,EAAF,WAAUC,EAAV,cAAsBC,EAAtB,UAAqCC,GAAcL,EACnDM,EAAOR,IAOZ,OALMI,GAAUI,GAChBL,EAAe,CAAEC,OAAQI,IAIzB,EAAC,EACA,KAAA,EAAC,EACA,KAAA,EAAC,EAAD,CAAW,MAAQ5B,EAAI,WAAY,cAAiB,aAAc,GACjE,EAAC,EAAD,CACC,MAAQA,EAAI,sBAAuB,cACnC,MAAQyB,EACR,SAAarB,GACZmB,EAAe,CAAEE,WAAYrB,IAE9B,IAAM,EACN,IAAM,GACN,UAAQ,IAET,EAAC,EAAD,CACC,MAAQJ,EAAI,0BAA2B,cACvC,MAAQ0B,EACR,QAAUxB,EAHX,MAIC,SAAa2B,IACZN,EAAe,CAAEG,cAAeG,OAGlC,EAAC,EAAD,CACC,MAAQ7B,EAAI,oDAAsD,cAClE,UAAa2B,EACb,SAAW,KACVJ,EAAe,CAAEI,WAAaA,SAKlC,EAAC,EACA,KAAA,EAAC,EAAD,CAAkB,MAAM,aAAa,WAAaL,OAMvCjB,IAAAA,EAAAA,EAAAA,QAAAA,QAAAA;;AC/CAyB,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EAlCf,MACCC,QAAQ,YACPC,IAEE/B,GAOE6B,EAAa,CAClBG,KAAM,CACL,CACCC,KAAM,QACNH,OAAQ,CAAE,sBACVI,QAAS,EAAIC,OAAAA,EAAQC,SAAAA,OACbA,MAAAA,IAAAA,EAAUC,MAIC,2BAAXF,EAERG,UAAW,EAAIF,SAAAA,KACPL,EAAa,aAAc,CACjCP,WAAYY,EAASC,IAAIE,YACzBd,cAAeW,EAASC,IAAIG,eAC5Bd,UAAWU,EAASC,IAAII,gBAOdZ,IAAAA,EAAAA,EAAAA,QAAAA,QAAAA;;ACnBf,aAHA,IAAA,EAAA,EAAA,QAAA,mBACA,EAAA,EAAA,QAAA,yBAEA,SAAA,EAAA,GAAA,OAAA,GAAA,EAAA,WAAA,EAAA,CAAA,QAAA,GAfA,MACCC,QAAQ,kBACPY,GAED5C,MAAM,GACLC,IAEEC,GAQJ0C,EAAmB,aAAc,CAChCC,MAAO5C,EAAI,eAAgB,cAC3B6C,YAAa7C,EAAI,oPAAqP,cACtQ8C,KAAM,CACLC,WAAY,OACZC,WAAY,UACZC,IAAK,qBAENC,SAAU,aACV5B,WAAY,CACXG,WAAY,CACXS,KAAM,SACNiB,QAAS,GAEVzB,cAAe,CACdQ,KAAM,SACNiB,QAAS,UAEVxB,UAAW,CACVO,KAAM,UACNiB,SAAS,GAEV3B,OAAQ,CACPU,KAAM,SACNiB,QAAS,IAGXC,KAAM/C,EA3B0B,QA4BhCyB,WAAYA,EAAAA","file":"friends.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Friends ordering types.\n *\n * @type {Array}\n */\nexport const TYPES = [\n\t{\n\t\tlabel: __( 'Newest', 'buddypress' ),\n\t\tvalue: 'newest',\n\t},\n\t{\n\t\tlabel: __( 'Active', 'buddypress' ),\n\t\tvalue: 'active',\n\t},\n\t{\n\t\tlabel: __( 'Popular', 'buddypress' ),\n\t\tvalue: 'popular',\n\t},\n];\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblockEditor: {\n\t\tInspectorControls,\n\t},\n\tcomponents: {\n\t\tDisabled,\n\t\tPanelBody,\n\t\tRangeControl,\n\t\tSelectControl,\n\t\tToggleControl,\n\t},\n\telement: {\n\t\tFragment,\n\t\tcreateElement,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n\tserverSideRender: ServerSideRender,\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tblockData: {\n\t\tcurrentPostId,\n\t}\n} = bp;\n\n/**\n * Internal dependencies.\n */\nimport { TYPES } from './constants';\n\nconst editDynamicFriendsBlock = ( { attributes, setAttributes } ) => {\n\tconst { postId, maxFriends, friendDefault, linkTitle } = attributes;\n\tconst post = currentPostId();\n\n\tif ( ! postId && post ) {\n\t\tsetAttributes( { postId: post } );\n\t}\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings', 'buddypress' ) } initialOpen={ true }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max friends to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ maxFriends }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { maxFriends: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 10 }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Default members to show', 'buddypress' ) }\n\t\t\t\t\t\tvalue={ friendDefault }\n\t\t\t\t\t\toptions={ TYPES }\n\t\t\t\t\t\tonChange={ ( option ) => {\n\t\t\t\t\t\t\tsetAttributes( { friendDefault: option } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link block title to Member\\'s profile friends page', 'buddypress' ) }\n\t\t\t\t\t\tchecked={ !! linkTitle }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetAttributes( { linkTitle: ! linkTitle } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<Disabled>\n\t\t\t\t<ServerSideRender block=\"bp/friends\" attributes={ attributes } />\n\t\t\t</Disabled>\n\t\t</Fragment>\n\t);\n};\n\nexport default editDynamicFriendsBlock;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tcreateBlock,\n\t},\n} = wp;\n\n/**\n * Transforms Legacy Widget to Friends Block.\n *\n * @type {Object}\n */\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/legacy-widget' ],\n\t\t\tisMatch: ( { idBase, instance } ) => {\n\t\t\t\tif ( ! instance?.raw ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn idBase === 'bp_core_friends_widget';\n\t\t\t},\n\t\t\ttransform: ( { instance } ) => {\n\t\t\t\treturn createBlock( 'bp/friends', {\n\t\t\t\t\tmaxFriends: instance.raw.max_friends,\n\t\t\t\t\tfriendDefault: instance.raw.friend_default,\n\t\t\t\t\tlinkTitle: instance.raw.link_title,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n","/**\n * WordPress dependencies.\n */\nconst {\n\tblocks: {\n\t\tregisterBlockType,\n\t},\n\ti18n: {\n\t\t__,\n\t},\n} = wp;\n\n/**\n * Internal dependencies.\n */\nimport editDynamicFriendsBlock from './friends/edit';\nimport transforms from './friends/transforms';\n\nregisterBlockType( 'bp/friends', {\n\ttitle: __( 'Friends List', 'buddypress' ),\n\tdescription: __( 'A dynamic list of recently active, popular, and newest friends of the post author (when used into a page or post) or of the displayed member (when used in a widgetized area). If author/member data is not available the block is not displayed.', 'buddypress' ),\n\ticon: {\n\t\tbackground: '#fff',\n\t\tforeground: '#d84800',\n\t\tsrc: 'buddicons-friends',\n\t},\n\tcategory: 'buddypress',\n\tattributes: {\n\t\tmaxFriends: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 5\n\t\t},\n\t\tfriendDefault: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'active',\n\t\t},\n\t\tlinkTitle: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tpostId: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\tedit: editDynamicFriendsBlock,\n\ttransforms: transforms,\n} );\n"]}
|
@@ -1,4 +1,4 @@
|
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"pMhP":[function(require,module,exports) {
|
2 |
-
|
3 |
},{}]},{},["pMhP"], null)
|
4 |
//# sourceMappingURL=/bp-friends/js/friends.js.map
|
1 |
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"pMhP":[function(require,module,exports) {
|
2 |
+
const{i18n:{__:e,sprintf:t}}=wp,{dynamicWidgetBlock:s}=bp;class r extends s{loop(s=[],r="",d="active"){const i=super.useTemplate("bp-friends-item"),n=document.querySelector("#"+r);let o="";s&&s.length?s.forEach(s=>{if("active"===d&&s.last_activity)s.extra=t(e("Active %s","buddypress"),s.last_activity.timediff);else if("popular"===d&&s.total_friend_count){const r=parseInt(s.total_friend_count,10);s.extra=0===r?e("No friends","buddypress"):1===r?e("1 friend","buddypress"):t(e("%s friends","buddypress"),s.total_friend_count)}else"newest"===d&&s.registered_since&&(s.extra=t(e("Registered %s","buddypress"),s.registered_since));s.avatar_alt=t(e("Profile picture of %s","buddypress"),s.name),o+=i(s)}):o='<div class="widget-error">'+e("Sorry, no members were found.","buddypress")+"</div>",n.innerHTML=o}start(){this.blocks.forEach((e,t)=>{const{selector:s}=e,{type:r}=e.query_args,d=document.querySelector("#"+s).closest(".bp-dynamic-block-container");super.getItems(r,t),d.querySelectorAll(".item-options a").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),e.target.closest(".item-options").querySelector(".selected").classList.remove("selected"),e.target.classList.add("selected");const s=e.target.getAttribute("data-bp-sort");s!==this.blocks[t].query_args.type&&super.getItems(s,t)})})})}}const d=window.bpFriendsSettings||{},i=window.bpFriendsBlocks||{},n=new r(d,i);"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n.start()):n.start();
|
3 |
},{}]},{},["pMhP"], null)
|
4 |
//# sourceMappingURL=/bp-friends/js/friends.js.map
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["bp-friends/js/friends.js"],"names":["
|
1 |
+
{"version":3,"sources":["bp-friends/js/friends.js"],"names":["i18n","__","sprintf","wp","dynamicWidgetBlock","bp","bpFriendsWidgetBlock","loop","friends","container","type","tmpl","useTemplate","selector","document","querySelector","output","length","forEach","friend","last_activity","extra","timediff","total_friend_count","friendsCount","parseInt","registered_since","avatar_alt","name","innerHTML","start","blocks","block","i","query_args","list","closest","getItems","querySelectorAll","navItem","addEventListener","event","preventDefault","target","classList","remove","add","newType","getAttribute","settings","window","bpFriendsSettings","bpFriendsBlocks","bpFriends","readyState"],"mappings":";AAGA,MACCA,MAAM,GACLC,EADK,QAELC,IAEEC,IAKE,mBACLC,GACGC,GAKJ,MAAMC,UAA6BF,EAClCG,KAAMC,EAAU,GAAIC,EAAY,GAAIC,EAAO,UACpCC,MAAAA,EAAO,MAAMC,YAAa,mBAC1BC,EAAWC,SAASC,cAAe,IAAMN,GAC3CO,IAAAA,EAAS,GAERR,GAAWA,EAAQS,OACvBT,EAAQU,QAAWC,IACb,GAAA,WAAaT,GAAQS,EAAOC,cAEhCD,EAAOE,MAAQnB,EAASD,EAAI,YAAa,cAAgBkB,EAAOC,cAAcE,eACxE,GAAK,YAAcZ,GAAQS,EAAOI,mBAAqB,CACvDC,MAAAA,EAAeC,SAAUN,EAAOI,mBAAoB,IAGzDJ,EAAOE,MADH,IAAMG,EACKvB,EAAI,aAAc,cACtB,IAAMuB,EACFvB,EAAI,WAAY,cAGhBC,EAASD,EAAI,aAAc,cAAgBkB,EAAOI,wBAEvD,WAAab,GAAQS,EAAOO,mBAEvCP,EAAOE,MAAQnB,EAASD,EAAI,gBAAiB,cAAgBkB,EAAOO,mBAIrEP,EAAOQ,WAAazB,EAASD,EAAI,wBAAyB,cAAgBkB,EAAOS,MAEjFZ,GAAUL,EAAMQ,KAGjBH,EAAS,6BAA+Bf,EAAI,gCAAiC,cAAiB,SAG/FY,EAASgB,UAAYb,EAGtBc,QACMC,KAAAA,OAAOb,QAAS,CAAEc,EAAOC,KACvB,MAAA,SAAEpB,GAAamB,GACf,KAAEtB,GAASsB,EAAME,WACjBC,EAAOrB,SAASC,cAAe,IAAMF,GAAWuB,QAAS,+BAGzDC,MAAAA,SAAU3B,EAAMuB,GAGtBE,EAAKG,iBAAkB,mBAAoBpB,QAAWqB,IACrDA,EAAQC,iBAAkB,QAAWC,IACpCA,EAAMC,iBAGND,EAAME,OAAOP,QAAS,iBAAkBrB,cAAe,aAAc6B,UAAUC,OAAQ,YACvFJ,EAAME,OAAOC,UAAUE,IAAK,YAEtBC,MAAAA,EAAUN,EAAME,OAAOK,aAAc,gBAEtCD,IAAY,KAAKhB,OAAQE,GAAIC,WAAWxB,MACtC2B,MAAAA,SAAUU,EAASd,UAQ/B,MAAMgB,EAAWC,OAAOC,mBAAqB,GACvCpB,EAASmB,OAAOE,iBAAmB,GACnCC,EAAY,IAAI/C,EAAsB2C,EAAUlB,GAEjD,YAAcjB,SAASwC,WAC3BxC,SAAS0B,iBAAkB,mBAAoBa,EAAUvB,SAEzDuB,EAAUvB","file":"friends.js","sourceRoot":"../src/js","sourcesContent":["/**\n * WordPress dependencies.\n */\nconst {\n\ti18n: {\n\t\t__,\n\t\tsprintf,\n\t},\n} = wp;\n\n/**\n * BuddyPress dependencies.\n */\nconst {\n\tdynamicWidgetBlock,\n} = bp;\n\n/**\n * Front-end Friends block class.\n */\nclass bpFriendsWidgetBlock extends dynamicWidgetBlock {\n\tloop( friends = [], container = '', type = 'active' ) {\n\t\tconst tmpl = super.useTemplate( 'bp-friends-item' );\n\t\tconst selector = document.querySelector( '#' + container );\n\t\tlet output = '';\n\n\t\tif ( friends && friends.length ) {\n\t\t\tfriends.forEach( ( friend ) => {\n\t\t\t\tif ( 'active' === type && friend.last_activity ) {\n\t\t\t\t\t/* translators: %s: last activity timestamp (e.g. \"Active 1 hour ago\") */\n\t\t\t\t\tfriend.extra = sprintf( __( 'Active %s', 'buddypress' ), friend.last_activity.timediff );\n\t\t\t\t} else if ( 'popular' === type && friend.total_friend_count ) {\n\t\t\t\t\tconst friendsCount = parseInt( friend.total_friend_count, 10 );\n\n\t\t\t\t\tif ( 0 === friendsCount ) {\n\t\t\t\t\t\tfriend.extra = __( 'No friends', 'buddypress' );\n\t\t\t\t\t} else if ( 1 === friendsCount ) {\n\t\t\t\t\t\tfriend.extra = __( '1 friend', 'buddypress' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/* translators: %s: total friend count (more than 1). */\n\t\t\t\t\t\tfriend.extra = sprintf( __( '%s friends', 'buddypress' ), friend.total_friend_count );\n\t\t\t\t\t}\n\t\t\t\t} else if ( 'newest' === type && friend.registered_since ) {\n\t\t\t\t\t/* translators: %s is time elapsed since the registration date happened */\n\t\t\t\t\tfriend.extra = sprintf( __( 'Registered %s', 'buddypress' ), friend.registered_since );\n\t\t\t\t}\n\n\t\t\t\t/* translators: %s: member name */\n\t\t\t\tfriend.avatar_alt = sprintf( __( 'Profile picture of %s', 'buddypress' ), friend.name );\n\n\t\t\t\toutput += tmpl( friend );\n\t\t\t} );\n\t\t} else {\n\t\t\toutput = '<div class=\"widget-error\">' + __( 'Sorry, no members were found.', 'buddypress' ) + '</div>';\n\t\t}\n\n\t\tselector.innerHTML = output;\n\t}\n\n\tstart() {\n\t\tthis.blocks.forEach( ( block, i ) => {\n\t\t\tconst { selector } = block;\n\t\t\tconst { type } = block.query_args;\n\t\t\tconst list = document.querySelector( '#' + selector ).closest( '.bp-dynamic-block-container' );\n\n\t\t\t// Get default Block's type friends.\n\t\t\tsuper.getItems( type, i );\n\n\t\t\t// Listen to Block's Nav item clics\n\t\t\tlist.querySelectorAll( '.item-options a' ).forEach( ( navItem ) => {\n\t\t\t\tnavItem.addEventListener( 'click', ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// Changes the displayed filter.\n\t\t\t\t\tevent.target.closest( '.item-options' ).querySelector( '.selected' ).classList.remove( 'selected' );\n\t\t\t\t\tevent.target.classList.add( 'selected' );\n\n\t\t\t\t\tconst newType = event.target.getAttribute( 'data-bp-sort' );\n\n\t\t\t\t\tif ( newType !== this.blocks[ i ].query_args.type ) {\n\t\t\t\t\t\tsuper.getItems( newType, i );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t}\n}\n\nconst settings = window.bpFriendsSettings || {};\nconst blocks = window.bpFriendsBlocks || {};\nconst bpFriends = new bpFriendsWidgetBlock( settings, blocks );\n\nif ( 'loading' === document.readyState ) {\n\tdocument.addEventListener( 'DOMContentLoaded', bpFriends.start() );\n} else {\n\tbpFriends.start();\n}\n"]}
|
@@ -29,4 +29,4 @@ function friends_screen_my_friends() {
|
|
29 |
* @param string $template Path to the my friends template to load.
|
30 |
*/
|
31 |
bp_core_load_template( apply_filters( 'friends_template_my_friends', 'members/single/home' ) );
|
32 |
-
}
|
29 |
* @param string $template Path to the my friends template to load.
|
30 |
*/
|
31 |
bp_core_load_template( apply_filters( 'friends_template_my_friends', 'members/single/home' ) );
|
32 |
+
}
|
@@ -62,4 +62,4 @@ function friends_screen_requests() {
|
|
62 |
* @param string $template Path to the friends request template to load.
|
63 |
*/
|
64 |
bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
|
65 |
-
}
|
62 |
* @param string $template Path to the friends request template to load.
|
63 |
*/
|
64 |
bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );
|
65 |
+
}
|
@@ -270,19 +270,23 @@ function groups_action_create_group() {
|
|
270 |
'crop_h' => $_POST['h']
|
271 |
);
|
272 |
|
273 |
-
|
|
|
|
|
274 |
bp_core_add_message( __( 'There was an error saving the group profile photo, please try uploading again.', 'buddypress' ), 'error' );
|
275 |
} else {
|
276 |
/**
|
277 |
* Fires after a group avatar is uploaded.
|
278 |
*
|
279 |
* @since 2.8.0
|
|
|
280 |
*
|
281 |
-
* @param int $group_id
|
282 |
-
* @param string $type
|
283 |
-
* @param array $args
|
|
|
284 |
*/
|
285 |
-
do_action( 'groups_avatar_uploaded', bp_get_current_group_id(), 'crop', $args );
|
286 |
|
287 |
bp_core_add_message( __( 'The group profile photo was uploaded successfully.', 'buddypress' ) );
|
288 |
}
|
270 |
'crop_h' => $_POST['h']
|
271 |
);
|
272 |
|
273 |
+
$cropped_avatar = bp_core_avatar_handle_crop( $args, 'array' );
|
274 |
+
|
275 |
+
if ( ! $cropped_avatar ) {
|
276 |
bp_core_add_message( __( 'There was an error saving the group profile photo, please try uploading again.', 'buddypress' ), 'error' );
|
277 |
} else {
|
278 |
/**
|
279 |
* Fires after a group avatar is uploaded.
|
280 |
*
|
281 |
* @since 2.8.0
|
282 |
+
* @since 10.0.0 Adds a new param: an array containing the full, thumb avatar and the timestamp.
|
283 |
*
|
284 |
+
* @param int $group_id ID of the group.
|
285 |
+
* @param string $type Avatar type. 'crop' or 'camera'.
|
286 |
+
* @param array $args Array of parameters passed to the crop handler.
|
287 |
+
* @param array $cropped_avatar Array containing the full, thumb avatar and the timestamp.
|
288 |
*/
|
289 |
+
do_action( 'groups_avatar_uploaded', bp_get_current_group_id(), 'crop', $args, $cropped_avatar );
|
290 |
|
291 |
bp_core_add_message( __( 'The group profile photo was uploaded successfully.', 'buddypress' ) );
|
292 |
}
|
@@ -50,6 +50,21 @@ body.toplevel_page_bp-groups table.groups th#last_active {
|
|
50 |
vertical-align: middle;
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
#bp-groups-permalink-box {
|
54 |
line-height: 24px;
|
55 |
color: #666;
|
50 |
vertical-align: middle;
|
51 |
}
|
52 |
|
53 |
+
.groupbox {
|
54 |
+
position: relative;
|
55 |
+
min-width: 255px;
|
56 |
+
border: 1px solid #c3c4c7;
|
57 |
+
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
58 |
+
background: #fff;
|
59 |
+
margin-bottom: 20px;
|
60 |
+
padding: 0;
|
61 |
+
line-height: 1;
|
62 |
+
}
|
63 |
+
|
64 |
+
.groupbox .inside {
|
65 |
+
padding: 0 12px 12px;
|
66 |
+
}
|
67 |
+
|
68 |
#bp-groups-permalink-box {
|
69 |
line-height: 24px;
|
70 |
color: #666;
|
@@ -1 +1 @@
|
|
1 |
-
body.toplevel_page_bp-groups table.groups th#members,body.toplevel_page_bp-groups table.groups th#status{width:10%}body.toplevel_page_bp-groups table.groups th#last_active{width:15%}#bp-groups-form .avatar{float:right;margin-left:10px;margin-top:1px}#bp-groups-edit-form input{outline:medium none}#bp-groups-edit-form input#bp-groups-name{font-size:1.7em;width:100%;margin-bottom:6px}#bp-groups-edit-form input#bp-groups-new-members{border:1px solid #e5e5e5;margin-top:6px;width:100%}#bp-groups-new-members-list{margin:0}.bp-groups-settings-section{margin-top:10px;line-height:2}.bp-groups-settings-section legend{margin-top:10px;font-weight:700}.bp-groups-settings-section label{clear:right;display:block;float:right;vertical-align:middle}#bp-groups-permalink-box{line-height:24px;color:#666}#bp-groups-permalink{margin-left:24px}.bp-groups-member-type{position:relative}.bp-groups-member-type>h4{margin-bottom:.5em}ul.bp-group-delete-list{list-style-type:disc;margin:4px 26px}.bp-group-admin-pagination{position:absolute;text-align:left;width:100%}.bp-group-admin-pagination.table-top{top:0}.bp-group-admin-pagination.table-bottom{bottom:0}.bp-group-admin-pagination-viewing{color:#777;font-size:12px;font-style:italic}.bp-group-admin-pagination-links{white-space:nowrap;padding-right:15px}.bp-group-admin-pagination-links .page-numbers{display:inline-block;min-width:12px;border:1px solid #ccc;padding:2px 4px 4px;background:#e5e5e5;line-height:1;font-weight:400;text-align:center;text-decoration:none}.bp-group-admin-pagination-links a.page-numbers:hover{text-decoration:underline}.bp-group-admin-pagination-links .page-numbers.current,.bp-group-admin-pagination-links .page-numbers.dots{border-color:#ddd;background:#f7f7f7;color:#a0a5aa}table.bp-group-members .uid-column{padding-right:20px;padding-left:20px}table.bp-group-members .uname-column{width:70%}table.bp-group-members .urole-column{padding-right:20px;padding-left:20px}#group-manage-members-ui .subnav-filters .filter.last{float:left}#group-manage-members-ui .subnav-filters .left-menu{float:right}#group-manage-members-ui .subnav-filters .group-members-paginate-button:last-child{margin-left:2em}#group-manage-members-ui .subnav-filters .dashicons{padding-top:2px}#group-manage-members-ui .uname-column .profile-photo{margin-left:1em}#bp-no-group-members .bp-feedback.info{background:#fff;border-right:4px solid #00a0d2;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 5px 2px;padding:1px 12px}#bp-no-group-members .bp-feedback.info p{margin:.5em 0;padding:2px}@media screen and (max-width:782px){.bp-groups-settings-section label{margin:.25em 0}}
|
1 |
+
body.toplevel_page_bp-groups table.groups th#members,body.toplevel_page_bp-groups table.groups th#status{width:10%}body.toplevel_page_bp-groups table.groups th#last_active{width:15%}#bp-groups-form .avatar{float:right;margin-left:10px;margin-top:1px}#bp-groups-edit-form input{outline:medium none}#bp-groups-edit-form input#bp-groups-name{font-size:1.7em;width:100%;margin-bottom:6px}#bp-groups-edit-form input#bp-groups-new-members{border:1px solid #e5e5e5;margin-top:6px;width:100%}#bp-groups-new-members-list{margin:0}.bp-groups-settings-section{margin-top:10px;line-height:2}.bp-groups-settings-section legend{margin-top:10px;font-weight:700}.bp-groups-settings-section label{clear:right;display:block;float:right;vertical-align:middle}.groupbox{position:relative;min-width:255px;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgb(0 0 0 / 4%);background:#fff;margin-bottom:20px;padding:0;line-height:1}.groupbox .inside{padding:0 12px 12px}#bp-groups-permalink-box{line-height:24px;color:#666}#bp-groups-permalink{margin-left:24px}.bp-groups-member-type{position:relative}.bp-groups-member-type>h4{margin-bottom:.5em}ul.bp-group-delete-list{list-style-type:disc;margin:4px 26px}.bp-group-admin-pagination{position:absolute;text-align:left;width:100%}.bp-group-admin-pagination.table-top{top:0}.bp-group-admin-pagination.table-bottom{bottom:0}.bp-group-admin-pagination-viewing{color:#777;font-size:12px;font-style:italic}.bp-group-admin-pagination-links{white-space:nowrap;padding-right:15px}.bp-group-admin-pagination-links .page-numbers{display:inline-block;min-width:12px;border:1px solid #ccc;padding:2px 4px 4px;background:#e5e5e5;line-height:1;font-weight:400;text-align:center;text-decoration:none}.bp-group-admin-pagination-links a.page-numbers:hover{text-decoration:underline}.bp-group-admin-pagination-links .page-numbers.current,.bp-group-admin-pagination-links .page-numbers.dots{border-color:#ddd;background:#f7f7f7;color:#a0a5aa}table.bp-group-members .uid-column{padding-right:20px;padding-left:20px}table.bp-group-members .uname-column{width:70%}table.bp-group-members .urole-column{padding-right:20px;padding-left:20px}#group-manage-members-ui .subnav-filters .filter.last{float:left}#group-manage-members-ui .subnav-filters .left-menu{float:right}#group-manage-members-ui .subnav-filters .group-members-paginate-button:last-child{margin-left:2em}#group-manage-members-ui .subnav-filters .dashicons{padding-top:2px}#group-manage-members-ui .uname-column .profile-photo{margin-left:1em}#bp-no-group-members .bp-feedback.info{background:#fff;border-right:4px solid #00a0d2;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 5px 2px;padding:1px 12px}#bp-no-group-members .bp-feedback.info p{margin:.5em 0;padding:2px}@media screen and (max-width:782px){.bp-groups-settings-section label{margin:.25em 0}}
|
@@ -50,6 +50,21 @@ body.toplevel_page_bp-groups table.groups th#last_active {
|
|
50 |
vertical-align: middle;
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
#bp-groups-permalink-box {
|
54 |
line-height: 24px;
|
55 |
color: #666;
|
50 |
vertical-align: middle;
|
51 |
}
|
52 |
|
53 |
+
.groupbox {
|
54 |
+
position: relative;
|
55 |
+
min-width: 255px;
|
56 |
+
border: 1px solid #c3c4c7;
|
57 |
+
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
|
58 |
+
background: #fff;
|
59 |
+
margin-bottom: 20px;
|
60 |
+
padding: 0;
|
61 |
+
line-height: 1;
|
62 |
+
}
|
63 |
+
|
64 |
+
.groupbox .inside {
|
65 |
+
padding: 0 12px 12px;
|
66 |
+
}
|
67 |
+
|
68 |
#bp-groups-permalink-box {
|
69 |
line-height: 24px;
|
70 |
color: #666;
|
@@ -1 +1 @@
|
|
1 |
-
body.toplevel_page_bp-groups table.groups th#members,body.toplevel_page_bp-groups table.groups th#status{width:10%}body.toplevel_page_bp-groups table.groups th#last_active{width:15%}#bp-groups-form .avatar{float:left;margin-right:10px;margin-top:1px}#bp-groups-edit-form input{outline:medium none}#bp-groups-edit-form input#bp-groups-name{font-size:1.7em;width:100%;margin-bottom:6px}#bp-groups-edit-form input#bp-groups-new-members{border:1px solid #e5e5e5;margin-top:6px;width:100%}#bp-groups-new-members-list{margin:0}.bp-groups-settings-section{margin-top:10px;line-height:2}.bp-groups-settings-section legend{margin-top:10px;font-weight:700}.bp-groups-settings-section label{clear:left;display:block;float:left;vertical-align:middle}#bp-groups-permalink-box{line-height:24px;color:#666}#bp-groups-permalink{margin-right:24px}.bp-groups-member-type{position:relative}.bp-groups-member-type>h4{margin-bottom:.5em}ul.bp-group-delete-list{list-style-type:disc;margin:4px 26px}.bp-group-admin-pagination{position:absolute;text-align:right;width:100%}.bp-group-admin-pagination.table-top{top:0}.bp-group-admin-pagination.table-bottom{bottom:0}.bp-group-admin-pagination-viewing{color:#777;font-size:12px;font-style:italic}.bp-group-admin-pagination-links{white-space:nowrap;padding-left:15px}.bp-group-admin-pagination-links .page-numbers{display:inline-block;min-width:12px;border:1px solid #ccc;padding:2px 4px 4px;background:#e5e5e5;line-height:1;font-weight:400;text-align:center;text-decoration:none}.bp-group-admin-pagination-links a.page-numbers:hover{text-decoration:underline}.bp-group-admin-pagination-links .page-numbers.current,.bp-group-admin-pagination-links .page-numbers.dots{border-color:#ddd;background:#f7f7f7;color:#a0a5aa}table.bp-group-members .uid-column{padding-left:20px;padding-right:20px}table.bp-group-members .uname-column{width:70%}table.bp-group-members .urole-column{padding-left:20px;padding-right:20px}#group-manage-members-ui .subnav-filters .filter.last{float:right}#group-manage-members-ui .subnav-filters .left-menu{float:left}#group-manage-members-ui .subnav-filters .group-members-paginate-button:last-child{margin-right:2em}#group-manage-members-ui .subnav-filters .dashicons{padding-top:2px}#group-manage-members-ui .uname-column .profile-photo{margin-right:1em}#bp-no-group-members .bp-feedback.info{background:#fff;border-left:4px solid #00a0d2;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 5px 2px;padding:1px 12px}#bp-no-group-members .bp-feedback.info p{margin:.5em 0;padding:2px}@media screen and (max-width:782px){.bp-groups-settings-section label{margin:.25em 0}}
|
1 |
+
body.toplevel_page_bp-groups table.groups th#members,body.toplevel_page_bp-groups table.groups th#status{width:10%}body.toplevel_page_bp-groups table.groups th#last_active{width:15%}#bp-groups-form .avatar{float:left;margin-right:10px;margin-top:1px}#bp-groups-edit-form input{outline:medium none}#bp-groups-edit-form input#bp-groups-name{font-size:1.7em;width:100%;margin-bottom:6px}#bp-groups-edit-form input#bp-groups-new-members{border:1px solid #e5e5e5;margin-top:6px;width:100%}#bp-groups-new-members-list{margin:0}.bp-groups-settings-section{margin-top:10px;line-height:2}.bp-groups-settings-section legend{margin-top:10px;font-weight:700}.bp-groups-settings-section label{clear:left;display:block;float:left;vertical-align:middle}.groupbox{position:relative;min-width:255px;border:1px solid #c3c4c7;box-shadow:0 1px 1px rgb(0 0 0 / 4%);background:#fff;margin-bottom:20px;padding:0;line-height:1}.groupbox .inside{padding:0 12px 12px}#bp-groups-permalink-box{line-height:24px;color:#666}#bp-groups-permalink{margin-right:24px}.bp-groups-member-type{position:relative}.bp-groups-member-type>h4{margin-bottom:.5em}ul.bp-group-delete-list{list-style-type:disc;margin:4px 26px}.bp-group-admin-pagination{position:absolute;text-align:right;width:100%}.bp-group-admin-pagination.table-top{top:0}.bp-group-admin-pagination.table-bottom{bottom:0}.bp-group-admin-pagination-viewing{color:#777;font-size:12px;font-style:italic}.bp-group-admin-pagination-links{white-space:nowrap;padding-left:15px}.bp-group-admin-pagination-links .page-numbers{display:inline-block;min-width:12px;border:1px solid #ccc;padding:2px 4px 4px;background:#e5e5e5;line-height:1;font-weight:400;text-align:center;text-decoration:none}.bp-group-admin-pagination-links a.page-numbers:hover{text-decoration:underline}.bp-group-admin-pagination-links .page-numbers.current,.bp-group-admin-pagination-links .page-numbers.dots{border-color:#ddd;background:#f7f7f7;color:#a0a5aa}table.bp-group-members .uid-column{padding-left:20px;padding-right:20px}table.bp-group-members .uname-column{width:70%}table.bp-group-members .urole-column{padding-left:20px;padding-right:20px}#group-manage-members-ui .subnav-filters .filter.last{float:right}#group-manage-members-ui .subnav-filters .left-menu{float:left}#group-manage-members-ui .subnav-filters .group-members-paginate-button:last-child{margin-right:2em}#group-manage-members-ui .subnav-filters .dashicons{padding-top:2px}#group-manage-members-ui .uname-column .profile-photo{margin-right:1em}#bp-no-group-members .bp-feedback.info{background:#fff;border-left:4px solid #00a0d2;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 5px 2px;padding:1px 12px}#bp-no-group-members .bp-feedback.info p{margin:.5em 0;padding:2px}@media screen and (max-width:782px){.bp-groups-settings-section label{margin:.25em 0}}
|
@@ -521,20 +521,24 @@ function groups_record_activity( $args = '' ) {
|
|
521 |
}
|
522 |
}
|
523 |
|
524 |
-
$r = bp_parse_args(
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
|
|
|
|
|
|
|
|
538 |
|
539 |
return bp_activity_add( $r );
|
540 |
}
|
@@ -558,12 +562,16 @@ function groups_record_activity( $args = '' ) {
|
|
558 |
function groups_post_update( $args = '' ) {
|
559 |
$bp = buddypress();
|
560 |
|
561 |
-
$r = bp_parse_args(
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
|
|
|
|
|
|
|
|
567 |
|
568 |
$group_id = (int) $r['group_id'];
|
569 |
if ( ! $group_id && ! empty( $bp->groups->current_group->id ) ) {
|
521 |
}
|
522 |
}
|
523 |
|
524 |
+
$r = bp_parse_args(
|
525 |
+
$args,
|
526 |
+
array(
|
527 |
+
'id' => false,
|
528 |
+
'user_id' => bp_loggedin_user_id(),
|
529 |
+
'action' => '',
|
530 |
+
'content' => '',
|
531 |
+
'primary_link' => '',
|
532 |
+
'component' => buddypress()->groups->id,
|
533 |
+
'type' => false,
|
534 |
+
'item_id' => false,
|
535 |
+
'secondary_item_id' => false,
|
536 |
+
'recorded_time' => bp_core_current_time(),
|
537 |
+
'hide_sitewide' => $hide_sitewide,
|
538 |
+
'error_type' => 'bool',
|
539 |
+
),
|
540 |
+
'groups_record_activity'
|
541 |
+
);
|
542 |
|
543 |
return bp_activity_add( $r );
|
544 |
}
|
562 |
function groups_post_update( $args = '' ) {
|
563 |
$bp = buddypress();
|
564 |
|
565 |
+
$r = bp_parse_args(
|
566 |
+
$args,
|
567 |
+
array(
|
568 |
+
'content' => false,
|
569 |
+
'user_id' => bp_loggedin_user_id(),
|
570 |
+
'group_id' => 0,
|
571 |
+
'error_type' => 'bool',
|
572 |
+
),
|
573 |
+
'groups_post_update'
|
574 |
+
);
|
575 |
|
576 |
$group_id = (int) $r['group_id'];
|
577 |
if ( ! $group_id && ! empty( $bp->groups->current_group->id ) ) {
|
@@ -663,7 +663,7 @@ function bp_groups_admin_edit() {
|
|
663 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
664 |
<div id="post-body-content">
|
665 |
<div id="postdiv">
|
666 |
-
<div id="bp_groups_name" class="
|
667 |
<h2><?php _e( 'Name and Description', 'buddypress' ); ?></h2>
|
668 |
<div class="inside">
|
669 |
<label for="bp-groups-name" class="screen-reader-text"><?php
|
@@ -936,7 +936,8 @@ function bp_groups_admin_edit_metabox_members( $item ) {
|
|
936 |
bp_groups_get_group_manage_members_script_data( $item->id )
|
937 |
);
|
938 |
|
939 |
-
|
|
|
940 |
|
941 |
/**
|
942 |
* Echo out the JavaScript variable.
|
663 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
|
664 |
<div id="post-body-content">
|
665 |
<div id="postdiv">
|
666 |
+
<div id="bp_groups_name" class="groupbox">
|
667 |
<h2><?php _e( 'Name and Description', 'buddypress' ); ?></h2>
|
668 |
<div class="inside">
|
669 |
<label for="bp-groups-name" class="screen-reader-text"><?php
|
936 |
bp_groups_get_group_manage_members_script_data( $item->id )
|
937 |
);
|
938 |
|
939 |
+
// Inject the Group Manage Members interface.
|
940 |
+
bp_groups_manage_group_members_interface( 'admin_footer' );
|
941 |
|
942 |
/**
|
943 |
* Echo out the JavaScript variable.
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
function bp_groups_render_group_block( $attributes = array() ) {
|
24 |
$bp = buddypress();
|
25 |
|
26 |
-
$block_args =
|
27 |
$attributes,
|
28 |
array(
|
29 |
'itemID' => 0,
|
@@ -190,7 +190,7 @@ function bp_groups_render_group_block( $attributes = array() ) {
|
|
190 |
function bp_groups_render_groups_block( $attributes = array() ) {
|
191 |
$bp = buddypress();
|
192 |
|
193 |
-
$block_args =
|
194 |
$attributes,
|
195 |
array(
|
196 |
'itemIDs' => array(),
|
@@ -325,6 +325,23 @@ function bp_groups_blocks_add_script_data() {
|
|
325 |
return;
|
326 |
}
|
327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
// Include the common JS template.
|
329 |
echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-groups.php' );
|
330 |
|
@@ -345,7 +362,7 @@ function bp_groups_blocks_add_script_data() {
|
|
345 |
* @return string HTML output.
|
346 |
*/
|
347 |
function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
|
348 |
-
$block_args =
|
349 |
$attributes,
|
350 |
array(
|
351 |
'title' => __( 'Groups', 'buddypress' ),
|
@@ -439,7 +456,7 @@ function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
|
|
439 |
/* translators: %s is the number of Group members */
|
440 |
$extra = sprintf( _n( '%s member', '%s members', $count, 'buddypress' ), bp_core_number_format( $count ) );
|
441 |
} else {
|
442 |
-
/* translators: %s:
|
443 |
$extra = sprintf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active( $group ) );
|
444 |
}
|
445 |
|
@@ -483,10 +500,7 @@ function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
|
|
483 |
$path
|
484 |
);
|
485 |
|
486 |
-
$preloaded_groups =
|
487 |
-
if ( bp_is_running_wp( '5.0.0' ) ) {
|
488 |
-
$preloaded_groups = rest_preload_api_request( '', $default_path );
|
489 |
-
}
|
490 |
|
491 |
buddypress()->groups->block_globals['bp/dynamic-groups']->items[ $widget_id ] = (object) array(
|
492 |
'selector' => $widget_id,
|
@@ -498,15 +512,6 @@ function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
|
|
498 |
if ( ! has_action( 'wp_footer', 'bp_groups_blocks_add_script_data', 1 ) ) {
|
499 |
wp_set_script_translations( 'bp-dynamic-groups-script', 'buddypress' );
|
500 |
wp_enqueue_script( 'bp-dynamic-groups-script' );
|
501 |
-
wp_localize_script(
|
502 |
-
'bp-dynamic-groups-script',
|
503 |
-
'bpDynamicGroupsSettings',
|
504 |
-
array(
|
505 |
-
'path' => ltrim( $path, '/' ),
|
506 |
-
'root' => esc_url_raw( get_rest_url() ),
|
507 |
-
'nonce' => wp_create_nonce( 'wp_rest' ),
|
508 |
-
)
|
509 |
-
);
|
510 |
|
511 |
add_action( 'wp_footer', 'bp_groups_blocks_add_script_data', 1 );
|
512 |
}
|
23 |
function bp_groups_render_group_block( $attributes = array() ) {
|
24 |
$bp = buddypress();
|
25 |
|
26 |
+
$block_args = bp_parse_args(
|
27 |
$attributes,
|
28 |
array(
|
29 |
'itemID' => 0,
|
190 |
function bp_groups_render_groups_block( $attributes = array() ) {
|
191 |
$bp = buddypress();
|
192 |
|
193 |
+
$block_args = bp_parse_args(
|
194 |
$attributes,
|
195 |
array(
|
196 |
'itemIDs' => array(),
|
325 |
return;
|
326 |
}
|
327 |
|
328 |
+
$path = sprintf(
|
329 |
+
'/%1$s/%2$s/%3$s',
|
330 |
+
bp_rest_namespace(),
|
331 |
+
bp_rest_version(),
|
332 |
+
buddypress()->groups->id
|
333 |
+
);
|
334 |
+
|
335 |
+
wp_localize_script(
|
336 |
+
'bp-dynamic-groups-script',
|
337 |
+
'bpDynamicGroupsSettings',
|
338 |
+
array(
|
339 |
+
'path' => ltrim( $path, '/' ),
|
340 |
+
'root' => esc_url_raw( get_rest_url() ),
|
341 |
+
'nonce' => wp_create_nonce( 'wp_rest' ),
|
342 |
+
)
|
343 |
+
);
|
344 |
+
|
345 |
// Include the common JS template.
|
346 |
echo bp_get_dynamic_template_part( 'assets/widgets/dynamic-groups.php' );
|
347 |
|
362 |
* @return string HTML output.
|
363 |
*/
|
364 |
function bp_groups_render_dynamic_groups_block( $attributes = array() ) {
|
365 |
+
$block_args = bp_parse_args(
|
366 |
$attributes,
|
367 |
array(
|
368 |
'title' => __( 'Groups', 'buddypress' ),
|
456 |
/* translators: %s is the number of Group members */
|
457 |
$extra = sprintf( _n( '%s member', '%s members', $count, 'buddypress' ), bp_core_number_format( $count ) );
|
458 |
} else {
|
459 |
+
/* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */
|
460 |
$extra = sprintf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active( $group ) );
|
461 |
}
|
462 |
|
500 |
$path
|
501 |
);
|
502 |
|
503 |
+
$preloaded_groups = rest_preload_api_request( '', $default_path );
|
|
|
|
|
|
|
504 |
|
505 |
buddypress()->groups->block_globals['bp/dynamic-groups']->items[ $widget_id ] = (object) array(
|
506 |
'selector' => $widget_id,
|
512 |
if ( ! has_action( 'wp_footer', 'bp_groups_blocks_add_script_data', 1 ) ) {
|
513 |
wp_set_script_translations( 'bp-dynamic-groups-script', 'buddypress' );
|
514 |
wp_enqueue_script( 'bp-dynamic-groups-script' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
|
516 |
add_action( 'wp_footer', 'bp_groups_blocks_add_script_data', 1 );
|
517 |
}
|
@@ -19,7 +19,7 @@ function bp_groups_register_scripts() {
|
|
19 |
wp_register_script(
|
20 |
'bp-group-manage-members',
|
21 |
sprintf( '%1$sbp-groups/js/manage-members%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
|
22 |
-
array( 'json2', 'wp-backbone', '
|
23 |
bp_get_version(),
|
24 |
true
|
25 |
);
|
@@ -49,10 +49,7 @@ function bp_groups_get_group_manage_members_script_data( $group_id = 0 ) {
|
|
49 |
$group_id
|
50 |
);
|
51 |
|
52 |
-
$preloaded_members =
|
53 |
-
if ( bp_is_running_wp( '5.0.0' ) ) {
|
54 |
-
$preloaded_members = rest_preload_api_request( '', $path );
|
55 |
-
}
|
56 |
|
57 |
return array(
|
58 |
'path' => remove_query_arg( 'exclude_admins', $path ),
|
19 |
wp_register_script(
|
20 |
'bp-group-manage-members',
|
21 |
sprintf( '%1$sbp-groups/js/manage-members%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ),
|
22 |
+
array( 'json2', 'wp-backbone', 'wp-api-request' ),
|
23 |
bp_get_version(),
|
24 |
true
|
25 |
);
|
49 |
$group_id
|
50 |
);
|
51 |
|
52 |
+
$preloaded_members = rest_preload_api_request( '', $path );
|
|
|
|
|
|
|
53 |
|
54 |
return array(
|
55 |
'path' => remove_query_arg( 'exclude_admins', $path ),
|
@@ -48,11 +48,15 @@ function groups_get_group( $group_id ) {
|
|
48 |
* Old-style arguments take the form of an array or a query string.
|
49 |
*/
|
50 |
if ( ! is_numeric( $group_id ) ) {
|
51 |
-
$r = bp_parse_args(
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
56 |
|
57 |
$group_id = $r['group_id'];
|
58 |
}
|
@@ -69,6 +73,84 @@ function groups_get_group( $group_id ) {
|
|
69 |
return apply_filters( 'groups_get_group', $group );
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
/** Group Creation, Editing & Deletion ****************************************/
|
73 |
|
74 |
/**
|
@@ -97,17 +179,21 @@ function groups_get_group( $group_id ) {
|
|
97 |
*/
|
98 |
function groups_create_group( $args = '' ) {
|
99 |
|
100 |
-
$args = bp_parse_args(
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
|
112 |
extract( $args, EXTR_SKIP );
|
113 |
|
@@ -255,13 +341,17 @@ function groups_edit_base_group_details( $args = array() ) {
|
|
255 |
$args = bp_core_parse_args_array( $old_args_keys, $function_args );
|
256 |
}
|
257 |
|
258 |
-
$r = bp_parse_args(
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
|
|
265 |
|
266 |
if ( ! $r['group_id'] ) {
|
267 |
return false;
|
@@ -425,7 +515,7 @@ function groups_delete_group( $group_id ) {
|
|
425 |
function groups_is_valid_status( $status ) {
|
426 |
$bp = buddypress();
|
427 |
|
428 |
-
return in_array( $status, (array) $bp->groups->valid_status );
|
429 |
}
|
430 |
|
431 |
/**
|
@@ -459,16 +549,23 @@ function groups_check_slug( $slug ) {
|
|
459 |
}
|
460 |
|
461 |
/**
|
462 |
-
* Get
|
463 |
*
|
464 |
* @since 1.0.0
|
|
|
465 |
*
|
466 |
-
* @param int $
|
467 |
-
* @return string The group's slug.
|
468 |
*/
|
469 |
-
function groups_get_slug( $
|
470 |
-
|
471 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
}
|
473 |
|
474 |
/**
|
@@ -477,7 +574,7 @@ function groups_get_slug( $group_id ) {
|
|
477 |
* @since 1.6.0
|
478 |
*
|
479 |
* @param string $group_slug The group's slug.
|
480 |
-
* @return int|null The group ID on success
|
481 |
*/
|
482 |
function groups_get_id( $group_slug ) {
|
483 |
return BP_Groups_Group::group_exists( $group_slug );
|
@@ -489,7 +586,7 @@ function groups_get_id( $group_slug ) {
|
|
489 |
* @since 2.9.0
|
490 |
*
|
491 |
* @param string $group_slug The group's slug.
|
492 |
-
* @return int|null The group ID on success
|
493 |
*/
|
494 |
function groups_get_id_by_previous_slug( $group_slug ) {
|
495 |
return BP_Groups_Group::get_id_by_previous_slug( $group_slug );
|
@@ -501,26 +598,34 @@ function groups_get_id_by_previous_slug( $group_slug ) {
|
|
501 |
* Remove a user from a group.
|
502 |
*
|
503 |
* @since 1.0.0
|
|
|
504 |
*
|
505 |
-
* @param int $
|
506 |
-
* @param int
|
507 |
-
*
|
508 |
* @return bool True on success, false on failure.
|
509 |
*/
|
510 |
-
function groups_leave_group( $
|
511 |
|
512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
$user_id = bp_loggedin_user_id();
|
|
|
514 |
|
515 |
// Don't let single admins leave the group.
|
516 |
-
if ( count( groups_get_group_admins( $
|
517 |
-
if ( groups_is_user_admin( $user_id, $
|
518 |
bp_core_add_message( __( 'As the only admin, you cannot leave the group.', 'buddypress' ), 'error' );
|
519 |
return false;
|
520 |
}
|
521 |
}
|
522 |
|
523 |
-
if ( ! BP_Groups_Member::delete( $user_id, $
|
524 |
return false;
|
525 |
}
|
526 |
|
@@ -530,11 +635,13 @@ function groups_leave_group( $group_id, $user_id = 0 ) {
|
|
530 |
* Fires after a user leaves a group.
|
531 |
*
|
532 |
* @since 1.0.0
|
|
|
533 |
*
|
534 |
-
* @param int
|
535 |
-
* @param int
|
|
|
536 |
*/
|
537 |
-
do_action( 'groups_leave_group', $
|
538 |
|
539 |
return true;
|
540 |
}
|
@@ -543,30 +650,43 @@ function groups_leave_group( $group_id, $user_id = 0 ) {
|
|
543 |
* Add a user to a group.
|
544 |
*
|
545 |
* @since 1.0.0
|
|
|
546 |
*
|
547 |
-
* @param int $
|
548 |
-
* @param int
|
549 |
-
*
|
550 |
* @return bool True on success, false on failure.
|
551 |
*/
|
552 |
-
function groups_join_group( $
|
553 |
|
554 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
$user_id = bp_loggedin_user_id();
|
|
|
556 |
|
557 |
// Check if the user has an outstanding invite. If so, delete it.
|
558 |
-
if ( groups_check_user_has_invite( $user_id, $group_id ) )
|
559 |
groups_delete_invite( $user_id, $group_id );
|
|
|
560 |
|
561 |
// Check if the user has an outstanding request. If so, delete it.
|
562 |
-
if ( groups_check_for_membership_request( $user_id, $group_id ) )
|
563 |
groups_delete_membership_request( null, $user_id, $group_id );
|
|
|
564 |
|
565 |
// User is already a member, just return true.
|
566 |
-
if ( groups_is_user_member( $user_id, $group_id ) )
|
567 |
return true;
|
|
|
568 |
|
569 |
-
$new_member = new BP_Groups_Member;
|
570 |
$new_member->group_id = $group_id;
|
571 |
$new_member->user_id = $user_id;
|
572 |
$new_member->inviter_id = 0;
|
@@ -575,34 +695,32 @@ function groups_join_group( $group_id, $user_id = 0 ) {
|
|
575 |
$new_member->date_modified = bp_core_current_time();
|
576 |
$new_member->is_confirmed = 1;
|
577 |
|
578 |
-
if (
|
579 |
return false;
|
580 |
-
|
581 |
-
$bp = buddypress();
|
582 |
-
|
583 |
-
if ( !isset( $bp->groups->current_group ) || !$bp->groups->current_group || $group_id != $bp->groups->current_group->id )
|
584 |
-
$group = groups_get_group( $group_id );
|
585 |
-
else
|
586 |
-
$group = $bp->groups->current_group;
|
587 |
|
588 |
// Record this in activity streams.
|
589 |
if ( bp_is_active( 'activity' ) ) {
|
590 |
-
groups_record_activity(
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
|
|
|
|
595 |
}
|
596 |
|
597 |
/**
|
598 |
* Fires after a user joins a group.
|
599 |
*
|
600 |
* @since 1.0.0
|
|
|
601 |
*
|
602 |
-
* @param int
|
603 |
-
* @param int
|
|
|
604 |
*/
|
605 |
-
do_action( 'groups_join_group', $group_id, $user_id );
|
606 |
|
607 |
return true;
|
608 |
}
|
@@ -611,26 +729,25 @@ function groups_join_group( $group_id, $user_id = 0 ) {
|
|
611 |
* Update the last_activity meta value for a given group.
|
612 |
*
|
613 |
* @since 1.0.0
|
|
|
614 |
*
|
615 |
-
* @param int $
|
616 |
-
*
|
617 |
-
* @return
|
618 |
*/
|
619 |
-
function groups_update_last_activity( $
|
620 |
|
621 |
-
|
622 |
-
$group_id = buddypress()->groups->current_group->id;
|
623 |
-
}
|
624 |
|
625 |
-
if ( empty( $
|
626 |
return false;
|
627 |
}
|
628 |
|
629 |
-
groups_update_groupmeta( $
|
630 |
}
|
631 |
-
add_action( 'groups_join_group',
|
632 |
-
add_action( 'groups_leave_group',
|
633 |
-
add_action( 'groups_created_group',
|
634 |
|
635 |
/** General Group Functions ***************************************************/
|
636 |
|
@@ -710,17 +827,21 @@ function groups_get_group_members( $args = array() ) {
|
|
710 |
$args = bp_core_parse_args_array( $old_args_keys, $function_args );
|
711 |
}
|
712 |
|
713 |
-
$r = bp_parse_args(
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
'exclude_admins_mods' => true,
|
718 |
-
'exclude_banned' => true,
|
719 |
-
'exclude' => false,
|
720 |
-
'group_role' => array(),
|
721 |
-
'search_terms' => false,
|
722 |
-
'type' => 'last_joined',
|
723 |
-
), 'groups_get_group_members' );
|
48 |
* Old-style arguments take the form of an array or a query string.
|
49 |
*/
|
50 |
if ( ! is_numeric( $group_id ) ) {
|
51 |
+
$r = bp_parse_args(
|
52 |
+
$group_id,
|
53 |
+
array(
|
54 |
+
'group_id' => false,
|
55 |
+
'load_users' => false,
|
56 |
+
'populate_extras' => false,
|
57 |
+
),
|
58 |
+
'groups_get_group'
|
59 |
+
);
|
60 |
|
61 |
$group_id = $r['group_id'];
|
62 |
}
|
73 |
return apply_filters( 'groups_get_group', $group );
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* Retrieve group by a given field.
|
78 |
+
*
|
79 |
+
* @since 10.0.0
|
80 |
+
*
|
81 |
+
* @param string $field (Required) The field to use to retrieve the group.
|
82 |
+
* Possible values are `'id'` or `'slug'`.
|
83 |
+
* @param string|int $value (Required) A value for the $field. A Group ID or slug.
|
84 |
+
* @return BP_Groups_Group|bool The Group object if found, false otherwise.
|
85 |
+
*/
|
86 |
+
function bp_get_group_by( $field, $value ) {
|
87 |
+
$group_id = $value;
|
88 |
+
|
89 |
+
if ( 'slug' === $field && is_string( $value ) ) {
|
90 |
+
$group_id = groups_get_id( $value );
|
91 |
+
}
|
92 |
+
|
93 |
+
$group = groups_get_group( array( 'group_id' => (int) $group_id ) );
|
94 |
+
|
95 |
+
if ( empty( $group->id ) ) {
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
return $group;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Retrieve a Group.
|
104 |
+
*
|
105 |
+
* When used into the context of a Groups loop built by the `BP_Groups_Template` class, it defaults to the
|
106 |
+
* Group being iterated on.
|
107 |
+
*
|
108 |
+
* @since 10.0.0
|
109 |
+
*
|
110 |
+
* @global BP_Groups_Template $groups_template Groups template object.
|
111 |
+
*
|
112 |
+
* @param false|int|string|object|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
|
113 |
+
* Default: false.
|
114 |
+
* @return BP_Groups_Group|bool The Group object if found, false otherwise.
|
115 |
+
*/
|
116 |
+
function bp_get_group( $group = false ) {
|
117 |
+
global $groups_template;
|
118 |
+
|
119 |
+
$group_obj = false;
|
120 |
+
|
121 |
+
if ( $group instanceof BP_Groups_Group || ( is_object( $group ) && ! empty( $group->id ) ) ) {
|
122 |
+
$group_obj = $group;
|
123 |
+
|
124 |
+
// Nothing requested? Let's use the current Group of the Groups Loop, if available.
|
125 |
+
} elseif ( ! $group && isset( $groups_template->group ) && is_object( $groups_template->group ) ) {
|
126 |
+
$group_obj = $groups_template->group;
|
127 |
+
} else {
|
128 |
+
$current_group = null;
|
129 |
+
|
130 |
+
// Let's get the current group if we can.
|
131 |
+
if ( did_action( 'bp_groups_set_current_group' ) ) {
|
132 |
+
$current_group = groups_get_current_group();
|
133 |
+
}
|
134 |
+
|
135 |
+
$field = '';
|
136 |
+
if ( is_string( $group ) ) {
|
137 |
+
$field = 'slug';
|
138 |
+
} elseif ( is_numeric( $group ) ) {
|
139 |
+
$field = 'id';
|
140 |
+
$group = (int) $group;
|
141 |
+
}
|
142 |
+
|
143 |
+
// Let's use the current Group if it matches with the requested field value.
|
144 |
+
if ( isset( $current_group->{$field} ) && $current_group->{$field} === $group ) {
|
145 |
+
$group_obj = $current_group;
|
146 |
+
} else {
|
147 |
+
$group_obj = bp_get_group_by( $field, $group );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
return $group_obj;
|
152 |
+
}
|
153 |
+
|
154 |
/** Group Creation, Editing & Deletion ****************************************/
|
155 |
|
156 |
/**
|
179 |
*/
|
180 |
function groups_create_group( $args = '' ) {
|
181 |
|
182 |
+
$args = bp_parse_args(
|
183 |
+
$args,
|
184 |
+
array(
|
185 |
+
'group_id' => 0,
|
186 |
+
'creator_id' => 0,
|
187 |
+
'name' => '',
|
188 |
+
'description' => '',
|
189 |
+
'slug' => '',
|
190 |
+
'status' => null,
|
191 |
+
'parent_id' => null,
|
192 |
+
'enable_forum' => null,
|
193 |
+
'date_created' => null,
|
194 |
+
),
|
195 |
+
'groups_create_group'
|
196 |
+
);
|
197 |
|
198 |
extract( $args, EXTR_SKIP );
|
199 |
|
341 |
$args = bp_core_parse_args_array( $old_args_keys, $function_args );
|
342 |
}
|
343 |
|
344 |
+
$r = bp_parse_args(
|
345 |
+
$args,
|
346 |
+
array(
|
347 |
+
'group_id' => bp_get_current_group_id(),
|
348 |
+
'name' => null,
|
349 |
+
'slug' => null,
|
350 |
+
'description' => null,
|
351 |
+
'notify_members' => false,
|
352 |
+
),
|
353 |
+
'groups_edit_base_group_details'
|
354 |
+
);
|
355 |
|
356 |
if ( ! $r['group_id'] ) {
|
357 |
return false;
|
515 |
function groups_is_valid_status( $status ) {
|
516 |
$bp = buddypress();
|
517 |
|
518 |
+
return in_array( $status, (array) $bp->groups->valid_status, true );
|
519 |
}
|
520 |
|
521 |
/**
|
549 |
}
|
550 |
|
551 |
/**
|
552 |
+
* Get slug from a group.
|
553 |
*
|
554 |
* @since 1.0.0
|
555 |
+
* @since 10.0.0 Updated to use `bp_get_group`.
|
556 |
*
|
557 |
+
* @param int|string|BP_Groups_Group $group The Group ID, the Group Slug or the Group object.
|
558 |
+
* @return bool|string The group's slug. False if group doesn't exist.
|
559 |
*/
|
560 |
+
function groups_get_slug( $group ) {
|
561 |
+
|
562 |
+
$group = bp_get_group( $group );
|
563 |
+
|
564 |
+
if ( empty( $group->id ) ) {
|
565 |
+
return false;
|
566 |
+
}
|
567 |
+
|
568 |
+
return ! empty( $group->slug ) ? $group->slug : '';
|
569 |
}
|
570 |
|
571 |
/**
|
574 |
* @since 1.6.0
|
575 |
*
|
576 |
* @param string $group_slug The group's slug.
|
577 |
+
* @return int|null The group ID on success, null on failure.
|
578 |
*/
|
579 |
function groups_get_id( $group_slug ) {
|
580 |
return BP_Groups_Group::group_exists( $group_slug );
|
586 |
* @since 2.9.0
|
587 |
*
|
588 |
* @param string $group_slug The group's slug.
|
589 |
+
* @return int|null The group ID on success, null on failure.
|
590 |
*/
|
591 |
function groups_get_id_by_previous_slug( $group_slug ) {
|
592 |
return BP_Groups_Group::get_id_by_previous_slug( $group_slug );
|
598 |
* Remove a user from a group.
|
599 |
*
|
600 |
* @since 1.0.0
|
601 |
+
* @since 10.0.0 Updated to use `bp_get_group`.
|
602 |
*
|
603 |
+
* @param int|string|BP_Groups_Group $group The Group ID, the Group Slug or the Group object.
|
604 |
+
* @param int $user_id Optional. ID of the user. Defaults to the currently
|
605 |
+
* logged-in user.
|
606 |
* @return bool True on success, false on failure.
|
607 |
*/
|
608 |
+
function groups_leave_group( $group, $user_id = 0 ) {
|
609 |
|
610 |
+
$group = bp_get_group( $group );
|
611 |
+
|
612 |
+
if ( empty( $group->id ) ) {
|
613 |
+
return false;
|
614 |
+
}
|
615 |
+
|
616 |
+
if ( empty( $user_id ) ) {
|
617 |
$user_id = bp_loggedin_user_id();
|
618 |
+
}
|
619 |
|
620 |
// Don't let single admins leave the group.
|
621 |
+
if ( count( groups_get_group_admins( $group->id ) ) < 2 ) {
|
622 |
+
if ( groups_is_user_admin( $user_id, $group->id ) ) {
|
623 |
bp_core_add_message( __( 'As the only admin, you cannot leave the group.', 'buddypress' ), 'error' );
|
624 |
return false;
|
625 |
}
|
626 |
}
|
627 |
|
628 |
+
if ( ! BP_Groups_Member::delete( $user_id, $group->id ) ) {
|
629 |
return false;
|
630 |
}
|
631 |
|
635 |
* Fires after a user leaves a group.
|
636 |
*
|
637 |
* @since 1.0.0
|
638 |
+
* @since 10.0.0 Updated to add the `$group` parameter.
|
639 |
*
|
640 |
+
* @param int $group_id ID of the group.
|
641 |
+
* @param int $user_id ID of the user leaving the group.
|
642 |
+
* @param BP_Groups_Group $group The group object.
|
643 |
*/
|
644 |
+
do_action( 'groups_leave_group', $group->id, $user_id, $group );
|
645 |
|
646 |
return true;
|
647 |
}
|
650 |
* Add a user to a group.
|
651 |
*
|
652 |
* @since 1.0.0
|
653 |
+
* @since 10.0.0 Updated to use `bp_get_group`.
|
654 |
*
|
655 |
+
* @param int|string|BP_Groups_Group $group The Group ID, the Group Slug or the Group object.
|
656 |
+
* @param int $user_id Optional. ID of the user. Defaults to the currently
|
657 |
+
* logged-in user.
|
658 |
* @return bool True on success, false on failure.
|
659 |
*/
|
660 |
+
function groups_join_group( $group, $user_id = 0 ) {
|
661 |
|
662 |
+
$group = bp_get_group( $group );
|
663 |
+
|
664 |
+
if ( empty( $group->id ) ) {
|
665 |
+
return false;
|
666 |
+
}
|
667 |
+
|
668 |
+
$group_id = $group->id;
|
669 |
+
|
670 |
+
if ( empty( $user_id ) ) {
|
671 |
$user_id = bp_loggedin_user_id();
|
672 |
+
}
|
673 |
|
674 |
// Check if the user has an outstanding invite. If so, delete it.
|
675 |
+
if ( groups_check_user_has_invite( $user_id, $group_id ) ) {
|
676 |
groups_delete_invite( $user_id, $group_id );
|
677 |
+
}
|
678 |
|
679 |
// Check if the user has an outstanding request. If so, delete it.
|
680 |
+
if ( groups_check_for_membership_request( $user_id, $group_id ) ) {
|
681 |
groups_delete_membership_request( null, $user_id, $group_id );
|
682 |
+
}
|
683 |
|
684 |
// User is already a member, just return true.
|
685 |
+
if ( groups_is_user_member( $user_id, $group_id ) ) {
|
686 |
return true;
|
687 |
+
}
|
688 |
|
689 |
+
$new_member = new BP_Groups_Member();
|
690 |
$new_member->group_id = $group_id;
|
691 |
$new_member->user_id = $user_id;
|
692 |
$new_member->inviter_id = 0;
|
695 |
$new_member->date_modified = bp_core_current_time();
|
696 |
$new_member->is_confirmed = 1;
|
697 |
|
698 |
+
if ( ! $new_member->save() ) {
|
699 |
return false;
|
700 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
701 |
|
702 |
// Record this in activity streams.
|
703 |
if ( bp_is_active( 'activity' ) ) {
|
704 |
+
groups_record_activity(
|
705 |
+
array(
|
706 |
+
'type' => 'joined_group',
|
707 |
+
'item_id' => $group_id,
|
708 |
+
'user_id' => $user_id,
|
709 |
+
)
|
710 |
+
);
|
711 |
}
|
712 |
|
713 |
/**
|
714 |
* Fires after a user joins a group.
|
715 |
*
|
716 |
* @since 1.0.0
|
717 |
+
* @since 10.0.0 Added the `$group` parameter.
|
718 |
*
|
719 |
+
* @param int $group_id ID of the group.
|
720 |
+
* @param int $user_id ID of the user joining the group.
|
721 |
+
* @param BP_Groups_Group $group The group object.
|
722 |
*/
|
723 |
+
do_action( 'groups_join_group', $group_id, $user_id, $group );
|
724 |
|
725 |
return true;
|
726 |
}
|
729 |
* Update the last_activity meta value for a given group.
|
730 |
*
|
731 |
* @since 1.0.0
|
732 |
+
* @since 10.0.0 Updated to use `bp_get_group`.
|
733 |
*
|
734 |
+
* @param int|string|BP_Groups_Group $group The Group ID, the Group Slug or the Group object.
|
735 |
+
* Default: the current group's ID.
|
736 |
+
* @return bool False on failure.
|
737 |
*/
|
738 |
+
function groups_update_last_activity( $group = 0 ) {
|
739 |
|
740 |
+
$group = bp_get_group( $group );
|
|
|
|
|
741 |
|
742 |
+
if ( empty( $group->id ) ) {
|
743 |
return false;
|
744 |
}
|
745 |
|
746 |
+
groups_update_groupmeta( $group->id, 'last_activity', bp_core_current_time() );
|
747 |
}
|
748 |
+
add_action( 'groups_join_group', 'groups_update_last_activity' );
|
749 |
+
add_action( 'groups_leave_group', 'groups_update_last_activity' );
|
750 |
+
add_action( 'groups_created_group', 'groups_update_last_activity' );
|
751 |
|
752 |
/** General Group Functions ***************************************************/
|
753 |
|
827 |
$args = bp_core_parse_args_array( $old_args_keys, $function_args );
|
828 |
}
|
829 |
|
830 |
+
$r = bp_parse_args(
|
831 |
+
$args,
|
832 |
+
array(
|
833 |
+
'gro
|
|
|
|
|
|
|
|
|
|
|
|
|
|