コード例 #1
0
/**
 * wpsc_user_enqueues products function,
 * enqueue all javascript and CSS for wp ecommerce
 */
function wpsc_enqueue_user_script_and_css()
{
    global $wp_styles, $wpsc_theme_url, $wp_query;
    /**
     * added by xiligroup.dev to be compatible with touchshop
     */
    if (has_filter('wpsc_enqueue_user_script_and_css') && apply_filters('wpsc_mobile_scripts_css_filters', false)) {
        do_action('wpsc_enqueue_user_script_and_css');
    } else {
        /**
         * end of added by xiligroup.dev to be compatible with touchshop
         */
        $scheme = is_ssl() ? 'https' : 'http';
        $version_identifier = WPSC_VERSION . "." . WPSC_MINOR_VERSION;
        $category_id = wpsc_get_current_category_id();
        if (get_option('wpsc_share_this') == 1) {
            $remote_protocol = is_ssl() ? 'https://ws' : 'http://w';
            wp_enqueue_script('sharethis', $remote_protocol . '.sharethis.com/button/buttons.js', array(), false, true);
        }
        wp_enqueue_script('jQuery');
        wp_enqueue_script('wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array('jquery'), $version_identifier);
        wp_enqueue_script('infieldlabel', WPSC_CORE_JS_URL . '/jquery.infieldlabel.min.js', array('jquery'), $version_identifier);
        wp_enqueue_script('wp-e-commerce-ajax-legacy', WPSC_CORE_JS_URL . '/ajax.js', false, $version_identifier);
        //wp_enqueue_script( 'wp-e-commerce-dynamic', home_url( '/index.php?wpsc_user_dynamic_js=true', $scheme ), true,             $version_identifier );
        wp_localize_script('wp-e-commerce-dynamic', 'wpsc_ajax', array('ajaxurl' => admin_url('admin-ajax.php'), 'spinner' => esc_url(admin_url('images/wpspin_light.gif')), 'no_quotes' => __('It appears that there are no shipping quotes for the shipping information provided.  Please check the information and try again.', 'wpsc')));
        wp_enqueue_script('livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array('jquery'), '1.0.3');
        if (get_option('product_ratings') == 1) {
            wp_enqueue_script('jquery-rating', WPSC_CORE_JS_URL . '/jquery.rating.js', array('jquery'), $version_identifier);
        }
        wp_enqueue_script('wp-e-commerce-legacy', WPSC_CORE_JS_URL . '/user.js', array('jquery'), WPSC_VERSION . WPSC_MINOR_VERSION);
        if (get_option('show_thumbnails_thickbox') == 1) {
            $lightbox = get_option('wpsc_lightbox', 'thickbox');
            if ($lightbox == 'thickbox') {
                wp_enqueue_script('wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.js', array('jquery'), 'Instinct_e-commerce');
                wp_enqueue_style('wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.css', false, $version_identifier, 'all');
            } elseif ($lightbox == 'colorbox') {
                wp_enqueue_script('colorbox-min', WPSC_CORE_JS_URL . '/jquery.colorbox-min.js', array('jquery'), 'Instinct_e-commerce');
                wp_enqueue_script('wpsc_colorbox', WPSC_CORE_JS_URL . '/wpsc_colorbox.js', array('jquery', 'colorbox-min'), 'Instinct_e-commerce');
                wp_enqueue_style('wpsc-colorbox-css', WPSC_CORE_JS_URL . '/wpsc_colorbox.css', false, $version_identifier, 'all');
            }
        }
        wp_enqueue_style('wpsc-theme-css', wpsc_get_template_file_url('wpsc-' . get_option('wpsc_selected_theme') . '.css'), false, $version_identifier, 'all');
        wp_enqueue_style('wpsc-theme-css-compatibility', WPSC_CORE_THEME_URL . 'compatibility.css', array('wpsc-theme-css'), $version_identifier, 'all');
        if (function_exists('wp_add_inline_style')) {
            wp_add_inline_style('wpsc-theme-css', wpsc_get_user_dynamic_css());
        } else {
            wp_enqueue_style('wp-e-commerce-dynamic', wpsc_get_dynamic_user_css_url(), array('wpsc-theme-css'), $version_identifier);
        }
        if (get_option('product_ratings') == 1) {
            wp_enqueue_style('wpsc-product-rater', WPSC_CORE_JS_URL . '/product_rater.css', false, $version_identifier, 'all');
        }
    }
    if (!defined('WPSC_MP3_MODULE_USES_HOOKS') && function_exists('listen_button')) {
        function wpsc_legacy_add_mp3_preview($product_id, &$product_data)
        {
            global $wpdb;
            if (function_exists('listen_button')) {
                $file_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id` = %d LIMIT 1", $product_data['file']), ARRAY_A);
                if ($file_data != null) {
                    echo listen_button($file_data['idhash'], $file_data['id']);
                }
            }
        }
        add_action('wpsc_product_before_description', 'wpsc_legacy_add_mp3_preview', 10, 2);
    }
}
コード例 #2
0
/**
 * wpsc_user_enqueues products function,
 * enqueue all javascript and CSS for wp ecommerce
 */
function wpsc_enqueue_user_script_and_css()
{
    global $wp_styles, $wpsc_theme_url, $wp_query;
    /**
     * added by xiligroup.dev to be compatible with touchshop
     */
    if (has_filter('wpsc_enqueue_user_script_and_css') && apply_filters('wpsc_mobile_scripts_css_filters', false)) {
        do_action('wpsc_enqueue_user_script_and_css');
    } else {
        /**
         * end of added by xiligroup.dev to be compatible with touchshop
         */
        $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
        $category_id = wpsc_get_current_category_id();
        if (get_option('wpsc_share_this') == 1) {
            $remote_protocol = is_ssl() ? 'https://ws' : 'http://w';
            wp_enqueue_script('sharethis', $remote_protocol . '.sharethis.com/button/buttons.js', array(), false, true);
        }
        wp_enqueue_script('jQuery');
        wp_enqueue_script('wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array('jquery'), $version_identifier);
        if (defined('WPEC_LOAD_DEPRECATED_JS') && WPEC_LOAD_DEPRECATED_JS) {
            wp_enqueue_script('wpsc-deprecated', WPSC_CORE_JS_URL . '/wpsc-deprecated.js', 'wp-e-commerce', $version_identifier);
            wp_localize_script('wpsc-deprecated', 'wpsc_deprecated_js_vars', _wpsc_deprecated_javascript_localization_vars());
        }
        wp_enqueue_script('wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array('jquery'), $version_identifier);
        wp_localize_script('wp-e-commerce', 'wpsc_vars', wpsc_javascript_localizations());
        wp_enqueue_script('livequery', WPSC_URL . '/wpsc-admin/js/jquery.livequery.js', array('jquery'), '1.0.3');
        if (get_option('product_ratings') == 1) {
            wp_enqueue_script('jquery-rating', WPSC_CORE_JS_URL . '/jquery.rating.js', array('jquery'), $version_identifier);
        }
        wp_enqueue_script('wp-e-commerce-legacy', WPSC_CORE_JS_URL . '/user.js', array('jquery'), WPSC_VERSION . WPSC_MINOR_VERSION);
        if (get_option('show_thumbnails_thickbox') == 1) {
            $lightbox = get_option('wpsc_lightbox', 'thickbox');
            if ($lightbox == 'thickbox') {
                wp_enqueue_script('wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.js', array('jquery'), 'Instinct_e-commerce');
                wp_enqueue_style('wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.css', false, $version_identifier, 'all');
            } elseif ($lightbox == 'colorbox') {
                wp_enqueue_script('colorbox-min', WPSC_CORE_JS_URL . '/jquery.colorbox-min.js', array('jquery'), 'Instinct_e-commerce');
                wp_enqueue_script('wpsc_colorbox', WPSC_CORE_JS_URL . '/wpsc_colorbox.js', array('jquery', 'colorbox-min'), 'Instinct_e-commerce');
                wp_enqueue_style('wpsc-colorbox-css', WPSC_CORE_JS_URL . '/wpsc_colorbox.css', false, $version_identifier, 'all');
            }
        }
        wp_enqueue_style('wpsc-theme-css', wpsc_get_template_file_url('wpsc-' . get_option('wpsc_selected_theme') . '.css'), false, $version_identifier, 'all');
        wp_enqueue_style('wpsc-theme-css-compatibility', wpsc_get_template_file_url('compatibility.css'), array('wpsc-theme-css'), $version_identifier, 'all');
        if (function_exists('wp_add_inline_style')) {
            wp_add_inline_style('wpsc-theme-css', wpsc_get_user_dynamic_css());
        } else {
            wp_enqueue_style('wp-e-commerce-dynamic', wpsc_get_dynamic_user_css_url(), array('wpsc-theme-css'), $version_identifier);
        }
        if (get_option('product_ratings') == 1) {
            wp_enqueue_style('wpsc-product-rater', WPSC_CORE_JS_URL . '/product_rater.css', false, $version_identifier, 'all');
        }
    }
    if (!defined('WPSC_MP3_MODULE_USES_HOOKS') && function_exists('listen_button')) {
        function wpsc_legacy_add_mp3_preview($product_id, &$product_data)
        {
            global $wpdb;
            if (function_exists('listen_button')) {
                $file_data = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPSC_TABLE_PRODUCT_FILES . "` WHERE `id` = %d LIMIT 1", $product_data['file']), ARRAY_A);
                if ($file_data != null) {
                    echo listen_button($file_data['idhash'], $file_data['id']);
                }
            }
        }
        add_action('wpsc_product_before_description', 'wpsc_legacy_add_mp3_preview', 10, 2);
    }
}
コード例 #3
0
ファイル: page.php プロジェクト: benhuson/WP-e-Commerce
/**
 * wpsc_user_enqueues products function,
 * enqueue all javascript and CSS for wp ecommerce
 */
function wpsc_enqueue_user_script_and_css()
{
    global $wp_styles, $wpsc_theme_url, $wp_query;
    /**
     * added by xiligroup.dev to be compatible with touchshop
     */
    if (has_filter('wpsc_enqueue_user_script_and_css') && apply_filters('wpsc_mobile_scripts_css_filters', false)) {
        do_action('wpsc_enqueue_user_script_and_css');
    } else {
        /**
         * end of added by xiligroup.dev to be compatible with touchshop
         */
        $version_identifier = WPSC_VERSION . '.' . WPSC_MINOR_VERSION;
        $category_id = wpsc_get_current_category_id();
        if (get_option('wpsc_share_this') == 1) {
            $remote_protocol = is_ssl() ? 'https://ws' : 'http://w';
            wp_enqueue_script('sharethis', $remote_protocol . '.sharethis.com/button/buttons.js', array(), false, true);
        }
        wp_enqueue_script('jQuery');
        wp_enqueue_script('wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array('jquery'), $version_identifier);
        if (defined('WPEC_LOAD_DEPRECATED_JS') && WPEC_LOAD_DEPRECATED_JS) {
            wp_enqueue_script('wpsc-deprecated', WPSC_CORE_JS_URL . '/wpsc-deprecated.js', 'wp-e-commerce', $version_identifier);
            wp_localize_script('wpsc-deprecated', 'wpsc_deprecated_js_vars', _wpsc_deprecated_javascript_localization_vars());
        }
        wp_enqueue_script('wp-e-commerce', WPSC_CORE_JS_URL . '/wp-e-commerce.js', array('jquery'), $version_identifier);
        wp_localize_script('wp-e-commerce', 'wpsc_vars', wpsc_javascript_localizations());
        if (get_option('product_ratings') == 1) {
            wp_enqueue_script('jquery-rating', WPSC_CORE_JS_URL . '/jquery.rating.js', array('jquery'), $version_identifier);
        }
        wp_enqueue_script('wp-e-commerce-legacy', WPSC_CORE_JS_URL . '/user.js', array('jquery'), WPSC_VERSION . WPSC_MINOR_VERSION);
        if (get_option('show_thumbnails_thickbox') == 1) {
            $lightbox = get_option('wpsc_lightbox', 'thickbox');
            if ($lightbox == 'thickbox') {
                wp_enqueue_script('wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.js', array('jquery'), 'Instinct_e-commerce');
                wp_enqueue_style('wpsc-thickbox', WPSC_CORE_JS_URL . '/thickbox.css', false, $version_identifier, 'all');
            } elseif ($lightbox == 'colorbox') {
                wp_enqueue_script('colorbox-min', WPSC_CORE_JS_URL . '/jquery.colorbox-min.js', array('jquery'), 'Instinct_e-commerce');
                wp_enqueue_script('wpsc_colorbox', WPSC_CORE_JS_URL . '/wpsc_colorbox.js', array('jquery', 'colorbox-min'), 'Instinct_e-commerce');
                wp_enqueue_style('wpsc-colorbox-css', WPSC_CORE_JS_URL . '/wpsc_colorbox.css', false, $version_identifier, 'all');
            }
        }
        wp_enqueue_style('wpsc-theme-css', wpsc_get_template_file_url('wpsc-' . get_option('wpsc_selected_theme') . '.css'), false, $version_identifier, 'all');
        wp_enqueue_style('wpsc-theme-css-compatibility', wpsc_get_template_file_url('compatibility.css'), array('wpsc-theme-css'), $version_identifier, 'all');
        if (function_exists('wp_add_inline_style')) {
            wp_add_inline_style('wpsc-theme-css', wpsc_get_user_dynamic_css());
        } else {
            wp_enqueue_style('wp-e-commerce-dynamic', wpsc_get_dynamic_user_css_url(), array('wpsc-theme-css'), $version_identifier);
        }
        if (get_option('product_ratings') == 1) {
            wp_enqueue_style('wpsc-product-rater', WPSC_CORE_JS_URL . '/product_rater.css', false, $version_identifier, 'all');
        }
    }
}