From 592734e11eae70c5b8b370e8ab5c0fe2c63f7588 Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Thu, 18 Jun 2026 18:15:01 +0200 Subject: [PATCH 1/6] Added support for Presentment Payment in Payments table --- includes/entities/class-fs-payment.php | 65 ++++++++++++++++++++++++-- start.php | 2 +- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/includes/entities/class-fs-payment.php b/includes/entities/class-fs-payment.php index 9fd2d38d..e5fbff60 100755 --- a/includes/entities/class-fs-payment.php +++ b/includes/entities/class-fs-payment.php @@ -80,11 +80,22 @@ class FS_Payment extends FS_Entity { */ public $source = 0; + /** + * Presentment payment information for customer-facing currency display. + * + * @var object|null + */ + public $presentment; + #endregion Properties const CURRENCY_USD = 'usd'; const CURRENCY_GBP = 'gbp'; const CURRENCY_EUR = 'eur'; + const CURRENCY_ILS = 'ils'; + const CURRENCY_CAD = 'cad'; + const CURRENCY_AUD = 'aud'; + CONST CURRENCY_PLN = 'pln'; /** * @param object|bool $payment @@ -119,6 +130,43 @@ function is_migrated() { return ( 0 != $this->source ); } + /** + * @return bool + */ + function has_presentment() { + return ( + is_object( $this->presentment ) && + ! empty( $this->presentment->currency ) + ); + } + + /** + * @return float + */ + function get_display_gross() { + return $this->has_presentment() ? + (float) $this->presentment->gross : + (float) $this->gross; + } + + /** + * @return float + */ + function get_display_vat() { + return $this->has_presentment() ? + (float) $this->presentment->vat : + (float) $this->vat; + } + + /** + * @return string + */ + function get_display_currency() { + return $this->has_presentment() ? + $this->presentment->currency : + $this->currency; + } + /** * Returns the gross in this format: * `{symbol}{amount | 2 decimal digits} {currency | uppercase}` @@ -132,12 +180,13 @@ function is_migrated() { */ function formatted_gross() { - $price = $this->gross + $this->vat; + $price = $this->get_display_gross() + $this->get_display_vat(); + return ( ( $price < 0 ? '-' : '' ) . $this->get_symbol() . number_format( abs( $price ), 2, '.', ',' ) . ' ' . - strtoupper( $this->currency ) + strtoupper( $this->get_display_currency() ) ); } @@ -161,9 +210,17 @@ private function get_symbol() { self::CURRENCY_USD => '$', self::CURRENCY_GBP => '£', self::CURRENCY_EUR => '€', + self::CURRENCY_ILS => '₪', + self::CURRENCY_CAD => '$', + self::CURRENCY_AUD => '$', + self::CURRENCY_PLN => 'zł', ); } - return self::$CURRENCY_2_SYMBOL[ $this->currency ]; + $currency = $this->get_display_currency(); + + return isset( self::$CURRENCY_2_SYMBOL[ $currency ] ) + ? self::$CURRENCY_2_SYMBOL[ $currency ] + : strtoupper( $currency ) . ' '; } - } \ No newline at end of file + } diff --git a/start.php b/start.php index f5664c45..d5d355df 100644 --- a/start.php +++ b/start.php @@ -15,7 +15,7 @@ * * @var string */ - $this_sdk_version = '2.13.2'; + $this_sdk_version = '2.13.2.1'; #region SDK Selection Logic -------------------------------------------------------------------- From 1e3569d7d80a79f808be5ab514d8848aa1f88f93 Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Fri, 19 Jun 2026 16:24:00 +0200 Subject: [PATCH 2/6] Prevent Undefined Array Key Warning for HTTP_HOST in Connectivity Test --- includes/class-freemius.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-freemius.php b/includes/class-freemius.php index 755968d7..6fc8bd9a 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -3946,7 +3946,7 @@ private function store_connectivity_info( $pong, $is_connected ) { $this->_storage->connectivity_test = array( 'is_connected' => $is_connected, - 'host' => $_SERVER['HTTP_HOST'], + 'host' => isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : '', 'server_ip' => WP_FS__REMOTE_ADDR, 'is_active' => $is_active, 'timestamp' => WP_FS__SCRIPT_START_TIME, From 474b133e87a8393eb0ef4084c0e78bd08e659d65 Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Fri, 19 Jun 2026 16:34:39 +0200 Subject: [PATCH 3/6] Fix deprecation error: Using null as an array offset is deprecated in FS_Contact_Form_Manager -> get_standalone_link() --- .../class-fs-contact-form-manager.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/includes/managers/class-fs-contact-form-manager.php b/includes/managers/class-fs-contact-form-manager.php index 9e3167bd..1db9f75f 100644 --- a/includes/managers/class-fs-contact-form-manager.php +++ b/includes/managers/class-fs-contact-form-manager.php @@ -77,8 +77,23 @@ public function get_standalone_link( Freemius $fs ) { $query_params = $this->get_query_params( $fs ); $query_params['is_standalone'] = 'true'; - $query_params['parent_url'] = admin_url( add_query_arg( '', '' ) ); + $parent_url = admin_url(); + + if ( isset( $_SERVER['REQUEST_URI'] ) ) { + $request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); + $admin_path = wp_parse_url( admin_url(), PHP_URL_PATH ); + + if ( is_string( $admin_path ) && '' !== $admin_path && 0 === strpos( $request_uri, $admin_path ) ) { + $request_uri = ltrim( substr( $request_uri, strlen( $admin_path ) ), '/' ); + } else { + $request_uri = ltrim( $request_uri, '/' ); + } + + $parent_url = admin_url( $request_uri ); + } + + $query_params['parent_url'] = $parent_url; return WP_FS__ADDRESS . '/contact/?' . http_build_query( $query_params ); } - } \ No newline at end of file + } From 9c38aedbcae046445164e40caacbd484109418ef Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Tue, 30 Jun 2026 13:40:36 +0200 Subject: [PATCH 4/6] lower case `const` for consistency --- includes/entities/class-fs-payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/entities/class-fs-payment.php b/includes/entities/class-fs-payment.php index e5fbff60..1da0884b 100755 --- a/includes/entities/class-fs-payment.php +++ b/includes/entities/class-fs-payment.php @@ -95,7 +95,7 @@ class FS_Payment extends FS_Entity { const CURRENCY_ILS = 'ils'; const CURRENCY_CAD = 'cad'; const CURRENCY_AUD = 'aud'; - CONST CURRENCY_PLN = 'pln'; + const CURRENCY_PLN = 'pln'; /** * @param object|bool $payment From acb4dd3b0a3a1e39271303d8e5c59df461586484 Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Tue, 30 Jun 2026 17:51:00 +0200 Subject: [PATCH 5/6] Refactor and simplify --- includes/entities/class-fs-payment.php | 17 +++++++++-------- .../managers/class-fs-contact-form-manager.php | 18 ++---------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/includes/entities/class-fs-payment.php b/includes/entities/class-fs-payment.php index 1da0884b..fd6af1aa 100755 --- a/includes/entities/class-fs-payment.php +++ b/includes/entities/class-fs-payment.php @@ -133,17 +133,16 @@ function is_migrated() { /** * @return bool */ - function has_presentment() { - return ( - is_object( $this->presentment ) && - ! empty( $this->presentment->currency ) - ); + function has_presentment() + { + return is_object($this->presentment); } /** * @return float */ - function get_display_gross() { + function get_display_gross() + { return $this->has_presentment() ? (float) $this->presentment->gross : (float) $this->gross; @@ -152,7 +151,8 @@ function get_display_gross() { /** * @return float */ - function get_display_vat() { + function get_display_vat() + { return $this->has_presentment() ? (float) $this->presentment->vat : (float) $this->vat; @@ -161,7 +161,8 @@ function get_display_vat() { /** * @return string */ - function get_display_currency() { + function get_display_currency() + { return $this->has_presentment() ? $this->presentment->currency : $this->currency; diff --git a/includes/managers/class-fs-contact-form-manager.php b/includes/managers/class-fs-contact-form-manager.php index 1db9f75f..429fa08b 100644 --- a/includes/managers/class-fs-contact-form-manager.php +++ b/includes/managers/class-fs-contact-form-manager.php @@ -77,22 +77,8 @@ public function get_standalone_link( Freemius $fs ) { $query_params = $this->get_query_params( $fs ); $query_params['is_standalone'] = 'true'; - $parent_url = admin_url(); - - if ( isset( $_SERVER['REQUEST_URI'] ) ) { - $request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ); - $admin_path = wp_parse_url( admin_url(), PHP_URL_PATH ); - - if ( is_string( $admin_path ) && '' !== $admin_path && 0 === strpos( $request_uri, $admin_path ) ) { - $request_uri = ltrim( substr( $request_uri, strlen( $admin_path ) ), '/' ); - } else { - $request_uri = ltrim( $request_uri, '/' ); - } - - $parent_url = admin_url( $request_uri ); - } - - $query_params['parent_url'] = $parent_url; + // Intentionally using add_query_arg( '', '' ) to preserve the legacy behavior of resolving the current admin URL. + $query_params['parent_url'] = admin_url( add_query_arg( '', '' ) ); return WP_FS__ADDRESS . '/contact/?' . http_build_query( $query_params ); } From ec1f9872faf0b143e83bb69eadbfa7f1a54e9a61 Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Wed, 1 Jul 2026 09:28:08 +0200 Subject: [PATCH 6/6] Change visibility of payment methods to private for encapsulation --- includes/entities/class-fs-payment.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/entities/class-fs-payment.php b/includes/entities/class-fs-payment.php index fd6af1aa..eb185045 100755 --- a/includes/entities/class-fs-payment.php +++ b/includes/entities/class-fs-payment.php @@ -133,15 +133,15 @@ function is_migrated() { /** * @return bool */ - function has_presentment() + private function has_presentment() { - return is_object($this->presentment); + return is_object( $this->presentment ); } /** * @return float */ - function get_display_gross() + private function get_display_gross() { return $this->has_presentment() ? (float) $this->presentment->gross : @@ -151,7 +151,7 @@ function get_display_gross() /** * @return float */ - function get_display_vat() + private function get_display_vat() { return $this->has_presentment() ? (float) $this->presentment->vat : @@ -161,7 +161,7 @@ function get_display_vat() /** * @return string */ - function get_display_currency() + private function get_display_currency() { return $this->has_presentment() ? $this->presentment->currency :