From f99733d92507b1689fc04d6f3cf979ebf8863d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 5 Apr 2023 14:28:56 +0200 Subject: [PATCH 001/243] Add missing text domain. --- src/Admin/AdminHealth.php | 12 ++++++------ views/meta-box-payment-update.php | 6 +++--- views/meta-box-subscription-update.php | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Admin/AdminHealth.php b/src/Admin/AdminHealth.php index ebe07e68..b728d285 100644 --- a/src/Admin/AdminHealth.php +++ b/src/Admin/AdminHealth.php @@ -169,37 +169,37 @@ private function get_active_gateway_integrations_debug() { public function status_tests( $status_tests ) { // Test valid license. $status_tests['direct']['pronamic_pay_valid_license'] = [ - 'label' => __( 'Pronamic Pay support license key test' ), + 'label' => __( 'Pronamic Pay support license key test', 'pronamic_ideal' ), 'test' => [ $this, 'test_valid_license' ], ]; // Test minimum required WordPress version. $status_tests['direct']['pronamic_pay_wordpress_version'] = [ - 'label' => __( 'Pronamic Pay WordPress version test' ), + 'label' => __( 'Pronamic Pay WordPress version test', 'pronamic_ideal' ), 'test' => [ $this, 'test_wordpress_version' ], ]; // Test memory limit. $status_tests['direct']['pronamic_pay_memory_limit'] = [ - 'label' => __( 'Pronamic Pay memory limit test' ), + 'label' => __( 'Pronamic Pay memory limit test', 'pronamic_ideal' ), 'test' => [ $this, 'test_memory_limit' ], ]; // Test character set. $status_tests['direct']['pronamic_pay_character_set'] = [ - 'label' => __( 'Pronamic Pay UTF-8 character set test' ), + 'label' => __( 'Pronamic Pay UTF-8 character set test', 'pronamic_ideal' ), 'test' => [ $this, 'test_character_set' ], ]; // Test hashing algorithms. $status_tests['direct']['pronamic_pay_hashing_algorithms'] = [ - 'label' => __( 'Pronamic Pay hashing algorithms test' ), + 'label' => __( 'Pronamic Pay hashing algorithms test', 'pronamic_ideal' ), 'test' => [ $this, 'test_hashing_algorithms' ], ]; // Test supported extensions. $status_tests['direct']['pronamic_pay_extensions_support'] = [ - 'label' => __( 'Pronamic Pay extensions support test' ), + 'label' => __( 'Pronamic Pay extensions support test', 'pronamic_ideal' ), 'test' => [ $this, 'test_extensions_support' ], ]; diff --git a/views/meta-box-payment-update.php b/views/meta-box-payment-update.php index 4ce3b258..08e2da2a 100644 --- a/views/meta-box-payment-update.php +++ b/views/meta-box-payment-update.php @@ -59,7 +59,7 @@
- + - - + +
diff --git a/views/meta-box-subscription-update.php b/views/meta-box-subscription-update.php index 77b126eb..6bf2773d 100644 --- a/views/meta-box-subscription-update.php +++ b/views/meta-box-subscription-update.php @@ -55,7 +55,7 @@
- + - - + +
get_status(), [ SubscriptionStatus::FAILURE, SubscriptionStatus::ON_HOLD ], true ) ) : ?> @@ -154,8 +154,8 @@ ?> - - + + Date: Thu, 6 Apr 2023 12:33:21 +0200 Subject: [PATCH 002/243] Fix loading bundled WordPress money translations. --- src/Plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin.php b/src/Plugin.php index 38f0f304..90e6110f 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -765,7 +765,7 @@ public static function load_plugin_textdomain() { \load_plugin_textdomain( 'pronamic_ideal', false, $rel_path . '/languages' ); - \load_plugin_textdomain( 'pronamic-money', false, $rel_path . '/vendor/pronamic/wp-money/languages' ); + \load_plugin_textdomain( 'pronamic-money', false, $rel_path . '/packages/pronamic/wp-money/languages' ); } /** From f68dec541d29981a48dde00734b18c22f5e03929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 3 May 2023 16:45:00 +0200 Subject: [PATCH 003/243] Remove legacy 'Tools' page. --- src/Admin/AdminModule.php | 12 -- views/page-tools.php | 66 ------- views/tab-extensions.php | 101 ---------- views/tab-gateways.php | 113 ------------ views/tab-system_status.php | 356 ------------------------------------ 5 files changed, 648 deletions(-) delete mode 100644 views/page-tools.php delete mode 100644 views/tab-extensions.php delete mode 100644 views/tab-gateways.php delete mode 100644 views/tab-system_status.php diff --git a/src/Admin/AdminModule.php b/src/Admin/AdminModule.php index ffb5966e..ec01d6f6 100644 --- a/src/Admin/AdminModule.php +++ b/src/Admin/AdminModule.php @@ -872,18 +872,6 @@ public function admin_menu() { }, ]; - if ( version_compare( get_bloginfo( 'version' ), '5.2', '<' ) ) { - $submenu_pages[] = [ - 'page_title' => __( 'Tools', 'pronamic_ideal' ), - 'menu_title' => __( 'Tools', 'pronamic_ideal' ), - 'capability' => 'manage_options', - 'menu_slug' => 'pronamic_pay_tools', - 'function' => function() { - $this->render_page( 'tools' ); - }, - ]; - } - $minimum_capability = $this->get_minimum_capability( $submenu_pages ); try { diff --git a/views/page-tools.php b/views/page-tools.php deleted file mode 100644 index 8bba0222..00000000 --- a/views/page-tools.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -$nav_tabs = [ - 'system_status' => __( 'System Status', 'pronamic_ideal' ), - 'gateways' => __( 'Payment Gateways', 'pronamic_ideal' ), - 'extensions' => __( 'Extensions', 'pronamic_ideal' ), -]; - -// phpcs:ignore WordPress.Security.NonceVerification.Recommended -$current_tab = array_key_exists( 'tab', $_GET ) ? \sanitize_text_field( \wp_unslash( $_GET['tab'] ) ) : ''; -$current_tab = empty( $current_tab ) ? key( $nav_tabs ) : $current_tab; - -?> - -
- - -
- - - - -
diff --git a/views/tab-extensions.php b/views/tab-extensions.php deleted file mode 100644 index c2297627..00000000 --- a/views/tab-extensions.php +++ /dev/null @@ -1,101 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -use Pronamic\WordPress\Pay\Plugin; - -?>

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- - name ); ?> - - - author, $extension->author_url ) ) { - printf( - '%s', - esc_attr( $extension->author_url ), - esc_html( $extension->author ) - ); - } - - ?> - - wp_org_url ) ) { - printf( - '%s', - esc_attr( $extension->wp_org_url ), - esc_html( $extension->wp_org_url ) - ); - } - - ?> - - requires_at_least ) ) { - echo esc_html( $extension->requires_at_least ); - } - - ?> -
diff --git a/views/tab-gateways.php b/views/tab-gateways.php deleted file mode 100644 index d5c66562..00000000 --- a/views/tab-gateways.php +++ /dev/null @@ -1,113 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -?> -

- - - - - - - - - - - - - - - get_name(); - - $name = explode( ' - ', $name ); - - // Provider. - if ( count( $name ) > 1 ) : - $provider = array_shift( $name ); - else : - $provider_name = explode( '(', $name[0] ); - - $provider = array_shift( $provider_name ); - endif; - - if ( $current_provider === $integration->provider ) : - $provider = ''; - else : - $current_provider = $integration->provider; - - $alternate = ! $alternate; - endif; - - $name = implode( '', $name ); - - // Deprecated notice. - if ( isset( $integration->deprecated ) && $integration->deprecated ) { - /* translators: %s: Integration name */ - $name = sprintf( __( '%s (obsoleted)', 'pronamic_ideal' ), $name ); - } - - // Product link. - $site = ''; - - if ( null !== $integration->get_product_url() ) { - $site = sprintf( - '%2$s', - $integration->get_product_url(), - __( 'Site', 'pronamic_ideal' ) - ); - } - - printf( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - ' - - - - ', - ( $alternate ? ' class="alternate"' : null ), - esc_html( $provider ), - esc_html( $name ), - wp_kses( - $site, - [ - 'a' => [ - 'href' => true, - 'target' => true, - 'title' => true, - ], - ] - ) - ); - - endforeach; - - endif; - - endforeach; - - ?> - - -
%s%s%s
diff --git a/views/tab-system_status.php b/views/tab-system_status.php deleted file mode 100644 index 75ec8acd..00000000 --- a/views/tab-system_status.php +++ /dev/null @@ -1,356 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -namespace Pronamic\WordPress\Pay; - -use Pronamic\WordPress\DateTime\DateTime; -use Pronamic\WordPress\DateTime\DateTimeZone; - -?> - - - - - - - - - - - - - - - - - -
- - - -
- - - format_i18n() ); - } else { - esc_html_e( 'Not scheduled', 'pronamic_ideal' ); - } - - ?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - ✓ -
- - - - - ✓ -
- - - - - ' ) ) { - echo '✓'; - } else { - esc_html_e( 'Pronamic Pay requires PHP 5.2 or above.', 'pronamic_ideal' ); - } - } - - ?> -
- - - db_version() ); - - ?> - - db_version(), '5', '>' ) ) { - echo '✓'; - } else { - esc_html_e( 'Pronamic Pay requires MySQL 5 or above.', 'pronamic_ideal' ); - } - - ?> -
- - - - - ' ) ) { - echo '✓'; - } else { - esc_html_e( 'Pronamic Pay requires WordPress 3.2 or above.', 'pronamic_ideal' ); - } - - ?> -
- - - - - = 67108864 ) { // 64 MB - echo '✓'; - } else { - echo wp_kses( - sprintf( - /* translators: %s: WordPress Codex link */ - __( 'We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP', 'pronamic_ideal' ), - esc_attr( 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) - ), - [ - 'a' => [ - 'href' => true, - 'target' => true, - ], - ] - ); - } - - ?> -
- - - - - -
- - - - - ✓ -
- - - - - ✓ -
- - - - - ' ) ) { - echo '✓'; - } else { - esc_html_e( 'Pronamic Pay requires OpenSSL 0.9.8 or above.', 'pronamic_ideal' ); - } - - ?> -
- - - - - -
- - - get_version(), 'https://travis-ci.org/pronamic/wp-pronamic-ideal.png' ); - - ?> - - - - - -
From 0e7684a8e78c98de9a29712ddc495994fb109ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 3 May 2023 16:45:37 +0200 Subject: [PATCH 004/243] Remove Pronamic socials. --- views/page-dashboard.php | 2 -- views/page-reports.php | 2 -- views/page-settings.php | 2 -- views/pronamic.php | 21 --------------------- 4 files changed, 27 deletions(-) delete mode 100644 views/pronamic.php diff --git a/views/page-dashboard.php b/views/page-dashboard.php index 2444c3cc..4f5a10a9 100644 --- a/views/page-dashboard.php +++ b/views/page-dashboard.php @@ -445,8 +445,6 @@ function( $post ) { - - diff --git a/views/page-reports.php b/views/page-reports.php index 5ff26b8d..d084569a 100644 --- a/views/page-reports.php +++ b/views/page-reports.php @@ -65,6 +65,4 @@ - - diff --git a/views/page-settings.php b/views/page-settings.php index b2b8f77b..1862f423 100644 --- a/views/page-settings.php +++ b/views/page-settings.php @@ -46,6 +46,4 @@ - - diff --git a/views/pronamic.php b/views/pronamic.php deleted file mode 100644 index 0318bbc6..00000000 --- a/views/pronamic.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -?> -

- -
- -
- -
- - -
From eca49abeb2df431a1f706bd25d2f1908ed9bd787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 3 May 2023 16:47:37 +0200 Subject: [PATCH 005/243] Remove unused function. --- includes/functions.php | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 933b9c8c..8b298257 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -303,30 +303,6 @@ function get_pronamic_subscriptions_by_source( $source, $source_id = null ) { return get_pronamic_subscriptions_by_meta( null, null, $args ); } -/** - * Bind the global providers and gateways together. - */ -function bind_providers_and_gateways() { - global $pronamic_pay_providers; - - $integrations = pronamic_pay_plugin()->gateway_integrations; - - foreach ( $integrations as $integration ) { - $provider = $integration->provider; - - if ( ! isset( $pronamic_pay_providers[ $provider ] ) ) { - $pronamic_pay_providers[ $provider ] = [ - 'integrations' => [], - ]; - } - - $pronamic_pay_providers[ $provider ]['integrations'][] = $integration; - } - - // Sort by provider. - ksort( $pronamic_pay_providers ); -} - /** * Let to num function. * From 4eeb83ae251dff9e33c603e4d8be06817516714d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 9 May 2023 10:49:55 +0200 Subject: [PATCH 006/243] Update setting initial home URL option. --- src/HomeUrlController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/HomeUrlController.php b/src/HomeUrlController.php index d3b1c3d2..99a555e9 100644 --- a/src/HomeUrlController.php +++ b/src/HomeUrlController.php @@ -33,9 +33,9 @@ public function setup() { * @return void */ public function init() { - $option = \get_option( 'pronamic_pay_home_url', null ); + $option = (string) \get_option( 'pronamic_pay_home_url' ); - if ( null === $option ) { + if ( '' === $option ) { \update_option( 'pronamic_pay_home_url', \home_url() ); } From 3eccc8b8add83159f35862f53c91a3bd6b748450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 10 May 2023 13:57:55 +0200 Subject: [PATCH 007/243] Add support for setting origin ID with Charitable. --- src/Plugin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Plugin.php b/src/Plugin.php index 90e6110f..4ac98e2a 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -957,6 +957,12 @@ public static function complement_payment( Payment $payment ) { $referer = \wp_get_referer(); if ( null === $origin_id && false !== $referer ) { + $referer_host = \wp_parse_url( $referer, \PHP_URL_HOST ); + + if ( null === $referer_host ) { + $referer = \home_url( $referer ); + } + $post_id = \url_to_postid( $referer ); if ( $post_id > 0 ) { From d37573af22c92731d3c35814175df0679f09b2b2 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 May 2023 15:41:32 +0200 Subject: [PATCH 008/243] Move this hidden setting away from the 'pronamic_pay' option group. --- src/HomeUrlController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/HomeUrlController.php b/src/HomeUrlController.php index 99a555e9..f6381aec 100644 --- a/src/HomeUrlController.php +++ b/src/HomeUrlController.php @@ -33,14 +33,14 @@ public function setup() { * @return void */ public function init() { - $option = (string) \get_option( 'pronamic_pay_home_url' ); + $option = \get_option( 'pronamic_pay_home_url', null ); - if ( '' === $option ) { + if ( null === $option ) { \update_option( 'pronamic_pay_home_url', \home_url() ); } \register_setting( - 'pronamic_pay', + 'pronamic_pay_home_url', 'pronamic_pay_home_url', [ 'type' => 'string', From 470fa98a17a61f2214baee036c4400b883525e64 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 24 May 2023 15:57:49 +0200 Subject: [PATCH 009/243] Update HomeUrlController.php --- src/HomeUrlController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/HomeUrlController.php b/src/HomeUrlController.php index f6381aec..fc5b2a65 100644 --- a/src/HomeUrlController.php +++ b/src/HomeUrlController.php @@ -40,6 +40,14 @@ public function init() { } \register_setting( + /** + * We deliberately use the 'pronamic_pay_home_url' option group + * here, as this setting is not visible to administrators. Using + * the 'pronamic_pay' option group will clear the setting after + * saving. + * + * @link https://github.com/pronamic/wp-pay-core/issues/119 + */ 'pronamic_pay_home_url', 'pronamic_pay_home_url', [ From bdc3e6c60febff84d7f86cb959fd6b7a8610d1a3 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Fri, 26 May 2023 10:48:51 +0200 Subject: [PATCH 010/243] Fix WPML conflict. --- src/HomeUrlController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/HomeUrlController.php b/src/HomeUrlController.php index fc5b2a65..c8d89c9a 100644 --- a/src/HomeUrlController.php +++ b/src/HomeUrlController.php @@ -65,7 +65,16 @@ public function init() { * @return void */ public function admin_notices() { - if ( \home_url() === \get_option( 'pronamic_pay_home_url' ) ) { + /** + * We use the `get_option( 'home' )` here and not `home_url()` to + * bypass the `home_url` filter. The WPML plugin hooks into the + * `home_url` filter and this causes the notice to be displayed + * unnecessarily. That's why we decided to compare on the + * unfiltered home URL directly from the options. + * + * @link https://github.com/pronamic/wp-pay-core/issues/121 + */ + if ( \get_option( 'home' ) === \get_option( 'pronamic_pay_home_url' ) ) { return; } From 71550afef3bf8a067d54938ccab96a71aea9e311 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:31:42 +0200 Subject: [PATCH 011/243] Switch from `pronamic/wp-deployer` to `pronamic/pronamic-cli`. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 65d740e6..0f41e626 100644 --- a/composer.json +++ b/composer.json @@ -68,8 +68,8 @@ "php-stubs/wordpress-globals": "^0.2.0", "php-stubs/wp-cli-stubs": "^2.4", "phpmd/phpmd": "^2.9", + "pronamic/pronamic-cli": "^1.0", "pronamic/wp-coding-standards": "^1.3", - "pronamic/wp-deployer": "^1.1", "roots/wordpress": "^6.0", "wp-cli/wp-cli": "^2.3", "wp-phpunit/wp-phpunit": "^6.1", From b20133ecec3b72d2ca9fab58b6b693f93edf3063 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:32:35 +0200 Subject: [PATCH 012/243] v4.9.3 --- CHANGELOG.md | 18 ++++++++++++++++++ package.json | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e6b0a7..7f165156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,24 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] +## [4.9.3] - 2023-06-01 + +### Commits + +- Switch from `pronamic/wp-deployer` to `pronamic/pronamic-cli`. ([71550af](https://github.com/pronamic/wp-pay-core/commit/71550afef3bf8a067d54938ccab96a71aea9e311)) +- Fixed WPML conflict. ([bdc3e6c](https://github.com/pronamic/wp-pay-core/commit/bdc3e6c60febff84d7f86cb959fd6b7a8610d1a3)) +- Updated HomeUrlController.php ([470fa98](https://github.com/pronamic/wp-pay-core/commit/470fa98a17a61f2214baee036c4400b883525e64)) +- Added support for setting origin ID with Charitable. ([3eccc8b](https://github.com/pronamic/wp-pay-core/commit/3eccc8b8add83159f35862f53c91a3bd6b748450)) +- Removed unused function. ([eca49ab](https://github.com/pronamic/wp-pay-core/commit/eca49abeb2df431a1f706bd25d2f1908ed9bd787)) +- Removed Pronamic socials. ([0e7684a](https://github.com/pronamic/wp-pay-core/commit/0e7684a8e78c98de9a29712ddc495994fb109ed4)) +- Removed legacy 'Tools' page. ([f68dec5](https://github.com/pronamic/wp-pay-core/commit/f68dec541d29981a48dde00734b18c22f5e03929)) +- Fixed loading bundled WordPress money translations. ([2b04615](https://github.com/pronamic/wp-pay-core/commit/2b04615a2e80626c92a881e950b8e3b20bb15df8)) +- Added missing text domain. ([f99733d](https://github.com/pronamic/wp-pay-core/commit/f99733d92507b1689fc04d6f3cf979ebf8863d2c)) + +Full set of changes: [`4.9.2...4.9.3`][4.9.3] + +[4.9.3]: https://github.com/pronamic/wp-pay-core/compare/v4.9.2...v4.9.3 + ## [4.9.2] - 2023-03-31 ### Commits diff --git a/package.json b/package.json index e6c992bf..878d125d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wp-pay/core", - "version": "4.9.2", + "version": "4.9.3", "description": "Core components for the WordPress payment processing library.", "repository": { "type": "git", From 5a0064d60669e8b302f1fb4326095a669a57d6d7 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 1 Jun 2023 20:34:47 +0200 Subject: [PATCH 013/243] Remove `plugin_locale` filter for `nl_NL_formal` and `nl_BE`. --- src/Plugin.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 4ac98e2a..aedb1032 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -308,9 +308,6 @@ public function __construct( $args = [] ) { */ add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ], 0 ); - // Plugin locale. - add_filter( 'plugin_locale', [ $this, 'plugin_locale' ], 10, 2 ); - // Register styles. add_action( 'init', [ $this, 'register_styles' ], 9 ); @@ -768,30 +765,6 @@ public static function load_plugin_textdomain() { \load_plugin_textdomain( 'pronamic-money', false, $rel_path . '/packages/pronamic/wp-money/languages' ); } - /** - * Filter plugin locale. - * - * @param string $locale A WordPress locale identifier. - * @param string $domain A WordPress text domain identifier. - * - * @return string - */ - public function plugin_locale( $locale, $domain ) { - if ( 'pronamic_ideal' !== $domain ) { - return $locale; - } - - if ( 'nl_NL_formal' === $locale ) { - return 'nl_NL'; - } - - if ( 'nl_BE' === $locale ) { - return 'nl_NL'; - } - - return $locale; - } - /** * Default date time format. * From 966f2304068c51468fd3d843ac326a5d29d4a46f Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 1 Jun 2023 20:39:06 +0200 Subject: [PATCH 014/243] Remove `load_plugin_textdomain` functions. --- src/Core/Util.php | 2 -- src/Plugin.php | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/src/Core/Util.php b/src/Core/Util.php index e0bf0a81..1b67df99 100644 --- a/src/Core/Util.php +++ b/src/Core/Util.php @@ -193,8 +193,6 @@ public static function switch_to_user_locale() { \add_filter( 'determine_locale', 'get_user_locale' ); - Plugin::load_plugin_textdomain(); - \remove_filter( 'determine_locale', 'get_user_locale' ); } } diff --git a/src/Plugin.php b/src/Plugin.php index 4ac98e2a..eaeba81a 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -656,13 +656,9 @@ public static function get_number_payments() { * Plugins loaded. * * @link https://developer.wordpress.org/reference/hooks/plugins_loaded/ - * @link https://developer.wordpress.org/reference/functions/load_plugin_textdomain/ * @return void */ public function plugins_loaded() { - // Load plugin textdomain. - self::load_plugin_textdomain(); - // Settings. $this->settings = new Settings( $this ); @@ -755,19 +751,6 @@ public function plugins_loaded() { \add_action( 'pronamic_pay_pre_create_payment', [ __CLASS__, 'complement_payment' ], 10, 1 ); } - /** - * Load plugin text domain. - * - * @return void - */ - public static function load_plugin_textdomain() { - $rel_path = \dirname( \plugin_basename( self::$file ) ); - - \load_plugin_textdomain( 'pronamic_ideal', false, $rel_path . '/languages' ); - - \load_plugin_textdomain( 'pronamic-money', false, $rel_path . '/packages/pronamic/wp-money/languages' ); - } - /** * Filter plugin locale. * From b9c0cb17feb9f7a6737d04fcc891f6d97ccff384 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 1 Jun 2023 20:40:28 +0200 Subject: [PATCH 015/243] Remove `switch_to_user_locale`. Users who want to use this functionality can use a plugin such as https://wordpress.org/plugins/jsm-user-locale/. --- src/Core/Gateway.php | 3 --- src/Core/Util.php | 13 ------------- src/Plugin.php | 3 --- src/Subscriptions/SubscriptionsModule.php | 3 --- 4 files changed, 22 deletions(-) diff --git a/src/Core/Gateway.php b/src/Core/Gateway.php index eaae9a1d..6a9e4861 100644 --- a/src/Core/Gateway.php +++ b/src/Core/Gateway.php @@ -256,9 +256,6 @@ public function create_refund( Refund $refund ) { * @throws \Exception Throws exception when action URL for HTTP redirect is empty. */ public function redirect( Payment $payment ) { - // Switch to user locale. - Util::switch_to_user_locale(); - switch ( $this->method ) { case self::METHOD_HTTP_REDIRECT: $this->redirect_via_http( $payment ); diff --git a/src/Core/Util.php b/src/Core/Util.php index 1b67df99..18dbbc04 100644 --- a/src/Core/Util.php +++ b/src/Core/Util.php @@ -182,17 +182,4 @@ public static function get_remote_address() { public static function class_method_exists( $class, $method ) { return class_exists( $class ) && method_exists( $class, $method ); } - - /** - * Switch to user locale. - * - * @return void - */ - public static function switch_to_user_locale() { - \switch_to_locale( \get_user_locale() ); - - \add_filter( 'determine_locale', 'get_user_locale' ); - - \remove_filter( 'determine_locale', 'get_user_locale' ); - } } diff --git a/src/Plugin.php b/src/Plugin.php index eaeba81a..d0d92958 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -599,9 +599,6 @@ public function maybe_redirect() { // Don't cache. Core_Util::no_cache(); - // Switch to user locale. - Core_Util::switch_to_user_locale(); - // Handle redirect message from payment meta. $redirect_message = $payment->get_meta( 'payment_redirect_message' ); diff --git a/src/Subscriptions/SubscriptionsModule.php b/src/Subscriptions/SubscriptionsModule.php index b75a3551..096df76f 100644 --- a/src/Subscriptions/SubscriptionsModule.php +++ b/src/Subscriptions/SubscriptionsModule.php @@ -266,9 +266,6 @@ public function maybe_handle_subscription_action() { exit; } - // Switch to user locale. - Util::switch_to_user_locale(); - // Handle action. switch ( $_GET['action'] ) { // phpcs:enable WordPress.Security.NonceVerification.Recommended From 19088b1746901c973627bfbc1a081b961d8d6b8c Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 1 Jun 2023 20:59:46 +0200 Subject: [PATCH 016/243] Changes links in license notice. --- src/LicenseManager.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/LicenseManager.php b/src/LicenseManager.php index a2986ca5..8ef7b091 100644 --- a/src/LicenseManager.php +++ b/src/LicenseManager.php @@ -158,17 +158,17 @@ public function admin_notices() { if ( '' === $license ) { $notice = sprintf( /* translators: 1: Pronamic Pay settings page URL, 2: Pronamic.eu plugin page URL */ - __( 'Pronamic Pay — You have not entered a valid support license key, please get your key at pronamic.eu.', 'pronamic_ideal' ), + __( 'Pronamic Pay — You have not entered a valid support license key, please get your key at pronamicpay.com.', 'pronamic_ideal' ), add_query_arg( 'page', 'pronamic_pay_settings', get_admin_url( null, 'admin.php' ) ), - 'https://www.pronamic.eu/plugins/pronamic-ideal/' + 'https://www.pronamicpay.com/' ); } else { $notice = sprintf( /* translators: 1: Pronamic Pay settings page URL, 2: Pronamic.eu plugin page URL, 3: Pronamic.eu account page URL */ - __( 'Pronamic Pay — You have not entered a valid support license key. Please get your key at pronamic.eu or login to check your license status.', 'pronamic_ideal' ), + __( 'Pronamic Pay — You have not entered a valid support license key. Please get your key at pronamicpay.com or login to check your license status.', 'pronamic_ideal' ), add_query_arg( 'page', 'pronamic_pay_settings', get_admin_url( null, 'admin.php' ) ), - 'https://www.pronamic.eu/plugins/pronamic-ideal/', - 'https://www.pronamic.eu/account/' + 'https://www.pronamicpay.com/', + 'https://www.pronamic.shop/' ); } From be14ef946d39ab956ce34a758f00c87b7402e752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 5 Jun 2023 17:00:06 +0200 Subject: [PATCH 017/243] Fix payment lines not displayed in meta box for subscriptions. --- views/meta-box-payment-lines.php | 44 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/views/meta-box-payment-lines.php b/views/meta-box-payment-lines.php index 407ad542..724a82b9 100644 --- a/views/meta-box-payment-lines.php +++ b/views/meta-box-payment-lines.php @@ -15,7 +15,7 @@ use Pronamic\WordPress\Number\Number; use Pronamic\WordPress\Pay\Payments\PaymentLine; -if ( ! isset( $payment ) || empty( $lines ) ) : ?> +if ( empty( $lines ) ) : ?>

@@ -105,19 +105,21 @@ } } - foreach ( $payment->refunds as $refund ) { - foreach ( $refund->lines as $refund_line ) { - $refunded_quantity_total = $refunded_quantity_total->add( $refund_line->get_quantity() ); + if ( isset( $payment ) ) { + foreach ( $payment->refunds as $refund ) { + foreach ( $refund->lines as $refund_line ) { + $refunded_quantity_total = $refunded_quantity_total->add( $refund_line->get_quantity() ); - $line_total = $refund_line->get_total_amount(); + $line_total = $refund_line->get_total_amount(); - $refunded_amount_total = $refunded_amount_total->add( $refund_line->get_total_amount() ); + $refunded_amount_total = $refunded_amount_total->add( $refund_line->get_total_amount() ); - if ( $line_total instanceof TaxedMoney ) { - $tax_amount = $line_total->get_tax_amount(); + if ( $line_total instanceof TaxedMoney ) { + $tax_amount = $line_total->get_tax_amount(); - if ( null !== $tax_amount ) { - $refunded_tax_total = $refunded_tax_total->add( $tax_amount ); + if ( null !== $tax_amount ) { + $refunded_tax_total = $refunded_tax_total->add( $tax_amount ); + } } } } @@ -197,20 +199,22 @@ function( PaymentLine $line ) { $refunded_amount = new Money(); $refunded_tax = new Money(); - foreach ( $payment->refunds as $refund ) { - foreach ( $refund->lines as $refund_line ) { - if ( $refund_line->get_payment_line() === $line ) { - $refunded_quantity = $refunded_quantity->add( $refund_line->get_quantity() ); + if ( isset( $payment ) ) { + foreach ( $payment->refunds as $refund ) { + foreach ( $refund->lines as $refund_line ) { + if ( $refund_line->get_payment_line() === $line ) { + $refunded_quantity = $refunded_quantity->add( $refund_line->get_quantity() ); - $line_total = $refund_line->get_total_amount(); + $line_total = $refund_line->get_total_amount(); - $refunded_amount = $refunded_amount->add( $line_total ); + $refunded_amount = $refunded_amount->add( $line_total ); - if ( $line_total instanceof TaxedMoney ) { - $tax_amount = $line_total->get_tax_amount(); + if ( $line_total instanceof TaxedMoney ) { + $tax_amount = $line_total->get_tax_amount(); - if ( null !== $tax_amount ) { - $refunded_tax = $refunded_tax->add( $tax_amount ); + if ( null !== $tax_amount ) { + $refunded_tax = $refunded_tax->add( $tax_amount ); + } } } } From 30a59e9c1d5f7dc39ca0fd6a235076ffa5c96f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 6 Jun 2023 11:04:45 +0200 Subject: [PATCH 018/243] Reflect home URL change from bdc3e6c6 in admin notice. --- src/HomeUrlController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/HomeUrlController.php b/src/HomeUrlController.php index c8d89c9a..50ad91e4 100644 --- a/src/HomeUrlController.php +++ b/src/HomeUrlController.php @@ -45,7 +45,7 @@ public function init() { * here, as this setting is not visible to administrators. Using * the 'pronamic_pay' option group will clear the setting after * saving. - * + * * @link https://github.com/pronamic/wp-pay-core/issues/119 */ 'pronamic_pay_home_url', @@ -67,11 +67,11 @@ public function init() { public function admin_notices() { /** * We use the `get_option( 'home' )` here and not `home_url()` to - * bypass the `home_url` filter. The WPML plugin hooks into the + * bypass the `home_url` filter. The WPML plugin hooks into the * `home_url` filter and this causes the notice to be displayed * unnecessarily. That's why we decided to compare on the * unfiltered home URL directly from the options. - * + * * @link https://github.com/pronamic/wp-pay-core/issues/121 */ if ( \get_option( 'home' ) === \get_option( 'pronamic_pay_home_url' ) ) { @@ -92,7 +92,7 @@ public function admin_notices() { /* translators: 1: Pronamic Pay home URL option, 2: home URL */ __( 'We noticed the WordPress home URL has changed from "%1$s" to "%2$s". Please verify the payment gateway settings. For example, you might want to switch between live and test mode or need to update an URL at the gateway to continue receiving payment status updates. Also keep an eye on pending payments to discover possible configuration issues.', 'pronamic_ideal' ), \get_option( 'pronamic_pay_home_url' ), - \home_url() + \get_option( 'home' ) ) ); From 76cdf8aa10c9b16b20755da41e070abc4a4c6b5f Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:11:08 +0200 Subject: [PATCH 019/243] Remove admin notices feature for removed extensions, no longer used. --- src/Admin/AdminModule.php | 8 -- src/Admin/AdminNotices.php | 155 ------------------------------------- 2 files changed, 163 deletions(-) delete mode 100644 src/Admin/AdminNotices.php diff --git a/src/Admin/AdminModule.php b/src/Admin/AdminModule.php index ec01d6f6..6e651b10 100644 --- a/src/Admin/AdminModule.php +++ b/src/Admin/AdminModule.php @@ -74,13 +74,6 @@ class AdminModule { */ public $health; - /** - * Admin notices page. - * - * @var AdminNotices - */ - public $notices; - /** * Admin reports page. * @@ -126,7 +119,6 @@ public function __construct( Plugin $plugin ) { $this->settings = new AdminSettings( $plugin ); $this->dashboard = new AdminDashboard(); $this->health = new AdminHealth( $plugin ); - $this->notices = new AdminNotices(); $this->reports = new AdminReports( $plugin ); $this->tour = new AdminTour( $plugin ); diff --git a/src/Admin/AdminNotices.php b/src/Admin/AdminNotices.php deleted file mode 100644 index dba6dace..00000000 --- a/src/Admin/AdminNotices.php +++ /dev/null @@ -1,155 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Admin - */ - -namespace Pronamic\WordPress\Pay\Admin; - -use Pronamic\WordPress\Pay\Plugin; - -/** - * WordPress admin notices - * - * @author Remco Tolsma - * @version 2.2.6 - * @since 3.7.0 - */ -class AdminNotices { - /** - * Construct admin notices. - * - * @link https://github.com/woothemes/woocommerce/blob/2.4.3/includes/admin/class-wc-admin-notices.php - */ - public function __construct() { - // Actions. - add_action( 'admin_init', [ $this, 'admin_init' ] ); - add_action( 'admin_notices', [ $this, 'admin_notices' ], 11 ); - } - - /** - * Admin notices. - * - * @link https://github.com/WordPress/WordPress/blob/4.3.1/wp-admin/admin-header.php#L245-L250 - * @return void - */ - public function admin_notices() { - // Show notices only to options managers (administrators). - if ( ! current_user_can( 'manage_options' ) ) { - return; - } - - // Jetpack. - $screen = get_current_screen(); - - if ( null !== $screen && 'jetpack' === $screen->parent_base ) { - return; - } - - $this->removed_support_notices(); - } - - /** - * Removed support notices. - * - * @link https://github.com/pronamic/wp-pronamic-pay/issues/293 - * @return void - */ - private function removed_support_notices() { - $notifications = []; - - /** - * Filters the removed extensions notifications. - * - * @param AdminNotification[] $notifications Notifications for removed extensions. - */ - $notifications = \apply_filters( 'pronamic_pay_removed_extension_notifications', $notifications ); - - foreach ( $notifications as $notification ) { - $this->removed_support_notice( $notification ); - } - } - - /** - * Removed support notice. - * - * @param AdminNotification $notification Notification. - * @return void - */ - private function removed_support_notice( $notification ) { - if ( ! $notification->is_met() ) { - return; - } - - $is_dismissed = (bool) \get_user_option( 'pronamic_pay_dismissed_notification:' . $notification->get_id(), \get_current_user_id() ); - - if ( true === $is_dismissed ) { - return; - } - - $dismiss_notification_url = \add_query_arg( 'pronamic_pay_dismiss_notification', $notification->get_id() ); - $dismiss_notification_url = \wp_nonce_url( $dismiss_notification_url, 'pronamic_pay_dismiss_notification:' . $notification->get_id(), 'pronamic_pay_dismiss_notification_nonce' ); - - ?> -

-

- — - get_message() ); ?> -

- - -
- false, - 'pronamic_pay_dismiss_notification_nonce' => false, - 'pronamic_pay_dismissed_notification' => $id, - ], - \wp_get_referer() - ); - - \wp_safe_redirect( $url ); - - exit; - } -} From 367d8a202680801a75db0246632ee1e1935132fc Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 8 Jun 2023 10:41:42 +0200 Subject: [PATCH 020/243] Add `get_current_period` function to subscription class. --- src/Subscriptions/Subscription.php | 33 ++++++++++++- src/Subscriptions/SubscriptionPhase.php | 61 ++++++++++++++++++++----- 2 files changed, 81 insertions(+), 13 deletions(-) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index 03a24de0..efb51264 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -775,8 +775,18 @@ public function is_infinite() { * @return SubscriptionPhase|null */ public function get_current_phase() { + return $this->get_phase_for_date( $this->get_next_payment_date() ); + } + + /** + * Get phase for date. + * + * @param DateTimeInterface $date Date. + * @return SubscriptionPhase|null + */ + public function get_phase_for_date( DateTimeInterface $date ) { foreach ( $this->phases as $phase ) { - if ( $phase->all_periods_created() ) { + if ( $phase->is_completed_to_date( $date ) ) { continue; } @@ -790,6 +800,27 @@ public function get_current_phase() { return null; } + /** + * Get current period. + * + * @return SubscriptionPeriod|null + */ + public function get_current_period() { + $date = $this->get_next_payment_date(); + + foreach ( $this->phases as $phase ) { + $start_date = $phase->substract_interval( $date ); + + $period = $phase->get_period( $start_date ); + + if ( null !== $period ) { + return $period; + } + } + + return null; + } + /** * Get phase for display. * diff --git a/src/Subscriptions/SubscriptionPhase.php b/src/Subscriptions/SubscriptionPhase.php index 801b047c..c0634b63 100644 --- a/src/Subscriptions/SubscriptionPhase.php +++ b/src/Subscriptions/SubscriptionPhase.php @@ -421,9 +421,17 @@ public function is_infinite() { * @return bool True if all periods are created, false otherwise. */ public function all_periods_created() { - $next_date = $this->subscription->get_next_payment_date(); + return $this->is_completed_to_date( $this->subscription->get_next_payment_date() ); + } - if ( null === $next_date ) { + /** + * Check if this phase is completed to date. + * + * @param DateTimeInterface|null $date Date. + * @return bool True if phase is completed to date, false otherwise. + */ + public function is_completed_to_date( DateTimeInterface $date = null ) { + if ( null === $date ) { return true; } @@ -431,7 +439,7 @@ public function all_periods_created() { return false; } - return $next_date >= $this->end_date; + return $date >= $this->end_date; } /** @@ -463,28 +471,57 @@ private function add_interval( $date, $times = 1 ) { } /** - * Get next period. - * + * Substract the interval of this subscription phase from the specified date. + * + * @param DateTimeImmutable $date Date to substract interval period from. + * @param int $times Number of times to substract interval. + * @return DateTimeImmutable + */ + public function substract_interval( $date, $times = 1 ) { + // If times is zero there is nothing to add. + if ( 0 === $times ) { + return $date; + } + + // Multiply date interval. + return $date->sub( $this->interval->multiply( $times ) ); + } + + /** + * Get period for the specified start date. + * + * @param DateTimeInterface $start_date Start date. * @return SubscriptionPeriod|null */ - public function get_next_period() { - if ( $this->all_periods_created() ) { + public function get_period( DateTimeInterface $start_date = null ) { + if ( null === $start_date ) { return null; } - $start = $this->get_next_date(); - - if ( null === $start ) { + if ( $this->start_date > $start_date ) { return null; } - $end = $this->add_interval( $start ); + $end_date = $this->add_interval( $start_date ); + + if ( null !== $this->end_date && $end_date > $this->end_date ) { + return null; + } - $period = new SubscriptionPeriod( $this, $start, $end, $this->get_amount() ); + $period = new SubscriptionPeriod( $this, $start_date, $end_date, $this->get_amount() ); return $period; } + /** + * Get next period. + * + * @return SubscriptionPeriod|null + */ + public function get_next_period() { + return $this->get_period( $this->get_next_date() ); + } + /** * Next period. * From 373ac95c563f9839fcd894799febffe794ed86f5 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:40:35 +0200 Subject: [PATCH 021/243] Update Subscription.php --- src/Subscriptions/Subscription.php | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index efb51264..9b9e86e4 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -821,6 +821,37 @@ public function get_current_period() { return null; } + /** + * Get start date of this subscription. + * + * @return DateTimeImmutable|null + */ + public function get_start_date() { + $phase = \reset( $this->phases ); + + if ( false === $phase ) { + return null; + } + + return $phase->get_start_date(); + } + + /** + * Get period for date. + * + * @param DateTimeInterface $date Date. + * @return SubscriptionPeriod|null + */ + public function get_period_for_date( DateTimeInterface $date ) { + $phase = $this->get_phase_for_date( $date ); + + if ( null === $phase ) { + return null; + } + + return $phase->get_period( $date ); + } + /** * Get phase for display. * From 8733c45a02dcd83f604c8b0344eb5512b615d29f Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:50:10 +0200 Subject: [PATCH 022/243] Update Subscription.php --- src/Subscriptions/Subscription.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index 9b9e86e4..5e0313b8 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -821,21 +821,6 @@ public function get_current_period() { return null; } - /** - * Get start date of this subscription. - * - * @return DateTimeImmutable|null - */ - public function get_start_date() { - $phase = \reset( $this->phases ); - - if ( false === $phase ) { - return null; - } - - return $phase->get_start_date(); - } - /** * Get period for date. * @@ -962,6 +947,21 @@ public function get_phase_by_sequence_number( $sequence_number ) { return null; } + /** + * Get start date. + * + * @return DateTimeImmutable|null + */ + public function get_start_date() { + $phase = \reset( $this->phases ); + + if ( false === $phase ) { + return null; + } + + return $phase->get_start_date(); + } + /** * Get end date. * From 9ca95622e243f80ccba2ba6402de4f6a871c08b1 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:01:47 +0200 Subject: [PATCH 023/243] Remove `get_current_period()`, doesn't work for last period when next payment date is `null`. --- src/Subscriptions/Subscription.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index 5e0313b8..548cd09e 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -800,27 +800,6 @@ public function get_phase_for_date( DateTimeInterface $date ) { return null; } - /** - * Get current period. - * - * @return SubscriptionPeriod|null - */ - public function get_current_period() { - $date = $this->get_next_payment_date(); - - foreach ( $this->phases as $phase ) { - $start_date = $phase->substract_interval( $date ); - - $period = $phase->get_period( $start_date ); - - if ( null !== $period ) { - return $period; - } - } - - return null; - } - /** * Get period for date. * From 30237c58b89790e863ffa14ba8d14c530714cc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Fri, 9 Jun 2023 14:23:22 +0200 Subject: [PATCH 024/243] Fix "Fatal error: Uncaught TypeError: Pronamic\WordPress\Pay\Subscriptions\Subscription::get_phase_for_date(): Argument #1 ($date) must be of type Pronamic\WordPress\DateTime\DateTimeInterface, null given" in subscription payments meta box. --- src/Subscriptions/Subscription.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index 548cd09e..9bc88d12 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -775,12 +775,18 @@ public function is_infinite() { * @return SubscriptionPhase|null */ public function get_current_phase() { - return $this->get_phase_for_date( $this->get_next_payment_date() ); + $next_payment_date = $this->get_next_payment_date(); + + if ( null === $next_payment_date ) { + return null; + } + + return $this->get_phase_for_date( $next_payment_date ); } /** * Get phase for date. - * + * * @param DateTimeInterface $date Date. * @return SubscriptionPhase|null */ @@ -928,7 +934,7 @@ public function get_phase_by_sequence_number( $sequence_number ) { /** * Get start date. - * + * * @return DateTimeImmutable|null */ public function get_start_date() { From d7cba1d6bbad51060ed1ce9864ed1f8dc2281ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 12 Jun 2023 11:34:33 +0200 Subject: [PATCH 025/243] Remove unused class import. --- src/Subscriptions/SubscriptionPhase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Subscriptions/SubscriptionPhase.php b/src/Subscriptions/SubscriptionPhase.php index c0634b63..07420285 100644 --- a/src/Subscriptions/SubscriptionPhase.php +++ b/src/Subscriptions/SubscriptionPhase.php @@ -10,7 +10,6 @@ namespace Pronamic\WordPress\Pay\Subscriptions; -use Pronamic\WordPress\DateTime\DateTime; use Pronamic\WordPress\DateTime\DateTimeImmutable; use Pronamic\WordPress\DateTime\DateTimeInterface; use Pronamic\WordPress\Money\Money; From feacc4b6092c42b70fde7a3c8508f60b74b31e1a Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:04:21 +0200 Subject: [PATCH 026/243] Update logos library to version 1.16.0. --- scss/card-slider.scss | 44 ++++++++++++++++++------------------- src/Cards.php | 2 +- src/Core/PaymentMethods.php | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scss/card-slider.scss b/scss/card-slider.scss index 12327da5..3c579d00 100644 --- a/scss/card-slider.scss +++ b/scss/card-slider.scss @@ -135,31 +135,31 @@ &.brand-american-express { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/american-express/card-american-express-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/american-express/card-american-express-background-480x270.svg"); } } &.brand-carta-si { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/carta-si/card-carta-si-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/carta-si/card-carta-si-background-480x270.svg"); } } &.brand-carte-bleue { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/carte-bleue/card-carte-bleue-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/carte-bleue/card-carte-bleue-background-480x270.svg"); } } &.brand-dankort { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/dankort/card-dankort-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/dankort/card-dankort-background-480x270.svg"); } } &.brand-diners-club { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/diners-club/card-diners-club-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/diners-club/card-diners-club-background-480x270.svg"); } .pp-card__content { @@ -169,7 +169,7 @@ &.brand-discover { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/discover/card-discover-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/discover/card-discover-background-480x270.svg"); } .pp-card__content { @@ -179,19 +179,19 @@ &.brand-jcb { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/jcb/card-jcb-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/jcb/card-jcb-background-480x270.svg"); } } &.brand-maestro { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/maestro/card-maestro-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/maestro/card-maestro-background-480x270.svg"); } } &.brand-mastercard { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/mastercard/card-mastercard-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/mastercard/card-mastercard-background-480x270.svg"); } .pp-card__content { @@ -201,7 +201,7 @@ &.brand-unionpay { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/unionpay/card-unionpay-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/unionpay/card-unionpay-background-480x270.svg"); } .pp-card__content { @@ -211,13 +211,13 @@ &.brand-visa { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/visa/card-visa-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/visa/card-visa-background-480x270.svg"); } } &.brand-abn-amro { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/abn-amro/card-abn-amro-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/abn-amro/card-abn-amro-background-480x270.svg"); } .pp-card__value { @@ -227,7 +227,7 @@ &.brand-asn-bank { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/asn-bank/card-asn-bank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/asn-bank/card-asn-bank-background-480x270.svg"); } .pp-card__content { @@ -238,19 +238,19 @@ &.brand-bunq { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/bunq/card-bunq-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/bunq/card-bunq-background-480x270.svg"); } } &.brand-handelsbanken { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/handelsbanken/card-handelsbanken-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/handelsbanken/card-handelsbanken-background-480x270.svg"); } } &.brand-ing { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/ing/card-ing-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/ing/card-ing-background-480x270.svg"); } .pp-card__value { @@ -260,7 +260,7 @@ &.brand-knab { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/knab/card-knab-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/knab/card-knab-background-480x270.svg"); } .pp-card__label { @@ -274,7 +274,7 @@ &.brand-rabobank { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/rabobank/card-rabobank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/rabobank/card-rabobank-background-480x270.svg"); } .pp-card__content { @@ -284,7 +284,7 @@ &.brand-regiobank { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/regiobank/card-regiobank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/regiobank/card-regiobank-background-480x270.svg"); } .pp-card__value { @@ -294,13 +294,13 @@ &.brand-sns { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/sns/card-sns-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/sns/card-sns-background-480x270.svg"); } } &.brand-triodos-bank { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/triodos-bank/card-triodos-bank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/triodos-bank/card-triodos-bank-background-480x270.svg"); } .pp-card__content { @@ -310,7 +310,7 @@ &.brand-van-lanschot { .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/van-lanschot/card-van-lanschot-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/van-lanschot/card-van-lanschot-background-480x270.svg"); } } } diff --git a/src/Cards.php b/src/Cards.php index 645f0cc3..3b215314 100644 --- a/src/Cards.php +++ b/src/Cards.php @@ -202,7 +202,7 @@ public function get_card( $bic_or_brand ) { */ public function get_card_logo_url( $brand ) { return sprintf( - 'https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.13.0/dist/cards/%1$s/card-%1$s-logo-_x80.svg', + 'https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/%1$s/card-%1$s-logo-_x80.svg', $brand ); } diff --git a/src/Core/PaymentMethods.php b/src/Core/PaymentMethods.php index 42d6b353..56147195 100644 --- a/src/Core/PaymentMethods.php +++ b/src/Core/PaymentMethods.php @@ -528,7 +528,7 @@ public static function get_icon_url( $method = null, $size = null ) { } return \sprintf( - 'https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.13.0/dist/methods/%1$s/method-%1$s-%2$s.svg', + 'https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/methods/%1$s/method-%1$s-%2$s.svg', \str_replace( '_', '-', $method ), $size ); From 2d2ae98f9ab80ebdeb212478469fe195d7855e79 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:04:34 +0200 Subject: [PATCH 027/243] npm run sass --- css/admin.css | 2 +- css/card-slider.css | 44 ++++++++++++++++++++++---------------------- css/forms.css.map | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/css/admin.css b/css/admin.css index 47c7d878..1871d7a4 100644 --- a/css/admin.css +++ b/css/admin.css @@ -449,7 +449,7 @@ body.post-type-pronamic_payment #post-body-content, body.post-type-pronamic_pay_ } @media only screen and (max-width: 782px) { .pronamic-pay-tab .form-table th, -.pronamic-pay-tab .form-table td { + .pronamic-pay-tab .form-table td { padding: 11px; } } diff --git a/css/card-slider.css b/css/card-slider.css index bc3ef0df..e262f7fb 100644 --- a/css/card-slider.css +++ b/css/card-slider.css @@ -119,77 +119,77 @@ height: 100%; } .pp-card.brand-american-express .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/american-express/card-american-express-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/american-express/card-american-express-background-480x270.svg"); } .pp-card.brand-carta-si .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/carta-si/card-carta-si-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/carta-si/card-carta-si-background-480x270.svg"); } .pp-card.brand-carte-bleue .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/carte-bleue/card-carte-bleue-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/carte-bleue/card-carte-bleue-background-480x270.svg"); } .pp-card.brand-dankort .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/dankort/card-dankort-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/dankort/card-dankort-background-480x270.svg"); } .pp-card.brand-diners-club .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/diners-club/card-diners-club-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/diners-club/card-diners-club-background-480x270.svg"); } .pp-card.brand-diners-club .pp-card__content { color: #000; } .pp-card.brand-discover .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/discover/card-discover-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/discover/card-discover-background-480x270.svg"); } .pp-card.brand-discover .pp-card__content { color: #000; } .pp-card.brand-jcb .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/jcb/card-jcb-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/jcb/card-jcb-background-480x270.svg"); } .pp-card.brand-maestro .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/maestro/card-maestro-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/maestro/card-maestro-background-480x270.svg"); } .pp-card.brand-mastercard .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/mastercard/card-mastercard-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/mastercard/card-mastercard-background-480x270.svg"); } .pp-card.brand-mastercard .pp-card__content { color: #000; } .pp-card.brand-unionpay .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/unionpay/card-unionpay-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/unionpay/card-unionpay-background-480x270.svg"); } .pp-card.brand-unionpay .pp-card__content { color: #000; } .pp-card.brand-visa .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/visa/card-visa-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/visa/card-visa-background-480x270.svg"); } .pp-card.brand-abn-amro .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/abn-amro/card-abn-amro-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/abn-amro/card-abn-amro-background-480x270.svg"); } .pp-card.brand-abn-amro .pp-card__value { color: #000; } .pp-card.brand-asn-bank .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/asn-bank/card-asn-bank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/asn-bank/card-asn-bank-background-480x270.svg"); } .pp-card.brand-asn-bank .pp-card__content { color: #000; opacity: 0.6; } .pp-card.brand-bunq .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/bunq/card-bunq-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/bunq/card-bunq-background-480x270.svg"); } .pp-card.brand-handelsbanken .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/handelsbanken/card-handelsbanken-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/handelsbanken/card-handelsbanken-background-480x270.svg"); } .pp-card.brand-ing .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/ing/card-ing-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/ing/card-ing-background-480x270.svg"); } .pp-card.brand-ing .pp-card__value { color: #000; } .pp-card.brand-knab .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/knab/card-knab-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/knab/card-knab-background-480x270.svg"); } .pp-card.brand-knab .pp-card__label { color: #ec5f7d; @@ -198,28 +198,28 @@ color: #003b5a; } .pp-card.brand-rabobank .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/rabobank/card-rabobank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/rabobank/card-rabobank-background-480x270.svg"); } .pp-card.brand-rabobank .pp-card__content { color: #000; } .pp-card.brand-regiobank .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/regiobank/card-regiobank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/regiobank/card-regiobank-background-480x270.svg"); } .pp-card.brand-regiobank .pp-card__value { color: #000; } .pp-card.brand-sns .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/sns/card-sns-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/sns/card-sns-background-480x270.svg"); } .pp-card.brand-triodos-bank .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/triodos-bank/card-triodos-bank-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/triodos-bank/card-triodos-bank-background-480x270.svg"); } .pp-card.brand-triodos-bank .pp-card__content { color: #000; } .pp-card.brand-van-lanschot .pp-card__background { - background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/van-lanschot/card-van-lanschot-background-480x270.svg"); + background-image: url("https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/van-lanschot/card-van-lanschot-background-480x270.svg"); } .slick-slide { diff --git a/css/forms.css.map b/css/forms.css.map index 8c3a5a56..66fe0653 100644 --- a/css/forms.css.map +++ b/css/forms.css.map @@ -1 +1 @@ -{"version":3,"mappings":"AAIC,2BAAS;EACR,MAAM,EAAE,CAAC;;AAIV,yBAAO;EACN,aAAa,EAAE,iBAA0B;EAEzC,WAAW,EAAE,GAAG;EAEhB,MAAM,EAAE,WAAW;EACnB,OAAO,EAAE,QAAQ;EAEjB,KAAK,EAAE,IAAI;;AAIZ,0DAAwC;EACvC,KAAK,EAAE,IAAI;;;AAKb,gCAAiC;EAChC,KAAK,ECuDyB,IAAS;;;ADnDxC,sBAAuB;EACtB,MAAM,EAAE,QAAQ;;AAEhB;;6BAEO;EACN,aAAa,EAAE,CAAC;EAEhB,OAAO,EAAE,IAAI;EAEb,KAAK,EAAE,IAAI;;;AAIb,2BAA4B;EAC3B,KAAK,EAAE,IAAI;EAEX,MAAM,EAAE,QAAQ;;;AAGjB;2BAC4B;EAC3B,KAAK,EAAE,KAAK;;;AAGb,4BAA6B;EAC5B,KAAK,EAAE,IAAI;;;AAGZ,2BAA4B;EAC3B,KAAK,EAAE,KAAK;;;AAIb,mBAAoB;EACnB,UAAU,ECjDa,OAAO;EDmD9B,WAAW,EAAE,cAAmB;EAEhC,UAAU,EAAE,8BAA4B;EAExC,KAAK,EAAE,IAAI;EAEX,MAAM,EAAE,MAAM;EAEd,OAAO,EAAE,eAAe;EAExB,QAAQ,EAAE,QAAQ;;;AAInB,iCAAkC;EACjC,UAAU,EAAE,IAAI;EAEhB,WAAW,EAAE,CAAC;EACd,YAAY,EAAE,CAAC;;;AAIhB,qFAAsF;EACrF,OAAO,EAAE,IAAI;;;AAGd,6FAA8F;EAC7F,OAAO,EAAE,KAAK","sources":["../scss/forms.scss","../scss/admin/_variables.scss"],"names":[],"file":"forms.css"} +{"version":3,"sourceRoot":"","sources":["../scss/forms.scss","../scss/admin/_variables.scss"],"names":[],"mappings":"AAIC;EACC;;AAID;EACC;EAEA;EAEA;EACA;EAEA;;AAID;EACC;;;AAKF;EACC,OCFU;;;ADMX;EACC;;AAEA;AAAA;AAAA;EAGC;EAEA;EAEA;;;AAIF;EACC;EAEA;;;AAGD;AAAA;EAEC;;;AAGD;EACC;;;AAGD;EACC;;;AAID;EACC,YCjDuB;EDmDvB;EAEA;EAEA;EAEA;EAEA;EAEA;;;AAID;EACC;EAEA;EACA;;;AAID;EACC;;;AAGD;EACC","file":"forms.css"} \ No newline at end of file From 7d647ebeab7dc2a963e238d62c600d8dca8800a3 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:05:48 +0200 Subject: [PATCH 028/243] grunt postcss --- css/admin-about.css | 2 -- css/admin-tour.css | 2 -- css/admin.css | 18 ++++++++++++------ css/admin.min.css | 2 +- css/card-slider.css | 35 +++++++++++++++++++++++++---------- css/card-slider.min.css | 2 +- css/forms.css | 5 ++--- css/redirect.css | 24 ++++++++++++++++-------- 8 files changed, 57 insertions(+), 33 deletions(-) diff --git a/css/admin-about.css b/css/admin-about.css index 28290f97..83027c96 100644 --- a/css/admin-about.css +++ b/css/admin-about.css @@ -7,5 +7,3 @@ .svg .pronamic-pay-badge { background-image: url("../images/dist/wp-pay-white.svgo-min.svg"); } - -/*# sourceMappingURL=admin-about.css.map */ diff --git a/css/admin-tour.css b/css/admin-tour.css index 67ff9505..50ae178d 100644 --- a/css/admin-tour.css +++ b/css/admin-tour.css @@ -15,5 +15,3 @@ .pp-pointer-buttons-right { float: right; } - -/*# sourceMappingURL=admin-tour.css.map */ diff --git a/css/admin.css b/css/admin.css index 1871d7a4..993b0fed 100644 --- a/css/admin.css +++ b/css/admin.css @@ -25,13 +25,18 @@ } .pronamic-pay-chart-legend li { border-right: 5px solid #aaa; - box-shadow: inset 0 -1px 0 0 #e5e5e5; + -webkit-box-shadow: inset 0 -1px 0 0 #e5e5e5; + box-shadow: inset 0 -1px 0 0 #e5e5e5; color: #aaa; display: block; margin: 0; padding: 1em; - transition-duration: 0.5s; + -webkit-transition-duration: 0.5s; + transition-duration: 0.5s; + -webkit-transition-property: border, padding, -webkit-box-shadow; + transition-property: border, padding, -webkit-box-shadow; transition-property: border, box-shadow, padding; + transition-property: border, box-shadow, padding, -webkit-box-shadow; } .pronamic-pay-chart-legend li.completed-count { border-right-color: #dbe1e3; @@ -53,7 +58,8 @@ } .pronamic-pay-chart-legend li:hover { border-right-color: #23282f; - box-shadow: inset 0 -1px 0 0 #e5e5e5, inset 300px 0 0 #f9f9f9; + -webkit-box-shadow: inset 0 -1px 0 0 #e5e5e5, inset 300px 0 0 #f9f9f9; + box-shadow: inset 0 -1px 0 0 #e5e5e5, inset 300px 0 0 #f9f9f9; padding-left: 1.5em; } .pronamic-pay-chart-legend strong { @@ -74,7 +80,8 @@ } .pronamic-pay-status-list li { border-top: 1px solid #eee; - box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; color: #aaa; float: left; margin: 0; @@ -87,6 +94,7 @@ font-size: 12px; padding: 9px 12px; position: relative; + -webkit-transition: color ease 0.5s; transition: color ease 0.5s; } .pronamic-pay-status-list li a strong { @@ -477,5 +485,3 @@ body.post-type-pronamic_payment #post-body-content, body.post-type-pronamic_pay_ .pronamic-pay-cloack { display: none; } - -/*# sourceMappingURL=admin.css.map */ diff --git a/css/admin.min.css b/css/admin.min.css index a157f8ac..aac5c192 100644 --- a/css/admin.min.css +++ b/css/admin.min.css @@ -1 +1 @@ -.pronamic-pay-btn-link{line-height:26px;padding:0 10px 1px}.postbox .pronamic-pay-chart-with-sidebar{padding:12px 12px 12px 249px}.pronamic-pay-chart-sidebar{float:left;margin-left:-237px;width:225px}.pronamic-pay-chart-legend{background:#fff;border-color:#e5e5e5;border-style:solid;border-width:1px 0 0 1px;list-style:none;margin:0 0 1em;padding:0}.pronamic-pay-chart-legend li{border-right:5px solid #aaa;-webkit-box-shadow:inset 0 -1px 0 0 #e5e5e5;box-shadow:inset 0 -1px 0 0 #e5e5e5;color:#aaa;display:block;margin:0;padding:1em;-webkit-transition-duration:.5s;transition-duration:.5s;-webkit-transition-property:border,padding,-webkit-box-shadow;transition-property:border,padding,-webkit-box-shadow;transition-property:border,box-shadow,padding;transition-property:border,box-shadow,padding,-webkit-box-shadow}.pronamic-pay-chart-legend li.completed-count{border-right-color:#dbe1e3}.pronamic-pay-chart-legend li.pending-sum{border-right-color:#b1d4ea}.pronamic-pay-chart-legend li.completed-sum{border-right-color:#3498db}.pronamic-pay-chart-legend li.cancelled-sum{border-right-color:#f1c40f}.pronamic-pay-chart-legend li.expired-sum{border-right-color:#dbe1e3}.pronamic-pay-chart-legend li.failed-sum{border-right-color:#e74c3c}.pronamic-pay-chart-legend li:hover{border-right-color:#23282f;-webkit-box-shadow:inset 0 -1px 0 0 #e5e5e5,inset 300px 0 0 #f9f9f9;box-shadow:inset 0 -1px 0 0 #e5e5e5,inset 300px 0 0 #f9f9f9;padding-left:1.5em}.pronamic-pay-chart-legend strong{color:#444;display:block;font-size:1.618em;font-weight:400;line-height:1.2em}.postbox .inside .pronamic-pay-status-widget{margin:-12px}.pronamic-pay-status-list{margin-bottom:0;overflow:hidden}.pronamic-pay-status-list li{border-top:1px solid #eee;-webkit-box-sizing:border-box;box-sizing:border-box;color:#aaa;float:left;margin:0;padding:0;width:50%}.pronamic-pay-status-list li a{color:#aaa;display:block;font-size:12px;padding:9px 12px;position:relative;-webkit-transition:color .5s ease;transition:color .5s ease}.pronamic-pay-status-list li a strong{color:#0073aa;display:block;font-size:18px;font-weight:400;line-height:1.2em}.pronamic-pay-status-list li a:hover,.pronamic-pay-status-list li a:hover:before,.pronamic-pay-status-list li a:hover strong{color:#00a0d2}.pronamic-pay-status-list li:first-child{border-top:0;width:100%}.pronamic-pay-status-list li:nth-child(2n){border-right:1px solid #eee}body.post-type-pronamic_pay_subscr #post-body-content,body.post-type-pronamic_payment #post-body-content{margin-bottom:0}.pronamic-pay-form-control-lg,.pronamic-pay-shortcode-input{width:100%}.pronamic-pay-form-control-file-button [type=file]{border:0;clip:rect(0,0,0,0);margin:-1px;padding:0;overflow:hidden;position:absolute;width:1px;height:1px}.pronamic-pay-icon{position:relative;text-indent:-9999px;width:1em;height:1em}.pronamic-pay-icon:after{content:"\f10b";display:block;font-family:Pronamic Pay Icons;position:absolute;top:0;left:0;speak:none;text-indent:0;width:100%;height:100%}.pronamic-pay-icon-pending:after{color:#ffba00;content:"\f10a"}.pronamic-pay-icon-cancelled:after{color:#a00;content:"\f106"}.pronamic-pay-icon-processing:after{color:#73a724;content:"\f10b"}.pronamic-pay-icon-completed:after{color:#2ea2cc;content:"\f107"}.pronamic-pay-icon-refunded:after{color:#999;content:"\f10c"}.pronamic-pay-icon-failed:after{color:#d0c21f;content:"\f108"}.pronamic-pay-icon-on-hold:after{color:#999;content:"\f109"}.pronamic-pay-icon-recurring:after{color:#999;content:"\f105"}.pronamic-pay-icon-recurring-first:after{color:#2ea2cc;content:"\f105"}.pronamic-pay-icon-question-mark:after{color:#999;content:"\f104"}.pronamic-pay-payment-methods.form-table.widefat{border-right:0;border-bottom:0;border-left:0;margin:-15px -10px;width:calc(100% + 20px)}.pronamic-pay-payment-methods thead th:first-of-type{width:60%}.pronamic-pay-payment-methods .pronamic-pay-icon{line-height:inherit}.pronamic-pay-payment-methods .pronamic-pay-icon-completed:after{color:#73a724}.pronamic-pay-payment-methods .pronamic-pay-icon-cancelled:after{color:#aaa}@media screen and (max-width:782px){.pronamic-pay-payment-methods.form-table th{display:table-cell}.pronamic-pay-payment-methods.form-table th:first-of-type{width:50%}.pronamic-pay-payment-methods.form-table td{display:table-cell}}.gateway-config-section-header h4{margin:0}.gateway-config-section-header p{margin:0 0 1em}.gateway-config-section-header p:last-child{margin-bottom:0}.pronamic-pay-test-payment-method td label{display:none}#pronamic_payment_log.postbox .inside{margin:0;padding:0}#pronamic_payment_log .comments-box{border:0}#pronamic_subscription.postbox input[name=pronamic_subscription_amount]{vertical-align:initial}#pronamic_payment_update .inside,#pronamic_subscription_update .inside{margin:0;padding:0}.pronamic-pay-inner{margin:6px 0 0}.pronamic-pay-major-actions{background:#f5f5f5;border-top:1px solid #ddd;padding:10px}.pronamic-pay-action{float:right;text-align:right}#pronamic-pay-next-payment-date-display,#pronamic-pay-post-status-display{font-weight:600}#pronamic-pay-next-payment-date-input,#pronamic-pay-post-status-input{margin-top:3px}.pronamic-pay-settings select{width:25em}.pronamic-pay-table-responsive{overflow-x:auto}.pronamic-pay-table thead th{font-weight:700}.pronamic-pay-table .deprecated a,.pronamic-pay-table .deprecated td{color:#aaa}.pronamic-pay-table td p{margin:0 0 1em}.pronamic-pay-table td p:last-child{margin-bottom:0}.postbox .pronamic-pay-table{border:0}.form-table .even,.pronamic-pay-table-striped tbody tr:nth-of-type(odd){background:#f9f9f9}#pronamic_payment .form-table td a{display:inline-block;overflow:hidden;width:350px;text-overflow:ellipsis;white-space:nowrap}.pronamic-pay-status-table{margin-top:2em}.pronamic-pay-status-table tbody th:first-child{width:20%}.widefat .column-pronamic_payment_status,.widefat .column-pronamic_payment_subscription,.widefat .column-pronamic_subscription_status{width:1em}.widefat .column-pronamic_payment_method,.widefat .column-pronamic_subscription_method{width:2.5em}@media only screen and (max-width:782px){.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status{display:table-cell}.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status:before,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription:before,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status:before{display:none}.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_subscription_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_subscription_status{display:table-cell!important}}.pronamic-pay-tabs-items{border-bottom:1px solid #e5e5e5;display:block;float:left;margin:3px 0 0;width:100%}.pronamic-pay-tabs-items li{background:#e5e5e5;border-right:1px solid #e5e5e5;border-left:1px solid #e5e5e5;cursor:pointer;display:block;float:left;margin:0 5px -1px 0;padding:8px 15px}.pronamic-pay-tabs-items li.active{background:#fff;border-top:3px solid #008ec2;margin-top:-3px}.admin-color-fresh .pronamic-pay-tabs-items li.active{border-top-color:#2271b1}.admin-color-light .pronamic-pay-tabs-items li.active{border-top-color:#888}.admin-color-modern .pronamic-pay-tabs-items li.active{border-top-color:#3858e9}.admin-color-blue .pronamic-pay-tabs-items li.active{border-top-color:#096484}.admin-color-coffee .pronamic-pay-tabs-items li.active{border-top-color:#c7a589}.admin-color-ectoplasm .pronamic-pay-tabs-items li.active{border-top-color:#a3b745}.admin-color-midnight .pronamic-pay-tabs-items li.active{border-top-color:#e14d43}.admin-color-ocean .pronamic-pay-tabs-items li.active{border-top-color:#9ebaa0}.admin-color-sunrise .pronamic-pay-tabs-items li.active{border-top-color:#dd823b}.pronamic-pay-tab{border:1px solid #e5e5e5;border-top:0;clear:both}.pronamic-pay-tab .form-table{margin-top:0}.pronamic-pay-tab .form-table th{padding-left:10px}.pronamic-pay-tab-block{padding:15px 10px}@media only screen and (max-width:960px){.pronamic-pay-tabs-items{display:none}.pronamic-pay-tab,.pronamic-pay-tab .form-table{border:0}}@media only screen and (max-width:782px){.pronamic-pay-tab .form-table td,.pronamic-pay-tab .form-table th{padding:11px}}.pronamic-pay-text-success{color:green}.pronamic-pay-text-danger{color:red}.pronamic-pay-text-warning{color:orange}:not(a).pronamic-pay-tip{color:#777;cursor:help}.form-table th .pronamic-pay-tip{float:right}.pronamic-pay-cloack{display:none} +.pronamic-pay-btn-link{line-height:26px;padding:0 10px 1px}.postbox .pronamic-pay-chart-with-sidebar{padding:12px 12px 12px 249px}.pronamic-pay-chart-sidebar{float:left;margin-left:-237px;width:225px}.pronamic-pay-chart-legend{background:#fff;border-color:#e5e5e5;border-style:solid;border-width:1px 0 0 1px;list-style:none;margin:0 0 1em;padding:0}.pronamic-pay-chart-legend li{border-right:5px solid #aaa;-webkit-box-shadow:inset 0 -1px 0 0 #e5e5e5;box-shadow:inset 0 -1px 0 0 #e5e5e5;color:#aaa;display:block;margin:0;padding:1em;-webkit-transition-duration:.5s;transition-duration:.5s;-webkit-transition-property:border,padding,-webkit-box-shadow;transition-property:border,padding,-webkit-box-shadow;transition-property:border,box-shadow,padding;transition-property:border,box-shadow,padding,-webkit-box-shadow}.pronamic-pay-chart-legend li.completed-count{border-right-color:#dbe1e3}.pronamic-pay-chart-legend li.pending-sum{border-right-color:#b1d4ea}.pronamic-pay-chart-legend li.completed-sum{border-right-color:#3498db}.pronamic-pay-chart-legend li.cancelled-sum{border-right-color:#f1c40f}.pronamic-pay-chart-legend li.expired-sum{border-right-color:#dbe1e3}.pronamic-pay-chart-legend li.failed-sum{border-right-color:#e74c3c}.pronamic-pay-chart-legend li:hover{border-right-color:#23282f;-webkit-box-shadow:inset 0 -1px 0 0 #e5e5e5,inset 300px 0 0 #f9f9f9;box-shadow:inset 0 -1px 0 0 #e5e5e5,inset 300px 0 0 #f9f9f9;padding-left:1.5em}.pronamic-pay-chart-legend strong{color:#444;display:block;font-size:1.618em;font-weight:400;line-height:1.2em}.postbox .inside .pronamic-pay-status-widget{margin:-12px}.pronamic-pay-status-list{margin-bottom:0;overflow:hidden}.pronamic-pay-status-list li{border-top:1px solid #eee;-webkit-box-sizing:border-box;box-sizing:border-box;color:#aaa;float:left;margin:0;padding:0;width:50%}.pronamic-pay-status-list li a{color:#aaa;display:block;font-size:12px;padding:9px 12px;position:relative;-webkit-transition:color .5s ease;transition:color .5s ease}.pronamic-pay-status-list li a strong{color:#0073aa;display:block;font-size:18px;font-weight:400;line-height:1.2em}.pronamic-pay-status-list li a:hover,.pronamic-pay-status-list li a:hover:before,.pronamic-pay-status-list li a:hover strong{color:#00a0d2}.pronamic-pay-status-list li:first-child{border-top:0;width:100%}.pronamic-pay-status-list li:nth-child(2n){border-right:1px solid #eee}body.post-type-pronamic_pay_subscr #post-body-content,body.post-type-pronamic_payment #post-body-content{margin-bottom:0}.pronamic-pay-form-control-lg,.pronamic-pay-shortcode-input{width:100%}.pronamic-pay-form-control-file-button [type=file]{border:0;clip:rect(0,0,0,0);margin:-1px;padding:0;overflow:hidden;position:absolute;width:1px;height:1px}.pronamic-pay-icon{position:relative;text-indent:-9999px;width:1em;height:1em}.pronamic-pay-icon:after{content:"\f10b";display:block;font-family:Pronamic Pay Icons;position:absolute;top:0;left:0;speak:none;text-indent:0;width:100%;height:100%}.pronamic-pay-icon-pending:after{color:#ffba00;content:"\f10a"}.pronamic-pay-icon-cancelled:after{color:#a00;content:"\f106"}.pronamic-pay-icon-processing:after{color:#73a724;content:"\f10b"}.pronamic-pay-icon-completed:after{color:#2ea2cc;content:"\f107"}.pronamic-pay-icon-refunded:after{color:#999;content:"\f10c"}.pronamic-pay-icon-failed:after{color:#d0c21f;content:"\f108"}.pronamic-pay-icon-on-hold:after{color:#999;content:"\f109"}.pronamic-pay-icon-recurring:after{color:#999;content:"\f105"}.pronamic-pay-icon-recurring-first:after{color:#2ea2cc;content:"\f105"}.pronamic-pay-icon-question-mark:after{color:#999;content:"\f104"}.pronamic-pay-payment-methods.form-table.widefat{border-right:0;border-bottom:0;border-left:0;margin:-15px -10px;width:calc(100% + 20px)}.pronamic-pay-payment-methods thead th:first-of-type{width:60%}.pronamic-pay-payment-methods .pronamic-pay-icon{line-height:inherit}.pronamic-pay-payment-methods .pronamic-pay-icon-completed:after{color:#73a724}.pronamic-pay-payment-methods .pronamic-pay-icon-cancelled:after{color:#aaa}@media screen and (max-width:782px){.pronamic-pay-payment-methods.form-table th{display:table-cell}.pronamic-pay-payment-methods.form-table th:first-of-type{width:50%}.pronamic-pay-payment-methods.form-table td{display:table-cell}}.gateway-config-section-header h4{margin:0}.gateway-config-section-header p{margin:0 0 1em}.gateway-config-section-header p:last-child{margin-bottom:0}.pronamic-pay-test-payment-method td label{display:none}#pronamic_payment_log.postbox .inside{margin:0;padding:0}#pronamic_payment_log .comments-box{border:0}#pronamic_subscription.postbox input[name=pronamic_subscription_amount]{vertical-align:initial}#pronamic_payment_update .inside,#pronamic_subscription_update .inside{margin:0;padding:0}.pronamic-pay-inner{margin:6px 0 0}.pronamic-pay-major-actions{background:#f5f5f5;border-top:1px solid #ddd;padding:10px}.pronamic-pay-action{float:right;text-align:right}#pronamic-pay-next-payment-date-display,#pronamic-pay-post-status-display{font-weight:600}#pronamic-pay-next-payment-date-input,#pronamic-pay-post-status-input{margin-top:3px}.pronamic-pay-settings select{width:25em}.pronamic-pay-table-responsive{overflow-x:auto}.pronamic-pay-table thead th{font-weight:700}.pronamic-pay-table .deprecated a,.pronamic-pay-table .deprecated td{color:#aaa}.pronamic-pay-table td p{margin:0 0 1em}.pronamic-pay-table td p:last-child{margin-bottom:0}.postbox .pronamic-pay-table{border:0}.form-table .even,.pronamic-pay-table-striped tbody tr:nth-of-type(odd){background:#f9f9f9}#pronamic_payment .form-table td a{display:inline-block;overflow:hidden;width:350px;text-overflow:ellipsis;white-space:nowrap}.pronamic-pay-status-table{margin-top:2em}.pronamic-pay-status-table tbody th:first-child{width:20%}.widefat .column-pronamic_payment_status,.widefat .column-pronamic_payment_subscription,.widefat .column-pronamic_subscription_status{width:1em}.widefat .column-pronamic_payment_method,.widefat .column-pronamic_subscription_method{width:2.5em}@media only screen and (max-width:782px){.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_method,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_method,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_method,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_method,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status{display:table-cell}.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_method:before,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status:before,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription:before,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_method:before,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_method:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_status:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_payment_subscription:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_method:before,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items) td:not(.column-primary).column-pronamic_subscription_status:before{display:none}.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_method,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_subscription_method,.wp-list-table tr.type-pronamic_pay_subscr:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_subscription_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_method,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_status,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_payment_subscription,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_subscription_method,.wp-list-table tr.type-pronamic_payment:not(.inline-edit-row):not(.no-items).is-expanded td:not(.hidden).column-pronamic_subscription_status{display:table-cell!important}}.pronamic-pay-tabs-items{border-bottom:1px solid #e5e5e5;display:block;float:left;margin:3px 0 0;width:100%}.pronamic-pay-tabs-items li{background:#e5e5e5;border-right:1px solid #e5e5e5;border-left:1px solid #e5e5e5;cursor:pointer;display:block;float:left;margin:0 5px -1px 0;padding:8px 15px}.pronamic-pay-tabs-items li.active{background:#fff;border-top:3px solid #008ec2;margin-top:-3px}.admin-color-fresh .pronamic-pay-tabs-items li.active{border-top-color:#2271b1}.admin-color-light .pronamic-pay-tabs-items li.active{border-top-color:#888}.admin-color-modern .pronamic-pay-tabs-items li.active{border-top-color:#3858e9}.admin-color-blue .pronamic-pay-tabs-items li.active{border-top-color:#096484}.admin-color-coffee .pronamic-pay-tabs-items li.active{border-top-color:#c7a589}.admin-color-ectoplasm .pronamic-pay-tabs-items li.active{border-top-color:#a3b745}.admin-color-midnight .pronamic-pay-tabs-items li.active{border-top-color:#e14d43}.admin-color-ocean .pronamic-pay-tabs-items li.active{border-top-color:#9ebaa0}.admin-color-sunrise .pronamic-pay-tabs-items li.active{border-top-color:#dd823b}.pronamic-pay-tab{border:1px solid #e5e5e5;border-top:0;clear:both}.pronamic-pay-tab .form-table{margin-top:0}.pronamic-pay-tab .form-table th{padding-left:10px}.pronamic-pay-tab-block{padding:15px 10px}@media only screen and (max-width:960px){.pronamic-pay-tabs-items{display:none}.pronamic-pay-tab,.pronamic-pay-tab .form-table{border:0}}@media only screen and (max-width:782px){.pronamic-pay-tab .form-table td,.pronamic-pay-tab .form-table th{padding:11px}}.pronamic-pay-text-success{color:green}.pronamic-pay-text-danger{color:red}.pronamic-pay-text-warning{color:orange}:not(a).pronamic-pay-tip{color:#777;cursor:help}.form-table th .pronamic-pay-tip{float:right}.pronamic-pay-cloack{display:none} diff --git a/css/card-slider.css b/css/card-slider.css index e262f7fb..05d10405 100644 --- a/css/card-slider.css +++ b/css/card-slider.css @@ -1,7 +1,8 @@ @charset "UTF-8"; .pp-card-slider-container *, .pp-new-payment-method-container * { - box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; } .pp-card-slider-container input[type=submit], .pp-card-slider-container select, @@ -14,7 +15,8 @@ .pp-new-payment-method-wrapper { background: #fff; border-radius: 20px; - box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); color: #333; max-width: 600px; margin: 3em auto 0 auto; @@ -29,13 +31,15 @@ max-width: 600px; } .pp-card-container * { - box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; } .pp-card { background: #000; border-radius: 10px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); font-family: sans-serif; margin: 0; padding-top: 56.25%; @@ -45,9 +49,16 @@ .pp-card .pp-card__content { color: #fff; cursor: pointer; + display: -webkit-box; + display: -ms-flexbox; display: flex; - flex-direction: column; - justify-content: space-between; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; margin: 0; padding: 8%; position: absolute; @@ -59,7 +70,8 @@ .pp-card .pp-card__content .pt-card__indicator { background: #fff; border-radius: 100%; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); color: #81cf1f; content: ""; line-height: 40px; @@ -68,6 +80,7 @@ top: 20px; right: 20px; text-align: center; + -webkit-transition: opacity 0.2s; transition: opacity 0.2s; width: 40px; height: 40px; @@ -231,8 +244,12 @@ } .slick-dots { + display: -webkit-box; + display: -ms-flexbox; display: flex; - justify-content: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; list-style: none; margin: 30px 0 0; padding: 0; @@ -281,5 +298,3 @@ color: #f9461c; opacity: 1; } - -/*# sourceMappingURL=card-slider.css.map */ diff --git a/css/card-slider.min.css b/css/card-slider.min.css index be2dd9a9..abe98403 100644 --- a/css/card-slider.min.css +++ b/css/card-slider.min.css @@ -1 +1 @@ -@charset "UTF-8";.pp-card-slider-container *,.pp-new-payment-method-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.pp-card-slider-container input[type=submit],.pp-card-slider-container select,.pp-new-payment-method-container input[type=submit],.pp-new-payment-method-container select{padding:10px}.pp-card-slider-wrapper,.pp-new-payment-method-wrapper{background:#fff;border-radius:20px;-webkit-box-shadow:0 0 20px rgba(0,0,0,.1);box-shadow:0 0 20px rgba(0,0,0,.1);color:#333;max-width:600px;margin:3em auto 0;padding:40px}.pp-card-slider{margin:0 -40px}.pp-card-container{max-width:600px}.pp-card-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.pp-card{background:#000;border-radius:10px;-webkit-box-shadow:0 0 10px rgba(0,0,0,.1);box-shadow:0 0 10px rgba(0,0,0,.1);font-family:sans-serif;margin:0;padding-top:56.25%;overflow:hidden;position:relative}.pp-card .pp-card__content{color:#fff;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin:0;padding:8%;position:absolute;top:0;left:0;width:100%;height:100%}.pp-card .pp-card__content .pt-card__indicator{background:#fff;border-radius:100%;-webkit-box-shadow:0 0 10px rgba(0,0,0,.1);box-shadow:0 0 10px rgba(0,0,0,.1);color:#81cf1f;content:"";line-height:40px;opacity:0;position:absolute;top:20px;right:20px;text-align:center;-webkit-transition:opacity .2s;transition:opacity .2s;width:40px;height:40px}.pp-card .pp-card__content .pt-card__indicator:after{content:"✓"}.pp-card .pp-card__input{position:absolute;left:-9999px}.pp-card .pp-card__input:checked+.pt-card__indicator{opacity:1}.pp-card .pp-card__title{display:none}.pp-card .pp-card__name,.pp-card .pp-card__number{margin:0}.pp-card .pp-card__label{font-size:14px;font-weight:400;opacity:.6;margin:0}.pp-card .pp-card__value{font-family:Roboto Mono;font-size:20px;margin:0}.pp-card .pp-card__logo{margin:0;padding:0}.pp-card .pp-card__logo img{max-width:20%;height:auto}.pp-card .pp-card__background{background-position:50%;background-repeat:no-repeat;background-size:cover;position:absolute;top:0;left:0;width:100%;height:100%}.pp-card.brand-american-express .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/american-express/card-american-express-background-480x270.svg)}.pp-card.brand-carta-si .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/carta-si/card-carta-si-background-480x270.svg)}.pp-card.brand-carte-bleue .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/carte-bleue/card-carte-bleue-background-480x270.svg)}.pp-card.brand-dankort .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/dankort/card-dankort-background-480x270.svg)}.pp-card.brand-diners-club .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/diners-club/card-diners-club-background-480x270.svg)}.pp-card.brand-diners-club .pp-card__content{color:#000}.pp-card.brand-discover .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/discover/card-discover-background-480x270.svg)}.pp-card.brand-discover .pp-card__content{color:#000}.pp-card.brand-jcb .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/jcb/card-jcb-background-480x270.svg)}.pp-card.brand-maestro .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/maestro/card-maestro-background-480x270.svg)}.pp-card.brand-mastercard .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/mastercard/card-mastercard-background-480x270.svg)}.pp-card.brand-mastercard .pp-card__content{color:#000}.pp-card.brand-unionpay .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/unionpay/card-unionpay-background-480x270.svg)}.pp-card.brand-unionpay .pp-card__content{color:#000}.pp-card.brand-visa .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/visa/card-visa-background-480x270.svg)}.pp-card.brand-abn-amro .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/abn-amro/card-abn-amro-background-480x270.svg)}.pp-card.brand-abn-amro .pp-card__value{color:#000}.pp-card.brand-asn-bank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/asn-bank/card-asn-bank-background-480x270.svg)}.pp-card.brand-asn-bank .pp-card__content{color:#000;opacity:.6}.pp-card.brand-bunq .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/bunq/card-bunq-background-480x270.svg)}.pp-card.brand-handelsbanken .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/handelsbanken/card-handelsbanken-background-480x270.svg)}.pp-card.brand-ing .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/ing/card-ing-background-480x270.svg)}.pp-card.brand-ing .pp-card__value{color:#000}.pp-card.brand-knab .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/knab/card-knab-background-480x270.svg)}.pp-card.brand-knab .pp-card__label{color:#ec5f7d}.pp-card.brand-knab .pp-card__value{color:#003b5a}.pp-card.brand-moneyou .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/moneyou/card-moneyou-background-480x270.svg)}.pp-card.brand-moneyou .pp-card__label{color:#000;opacity:.4}.pp-card.brand-moneyou .pp-card__value{color:#000}.pp-card.brand-rabobank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/rabobank/card-rabobank-background-480x270.svg)}.pp-card.brand-rabobank .pp-card__content{color:#000}.pp-card.brand-regiobank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/regiobank/card-regiobank-background-480x270.svg)}.pp-card.brand-regiobank .pp-card__value{color:#000}.pp-card.brand-sns .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/sns/card-sns-background-480x270.svg)}.pp-card.brand-triodos-bank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/triodos-bank/card-triodos-bank-background-480x270.svg)}.pp-card.brand-triodos-bank .pp-card__content{color:#000}.pp-card.brand-van-lanschot .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.5.0/dist/cards/van-lanschot/card-van-lanschot-background-480x270.svg)}.slick-slide{padding:0 15px;outline:none}.slick-slide.slick-current .pt-card__indicator{opacity:1}.slick-dots{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;list-style:none;margin:30px 0 0;padding:0}.slick-dots li{margin:0 5px;position:relative}.slick-dots li,.slick-dots li button{cursor:pointer;display:block;width:20px;height:20px}.slick-dots li button{background:transparent;border:0;color:transparent;font-size:0;line-height:0;outline:none;padding:5px}.slick-dots li button:before{color:#f9461c;content:"•";font-size:20px;line-height:20px;opacity:.25;position:absolute;top:0;left:0;width:20px;height:20px;text-align:center}.slick-dots li button:focus,.slick-dots li button:hover{outline:none}.slick-dots li button:focus:before,.slick-dots li button:hover:before{opacity:1}.slick-dots li.slick-active button:before{color:#f9461c;opacity:1} +@charset "UTF-8";.pp-card-slider-container *,.pp-new-payment-method-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.pp-card-slider-container input[type=submit],.pp-card-slider-container select,.pp-new-payment-method-container input[type=submit],.pp-new-payment-method-container select{padding:10px}.pp-card-slider-wrapper,.pp-new-payment-method-wrapper{background:#fff;border-radius:20px;-webkit-box-shadow:0 0 20px rgba(0,0,0,.1);box-shadow:0 0 20px rgba(0,0,0,.1);color:#333;max-width:600px;margin:3em auto 0;padding:40px}.pp-card-slider{margin:0 -40px}.pp-card-container{max-width:600px}.pp-card-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.pp-card{background:#000;border-radius:10px;-webkit-box-shadow:0 0 10px rgba(0,0,0,.1);box-shadow:0 0 10px rgba(0,0,0,.1);font-family:sans-serif;margin:0;padding-top:56.25%;overflow:hidden;position:relative}.pp-card .pp-card__content{color:#fff;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin:0;padding:8%;position:absolute;top:0;left:0;width:100%;height:100%}.pp-card .pp-card__content .pt-card__indicator{background:#fff;border-radius:100%;-webkit-box-shadow:0 0 10px rgba(0,0,0,.1);box-shadow:0 0 10px rgba(0,0,0,.1);color:#81cf1f;content:"";line-height:40px;opacity:0;position:absolute;top:20px;right:20px;text-align:center;-webkit-transition:opacity .2s;transition:opacity .2s;width:40px;height:40px}.pp-card .pp-card__content .pt-card__indicator:after{content:"✓"}.pp-card .pp-card__input{position:absolute;left:-9999px}.pp-card .pp-card__input:checked+.pt-card__indicator{opacity:1}.pp-card .pp-card__title{display:none}.pp-card .pp-card__name,.pp-card .pp-card__number{margin:0}.pp-card .pp-card__label{font-size:14px;font-weight:400;opacity:.6;margin:0}.pp-card .pp-card__value{font-family:Roboto Mono;font-size:20px;margin:0}.pp-card .pp-card__logo{margin:0;padding:0}.pp-card .pp-card__logo img{max-width:20%;height:auto}.pp-card .pp-card__background{background-position:50%;background-repeat:no-repeat;background-size:cover;position:absolute;top:0;left:0;width:100%;height:100%}.pp-card.brand-american-express .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/american-express/card-american-express-background-480x270.svg)}.pp-card.brand-carta-si .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/carta-si/card-carta-si-background-480x270.svg)}.pp-card.brand-carte-bleue .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/carte-bleue/card-carte-bleue-background-480x270.svg)}.pp-card.brand-dankort .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/dankort/card-dankort-background-480x270.svg)}.pp-card.brand-diners-club .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/diners-club/card-diners-club-background-480x270.svg)}.pp-card.brand-diners-club .pp-card__content{color:#000}.pp-card.brand-discover .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/discover/card-discover-background-480x270.svg)}.pp-card.brand-discover .pp-card__content{color:#000}.pp-card.brand-jcb .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/jcb/card-jcb-background-480x270.svg)}.pp-card.brand-maestro .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/maestro/card-maestro-background-480x270.svg)}.pp-card.brand-mastercard .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/mastercard/card-mastercard-background-480x270.svg)}.pp-card.brand-mastercard .pp-card__content{color:#000}.pp-card.brand-unionpay .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/unionpay/card-unionpay-background-480x270.svg)}.pp-card.brand-unionpay .pp-card__content{color:#000}.pp-card.brand-visa .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/visa/card-visa-background-480x270.svg)}.pp-card.brand-abn-amro .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/abn-amro/card-abn-amro-background-480x270.svg)}.pp-card.brand-abn-amro .pp-card__value{color:#000}.pp-card.brand-asn-bank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/asn-bank/card-asn-bank-background-480x270.svg)}.pp-card.brand-asn-bank .pp-card__content{color:#000;opacity:.6}.pp-card.brand-bunq .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/bunq/card-bunq-background-480x270.svg)}.pp-card.brand-handelsbanken .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/handelsbanken/card-handelsbanken-background-480x270.svg)}.pp-card.brand-ing .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/ing/card-ing-background-480x270.svg)}.pp-card.brand-ing .pp-card__value{color:#000}.pp-card.brand-knab .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/knab/card-knab-background-480x270.svg)}.pp-card.brand-knab .pp-card__label{color:#ec5f7d}.pp-card.brand-knab .pp-card__value{color:#003b5a}.pp-card.brand-rabobank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/rabobank/card-rabobank-background-480x270.svg)}.pp-card.brand-rabobank .pp-card__content{color:#000}.pp-card.brand-regiobank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/regiobank/card-regiobank-background-480x270.svg)}.pp-card.brand-regiobank .pp-card__value{color:#000}.pp-card.brand-sns .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/sns/card-sns-background-480x270.svg)}.pp-card.brand-triodos-bank .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/triodos-bank/card-triodos-bank-background-480x270.svg)}.pp-card.brand-triodos-bank .pp-card__content{color:#000}.pp-card.brand-van-lanschot .pp-card__background{background-image:url(https://cdn.wp-pay.org/jsdelivr.net/npm/@wp-pay/logos@1.16.0/dist/cards/van-lanschot/card-van-lanschot-background-480x270.svg)}.slick-slide{padding:0 15px;outline:none}.slick-slide.slick-current .pt-card__indicator{opacity:1}.slick-dots{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;list-style:none;margin:30px 0 0;padding:0}.slick-dots li{margin:0 5px;position:relative}.slick-dots li,.slick-dots li button{cursor:pointer;display:block;width:20px;height:20px}.slick-dots li button{background:transparent;border:0;color:transparent;font-size:0;line-height:0;outline:none;padding:5px}.slick-dots li button:before{color:#f9461c;content:"•";font-size:20px;line-height:20px;opacity:.25;position:absolute;top:0;left:0;width:20px;height:20px;text-align:center}.slick-dots li button:focus,.slick-dots li button:hover{outline:none}.slick-dots li button:focus:before,.slick-dots li button:hover:before{opacity:1}.slick-dots li.slick-active button:before{color:#f9461c;opacity:1} diff --git a/css/forms.css b/css/forms.css index 65490b87..92a44abb 100644 --- a/css/forms.css +++ b/css/forms.css @@ -48,7 +48,8 @@ .pronamic-pay-error { background: #f9f9f9; border-left: 4px solid #a00; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); clear: both; margin: 15px 0; padding: 1em 1em 1em 2em; @@ -68,5 +69,3 @@ .pronamic-pay-payment-method-list input:checked + label + .pronamic-pay-payment-method-fields { display: block; } - -/*# sourceMappingURL=forms.css.map */ diff --git a/css/redirect.css b/css/redirect.css index d0d4fb27..2d37ae5a 100644 --- a/css/redirect.css +++ b/css/redirect.css @@ -26,12 +26,14 @@ body { color: #777; } .pronamic-pay-redirect-container .pp-page-section-container * { - box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; } .pronamic-pay-redirect-container .pp-page-section-container .pp-page-section-wrapper { background: #fff; border-radius: 20px; - box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); + -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); color: #333; max-width: 600px; margin: 3em auto 0 auto; @@ -41,20 +43,28 @@ body { margin-top: 0; } .pronamic-pay-redirect-container .pp-page-section-container .pp-page-section-wrapper dl { + display: -webkit-box; + display: -ms-flexbox; display: flex; - flex-flow: row wrap; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; } .pronamic-pay-redirect-container .pp-page-section-container .pp-page-section-wrapper dl dt, .pronamic-pay-redirect-container .pp-page-section-container .pp-page-section-wrapper dl dd { float: left; padding-bottom: 5px; } .pronamic-pay-redirect-container .pp-page-section-container .pp-page-section-wrapper dl dt { - flex-basis: 30%; + -ms-flex-preferred-size: 30%; + flex-basis: 30%; font-weight: bold; } .pronamic-pay-redirect-container .pp-page-section-container .pp-page-section-wrapper dl dd { - flex-basis: 70%; - margin-inline-start: 0; + -ms-flex-preferred-size: 70%; + flex-basis: 70%; + -webkit-margin-start: 0; + margin-inline-start: 0; } .pronamic-pay-redirect-container input[type=submit], .pronamic-pay-redirect-container select { @@ -94,5 +104,3 @@ hr { .alignleft { text-align: left; } - -/*# sourceMappingURL=redirect.css.map */ From 3bd2e275c479067d033192b9c686a53ad517c08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 12 Jun 2023 12:18:52 +0200 Subject: [PATCH 029/243] Use parameter type `DateTimeImmutable` to get period. --- src/Subscriptions/Subscription.php | 4 ++-- src/Subscriptions/SubscriptionPhase.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index 9bc88d12..2399cf17 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -809,10 +809,10 @@ public function get_phase_for_date( DateTimeInterface $date ) { /** * Get period for date. * - * @param DateTimeInterface $date Date. + * @param DateTimeImmutable $date Date. * @return SubscriptionPeriod|null */ - public function get_period_for_date( DateTimeInterface $date ) { + public function get_period_for_date( DateTimeImmutable $date ) { $phase = $this->get_phase_for_date( $date ); if ( null === $phase ) { diff --git a/src/Subscriptions/SubscriptionPhase.php b/src/Subscriptions/SubscriptionPhase.php index 07420285..c6e2caa0 100644 --- a/src/Subscriptions/SubscriptionPhase.php +++ b/src/Subscriptions/SubscriptionPhase.php @@ -425,7 +425,7 @@ public function all_periods_created() { /** * Check if this phase is completed to date. - * + * * @param DateTimeInterface|null $date Date. * @return bool True if phase is completed to date, false otherwise. */ @@ -471,7 +471,7 @@ private function add_interval( $date, $times = 1 ) { /** * Substract the interval of this subscription phase from the specified date. - * + * * @param DateTimeImmutable $date Date to substract interval period from. * @param int $times Number of times to substract interval. * @return DateTimeImmutable @@ -488,11 +488,11 @@ public function substract_interval( $date, $times = 1 ) { /** * Get period for the specified start date. - * - * @param DateTimeInterface $start_date Start date. + * + * @param DateTimeImmutable $start_date Start date. * @return SubscriptionPeriod|null */ - public function get_period( DateTimeInterface $start_date = null ) { + public function get_period( DateTimeImmutable $start_date = null ) { if ( null === $start_date ) { return null; } From 0465c1b5b18dbeaeb00224a859f928307c42e6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 12 Jun 2023 13:25:23 +0200 Subject: [PATCH 030/243] Remove unused method `substract_interval()`. --- src/Subscriptions/SubscriptionPhase.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/Subscriptions/SubscriptionPhase.php b/src/Subscriptions/SubscriptionPhase.php index c6e2caa0..f963fbbe 100644 --- a/src/Subscriptions/SubscriptionPhase.php +++ b/src/Subscriptions/SubscriptionPhase.php @@ -469,23 +469,6 @@ private function add_interval( $date, $times = 1 ) { return $date->add( $this->interval->multiply( $times ) ); } - /** - * Substract the interval of this subscription phase from the specified date. - * - * @param DateTimeImmutable $date Date to substract interval period from. - * @param int $times Number of times to substract interval. - * @return DateTimeImmutable - */ - public function substract_interval( $date, $times = 1 ) { - // If times is zero there is nothing to add. - if ( 0 === $times ) { - return $date; - } - - // Multiply date interval. - return $date->sub( $this->interval->multiply( $times ) ); - } - /** * Get period for the specified start date. * From 6308ab6efc6af243fe882a07e5cf4193249984f9 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:28:31 +0200 Subject: [PATCH 031/243] Register Billie payment method. Billie added in preparation to https://github.com/pronamic/wp-pronamic-pay-mollie/issues/29. --- src/Core/PaymentMethods.php | 8 ++++++++ src/Plugin.php | 1 + 2 files changed, 9 insertions(+) diff --git a/src/Core/PaymentMethods.php b/src/Core/PaymentMethods.php index 56147195..578f2f19 100644 --- a/src/Core/PaymentMethods.php +++ b/src/Core/PaymentMethods.php @@ -99,6 +99,13 @@ class PaymentMethods { */ const BELFIUS = 'belfius'; + /** + * Billie + * + * @var string + */ + const BILLIE = 'billie'; + /** * Billink * @@ -431,6 +438,7 @@ public static function get_payment_methods() { self::BANCONTACT => __( 'Bancontact', 'pronamic_ideal' ), self::BANK_TRANSFER => __( 'Bank Transfer', 'pronamic_ideal' ), self::BELFIUS => __( 'Belfius Direct Net', 'pronamic_ideal' ), + self::BILLIE => __( 'Billie', 'pronamic_ideal' ), self::BILLINK => __( 'Billink', 'pronamic_ideal' ), self::BITCOIN => __( 'Bitcoin', 'pronamic_ideal' ), self::BLIK => __( 'BLIK', 'pronamic_ideal' ), diff --git a/src/Plugin.php b/src/Plugin.php index 0bbdda5e..aead1201 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -349,6 +349,7 @@ public function __construct( $args = [] ) { $this->payment_methods->add( new PaymentMethod( PaymentMethods::BANCONTACT ) ); $this->payment_methods->add( new PaymentMethod( PaymentMethods::BANK_TRANSFER ) ); $this->payment_methods->add( new PaymentMethod( PaymentMethods::BELFIUS ) ); + $this->payment_methods->add( new PaymentMethod( PaymentMethods::BILLIE ) ); $this->payment_methods->add( new PaymentMethod( PaymentMethods::BILLINK ) ); $this->payment_methods->add( new PaymentMethod( PaymentMethods::BITCOIN ) ); $this->payment_methods->add( new PaymentMethod( PaymentMethods::BLIK ) ); From a26863b099739babe9e286049c593a2aeee2489a Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 14 Jun 2023 09:36:40 +0200 Subject: [PATCH 032/243] Allow null in next payment date. --- src/Subscriptions/Subscription.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Subscriptions/Subscription.php b/src/Subscriptions/Subscription.php index 2399cf17..f0dbc219 100644 --- a/src/Subscriptions/Subscription.php +++ b/src/Subscriptions/Subscription.php @@ -623,9 +623,7 @@ public static function from_json( $json, $subscription = null ) { $subscription->set_activated_at( $activated_at ); if ( \property_exists( $json, 'next_payment_date' ) ) { - if ( null !== $json->next_payment_date ) { - $subscription->set_next_payment_date( new DateTimeImmutable( $json->next_payment_date ) ); - } + $subscription->set_next_payment_date( null === $json->next_payment_date ? null : new DateTimeImmutable( $json->next_payment_date ) ); } return $subscription; From 872eab3bb4bc69cd1e42000451a31e5e3fc588ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 22 Jun 2023 12:09:39 +0200 Subject: [PATCH 033/243] Show payments without periods in subscription payments meta box. --- views/meta-box-subscription-payments.php | 104 +++++++++++++++++++---- 1 file changed, 88 insertions(+), 16 deletions(-) diff --git a/views/meta-box-subscription-payments.php b/views/meta-box-subscription-payments.php index c1f6c4f7..5ac3e48b 100644 --- a/views/meta-box-subscription-payments.php +++ b/views/meta-box-subscription-payments.php @@ -10,6 +10,7 @@ * @var \Pronamic\WordPress\Pay\Subscriptions\Subscription $subscription Subscription. */ +use Pronamic\WordPress\Pay\Payments\PaymentStatus; use Pronamic\WordPress\Pay\Plugin; use Pronamic\WordPress\Pay\Subscriptions\SubscriptionStatus; @@ -19,11 +20,9 @@ return; } -$periods = $subscription->get_payments_by_period(); - ?> - +get_payments() ) ) : ?> @@ -120,22 +119,96 @@ endif; - foreach ( $periods as $period ) : + $data = []; - $is_first = true; + foreach ( $subscription->get_payments() as $payment ) { + $key = sprintf( + '%s-%s', + $payment->get_date()->getTimestamp(), + $payment->get_id() + ); - $can_retry = $period['can_retry']; + $item = [ + 'period' => null, + 'payments' => [ + $key => $payment, + ], + ]; - $payments = $period['payments']; + // Maybe bundle payments for period. + $periods = $payment->get_periods(); - $period = $period['period']; + if ( null !== $periods ) { + foreach ( $periods as $period ) { + if ( $subscription->get_id() !== $period->get_phase()->get_subscription()->get_id() ) { + continue; + } - ?> + $item['period'] = $period; - + $key = $period->get_start_date()->getTimestamp(); - get_date()->getTimestamp(), + $payment->get_id() + ); + + $result[ $key ] = $item; + } + + // Sort items by date. + \krsort( $result ); + + foreach ( $result as $sort_key => $item ) : + $period = $item['period']; + + $is_first = ( null !== $period ); + + foreach ( $item['payments'] as $payment ) : $payment_id = $payment->get_id(); $payments_post_type = get_post_type( $payment_id ); @@ -148,15 +221,14 @@ human_readable_range() ); endif; ?> - - human_readable_range() ); ?> @@ -172,7 +244,7 @@ - subscriptions_module->can_retry_payment( $payment ) ) : ?> + subscriptions_module->can_retry_payment( $payment ) ) : ?>   From 5307f8973c288089d2ddce5d1b30012cdfb1af40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 22 Jun 2023 12:25:52 +0200 Subject: [PATCH 034/243] Fix PHPStan issues. --- composer.json | 2 +- views/meta-box-subscription-payments.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 0f41e626..618d12b1 100644 --- a/composer.json +++ b/composer.json @@ -91,7 +91,7 @@ "phpcs": "XDEBUG_MODE=off vendor/bin/phpcs -s -v", "phplint": "vendor/bin/phplint", "phpmd": "vendor/bin/phpmd src,tests text phpmd.ruleset.xml --suffixes php", - "phpstan": "vendor/bin/phpstan analyse --memory-limit=-1", + "phpstan": "XDEBUG_MODE=off vendor/bin/phpstan analyse --memory-limit=-1", "phpunit": "vendor/bin/phpunit --colors=always", "psalm": "vendor/bin/psalm", "xmllint-phpcs": "xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist", diff --git a/views/meta-box-subscription-payments.php b/views/meta-box-subscription-payments.php index 5ac3e48b..b3119e46 100644 --- a/views/meta-box-subscription-payments.php +++ b/views/meta-box-subscription-payments.php @@ -149,7 +149,7 @@ $key = $period->get_start_date()->getTimestamp(); // Add payment if period already exists in data. - if ( \array_key_exists( $key, $data ) ) { + if ( \array_key_exists( $key, $data ) && array_key_exists( 'payments', $data[ $key ] ) && array_key_exists( 'payments', $item ) ) { $data[ $key ]['payments'] = $data[ $key ]['payments'] + $item['payments']; $item = null; @@ -169,6 +169,10 @@ $result = []; foreach ( $data as $item ) { + if ( ! array_key_exists( 'payments', $item ) ) { + continue; + } + \ksort( $item['payments'] ); // Determine wether payment for period can be retried. @@ -206,7 +210,7 @@ foreach ( $result as $sort_key => $item ) : $period = $item['period']; - $is_first = ( null !== $period ); + $is_first = true; foreach ( $item['payments'] as $payment ) : $payment_id = $payment->get_id(); @@ -244,7 +248,7 @@ - subscriptions_module->can_retry_payment( $payment ) ) : ?> + subscriptions_module->can_retry_payment( $payment ) ) : ?>   From eb91cc44d62058b2d3e7dbce0965c5900ef50cec Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 22 Jun 2023 15:59:12 +0200 Subject: [PATCH 035/243] Slightly shorter. --- views/meta-box-subscription-payments.php | 191 ++++++++++------------- 1 file changed, 81 insertions(+), 110 deletions(-) diff --git a/views/meta-box-subscription-payments.php b/views/meta-box-subscription-payments.php index b3119e46..c6c94a34 100644 --- a/views/meta-box-subscription-payments.php +++ b/views/meta-box-subscription-payments.php @@ -20,9 +20,78 @@ return; } -?> +$payments = $subscription->get_payments(); + +$data = []; + +foreach ( $payments as $payment ) { + $periods = (array) $payment->get_periods(); + + /** + * A payment can be for multiple and different subscription periods. + * Here we only want to show the periods of this subscription and + * therefore we filter out other periods. + */ + $periods = \array_filter( + $periods, + function( $period ) use ( $subscription ) { + return ( $subscription->get_id() === $period->get_phase()->get_subscription()->get_id() ); + } + ); + + if ( 0 === count( $periods ) ) { + $key = 'payment-' . $payment->get_id(); + + $data[ $key ] = (object) [ + 'date' => $payment->get_date(), + 'payments' => [ $payment ], + 'period' => null, + ]; + } + + foreach ( $periods as $period ) { + $key = 'period-' . $period->get_start_date()->getTimestamp(); + + if ( ! array_key_exists( $key, $data ) ) { + $data[ $key ] = (object) [ + 'date' => $period->get_start_date(), + 'payments' => [], + 'period' => $period, + ]; + } + + $data[ $key ]->payments[] = $payment; + } +} + +foreach ( $data as $item ) { + usort( + $item->payments, + function( $a, $b ) { + return $a->get_date() <=> $b->get_date(); + } + ); + + $item->first = reset( $item->payments ); -get_payments() ) ) : ?> + $statuses = array_map( + function( $payment ) { + return $payment->get_status(); + }, + $item->payments + ); + + $item->can_retry = ! ( in_array( PaymentStatus::OPEN, $statuses, true ) || in_array( PaymentStatus::SUCCESS, $statuses, true ) ); +} + +usort( + $data, + function( $a, $b ) { + return $b->date <=> $a->date; + } +); + +if ( 0 === count( $payments ) ) : ?> @@ -119,100 +188,8 @@ endif; - $data = []; - - foreach ( $subscription->get_payments() as $payment ) { - $key = sprintf( - '%s-%s', - $payment->get_date()->getTimestamp(), - $payment->get_id() - ); - - $item = [ - 'period' => null, - 'payments' => [ - $key => $payment, - ], - ]; - - // Maybe bundle payments for period. - $periods = $payment->get_periods(); - - if ( null !== $periods ) { - foreach ( $periods as $period ) { - if ( $subscription->get_id() !== $period->get_phase()->get_subscription()->get_id() ) { - continue; - } - - $item['period'] = $period; - - $key = $period->get_start_date()->getTimestamp(); - - // Add payment if period already exists in data. - if ( \array_key_exists( $key, $data ) && array_key_exists( 'payments', $data[ $key ] ) && array_key_exists( 'payments', $item ) ) { - $data[ $key ]['payments'] = $data[ $key ]['payments'] + $item['payments']; - - $item = null; - } - - break; - } - } - - // Add item. - if ( null !== $item ) { - $data[ $key ] = $item; - } - } - - // Add items to result. - $result = []; - - foreach ( $data as $item ) { - if ( ! array_key_exists( 'payments', $item ) ) { - continue; - } - - \ksort( $item['payments'] ); - - // Determine wether payment for period can be retried. - $can_retry = false; - - if ( null !== $item['period'] ) { - $has_open_or_success = array_intersect( - \wp_list_pluck( $item['payments'], 'status' ), - [ - PaymentStatus::OPEN, - PaymentStatus::SUCCESS, - ] - ); - - $can_retry = empty( $has_open_or_success ); - } - - $item['can_retry'] = $can_retry; - - // Add item to result using (first) payment date as key for sorting. - $payment = reset( $item['payments'] ); - - $key = sprintf( - '%s-%s', - $payment->get_date()->getTimestamp(), - $payment->get_id() - ); - - $result[ $key ] = $item; - } - - // Sort items by date. - \krsort( $result ); - - foreach ( $result as $sort_key => $item ) : - $period = $item['period']; - - $is_first = true; - - foreach ( $item['payments'] as $payment ) : + foreach ( $data as $item ) : + foreach ( $item->payments as $payment ) : $payment_id = $payment->get_id(); $payments_post_type = get_post_type( $payment_id ); @@ -225,10 +202,10 @@ period ) : + $prefix = ( $payment === $item->first ? '' : '⌙ ' ); - echo esc_html( $prefix . $period->human_readable_range() ); + echo esc_html( $prefix . $item->period->human_readable_range() ); endif; @@ -248,7 +225,7 @@ - subscriptions_module->can_retry_payment( $payment ) ) : ?> + period && $payment === $item->first && $item->can_retry && $plugin->subscriptions_module->can_retry_payment( $payment ) ) : ?>   @@ -261,9 +238,9 @@ [ 'period_payment' => true, 'subscription_id' => $subscription->get_id(), - 'sequence_number' => $period->get_phase()->get_sequence_number(), - 'start_date' => $period->get_start_date()->format( DATE_ATOM ), - 'end_date' => $period->get_end_date()->format( DATE_ATOM ), + 'sequence_number' => $item->period->get_phase()->get_sequence_number(), + 'start_date' => $item->period->get_start_date()->format( DATE_ATOM ), + 'end_date' => $item->period->get_end_date()->format( DATE_ATOM ), ] ), \get_edit_post_link( $subscription_id ) @@ -289,13 +266,7 @@ - + From 944611af8292114a4c82decb99bb30f66c4a62ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Thu, 22 Jun 2023 16:50:52 +0200 Subject: [PATCH 036/243] Use first payment as item date. --- views/meta-box-subscription-payments.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/views/meta-box-subscription-payments.php b/views/meta-box-subscription-payments.php index c6c94a34..6ab8c551 100644 --- a/views/meta-box-subscription-payments.php +++ b/views/meta-box-subscription-payments.php @@ -54,7 +54,7 @@ function( $period ) use ( $subscription ) { if ( ! array_key_exists( $key, $data ) ) { $data[ $key ] = (object) [ - 'date' => $period->get_start_date(), + 'date' => $payment->get_date(), 'payments' => [], 'period' => $period, ]; @@ -74,6 +74,10 @@ function( $a, $b ) { $item->first = reset( $item->payments ); + if ( false !== $item->first ) { + $item->date = $item->first->get_date(); + } + $statuses = array_map( function( $payment ) { return $payment->get_status(); From 71996137587ffbd4b5110dbf3a67cb5bff478d75 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Fri, 23 Jun 2023 13:27:14 +0200 Subject: [PATCH 037/243] Remove Google Analytics integration, closes #127. --- docs/hooks.md | 78 ++--- json-schemas/payment.json | 7 - src/Admin/AdminPaymentPostType.php | 28 -- src/Admin/AdminSettings.php | 14 - src/GoogleAnalyticsEcommerce.php | 403 -------------------------- src/Payments/PaymentInfoHelper.php | 9 - src/Payments/PaymentsDataStoreCPT.php | 11 +- src/Plugin.php | 21 -- src/Settings.php | 9 - tests/json/payment.json | 4 +- tests/src/Payments/PaymentTest.php | 1 - views/meta-box-payment-info.php | 33 --- views/meta-box-payment-update.php | 26 -- 13 files changed, 22 insertions(+), 622 deletions(-) delete mode 100644 src/GoogleAnalyticsEcommerce.php diff --git a/docs/hooks.md b/docs/hooks.md index 837a21b6..30de7ef0 100644 --- a/docs/hooks.md +++ b/docs/hooks.md @@ -58,7 +58,7 @@ Argument | Type | Description `$previous_status` | `null\|string` | Previous [payment status](https://github.com/pronamic/wp-pronamic-pay/wiki#payment-status). `$updated_status` | `null\|string` | Updated [payment status](https://github.com/pronamic/wp-pronamic-pay/wiki#payment-status). -Source: [src/Payments/PaymentsDataStoreCPT.php](../src/Payments/PaymentsDataStoreCPT.php), [line 919](../src/Payments/PaymentsDataStoreCPT.php#L919-L931) +Source: [src/Payments/PaymentsDataStoreCPT.php](../src/Payments/PaymentsDataStoreCPT.php), [line 910](../src/Payments/PaymentsDataStoreCPT.php#L910-L922) ### `pronamic_payment_status_update_{$source}` @@ -75,7 +75,7 @@ Argument | Type | Description `$previous_status` | `null\|string` | Previous [payment status](https://github.com/pronamic/wp-pronamic-pay/wiki#payment-status). `$updated_status` | `null\|string` | Updated [payment status](https://github.com/pronamic/wp-pronamic-pay/wiki#payment-status)). -Source: [src/Payments/PaymentsDataStoreCPT.php](../src/Payments/PaymentsDataStoreCPT.php), [line 933](../src/Payments/PaymentsDataStoreCPT.php#L933-L943) +Source: [src/Payments/PaymentsDataStoreCPT.php](../src/Payments/PaymentsDataStoreCPT.php), [line 924](../src/Payments/PaymentsDataStoreCPT.php#L924-L934) ### `pronamic_payment_status_update` @@ -90,7 +90,7 @@ Argument | Type | Description `$previous_status` | `null\|string` | Previous [payment status](https://github.com/pronamic/wp-pronamic-pay/wiki#payment-status). `$updated_status` | `null\|string` | Updated [payment status](https://github.com/pronamic/wp-pronamic-pay/wiki#payment-status). -Source: [src/Payments/PaymentsDataStoreCPT.php](../src/Payments/PaymentsDataStoreCPT.php), [line 945](../src/Payments/PaymentsDataStoreCPT.php#L945-L953) +Source: [src/Payments/PaymentsDataStoreCPT.php](../src/Payments/PaymentsDataStoreCPT.php), [line 936](../src/Payments/PaymentsDataStoreCPT.php#L936-L944) ### `pronamic_pay_privacy_register_exporters` @@ -225,7 +225,7 @@ Argument | Type | Description `$url` | | `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 427](../src/Payments/Payment.php#L427-L433) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 437](../src/Payments/Payment.php#L437-L443) ### `pronamic_payment_source_text_{$source}` @@ -238,7 +238,7 @@ Argument | Type | Description `$text` | `string` | Source text. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 477](../src/Payments/Payment.php#L477-L483) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 487](../src/Payments/Payment.php#L487-L493) ### `pronamic_payment_source_text` @@ -251,7 +251,7 @@ Argument | Type | Description `$text` | `string` | Source text. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 486](../src/Payments/Payment.php#L486-L492) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 496](../src/Payments/Payment.php#L496-L502) ### `pronamic_payment_source_description` @@ -264,7 +264,7 @@ Argument | Type | Description `$description` | `string` | Source description. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 509](../src/Payments/Payment.php#L509-L515) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 519](../src/Payments/Payment.php#L519-L525) ### `pronamic_payment_source_description_{$source}` @@ -277,7 +277,7 @@ Argument | Type | Description `$description` | `string` | Source description. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 518](../src/Payments/Payment.php#L518-L524) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 528](../src/Payments/Payment.php#L528-L534) ### `pronamic_payment_source_url` @@ -290,7 +290,7 @@ Argument | Type | Description `$url` | `null\|string` | Source URL. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 542](../src/Payments/Payment.php#L542-L548) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 552](../src/Payments/Payment.php#L552-L558) ### `pronamic_payment_source_url_{$source}` @@ -303,7 +303,7 @@ Argument | Type | Description `$url` | `null\|string` | Source URL. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 551](../src/Payments/Payment.php#L551-L557) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 561](../src/Payments/Payment.php#L561-L567) ### `pronamic_payment_provider_url` @@ -316,7 +316,7 @@ Argument | Type | Description `$url` | `null\|string` | Provider URL. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 573](../src/Payments/Payment.php#L573-L579) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 583](../src/Payments/Payment.php#L583-L589) ### `pronamic_payment_provider_url_{$gateway_id}` @@ -329,33 +329,7 @@ Argument | Type | Description `$url` | `null\|string` | Provider URL. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 594](../src/Payments/Payment.php#L594-L600) - -### `pronamic_pay_google_analytics_ecommerce_item_name` - -*Filters the item name for Google Analytics e-commerce tracking.* - -**Arguments** - -Argument | Type | Description --------- | ---- | ----------- -`$name` | `string` | Item name. -`$line` | `\Pronamic\WordPress\Pay\Payments\PaymentLine` | Payment line. - -Source: [src/GoogleAnalyticsEcommerce.php](../src/GoogleAnalyticsEcommerce.php), [line 215](../src/GoogleAnalyticsEcommerce.php#L215-L222) - -### `pronamic_pay_google_analytics_ecommerce_item_product_category` - -*Filters the product category for Google Analytics e-commerce tracking.* - -**Arguments** - -Argument | Type | Description --------- | ---- | ----------- -`$product_category` | `string\|null` | Product category. -`$line` | `\Pronamic\WordPress\Pay\Payments\PaymentLine` | Payment line. - -Source: [src/GoogleAnalyticsEcommerce.php](../src/GoogleAnalyticsEcommerce.php), [line 262](../src/GoogleAnalyticsEcommerce.php#L262-L269) +Source: [src/Payments/Payment.php](../src/Payments/Payment.php), [line 604](../src/Payments/Payment.php#L604-L610) ### `pronamic_pay_return_should_redirect` @@ -368,7 +342,7 @@ Argument | Type | Description `$should_redirect` | `bool` | Flag to indicate if redirect is allowed on handling payment return. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Plugin.php](../src/Plugin.php), [line 552](../src/Plugin.php#L552-L558) +Source: [src/Plugin.php](../src/Plugin.php), [line 544](../src/Plugin.php#L544-L550) ### `pronamic_pay_gateways` @@ -380,7 +354,7 @@ Argument | Type | Description -------- | ---- | ----------- `$gateways` | `\Pronamic\WordPress\Pay\AbstractGatewayIntegration[]` | Gateway integrations. -Source: [src/Plugin.php](../src/Plugin.php), [line 716](../src/Plugin.php#L716-L721) +Source: [src/Plugin.php](../src/Plugin.php), [line 698](../src/Plugin.php#L698-L703) ### `pronamic_pay_plugin_integrations` @@ -392,7 +366,7 @@ Argument | Type | Description -------- | ---- | ----------- `$plugin_integrations` | `\Pronamic\WordPress\Pay\AbstractPluginIntegration[]` | Plugin integrations. -Source: [src/Plugin.php](../src/Plugin.php), [line 731](../src/Plugin.php#L731-L736) +Source: [src/Plugin.php](../src/Plugin.php), [line 713](../src/Plugin.php#L713-L718) ### `pronamic_payment_gateway_configuration_id` @@ -405,7 +379,7 @@ Argument | Type | Description `$config_id` | `null\|int` | Gateway configuration ID. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Plugin.php](../src/Plugin.php), [line 1152](../src/Plugin.php#L1152-L1158) +Source: [src/Plugin.php](../src/Plugin.php), [line 1092](../src/Plugin.php#L1092-L1098) ### `pronamic_payment_redirect_url_{$source}` @@ -418,7 +392,7 @@ Argument | Type | Description `$url` | `string` | Redirect URL. `$payment` | `\Pronamic\WordPress\Pay\Payments\Payment` | Payment. -Source: [src/Plugin.php](../src/Plugin.php), [line 1373](../src/Plugin.php#L1373-L1379) +Source: [src/Plugin.php](../src/Plugin.php), [line 1283](../src/Plugin.php#L1283-L1289) ### `pronamic_pay_modules` @@ -428,7 +402,7 @@ Argument | Type | Description -------- | ---- | ----------- `[]` | | -Source: [src/Admin/AdminPaymentPostType.php](../src/Admin/AdminPaymentPostType.php), [line 590](../src/Admin/AdminPaymentPostType.php#L590-L590) +Source: [src/Admin/AdminPaymentPostType.php](../src/Admin/AdminPaymentPostType.php), [line 562](../src/Admin/AdminPaymentPostType.php#L562-L562) ### `pronamic_gateway_configuration_display_value` @@ -469,19 +443,7 @@ Argument | Type | Description -------- | ---- | ----------- `[]` | | -Source: [src/Admin/AdminModule.php](../src/Admin/AdminModule.php), [line 814](../src/Admin/AdminModule.php#L814-L814) - -### `pronamic_pay_removed_extension_notifications` - -*Filters the removed extensions notifications.* - -**Arguments** - -Argument | Type | Description --------- | ---- | ----------- -`$notifications` | `\Pronamic\WordPress\Pay\Admin\AdminNotification[]` | Notifications for removed extensions. - -Source: [src/Admin/AdminNotices.php](../src/Admin/AdminNotices.php), [line 65](../src/Admin/AdminNotices.php#L65-L70) +Source: [src/Admin/AdminModule.php](../src/Admin/AdminModule.php), [line 806](../src/Admin/AdminModule.php#L806-L806) ### `pronamic_pay_modules` @@ -592,7 +554,7 @@ Argument | Type | Description -------- | ---- | ----------- `[]` | | -Source: [src/HomeUrlController.php](../src/HomeUrlController.php), [line 85](../src/HomeUrlController.php#L85-L85) +Source: [src/HomeUrlController.php](../src/HomeUrlController.php), [line 104](../src/HomeUrlController.php#L104-L104)

Pronamic WordPress Documentor
Generated by Pronamic WordPress Documentor 1.2.0

diff --git a/json-schemas/payment.json b/json-schemas/payment.json index 410116af..9a05047b 100644 --- a/json-schemas/payment.json +++ b/json-schemas/payment.json @@ -3,12 +3,5 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Pronamic Pay payment.", "type": "object", - "properties": { - "ga_tracked": { - "description": "Indicates if the payment is Google Analytics e-commerce tracked.", - "type": "boolean", - "deprecated": true - } - }, "required": [] } diff --git a/src/Admin/AdminPaymentPostType.php b/src/Admin/AdminPaymentPostType.php index 1ec1f0c5..4a8c4851 100644 --- a/src/Admin/AdminPaymentPostType.php +++ b/src/Admin/AdminPaymentPostType.php @@ -155,34 +155,6 @@ public function maybe_process_payment_action() { 'message' => __( 'Payment status updated.', 'pronamic_ideal' ), ]; } - - // Send to Google Analytics action. - if ( filter_has_var( INPUT_GET, 'pronamic_pay_ga_track' ) && check_admin_referer( 'pronamic_payment_ga_track_' . $post_id ) ) { - $ga_ecommerce = pronamic_pay_plugin()->google_analytics_ecommerce; - - if ( ! $ga_ecommerce->valid_payment( $payment ) ) { - $notice = [ - 'type' => 'error', - 'message' => __( 'Payment details or an invalid tracking ID prevent payment from being tracked by Google Analytics.', 'pronamic_ideal' ), - ]; - } else { - pronamic_pay_plugin()->google_analytics_ecommerce->send_transaction( $payment ); - - if ( true === $payment->get_meta( 'google_analytics_tracked' ) ) { - $notice = [ - 'type' => 'info', - 'message' => __( 'Payment sent to Google Analytics.', 'pronamic_ideal' ), - ]; - } else { - $notice = [ - 'type' => 'error', - 'message' => __( 'Payment could not be sent to Google Analytics.', 'pronamic_ideal' ), - ]; - } - } - - $this->admin_notices[] = $notice; - } } /** diff --git a/src/Admin/AdminSettings.php b/src/Admin/AdminSettings.php index 43c56143..07a2861a 100644 --- a/src/Admin/AdminSettings.php +++ b/src/Admin/AdminSettings.php @@ -70,20 +70,6 @@ function() { ] ); - // Google Analytics property UA code. - add_settings_field( - 'pronamic_pay_google_analytics_property', - __( 'Google Analytics tracking ID', 'pronamic_ideal' ), - [ $this, 'input_element' ], - 'pronamic_pay', - 'pronamic_pay_general', - [ - 'description' => __( 'Set a Google Analytics tracking UA code to track ecommerce revenue.', 'pronamic_ideal' ), - 'label_for' => 'pronamic_pay_google_analytics_property', - 'classes' => 'regular-text code', - ] - ); - // Remove data on uninstall. add_settings_field( 'pronamic_pay_uninstall_clear_data', diff --git a/src/GoogleAnalyticsEcommerce.php b/src/GoogleAnalyticsEcommerce.php deleted file mode 100644 index e52bcdb4..00000000 --- a/src/GoogleAnalyticsEcommerce.php +++ /dev/null @@ -1,403 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -namespace Pronamic\WordPress\Pay; - -use Pronamic\WordPress\Money\TaxedMoney; -use Pronamic\WordPress\Pay\Core\Gateway; -use Pronamic\WordPress\Pay\Core\Server; -use Pronamic\WordPress\Pay\Payments\PaymentLine; -use Pronamic\WordPress\Pay\Payments\PaymentStatus; -use Pronamic\WordPress\Pay\Payments\Payment; - -/** - * Pronamic Pay Google Analytics e-commerce - * - * @author Reüel van der Steege - * @version 2.2.6 - * @since 2.0.1 - */ -class GoogleAnalyticsEcommerce { - /** - * Google Analytics Measurement Protocol API endpoint URL. - * - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide - * @var string - */ - const API_URL = 'https://www.google-analytics.com/collect'; - - /** - * Measurement Protocol API version. - * - * @var string - */ - const API_VERSION = '1'; - - /** - * Anonymous client ID. - * - * @var string|null - */ - private $client_id; - - /** - * Constructs an analytics e-commerce object. - */ - public function __construct() { - // Actions. - add_action( 'pronamic_payment_status_update', [ $this, 'maybe_send_transaction' ], 10 ); - - // Filters. - add_filter( 'pronamic_payment_redirect_url', [ $this, 'payment_redirect_url' ], 15, 1 ); - } - - /** - * Maybe send transaction for the specified payment. - * - * @param Payment $payment Payment. - * @return void - */ - public function maybe_send_transaction( $payment ) { - // Ignore test mode payments. - if ( Gateway::MODE_TEST === $payment->get_mode() ) { - return; - } - - $this->send_transaction( $payment ); - } - - /** - * Is this a valid payment to track? - * - * @param Payment $payment Payment to track. - * - * @return bool - */ - public function valid_payment( $payment ) { - // Is payment already tracked? - if ( true === $payment->get_meta( 'google_analytics_tracked' ) ) { - return false; - } - - // Check if Google Analytics property ID has been set. - $property_id = get_option( 'pronamic_pay_google_analytics_property' ); - - if ( empty( $property_id ) ) { - return false; - } - - // Only process successful payments. - if ( PaymentStatus::SUCCESS !== $payment->get_status() ) { - return false; - } - - return true; - } - - /** - * Send transaction. - * - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#ecom - * - * Parameters: - * v=1 // Version. - * &tid=UA-XXXX-Y // Tracking ID / Property ID. - * &cid=555 // Anonymous Client ID. - * - * &t=transaction // Transaction hit type. - * &ti=12345 // transaction ID. Required. - * &ta=westernWear // Transaction affiliation. - * &tr=50.00 // Transaction revenue. - * &ts=32.00 // Transaction shipping. - * &tt=12.00 // Transaction tax. - * &cu=EUR // Currency code. - * - * @param Payment $payment Payment. - * @return void - */ - public function send_transaction( $payment ) { - if ( ! $this->valid_payment( $payment ) ) { - return; - } - - $defaults = [ - 'v' => self::API_VERSION, - 'tid' => get_option( 'pronamic_pay_google_analytics_property' ), - 'cid' => $this->get_client_id( $payment ), - 'ti' => strval( $payment->get_id() ), - 'ni' => 1, - ]; - - $total_amount = $payment->get_total_amount(); - - // Transaction Hit. - $transaction = wp_parse_args( - [ - 't' => 'transaction', - 'tr' => $total_amount->number_format( null, '.', '' ), - ], - $defaults - ); - - /* - * Currency Code - * Optional. - * When present indicates the local currency for all transaction currency values. Value should be a valid ISO 4217 currency code. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cu - */ - $transaction['cu'] = $total_amount->get_currency()->get_alphabetic_code(); - - // Shipping. - $shipping_amount = $payment->get_shipping_amount(); - - if ( null !== $shipping_amount ) { - /* - * Transaction Shipping - * Optional. - * Specifies the total shipping cost of the transaction. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ts - */ - $transaction['ts'] = $shipping_amount->number_format( null, '.', '' ); - } - - // Tax. - if ( $total_amount instanceof TaxedMoney ) { - /* - * Transaction Tax - * Optional. - * Specifies the total tax of the transaction. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tt - */ - $transaction['tt'] = sprintf( '%F', $total_amount->get_tax_value() ); - } - - wp_remote_post( - self::API_URL, - [ - 'user-agent' => Server::get( 'HTTP_USER_AGENT' ), - 'body' => $transaction, - 'blocking' => false, - ] - ); - - // Mark payment as tracked. - $payment->set_meta( 'google_analytics_tracked', true ); - $payment->save(); - - // Item Hit. - $lines = $payment->get_lines(); - - if ( ! empty( $lines ) ) { - foreach ( $lines as $line ) { - $item = $defaults; - - /* - * Hit - Hit type - Required for all hit types. - * The type of hit. Must be one of 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#t - */ - $item['t'] = 'item'; - - /* - * Item Name - Required for item hit type. - Specifies the item name. - * - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#in - */ - $name = (string) $line->get_name(); - - /** - * Filters the item name for Google Analytics e-commerce tracking. - * - * @param string $name Item name. - * @param PaymentLine $line Payment line. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#in - */ - $name = \apply_filters( 'pronamic_pay_google_analytics_ecommerce_item_name', $name, $line ); - - $item['in'] = $name; - - /* - * Item Price - Optional. - Specifies the price for a single item / unit. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ip - */ - $unit_price = $line->get_unit_price(); - - if ( null !== $unit_price ) { - $item['ip'] = $unit_price->number_format( null, '.', '' ); - } - - /* - * Item Quantity - Optional. - Specifies the number of items purchased. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#iq - */ - if ( null !== $line->get_quantity() ) { - $item['iq'] = $line->get_quantity(); - } - - /* - * Item Code - Optional. - Specifies the SKU or item code. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ic - */ - if ( null !== $line->get_id() ) { - $item['ic'] = $line->get_id(); - } - - if ( null !== $line->get_sku() ) { - $item['ic'] = $line->get_sku(); - } - - /* - * Item Category - Optional. - Specifies the category that the item belongs to. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#iv - */ - $product_category = $line->get_product_category(); - - /** - * Filters the product category for Google Analytics e-commerce tracking. - * - * @param string|null $product_category Product category. - * @param PaymentLine $line Payment line. - * @link https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#iv - */ - $product_category = \apply_filters( 'pronamic_pay_google_analytics_ecommerce_item_product_category', $product_category, $line ); - - if ( null !== $product_category ) { - $item['iv'] = $product_category; - } - - wp_remote_post( - self::API_URL, - [ - 'user-agent' => Server::get( 'HTTP_USER_AGENT' ), - 'body' => $item, - 'blocking' => false, - ] - ); - } - } - } - - /** - * Get the Client ID. - * - * @param Payment $payment Payment. - * @return string - */ - private function get_client_id( Payment $payment ) { - $client_id = $payment->get_meta( 'google_analytics_client_id' ); - - if ( ! empty( $client_id ) ) { - return $client_id; - } - - if ( ! empty( $this->client_id ) ) { - return $this->client_id; - } - - // Check cookie `_ga` for Client ID. - $this->client_id = self::get_cookie_client_id(); - - if ( empty( $this->client_id ) ) { - // Generate UUID. - // Borrowed from https://github.com/ins0/google-measurement-php-client/blob/master/src/Racecore/GATracking/GATracking.php. - $this->client_id = sprintf( - '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', - // 32 bits for "time_low". - wp_rand( 0, 0xffff ), - wp_rand( 0, 0xffff ), - // 16 bits for "time_mid". - wp_rand( 0, 0xffff ), - // 16 bits for "time_hi_and_version",. - // four most significant bits holds version number 4. - wp_rand( 0, 0x0fff ) | 0x4000, - // 16 bits, 8 bits for "clk_seq_hi_res",. - // 8 bits for "clk_seq_low",. - // two most significant bits holds zero and one for variant DCE1.1. - wp_rand( 0, 0x3fff ) | 0x8000, - // 48 bits for "node". - wp_rand( 0, 0xffff ), - wp_rand( 0, 0xffff ), - wp_rand( 0, 0xffff ) - ); - } - - return $this->client_id; - } - - /** - * Check if the specified UUID is valid. - * - * @link http://php.net/preg_match - * - * @param string $uuid String. - * @return boolean True if value is a valid UUID, false otherwise. - */ - public static function is_uuid( $uuid ) { - $result = preg_match( '#^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$#i', $uuid ); - - return 1 === $result; - } - - /** - * Get cookie client ID. - * - * @return string|null - */ - public static function get_cookie_client_id() { - // Check `_ga` cookie. - if ( ! \array_key_exists( '_ga', $_COOKIE ) ) { - return null; - } - - $ga_cookie = \sanitize_text_field( \wp_unslash( $_COOKIE['_ga'] ) ); - - if ( empty( $ga_cookie ) ) { - return null; - } - - $ga = explode( '.', $ga_cookie ); - - $client_id = null; - - if ( isset( $ga[2] ) && self::is_uuid( $ga[2] ) ) { - // Use UUID from cookie. - $client_id = $ga[2]; - } elseif ( isset( $ga[2], $ga[3] ) ) { - // Older Google Client ID. - $client_id = sprintf( '%s.%s', $ga[2], $ga[3] ); - } - - return $client_id; - } - - /** - * Payment redirect URL. - * - * @param string $url Redirect URL. - * @return string - */ - public function payment_redirect_url( $url ) { - /** - * Payment Gateway Referral Exclusions in Google Analytics. - * - * @link https://lmgtfy.com/?q=google+analytics+exclude+payment+providers - * @link https://webvalue.nl/blog/betaalproviders-uitsluiten-google-analytics - * @link https://seeders.nl/lijst-nederlandse-paymentproviders-om-sluiten-google-analytics/ - * @link http://blog.analytics-toolkit.com/2015/payment-gateway-referrer-exclusions-google-analytics/ - * @link https://andrescholten.nl/a-bank-ideal-ogone-paypal-or-other-payment-providers-getting-all-revenue-in-google-analytics/ - * @link https://nicksnell.dev/log/2017/06/exclude-social-login-referrals/ - * @link https://bluegg.co.uk/blog/tracking-referrals-when-using-an-external-payment-gatewa - * @link https://github.com/Adyen/adyen-magento2/search?q=utm_nooverride - */ - $url = \add_query_arg( 'utm_nooverride', '1', $url ); - - return $url; - } -} diff --git a/src/Payments/PaymentInfoHelper.php b/src/Payments/PaymentInfoHelper.php index 60fc157f..5873f727 100644 --- a/src/Payments/PaymentInfoHelper.php +++ b/src/Payments/PaymentInfoHelper.php @@ -263,15 +263,6 @@ public static function from_json( $json, PaymentInfo $payment_info ) { $payment_info->key = $json->key; } - /* - * Legacy. - */ - - // Google Analytics tracked. - if ( isset( $json->ga_tracked ) ) { - $payment_info->set_meta( 'google_analytics_tracked', $json->ga_tracked ); - } - return $payment_info; } } diff --git a/src/Payments/PaymentsDataStoreCPT.php b/src/Payments/PaymentsDataStoreCPT.php index 9a9a7441..26d301e2 100644 --- a/src/Payments/PaymentsDataStoreCPT.php +++ b/src/Payments/PaymentsDataStoreCPT.php @@ -670,14 +670,6 @@ private function register_meta() { ] ); - $this->register_meta_key( - 'analytics_client_id', - [ - 'label' => __( 'Analytics Client ID', 'pronamic_ideal' ), - 'privacy_erasure' => 'erase', - ] - ); - $this->register_meta_key( 'subscription_id', [ @@ -796,8 +788,7 @@ protected function read_post_meta( $payment ) { // Meta. $keys = [ - '_pronamic_payment_issuer' => 'issuer', - '_pronamic_payment_analytics_client_id' => 'google_analytics_client_id', + '_pronamic_payment_issuer' => 'issuer', ]; foreach ( $keys as $post_meta_key => $payment_meta_key ) { diff --git a/src/Plugin.php b/src/Plugin.php index aead1201..ef3f0936 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -202,13 +202,6 @@ public static function instance( $args = [] ) { */ public $subscriptions_module; - /** - * Google analytics ecommerce. - * - * @var GoogleAnalyticsEcommerce - */ - public $google_analytics_ecommerce; - /** * Gateway integrations. * @@ -689,9 +682,6 @@ public function plugins_loaded() { $this->blocks_module->setup(); } - // Google Analytics Ecommerce. - $this->google_analytics_ecommerce = new GoogleAnalyticsEcommerce(); - // Admin. if ( is_admin() ) { $this->admin = new Admin\AdminModule( $this ); @@ -928,17 +918,6 @@ public static function complement_payment( Payment $payment ) { $payment->set_origin_id( $origin_id ); } - // Google Analytics client ID. - $google_analytics_client_id = $payment->get_meta( 'google_analytics_client_id' ); - - if ( null === $google_analytics_client_id ) { - $google_analytics_client_id = GoogleAnalyticsEcommerce::get_cookie_client_id(); - - if ( null !== $google_analytics_client_id ) { - $payment->set_meta( 'google_analytics_client_id', $google_analytics_client_id ); - } - } - // Customer. $customer = $payment->get_customer(); diff --git a/src/Settings.php b/src/Settings.php index 2568c1de..2e8e3c7c 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -74,15 +74,6 @@ public function init() { ] ); - register_setting( - 'pronamic_pay', - 'pronamic_pay_google_analytics_property', - [ - 'type' => 'string', - 'sanitize_callback' => 'sanitize_text_field', - ] - ); - \register_setting( 'pronamic_pay', 'pronamic_pay_debug_mode', diff --git a/tests/json/payment.json b/tests/json/payment.json index 2163055a..b0f31c92 100644 --- a/tests/json/payment.json +++ b/tests/json/payment.json @@ -100,9 +100,7 @@ "reference": "ABCD-1234-EFGH-5678" }, "mode":"live", - "meta": { - "google_analytics_tracked": true - }, + "meta": {}, "expiry_date": "2005-05-05T00:30:00+00:00", "total_amount": { "value": "242", diff --git a/tests/src/Payments/PaymentTest.php b/tests/src/Payments/PaymentTest.php index 30f3c9b4..5a5dfb73 100644 --- a/tests/src/Payments/PaymentTest.php +++ b/tests/src/Payments/PaymentTest.php @@ -173,7 +173,6 @@ public function test_json() { $payment->set_id( 1 ); $payment->set_mode( Gateway::MODE_LIVE ); $payment->set_total_amount( new TaxedMoney( 242, 'EUR', 42, 21 ) ); - $payment->set_meta( 'google_analytics_tracked', true ); // Name. $name = new ContactName(); diff --git a/views/meta-box-payment-info.php b/views/meta-box-payment-info.php index fbcc698a..8479d8b5 100644 --- a/views/meta-box-payment-info.php +++ b/views/meta-box-payment-info.php @@ -727,39 +727,6 @@ - get_meta( 'google_analytics_tracked' ); - - $ga_property_id = get_option( 'pronamic_pay_google_analytics_property' ); - - ?> - - - - - - - - - - - - - - get_source() ) : ?> diff --git a/views/meta-box-payment-update.php b/views/meta-box-payment-update.php index 08e2da2a..7e931b7b 100644 --- a/views/meta-box-payment-update.php +++ b/views/meta-box-payment-update.php @@ -108,32 +108,6 @@ ); } - /** - * Send to Google Analytics button. - */ - $can_track = pronamic_pay_plugin()->google_analytics_ecommerce->valid_payment( $payment ); - - if ( $can_track ) { - // Only show button for payments that can be tracked. - $action_url = wp_nonce_url( - add_query_arg( - [ - 'post' => $post->ID, - 'action' => 'edit', - 'pronamic_pay_ga_track' => true, - ], - admin_url( 'post.php' ) - ), - 'pronamic_payment_ga_track_' . $post->ID - ); - - printf( - '

', - esc_url( $action_url ), - esc_html__( 'Send to Google Analytics', 'pronamic_ideal' ) - ); - } - ?> From 63685363ab043a0d759495b8c4c6ba84d066296d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Tue, 27 Jun 2023 12:37:47 +0200 Subject: [PATCH 038/243] Prevent duplicate subscription status update. --- src/Subscriptions/SubscriptionsModule.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Subscriptions/SubscriptionsModule.php b/src/Subscriptions/SubscriptionsModule.php index 096df76f..95b50fdb 100644 --- a/src/Subscriptions/SubscriptionsModule.php +++ b/src/Subscriptions/SubscriptionsModule.php @@ -185,10 +185,12 @@ public function payment_status_update( $payment ) { if ( $is_renewal || ! in_array( $status_before, [ SubscriptionStatus::CANCELLED, SubscriptionStatus::COMPLETED, SubscriptionStatus::ON_HOLD ], true ) ) { $subscription->set_status( $status_update ); - } - // Update. - $subscription->save(); + // Update. + if ( $status_before !== $status_update ) { + $subscription->save(); + } + } } } @@ -356,9 +358,9 @@ private function handle_subscription_renew( Subscription $subscription ) { $payment->order_id = $subscription->get_order_id(); /** - * We set the payment method to `null` so that users get the + * We set the payment method to `null` so that users get the * chance to choose a payment method themselves if possible. - * + * * @link https://github.com/pronamic/wp-pronamic-pay-mollie/issues/23 * @link https://github.com/pronamic/wp-pay-core/pull/99 */ From 8da8177599fee97fe26061210fa84c7d67da624a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 28 Jun 2023 13:11:30 +0200 Subject: [PATCH 039/243] Fix duplicate `_pronamic_payment_subscription_id` meta due to unprefixed meta key. --- src/Payments/PaymentsDataStoreCPT.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Payments/PaymentsDataStoreCPT.php b/src/Payments/PaymentsDataStoreCPT.php index 26d301e2..5fbe5786 100644 --- a/src/Payments/PaymentsDataStoreCPT.php +++ b/src/Payments/PaymentsDataStoreCPT.php @@ -859,7 +859,7 @@ private function update_post_meta( $payment ) { // Subscriptions. $meta_key = $this->get_meta_key( 'subscription_id' ); - $subscriptions_ids = \get_post_meta( $id, 'subscription_id' ); + $subscriptions_ids = \get_post_meta( $id, $meta_key ); foreach ( $payment->get_subscriptions() as $subscription ) { $subscription_id = $subscription->get_id(); From 2e0c0a6015b39ad628659a11801f3403bb05c6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Mon, 3 Jul 2023 15:39:37 +0200 Subject: [PATCH 040/243] Remove payment ID fallback from formatted payment string (pronamic/wp-pronamic-pay-adyen#23). --- src/Payments/Payment.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Payments/Payment.php b/src/Payments/Payment.php index f04cea60..67572ccd 100644 --- a/src/Payments/Payment.php +++ b/src/Payments/Payment.php @@ -661,29 +661,20 @@ public function add_subscription( Subscription $subscription ) { * @return string */ public function format_string( $string ) { - $id = $this->get_id(); - // Replacements definition. $replacements = [ '{order_id}' => $this->get_order_id(), - '{payment_id}' => $id, + '{payment_id}' => $this->get_id(), ]; // Find and replace. - $count = 0; - $string = str_replace( array_keys( $replacements ), array_values( $replacements ), - $string, - $count + $string ); - // Make sure there is an dynamic part in the order ID. - // @link https://secure.ogone.com/ncol/param_cookbook.asp. - if ( 0 === $count && null !== $id ) { - $string .= $id; - } + $string = trim( $string ); return $string; } From dd0478784f2ffbeb2209519abcf02bd149ce54fe Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:17:39 +0200 Subject: [PATCH 041/243] Don't trim string in format function? --- src/Payments/Payment.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Payments/Payment.php b/src/Payments/Payment.php index 67572ccd..834a0199 100644 --- a/src/Payments/Payment.php +++ b/src/Payments/Payment.php @@ -674,8 +674,6 @@ public function format_string( $string ) { $string ); - $string = trim( $string ); - return $string; } From 1602bc636420d39d4de0529af882a8630954a0e2 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:19:21 +0200 Subject: [PATCH 042/243] Simplified replace by using `strtr` function. --- src/Payments/Payment.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Payments/Payment.php b/src/Payments/Payment.php index 834a0199..02f51f9c 100644 --- a/src/Payments/Payment.php +++ b/src/Payments/Payment.php @@ -661,18 +661,12 @@ public function add_subscription( Subscription $subscription ) { * @return string */ public function format_string( $string ) { - // Replacements definition. - $replacements = [ + $replace_pairs = [ '{order_id}' => $this->get_order_id(), '{payment_id}' => $this->get_id(), ]; - // Find and replace. - $string = str_replace( - array_keys( $replacements ), - array_values( $replacements ), - $string - ); + $string = \strtr( $string, $replace_pairs ); return $string; } From 3bdce1eb494d1436d3e4060ebd2015e20ebe0e59 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:26:47 +0200 Subject: [PATCH 043/243] Use private get home URL function to retrieve home URL. --- src/LicenseManager.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/LicenseManager.php b/src/LicenseManager.php index 8ef7b091..ad28670c 100644 --- a/src/LicenseManager.php +++ b/src/LicenseManager.php @@ -58,6 +58,16 @@ public function __construct() { \add_filter( 'debug_information', [ $this, 'debug_information' ], 15 ); } + /** + * Get home URL. + * + * @link https://github.com/pronamic/wp-pay-core/issues/136 + * @return string + */ + private function get_home_url() { + return \home_url(); + } + /** * Admin initialize. * @@ -255,7 +265,7 @@ private function request_license_status( $license ) { $args = [ 'license' => $license, 'name' => 'Pronamic Pay', - 'url' => home_url(), + 'url' => $this->get_home_url(), ]; $args = urlencode_deep( $args ); @@ -303,7 +313,7 @@ public function deactivate_license( $license ) { $args = [ 'license' => $license, 'name' => 'Pronamic Pay', - 'url' => home_url(), + 'url' => $this->get_home_url(), ]; $args = urlencode_deep( $args ); @@ -327,7 +337,7 @@ public function activate_license( $license ) { $args = [ 'license' => $license, 'name' => 'Pronamic Pay', - 'url' => home_url(), + 'url' => $this->get_home_url(), ]; $args = urlencode_deep( $args ); From 8c39f2c15c0e9313035eb061a2845044678480b2 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:29:35 +0200 Subject: [PATCH 044/243] Use unfiltered home URL directly from options. --- src/LicenseManager.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/LicenseManager.php b/src/LicenseManager.php index ad28670c..6a488919 100644 --- a/src/LicenseManager.php +++ b/src/LicenseManager.php @@ -61,11 +61,19 @@ public function __construct() { /** * Get home URL. * - * @link https://github.com/pronamic/wp-pay-core/issues/136 * @return string */ private function get_home_url() { - return \home_url(); + /** + * We use the `get_option( 'home' )` here and not `home_url()` to + * bypass the `home_url` filter. The WPML plugin hooks into the + * `home_url` filter and this causes the notice to be displayed + * unnecessarily. That's why we decided to compare on the + * unfiltered home URL directly from the options. + * + * @link https://github.com/pronamic/wp-pay-core/issues/136 + */ + return \get_option( 'home' ); } /** From add7bde6318303e54cb3e583361b1a40b461636e Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 12 Jul 2023 10:27:09 +0200 Subject: [PATCH 045/243] vendor/bin/phpcbf --- src/LicenseManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LicenseManager.php b/src/LicenseManager.php index 6a488919..90e96325 100644 --- a/src/LicenseManager.php +++ b/src/LicenseManager.php @@ -71,7 +71,7 @@ private function get_home_url() { * unnecessarily. That's why we decided to compare on the * unfiltered home URL directly from the options. * - * @link https://github.com/pronamic/wp-pay-core/issues/136 + * @link https://github.com/pronamic/wp-pay-core/issues/136 */ return \get_option( 'home' ); } From 82543e1a9716a9caf7ffc8f59b94049a375e844a Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 12 Jul 2023 10:30:43 +0200 Subject: [PATCH 046/243] FIx test, if meta is empty it's not added to the JSON. --- tests/json/payment.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/json/payment.json b/tests/json/payment.json index b0f31c92..067d315b 100644 --- a/tests/json/payment.json +++ b/tests/json/payment.json @@ -100,7 +100,6 @@ "reference": "ABCD-1234-EFGH-5678" }, "mode":"live", - "meta": {}, "expiry_date": "2005-05-05T00:30:00+00:00", "total_amount": { "value": "242", From 50e53ec1e3ab8df7bf4541cdb6ca6e483ec8c5c7 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Wed, 12 Jul 2023 10:39:48 +0200 Subject: [PATCH 047/243] v4.9.4 --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f165156..70bd797c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,39 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] +## [4.9.4] - 2023-07-12 + +### Added + +- Register Billie payment method. ([6308ab6](https://github.com/pronamic/wp-pay-core/commit/6308ab6efc6af243fe882a07e5cf4193249984f9)) + +### Changed + +- Use unfiltered home URL in license manager. +- Updated logos library to version 1.16.0. ([feacc4b](https://github.com/pronamic/wp-pay-core/commit/feacc4b6092c42b70fde7a3c8508f60b74b31e1a)) +- Changes links in license notice. ([19088b1](https://github.com/pronamic/wp-pay-core/commit/19088b1746901c973627bfbc1a081b961d8d6b8c)) + +### Fixed + +- Fixed duplicate `_pronamic_payment_subscription_id` meta due to unprefixed meta key. ([8da8177](https://github.com/pronamic/wp-pay-core/commit/8da8177599fee97fe26061210fa84c7d67da624a)) +- Prevent duplicate subscription status update. ([6368536](https://github.com/pronamic/wp-pay-core/commit/63685363ab043a0d759495b8c4c6ba84d066296d)) +- Show payments without periods in subscription payments meta box. ([872eab3](https://github.com/pronamic/wp-pay-core/commit/872eab3bb4bc69cd1e42000451a31e5e3fc588ff)) +- Reflect home URL change from bdc3e6c6 in admin notice. ([30a59e9](https://github.com/pronamic/wp-pay-core/commit/30a59e9c1d5f7dc39ca0fd6a235076ffa5c96f15)) +- Fixed payment lines not displayed in meta box for subscriptions. ([be14ef9](https://github.com/pronamic/wp-pay-core/commit/be14ef946d39ab956ce34a758f00c87b7402e752)) + +### Removed + +- Removed payment ID fallback from formatted payment string (pronamic/wp-pronamic-pay-adyen#23). ([2e0c0a6](https://github.com/pronamic/wp-pay-core/commit/2e0c0a6015b39ad628659a11801f3403bb05c6c2)) +- Removed Google Analytics integration, closes #127. ([7199613](https://github.com/pronamic/wp-pay-core/commit/71996137587ffbd4b5110dbf3a67cb5bff478d75)) +- Removed admin notices feature for removed extensions, no longer used. ([76cdf8a](https://github.com/pronamic/wp-pay-core/commit/76cdf8aa10c9b16b20755da41e070abc4a4c6b5f)) +- Removed `switch_to_user_locale`. ([b9c0cb1](https://github.com/pronamic/wp-pay-core/commit/b9c0cb17feb9f7a6737d04fcc891f6d97ccff384)) +- Removed `load_plugin_textdomain` functions. ([966f230](https://github.com/pronamic/wp-pay-core/commit/966f2304068c51468fd3d843ac326a5d29d4a46f)) +- Removed `plugin_locale` filter for `nl_NL_formal` and `nl_BE`. ([5a0064d](https://github.com/pronamic/wp-pay-core/commit/5a0064d60669e8b302f1fb4326095a669a57d6d7)) + +Full set of changes: [`4.9.3...4.9.4`][4.9.4] + +[4.9.4]: https://github.com/pronamic/wp-pay-core/compare/v4.9.3...v4.9.4 + ## [4.9.3] - 2023-06-01 ### Commits diff --git a/package.json b/package.json index 878d125d..1a1bf5fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wp-pay/core", - "version": "4.9.3", + "version": "4.9.4", "description": "Core components for the WordPress payment processing library.", "repository": { "type": "git", From b83ed3c7c45a7a0215f57745947c0d736352aec6 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:44:15 +0200 Subject: [PATCH 048/243] Remove files that are now part of `pronamic/wp-pronamic-pay-forms`. --- scss/forms.scss | 98 ------- src/Forms/FormPostType.php | 444 -------------------------------- src/Forms/FormProcessor.php | 261 ------------------- src/Forms/FormScripts.php | 75 ------ src/Forms/FormShortcode.php | 66 ----- src/Forms/FormsModule.php | 216 ---------------- src/Forms/FormsSource.php | 50 ---- views/form.php | 292 --------------------- views/meta-box-form-options.php | 130 ---------- 9 files changed, 1632 deletions(-) delete mode 100644 scss/forms.scss delete mode 100644 src/Forms/FormPostType.php delete mode 100644 src/Forms/FormProcessor.php delete mode 100644 src/Forms/FormScripts.php delete mode 100644 src/Forms/FormShortcode.php delete mode 100644 src/Forms/FormsModule.php delete mode 100644 src/Forms/FormsSource.php delete mode 100644 views/form.php delete mode 100644 views/meta-box-form-options.php diff --git a/scss/forms.scss b/scss/forms.scss deleted file mode 100644 index 0d6f0e55..00000000 --- a/scss/forms.scss +++ /dev/null @@ -1,98 +0,0 @@ -@import 'admin/variables'; - -.pronamic-pay-form { - // Fieldset - fieldset { - border: 0; - } - - // Legend - legend { - border-bottom: 1px solid $gray-very-light; - - font-weight: 700; - - margin: 10px 0 15px; - padding: 0 0 10px; - - width: 100%; - } - - // Input - .pronamic-pay-amount-input[type="text"] { - width: auto; - } -} - -// Required indicator -.pronamic-pay-required-indicator { - color: $dark-red; -} - -// Rows -.pronamic-pay-form-row { - margin: 0 0 15px; - - input, - textarea, - select { - border-radius: 0; - - outline: none; - - width: 100%; - } -} - -.pronamic-pay-form-row-wide { - clear: both; - - margin: 0 0 15px; -} - -.pronamic-pay-form-row-first, -.pronamic-pay-form-row-last { - width: 48.5%; -} - -.pronamic-pay-form-row-first { - float: left; -} - -.pronamic-pay-form-row-last { - float: right; -} - -// Error -.pronamic-pay-error { - background: $gray-very-light-white; - - border-left: 4px solid $dark-red; - - box-shadow: 0 1px 1px $gray-very-light-2; - - clear: both; - - margin: 15px 0; - - padding: 1em 1em 1em 2em; - - position: relative; -} - -// Payment method list -.pronamic-pay-payment-method-list { - list-style: none; - - margin-left: 0; - padding-left: 0; -} - -// Payment method fields -.pronamic-pay-payment-method-list input + label + .pronamic-pay-payment-method-fields { - display: none; -} - -.pronamic-pay-payment-method-list input:checked + label + .pronamic-pay-payment-method-fields { - display: block; -} diff --git a/src/Forms/FormPostType.php b/src/Forms/FormPostType.php deleted file mode 100644 index 34661e7a..00000000 --- a/src/Forms/FormPostType.php +++ /dev/null @@ -1,444 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Forms - */ - -namespace Pronamic\WordPress\Pay\Forms; - -use Pronamic\WordPress\Money\Money; -use Pronamic\WordPress\Money\Parser as MoneyParser; -use Pronamic\WordPress\Pay\Plugin; -use WP_Post; - -/** - * Form Post Type - * - * @author Remco Tolsma - * @version 2.7.1 - * @since 1.0.0 - */ -class FormPostType { - /** - * Post type. - * - * @var string - */ - const POST_TYPE = 'pronamic_pay_form'; - - /** - * Amount method input fixed. - * - * @var string - */ - const AMOUNT_METHOD_INPUT_FIXED = 'fixed'; - - /** - * Amount method input only. - * - * @var string - */ - const AMOUNT_METHOD_INPUT_ONLY = 'input_only'; - - /** - * Amount method choices only. - * - * @var string - */ - const AMOUNT_METHOD_CHOICES_ONLY = 'choices_only'; - - /** - * Amount method choices and input. - * - * @var string - */ - const AMOUNT_METHOD_CHOICES_AND_INPUT = 'choices_and_input'; - - /** - * Construct form post type object. - */ - public function __construct() { - /** - * Priority of the initial post types function should be set to < 10. - * - * @link https://core.trac.wordpress.org/ticket/28488. - * @link https://core.trac.wordpress.org/changeset/29318. - * - * @link https://github.com/WordPress/WordPress/blob/4.0/wp-includes/post.php#L167. - */ - add_action( 'init', [ $this, 'register_post_type' ], 0 ); // Highest priority. - - add_filter( 'manage_edit-' . self::POST_TYPE . '_columns', [ $this, 'edit_columns' ] ); - - add_action( 'manage_' . self::POST_TYPE . '_posts_custom_column', [ $this, 'custom_columns' ], 10, 2 ); - - /* - * Add meta box, we use priority 9 to make sure it loads before Yoast SEO meta box. - * @link https://github.com/Yoast/wordpress-seo/blob/2.3.4/admin/class-metabox.php#L20. - */ - add_action( 'add_meta_boxes', [ $this, 'add_meta_boxes' ], 9 ); - - add_action( 'save_post_' . self::POST_TYPE, [ $this, 'save_post' ] ); - - add_action( 'post_submitbox_misc_actions', [ $this, 'post_submitbox_misc_actions' ] ); - } - - /** - * Register post type. - * - * @return void - */ - public function register_post_type() { - register_post_type( - self::POST_TYPE, - [ - 'label' => __( 'Payment Forms', 'pronamic_ideal' ), - 'labels' => [ - 'name' => __( 'Payment Forms', 'pronamic_ideal' ), - 'singular_name' => __( 'Payment Form', 'pronamic_ideal' ), - 'add_new' => __( 'Add New', 'pronamic_ideal' ), - 'add_new_item' => __( 'Add New Payment Form', 'pronamic_ideal' ), - 'edit_item' => __( 'Edit Payment Form', 'pronamic_ideal' ), - 'new_item' => __( 'New Payment Form', 'pronamic_ideal' ), - 'all_items' => __( 'All Payment Forms', 'pronamic_ideal' ), - 'view_item' => __( 'View Payment Form', 'pronamic_ideal' ), - 'search_items' => __( 'Search Payment Forms', 'pronamic_ideal' ), - 'not_found' => __( 'No payment forms found.', 'pronamic_ideal' ), - 'not_found_in_trash' => __( 'No payment forms found in Trash.', 'pronamic_ideal' ), - 'menu_name' => __( 'Payment Forms', 'pronamic_ideal' ), - 'filter_items_list' => __( 'Filter payment forms list', 'pronamic_ideal' ), - 'items_list_navigation' => __( 'Payment forms list navigation', 'pronamic_ideal' ), - 'items_list' => __( 'Payment forms list', 'pronamic_ideal' ), - - /* - * New Post Type Labels in 5.0. - * @link https://make.wordpress.org/core/2018/12/05/new-post-type-labels-in-5-0/ - */ - 'item_published' => __( 'Payment form published.', 'pronamic_ideal' ), - 'item_published_privately' => __( 'Payment form published privately.', 'pronamic_ideal' ), - 'item_reverted_to_draft' => __( 'Payment form reverted to draft.', 'pronamic_ideal' ), - 'item_scheduled' => __( 'Payment form scheduled.', 'pronamic_ideal' ), - 'item_updated' => __( 'Payment form updated.', 'pronamic_ideal' ), - ], - 'public' => true, - 'publicly_queryable' => true, - 'show_ui' => true, - 'show_in_nav_menus' => true, - 'show_in_menu' => false, - 'show_in_admin_bar' => false, - 'supports' => [ - 'title', - 'revisions', - ], - 'rewrite' => [ - 'slug' => _x( 'payment-forms', 'slug', 'pronamic_ideal' ), - ], - 'query_var' => false, - 'capabilities' => self::get_capabilities(), - 'map_meta_cap' => true, - ] - ); - } - - /** - * Edit columns. - * - * @param array $columns Edit columns. - * @return array - */ - public function edit_columns( $columns ) { - $columns = [ - 'cb' => '', - 'title' => __( 'Title', 'pronamic_ideal' ), - 'pronamic_payment_form_gateway' => __( 'Gateway', 'pronamic_ideal' ), - 'pronamic_payment_form_payments' => __( 'Payments', 'pronamic_ideal' ), - 'pronamic_payment_form_earnings' => __( 'Earnings', 'pronamic_ideal' ), - 'pronamic_payment_form_shortcode' => __( 'Shortcode', 'pronamic_ideal' ), - 'date' => __( 'Date', 'pronamic_ideal' ), - ]; - - return $columns; - } - - /** - * Custom columns. - * - * @param string $column Column. - * @param int $post_id Post ID. - * @return void - */ - public function custom_columns( $column, $post_id ) { - global $post; - global $wpdb; - - switch ( $column ) { - case 'pronamic_payment_form_gateway': - $config_id = get_post_meta( $post_id, '_pronamic_payment_form_config_id', true ); - - if ( ! empty( $config_id ) ) { - echo esc_html( get_the_title( $config_id ) ); - } else { - echo '—'; - } - - break; - case 'pronamic_payment_form_payments': - /* phpcs:ignore WordPress.DB.DirectDatabaseQuery */ - $value = $wpdb->get_var( - $wpdb->prepare( - " - SELECT - COUNT( post.ID ) AS value - FROM - $wpdb->posts AS post - LEFT JOIN - $wpdb->postmeta AS meta_amount - ON post.ID = meta_amount.post_id AND meta_amount.meta_key = '_pronamic_payment_amount' - LEFT JOIN - $wpdb->postmeta AS meta_source - ON post.ID = meta_source.post_id AND meta_source.meta_key = '_pronamic_payment_source' - LEFT JOIN - $wpdb->postmeta AS meta_source_id - ON post.ID = meta_source_id.post_id AND meta_source_id.meta_key = '_pronamic_payment_source_id' - WHERE - post.post_type = 'pronamic_payment' - AND - post.post_status = 'payment_completed' - AND - meta_source.meta_value = 'payment_form' - AND - meta_source_id.meta_value = %s - GROUP BY - post.ID - ; - ", - $post_id - ) - ); - - echo esc_html( number_format_i18n( (int) $value ) ); - - break; - case 'pronamic_payment_form_earnings': - /* phpcs:ignore WordPress.DB.DirectDatabaseQuery */ - $value = $wpdb->get_var( - $wpdb->prepare( - " - SELECT - SUM( meta_amount.meta_value ) AS value - FROM - $wpdb->posts AS post - LEFT JOIN - $wpdb->postmeta AS meta_amount - ON post.ID = meta_amount.post_id AND meta_amount.meta_key = '_pronamic_payment_amount' - LEFT JOIN - $wpdb->postmeta AS meta_source - ON post.ID = meta_source.post_id AND meta_source.meta_key = '_pronamic_payment_source' - LEFT JOIN - $wpdb->postmeta AS meta_source_id - ON post.ID = meta_source_id.post_id AND meta_source_id.meta_key = '_pronamic_payment_source_id' - WHERE - post.post_type = 'pronamic_payment' - AND - post.post_status = 'payment_completed' - AND - meta_source.meta_value = 'payment_form' - AND - meta_source_id.meta_value = %s - GROUP BY - post.ID - ; - ", - $post_id - ) - ); - - if ( empty( $value ) ) { - $value = 0; - } - - $money = new Money( $value, 'EUR' ); - - echo esc_html( $money->format_i18n() ); - - break; - case 'pronamic_payment_form_shortcode': - printf( - '', - esc_attr( $this->get_shortcode( $post_id ) ) - ); - - break; - } - } - - /** - * Add meta boxes. - * - * @param string $post_type Post Type. - * @return void - */ - public function add_meta_boxes( $post_type ) { - if ( self::POST_TYPE === $post_type ) { - add_meta_box( - 'pronamic_payment_form_options', - __( 'Form Options', 'pronamic_ideal' ), - [ $this, 'meta_box_form_options' ], - $post_type, - 'normal', - 'high' - ); - } - } - - /** - * Pronamic Pay gateway config meta box. - * - * @param WP_Post $post The object for the current post/page. - * @return void - */ - public function meta_box_form_options( $post ) { - include __DIR__ . '/../../views/meta-box-form-options.php'; - } - - /** - * When the post is saved, saves our custom data. - * - * @link https://github.com/WordPress/WordPress/blob/5.3/wp-includes/post.php#L4096-L4119 - * @param int $post_id The ID of the post being saved. - * @return void - */ - public function save_post( $post_id ) { - // Check if our nonce is set. - if ( ! \array_key_exists( 'pronamic_pay_nonce', $_POST ) ) { - return; - } - - $nonce = \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_nonce'] ) ); - - // Verify that the nonce is valid. - if ( ! wp_verify_nonce( $nonce, 'pronamic_pay_save_form_options' ) ) { - return; - } - - // If this is an autosave, our form has not been submitted, so we don't want to do anything. - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { - return; - } - - // OK, its safe for us to save the data now. - $definition = [ - // General. - '_pronamic_payment_form_config_id' => FILTER_SANITIZE_NUMBER_INT, - '_pronamic_payment_form_amount_choices' => [ - 'flags' => FILTER_REQUIRE_ARRAY, - ], - ]; - - $data = \filter_input_array( INPUT_POST, $definition ); - - if ( ! \is_array( $data ) ) { - return; - } - - if ( \array_key_exists( '_pronamic_payment_form_button_text', $_POST ) ) { - $data['_pronamic_payment_form_button_text'] = \sanitize_text_field( \wp_unslash( $_POST['_pronamic_payment_form_button_text'] ) ); - } - - if ( \array_key_exists( '_pronamic_payment_form_description', $_POST ) ) { - $data['_pronamic_payment_form_description'] = \sanitize_text_field( \wp_unslash( $_POST['_pronamic_payment_form_description'] ) ); - } - - if ( \array_key_exists( '_pronamic_payment_form_amount_method', $_POST ) ) { - $data['_pronamic_payment_form_amount_method'] = \sanitize_text_field( \wp_unslash( $_POST['_pronamic_payment_form_amount_method'] ) ); - } - - // Convert amount choices to cents. - if ( isset( $data['_pronamic_payment_form_amount_choices'] ) ) { - $money_parser = new MoneyParser(); - - foreach ( $data['_pronamic_payment_form_amount_choices'] as $i => $amount ) { - // Parse input value to money object. - try { - $amount = $money_parser->parse( $amount ); - } catch ( \Exception $e ) { - // Remove amount choice if parsing failed (i.e. empty string). - unset( $data['_pronamic_payment_form_amount_choices'][ $i ] ); - - continue; - } - - $data['_pronamic_payment_form_amount_choices'][ $i ] = $amount->get_minor_units()->to_int(); - } - - // Remove empty choices. - $data['_pronamic_payment_form_amount_choices'] = array_filter( $data['_pronamic_payment_form_amount_choices'] ); - } - - // Update post meta data. - pronamic_pay_update_post_meta_data( $post_id, $data ); - } - - /** - * Get shortcode of the specified form post ID. - * - * @param int|null $post_id Post ID. - * @return string - */ - private function get_shortcode( $post_id = null ) { - $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; - - $shortcode = sprintf( '[pronamic_payment_form id="%s"]', esc_attr( strval( $post_id ) ) ); - - return $shortcode; - } - - /** - * Post submit box miscellaneous actions. - * - * @link https://github.com/WordPress/WordPress/blob/5.3/wp-admin/includes/meta-boxes.php#L283-L293 - * @return void - */ - public function post_submitbox_misc_actions() { - if ( self::POST_TYPE !== get_post_type() ) { - return; - } - - ?> -
- - - -
- 'edit_form', - 'read_post' => 'read_form', - 'delete_post' => 'delete_form', - 'edit_posts' => 'edit_forms', - 'edit_others_posts' => 'edit_others_forms', - 'publish_posts' => 'publish_forms', - 'read_private_posts' => 'read_private_forms', - 'read' => 'read', - 'delete_posts' => 'delete_forms', - 'delete_private_posts' => 'delete_private_forms', - 'delete_published_posts' => 'delete_published_forms', - 'delete_others_posts' => 'delete_others_forms', - 'edit_private_posts' => 'edit_private_forms', - 'edit_published_posts' => 'edit_published_forms', - 'create_posts' => 'create_forms', - ]; - } -} diff --git a/src/Forms/FormProcessor.php b/src/Forms/FormProcessor.php deleted file mode 100644 index 7e8b9673..00000000 --- a/src/Forms/FormProcessor.php +++ /dev/null @@ -1,261 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Forms - */ - -namespace Pronamic\WordPress\Pay\Forms; - -use Exception; -use Pronamic\WordPress\Number\Number; -use Pronamic\WordPress\Money\Money; -use Pronamic\WordPress\Pay\Core\PaymentMethods; -use Pronamic\WordPress\Pay\ContactName; -use Pronamic\WordPress\Pay\Customer; -use Pronamic\WordPress\Pay\Payments\Payment; -use Pronamic\WordPress\Pay\Payments\PaymentLines; -use Pronamic\WordPress\Pay\Plugin; -use WP_Error; -use WP_User; - -/** - * Form Processor - * - * @author Remco Tolsma - * @version 2.7.1 - * @since 3.7.0 - */ -class FormProcessor { - /** - * Construct form processor object. - */ - public function __construct() { - // Actions. - add_action( 'init', [ $this, 'init' ] ); - } - - /** - * Get amount. - * - * @return Money - */ - private function get_amount() { - // phpcs:disable WordPress.Security.NonceVerification.Missing -- Nonce verification in init method. - $amount_string = 0; - - if ( \array_key_exists( 'pronamic_pay_amount', $_POST ) ) { - $amount_string = \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_amount'] ) ); - - if ( 'other' === $amount_string ) { - $amount_string = \array_key_exists( 'pronamic_pay_amount_other', $_POST ) ? \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_amount_other'] ) ) : 0; - } - } - - // phpcs:enable WordPress.Security.NonceVerification.Missing - - $number = Number::from_string( (string) $amount_string ); - - $money = new Money( $number, 'EUR' ); - - return $money; - } - - /** - * Initialize. - * - * @return void - * @throws Exception When processing form fails on creating WordPress user. - */ - public function init() { - global $pronamic_pay_errors; - - $pronamic_pay_errors = []; - - // Nonce. - if ( ! \array_key_exists( 'pronamic_pay_nonce', $_POST ) ) { - return; - } - - $nonce = \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_nonce'] ) ); - - if ( ! wp_verify_nonce( $nonce, 'pronamic_pay' ) ) { - return; - } - - // Validate. - $valid = $this->validate(); - - if ( ! $valid ) { - return; - } - - // Source. - $source = array_key_exists( 'pronamic_pay_source', $_POST ) ? \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_source'] ) ) : ''; - $source_id = array_key_exists( 'pronamic_pay_source_id', $_POST ) ? (int) \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_source_id'] ) ) : 0; - - if ( ! FormsSource::is_valid( $source ) ) { - return; - } - - // Config ID. - $config_id = filter_input( INPUT_POST, 'pronamic_pay_config_id', \FILTER_SANITIZE_NUMBER_INT ); - - if ( FormsSource::PAYMENT_FORM === $source ) { - $config_id = get_post_meta( $source_id, '_pronamic_payment_form_config_id', true ); - } - - /* - * Start payment. - */ - $first_name = array_key_exists( 'pronamic_pay_first_name', $_POST ) ? \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_first_name'] ) ) : ''; - $last_name = array_key_exists( 'pronamic_pay_last_name', $_POST ) ? \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_last_name'] ) ) : ''; - $email = filter_input( INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL ); - $order_id = (string) time(); - - $description = null; - - if ( FormsSource::PAYMENT_FORM === $source ) { - $description = get_post_meta( $source_id, '_pronamic_payment_form_description', true ); - - if ( ! empty( $description ) ) { - $description = sprintf( '%s %s', $description, $order_id ); - } - } - - if ( empty( $description ) ) { - $description = sprintf( - /* translators: %s: order id */ - __( 'Payment Form %s', 'pronamic_ideal' ), - $order_id - ); - } - - $payment = new Payment(); - - $payment->title = sprintf( - /* translators: %s: payment data title */ - __( 'Payment for %s', 'pronamic_ideal' ), - $description - ); - - $payment->set_config_id( $config_id ); - $payment->set_description( $description ); - $payment->set_origin_id( $source_id ); - - $payment->order_id = $order_id; - $payment->source = $source; - $payment->source_id = $source_id; - - // Name. - $name = null; - - if ( ! empty( $first_name ) || ! empty( $last_name ) ) { - $name = new ContactName(); - - if ( ! empty( $first_name ) ) { - $name->set_first_name( $first_name ); - } - - if ( ! empty( $last_name ) ) { - $name->set_last_name( $last_name ); - } - } - - // Customer. - $customer = null; - - if ( null !== $name || ! empty( $email ) ) { - $customer = new Customer(); - - $customer->set_name( $name ); - - if ( ! empty( $email ) ) { - $customer->set_email( $email ); - } - } - - $payment->set_customer( $customer ); - - // Amount. - $payment->set_total_amount( $this->get_amount() ); - - // Method. - $payment_method = \array_key_exists( 'payment_method', $_POST ) ? \sanitize_text_field( \wp_unslash( $_POST['payment_method'] ) ) : null; - - $payment->set_payment_method( $payment_method ); - - // Payment lines. - $payment->lines = new PaymentLines(); - - $line = $payment->lines->new_line(); - - // Set line properties. - $line->set_id( strval( $order_id ) ); - $line->set_name( $description ); - $line->set_quantity( 1 ); - $line->set_unit_price( $payment->get_total_amount() ); - $line->set_total_amount( $payment->get_total_amount() ); - - // Gateway. - $gateway = Plugin::get_gateway( $config_id ); - - if ( null === $gateway ) { - return; - } - - // Start payment. - try { - $payment = Plugin::start_payment( $payment ); - } catch ( \Exception $e ) { - Plugin::render_exception( $e ); - - exit; - } - - $gateway->redirect( $payment ); - - exit; - } - - /** - * Validate. - * - * @return boolean True if valid, false otherwise. - */ - private function validate() { - global $pronamic_pay_errors; - - // Amount. - try { - $amount = $this->get_amount(); - } catch ( \Exception $e ) { - $pronamic_pay_errors['amount'] = __( 'Please enter a valid amount', 'pronamic_ideal' ); - } - - // phpcs:disable WordPress.Security.NonceVerification.Missing -- Nonce verification in init method. - - // First Name. - if ( \array_key_exists( 'pronamic_pay_first_name', $_POST ) ) { - $first_name = \sanitize_text_field( \wp_unslash( $_POST['pronamic_pay_first_name'] ) ); - - if ( empty( $first_name ) ) { - $pronamic_pay_errors['first_name'] = __( 'Please enter your first name', 'pronamic_ideal' ); - } - } - - // phpcs:enable WordPress.Security.NonceVerification.Missing - - // E-mail. - $email = filter_input( INPUT_POST, 'pronamic_pay_email', FILTER_VALIDATE_EMAIL ); - - if ( empty( $email ) ) { - $pronamic_pay_errors['email'] = __( 'Please enter a valid email address', 'pronamic_ideal' ); - } - - return empty( $pronamic_pay_errors ); - } -} diff --git a/src/Forms/FormScripts.php b/src/Forms/FormScripts.php deleted file mode 100644 index ec9e9d67..00000000 --- a/src/Forms/FormScripts.php +++ /dev/null @@ -1,75 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Forms - */ - -namespace Pronamic\WordPress\Pay\Forms; - -/** - * Form Scripts - * - * @author Remco Tolsma - * @version 2.2.6 - * @since 3.7.0 - */ -class FormScripts { - /** - * Constructs and initialize a form scripts object. - */ - public function __construct() { - /** - * We register the form style in the 'init' action so the style - * is available on the front end and admin pages. This is - * important for the block editor to work. According to the - * `_wp_scripts_maybe_doing_it_wrong` function it is allowed - * to register scripts in the 'init' action. - * - * @link https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts - * @link https://github.com/WordPress/WordPress/blob/5.1/wp-includes/script-loader.php#L2645-L2680 - * @link https://github.com/WordPress/WordPress/blob/5.1/wp-includes/functions.wp-scripts.php#L28-L52 - */ - add_action( 'init', [ $this, 'register' ] ); - - add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] ); - } - - /** - * Register. - * - * @return void - */ - public function register() { - $min = SCRIPT_DEBUG ? '' : '.min'; - - $file = 'css/forms' . $min . '.css'; - - wp_register_style( - 'pronamic-pay-forms', - plugins_url( $file, dirname( __DIR__ ) ), - [], - \hash_file( 'crc32b', dirname( __DIR__, 2 ) . '/' . $file ), - ); - } - - /** - * Enqueue. - * - * @link https://mikejolley.com/2013/12/02/sensible-script-enqueuing-shortcodes/ - * @link http://wordpress.stackexchange.com/questions/165754/enqueue-scripts-styles-when-shortcode-is-present - * @return void - */ - public function enqueue() { - if ( - has_shortcode( get_post_field( 'post_content' ), 'pronamic_payment_form' ) - || - is_singular( 'pronamic_pay_form' ) - ) { - wp_enqueue_style( 'pronamic-pay-forms' ); - } - } -} diff --git a/src/Forms/FormShortcode.php b/src/Forms/FormShortcode.php deleted file mode 100644 index f9b0c5f8..00000000 --- a/src/Forms/FormShortcode.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Forms - */ - -namespace Pronamic\WordPress\Pay\Forms; - -/** - * Form Shortcode - * - * @author Remco Tolsma - * @version 2.2.6 - * @since 3.7.0 - */ -class FormShortcode { - /** - * Forms module. - * - * @var FormsModule - */ - private $forms_module; - - /** - * Constructs and initializes an post types object. - * - * @param FormsModule $forms_module Reference to the forms module. - */ - public function __construct( $forms_module ) { - $this->forms_module = $forms_module; - - add_shortcode( 'pronamic_payment_form', [ $this, 'shortcode_form' ] ); - } - - /** - * Shortcode form. - * - * @link https://github.com/WordImpress/Give/blob/1.1/includes/shortcodes.php#L39-L65 - * @link https://github.com/WordImpress/Give/blob/1.1/includes/forms/template.php#L18-L140 - * - * @param array $atts Shortcode attributes array. - * - * @return string - * - * @throws \Exception Throws exception if output buffering is not active. - */ - public function shortcode_form( $atts ) { - $atts = shortcode_atts( - [ - 'id' => null, - ], - $atts, - 'pronamic_payment_form' - ); - - if ( empty( $atts['id'] ) ) { - return ''; - } - - return $this->forms_module->get_form_output_by_id( (int) $atts['id'] ); - } -} diff --git a/src/Forms/FormsModule.php b/src/Forms/FormsModule.php deleted file mode 100644 index 0b4e5ee6..00000000 --- a/src/Forms/FormsModule.php +++ /dev/null @@ -1,216 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Forms - */ - -namespace Pronamic\WordPress\Pay\Forms; - -use Pronamic\WordPress\Number\Number; -use Pronamic\WordPress\Pay\Payments\Payment; - -/** - * Forms Module - * - * @author Remco Tolsma - * @version 2.2.6 - * @since 3.7.0 - */ -class FormsModule { - /** - * Construct and initialize a forms module object. - */ - public function __construct() { - // Form Post Type. - new FormPostType(); - - // Processor. - new FormProcessor(); - - // Scripts. - new FormScripts(); - - // Shortcode. - new FormShortcode( $this ); - - // Actions. - add_filter( 'the_content', [ $this, 'maybe_add_form_to_content' ] ); - - add_filter( 'pronamic_payment_source_url_' . FormsSource::PAYMENT_FORM, [ $this, 'source_url' ], 10, 2 ); - add_filter( 'pronamic_payment_source_text_' . FormsSource::PAYMENT_FORM, [ $this, 'source_text' ], 10, 2 ); - add_filter( 'pronamic_payment_source_description_' . FormsSource::PAYMENT_FORM, [ $this, 'source_description' ], 10, 2 ); - } - - /** - * Maybe add form to content. - * - * @link https://developer.wordpress.org/reference/hooks/the_content/ - * - * @param string $content Post content to maybe extend with a payment form. - * - * @return string - * - * @throws \Exception Throws exception if output buffering is not active. - */ - public function maybe_add_form_to_content( $content ) { - if ( is_singular( 'pronamic_pay_form' ) && 'pronamic_pay_form' === get_post_type() ) { - $content .= $this->get_form_output_by_id( (int) get_the_ID() ); - } - - return $content; - } - - /** - * Get form output. - * - * @param int $id Form ID or form settings. - * - * @return string - * - * @throws \Exception Throws exception if output buffering is not active. - */ - public function get_form_output_by_id( $id ) { - $choices = \get_post_meta( $id, '_pronamic_payment_form_amount_choices', true ); - $amounts = []; - - if ( \is_array( $choices ) ) { - foreach ( $choices as $value ) { - $amounts[] = Number::from_mixed( $value )->divide( Number::from_int( 100 ) ); - } - } - - $args = [ - 'amount_method' => get_post_meta( $id, '_pronamic_payment_form_amount_method', true ), - 'amounts' => $amounts, - 'config_id' => get_post_meta( $id, '_pronamic_payment_form_config_id', true ), - 'html_id' => sprintf( 'pronamic-pay-form-%s', $id ), - 'source' => FormsSource::PAYMENT_FORM, - 'source_id' => $id, - 'title' => ( is_singular( 'pronamic_pay_form' ) ? null : get_the_title( $id ) ), - ]; - - // Button text. - $button_text = get_post_meta( $id, '_pronamic_payment_form_button_text', true ); - - if ( '' !== $button_text ) { - $args['button_text'] = $button_text; - } - - return $this->get_form_output( $args ); - } - - /** - * Get form output. - * - * @param array $args Form settings. - * - * @return string - * - * @throws \Exception When output buffering is not working as expected. - */ - public function get_form_output( $args ) { - if ( ! is_array( $args ) ) { - return ''; - } - - // Form settings. - $defaults = [ - 'amount_method' => FormPostType::AMOUNT_METHOD_INPUT_FIXED, - 'amounts' => [ 0 ], - 'button_text' => __( 'Pay Now', 'pronamic_ideal' ), - 'config_id' => get_option( 'pronamic_pay_config_id' ), - 'form_id' => null, - 'html_id' => 'pronamic-pay-form', - 'source' => null, - 'source_id' => null, - 'title' => null, - ]; - - $settings = wp_parse_args( $args, $defaults ); - - // Load template. - ob_start(); - - include __DIR__ . '/../../views/form.php'; - - $output = ob_get_clean(); - - if ( false === $output ) { - throw new \Exception( 'Output buffering is not active.' ); - } - - return $output; - } - - /** - * Source text filter. - * - * @param string $text The source text to filter. - * @param Payment $payment The payment for the specified source text. - * @return string - */ - public function source_text( $text, Payment $payment ) { - $text = __( 'Payment Form', 'pronamic_ideal' ); - - if ( empty( $payment->source_id ) ) { - return $text; - } - - $link = get_edit_post_link( intval( $payment->source_id ) ); - - if ( null === $link ) { - return $text; - } - - $text .= '
'; - - $text .= sprintf( - '%s', - esc_url( $link ), - esc_html( strval( $payment->source_id ) ) - ); - - return $text; - } - - /** - * Source description filter. - * - * @param string $text The source text to filter. - * @param Payment $payment The payment for the specified source text. - * @return string - */ - public function source_description( $text, Payment $payment ) { - $text = __( 'Payment Form', 'pronamic_ideal' ) . '
'; - - return $text; - } - - /** - * Source URL. - * - * @link https://developer.wordpress.org/reference/functions/get_edit_post_link/ - * - * @param string $url Source URL. - * @param Payment $payment Payment. - * - * @return string - */ - public function source_url( $url, Payment $payment ) { - if ( empty( $payment->source_id ) ) { - return $url; - } - - $link = get_edit_post_link( intval( $payment->source_id ) ); - - if ( null === $link ) { - return $url; - } - - return $link; - } -} diff --git a/src/Forms/FormsSource.php b/src/Forms/FormsSource.php deleted file mode 100644 index ed891675..00000000 --- a/src/Forms/FormsSource.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Forms - */ - -namespace Pronamic\WordPress\Pay\Forms; - -/** - * Form Source - * - * @author Reüel van der Steege - * @version 2.1.7 - * @since 2.1.7 - */ -class FormsSource { - /** - * Payment form. - * - * @var string - */ - const PAYMENT_FORM = 'payment_form'; - - /** - * Block payment form. - * - * @var string - */ - const BLOCK_PAYMENT_FORM = 'block_payment_form'; - - /** - * Is valid source? - * - * @param string $source Source string to validate. - * - * @return bool - */ - public static function is_valid( $source ) { - $sources = [ - self::BLOCK_PAYMENT_FORM, - self::PAYMENT_FORM, - ]; - - return in_array( $source, $sources, true ); - } -} diff --git a/views/form.php b/views/form.php deleted file mode 100644 index c33cd63e..00000000 --- a/views/form.php +++ /dev/null @@ -1,292 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -global $pronamic_pay_errors; - -use Pronamic\WordPress\Money\Currency; -use Pronamic\WordPress\Money\Money; -use Pronamic\WordPress\Pay\Core\PaymentMethods; -use Pronamic\WordPress\Pay\Core\SelectField; -use Pronamic\WordPress\Pay\Forms\FormPostType; -use Pronamic\WordPress\Pay\Forms\FormsSource; -use Pronamic\WordPress\Pay\Plugin; -use Pronamic\WordPress\Pay\Util; - -if ( ! isset( $settings ) ) { - return; -} - -$methods_with_choices = [ - FormPostType::AMOUNT_METHOD_CHOICES_ONLY, - FormPostType::AMOUNT_METHOD_CHOICES_AND_INPUT, -]; - -$gateway = Plugin::get_gateway( $settings['config_id'] ); - -// phpcs:ignore WordPress.Security.NonceVerification.Recommended -$amount_value = array_key_exists( 'amount', $_GET ) ? \sanitize_text_field( \wp_unslash( $_GET['amount'] ) ) : ''; - -if ( null === $gateway ) { - return; -} - -$currency = Currency::get_instance( 'EUR' ); - -// First payment method. -$payment_methods = $gateway->get_payment_methods( - [ - 'status' => [ - '', - 'active', - ], - ] -)->get_array(); - -$payment_methods = array_filter( - $payment_methods, - function( $payment_method ) { - return ! in_array( - $payment_method->get_id(), - [ - PaymentMethods::AFTERPAY, - PaymentMethods::AFTERPAY_NL, - PaymentMethods::AFTERPAY_COM, - PaymentMethods::APPLE_PAY, - PaymentMethods::IN3, - PaymentMethods::DIRECT_DEBIT_BANCONTACT, - PaymentMethods::DIRECT_DEBIT_IDEAL, - PaymentMethods::DIRECT_DEBIT_SOFORT, - PaymentMethods::KLARNA_PAY_LATER, - PaymentMethods::KLARNA_PAY_OVER_TIME, - PaymentMethods::RIVERTY, - PaymentMethods::SPRAYPAY, - ], - true - ); - } -); - -$payment_method_default = \reset( $payment_methods ); - -?> -
- - - -

- - - -
- - -
- - - - -
- - - - - - -
- - - -
- - - - - -
- - - -
- - - - - - - - - - - -
- - - -
- - - -
- - -

- - - -

- -

- - - -

- -

- - - -

-
- -
- - -
    - - - -
  • - get_id(); - - printf( - '', - \esc_attr( $html_id ), - \esc_attr( $payment_method->get_id() ), - checked( $payment_method === $payment_method_default, true, false ) - ); - - echo ' '; - - printf( - '', - \esc_attr( $html_id ), - \esc_html( $payment_method->get_name() ) - ); - - ?> -
    - - get_fields() as $field ) : ?> - -

    - - - output(); - } catch ( \Exception $exception ) { - echo ''; - - printf( - /* translators: %s: Exception message. */ - esc_html__( 'This field could not be displayed due to the following error message: "%s".', 'pronamic_ideal' ), - esc_html( $exception->getMessage() ) - ); - - echo ''; - } - - ?> -

    - - - -
    -
  • - - - -
- -
- - - -
- - - -

- : -

- - - -
- - - -
- - - $settings['source'], - 'pronamic_pay_source_id' => $settings['source_id'], - ]; - - // Add config ID when needed. - if ( FormsSource::PAYMENT_FORM !== $settings['source'] ) { - $fields['pronamic_pay_config_id'] = $settings['config_id']; - } - - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo Util::html_hidden_fields( $fields ); - - ?> - - - - - - - - -
-
-
diff --git a/views/meta-box-form-options.php b/views/meta-box-form-options.php deleted file mode 100644 index db376479..00000000 --- a/views/meta-box-form-options.php +++ /dev/null @@ -1,130 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay - */ - -use Pronamic\WordPress\Number\Number; -use Pronamic\WordPress\Money\Money; - -if ( ! isset( $post ) ) { - return; -} - -wp_nonce_field( 'pronamic_pay_save_form_options', 'pronamic_pay_nonce' ); - -?> - - - - - - - - - - - - - - - - - - - - - -
- - - ID, '_pronamic_payment_form_config_id', true ); - - \Pronamic\WordPress\Pay\Admin\AdminModule::dropdown_configs( - [ - 'name' => '_pronamic_payment_form_config_id', - 'selected' => $config_id, - ] - ); - - ?> -
- - - ID, '_pronamic_payment_form_button_text', true ); ?> - - -
- - - -
- ID, '_pronamic_payment_form_amount_choices', true ); - - $items = []; - - if ( \is_array( $choices ) ) { - foreach ( $choices as $value ) { - $items[] = Number::from_mixed( $value )->divide( Number::from_int( 100 ) ); - } - } - - // Add empty input field. - $items[] = ''; - - foreach ( $items as $i => $value ) { - printf( - '
- -
', - esc_attr( (string) $i ), - esc_attr( (string) $i ), - esc_attr( $value ) - ); - } - ?> -
- - - ID, '_pronamic_payment_form_description', true ); ?> - - -
From e0ace371084c2684b1d2aa8308e9548419a48659 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:36:31 +0200 Subject: [PATCH 049/243] Delete CSS forms. --- css/forms.css | 71 ----------------------------------------------- css/forms.css.map | 1 - css/forms.min.css | 1 - 3 files changed, 73 deletions(-) delete mode 100644 css/forms.css delete mode 100644 css/forms.css.map delete mode 100644 css/forms.min.css diff --git a/css/forms.css b/css/forms.css deleted file mode 100644 index 92a44abb..00000000 --- a/css/forms.css +++ /dev/null @@ -1,71 +0,0 @@ -.pronamic-pay-form fieldset { - border: 0; -} -.pronamic-pay-form legend { - border-bottom: 1px solid #ededed; - font-weight: 700; - margin: 10px 0 15px; - padding: 0 0 10px; - width: 100%; -} -.pronamic-pay-form .pronamic-pay-amount-input[type=text] { - width: auto; -} - -.pronamic-pay-required-indicator { - color: #a00; -} - -.pronamic-pay-form-row { - margin: 0 0 15px; -} -.pronamic-pay-form-row input, -.pronamic-pay-form-row textarea, -.pronamic-pay-form-row select { - border-radius: 0; - outline: none; - width: 100%; -} - -.pronamic-pay-form-row-wide { - clear: both; - margin: 0 0 15px; -} - -.pronamic-pay-form-row-first, -.pronamic-pay-form-row-last { - width: 48.5%; -} - -.pronamic-pay-form-row-first { - float: left; -} - -.pronamic-pay-form-row-last { - float: right; -} - -.pronamic-pay-error { - background: #f9f9f9; - border-left: 4px solid #a00; - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); - clear: both; - margin: 15px 0; - padding: 1em 1em 1em 2em; - position: relative; -} - -.pronamic-pay-payment-method-list { - list-style: none; - margin-left: 0; - padding-left: 0; -} - -.pronamic-pay-payment-method-list input + label + .pronamic-pay-payment-method-fields { - display: none; -} - -.pronamic-pay-payment-method-list input:checked + label + .pronamic-pay-payment-method-fields { - display: block; -} diff --git a/css/forms.css.map b/css/forms.css.map deleted file mode 100644 index 66fe0653..00000000 --- a/css/forms.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sourceRoot":"","sources":["../scss/forms.scss","../scss/admin/_variables.scss"],"names":[],"mappings":"AAIC;EACC;;AAID;EACC;EAEA;EAEA;EACA;EAEA;;AAID;EACC;;;AAKF;EACC,OCFU;;;ADMX;EACC;;AAEA;AAAA;AAAA;EAGC;EAEA;EAEA;;;AAIF;EACC;EAEA;;;AAGD;AAAA;EAEC;;;AAGD;EACC;;;AAGD;EACC;;;AAID;EACC,YCjDuB;EDmDvB;EAEA;EAEA;EAEA;EAEA;EAEA;;;AAID;EACC;EAEA;EACA;;;AAID;EACC;;;AAGD;EACC","file":"forms.css"} \ No newline at end of file diff --git a/css/forms.min.css b/css/forms.min.css deleted file mode 100644 index 7e665332..00000000 --- a/css/forms.min.css +++ /dev/null @@ -1 +0,0 @@ -.pronamic-pay-form fieldset{border:0}.pronamic-pay-form legend{border-bottom:1px solid #ededed;font-weight:700;margin:10px 0 15px;padding:0 0 10px;width:100%}.pronamic-pay-form .pronamic-pay-amount-input[type=text]{width:auto}.pronamic-pay-required-indicator{color:#a00}.pronamic-pay-form-row{margin:0 0 15px}.pronamic-pay-form-row input,.pronamic-pay-form-row select,.pronamic-pay-form-row textarea{border-radius:0;outline:none;width:100%}.pronamic-pay-form-row-wide{clear:both;margin:0 0 15px}.pronamic-pay-form-row-first,.pronamic-pay-form-row-last{width:48.5%}.pronamic-pay-form-row-first{float:left}.pronamic-pay-form-row-last{float:right}.pronamic-pay-error{background:#f9f9f9;border-left:4px solid #a00;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.125);box-shadow:0 1px 1px rgba(0,0,0,.125);clear:both;margin:15px 0;padding:1em 1em 1em 2em;position:relative}.pronamic-pay-payment-method-list{list-style:none;margin-left:0;padding-left:0}.pronamic-pay-payment-method-list input+label+.pronamic-pay-payment-method-fields{display:none}.pronamic-pay-payment-method-list input:checked+label+.pronamic-pay-payment-method-fields{display:block} From 7596af85fe25ff7a8b288c063d9e2a2e3af35b45 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:41:53 +0200 Subject: [PATCH 050/243] Update BlocksModule.php --- src/Blocks/BlocksModule.php | 207 ------------------------------------ 1 file changed, 207 deletions(-) diff --git a/src/Blocks/BlocksModule.php b/src/Blocks/BlocksModule.php index dca7c9dd..75f585c1 100644 --- a/src/Blocks/BlocksModule.php +++ b/src/Blocks/BlocksModule.php @@ -34,22 +34,11 @@ class BlocksModule { public function setup() { global $wp_version; - // Initialize. - add_action( 'init', [ $this, 'register_scripts' ] ); - add_action( 'init', [ $this, 'register_block_types' ] ); - - add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_styles' ] ); - add_filter( 'block_categories_all', [ $this, 'block_categories' ], 10, 2 ); if ( \version_compare( $wp_version, '5.8', '<' ) ) { add_filter( 'block_categories', [ $this, 'block_categories' ], 10, 2 ); } - - // Source text and description. - add_filter( 'pronamic_payment_source_url_' . FormsSource::BLOCK_PAYMENT_FORM, [ $this, 'source_url' ], 10, 2 ); - add_filter( 'pronamic_payment_source_text_' . FormsSource::BLOCK_PAYMENT_FORM, [ $this, 'source_text' ], 10, 2 ); - add_filter( 'pronamic_payment_source_description_' . FormsSource::BLOCK_PAYMENT_FORM, [ $this, 'source_description' ], 10, 2 ); } /** @@ -69,200 +58,4 @@ public function block_categories( $categories, $post ) { return $categories; } - - /** - * Register blocks. - * - * @return void - */ - public function register_scripts() { - // Register editor script. - $min = SCRIPT_DEBUG ? '' : '.min'; - - wp_register_script( - 'pronamic-payment-form-editor', - plugins_url( '/js/dist/block-payment-form' . $min . '.js', dirname( __DIR__ ) ), - [ 'wp-blocks', 'wp-components', 'wp-editor', 'wp-element' ], - pronamic_pay_plugin()->get_version(), - false - ); - - // Localize script. - wp_localize_script( - 'pronamic-payment-form-editor', - 'pronamic_payment_form', - [ - 'title' => _x( 'Payment Form', 'Block', 'pronamic_ideal' ), - 'label_add_form' => __( 'Add form', 'pronamic_ideal' ), - 'label_amount' => __( 'Amount', 'pronamic_ideal' ), - ] - ); - } - - /** - * Register block types. - * - * @return void - */ - public function register_block_types() { - register_block_type( - 'pronamic-pay/payment-form', - [ - 'title' => __( 'Payment Form', 'pronamic_ideal' ), - 'render_callback' => [ $this, 'render_payment_form_block' ], - 'editor_script' => 'pronamic-payment-form-editor', - 'attributes' => [ - 'amount' => [ - 'type' => 'string', - 'default' => '0', - ], - ], - ] - ); - } - - /** - * Enqueue styles. - * - * @return void - */ - public function enqueue_styles() { - \wp_enqueue_style( 'pronamic-pay-forms' ); - } - - /** - * Render payment form block. - * - * @param array $attributes Attributes. - * - * @return string - * - * @throws \Exception When output buffering is not working as expected. - */ - public function render_payment_form_block( $attributes = [] ) { - // Amount. - $amounts = []; - - if ( ! empty( $attributes['amount'] ) ) { - try { - $amounts[] = Number::from_mixed( $attributes['amount'] ); - } catch ( \Exception $e ) { - /** - * It is possible that in the past localized numbers were stored in the amount attribute. - */ - try { - $parser = new NumberParser(); - - $amounts[] = $parser->parse( $attributes['amount'] ); - } catch ( \Exception $e ) { - return ''; - } - } - } - - // Form settings. - $args = [ - 'amounts' => $amounts, - 'html_id' => sprintf( 'pronamic-pay-payment-form-%s', get_the_ID() ), - 'source' => FormsSource::BLOCK_PAYMENT_FORM, - 'source_id' => get_the_ID(), - ]; - - // Check valid gateway. - $config_id = get_option( 'pronamic_pay_config_id' ); - - $gateway = Plugin::get_gateway( $config_id ); - - if ( null === $gateway ) { - ob_start(); - - Plugin::render_errors( - new WP_Error( - 'pay_error', - __( 'Unable to process payments with default gateway.', 'pronamic_ideal' ) - ) - ); - - $output = ob_get_clean(); - - if ( false === $output ) { - throw new \Exception( 'Output buffering is not active.' ); - } - - return $output; - } - - $this->enqueue_styles(); - - // Return form output. - return pronamic_pay_plugin()->forms_module->get_form_output( $args ); - } - - /** - * Source text filter. - * - * @param string $text The source text to filter. - * @param Payment $payment The payment for the specified source text. - * - * @return string - */ - public function source_text( $text, Payment $payment ) { - $text = __( 'Payment Form Block', 'pronamic_ideal' ); - - if ( empty( $payment->source_id ) ) { - return $text; - } - - $link = get_edit_post_link( intval( $payment->source_id ) ); - - if ( null === $link ) { - return $text; - } - - $text .= '
'; - - $text .= sprintf( - '%s', - esc_url( $link ), - esc_html( strval( $payment->source_id ) ) - ); - - return $text; - } - - /** - * Source description filter. - * - * @param string $text The source text to filter. - * @param Payment $payment The payment for the specified source text. - * - * @return string - */ - public function source_description( $text, Payment $payment ) { - $text = __( 'Payment Form Block', 'pronamic_ideal' ) . '
'; - - return $text; - } - - /** - * Source URL. - * - * @param string $url Source URL. - * @param Payment $payment Payment. - * - * @return string - */ - public function source_url( $url, Payment $payment ) { - if ( empty( $payment->source_id ) ) { - return $url; - } - - $link = get_edit_post_link( intval( $payment->source_id ) ); - - if ( null === $link ) { - return $url; - } - - return $link; - } } From c475d8f4d3699204ce1815aadf1b9ee0f7cf02ed Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:08:49 +0200 Subject: [PATCH 051/243] Remove payment form block. --- js/dist/block-payment-form.js | 109 ------------------------- js/dist/block-payment-form.min.js | 1 - js/dist/blocks/payment-form/block.json | 14 ---- js/src/block-payment-form.js | 109 ------------------------- js/src/blocks/payment-form/block.json | 14 ---- 5 files changed, 247 deletions(-) delete mode 100644 js/dist/block-payment-form.js delete mode 100644 js/dist/block-payment-form.min.js delete mode 100644 js/dist/blocks/payment-form/block.json delete mode 100644 js/src/block-payment-form.js delete mode 100644 js/src/blocks/payment-form/block.json diff --git a/js/dist/block-payment-form.js b/js/dist/block-payment-form.js deleted file mode 100644 index ac639489..00000000 --- a/js/dist/block-payment-form.js +++ /dev/null @@ -1,109 +0,0 @@ -/* globals pronamic_payment_form */ -( function ( wp, blocks, components, editor, element ) { - var el = element.createElement; - var Fragment = element.Fragment; - var InspectorControls = editor.InspectorControls; - var Button = components.Button; - var Placeholder = components.Placeholder; - var TextControl = components.TextControl; - var ServerSideRender = wp.serverSideRender; - - /** - * Register payment form block type. - * - * @param string name Block name. - * @param object settings Block settings. - * - * @return WPBlock Block if registered successfully, otherwise "undefined". - */ - blocks.registerBlockType( 'pronamic-pay/payment-form', { - title: pronamic_payment_form.title, - icon: 'money', - category: 'pronamic-pay', - - // Attributes. - attributes: { - amount: { - type: 'string' - } - }, - - // Feature supports. - supports: { - // Remove support for an HTML mode. - html: false - }, - - // Edit. - edit: function ( props ) { - var amount = props.attributes.amount; - var hasSettingsSet = props.attributes && parseInt( amount ) > 0; - - function onChangeAmount( updatedAmount ) { - props.setAttributes( { amount: updatedAmount } ); - } - - return el( Fragment, null, - - // Inspector controls. - el( InspectorControls, null, - el( Fragment, null, - el( TextControl, { - type: 'number', - step: 'any', - label: pronamic_payment_form.label_amount, - value: amount, - onChange: onChangeAmount - } ) - ) - ), - - // Setup required props. - ! hasSettingsSet && - el( Placeholder, { - label: pronamic_payment_form.title, - icon: 'money' - }, - el( Fragment, null, - el( TextControl, { - type: 'number', - step: 'any', - label: pronamic_payment_form.label_amount, - onChange: function ( value ) { - }, - onBlur: function () { - onChangeAmount( event.target.value ); - } - } ), - el( 'div', - { - style: { width: '100%' } - }, - el( Button, - { isPrimary: true }, - el( Fragment, null, pronamic_payment_form.label_add_form ) - ) - ) - ) - ), - - // Server side render. - hasSettingsSet && el( ServerSideRender, { - block: 'pronamic-pay/payment-form', - attributes: props.attributes - } ) - ); - }, - - // Save. - save: function () { - return null; - } - } ); -} )( - window.wp, - window.wp.blocks, - window.wp.components, - window.wp.blockEditor, - window.wp.element -); diff --git a/js/dist/block-payment-form.min.js b/js/dist/block-payment-form.min.js deleted file mode 100644 index 56e2a64e..00000000 --- a/js/dist/block-payment-form.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,n,e,o,a){var r=a.createElement,l=a.Fragment,i=o.InspectorControls,m=e.Button,p=e.Placeholder,u=e.TextControl,c=t.serverSideRender;n.registerBlockType("pronamic-pay/payment-form",{title:pronamic_payment_form.title,icon:"money",category:"pronamic-pay",attributes:{amount:{type:"string"}},supports:{html:!1},edit:function(t){var n=t.attributes.amount,e=t.attributes&&parseInt(n)>0;function o(n){t.setAttributes({amount:n})}return r(l,null,r(i,null,r(l,null,r(u,{type:"number",step:"any",label:pronamic_payment_form.label_amount,value:n,onChange:o}))),!e&&r(p,{label:pronamic_payment_form.title,icon:"money"},r(l,null,r(u,{type:"number",step:"any",label:pronamic_payment_form.label_amount,onChange:function(t){},onBlur:function(){o(event.target.value)}}),r("div",{style:{width:"100%"}},r(m,{isPrimary:!0},r(l,null,pronamic_payment_form.label_add_form))))),e&&r(c,{block:"pronamic-pay/payment-form",attributes:t.attributes}))},save:function(){return null}})}(window.wp,window.wp.blocks,window.wp.components,window.wp.blockEditor,window.wp.element); \ No newline at end of file diff --git a/js/dist/blocks/payment-form/block.json b/js/dist/blocks/payment-form/block.json deleted file mode 100644 index 3ffdbca0..00000000 --- a/js/dist/blocks/payment-form/block.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "pronamic-pay/payment-form", - "title": "Payment Form", - "category": "pronamic-pay", - "attributes": { - "amount": { - "type": "string" - } - }, - "editorScript": "pronamic-payment-form-editor", - "editorStyle": "pronamic-pay-forms", - "style": "pronamic-pay-forms", - "textdomain": "pronamic_ideal" -} diff --git a/js/src/block-payment-form.js b/js/src/block-payment-form.js deleted file mode 100644 index ac639489..00000000 --- a/js/src/block-payment-form.js +++ /dev/null @@ -1,109 +0,0 @@ -/* globals pronamic_payment_form */ -( function ( wp, blocks, components, editor, element ) { - var el = element.createElement; - var Fragment = element.Fragment; - var InspectorControls = editor.InspectorControls; - var Button = components.Button; - var Placeholder = components.Placeholder; - var TextControl = components.TextControl; - var ServerSideRender = wp.serverSideRender; - - /** - * Register payment form block type. - * - * @param string name Block name. - * @param object settings Block settings. - * - * @return WPBlock Block if registered successfully, otherwise "undefined". - */ - blocks.registerBlockType( 'pronamic-pay/payment-form', { - title: pronamic_payment_form.title, - icon: 'money', - category: 'pronamic-pay', - - // Attributes. - attributes: { - amount: { - type: 'string' - } - }, - - // Feature supports. - supports: { - // Remove support for an HTML mode. - html: false - }, - - // Edit. - edit: function ( props ) { - var amount = props.attributes.amount; - var hasSettingsSet = props.attributes && parseInt( amount ) > 0; - - function onChangeAmount( updatedAmount ) { - props.setAttributes( { amount: updatedAmount } ); - } - - return el( Fragment, null, - - // Inspector controls. - el( InspectorControls, null, - el( Fragment, null, - el( TextControl, { - type: 'number', - step: 'any', - label: pronamic_payment_form.label_amount, - value: amount, - onChange: onChangeAmount - } ) - ) - ), - - // Setup required props. - ! hasSettingsSet && - el( Placeholder, { - label: pronamic_payment_form.title, - icon: 'money' - }, - el( Fragment, null, - el( TextControl, { - type: 'number', - step: 'any', - label: pronamic_payment_form.label_amount, - onChange: function ( value ) { - }, - onBlur: function () { - onChangeAmount( event.target.value ); - } - } ), - el( 'div', - { - style: { width: '100%' } - }, - el( Button, - { isPrimary: true }, - el( Fragment, null, pronamic_payment_form.label_add_form ) - ) - ) - ) - ), - - // Server side render. - hasSettingsSet && el( ServerSideRender, { - block: 'pronamic-pay/payment-form', - attributes: props.attributes - } ) - ); - }, - - // Save. - save: function () { - return null; - } - } ); -} )( - window.wp, - window.wp.blocks, - window.wp.components, - window.wp.blockEditor, - window.wp.element -); diff --git a/js/src/blocks/payment-form/block.json b/js/src/blocks/payment-form/block.json deleted file mode 100644 index 3ffdbca0..00000000 --- a/js/src/blocks/payment-form/block.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "pronamic-pay/payment-form", - "title": "Payment Form", - "category": "pronamic-pay", - "attributes": { - "amount": { - "type": "string" - } - }, - "editorScript": "pronamic-payment-form-editor", - "editorStyle": "pronamic-pay-forms", - "style": "pronamic-pay-forms", - "textdomain": "pronamic_ideal" -} From 113ab4744d96dbccf33f6e105fad96579b93ce2d Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 18 Jul 2023 09:31:50 +0200 Subject: [PATCH 052/243] v4.10.0 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70bd797c..6494c526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] +## [4.10.0] - 2023-07-18 + +### Removed + +- Removed forms module, moved to https://github.com/pronamic/wp-pronamic-pay-forms. + +Full set of changes: [`4.9.4...4.10.0`][4.10.0] + +[4.10.0]: https://github.com/pronamic/wp-pay-core/compare/v4.9.4...v4.10.0 + ## [4.9.4] - 2023-07-12 ### Added diff --git a/package.json b/package.json index 1a1bf5fa..cf2e87db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wp-pay/core", - "version": "4.9.4", + "version": "4.10.0", "description": "Core components for the WordPress payment processing library.", "repository": { "type": "git", From a466897162b141d7e27e4fd59178a07300887f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 19 Jul 2023 15:12:13 +0200 Subject: [PATCH 053/243] Remove forms leftovers. --- src/Admin/AdminModule.php | 11 ----------- src/Admin/Install.php | 8 -------- src/Plugin.php | 8 -------- 3 files changed, 27 deletions(-) diff --git a/src/Admin/AdminModule.php b/src/Admin/AdminModule.php index 6e651b10..1922e7ad 100644 --- a/src/Admin/AdminModule.php +++ b/src/Admin/AdminModule.php @@ -23,7 +23,6 @@ use Pronamic\WordPress\Pay\CreditCard; use Pronamic\WordPress\Pay\Customer; use Pronamic\WordPress\Pay\CustomerHelper; -use Pronamic\WordPress\Pay\Forms\FormPostType; use Pronamic\WordPress\Pay\Payments\Payment; use Pronamic\WordPress\Pay\Payments\PaymentLines; use Pronamic\WordPress\Pay\Plugin; @@ -672,7 +671,6 @@ public function admin_menu_parent_file( $parent_file ) { } switch ( $screen->id ) { - case FormPostType::POST_TYPE: case AdminGatewayPostType::POST_TYPE: case AdminPaymentPostType::POST_TYPE: case AdminSubscriptionPostType::POST_TYPE: @@ -838,15 +836,6 @@ public function admin_menu() { ]; } - if ( \in_array( 'forms', $modules, true ) ) { - $submenu_pages[] = [ - 'page_title' => __( 'Payment Forms', 'pronamic_ideal' ), - 'menu_title' => __( 'Forms', 'pronamic_ideal' ), - 'capability' => 'edit_forms', - 'menu_slug' => 'edit.php?post_type=pronamic_pay_form', - ]; - } - $submenu_pages[] = [ 'page_title' => __( 'Configurations', 'pronamic_ideal' ), 'menu_title' => __( 'Configurations', 'pronamic_ideal' ), diff --git a/src/Admin/Install.php b/src/Admin/Install.php index 6f793907..2d160829 100644 --- a/src/Admin/Install.php +++ b/src/Admin/Install.php @@ -11,7 +11,6 @@ namespace Pronamic\WordPress\Pay\Admin; use Pronamic\WordPress\Pay\AbstractIntegration; -use Pronamic\WordPress\Pay\Forms\FormPostType; use Pronamic\WordPress\Pay\Payments\PaymentPostType; use Pronamic\WordPress\Pay\Plugin; use Pronamic\WordPress\Pay\Upgrades\Upgrade620; @@ -178,13 +177,6 @@ private function create_roles() { foreach ( $payment_capabilities as $capability ) { $roles->add_cap( 'administrator', $capability ); } - - // Forms. - $form_capabilities = FormPostType::get_capabilities(); - - foreach ( $form_capabilities as $capability ) { - $roles->add_cap( 'administrator', $capability ); - } } /** diff --git a/src/Plugin.php b/src/Plugin.php index ef3f0936..01b676ee 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -174,13 +174,6 @@ public static function instance( $args = [] ) { */ public $blocks_module; - /** - * Forms module. - * - * @var Forms\FormsModule - */ - public $forms_module; - /** * Tracking module. * @@ -671,7 +664,6 @@ public function plugins_loaded() { $this->webhook_logger->setup(); // Modules. - $this->forms_module = new Forms\FormsModule(); $this->payments_module = new Payments\PaymentsModule( $this ); $this->subscriptions_module = new Subscriptions\SubscriptionsModule( $this ); $this->tracking_module = new TrackingModule(); From 56870a1e025de83f2c099bbd60b69aa66164f4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reu=CC=88el=20van=20der=20Steege?= Date: Wed, 19 Jul 2023 15:59:46 +0200 Subject: [PATCH 054/243] v4.10.1 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6494c526..3f7bc82b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ This projects adheres to [Semantic Versioning](http://semver.org/) and [Keep a C ## [Unreleased][unreleased] +## [4.10.1] - 2023-07-19 + +### Commits + +- Moved references of forms to pronamic/wp-pronamic-pay-forms library. ([a466897](https://github.com/pronamic/wp-pay-core/commit/a466897162b141d7e27e4fd59178a07300887f22)) + +Full set of changes: [`4.10.0...4.10.1`][4.10.1] + +[4.10.1]: https://github.com/pronamic/wp-pay-core/compare/v4.10.0...v4.10.1 + ## [4.10.0] - 2023-07-18 ### Removed diff --git a/package.json b/package.json index cf2e87db..074a630c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wp-pay/core", - "version": "4.10.0", + "version": "4.10.1", "description": "Core components for the WordPress payment processing library.", "repository": { "type": "git", From c948b2faba6f08f3f5c4d3595e7806fee63c094f Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Thu, 20 Jul 2023 14:48:36 +0200 Subject: [PATCH 055/243] Update `overtrue/phplint`. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 618d12b1..281a3c2c 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "require-dev": { "automattic/wordbless": "^0.4.2", "bamarni/composer-bin-plugin": "^1.4", - "overtrue/phplint": "^4.5", + "overtrue/phplint": "^9.0", "php-coveralls/php-coveralls": "^2.4", "php-stubs/wordpress-globals": "^0.2.0", "php-stubs/wp-cli-stubs": "^2.4", From 494f631aaa7bc9327339c3e5d4ae15119fa92737 Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:11:35 +0200 Subject: [PATCH 056/243] Ignore /docs folder. This will make the WordPress plugin review team happy. Calling files remotely: ``` pronamic-pay-with-mollie-for-woocommerce/packages/wp-pay/core/docs/hooks.md:598:

Pronamic WordPre [...]
```

https://github.com/pronamic/wp-pay-core/issues/143
---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitattributes b/.gitattributes
index 7aac1e96..448e70ec 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,4 +1,5 @@
 /bin               export-ignore
+/docs              export-ignore
 /fonts/src         export-ignore
 /images/src        export-ignore
 /js/src            export-ignore

From a0f81a2ee5426a20e4703d9e9982a812d18bcac3 Mon Sep 17 00:00:00 2001
From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com>
Date: Tue, 22 Aug 2023 10:17:34 +0200
Subject: [PATCH 057/243] npm install slick-carousel

---
 package.json | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package.json b/package.json
index 074a630c..425f91b8 100644
--- a/package.json
+++ b/package.json
@@ -36,6 +36,7 @@
     Date: Tue, 22 Aug 2023 10:17:47 +0200 Subject: [PATCH 058/243] Remove some old block build/minify scripts. --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index 425f91b8..60cfc4fd 100644 --- a/package.json +++ b/package.json @@ -80,12 +80,10 @@ "sass-lint": "sass-lint --verbose", "js-build": "npm-run-all js-build-* js-minify", "js-build-copy": "cp js/src/*.js js/dist", - "js-build-blocks-json": "rsync -a --prune-empty-dirs --include '*/' --include 'block.json' --exclude '*' js/src/ js/dist/", "js-minify": "npm-run-all js-minify-*", "js-minify-admin": "terser --compress --mangle --output js/dist/admin.min.js js/src/admin.js", "js-minify-admin-reports": "terser --compress --mangle --output js/dist/admin-reports.min.js js/src/admin-reports.js", "js-minify-admin-tour": "terser --compress --mangle --output js/dist/admin-tour.min.js js/src/admin-tour.js", - "js-minify-block-payment-form": "terser --compress --mangle --output js/dist/block-payment-form.min.js js/src/block-payment-form.js", "sass": "sass scss:css" } } From a7cb4b1daa42820a3a6a5725d585b061c7e06ece Mon Sep 17 00:00:00 2001 From: Remco Tolsma <869674+remcotolsma@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:48:25 +0200 Subject: [PATCH 059/243] No longer load Slick from https://cdnjs.cloudflare.com/. This will make the WordPress plugin review team happy. Calling files remotely: ``` pronamic-pay-with-mollie-for-woocommerce/packages/wp-pay/core/src/Subscriptions/SubscriptionsModule.php:537: 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js', pronamic-pay-with-mollie-for-woocommerce/packages/wp-pay/core/src/Subscriptions/SubscriptionsModule.php:545: 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css', p ``` https://github.com/pronamic/wp-pay-core/issues/143 --- assets/slick-carousel/slick.css | 119 + assets/slick-carousel/slick.js | 3011 +++++++++++++++++++++ assets/slick-carousel/slick.min.css | 1 + assets/slick-carousel/slick.min.js | 1 + package.json | 6 + src/Subscriptions/SubscriptionsModule.php | 26 +- views/subscription-mandate.php | 2 +- 7 files changed, 3155 insertions(+), 11 deletions(-) create mode 100644 assets/slick-carousel/slick.css create mode 100644 assets/slick-carousel/slick.js create mode 100644 assets/slick-carousel/slick.min.css create mode 100644 assets/slick-carousel/slick.min.js diff --git a/assets/slick-carousel/slick.css b/assets/slick-carousel/slick.css new file mode 100644 index 00000000..57477e84 --- /dev/null +++ b/assets/slick-carousel/slick.css @@ -0,0 +1,119 @@ +/* Slider */ +.slick-slider +{ + position: relative; + + display: block; + box-sizing: border-box; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + -webkit-touch-callout: none; + -khtml-user-select: none; + -ms-touch-action: pan-y; + touch-action: pan-y; + -webkit-tap-highlight-color: transparent; +} + +.slick-list +{ + position: relative; + + display: block; + overflow: hidden; + + margin: 0; + padding: 0; +} +.slick-list:focus +{ + outline: none; +} +.slick-list.dragging +{ + cursor: pointer; + cursor: hand; +} + +.slick-slider .slick-track, +.slick-slider .slick-list +{ + -webkit-transform: translate3d(0, 0, 0); + -moz-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -o-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} + +.slick-track +{ + position: relative; + top: 0; + left: 0; + + display: block; + margin-left: auto; + margin-right: auto; +} +.slick-track:before, +.slick-track:after +{ + display: table; + + content: ''; +} +.slick-track:after +{ + clear: both; +} +.slick-loading .slick-track +{ + visibility: hidden; +} + +.slick-slide +{ + display: none; + float: left; + + height: 100%; + min-height: 1px; +} +[dir='rtl'] .slick-slide +{ + float: right; +} +.slick-slide img +{ + display: block; +} +.slick-slide.slick-loading img +{ + display: none; +} +.slick-slide.dragging img +{ + pointer-events: none; +} +.slick-initialized .slick-slide +{ + display: block; +} +.slick-loading .slick-slide +{ + visibility: hidden; +} +.slick-vertical .slick-slide +{ + display: block; + + height: auto; + + border: 1px solid transparent; +} +.slick-arrow.slick-hidden { + display: none; +} diff --git a/assets/slick-carousel/slick.js b/assets/slick-carousel/slick.js new file mode 100644 index 00000000..7aca6136 --- /dev/null +++ b/assets/slick-carousel/slick.js @@ -0,0 +1,3011 @@ +/* + _ _ _ _ + ___| (_) ___| | __ (_)___ +/ __| | |/ __| |/ / | / __| +\__ \ | | (__| < _ | \__ \ +|___/_|_|\___|_|\_(_)/ |___/ + |__/ + + Version: 1.8.1 + Author: Ken Wheeler + Website: http://kenwheeler.github.io + Docs: http://kenwheeler.github.io/slick + Repo: http://github.com/kenwheeler/slick + Issues: http://github.com/kenwheeler/slick/issues + + */ +/* global window, document, define, jQuery, setInterval, clearInterval */ +;(function(factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } else if (typeof exports !== 'undefined') { + module.exports = factory(require('jquery')); + } else { + factory(jQuery); + } + +}(function($) { + 'use strict'; + var Slick = window.Slick || {}; + + Slick = (function() { + + var instanceUid = 0; + + function Slick(element, settings) { + + var _ = this, dataSettings; + + _.defaults = { + accessibility: true, + adaptiveHeight: false, + appendArrows: $(element), + appendDots: $(element), + arrows: true, + asNavFor: null, + prevArrow: '', + nextArrow: '', + autoplay: false, + autoplaySpeed: 3000, + centerMode: false, + centerPadding: '50px', + cssEase: 'ease', + customPaging: function(slider, i) { + return $('',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('