/** * Show Settings Message * * Handles to show settings message * * @package Easy Digital Downloads - Currency Converter * @since 1.0.0 **/ public function edd_currency_admin_notice() { global $edd_options; $errors = array(); // Check easy digital downlownload pages if (isset($_GET['post_type']) && $_GET['post_type'] == 'download') { if (isset($edd_options['exchange_rates_method']) && $edd_options['exchange_rates_method'] == 'open_exchange' && isset($edd_options['exchange_app_id']) && empty($edd_options['exchange_app_id'])) { $errors[] = '<li><p><strong>' . __('Easy Digital Download - Currency Converter can not be activated on the front-side because you have selected Exchange Rates Method as Open Exchange Rates and not added it\'s APP ID.', 'eddcurrency') . '</strong></p></li>'; } if (!edd_currency_check_base_currency_has_rate()) { $base_currency_code = edd_get_currency(); $errors[] = '<li><p><strong>' . __('Easy Digital Download base currency (', 'eddcurrency') . $base_currency_code . __(') must have an exchange rate.', 'eddcurrency') . '</strong></p>'; } if (!empty($errors)) { ?> <div class="error" id="updated"> <ol> <?php echo implode('', $errors); ?> </ol> </div> <?php } } }
/** * Adding Hooks * * Adding proper hoocks for the public pages. * * @package Easy Digital Downloads - Currency Converter * @since 1.0.0 */ public function add_hooks() { global $edd_options; //check base currency has rate & is not admin side and calling ajax if (edd_currency_check_base_currency_has_rate() && !is_admin() || defined('DOING_AJAX') && DOING_AJAX) { $currency_data = $this->model->edd_currency_get_data(); if (!empty($currency_data)) { // Check currencies data are not empty // mark up for popup add_action('wp_footer', array($this, 'edd_currency_list_popup')); // Add filter to add class in nav menu add_filter('nav_menu_css_class', array($this, 'edd_currency_nav_menu_css_class'), 10, 2); add_filter('page_css_class', array($this, 'edd_currency_page_css_class'), 10, 2); } $currency = edd_get_currency(); // get edd base currency $stored_currency = edd_currency_get_stored_currency(); // get cuurency which is set in the cookie $exchange_rates = edd_currency_get_exchange_rates(); // get exchance rates array add_filter('edd_' . strtolower($currency) . '_currency_filter_before', array($this, 'edd_currency_change_before_format'), 10, 3); add_filter('edd_' . strtolower($currency) . '_currency_filter_after', array($this, 'edd_currency_change_after_format'), 10, 3); if (isset($edd_options['display_cart_notification']) && $edd_options['display_cart_notification'] == '1' && $stored_currency != $currency && $this->model->edd_currency_check_open_exchange() && isset($exchange_rates[$stored_currency])) { // Add message for checkout add_action('edd_before_purchase_form', array($this->render, 'edd_currency_checkout_message_content')); } } //add action to show currency popup markup add_action('wp_footer', array($this->render, 'edd_currency_saved_popup')); //add action to show detection prompt user message add_action('wp_footer', array($this->render, 'edd_currency_detection_popup')); }