コード例 #1
0
/**
 * Plugin compatibility checker
 *
 * Here current theme is checked for compatibility with WP PRODUCT ADDER.
 *
 * @version		1.1.2
 * @package		ecommerce-product-catalog/functions
 * @author 		Norbert Dreszer
 */
function al_product_adder_admin_notices_styles()
{
    if (current_user_can('activate_plugins')) {
        if (!is_advanced_mode_forced()) {
            $template = get_option('template');
            $integration_type = get_integration_type();
            if (!empty($_GET['hide_al_product_adder_support_check'])) {
                update_option('product_adder_theme_support_check', $template);
                return;
            }
            if (get_option('product_adder_theme_support_check') !== $template && current_user_can('delete_others_products')) {
                product_adder_theme_check_notice();
            }
        }
        if (is_ic_catalog_admin_page()) {
            $product_count = ic_products_count();
            if ($product_count > 5) {
                if (false === get_transient('implecode_hide_plugin_review_info')) {
                    implecode_plugin_review_notice();
                    set_transient('implecode_hide_plugin_translation_info', 1, WEEK_IN_SECONDS);
                } else {
                    if (false === get_transient('implecode_hide_plugin_translation_info') && !is_english_catalog_active()) {
                        implecode_plugin_translation_notice();
                    }
                }
            } else {
                if (false === get_transient('implecode_hide_plugin_review_info')) {
                    set_transient('implecode_hide_plugin_review_info', 1, WEEK_IN_SECONDS);
                }
            }
        }
    }
}
コード例 #2
0
function create_sample_product()
{
    $sample_id = sample_product_id();
    if (current_user_can('publish_products') && (!is_advanced_mode_forced() && empty($sample_id) || isset($_GET['create_sample_product_page']))) {
        $product_sample = array('post_title' => __('Sample Product Page', 'ecommerce-product-catalog'), 'post_type' => 'al_product', 'post_content' => '', 'post_status' => 'publish', 'comment_status' => 'closed');
        $product_id = wp_insert_post($product_sample);
        $product_field['_price'] = 30;
        $product_field['_sku'] = 'INT102';
        $product_field['_attribute-label1'] = __('Color', 'ecommerce-product-catalog');
        $product_field['_attribute-label2'] = __('Size', 'ecommerce-product-catalog');
        $product_field['_attribute-label3'] = __('Weight', 'ecommerce-product-catalog');
        $product_field['_attribute1'] = __('White', 'ecommerce-product-catalog');
        $product_field['_attribute2'] = __('Big', 'ecommerce-product-catalog');
        $product_field['_attribute3'] = 130;
        $product_field['_attribute-unit1'] = '';
        $product_field['_attribute-unit2'] = '';
        $product_field['_attribute-unit3'] = __('lbs', 'ecommerce-product-catalog');
        $product_field['_shipping-label1'] = 'UPS';
        $product_field['_shipping1'] = 15;
        //$product_field[ 'excerpt' ]				 = '[theme_integration class="fixed-box"]';
        $product_field['excerpt'] = '<p>' . __('Welcome on product test page. This is short description. It should show up on the left of the product image and below product name. You shouldn\'t see nothing between product name and short description. No author, time or date. Absolutely nothing. If there is something that you don\'t want to see than you probably need Advanced Integration Mode.', 'ecommerce-product-catalog') . '</p>';
        $product_field['excerpt'] .= '<p><strong>' . __('Please read this page carefully to fully understand the difference between simple and advanced mode and how the product page looks like.', 'ecommerce-product-catalog') . '</strong></p>';
        $long_desc = '<p>' . __('This section is product long description. It should appear under the attributes table. Between the short description and the attributes table you should see the price, SKU and shipping options (all can be disabled). The attributes also can be disabled.', 'ecommerce-product-catalog') . '</p>';
        $long_desc .= '<h2>' . __('Advanced Theme Integration Mode', 'ecommerce-product-catalog') . '</h2>';
        $long_desc .= '<p>' . sprintf(__('With Advanced Mode you will be able to use eCommerce Product Catalog in %s. The product listing page, category pages, product search and category widget will be enabled in advanced mode. You can enable the Advanced Mode %s free. To see how please see <a target="_blank" href="%s">Theme Integration Guide</a>', 'ecommerce-product-catalog'), '100%', '100%', 'https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=sample-product-page&key=integration-mode-test') . '</p>';
        $long_desc .= '<p>' . __('The Advanced Mode works out of the box on all default WordPress themes and all themes with the integration done properly.', 'ecommerce-product-catalog') . '</p>';
        $long_desc .= '<h2>' . __('Simple Theme Integration Mode', 'ecommerce-product-catalog') . '</h2>';
        $long_desc .= '<p>' . sprintf(__('The simple mode allows to use eCommerce Product Catalog most features. You can build the product listing pages and category pages by using a %s shortcode. Simple mode uses your theme page layout so it can show unwanted elements on product page. If it does please switch to Advanced Mode and see if it works out of the box.', 'ecommerce-product-catalog'), '[[show_products]]') . '</p>';
        $long_desc .= '<p>' . __('Switching to Advanced Mode also gives additional features: automatic product listing, category pages, product search and category widget. Building a product catalog in Advanced Mode will be less time consuming as you don\'t need to use a shortcode for everything.', 'ecommerce-product-catalog') . '</p>';
        $long_desc .= '<h2>' . __('How to switch to Advanced Mode?', 'ecommerce-product-catalog') . '</h2>';
        $long_desc .= '<p>' . sprintf(__('Click <a href="%s">here</a> to test the Automatic Advanced Mode. If the test goes well you can keep it enabled and enjoy full eCommerce Product Catalog functionality. If the page layout during the test will not be satisfying please see <a target="_blank" href="%s">Theme Integration Guide</a>', 'ecommerce-product-catalog'), '?test_advanced=1', 'https://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=sample-product-page&key=integration-mode-test') . '</p>';
        $long_desc .= '<p>' . __('The theme integration guide will show you a step by step process. If you finish it successfully the integration will be done. It is recommended to use theme integration guide even if the page looks good in simple mode or automatic advanced mode because it reassures 100% theme integrity.', 'ecommerce-product-catalog') . '</p>';
        $long_desc .= '<h2>' . __('Product Description End', 'ecommerce-product-catalog') . '</h2>';
        $long_desc .= '<p>' . __('Below the product description you should see nothing apart of return to products URL and Advanced Mode Test which will not show up on your product pages. When using advanced mode also the related products will show up.', 'ecommerce-product-catalog') . '</p>';
        $long_desc .= '<p>' . sprintf(__('Thank you for choosing eCommerce Product Catalog. If you have any questions or comments please use <a target="_blank" href="%s">plugin support forum</a>.', 'ecommerce-product-catalog'), 'https://wordpress.org/support/plugin/ecommerce-product-catalog') . '</p>';
        //$long_desc .= '[theme_integration]';
        $product_field['content'] = $long_desc;
        foreach ($product_field as $key => $value) {
            add_post_meta($product_id, $key, $value, true);
        }
        update_option('sample_product_id', $product_id);
        return $product_id;
    }
}
コード例 #3
0
function get_multiple_settings()
{
    $archive_multiple_settings = get_option('archive_multiple_settings', unserialize(DEFAULT_ARCHIVE_MULTIPLE_SETTINGS));
    if (is_advanced_mode_forced() || isset($_GET['test_advanced']) && ($_GET['test_advanced'] == 1 || $_GET['test_advanced'] == 'ok')) {
        $archive_multiple_settings['integration_type'] = 'advanced';
    } else {
        $archive_multiple_settings['integration_type'] = isset($archive_multiple_settings['integration_type']) ? $archive_multiple_settings['integration_type'] : 'simple';
    }
    $archive_multiple_settings['disable_sku'] = isset($archive_multiple_settings['disable_sku']) ? $archive_multiple_settings['disable_sku'] : '';
    $archive_multiple_settings['seo_title_sep'] = isset($archive_multiple_settings['seo_title_sep']) ? $archive_multiple_settings['seo_title_sep'] : '';
    $archive_multiple_settings['seo_title'] = isset($archive_multiple_settings['seo_title']) ? $archive_multiple_settings['seo_title'] : '';
    $archive_multiple_settings['category_archive_url'] = isset($archive_multiple_settings['category_archive_url']) ? $archive_multiple_settings['category_archive_url'] : 'product-category';
    $archive_multiple_settings['category_archive_url'] = empty($archive_multiple_settings['category_archive_url']) ? 'product-category' : $archive_multiple_settings['category_archive_url'];
    $archive_multiple_settings['product_listing_cats'] = isset($archive_multiple_settings['product_listing_cats']) ? $archive_multiple_settings['product_listing_cats'] : 'on';
    $archive_multiple_settings['category_top_cats'] = isset($archive_multiple_settings['category_top_cats']) ? $archive_multiple_settings['category_top_cats'] : 'on';
    $archive_multiple_settings['cat_template'] = isset($archive_multiple_settings['cat_template']) ? $archive_multiple_settings['cat_template'] : 'template';
    $archive_multiple_settings['product_order'] = isset($archive_multiple_settings['product_order']) ? $archive_multiple_settings['product_order'] : 'newest';
    $archive_multiple_settings['catalog_plural'] = isset($archive_multiple_settings['catalog_plural']) ? $archive_multiple_settings['catalog_plural'] : __('Products', 'al-ecommerce-product-catalog');
    $archive_multiple_settings['catalog_singular'] = isset($archive_multiple_settings['catalog_singular']) ? $archive_multiple_settings['catalog_singular'] : __('Product', 'al-ecommerce-product-catalog');
    $archive_multiple_settings['cat_image_disabled'] = isset($archive_multiple_settings['cat_image_disabled']) ? $archive_multiple_settings['cat_image_disabled'] : '';
    return apply_filters('catalog_multiple_settings', $archive_multiple_settings);
}
コード例 #4
0
ファイル: templates.php プロジェクト: satokora/IT354Project
function theme_integration_shortcode($atts)
{
    $current_mode = get_real_integration_mode();
    if (current_user_can("delete_private_products") && !is_advanced_mode_forced()) {
        $args = shortcode_atts(array('class' => 'relative-box'), $atts);
        $class = esc_attr($args['class']);
        $box_content = '<h4>' . __('Advanced Mode Test', 'al-ecommerce-product-catalog') . '</h4>';
        $box_content .= '<script>jQuery(window).scroll( function() { if (isScrolledIntoView(".relative-box")) {jQuery(".fixed-box").hide("slow");}
else {jQuery(".fixed-box").show("slow");}});
function isScrolledIntoView(elem)
{
    var docViewTop = jQuery(window).scrollTop();
    var docViewBottom = docViewTop + jQuery(window).height();
    var elemTop = jQuery(elem).offset().top;
    var elemBottom = elemTop + jQuery(elem).height();
    return ((docViewTop < elemTop) && (docViewBottom > elemBottom));
//    return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}</script>';
        if (!isset($_GET['test_advanced'])) {
            $box_content .= '<p>' . __('eCommerce Product Catalog is currently running in Simple Mode.', 'al-ecommerce-product-catalog') . '</p>';
            $box_content .= '<p>' . __('In Simple Mode the product listing, product search and category pages are disabled (please read this Sample Product Page to fully understand the difference).', 'al-ecommerce-product-catalog') . '</p>';
            $box_content .= '<p>' . __('Please use the button below to check out how the product page looks in Automatic Advanced Mode.', 'al-ecommerce-product-catalog') . '</p>';
            $box_content .= '<p class="wp-core-ui"><a href="' . add_query_arg('test_advanced', '1') . '" class="button-primary">' . __('Start Advanced Mode Test', 'al-ecommerce-product-catalog') . '</a><a href="' . add_query_arg('test_advanced', 'simple') . '" class="button-secondary">' . __('Use Simple Mode', 'al-ecommerce-product-catalog') . '</a></p>';
            if ($current_mode == 'simple') {
                return '<div class="' . $class . '">' . implecode_info($box_content, 0) . '</div>';
            }
        } else {
            if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 1) {
                $box_content .= '<p>' . __('Advanced Mode is temporary enabled for this page now.', 'al-ecommerce-product-catalog') . '</p>';
                $box_content .= '<p>' . __('Please use the buttons below to let the script know if the Automatic Advanced Integration is done right.', 'al-ecommerce-product-catalog') . '</p>';
                $box_content .= '<p>' . __('Is everything looking fine, without design break and correct sidebar position?', 'al-ecommerce-product-catalog') . '</p>';
                $box_content .= '<p class="wp-core-ui"><a href="' . add_query_arg('test_advanced', 'ok') . '" class="button-primary">' . __('It\'s Fine', 'al-ecommerce-product-catalog') . '</a><a href="' . add_query_arg('test_advanced', 'bad') . '" class="button-secondary">' . __('It\'s Broken', 'al-ecommerce-product-catalog') . '</a></p>';
                return '<div class="' . $class . '">' . implecode_info($box_content, 0) . '</div>';
            } else {
                if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 'bad') {
                    $box_content .= '<p>' . __('It seems that Manual Theme Integration is needed in order to use Advanced Mode with your current theme.', 'al-ecommerce-product-catalog') . '</p>';
                    $box_content .= '<h4>' . __('You Have 3 choices', 'al-ecommerce-product-catalog') . ':</h4>';
                    $box_content .= '<ol>';
                    $box_content .= '<li>' . __('Get the Manual Theme Integration done.', 'al-ecommerce-product-catalog') . '</li>';
                    $box_content .= '<li>' . __('Keep using Simple Mode which is still functional.', 'al-ecommerce-product-catalog') . '</li>';
                    $box_content .= '<li>' . __('Switch the theme.', 'al-ecommerce-product-catalog') . '</li>';
                    $box_content .= '</ol>';
                    $box_content .= '<p>' . __('Please make your choice below or switch the theme.', 'al-ecommerce-product-catalog') . '</p>';
                    $box_content .= '<p class="wp-core-ui"><a target="_blank" href="http://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=simple-mode&key=integration-advanced-fail" class="button-primary">' . __('Free Theme Integration Guide', 'al-ecommerce-product-catalog') . '</a><a href="' . add_query_arg('test_advanced', 'simple') . '" class="button-secondary">' . __('Use Simple Mode', 'al-ecommerce-product-catalog') . '</a></p>';
                    enable_simple_mode();
                    return '<div class="' . $class . '">' . implecode_warning($box_content, 0) . '</div>';
                } else {
                    if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 'ok') {
                        $box_content .= '<p>' . __('Congratulations! eCommerce Product Catalog is working on Advanced Mode now. You can go to admin and add the products to the catalog.', 'al-ecommerce-product-catalog') . '</p>';
                        $box_content .= '<p>' . __('If you are a developer or would like to have full control on the product pages templates we still recommend to proceed with manual integration.', 'al-ecommerce-product-catalog') . '</p>';
                        $box_content .= '<p>' . __('You can switch between modes at any time in Product Settings.', 'al-ecommerce-product-catalog') . '</p>';
                        $box_content .= '<p class="wp-core-ui"><a href="' . admin_url() . '" class="button-primary">' . __('Go to Admin', 'al-ecommerce-product-catalog') . '</a><a target="_blank" href="http://implecode.com/wordpress/product-catalog/theme-integration-guide/#cam=advanced-mode&key=integration-advanced-success" class="button-secondary">' . __('Free Theme Integration Guide', 'al-ecommerce-product-catalog') . '</a></p>';
                        enable_advanced_mode();
                        return '<div class="' . $class . '">' . implecode_success($box_content, 0) . '</div>';
                    } else {
                        if (isset($_GET['test_advanced']) && $_GET['test_advanced'] == 'simple') {
                            $box_content .= '<p>' . __('You are using simple mode now.', 'al-ecommerce-product-catalog') . '</p>';
                            $box_content .= '<p>' . __('You can switch between modes at any time in Product Settings.', 'al-ecommerce-product-catalog') . '</p>';
                            $box_content .= '<p>' . __('Use the buttons below to try the advanced integration again or go to admin and start adding your products.', 'al-ecommerce-product-catalog') . '</p>';
                            $box_content .= '<p class="wp-core-ui"><a href="' . admin_url() . '" class="button-primary">' . __('Go to Admin', 'al-ecommerce-product-catalog') . '</a><a href="' . add_query_arg('test_advanced', '1') . '" class="button-secondary">' . __('Restart Advanced Mode Test', 'al-ecommerce-product-catalog') . '</a></p>';
                            enable_simple_mode();
                            return '<div class="' . $class . '">' . implecode_success($box_content, 0) . '</div>';
                        }
                    }
                }
            }
        }
    }
}
コード例 #5
0
/**
 * Checks if current page is integration wizard page
 *
 * @return boolean
 */
function is_ic_integration_wizard_page()
{
    if (sample_product_id() == get_the_ID() && current_user_can("manage_product_settings") && !is_advanced_mode_forced()) {
        return true;
    }
    return false;
}