Esempio n. 1
0
/**
 * Returns single names settings
 *
 * @return type
 */
function get_single_names()
{
    $single_names = ic_get_global('single_names');
    if (!$single_names) {
        $default_single_names = default_single_names();
        $single_names = get_option('single_names', $default_single_names);
        foreach ($default_single_names as $key => $value) {
            $single_names[$key] = isset($single_names[$key]) ? $single_names[$key] : $value;
        }
        ic_save_global('single_names', $single_names);
    }
    return $single_names;
}
Esempio n. 2
0
/**
 * Returns current product ID
 *
 * @global type $implecode
 * @return type
 */
function ic_get_product_id()
{
    $product_id = ic_get_global('product_id');
    if (!$product_id) {
        $product_id = get_the_ID();
        ic_save_global('product_id', $product_id);
    }
    return $product_id;
}
Esempio n. 3
0
function ecommerce_product_catalog_upgrade()
{
    if (is_admin()) {
        $plugin_data = get_plugin_data(AL_PLUGIN_MAIN_FILE);
        $plugin_version = $plugin_data["Version"];
        $database_plugin_version = get_option('ecommerce_product_catalog_ver', $plugin_version);
        if ($database_plugin_version != $plugin_version) {
            update_option('ecommerce_product_catalog_ver', $plugin_version);
            $first_version = (string) get_option('first_activation_version', $plugin_version);
            if (version_compare($first_version, '1.9.0') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) {
                $hide_info = 0;
                enable_advanced_mode($hide_info);
            }
            if (version_compare($first_version, '2.0.0') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) {
                $archive_multiple_settings = get_multiple_settings();
                $archive_multiple_settings['product_listing_cats'] = 'off';
                $archive_multiple_settings['cat_template'] = 'link';
                update_option('archive_multiple_settings', $archive_multiple_settings);
            }
            if (version_compare($first_version, '2.0.1') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) {
                add_product_caps();
            }
            if (version_compare($first_version, '2.0.4') < 0 && version_compare($database_plugin_version, '2.2.4') < 0) {
                delete_transient('implecode_extensions_data');
            }
            if (version_compare($first_version, '2.2.5') < 0 && version_compare($database_plugin_version, '2.2.5') < 0) {
                $archive_names = get_option('archive_names');
                $archive_names['all_main_categories'] = '';
                $archive_names['all_products'] = '';
                $archive_names['all_subcategories'] = '';
                update_option('archive_names', $archive_names);
            }
            if (version_compare($first_version, '2.3.6') < 0 && version_compare($database_plugin_version, '2.3.6') < 0) {
                $archive_multiple_settings = get_multiple_settings();
                $archive_multiple_settings['default_sidebar'] = 1;
                update_option('archive_multiple_settings', $archive_multiple_settings);
            }
            if (version_compare($first_version, '2.4.0') < 0 && version_compare($database_plugin_version, '2.4.0') < 0) {
                $archive_multiple_settings = get_multiple_settings();
                $archive_multiple_settings['related'] = 'categories';
                update_option('archive_multiple_settings', $archive_multiple_settings);
                update_option('old_sort_bar', 1);
            }
            if (version_compare($first_version, '2.4.15') < 0 && version_compare($database_plugin_version, '2.4.15') < 0) {
                save_default_multiple_settings();
            }
            if (version_compare($first_version, '2.4.16') < 0 && version_compare($database_plugin_version, '2.4.16') < 0) {
                $single_names = get_single_names();
                $single_names['free'] = '';
                update_option('single_names', $single_names);
                ic_save_global('single_names', $single_names);
            }
            flush_rewrite_rules();
        }
    }
}
Esempio n. 4
0
/**
 * Returns the number of defined product attributes
 *
 * @return int
 */
function product_attributes_number()
{
    $number = ic_get_global('product_attributes_number');
    if (!$number) {
        $number = get_option('product_attributes_number', 3);
        ic_save_global('product_attributes_number', $number);
    }
    return $number;
}