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, diff --git a/includes/entities/class-fs-payment.php b/includes/entities/class-fs-payment.php index 9fd2d38d..eb185045 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,44 @@ function is_migrated() { return ( 0 != $this->source ); } + /** + * @return bool + */ + private function has_presentment() + { + return is_object( $this->presentment ); + } + + /** + * @return float + */ + private function get_display_gross() + { + return $this->has_presentment() ? + (float) $this->presentment->gross : + (float) $this->gross; + } + + /** + * @return float + */ + private function get_display_vat() + { + return $this->has_presentment() ? + (float) $this->presentment->vat : + (float) $this->vat; + } + + /** + * @return string + */ + private 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 +181,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 +211,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/includes/managers/class-fs-contact-form-manager.php b/includes/managers/class-fs-contact-form-manager.php index 9e3167bd..429fa08b 100644 --- a/includes/managers/class-fs-contact-form-manager.php +++ b/includes/managers/class-fs-contact-form-manager.php @@ -77,8 +77,9 @@ public function get_standalone_link( Freemius $fs ) { $query_params = $this->get_query_params( $fs ); $query_params['is_standalone'] = 'true'; + // 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 ); } - } \ 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 --------------------------------------------------------------------