Skip to:
Content

BuddyPress.org

Ticket #7906: 7906.3.diff

File 7906.3.diff, 10.8 KB (added by imath, 4 months ago)
  • src/bp-activity/bp-activity-filters.php

    diff --git src/bp-activity/bp-activity-filters.php src/bp-activity/bp-activity-filters.php
    index 1e57372ee..b5308821a 100644
    add_filter( 'bp_get_activity_feed_item_description', 'force_balance_tags' ); 
    3131add_filter( 'bp_activity_content_before_save',       'force_balance_tags' );
    3232add_filter( 'bp_activity_action_before_save',        'force_balance_tags' );
    3333
    34 if ( function_exists( 'wp_encode_emoji' ) ) {
    35         add_filter( 'bp_activity_content_before_save', 'wp_encode_emoji' );
    36 }
     34add_filter( 'bp_activity_content_before_save', 'wp_encode_emoji' );
    3735
    3836add_filter( 'bp_get_activity_action',                'wptexturize' );
    3937add_filter( 'bp_get_activity_content_body',          'wptexturize' );
  • src/bp-blogs/bp-blogs-functions.php

    diff --git src/bp-blogs/bp-blogs-functions.php src/bp-blogs/bp-blogs-functions.php
    index 8b7e5f237..d66589cc9 100644
    function bp_blogs_delete_url_blogmeta( $site_id = 0 ) { 
    575575        bp_blogs_delete_blogmeta( (int) $site_id, 'url' );
    576576}
    577577
    578 if ( function_exists( 'wp_switch_roles_and_user' ) ) {
     578if ( bp_is_running_wp( '4.9.0' ) ) {
    579579        add_action( 'clean_site_cache', 'bp_blogs_delete_url_blogmeta' );
    580580} else {
    581581        add_action( 'refresh_blog_details', 'bp_blogs_delete_url_blogmeta' );
  • src/bp-core/bp-core-blocks.php

    diff --git src/bp-core/bp-core-blocks.php src/bp-core/bp-core-blocks.php
    index f2f7a8c2c..62e408060 100644
    defined( 'ABSPATH' ) || exit; 
    1919 *              False otherwise.
    2020 */
    2121function bp_support_blocks() {
    22         return function_exists( 'register_block_type' ) && bp_rest_api_is_available();
     22        return bp_is_running_wp( '5.0.0' ) && bp_rest_api_is_available();
    2323}
    2424
    2525/**
  • src/bp-core/bp-core-catchuri.php

    diff --git src/bp-core/bp-core-catchuri.php src/bp-core/bp-core-catchuri.php
    index 198d42393..df857d464 100644
    function bp_core_load_template( $templates ) { 
    463463         * Wiping out the bp-default template allows WordPress to use their special
    464464         * embed template, which is what we want.
    465465         */
    466         if ( function_exists( 'is_embed' ) && is_embed() ) {
     466        if ( is_embed() ) {
    467467                $located_template = '';
    468468        }
    469469
  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index 21190f48d..2b8f0b594 100644
    function bp_db_version_raw() { 
    7070                return !empty( $bp->db_version_raw ) ? $bp->db_version_raw : 0;
    7171        }
    7272
     73/**
     74 * Check whether the current version of WP exceeds a given version.
     75 *
     76 * @since 7.0.0
     77 *
     78 * @param string $version WP version, in "PHP-standardized" format.
     79 * @param string $compare Optional. Comparison operator. Default '>='.
     80 * @return bool
     81 */
     82function bp_is_running_wp( $version, $compare = '>=' ) {
     83        return version_compare( $GLOBALS['wp_version'], $version, $compare );
     84}
     85
    7386/** Functions *****************************************************************/
    7487
    7588/**
    function bp_register_type_meta( $type_tax, $meta_key, array $args ) { 
    31343147        }
    31353148
    31363149        // register_term_meta() was introduced in WP 4.9.8.
    3137         if ( ! function_exists( 'register_term_meta' ) ) {
     3150        if ( ! bp_is_running_wp( '4.9.8' ) ) {
    31383151                $args['object_subtype'] = $type_tax;
    31393152
    31403153                return register_meta( 'term', $meta_key, $args );
    function bp_email_get_appearance_settings() { 
    35383551                )
    35393552        );
    35403553
    3541         if ( version_compare( $GLOBALS['wp_version'], '4.9.6', '>=' ) ) {
     3554        if ( bp_is_running_wp( '4.9.6' ) ) {
    35423555                $privacy_policy_url = get_privacy_policy_url();
    35433556                if ( $privacy_policy_url ) {
    35443557                        $footer_text[] = sprintf(
  • src/bp-core/bp-core-rest-api.php

    diff --git src/bp-core/bp-core-rest-api.php src/bp-core/bp-core-rest-api.php
    index 3246b10b4..40771ef34 100644
    function bp_rest_api_is_available() { 
    5656         *
    5757         * @param boolean $value True if the BP REST API is available. False otherwise.
    5858         */
    59         return apply_filters( 'bp_rest_api_is_available', function_exists( 'create_initial_rest_routes' ) && bp_rest_in_buddypress() ) || bp_rest_is_plugin_active();
     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();
    6060}
    6161
    6262/**
  • src/bp-core/bp-core-theme-compatibility.php

    diff --git src/bp-core/bp-core-theme-compatibility.php src/bp-core/bp-core-theme-compatibility.php
    index 787c6b5b0..f6a40e22b 100644
    function bp_theme_compat_reset_post( $args = array() ) { 
    665665 */
    666666function bp_template_include_theme_compat( $template = '' ) {
    667667        // If embed template, bail.
    668         if ( true === function_exists( 'is_embed' ) && is_embed() ) {
     668        if ( is_embed() ) {
    669669                return $template;
    670670        }
    671671
  • src/bp-core/classes/class-bp-admin.php

    diff --git src/bp-core/classes/class-bp-admin.php src/bp-core/classes/class-bp-admin.php
    index a7823ab0e..d0c0fa800 100644
    class BP_Admin { 
    562562         */
    563563        public function add_privacy_policy_content() {
    564564                // Nothing to do if we're running < WP 4.9.6.
    565                 if ( version_compare( $GLOBALS['wp_version'], '4.9.6', '<' ) ) {
     565                if ( bp_is_running_wp( '4.9.6', '<' ) ) {
    566566                        return;
    567567                }
    568568
  • src/bp-core/classes/class-bp-embed.php

    diff --git src/bp-core/classes/class-bp-embed.php src/bp-core/classes/class-bp-embed.php
    index b605ae700..4b1d160f5 100644
    class BP_Embed extends WP_Embed { 
    117117                 */
    118118                $id = apply_filters( 'embed_post_id', 0 );
    119119
    120                 $unfiltered_html   = current_user_can( 'unfiltered_html' );
    121                 $default_discovery = false;
    122 
    123120                // Since 4.4, WordPress is now an oEmbed provider.
    124                 if ( function_exists( 'wp_oembed_register_route' ) ) {
    125                         $unfiltered_html   = true;
    126                         $default_discovery = true;
    127                 }
     121                $unfiltered_html   = true;
     122                $default_discovery = true;
    128123
    129124                /**
    130125                 * Filters whether or not oEmbed discovery is on.
  • src/bp-groups/bp-groups-cssjs.php

    diff --git src/bp-groups/bp-groups-cssjs.php src/bp-groups/bp-groups-cssjs.php
    index a160fa3ee..4a2221486 100644
    function bp_groups_get_group_manage_members_script_data( $group_id = 0 ) { 
    5050        );
    5151
    5252        $preloaded_members = array();
    53         if ( function_exists( 'rest_preload_api_request' ) ) {
     53        if ( bp_is_running_wp( '5.0.0' ) ) {
    5454                $preloaded_members = rest_preload_api_request( '', $path );
    5555        }
    5656
  • src/bp-groups/bp-groups-filters.php

    diff --git src/bp-groups/bp-groups-filters.php src/bp-groups/bp-groups-filters.php
    index a3bd2e70f..29b424d20 100644
    add_filter( 'groups_group_name_before_save', 'trim' ); 
    5353add_filter( 'groups_group_description_before_save', 'trim' );
    5454
    5555// Support emoji.
    56 if ( function_exists( 'wp_encode_emoji' ) ) {
    57         add_filter( 'groups_group_description_before_save', 'wp_encode_emoji' );
    58 }
     56add_filter( 'groups_group_description_before_save', 'wp_encode_emoji' );
    5957
    6058// Escape output of new group creation details.
    6159add_filter( 'bp_get_new_group_name',        'esc_attr'     );
  • src/bp-members/bp-members-template.php

    diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php
    index b6dac6b9e..e202ea11b 100644
    function bp_signup_avatar_dir_value() { 
    24162416 */
    24172417function bp_signup_requires_privacy_policy_acceptance() {
    24182418        // Bail if we're running a version of WP that doesn't have the Privacy Policy feature.
    2419         if ( version_compare( $GLOBALS['wp_version'], '4.9.6', '<' ) ) {
     2419        if ( bp_is_running_wp( '4.9.6', '<' ) ) {
    24202420                return false;
    24212421        }
    24222422
  • src/bp-messages/bp-messages-filters.php

    diff --git src/bp-messages/bp-messages-filters.php src/bp-messages/bp-messages-filters.php
    index fad054023..14c20a1f9 100644
    add_filter( 'messages_message_subject_before_save', 'force_balance_tags' ); 
    3232add_filter( 'messages_notice_message_before_save',  'force_balance_tags' );
    3333add_filter( 'messages_notice_subject_before_save',  'force_balance_tags' );
    3434
    35 if ( function_exists( 'wp_encode_emoji' ) ) {
    36         add_filter( 'messages_message_subject_before_save', 'wp_encode_emoji' );
    37         add_filter( 'messages_message_content_before_save', 'wp_encode_emoji' );
    38         add_filter( 'messages_notice_message_before_save',  'wp_encode_emoji' );
    39         add_filter( 'messages_notice_subject_before_save',  'wp_encode_emoji' );
    40 }
     35add_filter( 'messages_message_subject_before_save', 'wp_encode_emoji' );
     36add_filter( 'messages_message_content_before_save', 'wp_encode_emoji' );
     37add_filter( 'messages_notice_message_before_save',  'wp_encode_emoji' );
     38add_filter( 'messages_notice_subject_before_save',  'wp_encode_emoji' );
    4139
    4240add_filter( 'bp_get_message_notice_subject',     'wptexturize' );
    4341add_filter( 'bp_get_message_notice_text',        'wptexturize' );
  • src/bp-settings/bp-settings-functions.php

    diff --git src/bp-settings/bp-settings-functions.php src/bp-settings/bp-settings-functions.php
    index bca439157..02eafb288 100644
    function bp_settings_get_personal_data_request( $user_id = 0 ) { 
    249249
    250250        if ( ! empty( $query->post ) ) {
    251251                // WP 5.4 changed the user request function name to wp_get_user_request()
    252                 $user_request = function_exists( 'wp_get_user_request' ) ? 'wp_get_user_request' : 'wp_get_user_request_data';
     252                $user_request = bp_is_running_wp( '4.9.6' ) ? 'wp_get_user_request' : 'wp_get_user_request_data';
    253253                return $user_request( $query->post->ID );
    254254        } else {
    255255                return false;
  • src/bp-settings/classes/class-bp-settings-component.php

    diff --git src/bp-settings/classes/class-bp-settings-component.php src/bp-settings/classes/class-bp-settings-component.php
    index dda4a928d..e48747f81 100644
    class BP_Settings_Component extends BP_Component { 
    193193                $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true );
    194194
    195195                // Export Data - only available for WP 4.9.6+.
    196                 if ( true === $show_data_page && version_compare( $GLOBALS['wp_version'], '4.9.6', '>=' ) ) {
     196                if ( true === $show_data_page && bp_is_running_wp( '4.9.6' ) ) {
    197197                        $sub_nav[] = array(
    198198                                'name'            => __( 'Export Data', 'buddypress' ),
    199199                                'slug'            => 'data',
    class BP_Settings_Component extends BP_Component { 
    268268                        $show_data_page = apply_filters( 'bp_settings_show_user_data_page', true );
    269269
    270270                        // Export Data.
    271                         if ( true === $show_data_page && version_compare( $GLOBALS['wp_version'], '4.9.6', '>=' ) ) {
     271                        if ( true === $show_data_page && bp_is_running_wp( '4.9.6' ) ) {
    272272                                $wp_admin_nav[] = array(
    273273                                        'parent'   => 'my-account-' . $this->id,
    274274                                        'id'       => 'my-account-' . $this->id . '-data',