From f35b6cfa2f3f4b9b9977703201ac1903683db627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20Wytr=C4=99bowicz?= Date: Mon, 24 Jul 2023 17:19:25 +0200 Subject: [PATCH 01/65] Add automerge-released-trunk workflow to automate merging trunk to develop after a release --- .github/workflows/post-release-automerge.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/post-release-automerge.yml diff --git a/.github/workflows/post-release-automerge.yml b/.github/workflows/post-release-automerge.yml new file mode 100644 index 000000000..8555f5c4f --- /dev/null +++ b/.github/workflows/post-release-automerge.yml @@ -0,0 +1,19 @@ +name: 'Merge the release to develop' +run-name: Merge the released `${{ github.head_ref }}` from `trunk` to `develop` + +# **What it does**: Merges trunk to develop after `release/*` is merged to `trunk`. +# **Why we have it**: To automate the release process and follow git-flow. + +on: + pull_request: + types: + - closed + branches: + - trunk + +jobs: + automerge_trunk: + name: Automerge released trunk + runs-on: ubuntu-latest + steps: + - uses: woocommerce/grow/automerge-released-trunk@actions-v1 From 6f6508b0308f0ef4e2a2647e38aedb71395ab1dc Mon Sep 17 00:00:00 2001 From: Dima Date: Tue, 25 Jul 2023 13:28:31 +0300 Subject: [PATCH 02/65] Add silent exception handling. --- class-pinterest-for-woocommerce.php | 6 +++++- src/API/Base.php | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/class-pinterest-for-woocommerce.php b/class-pinterest-for-woocommerce.php index ce990f0ff..3bc4e71a4 100644 --- a/class-pinterest-for-woocommerce.php +++ b/class-pinterest-for-woocommerce.php @@ -1109,7 +1109,11 @@ public static function update_linked_businesses() { array_key_exists( 'is_partner', $account_data ) && ! $account_data['is_partner']; - $fetched_businesses = $fetch_linked_businesses ? Pinterest\API\Base::get_linked_businesses() : array(); + try { + $fetched_businesses = $fetch_linked_businesses ? Pinterest\API\Base::get_linked_businesses() : array(); + } catch ( Exception $e ) { + $fetched_businesses = array(); + } if ( ! empty( $fetched_businesses ) && 'success' === $fetched_businesses['status'] ) { $linked_businesses = $fetched_businesses['data']; diff --git a/src/API/Base.php b/src/API/Base.php index 3d39a6ec3..53d0dbeea 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -396,7 +396,9 @@ public static function get_account_info() { /** * Get the linked business accounts from the API. * - * @return mixed + * @return array + * + * @throws ApiException|Exception */ public static function get_linked_businesses() { return self::make_request( 'users/me/businesses', 'GET' ); From 0ce46d639589faabc2d26d6f6f486c0d10a837d6 Mon Sep 17 00:00:00 2001 From: Dima Date: Tue, 25 Jul 2023 13:37:24 +0300 Subject: [PATCH 03/65] Fix PHP code styling error. --- src/API/Base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/API/Base.php b/src/API/Base.php index 53d0dbeea..ab124a2a0 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -398,7 +398,7 @@ public static function get_account_info() { * * @return array * - * @throws ApiException|Exception + * @throws ApiException|Exception Pinterest API or PHP exceptions. */ public static function get_linked_businesses() { return self::make_request( 'users/me/businesses', 'GET' ); From b2c389cc153ebf3d65ee406676e0cff53db4b8f0 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Tue, 15 Aug 2023 12:14:42 +0100 Subject: [PATCH 04/65] Adds logic to dynamically display spend requirement and credits given based on store currency. --- .../catalog-sync/sections/AdCreditsNotice.js | 10 ++- class-pinterest-for-woocommerce.php | 15 +++++ src/API/Options.php | 5 ++ src/AdsCreditCurrency.php | 66 +++++++++++++++++++ 4 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 src/AdsCreditCurrency.php diff --git a/assets/source/catalog-sync/sections/AdCreditsNotice.js b/assets/source/catalog-sync/sections/AdCreditsNotice.js index 939f05e61..c18d04b56 100644 --- a/assets/source/catalog-sync/sections/AdCreditsNotice.js +++ b/assets/source/catalog-sync/sections/AdCreditsNotice.js @@ -49,6 +49,11 @@ const AdCreditsNotice = () => { const appSettings = useSettingsSelect(); const isBillingSetup = appSettings?.account_data?.is_billing_setup; const trackingAdvertiser = appSettings?.tracking_advertiser; + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + // console.log ( 'test Hello' ); + // console.log ( appSettings ); + // console.log(currencyCreditInfo); + // console.log(currencyCreditInfo['currency']) const closeAdCreditsNotice = () => { setIsNoticeDisplayed( false ); @@ -80,14 +85,15 @@ const AdCreditsNotice = () => { { isBillingSetup ? ( { __( - 'Spend $15 to claim $125 Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).' + `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendReq'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditGiven'] } in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).`, + 'pinterest-for-woocommerce' ) } ) : ( { createInterpolateElement( __( - 'Spend $15 to get $125 in Pinterest ad credits. To claim the credits, add your billing details.', + `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendReq'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditGiven'] } in Pinterest ad credits. To claim the credits, add your billing details.`, 'pinterest-for-woocommerce' ), { diff --git a/class-pinterest-for-woocommerce.php b/class-pinterest-for-woocommerce.php index ce990f0ff..31e1c516b 100644 --- a/class-pinterest-for-woocommerce.php +++ b/class-pinterest-for-woocommerce.php @@ -9,6 +9,7 @@ use Automattic\WooCommerce\Pinterest as Pinterest; use Automattic\WooCommerce\Pinterest\AdCredits; use Automattic\WooCommerce\Pinterest\AdCreditsCoupons; +use Automattic\WooCommerce\Pinterest\AdsCreditCurrency; use Automattic\WooCommerce\Pinterest\Billing; use Automattic\WooCommerce\Pinterest\Heartbeat; use Automattic\WooCommerce\Pinterest\Notes\MarketingNotifications; @@ -1020,6 +1021,20 @@ public static function add_redeem_credits_info_to_account_data() { self::save_setting( 'account_data', $account_data ); } + /** + * Add currency_credit_info information to the account data option. + * + * @since x.x.x + * + * @return void + */ + public static function add_currency_credits_info_to_account_data() { + $account_data = self::get_setting( 'account_data' ); + $currency_credit_info = AdsCreditCurrency::get_currency_credits(); + $account_data['currency_credit_info'] = $currency_credit_info; + self::save_setting( 'account_data', $account_data ); + } + /** * Add available credits information to the account data option. * diff --git a/src/API/Options.php b/src/API/Options.php index 117f6f99b..5ead84620 100644 --- a/src/API/Options.php +++ b/src/API/Options.php @@ -44,6 +44,11 @@ public function __construct() { */ public function get_settings() { Pinterest_For_Woocommerce()::maybe_check_billing_setup(); + Pinterest_For_Woocommerce()::add_currency_credits_info_to_account_data(); + // $myarray = array( + // PINTEREST_FOR_WOOCOMMERCE_OPTION_NAME => Pinterest_For_Woocommerce()::get_settings( true ), + // ); + // error_log(print_r($myarray, true)); return array( PINTEREST_FOR_WOOCOMMERCE_OPTION_NAME => Pinterest_For_Woocommerce()::get_settings( true ), ); diff --git a/src/AdsCreditCurrency.php b/src/AdsCreditCurrency.php new file mode 100644 index 000000000..69e56ad30 --- /dev/null +++ b/src/AdsCreditCurrency.php @@ -0,0 +1,66 @@ + array(15, 125), + "EUR" => array(15, 131), + "GBP" => array(13, 117), + "BRL" => array(80, 673), + "CAD" => array(20, 172), + "AUD" => array(23, 195), + "MXN" => array(305, 2548), + "ARS" => array(2198, 18320), + "CHF" => array(14, 124), + "CZK" => array(385, 3216), + "DKK" => array(116, 970), + "HUF" => array(6366, 53050), + "JPY" => array(2172, 18102), + "NOK" => array(162, 1353), + "NZD" => array(26, 222), + "PLN" => array(74, 624), + "RON" => array(77, 646), + "SEK" => array(170, 1424) + ); + + /** + * Get spend requirement and credits based on currency. + * + * @since x.x.x + * + * @return array $result Amount to be spent, credits given and currency symbol. + */ + public static function get_currency_credits() { + + $currency = get_woocommerce_currency(); + $currency_symbol = html_entity_decode( get_woocommerce_currency_symbol() ); + $credits_array = ( !array_key_exists( $currency, self::$currency_credits_map ) || $currency === 'USD' ) ? self::$currency_credits_map[ 'USD' ] : self::$currency_credits_map[ $currency ]; + list( $spend_require, $credits_given ) = $credits_array; + + $result = array( + 'spendReq' => $spend_require, + 'creditGiven' => $credits_given, + 'currency' => $currency_symbol + ); + + return $result; + } +} From 46fb8eb45b2e2d0f5521d6955c0cbb48df650292 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Tue, 15 Aug 2023 12:31:20 +0100 Subject: [PATCH 05/65] Code cleanup. --- assets/source/catalog-sync/sections/AdCreditsNotice.js | 8 ++------ src/API/Options.php | 4 ---- src/AdsCreditCurrency.php | 4 ++-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/assets/source/catalog-sync/sections/AdCreditsNotice.js b/assets/source/catalog-sync/sections/AdCreditsNotice.js index c18d04b56..9c563c9e7 100644 --- a/assets/source/catalog-sync/sections/AdCreditsNotice.js +++ b/assets/source/catalog-sync/sections/AdCreditsNotice.js @@ -50,10 +50,6 @@ const AdCreditsNotice = () => { const isBillingSetup = appSettings?.account_data?.is_billing_setup; const trackingAdvertiser = appSettings?.tracking_advertiser; const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; - // console.log ( 'test Hello' ); - // console.log ( appSettings ); - // console.log(currencyCreditInfo); - // console.log(currencyCreditInfo['currency']) const closeAdCreditsNotice = () => { setIsNoticeDisplayed( false ); @@ -85,7 +81,7 @@ const AdCreditsNotice = () => { { isBillingSetup ? ( { __( - `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendReq'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditGiven'] } in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).`, + `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendRequire'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditsGiven'] } in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).`, 'pinterest-for-woocommerce' ) } @@ -93,7 +89,7 @@ const AdCreditsNotice = () => { { createInterpolateElement( __( - `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendReq'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditGiven'] } in Pinterest ad credits. To claim the credits, add your billing details.`, + `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendRequire'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditsGiven'] } in Pinterest ad credits. To claim the credits, add your billing details.`, 'pinterest-for-woocommerce' ), { diff --git a/src/API/Options.php b/src/API/Options.php index 5ead84620..8651f0294 100644 --- a/src/API/Options.php +++ b/src/API/Options.php @@ -45,10 +45,6 @@ public function __construct() { public function get_settings() { Pinterest_For_Woocommerce()::maybe_check_billing_setup(); Pinterest_For_Woocommerce()::add_currency_credits_info_to_account_data(); - // $myarray = array( - // PINTEREST_FOR_WOOCOMMERCE_OPTION_NAME => Pinterest_For_Woocommerce()::get_settings( true ), - // ); - // error_log(print_r($myarray, true)); return array( PINTEREST_FOR_WOOCOMMERCE_OPTION_NAME => Pinterest_For_Woocommerce()::get_settings( true ), ); diff --git a/src/AdsCreditCurrency.php b/src/AdsCreditCurrency.php index 69e56ad30..576ba25da 100644 --- a/src/AdsCreditCurrency.php +++ b/src/AdsCreditCurrency.php @@ -56,8 +56,8 @@ public static function get_currency_credits() { list( $spend_require, $credits_given ) = $credits_array; $result = array( - 'spendReq' => $spend_require, - 'creditGiven' => $credits_given, + 'spendRequire' => $spend_require, + 'creditsGiven' => $credits_given, 'currency' => $currency_symbol ); From 121cb7ab93b32f3de3589a8b9a031cc96d3eadbb Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Tue, 15 Aug 2023 12:58:54 +0100 Subject: [PATCH 06/65] Fixes PHPCS and JS linting issues. --- .../catalog-sync/sections/AdCreditsNotice.js | 4 +- src/AdsCreditCurrency.php | 86 +++++++++---------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/assets/source/catalog-sync/sections/AdCreditsNotice.js b/assets/source/catalog-sync/sections/AdCreditsNotice.js index 9c563c9e7..ed10d474c 100644 --- a/assets/source/catalog-sync/sections/AdCreditsNotice.js +++ b/assets/source/catalog-sync/sections/AdCreditsNotice.js @@ -81,7 +81,7 @@ const AdCreditsNotice = () => { { isBillingSetup ? ( { __( - `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendRequire'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditsGiven'] } in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).`, + `Spend ${ currencyCreditInfo.currency }${ currencyCreditInfo.spendRequire } to claim ${ currencyCreditInfo.currency }${ currencyCreditInfo.creditsGiven } in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).`, 'pinterest-for-woocommerce' ) } @@ -89,7 +89,7 @@ const AdCreditsNotice = () => { { createInterpolateElement( __( - `Spend ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['spendRequire'] } to claim ${ currencyCreditInfo['currency'] }${ currencyCreditInfo['creditsGiven'] } in Pinterest ad credits. To claim the credits, add your billing details.`, + `Spend ${ currencyCreditInfo.currency }${ currencyCreditInfo.spendRequire } to claim ${ currencyCreditInfo.currency }${ currencyCreditInfo.creditsGiven } in Pinterest ad credits. To claim the credits, add your billing details.`, 'pinterest-for-woocommerce' ), { diff --git a/src/AdsCreditCurrency.php b/src/AdsCreditCurrency.php index 576ba25da..1e886782c 100644 --- a/src/AdsCreditCurrency.php +++ b/src/AdsCreditCurrency.php @@ -9,7 +9,7 @@ namespace Automattic\WooCommerce\Pinterest; if ( ! defined( 'ABSPATH' ) ) { - exit; + exit; } /** @@ -17,50 +17,50 @@ */ class AdsCreditCurrency { - /** - * @var array $currency_credits_map Mapping of currency to spend requirement and credit given. - */ - public static $currency_credits_map = array( - "USD" => array(15, 125), - "EUR" => array(15, 131), - "GBP" => array(13, 117), - "BRL" => array(80, 673), - "CAD" => array(20, 172), - "AUD" => array(23, 195), - "MXN" => array(305, 2548), - "ARS" => array(2198, 18320), - "CHF" => array(14, 124), - "CZK" => array(385, 3216), - "DKK" => array(116, 970), - "HUF" => array(6366, 53050), - "JPY" => array(2172, 18102), - "NOK" => array(162, 1353), - "NZD" => array(26, 222), - "PLN" => array(74, 624), - "RON" => array(77, 646), - "SEK" => array(170, 1424) - ); + /** + * @var array $currency_credits_map Mapping of currency to spend requirement and credit given. + */ + public static $currency_credits_map = array( + 'USD' => array( 15, 125 ), + 'EUR' => array( 15, 131 ), + 'GBP' => array( 13, 117 ), + 'BRL' => array( 80, 673 ), + 'CAD' => array( 20, 172 ), + 'AUD' => array( 23, 195 ), + 'MXN' => array( 305, 2548 ), + 'ARS' => array( 2198, 18320 ), + 'CHF' => array( 14, 124 ), + 'CZK' => array( 385, 3216 ), + 'DKK' => array( 116, 970 ), + 'HUF' => array( 6366, 53050 ), + 'JPY' => array( 2172, 18102 ), + 'NOK' => array( 162, 1353 ), + 'NZD' => array( 26, 222 ), + 'PLN' => array( 74, 624 ), + 'RON' => array( 77, 646 ), + 'SEK' => array( 170, 1424 ), + ); - /** - * Get spend requirement and credits based on currency. - * - * @since x.x.x - * - * @return array $result Amount to be spent, credits given and currency symbol. - */ - public static function get_currency_credits() { + /** + * Get spend requirement and credits based on currency. + * + * @since x.x.x + * + * @return array $result Amount to be spent, credits given and currency symbol. + */ + public static function get_currency_credits() { - $currency = get_woocommerce_currency(); - $currency_symbol = html_entity_decode( get_woocommerce_currency_symbol() ); - $credits_array = ( !array_key_exists( $currency, self::$currency_credits_map ) || $currency === 'USD' ) ? self::$currency_credits_map[ 'USD' ] : self::$currency_credits_map[ $currency ]; - list( $spend_require, $credits_given ) = $credits_array; + $currency = get_woocommerce_currency(); + $currency_symbol = html_entity_decode( get_woocommerce_currency_symbol() ); + $credits_array = ( ! array_key_exists( $currency, self::$currency_credits_map ) || 'USD' === $currency ) ? self::$currency_credits_map['USD'] : self::$currency_credits_map[ $currency ]; + list( $spend_require, $credits_given ) = $credits_array; - $result = array( - 'spendRequire' => $spend_require, - 'creditsGiven' => $credits_given, - 'currency' => $currency_symbol - ); + $result = array( + 'spendRequire' => $spend_require, + 'creditsGiven' => $credits_given, + 'currency' => $currency_symbol, + ); - return $result; - } + return $result; + } } From 5b55682fbd1619a068c1ad2b88799b08b36ab59d Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Thu, 17 Aug 2023 18:33:19 +0100 Subject: [PATCH 07/65] Adds translator comment and values with sprintf. --- .../catalog-sync/sections/AdCreditsNotice.js | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/assets/source/catalog-sync/sections/AdCreditsNotice.js b/assets/source/catalog-sync/sections/AdCreditsNotice.js index ed10d474c..031a747f6 100644 --- a/assets/source/catalog-sync/sections/AdCreditsNotice.js +++ b/assets/source/catalog-sync/sections/AdCreditsNotice.js @@ -2,7 +2,7 @@ * External dependencies */ import { recordEvent } from '@woocommerce/tracks'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { createInterpolateElement, useCallback, @@ -80,18 +80,22 @@ const AdCreditsNotice = () => { /> { isBillingSetup ? ( - { __( - `Spend ${ currencyCreditInfo.currency }${ currencyCreditInfo.spendRequire } to claim ${ currencyCreditInfo.currency }${ currencyCreditInfo.creditsGiven } in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).`, - 'pinterest-for-woocommerce' - ) } + { sprintf( + // translators: %1$s: Currency symbol. %2$s: Amount of money required to spend to claim ad credits. %3$s: Amount of ad credits given. + __( + 'Spend %1$s%2$s to claim %1$s%3$s in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).', 'pinterest-for-woocommerce' + ), currencyCreditInfo.currency, currencyCreditInfo.spendRequire, currencyCreditInfo.creditsGiven + ) } ) : ( { createInterpolateElement( - __( - `Spend ${ currencyCreditInfo.currency }${ currencyCreditInfo.spendRequire } to claim ${ currencyCreditInfo.currency }${ currencyCreditInfo.creditsGiven } in Pinterest ad credits. To claim the credits, add your billing details.`, - 'pinterest-for-woocommerce' - ), + sprintf( + // translators: %1: Currency symbol. %2$s: Amount of money required to spend to claim ad credits. %3$s: Amount of ad credits given. + __( + 'Spend %1$s%2$s to claim %1$s%3$s in Pinterest ad credits. To claim the credits, add your billing details.', 'pinterest-for-woocommerce' + ), currencyCreditInfo.currency, currencyCreditInfo.spendRequire, currencyCreditInfo.creditsGiven + ), { adsBillingDetails: trackingAdvertiser ? ( Date: Thu, 17 Aug 2023 22:05:16 +0100 Subject: [PATCH 08/65] Fixes JS linting errors. Passed spendRequire and creditsGiven values with currency using wc_price function. --- .../catalog-sync/sections/AdCreditsNotice.js | 22 ++++++++++++------- src/AdsCreditCurrency.php | 6 ++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/assets/source/catalog-sync/sections/AdCreditsNotice.js b/assets/source/catalog-sync/sections/AdCreditsNotice.js index 031a747f6..2aadbc3e2 100644 --- a/assets/source/catalog-sync/sections/AdCreditsNotice.js +++ b/assets/source/catalog-sync/sections/AdCreditsNotice.js @@ -81,21 +81,27 @@ const AdCreditsNotice = () => { { isBillingSetup ? ( { sprintf( - // translators: %1$s: Currency symbol. %2$s: Amount of money required to spend to claim ad credits. %3$s: Amount of ad credits given. + // translators: %1$s: Amount of money required to spend to claim ad credits with currency. %2$s: Amount of ad credits given with currency. __( - 'Spend %1$s%2$s to claim %1$s%3$s in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).', 'pinterest-for-woocommerce' - ), currencyCreditInfo.currency, currencyCreditInfo.spendRequire, currencyCreditInfo.creditsGiven - ) } + 'Spend %1$s to claim %2$s in Pinterest ad credits. (Ad credits may take up to 24 hours to be credited to account).', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.spendRequire, + currencyCreditInfo.creditsGiven + ) } ) : ( { createInterpolateElement( sprintf( - // translators: %1: Currency symbol. %2$s: Amount of money required to spend to claim ad credits. %3$s: Amount of ad credits given. + // translators: %1$s: Amount of money required to spend to claim ad credits with currency. %2$s: Amount of ad credits given with currency. __( - 'Spend %1$s%2$s to claim %1$s%3$s in Pinterest ad credits. To claim the credits, add your billing details.', 'pinterest-for-woocommerce' - ), currencyCreditInfo.currency, currencyCreditInfo.spendRequire, currencyCreditInfo.creditsGiven - ), + 'Spend %1$s to claim %2$s in Pinterest ad credits. To claim the credits, add your billing details.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.spendRequire, + currencyCreditInfo.creditsGiven + ), { adsBillingDetails: trackingAdvertiser ? ( $spend_require, - 'creditsGiven' => $credits_given, - 'currency' => $currency_symbol, + 'spendRequire' => html_entity_decode( wp_strip_all_tags( wc_price( $spend_require ) ) ), + 'creditsGiven' => html_entity_decode( wp_strip_all_tags( wc_price( $credits_given ) ) ), ); return $result; From 3e9c12b092e8cc41721f4736f09a8ef5e4ac6b37 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Fri, 18 Aug 2023 10:19:10 +0100 Subject: [PATCH 09/65] Dyanamically generates amount required to be spent and the credits given. --- .../OnboardingModals/OnboardingAdsModal.js | 47 ++++++++++++----- .../app/components/TermsAndConditionsModal.js | 17 +++++-- .../app/steps/components/AdsCreditsPromo.js | 15 ++++-- .../setup-guide/app/views/LandingPageApp.js | 50 ++++++++++++++----- 4 files changed, 95 insertions(+), 34 deletions(-) diff --git a/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js b/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js index 57b40ecf1..055520bd7 100644 --- a/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js +++ b/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; import { Icon, external as externalIcon } from '@wordpress/icons'; import { @@ -18,13 +18,21 @@ import { useSettingsSelect } from '../../../setup-guide/app/helpers/effects'; import { useBillingSetupFlowEntered } from '../../helpers/effects'; const OnboardingModalText = ( { isBillingSetup } ) => { + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + if ( ! isBillingSetup ) { return ( { createInterpolateElement( - __( - 'You are eligible for $125 of Pinterest ad credits. To claim the credits, you would need to add your billing details and spend $15 on Pinterest ads.', - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'You are eligible for %1$s of Pinterest ad credits. To claim the credits, you would need to add your billing details and spend %2$s on Pinterest ads.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ), { strong: , @@ -36,14 +44,22 @@ const OnboardingModalText = ( { isBillingSetup } ) => { return ( - { __( - 'You are eligible for $125 of Pinterest ad credits. To claim the credits, head over to the Pinterest ads manager and ', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of ad credit given with currency. + __( + 'You are eligible for %s of Pinterest ad credits. To claim the credits, head over to the Pinterest ads manager and ', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven ) } - { __( - 'spend $15 on Pinterest ads.', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of money required to spend to claim ad credits with currency. + __( + 'spend %s on Pinterest ads.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.spendRequire ) } @@ -61,6 +77,7 @@ const OnboardingModalText = ( { isBillingSetup } ) => { const OnboardingAdsModal = ( { onCloseModal } ) => { const appSettings = useSettingsSelect(); const isBillingSetup = appSettings?.account_data?.is_billing_setup; + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; const billingSetupFlowEntered = useBillingSetupFlowEntered(); const onClickBilling = () => { @@ -83,9 +100,13 @@ const OnboardingAdsModal = ( { onCloseModal } ) => { className="pinterest-for-woocommerce-catalog-sync__onboarding-modal" > - { __( - 'You are one step away from claiming $125 of Pinterest ad credits.', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of ad credit given with currency. + __( + 'You are one step away from claiming %s of Pinterest ad credits.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven ) } diff --git a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js index d2c8646ac..789c1e4eb 100644 --- a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js +++ b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; import { Modal, @@ -11,6 +11,7 @@ import { /** * Internal dependencies */ +import { useSettingsSelect } from '../helpers/effects'; import documentationLinkProps from '../helpers/documentation-link-props'; const tosHref = 'https://business.pinterest.com/business-terms-of-service/'; @@ -30,6 +31,9 @@ const advertisingServicesAgreementHref = * @return {JSX.Element} Rendered element. */ const AdsCreditsTermsAndConditionsModal = ( { onModalClose } ) => { + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return ( { className="pinterest-for-woocommerce-landing-page__credits-section__tac-modal" > - { __( - 'To be eligible and redeem the $125 ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend $15 with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'To be eligible and redeem the %1$s ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend %2$s with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ) } diff --git a/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js b/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js index 532976982..bdf876ac1 100644 --- a/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js +++ b/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js @@ -2,7 +2,7 @@ * External dependencies */ import { useState, createInterpolateElement } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { recordEvent } from '@woocommerce/tracks'; import { CardDivider, @@ -42,6 +42,8 @@ const AdsCreditsPromo = () => { } ); }; + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return appSettings?.ads_campaign_is_active ? ( <> { { createInterpolateElement( - __( - 'As a new Pinterest customer, you can get $125 in free ad credits when you successfully set up Pinterest for WooCommerce and spend $15 on Pinterest Ads. Pinterest Terms and conditions apply.', - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s: Amount of ad credits given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'As a new Pinterest customer, you can get %1$s in free ad credits when you successfully set up Pinterest for WooCommerce and spend %2$s on Pinterest Ads. Pinterest Terms and conditions apply.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ), { a: ( diff --git a/assets/source/setup-guide/app/views/LandingPageApp.js b/assets/source/setup-guide/app/views/LandingPageApp.js index 848fe5cab..afb52887d 100644 --- a/assets/source/setup-guide/app/views/LandingPageApp.js +++ b/assets/source/setup-guide/app/views/LandingPageApp.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { getNewPath, getHistory } from '@woocommerce/navigation'; import { createInterpolateElement, @@ -159,6 +159,9 @@ const AdsCreditSection = () => { } ); }; + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return ( @@ -173,16 +176,25 @@ const AdsCreditSection = () => { - { __( - 'Try Pinterest for WooCommerce and get $125 in ad credits!', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of ad credits given with currency. + __( + 'Try Pinterest for WooCommerce and get %s in ad credits!', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven ) } { createInterpolateElement( - __( - 'To help you get started with Pinterest Ads, new Pinterest customers can get $125 in ad credits when they have successfully set up Pinterest for WooCommerce and spend $15 on Pinterest Ads. Pinterest Terms and conditions apply.', - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s: Amount of ad credits given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'To help you get started with Pinterest Ads, new Pinterest customers can get %1$s in ad credits when they have successfully set up Pinterest for WooCommerce and spend %2$s on Pinterest Ads. Pinterest Terms and conditions apply.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ), { a: ( @@ -269,6 +281,9 @@ const Feature = ( { title, text, imageUrl } ) => { }; const FaqSection = () => { + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return ( { /> From 211591de50feaa1572d9bb333eeda984c9f6d4a9 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Sat, 19 Aug 2023 00:14:29 +0100 Subject: [PATCH 10/65] Revert "Dyanamically generates amount required to be spent and the credits given." This reverts commit 3e9c12b092e8cc41721f4736f09a8ef5e4ac6b37. --- .../OnboardingModals/OnboardingAdsModal.js | 47 +++++------------ .../app/components/TermsAndConditionsModal.js | 17 ++----- .../app/steps/components/AdsCreditsPromo.js | 15 ++---- .../setup-guide/app/views/LandingPageApp.js | 50 +++++-------------- 4 files changed, 34 insertions(+), 95 deletions(-) diff --git a/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js b/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js index 055520bd7..57b40ecf1 100644 --- a/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js +++ b/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __, sprintf } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; import { Icon, external as externalIcon } from '@wordpress/icons'; import { @@ -18,21 +18,13 @@ import { useSettingsSelect } from '../../../setup-guide/app/helpers/effects'; import { useBillingSetupFlowEntered } from '../../helpers/effects'; const OnboardingModalText = ( { isBillingSetup } ) => { - const appSettings = useSettingsSelect(); - const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; - if ( ! isBillingSetup ) { return ( { createInterpolateElement( - sprintf( - // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. - __( - 'You are eligible for %1$s of Pinterest ad credits. To claim the credits, you would need to add your billing details and spend %2$s on Pinterest ads.', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven, - currencyCreditInfo.spendRequire + __( + 'You are eligible for $125 of Pinterest ad credits. To claim the credits, you would need to add your billing details and spend $15 on Pinterest ads.', + 'pinterest-for-woocommerce' ), { strong: , @@ -44,22 +36,14 @@ const OnboardingModalText = ( { isBillingSetup } ) => { return ( - { sprintf( - // translators: %s: Amount of ad credit given with currency. - __( - 'You are eligible for %s of Pinterest ad credits. To claim the credits, head over to the Pinterest ads manager and ', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven + { __( + 'You are eligible for $125 of Pinterest ad credits. To claim the credits, head over to the Pinterest ads manager and ', + 'pinterest-for-woocommerce' ) } - { sprintf( - // translators: %s: Amount of money required to spend to claim ad credits with currency. - __( - 'spend %s on Pinterest ads.', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.spendRequire + { __( + 'spend $15 on Pinterest ads.', + 'pinterest-for-woocommerce' ) } @@ -77,7 +61,6 @@ const OnboardingModalText = ( { isBillingSetup } ) => { const OnboardingAdsModal = ( { onCloseModal } ) => { const appSettings = useSettingsSelect(); const isBillingSetup = appSettings?.account_data?.is_billing_setup; - const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; const billingSetupFlowEntered = useBillingSetupFlowEntered(); const onClickBilling = () => { @@ -100,13 +83,9 @@ const OnboardingAdsModal = ( { onCloseModal } ) => { className="pinterest-for-woocommerce-catalog-sync__onboarding-modal" > - { sprintf( - // translators: %s: Amount of ad credit given with currency. - __( - 'You are one step away from claiming %s of Pinterest ad credits.', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven + { __( + 'You are one step away from claiming $125 of Pinterest ad credits.', + 'pinterest-for-woocommerce' ) } diff --git a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js index 789c1e4eb..d2c8646ac 100644 --- a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js +++ b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __, sprintf } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; import { Modal, @@ -11,7 +11,6 @@ import { /** * Internal dependencies */ -import { useSettingsSelect } from '../helpers/effects'; import documentationLinkProps from '../helpers/documentation-link-props'; const tosHref = 'https://business.pinterest.com/business-terms-of-service/'; @@ -31,9 +30,6 @@ const advertisingServicesAgreementHref = * @return {JSX.Element} Rendered element. */ const AdsCreditsTermsAndConditionsModal = ( { onModalClose } ) => { - const appSettings = useSettingsSelect(); - const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; - return ( { className="pinterest-for-woocommerce-landing-page__credits-section__tac-modal" > - { sprintf( - // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. - __( - 'To be eligible and redeem the %1$s ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend %2$s with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven, - currencyCreditInfo.spendRequire + { __( + 'To be eligible and redeem the $125 ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend $15 with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', + 'pinterest-for-woocommerce' ) } diff --git a/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js b/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js index bdf876ac1..532976982 100644 --- a/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js +++ b/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js @@ -2,7 +2,7 @@ * External dependencies */ import { useState, createInterpolateElement } from '@wordpress/element'; -import { __, sprintf } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { recordEvent } from '@woocommerce/tracks'; import { CardDivider, @@ -42,8 +42,6 @@ const AdsCreditsPromo = () => { } ); }; - const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; - return appSettings?.ads_campaign_is_active ? ( <> { { createInterpolateElement( - sprintf( - // translators: %1$s: Amount of ad credits given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. - __( - 'As a new Pinterest customer, you can get %1$s in free ad credits when you successfully set up Pinterest for WooCommerce and spend %2$s on Pinterest Ads. Pinterest Terms and conditions apply.', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven, - currencyCreditInfo.spendRequire + __( + 'As a new Pinterest customer, you can get $125 in free ad credits when you successfully set up Pinterest for WooCommerce and spend $15 on Pinterest Ads. Pinterest Terms and conditions apply.', + 'pinterest-for-woocommerce' ), { a: ( diff --git a/assets/source/setup-guide/app/views/LandingPageApp.js b/assets/source/setup-guide/app/views/LandingPageApp.js index afb52887d..848fe5cab 100644 --- a/assets/source/setup-guide/app/views/LandingPageApp.js +++ b/assets/source/setup-guide/app/views/LandingPageApp.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __, sprintf } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { getNewPath, getHistory } from '@woocommerce/navigation'; import { createInterpolateElement, @@ -159,9 +159,6 @@ const AdsCreditSection = () => { } ); }; - const appSettings = useSettingsSelect(); - const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; - return ( @@ -176,25 +173,16 @@ const AdsCreditSection = () => { - { sprintf( - // translators: %s: Amount of ad credits given with currency. - __( - 'Try Pinterest for WooCommerce and get %s in ad credits!', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven + { __( + 'Try Pinterest for WooCommerce and get $125 in ad credits!', + 'pinterest-for-woocommerce' ) } { createInterpolateElement( - sprintf( - // translators: %1$s: Amount of ad credits given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. - __( - 'To help you get started with Pinterest Ads, new Pinterest customers can get %1$s in ad credits when they have successfully set up Pinterest for WooCommerce and spend %2$s on Pinterest Ads. Pinterest Terms and conditions apply.', - 'pinterest-for-woocommerce' - ), - currencyCreditInfo.creditsGiven, - currencyCreditInfo.spendRequire + __( + 'To help you get started with Pinterest Ads, new Pinterest customers can get $125 in ad credits when they have successfully set up Pinterest for WooCommerce and spend $15 on Pinterest Ads. Pinterest Terms and conditions apply.', + 'pinterest-for-woocommerce' ), { a: ( @@ -281,9 +269,6 @@ const Feature = ( { title, text, imageUrl } ) => { }; const FaqSection = () => { - const appSettings = useSettingsSelect(); - const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; - return ( { /> From ef1e96cf4a0686033b1d7f2af6dc9cbdff7d3cf8 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Sat, 19 Aug 2023 00:57:20 +0100 Subject: [PATCH 11/65] Dynamic generation of credits given and spend requirement amount on Ads promo and onboarding modal. --- .../OnboardingModals/OnboardingAdsModal.js | 47 ++++++++++++++----- .../app/steps/components/AdsCreditsPromo.js | 15 ++++-- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js b/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js index 57b40ecf1..055520bd7 100644 --- a/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js +++ b/assets/source/catalog-sync/components/OnboardingModals/OnboardingAdsModal.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; import { Icon, external as externalIcon } from '@wordpress/icons'; import { @@ -18,13 +18,21 @@ import { useSettingsSelect } from '../../../setup-guide/app/helpers/effects'; import { useBillingSetupFlowEntered } from '../../helpers/effects'; const OnboardingModalText = ( { isBillingSetup } ) => { + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + if ( ! isBillingSetup ) { return ( { createInterpolateElement( - __( - 'You are eligible for $125 of Pinterest ad credits. To claim the credits, you would need to add your billing details and spend $15 on Pinterest ads.', - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'You are eligible for %1$s of Pinterest ad credits. To claim the credits, you would need to add your billing details and spend %2$s on Pinterest ads.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ), { strong: , @@ -36,14 +44,22 @@ const OnboardingModalText = ( { isBillingSetup } ) => { return ( - { __( - 'You are eligible for $125 of Pinterest ad credits. To claim the credits, head over to the Pinterest ads manager and ', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of ad credit given with currency. + __( + 'You are eligible for %s of Pinterest ad credits. To claim the credits, head over to the Pinterest ads manager and ', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven ) } - { __( - 'spend $15 on Pinterest ads.', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of money required to spend to claim ad credits with currency. + __( + 'spend %s on Pinterest ads.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.spendRequire ) } @@ -61,6 +77,7 @@ const OnboardingModalText = ( { isBillingSetup } ) => { const OnboardingAdsModal = ( { onCloseModal } ) => { const appSettings = useSettingsSelect(); const isBillingSetup = appSettings?.account_data?.is_billing_setup; + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; const billingSetupFlowEntered = useBillingSetupFlowEntered(); const onClickBilling = () => { @@ -83,9 +100,13 @@ const OnboardingAdsModal = ( { onCloseModal } ) => { className="pinterest-for-woocommerce-catalog-sync__onboarding-modal" > - { __( - 'You are one step away from claiming $125 of Pinterest ad credits.', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of ad credit given with currency. + __( + 'You are one step away from claiming %s of Pinterest ad credits.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven ) } diff --git a/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js b/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js index 532976982..bdf876ac1 100644 --- a/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js +++ b/assets/source/setup-guide/app/steps/components/AdsCreditsPromo.js @@ -2,7 +2,7 @@ * External dependencies */ import { useState, createInterpolateElement } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { recordEvent } from '@woocommerce/tracks'; import { CardDivider, @@ -42,6 +42,8 @@ const AdsCreditsPromo = () => { } ); }; + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return appSettings?.ads_campaign_is_active ? ( <> { { createInterpolateElement( - __( - 'As a new Pinterest customer, you can get $125 in free ad credits when you successfully set up Pinterest for WooCommerce and spend $15 on Pinterest Ads. Pinterest Terms and conditions apply.', - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s: Amount of ad credits given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'As a new Pinterest customer, you can get %1$s in free ad credits when you successfully set up Pinterest for WooCommerce and spend %2$s on Pinterest Ads. Pinterest Terms and conditions apply.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ), { a: ( From d4f1383d6823351d62f1520201dbde2643315764 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Mon, 21 Aug 2023 17:04:07 +0100 Subject: [PATCH 12/65] Dynamic generation of credits given and spend requirement amount on Terms and Conditions modal and Landing page flexbox. --- .../app/components/TermsAndConditionsModal.js | 17 +++++++++--- .../setup-guide/app/views/LandingPageApp.js | 26 ++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js index d2c8646ac..9a7f3c2af 100644 --- a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js +++ b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { createInterpolateElement } from '@wordpress/element'; import { Modal, @@ -11,6 +11,7 @@ import { /** * Internal dependencies */ +import { useSettingsSelect } from '../helpers/effects'; import documentationLinkProps from '../helpers/documentation-link-props'; const tosHref = 'https://business.pinterest.com/business-terms-of-service/'; @@ -30,6 +31,9 @@ const advertisingServicesAgreementHref = * @return {JSX.Element} Rendered element. */ const AdsCreditsTermsAndConditionsModal = ( { onModalClose } ) => { + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return ( { className="pinterest-for-woocommerce-landing-page__credits-section__tac-modal" > - { __( - 'To be eligible and redeem the $125 ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend $15 with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'To be eligible and redeem the %1$s ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend %2$s with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ) } diff --git a/assets/source/setup-guide/app/views/LandingPageApp.js b/assets/source/setup-guide/app/views/LandingPageApp.js index 848fe5cab..9c6b147f4 100644 --- a/assets/source/setup-guide/app/views/LandingPageApp.js +++ b/assets/source/setup-guide/app/views/LandingPageApp.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; import { getNewPath, getHistory } from '@woocommerce/navigation'; import { createInterpolateElement, @@ -159,6 +159,9 @@ const AdsCreditSection = () => { } ); }; + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return ( @@ -173,16 +176,25 @@ const AdsCreditSection = () => { - { __( - 'Try Pinterest for WooCommerce and get $125 in ad credits!', - 'pinterest-for-woocommerce' + { sprintf( + // translators: %s: Amount of ad credits given with currency. + __( + 'Try Pinterest for WooCommerce and get %s in ad credits!', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven ) } { createInterpolateElement( - __( - 'To help you get started with Pinterest Ads, new Pinterest customers can get $125 in ad credits when they have successfully set up Pinterest for WooCommerce and spend $15 on Pinterest Ads. Pinterest Terms and conditions apply.', - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s: Amount of ad credits given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. + __( + 'To help you get started with Pinterest Ads, new Pinterest customers can get %1$s in ad credits when they have successfully set up Pinterest for WooCommerce and spend %2$s on Pinterest Ads. Pinterest Terms and conditions apply.', + 'pinterest-for-woocommerce' + ), + currencyCreditInfo.creditsGiven, + currencyCreditInfo.spendRequire ), { a: ( From ecbccd789b0de2605d7b1ec0ff5d6b60c46dfe71 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Mon, 21 Aug 2023 17:14:50 +0100 Subject: [PATCH 13/65] Fixes JS linting issue. --- assets/source/setup-guide/app/views/LandingPageApp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/source/setup-guide/app/views/LandingPageApp.js b/assets/source/setup-guide/app/views/LandingPageApp.js index 9c6b147f4..991eafb4c 100644 --- a/assets/source/setup-guide/app/views/LandingPageApp.js +++ b/assets/source/setup-guide/app/views/LandingPageApp.js @@ -176,7 +176,7 @@ const AdsCreditSection = () => { - { sprintf( + { sprintf( // translators: %s: Amount of ad credits given with currency. __( 'Try Pinterest for WooCommerce and get %s in ad credits!', From 4c40c3c5a04af55c01479ca9c94688bd343cc60b Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Mon, 21 Aug 2023 17:18:31 +0100 Subject: [PATCH 14/65] Fixes JS linting issue. --- .../setup-guide/app/components/TermsAndConditionsModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js index 9a7f3c2af..789c1e4eb 100644 --- a/assets/source/setup-guide/app/components/TermsAndConditionsModal.js +++ b/assets/source/setup-guide/app/components/TermsAndConditionsModal.js @@ -48,7 +48,7 @@ const AdsCreditsTermsAndConditionsModal = ( { onModalClose } ) => { className="pinterest-for-woocommerce-landing-page__credits-section__tac-modal" > - { sprintf( + { sprintf( // translators: %1$s: Amount of ad credit given with currency. %2$s: Amount of money required to spend to claim ad credits with currency. __( 'To be eligible and redeem the %1$s ad credit from Pinterest, you must complete the setup of Pinterest for WooCommerce, set up your billing with Pinterest Ads manager, and spend %2$s with Pinterest ads. Credits may take up to 24 hours to be credited to the user.', From 5c47fa85101d2fcb75fb5aded9b54b1b40740cfe Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Mon, 21 Aug 2023 21:19:39 +0100 Subject: [PATCH 15/65] Adds logic to dynamically display credits info in FAQ section on Landing page. --- .../setup-guide/app/views/LandingPageApp.js | 36 +++++++++++++------ class-pinterest-for-woocommerce.php | 3 ++ src/API/Options.php | 1 - src/AdsCreditCurrency.php | 4 +-- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/assets/source/setup-guide/app/views/LandingPageApp.js b/assets/source/setup-guide/app/views/LandingPageApp.js index 991eafb4c..b28b4e193 100644 --- a/assets/source/setup-guide/app/views/LandingPageApp.js +++ b/assets/source/setup-guide/app/views/LandingPageApp.js @@ -281,6 +281,9 @@ const Feature = ( { title, text, imageUrl } ) => { }; const FaqSection = () => { + const appSettings = useSettingsSelect(); + const currencyCreditInfo = appSettings?.account_data?.currency_credit_info; + return ( { 'pinterest-for-woocommerce' ) } /> - + { currencyCreditInfo && ( + + ) } ); diff --git a/class-pinterest-for-woocommerce.php b/class-pinterest-for-woocommerce.php index 31e1c516b..e8fdb9a1d 100644 --- a/class-pinterest-for-woocommerce.php +++ b/class-pinterest-for-woocommerce.php @@ -280,6 +280,9 @@ public function init_plugin() { // Verify that the ads_campaign is active or not. add_action( 'admin_init', array( Pinterest\AdCredits::class, 'check_if_ads_campaign_is_active' ) ); + // Append credits info to account data. + add_action( 'init', array( $this, 'add_currency_credits_info_to_account_data' ) ); + add_action( 'pinterest_for_woocommerce_token_saved', array( $this, 'set_default_settings' ) ); add_action( 'pinterest_for_woocommerce_token_saved', array( $this, 'update_account_data' ) ); diff --git a/src/API/Options.php b/src/API/Options.php index 8651f0294..117f6f99b 100644 --- a/src/API/Options.php +++ b/src/API/Options.php @@ -44,7 +44,6 @@ public function __construct() { */ public function get_settings() { Pinterest_For_Woocommerce()::maybe_check_billing_setup(); - Pinterest_For_Woocommerce()::add_currency_credits_info_to_account_data(); return array( PINTEREST_FOR_WOOCOMMERCE_OPTION_NAME => Pinterest_For_Woocommerce()::get_settings( true ), ); diff --git a/src/AdsCreditCurrency.php b/src/AdsCreditCurrency.php index 4ff93b404..0be1d0a5d 100644 --- a/src/AdsCreditCurrency.php +++ b/src/AdsCreditCurrency.php @@ -55,8 +55,8 @@ public static function get_currency_credits() { list( $spend_require, $credits_given ) = $credits_array; $result = array( - 'spendRequire' => html_entity_decode( wp_strip_all_tags( wc_price( $spend_require ) ) ), - 'creditsGiven' => html_entity_decode( wp_strip_all_tags( wc_price( $credits_given ) ) ), + 'spendRequire' => html_entity_decode( wp_strip_all_tags( wc_price( $spend_require, array( 'decimals' => 0 ) ) ) ), + 'creditsGiven' => html_entity_decode( wp_strip_all_tags( wc_price( $credits_given, array( 'decimals' => 0 ) ) ) ), ); return $result; From 799b123b90e8c4eb71e752d73371f848a56efc3f Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Thu, 24 Aug 2023 15:39:03 +0100 Subject: [PATCH 16/65] Updates phpunit version, unit tests and matrix for PHP8.2 compatibility. --- .github/workflows/php-unit-tests.yml | 9 +- composer.json | 2 +- composer.lock | 1325 +++++++++++++------------ tests/Unit/FeedFileOperationsTest.php | 2 +- tests/Unit/FeedGeneratorTest.php | 2 +- tests/Unit/PluginUpdateTest.php | 6 +- tests/Unit/ProductFeedStatusTest.php | 2 +- tests/Unit/TrackerSnapshotTest.php | 2 +- tests/Unit/TrackingTest.php | 2 +- tests/bootstrap.php | 6 - 10 files changed, 697 insertions(+), 661 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index f7e5fd049..c8d3c5f60 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -30,8 +30,13 @@ jobs: WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit" strategy: matrix: - php: [7.3, 7.4] - wp-version: [5.8, 5.9, latest] + php: [7.3, 7.4, 8.0, 8.1, 8.2] + wp-version: [latest] + include: + - php: 7.4 + wp-version: 5.9 + - php: 7.3 + wp-version: 5.9 steps: - name: Checkout repository diff --git a/composer.json b/composer.json index e2b5761dc..e38f31f47 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "woocommerce/woocommerce-sniffs": "^0.1.0", "wp-coding-standards/wpcs": "^2.3", - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^9.6", "yoast/phpunit-polyfills": "^1.0", "wp-cli/i18n-command": "^2.3" }, diff --git a/composer.lock b/composer.lock index 25ee62f6a..01eb96f9e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b4fc2c1c588f3e9c77af8f761962a4ea", + "content-hash": "6c9eba590353625c50352f7fb7ff8421", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -444,29 +444,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -493,7 +494,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -509,7 +510,7 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "eftec/bladeone", @@ -826,25 +827,29 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { @@ -869,7 +874,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -877,32 +882,89 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.17.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + }, + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -934,26 +996,26 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2018-07-08T19:23:20+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -985,9 +1047,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/master" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2018-07-08T19:19:57+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -1162,268 +1224,289 @@ "time": "2021-12-30T16:37:40+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", + "name": "phpunit/php-code-coverage", + "version": "9.2.27", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-2.x": "2.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" + "coverage", + "testing", + "xunit" ], "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" }, - "time": "2020-06-27T09:03:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-07-26T13:44:30+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "name": "phpunit/php-file-iterator", + "version": "3.0.6", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" + "php": ">=7.3" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, - "time": "2021-10-19T17:43:47+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "1.6.0", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "php": ">=7.3" }, "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-master": "3.1-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" }, - "time": "2022-01-04T19:58:01+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "phpspec/prophecy", - "version": "v1.15.0", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "php": ">=7.3" }, "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" + "template" ], "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" }, - "time": "2021-12-08T12:19:24+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1442,46 +1525,83 @@ "role": "lead" } ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "coverage", - "testing", - "xunit" + "timer" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, - "time": "2018-10-31T16:06:48+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" }, { - "name": "phpunit/php-file-iterator", - "version": "2.0.5", + "name": "phpunit/phpunit", + "version": "9.6.11", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", - "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", + "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", "shasum": "" }, "require": { - "php": ">=7.1" + "doctrine/instantiator": "^1.3.1 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpunit/phpunit": "^8.5" + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, + "bin": [ + "phpunit" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "9.6-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -1497,93 +1617,118 @@ "role": "lead" } ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", "keywords": [ - "filesystem", - "iterator" + "phpunit", + "testing", + "xunit" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" }, "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2021-12-02T12:42:26+00:00" + "time": "2023-08-19T07:10:56+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "rmccue/requests", + "version": "v1.8.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/WordPress/Requests.git", + "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/WordPress/Requests/zipball/82e6936366eac3af4d836c18b9d8c31028fe4cd5", + "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.2" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "php-parallel-lint/php-console-highlighter": "^0.5.0", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcompatibility/php-compatibility": "^9.0", + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5", + "requests/test-server": "dev-master", + "squizlabs/php_codesniffer": "^3.5", + "wp-coding-standards/wpcs": "^2.0" }, "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-0": { + "Requests": "library/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "ISC" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Ryan McCue", + "homepage": "http://ryanmccue.info" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "A HTTP library written in PHP, for human beings.", + "homepage": "http://github.com/WordPress/Requests", "keywords": [ - "template" + "curl", + "fsockopen", + "http", + "idna", + "ipv6", + "iri", + "sockets" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + "issues": "https://github.com/WordPress/Requests/issues", + "source": "https://github.com/WordPress/Requests/tree/v1.8.1" }, - "time": "2015-06-21T13:50:34+00:00" + "time": "2021-06-04T09:56:25+00:00" }, { - "name": "phpunit/php-timer", - "version": "2.1.3", + "name": "sebastian/cli-parser", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1602,14 +1747,11 @@ "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" }, "funding": [ { @@ -1617,33 +1759,32 @@ "type": "github" } ], - "time": "2020-11-30T08:20:02+00:00" + "time": "2020-09-28T06:08:49+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "3.1.3", + "name": "sebastian/code-unit", + "version": "1.0.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1658,17 +1799,15 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" }, "funding": [ { @@ -1676,66 +1815,32 @@ "type": "github" } ], - "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" + "time": "2020-10-26T13:08:54+00:00" }, { - "name": "phpunit/phpunit", - "version": "7.5.20", + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" + "php": ">=7.3" }, "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/phpunit": "^9.3" }, - "bin": [ - "phpunit" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1750,107 +1855,49 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" - }, - "time": "2020-01-08T08:45:45+00:00" - }, - { - "name": "rmccue/requests", - "version": "v1.8.1", - "source": { - "type": "git", - "url": "https://github.com/WordPress/Requests.git", - "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/82e6936366eac3af4d836c18b9d8c31028fe4cd5", - "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcompatibility/php-compatibility": "^9.0", - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5", - "requests/test-server": "dev-master", - "squizlabs/php_codesniffer": "^3.5", - "wp-coding-standards/wpcs": "^2.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Requests": "library/" - } + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ + "funding": [ { - "name": "Ryan McCue", - "homepage": "http://ryanmccue.info" + "url": "https://github.com/sebastianbergmann", + "type": "github" } ], - "description": "A HTTP library written in PHP, for human beings.", - "homepage": "http://github.com/WordPress/Requests", - "keywords": [ - "curl", - "fsockopen", - "http", - "idna", - "ipv6", - "iri", - "sockets" - ], - "support": { - "issues": "https://github.com/WordPress/Requests/issues", - "source": "https://github.com/WordPress/Requests/tree/v1.8.1" - }, - "time": "2021-06-04T09:56:25+00:00" + "time": "2020-09-28T05:30:19+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", + "name": "sebastian/comparator", + "version": "4.0.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1866,13 +1913,30 @@ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" } ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -1880,34 +1944,33 @@ "type": "github" } ], - "time": "2020-11-30T08:15:22+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { - "name": "sebastian/comparator", - "version": "3.0.3", + "name": "sebastian/complexity", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "nikic/php-parser": "^4.7", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1922,31 +1985,15 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" }, "funding": [ { @@ -1954,33 +2001,33 @@ "type": "github" } ], - "time": "2020-11-30T08:04:30+00:00" + "time": "2020-10-26T15:52:27+00:00" }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2012,7 +2059,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -2020,27 +2067,27 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", - "version": "4.2.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -2048,7 +2095,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -2075,7 +2122,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -2083,34 +2130,34 @@ "type": "github" } ], - "time": "2020-11-30T07:53:42+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^8.5" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2145,14 +2192,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -2160,27 +2207,30 @@ "type": "github" } ], - "time": "2021-11-11T13:51:24+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -2188,7 +2238,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2213,36 +2263,99 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-02T09:26:13+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" }, - "time": "2017-04-27T15:39:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.4", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2264,7 +2377,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" }, "funding": [ { @@ -2272,32 +2385,32 @@ "type": "github" } ], - "time": "2020-11-30T07:40:27+00:00" + "time": "2020-10-26T13:12:34+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2319,7 +2432,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" }, "funding": [ { @@ -2327,32 +2440,32 @@ "type": "github" } ], - "time": "2020-11-30T07:37:18+00:00" + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.1", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2379,10 +2492,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -2390,29 +2503,32 @@ "type": "github" } ], - "time": "2020-11-30T07:34:24+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2434,7 +2550,63 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -2442,29 +2614,29 @@ "type": "github" } ], - "time": "2020-11-30T07:30:19+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2487,9 +2659,15 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/master" + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, - "time": "2016-10-03T07:35:21+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2549,7 +2727,7 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -2596,7 +2774,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" }, "funding": [ { @@ -2677,100 +2855,18 @@ ], "time": "2022-04-15T08:07:45+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-10-20T20:35:02+00:00" - }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -2779,7 +2875,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2824,7 +2920,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -2840,7 +2936,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "theseer/tokenizer", @@ -2892,64 +2988,6 @@ ], "time": "2021-07-28T10:34:58+00:00" }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" - }, { "name": "woocommerce/woocommerce-sniffs", "version": "0.1.2", @@ -3354,7 +3392,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.3" + "php": ">=7.3", + "ext-json": "*" }, "platform-dev": [], "platform-overrides": { diff --git a/tests/Unit/FeedFileOperationsTest.php b/tests/Unit/FeedFileOperationsTest.php index 3abcb37be..2385923da 100644 --- a/tests/Unit/FeedFileOperationsTest.php +++ b/tests/Unit/FeedFileOperationsTest.php @@ -13,7 +13,7 @@ class FeedFileOperationsTest extends \WP_UnitTestCase { /** @var LocalFeedConfigs */ private $local_feed_configs; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->local_feed_configs = $this->createMock( LocalFeedConfigs::class ); ProductFeedStatus::set( ProductFeedStatus::STATE_PROPS ); diff --git a/tests/Unit/FeedGeneratorTest.php b/tests/Unit/FeedGeneratorTest.php index e0b894e34..bee4a3177 100644 --- a/tests/Unit/FeedGeneratorTest.php +++ b/tests/Unit/FeedGeneratorTest.php @@ -28,7 +28,7 @@ class FeedGeneratorTest extends \WP_UnitTestCase { /** @var FeedGenerator */ private $feed_generator; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->action_scheduler = $this->createMock( ActionSchedulerInterface::class ); $this->feed_file_operations = $this->createMock( FeedFileOperations::class ); diff --git a/tests/Unit/PluginUpdateTest.php b/tests/Unit/PluginUpdateTest.php index 1f60c1893..ed806edad 100644 --- a/tests/Unit/PluginUpdateTest.php +++ b/tests/Unit/PluginUpdateTest.php @@ -123,8 +123,7 @@ public function testUpdateFlowNoThrow() { ->setMethods( ['perform_plugin_update_procedure'] ) ->getMock(); - $mock_plugin_update->method('perform_plugin_update_procedure') - ->willReturn( null ); + $mock_plugin_update->method('perform_plugin_update_procedure'); $mock_plugin_update->maybe_update(); @@ -178,8 +177,7 @@ public function testAfterUpdateTheUpdateIsNotExecutedAgain() { ->setMethods( ['perform_plugin_update_procedure'] ) ->getMock(); - $mock_plugin_update->method('perform_plugin_update_procedure') - ->willReturn( null ); + $mock_plugin_update->method('perform_plugin_update_procedure'); $mock_plugin_update->maybe_update(); diff --git a/tests/Unit/ProductFeedStatusTest.php b/tests/Unit/ProductFeedStatusTest.php index 9a2b72d94..d1d35e83c 100644 --- a/tests/Unit/ProductFeedStatusTest.php +++ b/tests/Unit/ProductFeedStatusTest.php @@ -6,7 +6,7 @@ class ProductFeedStatusTest extends \WP_UnitTestCase { - public function setUp() { + public function setUp(): void { parent::setUp(); ProductFeedStatus::deregister(); } diff --git a/tests/Unit/TrackerSnapshotTest.php b/tests/Unit/TrackerSnapshotTest.php index 329f90205..1cad9ea9b 100644 --- a/tests/Unit/TrackerSnapshotTest.php +++ b/tests/Unit/TrackerSnapshotTest.php @@ -21,7 +21,7 @@ class TrackerSnapshotTest extends \WP_UnitTestCase { 'erase_plugin_data' => false, ); - function setUp() { + function setUp(): void { parent::setUp(); update_option( 'woocommerce_allow_tracking', 'yes' ); } diff --git a/tests/Unit/TrackingTest.php b/tests/Unit/TrackingTest.php index 4bdd47bb8..bb3ad28c2 100644 --- a/tests/Unit/TrackingTest.php +++ b/tests/Unit/TrackingTest.php @@ -6,7 +6,7 @@ class TrackingTest extends \WP_UnitTestCase { - function setUp() { + function setUp(): void { parent::setUp(); update_option( 'woocommerce_allow_tracking', 'yes' ); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 522496647..d2d537a14 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -12,12 +12,6 @@ global $wp_plugins_dir; global $wc_dir; -//TODO: Double check this -if ( PHP_MAJOR_VERSION >= 8 ) { - echo "The scaffolded tests cannot currently be run on PHP 8.0+. See https://github.com/wp-cli/scaffold-command/issues/285" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - exit( 1 ); -} - $wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ?: path_join( sys_get_temp_dir(), '/wordpress-tests-lib' ); validate_file_exits( "{$wp_tests_dir}/includes/functions.php" ); From 9e3eec9a2ddb97daebd5dd63e5f5b1456ccabfc4 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Thu, 24 Aug 2023 16:35:34 +0100 Subject: [PATCH 17/65] Reduces PHP unit tests checks in git workflow. --- .github/workflows/php-unit-tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index c8d3c5f60..3835e32dc 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -32,11 +32,6 @@ jobs: matrix: php: [7.3, 7.4, 8.0, 8.1, 8.2] wp-version: [latest] - include: - - php: 7.4 - wp-version: 5.9 - - php: 7.3 - wp-version: 5.9 steps: - name: Checkout repository From 52f816ebfe9e56b0284a3f64f2a16b06921582ee Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Thu, 24 Aug 2023 18:54:19 +0100 Subject: [PATCH 18/65] Eliminates Automatic conversion of false to array is deprecated warning. --- src/PluginUpdate.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PluginUpdate.php b/src/PluginUpdate.php index 26b2ca74e..715b0c490 100644 --- a/src/PluginUpdate.php +++ b/src/PluginUpdate.php @@ -270,7 +270,9 @@ protected function feed_generation_migration(): void { */ $settings = Pinterest_For_Woocommerce()::get_settings( true, PINTEREST_FOR_WOOCOMMERCE_DATA_NAME ); - unset( $settings['local_feed_id'] ); + if ( isset( $settings['local_feed_id'] ) ) { + unset( $settings['local_feed_id'] ); + } Pinterest_For_Woocommerce()::save_settings( $settings, PINTEREST_FOR_WOOCOMMERCE_DATA_NAME ); From b25bfcfeb4780ad20738dee5b8fbf231f2e922a6 Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Fri, 25 Aug 2023 14:38:45 +0100 Subject: [PATCH 19/65] Updates minimum PHP to 7.4 and PHP 8.2 for coding standards workflow. --- .github/workflows/php-coding-standards.yml | 2 +- README.md | 4 - class-pinterest-for-woocommerce.php | 2 +- composer.json | 4 +- composer.lock | 289 +++++++++------------ phpcs.xml | 2 +- pinterest-for-woocommerce.php | 2 +- 7 files changed, 131 insertions(+), 174 deletions(-) diff --git a/.github/workflows/php-coding-standards.yml b/.github/workflows/php-coding-standards.yml index c9aa13ab4..e5f803f78 100644 --- a/.github/workflows/php-coding-standards.yml +++ b/.github/workflows/php-coding-standards.yml @@ -28,7 +28,7 @@ jobs: - name: Prepare PHP uses: woocommerce/grow/prepare-php@actions-v1 with: - php-version: '7.3' + php-version: '8.2' tools: cs2pr - name: Log PHPCS debug information diff --git a/README.md b/README.md index 364cfc73e..b02024631 100644 --- a/README.md +++ b/README.md @@ -123,10 +123,6 @@ $ vendor/bin/phpunit The tests will execute and you'll be presented with a summary. -### Unit Tests and PHP 8 - -We currently do not support running unit tests on PHP 8.. -



Made with 💜 by WooCommerce.
diff --git a/class-pinterest-for-woocommerce.php b/class-pinterest-for-woocommerce.php index ce990f0ff..fb2e0ec81 100644 --- a/class-pinterest-for-woocommerce.php +++ b/class-pinterest-for-woocommerce.php @@ -61,7 +61,7 @@ final class Pinterest_For_Woocommerce { * Set the minimum required versions for the plugin. */ const PLUGIN_REQUIREMENTS = array( - 'php_version' => '7.3', + 'php_version' => '7.4', 'wp_version' => '5.6', 'wc_version' => '5.3', 'action_scheduler' => '3.3.0', diff --git a/composer.json b/composer.json index e38f31f47..b90493d7d 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": ">=7.3", + "php": ">=7.4", "ext-json": "*", "automattic/jetpack-autoloader": "^2.10.1", "defuse/php-encryption": "^2.2", @@ -39,7 +39,7 @@ }, "config": { "platform": { - "php": "7.3.0" + "php": "7.4" }, "allow-plugins": { "composer/installers": true, diff --git a/composer.lock b/composer.lock index 01eb96f9e..eda7a252f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,28 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6c9eba590353625c50352f7fb7ff8421", + "content-hash": "c1847d9fd3afc478f403f9aa9459b65d", "packages": [ { "name": "automattic/jetpack-autoloader", - "version": "v2.10.12", + "version": "v2.11.22", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-autoloader.git", - "reference": "4e406f3b747261f3848d7efa6faac45a296dacca" + "reference": "32cc6b4a30e5cb5be669b4c8bed7330202e9f0c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/4e406f3b747261f3848d7efa6faac45a296dacca", - "reference": "4e406f3b747261f3848d7efa6faac45a296dacca", + "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/32cc6b4a30e5cb5be669b4c8bed7330202e9f0c1", + "reference": "32cc6b4a30e5cb5be669b4c8bed7330202e9f0c1", "shasum": "" }, "require": { "composer-plugin-api": "^1.1 || ^2.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^3.0", - "yoast/phpunit-polyfills": "1.0.3" + "automattic/jetpack-changelogger": "^3.3.8", + "yoast/phpunit-polyfills": "1.1.0" }, "type": "composer-plugin", "extra": { @@ -36,7 +36,7 @@ "link-template": "https://github.com/Automattic/jetpack-autoloader/compare/v${old}...v${new}" }, "branch-alias": { - "dev-master": "2.10.x-dev" + "dev-trunk": "2.11.x-dev" } }, "autoload": { @@ -52,23 +52,31 @@ "GPL-2.0-or-later" ], "description": "Creates a custom autoloader for a plugin or theme.", + "keywords": [ + "autoload", + "autoloader", + "composer", + "jetpack", + "plugin", + "wordpress" + ], "support": { - "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.10.12" + "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.11.22" }, - "time": "2022-01-25T17:38:25+00:00" + "time": "2023-08-23T17:57:14+00:00" }, { "name": "defuse/php-encryption", - "version": "v2.3.1", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/defuse/php-encryption.git", - "reference": "77880488b9954b7884c25555c2a0ea9e7053f9d2" + "reference": "f53396c2d34225064647a05ca76c1da9d99e5828" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/defuse/php-encryption/zipball/77880488b9954b7884c25555c2a0ea9e7053f9d2", - "reference": "77880488b9954b7884c25555c2a0ea9e7053f9d2", + "url": "https://api.github.com/repos/defuse/php-encryption/zipball/f53396c2d34225064647a05ca76c1da9d99e5828", + "reference": "f53396c2d34225064647a05ca76c1da9d99e5828", "shasum": "" }, "require": { @@ -77,7 +85,8 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "^4|^5|^6|^7|^8|^9" + "phpunit/phpunit": "^5|^6|^7|^8|^9|^10", + "yoast/phpunit-polyfills": "^2.0.0" }, "bin": [ "bin/generate-defuse-key" @@ -119,9 +128,9 @@ ], "support": { "issues": "https://github.com/defuse/php-encryption/issues", - "source": "https://github.com/defuse/php-encryption/tree/v2.3.1" + "source": "https://github.com/defuse/php-encryption/tree/v2.4.0" }, - "time": "2021-04-09T23:57:26+00:00" + "time": "2023-06-19T06:10:36+00:00" }, { "name": "paragonie/random_compat", @@ -572,16 +581,16 @@ }, { "name": "gettext/gettext", - "version": "v4.8.6", + "version": "v4.8.11", "source": { "type": "git", "url": "https://github.com/php-gettext/Gettext.git", - "reference": "bbeb8f4d3077663739aecb4551b22e720c0e9efe" + "reference": "b632aaf5e4579d0b2ae8bc61785e238bff4c5156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/bbeb8f4d3077663739aecb4551b22e720c0e9efe", - "reference": "bbeb8f4d3077663739aecb4551b22e720c0e9efe", + "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/b632aaf5e4579d0b2ae8bc61785e238bff4c5156", + "reference": "b632aaf5e4579d0b2ae8bc61785e238bff4c5156", "shasum": "" }, "require": { @@ -633,7 +642,7 @@ "support": { "email": "oom@oscarotero.com", "issues": "https://github.com/oscarotero/Gettext/issues", - "source": "https://github.com/php-gettext/Gettext/tree/v4.8.6" + "source": "https://github.com/php-gettext/Gettext/tree/v4.8.11" }, "funding": [ { @@ -649,20 +658,20 @@ "type": "patreon" } ], - "time": "2021-10-19T10:44:53+00:00" + "time": "2023-08-14T15:15:05+00:00" }, { "name": "gettext/languages", - "version": "2.9.0", + "version": "2.10.0", "source": { "type": "git", "url": "https://github.com/php-gettext/Languages.git", - "reference": "ed56dd2c7f4024cc953ed180d25f02f2640e3ffa" + "reference": "4d61d67fe83a2ad85959fe6133d6d9ba7dddd1ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-gettext/Languages/zipball/ed56dd2c7f4024cc953ed180d25f02f2640e3ffa", - "reference": "ed56dd2c7f4024cc953ed180d25f02f2640e3ffa", + "url": "https://api.github.com/repos/php-gettext/Languages/zipball/4d61d67fe83a2ad85959fe6133d6d9ba7dddd1ab", + "reference": "4d61d67fe83a2ad85959fe6133d6d9ba7dddd1ab", "shasum": "" }, "require": { @@ -711,7 +720,7 @@ ], "support": { "issues": "https://github.com/php-gettext/Languages/issues", - "source": "https://github.com/php-gettext/Languages/tree/2.9.0" + "source": "https://github.com/php-gettext/Languages/tree/2.10.0" }, "funding": [ { @@ -723,20 +732,20 @@ "type": "github" } ], - "time": "2021-11-11T17:30:39+00:00" + "time": "2022-10-18T15:00:10+00:00" }, { "name": "mck89/peast", - "version": "v1.14.0", + "version": "v1.15.4", "source": { "type": "git", "url": "https://github.com/mck89/peast.git", - "reference": "70a728d598017e237118652b2fa30fbaa9d4ef6d" + "reference": "1df4dc28a6b5bb7ab117ab073c1712256e954e18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mck89/peast/zipball/70a728d598017e237118652b2fa30fbaa9d4ef6d", - "reference": "70a728d598017e237118652b2fa30fbaa9d4ef6d", + "url": "https://api.github.com/repos/mck89/peast/zipball/1df4dc28a6b5bb7ab117ab073c1712256e954e18", + "reference": "1df4dc28a6b5bb7ab117ab073c1712256e954e18", "shasum": "" }, "require": { @@ -749,13 +758,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14.0-dev" + "dev-master": "1.15.4-dev" } }, "autoload": { "psr-4": { - "Peast\\": "lib/Peast/", - "Peast\\test\\": "test/Peast/" + "Peast\\": "lib/Peast/" } }, "notification-url": "https://packagist.org/downloads/", @@ -771,22 +779,22 @@ "description": "Peast is PHP library that generates AST for JavaScript code", "support": { "issues": "https://github.com/mck89/peast/issues", - "source": "https://github.com/mck89/peast/tree/v1.14.0" + "source": "https://github.com/mck89/peast/tree/v1.15.4" }, - "time": "2022-05-01T15:09:54+00:00" + "time": "2023-08-12T08:29:29+00:00" }, { "name": "mustache/mustache", - "version": "v2.14.1", + "version": "v2.14.2", "source": { "type": "git", "url": "https://github.com/bobthecow/mustache.php.git", - "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e" + "reference": "e62b7c3849d22ec55f3ec425507bf7968193a6cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/579ffa5c96e1d292c060b3dd62811ff01ad8c24e", - "reference": "579ffa5c96e1d292c060b3dd62811ff01ad8c24e", + "url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/e62b7c3849d22ec55f3ec425507bf7968193a6cb", + "reference": "e62b7c3849d22ec55f3ec425507bf7968193a6cb", "shasum": "" }, "require": { @@ -821,9 +829,9 @@ ], "support": { "issues": "https://github.com/bobthecow/mustache.php/issues", - "source": "https://github.com/bobthecow/mustache.php/tree/v2.14.1" + "source": "https://github.com/bobthecow/mustache.php/tree/v2.14.2" }, - "time": "2022-01-21T06:08:36+00:00" + "time": "2022-08-23T13:07:01+00:00" }, { "name": "myclabs/deep-copy", @@ -1115,16 +1123,16 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", "shasum": "" }, "require": { @@ -1161,26 +1169,27 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" }, - "time": "2021-02-15T10:24:51+00:00" + "time": "2022-10-25T01:46:02+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", "shasum": "" }, "require": { @@ -1215,13 +1224,14 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2021-12-30T16:37:40+00:00" + "time": "2022-10-24T09:00:36+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1645,66 +1655,6 @@ ], "time": "2023-08-19T07:10:56+00:00" }, - { - "name": "rmccue/requests", - "version": "v1.8.1", - "source": { - "type": "git", - "url": "https://github.com/WordPress/Requests.git", - "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/82e6936366eac3af4d836c18b9d8c31028fe4cd5", - "reference": "82e6936366eac3af4d836c18b9d8c31028fe4cd5", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", - "php-parallel-lint/php-console-highlighter": "^0.5.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcompatibility/php-compatibility": "^9.0", - "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5", - "requests/test-server": "dev-master", - "squizlabs/php_codesniffer": "^3.5", - "wp-coding-standards/wpcs": "^2.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Requests": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Ryan McCue", - "homepage": "http://ryanmccue.info" - } - ], - "description": "A HTTP library written in PHP, for human beings.", - "homepage": "http://github.com/WordPress/Requests", - "keywords": [ - "curl", - "fsockopen", - "http", - "idna", - "ipv6", - "iri", - "sockets" - ], - "support": { - "issues": "https://github.com/WordPress/Requests/issues", - "source": "https://github.com/WordPress/Requests/tree/v1.8.1" - }, - "time": "2021-06-04T09:56:25+00:00" - }, { "name": "sebastian/cli-parser", "version": "1.0.1", @@ -2671,16 +2621,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.2", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -2716,14 +2666,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-12-12T21:44:58+00:00" + "time": "2023-02-22T23:07:41+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2794,16 +2745,16 @@ }, { "name": "symfony/finder", - "version": "v5.4.8", + "version": "v5.4.27", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" + "reference": "ff4bce3c33451e7ec778070e45bd23f74214cd5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", - "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", + "url": "https://api.github.com/repos/symfony/finder/zipball/ff4bce3c33451e7ec778070e45bd23f74214cd5d", + "reference": "ff4bce3c33451e7ec778070e45bd23f74214cd5d", "shasum": "" }, "require": { @@ -2837,7 +2788,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.8" + "source": "https://github.com/symfony/finder/tree/v5.4.27" }, "funding": [ { @@ -2853,7 +2804,7 @@ "type": "tidelift" } ], - "time": "2022-04-15T08:07:45+00:00" + "time": "2023-07-31T08:02:31+00:00" }, { "name": "symfony/polyfill-php80", @@ -2990,16 +2941,16 @@ }, { "name": "woocommerce/woocommerce-sniffs", - "version": "0.1.2", + "version": "0.1.3", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git", - "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b" + "reference": "4576d54595614d689bc4436acff8baaece3c5bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/5566270d280a300bc24bd0cb055a8b9325afdd6b", - "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b", + "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/4576d54595614d689bc4436acff8baaece3c5bb0", + "reference": "4576d54595614d689bc4436acff8baaece3c5bb0", "shasum": "" }, "require": { @@ -3028,22 +2979,22 @@ ], "support": { "issues": "https://github.com/woocommerce/woocommerce-sniffs/issues", - "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.2" + "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.3" }, - "time": "2022-01-21T20:13:23+00:00" + "time": "2022-02-17T15:34:51+00:00" }, { "name": "wp-cli/i18n-command", - "version": "v2.3.0", + "version": "v2.4.3", "source": { "type": "git", "url": "https://github.com/wp-cli/i18n-command.git", - "reference": "bcb1a8159679cafdf1da884dbe5830122bae2c4d" + "reference": "203b020318fe2596a218bf52db25adc6b187f42d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/bcb1a8159679cafdf1da884dbe5830122bae2c4d", - "reference": "bcb1a8159679cafdf1da884dbe5830122bae2c4d", + "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/203b020318fe2596a218bf52db25adc6b187f42d", + "reference": "203b020318fe2596a218bf52db25adc6b187f42d", "shasum": "" }, "require": { @@ -3057,6 +3008,7 @@ "wp-cli/wp-cli-tests": "^3.1" }, "suggest": { + "ext-json": "Used for reading and generating JSON translation files", "ext-mbstring": "Used for calculating include/exclude matches in code extraction" }, "type": "wp-cli-package", @@ -3068,7 +3020,9 @@ "commands": [ "i18n", "i18n make-pot", - "i18n make-json" + "i18n make-json", + "i18n make-mo", + "i18n update-po" ] }, "autoload": { @@ -3093,9 +3047,9 @@ "homepage": "https://github.com/wp-cli/i18n-command", "support": { "issues": "https://github.com/wp-cli/i18n-command/issues", - "source": "https://github.com/wp-cli/i18n-command/tree/v2.3.0" + "source": "https://github.com/wp-cli/i18n-command/tree/v2.4.3" }, - "time": "2022-04-06T15:32:48+00:00" + "time": "2023-03-24T18:15:59+00:00" }, { "name": "wp-cli/mustangostang-spyc", @@ -3150,22 +3104,31 @@ }, { "name": "wp-cli/php-cli-tools", - "version": "v0.11.13", + "version": "v0.11.19", "source": { "type": "git", "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "a2866855ac1abc53005c102e901553ad5772dc04" + "reference": "2d27f0db5c36f5aa0064abecddd6d05f28c4d001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/a2866855ac1abc53005c102e901553ad5772dc04", - "reference": "a2866855ac1abc53005c102e901553ad5772dc04", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/2d27f0db5c36f5aa0064abecddd6d05f28c4d001", + "reference": "2d27f0db5c36f5aa0064abecddd6d05f28c4d001", "shasum": "" }, "require": { "php": ">= 5.3.0" }, + "require-dev": { + "roave/security-advisories": "dev-latest", + "wp-cli/wp-cli-tests": "^3.1.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.11.x-dev" + } + }, "autoload": { "files": [ "lib/cli/cli.php" @@ -3198,29 +3161,28 @@ ], "support": { "issues": "https://github.com/wp-cli/php-cli-tools/issues", - "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.13" + "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.19" }, - "time": "2021-07-01T15:08:16+00:00" + "time": "2023-07-21T11:37:15+00:00" }, { "name": "wp-cli/wp-cli", - "version": "v2.6.0", + "version": "v2.8.1", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "dee13c2baf6bf972484a63f8b8dab48f7220f095" + "reference": "5dd2340b9a01c3cfdbaf5e93a140759fdd190eee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/dee13c2baf6bf972484a63f8b8dab48f7220f095", - "reference": "dee13c2baf6bf972484a63f8b8dab48f7220f095", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/5dd2340b9a01c3cfdbaf5e93a140759fdd190eee", + "reference": "5dd2340b9a01c3cfdbaf5e93a140759fdd190eee", "shasum": "" }, "require": { "ext-curl": "*", "mustache/mustache": "^2.14.1", "php": "^5.6 || ^7.0 || ^8.0", - "rmccue/requests": "^1.8", "symfony/finder": ">2.7", "wp-cli/mustangostang-spyc": "^0.6.3", "wp-cli/php-cli-tools": "~0.11.2" @@ -3231,7 +3193,7 @@ "wp-cli/entity-command": "^1.2 || ^2", "wp-cli/extension-command": "^1.1 || ^2", "wp-cli/package-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^3.1.3" + "wp-cli/wp-cli-tests": "^3.1.6" }, "suggest": { "ext-readline": "Include for a better --prompt implementation", @@ -3244,7 +3206,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6.x-dev" + "dev-main": "2.9.x-dev" } }, "autoload": { @@ -3271,7 +3233,7 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2022-01-25T16:31:27+00:00" + "time": "2023-06-05T06:55:55+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -3326,16 +3288,16 @@ }, { "name": "yoast/phpunit-polyfills", - "version": "1.0.3", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "5ea3536428944955f969bc764bbe09738e151ada" + "reference": "224e4a1329c03d8bad520e3fc4ec980034a4b212" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/5ea3536428944955f969bc764bbe09738e151ada", - "reference": "5ea3536428944955f969bc764bbe09738e151ada", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/224e4a1329c03d8bad520e3fc4ec980034a4b212", + "reference": "224e4a1329c03d8bad520e3fc4ec980034a4b212", "shasum": "" }, "require": { @@ -3343,13 +3305,12 @@ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "require-dev": { - "yoast/yoastcs": "^2.2.0" + "yoast/yoastcs": "^2.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev", - "dev-develop": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -3383,7 +3344,7 @@ "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2021-11-23T01:37:03+00:00" + "time": "2023-08-19T14:25:08+00:00" } ], "aliases": [], @@ -3392,12 +3353,12 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.3", + "php": ">=7.4", "ext-json": "*" }, "platform-dev": [], "platform-overrides": { - "php": "7.3.0" + "php": "7.4" }, "plugin-api-version": "2.3.0" } diff --git a/phpcs.xml b/phpcs.xml index cd9eb6b61..0fa6cce4a 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -14,7 +14,7 @@ - + diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index bdcc134a0..acfa5a809 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -23,7 +23,7 @@ * * Requires at least: 5.6 * Tested up to: 6.3 - * Requires PHP: 7.3 + * Requires PHP: 7.4 * * WC requires at least: 5.3 * WC tested up to: 8.0 From a0f76f9019238285d68021c33f14b52f84e08cbd Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Fri, 25 Aug 2023 14:52:38 +0100 Subject: [PATCH 20/65] Remove Unit test git workflow check for PHP7.3. --- .github/workflows/php-unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index 3835e32dc..b19feabd0 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -30,7 +30,7 @@ jobs: WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit" strategy: matrix: - php: [7.3, 7.4, 8.0, 8.1, 8.2] + php: [7.4, 8.0, 8.1, 8.2] wp-version: [latest] steps: From 606d57c90386d788a7f334145affbd32eb5154bb Mon Sep 17 00:00:00 2001 From: Kruti Dugade Date: Fri, 25 Aug 2023 18:13:33 +0100 Subject: [PATCH 21/65] Fixes PHPCS issues. --- class-pinterest-for-woocommerce.php | 26 +++++++++++++++++-- composer.json | 2 +- composer.lock | 2 +- src/API/Auth.php | 5 +++- src/API/Base.php | 8 +++++- src/API/FeedState.php | 4 +++ .../Product/Attributes/AttributesForm.php | 5 ++++ .../Product/Attributes/AttributesTab.php | 8 ++++++ src/FeedGenerator.php | 24 +++++++++++++++++ src/Merchants.php | 1 + src/Product/Attributes/AttributeManager.php | 5 ++++ src/ProductFeedStatus.php | 6 +++++ src/ProductsXmlFeed.php | 9 +++++-- src/RichPins.php | 6 +++++ src/View/PHPView.php | 16 ++++++++++++ uninstall.php | 2 +- 16 files changed, 120 insertions(+), 9 deletions(-) diff --git a/class-pinterest-for-woocommerce.php b/class-pinterest-for-woocommerce.php index fb2e0ec81..556d8761f 100644 --- a/class-pinterest-for-woocommerce.php +++ b/class-pinterest-for-woocommerce.php @@ -177,6 +177,10 @@ public function maybe_init_plugin() { add_action( 'plugins_loaded', array( $this, 'init_plugin' ) ); + /** + * Plugin loaded action. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'pinterest_for_woocommerce_loaded' ); } @@ -304,13 +308,19 @@ public function init_plugin() { * Init Pinterest_For_Woocommerce when WordPress Initialises. */ public function init() { - // Before init action. + /** + * Before init action. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'before_pinterest_for_woocommerce_init' ); // Set up localisation. $this->load_plugin_textdomain(); - // Init action. + /** + * Init action. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'pinterest_for_woocommerce_init' ); } @@ -365,6 +375,10 @@ public function check_plugin_requirements() { $errors[] = sprintf( esc_html__( 'Pinterest for WooCommerce requires a minimum WooCommerce version of %s.', 'pinterest-for-woocommerce' ), self::PLUGIN_REQUIREMENTS['wc_version'] ); } + /** + * Check if WooCommerce Admin is enabled. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ if ( apply_filters( 'woocommerce_admin_disabled', false ) ) { $errors[] = esc_html__( 'Pinterest for WooCommerce requires WooCommerce Admin to be enabled.', 'pinterest-for-woocommerce' ); } @@ -420,6 +434,10 @@ public function maybe_update_plugin() { * - WP_LANG_DIR/plugins/pinterest-for-woocommerce-LOCALE.mo */ private function load_plugin_textdomain() { + /** + * Get plugin locale. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ $locale = apply_filters( 'plugin_locale', get_locale(), 'pinterest-for-woocommerce' ); load_textdomain( 'pinterest-for-woocommerce', WP_LANG_DIR . '/pinterest-for-woocommerce/pinterest-for-woocommerce-' . $locale . '.mo' ); @@ -450,6 +468,10 @@ public function plugin_path() { * @return string */ public function template_path() { + /** + * Returns template path. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return apply_filters( 'pinterest_for_woocommerce_template_path', 'pinterest-for-woocommerce/' ); } diff --git a/composer.json b/composer.json index b90493d7d..71b63e1e4 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "require-dev": { "composer/installers": "^1.7.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", - "woocommerce/woocommerce-sniffs": "^0.1.0", + "woocommerce/woocommerce-sniffs": "^0.1.3", "wp-coding-standards/wpcs": "^2.3", "phpunit/phpunit": "^9.6", "yoast/phpunit-polyfills": "^1.0", diff --git a/composer.lock b/composer.lock index eda7a252f..a5b086b7e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c1847d9fd3afc478f403f9aa9459b65d", + "content-hash": "6a8ca529ef3984a45713133c11c9ee28", "packages": [ { "name": "automattic/jetpack-autoloader", diff --git a/src/API/Auth.php b/src/API/Auth.php index 099290316..7efeb0bf7 100644 --- a/src/API/Auth.php +++ b/src/API/Auth.php @@ -107,7 +107,10 @@ public function oauth_callback( WP_REST_Request $request ) { ); try { - // Actions to perform after getting the authorization token. + /** + * Actions to perform after getting the authorization token. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'pinterest_for_woocommerce_token_saved' ); } catch ( Throwable $th ) { $error = esc_html__( 'There was an error getting the account data. Please try again later.', 'pinterest-for-woocommerce' ); diff --git a/src/API/Base.php b/src/API/Base.php index 64cbea3a7..cce482d32 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -429,6 +429,10 @@ public static function get_linked_businesses() { */ public static function create_advertiser( $tos_id ) { + /** + * Advertiser name. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ $advertiser_name = apply_filters( 'pinterest_for_woocommerce_default_advertiser_name', esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) ); return self::make_request( @@ -529,7 +533,9 @@ public static function get_advertiser_tag( $advertiser_id, $tag_id ) { * @return mixed */ public static function create_tag( $advertiser_id ) { - + /** + * Tag name. + */ $tag_name = apply_filters( 'pinterest_for_woocommerce_default_tag_name', esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) ); return self::make_request( diff --git a/src/API/FeedState.php b/src/API/FeedState.php index 71e21a9d7..88eb03ce6 100644 --- a/src/API/FeedState.php +++ b/src/API/FeedState.php @@ -107,6 +107,10 @@ public function get_feed_state() { ); } + /** + * Returns feed state. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return apply_filters( 'pinterest_for_woocommerce_feed_state', array() ); } catch ( \Throwable $th ) { diff --git a/src/Admin/Product/Attributes/AttributesForm.php b/src/Admin/Product/Attributes/AttributesForm.php index 05e053a0d..866a4587d 100644 --- a/src/Admin/Product/Attributes/AttributesForm.php +++ b/src/Admin/Product/Attributes/AttributesForm.php @@ -71,11 +71,13 @@ public function get_view_data(): array { * This filter is documented in AttributeManager::map_attribute_types * * @see AttributeManager::map_attribute_types + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $applicable_types = apply_filters( "wc_pinterest_attribute_applicable_product_types_{$attribute_id}", $applicable_types, $attribute_type ); /** * Filters the list of product types to hide the attribute for. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $hidden_types = apply_filters( "wc_pinterest_attribute_hidden_product_types_{$attribute_id}", array() ); @@ -113,6 +115,9 @@ protected function init_input( InputInterface $input, AttributeInterface $attrib if ( $attribute instanceof WithValueOptionsInterface ) { $value_options = $attribute::get_value_options(); } + /** + * Filters the list of value options for the given attribute. + */ $value_options = apply_filters( "wc_pinterest_product_attribute_value_options_{$attribute::get_id()}", $value_options ); if ( ! empty( $value_options ) ) { diff --git a/src/Admin/Product/Attributes/AttributesTab.php b/src/Admin/Product/Attributes/AttributesTab.php index 6b3bbee84..6a90f9d91 100644 --- a/src/Admin/Product/Attributes/AttributesTab.php +++ b/src/Admin/Product/Attributes/AttributesTab.php @@ -182,6 +182,10 @@ protected function get_form( WC_Product $product ): AttributesForm { * @return array of WooCommerce product types (e.g. 'simple', 'variable', etc.) */ public static function get_applicable_product_types(): array { + /** + * Array of product types that the Pinterest tab can be displayed for. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return apply_filters( 'wc_pinterest_attributes_tab_applicable_product_types', array( @@ -199,6 +203,10 @@ public static function get_applicable_product_types(): array { * @return array of WooCommerce product types (e.g. 'subscription', 'variable-subscription', etc.) */ protected function get_hidden_product_types(): array { + /** + * Array of product types that the Pinterest tab cannot be displayed for. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return apply_filters( 'wc_pinterest_attributes_tab_hidden_product_types', array_diff_key( diff --git a/src/FeedGenerator.php b/src/FeedGenerator.php index 7bfeb7f7a..e91142f08 100644 --- a/src/FeedGenerator.php +++ b/src/FeedGenerator.php @@ -579,6 +579,10 @@ private function get_locations(): array { * @return int - The number of products to process per batch. */ protected function get_batch_size(): int { + /** + * Returns products to process per batch. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return Pinterest_For_Woocommerce::get_data( 'feed_product_batch_size' ) ?? apply_filters( PINTEREST_FOR_WOOCOMMERCE_OPTION_NAME . '_feed_product_batch_size', self::DEFAULT_PRODUCT_BATCH_SIZE @@ -632,6 +636,10 @@ protected function process_item( $item, array $args ) { * @return array */ private function get_included_product_types(): array { + /** + * Returns array of included product types. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return (array) apply_filters( 'pinterest_for_woocommerce_included_product_types', array( @@ -649,6 +657,10 @@ private function get_included_product_types(): array { * @return array */ private function get_excluded_product_types(): array { + /** + * Returns array of excluded product types. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return (array) apply_filters( 'pinterest_for_woocommerce_excluded_product_types', array( @@ -668,6 +680,10 @@ private function get_excluded_product_types(): array { * @return array */ private function get_excluded_products_by_parent(): array { + /** + * Returns array of excluded products by parent. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ return (array) apply_filters( 'pinterest_for_woocommerce_excluded_products_by_parent', wc_get_products( @@ -740,7 +756,15 @@ public function maybe_handle_error_on_timeout( int $action_id ) { * @since 1.3.1 */ protected function is_failure_rate_above_threshold( string $hook, ?array $args = null ): bool { + /** + * Threshold of failed actions. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ $threshold = apply_filters( 'pinterest_for_woocommerce_action_failure_threshold', 3 ); + /** + * Time period of failed actions. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ $time_period = apply_filters( 'pinterest_for_woocommerce_action_failure_time_period', 30 * MINUTE_IN_SECONDS ); $failed_actions = $this->action_scheduler->search( [ diff --git a/src/Merchants.php b/src/Merchants.php index 142d6ddb4..2f83aa7b8 100644 --- a/src/Merchants.php +++ b/src/Merchants.php @@ -135,6 +135,7 @@ public static function update_or_create_merchant() { * feed configuration page in Pinterest. * * @param string $merchant_name The default merchant name. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $merchant_name = apply_filters( 'pinterest_for_woocommerce_default_merchant_name', esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) ); diff --git a/src/Product/Attributes/AttributeManager.php b/src/Product/Attributes/AttributeManager.php index c6eb4df4d..debfaf323 100644 --- a/src/Product/Attributes/AttributeManager.php +++ b/src/Product/Attributes/AttributeManager.php @@ -251,6 +251,7 @@ public static function get_available_attribute_types(): array { * Filters the list of available product attributes. * * @param string[] $attributes Array of attribute class names (FQN) + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ return apply_filters( 'wc_pinterest_product_attribute_types', self::ATTRIBUTES ); } @@ -279,6 +280,9 @@ protected function get_attribute_types_map(): array { protected function validate( WC_Product $product, string $attribute_id ) { $attribute_types = $this->get_attribute_types_for_product( $product ); if ( ! isset( $attribute_types[ $attribute_id ] ) ) { + /** + * Displays an error when an attribute is not supported for a product type. + */ do_action( 'wc_pinterest_error', sprintf( 'Attribute "%s" is not supported for a "%s" product (ID: %s).', $attribute_id, $product->get_type(), $product->get_id() ), @@ -307,6 +311,7 @@ protected function map_attribute_types(): void { * * @param string[] $applicable_types Array of WooCommerce product types * @param string $attribute_type Attribute class name (FQN) + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $applicable_types = apply_filters( "wc_pinterest_attribute_applicable_product_types_{$attribute_id}", $applicable_types, $attribute_type ); diff --git a/src/ProductFeedStatus.php b/src/ProductFeedStatus.php index 9c62b9576..467266ef2 100644 --- a/src/ProductFeedStatus.php +++ b/src/ProductFeedStatus.php @@ -89,6 +89,12 @@ public static function set( $state ) { } if ( ! empty( $state['status'] ) ) { + /** + * Feed status hook. + * + * @param array $state The array holding the feed state props. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'pinterest_for_woocommerce_feed_' . $state['status'], $state ); } } diff --git a/src/ProductsXmlFeed.php b/src/ProductsXmlFeed.php index 2d21a12ac..5889aaeec 100644 --- a/src/ProductsXmlFeed.php +++ b/src/ProductsXmlFeed.php @@ -256,6 +256,7 @@ private static function get_property_description( $product, $property ) { * * @param bool $apply_shortcodes Shortcodes are applied if set to `true` and stripped out if set to `false`. * @param WC_Product $product WooCommerce product object. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $apply_shortcodes = apply_filters( 'pinterest_for_woocommerce_product_description_apply_shortcodes', false, $product ); @@ -323,7 +324,9 @@ private static function get_property_g_image_link( $product, $property ) { return ''; } - // Get the image with a filter for default size. + /** + * Get the image with a filter for default size. + */ $image = wp_get_attachment_image_src( $image_id, apply_filters( 'pinterest_for_woocommerce_feed_image_size', 'full' ) ); if ( ! $image ) { @@ -441,7 +444,9 @@ private static function get_property_g_additional_image_link( $product, $propert if ( $attachment_ids && $product->get_image_id() ) { foreach ( $attachment_ids as $attachment_id ) { - // Get the image with a filter for default size. + /** + * Get the image with a filter for default size. + */ $image = wp_get_attachment_image_src( $attachment_id, apply_filters( 'pinterest_for_woocommerce_feed_image_size', 'full' ) ); $images[] = $image ? $image[0] : false; diff --git a/src/RichPins.php b/src/RichPins.php index 027cc10b6..01e442660 100644 --- a/src/RichPins.php +++ b/src/RichPins.php @@ -56,6 +56,10 @@ public static function maybe_inject_rich_pins_opengraph_tags() { if ( $rich_pins_on_products || $rich_pins_on_posts ) { + /** + * Rich Pins arguments. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ $args = apply_filters( 'pinterest_for_woocommerce_richpins_args', array( @@ -179,6 +183,7 @@ public static function add_product_opengraph_tags( $tags, $args ) { * * @param bool $apply_shortcodes Shortcodes are applied if set to `true` and stripped out if set to `false`. * @param WC_Product $product WooCommerce product object. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $apply_shortcodes = apply_filters( 'pinterest_for_woocommerce_rich_pins_product_description_apply_shortcodes', false, $product ); @@ -231,6 +236,7 @@ public static function add_post_opengraph_tags( $tags, $args ) { * * @param bool $apply_shortcodes Shortcodes are applied if set to `true` and stripped out if set to `false`. * @param int The post id. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $apply_shortcodes = apply_filters( 'pinterest_for_woocommerce_rich_pins_post_description_apply_shortcodes', false, get_the_ID() ); diff --git a/src/View/PHPView.php b/src/View/PHPView.php index 71afc7bc0..94eadf88b 100644 --- a/src/View/PHPView.php +++ b/src/View/PHPView.php @@ -88,6 +88,10 @@ public function render( array $context = array() ): string { ob_end_clean(); } + /** + * Exception hook. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'wc_pinterest_exception', $exception, __METHOD__ ); throw ViewException::invalid_view_exception( @@ -146,6 +150,10 @@ public function raw( string $property ) { return $this->context[ $property ]; } + /** + * Displays an error message when a view property is missing. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'wc_pinterest_error', sprintf( 'View property "%s" is missing or undefined.', $property ), __METHOD__ ); /* @@ -174,6 +182,10 @@ protected function validate( string $path ): string { $path = path_join( $this->get_views_base_path(), $path ); if ( ! is_readable( $path ) ) { + /** + * View not found error. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'wc_pinterest_error', sprintf( 'View not found in path "%s".', $path ), __METHOD__ ); throw ViewException::invalid_path( $path ); @@ -218,6 +230,10 @@ public function __get( string $property ) { return $this->sanitize_context_variable( $this->context[ $property ] ); } + /** + * View property missing error. + * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment + */ do_action( 'wc_pinterest_error', sprintf( 'View property "%s" is missing or undefined.', $property ), __METHOD__ ); /* diff --git a/uninstall.php b/uninstall.php index 5990c48e5..94c0589f2 100644 --- a/uninstall.php +++ b/uninstall.php @@ -8,7 +8,7 @@ * @version 1.0.0 */ - use Automattic\WooCommerce\Pinterest\FeedRegistration; +use Automattic\WooCommerce\Pinterest\FeedRegistration; if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit; From dd33d7aabbcf707914a13b895ebafe24635e6317 Mon Sep 17 00:00:00 2001 From: Bartosz Budzanowski Date: Thu, 31 Aug 2023 14:06:17 +0200 Subject: [PATCH 22/65] Fix uninstall procedure. --- uninstall.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/uninstall.php b/uninstall.php index 5990c48e5..fcb7aa59d 100644 --- a/uninstall.php +++ b/uninstall.php @@ -14,15 +14,23 @@ exit; } -/** - * Remove the feed configuration. - */ -$data = get_option( 'pinterest_for_woocommerce_data', [] ); -$merchant_id = $data['merchant_id'] ?? ''; +try { + // Load classes. + require_once __DIR__ . '/pinterest-for-woocommerce.php'; + + /** + * Remove the feed configuration. + */ + $data = get_option( 'pinterest_for_woocommerce_data', [] ); + $merchant_id = $data['merchant_id'] ?? ''; + + if ( $merchant_id ) { + // At this time all feeds are considered stale so we just need pass bogus value as the second argument. + FeedRegistration::maybe_disable_stale_feeds_for_merchant( $merchant_id, '' ); + } -if ( $merchant_id ) { - // At this time all feeds are considered stale so we just need pass bogus value as the second argument. - FeedRegistration::maybe_disable_stale_feeds_for_merchant( $merchant_id, '' ); +} catch ( Exception $e ) { + // Do nothing. } $plugin_settings = get_option( 'pinterest_for_woocommerce' ); From 4dfac99e6504b891f2ba02b281f22fdeecbab316 Mon Sep 17 00:00:00 2001 From: Bartosz Budzanowski Date: Fri, 1 Sep 2023 10:19:51 +0200 Subject: [PATCH 23/65] Fix PHPCS issues. --- uninstall.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/uninstall.php b/uninstall.php index fcb7aa59d..ae118903d 100644 --- a/uninstall.php +++ b/uninstall.php @@ -28,9 +28,8 @@ // At this time all feeds are considered stale so we just need pass bogus value as the second argument. FeedRegistration::maybe_disable_stale_feeds_for_merchant( $merchant_id, '' ); } - -} catch ( Exception $e ) { - // Do nothing. +} catch ( Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch + // Do nothing - this is a cleanup routine. } $plugin_settings = get_option( 'pinterest_for_woocommerce' ); From 08dc976367b8ea31ef7e7342c251f99992ff266f Mon Sep 17 00:00:00 2001 From: Rodrigue Tusse Date: Tue, 5 Sep 2023 16:52:38 +0200 Subject: [PATCH 24/65] Product version bump update --- class-pinterest-for-woocommerce.php | 2 +- package-lock.json | 2 +- package.json | 2 +- pinterest-for-woocommerce.php | 6 +++--- readme.txt | 2 +- src/AdsCreditCurrency.php | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/class-pinterest-for-woocommerce.php b/class-pinterest-for-woocommerce.php index e8fdb9a1d..b76ca107f 100644 --- a/class-pinterest-for-woocommerce.php +++ b/class-pinterest-for-woocommerce.php @@ -1027,7 +1027,7 @@ public static function add_redeem_credits_info_to_account_data() { /** * Add currency_credit_info information to the account data option. * - * @since x.x.x + * @since 1.3.9 * * @return void */ diff --git a/package-lock.json b/package-lock.json index 29028fd4d..9ab38cdf0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pinterest-for-woocommerce", - "version": "1.3.8", + "version": "1.3.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 51079799d..c2fe8747c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pinterest-for-woocommerce", "title": "Pinterest for WooCommerce", "description": "Pinterest for WooCommerce", - "version": "1.3.8", + "version": "1.3.9", "main": "gulpfile.js", "repository": { "type": "git", diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index bdcc134a0..443c5074b 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -13,7 +13,7 @@ * Plugin Name: Pinterest for WooCommerce * Plugin URI: https://woocommerce.com/products/pinterest-for-woocommerce/ * Description: Grow your business on Pinterest! Use this official plugin to allow shoppers to Pin products while browsing your store, track conversions, and advertise on Pinterest. - * Version: 1.3.8 + * Version: 1.3.9 * Author: WooCommerce * Author URI: https://woocommerce.com * License: GPL-2.0+ @@ -26,7 +26,7 @@ * Requires PHP: 7.3 * * WC requires at least: 5.3 - * WC tested up to: 8.0 + * WC tested up to: 8.1 */ /** @@ -46,7 +46,7 @@ } define( 'PINTEREST_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ ); -define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.8' ); // WRCS: DEFINED_VERSION. +define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.9' ); // WRCS: DEFINED_VERSION. // HPOS compatibility declaration. add_action( diff --git a/readme.txt b/readme.txt index 89e358be9..314a8454a 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce, pinterest, advertise Requires at least: 5.6 Tested up to: 6.3 Requires PHP: 7.3 -Stable tag: 1.3.8 +Stable tag: 1.3.9 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html diff --git a/src/AdsCreditCurrency.php b/src/AdsCreditCurrency.php index 0be1d0a5d..21e5e83e7 100644 --- a/src/AdsCreditCurrency.php +++ b/src/AdsCreditCurrency.php @@ -3,7 +3,7 @@ * Pinterest for WooCommerce Ads Credit Currency * * @package Pinterest_For_WooCommerce/Classes/ - * @version x.x.x + * @version 1.3.9 */ namespace Automattic\WooCommerce\Pinterest; @@ -44,7 +44,7 @@ class AdsCreditCurrency { /** * Get spend requirement and credits based on currency. * - * @since x.x.x + * @since 1.3.9 * * @return array $result Amount to be spent, credits given and currency symbol. */ From 9c64bda46c78ec61e2bafc4ed59055d4c971e0f0 Mon Sep 17 00:00:00 2001 From: Rodrigue Tusse Date: Tue, 5 Sep 2023 16:52:48 +0200 Subject: [PATCH 25/65] Changelog update --- changelog.txt | 5 +++++ readme.txt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/changelog.txt b/changelog.txt index 9f13fb33a..0919e98af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ *** Pinterest for WooCommerce Changelog *** += 1.3.9 - 2023-09-05 = +* Add - Adds logic to dynamically display spend requirement and credits given based on store currency. +* Fix - Uninstall procedure. +* Tweak - WC 8.1 compatibility. + = 1.3.8 - 2023-08-15 = * Fix - Caching of API calls. * Fix - Make add to cart events independent from WooCommerce archive page settings. diff --git a/readme.txt b/readme.txt index 314a8454a..38a662c4b 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,11 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](hhttps: == Changelog == += 1.3.9 - 2023-09-05 = +* Add - Adds logic to dynamically display spend requirement and credits given based on store currency. +* Fix - Uninstall procedure. +* Tweak - WC 8.1 compatibility. + = 1.3.8 - 2023-08-15 = * Fix - Caching of API calls. * Fix - Make add to cart events independent from WooCommerce archive page settings. From d03702ca4a86b5abaff20af1bacc2ed94c68dd21 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:47:29 +0000 Subject: [PATCH 26/65] Start `release/1.3.10`. From fd6a4b37a28483ed2590a77f8301c0efc9adc63a Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Tue, 12 Sep 2023 18:21:47 +0800 Subject: [PATCH 27/65] Product version bump update --- package-lock.json | 2 +- package.json | 2 +- pinterest-for-woocommerce.php | 4 ++-- readme.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9ab38cdf0..1bf4bc302 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pinterest-for-woocommerce", - "version": "1.3.9", + "version": "1.3.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c2fe8747c..a9fb78785 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pinterest-for-woocommerce", "title": "Pinterest for WooCommerce", "description": "Pinterest for WooCommerce", - "version": "1.3.9", + "version": "1.3.10", "main": "gulpfile.js", "repository": { "type": "git", diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index d2257fe7f..e81edbd5f 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -13,7 +13,7 @@ * Plugin Name: Pinterest for WooCommerce * Plugin URI: https://woocommerce.com/products/pinterest-for-woocommerce/ * Description: Grow your business on Pinterest! Use this official plugin to allow shoppers to Pin products while browsing your store, track conversions, and advertise on Pinterest. - * Version: 1.3.9 + * Version: 1.3.10 * Author: WooCommerce * Author URI: https://woocommerce.com * License: GPL-2.0+ @@ -46,7 +46,7 @@ } define( 'PINTEREST_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ ); -define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.9' ); // WRCS: DEFINED_VERSION. +define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.10' ); // WRCS: DEFINED_VERSION. // HPOS compatibility declaration. add_action( diff --git a/readme.txt b/readme.txt index 38a662c4b..2cee6316e 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce, pinterest, advertise Requires at least: 5.6 Tested up to: 6.3 Requires PHP: 7.3 -Stable tag: 1.3.9 +Stable tag: 1.3.10 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html From 8a13a772a1f78ebedaa6c2cbbcbe6bcb8b1aed36 Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Tue, 12 Sep 2023 18:22:05 +0800 Subject: [PATCH 28/65] Changelog update --- changelog.txt | 3 +++ readme.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/changelog.txt b/changelog.txt index 0919e98af..0a671a574 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** Pinterest for WooCommerce Changelog *** += 1.3.10 - 2023-09-12 = +* Dev - Updates PHPUnit version, unit tests, and matrix in git workflow for PHP8.2 compatibility. + = 1.3.9 - 2023-09-05 = * Add - Adds logic to dynamically display spend requirement and credits given based on store currency. * Fix - Uninstall procedure. diff --git a/readme.txt b/readme.txt index 2cee6316e..32dbc5010 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,9 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](hhttps: == Changelog == += 1.3.10 - 2023-09-12 = +* Dev - Updates PHPUnit version, unit tests, and matrix in git workflow for PHP8.2 compatibility. + = 1.3.9 - 2023-09-05 = * Add - Adds logic to dynamically display spend requirement and credits given based on store currency. * Fix - Uninstall procedure. From 266025c29bd68111be6c1b822e648369398a8a34 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Sun, 1 Oct 2023 21:34:38 +0300 Subject: [PATCH 29/65] Add phpcs changed conde style check on changed files only. --- .github/workflows/php-coding-standards.yml | 41 ------ .github/workflows/php-cs-on-changes.yml | 47 +++++++ bin/lint-branch.sh | 17 +++ composer.json | 16 +-- composer.lock | 143 ++++++++++++++------- 5 files changed, 171 insertions(+), 93 deletions(-) delete mode 100644 .github/workflows/php-coding-standards.yml create mode 100644 .github/workflows/php-cs-on-changes.yml create mode 100644 bin/lint-branch.sh diff --git a/.github/workflows/php-coding-standards.yml b/.github/workflows/php-coding-standards.yml deleted file mode 100644 index e5f803f78..000000000 --- a/.github/workflows/php-coding-standards.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: PHP Coding Standards - -on: - push: - branches: - - trunk - - develop - paths: - - "**.php" - - .github/workflows/php-coding-standards.yml - pull_request: - paths: - - "**.php" - - .github/workflows/php-coding-standards.yml - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - phpcs: - name: PHP coding standards - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Prepare PHP - uses: woocommerce/grow/prepare-php@actions-v1 - with: - php-version: '8.2' - tools: cs2pr - - - name: Log PHPCS debug information - run: vendor/bin/phpcs -i - - - name: Run PHPCS on all files - run: vendor/bin/phpcs . -q -n --report=checkstyle | cs2pr - - - name: PHP 8.2 Syntax Check - uses: overtrue/phplint@8.2 diff --git a/.github/workflows/php-cs-on-changes.yml b/.github/workflows/php-cs-on-changes.yml new file mode 100644 index 000000000..d15f6ce85 --- /dev/null +++ b/.github/workflows/php-cs-on-changes.yml @@ -0,0 +1,47 @@ +name: PHP Coding Standards - PR Changed Files + +on: + pull_request: + paths: + - "**.php" + - .github/workflows/php-cs-on-changes.yml + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + php: [7.4, 8.0, 8.1, 8.2] + name: Code sniff (PHP ${{ matrix.php }}, WP Latest) + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Prepare PHP ${{ matrix.php }} + uses: woocommerce/grow/prepare-php@actions-v1 + with: + php-version: ${{ matrix.php }} + + - name: Get Changed Files + id: changed-files + uses: tj-actions/changed-files@v39 + with: + files: "**/*.php" + + - name: Tool versions + run: | + php --version + composer --version + vendor/bin/phpcs-changed --version + + - name: Run PHPCS + if: steps.changed-files.outputs.any_changed == 'true' + run: vendor/bin/phpcs-changed -s --git --git-base ${{ github.event.pull_request.base.sha }} ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/bin/lint-branch.sh b/bin/lint-branch.sh new file mode 100644 index 000000000..ed17883fe --- /dev/null +++ b/bin/lint-branch.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Lint branch +# +# Runs phpcs-changed, comparing the current branch to its "base" or "parent" branch. +# The base branch defaults to trunk, but another branch name can be specified as an +# optional positional argument. +# +# Example: +# ./lint-branch.sh base-branch + +baseBranch=${1:-"trunk"} + +changedFiles=$(git diff $(git merge-base HEAD $baseBranch) --relative --name-only -- '*.php') + +# Only complete this if changed files are detected. +[[ -z $changedFiles ]] || composer exec phpcs-changed -- -s --git --git-base $baseBranch $changedFiles diff --git a/composer.json b/composer.json index 71b63e1e4..983e7fd47 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ "composer/installers": "^1.7.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "woocommerce/woocommerce-sniffs": "^0.1.3", + "sirbrillig/phpcs-changed": "^2.11.1", "wp-coding-standards/wpcs": "^2.3", "phpunit/phpunit": "^9.6", "yoast/phpunit-polyfills": "^1.0", @@ -48,15 +49,12 @@ } }, "scripts": { - "phpcs": [ - "phpcs --extensions=php -s -p" - ], - "phpcbf": [ - "phpcbf -p" - ], - "test-unit": [ - "./vendor/bin/phpunit" - ] + "phpcs": "phpcs --extensions=php -s -p", + "lint": "chg=$(git diff --relative --name-only -- '*.php'); [[ -z $chg ]] || phpcs-changed -s --git --git-unstaged $chg", + "lint-staged": "chg=$(git diff HEAD --relative --name-only -- '*.php'); [[ -z $chg ]] || phpcs-changed -s --git $chg", + "lint-branch": "sh ./bin/lint-branch.sh", + "phpcbf": "phpcbf -p", + "test-unit": "./vendor/bin/phpunit" }, "extra": { "scripts-description": { diff --git a/composer.lock b/composer.lock index a5b086b7e..aaff3e852 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6a8ca529ef3984a45713133c11c9ee28", + "content-hash": "873c92ba9acf2a82e2ff2d604633dcf6", "packages": [ { "name": "automattic/jetpack-autoloader", - "version": "v2.11.22", + "version": "v2.12.0", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-autoloader.git", - "reference": "32cc6b4a30e5cb5be669b4c8bed7330202e9f0c1" + "reference": "632b69cfc73ed5505f2b03165e7f68d414d0da12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/32cc6b4a30e5cb5be669b4c8bed7330202e9f0c1", - "reference": "32cc6b4a30e5cb5be669b4c8bed7330202e9f0c1", + "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/632b69cfc73ed5505f2b03165e7f68d414d0da12", + "reference": "632b69cfc73ed5505f2b03165e7f68d414d0da12", "shasum": "" }, "require": { "composer-plugin-api": "^1.1 || ^2.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^3.3.8", + "automattic/jetpack-changelogger": "^3.3.11", "yoast/phpunit-polyfills": "1.1.0" }, "type": "composer-plugin", @@ -35,8 +35,11 @@ "changelogger": { "link-template": "https://github.com/Automattic/jetpack-autoloader/compare/v${old}...v${new}" }, + "version-constants": { + "::VERSION": "src/AutoloadGenerator.php" + }, "branch-alias": { - "dev-trunk": "2.11.x-dev" + "dev-trunk": "2.12.x-dev" } }, "autoload": { @@ -61,9 +64,9 @@ "wordpress" ], "support": { - "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.11.22" + "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.12.0" }, - "time": "2023-08-23T17:57:14+00:00" + "time": "2023-09-28T18:33:34+00:00" }, { "name": "defuse/php-encryption", @@ -1235,16 +1238,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.27", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { @@ -1301,7 +1304,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -1309,7 +1312,7 @@ "type": "github" } ], - "time": "2023-07-26T13:44:30+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1554,16 +1557,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.11", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { @@ -1578,7 +1581,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1637,7 +1640,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, "funding": [ { @@ -1653,7 +1656,7 @@ "type": "tidelift" } ], - "time": "2023-08-19T07:10:56+00:00" + "time": "2023-09-19T05:39:22+00:00" }, { "name": "sebastian/cli-parser", @@ -2619,6 +2622,60 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "sirbrillig/phpcs-changed", + "version": "v2.11.4", + "source": { + "type": "git", + "url": "https://github.com/sirbrillig/phpcs-changed.git", + "reference": "acc946731ec65053e49cb0d3185c8ffe74895f93" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirbrillig/phpcs-changed/zipball/acc946731ec65053e49cb0d3185c8ffe74895f93", + "reference": "acc946731ec65053e49cb0d3185c8ffe74895f93", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", + "phpunit/phpunit": "^6.4 || ^9.5", + "sirbrillig/phpcs-variable-analysis": "^2.1.3", + "squizlabs/php_codesniffer": "^3.2.1", + "vimeo/psalm": "^0.2 || ^0.3 || ^1.1 || ^4.24 || ^5.0@beta" + }, + "bin": [ + "bin/phpcs-changed" + ], + "type": "library", + "autoload": { + "files": [ + "PhpcsChanged/Cli.php", + "PhpcsChanged/functions.php" + ], + "psr-4": { + "PhpcsChanged\\": "PhpcsChanged/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Payton Swick", + "email": "payton@foolord.com" + } + ], + "description": "Run phpcs on files, but only report warnings/errors from lines which were changed.", + "support": { + "issues": "https://github.com/sirbrillig/phpcs-changed/issues", + "source": "https://github.com/sirbrillig/phpcs-changed/tree/v2.11.4" + }, + "time": "2023-09-29T21:27:51+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.7.2", @@ -2808,16 +2865,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -2826,7 +2883,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2871,7 +2928,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -2887,7 +2944,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "theseer/tokenizer", @@ -2985,16 +3042,16 @@ }, { "name": "wp-cli/i18n-command", - "version": "v2.4.3", + "version": "v2.4.4", "source": { "type": "git", "url": "https://github.com/wp-cli/i18n-command.git", - "reference": "203b020318fe2596a218bf52db25adc6b187f42d" + "reference": "7d82e675f271359b1af614e6325d8eeaeb7d7474" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/203b020318fe2596a218bf52db25adc6b187f42d", - "reference": "203b020318fe2596a218bf52db25adc6b187f42d", + "url": "https://api.github.com/repos/wp-cli/i18n-command/zipball/7d82e675f271359b1af614e6325d8eeaeb7d7474", + "reference": "7d82e675f271359b1af614e6325d8eeaeb7d7474", "shasum": "" }, "require": { @@ -3005,7 +3062,7 @@ }, "require-dev": { "wp-cli/scaffold-command": "^1.2 || ^2", - "wp-cli/wp-cli-tests": "^3.1" + "wp-cli/wp-cli-tests": "^4" }, "suggest": { "ext-json": "Used for reading and generating JSON translation files", @@ -3047,9 +3104,9 @@ "homepage": "https://github.com/wp-cli/i18n-command", "support": { "issues": "https://github.com/wp-cli/i18n-command/issues", - "source": "https://github.com/wp-cli/i18n-command/tree/v2.4.3" + "source": "https://github.com/wp-cli/i18n-command/tree/v2.4.4" }, - "time": "2023-03-24T18:15:59+00:00" + "time": "2023-08-30T18:00:10+00:00" }, { "name": "wp-cli/mustangostang-spyc", @@ -3104,16 +3161,16 @@ }, { "name": "wp-cli/php-cli-tools", - "version": "v0.11.19", + "version": "v0.11.21", "source": { "type": "git", "url": "https://github.com/wp-cli/php-cli-tools.git", - "reference": "2d27f0db5c36f5aa0064abecddd6d05f28c4d001" + "reference": "b3457a8d60cd0b1c48cab76ad95df136d266f0b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/2d27f0db5c36f5aa0064abecddd6d05f28c4d001", - "reference": "2d27f0db5c36f5aa0064abecddd6d05f28c4d001", + "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/b3457a8d60cd0b1c48cab76ad95df136d266f0b6", + "reference": "b3457a8d60cd0b1c48cab76ad95df136d266f0b6", "shasum": "" }, "require": { @@ -3121,7 +3178,7 @@ }, "require-dev": { "roave/security-advisories": "dev-latest", - "wp-cli/wp-cli-tests": "^3.1.6" + "wp-cli/wp-cli-tests": "^4" }, "type": "library", "extra": { @@ -3161,9 +3218,9 @@ ], "support": { "issues": "https://github.com/wp-cli/php-cli-tools/issues", - "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.19" + "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.21" }, - "time": "2023-07-21T11:37:15+00:00" + "time": "2023-09-29T15:28:10+00:00" }, { "name": "wp-cli/wp-cli", From 70473dcbd631b06511db357598bfd46648195664 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:54:40 +0300 Subject: [PATCH 30/65] Decrease the number of php versions to check against. --- .github/workflows/php-cs-on-changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php-cs-on-changes.yml b/.github/workflows/php-cs-on-changes.yml index d15f6ce85..2b781f369 100644 --- a/.github/workflows/php-cs-on-changes.yml +++ b/.github/workflows/php-cs-on-changes.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - php: [7.4, 8.0, 8.1, 8.2] + php: [7.4, 8.2] name: Code sniff (PHP ${{ matrix.php }}, WP Latest) permissions: contents: read From 9797c0ae9af715e70e8882870acdb793f2f200fb Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Mon, 9 Oct 2023 18:34:06 +0300 Subject: [PATCH 31/65] Make GitHub Action skip linter warnings. Update WooCommerce sniffs dependencies. Set default branch to develop. --- .github/workflows/php-cs-on-changes.yml | 2 +- bin/lint-branch.sh | 2 +- composer.json | 4 +- composer.lock | 223 ++++++++++++++++++++---- phpcs.xml | 1 - 5 files changed, 189 insertions(+), 43 deletions(-) diff --git a/.github/workflows/php-cs-on-changes.yml b/.github/workflows/php-cs-on-changes.yml index 2b781f369..94b82d7be 100644 --- a/.github/workflows/php-cs-on-changes.yml +++ b/.github/workflows/php-cs-on-changes.yml @@ -44,4 +44,4 @@ jobs: - name: Run PHPCS if: steps.changed-files.outputs.any_changed == 'true' - run: vendor/bin/phpcs-changed -s --git --git-base ${{ github.event.pull_request.base.sha }} ${{ steps.changed-files.outputs.all_changed_files }} + run: vendor/bin/phpcs-changed --warning-severity=0 -s --git --git-base ${{ github.event.pull_request.base.sha }} ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/bin/lint-branch.sh b/bin/lint-branch.sh index ed17883fe..ab57f1781 100644 --- a/bin/lint-branch.sh +++ b/bin/lint-branch.sh @@ -9,7 +9,7 @@ # Example: # ./lint-branch.sh base-branch -baseBranch=${1:-"trunk"} +baseBranch=${1:-"develop"} changedFiles=$(git diff $(git merge-base HEAD $baseBranch) --relative --name-only -- '*.php') diff --git a/composer.json b/composer.json index 983e7fd47..5fb1020e7 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,8 @@ }, "require-dev": { "composer/installers": "^1.7.0", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", - "woocommerce/woocommerce-sniffs": "^0.1.3", + "woocommerce/woocommerce-sniffs": "1.0.0", "sirbrillig/phpcs-changed": "^2.11.1", - "wp-coding-standards/wpcs": "^2.3", "phpunit/phpunit": "^9.6", "yoast/phpunit-polyfills": "^1.0", "wp-cli/i18n-command": "^2.3" diff --git a/composer.lock b/composer.lock index aaff3e852..fcec33014 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "873c92ba9acf2a82e2ff2d604633dcf6", + "content-hash": "4077808690f97608a6ae51e0a6a8558f", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -381,35 +381,38 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.2", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", + "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -425,7 +428,7 @@ }, { "name": "Contributors", - "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -449,10 +452,10 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-02-04T12:51:07+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "doctrine/instantiator", @@ -1236,6 +1239,142 @@ }, "time": "2022-10-24T09:00:36+00:00" }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/746c3190ba8eb2f212087c947ba75f4f5b9a58d5", + "reference": "746c3190ba8eb2f212087c947ba75f4f5b9a58d5", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "time": "2023-09-20T22:06:18+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/69465cab9d12454e5e7767b9041af0cd8cd13be7", + "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.7.1 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "time": "2023-07-16T21:39:41+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.29", @@ -2998,47 +3137,42 @@ }, { "name": "woocommerce/woocommerce-sniffs", - "version": "0.1.3", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git", - "reference": "4576d54595614d689bc4436acff8baaece3c5bb0" + "reference": "3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/4576d54595614d689bc4436acff8baaece3c5bb0", - "reference": "4576d54595614d689bc4436acff8baaece3c5bb0", + "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8", + "reference": "3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "php": ">=7.0", "phpcompatibility/phpcompatibility-wp": "^2.1.0", - "wp-coding-standards/wpcs": "^2.3.0" + "wp-coding-standards/wpcs": "^3.0.0" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Claudio Sanches", - "email": "claudio@automattic.com" - } - ], "description": "WooCommerce sniffs", "keywords": [ "phpcs", "standards", + "static analysis", "woocommerce", "wordpress" ], "support": { "issues": "https://github.com/woocommerce/woocommerce-sniffs/issues", - "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.3" + "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/1.0.0" }, - "time": "2022-02-17T15:34:51+00:00" + "time": "2023-09-29T13:52:33+00:00" }, { "name": "wp-cli/i18n-command", @@ -3294,30 +3428,38 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.1.0", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -3334,6 +3476,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -3341,7 +3484,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "type": "custom" + } + ], + "time": "2023-09-14T07:06:09+00:00" }, { "name": "yoast/phpunit-polyfills", diff --git a/phpcs.xml b/phpcs.xml index 0fa6cce4a..13b6bd5b8 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -21,7 +21,6 @@ - From 2549c6981b4e3d436e186fc0e87819af4a2ec7ff Mon Sep 17 00:00:00 2001 From: Kader Ibrahim S Date: Tue, 10 Oct 2023 14:03:49 +0530 Subject: [PATCH 32/65] Product version bump update --- package-lock.json | 2 +- package.json | 2 +- pinterest-for-woocommerce.php | 6 +++--- readme.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1bf4bc302..e4fc4ecd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pinterest-for-woocommerce", - "version": "1.3.10", + "version": "1.3.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a9fb78785..1052e4ac9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pinterest-for-woocommerce", "title": "Pinterest for WooCommerce", "description": "Pinterest for WooCommerce", - "version": "1.3.10", + "version": "1.3.11", "main": "gulpfile.js", "repository": { "type": "git", diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index e81edbd5f..8a0489ed4 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -13,7 +13,7 @@ * Plugin Name: Pinterest for WooCommerce * Plugin URI: https://woocommerce.com/products/pinterest-for-woocommerce/ * Description: Grow your business on Pinterest! Use this official plugin to allow shoppers to Pin products while browsing your store, track conversions, and advertise on Pinterest. - * Version: 1.3.10 + * Version: 1.3.11 * Author: WooCommerce * Author URI: https://woocommerce.com * License: GPL-2.0+ @@ -26,7 +26,7 @@ * Requires PHP: 7.4 * * WC requires at least: 5.3 - * WC tested up to: 8.1 + * WC tested up to: 8.2 */ /** @@ -46,7 +46,7 @@ } define( 'PINTEREST_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ ); -define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.10' ); // WRCS: DEFINED_VERSION. +define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.11' ); // WRCS: DEFINED_VERSION. // HPOS compatibility declaration. add_action( diff --git a/readme.txt b/readme.txt index 32dbc5010..f76a2f1e4 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce, pinterest, advertise Requires at least: 5.6 Tested up to: 6.3 Requires PHP: 7.3 -Stable tag: 1.3.10 +Stable tag: 1.3.11 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html From 8dd5e5ba62a4b647d3c4ee31b5e460b76775ef0a Mon Sep 17 00:00:00 2001 From: Kader Ibrahim S Date: Tue, 10 Oct 2023 14:03:57 +0530 Subject: [PATCH 33/65] Changelog update --- changelog.txt | 4 ++++ readme.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/changelog.txt b/changelog.txt index 0a671a574..2aca41050 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ *** Pinterest for WooCommerce Changelog *** += 1.3.11 - 2023-10-10 = +* Dev - automate merging trunk to develop after a release. +* Tweak - WC 8.2 compatibility. + = 1.3.10 - 2023-09-12 = * Dev - Updates PHPUnit version, unit tests, and matrix in git workflow for PHP8.2 compatibility. diff --git a/readme.txt b/readme.txt index f76a2f1e4..c1c498d53 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,10 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](hhttps: == Changelog == += 1.3.11 - 2023-10-10 = +* Dev - automate merging trunk to develop after a release. +* Tweak - WC 8.2 compatibility. + = 1.3.10 - 2023-09-12 = * Dev - Updates PHPUnit version, unit tests, and matrix in git workflow for PHP8.2 compatibility. From f0d319f46dca0cf322707d7aea36faec4ac397c6 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:36:42 +0300 Subject: [PATCH 34/65] Product version bump update --- package-lock.json | 2 +- package.json | 2 +- pinterest-for-woocommerce.php | 4 ++-- readme.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index e4fc4ecd5..3073f8735 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pinterest-for-woocommerce", - "version": "1.3.11", + "version": "1.3.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1052e4ac9..ef55373a0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pinterest-for-woocommerce", "title": "Pinterest for WooCommerce", "description": "Pinterest for WooCommerce", - "version": "1.3.11", + "version": "1.3.12", "main": "gulpfile.js", "repository": { "type": "git", diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index 8a0489ed4..95625b1b2 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -13,7 +13,7 @@ * Plugin Name: Pinterest for WooCommerce * Plugin URI: https://woocommerce.com/products/pinterest-for-woocommerce/ * Description: Grow your business on Pinterest! Use this official plugin to allow shoppers to Pin products while browsing your store, track conversions, and advertise on Pinterest. - * Version: 1.3.11 + * Version: 1.3.12 * Author: WooCommerce * Author URI: https://woocommerce.com * License: GPL-2.0+ @@ -46,7 +46,7 @@ } define( 'PINTEREST_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ ); -define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.11' ); // WRCS: DEFINED_VERSION. +define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.12' ); // WRCS: DEFINED_VERSION. // HPOS compatibility declaration. add_action( diff --git a/readme.txt b/readme.txt index c1c498d53..9f3164e88 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce, pinterest, advertise Requires at least: 5.6 Tested up to: 6.3 Requires PHP: 7.3 -Stable tag: 1.3.11 +Stable tag: 1.3.12 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html From 10d74d0eb4129938452f341d55ffd888995e0881 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Thu, 19 Oct 2023 20:37:19 +0300 Subject: [PATCH 35/65] Changelog update --- changelog.txt | 3 +++ readme.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/changelog.txt b/changelog.txt index 2aca41050..758c320fb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** Pinterest for WooCommerce Changelog *** += 1.3.12 - 2023-10-19 = +* Dev - Add phpcs on changed files only. + = 1.3.11 - 2023-10-10 = * Dev - automate merging trunk to develop after a release. * Tweak - WC 8.2 compatibility. diff --git a/readme.txt b/readme.txt index 9f3164e88..7e8bf636a 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,9 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](hhttps: == Changelog == += 1.3.12 - 2023-10-19 = +* Dev - Add phpcs on changed files only. + = 1.3.11 - 2023-10-10 = * Dev - automate merging trunk to develop after a release. * Tweak - WC 8.2 compatibility. From 6e7f1fb11faf3ca9c7c06c89d26617568905926b Mon Sep 17 00:00:00 2001 From: Dmytro Date: Thu, 2 Nov 2023 15:03:30 +0200 Subject: [PATCH 36/65] Update README.md Changing PHP CS badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b02024631..b794737ae 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![PHP Unit Tests](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/php-unit-tests.yml/badge.svg)](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/php-unit-tests.yml) [![JavaScript Unit Tests](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/js-unit-tests.yml/badge.svg)](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/js-unit-tests.yml) -[![PHP Coding Standards](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/php-coding-standards.yml/badge.svg)](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/php-coding-standards.yml) +[![PHP Coding Standards - PR Changed Files](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/php-cs-on-changes.yml/badge.svg)](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/php-cs-on-changes.yml) [![JavaScript and CSS Linting](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/js-css-linting.yml/badge.svg)](https://github.com/woocommerce/pinterest-for-woocommerce/actions/workflows/js-css-linting.yml) A native integration which allows you to market your store on Pinterest, including: From 9ac764664fa3d421cfcf429f76982dc6d798292c Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:59:07 +0100 Subject: [PATCH 37/65] =?UTF-8?q?Update=20woocommerce.com=20=E2=86=92=20wo?= =?UTF-8?q?o.com=20in=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/CODE_OF_CONDUCT.md | 2 +- .github/CONTRIBUTING.md | 2 +- README.md | 6 +++--- TRACKING.md | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index e0d865b5a..9194b71fc 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@woocommerce.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@woo.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 829b29665..e9b6f5f1a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -16,7 +16,7 @@ Please see [SECURITY.md](./SECURITY.md). ## Feature Requests -Feature requests can be submitted to our [ideas board](https://ideas.woocommerce.com/forums/133476-woocommerce?category_id=412041). Be sure to include a good description of the expected behavior and use case, and before submitting a request, please search for similar ones. +Feature requests can be submitted on [Woo.com](https://woo.com/es-es/feature-requests/pinterest-for-woocommerce/). Be sure to include a good description of the expected behavior and use case, and before submitting a request, please search for similar ones. ## Getting started diff --git a/README.md b/README.md index b794737ae..cf9d8b55f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ A native integration which allows you to market your store on Pinterest, includi ## Status - _in development_ -Pinterest for WooCommerce is under development. To find out more about availability and release, refer to WooCommerce.com. +Pinterest for WooCommerce is under development. To find out more about availability and release, refer to Woo.com. ## Support @@ -125,7 +125,7 @@ The tests will execute and you'll be presented with a summary.



- Made with 💜 by WooCommerce.
- We're hiring! Come work with us! + Made with 💜 by Woo.
+ We're hiring! Come work with us!

diff --git a/TRACKING.md b/TRACKING.md index f4d23bde4..24acccaff 100644 --- a/TRACKING.md +++ b/TRACKING.md @@ -1,6 +1,6 @@ # Usage Tracking -_Pinterest for WooCommerce_ implements usage tracking, based on the native [WooCommerce Usage Tracking](https://woocommerce.com/usage-tracking/), and is only enabled when WooCommerce Tracking is enabled. +_Pinterest for WooCommerce_ implements usage tracking, based on the native [WooCommerce Usage Tracking](https://woo.com/usage-tracking/), and is only enabled when WooCommerce Tracking is enabled. When a store opts in to WooCommerce usage tracking and uses _Pinterest for WooCommerce_, they will also be opted in to the tracking added by _Pinterest for WooCommerce_. @@ -195,4 +195,4 @@ like starting, ending, or navigating between steps. - \ No newline at end of file + From e8cc400e5015f558f4ad6cd1dc961b4f4082650d Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:59:19 +0100 Subject: [PATCH 38/65] =?UTF-8?q?Update=20woocommerce.com=20=E2=86=92=20wo?= =?UTF-8?q?o.com=20in=20composer.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5fb1020e7..9c865677b 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "woocommerce/pinterest-for-woocommerce", "description": "", - "homepage": "https://woocommerce.com/", + "homepage": "https://woo.com/", "type": "wordpress-plugin", "keywords": [ "pinterest", From b880441332dd5fef4b3f5367bdafb0238c6a4411 Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:59:35 +0100 Subject: [PATCH 39/65] =?UTF-8?q?Update=20woocommerce.com=20=E2=86=92=20wo?= =?UTF-8?q?o.com=20in=20plugin=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pinterest-for-woocommerce.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index 95625b1b2..0f2bd3c2d 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -5,17 +5,17 @@ * registers the activation and deactivation functions, and defines a function * that starts the plugin. * - * @link https://woocommerce.com + * @link https://woo.com * @since 1.0.0 * @package woocommerce/pinterest-for-woocommerce * * @wordpress-plugin * Plugin Name: Pinterest for WooCommerce - * Plugin URI: https://woocommerce.com/products/pinterest-for-woocommerce/ + * Plugin URI: https://woo.com/products/pinterest-for-woocommerce/ * Description: Grow your business on Pinterest! Use this official plugin to allow shoppers to Pin products while browsing your store, track conversions, and advertise on Pinterest. * Version: 1.3.12 * Author: WooCommerce - * Author URI: https://woocommerce.com + * Author URI: https://woo.com * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: pinterest-for-woocommerce From d8c193c2d6226025553efb9c7b380ac8ae687ce4 Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:59:58 +0100 Subject: [PATCH 40/65] =?UTF-8?q?Update=20woocommerce.com=20=E2=86=92=20wo?= =?UTF-8?q?o.com=20in=20Recommendations=20API=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AdCredits.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AdCredits.php b/src/AdCredits.php index fb72cab2d..c4b6d6490 100644 --- a/src/AdCredits.php +++ b/src/AdCredits.php @@ -181,7 +181,7 @@ public static function check_if_ads_campaign_is_active() { } /** - * Check if campaign is enabled in the recommendations API from woocommerce.com. + * Check if campaign is enabled in the recommendations API from woo.com. * * @since 1.2.5 * @@ -190,7 +190,7 @@ public static function check_if_ads_campaign_is_active() { * @return bool Wether the campaign is active or not. */ private static function get_is_campaign_active_from_recommendations() { - $request = wp_remote_get( 'https://woocommerce.com/wp-json/wccom/marketing-tab/1.2/recommendations.json' ); + $request = wp_remote_get( 'https://woo.com/wp-json/wccom/marketing-tab/1.2/recommendations.json' ); $recommendations = array(); if ( is_wp_error( $request ) ) { From 9894af62b0adc418c5d396ecb7ac87e9e4fcc88c Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:00:21 +0100 Subject: [PATCH 41/65] =?UTF-8?q?Update=20woocommerce.com=20=E2=86=92=20wo?= =?UTF-8?q?o.com=20in=20marketing=20tab=20icon=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MultichannelMarketing/PinterestChannel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MultichannelMarketing/PinterestChannel.php b/src/MultichannelMarketing/PinterestChannel.php index e09fb8be2..1838ed0c8 100644 --- a/src/MultichannelMarketing/PinterestChannel.php +++ b/src/MultichannelMarketing/PinterestChannel.php @@ -77,7 +77,7 @@ public function get_description(): string { * @return string */ public function get_icon_url(): string { - return 'https://woocommerce.com/wp-content/plugins/wccom-plugins/marketing-tab-rest-api/icons/pinterest.svg'; + return 'https://woo.com/wp-content/plugins/wccom-plugins/marketing-tab-rest-api/icons/pinterest.svg'; } /** From 9050e215328e76ecf027bedbd9c2333e947e625d Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:02:04 +0100 Subject: [PATCH 42/65] =?UTF-8?q?Update=20woocommerce.com=20=E2=86=92=20wo?= =?UTF-8?q?o.com=20in=20readme.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 7e8bf636a..204e07dc4 100644 --- a/readme.txt +++ b/readme.txt @@ -67,7 +67,7 @@ Pinterest is a visual discovery engine people use to find inspiration for their * PHP version 7.3 or greater (PHP 7.4 or greater is recommended) * MySQL version 5.6 or greater -Visit the [WooCommerce server requirements documentation](https://docs.woocommerce.com/document/server-requirements/) for a detailed list of server requirements. +Visit the [WooCommerce server requirements documentation](https://woo.com/document/server-requirements/) for a detailed list of server requirements. = Automatic installation = From 8cb93f51fd1f120f2a7ded7b5a19763aad4e5a6d Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Fri, 3 Nov 2023 11:21:21 +0100 Subject: [PATCH 43/65] Remove Spanish geo from feature requests link --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e9b6f5f1a..6a8cb103d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -16,7 +16,7 @@ Please see [SECURITY.md](./SECURITY.md). ## Feature Requests -Feature requests can be submitted on [Woo.com](https://woo.com/es-es/feature-requests/pinterest-for-woocommerce/). Be sure to include a good description of the expected behavior and use case, and before submitting a request, please search for similar ones. +Feature requests can be submitted on [Woo.com](https://woo.com/feature-requests/pinterest-for-woocommerce/). Be sure to include a good description of the expected behavior and use case, and before submitting a request, please search for similar ones. ## Getting started From dbdb9fb7f50d6d91a97ca7e02293e882835f4655 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:49:01 +0000 Subject: [PATCH 44/65] Start `release/1.3.13`. From a48dd61ab84019854de67a74dbf633530a856674 Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Tue, 7 Nov 2023 21:56:48 +0800 Subject: [PATCH 45/65] Product version bump update --- package-lock.json | 2 +- package.json | 2 +- pinterest-for-woocommerce.php | 8 ++++---- readme.txt | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3073f8735..eb2facc4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pinterest-for-woocommerce", - "version": "1.3.12", + "version": "1.3.13", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ef55373a0..cdff6e8ce 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pinterest-for-woocommerce", "title": "Pinterest for WooCommerce", "description": "Pinterest for WooCommerce", - "version": "1.3.12", + "version": "1.3.13", "main": "gulpfile.js", "repository": { "type": "git", diff --git a/pinterest-for-woocommerce.php b/pinterest-for-woocommerce.php index 0f2bd3c2d..e77bd5a56 100644 --- a/pinterest-for-woocommerce.php +++ b/pinterest-for-woocommerce.php @@ -13,7 +13,7 @@ * Plugin Name: Pinterest for WooCommerce * Plugin URI: https://woo.com/products/pinterest-for-woocommerce/ * Description: Grow your business on Pinterest! Use this official plugin to allow shoppers to Pin products while browsing your store, track conversions, and advertise on Pinterest. - * Version: 1.3.12 + * Version: 1.3.13 * Author: WooCommerce * Author URI: https://woo.com * License: GPL-2.0+ @@ -22,11 +22,11 @@ * Domain Path: /i18n/languages * * Requires at least: 5.6 - * Tested up to: 6.3 + * Tested up to: 6.4 * Requires PHP: 7.4 * * WC requires at least: 5.3 - * WC tested up to: 8.2 + * WC tested up to: 8.3 */ /** @@ -46,7 +46,7 @@ } define( 'PINTEREST_FOR_WOOCOMMERCE_PLUGIN_FILE', __FILE__ ); -define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.12' ); // WRCS: DEFINED_VERSION. +define( 'PINTEREST_FOR_WOOCOMMERCE_VERSION', '1.3.13' ); // WRCS: DEFINED_VERSION. // HPOS compatibility declaration. add_action( diff --git a/readme.txt b/readme.txt index 204e07dc4..b3ada7ebf 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: automattic, pinterest, woocommerce Tags: woocommerce, pinterest, advertise Requires at least: 5.6 -Tested up to: 6.3 +Tested up to: 6.4 Requires PHP: 7.3 -Stable tag: 1.3.12 +Stable tag: 1.3.13 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html From f2b97f3f52f79f6dcf30f51ac95098aaf0891cdf Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Tue, 7 Nov 2023 21:57:01 +0800 Subject: [PATCH 46/65] Changelog update --- changelog.txt | 5 +++++ readme.txt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/changelog.txt b/changelog.txt index 758c320fb..08d8c7d4b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,10 @@ *** Pinterest for WooCommerce Changelog *** += 1.3.13 - 2023-11-07 = +* Fix - Doc - Use new Woo.com domain. +* Tweak - WC 8.3 compatibility. +* Tweak - WP 6.4 compatibility. + = 1.3.12 - 2023-10-19 = * Dev - Add phpcs on changed files only. diff --git a/readme.txt b/readme.txt index b3ada7ebf..47f4e6d1c 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,11 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](hhttps: == Changelog == += 1.3.13 - 2023-11-07 = +* Fix - Doc - Use new Woo.com domain. +* Tweak - WC 8.3 compatibility. +* Tweak - WP 6.4 compatibility. + = 1.3.12 - 2023-10-19 = * Dev - Add phpcs on changed files only. From b62881098aa056c7bbccceeb347c3811ddc64e11 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:35:09 +0200 Subject: [PATCH 47/65] Check feed_location to contain absolute url. --- src/API/APIV5.php | 48 +++++++++++++++++++++++++++++++++ src/API/FeedState.php | 2 +- src/FeedRegistration.php | 18 ++++++------- src/FeedStatusService.php | 2 +- src/Feeds.php | 56 +++++++++------------------------------ 5 files changed, 72 insertions(+), 54 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index 905247e45..9d9df3b19 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -326,4 +326,52 @@ public static function domain_metatag_verification_request( string $domain ): ar ) ); } + + /** + * Get merchant's feeds. + * + * @param string $ad_account_id + * + * @return array { + * List of feeds. + * + * @type array[] $items { Feeds. + * @type string $id Feed ID. + * @type string $name A human-friendly name associated to a given feed. This value is currently nullable due to historical reasons. It is expected to become non-nullable in the future. + * @type string $status ACTIVE, INACTIVE. Status for catalogs entities. Present in catalogs_feed values. When a feed is deleted, the response will inform DELETED as status. + * @type string $format The file format of a feed: TSV, CSV, XML. + * @type string $location The URL where a feed is available for download. This URL is what Pinterest will use to download a feed for processing. + * @type string $created_at + * @type string $updated_at + * @type string $catalog_type Type of the catalog entity: RETAIL, HOTEL. + * @type array[] $credentials { Use this if your feed file requires username and password. + * @type string $username The required password for downloading a feed. + * @type string $password The required username for downloading a feed. + * } + * @type array[] $preferred_processing_schedule { Optional daily processing schedule. Use this to configure the preferred time for processing a feed (otherwise random). + * @type string $time A time in format HH:MM with leading 0 (zero). + * @type string $timezone The timezone considered for the processing schedule time. + * } + * @type string $default_currency Currency Codes from ISO 4217. + * @type string $default_locale The locale used within a feed for product descriptions. + * @type string $default_country Country ID from ISO 3166-1 alpha-2. + * @type string $default_availability Default availability for products in a feed. + * } + * @type string $bookmark Cursor used to fetch the next page of items + * } + * @throws PinterestApiException If the request fails with 500 status. + */ + public static function get_ad_account_feeds( $ad_account_id ) { + $args = array( + 'ad_account_id' => $ad_account_id, + 'page_size' => 25, // Default page size. + ); + return self::make_request( + 'catalogs/feeds', + 'GET', + $args, + '', + MINUTE_IN_SECONDS + ); + } } diff --git a/src/API/FeedState.php b/src/API/FeedState.php index f12ff1175..9568842c1 100644 --- a/src/API/FeedState.php +++ b/src/API/FeedState.php @@ -243,7 +243,7 @@ public function add_feed_registration_state( $result ) { $merchant_id = Pinterest_For_Woocommerce()::get_data( 'merchant_id' ); $feed_id = FeedRegistration::get_locally_stored_registered_feed_id(); - $feed = Pinterest\Feeds::get_merchant_feed( $merchant_id, $feed_id ); + $feed = Pinterest\Feeds::get_ad_account_feed( $feed_id ); if ( ! empty( $feed->location_config->full_feed_fetch_freq ) ) { $extra_info = wp_kses_post( sprintf( diff --git a/src/FeedRegistration.php b/src/FeedRegistration.php index 6003dbb08..ed65d0d22 100644 --- a/src/FeedRegistration.php +++ b/src/FeedRegistration.php @@ -211,22 +211,22 @@ private static function check_merchant_approval_status() { * @return void */ public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $feed_id ) { + $feeds = Feeds::get_ad_account_feeds(); - $feed_profiles = Feeds::get_merchant_feeds( $merchant_id ); - - if ( empty( $feed_profiles ) ) { + if ( empty( $feeds ) ) { return; } $configs = LocalFeedConfigs::get_instance()->get_configurations(); $config = reset( $configs ); - $local_path = dirname( $config['feed_url'] ); + // Make sure this $local_path has a domain name. + $local_path = $config['feed_url']; $invalidate_cache = false; - foreach ( $feed_profiles as $feed ) { + foreach ( $feeds as $feed ) { // Local feed should not be disabled. - if ( $feed_id === $feed->id ) { + if ( $feed_id === $feed['id'] ) { continue; } @@ -243,13 +243,13 @@ public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $fe * class. Utilizing dirname eliminates the file name and suffix, leaving only the directory path for * comparison. */ - if ( dirname( $feed->location_config->full_feed_fetch_location ) !== $local_path ) { + if ( dirname( $feed['location'] ) !== $local_path ) { continue; } // Disable the feed if it is active. - if ( 'ACTIVE' === $feed->feed_status ) { - Feeds::disable_feed( $merchant_id, $feed->id ); + if ( 'ACTIVE' === $feed['status'] ) { + Feeds::disable_feed( $merchant_id, $feed['id'] ); $invalidate_cache = true; } } diff --git a/src/FeedStatusService.php b/src/FeedStatusService.php index e196d2cc0..533349fa9 100644 --- a/src/FeedStatusService.php +++ b/src/FeedStatusService.php @@ -82,7 +82,7 @@ public static function get_feed_registration_status(): string { } try { - $feed = Feeds::get_merchant_feed( $merchant_id, $feed_id ); + $feed = Feeds::get_ad_account_feed( $feed_id ); } catch ( Exception $e ) { throw new Exception( 'error_fetching_feed' ); } diff --git a/src/Feeds.php b/src/Feeds.php index 57c19b88b..62c839f53 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -12,6 +12,7 @@ exit; } +use Automattic\WooCommerce\Pinterest\API\APIV5; use \Exception; use Automattic\WooCommerce\Pinterest\API\Base; use Automattic\WooCommerce\Pinterest\Exception\PinterestApiLocaleException; @@ -24,43 +25,26 @@ class Feeds { /** * Get a specific merchant feed using the given arguments. * - * @param string $merchant_id The merchant ID the feed belongs to. * @param string $feed_id The ID of the feed. * * @return object The feed profile object. * * @throws Exception PHP Exception. */ - public static function get_merchant_feed( $merchant_id, $feed_id ) { - + public static function get_ad_account_feed( $feed_id ) { try { - - // Get the feeds of the merchant. - $feeds = Base::get_merchant_feeds( $merchant_id, true ); - - if ( 'success' !== $feeds['status'] ) { - throw new Exception( esc_html__( 'Could not get feed info.', 'pinterest-for-woocommerce' ) ); - } - - if ( ! is_array( $feeds['data'] ) ) { - throw new Exception( esc_html__( 'Wrong feed info.', 'pinterest-for-woocommerce' ) ); - } - - foreach ( $feeds['data'] as $feed_profile ) { - + $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); + $feeds = APIV5::get_ad_account_feeds( $ad_account_id ); + foreach ( $feeds['items'] as $feed ) { // Get the feed with the requested id if exists. - if ( $feed_id === $feed_profile->id ) { - return $feed_profile; + if ( $feed_id === $feed['id'] ) { + return $feed; } } - // No feed found. throw new Exception( esc_html__( 'No feed found with the requested ID.', 'pinterest-for-woocommerce' ) ); - } catch ( Exception $e ) { - Logger::log( $e->getMessage(), 'error' ); - throw $e; } } @@ -69,31 +53,17 @@ public static function get_merchant_feed( $merchant_id, $feed_id ) { /** * Get merchant's feeds. * - * @param string $merchant_id The merchant ID. - * * @return array The feed profile objects. * * @throws Exception PHP Exception. */ - public static function get_merchant_feeds( $merchant_id ) { - + public static function get_ad_account_feeds() { try { - $feeds = API\Base::get_merchant_feeds( $merchant_id, true ); - - if ( 'success' !== $feeds['status'] ) { - throw new Exception( esc_html__( 'Could not get feed info.', 'pinterest-for-woocommerce' ) ); - } - - if ( ! is_array( $feeds['data'] ) ) { - throw new Exception( esc_html__( 'Wrong feed info.', 'pinterest-for-woocommerce' ) ); - } - - return $feeds['data']; - + $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); + $feeds = APIV5::get_ad_account_feeds( $ad_account_id ); + return $feeds['items'] ?? []; } catch ( Exception $e ) { - Logger::log( $e->getMessage(), 'error' ); - throw $e; } } @@ -124,7 +94,7 @@ public static function match_local_feed_configuration_to_registered_feeds( $merc $local_path = $config['feed_url']; $local_country = Pinterest_For_Woocommerce()::get_base_country() ?? 'US'; $local_locale = LocaleMapper::get_locale_for_api(); - $feeds = self::get_merchant_feeds( $merchant_id ); + $feeds = self::get_ad_account_feeds(); foreach ( $feeds as $feed ) { $configured_path = $feed->location_config->full_feed_fetch_location; @@ -152,7 +122,7 @@ public static function match_local_feed_configuration_to_registered_feeds( $merc * @return bool True if the feed is active, false otherwise. */ public static function is_local_feed_enabled( $merchant_id, $feed_profile_id ) { - $feed = self::get_merchant_feed( $merchant_id, $feed_profile_id ); + $feed = self::get_ad_account_feed( $feed_profile_id ); return 'ACTIVE' === $feed->feed_status; } From fb6e09134e19f33ca255c51dc5fb477aad52e3e1 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:09:10 +0200 Subject: [PATCH 48/65] Porting feed status change endpoints and invalidate cache method. --- src/API/APIV5.php | 56 ++++++++++++++++++++++++++++++++++++++++ src/FeedRegistration.php | 10 +++---- src/Feeds.php | 43 +++++++++++++++--------------- src/Merchants.php | 2 +- 4 files changed, 83 insertions(+), 28 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index 9d9df3b19..ca24e8cfe 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -374,4 +374,60 @@ public static function get_ad_account_feeds( $ad_account_id ) { MINUTE_IN_SECONDS ); } + + /** + * Invalidate the ad account's feeds cache. + * + * @param string $ad_account_id Ad Account ID. + * + * @return void + */ + public static function invalidate_ad_account_feeds_cache( $ad_account_id ) { + $args = array( + 'ad_account_id' => $ad_account_id, + 'page_size' => 25, // Default page size. + ); + self::invalidate_cached_response( + 'catalogs/feeds', + 'GET', + $args, + '', + ); + } + + /** + * Enable a feed. + * + * @since x.x.x + * + * @param string $feed_id The ID of the feed to be enabled. + * + * @return mixed + */ + public static function enable_merchant_feed( $merchant_id, $feed_id ) { + return static::update_feed_status( $feed_id, 'ACTIVE' ); + } + + /** + * Disable a feed. + * + * @since x.x.x + * + * @param string $feed_id The ID of the feed to be disabled. + * + * @return mixed + */ + public static function disable_merchant_feed( $merchant_id, $feed_id ) { + return static::update_feed_status( $feed_id, 'INACTIVE' ); + } + + private static function update_feed_status( $feed_id, $status ) { + return self::make_request( + "catalog/feeds/{$feed_id}", + 'PATCH', + array( + 'status' => 'INACTIVE', + ), + ); + } } diff --git a/src/FeedRegistration.php b/src/FeedRegistration.php index ed65d0d22..7a3d2b8f7 100644 --- a/src/FeedRegistration.php +++ b/src/FeedRegistration.php @@ -173,7 +173,7 @@ private static function register_feed() { private static function feed_enable_status_maintenance( $merchant_id, $feed_id ) { // Check if the feed is enabled. If not, enable it. if ( ! Feeds::is_local_feed_enabled( $merchant_id, $feed_id ) ) { - Feeds::enabled_feed( $merchant_id, $feed_id ); + Feeds::enabled_feed( $feed_id ); } // Cleanup feeds that are registered but not in the local feed configurations. @@ -231,9 +231,9 @@ public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $fe } // Only disable feeds that are registered as WooCommerce integration. - if ( 'WOOCOMMERCE' !== $feed->integration_platform_type ) { + /*if ( 'WOOCOMMERCE' !== $feed->integration_platform_type ) { continue; - } + }*/ /** * Disable feeds only if their file URL matches, using the directory path for accurate identification. This @@ -249,13 +249,13 @@ public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $fe // Disable the feed if it is active. if ( 'ACTIVE' === $feed['status'] ) { - Feeds::disable_feed( $merchant_id, $feed['id'] ); + Feeds::disable_feed( $feed['id'] ); $invalidate_cache = true; } } if ( $invalidate_cache ) { - Feeds::invalidate_get_merchant_feeds_cache( $merchant_id ); + Feeds::invalidate_get_ad_account_feeds_cache(); } } diff --git a/src/Feeds.php b/src/Feeds.php index 62c839f53..42c817c29 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -16,6 +16,7 @@ use \Exception; use Automattic\WooCommerce\Pinterest\API\Base; use Automattic\WooCommerce\Pinterest\Exception\PinterestApiLocaleException; +use Throwable; /** * Class handling fetch methods for feed profiles. @@ -71,12 +72,13 @@ public static function get_ad_account_feeds() { /** * Invalidate the merchant feeds cache. * - * @since 1.2.13 - * @param string $merchant_id The merchant ID. + * @since x.x.x + * * @return void */ - public static function invalidate_get_merchant_feeds_cache( $merchant_id ) { - API\Base::invalidate_merchant_feeds_cache( $merchant_id, true ); + public static function invalidate_get_ad_account_feeds_cache() { + $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); + APIV5::invalidate_ad_account_feeds_cache( $ad_account_id ); } /** @@ -129,22 +131,20 @@ public static function is_local_feed_enabled( $merchant_id, $feed_profile_id ) { /** * Enabled the feed. * - * @since 1.2.13 + * @since x.x.x * - * @param string $merchant_id The merchant ID. - * @param string $feed_profile_id The ID of the feed. + * @param string $feed_id The ID of the feed. * * @return bool True if the feed is has been enabled, false otherwise. */ - public static function enabled_feed( $merchant_id, $feed_profile_id ) { + public static function enabled_feed( $feed_id ) { try { - $result = Base::enable_merchant_feed( $merchant_id, $feed_profile_id ); - + $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); + APIV5::enable_merchant_feed( $ad_account_id, $feed_id ); // We don't need to check the status, lets just invalidate the cache for extra safety. - self::invalidate_get_merchant_feeds_cache( $merchant_id, true ); - - return 'success' === $result['status']; - } catch ( \Throwable $th ) { + self::invalidate_get_ad_account_feeds_cache(); + return true; + } catch ( Throwable $th ) { Logger::log( $th->getMessage(), 'error' ); return false; } @@ -153,19 +153,18 @@ public static function enabled_feed( $merchant_id, $feed_profile_id ) { /** * Enabled the feed. * - * @since 1.2.13 + * @since x.x.x * - * @param string $merchant_id The merchant ID. - * @param string $feed_profile_id The ID of the feed. + * @param string $feed_id The ID of the feed. * * @return bool True if the feed is has been disabled, false otherwise. */ - public static function disable_feed( $merchant_id, $feed_profile_id ) { + public static function disable_feed( $feed_id ) { try { - $result = Base::disable_merchant_feed( $merchant_id, $feed_profile_id ); - - return 'success' === $result['status']; - } catch ( \Throwable $th ) { + $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); + APIV5::disable_merchant_feed( $ad_account_id, $feed_id ); + return true; + } catch ( Throwable $th ) { Logger::log( $th->getMessage(), 'error' ); return false; } diff --git a/src/Merchants.php b/src/Merchants.php index 142d6ddb4..6e581b521 100644 --- a/src/Merchants.php +++ b/src/Merchants.php @@ -174,7 +174,7 @@ public static function update_or_create_merchant() { $merchant_id = $response['data']; - Feeds::invalidate_get_merchant_feeds_cache( $merchant_id, true ); + Feeds::invalidate_get_ad_account_feeds_cache(); try { $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds( $response['data'] ); From c49ecae63dee963644990aec3cc811827c9c17f9 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Mon, 13 Nov 2023 09:34:50 +0200 Subject: [PATCH 49/65] Fixing phpcs errors. Adding feed status constants. --- src/API/APIV5.php | 35 +++++++++++++++++++++++++---------- src/FeedRegistration.php | 6 ++++-- src/Feeds.php | 4 ++++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index ca24e8cfe..2f4d8e8a3 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -9,6 +9,7 @@ namespace Automattic\WooCommerce\Pinterest\API; +use Automattic\WooCommerce\Pinterest\Feeds; use Automattic\WooCommerce\Pinterest\PinterestApiException; use Automattic\WooCommerce\Pinterest\PinterestApiException as ApiException; use Exception; @@ -330,7 +331,7 @@ public static function domain_metatag_verification_request( string $domain ): ar /** * Get merchant's feeds. * - * @param string $ad_account_id + * @param string $ad_account_id Pinterest Ad Account ID. * * @return array { * List of feeds. @@ -400,12 +401,13 @@ public static function invalidate_ad_account_feeds_cache( $ad_account_id ) { * * @since x.x.x * - * @param string $feed_id The ID of the feed to be enabled. + * @param string $ad_account_id Pinterest Ad Account ID. + * @param string $feed_id The ID of the feed to be enabled. * * @return mixed */ - public static function enable_merchant_feed( $merchant_id, $feed_id ) { - return static::update_feed_status( $feed_id, 'ACTIVE' ); + public static function enable_merchant_feed( $ad_account_id, $feed_id ) { + return static::update_feed_status( $feed_id, Feeds::FEED_STATUS_ACTIVE, $ad_account_id ); } /** @@ -413,20 +415,33 @@ public static function enable_merchant_feed( $merchant_id, $feed_id ) { * * @since x.x.x * - * @param string $feed_id The ID of the feed to be disabled. + * @param string $ad_account_id Pinterest Ad Account ID. + * @param string $feed_id The ID of the feed to be disabled. * * @return mixed */ - public static function disable_merchant_feed( $merchant_id, $feed_id ) { - return static::update_feed_status( $feed_id, 'INACTIVE' ); + public static function disable_merchant_feed( $ad_account_id, $feed_id ) { + return static::update_feed_status( $feed_id, Feeds::FEED_STATUS_INACTIVE, $ad_account_id ); } - private static function update_feed_status( $feed_id, $status ) { + /** + * Update a feed status. + * + * @since x.x.x + * + * @param string $feed_id The ID of the feed to be updated. + * @param string $status The status to be set. + * @param string $ad_account_id Pinterest Ad Account ID. + * + * @return array + * @throws ApiException + */ + private static function update_feed_status( $feed_id, $status, $ad_account_id ) { return self::make_request( - "catalog/feeds/{$feed_id}", + "catalog/feeds/{$feed_id}?ad_account_id={$ad_account_id}", 'PATCH', array( - 'status' => 'INACTIVE', + 'status' => $status, ), ); } diff --git a/src/FeedRegistration.php b/src/FeedRegistration.php index 7a3d2b8f7..07d3c0c81 100644 --- a/src/FeedRegistration.php +++ b/src/FeedRegistration.php @@ -231,9 +231,11 @@ public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $fe } // Only disable feeds that are registered as WooCommerce integration. - /*if ( 'WOOCOMMERCE' !== $feed->integration_platform_type ) { + /* + if ( 'WOOCOMMERCE' !== $feed->integration_platform_type ) { continue; - }*/ + } + */ /** * Disable feeds only if their file URL matches, using the directory path for accurate identification. This diff --git a/src/Feeds.php b/src/Feeds.php index 42c817c29..343914364 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -23,6 +23,10 @@ */ class Feeds { + const FEED_STATUS_ACTIVE = 'ACTIVE'; + + const FEED_STATUS_INACTIVE = 'INACTIVE'; + /** * Get a specific merchant feed using the given arguments. * From c9e38a0e685e0c02ce78530758a08fd911c09084 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:01:15 +0200 Subject: [PATCH 50/65] Minor exception naming adjustments. --- src/API/APIV5.php | 15 +++++++-------- src/API/Base.php | 12 +++++------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index 2f4d8e8a3..1c77f467d 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -11,7 +11,6 @@ use Automattic\WooCommerce\Pinterest\Feeds; use Automattic\WooCommerce\Pinterest\PinterestApiException; -use Automattic\WooCommerce\Pinterest\PinterestApiException as ApiException; use Exception; if ( ! defined( 'ABSPATH' ) ) { @@ -68,7 +67,7 @@ public static function prepare_request( $endpoint, $method = 'POST', $payload = * @type int $following_count User account following count. * @type int $monthly_views User account monthly views. * } - * @throws ApiException Throws 403 and 500 exceptions. + * @throws PinterestApiException Throws 403 and 500 exceptions. */ public static function get_account_info() { return self::make_request( 'user_account', 'GET' ); @@ -110,7 +109,7 @@ public static function get_list_of_ads_supported_countries() { * } * @type string $bookmark * } - * @throws ApiException Throws 403 and 500 exceptions. + * @throws PinterestApiException Throws 403 and 500 exceptions. */ public static function get_user_websites() { return self::make_request( 'user_account/websites', 'GET' ); @@ -130,7 +129,7 @@ public static function get_user_websites() { * @type string $image_large_url * @type string $image_xlarge_url * } - * @throws ApiException Throws 500 exception in case of unexpected error. + * @throws PinterestApiException Throws 500 exception in case of unexpected error. */ public static function get_linked_businesses() { return self::make_request( 'user_account/businesses', 'GET' ); @@ -183,7 +182,7 @@ public static function get_advertisers( $pinterest_user = null ) { * } * } * - * @throws ApiException|Exception Throws 500 exception. + * @throws PinterestApiException|Exception Throws 500 exception. */ public static function get_advertiser_tags( $ad_account_id ) { return self::make_request( "ad_accounts/{$ad_account_id}/conversion_tags", 'GET' ); @@ -224,7 +223,7 @@ public static function get_advertiser_tags( $ad_account_id ) { * @type bool $aem_loc_enabled Whether Automatic Enhanced Match location is enabled. * } * } - * @throws ApiException Throws 500 exception in case of unexpected error. + * @throws PinterestApiException Throws 500 exception in case of unexpected error. */ public static function get_advertiser_tag( $ad_account_id, $conversion_tag_id ) { return self::make_request( "ad_accounts/{$ad_account_id}/conversion_tags/{$conversion_tag_id}", 'GET' ); @@ -262,7 +261,7 @@ public static function get_advertiser_tag( $ad_account_id, $conversion_tag_id ) * @type ?bool $aem_loc_enabled Whether Automatic Enhanced Match location is enabled. * } * } - * @throws ApiException|Exception Throws 500 exception. + * @throws PinterestApiException|Exception Throws 500 exception. */ public static function create_tag( $ad_account_id ) { $tag_name = self::get_tag_name(); @@ -434,7 +433,7 @@ public static function disable_merchant_feed( $ad_account_id, $feed_id ) { * @param string $ad_account_id Pinterest Ad Account ID. * * @return array - * @throws ApiException + * @throws PinterestApiException If API request ends up other than 2xx status. */ private static function update_feed_status( $feed_id, $status, $ad_account_id ) { return self::make_request( diff --git a/src/API/Base.php b/src/API/Base.php index 5c533e44d..d6823eee6 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -9,11 +9,9 @@ namespace Automattic\WooCommerce\Pinterest\API; -use Automattic\WooCommerce\Pinterest as Pinterest; use Automattic\WooCommerce\Pinterest\Logger as Logger; use Automattic\WooCommerce\Pinterest\PinterestApiException; -use Automattic\WooCommerce\Pinterest\PinterestApiException as ApiException; -use \Exception; +use Exception; if ( ! defined( 'ABSPATH' ) ) { @@ -105,7 +103,7 @@ public static function make_request( $endpoint, $method = 'POST', $payload = arr return $response; - } catch ( ApiException $e ) { + } catch ( PinterestApiException $e ) { if ( ! empty( Pinterest_For_WooCommerce()::get_setting( 'enable_debug_logging' ) ) ) { /* Translators: 1: Error message 2: Stack trace */ @@ -269,8 +267,8 @@ public static function invalidate_cached_response( $endpoint, $method, $payload, * * @return array * - * @throws Exception PHP exception. - * @throws ApiException PHP exception. + * @throws Exception PHP exception. + * @throws PinterestApiException PHP exception. */ protected static function handle_request( $request ) { @@ -335,7 +333,7 @@ protected static function handle_request( $request ) { } /* Translators: Additional message */ - throw new ApiException( + throw new PinterestApiException( array( 'message' => $message, 'response_body' => $body, From 273fd2e3d1d2456b0439b50cdc5e4eb2ba85582d Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:32:22 +0200 Subject: [PATCH 51/65] Fix update feed endpoints how parameters are passed to Pinterest. Adding recent feed processing status endpoint. --- src/API/APIV5.php | 23 ++++++++++------------- src/Feeds.php | 13 +++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index 1c77f467d..8292e435a 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -362,14 +362,10 @@ public static function domain_metatag_verification_request( string $domain ): ar * @throws PinterestApiException If the request fails with 500 status. */ public static function get_ad_account_feeds( $ad_account_id ) { - $args = array( - 'ad_account_id' => $ad_account_id, - 'page_size' => 25, // Default page size. - ); return self::make_request( - 'catalogs/feeds', + "catalogs/feeds?ad_account_id={$ad_account_id}", 'GET', - $args, + array(), '', MINUTE_IN_SECONDS ); @@ -383,15 +379,9 @@ public static function get_ad_account_feeds( $ad_account_id ) { * @return void */ public static function invalidate_ad_account_feeds_cache( $ad_account_id ) { - $args = array( - 'ad_account_id' => $ad_account_id, - 'page_size' => 25, // Default page size. - ); self::invalidate_cached_response( - 'catalogs/feeds', + "catalogs/feeds?ad_account_id={$ad_account_id}", 'GET', - $args, - '', ); } @@ -444,4 +434,11 @@ private static function update_feed_status( $feed_id, $status, $ad_account_id ) ), ); } + + public static function get_feed_processing_results( $feed_id, $ad_account_id ) { + return self::make_request( + "catalogs/feeds/{$feed_id}/processing_results?ad_account_id={$ad_account_id}", + 'GET' + ); + } } diff --git a/src/Feeds.php b/src/Feeds.php index 343914364..a1ff70087 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -205,4 +205,17 @@ function ( $a, $b ) { return reset( $feed_report['data']->workflows ); } + /** + * Get the latest Workflow of the active feed related to the last attempt to process and ingest our feed. + * + * @param string $feed_id Pinterest feed ID. + * @param string $ad_account_id Pinterest ad account ID. + * @param string $bookmark Bookmark to fetch results from. + * @param int $per_page Number of results to fetch per page. + * + * @return void + */ + public static function get_feed_processing_results( $feed_id, $ad_account_id, $bookmark = '', $per_page = 25 ) { + + } } From 5da7c81fa94cafd71c77b5c1e65106dd20feeb8d Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:22:48 +0200 Subject: [PATCH 52/65] Renaming some API methods. Implementing feed create method. Getting rid of Merchant object as the one not needed with v5. --- src/API/APIV5.php | 119 +++++++++++++++++++++-- src/API/Base.php | 10 +- src/API/Health.php | 45 --------- src/FeedRegistration.php | 49 +++------- src/Feeds.php | 141 +++++++++++++++++++++------- src/LocaleMapper.php | 9 +- src/Merchants.php | 197 --------------------------------------- 7 files changed, 240 insertions(+), 330 deletions(-) delete mode 100644 src/Merchants.php diff --git a/src/API/APIV5.php b/src/API/APIV5.php index 8292e435a..edd8caea0 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -327,9 +327,56 @@ public static function domain_metatag_verification_request( string $domain ): ar ); } + /** + * Sends create feed request to Pinterest API. + * + * @since x.x.x + * + * @link https://developers.pinterest.com/docs/api/v5/#operation/feeds/create + * + * @param array $data { + * Feed data. + * + * @type string $name A human-friendly name associated to a given feed. This value is currently nullable due to historical reasons. It is expected to become non-nullable in the future. + * @type string $format The file format of a feed: TSV, CSV, XML. + * @type string $location The URL where a feed is available for download. This URL is what Pinterest will use to download a feed for processing. + * @type string $catalog_type Type of the catalog entity: RETAIL, HOTEL. + * @type string $default_currency Currency Codes from ISO 4217. + * @type string $default_locale The locale used within a feed for product descriptions. + * @type string $default_country Country ID from ISO 3166-1 alpha-2. + * @type string $default_availability Default availability for products in a feed. + * @type array[] $credentials { + * Use this if your feed file requires username and password. + * + * @type string $username The required password for downloading a feed. + * @type string $password The required username for downloading a feed. + * } + * @type array[] $preferred_processing_schedule { + * Optional daily processing schedule. Use this to configure the preferred time for processing a feed (otherwise random). + * + * @type string $time A time in format HH:MM with leading 0 (zero). + * @type string $timezone The timezone considered for the processing schedule time. + * } + * } + * @param string $ad_account_id Pinterest Ad Account ID. + * + * @return array + * + * @throws PinterestApiException + */ + public static function create_feed( $data, $ad_account_id ): array { + return self::make_request( + "catalogs/feeds?ad_account_id={$ad_account_id}", + 'POST', + $data + ); + } + /** * Get merchant's feeds. * + * @since x.x.x + * * @param string $ad_account_id Pinterest Ad Account ID. * * @return array { @@ -344,11 +391,15 @@ public static function domain_metatag_verification_request( string $domain ): ar * @type string $created_at * @type string $updated_at * @type string $catalog_type Type of the catalog entity: RETAIL, HOTEL. - * @type array[] $credentials { Use this if your feed file requires username and password. + * @type array[] $credentials { + * Use this if your feed file requires username and password. + * * @type string $username The required password for downloading a feed. * @type string $password The required username for downloading a feed. * } - * @type array[] $preferred_processing_schedule { Optional daily processing schedule. Use this to configure the preferred time for processing a feed (otherwise random). + * @type array[] $preferred_processing_schedule { + * Optional daily processing schedule. Use this to configure the preferred time for processing a feed (otherwise random). + * * @type string $time A time in format HH:MM with leading 0 (zero). * @type string $timezone The timezone considered for the processing schedule time. * } @@ -361,7 +412,7 @@ public static function domain_metatag_verification_request( string $domain ): ar * } * @throws PinterestApiException If the request fails with 500 status. */ - public static function get_ad_account_feeds( $ad_account_id ) { + public static function get_feeds($ad_account_id ) { return self::make_request( "catalogs/feeds?ad_account_id={$ad_account_id}", 'GET', @@ -374,14 +425,18 @@ public static function get_ad_account_feeds( $ad_account_id ) { /** * Invalidate the ad account's feeds cache. * + * @since x.x.x + * * @param string $ad_account_id Ad Account ID. * - * @return void + * @return bool True if the cache was invalidated, false otherwise. */ - public static function invalidate_ad_account_feeds_cache( $ad_account_id ) { - self::invalidate_cached_response( + public static function invalidate_feeds_cache( string $ad_account_id ): bool { + return self::invalidate_cached_response( "catalogs/feeds?ad_account_id={$ad_account_id}", 'GET', + array(), + '' ); } @@ -395,7 +450,7 @@ public static function invalidate_ad_account_feeds_cache( $ad_account_id ) { * * @return mixed */ - public static function enable_merchant_feed( $ad_account_id, $feed_id ) { + public static function enable_feed($ad_account_id, $feed_id ) { return static::update_feed_status( $feed_id, Feeds::FEED_STATUS_ACTIVE, $ad_account_id ); } @@ -409,7 +464,7 @@ public static function enable_merchant_feed( $ad_account_id, $feed_id ) { * * @return mixed */ - public static function disable_merchant_feed( $ad_account_id, $feed_id ) { + public static function disable_feed($ad_account_id, $feed_id ) { return static::update_feed_status( $feed_id, Feeds::FEED_STATUS_INACTIVE, $ad_account_id ); } @@ -435,9 +490,53 @@ private static function update_feed_status( $feed_id, $status, $ad_account_id ) ); } - public static function get_feed_processing_results( $feed_id, $ad_account_id ) { + /** + * Get the latest workflow for the given feed. + * + * @link https://developers.pinterest.com/docs/api/v5/#operation/feed_processing_results/list + * + * @since x.x.x + * + * @param string $feed_id Feed ID. + * @param string $ad_account_id Pinterest Ad Account ID. + * + * @return array { + * Feed Processing Results. + * + * @type array[] $items { + * Feed processing results. + * + * @type string $id Feed Processing Results ID. + * @type string $status Feed Processing status. "COMPLETED", "COMPLETED_EARLY", "DISAPPROVED", etc. + * @type array $product_counts { + * Feed product counts. + * + * @type int $original Original product count. + * @type int $ingested Ingested product count. + * } + * @type array $ingestion_details { + * Processing details. + * + * @type array $errors {} Errors. + * @type array $info {} Info + * @type array $warnings {} Warnings. + * } + * @type array $validation_details { + * Validation details. + * + * @type array $errors {} Errors. + * @type array $warnings {} Warnings. + * } + * @type string $created_at Feed Processing Results creation time. + * @type string $updated_at Feed Processing Results update time. + * } + * @type string $bookmark Cursor used to fetch the next page of items + * } + * @throws PinterestApiException + */ + public static function get_feed_processing_results( $feed_id, $ad_account_id ): array { return self::make_request( - "catalogs/feeds/{$feed_id}/processing_results?ad_account_id={$ad_account_id}", + "catalogs/feeds/{$feed_id}/processing_results?ad_account_id={$ad_account_id}&page_size=1", 'GET' ); } diff --git a/src/API/Base.php b/src/API/Base.php index f8bd652d2..0fb37f7c2 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -243,11 +243,11 @@ private static function maybe_cache_api_response( $endpoint, $method, $payload, * @param array $payload Request payload. * @param string $api Request API. * - * @return void + * @return bool True if the transient was deleted, false otherwise. */ - public static function invalidate_cached_response( $endpoint, $method, $payload, $api ) { + public static function invalidate_cached_response( $endpoint, $method, $payload, $api ): bool { $cache_key = self::get_cache_key( $endpoint, $method, $payload, $api ); - delete_transient( $cache_key ); + return delete_transient( $cache_key ); } /** @@ -660,7 +660,7 @@ public static function update_merchant_feed( $merchant_id, $feed_id, $args ) { * * @return mixed */ - public static function disable_merchant_feed( $merchant_id, $feed_profile_id ) { + public static function disable_feed($merchant_id, $feed_profile_id ) { return self::make_request( "catalogs/disable_feed_profile/{$merchant_id}/{$feed_profile_id}/" ); @@ -676,7 +676,7 @@ public static function disable_merchant_feed( $merchant_id, $feed_profile_id ) { * * @return mixed */ - public static function enable_merchant_feed( $merchant_id, $feed_profile_id ) { + public static function enable_feed($merchant_id, $feed_profile_id ) { return self::make_request( "catalogs/enable_feed_profile/{$merchant_id}/{$feed_profile_id}/" ); diff --git a/src/API/Health.php b/src/API/Health.php index 5fc4e446d..2b74b07c3 100644 --- a/src/API/Health.php +++ b/src/API/Health.php @@ -40,53 +40,8 @@ public function __construct() { * @throws \Exception PHP Exception. */ public function health_check() { - return array( 'status' => 'approved', ); - - try { - - $response = array(); - - if ( ! Pinterest_For_Woocommerce()::get_data( 'merchant_id' ) ) { - return array( 'status' => 'pending_initial_configuration' ); - } - - $merchant_connected_diff_platform = Pinterest_For_Woocommerce()::get_data( 'merchant_connected_diff_platform' ); - if ( $merchant_connected_diff_platform ) { - return array( 'status' => 'merchant_connected_diff_platform' ); - } - - $locale_error = Pinterest_For_Woocommerce()::get_data( 'merchant_locale_not_valid' ); - if ( $locale_error ) { - return array( 'status' => 'merchant_locale_not_valid' ); - } - - $merchant = Pinterest\Merchants::get_merchant(); - - if ( 'success' !== $merchant['status'] || empty( $merchant['data']->product_pin_approval_status ) ) { - throw new \Exception( __( 'Could not get approval status from Pinterest.', 'pinterest-for-woocommerce' ), 200 ); - } - - $response['status'] = $merchant['data']->product_pin_approval_status; - - if ( isset( $merchant['data']->product_pin_approval_status_reasons ) ) { - $response['reasons'] = $merchant['data']->product_pin_approval_status_reasons; - } - - return $response; - - } catch ( Throwable $th ) { - - /* Translators: The error description as returned from the API */ - $error_message = sprintf( __( 'Could not fetch account status. [%s]', 'pinterest-for-woocommerce' ), $th->getMessage() ); - - return array( - 'status' => 'error', - 'message' => $error_message, - 'code' => $th->getCode(), - ); - } } } diff --git a/src/FeedRegistration.php b/src/FeedRegistration.php index 07d3c0c81..ae0997e4f 100644 --- a/src/FeedRegistration.php +++ b/src/FeedRegistration.php @@ -135,19 +135,11 @@ private function clear_merchant_error_code() { * @throws Exception PHP Exception. */ private static function register_feed() { - - $merchant_id = self::check_merchant_approval_status(); - - if ( ! $merchant_id ) { - return false; - } - - $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds( $merchant_id ); + $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds(); // If no matching registered feed found try to create it. if ( ! $feed_id ) { - $response = Merchants::update_or_create_merchant(); - $feed_id = $response['feed_id'] ?? ''; + $feed_id = Feeds::create_feed(); } Pinterest_For_Woocommerce()::save_data( 'feed_registered', $feed_id ); @@ -156,7 +148,7 @@ private static function register_feed() { return false; } - self::feed_enable_status_maintenance( $merchant_id, $feed_id ); + self::feed_enable_status_maintenance( $feed_id ); return true; } @@ -166,37 +158,19 @@ private static function register_feed() { * Disable all other feed configurations for the merchant. * * @since 1.2.13 - * @param string $merchant_id Merchant ID. + * * @param string $feed_id Feed ID. + * * @return void */ - private static function feed_enable_status_maintenance( $merchant_id, $feed_id ) { + private static function feed_enable_status_maintenance( $feed_id ) { // Check if the feed is enabled. If not, enable it. - if ( ! Feeds::is_local_feed_enabled( $merchant_id, $feed_id ) ) { + if ( ! Feeds::is_local_feed_enabled( $feed_id ) ) { Feeds::enabled_feed( $feed_id ); } // Cleanup feeds that are registered but not in the local feed configurations. - self::maybe_disable_stale_feeds_for_merchant( $merchant_id, $feed_id ); - } - - /** - * Check if the merchant is approved. - * This is a helper function for the register_feed method. - * - * @return mixed False if the merchant is not approved, merchant id otherwise. - */ - private static function check_merchant_approval_status() { - - $merchant = Merchants::get_merchant(); - - if ( ! empty( $merchant['data']->id ) && 'declined' === $merchant['data']->product_pin_approval_status ) { - - self::log( 'Pinterest returned a Declined status for product_pin_approval_status' ); - return false; - } - - return $merchant['data']->id; + self::maybe_disable_stale_feeds_for_merchant( $feed_id ); } /** @@ -205,13 +179,12 @@ private static function check_merchant_approval_status() { * * @since 1.2.13 * - * @param string $merchant_id Merchant ID. * @param string $feed_id Feed ID. * * @return void */ - public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $feed_id ) { - $feeds = Feeds::get_ad_account_feeds(); + public static function maybe_disable_stale_feeds_for_merchant( $feed_id ) { + $feeds = Feeds::get_feeds(); if ( empty( $feeds ) ) { return; @@ -257,7 +230,7 @@ public static function maybe_disable_stale_feeds_for_merchant( $merchant_id, $fe } if ( $invalidate_cache ) { - Feeds::invalidate_get_ad_account_feeds_cache(); + Feeds::invalidate_feeds_cache(); } } diff --git a/src/Feeds.php b/src/Feeds.php index a1ff70087..ab7722bef 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -13,9 +13,9 @@ } use Automattic\WooCommerce\Pinterest\API\APIV5; -use \Exception; use Automattic\WooCommerce\Pinterest\API\Base; use Automattic\WooCommerce\Pinterest\Exception\PinterestApiLocaleException; +use Exception; use Throwable; /** @@ -27,6 +27,78 @@ class Feeds { const FEED_STATUS_INACTIVE = 'INACTIVE'; + /** + * Create a new feed for the given ad account. + * + * @since x.x.x + * + * @return string The Feed ID or an empty string if failed. + * @throws Exception PHP Exception if there is an error creating the feed, and we are throttling the requests. + */ + public static function create_feed(): string { + $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); + $configs = LocalFeedConfigs::get_instance()->get_configurations(); + $config = reset( $configs ); + + /** + * Filters the default merchant name: pinterest_for_woocommerce_default_merchant_name. + * This vale appears in the feed configuration page in Pinterest. + * + * @param string $feed_name The default feed name. + */ + $feed_name = apply_filters( + 'pinterest_for_woocommerce_default_merchant_name', + esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) + ); + + $data = array( + 'name' => $feed_name, + 'format' => 'XML', + 'location' => $config['feed_url'], + 'catalog_type' => 'RETAIL', + 'default_currency' => get_woocommerce_currency(), + 'default_locale' => LocaleMapper::get_locale_for_api(), + 'default_country' => Pinterest_For_Woocommerce()::get_base_country() ?? 'US', + 'default_availability' => 'IN_STOCK', + ); + + $cache_key = PINTEREST_FOR_WOOCOMMERCE_PREFIX . '_request_' . md5( wp_json_encode( $data ) ); + $cache = get_transient( $cache_key ); + + if ( false !== $cache ) { + throw new Exception( + __( 'There was a previous error trying to create a feed.', 'pinterest-for-woocommerce' ), + (int) $cache + ); + } + + try { + $feed = APIV5::create_feed( $data, $ad_account_id ); + } catch ( Throwable $th ) { + $delay = Pinterest_For_Woocommerce()::get_data( 'create_feed_delay' ) ?? MINUTE_IN_SECONDS; + set_transient( $cache_key, $th->getCode(), $delay ); + // Double the delay. + Pinterest_For_Woocommerce()::save_data( + 'create_feed_delay', + min( $delay * 2, 6 * HOUR_IN_SECONDS ) + ); + throw new Exception( $th->getMessage(), $th->getCode() ); + } + + static::invalidate_feeds_cache(); + + try { + $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds( array( $feed ) ); + } catch ( Throwable $th ) { + $feed_id = ''; + } + + // Clean the cached delay. + Pinterest_For_Woocommerce()::save_data( 'create_feed_delay', false ); + + return $feed_id; + } + /** * Get a specific merchant feed using the given arguments. * @@ -36,10 +108,10 @@ class Feeds { * * @throws Exception PHP Exception. */ - public static function get_ad_account_feed( $feed_id ) { + public static function get_feed( $feed_id ) { try { $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); - $feeds = APIV5::get_ad_account_feeds( $ad_account_id ); + $feeds = APIV5::get_feeds( $ad_account_id ); foreach ( $feeds['items'] as $feed ) { // Get the feed with the requested id if exists. if ( $feed_id === $feed['id'] ) { @@ -60,14 +132,14 @@ public static function get_ad_account_feed( $feed_id ) { * * @return array The feed profile objects. * - * @throws Exception PHP Exception. + * @throws PinterestApiException Pinterest API Exception. */ - public static function get_ad_account_feeds() { + public static function get_feeds(): array { try { $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); - $feeds = APIV5::get_ad_account_feeds( $ad_account_id ); + $feeds = APIV5::get_feeds( $ad_account_id ); return $feeds['items'] ?? []; - } catch ( Exception $e ) { + } catch ( PinterestApiException $e ) { Logger::log( $e->getMessage(), 'error' ); throw $e; } @@ -80,37 +152,39 @@ public static function get_ad_account_feeds() { * * @return void */ - public static function invalidate_get_ad_account_feeds_cache() { + public static function invalidate_feeds_cache() { $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); - APIV5::invalidate_ad_account_feeds_cache( $ad_account_id ); + APIV5::invalidate_feeds_cache( $ad_account_id ); } /** * Verify if the local feed is already registered to the merchant. * Return its ID if it is. * - * @param string $merchant_id The merchant ID. + * @param array $feeds The list of feeds to check against. If not set, the list will be fetched from the API. * - * @throws PinterestApiLocaleException No valid locale found to check for the registered feed. * @return string Returns the ID of the feed if properly registered or an empty string otherwise. + * @throws PinterestApiException Pinterest API Exception. + * @throws PinterestApiLocaleException No valid locale found to check for the registered feed. */ - public static function match_local_feed_configuration_to_registered_feeds( $merchant_id ) { + public static function match_local_feed_configuration_to_registered_feeds( array $feeds = array() ): string { $configs = LocalFeedConfigs::get_instance()->get_configurations(); $config = reset( $configs ); $local_path = $config['feed_url']; $local_country = Pinterest_For_Woocommerce()::get_base_country() ?? 'US'; $local_locale = LocaleMapper::get_locale_for_api(); - $feeds = self::get_ad_account_feeds(); + + if ( empty( $feeds ) ) { + $feeds = self::get_feeds(); + } foreach ( $feeds as $feed ) { - $configured_path = $feed->location_config->full_feed_fetch_location; - if ( - $configured_path === $local_path && - $local_country === $feed->country && - $local_locale === $feed->locale - ) { + $does_match = $local_path === $feed['location']; + $does_match = $does_match && $local_country === $feed['default_country']; + $does_match = $does_match && $local_locale === $feed['default_locale']; + if ( $does_match ) { // We can assume we're on the same site. - return $feed->id; + return $feed['id']; } } @@ -122,13 +196,12 @@ public static function match_local_feed_configuration_to_registered_feeds( $merc * * @since 1.2.13 * - * @param string $merchant_id The merchant ID. * @param string $feed_profile_id The ID of the feed. * * @return bool True if the feed is active, false otherwise. */ - public static function is_local_feed_enabled( $merchant_id, $feed_profile_id ) { - $feed = self::get_ad_account_feed( $feed_profile_id ); + public static function is_local_feed_enabled( $feed_profile_id ) { + $feed = self::get_feed( $feed_profile_id ); return 'ACTIVE' === $feed->feed_status; } @@ -144,9 +217,9 @@ public static function is_local_feed_enabled( $merchant_id, $feed_profile_id ) { public static function enabled_feed( $feed_id ) { try { $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); - APIV5::enable_merchant_feed( $ad_account_id, $feed_id ); + APIV5::enable_feed( $ad_account_id, $feed_id ); // We don't need to check the status, lets just invalidate the cache for extra safety. - self::invalidate_get_ad_account_feeds_cache(); + self::invalidate_feeds_cache(); return true; } catch ( Throwable $th ) { Logger::log( $th->getMessage(), 'error' ); @@ -166,7 +239,7 @@ public static function enabled_feed( $feed_id ) { public static function disable_feed( $feed_id ) { try { $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); - APIV5::disable_merchant_feed( $ad_account_id, $feed_id ); + APIV5::disable_feed( $ad_account_id, $feed_id ); return true; } catch ( Throwable $th ) { Logger::log( $th->getMessage(), 'error' ); @@ -206,16 +279,18 @@ function ( $a, $b ) { } /** - * Get the latest Workflow of the active feed related to the last attempt to process and ingest our feed. + * Get the latest report of the active feed related to the last attempt to process and ingest our feed. * * @param string $feed_id Pinterest feed ID. - * @param string $ad_account_id Pinterest ad account ID. - * @param string $bookmark Bookmark to fetch results from. - * @param int $per_page Number of results to fetch per page. + * @param string $ad_account_id Pinterest Ad Account ID. * - * @return void + * @return array The feed ingestion and processing report or null. */ - public static function get_feed_processing_results( $feed_id, $ad_account_id, $bookmark = '', $per_page = 25 ) { - + public static function get_feed_processing_results( $feed_id, $ad_account_id ): array { + $feed_report = APIV5::get_feed_processing_results( $feed_id, $ad_account_id ); + if ( empty( $feed_report ) ) { + return array(); + } + return $feed_report; } } diff --git a/src/LocaleMapper.php b/src/LocaleMapper.php index 74cc71439..838ce9758 100644 --- a/src/LocaleMapper.php +++ b/src/LocaleMapper.php @@ -85,7 +85,7 @@ class LocaleMapper { * @return string * @throws PinterestApiLocaleException If no matching locale code is found. */ - public static function get_locale_for_api() { + public static function get_locale_for_api(): string { $locale = self::get_wordpress_locale(); // If the locale is in the list of Pinterest locales, return it. @@ -102,7 +102,12 @@ public static function get_locale_for_api() { // If no match was found, throw an exception. // translators: %s is the locale code. - throw new PinterestApiLocaleException( sprintf( __( 'No matching Pinterest API locale found for %s', 'pinterest-for-woocommerce' ), $locale ) ); + throw new PinterestApiLocaleException( + sprintf( + __( 'No matching Pinterest API locale found for %s', 'pinterest-for-woocommerce' ), + $locale + ) + ); } /** diff --git a/src/Merchants.php b/src/Merchants.php deleted file mode 100644 index 6e581b521..000000000 --- a/src/Merchants.php +++ /dev/null @@ -1,197 +0,0 @@ -getCode() ) { - throw $th; - } - - $merchant = false; - } - } - - if ( ! empty( $merchant_id ) ) { - - // Get merchant if a merchant id was found. - try { - $merchant = Base::get_merchant( $merchant_id ); - } catch ( Throwable $th ) { - $merchant = false; - } - } - - if ( ! $merchant || ( 'success' !== $merchant['status'] && 650 === $merchant['code'] ) ) { // https://developers.pinterest.com/docs/redoc/#tag/API-Response-Codes Merchant not found 650. - // Try creating one. - $response = self::update_or_create_merchant(); - - if ( ! $response['merchant_id'] ) { - throw new Exception( __( 'Wrong response when trying to create or update merchant.', 'pinterest-for-woocommerce' ), 400 ); - } - - $merchant_id = $response['merchant_id']; - - try { - $merchant = Base::get_merchant( $merchant_id ); - } catch ( Throwable $th ) { - throw new Exception( __( 'There was an error trying to get the merchant object.', 'pinterest-for-woocommerce' ), 400 ); - } - } - - if ( ! $merchant || 'success' !== $merchant['status'] || ! $merchant['data'] ) { - throw new Exception( __( 'Response error when trying to create a merchant or update the existing one.', 'pinterest-for-woocommerce' ), 400 ); - } - - // Update merchant id if it is different from the stored in DB. - if ( $saved_merchant_id !== $merchant['data']->id ) { - Pinterest_For_Woocommerce()::save_data( 'merchant_id', $merchant['data']->id ); - } - - return $merchant; - } - - - /** - * Gets the merchant ID of the authenticated user from the data returned on the Advertisers endpoint. - * - * @return string - * - * @throws Exception PHP exception. - */ - private static function get_merchant_id_from_advertiser() { - $advertisers = Base::get_advertisers(); - - if ( 'success' !== $advertisers['status'] ) { - throw new Exception( __( 'Response error when trying to get advertisers.', 'pinterest-for-woocommerce' ), 400 ); - } - - $advertiser = reset( $advertisers['data'] ); // All advertisers assigned to a user share the same merchant_id. - - if ( empty( $advertiser->merchant_id ) ) { - throw new Exception( __( "No merchant returned in the advertiser's response.", 'pinterest-for-woocommerce' ), 404 ); - } - - return $advertiser->merchant_id; - } - - - /** - * Creates a merchant for the authenticated user or updates the existing one. - * Returns an array with the merchant_id and the registered feed_id. - * - * @return array - * - * @throws Exception PHP Exception. - */ - public static function update_or_create_merchant() { - - $configs = LocalFeedConfigs::get_instance()->get_configurations(); - $config = reset( $configs ); - - /** - * Filters the default merchant name: pinterest_for_woocommerce_default_merchant_name. This vale appears in the - * feed configuration page in Pinterest. - * - * @param string $merchant_name The default merchant name. - */ - $merchant_name = apply_filters( 'pinterest_for_woocommerce_default_merchant_name', esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) ); - - $args = array( - 'merchant_domains' => get_home_url(), - 'feed_location' => $config['feed_url'], - 'feed_format' => 'XML', - 'country' => Pinterest_For_Woocommerce()::get_base_country() ?? 'US', - 'locale' => LocaleMapper::get_locale_for_api(), - 'currency' => get_woocommerce_currency(), - 'merchant_name' => $merchant_name, - ); - - $cache_key = PINTEREST_FOR_WOOCOMMERCE_PREFIX . '_request_' . md5( wp_json_encode( $args ) ); - $cache = get_transient( $cache_key ); - - if ( false !== $cache ) { - throw new Exception( __( 'There was a previous error trying to create or update merchant.', 'pinterest-for-woocommerce' ), (int) $cache ); - } - - try { - $response = Base::update_or_create_merchant( $args ); - } catch ( Throwable $th ) { - $delay = Pinterest_For_Woocommerce()::get_data( 'create_merchant_delay' ) ?? MINUTE_IN_SECONDS; - - set_transient( $cache_key, $th->getCode(), $delay ); - - // Double the delay. - Pinterest_For_Woocommerce()::save_data( 'create_merchant_delay', min( $delay * 2, 6 * HOUR_IN_SECONDS ) ); - - throw new Exception( $th->getMessage(), $th->getCode() ); - } - - if ( 'success' !== $response['status'] ) { - throw new Exception( __( 'Response error when trying to create a merchant or update the existing one.', 'pinterest-for-woocommerce' ), 400 ); - } - - $merchant_id = $response['data']; - - Feeds::invalidate_get_ad_account_feeds_cache(); - - try { - $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds( $response['data'] ); - } catch ( Throwable $th ) { - $feed_id = ''; - } - - // Clean the cached delay. - Pinterest_For_Woocommerce()::save_data( 'create_merchant_delay', false ); - - // Update the registered feed id setting. - Pinterest_For_Woocommerce()::save_data( 'feed_registered', $feed_id ); - - return array( - 'merchant_id' => $merchant_id, - 'feed_id' => $feed_id, - ); - } - -} From 764e7bb9bf856e588bb95279003431a92a02a8eb Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:24:51 +0200 Subject: [PATCH 53/65] Integrating use of renamed APIs. --- src/API/FeedState.php | 2 +- src/FeedStatusService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/API/FeedState.php b/src/API/FeedState.php index 9568842c1..7dbba2624 100644 --- a/src/API/FeedState.php +++ b/src/API/FeedState.php @@ -243,7 +243,7 @@ public function add_feed_registration_state( $result ) { $merchant_id = Pinterest_For_Woocommerce()::get_data( 'merchant_id' ); $feed_id = FeedRegistration::get_locally_stored_registered_feed_id(); - $feed = Pinterest\Feeds::get_ad_account_feed( $feed_id ); + $feed = Pinterest\Feeds::get_feed( $feed_id ); if ( ! empty( $feed->location_config->full_feed_fetch_freq ) ) { $extra_info = wp_kses_post( sprintf( diff --git a/src/FeedStatusService.php b/src/FeedStatusService.php index 533349fa9..bf141691c 100644 --- a/src/FeedStatusService.php +++ b/src/FeedStatusService.php @@ -82,7 +82,7 @@ public static function get_feed_registration_status(): string { } try { - $feed = Feeds::get_ad_account_feed( $feed_id ); + $feed = Feeds::get_feed( $feed_id ); } catch ( Exception $e ) { throw new Exception( 'error_fetching_feed' ); } From 1365367271c2883cf3137f0a78b499d14708e8c6 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Mon, 27 Nov 2023 22:47:04 +0200 Subject: [PATCH 54/65] Fixing bugs with wrong API endpoint URLs. Adjusting method comments. Adjusting create feed endpoint to provide a unique feed name. Reverting back some Base API method names. --- src/API/APIV5.php | 35 ++++++++++++++++-------------- src/API/Base.php | 13 +++++++----- src/FeedRegistration.php | 46 +++++++++++----------------------------- src/Feeds.php | 21 ++++++++++++------ 4 files changed, 53 insertions(+), 62 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index edd8caea0..eb6ddd97a 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -79,17 +79,18 @@ public static function get_account_info() { * @since x.x.x * * @return array { - * Ad Accounts countries + * Ad Accounts countries * - * @type array[] $items { - * @type string $code Country ID from ISO 3166-1 alpha-2. - * @type string $currency Country currency. - * @type int $index Country index - * @type string $name Country name. - * } + * @type array[] $items { + * @type string $code Country ID from ISO 3166-1 alpha-2. + * @type string $currency Country currency. + * @type int $index Country index + * @type string $name Country name. + * } * } + * @throws PinterestApiException */ - public static function get_list_of_ads_supported_countries() { + public static function get_list_of_ads_supported_countries(): array { $request_url = 'resources/ad_account_countries'; return self::make_request( $request_url, 'GET', array(), '', 2 * DAY_IN_SECONDS ); } @@ -334,7 +335,7 @@ public static function domain_metatag_verification_request( string $domain ): ar * * @link https://developers.pinterest.com/docs/api/v5/#operation/feeds/create * - * @param array $data { + * @param array $data { * Feed data. * * @type string $name A human-friendly name associated to a given feed. This value is currently nullable due to historical reasons. It is expected to become non-nullable in the future. @@ -362,9 +363,9 @@ public static function domain_metatag_verification_request( string $domain ): ar * * @return array * - * @throws PinterestApiException + * @throws PinterestApiException If the request fails with other than 2xx status. */ - public static function create_feed( $data, $ad_account_id ): array { + public static function create_feed( array $data, string $ad_account_id ): array { return self::make_request( "catalogs/feeds?ad_account_id={$ad_account_id}", 'POST', @@ -412,7 +413,7 @@ public static function create_feed( $data, $ad_account_id ): array { * } * @throws PinterestApiException If the request fails with 500 status. */ - public static function get_feeds($ad_account_id ) { + public static function get_feeds( string $ad_account_id ): array { return self::make_request( "catalogs/feeds?ad_account_id={$ad_account_id}", 'GET', @@ -449,8 +450,9 @@ public static function invalidate_feeds_cache( string $ad_account_id ): bool { * @param string $feed_id The ID of the feed to be enabled. * * @return mixed + * @throws PinterestApiException If API request ends up other than 2xx status. */ - public static function enable_feed($ad_account_id, $feed_id ) { + public static function enable_feed( string $ad_account_id, string $feed_id ): array { return static::update_feed_status( $feed_id, Feeds::FEED_STATUS_ACTIVE, $ad_account_id ); } @@ -463,8 +465,9 @@ public static function enable_feed($ad_account_id, $feed_id ) { * @param string $feed_id The ID of the feed to be disabled. * * @return mixed + * @throws PinterestApiException If API request ends up other than 2xx status. */ - public static function disable_feed($ad_account_id, $feed_id ) { + public static function disable_feed( string $ad_account_id, string $feed_id ): array { return static::update_feed_status( $feed_id, Feeds::FEED_STATUS_INACTIVE, $ad_account_id ); } @@ -480,9 +483,9 @@ public static function disable_feed($ad_account_id, $feed_id ) { * @return array * @throws PinterestApiException If API request ends up other than 2xx status. */ - private static function update_feed_status( $feed_id, $status, $ad_account_id ) { + private static function update_feed_status( string $feed_id, string $status, string $ad_account_id ): array { return self::make_request( - "catalog/feeds/{$feed_id}?ad_account_id={$ad_account_id}", + "catalogs/feeds/{$feed_id}?ad_account_id={$ad_account_id}", 'PATCH', array( 'status' => $status, diff --git a/src/API/Base.php b/src/API/Base.php index 0fb37f7c2..273229f22 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -655,12 +655,13 @@ public static function update_merchant_feed( $merchant_id, $feed_id, $args ) { * * @since 1.2.13 * - * @param string $merchant_id The merchant ID the feed belongs to. + * @param string $merchant_id The merchant ID the feed belongs to. * @param string $feed_profile_id The ID of the feed to be disabled. * * @return mixed + * @throws PinterestApiException */ - public static function disable_feed($merchant_id, $feed_profile_id ) { + public static function disable_merchant_feed( $merchant_id, $feed_profile_id ): array { return self::make_request( "catalogs/disable_feed_profile/{$merchant_id}/{$feed_profile_id}/" ); @@ -671,12 +672,13 @@ public static function disable_feed($merchant_id, $feed_profile_id ) { * * @since 1.2.13 * - * @param string $merchant_id The merchant ID the feed belongs to. + * @param string $merchant_id The merchant ID the feed belongs to. * @param string $feed_profile_id The ID of the feed to be enabled. * * @return mixed + * @throws PinterestApiException */ - public static function enable_feed($merchant_id, $feed_profile_id ) { + public static function enable_merchant_feed( $merchant_id, $feed_profile_id ): array { return self::make_request( "catalogs/enable_feed_profile/{$merchant_id}/{$feed_profile_id}/" ); @@ -735,9 +737,10 @@ public static function invalidate_merchant_feeds_cache( $merchant_id, $include_d * Get a specific merchant's feed report using the given arguments. * * @param string $merchant_id The merchant ID the feed belongs to. - * @param string $feed_id The ID of the feed. + * @param string $feed_id The ID of the feed. * * @return mixed + * @throws PinterestApiException */ public static function get_merchant_feed_report( $merchant_id, $feed_id ) { return self::make_request( diff --git a/src/FeedRegistration.php b/src/FeedRegistration.php index ae0997e4f..b68cf87d0 100644 --- a/src/FeedRegistration.php +++ b/src/FeedRegistration.php @@ -73,17 +73,17 @@ public function init() { * Should be run on demand when settings change, * and on a scheduled basis. * - * @return mixed + * @return bool * * @throws Exception PHP Exception. */ - public function handle_feed_registration() { + public function handle_feed_registration(): bool { // Clean merchants error code. $this->clear_merchant_error_code(); if ( ! self::feed_file_exists() ) { - self::log( 'Feed didn\'t fully generate yet. Retrying later.', 'debug' ); + self::log( 'Feed did not fully generate yet. Retrying later.' ); // Feed is not generated yet, lets wait a bit longer. return true; } @@ -101,7 +101,7 @@ public function handle_feed_registration() { // translators: %s: Error message. $error_message = "Could not register feed. Error: {$e->getMessage()}"; self::log( $error_message, 'error' ); - + return false; } catch ( Throwable $th ) { if ( method_exists( $th, 'get_pinterest_code' ) && 4163 === $th->get_pinterest_code() ) { Pinterest_For_Woocommerce()::save_data( 'merchant_connected_diff_platform', true ); @@ -127,14 +127,14 @@ private function clear_merchant_error_code() { /** * Handles feed registration using the given arguments. * Will try to create a merchant if none exists. - * Also if a different feed is registered, it will update using the URL in the + * Also, if a different feed is registered, it will update using the URL in the * $feed_args. * * @return boolean * * @throws Exception PHP Exception. */ - private static function register_feed() { + private static function register_feed(): bool { $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds(); // If no matching registered feed found try to create it. @@ -162,6 +162,7 @@ private static function register_feed() { * @param string $feed_id Feed ID. * * @return void + * @throws Exception PHP Exception. */ private static function feed_enable_status_maintenance( $feed_id ) { // Check if the feed is enabled. If not, enable it. @@ -182,6 +183,7 @@ private static function feed_enable_status_maintenance( $feed_id ) { * @param string $feed_id Feed ID. * * @return void + * @throws Exception PHP Exception. */ public static function maybe_disable_stale_feeds_for_merchant( $feed_id ) { $feeds = Feeds::get_feeds(); @@ -190,11 +192,6 @@ public static function maybe_disable_stale_feeds_for_merchant( $feed_id ) { return; } - $configs = LocalFeedConfigs::get_instance()->get_configurations(); - $config = reset( $configs ); - // Make sure this $local_path has a domain name. - $local_path = $config['feed_url']; - $invalidate_cache = false; foreach ( $feeds as $feed ) { @@ -203,27 +200,8 @@ public static function maybe_disable_stale_feeds_for_merchant( $feed_id ) { continue; } - // Only disable feeds that are registered as WooCommerce integration. - /* - if ( 'WOOCOMMERCE' !== $feed->integration_platform_type ) { - continue; - } - */ - - /** - * Disable feeds only if their file URL matches, using the directory path for accurate identification. This - * method prevents the disabling of non-WooCommerce feeds that share the same merchant registration. - * Simultaneously, disable feeds registered for WooCommerce from the same host with different file names, - * ending with a suffix generated by the wp_generate_password function, as outlined in the LocalFeedConfigs - * class. Utilizing dirname eliminates the file name and suffix, leaving only the directory path for - * comparison. - */ - if ( dirname( $feed['location'] ) !== $local_path ) { - continue; - } - // Disable the feed if it is active. - if ( 'ACTIVE' === $feed['status'] ) { + if ( Feeds::FEED_STATUS_ACTIVE === $feed['status'] ) { Feeds::disable_feed( $feed['id'] ); $invalidate_cache = true; } @@ -236,12 +214,12 @@ public static function maybe_disable_stale_feeds_for_merchant( $feed_id ) { /** * Checks if the feed file for the configured (In $state var) feed exists. - * This could be true as the feed is being generated, if its not the 1st time - * its been generated. + * This could be true as the feed is being generated, if it's not the 1st time + * it's been generated. * * @return bool */ - public function feed_file_exists() { + public function feed_file_exists(): bool { return $this->feed_file_operations->check_if_feed_file_exists(); } diff --git a/src/Feeds.php b/src/Feeds.php index ab7722bef..a0aa906bf 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -40,15 +40,22 @@ public static function create_feed(): string { $configs = LocalFeedConfigs::get_instance()->get_configurations(); $config = reset( $configs ); + + $default_country = Pinterest_For_Woocommerce()::get_base_country() ?? 'US'; + $default_currency = get_woocommerce_currency(); + /** - * Filters the default merchant name: pinterest_for_woocommerce_default_merchant_name. - * This vale appears in the feed configuration page in Pinterest. + * Filters the default feed name: pinterest_for_woocommerce_unique_feed_name. + * This vale appears in the Catalogues - Data sources page at Pinterest. * * @param string $feed_name The default feed name. */ $feed_name = apply_filters( - 'pinterest_for_woocommerce_default_merchant_name', - esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) + 'pinterest_for_woocommerce_unique_feed_name', + esc_html__( + "Created by Pinterest for WooCommerce {$default_country}-{$default_currency}.", + 'pinterest-for-woocommerce' + ) ); $data = array( @@ -56,9 +63,9 @@ public static function create_feed(): string { 'format' => 'XML', 'location' => $config['feed_url'], 'catalog_type' => 'RETAIL', - 'default_currency' => get_woocommerce_currency(), + 'default_currency' => $default_currency, 'default_locale' => LocaleMapper::get_locale_for_api(), - 'default_country' => Pinterest_For_Woocommerce()::get_base_country() ?? 'US', + 'default_country' => $default_country, 'default_availability' => 'IN_STOCK', ); @@ -141,7 +148,7 @@ public static function get_feeds(): array { return $feeds['items'] ?? []; } catch ( PinterestApiException $e ) { Logger::log( $e->getMessage(), 'error' ); - throw $e; + return []; } } From 06dd8dfe76ec0d15608d953d62c88a48999a4270 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 20:31:19 +0200 Subject: [PATCH 55/65] Adding feed location check to make sure this is a feed originated from the current website --- src/FeedRegistration.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FeedRegistration.php b/src/FeedRegistration.php index b68cf87d0..fd035d6e8 100644 --- a/src/FeedRegistration.php +++ b/src/FeedRegistration.php @@ -200,8 +200,10 @@ public static function maybe_disable_stale_feeds_for_merchant( $feed_id ) { continue; } - // Disable the feed if it is active. - if ( Feeds::FEED_STATUS_ACTIVE === $feed['status'] ) { + // Disable the feed if it is active and originated from the current website. + $is_active_feed = Feeds::FEED_STATUS_ACTIVE === $feed['status']; + $is_woocommerce_feed = 0 === strpos( $feed['location'], get_site_url() ); + if ( $is_active_feed && $is_woocommerce_feed ) { Feeds::disable_feed( $feed['id'] ); $invalidate_cache = true; } From 50186d8c70913978f6a37171897abe6156b31b06 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:17:28 +0200 Subject: [PATCH 56/65] Fixing phpcs errors when running PR checks. --- src/API/APIV5.php | 8 ++++---- src/API/Base.php | 6 +++--- src/Feeds.php | 5 ++--- src/LocaleMapper.php | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/API/APIV5.php b/src/API/APIV5.php index eb6ddd97a..8bce0a398 100644 --- a/src/API/APIV5.php +++ b/src/API/APIV5.php @@ -88,7 +88,7 @@ public static function get_account_info() { * @type string $name Country name. * } * } - * @throws PinterestApiException + * @throws PinterestApiException If API request ends up other than 2xx status. */ public static function get_list_of_ads_supported_countries(): array { $request_url = 'resources/ad_account_countries'; @@ -315,7 +315,7 @@ public static function domain_verification_data(): array { * @type string $status Status of the verification process. * @type string $verified_at UTC timestamp when the verification happened - sometimes missing. * } - * @throws PinterestApiException If the request fails with 500 status. + * @throws PinterestApiException If the request fails with 2xx status. */ public static function domain_metatag_verification_request( string $domain ): array { return self::make_request( @@ -411,7 +411,7 @@ public static function create_feed( array $data, string $ad_account_id ): array * } * @type string $bookmark Cursor used to fetch the next page of items * } - * @throws PinterestApiException If the request fails with 500 status. + * @throws PinterestApiException If the request fails with 2xx status. */ public static function get_feeds( string $ad_account_id ): array { return self::make_request( @@ -535,7 +535,7 @@ private static function update_feed_status( string $feed_id, string $status, str * } * @type string $bookmark Cursor used to fetch the next page of items * } - * @throws PinterestApiException + * @throws PinterestApiException If the request fails with other than 2xx status. */ public static function get_feed_processing_results( $feed_id, $ad_account_id ): array { return self::make_request( diff --git a/src/API/Base.php b/src/API/Base.php index 273229f22..998f75141 100644 --- a/src/API/Base.php +++ b/src/API/Base.php @@ -659,7 +659,7 @@ public static function update_merchant_feed( $merchant_id, $feed_id, $args ) { * @param string $feed_profile_id The ID of the feed to be disabled. * * @return mixed - * @throws PinterestApiException + * @throws PinterestApiException If the API request fails with other than 2xx status code. */ public static function disable_merchant_feed( $merchant_id, $feed_profile_id ): array { return self::make_request( @@ -676,7 +676,7 @@ public static function disable_merchant_feed( $merchant_id, $feed_profile_id ): * @param string $feed_profile_id The ID of the feed to be enabled. * * @return mixed - * @throws PinterestApiException + * @throws PinterestApiException If the API request fails with other than 2xx status code. */ public static function enable_merchant_feed( $merchant_id, $feed_profile_id ): array { return self::make_request( @@ -740,7 +740,7 @@ public static function invalidate_merchant_feeds_cache( $merchant_id, $include_d * @param string $feed_id The ID of the feed. * * @return mixed - * @throws PinterestApiException + * @throws PinterestApiException If the API request fails with other than 2xx status code. */ public static function get_merchant_feed_report( $merchant_id, $feed_id ) { return self::make_request( diff --git a/src/Feeds.php b/src/Feeds.php index a0aa906bf..37c67e2ee 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -40,7 +40,6 @@ public static function create_feed(): string { $configs = LocalFeedConfigs::get_instance()->get_configurations(); $config = reset( $configs ); - $default_country = Pinterest_For_Woocommerce()::get_base_country() ?? 'US'; $default_currency = get_woocommerce_currency(); @@ -53,7 +52,7 @@ public static function create_feed(): string { $feed_name = apply_filters( 'pinterest_for_woocommerce_unique_feed_name', esc_html__( - "Created by Pinterest for WooCommerce {$default_country}-{$default_currency}.", + sprintf( 'Created by Pinterest for WooCommerce %s-%s', $default_country, $default_currency ), 'pinterest-for-woocommerce' ) ); @@ -95,7 +94,7 @@ public static function create_feed(): string { static::invalidate_feeds_cache(); try { - $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds( array( $feed ) ); + $feed_id = static::match_local_feed_configuration_to_registered_feeds( array( $feed ) ); } catch ( Throwable $th ) { $feed_id = ''; } diff --git a/src/LocaleMapper.php b/src/LocaleMapper.php index 838ce9758..95597c94b 100644 --- a/src/LocaleMapper.php +++ b/src/LocaleMapper.php @@ -101,9 +101,9 @@ public static function get_locale_for_api(): string { } // If no match was found, throw an exception. - // translators: %s is the locale code. throw new PinterestApiLocaleException( sprintf( + // translators: %s is the locale code. __( 'No matching Pinterest API locale found for %s', 'pinterest-for-woocommerce' ), $locale ) From 8f8877375ab0aa0ecd8951d914751d846e5bd4a9 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:24:21 +0200 Subject: [PATCH 57/65] Fixing phpcs errors when running PR checks. --- src/Feeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Feeds.php b/src/Feeds.php index 37c67e2ee..fcd356951 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -52,7 +52,7 @@ public static function create_feed(): string { $feed_name = apply_filters( 'pinterest_for_woocommerce_unique_feed_name', esc_html__( - sprintf( 'Created by Pinterest for WooCommerce %s-%s', $default_country, $default_currency ), + 'Created by Pinterest for WooCommerce ' . $default_country . '-' . $default_currency, 'pinterest-for-woocommerce' ) ); From 22c6b36ea12d8c277a80639bf31c3ed22245f0c1 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:33:27 +0200 Subject: [PATCH 58/65] Fixing phpcs errors when running PR checks. --- src/Feeds.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Feeds.php b/src/Feeds.php index fcd356951..12813137d 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -51,9 +51,11 @@ public static function create_feed(): string { */ $feed_name = apply_filters( 'pinterest_for_woocommerce_unique_feed_name', - esc_html__( - 'Created by Pinterest for WooCommerce ' . $default_country . '-' . $default_currency, - 'pinterest-for-woocommerce' + sprintf( + // translators: %1$s is a country ISO 2 code, %2$s is a currency ISO 3 code. + esc_html__( 'Created by Pinterest for WooCommerce %1$s-%2$s', 'pinterest-for-woocommerce' ), + $default_country, + $default_currency ) ); From 52cf5b694b2a0a24936678abba904e21f9b7e22b Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:48:54 +0200 Subject: [PATCH 59/65] Adding php unit test github workflow file, same as we have on dev with renewed WP and PHP versions. --- .github/workflows/php-unit-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php-unit-tests.yml b/.github/workflows/php-unit-tests.yml index f7e5fd049..b19feabd0 100644 --- a/.github/workflows/php-unit-tests.yml +++ b/.github/workflows/php-unit-tests.yml @@ -30,8 +30,8 @@ jobs: WP_TESTS_DIR: "/tmp/wordpress/tests/phpunit" strategy: matrix: - php: [7.3, 7.4] - wp-version: [5.8, 5.9, latest] + php: [7.4, 8.0, 8.1, 8.2] + wp-version: [latest] steps: - name: Checkout repository From b3bd5669a897817b606c49ebf9895ae82054c4e3 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:01:17 +0200 Subject: [PATCH 60/65] Catching up with develop branch and updating the lock file. --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index fcec33014..6d97502df 100644 --- a/composer.lock +++ b/composer.lock @@ -3087,16 +3087,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -3125,7 +3125,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -3133,7 +3133,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" }, { "name": "woocommerce/woocommerce-sniffs", @@ -3358,16 +3358,16 @@ }, { "name": "wp-cli/wp-cli", - "version": "v2.8.1", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/wp-cli/wp-cli.git", - "reference": "5dd2340b9a01c3cfdbaf5e93a140759fdd190eee" + "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/5dd2340b9a01c3cfdbaf5e93a140759fdd190eee", - "reference": "5dd2340b9a01c3cfdbaf5e93a140759fdd190eee", + "url": "https://api.github.com/repos/wp-cli/wp-cli/zipball/8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", + "reference": "8a3befba2d947fbf5cc6d1941edf2dd99da4d4b7", "shasum": "" }, "require": { @@ -3384,7 +3384,7 @@ "wp-cli/entity-command": "^1.2 || ^2", "wp-cli/extension-command": "^1.1 || ^2", "wp-cli/package-command": "^1 || ^2", - "wp-cli/wp-cli-tests": "^3.1.6" + "wp-cli/wp-cli-tests": "^4.0.1" }, "suggest": { "ext-readline": "Include for a better --prompt implementation", @@ -3424,7 +3424,7 @@ "issues": "https://github.com/wp-cli/wp-cli/issues", "source": "https://github.com/wp-cli/wp-cli" }, - "time": "2023-06-05T06:55:55+00:00" + "time": "2023-10-25T09:06:37+00:00" }, { "name": "wp-coding-standards/wpcs", From a20e33a9dc92d228356655fbd6c3b027935bef1b Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:06:37 +0200 Subject: [PATCH 61/65] Fixing PHPCS errors after merging with develop. --- src/Feeds.php | 12 ++++++------ src/LocaleMapper.php | 4 ++-- uninstall.php | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Feeds.php b/src/Feeds.php index 12813137d..7f588fe0d 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -54,8 +54,8 @@ public static function create_feed(): string { sprintf( // translators: %1$s is a country ISO 2 code, %2$s is a currency ISO 3 code. esc_html__( 'Created by Pinterest for WooCommerce %1$s-%2$s', 'pinterest-for-woocommerce' ), - $default_country, - $default_currency + esc_html( $default_country ), + esc_html( $default_currency ) ) ); @@ -75,7 +75,7 @@ public static function create_feed(): string { if ( false !== $cache ) { throw new Exception( - __( 'There was a previous error trying to create a feed.', 'pinterest-for-woocommerce' ), + esc_html__( 'There was a previous error trying to create a feed.', 'pinterest-for-woocommerce' ), (int) $cache ); } @@ -90,7 +90,7 @@ public static function create_feed(): string { 'create_feed_delay', min( $delay * 2, 6 * HOUR_IN_SECONDS ) ); - throw new Exception( $th->getMessage(), $th->getCode() ); + throw new Exception( esc_html__( $th->getMessage() ), $th->getCode() ); } static::invalidate_feeds_cache(); @@ -146,10 +146,10 @@ public static function get_feeds(): array { try { $ad_account_id = Pinterest_For_WooCommerce()::get_setting( 'tracking_advertiser' ); $feeds = APIV5::get_feeds( $ad_account_id ); - return $feeds['items'] ?? []; + return $feeds['items'] ?? array(); } catch ( PinterestApiException $e ) { Logger::log( $e->getMessage(), 'error' ); - return []; + return array(); } } diff --git a/src/LocaleMapper.php b/src/LocaleMapper.php index 95597c94b..5046304a2 100644 --- a/src/LocaleMapper.php +++ b/src/LocaleMapper.php @@ -104,8 +104,8 @@ public static function get_locale_for_api(): string { throw new PinterestApiLocaleException( sprintf( // translators: %s is the locale code. - __( 'No matching Pinterest API locale found for %s', 'pinterest-for-woocommerce' ), - $locale + esc_html__( 'No matching Pinterest API locale found for %s', 'pinterest-for-woocommerce' ), + esc_html( $locale ) ) ); } diff --git a/uninstall.php b/uninstall.php index 20153da2d..2a9f61281 100644 --- a/uninstall.php +++ b/uninstall.php @@ -21,7 +21,7 @@ /** * Remove the feed configuration. */ - $data = get_option( 'pinterest_for_woocommerce_data', [] ); + $data = get_option( 'pinterest_for_woocommerce_data', array() ); $merchant_id = $data['merchant_id'] ?? ''; if ( $merchant_id ) { From 68d445ace0e0bed00ff4905ffc21cccbc57a78c7 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:09:36 +0200 Subject: [PATCH 62/65] Fixing PHPCS errors. --- src/Feeds.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Feeds.php b/src/Feeds.php index 7f588fe0d..3086152ed 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -47,6 +47,8 @@ public static function create_feed(): string { * Filters the default feed name: pinterest_for_woocommerce_unique_feed_name. * This vale appears in the Catalogues - Data sources page at Pinterest. * + * @since x.x.x + * * @param string $feed_name The default feed name. */ $feed_name = apply_filters( @@ -90,7 +92,7 @@ public static function create_feed(): string { 'create_feed_delay', min( $delay * 2, 6 * HOUR_IN_SECONDS ) ); - throw new Exception( esc_html__( $th->getMessage() ), $th->getCode() ); + throw new Exception( esc_html( $th->getMessage() ), $th->getCode() ); } static::invalidate_feeds_cache(); From 52996e62823fe74ea7d0dfb06ef6dbdae5cbee8d Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:34:19 +0200 Subject: [PATCH 63/65] Fix unit tests inheritance error. --- src/Feeds.php | 3 ++- tests/Unit/Tracking/TagTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Feeds.php b/src/Feeds.php index 3086152ed..49720a26f 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -92,7 +92,8 @@ public static function create_feed(): string { 'create_feed_delay', min( $delay * 2, 6 * HOUR_IN_SECONDS ) ); - throw new Exception( esc_html( $th->getMessage() ), $th->getCode() ); + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped + throw new Exception( $th->getMessage(), $th->getCode() ); } static::invalidate_feeds_cache(); diff --git a/tests/Unit/Tracking/TagTest.php b/tests/Unit/Tracking/TagTest.php index 54aaa5592..dd15cd156 100644 --- a/tests/Unit/Tracking/TagTest.php +++ b/tests/Unit/Tracking/TagTest.php @@ -6,7 +6,7 @@ class TagTest extends \WP_UnitTestCase { - function setUp() { + function setUp(): void { parent::setUp(); } From ff987fd0171c2ad22c12896dd0950e6304a927e4 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:42:56 +0200 Subject: [PATCH 64/65] Fix php cs errors --- src/API/TokenExchangeV3ToV5.php | 2 +- src/Feeds.php | 18 +++++++++--------- src/PluginUpdate.php | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/API/TokenExchangeV3ToV5.php b/src/API/TokenExchangeV3ToV5.php index a6fc8c4d0..d97d26263 100644 --- a/src/API/TokenExchangeV3ToV5.php +++ b/src/API/TokenExchangeV3ToV5.php @@ -56,7 +56,7 @@ public static function exchange_token() { public static function token_update() { $respone = self::exchange_token(); - if ( 'success' != $respone['status'] ) { + if ( 'success' !== $respone['status'] ) { return false; } diff --git a/src/Feeds.php b/src/Feeds.php index 49720a26f..16a168a7b 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -62,14 +62,14 @@ public static function create_feed(): string { ); $data = array( - 'name' => $feed_name, - 'format' => 'XML', - 'location' => $config['feed_url'], - 'catalog_type' => 'RETAIL', - 'default_currency' => $default_currency, - 'default_locale' => LocaleMapper::get_locale_for_api(), - 'default_country' => $default_country, - 'default_availability' => 'IN_STOCK', + 'name' => $feed_name, + 'format' => 'XML', + 'location' => $config['feed_url'], + 'catalog_type' => 'RETAIL', + 'default_currency' => $default_currency, + 'default_locale' => LocaleMapper::get_locale_for_api(), + 'default_country' => $default_country, + 'default_availability' => 'IN_STOCK', ); $cache_key = PINTEREST_FOR_WOOCOMMERCE_PREFIX . '_request_' . md5( wp_json_encode( $data ) ); @@ -298,7 +298,7 @@ function ( $a, $b ) { * @return array The feed ingestion and processing report or null. */ public static function get_feed_processing_results( $feed_id, $ad_account_id ): array { - $feed_report = APIV5::get_feed_processing_results( $feed_id, $ad_account_id ); + $feed_report = APIV5::get_feed_processing_results( $feed_id, $ad_account_id ); if ( empty( $feed_report ) ) { return array(); } diff --git a/src/PluginUpdate.php b/src/PluginUpdate.php index 0b2b901d3..b297192eb 100644 --- a/src/PluginUpdate.php +++ b/src/PluginUpdate.php @@ -115,7 +115,7 @@ private function update_procedures() { '1.2.5' => array( 'ads_credits_integration', ), - '1.4.0' => array( + '1.4.0' => array( 'token_update', ), ); From b3d4919b6de0713bbd10df9c898c89c6abdba6b2 Mon Sep 17 00:00:00 2001 From: Dima <9010963+message-dimke@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:52:38 +0200 Subject: [PATCH 65/65] Update phpcs rules to exclude a check for a specific @since version and to allow x.x.x versions. --- phpcs.xml | 6 +++++- src/Feeds.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 13b6bd5b8..a5580aa9e 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -23,7 +23,11 @@ - + + + + + src/* bin/* diff --git a/src/Feeds.php b/src/Feeds.php index 16a168a7b..f91c9f247 100644 --- a/src/Feeds.php +++ b/src/Feeds.php @@ -47,7 +47,7 @@ public static function create_feed(): string { * Filters the default feed name: pinterest_for_woocommerce_unique_feed_name. * This vale appears in the Catalogues - Data sources page at Pinterest. * - * @since x.x.x + * @since * * @param string $feed_name The default feed name. */