public static function load_gateway_currencies() { $gateways = ProSites_Helper_Gateway::get_gateways(); foreach ($gateways as $key => $gateway) { ProSites_Model_Data::load_currencies($key, $gateway); } }
/** * 'Payment Settings' * * @return string */ public static function render_tab_payment() { global $psts; ProSites_Helper_Settings::settings_header(ProSites_Helper_Tabs_Settings::get_active_tab()); ?> <div class="inside"> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Currency', 'psts'); echo $psts->help_text(esc_html__('This is the currency that customers will be charged in. Your gateway currency is a fall-back option.', 'psts'), 'site-currency'); ?> </th> <td> <select id="psts-currency-select" name="psts[currency]" class="chosen" data-placeholder="<?php echo esc_attr__('Enable gateways', 'psts'); ?> "> <?php $super = array('⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹'); $gateways = ProSites_Helper_Gateway::get_gateways(); $count = 0; $supported_key = ''; foreach ($gateways as $key => $gateway) { if ('manual' == $key) { continue; } $count++; $gateways[$key]['idx'] = $count; if ($count > 1) { $supported_key .= '<sup> | </sup>'; } $supported_key .= '<sup>' . $count . ' - ' . $gateway['name'] . '</sup>'; } // supports_currency // foreach ( $psts->currencies as $key => $value ) { $all_currencies = ProSites_Model_Data::$currencies; ksort($all_currencies); foreach ($all_currencies as $key => $currency) { $supported_by = ''; foreach ($gateways as $slug => $gateway) { if (ProSites_Helper_Gateway::supports_currency($key, $slug)) { if (strlen($supported_by) > 0) { $supported_by .= '⁻'; } $supported_by .= $super[$gateway['idx']]; } } ?> <option value="<?php echo $key; ?> "<?php selected($psts->get_setting('currency'), $key); ?> ><?php echo esc_attr(strtoupper($key)) . '' . $supported_by . ' - ' . esc_attr($currency['name']) . ' - ' . $psts->format_currency($key); ?> </option><?php } ?> </select> <div> <?php echo $supported_key; ?> <br /> <?php echo sprintf('<sup>%s</sup>', esc_html__('Note: Where a currency is not supported by your gateway it may revert to your merchant account currency. (e.g. Stripe)', 'psts')); ?> <?php echo sprintf('<sup><br />%s</sup>', esc_html__('Note: Updating your site currency might take time to load, please be patient.', 'psts')); ?> </div> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Currency Symbol Position', 'psts'); ?> </th> <td> <label><input value="1" name="psts[curr_symbol_position]" type="radio"<?php checked($psts->get_setting('curr_symbol_position', 1), 1); ?> > <?php echo $psts->format_currency(); ?> 100</label><br/> <label><input value="2" name="psts[curr_symbol_position]" type="radio"<?php checked($psts->get_setting('curr_symbol_position'), 2); ?> > <?php echo $psts->format_currency(); ?> 100</label><br/> <label><input value="3" name="psts[curr_symbol_position]" type="radio"<?php checked($psts->get_setting('curr_symbol_position'), 3); ?> > 100<?php echo $psts->format_currency(); ?> </label><br/> <label><input value="4" name="psts[curr_symbol_position]" type="radio"<?php checked($psts->get_setting('curr_symbol_position'), 4); ?> > 100 <?php echo $psts->format_currency(); ?> </label> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Show Decimal in Prices', 'psts'); ?> </th> <td> <label><input value="1" name="psts[curr_decimal]" type="radio"<?php checked($psts->get_setting('curr_decimal', 1), 1); ?> > <?php _e('Yes', 'psts'); ?> </label> <label><input value="0" name="psts[curr_decimal]" type="radio"<?php checked($psts->get_setting('curr_decimal'), 0); ?> > <?php _e('No', 'psts'); ?> </label> </td> </tr> </table> </div> <?php }
public static function prepend_plan_details($content, $blog_id, $domain) { global $psts; $plan_content = ''; $gateways = ProSites_Helper_Gateway::get_gateways(); $gateway_details = self::get_gateway_details($gateways); $is_pro_site = is_pro_site($blog_id); $session_data = array(); $session_data['new_blog_details'] = ProSites_Helper_Session::session('new_blog_details'); $session_data['upgraded_blog_details'] = ProSites_Helper_Session::session('upgraded_blog_details'); // No existing details for a new signup if (!is_user_logged_in() || isset($session_data['new_blog_details'])) { $pre_content = ''; if (isset($session_data['new_blog_details']) && isset($session_data['new_blog_details']['payment_success']) && true === $session_data['new_blog_details']['payment_success'] || isset($session_data['upgraded_blog_details']) && isset($session_data['upgraded_blog_details']['payment_success']) && true === $session_data['upgraded_blog_details']['payment_success']) { $pre_content .= self::render_payment_submitted(); } // Check manual payments if (isset($session_data['new_blog_details']) && isset($session_data['new_blog_details']['manual_submitted']) && true === $session_data['new_blog_details']['manual_submitted']) { $pre_content .= self::render_manual_submitted(); } if (!empty($pre_content)) { return $pre_content; } else { return $content; } } if ($is_pro_site && (!isset($_GET['action']) || $_GET['action'] == 'complete' && isset($_GET['token']))) { // EXISTING DETAILS if (isset($gateways) && isset($gateway_details)) { $gateway_order = isset($gateway_details['order']) ? $gateway_details['order'] : array(); $plan_content = self::render_current_plan_information(array(), $blog_id, $domain, $gateways, $gateway_order); $plan_content .= '<h2>' . esc_html__('Change your plan', 'psts') . '</h2>'; } } else { // NOTIFICATIONS ONLY $plan_content = self::render_notification_information(array(), $blog_id, $domain, $gateways, $gateway_details['order']); } return $plan_content . $content; }