Plugin Directory

Changeset 2853521


Ignore:
Timestamp:
01/24/2023 01:09:15 PM (3 years ago)
Author:
conversios
Message:

wp master plugin release v5.2.5

Location:
enhanced-e-commerce-for-woocommerce-store
Files:
202 added
16 edited

Legend:

Unmodified
Added
Removed
  • enhanced-e-commerce-for-woocommerce-store/trunk/admin/class-survey.php

    r2790722 r2853521  
    124124                        other_reason: $form.find('.selected input[type=text]').val(),
    125125                        site_url: '<?php echo esc_url_raw( home_url() ); ?>',
    126                         plugin_name: 'ee-woocommerce'
     126                        plugin_name: 'ee-woocommerce',
     127                        tvc_call_add_survey : "<?php echo wp_create_nonce('tvc_call_add_survey-nonce'); ?>"
    127128                    }
    128129                    add_survey(data);
  • enhanced-e-commerce-for-woocommerce-store/trunk/admin/class-tvc-admin-auto-product-sync-helper.php

    r2839796 r2853521  
    474474    }
    475475    public function call_auto_sync_product( $last_sync_product_id = array()){
    476       $this->TVC_Admin_Helper->plugin_log("Start auto sync with last_sync_product_id=".$last_sync_product_id, 'product_sync');
     476      $this->TVC_Admin_Helper->plugin_log("Auto - Start sync with last_sync_product_id=".$last_sync_product_id, 'product_sync');
    477477      $product_count = $this->TVC_Admin_DB_Helper->tvc_row_count('ee_product_sync_data');
    478478      //$count = 0;
     
    506506              'entries' => $p_map_attribute['items']
    507507            ];
    508             $this->TVC_Admin_Helper->plugin_log("Auto before product sync API Call for ".count($p_map_attribute['items']). " products", 'product_sync');
     508            $this->TVC_Admin_Helper->plugin_log("Auto - before product sync API Call for ".count($p_map_attribute['items']). " products", 'product_sync');
    509509            $response = $this->customApiObj->products_sync($data);
    510510            $sync_status = 0;
     
    513513            }
    514514            // End call product sync API
    515             $this->TVC_Admin_Helper->plugin_log("after product sync API Call", 'product_sync');
     515            $this->TVC_Admin_Helper->plugin_log("Auto - after product sync API Call", 'product_sync');
    516516            $sync_product_ids = (isset($p_map_attribute['product_ids']))?$p_map_attribute['product_ids']:"";
    517517            $last_sync_product_id =end($products)->id;
     
    552552            $this->TVC_Admin_DB_Helper->tvc_add_row('ee_product_sync_call', $t_data, array("%s", "%d", "%d", "%s", "%s", "%s", "%d", "%d", "%d" ));
    553553            as_enqueue_async_action('ee_auto_product_sync_check', array('last_sync_product_id' => intval($last_sync_product_id) ));         
    554             $this->TVC_Admin_Helper->plugin_log("Done and update ee_auto_product_sync_check", 'product_sync');
     554            $this->TVC_Admin_Helper->plugin_log("Auto - Done and update ee_auto_product_sync_check", 'product_sync');
    555555          }         
    556556        }
     
    657657    {
    658658      $TVC_Admin_Helper = new TVC_Admin_Helper();
    659       $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
    660       as_unschedule_all_actions('auto_product_sync_process_scheduler');
    661       as_unschedule_all_actions('init_product_sync_process_scheduler');
    662       global $wpdb;
    663659      try {
    664         $product_db_batch_size = 200; // batch size to insert in database
    665660        $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
    666         $prouct_pre_sync_table = esc_sql($wpdb->prefix . "ee_prouct_pre_sync_data");
    667         $mappedCats = unserialize(get_option('ee_prod_mapped_cats'));
    668         print_r($ee_additional_data);
     661        $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
     662        as_unschedule_all_actions('auto_product_sync_process_scheduler');
     663        as_unschedule_all_actions('init_product_sync_process_scheduler');
     664        global $wpdb;
    669665        if (!empty($ee_additional_data) && isset($ee_additional_data['is_mapping_update']) && $ee_additional_data['is_mapping_update'] == true) {
     666          $product_db_batch_size = 200; // batch size to insert in database
     667          $prouct_pre_sync_table = esc_sql($wpdb->prefix . "ee_prouct_pre_sync_data");
     668          $mappedCats = unserialize(get_option('ee_prod_mapped_cats'));
    670669          // Add products in product pre sync table
    671670          if (!empty($mappedCats)) {
     
    688687             
    689688              for($i = 1; $i<= $total_page; $i++){
    690                 $TVC_Admin_Helper->plugin_log("category > ".$mappedCat['name']." > total_page ".json_encode($total_page)." page > ". $i, 'product_sync');
     689                $TVC_Admin_Helper->plugin_log("Cron - category > ".$mappedCat['name']." > total_page ".json_encode($total_page)." page > ". $i, 'product_sync');
    691690                $all_products = get_posts(array(
    692691                  'post_type' => 'product',
     
    706705                  )
    707706                ));
    708                 $TVC_Admin_Helper->plugin_log("category id ".$mc_key." gmc product name ".$mappedCat['name']." - product count - ".count($all_products), 'product_sync'); // Add logs
     707                $TVC_Admin_Helper->plugin_log("Cron - category id ".$mc_key." gmc product name ".$mappedCat['name']." - product count - ".count($all_products), 'product_sync'); // Add logs
    709708                if(!empty($all_products)){
    710709                  foreach($all_products as $postvalue){
     
    745744         // add scheduled cron job
    746745         as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );*/
    747         $TVC_Admin_Helper->plugin_log("auto product sync process start", 'product_sync');
    748746        if (!empty($ee_additional_data) && isset($ee_additional_data['is_process_start']) && $ee_additional_data['is_process_start'] == true) {
     747          $TVC_Admin_Helper->plugin_log("Cron - product sync process start", 'product_sync');
    749748          if (!class_exists('TVCProductSyncHelper')) {
    750749            include(ENHANCAD_PLUGIN_DIR . 'includes/setup/class-tvc-product-sync-helper.php');
     
    753752          $response = $TVCProductSyncHelper->call_batch_wise_auto_sync_product();
    754753          if (!empty($response) && isset($response['message'])) {
    755             $TVC_Admin_Helper->plugin_log("Batch wise auto sync process response " . $response['message'], 'product_sync');
     754            $TVC_Admin_Helper->plugin_log("Cron - Batch wise auto sync process response " . $response['message'], 'product_sync');
    756755          }
    757756
     
    760759          if ($total_pending_pro == 0) {
    761760            // Truncate pre sync table
    762             $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
    763761            $TVC_Admin_DB_Helper->tvc_safe_truncate_table($tablename);
    764762
     
    767765            $ee_additional_data['product_sync_alert'] = NULL;
    768766            $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    769             $TVC_Admin_Helper->plugin_log("product sync process done", 'product_sync');
     767            $TVC_Admin_Helper->plugin_log("Cron - product sync process done", 'product_sync');
    770768          } else {
    771769            /*// add scheduled cron job
     
    774772             as_schedule_single_action( time()+5, 'auto_product_sync_process_scheduler' );
    775773             }*/
    776             $TVC_Admin_Helper->plugin_log("recall product sync process", 'product_sync');
     774            $TVC_Admin_Helper->plugin_log("Cron - recall product sync process for remaining ". $total_pending_pro. " products", 'product_sync');
    777775            // $this->tvc_call_auto_product_sync_process();
    778776          }
     
    783781          // as_unschedule_action('auto_product_sync_process_scheduler');
    784782          // $TVC_Admin_Helper->plugin_log("auto test 3", 'product_sync');
    785           $TVC_Admin_Helper->plugin_log("product sync process is already done", 'product_sync');
     783          $TVC_Admin_Helper->plugin_log("Cron - product sync process is already done", 'product_sync');
    786784        }
    787785        echo json_encode(array('status' => 'success', "message" => esc_html__("Product sync process started successfully")));
     
    796794        $ee_additional_data['product_sync_alert'] = $e->getMessage();
    797795        $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    798         $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
     796        $TVC_Admin_Helper->plugin_log("Cron - Error - ".$e->getMessage(), 'product_sync');
    799797      }
    800798      return true;
  • enhanced-e-commerce-for-woocommerce-store/trunk/admin/class-tvc-admin-helper.php

    r2843477 r2853521  
    812812                    }else{
    813813                        jQuery.post(tvc_ajax_url,{
    814                               action: "tvc_call_site_verified"
     814                              action: "tvc_call_site_verified",
     815                  SiteVerifiedNonce : "<?php echo wp_create_nonce('tvc_call_site_verified-nonce'); ?>"
    815816                            },function( response ){
    816817                              var rsp = JSON.parse(response);   
     
    832833                    //console.log("call_domain_claim");                 
    833834                        jQuery.post(tvc_ajax_url,{
    834                           action: "tvc_call_domain_claim"
     835                          action: "tvc_call_domain_claim",
     836                apiDomainClaimNonce : "<?php echo wp_create_nonce('tvc_call_domain_claim-nonce'); ?>"
    835837                        },function( response ){
    836838                          var rsp = JSON.parse(response);   
     
    11691171                      action: "tvc_call_notice_dismiss_trigger",
    11701172                      data:{ee_notice_dismiss_id_trigger:ee_notice_dismiss_id_trigger},
     1173                      apiNoticDismissNonce : "<?php echo wp_create_nonce('tvc_call_notice_dismiss-nonce'); ?>",
    11711174                      dataType: "json"
    11721175                  },function( response ){                           
     
    14271430    }
    14281431    $log = new WC_Logger();
    1429     $log->log( 'Conversios Product Sync Log ', $message );
     1432    $log->add( 'Conversios Product Sync Log ', $message );
    14301433    //error_log($message);
    14311434    return true;
  • enhanced-e-commerce-for-woocommerce-store/trunk/admin/js/onboarding-custom.js

    r2833722 r2853521  
    955955      dataType: "json",
    956956      url: tvc_ajax_url,
    957       data: {action: "update_user_tracking_data", event_name:event_name, error_msg:error_msg, screen_name:screen_name,event_label:event_label},
     957      data: {action: "update_user_tracking_data", event_name:event_name, error_msg:error_msg, screen_name:screen_name,
     958          event_label:event_label,
     959          TVCNonce : "<?php echo wp_create_nonce('update_user_tracking_data-nonce'); ?>"
     960      },
    958961      success: function (response) {
    959962           //console.log('user tracking');       
  • enhanced-e-commerce-for-woocommerce-store/trunk/admin/partials/class-conversios-footer.php

    r2777251 r2853521  
    4141                      dataType: "json",
    4242                      url: tvc_ajax_url,
    43                       data: {action: "update_user_tracking_data", event_name:event_name, error_msg:error_msg, screen_name:screen_name,event_label:event_label},
     43                      data: {action: "update_user_tracking_data", event_name:event_name, error_msg:error_msg, screen_name:screen_name,event_label:event_label,
     44                        TVCNonce : "<?php echo wp_create_nonce('update_user_tracking_data-nonce'); ?>"},
    4445                      success: function (response) {
    4546                           console.log('user tracking');       
  • enhanced-e-commerce-for-woocommerce-store/trunk/admin/partials/general-fields.php

    r2850883 r2853521  
    11671167      event.preventDefault();
    11681168      var data = {
    1169         action: "con_get_conversion_list"     
     1169        action: "con_get_conversion_list",
     1170        TVCNonce : "<?php echo wp_create_nonce('con_get_conversion_list-nonce'); ?>"
    11701171      };
    11711172      jQuery.ajax({
  • enhanced-e-commerce-for-woocommerce-store/trunk/enhanced-ecommerce-google-analytics.php

    r2850883 r2853521  
    1616 * Plugin URI:        https://www.conversios.io/
    1717 * Description:       Track Ecommerce events and conversions in Google Analytics, GA4, Google Ads, Facebook Pixel, Snapchat, Pinterest, Tiktok, Bing via Google Tag Manager. Build dynamic audiences and track ROAS performance in Google Ads, Meta (Facebook + Instagram), Snapchat, Pinterest, Tiktok, Microsoft Ads and Twitter to run successful shopping campaigns. Automate your product feed to Google Merchant Center for running performance max campaigns for your WooCommerce products to boost ROAS (Revenue on Ad Spends).
    18  * Version:           5.2.4
     18 * Version:           5.2.5
    1919 * Author:            Conversios
    2020 * Author URI:        conversios.io
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 define( 'PLUGIN_TVC_VERSION', '5.2.4' );
     40define( 'PLUGIN_TVC_VERSION', '5.2.5' );
    4141$fullName = plugin_basename( __FILE__ );
    4242$dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/data/class-tvc-ajax-calls.php

    r2777251 r2853521  
    2121        protected function safe_ajax_call( $nonce, $registered_nonce_name ) {
    2222            // check the nonce
    23             /*if ( ! wp_verify_nonce( $nonce, $registered_nonce_name ) ) {
    24                 die( 'You are not allowed to do this!' );
    25             }*/
    26             // only return results when the user is an admin with manage options
    27             if ( is_admin() ) {
     23            if ( wp_verify_nonce( $nonce, $registered_nonce_name ) && is_admin()) {
     24                //die( 'You are not allowed to do this!' );
    2825                return true;
    29             } else {
     26            }else {
    3027                return false;
    3128            }
     29            // only return results when the user is an admin with manage options
     30            // if ( is_admin() ) {
     31            //  return true;
     32            // } else {
     33            //  return false;
     34            // }
    3235        }
    3336    }
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/data/class-tvc-ajax-file.php

    r2850883 r2853521  
    4949    add_action('wp_ajax_update_user_tracking_data', array($this,'update_user_tracking_data') );
    5050    add_action('init_product_sync_process_scheduler', array($this,'tvc_call_start_product_sync_process'), 10, 1 );
    51     add_action('auto_product_sync_process_scheduler', array($this,'tvc_call_auto_product_sync_process') );
    52     add_action('wp_ajax_auto_product_sync_process_scheduler', array($this,'tvc_call_auto_product_sync_process') );
    53   }
    54 
    55     public function update_user_tracking_data(){   
    56     $event_name = isset($_POST['event_name'])?sanitize_text_field($_POST['event_name']):"";
    57     $screen_name = isset($_POST['screen_name'])?sanitize_text_field($_POST['screen_name']):"";
    58     $error_msg = isset($_POST['error_msg'])?sanitize_text_field($_POST['error_msg']):"";
    59     $event_label = isset($_POST['event_label'])?sanitize_text_field($_POST['event_label']):"";
    60     // $timestamp = isset($_POST['timestamp'])?sanitize_text_field($_POST['timestamp']):"";
    61     $timestamp =  date("YmdHis");
     51    /*add_action('auto_product_sync_process_scheduler', array($this,'tvc_call_auto_product_sync_process') );
     52    add_action('wp_ajax_auto_product_sync_process_scheduler', array($this,'tvc_call_auto_product_sync_process') );*/
     53    add_action('wp_ajax_auto_product_sync_process_scheduler', array($this,'tvc_call_start_product_sync_process') );
     54  }
     55
     56    public function update_user_tracking_data(){
     57      if ($this->safe_ajax_call(filter_input(INPUT_POST, 'TVCNonce'), 'update_user_tracking_data-nonce')) {
     58        $event_name = isset($_POST['event_name']) ? sanitize_text_field($_POST['event_name']) : "";
     59        $screen_name = isset($_POST['screen_name']) ? sanitize_text_field($_POST['screen_name']) : "";
     60        $error_msg = isset($_POST['error_msg']) ? sanitize_text_field($_POST['error_msg']) : "";
     61        $event_label = isset($_POST['event_label']) ? sanitize_text_field($_POST['event_label']) : "";
     62        // $timestamp = isset($_POST['timestamp'])?sanitize_text_field($_POST['timestamp']):"";
     63        $timestamp = date("YmdHis");
    6264        $t_data = array(
    63             'event_name'=>esc_sql($event_name),
    64             'screen_name'=>esc_sql($screen_name),
    65             'timestamp'=>esc_sql($timestamp),
    66             'error_msg'=>esc_sql($error_msg),
    67             'event_label'=>esc_sql($event_label),
    68           );
    69           if(!empty($t_data)){
    70 
    71              $options_val = get_option('ee_ut');
    72              if(!empty($options_val))
    73              {
    74               $odata = (array) maybe_unserialize( $options_val );
    75                 array_push($odata, $t_data);
    76                 update_option("ee_ut", serialize($odata));
    77              }
    78              else
    79              {
    80                $t_d[] = $t_data;
    81                update_option("ee_ut", serialize($t_d));
    82              }
    83           }
    84          wp_die();
     65          'event_name' => esc_sql($event_name),
     66          'screen_name' => esc_sql($screen_name),
     67          'timestamp' => esc_sql($timestamp),
     68          'error_msg' => esc_sql($error_msg),
     69          'event_label' => esc_sql($event_label),
     70        );
     71        if (!empty($t_data)) {
     72
     73          $options_val = get_option('ee_ut');
     74          if (!empty($options_val)) {
     75            $odata = (array) maybe_unserialize($options_val);
     76            array_push($odata, $t_data);
     77            update_option("ee_ut", serialize($odata));
     78          } else {
     79            $t_d[] = $t_data;
     80            update_option("ee_ut", serialize($t_d));
     81          }
     82        }
     83        wp_die();
     84      }else{
     85        echo json_encode(array("error"=>true, "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     86      }
     87      // IMPORTANT: don't forget to exit
     88      exit;
    8589  }
    8690
     
    266270
    267271  public function tvcajax_product_sync_bantch_wise(){
    268     $TVC_Admin_Helper = new TVC_Admin_Helper();
    269     $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
    270     try {
    271       $mappedCats = [];
    272       $mappedAttrs = [];
    273       $mappedCatsDB = [];
    274       $product_batch_size = isset($_POST['product_batch_size'])?sanitize_text_field($_POST['product_batch_size']):"25";// barch size for inser product in GMC
    275       $data = isset($_POST['tvc_data'])?$_POST['tvc_data']:"";
    276 
    277       $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
    278       parse_str($data, $formArray);
    279       if(!empty($formArray)){
    280         foreach ($formArray as $key => $value) {
    281           $formArray[$key] = sanitize_text_field($value);
     272      if ($this->safe_ajax_call(filter_input(INPUT_POST, 'TVCNonce'), 'tvcajax_product_sync_bantch_wise-nonce')) {
     273        $TVC_Admin_Helper = new TVC_Admin_Helper();
     274        $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
     275        try {
     276          $mappedCats = [];
     277          $mappedAttrs = [];
     278          $mappedCatsDB = [];
     279          $product_batch_size = isset($_POST['product_batch_size']) ? sanitize_text_field($_POST['product_batch_size']) : "25"; // barch size for inser product in GMC
     280          $data = isset($_POST['tvc_data']) ? $_POST['tvc_data'] : "";
     281
     282          $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
     283          parse_str($data, $formArray);
     284          if (!empty($formArray)) {
     285            foreach ($formArray as $key => $value) {
     286              $formArray[$key] = sanitize_text_field($value);
     287            }
     288          }
     289
     290          /*
     291           * Collect Attribute/Categories Mapping
     292           */
     293          foreach ($formArray as $key => $value) {
     294            if (preg_match("/^category-name-/i", $key)) {
     295              if ($value != '') {
     296                $keyArray = explode("name-", $key);
     297                $mappedCatsDB[$keyArray[1]]['name'] = $value;
     298              }
     299              unset($formArray[$key]);
     300            } else if (preg_match("/^category-/i", $key)) {
     301              if ($value != '' && $value > 0) {
     302                $keyArray = explode("-", $key);
     303                $mappedCats[$keyArray[1]] = $value;
     304                $mappedCatsDB[$keyArray[1]]['id'] = $value;
     305              }
     306              unset($formArray[$key]);
     307            } else {
     308              if ($value) {
     309                $mappedAttrs[$key] = $value;
     310              }
     311            }
     312          }
     313
     314          //add/update data in default profile
     315          $profile_data = array("profile_title" => esc_sql("Default"), "g_attribute_mapping" => json_encode($mappedAttrs), "update_date" => date('Y-m-d'));
     316          if ($TVC_Admin_DB_Helper->tvc_row_count("ee_product_sync_profile") == 0) {
     317            $TVC_Admin_DB_Helper->tvc_add_row("ee_product_sync_profile", $profile_data, array("%s", "%s", "%s"));
     318          } else {
     319            $TVC_Admin_DB_Helper->tvc_update_row("ee_product_sync_profile", $profile_data, array("id" => 1));
     320          }
     321          // Update settings
     322          update_option("ee_prod_mapped_cats", serialize($mappedCatsDB));
     323          update_option("ee_prod_mapped_attrs", serialize($mappedAttrs));
     324
     325          // Batch settings
     326          $ee_additional_data['is_mapping_update'] = true;
     327          $ee_additional_data['is_process_start'] = false;
     328          $ee_additional_data['is_auto_sync_start'] = false;
     329          $ee_additional_data['product_sync_batch_size'] = $product_batch_size;
     330          $ee_additional_data['product_sync_alert'] = "Product sync settings updated successfully process will start soon...";
     331          $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     332
     333          // add scheduled cron job
     334          //wp_schedule_single_event(time()+1, 'init_product_sync_process_scheduler', array(time()));
     335          /*as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );*/ // Changes done by chirag 09012023
     336          as_unschedule_all_actions( 'init_product_sync_process_scheduler' );
     337          as_enqueue_async_action('init_product_sync_process_scheduler');
     338
     339          /*wp_clear_scheduled_hook( 'init_product_sync_process_scheduler' );
     340          $TVC_Admin_Helper->plugin_log("step 1", 'product_sync');// Add logs
     341          if ( ! wp_next_scheduled( 'init_product_sync_process_scheduler' ) ) {
     342            $TVC_Admin_Helper->plugin_log("step 2", 'product_sync');// Add logs
     343              wp_schedule_single_event( time()+2 , 'init_product_sync_process_scheduler' );
     344              $TVC_Admin_Helper->plugin_log("step 3", 'product_sync');// Add logs
     345          }
     346          $TVC_Admin_Helper->plugin_log("step 4", 'product_sync');// Add logs*/
     347
     348          $TVC_Admin_Helper->plugin_log("mapping saved and product sync process scheduled", 'product_sync');// Add logs
     349
     350          $sync_message = esc_html__("Initiated, products are being synced to Merchant Center.Do not refresh..", "enhanced-e-commerce-for-woocommerce-store");
     351          $sync_progressive_data = array("sync_message" => $sync_message);
     352          echo json_encode(array('status' => 'success', "sync_progressive_data" => $sync_progressive_data));
     353        } catch (Exception $e) {
     354          $ee_additional_data['product_sync_alert'] = $e->getMessage();
     355          $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     356          $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
    282357        }
    283       }
    284 
    285       /*
    286       * Collect Attribute/Categories Mapping
    287       */
    288       foreach($formArray as $key => $value){
    289         if(preg_match("/^category-name-/i", $key)){
    290           if($value != ''){
    291             $keyArray = explode("name-", $key);
    292             $mappedCatsDB[$keyArray[1]]['name'] = $value;
    293           }
    294           unset($formArray[$key]);
    295         }else if(preg_match("/^category-/i", $key)){
    296           if($value != '' && $value > 0){
    297             $keyArray = explode("-", $key);
    298             $mappedCats[$keyArray[1]] = $value;
    299             $mappedCatsDB[$keyArray[1]]['id'] = $value;
    300           }
    301           unset($formArray[$key]);
    302         }else{
    303           if($value){
    304               $mappedAttrs[$key] = $value;
    305           }
    306         }
    307       }
    308 
    309       //add/update data in default profile
    310       $profile_data = array("profile_title"=>esc_sql("Default"),"g_attribute_mapping"=>json_encode($mappedAttrs),"update_date"=>date('Y-m-d'));
    311       if($TVC_Admin_DB_Helper->tvc_row_count("ee_product_sync_profile") ==0){
    312         $TVC_Admin_DB_Helper->tvc_add_row("ee_product_sync_profile", $profile_data, array("%s", "%s","%s"));
    313       }else{
    314         $TVC_Admin_DB_Helper->tvc_update_row("ee_product_sync_profile", $profile_data, array("id" => 1));
    315       }
    316       // Update settings
    317       update_option("ee_prod_mapped_cats", serialize($mappedCatsDB));
    318       update_option("ee_prod_mapped_attrs", serialize($mappedAttrs));
    319 
    320       // Batch settings
    321       $ee_additional_data['is_mapping_update'] = true;
    322       $ee_additional_data['is_process_start'] = false;
    323       $ee_additional_data['is_auto_sync_start'] = false;
    324       $ee_additional_data['product_sync_batch_size'] = $product_batch_size;
    325       $ee_additional_data['product_sync_alert'] = "Product sync settings updated successfully";
    326       $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    327 
    328       // add scheduled cron job
    329       //wp_schedule_single_event(time()+1, 'init_product_sync_process_scheduler', array(time()));
    330       as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
    331       as_unschedule_all_actions( 'init_product_sync_process_scheduler' );
    332       as_enqueue_async_action('init_product_sync_process_scheduler');
    333       $TVC_Admin_Helper->plugin_log("mapping saved and product sync process scheduled", 'product_sync');// Add logs
    334      
    335       $sync_message = esc_html__("Initiated, products are being synced to Merchant Center.Do not refresh..","enhanced-e-commerce-for-woocommerce-store");
    336       $sync_progressive_data = array("sync_message"=>$sync_message);
    337       echo json_encode(array('status'=>'success', "sync_progressive_data" => $sync_progressive_data));
    338     } catch (Exception $e) {
    339       $ee_additional_data['product_sync_alert'] = $e->getMessage();
    340       $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    341       $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
    342     }
    343     wp_die();
    344   }
     358        wp_die();
     359      }else{
     360        echo json_encode(array("error"=>true, "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     361      }
     362      // IMPORTANT: don't forget to exit
     363      exit;
     364  }
     365
     366  // function tvc_call_start_product_sync_process_old(){
     367  //   $TVC_Admin_Helper = new TVC_Admin_Helper();
     368  //   $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
     369  //   try {
     370  //     global $wpdb;
     371  //     $product_db_batch_size = 200; // batch size to insert in database
     372  //     $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
     373  //     $prouct_pre_sync_table = esc_sql( $wpdb->prefix ."ee_prouct_pre_sync_data" );
     374  //     $mappedCats = unserialize(get_option('ee_prod_mapped_cats'));
     375  //     if (!empty($ee_additional_data) && isset($ee_additional_data['is_mapping_update']) && $ee_additional_data['is_mapping_update'] == true) {
     376  //       // Add products in product pre sync table
     377  //       if(!empty($mappedCats)){
     378  //         // truncate data from product pre sync table
     379  //         if( $TVC_Admin_DB_Helper->tvc_row_count("ee_prouct_pre_sync_data") > 0 ){
     380  //           $TVC_Admin_DB_Helper->tvc_safe_truncate_table($prouct_pre_sync_table);
     381  //         }
     382
     383  //         $batch_count =0;
     384  //         $values = array();
     385  //         $place_holders = array();
     386  //         foreach($mappedCats as $mc_key => $mappedCat){
     387  //           $term = get_term_by( 'term_id', $mc_key,'product_cat' , 'ARRAY_A' );
     388  //           //$TVC_Admin_Helper->plugin_log(" = = = =category id ".json_encode($term), 'product_sync');
     389  //           //die;
     390  //           $total_page = 1;
     391  //           if(isset($term["count"]) && $term["count"] > 1000){
     392  //             $total_page = ceil($term["count"]/1000);
     393  //           }
     394           
     395  //           for($i = 1; $i<= $total_page; $i++){
     396  //             $TVC_Admin_Helper->plugin_log("category > ".$mappedCat['name']." > total_page ".json_encode($total_page)." page > ". $i, 'product_sync');
     397  //             $all_products = get_posts(array(
     398  //               'post_type' => 'product',
     399  //               'posts_per_page' => 1000,
     400  //               'paged' => $i,
     401  //               'numberposts' => -1,
     402  //               'post_status' => 'publish',
     403  //               'fields' => 'ids',
     404  //               'tax_query' => array(
     405  //                 array(
     406  //                   'taxonomy' => 'product_cat',
     407  //                   'field' => 'term_id',
     408  //                   'terms' => $mc_key, /* category name */
     409  //                   'operator' => 'IN',
     410  //                   'include_children' => false
     411  //                 )
     412  //               )
     413  //             ));
     414  //             $TVC_Admin_Helper->plugin_log("category id ".$mc_key." gmc product name ".$mappedCat['name']." - product count - ".count($all_products), 'product_sync'); // Add logs
     415  //             if(!empty($all_products)){
     416  //               foreach($all_products as $postvalue){
     417  //                 $batch_count++;       
     418  //                 array_push( $values, esc_sql($postvalue), esc_sql($mc_key), esc_sql($mappedCat['id']), 1, date( 'Y-m-d H:i:s', current_time( 'timestamp') ) );
     419  //                 $place_holders[] = "('%d', '%d', '%d','%d', '%s')";
     420  //                 if($batch_count >= $product_db_batch_size){
     421  //                   $query = "INSERT INTO `$prouct_pre_sync_table` (w_product_id, w_cat_id, g_cat_id, product_sync_profile_id, create_date) VALUES ";
     422  //                   $query .= implode( ', ', $place_holders );
     423  //                   $wpdb->query($wpdb->prepare( $query, $values ));
     424  //                   $batch_count = 0;
     425  //                   $values = array();
     426  //                   $place_holders = array();
     427  //                 }
     428  //               } //end product list loop
     429  //             }// end products if
     430  //           }// Pagination loop
     431  //         }//end category loop
     432
     433  //         // Add products in database
     434  //         if($batch_count > 0){
     435  //           $query = "INSERT INTO `$prouct_pre_sync_table` (w_product_id, w_cat_id, g_cat_id, product_sync_profile_id, create_date) VALUES ";
     436  //           $query .= implode( ', ', $place_holders );
     437  //           $wpdb->query($wpdb->prepare( $query, $values ));         
     438  //         }
     439
     440  //         // add scheduled cron job
     441  //         if ( false === as_next_scheduled_action( 'tvc_add_cron_interval_for_product_sync' ) ) {
     442  //           as_schedule_single_action( time()+5, 'auto_product_sync_process_scheduler' );
     443  //         }
     444  //       }
     445
     446  //       $ee_additional_data['is_mapping_update'] = false;
     447  //       $ee_additional_data['is_process_start'] = true;
     448  //       $ee_additional_data['product_sync_alert'] = "Product sync process is ready to start";
     449  //       $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     450  //     }
     451  //   } catch (Exception $e) {
     452  //     $ee_additional_data['product_sync_alert'] = $e->getMessage();
     453  //     $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     454  //     $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
     455  //   }
     456  //   return true;
     457  // }
     458
     459  // function tvc_call_auto_product_sync_process_old(){
     460  //   $TVC_Admin_Helper = new TVC_Admin_Helper();
     461  //   $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
     462  //   $ee_additional_data['product_sync_alert'] = NULL;
     463  //   $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     464  //   try {
     465  //     // add scheduled cron job
     466  //     as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
     467  //     $TVC_Admin_Helper->plugin_log("auto product sync process start", 'product_sync');
     468  //     global $wpdb;
     469  //     if (!empty($ee_additional_data) && isset($ee_additional_data['is_process_start']) && $ee_additional_data['is_process_start'] == true) {
     470  //       if(!class_exists('TVCProductSyncHelper')){
     471  //         include(ENHANCAD_PLUGIN_DIR . 'includes/setup/class-tvc-product-sync-helper.php');
     472  //       }
     473  //       $TVCProductSyncHelper = new TVCProductSyncHelper();
     474  //       $response = $TVCProductSyncHelper->call_batch_wise_auto_sync_product();
     475  //       if (!empty($response) && isset($response['message'])) {
     476  //         $TVC_Admin_Helper->plugin_log("Batch wise auto sync process response ".$response['message'], 'product_sync');
     477  //       }
     478
     479  //       $tablename = esc_sql( $wpdb->prefix ."ee_prouct_pre_sync_data" );
     480  //       $total_pending_pro = $wpdb->get_var("SELECT COUNT(*) as a FROM $tablename where `status` = 0");
     481  //       if($total_pending_pro == 0){
     482  //         // Truncate pre sync table
     483  //         $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
     484  //         $TVC_Admin_DB_Helper->tvc_safe_truncate_table($tablename);
     485         
     486  //         $ee_additional_data['is_process_start'] = false;
     487  //         $ee_additional_data['is_auto_sync_start'] = true;
     488  //         $ee_additional_data['product_sync_alert'] = NULL;
     489  //         $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     490  //         $TVC_Admin_Helper->plugin_log("product sync process done", 'product_sync');
     491  //       } else {
     492  //         // add scheduled cron job
     493  //         if ( false === as_next_scheduled_action( 'tvc_add_cron_interval_for_product_sync' ) ) {
     494  //           // as_schedule_cron_action( time(), '0/3 * * * *', 'auto_product_sync_process_scheduler' );
     495  //           as_schedule_single_action( time()+5, 'auto_product_sync_process_scheduler' );
     496  //         }
     497  //         $TVC_Admin_Helper->plugin_log("recall product sync process", 'product_sync');
     498  //         // $this->tvc_call_auto_product_sync_process();
     499  //       }
     500  //     } else {
     501  //       // add scheduled cron job
     502  //       as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
     503  //     }
     504  //     echo json_encode(array('status'=>'success', "message" => esc_html__("Product sync process started successfully")));
     505  //     return true;
     506  //   } catch (Exception $e) {
     507  //     $ee_additional_data['product_sync_alert'] = $e->getMessage();
     508  //     $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
     509  //     $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
     510  //     return true;
     511  //   }
     512  // }
    345513
    346514  function tvc_call_start_product_sync_process(){
    347515    $TVC_Admin_Helper = new TVC_Admin_Helper();
    348     $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
    349516    try {
     517      $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
     518      $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
     519      as_unschedule_all_actions( 'init_product_sync_process_scheduler' );
     520      as_schedule_single_action( time(), 'init_product_sync_process_scheduler' );
    350521      global $wpdb;
    351       $product_db_batch_size = 200; // batch size to insert in database
    352       $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
    353       $prouct_pre_sync_table = esc_sql( $wpdb->prefix ."ee_prouct_pre_sync_data" );
    354       $mappedCats = unserialize(get_option('ee_prod_mapped_cats'));
    355522      if (!empty($ee_additional_data) && isset($ee_additional_data['is_mapping_update']) && $ee_additional_data['is_mapping_update'] == true) {
     523        $product_db_batch_size = 200; // batch size to insert in database
     524        $prouct_pre_sync_table = esc_sql( $wpdb->prefix ."ee_prouct_pre_sync_data" );
     525        $mappedCats = unserialize(get_option('ee_prod_mapped_cats'));
    356526        // Add products in product pre sync table
    357527        if(!empty($mappedCats)){
     
    374544           
    375545            for($i = 1; $i<= $total_page; $i++){
    376               $TVC_Admin_Helper->plugin_log("category > ".$mappedCat['name']." > total_page ".json_encode($total_page)." page > ". $i, 'product_sync');
     546              $TVC_Admin_Helper->plugin_log("Manual - category > ".$mappedCat['name']." > total_page ".json_encode($total_page)." page > ". $i, 'product_sync');
    377547              $all_products = get_posts(array(
    378548                'post_type' => 'product',
     
    392562                )
    393563              ));
    394               $TVC_Admin_Helper->plugin_log("category id ".$mc_key." gmc product name ".$mappedCat['name']." - product count - ".count($all_products), 'product_sync'); // Add logs
     564              $TVC_Admin_Helper->plugin_log("Manual - category id ".$mc_key." gmc product name ".$mappedCat['name']." - product count - ".count($all_products), 'product_sync'); // Add logs
    395565              if(!empty($all_products)){
    396566                foreach($all_products as $postvalue){
     
    417587            $wpdb->query($wpdb->prepare( $query, $values ));         
    418588          }
    419 
    420           // add scheduled cron job
    421           if ( false === as_next_scheduled_action( 'tvc_add_cron_interval_for_product_sync' ) ) {
    422             as_schedule_single_action( time()+5, 'auto_product_sync_process_scheduler' );
    423           }
    424589        }
    425590
     
    428593        $ee_additional_data['product_sync_alert'] = "Product sync process is ready to start";
    429594        $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    430       }
    431     } catch (Exception $e) {
    432       $ee_additional_data['product_sync_alert'] = $e->getMessage();
    433       $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    434       $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
    435     }
    436     return true;
    437   }
    438 
    439   function tvc_call_auto_product_sync_process(){
    440     $TVC_Admin_Helper = new TVC_Admin_Helper();
    441     $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
    442     $ee_additional_data['product_sync_alert'] = NULL;
    443     $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    444     try {
    445       // add scheduled cron job
    446       as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
    447       $TVC_Admin_Helper->plugin_log("auto product sync process start", 'product_sync');
    448       global $wpdb;
     595      }
     596
     597      $ee_additional_data = $TVC_Admin_Helper->get_ee_additional_data();
    449598      if (!empty($ee_additional_data) && isset($ee_additional_data['is_process_start']) && $ee_additional_data['is_process_start'] == true) {
     599        $TVC_Admin_Helper->plugin_log("Manual - product sync process start", 'product_sync');
    450600        if(!class_exists('TVCProductSyncHelper')){
    451601          include(ENHANCAD_PLUGIN_DIR . 'includes/setup/class-tvc-product-sync-helper.php');
     
    454604        $response = $TVCProductSyncHelper->call_batch_wise_auto_sync_product();
    455605        if (!empty($response) && isset($response['message'])) {
    456           $TVC_Admin_Helper->plugin_log("Batch wise auto sync process response ".$response['message'], 'product_sync');
     606          $TVC_Admin_Helper->plugin_log("Manual - Batch wise auto sync process response ".$response['message'], 'product_sync');
    457607        }
    458608
     
    461611        if($total_pending_pro == 0){
    462612          // Truncate pre sync table
    463           $TVC_Admin_DB_Helper = new TVC_Admin_DB_Helper();
    464613          $TVC_Admin_DB_Helper->tvc_safe_truncate_table($tablename);
    465614         
     
    468617          $ee_additional_data['product_sync_alert'] = NULL;
    469618          $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    470           $TVC_Admin_Helper->plugin_log("product sync process done", 'product_sync');
     619          $TVC_Admin_Helper->plugin_log("Manual - product sync process done", 'product_sync');
     620          as_unschedule_all_actions( 'init_product_sync_process_scheduler' );
    471621        } else {
    472           // add scheduled cron job
    473           if ( false === as_next_scheduled_action( 'tvc_add_cron_interval_for_product_sync' ) ) {
    474             // as_schedule_cron_action( time(), '0/3 * * * *', 'auto_product_sync_process_scheduler' );
    475             as_schedule_single_action( time()+5, 'auto_product_sync_process_scheduler' );
    476           }
    477           $TVC_Admin_Helper->plugin_log("recall product sync process", 'product_sync');
    478           // $this->tvc_call_auto_product_sync_process();
     622          $TVC_Admin_Helper->plugin_log("Manual - recall product sync process for remaining ". $total_pending_pro. " products", 'product_sync');
     623          /*wp_clear_scheduled_hook( 'init_product_sync_process_scheduler' );
     624          $TVC_Admin_Helper->plugin_log("step 11", 'product_sync');// Add logs
     625          if ( ! wp_next_scheduled( 'init_product_sync_process_scheduler' ) ) {
     626            $TVC_Admin_Helper->plugin_log("step 22", 'product_sync');// Add logs
     627              wp_schedule_single_event( time(), 'init_product_sync_process_scheduler' );
     628              $TVC_Admin_Helper->plugin_log("step 33", 'product_sync');// Add logs
     629          }*/
     630          // $TVC_Admin_Helper->plugin_log(" stary ". as_next_scheduled_action( 'init_product_sync_process_scheduler' ));
     631          // if ( !as_next_scheduled_action( 'init_product_sync_process_scheduler' ) ) {
     632            // as_schedule_cron_action( time(), '0/3 * * * *', 'init_product_sync_process_scheduler' );
     633            /*as_unschedule_all_actions( 'init_product_sync_process_scheduler' );
     634            as_schedule_single_action( time(), 'init_product_sync_process_scheduler' );*/
     635          // }
     636          // $this->tvc_call_start_product_sync_process();
    479637        }
    480638      } else {
    481         // add scheduled cron job
    482         as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
     639        $TVC_Admin_Helper->plugin_log("Manual - Nothing to Sync", 'product_sync');
    483640      }
    484641      echo json_encode(array('status'=>'success', "message" => esc_html__("Product sync process started successfully")));
     
    487644      $ee_additional_data['product_sync_alert'] = $e->getMessage();
    488645      $TVC_Admin_Helper->set_ee_additional_data($ee_additional_data);
    489       $TVC_Admin_Helper->plugin_log($e->getMessage(), 'product_sync');
    490       return true;
    491     }
     646      $TVC_Admin_Helper->plugin_log("Manual - Error - ".$e->getMessage(), 'product_sync');
     647    }
     648    return true;
    492649  }
    493650
     
    515672      echo json_encode(array("error"=>true, "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
    516673    }
     674    // IMPORTANT: don't forget to exit
     675    exit;
    517676     
    518677  }
    519678  public function tvc_call_add_survey(){
    520     if ( is_admin() ) {
     679    if ( is_admin() && wp_verify_nonce( $_POST['tvc_call_add_survey'], 'tvc_call_add_survey-nonce' )) {
    521680      if(!class_exists('CustomApi')){
    522681        include(ENHANCAD_PLUGIN_DIR . 'includes/setup/CustomApi.php');
     
    525684      unset($_POST['action']);   
    526685      echo json_encode($customObj->add_survey_of_deactivate_plugin($_POST));
    527       exit;
    528     }
     686    }else
     687    {
     688      echo json_encode(array('error' => true, "is_connect"=>false, 'message' => esc_html__("Admin security nonce is not verified.","enhanced-e-commerce-for-woocommerce-store")));
     689    }
     690    // IMPORTANT: don't forget to exit
     691    exit;
    529692  }
    530693  //active licence key
     
    561724  }
    562725  public function auto_product_sync_setting(){
    563     if ( is_admin() ) {
     726    if ( is_admin() && wp_verify_nonce( $_POST['auto_product_sync_setting'], 'auto_product_sync_setting-nonce' )) {
    564727      as_unschedule_all_actions( 'ee_auto_product_sync_check' );
    565728      $product_sync_duration = isset($_POST['product_sync_duration'])?sanitize_text_field($_POST['product_sync_duration']):"";
     
    578741        echo json_encode(array('error' => true, 'message' => esc_html__("Error occured while saving the settings.","enhanced-e-commerce-for-woocommerce-store")));
    579742      }     
    580     }
     743    }else{
     744      echo json_encode(array('error' => true, "is_connect"=>false, 'message' => esc_html__("Admin security nonce is not verified.","enhanced-e-commerce-for-woocommerce-store")));       
     745    }
     746    // IMPORTANT: don't forget to exit
    581747    exit;
    582748  }
    583749
    584750  public function con_get_conversion_list(){
    585     $TVC_Admin_Helper = new TVC_Admin_Helper();
    586     $this->customApiObj = new CustomApi();
    587     $this->current_customer_id = $TVC_Admin_Helper->get_currentCustomerId();
    588     if($this->current_customer_id != ""){
    589       $response = $this->customApiObj->get_conversion_list($this->current_customer_id);
    590        if(property_exists($response,"error") && $response->error == false){
    591           if(property_exists($response,"data") && $response->data != "" && !empty($response->data)){
     751      if ($this->safe_ajax_call(filter_input(INPUT_POST, 'TVCNonce'), 'con_get_conversion_list-nonce')) {
     752        $TVC_Admin_Helper = new TVC_Admin_Helper();
     753        $this->customApiObj = new CustomApi();
     754        $this->current_customer_id = $TVC_Admin_Helper->get_currentCustomerId();
     755        if ($this->current_customer_id != "") {
     756          $response = $this->customApiObj->get_conversion_list($this->current_customer_id);
     757          if (property_exists($response, "error") && $response->error == false) {
     758            if (property_exists($response, "data") && $response->data != "" && !empty($response->data)) {
    592759              $selected_conversio_send_to = get_option('ee_conversio_send_to');
    593760              $conversion_label = array();
    594761              foreach ($response->data as $key => $value) {
    595                 $con_string=strip_tags($value->tagSnippets);
     762                $con_string = strip_tags($value->tagSnippets);
    596763                $conversion_label_check = $TVC_Admin_Helper->get_conversion_label($con_string);
    597                 if($conversion_label_check != "" && $conversion_label_check != null ){
    598                   $conversion_label[] = $TVC_Admin_Helper->get_conversion_label($con_string); 
     764                if ($conversion_label_check != "" && $conversion_label_check != null) {
     765                  $conversion_label[] = $TVC_Admin_Helper->get_conversion_label($con_string);
    599766                }
    600               } 
     767              }
    601768              echo json_encode($conversion_label);
    602769              exit;
     770            }
    603771          }
    604772        }
    605       }
     773      }else{
     774        echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));       
     775      }
     776      // IMPORTANT: don't forget to exit
     777    exit;
    606778  }
    607779  public function tvc_call_notification_dismiss(){
     
    618790        }       
    619791      }       
    620     }
     792    }else{
     793      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     794    }
     795    // IMPORTANT: don't forget to exit
    621796    exit;
    622797  }
     
    632807        echo json_encode(array('status' => 'success', 'message' => $ee_additional_data));
    633808      }       
    634     }
     809    }else{
     810      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     811    }
     812    // IMPORTANT: don't forget to exit
    635813    exit;
    636814  }
     
    649827      $TVC_Admin_Helper->tvc_dismiss_admin_notice($slug, $content, $status,$title);
    650828     }
    651     }
     829    }else{
     830      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     831    }
     832    // IMPORTANT: don't forget to exit
    652833    exit;
    653834   }
     
    662843        echo json_encode(array('error' => true, 'message' => esc_html__("Please try after some time.","enhanced-e-commerce-for-woocommerce-store")));
    663844      }
    664       exit;
    665     }
     845     
     846    }else{
     847      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     848    }
     849    // IMPORTANT: don't forget to exit
    666850    exit;
    667851  }
     
    675859          echo json_encode(array('error' => true, 'message' => esc_html__("Please try after some time.","enhanced-e-commerce-for-woocommerce-store")));
    676860        }
    677         exit;
    678     }
     861       
     862    }else{
     863      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     864    }
     865    // IMPORTANT: don't forget to exit
    679866    exit;
    680867  }
     
    690877      }     
    691878      exit;
    692     }
    693     exit;
    694   }
    695   public function tvc_call_domain_claim(){
     879    }else{
     880      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     881      exit;
     882    }
     883  }
     884  public function tvc_call_domain_claim(){     
    696885    if($this->safe_ajax_call(filter_input(INPUT_POST, 'apiDomainClaimNonce'), 'tvc_call_domain_claim-nonce')){
    697886      $TVC_Admin_Helper = new TVC_Admin_Helper();
     
    703892      }     
    704893      exit;
    705     }
    706     exit;
     894    }else{
     895      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     896      exit;
     897    }
    707898  }
    708899  public function get_tvc_access_token(){
     
    732923  public function tvcajax_delete_campaign(){
    733924      // make sure this call is legal
    734       if($this->safe_ajax_call(filter_input(INPUT_POST, 'campaignDeleteNonce'), 'tvcajax-delete-campaign-nonce')){
     925      if($this->safe_ajax_call(filter_input(INPUT_POST, 'campaignDeleteNonce'), 'tvcajax_delete_campaign-nonce')){
    735926
    736927          $merchantId = filter_input(INPUT_POST, 'merchantId');
     
    768959              // return new WP_Error($response_code, $response_message, $response_body);
    769960          }
    770       }
    771       exit;
     961      }else{
     962        echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     963      }
     964      // IMPORTANT: don't forget to exit
     965    exit;
    772966  }
    773967
     
    8281022          echo json_encode(['status' => 'error', 'message' => $message]);
    8291023        }
    830     }
     1024    }else{
     1025      echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     1026    }
     1027    // IMPORTANT: don't forget to exit
    8311028    exit;
    8321029  }
     
    9341131
    9351132          //   echo json_encode( $categories );
     1133      }else{
     1134        echo json_encode(array('status' => 'error', "message" => esc_html__("Admin security nonce is not verified.", "enhanced-e-commerce-for-woocommerce-store") ));
     1135        exit;
    9361136      }
    9371137
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/setup/account.php

    r2823603 r2853521  
    132132      var data = {
    133133        action: "tvc_call_active_licence",
    134         licence_key:licence_key       
     134        licence_key:licence_key,
     135        conv_licence_nonce: "<?php echo wp_create_nonce('conv_lic_nonce'); ?>"   
    135136      };
    136137      jQuery.ajax({
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/setup/class-tvc-product-sync-helper.php

    r2839796 r2853521  
    496496            } else {
    497497                // add scheduled cron job
    498                 as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
     498                // as_unschedule_all_actions( 'auto_product_sync_process_scheduler' );
    499499            }
    500500        } catch (Exception $e) {
     
    623623                          <option value="10">10</option>
    624624                          <option value="25">25</option>
    625                           <option selected="selected" value="50">50</option>
    626                           <option value="100">100</option>
     625                          <option value="50">50</option>
     626                          <option selected="selected" value="100">100</option>
    627627                                      <option value="500">500</option>
    628628                        </select>
     
    821821                tvc_data: jQuery("#productSync").find("input[value!=''], select:not(:empty), input[type='number']").serialize(),
    822822                product_batch_size: jQuery("#product_batch_size").val(),
    823                 sync_progressive_data:sync_progressive_data
     823                sync_progressive_data:sync_progressive_data,
     824                TVCNonce: "<?php echo wp_create_nonce('tvcajax_product_sync_bantch_wise-nonce'); ?>"
    824825            }
    825826            jQuery.ajax({
     
    888889                  countryCode: country_id,
    889890                  customerId: customer_id,
    890                   parent: parent
     891                  parent: parent,
     892                  gmcCategoryListsNonce : "<?php echo wp_create_nonce('tvcajax-gmc-category-lists-nonce'); ?>"
    891893                },
    892894                function( response ) {
     
    931933                    countryCode: country_id,
    932934                    customerId: customer_id,
    933                     parent: GmcParent
     935                    parent: GmcParent,
     936                    gmcCategoryListsNonce : "<?php echo wp_create_nonce('tvcajax-gmc-category-lists-nonce'); ?>"
    934937                  },
    935938                  function( response ) {
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/setup/google-shopping-feed-gaa-config.php

    r2850883 r2853521  
    333333        event.preventDefault();
    334334        jQuery.post(tvc_ajax_url,{
    335           action: "tvc_call_domain_claim"
     335          action: "tvc_call_domain_claim",
     336          apiDomainClaimNonce : "<?php echo wp_create_nonce('tvc_call_domain_claim-nonce'); ?>"
    336337        },function( response ){
    337338         
     
    351352              product_sync_duration:product_sync_duration,
    352353              pro_snyc_time_limit:pro_snyc_time_limit,
    353               product_sync_batch_size:product_sync_batch_size
     354              product_sync_batch_size:product_sync_batch_size,
     355              auto_product_sync_setting : "<?php echo wp_create_nonce('auto_product_sync_setting-nonce'); ?>"
    354356            };
    355357
     
    422424    jQuery(tvs_this).after('<div class="domain-claim-spinner tvc-nb-spinner" id="site-verified-spinner"></div>');
    423425    jQuery.post(tvc_ajax_url,{
    424       action: "tvc_call_site_verified"
     426      action: "tvc_call_site_verified",
     427      SiteVerifiedNonce : "<?php echo wp_create_nonce('tvc_call_site_verified-nonce'); ?>"
    425428    },function( response ){
    426429      var rsp = JSON.parse(response);   
     
    441444    jQuery(tvs_this).after('<div class="domain-claim-spinner tvc-nb-spinner" id="domain-claim-spinner"></div>');
    442445    jQuery.post(tvc_ajax_url,{
    443       action: "tvc_call_domain_claim"
     446      action: "tvc_call_domain_claim",
     447      apiDomainClaimNonce : "<?php echo wp_create_nonce('tvc_call_domain_claim-nonce'); ?>"
    444448    },function( response ){
    445449      var rsp = JSON.parse(response);   
     
    469473    tvc_helper.tvc_alert("error","<?php esc_html_e("Attention !","enhanced-e-commerce-for-woocommerce-store"); ?>","<?php esc_html_e("Sync up is in the process do not refresh the page. it may take few minutes.","enhanced-e-commerce-for-woocommerce-store"); ?>");
    470474    jQuery.post(tvc_ajax_url,{
    471       action: "tvc_call_api_sync"
     475      action: "tvc_call_api_sync",
     476      apiSyncupNonce : "<?php echo wp_create_nonce('tvc_call_api_sync-nonce'); ?>"
    472477    },function( response ){
    473478      var rsp = JSON.parse(response);   
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/setup/google-shopping-feed-shopping-campaigns.php

    r2823603 r2853521  
    790790            merchantId: merchantId,
    791791            customerId: customerId,
    792             campaignId: campaignId
     792            campaignId: campaignId,
     793          campaignDeleteNonce : "<?php echo wp_create_nonce('tvcajax_delete_campaign-nonce'); ?>"
    793794            },
    794795            function( response ) {
     
    823824        budget: budget,
    824825        budgetId: budgetId,
     826        campaignStatusNonce : "<?php echo wp_create_nonce('tvcajax-update-campaign-status-nonce'); ?>",
    825827        status: campaign_status == true ? 2 : 3
    826828      },
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/setup/google-shopping-feed-sync-product.php

    r2823603 r2853521  
    322322function ImportGMCProduct(next_page_token = null){
    323323  jQuery.post(tvc_ajax_url,{
    324     action: "tvc_call_import_gmc_product", next_page_token:next_page_token
     324    action: "tvc_call_import_gmc_product",
     325    next_page_token:next_page_token,
     326    apiSyncupNonce : "<?php echo wp_create_nonce('tvc_call_api_sync-nonce'); ?>"
    325327  },function( response ){
    326328    var rsp = JSON.parse(response);   
     
    348350function reTrySycnProcess(){
    349351  jQuery("#feed-spinner").css("display", "block");
     352  setTimeout(function(){ location.reload();}, 15000);
    350353  jQuery.post(tvc_ajax_url,{
    351354    action: "auto_product_sync_process_scheduler",
  • enhanced-e-commerce-for-woocommerce-store/trunk/includes/setup/google-shopping-feed.php

    r2850883 r2853521  
    129129    <div class="tab-card">
    130130      <div class="row">
    131         <div class="col-md-6 col-lg-8 border-right">
     131        <div class="col-md-6 col-lg-8 border-right">       
    132132          <?php if(esc_attr($this->subscriptionId) != ""){?>
    133133            <div class="tvc-api-sunc">                   
     
    192192                      </ul>
    193193                  </div>
    194                   <div class="card-footer">
     194                  <div class="card-footer">                 
    195195                    <a href="<?php echo esc_url_raw($this->site_url.'gaa_config_page'); ?>" class="btn btn-primary" id="configuration"><?php esc_html_e("Edit","enhanced-e-commerce-for-woocommerce-store"); ?></a>
    196196                  </div>
     
    267267    jQuery(tvs_this).after('<div class="domain-claim-spinner tvc-nb-spinner" id="site-verified-spinner"></div>');
    268268    jQuery.post(tvc_ajax_url,{
    269       action: "tvc_call_site_verified"
     269      action: "tvc_call_site_verified",
     270      SiteVerifiedNonce : "<?php echo wp_create_nonce('tvc_call_site_verified-nonce'); ?>"
    270271    },function( response ){
    271272      var rsp = JSON.parse(response);   
     
    286287    jQuery(tvs_this).after('<div class="domain-claim-spinner tvc-nb-spinner" id="domain-claim-spinner"></div>');
    287288    jQuery.post(tvc_ajax_url,{
    288       action: "tvc_call_domain_claim"
     289      action: "tvc_call_domain_claim",
     290      apiDomainClaimNonce : "<?php echo wp_create_nonce('tvc_call_domain_claim-nonce'); ?>"
    289291    },function( response ){
    290       var rsp = JSON.parse(response);   
     292      var rsp = JSON.parse(response); 
    291293      if(rsp.status == "success"){
    292294        tvc_helper.tvc_alert("success","",rsp.message,true);       
     
    314316    tvc_helper.tvc_alert("error","<?php esc_html_e("Attention !","enhanced-e-commerce-for-woocommerce-store"); ?>","<?php esc_html_e("Sync up is in the process do not refresh the page. it may take few minutes.","enhanced-e-commerce-for-woocommerce-store"); ?>");
    315317    jQuery.post(tvc_ajax_url,{
    316       action: "tvc_call_api_sync"
     318      action: "tvc_call_api_sync",
     319      apiSyncupNonce : "<?php echo wp_create_nonce('tvc_call_api_sync-nonce'); ?>"
    317320    },function( response ){
    318321      var rsp = JSON.parse(response);   
  • enhanced-e-commerce-for-woocommerce-store/trunk/readme.txt

    r2850883 r2853521  
    99Tested up to: 6.1.1
    1010Requires PHP: 5.6 or Higher
    11 Stable tag: 5.2.4
    12 Version: 5.2.4
     11Stable tag: 5.2.5
     12Version: 5.2.5
    1313License: GPLv3
    1414License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    234234
    235235== Changelog ==
     236= 5.2.5 - 24/01/2023 =
     237* Performance Optimization in product sync process for Google merchant center.
     238
    236239= 5.2.4 - 19/01/2023 =
    237240* In this release, we have done UI enhancements for our plugin users in the configuration page, while also adding site verification and domain claim status now at all level checkpoints.
Note: See TracChangeset for help on using the changeset viewer.