Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v3.2.0 #2728

Merged
merged 35 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a95c3e7
Remove Messenger settings tab
layoutd Apr 11, 2024
283bd2d
Remove messenger breadcrumbs
layoutd Apr 11, 2024
56cf714
Mark Settings_Screens/Messenger class as deprecated
layoutd Apr 11, 2024
6e3e505
Remove deprecation notice on upgrade
layoutd Apr 11, 2024
839598d
Deprecate and force false for is_messenger_enabled()
layoutd Apr 11, 2024
4c0bdcb
Don't initialize the messenger chat features
layoutd Apr 11, 2024
8ebf0c1
Remove messenger_chat property
layoutd Apr 11, 2024
5b4727c
Mark WC_Facebookcommerce_MessengerChat as deprecated
layoutd Apr 11, 2024
e02207d
Remove messenger_chat from magic method
layoutd Apr 11, 2024
4be30a5
Remove messenger_chat from facebookAdsToolboxConfig
layoutd Apr 11, 2024
8c9cd52
Delete messenger settings options on upgrade
layoutd Apr 11, 2024
1a3f668
Mark deprecated wc_facebook_is_messenger_enabled filter
layoutd Apr 11, 2024
cc1aac9
Mark deprecated messenger settings accessors and filters
layoutd Apr 11, 2024
656967b
No longer init the deprecation notice
layoutd Apr 11, 2024
fb5038a
No need to require the messenger-chat class file anymore
layoutd Apr 11, 2024
3c5092e
Upgrading will remove the deprecation notice, no need for deactivatio…
layoutd Apr 11, 2024
e70e1ef
messenger_enabled tests should always be false
layoutd Apr 12, 2024
fdf1863
Include 3.2.0 upgrade in list
layoutd Apr 12, 2024
65b9bea
Delete messenger settings screen class
layoutd Apr 16, 2024
3934ca2
Remove messenger-related filters and invoke _doing_it_wrong
layoutd Apr 16, 2024
e27d29b
Remove WC_Facebookcommerce_MessengerChat class
layoutd Apr 16, 2024
eb24fd0
Clarify class doc
layoutd Apr 16, 2024
84ea046
Remove Messenger config from reconnection URL params
layoutd Apr 16, 2024
5c6882c
Remove messenger deprecation notice handlers
layoutd Apr 16, 2024
061f40a
Remove messenger enabled data from WC Tracker info
layoutd Apr 16, 2024
611a19a
Leave only messenger enabled unit tests
layoutd Apr 16, 2024
12c8f43
Remove messenger functionality from FBE API and tests
layoutd Apr 16, 2024
731d15c
Merge pull request #2722 from woocommerce/release/3.1.15
rawdreeg Apr 16, 2024
868522a
Change is messenger enabled to expectedIncorrectUsage
layoutd Apr 17, 2024
fe752c0
Adding php8.3 to GitHub workflow for unit tests.
message-dimke Apr 22, 2024
1520f57
Adding php8.3 to GitHub workflow for PHPCS.
message-dimke Apr 23, 2024
330c1ae
Merge pull request #2727 from woocommerce/tweak/github-workflow-php83
message-dimke Apr 23, 2024
7c077bb
Merge pull request #2719 from woocommerce/remove/deprecate-facebook-m…
layoutd Apr 25, 2024
faa513f
Product version bump update
ibndawood May 1, 2024
839bf33
Changelog update
ibndawood May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading