Changeset 13140
- Timestamp:
- 11/07/2021 05:22:42 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.github/workflows/unit-tests.yml
r13030 r13140 19 19 - php: '7.4' 20 20 wp_version: '5.8' 21 - php: '7.4' 22 wp_version: '5.4' 21 23 env: 22 24 WP_ENV_PHP_VERSION: ${{ matrix.php }} -
trunk/src/bp-blogs/bp-blogs-functions.php
r13108 r13140 575 575 * 576 576 * Fires when a site's details are updated, which generally happens when 577 * editing a site under "Network Admin > Sites". Prior to WP 4.9, the 578 * correct hook was 'refresh_blog_details'; afterward, 'clean_site_cache'. 577 * editing a site under "Network Admin > Sites". 579 578 * 580 579 * @since 2.3.0 … … 585 584 bp_blogs_delete_blogmeta( (int) $site_id, 'url' ); 586 585 } 587 588 if ( bp_is_running_wp( '4.9.0' ) ) { 589 add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' ); 590 } else { 591 add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' ); 592 } 586 add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' ); 593 587 594 588 /** -
trunk/src/bp-core/admin/js/hello.js
r12649 r13140 5 5 * @since 3.0.0 6 6 */ 7 (function( $, bp ) {7 (function( $, wp ) { 8 8 // Bail if not set 9 9 if ( typeof bpHelloStrings === 'undefined' ) { … … 80 80 $( '#TB_window' ).addClass( 'thickbox-loading' ); 81 81 82 bp.apiRequest( {82 wp.apiRequest( { 83 83 url: anchor.data( 'endpoint' ), 84 84 type: 'GET', … … 119 119 120 120 // Init modal after the screen's loaded. 121 $( document ).ready(function() {121 $( function() { 122 122 bpHelloOpenModal(); 123 123 } ); 124 124 125 }( jQuery, window. bp || {} ) );125 }( jQuery, window.wp || {} ) ); -
trunk/src/bp-core/bp-core-blocks.php
r13111 r13140 12 12 13 13 /** 14 * BuddyPress blocks require WordPress >= 5.0.0 &the BP REST API.14 * BuddyPress blocks require the BP REST API. 15 15 * 16 16 * @since 6.0.0 … … 20 20 */ 21 21 function bp_support_blocks() { 22 return bp_is_running_wp( '5.0.0' ) && bp_rest_api_is_available(); 22 /** 23 * Filter here, returning `false`, to completely disable BuddyPress blocks. 24 * 25 * @since 10.0.0 26 * 27 * @param bool $value True if the BP REST API is available. False otherwise. 28 */ 29 return apply_filters( 'bp_support_blocks', bp_rest_api_is_available() ); 23 30 } 24 31 -
trunk/src/bp-core/bp-core-functions.php
r13118 r13140 3271 3271 } 3272 3272 3273 // register_term_meta() was introduced in WP 4.9.8.3274 if ( ! bp_is_running_wp( '4.9.8' ) ) {3275 $args['object_subtype'] = $type_tax;3276 3277 return register_meta( 'term', $meta_key, $args );3278 }3279 3280 3273 return register_term_meta( $type_tax, $meta_key, $args ); 3281 3274 } … … 3685 3678 ); 3686 3679 3687 if ( bp_is_running_wp( '4.9.6' ) ) { 3688 $privacy_policy_url = get_privacy_policy_url(); 3689 if ( $privacy_policy_url ) { 3690 $footer_text[] = sprintf( 3691 '<a href="%s">%s</a>', 3692 esc_url( $privacy_policy_url ), 3693 esc_html__( 'Privacy Policy', 'buddypress' ) 3694 ); 3695 } 3680 $privacy_policy_url = get_privacy_policy_url(); 3681 if ( $privacy_policy_url ) { 3682 $footer_text[] = sprintf( 3683 '<a href="%s">%s</a>', 3684 esc_url( $privacy_policy_url ), 3685 esc_html__( 'Privacy Policy', 'buddypress' ) 3686 ); 3696 3687 } 3697 3688 -
trunk/src/bp-core/bp-core-rest-api.php
r12985 r13140 51 51 * Filter here to disable the BP REST API. 52 52 * 53 * The BP REST API requires at least WordPress 4.7.0 53 * The BP REST API requires at least WordPress 4.7.0. 54 54 * 55 55 * @since 5.0.0 … … 57 57 * @param boolean $value True if the BP REST API is available. False otherwise. 58 58 */ 59 return apply_filters( 'bp_rest_api_is_available', bp_ is_running_wp( '4.7.0' ) && bp_rest_in_buddypress() ) || bp_rest_is_plugin_active();59 return apply_filters( 'bp_rest_api_is_available', bp_rest_in_buddypress() ) || bp_rest_is_plugin_active(); 60 60 } 61 61 … … 64 64 * 65 65 * @since 5.0.0 66 * @deprecated 10.0.0 66 67 */ 67 68 function bp_rest_api_register_request_script() { … … 70 71 } 71 72 72 $dependencies = array( 'jquery' );73 74 // The wrapper for WP REST API requests was introduced in WordPress 4.9.0.75 if ( wp_script_is( 'wp-api-request', 'registered' ) ) {76 $dependencies = array( 'wp-api-request' );77 }78 79 73 wp_register_script( 80 74 'bp-api-request', 81 75 sprintf( '%1$sbp-core/js/bp-api-request%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ), 82 $dependencies,76 array( 'jquery', 'wp-api-request' ), 83 77 bp_get_version(), 84 78 true … … 89 83 'bpApiSettings', 90 84 array( 91 'root' => esc_url_raw( get_rest_url() ), 92 'nonce' => wp_create_nonce( 'wp_rest' ), 93 'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ), 85 'unexpectedError' => __( 'An unexpected error occured. Please try again.', 'buddypress' ), 86 'deprecatedWarning' => __( 'The bp.apiRequest function is deprecated since BuddyPress 10.0.0, please use wp.apiRequest instead.', 'buddypress' ), 94 87 ) 95 88 ); -
trunk/src/bp-core/bp-core-template.php
r13108 r13140 3885 3885 ); 3886 3886 3887 if ( $block_name && bp_is_running_wp( '5. 0.0', '>=' ) ) {3887 if ( $block_name && bp_is_running_wp( '5.8.0', '>=' ) ) { 3888 3888 $widget_blocks = get_option( 'widget_block', array() ); 3889 3889 $sidebars = wp_get_sidebars_widgets(); -
trunk/src/bp-core/bp-core-wpabstraction.php
r12699 r13140 310 310 311 311 /** 312 * Returns the name of the hook to use once a WordPress Site is inserted into the Database.313 *314 * WordPress 5.1.0 deprecated the `wpmu_new_blog` action. As BuddyPress is supporting WordPress back315 * to 4.9.0, this function makes sure we are using the new hook `wp_initialize_site` when the current316 * WordPress version is upper or equal to 5.1.0 and that we keep on using `wpmu_new_blog` for earlier317 * versions of WordPress.318 *319 * @since 6.0.0320 *321 * @return string The name of the hook to use.322 */323 function bp_insert_site_hook() {324 $wp_hook = 'wpmu_new_blog';325 326 if ( function_exists( 'wp_insert_site' ) ) {327 $wp_hook = 'wp_initialize_site';328 }329 330 return $wp_hook;331 }332 333 /**334 312 * Catch the new site data for a later use. 335 313 * … … 400 378 do_action( 'bp_insert_site', $site_id, $user_id, $domain, $path, $network_id, $meta ); 401 379 } 402 add_action( bp_insert_site_hook(), 'bp_insert_site' ); 403 404 /** 405 * Returns the name of the hook to use once a WordPress Site is deleted. 406 * 407 * WordPress 5.1.0 deprecated the `delete_blog` action. As BuddyPress is supporting WordPress back 408 * to 4.9.0, this function makes sure we are using the new hook `wp_validate_site_deletion` when the 409 * current WordPress version is upper or equal to 5.1.0 and that we keep on using `delete_blog` for 410 * earlier versions of WordPress. 411 * 412 * @since 6.0.0 413 * 414 * @return string The name of the hook to use. 415 */ 416 function bp_delete_site_hook() { 417 $wp_hook = 'delete_blog'; 418 419 if ( function_exists( 'wp_delete_site' ) ) { 420 $wp_hook = 'wp_validate_site_deletion'; 421 } 422 423 return $wp_hook; 424 } 380 add_action( 'wp_initialize_site', 'bp_insert_site' ); 425 381 426 382 /** … … 472 428 do_action( 'bp_delete_site', $site_id, $drop ); 473 429 } 474 add_action( bp_delete_site_hook(), 'bp_delete_site', 10, 2 ); 475 476 if ( ! function_exists( 'wp_parse_list' ) ) { 477 /** 478 * Cleans up an array, comma- or space-separated list of scalar values. 479 * 480 * As BuddyPress supports older WordPress versions than 5.1 (4.9 & 5.0), 481 * the BP REST API needs this function to be available. 482 * 483 * @since 7.0.0 484 * 485 * @param array|string $list List of values. 486 * @return array Sanitized array of values. 487 */ 488 function wp_parse_list( $list ) { 489 if ( ! is_array( $list ) ) { 490 return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY ); 491 } 492 493 return $list; 494 } 495 } 430 add_action( 'wp_validate_site_deletion', 'bp_delete_site', 10, 2 ); -
trunk/src/bp-core/classes/class-bp-admin.php
r13139 r13140 655 655 */ 656 656 public function add_privacy_policy_content() { 657 // Nothing to do if we're running < WP 4.9.6.658 if ( bp_is_running_wp( '4.9.6', '<' ) ) {659 return;660 }661 662 657 $suggested_text = '<strong class="privacy-policy-tutorial">' . esc_html__( 'Suggested text:', 'buddypress' ) . ' </strong>'; 663 658 $content = ''; … … 1291 1286 'bp-hello-js' => array( 1292 1287 'file' => "{$url}hello{$min}.js", 1293 'dependencies' => array( 'thickbox', ' bp-api-request' ),1288 'dependencies' => array( 'thickbox', 'wp-api-request' ), 1294 1289 'footer' => true, 1295 1290 ), -
trunk/src/bp-core/js/bp-api-request.js
r12548 r13140 3 3 * 4 4 * @since 5.0.0 5 * @deprecated 10.0.0 5 6 * @output bp-core/js/bp-api-request.js 6 7 */ … … 8 9 window.bp = window.bp || {}; 9 10 10 ( function( wp, bp , $) {11 ( function( wp, bp ) { 11 12 // Bail if not set. 12 13 if ( typeof bpApiSettings === 'undefined' ) { … … 16 17 bp.isRestEnabled = true; 17 18 18 // Polyfill wp.apiRequest if WordPress < 4.9.19 // Polyfill wp.apiRequest. 19 20 bp.apiRequest = function( options ) { 21 window.console.log( bpApiSettings.deprecatedWarning ); 22 20 23 var bpRequest; 21 24 … … 24 27 } 25 28 26 // WordPress is >= 4.9.0. 27 if ( wp.apiRequest ) { 28 bpRequest = wp.apiRequest( options ); 29 30 // WordPress is < 4.9.0. 31 } else { 32 var url = bpApiSettings.root; 33 34 if ( options.path ) { 35 url = url + options.path.replace( /^\//, '' ); 36 } 37 38 if ( ! options.url ) { 39 options.url = url; 40 } 41 42 // Add The nonce only when needed. 43 if ( -1 !== options.url.indexOf( url ) ) { 44 options.beforeSend = function( xhr ) { 45 xhr.setRequestHeader( 'X-WP-Nonce', bpApiSettings.nonce ); 46 }; 47 } 48 49 bpRequest = $.ajax( options ); 50 } 29 bpRequest = wp.apiRequest( options ); 51 30 52 31 return bpRequest.then( null, function( result ) { … … 67 46 }; 68 47 69 } )( window.wp || {}, window.bp , jQuery);48 } )( window.wp || {}, window.bp ); -
trunk/src/bp-friends/bp-friends-blocks.php
r13108 r13140 208 208 ); 209 209 210 $preloaded_friends = array(); 211 if ( bp_is_running_wp( '5.0.0' ) ) { 212 $preloaded_friends = rest_preload_api_request( '', $default_path ); 213 } 210 $preloaded_friends = rest_preload_api_request( '', $default_path ); 214 211 215 212 buddypress()->friends->block_globals['bp/friends']->items[ $widget_id ] = (object) array( -
trunk/src/bp-groups/bp-groups-blocks.php
r13108 r13140 484 484 ); 485 485 486 $preloaded_groups = array(); 487 if ( bp_is_running_wp( '5.0.0' ) ) { 488 $preloaded_groups = rest_preload_api_request( '', $default_path ); 489 } 486 $preloaded_groups = rest_preload_api_request( '', $default_path ); 490 487 491 488 buddypress()->groups->block_globals['bp/dynamic-groups']->items[ $widget_id ] = (object) array( -
trunk/src/bp-groups/bp-groups-cssjs.php
r13004 r13140 20 20 'bp-group-manage-members', 21 21 sprintf( '%1$sbp-groups/js/manage-members%2$s.js', buddypress()->plugin_url, bp_core_get_minified_asset_suffix() ), 22 array( 'json2', 'wp-backbone', ' bp-api-request' ),22 array( 'json2', 'wp-backbone', 'wp-api-request' ), 23 23 bp_get_version(), 24 24 true … … 50 50 ); 51 51 52 $preloaded_members = array(); 53 if ( bp_is_running_wp( '5.0.0' ) ) { 54 $preloaded_members = rest_preload_api_request( '', $path ); 55 } 52 $preloaded_members = rest_preload_api_request( '', $path ); 56 53 57 54 return array( -
trunk/src/bp-groups/js/manage-members.js
r12531 r13140 5 5 6 6 // Bail if not set 7 if ( typeof bpGroupManageMembersSettings === 'undefined' || ! bp.isRestEnabled) {7 if ( typeof bpGroupManageMembersSettings === 'undefined' ) { 8 8 return; 9 9 } … … 63 63 } 64 64 65 return bp.apiRequest( options );65 return wp.apiRequest( options ); 66 66 } 67 67 }, … … 118 118 }; 119 119 120 return bp.apiRequest( options );120 return wp.apiRequest( options ); 121 121 } 122 122 } -
trunk/src/bp-members/bp-members-blocks.php
r13108 r13140 501 501 ); 502 502 503 $preloaded_members = array(); 504 if ( bp_is_running_wp( '5.0.0' ) ) { 505 $preloaded_members = rest_preload_api_request( '', $default_path ); 506 } 503 $preloaded_members = rest_preload_api_request( '', $default_path ); 507 504 508 505 buddypress()->members->block_globals['bp/dynamic-members']->items[ $widget_id ] = (object) array( -
trunk/src/bp-members/bp-members-template.php
r13118 r13140 2746 2746 */ 2747 2747 function bp_signup_requires_privacy_policy_acceptance() { 2748 // Bail if we're running a version of WP that doesn't have the Privacy Policy feature.2749 if ( bp_is_running_wp( '4.9.6', '<' ) ) {2750 return false;2751 }2752 2748 2753 2749 // Default to true when a published Privacy Policy page exists. -
trunk/src/bp-settings/bp-settings-functions.php
r13090 r13140 249 249 250 250 if ( ! empty( $query->post ) ) { 251 // WP 5.4 changed the user request function name to wp_get_user_request() 252 $user_request = bp_is_running_wp( '4.9.6' ) ? 'wp_get_user_request' : 'wp_get_user_request_data'; 253 return $user_request( $query->post->ID ); 251 return wp_get_user_request( $query->post->ID ); 254 252 } else { 255 253 return false; -
trunk/src/bp-settings/classes/class-bp-settings-component.php
r13093 r13140 199 199 $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true ); 200 200 201 // Export Data - only available for WP 4.9.6+.202 if ( true === $show_data_page && bp_is_running_wp( '4.9.6' )) {201 // Export Data. 202 if ( true === $show_data_page ) { 203 203 $sub_nav[] = array( 204 204 'name' => __( 'Export Data', 'buddypress' ), … … 279 279 280 280 // Export Data. 281 if ( true === $show_data_page && bp_is_running_wp( '4.9.6' )) {281 if ( true === $show_data_page ) { 282 282 $wp_admin_nav[] = array( 283 283 'parent' => 'my-account-' . $this->id, -
trunk/src/bp-templates/bp-nouveau/includes/functions.php
r13016 r13140 1553 1553 */ 1554 1554 function bp_nouveau_unregister_blocks_for_post_context() { 1555 if ( ! function_exists( 'unregister_block_type' ) ) {1556 return;1557 }1558 1559 1555 $is_registered = WP_Block_Type_Registry::get_instance()->is_registered( 'bp/primary-nav' ); 1560 1556 -
trunk/src/class-buddypress.php
r13109 r13140 559 559 require $this->plugin_dir . 'bp-core/deprecated/8.0.php'; 560 560 require $this->plugin_dir . 'bp-core/deprecated/9.0.php'; 561 require $this->plugin_dir . 'bp-core/deprecated/10.0.php'; 561 562 } 562 563 -
trunk/src/readme.txt
r13084 r13140 4 4 License: GPLv2 or later 5 5 License URI: https://www.gnu.org/licenses/gpl-2.0.html 6 Requires at least: 4.96 Requires at least: 5.4 7 7 Requires PHP: 5.6 8 8 Tested up to: 5.8 -
trunk/tests/phpunit/includes/testcase.php
r13108 r13140 86 86 if ( is_multisite() ) { 87 87 foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE blog_id != 1" ) as $blog_id ) { 88 if ( function_exists( 'wp_uninitialize_site' ) ) { 89 wp_uninitialize_site( $blog_id ); 90 } else { 91 wpmu_delete_blog( $blog_id, true ); 92 } 88 wp_uninitialize_site( $blog_id ); 93 89 } 94 90 }
Note: See TracChangeset
for help on using the changeset viewer.