Skip to content

Commit

Permalink
Merge pull request #2777 from woocommerce/release/2.9.6
Browse files Browse the repository at this point in the history
Release 2.9.6
  • Loading branch information
ianlin authored Jan 21, 2025
2 parents f25f66c + 36cfad0 commit f7693f6
Show file tree
Hide file tree
Showing 49 changed files with 451 additions and 436 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** Google for WooCommerce Changelog ***

= 2.9.6 - 2025-01-21 =
* Tweak - Resolve some of the plugin check errors and warnings.
* Tweak - Set specific flags for html_entity_decode.

= 2.9.5 - 2025-01-15 =
* Dev - Fix E2E tests in WC 9.6.
* Dev - Fix tests in WooCommerce 9.6.
Expand Down
7 changes: 5 additions & 2 deletions google-listings-and-ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Google for WooCommerce
* Plugin URL: https://wordpress.org/plugins/google-listings-and-ads/
* Description: Native integration with Google that allows merchants to easily display their products across Google’s network.
* Version: 2.9.5
* Version: 2.9.6
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: google-listings-and-ads
Expand All @@ -16,6 +16,9 @@
* WC tested up to: 9.6
* Woo:
*
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package WooCommerce\Admin
*/

Expand All @@ -30,7 +33,7 @@

defined( 'ABSPATH' ) || exit;

define( 'WC_GLA_VERSION', '2.9.5' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_VERSION', '2.9.6' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_MIN_PHP_VER', '7.4' );
define( 'WC_GLA_MIN_WC_VER', '7.9' );

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "google-listings-and-ads",
"title": "Google for WooCommerce",
"version": "2.9.5",
"version": "2.9.6",
"description": "Google for WooCommerce",
"author": "Automattic",
"license": "GPL-3.0-or-later",
Expand Down
11 changes: 1 addition & 10 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@
</properties>
</rule>

<!-- We'd rather use native functions -->
<rule ref="WordPress.WP.AlternativeFunctions">
<properties>
<property name="exclude" type="array">
<element value="json_encode"/>
<element value="rand"/>
</property>
</properties>
</rule>

<!-- We're judicious in our usage of meta queries -->
<rule ref="WordPress.DB.SlowDBQuery">
<properties>
Expand All @@ -118,6 +108,7 @@
<file>./bin</file>
<file>./views</file>
<file>./google-listings-and-ads.php</file>
<file>./uninstall.php</file>

<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>
Expand Down
17 changes: 5 additions & 12 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requires at least: 6.1
Tested up to: 6.7
Requires PHP: 7.4
Requires PHP Architecture: 64 Bits
Stable tag: 2.9.5
Stable tag: 2.9.6
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -140,6 +140,10 @@ To allow your products to appear in all relevant locations, make sure you’ve c

== Changelog ==

= 2.9.6 - 2025-01-21 =
* Tweak - Resolve some of the plugin check errors and warnings.
* Tweak - Set specific flags for html_entity_decode.

= 2.9.5 - 2025-01-15 =
* Dev - Fix E2E tests in WC 9.6.
* Dev - Fix tests in WooCommerce 9.6.
Expand All @@ -162,15 +166,4 @@ To allow your products to appear in all relevant locations, make sure you’ve c
* Tweak - Adjust conditions for MCM.
* Update - Google Ads API to v18.

= 2.9.3 - 2024-12-18 =
* Dev - Eliminate the duplicate functions used to group shipping time data.
* Dev - Improve E2E tests for related products.
* Fix - Budget Recommendation data not populating on install.
* Fix - PHP 8.4 package compatibility.
* Fix - Prevent duplicate conversion and purchase event tracking.
* Fix - The saved max shipping time is not showing after revisiting the free listings editing page.
* Tweak - Drop Jetpack packages and switch to packages bundled with WooCommerce.
* Tweak - WC 9.5 compatibility.
* Update - Drop support for WooCommerce < 7.9.

[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/google-listings-and-ads/trunk/changelog.txt).
2 changes: 1 addition & 1 deletion src/API/Google/AdsConversionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct( GoogleAdsClient $client ) {
*/
public function create_conversion_action(): array {
try {
$unique = sprintf( '%04x', mt_rand( 0, 0xffff ) );
$unique = sprintf( '%04x', wp_rand( 0, 0xffff ) );

$conversion_action_operation = new ConversionActionOperation();
$conversion_action_operation->setCreate(
Expand Down
2 changes: 1 addition & 1 deletion src/API/Google/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function connect( string $return_url, string $login_hint = '' ): string {
$result = $client->post(
$this->get_connection_url(),
[
'body' => json_encode( $post_body ),
'body' => wp_json_encode( $post_body ),

Check warning on line 55 in src/API/Google/Connection.php

View check run for this annotation

Codecov / codecov/patch

src/API/Google/Connection.php#L55

Added line #L55 was not covered by tests
]
);

Expand Down
12 changes: 6 additions & 6 deletions src/API/Google/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected function create_merchant_account_request( string $name, string $site_u
$result = $client->post(
$this->get_manager_url( 'create-merchant' ),
[
'body' => json_encode(
'body' => wp_json_encode(
[
'name' => $name,
'websiteUrl' => $site_url,
Expand Down Expand Up @@ -198,7 +198,7 @@ public function link_merchant_to_mca(): bool {
$result = $client->post(
$this->get_manager_url( 'link-merchant' ),
[
'body' => json_encode(
'body' => wp_json_encode(
[
'accountId' => $this->options->get_merchant_id(),
]
Expand Down Expand Up @@ -240,7 +240,7 @@ public function claim_merchant_website( bool $overwrite = false ): bool {
$result = $client->post(
$this->get_manager_url( 'claim-website' ),
[
'body' => json_encode(
'body' => wp_json_encode(
[
'accountId' => $this->options->get_merchant_id(),
'overwrite' => $overwrite,
Expand Down Expand Up @@ -299,7 +299,7 @@ public function create_ads_account(): array {
$result = $client->post(
$this->get_manager_url( $country . '/create-customer' ),
[
'body' => json_encode(
'body' => wp_json_encode(
[
'descriptive_name' => $this->new_account_name(),
'currency_code' => get_woocommerce_currency(),
Expand Down Expand Up @@ -358,7 +358,7 @@ public function link_ads_account( int $id ): array {
$result = $client->post(
$this->get_manager_url( 'link-customer' ),
[
'body' => json_encode(
'body' => wp_json_encode(
[
'client_customer' => $id,
]
Expand Down Expand Up @@ -429,7 +429,7 @@ public function mark_tos_accepted( string $service, string $email ): TosAccepted
$result = $client->post(
$this->get_tos_url( $service ),
[
'body' => json_encode(
'body' => wp_json_encode(
[
'email' => $email,
]
Expand Down
2 changes: 1 addition & 1 deletion src/API/WP/NotificationsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function notify( string $topic, $item_id = null, $data = [] ): bool {

do_action(
'woocommerce_gla_debug_message',
sprintf( 'Notification - Item ID: %s - Topic: %s - Data %s', $item_id, $topic, json_encode( $data ) ),
sprintf( 'Notification - Item ID: %s - Topic: %s - Data %s', $item_id, $topic, wp_json_encode( $data ) ),
__METHOD__
);

Expand Down
2 changes: 1 addition & 1 deletion src/Ads/AccountService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function get_connected_account(): array {
$status = [
'id' => $id,
'currency' => $this->options->get( OptionsInterface::ADS_ACCOUNT_CURRENCY ),
'symbol' => html_entity_decode( get_woocommerce_currency_symbol( $this->options->get( OptionsInterface::ADS_ACCOUNT_CURRENCY ) ) ),
'symbol' => html_entity_decode( get_woocommerce_currency_symbol( $this->options->get( OptionsInterface::ADS_ACCOUNT_CURRENCY ) ), ENT_QUOTES ),
'status' => $id ? 'connected' : 'disconnected',
];

Expand Down
2 changes: 1 addition & 1 deletion src/Assets/ScriptAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected function get_enqueue_callback(): callable {
}

foreach ( $this->inline_scripts as $variable_name => $data_array ) {
$inline_script = "var $variable_name = " . json_encode( $data_array );
$inline_script = "var $variable_name = " . wp_json_encode( $data_array );

Check warning on line 127 in src/Assets/ScriptAsset.php

View check run for this annotation

Codecov / codecov/patch

src/Assets/ScriptAsset.php#L127

Added line #L127 was not covered by tests
wp_add_inline_script( $this->handle, $inline_script, 'before' );
}

Expand Down
2 changes: 1 addition & 1 deletion src/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ protected function render_admin_page() {
<th><label>Errors:</label></th>
<td>
<p>
<code><?php echo isset( $this->integration_status_response['errors'] ) ? wp_kses_post( json_encode( $this->integration_status_response['errors'] ) ) ?? '' : '-'; ?></code>
<code><?php echo isset( $this->integration_status_response['errors'] ) ? wp_kses_post( wp_json_encode( $this->integration_status_response['errors'] ) ) ?? '' : '-'; ?></code>

Check warning on line 773 in src/ConnectionTest.php

View check run for this annotation

Codecov / codecov/patch

src/ConnectionTest.php#L773

Added line #L773 was not covered by tests
</p>
</td>
</tr>
Expand Down
14 changes: 7 additions & 7 deletions src/Coupon/CouponSyncer.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function update( WC_Coupon $coupon ) {
sprintf(
'Skipping coupon (ID: %s) because it does not pass validation: %s',
$coupon->get_id(),
json_encode( $validation_result )
wp_json_encode( $validation_result )

Check warning on line 145 in src/Coupon/CouponSyncer.php

View check run for this annotation

Codecov / codecov/patch

src/Coupon/CouponSyncer.php#L145

Added line #L145 was not covered by tests
),
__METHOD__
);
Expand All @@ -156,7 +156,7 @@ public function update( WC_Coupon $coupon ) {
sprintf(
'Start to upload coupon (ID: %s) as promotion structure: %s',
$coupon->get_id(),
json_encode( $adapted_coupon )
wp_json_encode( $adapted_coupon )
),
__METHOD__
);
Expand All @@ -172,7 +172,7 @@ public function update( WC_Coupon $coupon ) {
'woocommerce_gla_debug_message',
sprintf(
"Submitted promotion:\n%s",
json_encode( $adapted_coupon )
wp_json_encode( $adapted_coupon )
),
__METHOD__
);
Expand All @@ -195,7 +195,7 @@ public function update( WC_Coupon $coupon ) {
'woocommerce_gla_debug_message',
sprintf(
"Promotion failed to sync with Merchant Center:\n%s",
json_encode( $invalid_promotion )
wp_json_encode( $invalid_promotion )
),
__METHOD__
);
Expand Down Expand Up @@ -261,7 +261,7 @@ public function delete( DeleteCouponEntry $coupon ) {
sprintf(
'Start to delete coupon (ID: %s) as promotion structure: %s',
$coupon->get_wc_coupon_id(),
json_encode( $adapted_coupon )
wp_json_encode( $adapted_coupon )
),
__METHOD__
);
Expand Down Expand Up @@ -310,7 +310,7 @@ public function delete( DeleteCouponEntry $coupon ) {
sprintf(
"Failed to delete %s promotions from Merchant Center:\n%s",
count( $invalid_promotions ),
json_encode( $invalid_promotions )
wp_json_encode( $invalid_promotions )
),
__METHOD__
);
Expand All @@ -329,7 +329,7 @@ public function delete( DeleteCouponEntry $coupon ) {
sprintf(
"Deleted %s promoitons:\n%s",
count( $deleted_promotions ),
json_encode( $deleted_promotions )
wp_json_encode( $deleted_promotions )
),
__METHOD__
);
Expand Down
2 changes: 1 addition & 1 deletion src/DB/Migration/Migration20211228T1640692399.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function apply(): void {

if ( isset( $mc_settings['offers_free_shipping'] ) && false !== boolval( $mc_settings['offers_free_shipping'] ) && isset( $mc_settings['free_shipping_threshold'] ) ) {
// Move the free shipping threshold from the options to the shipping rate table.
$options_json = json_encode( [ 'free_shipping_threshold' => (float) $mc_settings['free_shipping_threshold'] ] );
$options_json = wp_json_encode( [ 'free_shipping_threshold' => (float) $mc_settings['free_shipping_threshold'] ] );

Check warning on line 68 in src/DB/Migration/Migration20211228T1640692399.php

View check run for this annotation

Codecov / codecov/patch

src/DB/Migration/Migration20211228T1640692399.php#L68

Added line #L68 was not covered by tests

// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
Expand Down
2 changes: 1 addition & 1 deletion src/DB/Query/ShippingRateQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function sanitize_value( string $column, $value ) {
throw InvalidQuery::invalid_value( $column );
}

$value = json_encode( $value );
$value = wp_json_encode( $value );

Check warning on line 49 in src/DB/Query/ShippingRateQuery.php

View check run for this annotation

Codecov / codecov/patch

src/DB/Query/ShippingRateQuery.php#L49

Added line #L49 was not covered by tests
}

return $value;
Expand Down
4 changes: 2 additions & 2 deletions src/DB/Table/AttributeMappingRulesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AttributeMappingRulesTable extends Table {
* @return string
*/
protected function get_install_query(): string {
return <<< SQL
return "
CREATE TABLE `{$this->get_sql_safe_name()}` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`attribute` varchar(255) NOT NULL,
Expand All @@ -31,7 +31,7 @@ protected function get_install_query(): string {
`categories` text NOT NULL,
PRIMARY KEY `id` (`id`)
) {$this->get_collation()};
SQL;
";
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/DB/Table/BudgetRecommendationTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BudgetRecommendationTable extends Table {
* @return string
*/
protected function get_install_query(): string {
return <<< SQL
return "
CREATE TABLE `{$this->get_sql_safe_name()}` (
id bigint(20) NOT NULL AUTO_INCREMENT,
currency varchar(3) NOT NULL,
Expand All @@ -38,7 +38,7 @@ protected function get_install_query(): string {
PRIMARY KEY (id),
UNIQUE KEY country_currency (country, currency)
) {$this->get_collation()};
SQL;
";
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/DB/Table/MerchantIssueTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MerchantIssueTable extends Table {
* @return string
*/
protected function get_install_query(): string {
return <<< SQL
return "
CREATE TABLE `{$this->get_sql_safe_name()}` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`product_id` bigint(20) NOT NULL,
Expand All @@ -39,7 +39,7 @@ protected function get_install_query(): string {
`created_at` datetime NOT NULL,
PRIMARY KEY `id` (`id`)
) {$this->get_collation()};
SQL;
";
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/DB/Table/ShippingRateTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ShippingRateTable extends Table {
* @return string
*/
protected function get_install_query(): string {
return <<< SQL
return "

Check warning on line 25 in src/DB/Table/ShippingRateTable.php

View check run for this annotation

Codecov / codecov/patch

src/DB/Table/ShippingRateTable.php#L25

Added line #L25 was not covered by tests
CREATE TABLE `{$this->get_sql_safe_name()}` (
id bigint(20) NOT NULL AUTO_INCREMENT,
country varchar(2) NOT NULL,
Expand All @@ -33,7 +33,7 @@ protected function get_install_query(): string {
KEY country (country),
KEY currency (currency)
) {$this->get_collation()};
SQL;
";

Check warning on line 36 in src/DB/Table/ShippingRateTable.php

View check run for this annotation

Codecov / codecov/patch

src/DB/Table/ShippingRateTable.php#L36

Added line #L36 was not covered by tests
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/DB/Table/ShippingTimeTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ShippingTimeTable extends Table {
* @return string
*/
protected function get_install_query(): string {
return <<< SQL
return "
CREATE TABLE `{$this->get_sql_safe_name()}` (
id bigint(20) NOT NULL AUTO_INCREMENT,
country varchar(2) NOT NULL,
Expand All @@ -31,7 +31,7 @@ protected function get_install_query(): string {
PRIMARY KEY (id),
KEY country (country)
) {$this->get_collation()};
SQL;
";
}

/**
Expand Down
Loading

0 comments on commit f7693f6

Please sign in to comment.