/**
 * form_paypal_multiple function.
 *
 * Use this for now, but it will eventually be replaced with a better form API for gateways
 * @access public
 * @return void
 */
function form_paypal_multiple()
{
    global $wpdb, $wpsc_gateways;
    $account_type = get_option('paypal_multiple_url');
    $account_types = array('https://www.paypal.com/cgi-bin/webscr' => __('Live Account', 'wp-e-commerce'), 'https://www.sandbox.paypal.com/cgi-bin/webscr' => __('Sandbox Account', 'wp-e-commerce'));
    $output = "\n\t<tr>\n\t\t<td>" . __('Username:'******'wp-e-commerce') . "</td>\n\t\t<td>\n\t\t\t<input type='text' size='40' value='" . get_option('paypal_multiple_business') . "' name='paypal_multiple_business' />\n\t\t\t<p class='description'>\n\t\t\t\t" . __('This is your PayPal email address.', 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\n\t<tr>\n\t\t<td>" . __('Account Type:', 'wp-e-commerce') . "</td>\n\t\t<td>\n\t\t\t<select name='paypal_multiple_url'>\n";
    foreach ($account_types as $url => $label) {
        $output .= "<option value='{$url}' " . selected($url, $account_type, false) . ">" . esc_html($label) . "</option>";
    }
    $output .= "\n\t\t\t</select>\n\t\t\t<p class='description'>\n\t\t\t\t" . __('If you have a PayPal developers Sandbox account, please use Sandbox mode. If you just have a standard PayPal account, then you will want to use Live mode.', 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n";
    $paypal_ipn = get_option('paypal_ipn');
    $paypal_ipn1 = "";
    $paypal_ipn2 = "";
    switch ($paypal_ipn) {
        case 0:
            $paypal_ipn2 = "checked='checked'";
            break;
        case 1:
            $paypal_ipn1 = "checked='checked'";
            break;
    }
    $paypal_ship = get_option('paypal_ship');
    $paypal_ship1 = "";
    $paypal_ship2 = "";
    switch ($paypal_ship) {
        case 1:
            $paypal_ship1 = "checked='checked'";
            break;
        case 0:
        default:
            $paypal_ship2 = "checked='checked'";
            break;
    }
    $address_override = get_option('address_override');
    $address_override1 = "";
    $address_override2 = "";
    switch ($address_override) {
        case 1:
            $address_override1 = "checked='checked'";
            break;
        case 0:
        default:
            $address_override2 = "checked='checked'";
            break;
    }
    $output .= "\n\t<tr>\n\t\t<td>" . __("IPN", 'wp-e-commerce') . ":</td>\n\t\t<td>\n\t\t\t<input type='radio' value='1' name='paypal_ipn' id='paypal_ipn1' " . $paypal_ipn1 . " /> <label for='paypal_ipn1'>" . __('Yes', 'wp-e-commerce') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' " . $paypal_ipn2 . " /> <label for='paypal_ipn2'>" . __('No', 'wp-e-commerce') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . __("IPN (instant payment notification) will automatically update your sales logs to 'Accepted payment' when a customer's payment is successful. For IPN to work you also need to have IPN turned on in your PayPal settings. If it is not turned on, the sales will remain as 'Order Pending' status until manually changed. It is highly recommended using IPN, especially if you are selling digital products.", 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td style='padding-bottom: 0px;'>" . __("Send shipping details", 'wp-e-commerce') . "</td>\n\t\t<td style='padding-bottom: 0px;'>\n\t\t\t<input type='radio' value='1' name='paypal_ship' id='paypal_ship1' " . $paypal_ship1 . " /> <label for='paypal_ship1'>" . __('Yes', 'wp-e-commerce') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='paypal_ship' id='paypal_ship2' " . $paypal_ship2 . " /> <label for='paypal_ship2'>" . __('No', 'wp-e-commerce') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . __("Note: If your checkout page does not have a shipping details section, or if you don't want to send PayPal shipping information, you should change the Send shipping details option to 'No'.", 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td>\n\t\t\t" . __('Address Override:', 'wp-e-commerce') . "\n\t\t</td>\n\t\t<td>\n\t\t\t<input type='radio' value='1' name='address_override' id='address_override1' " . $address_override1 . " /> <label for='address_override1'>" . __('Yes', 'wp-e-commerce') . "</label> &nbsp;\n\t\t\t<input type='radio' value='0' name='address_override' id='address_override2' " . $address_override2 . " /> <label for='address_override2'>" . __('No', 'wp-e-commerce') . "</label>\n\t\t\t<p class='description'>\n\t\t\t\t" . __("This setting affects your PayPal purchase log. If your customers already have a PayPal account, PayPal will try to populate your PayPal Purchase Log with their PayPal address. This setting tries to replace the address in the PayPal purchase log with the address customers enter on your Checkout page.", 'wp-e-commerce') . "\n\t\t\t</p>\n\t\t</td>\n\t</tr>\n";
    $store_currency_data = WPSC_Countries::get_currency_data(get_option('currency_type'), true);
    $current_currency = get_option('paypal_curcode');
    if ($current_currency == '' && in_array($store_currency_data['code'], $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'])) {
        update_option('paypal_curcode', $store_currency_data['code']);
        $current_currency = $store_currency_data['code'];
    }
    if ($current_currency != $store_currency_data['code']) {
        $output .= "\n\t\t<tr>\n\t\t\t<td>\n\t\t\t</td>\n\t\t\t<td><strong class='form_group'>" . __('Currency Converter', 'wp-e-commerce') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t" . sprintf(__('Your website uses <strong>%s</strong>. This currency is not supported by PayPal. Please select an accepted currency using the drop down menu below. Buyers on your site will still pay in your local currency. However, we will send the order through to PayPal using the currency you choose below.', 'wp-e-commerce'), $store_currency_data['currency']) . "\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t" . __('Select Currency:', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_curcode'>\n";
        $paypal_currency_list = array_map('esc_sql', $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list']);
        $currency_list = WPSC_Countries::get_currencies(true);
        foreach ($currency_list as $currency_item) {
            $selected_currency = '';
            if ($current_currency == $currency_item['code']) {
                $selected_currency = "selected='selected'";
            }
            $output .= "<option " . $selected_currency . " value='{$currency_item['code']}'>{$currency_item['name']}</option>";
        }
        $output .= "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n";
    }
    if (get_option('paypal_form_first_name', false)) {
        $output .= "\n\t\t<tr>\n\t\t\t<td colspan='2'>\n\t\t\t\t<strong class='form_group'>" . __('Forms Sent to Gateway', 'wp-e-commerce') . "</strong>\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t\t<td>" . __('First Name Field', 'wp-e-commerce') . "</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[first_name]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_first_name')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>" . __('Last Name Field', 'wp-e-commerce') . "</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[last_name]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_last_name')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Address Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[address]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_address')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('City Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[city]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_city')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('State Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[state]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_state')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Postal / ZIP Code Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[post_code]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_post_code')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t" . __('Country Field', 'wp-e-commerce') . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<select name='paypal_form[country]'>\n\t\t\t\t" . nzshpcrt_form_field_list(get_option('paypal_form_country')) . "\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2'>\n\t\t\t\t<p class='description'>\n\t\t\t\t" . sprintf(__("For more help configuring PayPal Standard, please read our documentation <a href='%s'>here</a>", 'wp-e-commerce'), esc_url('http://docs.wpecommerce.org/documentation/paypal-payments-standard/')) . "\n\t\t\t\t</p>\n\t\t\t</td>\n\t\t</tr>\n";
    }
    return $output;
}
Пример #2
0
    public function display()
    {
        global $wpdb, $wpsc_shipping_modules, $external_shipping_modules, $internal_shipping_modules;
        // sort into external and internal arrays.
        foreach ($GLOBALS['wpsc_shipping_modules'] as $key => $module) {
            if (empty($module)) {
                continue;
            }
            if (isset($module->is_external) && $module->is_external) {
                $external_shipping_modules[$key] = $module;
            } else {
                $internal_shipping_modules[$key] = $module;
            }
        }
        ?>

		<h3><?php 
        esc_html_e('Shipping Settings', 'wp-e-commerce');
        ?>
</h3>
		<input type='hidden' name='shipping_submits' value='true' />
		<?php 
        wp_nonce_field('update-options', 'wpsc-update-options');
        ?>
		<input type='hidden' name='wpsc_admin_action' value='submit_options' />
		<table class='form-table'>
			<?php 
        /* wpsc_setting_page_update_notification displays the wordpress styled notifications */
        wpsc_settings_page_update_notification();
        ?>
			<tr>
				<th scope="row"><?php 
        _e('Use Shipping', 'wp-e-commerce');
        ?>
</th>
				<td>
					<input type='hidden' value='1' name='wpsc_options[do_not_use_shipping]' />
					<input type='checkbox' value='0' name='wpsc_options[do_not_use_shipping]' id='do_not_use_shipping' <?php 
        checked('0', get_option('do_not_use_shipping'));
        ?>
 /> <label for='do_not_use_shipping'><?php 
        _e('Enable Shipping settings', 'wp-e-commerce');
        ?>
</label>
					<p class='description'><?php 
        esc_html_e('If you are only selling digital downloads, you should turn this off.', 'wp-e-commerce');
        ?>
</p>
				</td>
			</tr>

			<tr>
				<th><?php 
        esc_html_e('Shipping Origin City', 'wp-e-commerce');
        ?>
</th>
				<td>
					<input type='text' name='wpsc_options[base_city]' value='<?php 
        echo esc_attr(get_option('base_city'));
        ?>
' />
					<p class='description'><?php 
        esc_html_e('The name of the city where you fulfill and ship orders from. This enables us to give your customers more accurate shipping pricing.', 'wp-e-commerce');
        ?>
</p>
				</td>
			</tr>
			<tr>
				<th><?php 
        esc_html_e('Shipping Origin Zipcode/Postcode', 'wp-e-commerce');
        ?>
</th>
				<td>
					<input type='text' name='wpsc_options[base_zipcode]' value='<?php 
        echo esc_attr(get_option('base_zipcode'));
        ?>
' />
					<p class='description'>
						<?php 
        esc_html_e('The ZIP code / Postal code from where you fulfill and ship orders.', 'wp-e-commerce');
        ?>
<br />
						<?php 
        esc_html_e('If you are based in the United States, then this field is required in order for the UPS and USPS Shipping Calculators to work.', 'wp-e-commerce');
        ?>
					</p>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php 
        _e('Shipwire', 'wp-e-commerce');
        ?>
<span style='color: red;'></span></th>
				<td>
					<input type='hidden' value='0' name='wpsc_options[shipwire]' />
					<input type='checkbox' onclick='jQuery("#wpsc_shipwire_setting").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipwire]' id='shipwire' <?php 
        checked('1', get_option('shipwire'));
        ?>
 />
					<label for='shipwire'><?php 
        _e('Enable Shipwire Integration', 'wp-e-commerce');
        ?>
</label>
					<p class='description'><?php 
        printf(__('<a href="%1$s" target="_blank">Shipwire</a> provide e-commerce fulfillment warehouses. WP eCommerce can integrate stock inventory and shipping tracking with their service.', 'wp-e-commerce'), 'http://www.shipwire.com/pp/o.php?id=11922');
        ?>
</p>
				</td>
			</tr>
			<?php 
        switch (get_option('shipwire')) {
            case 1:
                $shipwire_settings = '';
                break;
            case 0:
            default:
                $shipwire_settings = 'style="display: none;"';
                break;
        }
        ?>
			<tr id='wpsc_shipwire_setting' <?php 
        echo $shipwire_settings;
        ?>
>
				<th>&nbsp;</th>
				<td>
					<table>
						<tr>
							<th><?php 
        esc_html_e('Shipwire Email', 'wp-e-commerce');
        ?>
</th>
							<td><input type="text" name='wpsc_options[shipwireemail]' value="<?php 
        echo esc_attr(get_option('shipwireemail'));
        ?>
" /></td>
						</tr>
						<tr>
							<th><?php 
        esc_html_e('Shipwire Password', 'wp-e-commerce');
        ?>
</th>
							<td><input type="text" name='wpsc_options[shipwirepassword]' value="<?php 
        echo esc_attr(get_option('shipwirepassword'));
        ?>
" /></td>
						</tr>
						<tr>
							<th><?php 
        esc_html_e('Use Test Server?', 'wp-e-commerce');
        ?>
</th>
							<td><input type="checkbox" name='wpsc_options[shipwire_test_server]' value="0" <?php 
        checked('1', get_option('shipwire_test_server', '0'));
        ?>
 /></td>
						</tr>
						<tr>
							<th><?php 
        esc_html_e('Force Sync with Shipwire', 'wp-e-commerce');
        ?>
</th>
							<td>
								<a class="shipwire_sync button"><?php 
        esc_html_e('Update Tracking and Inventory', 'wp-e-commerce');
        ?>
</a>
								<img src="<?php 
        echo esc_url(wpsc_get_ajax_spinner());
        ?>
" class="ajax-feedback" title="" alt="" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<?php 
        $currency_data = WPSC_Countries::get_currency_data(get_option('currency_type'), true);
        if ($currency_data['symbol'] != '') {
            $currency_sign = $currency_data['symbol_html'];
        } else {
            $currency_sign = $currency_data['code'];
        }
        ?>
			<tr>
				<th><?php 
        _e('Free Shipping Discount', 'wp-e-commerce');
        ?>
</th>
				<td>
					<?php 
        if (get_option('shipping_discount') == 1) {
            $shipping_discount_settings = 'style=\'display: block;\'';
        } else {
            $shipping_discount_settings = '';
        }
        ?>
					<input type='hidden' value='0' name='wpsc_options[shipping_discount]' />
					<input type='checkbox' onclick='jQuery("#shipping_discount_value").toggle( jQuery(this).prop("checked") );' value='1' name='wpsc_options[shipping_discount]' id='shipping_discount' <?php 
        checked('1', get_option('shipping_discount'));
        ?>
 />
					<label for='shipping_discount'><?php 
        _e('Enable Free Shipping Discount', 'wp-e-commerce');
        ?>
</label>

				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td colspan="2">
					<?php 
        $value = wpsc_format_number(get_option('shipping_discount_value'));
        ?>
					<div <?php 
        echo $shipping_discount_settings;
        ?>
 id='shipping_discount_value'>

					<?php 
        printf(__('Sales over or equal to %1$s<input type="text" size="6" name="wpsc_options[shipping_discount_value]" value="%2$s" id="shipping_discount_value" /> will receive free shipping.', 'wp-e-commerce'), $currency_sign, esc_attr($value));
        ?>
					</div>
				</td>
			</tr>
		</table>

		<?php 
        submit_button(__('Save Changes', 'wp-e-commerce'));
        ?>

		<h3><?php 
        _e('Shipping Modules', 'wp-e-commerce');
        ?>
</h3>
		<p class='description'><?php 
        _e('To enable shipping in WP eCommerce you must select which shipping methods you want to enable on your site.', 'wp-e-commerce');
        ?>
</p>
		<p class='description'>
			<strong><?php 
        _e('Tip', 'wp-e-commerce');
        ?>
</strong>:
			<?php 
        printf(__('For fixed-price shipping options such as "Pickup - $0, Overnight - $10, Same day - $20, etc.", install our free <a href="%1$s">Fixed Rate Shipping</a> plugin.', 'wp-e-commerce'), 'http://wordpress.org/extend/plugins/wp-e-commerce-fixed-rate-shipping/');
        ?>
		</p>

		<h4><?php 
        _e('Internal Shipping Calculators', 'wp-e-commerce');
        ?>
</h4>
		<table id='wpsc-shipping-options-internal' class='wpsc-edit-module-options wp-list-table widefat plugins'>
			<thead>
				<tr>
					<th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php 
        _e('Active', 'wp-e-commerce');
        ?>
</th>
					<th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php 
        _e('Shipping Calculator', 'wp-e-commerce');
        ?>
</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th scope="col" id="wpsc-shipping-options-internal-active" class="manage-column"><?php 
        _e('Active', 'wp-e-commerce');
        ?>
</th>
					<th scope="col" id="wpsc-shipping-options-internal-name" class="manage-column column-name"><?php 
        _e('Shipping Calculator', 'wp-e-commerce');
        ?>
</th>
				</tr>
			</tfoot>
			<tbody>
				<?php 
        foreach ($internal_shipping_modules as $shipping) {
            $force = $shipping->getInternalName() === (string) get_user_option('wpsc_settings_selected_shipping_module', get_current_user_id());
            $this->shipping_list_item($shipping, $force);
        }
        ?>
			</tbody>
		</table>
		<?php 
        submit_button(__('Save Changes', 'wp-e-commerce'));
        ?>

		<h4><?php 
        _e('External Shipping Calculators', 'wp-e-commerce');
        ?>
</h4>
		<?php 
        if (!function_exists('curl_init')) {
            ?>
			<p style='color: red; font-size:8pt; line-height:10pt;'>
				<?php 
            _e('The following shipping modules all need cURL which is not installed on this server. You may need to contact your web hosting provider to get it set up. ', 'wp-e-commerce');
            ?>
			</p>
		<?php 
        }
        ?>
		<table id='wpsc-shipping-options-external' class='wpsc-edit-module-options wp-list-table widefat plugins'>
			<thead>
				<tr>
					<th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php 
        _e('Active', 'wp-e-commerce');
        ?>
</th>
					<th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php 
        _e('Shipping Calculator', 'wp-e-commerce');
        ?>
</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th scope="col" id="wpsc-shipping-options-external-active" class="manage-column"><?php 
        _e('Active', 'wp-e-commerce');
        ?>
</th>
					<th scope="col" id="wpsc-shipping-options-external-name" class="manage-column column-name"><?php 
        _e('Shipping Calculator', 'wp-e-commerce');
        ?>
</th>
				</tr>
			</tfoot>
			<tbody>
				<?php 
        foreach ($external_shipping_modules as $shipping) {
            $force = $shipping->getInternalName() === (string) get_user_option('wpsc_settings_selected_shipping_module', get_current_user_id());
            $this->shipping_list_item($shipping, $force);
        }
        ?>
			</tbody>
		</table>
		<?php 
    }
/**
 * wpsc_currency_display function.
 *
 * @access public
 * @param mixed $price_in
 * @param mixed $args
 * @return string
 */
function wpsc_currency_display($price_in, $args = null)
{
    global $wpdb;
    $currency_code = '';
    $args = apply_filters('wpsc_toggle_display_currency_code', $args);
    $query = shortcode_atts(array('display_currency_symbol' => true, 'display_decimal_point' => true, 'display_currency_code' => false, 'display_as_html' => true, 'isocode' => false), $args);
    // No decimal point, no decimals
    if (false == $query['display_decimal_point']) {
        $decimals = 0;
    } else {
        $decimals = 2;
    }
    // default is 2
    $decimals = apply_filters('wpsc_modify_decimals', $decimals);
    // Format the price for output
    $price_out = wpsc_format_number($price_in, $decimals);
    // Get currency settings
    $currency_type = get_option('currency_type');
    if (!$query['isocode']) {
        // @todo: can deprecate this caching because the WPSC_Countries class already caches the data
        if (!($wpsc_currency_data = wp_cache_get($currency_type, 'wpsc_currency_id'))) {
            $wpsc_currency_data = WPSC_Countries::get_currency_data($currency_type, true);
            wp_cache_set($currency_type, $wpsc_currency_data, 'wpsc_currency_id');
        }
    } elseif (!($wpsc_currency_data = wp_cache_get($query['isocode'], 'wpsc_currency_isocode'))) {
        $wpsc_currency_data = WPSC_Countries::get_currency_data($currency_type, true);
        wp_cache_set($query['isocode'], $wpsc_currency_data, 'wpsc_currency_isocode');
    }
    // Figure out the currency code
    if ($query['display_currency_code']) {
        $currency_code = $wpsc_currency_data['code'];
    }
    // Figure out the currency sign
    $currency_sign = '';
    if ($query['display_currency_symbol']) {
        if (!empty($wpsc_currency_data['symbol'])) {
            if ($query['display_as_html'] && !empty($wpsc_currency_data['symbol_html'])) {
                $currency_sign = $wpsc_currency_data['symbol_html'];
            } else {
                $currency_sign = $wpsc_currency_data['symbol'];
            }
        } else {
            $currency_sign = $wpsc_currency_data['code'];
            $currency_code = '';
        }
    }
    $currency_sign_location = get_option('currency_sign_location');
    // Rejig the currency sign location
    switch ($currency_sign_location) {
        case 1:
            $format_string = '%3$s%1$s%2$s';
            break;
        case 2:
            $format_string = '%3$s %1$s%2$s';
            break;
        case 4:
            $format_string = '%1$s%2$s  %3$s';
            break;
        case 3:
        default:
            $format_string = '%1$s %2$s%3$s';
            break;
    }
    // Compile the output
    $output = trim(sprintf($format_string, $currency_code, $currency_sign, $price_out));
    if (!$query['display_as_html']) {
        $output = "" . $output . "";
    } else {
        $output = "<span class='pricedisplay'>" . $output . "</span>";
    }
    // Return results
    return apply_filters('wpsc_currency_display', $output);
}