From 592734e11eae70c5b8b370e8ab5c0fe2c63f7588 Mon Sep 17 00:00:00 2001 From: Daniele Alessandra Date: Thu, 18 Jun 2026 18:15:01 +0200 Subject: [PATCH 1/3] 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/3] 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/3] 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 + }