class SomeClass {
/**
* Basic integration with Easy Digital Downloads Currency Switcher, developed by Aelia
* (http://aelia.co). This method can be used by any 3rd party plugin to
* return prices converted to the active currency.
*
* @param double price The source price.
* @param string to_currency The target currency. If empty, the active currency
* will be taken.
* @param string from_currency The source currency. If empty, Easy Digital Downloads base
* currency will be taken.
* @return double The price converted from source to destination currency.
* @author Aelia <[email protected]>
* @link http://aelia.co
* @link https://aelia.co/shop/currency-switcher-for-easy-digital-downloads/
*/
public static function get_price_in_currency($price, $to_currency = null, $from_currency = null) {
if(empty($from_currency)) {
global $edd_options;
$from_currency = $edd_options['currency'];
}
if(empty($to_currency)) {
$to_currency = edd_get_currency();
}
return apply_filters('edd_aelia_cs_convert', $price, $from_currency, $to_currency);
}
public function test() {
$price = 123;
// Just call the get_price_in_currency() method, no further action required
return self::get_price_in_currency($price);
}
}
Comments