/**
  * update_products_price_by_country_module_saved.
  *
  * @version 2.5.3
  * @since   2.5.3
  */
 function update_products_price_by_country_module_saved($all_sections, $current_section)
 {
     if ('price_by_country' === $current_section && wcj_is_module_enabled('price_by_country')) {
         wcj_update_products_price_by_country();
     }
 }
 /**
  * On the scheduled action hook, run a function.
  *
  * @version 2.5.3
  */
 function update_the_exchange_rates($interval)
 {
     $currency_pairs[] = array();
     if (wcj_is_module_enabled('price_by_country')) {
         // Currency Pairs - Preparation - Price by Country
         if ('manual' != apply_filters('booster_get_option', 'manual', get_option('wcj_price_by_country_auto_exchange_rates', 'manual'))) {
             for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_price_by_country_total_groups_number', 1)); $i++) {
                 $currency_to = get_option('wcj_price_by_country_exchange_rate_currency_group_' . $i);
                 $currency_pairs = $this->get_currency_pair($currency_pairs, $currency_to, 'wcj_price_by_country_exchange_rate_group_' . $i);
             }
         }
     }
     if (wcj_is_module_enabled('multicurrency')) {
         // Currency Pairs - Preparation - Multicurrency
         if ('manual' != apply_filters('booster_get_option', 'manual', get_option('wcj_multicurrency_exchange_rate_update_auto', 'manual'))) {
             for ($i = 1; $i <= apply_filters('booster_get_option', 2, get_option('wcj_multicurrency_total_number', 2)); $i++) {
                 $currency_to = get_option('wcj_multicurrency_currency_' . $i);
                 $currency_pairs = $this->get_currency_pair($currency_pairs, $currency_to, 'wcj_multicurrency_exchange_rate_' . $i);
             }
         }
     }
     if (wcj_is_module_enabled('multicurrency_base_price')) {
         // Currency Pairs - Preparation - Multicurrency Product Base Price
         if ('manual' != apply_filters('booster_get_option', 'manual', get_option('wcj_multicurrency_base_price_exchange_rate_update', 'manual'))) {
             for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_multicurrency_base_price_total_number', 1)); $i++) {
                 $currency_to = get_option('wcj_multicurrency_base_price_currency_' . $i);
                 $currency_pairs = $this->get_currency_pair($currency_pairs, $currency_to, 'wcj_multicurrency_base_price_exchange_rate_' . $i);
             }
         }
     }
     if (wcj_is_module_enabled('currency_per_product')) {
         // Currency Pairs - Preparation - Currency per Product
         if ('manual' != apply_filters('booster_get_option', 'manual', get_option('wcj_currency_per_product_exchange_rate_update', 'manual'))) {
             for ($i = 1; $i <= apply_filters('booster_get_option', 1, get_option('wcj_currency_per_product_total_number', 1)); $i++) {
                 $currency_to = get_option('wcj_currency_per_product_currency_' . $i);
                 $currency_pairs = $this->get_currency_pair($currency_pairs, $currency_to, 'wcj_currency_per_product_exchange_rate_' . $i);
             }
         }
     }
     if (wcj_is_module_enabled('payment_gateways_currency')) {
         // Currency Pairs - Preparation - Gateway Currency
         if ('manual' != apply_filters('booster_get_option', 'manual', get_option('wcj_gateways_currency_exchange_rate_update_auto', 'manual'))) {
             global $woocommerce;
             $available_gateways = $woocommerce->payment_gateways->payment_gateways();
             foreach ($available_gateways as $key => $gateway) {
                 $currency_to = get_option('wcj_gateways_currency_' . $key);
                 if ('no_changes' != $currency_to) {
                     $currency_pairs = $this->get_currency_pair($currency_pairs, $currency_to, 'wcj_gateways_currency_exchange_rate_' . $key);
                 }
             }
         }
     }
     // Currency Pairs - Final
     foreach ($currency_pairs as $currency_pair) {
         $currency_from = $currency_pair['currency_from'];
         $currency_to = $currency_pair['currency_to'];
         $the_rate = $this->get_exchange_rate($currency_from, $currency_to);
         if (0 != $the_rate) {
             if ($currency_from != $currency_to) {
                 foreach ($currency_pair['option_name'] as $option_name) {
                     update_option($option_name, $the_rate);
                 }
                 $field_id = 'wcj_currency_exchange_rates_' . sanitize_title($currency_from . $currency_to);
                 update_option($field_id, $the_rate);
                 $result_message = __('Cron job: exchange rates successfully updated', 'woocommerce-jetpack');
             } else {
                 $result_message = __('Cron job: exchange rates not updated, as currency_from == currency_to', 'woocommerce-jetpack');
             }
         } else {
             $result_message = __('Cron job: exchange rates update failed', 'woocommerce-jetpack');
         }
         /* if ( 'yes' === get_option( 'wcj_currency_exchange_logging_enabled', 'no' ) ) {
         				wcj_log( $result_message . ': ' . $currency_from . $currency_to . ': ' . $the_rate . ': ' . 'update_the_exchange_rates: ' . $interval );
         			} */
     }
     if (wcj_is_module_enabled('price_by_country')) {
         if ('yes' === get_option('wcj_price_by_country_price_filter_widget_support_enabled', 'no')) {
             wcj_update_products_price_by_country();
         }
     }
 }