Skip to content

Commit

Permalink
Merge pull request #2728 from woocommerce/release/3.2.0
Browse files Browse the repository at this point in the history
Release v3.2.0
  • Loading branch information
ibndawood authored May 1, 2024
2 parents e26c9ec + 839bf33 commit 1cae610
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 981 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-on-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
php: [7.4, 8.2]
php: [7.4, 8.3]
name: Code sniff (PHP ${{ matrix.php }}, WP Latest)
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit"
strategy:
matrix:
php: [7.4, 8.0, 8.1, 8.2]
php: [7.4, 8.3]
wp-version: [latest]

steps:
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** Facebook for WooCommerce Changelog ***

= 3.2.0 - 2024-05-01 =
* Tweak - PHP8.3 to GitHub PHPCS and Unit Tests workflows.
* Update - Remove the sunsetted Messenger Chat feature.

= 3.1.15 - 2024-04-16 =
* Tweak - Replace the middleware URL from connect.woocommerce.com to api.woocommerce.com/integrations.
* Tweak - Test environment setup to resolve notice.
Expand Down
1 change: 0 additions & 1 deletion class-wc-facebookcommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ public function init() {
include_once 'facebook-commerce.php';

require_once __DIR__ . '/includes/fbproductfeed.php';
require_once __DIR__ . '/facebook-commerce-messenger-chat.php';

$this->heartbeat = new Heartbeat( WC()->queue() );
$this->heartbeat->init();
Expand Down
114 changes: 0 additions & 114 deletions facebook-commerce-messenger-chat.php

This file was deleted.

97 changes: 34 additions & 63 deletions facebook-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
/** @var WC_Facebookcommerce_EventsTracker instance. */
private $events_tracker;

/** @var WC_Facebookcommerce_MessengerChat instance. */
private $messenger_chat;

/** @var WC_Facebookcommerce_Background_Process instance. */
private $background_processor;

Expand Down Expand Up @@ -360,14 +357,6 @@ public function __construct( WC_Facebookcommerce $facebook_for_woocommerce ) {
$this->events_tracker = new WC_Facebookcommerce_EventsTracker( $user_info, $aam_settings );
}

// Initialize the messenger chat features.
$this->messenger_chat = new WC_Facebookcommerce_MessengerChat(
array(
'fb_page_id' => $this->get_facebook_page_id(),
'facebook_jssdk_version' => $this->get_js_sdk_version(),
)
);

// Update products on change of status.
add_action(
'transition_post_status',
Expand Down Expand Up @@ -400,7 +389,7 @@ public function __construct( WC_Facebookcommerce $facebook_for_woocommerce ) {
*/
public function __get( $key ) {
// Add warning for private properties.
if ( in_array( $key, array( 'events_tracker', 'messenger_chat', 'background_processor' ), true ) ) {
if ( in_array( $key, array( 'events_tracker', 'background_processor' ), true ) ) {
/* translators: %s property name. */
_doing_it_wrong( __FUNCTION__, sprintf( esc_html__( 'The %s property is private and should not be accessed outside its class.', 'facebook-for-woocommerce' ), esc_html( $key ) ), '3.0.32' );
return $this->$key;
Expand Down Expand Up @@ -717,7 +706,7 @@ public function load_assets() {
<script>
window.facebookAdsToolboxConfig = {
hasGzipSupport: '<?php echo extension_loaded( 'zlib' ) ? 'true' : 'false'; ?>',
enabledPlugins: ['MESSENGER_CHAT','INSTAGRAM_SHOP', 'PAGE_SHOP'],
enabledPlugins: ['INSTAGRAM_SHOP', 'PAGE_SHOP'],
enableSubscription: '<?php echo class_exists( 'WC_Subscriptions' ) ? 'true' : 'false'; ?>',
popupOrigin: '<?php echo isset( $_GET['url'] ) ? esc_js( sanitize_text_field( wp_unslash( $_GET['url'] ) ) ) : 'https://www.facebook.com/'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>',
feedWasDisabled: 'true',
Expand Down Expand Up @@ -2499,62 +2488,43 @@ public function get_product_description_mode() {
* Gets the configured Facebook messenger locale.
*
* @since 1.10.0
* @deprecated 3.2.0
*
* @return string
*/
public function get_messenger_locale() {
/**
* Filters the configured Facebook messenger locale.
*
* @since 1.10.0
*
* @param string $locale the configured Facebook messenger locale
* @param \WC_Facebookcommerce_Integration $integration the integration instance
*/
return (string) apply_filters( 'wc_facebook_messenger_locale', get_option( self::SETTING_MESSENGER_LOCALE, 'en_US' ), $this );
$this->messenger_doing_it_wrong();
return 'en_US';
}

/**
* Gets the configured Facebook messenger greeting.
*
* @since 1.10.0
* @deprecated 3.2.0
*
* @return string
*/
public function get_messenger_greeting() {
/**
* Filters the configured Facebook messenger greeting.
*
* @since 1.10.0
*
* @param string $greeting the configured Facebook messenger greeting
* @param \WC_Facebookcommerce_Integration $integration the integration instance
*/
$greeting = (string) apply_filters( 'wc_facebook_messenger_greeting', get_option( self::SETTING_MESSENGER_GREETING, __( "Hi! We're here to answer any questions you may have.", 'facebook-for-woocommerce' ) ), $this );
return Helper::str_truncate( $greeting, $this->get_messenger_greeting_max_characters(), '' );
$this->messenger_doing_it_wrong();
return Helper::str_truncate(
__( "Hi! We're here to answer any questions you may have.", 'facebook-for-woocommerce' ),
$this->get_messenger_greeting_max_characters(),
''
);
}

/**
* Gets the maximum number of characters allowed in the messenger greeting.
*
* @since 1.10.0
* @deprecated 3.2.0
*
* @return int
*/
public function get_messenger_greeting_max_characters() {
$default = 80;

/**
* Filters the maximum number of characters allowed in the messenger greeting.
*
* @since 1.10.0
*
* @param int $max the maximum number of characters allowed in the messenger greeting
* @param \WC_Facebookcommerce_Integration $integration the integration instance
*/
$max = (int) apply_filters( 'wc_facebook_messenger_greeting_max_characters', $default, $this );

return $max < 1 ? $default : $max;
$this->messenger_doing_it_wrong();
return 80;
}

/**
Expand All @@ -2563,19 +2533,13 @@ public function get_messenger_greeting_max_characters() {
* This is used to style the messenger UI.
*
* @since 1.10.0
* @deprecated 3.2.0
*
* @return string
*/
public function get_messenger_color_hex() {
/**
* Filters the configured Facebook messenger color hex.
*
* @since 1.10.0
*
* @param string $hex the configured Facebook messenger color hex
* @param \WC_Facebookcommerce_Integration $integration the integration instance
*/
return (string) apply_filters( 'wc_facebook_messenger_color_hex', get_option( self::SETTING_MESSENGER_COLOR_HEX, '#0084ff' ), $this );
$this->messenger_doing_it_wrong();
return '#0084ff';
}

/** Setter methods ************************************************************************************************/
Expand Down Expand Up @@ -2746,19 +2710,26 @@ public function is_legacy_feed_file_generation_enabled() {
* Determines whether the Facebook messenger is enabled.
*
* @since 1.10.0
* @deprecated 3.2.0
*
* @return bool
*/
public function is_messenger_enabled() {
/**
* Filters whether the Facebook messenger is enabled.
*
* @since 1.10.0
*
* @param bool $is_enabled whether the Facebook messenger is enabled
* @param \WC_Facebookcommerce_Integration $integration the integration instance
*/
return (bool) apply_filters( 'wc_facebook_is_messenger_enabled', 'yes' === get_option( self::SETTING_ENABLE_MESSENGER ), $this );
$this->messenger_doing_it_wrong();
return false;
}

/**
* Show _doing_it_wrong for any deprecated public Messenger-related methods.
*
* @since 3.2.0
*/
private function messenger_doing_it_wrong() {
_doing_it_wrong(
__FUNCTION__,
esc_html__( 'The Facebook Messenger chat plugin was deprecated in May 2024.', 'facebook-for-woocommerce' ),
'3.2.0'
);
}

/**
Expand Down
36 changes: 2 additions & 34 deletions facebook-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Description: Grow your business on Facebook! Use this official plugin to help sell more of your products using Facebook. After completing the setup, you'll be ready to create ads that promote your products and you can also create a shop section on your Page where customers can browse your products on Facebook.
* Author: Facebook
* Author URI: https://www.facebook.com/
* Version: 3.1.15
* Version: 3.2.0
* Requires at least: 5.6
* Text Domain: facebook-for-woocommerce
* Tested up to: 6.5
Expand Down Expand Up @@ -44,7 +44,7 @@ class WC_Facebook_Loader {
/**
* @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease.
*/
const PLUGIN_VERSION = '3.1.15'; // WRCS: DEFINED_VERSION.
const PLUGIN_VERSION = '3.2.0'; // WRCS: DEFINED_VERSION.

// Minimum PHP version required by this plugin.
const MINIMUM_PHP_VERSION = '7.4.0';
Expand Down Expand Up @@ -85,13 +85,11 @@ class WC_Facebook_Loader {
protected function __construct() {

register_activation_hook( __FILE__, array( $this, 'activation_check' ) );
register_deactivation_hook( __FILE__, array( $this, 'maybe_remove_messenger_deprecation_notice' ) );

add_action( 'admin_init', array( $this, 'check_environment' ) );

add_action( 'admin_notices', array( $this, 'add_plugin_notices' ) ); // admin_init is too early for the get_current_screen() function.
add_action( 'admin_notices', array( $this, 'admin_notices' ), 15 );
add_action( 'admin_notices', array( $this, 'maybe_show_messenger_deprecation_notice' ), 14 );

// If the environment check fails, initialize the plugin.
if ( $this->is_environment_compatible() ) {
Expand Down Expand Up @@ -298,36 +296,6 @@ public function add_plugin_notices() {

}

/**
* Adds warning notice that Facebook Messenger will be deprecated if the setting is enabled.
*
* @since 3.1.13
*/
public function maybe_show_messenger_deprecation_notice() {
// Display the notice on the Facebook for WooCommerce settings pages (except Messenger settings, which has a static notice).
$notice_slug = 'facebook_messenger_deprecation_warning';
$is_facebook_admin = isset( $_GET['page'] ) && 'wc-facebook' === $_GET['page'];
$is_messenger_settings = isset( $_GET['tab'] ) && 'messenger' === $_GET['tab'];
$has_deprecation_notice_queued = class_exists( 'WC_Admin_Notices' ) && \WC_Admin_Notices::has_notice( $notice_slug );

if( $is_facebook_admin && ! $is_messenger_settings && $has_deprecation_notice_queued ) {
\WC_Admin_Notices::output_custom_notices();
}
}

/**
* Removes facebook_messenger_deprecation_warning notice if it exists.
*
* @since 3.1.14
* @return void
*/
public function maybe_remove_messenger_deprecation_notice() {
$notice_slug = 'facebook_messenger_deprecation_warning';
if( class_exists( 'WC_Admin_Notices' ) && \WC_Admin_Notices::has_notice( $notice_slug ) ) {
\WC_Admin_Notices::remove_notice( $notice_slug );
}
}


/**
* Determines if the required plugins are compatible.
Expand Down
Loading

0 comments on commit 1cae610

Please sign in to comment.