HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
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: //proc/self/cwd/wp-content/plugins/pixel-caffeine/includes/class-aepc-currency.php
<?php
/**
 * Support class for currencies
 *
 * @package Pixel Caffeine
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Support class for currencies
 *
 * @class AEPC_Currency
 */
class AEPC_Currency {

	/**
	 * The cached list of currencies already fetched.
	 *
	 * @var array|null
	 */
	private static $currencies = null;

	/**
	 * Get all currencies supported by facebook
	 *
	 * @return array
	 */
	public static function get_currencies() {
		if ( is_null( self::$currencies ) ) {
			WP_Filesystem();
			global $wp_filesystem;
			/**
			 * Get the global filesystem layer from WP
			 *
			 * @var WP_Filesystem_Base $wp_filesystem
			 */

			self::$currencies = (array) json_decode( $wp_filesystem->get_contents( __DIR__ . '/resources/currencies.json' ) );
		}

		return apply_filters( 'aepc_currencies', self::$currencies );
	}

	/**
	 * Return amount with eventual offset, in base of currency
	 *
	 * The methods is kept for legacy. Before, it was written to include this inside:
	 *   if ( in_array( $currency, array_keys( self::get_currencies() ) ) ) {
	 *     $amount *= self::get_offset( $currency );
	 *   }
	 *
	 * It doesn't need anymore, but I decided to keep the method for better compatibility.
	 *
	 * @param float $amount The amount.
	 *
	 * @return float
	 */
	public static function get_amount( $amount ) {
		return $amount;
	}

	/**
	 * Return the offset for a currency
	 *
	 * @param string $currency The currency code.
	 *
	 * @return integer
	 */
	public static function get_offset( $currency ) {
		$currencies = self::get_currencies();
		return isset( $currencies[ $currency ] ) ? $currencies[ $currency ]->offset : 1;
	}
}