HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vmi1674223.contaboserver.net 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: root (0)
PHP: 7.4.3-4ubuntu2.22
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/onlineshop/wp-content/plugins/pinterest-for-woocommerce/src/AdsCreditCurrency.php
<?php
/**
 * Pinterest for WooCommerce Ads Credit Currency
 *
 * @package     Pinterest_For_WooCommerce/Classes/
 * @version     1.3.9
 */

namespace Automattic\WooCommerce\Pinterest;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class handling ad credits based on currency.
 */
class AdsCreditCurrency {

	/**
	 * @var array $currency_credits_map Mapping of currency to spend requirement and credit given.
	 */
	public static $currency_credits_map = array(
		'USD' => array( 15, 125 ),
		'EUR' => array( 15, 131 ),
		'GBP' => array( 13, 117 ),
		'BRL' => array( 80, 673 ),
		'CAD' => array( 20, 172 ),
		'AUD' => array( 23, 195 ),
		'MXN' => array( 305, 2548 ),
		'ARS' => array( 2198, 18320 ),
		'CHF' => array( 14, 124 ),
		'CZK' => array( 385, 3216 ),
		'DKK' => array( 116, 970 ),
		'HUF' => array( 6366, 53050 ),
		'JPY' => array( 2172, 18102 ),
		'NOK' => array( 162, 1353 ),
		'NZD' => array( 26, 222 ),
		'PLN' => array( 74, 624 ),
		'RON' => array( 77, 646 ),
		'SEK' => array( 170, 1424 ),
	);

	/**
	 * Get spend requirement and credits based on currency.
	 *
	 * @since 1.3.9
	 *
	 * @return array $result Amount to be spent, credits given and currency symbol.
	 */
	public static function get_currency_credits() {

		$currency                              = get_woocommerce_currency();
		$credits_array                         = ( ! array_key_exists( $currency, self::$currency_credits_map ) || 'USD' === $currency ) ? self::$currency_credits_map['USD'] : self::$currency_credits_map[ $currency ];
		list( $spend_require, $credits_given ) = $credits_array;

		$result = array(
			'spendRequire' => html_entity_decode( wp_strip_all_tags( wc_price( $spend_require, array( 'decimals' => 0 ) ) ) ),
			'creditsGiven' => html_entity_decode( wp_strip_all_tags( wc_price( $credits_given, array( 'decimals' => 0 ) ) ) ),
		);

		return $result;
	}
}