BuddyPress - Version 2.9.0-RC1

Version Description

See: https://codex.buddypress.org/releases/

Download this release

Release Info

Developer Otto42
Plugin Icon 128x128 BuddyPress
Version 2.9.0-RC1
Comparing to
See all releases

Code changes from version 2.9.4 to 2.9.0-RC1

Files changed (71) hide show
  1. bp-activity/classes/class-bp-activity-activity.php +1 -1
  2. bp-activity/classes/class-bp-activity-template.php +1 -1
  3. bp-blogs/bp-blogs-functions.php +3 -9
  4. bp-core/admin/css/common-rtl.css +2 -11
  5. bp-core/admin/css/common-rtl.min.css +1 -1
  6. bp-core/admin/css/common.css +2 -11
  7. bp-core/admin/css/common.min.css +1 -1
  8. bp-core/admin/images/list-unsubscribe.png +0 -0
  9. bp-core/admin/images/pending-accounts.png +0 -0
  10. bp-core/admin/images/twenty-seventeen.png +0 -0
  11. bp-core/bp-core-attachments.php +14 -15
  12. bp-core/bp-core-avatars.php +0 -5
  13. bp-core/bp-core-filters.php +7 -8
  14. bp-core/classes/class-bp-admin.php +12 -3
  15. bp-core/classes/class-bp-attachment-cover-image.php +291 -291
  16. bp-core/deprecated/1.6.php +2 -7
  17. bp-core/js/bp-plupload.js +1 -1
  18. bp-core/js/bp-plupload.min.js +1 -1
  19. bp-core/js/cover-image.js +277 -277
  20. bp-forums/bp-forums-bbpress-sa.php +5 -15
  21. bp-forums/bp-forums-filters.php +0 -20
  22. bp-forums/bp-forums-template.php +1 -3
  23. bp-forums/class.backpress-taxonomy.php +0 -2082
  24. bp-forums/class.bb-taxonomy.php +0 -329
  25. bp-groups/bp-groups-template.php +2 -2
  26. bp-groups/classes/class-bp-group-extension.php +3 -14
  27. bp-loader.php +1 -1
  28. bp-members/bp-members-functions.php +4 -11
  29. bp-members/bp-members-screens.php +6 -3
  30. bp-members/classes/class-bp-members-admin.php +3 -9
  31. bp-messages/bp-messages-actions.php +14 -18
  32. bp-messages/bp-messages-template.php +1 -1
  33. bp-templates/bp-legacy/buddypress-functions.php +15 -21
  34. bp-templates/bp-legacy/buddypress/assets/_attachments/cover-images/index.php +36 -36
  35. bp-templates/bp-legacy/buddypress/groups/single/admin/delete-group.php +41 -41
  36. bp-templates/bp-legacy/buddypress/groups/single/admin/edit-details.php +53 -53
  37. bp-templates/bp-legacy/buddypress/groups/single/admin/group-avatar.php +67 -67
  38. bp-templates/bp-legacy/buddypress/groups/single/admin/group-cover-image.php +33 -33
  39. bp-templates/bp-legacy/buddypress/groups/single/admin/group-settings.php +124 -124
  40. bp-templates/bp-legacy/buddypress/groups/single/admin/manage-members.php +332 -332
  41. bp-templates/bp-legacy/buddypress/groups/single/admin/membership-requests.php +35 -35
  42. bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php +129 -129
  43. bp-templates/bp-legacy/buddypress/members/single/cover-image-header.php +106 -106
  44. bp-templates/bp-legacy/buddypress/members/single/profile/change-cover-image.php +33 -33
  45. bp-templates/bp-legacy/css/twentyeleven-rtl.css +185 -185
  46. bp-templates/bp-legacy/css/twentyeleven.css +185 -185
  47. bp-templates/bp-legacy/css/twentyeleven.scss +2835 -2835
  48. bp-templates/bp-legacy/css/twentyseventeen-rtl.css +184 -184
  49. bp-templates/bp-legacy/css/twentyseventeen.css +184 -184
  50. bp-templates/bp-legacy/css/twentyseventeen.scss +3194 -3194
  51. bp-templates/bp-legacy/css/twentysixteen-rtl.css +187 -187
  52. bp-templates/bp-legacy/css/twentysixteen.css +187 -187
  53. bp-templates/bp-legacy/css/twentysixteen.scss +2710 -2710
  54. bp-templates/bp-legacy/css/twentyten-rtl.css +185 -185
  55. bp-templates/bp-legacy/css/twentyten.css +185 -185
  56. bp-templates/bp-legacy/css/twentyten.scss +2725 -2725
  57. bp-templates/bp-legacy/css/twentythirteen-rtl.css +189 -189
  58. bp-templates/bp-legacy/css/twentythirteen.css +189 -189
  59. bp-templates/bp-legacy/css/twentythirteen.scss +2688 -2688
  60. bp-templates/bp-legacy/css/twentytwelve-rtl.css +189 -189
  61. bp-templates/bp-legacy/css/twentytwelve.css +189 -189
  62. bp-templates/bp-legacy/css/twentytwelve.scss +2765 -2765
  63. bp-themes/bp-default/_inc/ajax.php +4 -4
  64. bp-xprofile/bp-xprofile-admin.php +1 -3
  65. bp-xprofile/bp-xprofile-filters.php +7 -11
  66. bp-xprofile/bp-xprofile-functions.php +0 -2
  67. bp-xprofile/bp-xprofile-template.php +15 -11
  68. bp-xprofile/classes/class-bp-xprofile-user-admin.php +1 -4
  69. buddypress.pot +0 -9682
  70. class-buddypress.php +1 -1
  71. readme.txt +4 -7
bp-activity/classes/class-bp-activity-activity.php CHANGED
@@ -1832,7 +1832,7 @@ class BP_Activity_Activity {
1832
// Get activities from user meta.
1833
$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
1834
if ( ! empty( $favorite_activity_entries ) ) {
1835
- return count( $favorite_activity_entries );
1836
}
1837
1838
// No favorites.
1832
// Get activities from user meta.
1833
$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
1834
if ( ! empty( $favorite_activity_entries ) ) {
1835
+ return count( maybe_unserialize( $favorite_activity_entries ) );
1836
}
1837
1838
// No favorites.
bp-activity/classes/class-bp-activity-template.php CHANGED
@@ -195,7 +195,7 @@ class BP_Activity_Template {
195
$this->disable_blogforum_replies = (bool) bp_core_get_root_option( 'bp-disable-blogforum-comments' );
196
197
// Get an array of the logged in user's favorite activities.
198
- $this->my_favs = bp_get_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', true );
199
200
// Fetch specific activity items based on ID's.
201
if ( !empty( $include ) ) {
195
$this->disable_blogforum_replies = (bool) bp_core_get_root_option( 'bp-disable-blogforum-comments' );
196
197
// Get an array of the logged in user's favorite activities.
198
+ $this->my_favs = maybe_unserialize( bp_get_user_meta( bp_loggedin_user_id(), 'bp_favorite_activities', true ) );
199
200
// Fetch specific activity items based on ID's.
201
if ( !empty( $include ) ) {
bp-blogs/bp-blogs-functions.php CHANGED
@@ -548,9 +548,8 @@ add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2
548
/**
549
* Deletes the 'url' blogmeta for a site.
550
*
551
- * Fires when a site's details are updated, which generally happens when
552
- * editing a site under "Network Admin > Sites". Prior to WP 4.9, the
553
- * correct hook was 'refresh_blog_details'; afterward, 'clean_site_cache'.
554
*
555
* @since 2.3.0
556
*
@@ -559,12 +558,7 @@ add_action( 'update_option_site_icon', 'bp_blogs_update_option_site_icon', 10, 2
559
function bp_blogs_delete_url_blogmeta( $site_id = 0 ) {
560
bp_blogs_delete_blogmeta( (int) $site_id, 'url' );
561
}
562
-
563
- if ( function_exists( 'wp_switch_roles_and_user' ) ) {
564
- add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' );
565
- } else {
566
- add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' );
567
- }
568
569
/**
570
* Record activity metadata about a published blog post.
548
/**
549
* Deletes the 'url' blogmeta for a site.
550
*
551
+ * Hooked to 'refresh_blog_details', which is notably used when editing a site
552
+ * under "Network Admin > Sites".
553
*
554
* @since 2.3.0
555
*
558
function bp_blogs_delete_url_blogmeta( $site_id = 0 ) {
559
bp_blogs_delete_blogmeta( (int) $site_id, 'url' );
560
}
561
+ add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' );
562
563
/**
564
* Record activity metadata about a published blog post.
bp-core/admin/css/common-rtl.css CHANGED
@@ -47,8 +47,7 @@ TABLE OF CONTENTS:
47
left: 0;
48
}
49
50
- .index_page_bp-credits code,
51
- .index_page_bp-about code {
52
background-color: #e0e0e0;
53
color: #636363;
54
font-size: 1em;
@@ -360,12 +359,8 @@ TABLE OF CONTENTS:
360
margin-top: 2em;
361
}
362
363
- .buddypress .bp-changelog {
364
- margin-bottom: 0;
365
- }
366
-
367
.buddypress .bp-changelog-section .changelog-title {
368
- margin-bottom: 0.5em;
369
}
370
371
.buddypress .bp-changelog .title {
@@ -382,10 +377,6 @@ TABLE OF CONTENTS:
382
padding-bottom: 0.5em;
383
width: 100%;
384
}
385
-
386
- .buddypress .bp-three-column .bp-column {
387
- width: 100%;
388
- }
389
}
390
391
@media screen and ( max-width: 360px ) {
47
left: 0;
48
}
49
50
+ .buddypress code {
51
background-color: #e0e0e0;
52
color: #636363;
53
font-size: 1em;
359
margin-top: 2em;
360
}
361
362
.buddypress .bp-changelog-section .changelog-title {
363
+ margin-bottom: 1.5em;
364
}
365
366
.buddypress .bp-changelog .title {
377
padding-bottom: 0.5em;
378
width: 100%;
379
}
380
}
381
382
@media screen and ( max-width: 360px ) {
bp-core/admin/css/common-rtl.min.css CHANGED
@@ -1 +1 @@
1
- .bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;left:0}.index_page_bp-about code,.index_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;left:auto}}.buddypress .bp-headline-feature{margin-bottom:2em;margin-top:3em;padding:2em 3em}.buddypress .bp-headline{margin:0 auto;width:45em}.buddypress .bp-headline span.dashicons{background-color:#f1f1f1;color:#d84800;clear:right;font-size:100px;float:right;height:100px;line-height:100px;margin:0 0 15px 15px;text-align:center;width:100px}.buddypress .bp-headline-feature .headline-title{font-size:2.2em;font-weight:300;line-height:2;margin:0 0 1em;text-align:center}.buddypress .bp-headline-feature p{font-size:1.15em;margin:1.15em 0 .6em auto}.buddypress .bp-features-section{border-bottom:1px solid #ccc;clear:both;margin-bottom:3em;margin-top:2em;overflow:hidden;padding-bottom:2em}.buddypress .bp-features-section p{font-size:14px;line-height:1.5}.buddypress .bp-features-section img{margin-bottom:20px}.buddypress .bp-features-section span.dashicons{background-color:#fff;border-radius:50%;clear:right;color:#d84800;font-size:50px;float:right;height:80px;line-height:80px;margin:0 0 15px 15px;text-align:center;width:80px}.buddypress .bp-features-section .headline-title{font-size:2em;font-weight:300;line-height:1.5;margin:1em auto 2em;text-align:center}.buddypress .bp-features-section .bp-feature-with-images{border-bottom:1px solid #ccc;margin-bottom:5em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{float:right;margin-bottom:3em;margin-left:4.799999999%;width:47.6%}.buddypress .bp-features-section .bp-feature-imaged.anon,.buddypress .bp-features-section .bp-feature.opposite{margin-left:0}.buddypress .bp-features-section .bp-feature code{font-size:.95em;line-height:1.5}.buddypress .bp-feature:after{clear:both;content:"";margin-bottom:2em}.buddypress .bp-feature-imaged .feature-title{color:#23282d;font-size:1.25em;margin-bottom:.6em;margin-top:0}.buddypress .bp-feature-imaged p{clear:right;font-size:1.1em}.buddypress .bp-feature-imaged img{clear:right}.buddypress .bp-feature .feature-title{font-size:1em;line-height:1.5;margin-bottom:0;margin-right:110px;margin-top:0;text-align:right}.buddypress .bp-feature p{margin-right:110px}.buddypress .bp-changelog-section{clear:both;margin-bottom:3em;margin-top:4em;padding-bottom:0}.buddypress .bp-changelog-section:after{clear:both;content:"";display:table}.buddypress .bp-changelog-section .changelog-title{color:#23282d;font-size:1.25em;line-height:1.5;margin:0 auto 1.5em}.buddypress .bp-two-column div{float:right;margin-left:4.799999999%;position:relative;width:47.6%}.buddypress .bp-three-column .bp-column{float:right;margin-left:5%;position:relative;width:29.95%}.buddypress .bp-three-column .bp-column:nth-of-type(3n),.buddypress .bp-two-column .bp-column:nth-of-type(2n){margin-left:0}.buddypress .bp-changelog{margin-bottom:3em}.buddypress .bp-changelog:after{clear:both;content:"";display:table}.buddypress .bp-changelog .title{font-size:14px;margin-bottom:.75em;margin-top:0}.buddypress .bp-changelog p{margin-bottom:0}.bp-changelog-url{text-align:center}.bp-assets{clear:both;margin-bottom:3em}@media screen and (max-width:782px){.bp-assets,.bp-changelog-section,.bp-features-section,.bp-headline-feature{margin-right:20px;margin-left:20px}.buddypress .bp-headline-feature{padding:0}.buddypress .bp-headline{margin:0;width:97%}.buddypress .bp-features-section{clear:both;margin-bottom:0;margin-top:2em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature-with-images{margin-bottom:2em}.buddypress .bp-features-section .headline-title{margin-bottom:1em}.buddypress .bp-changelog-section .changelog-title{font-size:1.25em;line-height:1.5;margin-bottom:.5em;margin-top:.5em}.buddypress .bp-changelog-section .title,.buddypress .bp-features-section .feature-title{font-size:1.25em;line-height:1.25;margin-top:.6em;text-align:right}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{clear:both;float:right;margin-bottom:1em;margin-top:1em;margin-left:0;padding-left:1em;width:100%}.buddypress .bp-features-section .bp-feature-imaged p{font-size:1em}.buddypress .bp-features-section .bp-feature span{margin-top:.33em}.buddypress .bp-feature.opposite .feature-title,.buddypress .bp-feature.opposite p{float:none}.buddypress .bp-changelog-section{clear:both;margin-bottom:2em;margin-top:2em}.buddypress .bp-changelog{margin-bottom:0}.buddypress .bp-changelog-section .changelog-title{margin-bottom:.5em}.buddypress .bp-changelog .title{font-size:1em}.buddypress .bp-changelog p{margin-bottom:1em}.buddypress .bp-changelog-section .three-col .col,.buddypress .bp-changelog-section .two-col>div{margin-top:0;padding-bottom:.5em;width:100%}.buddypress .bp-three-column .bp-column{width:100%}}@media screen and (max-width:360px){.buddypress .bp-headline{text-align:center}.buddypress .bp-headline span.dashicons{clear:none;font-size:80px;float:none;height:80px;line-height:80px;margin:0 auto;width:80px}.buddypress .bp-features-section .headline-title,.buddypress .bp-headline-feature .headline-title{font-size:1.5em;line-height:1.5;text-align:right}.buddypress .bp-headline-feature .headline-title{margin:1em 0 0}.buddypress .bp-headline-feature p{margin:1.15em 0 .6em auto;text-align:right;width:auto}.buddypress .bp-features-section .bp-feature{text-align:center}.buddypress .bp-features-section span.dashicons{float:none}.buddypress .bp-features-section .feature-title,.buddypress .bp-features-section p{margin-right:0;text-align:right}}#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.forums td.plugin-title span:before{content:"\f452"}.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"}#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.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}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}.tools_page_bp-tools .wrap{max-width:950px}.tools_page_bp-tools p{line-height:2}.tools_page_bp-tools fieldset{margin:2em 0 0}.tools_page_bp-tools legend{color:#23282d;font-size:1.3em;font-weight:600;margin:1em 0}.tools_page_bp-tools label{clear:right;display:block;line-height:1.5;margin:0 0 1em;vertical-align:middle}@media screen and (max-width:782px){.tools_page_bp-tools p{line-height:1.5}.tools_page_bp-tools label{margin-bottom:1em;padding-left:25px;text-indent:-33px}.tools_page_bp-tools .checkbox{padding:0 30px 0 0}}#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!important}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;left:0}.buddypress code{background-color:#e0e0e0;color:#636363;font-size:1em}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;left:auto}}.buddypress .bp-headline-feature{margin-bottom:2em;margin-top:3em;padding:2em 3em}.buddypress .bp-headline{margin:0 auto;width:45em}.buddypress .bp-headline span.dashicons{background-color:#f1f1f1;color:#d84800;clear:right;font-size:100px;float:right;height:100px;line-height:100px;margin:0 0 15px 15px;text-align:center;width:100px}.buddypress .bp-headline-feature .headline-title{font-size:2.2em;font-weight:300;line-height:2;margin:0 0 1em;text-align:center}.buddypress .bp-headline-feature p{font-size:1.15em;margin:1.15em 0 .6em auto}.buddypress .bp-features-section{border-bottom:1px solid #ccc;clear:both;margin-bottom:3em;margin-top:2em;overflow:hidden;padding-bottom:2em}.buddypress .bp-features-section p{font-size:14px;line-height:1.5}.buddypress .bp-features-section img{margin-bottom:20px}.buddypress .bp-features-section span.dashicons{background-color:#fff;border-radius:50%;clear:right;color:#d84800;font-size:50px;float:right;height:80px;line-height:80px;margin:0 0 15px 15px;text-align:center;width:80px}.buddypress .bp-features-section .headline-title{font-size:2em;font-weight:300;line-height:1.5;margin:1em auto 2em;text-align:center}.buddypress .bp-features-section .bp-feature-with-images{border-bottom:1px solid #ccc;margin-bottom:5em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{float:right;margin-bottom:3em;margin-left:4.799999999%;width:47.6%}.buddypress .bp-features-section .bp-feature-imaged.anon,.buddypress .bp-features-section .bp-feature.opposite{margin-left:0}.buddypress .bp-features-section .bp-feature code{font-size:.95em;line-height:1.5}.buddypress .bp-feature:after{clear:both;content:"";margin-bottom:2em}.buddypress .bp-feature-imaged .feature-title{color:#23282d;font-size:1.25em;margin-bottom:.6em;margin-top:0}.buddypress .bp-feature-imaged p{clear:right;font-size:1.1em}.buddypress .bp-feature-imaged img{clear:right}.buddypress .bp-feature .feature-title{font-size:1em;line-height:1.5;margin-bottom:0;margin-right:110px;margin-top:0;text-align:right}.buddypress .bp-feature p{margin-right:110px}.buddypress .bp-changelog-section{clear:both;margin-bottom:3em;margin-top:4em;padding-bottom:0}.buddypress .bp-changelog-section:after{clear:both;content:"";display:table}.buddypress .bp-changelog-section .changelog-title{color:#23282d;font-size:1.25em;line-height:1.5;margin:0 auto 1.5em}.buddypress .bp-two-column div{float:right;margin-left:4.799999999%;position:relative;width:47.6%}.buddypress .bp-three-column .bp-column{float:right;margin-left:5%;position:relative;width:29.95%}.buddypress .bp-three-column .bp-column:nth-of-type(3n),.buddypress .bp-two-column .bp-column:nth-of-type(2n){margin-left:0}.buddypress .bp-changelog{margin-bottom:3em}.buddypress .bp-changelog:after{clear:both;content:"";display:table}.buddypress .bp-changelog .title{font-size:14px;margin-bottom:.75em;margin-top:0}.buddypress .bp-changelog p{margin-bottom:0}.bp-changelog-url{text-align:center}.bp-assets{clear:both;margin-bottom:3em}@media screen and (max-width:782px){.bp-assets,.bp-changelog-section,.bp-features-section,.bp-headline-feature{margin-right:20px;margin-left:20px}.buddypress .bp-headline-feature{padding:0}.buddypress .bp-headline{margin:0;width:97%}.buddypress .bp-features-section{clear:both;margin-bottom:0;margin-top:2em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature-with-images{margin-bottom:2em}.buddypress .bp-features-section .headline-title{margin-bottom:1em}.buddypress .bp-changelog-section .changelog-title{font-size:1.25em;line-height:1.5;margin-bottom:.5em;margin-top:.5em}.buddypress .bp-changelog-section .title,.buddypress .bp-features-section .feature-title{font-size:1.25em;line-height:1.25;margin-top:.6em;text-align:right}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{clear:both;float:right;margin-bottom:1em;margin-top:1em;margin-left:0;padding-left:1em;width:100%}.buddypress .bp-features-section .bp-feature-imaged p{font-size:1em}.buddypress .bp-features-section .bp-feature span{margin-top:.33em}.buddypress .bp-feature.opposite .feature-title,.buddypress .bp-feature.opposite p{float:none}.buddypress .bp-changelog-section{clear:both;margin-bottom:2em;margin-top:2em}.buddypress .bp-changelog-section .changelog-title{margin-bottom:1.5em}.buddypress .bp-changelog .title{font-size:1em}.buddypress .bp-changelog p{margin-bottom:1em}.buddypress .bp-changelog-section .three-col .col,.buddypress .bp-changelog-section .two-col>div{margin-top:0;padding-bottom:.5em;width:100%}}@media screen and (max-width:360px){.buddypress .bp-headline{text-align:center}.buddypress .bp-headline span.dashicons{clear:none;font-size:80px;float:none;height:80px;line-height:80px;margin:0 auto;width:80px}.buddypress .bp-features-section .headline-title,.buddypress .bp-headline-feature .headline-title{font-size:1.5em;line-height:1.5;text-align:right}.buddypress .bp-headline-feature .headline-title{margin:1em 0 0}.buddypress .bp-headline-feature p{margin:1.15em 0 .6em auto;text-align:right;width:auto}.buddypress .bp-features-section .bp-feature{text-align:center}.buddypress .bp-features-section span.dashicons{float:none}.buddypress .bp-features-section .feature-title,.buddypress .bp-features-section p{margin-right:0;text-align:right}}#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.forums td.plugin-title span:before{content:"\f452"}.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"}#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.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}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}.tools_page_bp-tools .wrap{max-width:950px}.tools_page_bp-tools p{line-height:2}.tools_page_bp-tools fieldset{margin:2em 0 0}.tools_page_bp-tools legend{color:#23282d;font-size:1.3em;font-weight:600;margin:1em 0}.tools_page_bp-tools label{clear:right;display:block;line-height:1.5;margin:0 0 1em;vertical-align:middle}@media screen and (max-width:782px){.tools_page_bp-tools p{line-height:1.5}.tools_page_bp-tools label{margin-bottom:1em;padding-left:25px;text-indent:-33px}.tools_page_bp-tools .checkbox{padding:0 30px 0 0}}#buddypress-update.not-shiny .update-message{border-right:0;padding-right:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
bp-core/admin/css/common.css CHANGED
@@ -47,8 +47,7 @@ TABLE OF CONTENTS:
47
right: 0;
48
}
49
50
- .index_page_bp-credits code,
51
- .index_page_bp-about code {
52
background-color: #e0e0e0;
53
color: #636363;
54
font-size: 1em;
@@ -360,12 +359,8 @@ TABLE OF CONTENTS:
360
margin-top: 2em;
361
}
362
363
- .buddypress .bp-changelog {
364
- margin-bottom: 0;
365
- }
366
-
367
.buddypress .bp-changelog-section .changelog-title {
368
- margin-bottom: 0.5em;
369
}
370
371
.buddypress .bp-changelog .title {
@@ -382,10 +377,6 @@ TABLE OF CONTENTS:
382
padding-bottom: 0.5em;
383
width: 100%;
384
}
385
-
386
- .buddypress .bp-three-column .bp-column {
387
- width: 100%;
388
- }
389
}
390
391
@media screen and ( max-width: 360px ) {
47
right: 0;
48
}
49
50
+ .buddypress code {
51
background-color: #e0e0e0;
52
color: #636363;
53
font-size: 1em;
359
margin-top: 2em;
360
}
361
362
.buddypress .bp-changelog-section .changelog-title {
363
+ margin-bottom: 1.5em;
364
}
365
366
.buddypress .bp-changelog .title {
377
padding-bottom: 0.5em;
378
width: 100%;
379
}
380
}
381
382
@media screen and ( max-width: 360px ) {
bp-core/admin/css/common.min.css CHANGED
@@ -1 +1 @@
1
- .bp-badge{color:#d84800;display:inline-block;font:400 150px/1 dashicons!important}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;right:0}.index_page_bp-about code,.index_page_bp-credits code{background-color:#e0e0e0;color:#636363;font-size:1em}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;right:auto}}.buddypress .bp-headline-feature{margin-bottom:2em;margin-top:3em;padding:2em 3em}.buddypress .bp-headline{margin:0 auto;width:45em}.buddypress .bp-headline span.dashicons{background-color:#f1f1f1;color:#d84800;clear:left;font-size:100px;float:left;height:100px;line-height:100px;margin:0 15px 15px 0;text-align:center;width:100px}.buddypress .bp-headline-feature .headline-title{font-size:2.2em;font-weight:300;line-height:2;margin:0 0 1em;text-align:center}.buddypress .bp-headline-feature p{font-size:1.15em;margin:1.15em auto .6em 0}.buddypress .bp-features-section{border-bottom:1px solid #ccc;clear:both;margin-bottom:3em;margin-top:2em;overflow:hidden;padding-bottom:2em}.buddypress .bp-features-section p{font-size:14px;line-height:1.5}.buddypress .bp-features-section img{margin-bottom:20px}.buddypress .bp-features-section span.dashicons{background-color:#fff;border-radius:50%;clear:left;color:#d84800;font-size:50px;float:left;height:80px;line-height:80px;margin:0 15px 15px 0;text-align:center;width:80px}.buddypress .bp-features-section .headline-title{font-size:2em;font-weight:300;line-height:1.5;margin:1em auto 2em;text-align:center}.buddypress .bp-features-section .bp-feature-with-images{border-bottom:1px solid #ccc;margin-bottom:5em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{float:left;margin-bottom:3em;margin-right:4.799999999%;width:47.6%}.buddypress .bp-features-section .bp-feature-imaged.anon,.buddypress .bp-features-section .bp-feature.opposite{margin-right:0}.buddypress .bp-features-section .bp-feature code{font-size:.95em;line-height:1.5}.buddypress .bp-feature:after{clear:both;content:"";margin-bottom:2em}.buddypress .bp-feature-imaged .feature-title{color:#23282d;font-size:1.25em;margin-bottom:.6em;margin-top:0}.buddypress .bp-feature-imaged p{clear:left;font-size:1.1em}.buddypress .bp-feature-imaged img{clear:left}.buddypress .bp-feature .feature-title{font-size:1em;line-height:1.5;margin-bottom:0;margin-left:110px;margin-top:0;text-align:left}.buddypress .bp-feature p{margin-left:110px}.buddypress .bp-changelog-section{clear:both;margin-bottom:3em;margin-top:4em;padding-bottom:0}.buddypress .bp-changelog-section:after{clear:both;content:"";display:table}.buddypress .bp-changelog-section .changelog-title{color:#23282d;font-size:1.25em;line-height:1.5;margin:0 auto 1.5em}.buddypress .bp-two-column div{float:left;margin-right:4.799999999%;position:relative;width:47.6%}.buddypress .bp-three-column .bp-column{float:left;margin-right:5%;position:relative;width:29.95%}.buddypress .bp-three-column .bp-column:nth-of-type(3n),.buddypress .bp-two-column .bp-column:nth-of-type(2n){margin-right:0}.buddypress .bp-changelog{margin-bottom:3em}.buddypress .bp-changelog:after{clear:both;content:"";display:table}.buddypress .bp-changelog .title{font-size:14px;margin-bottom:.75em;margin-top:0}.buddypress .bp-changelog p{margin-bottom:0}.bp-changelog-url{text-align:center}.bp-assets{clear:both;margin-bottom:3em}@media screen and (max-width:782px){.bp-assets,.bp-changelog-section,.bp-features-section,.bp-headline-feature{margin-left:20px;margin-right:20px}.buddypress .bp-headline-feature{padding:0}.buddypress .bp-headline{margin:0;width:97%}.buddypress .bp-features-section{clear:both;margin-bottom:0;margin-top:2em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature-with-images{margin-bottom:2em}.buddypress .bp-features-section .headline-title{margin-bottom:1em}.buddypress .bp-changelog-section .changelog-title{font-size:1.25em;line-height:1.5;margin-bottom:.5em;margin-top:.5em}.buddypress .bp-changelog-section .title,.buddypress .bp-features-section .feature-title{font-size:1.25em;line-height:1.25;margin-top:.6em;text-align:left}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{clear:both;float:left;margin-bottom:1em;margin-top:1em;margin-right:0;padding-right:1em;width:100%}.buddypress .bp-features-section .bp-feature-imaged p{font-size:1em}.buddypress .bp-features-section .bp-feature span{margin-top:.33em}.buddypress .bp-feature.opposite .feature-title,.buddypress .bp-feature.opposite p{float:none}.buddypress .bp-changelog-section{clear:both;margin-bottom:2em;margin-top:2em}.buddypress .bp-changelog{margin-bottom:0}.buddypress .bp-changelog-section .changelog-title{margin-bottom:.5em}.buddypress .bp-changelog .title{font-size:1em}.buddypress .bp-changelog p{margin-bottom:1em}.buddypress .bp-changelog-section .three-col .col,.buddypress .bp-changelog-section .two-col>div{margin-top:0;padding-bottom:.5em;width:100%}.buddypress .bp-three-column .bp-column{width:100%}}@media screen and (max-width:360px){.buddypress .bp-headline{text-align:center}.buddypress .bp-headline span.dashicons{clear:none;font-size:80px;float:none;height:80px;line-height:80px;margin:0 auto;width:80px}.buddypress .bp-features-section .headline-title,.buddypress .bp-headline-feature .headline-title{font-size:1.5em;line-height:1.5;text-align:left}.buddypress .bp-headline-feature .headline-title{margin:1em 0 0}.buddypress .bp-headline-feature p{margin:1.15em auto .6em 0;text-align:left;width:auto}.buddypress .bp-features-section .bp-feature{text-align:center}.buddypress .bp-features-section span.dashicons{float:none}.buddypress .bp-features-section .feature-title,.buddypress .bp-features-section p{margin-left:0;text-align:left}}#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.forums td.plugin-title span:before{content:"\f452"}.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"}#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.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}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}.tools_page_bp-tools .wrap{max-width:950px}.tools_page_bp-tools p{line-height:2}.tools_page_bp-tools fieldset{margin:2em 0 0}.tools_page_bp-tools legend{color:#23282d;font-size:1.3em;font-weight:600;margin:1em 0}.tools_page_bp-tools label{clear:left;display:block;line-height:1.5;margin:0 0 1em;vertical-align:middle}@media screen and (max-width:782px){.tools_page_bp-tools p{line-height:1.5}.tools_page_bp-tools label{margin-bottom:1em;padding-right:25px;text-indent:-33px}.tools_page_bp-tools .checkbox{padding:0 0 0 30px}}#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!important}.bp-badge:before{content:"\f448"}.about-wrap .bp-badge{position:absolute;top:0;right:0}.buddypress code{background-color:#e0e0e0;color:#636363;font-size:1em}@media only screen and (max-width:500px){.about-wrap .bp-badge{position:relative;margin:10px auto;top:auto;right:auto}}.buddypress .bp-headline-feature{margin-bottom:2em;margin-top:3em;padding:2em 3em}.buddypress .bp-headline{margin:0 auto;width:45em}.buddypress .bp-headline span.dashicons{background-color:#f1f1f1;color:#d84800;clear:left;font-size:100px;float:left;height:100px;line-height:100px;margin:0 15px 15px 0;text-align:center;width:100px}.buddypress .bp-headline-feature .headline-title{font-size:2.2em;font-weight:300;line-height:2;margin:0 0 1em;text-align:center}.buddypress .bp-headline-feature p{font-size:1.15em;margin:1.15em auto .6em 0}.buddypress .bp-features-section{border-bottom:1px solid #ccc;clear:both;margin-bottom:3em;margin-top:2em;overflow:hidden;padding-bottom:2em}.buddypress .bp-features-section p{font-size:14px;line-height:1.5}.buddypress .bp-features-section img{margin-bottom:20px}.buddypress .bp-features-section span.dashicons{background-color:#fff;border-radius:50%;clear:left;color:#d84800;font-size:50px;float:left;height:80px;line-height:80px;margin:0 15px 15px 0;text-align:center;width:80px}.buddypress .bp-features-section .headline-title{font-size:2em;font-weight:300;line-height:1.5;margin:1em auto 2em;text-align:center}.buddypress .bp-features-section .bp-feature-with-images{border-bottom:1px solid #ccc;margin-bottom:5em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{float:left;margin-bottom:3em;margin-right:4.799999999%;width:47.6%}.buddypress .bp-features-section .bp-feature-imaged.anon,.buddypress .bp-features-section .bp-feature.opposite{margin-right:0}.buddypress .bp-features-section .bp-feature code{font-size:.95em;line-height:1.5}.buddypress .bp-feature:after{clear:both;content:"";margin-bottom:2em}.buddypress .bp-feature-imaged .feature-title{color:#23282d;font-size:1.25em;margin-bottom:.6em;margin-top:0}.buddypress .bp-feature-imaged p{clear:left;font-size:1.1em}.buddypress .bp-feature-imaged img{clear:left}.buddypress .bp-feature .feature-title{font-size:1em;line-height:1.5;margin-bottom:0;margin-left:110px;margin-top:0;text-align:left}.buddypress .bp-feature p{margin-left:110px}.buddypress .bp-changelog-section{clear:both;margin-bottom:3em;margin-top:4em;padding-bottom:0}.buddypress .bp-changelog-section:after{clear:both;content:"";display:table}.buddypress .bp-changelog-section .changelog-title{color:#23282d;font-size:1.25em;line-height:1.5;margin:0 auto 1.5em}.buddypress .bp-two-column div{float:left;margin-right:4.799999999%;position:relative;width:47.6%}.buddypress .bp-three-column .bp-column{float:left;margin-right:5%;position:relative;width:29.95%}.buddypress .bp-three-column .bp-column:nth-of-type(3n),.buddypress .bp-two-column .bp-column:nth-of-type(2n){margin-right:0}.buddypress .bp-changelog{margin-bottom:3em}.buddypress .bp-changelog:after{clear:both;content:"";display:table}.buddypress .bp-changelog .title{font-size:14px;margin-bottom:.75em;margin-top:0}.buddypress .bp-changelog p{margin-bottom:0}.bp-changelog-url{text-align:center}.bp-assets{clear:both;margin-bottom:3em}@media screen and (max-width:782px){.bp-assets,.bp-changelog-section,.bp-features-section,.bp-headline-feature{margin-left:20px;margin-right:20px}.buddypress .bp-headline-feature{padding:0}.buddypress .bp-headline{margin:0;width:97%}.buddypress .bp-features-section{clear:both;margin-bottom:0;margin-top:2em;padding-bottom:2em}.buddypress .bp-features-section .bp-feature-with-images{margin-bottom:2em}.buddypress .bp-features-section .headline-title{margin-bottom:1em}.buddypress .bp-changelog-section .changelog-title{font-size:1.25em;line-height:1.5;margin-bottom:.5em;margin-top:.5em}.buddypress .bp-changelog-section .title,.buddypress .bp-features-section .feature-title{font-size:1.25em;line-height:1.25;margin-top:.6em;text-align:left}.buddypress .bp-features-section .bp-feature,.buddypress .bp-features-section .bp-feature-imaged{clear:both;float:left;margin-bottom:1em;margin-top:1em;margin-right:0;padding-right:1em;width:100%}.buddypress .bp-features-section .bp-feature-imaged p{font-size:1em}.buddypress .bp-features-section .bp-feature span{margin-top:.33em}.buddypress .bp-feature.opposite .feature-title,.buddypress .bp-feature.opposite p{float:none}.buddypress .bp-changelog-section{clear:both;margin-bottom:2em;margin-top:2em}.buddypress .bp-changelog-section .changelog-title{margin-bottom:1.5em}.buddypress .bp-changelog .title{font-size:1em}.buddypress .bp-changelog p{margin-bottom:1em}.buddypress .bp-changelog-section .three-col .col,.buddypress .bp-changelog-section .two-col>div{margin-top:0;padding-bottom:.5em;width:100%}}@media screen and (max-width:360px){.buddypress .bp-headline{text-align:center}.buddypress .bp-headline span.dashicons{clear:none;font-size:80px;float:none;height:80px;line-height:80px;margin:0 auto;width:80px}.buddypress .bp-features-section .headline-title,.buddypress .bp-headline-feature .headline-title{font-size:1.5em;line-height:1.5;text-align:left}.buddypress .bp-headline-feature .headline-title{margin:1em 0 0}.buddypress .bp-headline-feature p{margin:1.15em auto .6em 0;text-align:left;width:auto}.buddypress .bp-features-section .bp-feature{text-align:center}.buddypress .bp-features-section span.dashicons{float:none}.buddypress .bp-features-section .feature-title,.buddypress .bp-features-section p{margin-left:0;text-align:left}}#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.forums td.plugin-title span:before{content:"\f452"}.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"}#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.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}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}.tools_page_bp-tools .wrap{max-width:950px}.tools_page_bp-tools p{line-height:2}.tools_page_bp-tools fieldset{margin:2em 0 0}.tools_page_bp-tools legend{color:#23282d;font-size:1.3em;font-weight:600;margin:1em 0}.tools_page_bp-tools label{clear:left;display:block;line-height:1.5;margin:0 0 1em;vertical-align:middle}@media screen and (max-width:782px){.tools_page_bp-tools p{line-height:1.5}.tools_page_bp-tools label{margin-bottom:1em;padding-right:25px;text-indent:-33px}.tools_page_bp-tools .checkbox{padding:0 0 0 30px}}#buddypress-update.not-shiny .update-message{border-left:0;padding-left:36px}#buddypress-update.not-shiny .update-message:before{content:"\f534"}
bp-core/admin/images/list-unsubscribe.png ADDED
Binary file
bp-core/admin/images/pending-accounts.png ADDED
Binary file
bp-core/admin/images/twenty-seventeen.png ADDED
Binary file
bp-core/bp-core-attachments.php CHANGED
@@ -265,7 +265,7 @@ function bp_attachments_create_item_type( $type = 'avatar', $args = array() ) {
265
}
266
267
// Make sure the file path is safe.
268
- if ( 1 === validate_file( $r['image'] ) ) {
269
return false;
270
}
271
@@ -447,7 +447,7 @@ function bp_attachments_get_attachment( $data = 'url', $args = array() ) {
447
$type_subdir = $r['object_dir'] . '/' . $r['item_id'] . '/' . $r['type'];
448
$type_dir = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $type_subdir;
449
450
- if ( 1 === validate_file( $type_dir ) || ! is_dir( $type_dir ) ) {
451
return $attachment_data;
452
}
453
@@ -1314,7 +1314,7 @@ function bp_attachments_cover_image_ajax_upload() {
1314
$cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
1315
$cover_dir = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $cover_subdir;
1316
1317
- if ( 1 === validate_file( $cover_dir ) || ! is_dir( $cover_dir ) ) {
1318
// Upload error response.
1319
bp_attachments_json_response( false, $is_html4, array(
1320
'type' => 'upload_error',
@@ -1396,34 +1396,33 @@ function bp_attachments_cover_image_ajax_delete() {
1396
wp_send_json_error();
1397
}
1398
1399
- if ( empty( $_POST['object'] ) || empty( $_POST['item_id'] ) ) {
1400
wp_send_json_error();
1401
}
1402
1403
- $args = array(
1404
- 'object' => sanitize_text_field( $_POST['object'] ),
1405
- 'item_id' => (int) $_POST['item_id'],
1406
- );
1407
-
1408
- // Check permissions.
1409
check_admin_referer( 'bp_delete_cover_image', 'nonce' );
1410
- if ( ! bp_attachments_current_user_can( 'edit_cover_image', $args ) ) {
1411
wp_send_json_error();
1412
}
1413
1414
// Set object for the user's case.
1415
- if ( 'user' === $args['object'] ) {
1416
$component = 'xprofile';
1417
$dir = 'members';
1418
1419
// Set it for any other cases.
1420
} else {
1421
- $component = $args['object'] . 's';
1422
$dir = $component;
1423
}
1424
1425
// Handle delete.
1426
- if ( bp_attachments_delete_file( array( 'item_id' => $args['item_id'], 'object_dir' => $dir, 'type' => 'cover-image' ) ) ) {
1427
/**
1428
* Fires if the cover image was successfully deleted.
1429
*
@@ -1436,7 +1435,7 @@ function bp_attachments_cover_image_ajax_delete() {
1436
*
1437
* @param int $item_id Inform about the item id the cover image was deleted for.
1438
*/
1439
- do_action( "{$component}_cover_image_deleted", (int) $args['item_id'] );
1440
1441
// Defaults no cover image.
1442
$response = array(
265
}
266
267
// Make sure the file path is safe.
268
+ if ( 0 !== validate_file( $r['image'] ) ) {
269
return false;
270
}
271
447
$type_subdir = $r['object_dir'] . '/' . $r['item_id'] . '/' . $r['type'];
448
$type_dir = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $type_subdir;
449
450
+ if ( ! is_dir( $type_dir ) ) {
451
return $attachment_data;
452
}
453
1314
$cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
1315
$cover_dir = trailingslashit( $bp_attachments_uploads_dir['basedir'] ) . $cover_subdir;
1316
1317
+ if ( ! is_dir( $cover_dir ) ) {
1318
// Upload error response.
1319
bp_attachments_json_response( false, $is_html4, array(
1320
'type' => 'upload_error',
1396
wp_send_json_error();
1397
}
1398
1399
+ $cover_image_data = $_POST;
1400
+
1401
+ if ( empty( $cover_image_data['object'] ) || empty( $cover_image_data['item_id'] ) ) {
1402
wp_send_json_error();
1403
}
1404
1405
+ // Check the nonce.
1406
check_admin_referer( 'bp_delete_cover_image', 'nonce' );
1407
+
1408
+ // Capability check.
1409
+ if ( ! bp_attachments_current_user_can( 'edit_cover_image', $cover_image_data ) ) {
1410
wp_send_json_error();
1411
}
1412
1413
// Set object for the user's case.
1414
+ if ( 'user' === $cover_image_data['object'] ) {
1415
$component = 'xprofile';
1416
$dir = 'members';
1417
1418
// Set it for any other cases.
1419
} else {
1420
+ $component = $cover_image_data['object'] . 's';
1421
$dir = $component;
1422
}
1423
1424
// Handle delete.
1425
+ if ( bp_attachments_delete_file( array( 'item_id' => $cover_image_data['item_id'], 'object_dir' => $dir, 'type' => 'cover-image' ) ) ) {
1426
/**
1427
* Fires if the cover image was successfully deleted.
1428
*
1435
*
1436
* @param int $item_id Inform about the item id the cover image was deleted for.
1437
*/
1438
+ do_action( "{$component}_cover_image_deleted", (int) $cover_image_data['item_id'] );
1439
1440
// Defaults no cover image.
1441
$response = array(
bp-core/bp-core-avatars.php CHANGED
@@ -1400,11 +1400,6 @@ function bp_core_get_avatar_data_url_filter( $retval, $id_or_email, $args ) {
1400
$args['item_id'] = $user->ID;
1401
$args['html'] = false;
1402
1403
- // Use the 'full' type if size is larger than BP's thumb width.
1404
- if ( (int) $args['size'] > bp_core_avatar_thumb_width() ) {
1405
- $args['type'] = 'full';
1406
- }
1407
-
1408
// Get the BuddyPress avatar URL.
1409
if ( $bp_avatar = bp_core_fetch_avatar( $args ) ) {
1410
return $bp_avatar;
1400
$args['item_id'] = $user->ID;
1401
$args['html'] = false;
1402
1403
// Get the BuddyPress avatar URL.
1404
if ( $bp_avatar = bp_core_fetch_avatar( $args ) ) {
1405
return $bp_avatar;
bp-core/bp-core-filters.php CHANGED
@@ -1011,14 +1011,13 @@ function bp_email_set_default_headers( $headers, $property, $transform, $email )
1011
if ( ! empty( $tokens['unsubscribe'] ) && $tokens['unsubscribe'] !== site_url( 'wp-login.php' ) ) {
1012
$user = get_user_by( 'email', $tokens['recipient.email'] );
1013
1014
- $link = bp_email_get_unsubscribe_link( array(
1015
- 'user_id' => $user->ID,
1016
- 'notification_type' => $email->get( 'type' ),
1017
- ) );
1018
-
1019
- if ( ! empty( $link ) ) {
1020
- $headers['List-Unsubscribe'] = sprintf( '<%s>', esc_url_raw( $link ) );
1021
- }
1022
}
1023
1024
return $headers;
1011
if ( ! empty( $tokens['unsubscribe'] ) && $tokens['unsubscribe'] !== site_url( 'wp-login.php' ) ) {
1012
$user = get_user_by( 'email', $tokens['recipient.email'] );
1013
1014
+ $headers['List-Unsubscribe'] = sprintf(
1015
+ '<%s>',
1016
+ esc_url_raw( bp_email_get_unsubscribe_link( array(
1017
+ 'user_id' => $user->ID,
1018
+ 'notification_type' => $email->get( 'type' ),
1019
+ ) ) )
1020
+ );
1021
}
1022
1023
return $headers;
bp-core/classes/class-bp-admin.php CHANGED
@@ -624,7 +624,12 @@ class BP_Admin {
624
625
<div class="bp-feature opposite">
626
<span class="dashicons dashicons-admin-users" aria-hidden="true"></span>
627
- <h4 class="feature-title"><?php esc_html_e( 'Improve accessibility of Extended Profile Fields', 'buddypress' ); ?></h4>
628
<p><?php esc_html_e( 'Related form fields are grouped together in fieldsets and all interactive form controls are associated with necessary ARIA states and properties.', 'buddypress' ); ?></p>
629
</div>
630
@@ -637,8 +642,12 @@ class BP_Admin {
637
<div class="bp-feature opposite">
638
<span class="dashicons dashicons-testimonial" aria-hidden="true"></span>
639
<h4 class="feature-title"><?php esc_html_e( 'Tooltips Usable for All Devices', 'buddypress' ); ?></h4>
640
-
641
- <p><?php esc_html_e( 'Replaced HTML title attributes with tooltips which provide additional information and visual cues where needed on mouse hover and keyboard focus events.', 'buddypress' );
642
?></p>
643
</div>
644
624
625
<div class="bp-feature opposite">
626
<span class="dashicons dashicons-admin-users" aria-hidden="true"></span>
627
+ <h4 class="feature-title"><?php
628
+ /* translators: %s: 1: accessibility, 2: extended profile */
629
+ printf( __( 'Improve %1$s of %2$s Fields', 'buddypress' ),
630
+ '<code>a11y</code>',
631
+ '<code>Extended Profile</code>' );
632
+ ?></h4>
633
<p><?php esc_html_e( 'Related form fields are grouped together in fieldsets and all interactive form controls are associated with necessary ARIA states and properties.', 'buddypress' ); ?></p>
634
</div>
635
642
<div class="bp-feature opposite">
643
<span class="dashicons dashicons-testimonial" aria-hidden="true"></span>
644
<h4 class="feature-title"><?php esc_html_e( 'Tooltips Usable for All Devices', 'buddypress' ); ?></h4>
645
+ <p><?php
646
+ /* translators: 1: title attribute, 2: :hover, 3: :focus */
647
+ printf( __( 'Replaced %1$s attributes with tooltips which provide additional information and visual cues where needed on mouse %2$s and keyboard %3$s.', 'buddypress' ),
648
+ '<code>title</code>',
649
+ '<code>:hover</code>',
650
+ '<code>:focus</code>' );
651
?></p>
652
</div>
653
bp-core/classes/class-bp-attachment-cover-image.php CHANGED
@@ -1,291 +1,291 @@
1
- <?php
2
- /**
3
- * Core Cover Image attachment class.
4
- *
5
- * @package BuddyPress
6
- * @subpackage Core
7
- * @since 2.4.0
8
- */
9
-
10
- // Exit if accessed directly.
11
- defined( 'ABSPATH' ) || exit;
12
-
13
- /**
14
- * BP Attachment Cover Image class.
15
- *
16
- * Extends BP Attachment to manage the cover images uploads.
17
- *
18
- * @since 2.4.0
19
- */
20
- class BP_Attachment_Cover_Image extends BP_Attachment {
21
- /**
22
- * The constuctor.
23
- *
24
- * @since 2.4.0
25
- */
26
- public function __construct() {
27
- // Allowed cover image types & upload size.
28
- $allowed_types = bp_attachments_get_allowed_types( 'cover_image' );
29
- $max_upload_file_size = bp_attachments_get_max_upload_file_size( 'cover_image' );
30
-
31
- parent::__construct( array(
32
- 'action' => 'bp_cover_image_upload',
33
- 'file_input' => 'file',
34
- 'original_max_filesize' => $max_upload_file_size,
35
- 'base_dir' => bp_attachments_uploads_dir_get( 'dir' ),
36
- 'required_wp_files' => array( 'file', 'image' ),
37
-
38
- // Specific errors for cover images.
39
- 'upload_error_strings' => array(
40
- 11 => sprintf( __( 'That image is too big. Please upload one smaller than %s', 'buddypress' ), size_format( $max_upload_file_size ) ),
41
- 12 => sprintf( _n( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'buddypress' ), self::get_cover_image_types( $allowed_types ) ),
42
- ),
43
- ) );
44
- }
45
-
46
- /**
47
- * Gets the available cover image types.
48
- *
49
- * @since 2.4.0
50
- *
51
- * @param array $allowed_types Array of allowed cover image types.
52
- * @return string $value Comma-separated list of allowed cover image types.
53
- */
54
- public static function get_cover_image_types( $allowed_types = array() ) {
55
- $types = array_map( 'strtoupper', $allowed_types );
56
- $comma = _x( ',', 'cover image types separator', 'buddypress' );
57
- return join( $comma . ' ', $types );
58
- }
59
-
60
- /**
61
- * Cover image specific rules.
62
- *
63
- * Adds an error if the cover image size or type don't match BuddyPress needs.
64
- * The error code is the index of $upload_error_strings.
65
- *
66
- * @since 2.4.0
67
- *
68
- * @param array $file The temporary file attributes (before it has been moved).
69
- * @return array $file The file with extra errors if needed.
70
- */
71
- public function validate_upload( $file = array() ) {
72
- // Bail if already an error.
73
- if ( ! empty( $file['error'] ) ) {
74
- return $file;
75
- }
76
-
77
- // File size is too big.
78
- if ( $file['size'] > $this->original_max_filesize ) {
79
- $file['error'] = 11;
80
-
81
- // File is of invalid type.
82
- } elseif ( ! bp_attachments_check_filetype( $file['tmp_name'], $file['name'], bp_attachments_get_allowed_mimes( 'cover_image' ) ) ) {
83
- $file['error'] = 12;
84
- }
85
-
86
- // Return with error code attached.
87
- return $file;
88
- }
89
-
90
- /**
91
- * Set the directory when uploading a file.
92
- *
93
- * @since 2.4.0
94
- *
95
- * @param array $upload_dir The original Uploads dir.
96
- * @return array $value Upload data (path, url, basedir...).
97
- */
98
- public function upload_dir_filter( $upload_dir = array() ) {
99
- // Default values are for profiles.
100
- $object_id = bp_displayed_user_id();
101
-
102
- if ( empty( $object_id ) ) {
103
- $object_id = bp_loggedin_user_id();
104
- }
105
-
106
- $object_directory = 'members';
107
-
108
- // We're in a group, edit default values.
109
- if ( bp_is_group() || bp_is_group_create() ) {
110
- $object_id = bp_get_current_group_id();
111
- $object_directory = 'groups';
112
- }
113
-
114
- // Set the subdir.
115
- $subdir = '/' . $object_directory . '/' . $object_id . '/cover-image';
116
-
117
- /**
118
- * Filters the cover image upload directory.
119
- *
120
- * @since 2.4.0
121
- *
122
- * @param array $value Array containing the path, URL, and other helpful settings.
123
- * @param array $upload_dir The original Uploads dir.
124
- */
125
- return apply_filters( 'bp_attachments_cover_image_upload_dir', array(
126
- 'path' => $this->upload_path . $subdir,
127
- 'url' => $this->url . $subdir,
128
- 'subdir' => $subdir,
129
- 'basedir' => $this->upload_path,
130
- 'baseurl' => $this->url,
131
- 'error' => false
132
- ), $upload_dir );
133
- }
134
-
135
- /**
136
- * Adjust the cover image to fit with advised width & height.
137
- *
138
- * @since 2.4.0
139
- *
140
- * @param string $file The absolute path to the file.
141
- * @param array $dimensions Array of dimensions for the cover image.
142
- * @return mixed
143
- */
144
- public function fit( $file = '', $dimensions = array() ) {
145
- if ( empty( $dimensions['width'] ) || empty( $dimensions['height'] ) ) {
146
- return false;
147
- }
148
-
149
- // Get image size.
150
- $cover_data = parent::get_image_data( $file );
151
-
152
- // Init the edit args.
153
- $edit_args = array();
154
-
155
- // Do we need to resize the image?
156
- if ( ( isset( $cover_data['width'] ) && $cover_data['width'] > $dimensions['width'] ) ||
157
- ( isset( $cover_data['height'] ) && $cover_data['height'] > $dimensions['height'] ) ) {
158
- $edit_args = array(
159
- 'max_w' => $dimensions['width'],
160
- 'max_h' => $dimensions['height'],
161
- 'crop' => true,
162
- );
163
- }
164
-
165
- // Do we need to rotate the image?
166
- $angles = array(
167
- 3 => 180,
168
- 6 => -90,
169
- 8 => 90,
170
- );
171
-
172
- if ( isset( $cover_data['meta']['orientation'] ) && isset( $angles[ $cover_data['meta']['orientation'] ] ) ) {
173
- $edit_args['rotate'] = $angles[ $cover_data['meta']['orientation'] ];
174
- }
175
-
176
- // No need to edit the avatar, original file will be used.
177
- if ( empty( $edit_args ) ) {
178
- return false;
179
-
180
- // Add the file to the edit arguments.
181
- } else {
182
- $edit_args = array_merge( $edit_args, array( 'file' => $file, 'save' => false ) );
183
- }
184
-
185
- // Get the editor so that we can use a specific save method.
186
- $editor = parent::edit_image( 'cover_image', $edit_args );
187
-
188
- if ( is_wp_error( $editor ) ) {
189
- return $editor;
190
- } elseif ( ! is_a( $editor, 'WP_Image_Editor' ) ) {
191
- return false;
192
- }
193
-
194
- // Save the new image file.
195
- return $editor->save( $this->generate_filename( $file ) );
196
- }
197
-
198
- /**
199
- * Generate a filename for the cover image.
200
- *
201
- * @since 2.4.0
202
- *
203
- * @param string $file The absolute path to the file.
204
- * @return false|string $value The absolute path to the new file name.
205
- */
206
- public function generate_filename( $file = '' ) {
207
- if ( empty( $file ) || ! file_exists( $file ) ) {
208
- return false;
209
- }
210
-
211
- $info = pathinfo( $file );
212
- $ext = strtolower( $info['extension'] );
213
- $name = wp_unique_filename( $info['dirname'], uniqid() . "-bp-cover-image.$ext" );
214
-
215
- return trailingslashit( $info['dirname'] ) . $name;
216
- }
217
-
218
- /**
219
- * Build script datas for the Uploader UI.
220
- *
221
- * @since 2.4.0
222
- *
223
- * @return array The javascript localization data
224
- */
225
- public function script_data() {
226
- // Get default script data.
227
- $script_data = parent::script_data();
228
-
229
- if ( bp_is_user() ) {
230
- $item_id = bp_displayed_user_id();
231
-
232
- $script_data['bp_params'] = array(
233
- 'object' => 'user',
234
- 'item_id' => $item_id,
235
- 'has_cover_image' => bp_attachments_get_user_has_cover_image( $item_id ),
236
- 'nonces' => array(
237
- 'remove' => wp_create_nonce( 'bp_delete_cover_image' ),
238
- ),
239
- );
240
-
241
- // Set feedback messages.
242
- $script_data['feedback_messages'] = array(
243
- 1 => __( 'Your new cover image was uploaded successfully.', 'buddypress' ),
244
- 2 => __( 'There was a problem deleting your cover image. Please try again.', 'buddypress' ),
245
- 3 => __( 'Your cover image was deleted successfully!', 'buddypress' ),
246
- );
247
- } elseif ( bp_is_group() ) {
248
- $item_id = bp_get_current_group_id();
249
-
250
- $script_data['bp_params'] = array(
251
- 'object' => 'group',
252
- 'item_id' => bp_get_current_group_id(),
253
- 'has_cover_image' => bp_attachments_get_group_has_cover_image( $item_id ),
254
- 'nonces' => array(
255
- 'remove' => wp_create_nonce( 'bp_delete_cover_image' ),
256
- ),
257
- );
258
-
259
- // Set feedback messages.
260
- $script_data['feedback_messages'] = array(
261
- 1 => __( 'The group cover image was uploaded successfully.', 'buddypress' ),
262
- 2 => __( 'There was a problem deleting the group cover image. Please try again.', 'buddypress' ),
263
- 3 => __( 'The group cover image was deleted successfully!', 'buddypress' ),
264
- );
265
- } else {
266
-
267
- /**
268
- * Filters the cover image params to include specific BuddyPress params for your object.
269
- * e.g. Cover image for blogs single item.
270
- *
271
- * @since 2.4.0
272
- *
273
- * @param array $value The cover image specific BuddyPress parameters.
274
- */
275
- $script_data['bp_params'] = apply_filters( 'bp_attachment_cover_image_params', array() );
276
- }
277
-
278
- // Include our specific js & css.
279
- $script_data['extra_js'] = array( 'bp-cover-image' );
280
- $script_data['extra_css'] = array( 'bp-avatar' );
281
-
282
- /**
283
- * Filters the cover image script data.
284
- *
285
- * @since 2.4.0
286
- *
287
- * @param array $script_data Array of data for the cover image.
288
- */
289
- return apply_filters( 'bp_attachments_cover_image_script_data', $script_data );
290
- }
291
- }
1
+ <?php
2
+ /**
3
+ * Core Cover Image attachment class.
4
+ *
5
+ * @package BuddyPress
6
+ * @subpackage Core
7
+ * @since 2.4.0
8
+ */
9
+
10
+ // Exit if accessed directly.
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ /**
14
+ * BP Attachment Cover Image class.
15
+ *
16
+ * Extends BP Attachment to manage the cover images uploads.
17
+ *
18
+ * @since 2.4.0
19
+ */
20
+ class BP_Attachment_Cover_Image extends BP_Attachment {
21
+ /**
22
+ * The constuctor.
23
+ *
24
+ * @since 2.4.0
25
+ */
26
+ public function __construct() {
27
+ // Allowed cover image types & upload size.
28
+ $allowed_types = bp_attachments_get_allowed_types( 'cover_image' );
29
+ $max_upload_file_size = bp_attachments_get_max_upload_file_size( 'cover_image' );
30
+
31
+ parent::__construct( array(
32
+ 'action' => 'bp_cover_image_upload',
33
+ 'file_input' => 'file',
34
+ 'original_max_filesize' => $max_upload_file_size,
35
+ 'base_dir' => bp_attachments_uploads_dir_get( 'dir' ),
36
+ 'required_wp_files' => array( 'file', 'image' ),
37
+
38
+ // Specific errors for cover images.
39
+ 'upload_error_strings' => array(
40
+ 11 => sprintf( __( 'That image is too big. Please upload one smaller than %s', 'buddypress' ), size_format( $max_upload_file_size ) ),
41
+ 12 => sprintf( _n( 'Please upload only this file type: %s.', 'Please upload only these file types: %s.', count( $allowed_types ), 'buddypress' ), self::get_cover_image_types( $allowed_types ) ),
42
+ ),
43
+ ) );
44
+ }
45
+
46
+ /**
47
+ * Gets the available cover image types.
48
+ *
49
+ * @since 2.4.0
50
+ *
51
+ * @param array $allowed_types Array of allowed cover image types.
52
+ * @return string $value Comma-separated list of allowed cover image types.
53
+ */
54
+ public static function get_cover_image_types( $allowed_types = array() ) {
55
+ $types = array_map( 'strtoupper', $allowed_types );
56
+ $comma = _x( ',', 'cover image types separator', 'buddypress' );
57
+ return join( $comma . ' ', $types );
58
+ }
59
+
60
+ /**
61
+ * Cover image specific rules.
62
+ *
63
+ * Adds an error if the cover image size or type don't match BuddyPress needs.
64
+ * The error code is the index of $upload_error_strings.
65
+ *
66
+ * @since 2.4.0
67
+ *
68
+ * @param array $file The temporary file attributes (before it has been moved).
69
+ * @return array $file The file with extra errors if needed.
70
+ */
71
+ public function validate_upload( $file = array() ) {
72
+ // Bail if already an error.
73
+ if ( ! empty( $file['error'] ) ) {
74
+ return $file;
75
+ }
76
+
77
+ // File size is too big.
78
+ if ( $file['size'] > $this->original_max_filesize ) {
79
+ $file['error'] = 11;
80
+
81
+ // File is of invalid type.
82
+ } elseif ( ! bp_attachments_check_filetype( $file['tmp_name'], $file['name'], bp_attachments_get_allowed_mimes( 'cover_image' ) ) ) {
83
+ $file['error'] = 12;
84
+ }
85
+
86
+ // Return with error code attached.
87
+ return $file;
88
+ }
89
+
90
+ /**
91
+ * Set the directory when uploading a file.
92
+ *
93
+ * @since 2.4.0
94
+ *
95
+ * @param array $upload_dir The original Uploads dir.
96
+ * @return array $value Upload data (path, url, basedir...).
97
+ */
98
+ public function upload_dir_filter( $upload_dir = array() ) {
99
+ // Default values are for profiles.
100
+ $object_id = bp_displayed_user_id();
101
+
102
+ if ( empty( $object_id ) ) {
103
+ $object_id = bp_loggedin_user_id();
104
+ }
105
+
106
+ $object_directory = 'members';
107
+
108
+ // We're in a group, edit default values.
109
+ if ( bp_is_group() || bp_is_group_create() ) {
110
+ $object_id = bp_get_current_group_id();
111
+ $object_directory = 'groups';
112
+ }
113
+
114
+ // Set the subdir.
115
+ $subdir = '/' . $object_directory . '/' . $object_id . '/cover-image';
116
+
117
+ /**
118
+ * Filters the cover image upload directory.
119
+ *
120
+ * @since 2.4.0
121
+ *
122
+ * @param array $value Array containing the path, URL, and other helpful settings.
123
+ * @param array $upload_dir The original Uploads dir.
124
+ */
125
+ return apply_filters( 'bp_attachments_cover_image_upload_dir', array(
126
+ 'path' => $this->upload_path . $subdir,
127
+ 'url' => $this->url . $subdir,
128
+ 'subdir' => $subdir,
129
+ 'basedir' => $this->upload_path,
130
+ 'baseurl' => $this->url,
131
+ 'error' => false
132
+ ), $upload_dir );
133
+ }
134
+
135
+ /**
136
+ * Adjust the cover image to fit with advised width & height.
137
+ *
138
+ * @since 2.4.0
139
+ *
140
+ * @param string $file The absolute path to the file.
141
+ * @param array $dimensions Array of dimensions for the cover image.
142
+ * @return mixed
143
+ */
144
+ public function fit( $file = '', $dimensions = array() ) {
145
+ if ( empty( $dimensions['width'] ) || empty( $dimensions['height'] ) ) {
146
+ return false;
147
+ }
148
+
149
+ // Get image size.
150
+ $cover_data = parent::get_image_data( $file );
151
+
152
+ // Init the edit args.
153
+ $edit_args = array();
154
+
155
+ // Do we need to resize the image?
156
+ if ( ( isset( $cover_data['width'] ) && $cover_data['width'] > $dimensions['width'] ) ||
157
+ ( isset( $cover_data['height'] ) && $cover_data['height'] > $dimensions['height'] ) ) {
158
+ $edit_args = array(
159
+ 'max_w' => $dimensions['width'],
160
+ 'max_h' => $dimensions['height'],
161
+ 'crop' => true,
162
+ );
163
+ }
164
+
165
+ // Do we need to rotate the image?
166
+ $angles = array(
167
+ 3 => 180,
168
+ 6 => -90,
169
+ 8 => 90,
170
+ );
171
+
172
+ if ( isset( $cover_data['meta']['orientation'] ) && isset( $angles[ $cover_data['meta']['orientation'] ] ) ) {
173
+ $edit_args['rotate'] = $angles[ $cover_data['meta']['orientation'] ];
174
+ }
175
+
176
+ // No need to edit the avatar, original file will be used.
177
+ if ( empty( $edit_args ) ) {
178
+ return false;
179
+
180
+ // Add the file to the edit arguments.
181
+ } else {
182
+ $edit_args = array_merge( $edit_args, array( 'file' => $file, 'save' => false ) );
183
+ }
184
+
185
+ // Get the editor so that we can use a specific save method.
186
+ $editor = parent::edit_image( 'cover_image', $edit_args );
187
+
188
+ if ( is_wp_error( $editor ) ) {
189
+ return $editor;
190
+ } elseif ( ! is_a( $editor, 'WP_Image_Editor' ) ) {
191
+ return false;
192
+ }
193
+
194
+ // Save the new image file.
195
+ return $editor->save( $this->generate_filename( $file ) );
196
+ }
197
+
198
+ /**
199
+ * Generate a filename for the cover image.
200
+ *
201
+ * @since 2.4.0
202
+ *
203
+ * @param string $file The absolute path to the file.
204
+ * @return false|string $value The absolute path to the new file name.
205
+ */
206
+ public function generate_filename( $file = '' ) {
207
+ if ( empty( $file ) || ! file_exists( $file ) ) {
208
+ return false;
209
+ }
210
+
211
+ $info = pathinfo( $file );
212
+ $ext = strtolower( $info['extension'] );
213
+ $name = wp_unique_filename( $info['dirname'], uniqid() . "-bp-cover-image.$ext" );
214
+
215
+ return trailingslashit( $info['dirname'] ) . $name;
216
+ }
217
+
218
+ /**
219
+ * Build script datas for the Uploader UI.
220
+ *
221
+ * @since 2.4.0
222
+ *
223
+ * @return array The javascript localization data
224
+ */
225
+ public function script_data() {
226
+ // Get default script data.
227
+ $script_data = parent::script_data();
228
+
229
+ if ( bp_is_user() ) {
230
+ $item_id = bp_displayed_user_id();
231
+
232
+ $script_data['bp_params'] = array(
233
+ 'object' => 'user',
234
+ 'item_id' => $item_id,
235
+ 'has_cover_image' => bp_attachments_get_user_has_cover_image( $item_id ),
236
+ 'nonces' => array(
237
+ 'remove' => wp_create_nonce( 'bp_delete_cover_image' ),
238
+ ),
239
+ );
240
+
241
+ // Set feedback messages.
242
+ $script_data['feedback_messages'] = array(
243
+ 1 => __( 'Your new cover image was uploaded successfully.', 'buddypress' ),
244
+ 2 => __( 'There was a problem deleting your cover image. Please try again.', 'buddypress' ),
245
+ 3 => __( 'Your cover image was deleted successfully!', 'buddypress' ),
246
+ );
247
+ } elseif ( bp_is_group() ) {
248
+ $item_id = bp_get_current_group_id();
249
+
250
+ $script_data['bp_params'] = array(
251
+ 'object' => 'group',
252
+ 'item_id' => bp_get_current_group_id(),
253
+ 'has_cover_image' => bp_attachments_get_group_has_cover_image( $item_id ),
254
+ 'nonces' => array(
255
+ 'remove' => wp_create_nonce( 'bp_delete_cover_image' ),
256
+ ),
257
+ );
258
+
259
+ // Set feedback messages.
260
+ $script_data['feedback_messages'] = array(
261
+ 1 => __( 'The group cover image was uploaded successfully.', 'buddypress' ),
262
+ 2 => __( 'There was a problem deleting the group cover image. Please try again.', 'buddypress' ),
263
+ 3 => __( 'The group cover image was deleted successfully!', 'buddypress' ),
264
+ );
265
+ } else {
266
+
267
+ /**
268
+ * Filters the cover image params to include specific BuddyPress params for your object.
269
+ * e.g. Cover image for blogs single item.
270
+ *
271
+ * @since 2.4.0
272
+ *
273
+ * @param array $value The cover image specific BuddyPress parameters.
274
+ */
275
+ $script_data['bp_params'] = apply_filters( 'bp_attachment_cover_image_params', array() );
276
+ }
277
+
278
+ // Include our specific js & css.
279
+ $script_data['extra_js'] = array( 'bp-cover-image' );
280
+ $script_data['extra_css'] = array( 'bp-avatar' );
281
+
282
+ /**
283
+ * Filters the cover image script data.
284
+ *
285
+ * @since 2.4.0
286
+ *
287
+ * @param array $script_data Array of data for the cover image.
288
+ */
289
+ return apply_filters( 'bp_attachments_cover_image_script_data', $script_data );
290
+ }
291
+ }
bp-core/deprecated/1.6.php CHANGED
@@ -265,13 +265,8 @@ if ( !function_exists( 'bp_dtheme_register_actions' ) ) :
265
266
// For each of the problematic hooks, exit at the very end of execution
267
foreach( $actions as $action ) {
268
- add_action( 'wp_ajax_' . $action, function() {
269
- exit;
270
- }, 9999 );
271
-
272
- add_action( 'wp_ajax_nopriv_' . $action, function() {
273
- exit;
274
- }, 9999 );
275
}
276
}
277
add_action( 'after_setup_theme', 'bp_die_legacy_ajax_callbacks', 20 );
265
266
// For each of the problematic hooks, exit at the very end of execution
267
foreach( $actions as $action ) {
268
+ add_action( 'wp_ajax_' . $action, create_function( '', 'exit;' ), 9999 );
269
+ add_action( 'wp_ajax_nopriv_' . $action, create_function( '', 'exit;' ), 9999 );
270
}
271
}
272
add_action( 'after_setup_theme', 'bp_die_legacy_ajax_callbacks', 20 );
bp-core/js/bp-plupload.js CHANGED
@@ -275,7 +275,7 @@ window.bp = window.bp || {};
275
'IO_ERROR': self.strings.io_error,
276
'HTTP_ERROR': self.strings.http_error,
277
'SECURITY_ERROR': self.strings.security_error,
278
- 'FILE_SIZE_ERROR': self.strings.file_exceeds_size_limit.replace( '%s' , $( '<span />' ).text( pluploadError.file.name ).html() )
279
};
280
281
// Check for plupload errors.
275
'IO_ERROR': self.strings.io_error,
276
'HTTP_ERROR': self.strings.http_error,
277
'SECURITY_ERROR': self.strings.security_error,
278
+ 'FILE_SIZE_ERROR': self.strings.file_exceeds_size_limit.replace( '%s' , pluploadError.file.name )
279
};
280
281
// Check for plupload errors.
bp-core/js/bp-plupload.min.js CHANGED
@@ -1 +1 @@
1
- window.wp=window.wp||{},window.bp=window.bp||{},function(e,i){"undefined"!=typeof BP_Uploader&&(_.extend(bp,_.pick(wp,"Backbone","ajax","template")),bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Uploader={},bp.Uploader.uploader=function(){var e=this,t=-1!==navigator.userAgent.indexOf("Trident/")||-1!==navigator.userAgent.indexOf("MSIE ");this.params=BP_Uploader.settings,this.strings=BP_Uploader.strings,this.supports={upload:this.params.browser.supported},this.supported=this.supports.upload,this.supported?(t||"flash"!==plupload.predictRuntime(this.params.defaults)||this.params.defaults.required_features&&this.params.defaults.required_features.hasOwnProperty("send_binary_string")||(this.params.defaults.required_features=this.params.defaults.required_features||{},this.params.defaults.required_features.send_binary_string=!0),this.uploader=new plupload.Uploader(this.params.defaults),this.uploader.bind("Init",function(t){var s=i("#"+e.params.defaults.container),a=i("#"+e.params.defaults.drop_element);"html4"===t.runtime&&(t.settings.multipart_params.html4=!0),"bp_avatar_upload"===t.settings.multipart_params.action&&(t.settings.multipart_params.bp_params.ui_available_width=s.width()),t.features.dragdrop&&!e.params.browser.mobile?(s.addClass("drag-drop"),a.bind("dragover.wp-uploader",function(){s.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){s.removeClass("drag-over")})):(s.removeClass("drag-drop"),a.unbind(".wp-uploader"))}),this.uploader.bind("postinit",function(e){e.refresh()}),this.uploader.init(),this.feedback=function(e,i,t){!_.isNull(t)&&t.item&&t.item.clear(),bp.Uploader.filesError.unshift({message:e,data:i,file:t})},this.uploader.bind("FilesAdded",function(t,s){var a=parseInt(t.settings.max_file_size,10),r=this;if(!t.settings.multi_selection&&s.length>1){for(var n in s)t.removeFile(s[n]);i(e).trigger("bp-uploader-warning",e.strings.unique_file_warning)}else _.each(s,function(e){var i;plupload.FAILED!==e.status&&(a>104857600&&e.size>104857600&&"html5"!==t.runtime?r.uploadSizeError(t,e,!0):(i=_.extend({id:e.id,file:e,uploading:!0,date:new Date,filename:e.name},_.pick(e,"loaded","size","percent")),e.item=new bp.Models.File(i),bp.Uploader.filesQueue.add(e.item)))}),t.refresh(),t.start()}),this.uploader.bind("UploadProgress",function(e,i){i.item.set(_.pick(i,"loaded","percent"))}),this.uploader.bind("FileUploaded",function(i,t,s){var a=e.strings.default_error;try{s=JSON.parse(s.response)}catch(i){return e.feedback(a,i,t)}return!_.isObject(s)||_.isUndefined(s.success)?e.feedback(a,null,t):s.success?(_.each(["file","loaded","size","percent"],function(e){t.item.unset(e)}),t.item.set(_.extend(s.data,{uploading:!1})),void bp.Uploader.filesUploaded.add(t.item)):(s.data&&s.data.message&&(a=s.data.message),e.feedback(a,s.data,t))}),this.uploader.bind("BeforeUpload",function(t,s){i(e).trigger("bp-uploader-new-upload",t,s)}),this.uploader.bind("UploadComplete",function(t,s){i(e).trigger("bp-uploader-upload-complete",t,s),bp.Uploader.filesQueue.reset()}),this.uploader.bind("Error",function(t,s){var a,r=e.strings.default_error,n={FAILED:e.strings.upload_failed,FILE_EXTENSION_ERROR:e.strings.invalid_filetype,IMAGE_FORMAT_ERROR:e.strings.not_an_image,IMAGE_MEMORY_ERROR:e.strings.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:e.strings.image_dimensions_exceeded,GENERIC_ERROR:e.strings.upload_failed,IO_ERROR:e.strings.io_error,HTTP_ERROR:e.strings.http_error,SECURITY_ERROR:e.strings.security_error,FILE_SIZE_ERROR:e.strings.file_exceeds_size_limit.replace("%s",i("<span />").text(s.file.name).html())};for(a in n)if(s.code===plupload[a]){r=n[a];break}i(e).trigger("bp-uploader-warning",r),t.refresh()})):BP_Uploader=void 0},bp.Models.File=Backbone.Model.extend({file:{}}),i.extend(bp.Uploader,{filesQueue:new Backbone.Collection,filesUploaded:new Backbone.Collection,filesError:new Backbone.Collection}),bp.View=bp.Backbone.View.extend({inject:function(e){this.render(),i(e).html(this.el),this.views.ready()},prepare:function(){return!_.isUndefined(this.model)&&_.isFunction(this.model.toJSON)?this.model.toJSON():{}}}),bp.Views.Uploader=bp.View.extend({className:"bp-uploader-window",template:bp.template("upload-window"),defaults:_.pick(BP_Uploader.settings.defaults,"container","drop_element","browse_button"),initialize:function(){this.warnings=[],this.model=new Backbone.Model(this.defaults),this.on("ready",this.initUploader)},initUploader:function(){this.uploader=new bp.Uploader.uploader,i(this.uploader).on("bp-uploader-warning",_.bind(this.setWarning,this)),i(this.uploader).on("bp-uploader-new-upload",_.bind(this.resetWarning,this))},setWarning:function(e,i){if(!_.isUndefined(i)){var t=new bp.Views.uploaderWarning({value:i}).render();this.warnings.push(t),this.$el.after(t.el)}},resetWarning:function(){0!==this.warnings.length&&(_.each(this.warnings,function(e){e.remove()}),this.warnings=[])}}),bp.Views.uploaderWarning=bp.View.extend({tagName:"p",className:"warning",initialize:function(){this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.uploaderStatus=bp.View.extend({className:"files",initialize:function(){_.each(this.collection.models,this.addFile,this),this.collection.on("change:percent",this.progress,this),bp.Uploader.filesError.on("add",this.feedback,this)},addFile:function(e){this.views.add(new bp.Views.uploaderProgress({model:e}))},progress:function(e){_.isUndefined(e.get("percent"))||i("#"+e.get("id")+" .bp-progress .bp-bar").css("width",e.get("percent")+"%")},feedback:function(e){_.isUndefined(e.get("message"))||_.isUndefined(e.get("file"))||i("#"+e.get("file").id).html(e.get("message")).addClass("error")}}),bp.Views.uploaderProgress=bp.View.extend({className:"bp-uploader-progress",template:bp.template("progress-window")}))}(bp,jQuery);
1
+ window.wp=window.wp||{},window.bp=window.bp||{},function(e,i){"undefined"!=typeof BP_Uploader&&(_.extend(bp,_.pick(wp,"Backbone","ajax","template")),bp.Models=bp.Models||{},bp.Collections=bp.Collections||{},bp.Views=bp.Views||{},bp.Uploader={},bp.Uploader.uploader=function(){var e=this,t=-1!==navigator.userAgent.indexOf("Trident/")||-1!==navigator.userAgent.indexOf("MSIE ");this.params=BP_Uploader.settings,this.strings=BP_Uploader.strings,this.supports={upload:this.params.browser.supported},this.supported=this.supports.upload,this.supported?(t||"flash"!==plupload.predictRuntime(this.params.defaults)||this.params.defaults.required_features&&this.params.defaults.required_features.hasOwnProperty("send_binary_string")||(this.params.defaults.required_features=this.params.defaults.required_features||{},this.params.defaults.required_features.send_binary_string=!0),this.uploader=new plupload.Uploader(this.params.defaults),this.uploader.bind("Init",function(t){var s=i("#"+e.params.defaults.container),a=i("#"+e.params.defaults.drop_element);"html4"===t.runtime&&(t.settings.multipart_params.html4=!0),"bp_avatar_upload"===t.settings.multipart_params.action&&(t.settings.multipart_params.bp_params.ui_available_width=s.width()),t.features.dragdrop&&!e.params.browser.mobile?(s.addClass("drag-drop"),a.bind("dragover.wp-uploader",function(){s.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){s.removeClass("drag-over")})):(s.removeClass("drag-drop"),a.unbind(".wp-uploader"))}),this.uploader.bind("postinit",function(e){e.refresh()}),this.uploader.init(),this.feedback=function(e,i,t){!_.isNull(t)&&t.item&&t.item.clear(),bp.Uploader.filesError.unshift({message:e,data:i,file:t})},this.uploader.bind("FilesAdded",function(t,s){var a=parseInt(t.settings.max_file_size,10),r=this;if(!t.settings.multi_selection&&s.length>1){for(var n in s)t.removeFile(s[n]);i(e).trigger("bp-uploader-warning",e.strings.unique_file_warning)}else _.each(s,function(e){var i;plupload.FAILED!==e.status&&(a>104857600&&e.size>104857600&&"html5"!==t.runtime?r.uploadSizeError(t,e,!0):(i=_.extend({id:e.id,file:e,uploading:!0,date:new Date,filename:e.name},_.pick(e,"loaded","size","percent")),e.item=new bp.Models.File(i),bp.Uploader.filesQueue.add(e.item)))}),t.refresh(),t.start()}),this.uploader.bind("UploadProgress",function(e,i){i.item.set(_.pick(i,"loaded","percent"))}),this.uploader.bind("FileUploaded",function(i,t,s){var a=e.strings.default_error;try{s=JSON.parse(s.response)}catch(i){return e.feedback(a,i,t)}return!_.isObject(s)||_.isUndefined(s.success)?e.feedback(a,null,t):s.success?(_.each(["file","loaded","size","percent"],function(e){t.item.unset(e)}),t.item.set(_.extend(s.data,{uploading:!1})),void bp.Uploader.filesUploaded.add(t.item)):(s.data&&s.data.message&&(a=s.data.message),e.feedback(a,s.data,t))}),this.uploader.bind("BeforeUpload",function(t,s){i(e).trigger("bp-uploader-new-upload",t,s)}),this.uploader.bind("UploadComplete",function(t,s){i(e).trigger("bp-uploader-upload-complete",t,s),bp.Uploader.filesQueue.reset()}),this.uploader.bind("Error",function(t,s){var a,r=e.strings.default_error,n={FAILED:e.strings.upload_failed,FILE_EXTENSION_ERROR:e.strings.invalid_filetype,IMAGE_FORMAT_ERROR:e.strings.not_an_image,IMAGE_MEMORY_ERROR:e.strings.image_memory_exceeded,IMAGE_DIMENSIONS_ERROR:e.strings.image_dimensions_exceeded,GENERIC_ERROR:e.strings.upload_failed,IO_ERROR:e.strings.io_error,HTTP_ERROR:e.strings.http_error,SECURITY_ERROR:e.strings.security_error,FILE_SIZE_ERROR:e.strings.file_exceeds_size_limit.replace("%s",s.file.name)};for(a in n)if(s.code===plupload[a]){r=n[a];break}i(e).trigger("bp-uploader-warning",r),t.refresh()})):BP_Uploader=void 0},bp.Models.File=Backbone.Model.extend({file:{}}),i.extend(bp.Uploader,{filesQueue:new Backbone.Collection,filesUploaded:new Backbone.Collection,filesError:new Backbone.Collection}),bp.View=bp.Backbone.View.extend({inject:function(e){this.render(),i(e).html(this.el),this.views.ready()},prepare:function(){return!_.isUndefined(this.model)&&_.isFunction(this.model.toJSON)?this.model.toJSON():{}}}),bp.Views.Uploader=bp.View.extend({className:"bp-uploader-window",template:bp.template("upload-window"),defaults:_.pick(BP_Uploader.settings.defaults,"container","drop_element","browse_button"),initialize:function(){this.warnings=[],this.model=new Backbone.Model(this.defaults),this.on("ready",this.initUploader)},initUploader:function(){this.uploader=new bp.Uploader.uploader,i(this.uploader).on("bp-uploader-warning",_.bind(this.setWarning,this)),i(this.uploader).on("bp-uploader-new-upload",_.bind(this.resetWarning,this))},setWarning:function(e,i){if(!_.isUndefined(i)){var t=new bp.Views.uploaderWarning({value:i}).render();this.warnings.push(t),this.$el.after(t.el)}},resetWarning:function(){0!==this.warnings.length&&(_.each(this.warnings,function(e){e.remove()}),this.warnings=[])}}),bp.Views.uploaderWarning=bp.View.extend({tagName:"p",className:"warning",initialize:function(){this.value=this.options.value},render:function(){return this.$el.html(this.value),this}}),bp.Views.uploaderStatus=bp.View.extend({className:"files",initialize:function(){_.each(this.collection.models,this.addFile,this),this.collection.on("change:percent",this.progress,this),bp.Uploader.filesError.on("add",this.feedback,this)},addFile:function(e){this.views.add(new bp.Views.uploaderProgress({model:e}))},progress:function(e){_.isUndefined(e.get("percent"))||i("#"+e.get("id")+" .bp-progress .bp-bar").css("width",e.get("percent")+"%")},feedback:function(e){_.isUndefined(e.get("message"))||_.isUndefined(e.get("file"))||i("#"+e.get("file").id).html(e.get("message")).addClass("error")}}),bp.Views.uploaderProgress=bp.View.extend({className:"bp-uploader-progress",template:bp.template("progress-window")}))}(bp,jQuery);
bp-core/js/cover-image.js CHANGED
@@ -1,277 +1,277 @@
1
- /* global bp, BP_Uploader, _, Backbone */
2
-
3
- window.bp = window.bp || {};
4
-
5
- ( function( exports, $ ) {
6
-
7
- // Bail if not set
8
- if ( typeof BP_Uploader === 'undefined' ) {
9
- return;
10
- }
11
-
12
- bp.Models = bp.Models || {};
13
- bp.Collections = bp.Collections || {};
14
- bp.Views = bp.Views || {};
15
-
16
- bp.CoverImage = {
17
- start: function() {
18
-
19
- // Init some vars
20
- this.views = new Backbone.Collection();
21
- this.warning = null;
22
-
23
- // The Cover Image Attachment object.
24
- this.Attachment = new Backbone.Model();
25
-
26
- // Set up views
27
- this.uploaderView();
28
-
29
- // Inform about the needed dimensions
30
- this.displayWarning( BP_Uploader.strings.cover_image_warnings.dimensions );
31
-
32
- // Set up the delete view if needed
33
- if ( true === BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image ) {
34
- this.deleteView();
35
- }
36
- },
37
-
38
- uploaderView: function() {
39
- // Listen to the Queued uploads
40
- bp.Uploader.filesQueue.on( 'add', this.uploadProgress, this );
41
-
42
- // Create the BuddyPress Uploader
43
- var uploader = new bp.Views.Uploader();
44
-
45
- // Add it to views
46
- this.views.add( { id: 'upload', view: uploader } );
47
-
48
- // Display it
49
- uploader.inject( '.bp-cover-image' );
50
- },
51
-
52
- uploadProgress: function() {
53
- // Create the Uploader status view
54
- var coverImageUploadProgress = new bp.Views.coverImageUploadProgress( { collection: bp.Uploader.filesQueue } );
55
-
56
- if ( ! _.isUndefined( this.views.get( 'status' ) ) ) {
57
- this.views.set( { id: 'status', view: coverImageUploadProgress } );
58
- } else {
59
- this.views.add( { id: 'status', view: coverImageUploadProgress } );
60
- }
61
-
62
- // Display it
63
- coverImageUploadProgress.inject( '.bp-cover-image-status' );
64
- },
65
-
66
- deleteView: function() {
67
- // Create the delete model
68
- var delete_model = new Backbone.Model( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
69
- ['object', 'item_id', 'nonces']
70
- ) );
71
-
72
- // Do not add it if already there!
73
- if ( ! _.isUndefined( this.views.get( 'delete' ) ) ) {
74
- return;
75
- }
76
-
77
- // Create the delete view
78
- var deleteView = new bp.Views.DeleteCoverImage( { model: delete_model } );
79
-
80
- // Add it to views
81
- this.views.add( { id: 'delete', view: deleteView } );
82
-
83
- // Display it
84
- deleteView.inject( '.bp-cover-image-manage' );
85
- },
86
-
87
- deleteCoverImage: function( model ) {
88
- var self = this,
89
- deleteView;
90
-
91
- // Remove the delete view
92
- if ( ! _.isUndefined( this.views.get( 'delete' ) ) ) {
93
- deleteView = this.views.get( 'delete' );
94
- deleteView.get( 'view' ).remove();
95
- this.views.remove( { id: 'delete', view: deleteView } );
96
- }
97
-
98
- // Remove the cover image !
99
- bp.ajax.post( 'bp_cover_image_delete', {
100
- json: true,
101
- item_id: model.get( 'item_id' ),
102
- object: model.get( 'object' ),
103
- nonce: model.get( 'nonces' ).remove
104
- } ).done( function( response ) {
105
- var coverImageStatus = new bp.Views.CoverImageStatus( {
106
- value : BP_Uploader.strings.feedback_messages[ response.feedback_code ],
107
- type : 'success'
108
- } );
109
-
110
- self.views.add( {
111
- id : 'status',
112
- view : coverImageStatus
113
- } );
114
-
115
- coverImageStatus.inject( '.bp-cover-image-status' );
116
-
117
- // Reset the header of the page
118
- if ( '' === response.reset_url ) {
119
- $( '#header-cover-image' ).css( {
120
- 'background-image': 'none'
121
- } );
122
- } else {
123
- $( '#header-cover-image' ).css( {
124
- 'background-image': 'url( ' + response.reset_url + ' )'
125
- } );
126
- }
127
-
128
- // Reset the has_cover_image bp_param
129
- BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image = false;
130
-
131
- /**
132
- * Reset the Attachment object
133
- *
134
- * You can run extra actions once the cover image is set using:
135
- * bp.CoverImage.Attachment.on( 'change:url', function( data ) { your code } );
136
- *
137
- * In this case data.attributes will include the default url for the
138
- * cover image (most of the time: ''), the object and the item_id concerned.
139
- */
140
- self.Attachment.set( _.extend(
141
- _.pick( model.attributes, ['object', 'item_id'] ),
142
- { url: response.reset_url, action: 'deleted' }
143
- ) );
144
-
145
- } ).fail( function( response ) {
146
- var feedback = BP_Uploader.strings.default_error;
147
- if ( ! _.isUndefined( response ) ) {
148
- feedback = BP_Uploader.strings.feedback_messages[ response.feedback_code ];
149
- }
150
-
151
- var coverImageStatus = new bp.Views.CoverImageStatus( {
152
- value : feedback,
153
- type : 'error'
154
- } );
155
-
156
- self.views.add( {
157
- id : 'status',
158
- view : coverImageStatus
159
- } );
160
-
161
- coverImageStatus.inject( '.bp-cover-image-status' );
162
-
163
- // Put back the delete view
164
- bp.CoverImage.deleteView();
165
- } );
166
- },
167
-
168
- removeWarning: function() {
169
- if ( ! _.isNull( this.warning ) ) {
170
- this.warning.remove();
171
- }
172
- },
173
-
174
- displayWarning: function( message ) {
175
- this.removeWarning();
176
-
177
- this.warning = new bp.Views.uploaderWarning( {
178
- value: message
179
- } );
180
-
181
- this.warning.inject( '.bp-cover-image-status' );
182
- }
183
- };
184
-
185
- // Custom Uploader Files view
186
- bp.Views.coverImageUploadProgress = bp.Views.uploaderStatus.extend( {
187
- className: 'files',
188
-
189
- initialize: function() {
190
- bp.Views.uploaderStatus.prototype.initialize.apply( this, arguments );
191
-
192
- this.collection.on( 'change:url', this.uploadResult, this );
193
- },
194
-
195
- uploadResult: function( model ) {
196
- var message, type;
197
-
198
- if ( ! _.isUndefined( model.get( 'url' ) ) ) {
199
-
200
- // Image is too small
201
- if ( 0 === model.get( 'feedback_code' ) ) {
202
- message = BP_Uploader.strings.cover_image_warnings.dimensions;
203
- type = 'warning';
204
-
205
- // Success, Rock n roll!
206
- } else {
207
- message = BP_Uploader.strings.feedback_messages[ model.get( 'feedback_code' ) ];
208
- type = 'success';
209
- }
210
-
211
- this.views.set( '.bp-uploader-progress', new bp.Views.CoverImageStatus( {
212
- value : message,
213
- type : type
214
- } ) );
215
-
216
- // Update the header of the page
217
- $( '#header-cover-image' ).css( {
218
- 'background-image': 'url( ' + model.get( 'url' ) + ' )'
219
- } );
220
-
221
- // Add the delete view
222
- bp.CoverImage.deleteView();
223
-
224
- /**
225
- * Set the Attachment object
226
- *
227
- * You can run extra actions once the cover image is set using:
228
- * bp.CoverImage.Attachment.on( 'change:url', function( data ) { your code } );
229
- *
230
- * In this case data.attributes will include the url to the newly
231
- * uploaded cover image, the object and the item_id concerned.
232
- */
233
- bp.CoverImage.Attachment.set( _.extend(
234
- _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params, ['object', 'item_id'] ),
235
- { url: model.get( 'url' ), action: 'uploaded' }
236
- ) );
237
- }
238
- }
239
- } );
240
-
241
- // BuddyPress Cover Image Feedback view
242
- bp.Views.CoverImageStatus = bp.View.extend( {
243
- tagName: 'p',
244
- className: 'updated',
245
- id: 'bp-cover-image-feedback',
246
-
247
- initialize: function() {
248
- this.el.className += ' ' + this.options.type;
249
- this.value = this.options.value;
250
- },
251
-
252
- render: function() {
253
- this.$el.html( this.value );
254
- return this;
255
- }
256
- } );
257
-
258
- // BuddyPress Cover Image Delete view
259
- bp.Views.DeleteCoverImage = bp.View.extend( {
260
- tagName: 'div',
261
- id: 'bp-delete-cover-image-container',
262
- template: bp.template( 'bp-cover-image-delete' ),
263
-
264
- events: {
265
- 'click #bp-delete-cover-image': 'deleteCoverImage'
266
- },
267
-
268
- deleteCoverImage: function( event ) {
269
- event.preventDefault();
270
-
271
- bp.CoverImage.deleteCoverImage( this.model );
272
- }
273
- } );
274
-
275
- bp.CoverImage.start();
276
-
277
- })( bp, jQuery );
1
+ /* global bp, BP_Uploader, _, Backbone */
2
+
3
+ window.bp = window.bp || {};
4
+
5
+ ( function( exports, $ ) {
6
+
7
+ // Bail if not set
8
+ if ( typeof BP_Uploader === 'undefined' ) {
9
+ return;
10
+ }
11
+
12
+ bp.Models = bp.Models || {};
13
+ bp.Collections = bp.Collections || {};
14
+ bp.Views = bp.Views || {};
15
+
16
+ bp.CoverImage = {
17
+ start: function() {
18
+
19
+ // Init some vars
20
+ this.views = new Backbone.Collection();
21
+ this.warning = null;
22
+
23
+ // The Cover Image Attachment object.
24
+ this.Attachment = new Backbone.Model();
25
+
26
+ // Set up views
27
+ this.uploaderView();
28
+
29
+ // Inform about the needed dimensions
30
+ this.displayWarning( BP_Uploader.strings.cover_image_warnings.dimensions );
31
+
32
+ // Set up the delete view if needed
33
+ if ( true === BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image ) {
34
+ this.deleteView();
35
+ }
36
+ },
37
+
38
+ uploaderView: function() {
39
+ // Listen to the Queued uploads
40
+ bp.Uploader.filesQueue.on( 'add', this.uploadProgress, this );
41
+
42
+ // Create the BuddyPress Uploader
43
+ var uploader = new bp.Views.Uploader();
44
+
45
+ // Add it to views
46
+ this.views.add( { id: 'upload', view: uploader } );
47
+
48
+ // Display it
49
+ uploader.inject( '.bp-cover-image' );
50
+ },
51
+
52
+ uploadProgress: function() {
53
+ // Create the Uploader status view
54
+ var coverImageUploadProgress = new bp.Views.coverImageUploadProgress( { collection: bp.Uploader.filesQueue } );
55
+
56
+ if ( ! _.isUndefined( this.views.get( 'status' ) ) ) {
57
+ this.views.set( { id: 'status', view: coverImageUploadProgress } );
58
+ } else {
59
+ this.views.add( { id: 'status', view: coverImageUploadProgress } );
60
+ }
61
+
62
+ // Display it
63
+ coverImageUploadProgress.inject( '.bp-cover-image-status' );
64
+ },
65
+
66
+ deleteView: function() {
67
+ // Create the delete model
68
+ var delete_model = new Backbone.Model( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
69
+ ['object', 'item_id', 'nonces']
70
+ ) );
71
+
72
+ // Do not add it if already there!
73
+ if ( ! _.isUndefined( this.views.get( 'delete' ) ) ) {
74
+ return;
75
+ }
76
+
77
+ // Create the delete view
78
+ var deleteView = new bp.Views.DeleteCoverImage( { model: delete_model } );
79
+
80
+ // Add it to views
81
+ this.views.add( { id: 'delete', view: deleteView } );
82
+
83
+ // Display it
84
+ deleteView.inject( '.bp-cover-image-manage' );
85
+ },
86
+
87
+ deleteCoverImage: function( model ) {
88
+ var self = this,
89
+ deleteView;
90
+
91
+ // Remove the delete view
92
+ if ( ! _.isUndefined( this.views.get( 'delete' ) ) ) {
93
+ deleteView = this.views.get( 'delete' );
94
+ deleteView.get( 'view' ).remove();
95
+ this.views.remove( { id: 'delete', view: deleteView } );
96
+ }
97
+
98
+ // Remove the cover image !
99
+ bp.ajax.post( 'bp_cover_image_delete', {
100
+ json: true,
101
+ item_id: model.get( 'item_id' ),
102
+ object: model.get( 'object' ),
103
+ nonce: model.get( 'nonces' ).remove
104
+ } ).done( function( response ) {
105
+ var coverImageStatus = new bp.Views.CoverImageStatus( {
106
+ value : BP_Uploader.strings.feedback_messages[ response.feedback_code ],
107
+ type : 'success'
108
+ } );
109
+
110
+ self.views.add( {
111
+ id : 'status',
112
+ view : coverImageStatus
113
+ } );
114
+
115
+ coverImageStatus.inject( '.bp-cover-image-status' );
116
+
117
+ // Reset the header of the page
118
+ if ( '' === response.reset_url ) {
119
+ $( '#header-cover-image' ).css( {
120
+ 'background-image': 'none'
121
+ } );
122
+ } else {
123
+ $( '#header-cover-image' ).css( {
124
+ 'background-image': 'url( ' + response.reset_url + ' )'
125
+ } );
126
+ }
127
+
128
+ // Reset the has_cover_image bp_param
129
+ BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image = false;
130
+
131
+ /**
132
+ * Reset the Attachment object
133
+ *
134
+ * You can run extra actions once the cover image is set using:
135
+ * bp.CoverImage.Attachment.on( 'change:url', function( data ) { your code } );
136
+ *
137
+ * In this case data.attributes will include the default url for the
138
+ * cover image (most of the time: ''), the object and the item_id concerned.
139
+ */
140
+ self.Attachment.set( _.extend(
141
+ _.pick( model.attributes, ['object', 'item_id'] ),
142
+ { url: response.reset_url, action: 'deleted' }
143
+ ) );
144
+
145
+ } ).fail( function( response ) {
146
+ var feedback = BP_Uploader.strings.default_error;
147
+ if ( ! _.isUndefined( response ) ) {
148
+ feedback = BP_Uploader.strings.feedback_messages[ response.feedback_code ];
149
+ }
150
+
151
+ var coverImageStatus = new bp.Views.CoverImageStatus( {
152
+ value : feedback,
153
+ type : 'error'
154
+ } );
155
+
156
+ self.views.add( {
157
+ id : 'status',
158
+ view : coverImageStatus
159
+ } );
160
+
161
+ coverImageStatus.inject( '.bp-cover-image-status' );
162
+
163
+ // Put back the delete view
164
+ bp.CoverImage.deleteView();
165
+ } );
166
+ },
167
+
168
+ removeWarning: function() {
169
+ if ( ! _.isNull( this.warning ) ) {
170
+ this.warning.remove();
171
+ }
172
+ },
173
+
174
+ displayWarning: function( message ) {
175
+ this.removeWarning();
176
+
177
+ this.warning = new bp.Views.uploaderWarning( {
178
+ value: message
179
+ } );
180
+
181
+ this.warning.inject( '.bp-cover-image-status' );
182
+ }
183
+ };
184
+
185
+ // Custom Uploader Files view
186
+ bp.Views.coverImageUploadProgress = bp.Views.uploaderStatus.extend( {
187
+ className: 'files',
188
+
189
+ initialize: function() {
190
+ bp.Views.uploaderStatus.prototype.initialize.apply( this, arguments );
191
+
192
+ this.collection.on( 'change:url', this.uploadResult, this );
193
+ },
194
+
195
+ uploadResult: function( model ) {
196
+ var message, type;
197
+
198
+ if ( ! _.isUndefined( model.get( 'url' ) ) ) {
199
+
200
+ // Image is too small
201
+ if ( 0 === model.get( 'feedback_code' ) ) {
202
+ message = BP_Uploader.strings.cover_image_warnings.dimensions;
203
+ type = 'warning';
204
+
205
+ // Success, Rock n roll!
206
+ } else {
207
+ message = BP_Uploader.strings.feedback_messages[ model.get( 'feedback_code' ) ];
208
+ type = 'success';
209
+ }
210
+
211
+ this.views.set( '.bp-uploader-progress', new bp.Views.CoverImageStatus( {
212
+ value : message,
213
+ type : type
214
+ } ) );
215
+
216
+ // Update the header of the page
217
+ $( '#header-cover-image' ).css( {
218
+ 'background-image': 'url( ' + model.get( 'url' ) + ' )'
219
+ } );
220
+
221
+ // Add the delete view
222
+ bp.CoverImage.deleteView();
223
+
224
+ /**
225
+ * Set the Attachment object
226
+ *
227
+ * You can run extra actions once the cover image is set using:
228
+ * bp.CoverImage.Attachment.on( 'change:url', function( data ) { your code } );
229
+ *
230
+ * In this case data.attributes will include the url to the newly
231
+ * uploaded cover image, the object and the item_id concerned.
232
+ */
233
+ bp.CoverImage.Attachment.set( _.extend(
234
+ _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params, ['object', 'item_id'] ),
235
+ { url: model.get( 'url' ), action: 'uploaded' }
236
+ ) );
237
+ }
238
+ }
239
+ } );
240
+
241
+ // BuddyPress Cover Image Feedback view
242
+ bp.Views.CoverImageStatus = bp.View.extend( {
243
+ tagName: 'p',
244
+ className: 'updated',
245
+ id: 'bp-cover-image-feedback',
246
+
247
+ initialize: function() {
248
+ this.el.className += ' ' + this.options.type;
249
+ this.value = this.options.value;
250
+ },
251
+
252
+ render: function() {
253
+ this.$el.html( this.value );
254
+ return this;
255
+ }
256
+ } );
257
+
258
+ // BuddyPress Cover Image Delete view
259
+ bp.Views.DeleteCoverImage = bp.View.extend( {
260
+ tagName: 'div',
261
+ id: 'bp-delete-cover-image-container',
262
+ template: bp.template( 'bp-cover-image-delete' ),
263
+
264
+ events: {
265
+ 'click #bp-delete-cover-image': 'deleteCoverImage'
266
+ },
267
+
268
+ deleteCoverImage: function( event ) {
269
+ event.preventDefault();
270
+
271
+ bp.CoverImage.deleteCoverImage( this.model );
272
+ }
273
+ } );
274
+
275
+ bp.CoverImage.start();
276
+
277
+ })( bp, jQuery );
bp-forums/bp-forums-bbpress-sa.php CHANGED
@@ -37,7 +37,7 @@ function bp_forums_load_bbpress() {
37
define( 'BB_INC', 'bb-includes/' );
38
39
require( BB_PATH . BB_INC . 'class.bb-query.php' );
40
- @require( BB_PATH . BB_INC . 'class.bb-walker.php' );
41
42
require( BB_PATH . BB_INC . 'functions.bb-core.php' );
43
require( BB_PATH . BB_INC . 'functions.bb-forums.php' );
@@ -50,10 +50,10 @@ function bp_forums_load_bbpress() {
50
require( BB_PATH . BB_INC . 'functions.bb-formatting.php' );
51
require( BB_PATH . BB_INC . 'functions.bb-template.php' );
52
53
- require( $bp->plugin_dir . '/bp-forums/class.backpress-taxonomy.php' );
54
- require( $bp->plugin_dir . '/bp-forums/class.bb-taxonomy.php' );
55
56
- @require( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
57
58
$bb = new stdClass();
59
require( bp_get_option( 'bb-config-location' ) );
@@ -124,21 +124,11 @@ function bp_forums_load_bbpress() {
124
125
// Check if the tables are installed, if not, install them.
126
if ( !$tables_installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A ) ) {
127
- // Do not alter wp_users table.
128
- if ( ! defined( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES' ) ) {
129
- define( 'BB_SCHEMA_IGNORE_WP_USERS_TABLES', true );
130
- }
131
-
132
require( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
133
134
// Backticks and "IF NOT EXISTS" break the dbDelta function.
135
- $bb_queries = str_replace( ' IF NOT EXISTS', '', str_replace( '`', '', $bb_queries ) );
136
-
137
- // Fix issue with utf8mb4 in WP 4.2+ and bbPress DB schema (bb_terms/bb_meta)
138
- $bb_queries = str_replace( array( 'varchar(200)', 'varchar(255)' ), 'varchar(191)', $bb_queries );
139
140
- // Do the DB!
141
- bp_bb_dbDelta( $bb_queries );
142
require( BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php' );
143
bb_update_db_version();
144
37
define( 'BB_INC', 'bb-includes/' );
38
39
require( BB_PATH . BB_INC . 'class.bb-query.php' );
40
+ require( BB_PATH . BB_INC . 'class.bb-walker.php' );
41
42
require( BB_PATH . BB_INC . 'functions.bb-core.php' );
43
require( BB_PATH . BB_INC . 'functions.bb-forums.php' );
50
require( BB_PATH . BB_INC . 'functions.bb-formatting.php' );
51
require( BB_PATH . BB_INC . 'functions.bb-template.php' );
52
53
+ require( BACKPRESS_PATH . 'class.wp-taxonomy.php' );
54
+ require( BB_PATH . BB_INC . 'class.bb-taxonomy.php' );
55
56
+ require( BB_PATH . 'bb-admin/includes/functions.bb-admin.php' );
57
58
$bb = new stdClass();
59
require( bp_get_option( 'bb-config-location' ) );
124
125
// Check if the tables are installed, if not, install them.
126
if ( !$tables_installed = (boolean) $bbdb->get_results( 'DESCRIBE `' . $bbdb->forums . '`;', ARRAY_A ) ) {
127
require( BB_PATH . 'bb-admin/includes/defaults.bb-schema.php' );
128
129
// Backticks and "IF NOT EXISTS" break the dbDelta function.
130
+ bp_bb_dbDelta( str_replace( ' IF NOT EXISTS', '', str_replace( '`', '', $bb_queries ) ) );
131
132
require( BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php' );
133
bb_update_db_version();
134
bp-forums/bp-forums-filters.php CHANGED
@@ -168,26 +168,6 @@ function bp_forums_add_forum_topic_to_page_title( $title, $original_title, $sep,
168
}
169
add_filter( 'bp_modify_page_title', 'bp_forums_add_forum_topic_to_page_title', 9, 4 );
170
171
- /**
172
- * Append forum topic to document title.
173
- *
174
- * @since 2.9.0
175
- *
176
- * @param array $bp_title The BuddyPress page title parts.
177
- * @param array $title The original WordPress title parts.
178
- */
179
- function bp_forums_add_forum_topic_to_document_title( $bp_title, $title ) {
180
- if ( bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) && bp_has_forum_topic_posts() ) {
181
- /** This filter is documented in wp-includes/general-template.php */
182
- $sep = apply_filters( 'document_title_separator', '-' );
183
-
184
- $bp_title['title'] = bp_get_the_topic_title() . " $sep " . $bp_title['title'];
185
- }
186
-
187
- return $bp_title;
188
- }
189
- add_filter( 'bp_modify_document_title_parts', 'bp_forums_add_forum_topic_to_document_title', 10, 2 );
190
-
191
/**
192
* Remove the anchor tag autogenerated for at-mentions when forum topics and posts are edited.
193
*
168
}
169
add_filter( 'bp_modify_page_title', 'bp_forums_add_forum_topic_to_page_title', 9, 4 );
170
171
/**
172
* Remove the anchor tag autogenerated for at-mentions when forum topics and posts are edited.
173
*
bp-forums/bp-forums-template.php CHANGED
@@ -2425,9 +2425,7 @@ function bp_has_forum_topic_posts( $args = '' ) {
2425
return false;
2426
2427
} else {
2428
- if ( empty( $topic_template ) ) {
2429
- $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );
2430
- }
2431
2432
// Current topic forum_id needs to match current_group forum_id.
2433
if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( bp_get_current_group_id(), 'forum_id' ) )
2425
return false;
2426
2427
} else {
2428
+ $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );
2429
2430
// Current topic forum_id needs to match current_group forum_id.
2431
if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( bp_get_current_group_id(), 'forum_id' ) )
bp-forums/class.backpress-taxonomy.php DELETED
@@ -1,2082 +0,0 @@
1
- <?php
2
- // Last sync [WP11537] - Refactored into a class based on wp-includes/taxonomy.php
3
-
4
- /**
5
- * Taxonomy API
6
- *
7
- * @package WordPress
8
- * @subpackage Taxonomy
9
- * @since 2.3.0
10
- */
11
-
12
- /**
13
- * WordPress Taxonomy based off of WordPress revision 8782.
14
- *
15
- * @since 2.3.0
16
- */
17
- class BackPress_Taxonomy {
18
- /**
19
- * Stores the database.
20
- *
21
- * @var unknown_type
22
- */
23
- var $db;
24
- var $taxonomies = array();
25
-
26
- function WP_Taxonomy( &$db ) {
27
- $this->__construct( $db );
28
- register_shutdown_function( array(&$this, '__destruct') );
29
- }
30
-
31
- /**
32
- * PHP5 constructor - Assigns the database to an attribute of the class.
33
- *
34
- * @param unknown_type $db
35
- */
36
- function __construct( &$db ) {
37
- $this->db =& $db;
38
- }
39
-
40
- /**
41
- * Does nothing.
42
- *
43
- * @package BackPress
44
- * @subpackage Taxonomy
45
- */
46
- function __destruct() {
47
- }
48
-
49
- /**
50
- * Return all of the taxonomy names that are of $object_type.
51
- *
52
- * It appears that this function can be used to find all of the names inside of
53
- * $this->taxonomies variable.
54
- *
55
- * <code><?php $taxonomies = $this->get_object_taxonomies('post'); ?></code> Should
56
- * result in <code>Array('category', 'post_tag')</code>
57
- *
58
- * @package WordPress
59
- * @subpackage Taxonomy
60
- * @since 2.3.0
61
- *
62
- * @uses $this->taxonomies
63
- *
64
- * @param array|string|object $object_type Name of the type of taxonomy object, or an object (row from posts)
65
- * @return array The names of all taxonomy of $object_type.
66
- */
67
- function get_object_taxonomies($object_type) {
68
- $object_type = (array) $object_type;
69
-
70
- // WP DIFF
71
- $taxonomies = array();
72
- foreach ( (array) $this->taxonomies as $taxonomy ) {
73
- if ( array_intersect($object_type, (array) $taxonomy->object_type) )
74
- $taxonomies[] = $taxonomy->name;
75
- }
76
-
77
- return $taxonomies;
78
- }
79
-
80
- /**
81
- * Retrieves the taxonomy object of $taxonomy.
82
- *
83
- * The get_taxonomy function will first check that the parameter string given
84
- * is a taxonomy object and if it is, it will return it.
85
- *
86
- * @package WordPress
87
- * @subpackage Taxonomy
88
- * @since 2.3.0
89
- *
90
- * @uses $this->taxonomies
91
- * @uses $this->is_taxonomy() Checks whether taxonomy exists
92
- *
93
- * @param string $taxonomy Name of taxonomy object to return
94
- * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist
95
- */
96
- function get_taxonomy( $taxonomy ) {
97
- if ( !$this->is_taxonomy($taxonomy) )
98
- return false;
99
-
100
- return $this->taxonomies[$taxonomy];
101
- }
102
-
103
- /**
104
- * Checks that the taxonomy name exists.
105
- *
106
- * @package WordPress
107
- * @subpackage Taxonomy
108
- * @since 2.3.0
109
- *
110
- * @uses $this->taxonomies
111
- *
112
- * @param string $taxonomy Name of taxonomy object
113
- * @return bool Whether the taxonomy exists or not.
114
- */
115
- function is_taxonomy( $taxonomy ) {
116
- return isset($this->taxonomies[$taxonomy]);
117
- }
118
-
119
- /**
120
- * Whether the taxonomy object is hierarchical.
121
- *
122
- * Checks to make sure that the taxonomy is an object first. Then Gets the
123
- * object, and finally returns the hierarchical value in the object.
124
- *
125
- * A false return value might also mean that the taxonomy does not exist.
126
- *
127
- * @package WordPress
128
- * @subpackage Taxonomy
129
- * @since 2.3.0
130
- *
131
- * @uses $this->is_taxonomy() Checks whether taxonomy exists
132
- * @uses $this->get_taxonomy() Used to get the taxonomy object
133
- *
134
- * @param string $taxonomy Name of taxonomy object
135
- * @return bool Whether the taxonomy is hierarchical
136
- */
137
- function is_taxonomy_hierarchical($taxonomy) {
138
- if ( !$this->is_taxonomy($taxonomy) )
139
- return false;
140
-
141
- $taxonomy = $this->get_taxonomy($taxonomy);
142
- return $taxonomy->hierarchical;
143
- }
144
-
145
- /**
146
- * Create or modify a taxonomy object. Do not use before init.
147
- *
148
- * A simple function for creating or modifying a taxonomy object based on the
149
- * parameters given. The function will accept an array (third optional
150
- * parameter), along with strings for the taxonomy name and another string for
151
- * the object type.
152
- *
153
- * The function keeps a default set, allowing for the $args to be optional but
154
- * allow the other functions to still work. It is possible to overwrite the
155
- * default set, which contains two keys: hierarchical and update_count_callback.
156
- *
157
- * Nothing is returned, so expect error maybe or use is_taxonomy() to check
158
- * whether taxonomy exists.
159
- *
160
- * Optional $args contents:
161
- *
162
- * hierarachical - has some defined purpose at other parts of the API and is a
163
- * boolean value.
164
- *
165
- * update_count_callback - works much like a hook, in that it will be called
166
- * when the count is updated.
167
- *
168
- * @package WordPress
169
- * @subpackage Taxonomy
170
- * @since 2.3.0
171
- * @uses $this->taxonomies Inserts new taxonomy object into the list
172
- *
173
- * @param string $taxonomy Name of taxonomy object
174
- * @param string $object_type Name of the object type for the taxonomy object.
175
- * @param array|string $args See above description for the two keys values.
176
- */
177
- function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
178
- $defaults = array('hierarchical' => false, 'update_count_callback' => '');
179
- $args = wp_parse_args($args, $defaults);
180
-
181
- $args['name'] = $taxonomy;
182
- $args['object_type'] = $object_type;
183
- $this->taxonomies[$taxonomy] = (object) $args;
184
- }
185
-
186
- //
187
- // Term API
188
- //
189
-
190
- /**
191
- * Retrieve object_ids of valid taxonomy and term.
192
- *
193
- * The strings of $taxonomies must exist before this function will continue. On
194
- * failure of finding a valid taxonomy, it will return an WP_Error class, kind
195
- * of like Exceptions in PHP 5, except you can't catch them. Even so, you can
196
- * still test for the WP_Error class and get the error message.
197
- *
198
- * The $terms aren't checked the same as $taxonomies, but still need to exist
199
- * for $object_ids to be returned.
200
- *
201
- * It is possible to change the order that object_ids is returned by either
202
- * using PHP sort family functions or using the database by using $args with
203
- * either ASC or DESC array. The value should be in the key named 'order'.
204
- *
205
- * @package WordPress
206
- * @subpackage Taxonomy
207
- * @since 2.3.0
208
- *
209
- * @uses wp_parse_args() Creates an array from string $args.
210
- *
211
- * @param string|array $terms String of term or array of string values of terms that will be used
212
- * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
213
- * @param array|string $args Change the order of the object_ids, either ASC or DESC
214
- * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
215
- * the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
216
- */
217
- function get_objects_in_term( $terms, $taxonomies, $args = null ) {
218
- if ( !is_array($terms) )
219
- $terms = array($terms);
220
-
221
- if ( !is_array($taxonomies) )
222
- $taxonomies = array($taxonomies);
223
-
224
- foreach ( (array) $taxonomies as $taxonomy ) {
225
- if ( !$this->is_taxonomy($taxonomy) )
226
- return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
227
- }
228
-
229
- $defaults = array('order' => 'ASC', 'field' => 'term_id');
230
- $args = wp_parse_args( $args, $defaults );
231
- extract($args, EXTR_SKIP);
232
-
233
- if ( 'tt_id' == $field )
234
- $field = 'tt.term_taxonomy_id';
235
- else
236
- $field = 'tt.term_id';
237
-
238
- $order = ( 'desc' == strtolower($order) ) ? 'DESC' : 'ASC';
239
-
240
- $terms = array_map('intval', $terms);
241
-
242
- $taxonomies = "'" . implode("', '", $taxonomies) . "'";
243
- $terms = "'" . implode("', '", $terms) . "'";
244
-
245
- $object_ids = $this->db->get_col("SELECT tr.object_id FROM {$this->db->term_relationships} AS tr INNER JOIN {$this->db->term_taxonomy} AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND $field IN ($terms) ORDER BY tr.object_id $order");
246
-
247
- if ( ! $object_ids )
248
- return array();
249
-
250
- return $object_ids;
251
- }
252
-
253
- /**
254
- * Get all Term data from database by Term ID.
255
- *
256
- * The usage of the get_term function is to apply filters to a term object. It
257
- * is possible to get a term object from the database before applying the
258
- * filters.
259
- *
260
- * $term ID must be part of $taxonomy, to get from the database. Failure, might
261
- * be able to be captured by the hooks. Failure would be the same value as $this->db
262
- * returns for the get_row method.
263
- *
264
- * There are two hooks, one is specifically for each term, named 'get_term', and
265
- * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the
266
- * term object, and the taxonomy name as parameters. Both hooks are expected to
267
- * return a Term object.
268
- *
269
- * 'get_term' hook - Takes two parameters the term Object and the taxonomy name.
270
- * Must return term object. Used in get_term() as a catch-all filter for every
271
- * $term.
272
- *
273
- * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy
274
- * name. Must return term object. $taxonomy will be the taxonomy name, so for
275
- * example, if 'category', it would be 'get_category' as the filter name. Useful
276
- * for custom taxonomies or plugging into default taxonomies.
277
- *
278
- * @package WordPress
279
- * @subpackage Taxonomy
280
- * @since 2.3.0
281
- *
282
- * @uses $this->sanitize_term() Cleanses the term based on $filter context before returning.
283
- * @see $this->sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
284
- *
285
- * @param int|object $term If integer, will get from database. If object will apply filters and return $term.
286
- * @param string $taxonomy Taxonomy name that $term is part of.
287
- * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
288
- * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
289
- * @return mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not
290
- * exist then WP_Error will be returned.
291
- */
292
- function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
293
- if ( empty($term) ) {
294
- $error = new WP_Error('invalid_term', __('Empty Term'));
295
- return $error;
296
- }
297
-
298
- if ( !$this->is_taxonomy($taxonomy) ) {
299
- $error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
300
- return $error;
301
- }
302
-
303
- if ( is_object($term) ) {
304
- wp_cache_add($term->term_id, $term, $taxonomy);
305
- wp_cache_add($term->term_taxonomy_id, $term->term_id, "$taxonomy:tt_id" );
306
- $_term = $term;
307
- } else {
308
- $term = (int) $term;
309
- if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
310
- $_term = $this->db->get_row( $this->db->prepare( "SELECT t.*, tt.* FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) );
311
- wp_cache_add($term, $_term, $taxonomy);
312
- wp_cache_add($_term->term_taxonomy_id, $_term->term_id, "$taxonomy:tt_id" );
313
- }
314
- }
315
-
316
- $_term = apply_filters('get_term', $_term, $taxonomy);
317
- $_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
318
- $_term = $this->sanitize_term($_term, $taxonomy, $filter);
319
-
320
- backpress_convert_object( $_term, $output );
321
-
322
- return $_term;
323
- }
324
-
325
- /**
326
- * Get all Term data from database by Term field and data.
327
- *
328
- * Warning: $value is not escaped for 'name' $field. You must do it yourself, if
329
- * required.
330
- *
331
- * The default $field is 'id', therefore it is possible to also use null for
332
- * field, but not recommended that you do so.
333
- *
334
- * If $value does not exist, the return value will be false. If $taxonomy exists
335
- * and $field and $value combinations exist, the Term will be returned.
336
- *
337
- * @package WordPress
338
- * @subpackage Taxonomy
339
- * @since 2.3.0
340
- *
341
- * @uses $this->sanitize_term() Cleanses the term based on $filter context before returning.
342
- * @see $this->sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
343
- *
344
- * @param string $field Either 'slug', 'name', 'id', or 'tt_id'
345
- * @param string|int $value Search for this term value
346
- * @param string $taxonomy Taxonomy Name
347
- * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
348
- * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
349
- * @return mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found.
350
- */
351
- function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
352
- if ( !$this->is_taxonomy($taxonomy) )
353
- return false;
354
-
355
- if ( 'slug' == $field ) {
356
- $field = 't.slug';
357
- $value = $this->sanitize_term_slug($value, $taxonomy);
358
- if ( empty($value) )
359
- return false;
360
- } else if ( 'name' == $field ) {
361
- // Assume already escaped
362
- $field = 't.name';
363
- } else if ( 'tt_id' == $field ) {
364
- $field = 'tt.term_taxonomy_id';
365
- $value = (int) $value;
366
- if ( $_term_id = wp_cache_get( $value, "$taxonomy:tt_id" ) )
367
- return $this->get_term( $_term_id, $taxonomy, $output, $filter );
368
- } else {
369
- $field = 't.term_id';
370
- $value = (int) $value;
371
- }
372
-
373
- $term = $this->db->get_row( $this->db->prepare( "SELECT t.*, tt.* FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
374
- if ( !$term )
375
- return false;
376
-
377
- wp_cache_add($term->term_id, $term, $taxonomy);
378
- wp_cache_add($term->term_taxonomy_id, $term->term_id, "$taxonomy:tt_id" );
379
-
380
- $term = $this->sanitize_term($term, $taxonomy, $filter);
381
-
382
- backpress_convert_object( $term, $output );
383
-
384
- return $term;
385
- }
386
-
387
- /**
388
- * Merge all term children into a single array of their IDs.
389
- *
390
- * This recursive function will merge all of the children of $term into the same
391
- * array of term IDs. Only useful for taxonomies which are hierarchical.
392
- *
393
- * Will return an empty array if $term does not exist in $taxonomy.
394
- *
395
- * @package WordPress
396
- * @subpackage Taxonomy
397
- * @since 2.3.0
398
- *
399
- * @uses $this->_get_term_hierarchy()
400
- * @uses $this->get_term_children() Used to get the children of both $taxonomy and the parent $term
401
- *
402
- * @param string $term ID of Term to get children
403
- * @param string $taxonomy Taxonomy Name
404
- * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist
405
- */
406
- function get_term_children( $term_id, $taxonomy ) {
407
- if ( !$this->is_taxonomy($taxonomy) )
408
- return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
409
-
410
- $term_id = intval( $term_id );
411
-
412
- $terms = $this->_get_term_hierarchy($taxonomy);
413
-
414
- if ( ! isset($terms[$term_id]) )
415
- return array();
416
-
417
- $children = $terms[$term_id];
418
-
419
- foreach ( (array) $terms[$term_id] as $child ) {
420
- if ( isset($terms[$child]) )
421
- $children = array_merge($children, $this->get_term_children($child, $taxonomy));
422
- }
423
-
424
- return $children;
425
- }
426
-
427
- /**
428
- * Get sanitized Term field.
429
- *
430
- * Does checks for $term, based on the $taxonomy. The function is for contextual
431
- * reasons and for simplicity of usage. See sanitize_term_field() for more
432
- * information.
433
- *
434
- * @package WordPress
435
- * @subpackage Taxonomy
436
- * @since 2.3.0
437
- *
438
- * @uses $this->sanitize_term_field() Passes the return value in sanitize_term_field on success.
439
- *
440
- * @param string $field Term field to fetch
441
- * @param int $term Term ID
442
- * @param string $taxonomy Taxonomy Name
443
- * @param string $context Optional, default is display. Look at sanitize_term_field() for available options.
444
- * @return mixed Will return an empty string if $term is not an object or if $field is not set in $term.
445
- */
446
- function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
447
- $term = (int) $term;
448
- $term = $this->get_term( $term, $taxonomy );
449
- if ( is_wp_error($term) )
450
- return $term;
451
-
452
- if ( !is_object($term) )
453
- return '';
454
-
455
- if ( !isset($term->$field) )
456
- return '';
457
-
458
- return $this->sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context);
459
- }
460
-
461
- /**
462
- * Sanitizes Term for editing.
463
- *
464
- * Return value is sanitize_term() and usage is for sanitizing the term for
465
- * editing. Function is for contextual and simplicity.
466
- *
467
- * @package WordPress
468
- * @subpackage Taxonomy
469
- * @since 2.3.0
470
- *
471
- * @uses $this->sanitize_term() Passes the return value on success
472
- *
473
- * @param int|object $id Term ID or Object
474
- * @param string $taxonomy Taxonomy Name
475
- * @return mixed|null|WP_Error Will return empty string if $term is not an object.
476
- */
477
- function get_term_to_edit( $id, $taxonomy ) {
478
- $term = $this->get_term( $id, $taxonomy );
479
-
480
- if ( is_wp_error($term) )
481
- return $term;
482
-
483
- if ( !is_object($term) )
484
- return '';
485
-
486
- return $this->sanitize_term($term, $taxonomy, 'edit');
487
- }
488
-
489
- /**
490
- * Retrieve the terms in a given taxonomy or list of taxonomies.
491
- *
492
- * You can fully inject any customizations to the query before it is sent, as
493
- * well as control the output with a filter.
494
- *
495
- * The 'get_terms' filter will be called when the cache has the term and will
496
- * pass the found term along with the array of $taxonomies and array of $args.
497
- * This filter is also called before the array of terms is passed and will pass
498
- * the array of terms, along with the $taxonomies and $args.
499
- *
500
- * The 'list_terms_exclusions' filter passes the compiled exclusions along with
501
- * the $args.
502
- *
503
- * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
504
- * along with the $args array.
505
- *
506
- * The 'get_terms_fields' filter passes the fields for the SELECT query
507
- * along with the $args array.
508
- *
509
- * The list of arguments that $args can contain, which will overwrite the defaults:
510
- *
511
- * orderby - Default is 'name'. Can be name, count, term_group, slug or nothing
512
- * (will use term_id), Passing a custom value other than these will cause it to
513
- * order based on the custom value.
514
- *
515
- * order - Default is ASC. Can use DESC.
516
- *
517
- * hide_empty - Default is true. Will not return empty terms, which means
518
- * terms whose count is 0 according to the given taxonomy.
519
- *
520
- * exclude - Default is an empty string. A comma- or space-delimited string
521
- * of term ids to exclude from the return array. If 'include' is non-empty,
522
- * 'exclude' is ignored.
523
- *
524
- * include - Default is an empty string. A comma- or space-delimited string
525
- * of term ids to include in the return array.
526
- *
527
- * number - The maximum number of terms to return. Default is empty.
528
- *
529
- * offset - The number by which to offset the terms query.
530
- *
531
- * fields - Default is 'all', which returns an array of term objects.
532
- * If 'fields' is 'ids' or 'names', returns an array of
533
- * integers or strings, respectively.
534
- *
535
- * slug - Returns terms whose "slug" matches this value. Default is empty string.
536
- *
537
- * hierarchical - Whether to include terms that have non-empty descendants
538
- * (even if 'hide_empty' is set to true).
539
- *
540
- * search - Returned terms' names will contain the value of 'search',
541
- * case-insensitive. Default is an empty string.
542
- *
543
- * name__like - Returned terms' names will begin with the value of 'name__like',
544
- * case-insensitive. Default is empty string.
545
- *
546
- * The argument 'pad_counts', if set to true will include the quantity of a term's
547
- * children in the quantity of each term's "count" object variable.
548
- *
549
- * The 'get' argument, if set to 'all' instead of its default empty string,
550
- * returns terms regardless of ancestry or whether the terms are empty.
551
- *
552
- * The 'child_of' argument, when used, should be set to the integer of a term ID. Its default
553
- * is 0. If set to a non-zero value, all returned terms will be descendants
554
- * of that term according to the given taxonomy. Hence 'child_of' is set to 0
555
- * if more than one taxonomy is passed in $taxonomies, because multiple taxonomies
556
- * make term ancestry ambiguous.
557
- *
558
- * The 'parent' argument, when used, should be set to the integer of a term ID. Its default is
559
- * the empty string '', which has a different meaning from the integer 0.
560
- * If set to an integer value, all returned terms will have as an immediate
561
- * ancestor the term whose ID is specified by that integer according to the given taxonomy.
562
- * The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent'
563
- * of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.
564
- *
565
- * @package WordPress
566
- * @subpackage Taxonomy
567
- * @since 2.3.0
568
- *
569
- * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
570
- *
571
- * @param string|array Taxonomy name or list of Taxonomy names
572
- * @param string|array $args The values of what to search for when returning terms
573
- * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist.
574
- */
575
- function &get_terms($taxonomies, $args = '') {
576
- $empty_array = array();
577
-
578
- $single_taxonomy = false;
579
- if ( !is_array($taxonomies) ) {
580
- $single_taxonomy = true;
581
- $taxonomies = array($taxonomies);
582
- }
583
-
584
- foreach ( (array) $taxonomies as $taxonomy ) {
585
- if ( ! $this->is_taxonomy($taxonomy) ) {
586
- $error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
587
- return $error;
588
- }
589
- }
590
-
591
- $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
592
-
593
- $defaults = array('orderby' => 'name', 'order' => 'ASC',
594
- 'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
595
- 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
596
- 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
597
- 'pad_counts' => false, 'offset' => '', 'search' => '');
598
- $args = wp_parse_args( $args, $defaults );
599
- $args['number'] = absint( $args['number'] );
600
- $args['offset'] = absint( $args['offset'] );
601
- if ( !$single_taxonomy || !$this->is_taxonomy_hierarchical($taxonomies[0]) ||
602
- '' !== $args['parent'] ) {
603
- $args['child_of'] = 0;
604
- $args['hierarchical'] = false;
605
- $args['pad_counts'] = false;
606
- }
607
-
608
- if ( 'all' == $args['get'] ) {
609
- $args['child_of'] = 0;
610
- $args['hide_empty'] = 0;
611
- $args['hierarchical'] = false;
612
- $args['pad_counts'] = false;
613
- }
614
- extract($args, EXTR_SKIP);
615
-
616
- if ( $child_of ) {
617
- $hierarchy = $this->_get_term_hierarchy($taxonomies[0]);
618
- if ( !isset($hierarchy[$child_of]) )
619
- return $empty_array;
620
- }
621
-
622
- if ( $parent ) {
623
- $hierarchy = $this->_get_term_hierarchy($taxonomies[0]);
624
- if ( !isset($hierarchy[$parent]) )
625
- return $empty_array;
626
- }
627
-
628
- // $args can be whatever, only use the args defined in defaults to compute the key
629
- $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
630
- $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
631
- $last_changed = wp_cache_get('last_changed', 'terms');
632
- if ( !$last_changed ) {
633
- $last_changed = time();
634
- wp_cache_set('last_changed', $last_changed, 'terms');
635
- }
636
- $cache_key = "get_terms:$key:$last_changed";
637
- $cache = wp_cache_get( $cache_key, 'terms' );
638
- if ( false !== $cache ) {
639
- $cache = apply_filters('get_terms', $cache, $taxonomies, $args);
640
- return $cache;
641
- }
642
-
643
- $_orderby = strtolower($orderby);
644
- if ( 'count' == $_orderby )
645
- $orderby = 'tt.count';
646
- else if ( 'name' == $_orderby )
647
- $orderby = 't.name';
648
- else if ( 'slug' == $_orderby )
649
- $orderby = 't.slug';
650
- else if ( 'term_group' == $_orderby )
651
- $orderby = 't.term_group';
652
- elseif ( empty($_orderby) || 'id' == $_orderby )
653
- $orderby = 't.term_id';
654
-
655
- $orderby = apply_filters( 'get_terms_orderby', $orderby, $args );
656
-
657
- $where = '';
658
- $inclusions = '';
659
- if ( !empty($include) ) {
660
- $exclude = '';
661
- $exclude_tree = '';
662
- $interms = preg_split('/[\s,]+/',$include);
663
- if ( count($interms) ) {
664
- foreach ( (array) $interms as $interm ) {
665
- if (empty($inclusions))
666
- $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
667
- else
668
- $inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
669
- }
670
- }
671
- }
672
-
673
- if ( !empty($inclusions) )
674
- $inclusions .= ')';
675
- $where .= $inclusions;
676
-
677
- $exclusions = '';
678
- if ( ! empty( $exclude_tree ) ) {
679
- $excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
680
- foreach( (array) $excluded_trunks as $extrunk ) {
681
- $excluded_children = (array) $this->get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids'));
682
- $excluded_children[] = $extrunk;
683
- foreach( (array) $excluded_children as $exterm ) {
684
- if ( empty($exclusions) )
685
- $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
686
- else
687
- $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
688
-
689
- }
690
- }
691
- }
692
- if ( !empty($exclude) ) {
693
- $exterms = preg_split('/[\s,]+/',$exclude);
694
- if ( count($exterms) ) {
695
- foreach ( (array) $exterms as $exterm ) {
696
- if ( empty($exclusions) )
697
- $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
698
- else
699
- $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
700
- }
701
- }
702
- }
703
-
704
- if ( !empty($exclusions) )
705
- $exclusions .= ')';
706
- $exclusions = apply_filters('list_terms_exclusions', $exclusions, $args );
707
- $where .= $exclusions;
708
-
709
- if ( !empty($slug) ) {
710
- $slug = $this->sanitize_term_slug($slug);
711
- $where .= " AND t.slug = '$slug'";
712
- }
713
-
714
- if ( !empty($name__like) )
715
- $where .= " AND t.name LIKE '{$name__like}%'";
716
-
717
- if ( '' !== $parent ) {
718
- $parent = (int) $parent;
719
- $where .= " AND tt.parent = '$parent'";
720
- }
721
-
722
- if ( $hide_empty && !$hierarchical )
723
- $where .= ' AND tt.count > 0';
724
-
725
- // don't limit the query results when we have to descend the family tree
726
- if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) {
727
- if( $offset )
728
- $limit = 'LIMIT ' . $offset . ',' . $number;
729
- else
730
- $limit = 'LIMIT ' . $number;
731
-
732
- } else
733
- $limit = '';
734
-
735
- if ( !empty($search) ) {
736
- $search = like_escape($search);
737
- $where .= " AND (t.name LIKE '%$search%')";
738
- }
739
-
740
- if ( !in_array( $fields, array( 'all', 'ids', 'names', 'tt_ids' ) ) )
741
- $fields = 'all';
742
-
743
- $selects = array();
744
- if ( 'all' == $fields )
745
- $selects = array('t.*', 'tt.*');
746
- else if ( 'ids' == $fields )
747
- $selects = array('t.term_id', 'tt.parent', 'tt.count');
748
- else if ( 'names' == $fields )
749
- $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
750
- $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
751
-
752
- $query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit";
753
-
754
- $terms = $this->db->get_results($query);
755
- if ( 'all' == $fields ) {
756
- $this->update_term_cache($terms);
757
- }
758
-
759
- if ( empty($terms) ) {
760
- wp_cache_add( $cache_key, array(), 'terms' );
761
- $terms = apply_filters('get_terms', array(), $taxonomies, $args);
762
- return $terms;
763
- }
764
-
765
- if ( $child_of || $hierarchical ) {
766
- $children = $this->_get_term_hierarchy($taxonomies[0]);
767
- if ( ! empty($children) )
768
- $terms = & $this->_get_term_children($child_of, $terms, $taxonomies[0]);
769
- }
770
-
771
- // Update term counts to include children.
772
- if ( $pad_counts )
773
- $this->_pad_term_counts($terms, $taxonomies[0]);
774
-
775
- // Make sure we show empty categories that have children.
776
- if ( $hierarchical && $hide_empty && is_array($terms) ) {
777
- foreach ( $terms as $k => $term ) {
778
- if ( ! $term->count ) {
779
- $children = $this->_get_term_children($term->term_id, $terms, $taxonomies[0]);
780
- if( is_array($children) )
781
- foreach ( $children as $child )
782
- if ( $child->count )
783
- continue 2;
784
-
785
- // It really is empty
786
- unset($terms[$k]);
787
- }
788
- }
789
- }
790
- reset ( $terms );
791
-
792
- $_terms = array();
793
- if ( 'ids' == $fields ) {
794
- while ( $term = array_shift($terms) )
795
- $_terms[] = $term->term_id;
796
- $terms = $_terms;
797
- } elseif ( 'names' == $fields ) {
798
- while ( $term = array_shift($terms) )
799
- $_terms[] = $term->name;
800
- $terms = $_terms;
801
- }
802
-
803
- if ( 0 < $number && intval(@count($terms)) > $number ) {
804
- $terms = array_slice($terms, $offset, $number);
805
- }
806
-
807
- wp_cache_add( $cache_key, $terms, 'terms' );
808
-
809
- $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
810
- return $terms;
811
- }
812
-
813
- /**
814
- * Check if Term exists.
815
- *
816
- * Returns the index of a defined term, or 0 (false) if the term doesn't exist.
817
- *
818
- * @package WordPress
819
- * @subpackage Taxonomy
820
- * @since 2.3.0
821
- *
822
- * @param int|string $term The term to check
823
- * @param string $taxonomy The taxonomy name to use
824
- * @param int $parent ID of parent term under which to confine the exists search.
825
- * @return mixed Get the term id or Term Object, if exists.
826
- */
827
- function is_term($term, $taxonomy = '', $parent = 0) {
828
- $select = "SELECT term_id FROM {$this->db->terms} as t WHERE ";
829
- $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} as tt ON tt.term_id = t.term_id WHERE ";
830
-
831
- if ( is_int($term) ) {
832
- if ( 0 == $term )
833
- return 0;
834
- $where = 't.term_id = %d';
835
- if ( !empty($taxonomy) )
836
- return $this->db->get_row( $this->db->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A );
837
- else
838
- return $this->db->get_var( $this->db->prepare( $select . $where, $term ) );
839
- }
840
-
841
- $term = trim( stripslashes( $term ) );
842
-
843
- if ( '' === $slug = $this->sanitize_term_slug($term) )
844
- return 0;
845
-
846
- $where = 't.slug = %s';
847
- $else_where = 't.name = %s';
848
- $where_fields = array($slug);
849
- $else_where_fields = array($term);
850
- if ( !empty($taxonomy) ) {
851
- $parent = (int) $parent;
852
- if ( $parent > 0 ) {
853
- $where_fields[] = $parent;
854
- $else_where_fields[] = $parent;
855
- $where .= ' AND tt.parent = %d';
856
- $else_where .= ' AND tt.parent = %d';
857
- }
858
-
859
- $where_fields[] = $taxonomy;
860
- $else_where_fields[] = $taxonomy;
861
-
862
- if ( $result = $this->db->get_row( $this->db->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A) )
863
- return $result;
864
-
865
- return $this->db->get_row( $this->db->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $else_where_fields), ARRAY_A);
866
- }
867
-
868
- if ( $result = $this->db->get_var( $this->db->prepare("SELECT term_id FROM {$this->db->terms} as t WHERE $where", $where_fields) ) )
869
- return $result;
870
-
871
- return $this->db->get_var( $this->db->prepare("SELECT term_id FROM {$this->db->terms} as t WHERE $else_where", $else_where_fields) );
872
- }
873
-
874
- function sanitize_term_slug( $title, $taxonomy = '', $term_id = 0 ) {
875
- return apply_filters( 'pre_term_slug', $title, $taxonomy, $term_id );
876
- }
877
-
878
- function format_to_edit( $text ) {
879
- return format_to_edit( $text );
880
- }
881
-
882
- /**
883
- * Sanitize Term all fields
884
- *
885
- * Relies on sanitize_term_field() to sanitize the term. The difference
886
- * is that this function will sanitize <strong>all</strong> fields. The
887
- * context is based on sanitize_term_field().
888
- *
889
- * The $term is expected to be either an array or an object.
890
- *
891
- * @package WordPress
892
- * @subpackage Taxonomy
893
- * @since 2.3.0
894
- *
895
- * @uses $this->sanitize_term_field Used to sanitize all fields in a term
896
- *
897
- * @param array|object $term The term to check
898
- * @param string $taxonomy The taxonomy name to use
899
- * @param string $context Default is 'display'.
900
- * @return array|object Term with all fields sanitized
901
- */
902
- function sanitize_term($term, $taxonomy, $context = 'display') {
903
-
904
- if ( 'raw' == $context )
905
- return $term;
906
-
907
- $fields = array('term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group');
908
-
909
- $do_object = false;
910
- if ( is_object($term) )
911
- $do_object = true;
912
-
913
- $term_id = $do_object ? $term->term_id : (isset($term['term_id']) ? $term['term_id'] : 0);
914
-
915
- foreach ( (array) $fields as $field ) {
916
- if ( $do_object ) {
917
- if ( isset($term->$field) )
918
- $term->$field = $this->sanitize_term_field($field, $term->$field, $term_id, $taxonomy, $context);
919
- } else {
920
- if ( isset($term[$field]) )
921
- $term[$field] = $this->sanitize_term_field($field, $term[$field], $term_id, $taxonomy, $context);
922
- }
923
- }
924
-
925
- if ( $do_object )
926
- $term->filter = $context;
927
- else
928
- $term['filter'] = $context;
929
-
930
- return $term;
931
- }
932
-
933
- /**
934
- * Cleanse the field value in the term based on the context.
935
- *
936
- * Passing a term field value through the function should be assumed to have
937
- * cleansed the value for whatever context the term field is going to be used.
938
- *
939
- * If no context or an unsupported context is given, then default filters will
940
- * be applied.
941
- *
942
- * There are enough filters for each context to support a custom filtering
943
- * without creating your own filter function. Simply create a function that
944
- * hooks into the filter you need.
945
- *
946
- * @package WordPress
947
- * @subpackage Taxonomy
948
- * @since 2.3.0
949
- *
950
- * @param string $field Term field to sanitize
951
- * @param string $value Search for this term value
952
- * @param int $term_id Term ID
953
- * @param string $taxonomy Taxonomy Name
954
- * @param string $context Either edit, db, display, attribute, or js.
955
- * @return mixed sanitized field
956
- */
957
- function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
958
- if ( 'parent' == $field || 'term_id' == $field || 'count' == $field || 'term_group' == $field ) {
959
- $value = (int) $value;
960
- if ( $value < 0 )
961
- $value = 0;
962
- }
963
-
964
- if ( 'raw' == $context )
965
- return $value;
966
-
967
- if ( 'edit' == $context ) {
968
- $value = apply_filters("edit_term_$field", $value, $term_id, $taxonomy);
969
- $value = apply_filters("edit_${taxonomy}_$field", $value, $term_id);
970
- if ( 'description' == $field )
971
- $value = $this->format_to_edit($value);
972
- else
973
- $value = esc_attr($value);
974
- } else if ( 'db' == $context ) {
975
- $value = apply_filters("pre_term_$field", $value, $taxonomy);
976
- $value = apply_filters("pre_${taxonomy}_$field", $value);
977
- // WP DIFF
978
- } else if ( 'rss' == $context ) {
979
- $value = apply_filters("term_${field}_rss", $value, $taxonomy);
980
- $value = apply_filters("${taxonomy}_${field}_rss", $value); <