echo $class2;
    ?>
").html("<?php 
    echo $response;
    ?>
").fadeIn().delay(3000).fadeOut(4000);
                    
    </script>
    <?php 
    // End - Adding API Key by Pop UP
}
if (isset($_POST['apikey_update'])) {
    $table_name = $wpdb->prefix . 'linksync_laidKey';
    $where = array('id' => $_POST['id']);
    if (!empty($_POST['apikey'])) {
        $result = linksync::checkForConnection($_POST['apikey']);
        if (isset($result['success'])) {
            $status = 'Connected';
        } else {
            $status = 'InValid';
        }
        $data_array = array('api_key' => trim($_POST['apikey']), 'date_add' => date('Y/m/d'), 'status' => $status);
        if ($wpdb->update($table_name, $data_array, $where)) {
            linksync_class::add('Manage API Keys', 'success', 'API key Updated Successfully', $_POST['apikey']);
            $response = 'API key Updated Successfully!! ';
        } else {
            linksync_class::add('Manage API Keys', 'fail', 'Unable to Update!!', $_POST['apikey']);
        }
    } else {
        linksync_class::add('Manage API Keys', 'fail', 'API key is empty!!', '-');
        $response = "API key is empty!!";
    exit('Access is Denied');
    // Exit if accessed directly
}
//$test_mode = 'enabled';
if (isset($test_mode) && $test_mode == 'enabled') {
    update_option('linksync_test', 'on');
} else {
    update_option('linksync_test', 'off');
}
//Uncomment $check_duplicate_tool to Enable the tool
//$check_duplicate_tool = 'enabled';
/*
 * Reset Product and Order Syncing Setting
 */
if (isset($_POST['rest'])) {
    $linksync = new linksync();
    $linksync->linksync_restOptions();
    linksync_class::add('Reset Option', 'success', "Reset Product and Order Syncing Setting", '-');
    $class1 = 'error';
    $class2 = 'updated';
    $response = 'Successfully! Reset Syncing Setting.';
    ?>
<script>
       linksync_jQuery1(document).ready(function() {
           linksync_jQuery1('#response').removeClass("<?php 
    echo $class1;
    ?>
").addClass("<?php 
    echo $class2;
    ?>
").html("<?php 
Beispiel #3
0
    public static function activate()
    {
        global $wpdb;
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        $check_laid = get_option('linksync_laid');
        if (isset($check_laid) && !empty($check_laid)) {
            self::checkForConnection($check_laid);
        }
        add_option('linksync_laid', "");
        add_option('linksync_status', "");
        add_option('linksync_frequency', "");
        add_option('linksync_connected_url', '');
        add_option('linksync_test', 'off');
        add_option('linksync_last_test_time', "");
        add_option('linksync_version', '');
        add_option('linksync_time_offset', '');
        add_option('linksync_connectedto', '');
        add_option('is_linksync_cron_running', "0");
        add_option('linksync_full_stock_import', 'yes');
        add_option('linksync_addedfile', '');
        add_option('linksync_connectionwith', '');
        add_option('linksync_current_stock_index', 0);
        add_option('linksync_current_stock_status', 0);
        add_option('linksync_updated_products_count', "0");
        add_option('linksync_stock_updated_time', "1900-01-01 00:00:00");
        add_option('linksync_option', '');
        add_option('hide_this_notice', 'on');
        // Product Sync Settings
        add_option('product_sync_type', 'disabled_sync');
        # Two-way ,Vend to WooCommerce,WooCommerce to Vend,Disabled
        add_option('ps_name_title', 'on');
        add_option('ps_description', 'on');
        add_option('ps_desc_copy', '');
        add_option('ps_price', 'on');
        add_option('excluding_tax', 'on');
        add_option('tax_class', '');
        add_option('price_book', 'off');
        add_option('price_book_identifier', '');
        add_option('ps_categories', 'off');
        add_option('ps_quantity', 'on');
        add_option('ps_outlet', 'on');
        add_option('ps_unpublish', 'on');
        add_option('ps_brand', 'on');
        add_option('ps_tags', 'off');
        add_option('cat_radio', 'ps_cat_tags');
        add_option('ps_imp_by_tag', 'off');
        add_option('import_by_tags_list', '');
        add_option('ps_images', 'off');
        add_option('ps_import_image_radio', 'Enable');
        add_option('ps_create_new', 'on');
        add_option('ps_delete', '');
        add_option('prod_update_req', '');
        add_option('prod_update_suc', NULL);
        add_option('ps_outlet_details', '');
        add_option('ps_wc_to_vend_outlet', 'on');
        add_option('wc_to_vend_outlet_detail', '');
        add_option('ps_pending', '');
        add_option('price_field', 'regular_price');
        add_option('ps_attribute', 'on');
        add_option('linksync_visiable_attr', '1');
        add_option('linksync_woocommerce_tax_option', 'on');
        //Order sync Add options
        add_option('order_sync_type', 'disabled');
        add_option('order_time_req', null);
        add_option('order_time_suc', null);
        add_option('order_status_wc_to_vend', 'wc-processing');
        add_option('wc_to_vend_outlet', '');
        add_option('wc_to_vend_register', '');
        add_option('wc_to_vend_user', '');
        add_option('wc_to_vend_tax', '');
        add_option('wc_to_vend_payment', '');
        add_option('wc_to_vend_export', '');
        // Vend To WC
        add_option('order_vend_to_wc', 'wc-completed');
        add_option('vend_to_wc_tax', '');
        add_option('vend_to_wc_payments', '');
        add_option('vend_to_wc_customer', '');
        add_option('laid_message', null);
        add_option('prod_last_page', '');
        //QuickBook Options
        add_option('product_sync_type_QBO', 'disabled_sync');
        add_option('order_sync_type_QBO', 'disabled');
        add_option('order_status_wc_to_QBO', 'wc-processing');
        add_option('wc_to_QBO_tax', '');
        add_option('wc_to_QBO_payment', '');
        add_option('wc_to_QBO_export', '');
        add_option('order_QBO_to_wc', 'wc-completed');
        add_option('QBO_to_wc_tax', '');
        add_option('QBO_to_wc_payments', '');
        add_option('QBO_to_wc_customer', '');
        add_option('ps_account_expense', '');
        add_option('ps_account_revenue', '');
        add_option('ps_account_asset', '');
        add_option('order_account', '');
        add_option('QBO_class', '');
        add_option('QBO_locations', '');
        add_option('product_import', 'no');
        add_option('order_import', 'no');
        //order id
        add_option('linksync_sent_order_id', '');
        add_option('Vend_orderIDs', '');
        //product details
        add_option('product_detail', '');
        //order details
        add_option('order_detail', '');
        //Woo Version Checker
        add_option('linksync_wooVersion', 'off');
        //user activity
        add_option('linksync_user_activity', time());
        add_option('linksync_user_activity_daily', time());
        //update notic
        add_option('linksync_update_notic', 'off');
        //Post product
        add_option('post_product', 0);
        // syncing Status
        add_option('linksync_sycning_status', NULL);
        // display_retail_price_tax_inclusive
        add_option('linksync_tax_inclusive', '');
        // WEBHOOK CONCEPT
        $webhook_url_code = linksync::linksync_autogenerate_code();
        add_option('webhook_url_code', $webhook_url_code);
        // Logs Record Table
        $sql1 = 'CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . 'linksync_log`(
			`id_linksync_log` int(10) unsigned NOT NULL auto_increment,
			`method` varchar(200),
			`result` varchar(200),
                        `laid` varchar(50),
			`message` text,
			`date_add` datetime,
			PRIMARY KEY (`id_linksync_log`)) DEFAULT CHARSET=utf8';
        $sql2 = 'CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . 'linksync_laidKey`(
			`id` int(10) unsigned NOT NULL auto_increment,
			`api_key` varchar(200),
                        `status` varchar(50),
                        `date_add` date,
			PRIMARY KEY (`id`)) DEFAULT CHARSET=utf8';
        dbDelta($sql1);
        dbDelta($sql2);
        // Removing Spaces b/w  sku value of product
        // linksync::linksync_removespaces_of_exists_product();
    }