alg_get_exchange_rate

Alg_get_exchange_rate.

Description

alg_get_exchange_rate( $currency_from, $currency_to ); 

Parameters (2)

0. $currency_from
The currency from.
1. $currency_to
The currency to.

Usage

  1. if ( !function_exists( 'alg_get_exchange_rate' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'booster-for-woocommerce/includes/functions/wcj-exchange-rates-functions.php'; 
  3.  
  4. // The currency from. 
  5. $currency_from = null; 
  6.  
  7. // The currency to. 
  8. $currency_to = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = alg_get_exchange_rate($currency_from, $currency_to); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/functions/wcj-exchange-rates-functions.php  
  1. function alg_get_exchange_rate( $currency_from, $currency_to ) { 
  2. if ( 'yes' === ( $calculate_by_invert = get_option( 'wcj_currency_exchange_rates_calculate_by_invert', 'no' ) ) ) { 
  3. $_currency_to = $currency_to; 
  4. $currency_to = $currency_from; 
  5. $currency_from = $_currency_to; 
  6. $exchange_rates_server = get_option( 'wcj_currency_exchange_rates_server', 'yahoo' ); 
  7. switch ( $exchange_rates_server ) { 
  8. case 'tcmb': 
  9. $return = alg_tcmb_get_exchange_rate( $currency_from, $currency_to ); 
  10. break; 
  11. case 'ecb': 
  12. $return = alg_ecb_get_exchange_rate( $currency_from, $currency_to ); 
  13. break; 
  14. default: // 'yahoo' 
  15. $return = alg_yahoo_get_exchange_rate( $currency_from, $currency_to ); 
  16. break; 
  17. return ( 'yes' === $calculate_by_invert ) ? round( ( 1 / $return ), 6 ) : $return;