/**
  * WordPress Enqueue for the Pro Script and CSS file
  *
  * @return void
  *
  * @since 3.9
  */
 public function pro_script()
 {
     if (wpsc_is_checkout()) {
         wp_enqueue_script('pro-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.js', array('jquery'));
         wp_enqueue_style('pro-syle-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.css');
     }
 }
 /**
  * WordPress Enqueue for the Dgital Goods Script and CSS file
  *
  * @return void
  *
  * @since 3.9
  */
 public function dg_script()
 {
     if (wpsc_is_checkout()) {
         wp_enqueue_script('dg-script', 'https://www.paypalobjects.com/js/external/dg.js');
         wp_enqueue_script('dg-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/dg.js', array('jquery'));
     }
 }
Example #3
0
 /**
  * WordPress Enqueue for the Pro Script and CSS file
  *
  * @return void
  *
  * @since 3.9
  */
 public static function pro_script()
 {
     if (wpsc_is_checkout()) {
         $pro_loc = array('spinner_url' => wpsc_get_ajax_spinner(), 'loading' => __('Loading...', 'wp-e-commerce'));
         wp_enqueue_script('pro-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.js', array('jquery'));
         wp_enqueue_style('pro-style-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/pro.css');
         wp_localize_script('pro-script-internal', 'pro_loc', $pro_loc);
     }
 }
Example #4
0
 public function force_ssl()
 {
     if (!is_ssl() && '1' == get_option('wpsc_force_ssl') && (wpsc_is_cart() || wpsc_is_checkout())) {
         $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         if (isset($_REQUEST['_wp_nonce'])) {
             $url = add_query_arg('_wp_nonce', $_REQUEST['_wp_nonce'], $url);
         }
         wp_safe_redirect($url);
         exit;
     }
 }
Example #5
0
/**
 * wpsc_template_loader function.
 *
 * @since 3.8
 * @access public
 * @return void
 */
function wpsc_template_loader()
{
    global $wp_query;
    if (wpsc_is_product() && ($template = wpsc_get_template('products'))) {
        include $template;
        exit;
    }
    if (wpsc_is_checkout() && ($template = wpsc_get_template('checkout'))) {
        include $template;
        exit;
    }
}
 /**
  * WordPress Enqueue for the Dgital Goods Script and CSS file
  *
  * @return void
  *
  * @since 3.9
  */
 public static function dg_script()
 {
     $dg_loc = array('spinner_url' => wpsc_get_ajax_spinner(), 'loading' => __('Loading...', 'wp-e-commerce'));
     // Checkout Page
     if (wpsc_is_checkout()) {
         wp_enqueue_script('dg-script', 'https://www.paypalobjects.com/js/external/dg.js');
         wp_enqueue_script('dg-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/dg.js', array('jquery'));
         wp_localize_script('dg-script', 'dg_loc', $dg_loc);
     }
     // Cart Page
     if (function_exists('wpsc_is_cart') && wpsc_is_cart()) {
         wp_enqueue_script('dg-script', 'https://www.paypalobjects.com/js/external/dg.js');
         wp_enqueue_script('dg-script-internal', WPSC_URL . '/wpsc-components/merchant-core-v3/gateways/dgs.js', array('jquery'));
         wp_localize_script('dg-script', 'dg_loc', $dg_loc);
     }
 }
Example #7
0
/**
 * Output a dummy thumbnail image in case the current product in the loop does not have a specified
 * featured thumbnail.
 *
 * @since 4.0
 * @uses  $_wp_additional_image_size The array containing registered image sizes
 * @uses  apply_filters() Applies 'wpsc_product_no_thumbnail_url' filter
 * @uses  apply_filters() Applies 'wpsc_product_no_thumbnail_html' filter
 *
 * @param string $size Optional. If this is not specified, the appropriate size will be detected based on the current page being viewed. See {@link wpsc_get_product_thumbnail()} for a list of available sizes you can use.
 * @param string $attr Optional. Query string or array of attributes. Defaults to ''.
 */
function wpsc_product_no_thumbnail_image($size = false, $attr = '')
{
    global $_wp_additional_image_sizes;
    // automatically detect the correct $size if it's not specified
    if (!$size) {
        if (is_singular('wpsc-product')) {
            $size = 'single';
        } elseif (is_tax('wpsc_product_category') || is_tax('product_tag')) {
            $size = 'taxonomy';
        } elseif (wpsc_is_cart() || wpsc_is_customer_account() || wpsc_is_checkout()) {
            $size = 'cart';
        } else {
            $size = 'archive';
        }
    }
    if (is_string($size)) {
        $wp_size = $size;
        if (in_array($size, array('single', 'taxonomy', 'cart', 'archive'))) {
            $wp_size = 'wpsc_product_' . $size . '_thumbnail';
        }
        if (array_key_exists($wp_size, $_wp_additional_image_sizes)) {
            $dimensions = $_wp_additional_image_sizes[$wp_size];
        } else {
            $dimensions = array('width' => '', 'height' => '');
        }
    } elseif (is_array($size) && count($size) == 2) {
        $dimensions = array('width' => $size[0], 'height' => $size[1]);
    } else {
        return;
    }
    $title = wpsc_product_title_attribute(array('echo' => false));
    $src = apply_filters('wpsc_product_no_thumbnail_url', wpsc_locate_asset_uri('images/noimage.png'), $size, $attr);
    $html = '<img alt="' . $title . '" src="' . $src . '" title="' . $title . '" width="' . $dimensions['width'] . '" height="' . $dimensions['height'] . '" />';
    $html = apply_filters('wpsc_product_no_thumbnail_html', $html, $size, $attr);
    echo $html;
}
 /**
  * Add scripts
  */
 public function scripts()
 {
     if (!wpsc_is_cart() && !wpsc_is_checkout()) {
         return;
     }
     wp_enqueue_style('amazon_payments_advanced', WPSC_MERCHANT_V3_SDKS_URL . '/amazon-payments/assets/css/style.css');
     wp_enqueue_script('amazon_payments_advanced_widgets', WPSC_AMAZON_PA_WIDGETS_URL, '', WPSC_VERSION);
     wp_enqueue_script('amazon_payments_advanced', WPSC_MERCHANT_V3_SDKS_URL . '/amazon-payments/assets/js/amazon-checkout.js', array('amazon_payments_advanced_widgets'), '1.0', true);
     $is_pay_page = _wpsc_get_current_controller_name() == 'checkout' || _wpsc_get_current_controller_name() == 'cart';
     $redirect_page = $is_pay_page ? add_query_arg('amazon_payments_advanced', 'true', wpsc_get_checkout_url('shipping-and-billing')) : esc_url_raw(add_query_arg('amazon_payments_advanced', 'true'));
     wp_localize_script('amazon_payments_advanced', 'amazon_payments_advanced_params', apply_filters('wpsc_amazon_payments_advanced_params', array('seller_id' => $this->setting->get('seller_id'), 'reference_id' => $this->reference_id, 'redirect' => $redirect_page, 'pwa_type' => 'PwA', 'pwa_color' => 'Gold', 'pwa_size' => 'small')));
 }