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 2.9.6 #2777

Merged
merged 20 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
db79890
Adjust the proxy in `MockRequests` to make the `fulfillRequest` optio…
eason9487 Jan 16, 2025
1375d8b
Add `withFulfillDeferred` method to `MockRequests` to defer the fulfi…
eason9487 Jan 16, 2025
d0dccb9
Fix the flaky E2E test which asserts the auto-creation of Google Ads …
eason9487 Jan 16, 2025
7896619
Speed up the E2E test which asserts the ad billing status change.
eason9487 Jan 16, 2025
a3a0a7a
Remove the timeout options that are no longer needed from E2E testing.
eason9487 Jan 16, 2025
f88648c
Merge pull request #2769 from woocommerce/dev/improve-e2e-tests
eason9487 Jan 16, 2025
c92acd5
Set specific flags for html_entity_decode
mikkamp Jan 16, 2025
823e80a
Remove exclusion for alternative functions
mikkamp Jan 16, 2025
cd22f66
Replace alternative functions
mikkamp Jan 16, 2025
8b6d0a2
Stop using heredoc syntax
mikkamp Jan 16, 2025
477f2e9
Add license to plugin header - same as readme.txt
mikkamp Jan 16, 2025
fd3a02b
Add liniting for uninstall.php
mikkamp Jan 16, 2025
b371832
WP functions are not available in scripts
mikkamp Jan 16, 2025
a80bf4a
Merge pull request #2771 from woocommerce/fix/2770-html-entity-decode
mikkamp Jan 17, 2025
9949c75
Merge pull request #2772 from woocommerce/tweak/plugin-check-errors-a…
mikkamp Jan 17, 2025
db77506
Start `release/2.9.6`.
github-actions[bot] Jan 21, 2025
5ba002c
Remove older changelog entries
ianlin Jan 21, 2025
10282f0
woorelease: Product version bump update
Jan 21, 2025
e61bbe9
woorelease: Changelog update
Jan 21, 2025
36cfad0
Update hooks documentation from branch.
github-actions[bot] Jan 21, 2025
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
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 ),
]
);

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 );
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>
</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 )
),
__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'] ] );

// 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 );
}

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 "
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;
";
}

/**
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
Loading