/**
 * Manages functions necessary on plugin activation.
 *
 *
 * @version		1.1.3
 * @package		ecommerce-product-catalog/functions
 * @author 		Norbert Dreszer
 */
function epc_activation_function()
{
    create_products_page();
    create_sample_product();
    implecode_plugin_review_notice_hide();
    save_default_multiple_settings();
    permalink_options_update();
}
Esempio n. 2
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();
        }
    }
}