403Webshell
Server IP : 66.29.132.122  /  Your IP : 18.119.213.171
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/assets/js/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/assets/js/admin/kkart-product-import.js
/*global ajaxurl, kkart_product_import_params */
;(function ( $, window ) {

	/**
	 * productImportForm handles the import process.
	 */
	var productImportForm = function( $form ) {
		this.$form           = $form;
		this.xhr             = false;
		this.mapping         = kkart_product_import_params.mapping;
		this.position        = 0;
		this.file            = kkart_product_import_params.file;
		this.update_existing = kkart_product_import_params.update_existing;
		this.delimiter       = kkart_product_import_params.delimiter;
		this.security        = kkart_product_import_params.import_nonce;

		// Number of import successes/failures.
		this.imported = 0;
		this.failed   = 0;
		this.updated  = 0;
		this.skipped  = 0;

		// Initial state.
		this.$form.find('.kkart-importer-progress').val( 0 );

		this.run_import = this.run_import.bind( this );

		// Start importing.
		this.run_import();
	};

	/**
	 * Run the import in batches until finished.
	 */
	productImportForm.prototype.run_import = function() {
		var $this = this;

		$.ajax( {
			type: 'POST',
			url: ajaxurl,
			data: {
				action          : 'kkart_do_ajax_product_import',
				position        : $this.position,
				mapping         : $this.mapping,
				file            : $this.file,
				update_existing : $this.update_existing,
				delimiter       : $this.delimiter,
				security        : $this.security
			},
			dataType: 'json',
			success: function( response ) {
				if ( response.success ) {
					$this.position  = response.data.position;
					$this.imported += response.data.imported;
					$this.failed   += response.data.failed;
					$this.updated  += response.data.updated;
					$this.skipped  += response.data.skipped;
					$this.$form.find('.kkart-importer-progress').val( response.data.percentage );

					if ( 'done' === response.data.position ) {
						var file_name = kkart_product_import_params.file.split( '/' ).pop();
						window.location = response.data.url +
							'&products-imported=' +
							parseInt( $this.imported, 10 ) +
							'&products-failed=' +
							parseInt( $this.failed, 10 ) +
							'&products-updated=' +
							parseInt( $this.updated, 10 ) +
							'&products-skipped=' +
							parseInt( $this.skipped, 10 ) +
							'&file-name=' +
							file_name;
					} else {
						$this.run_import();
					}
				}
			}
		} ).fail( function( response ) {
			window.console.log( response );
		} );
	};

	/**
	 * Function to call productImportForm on jQuery selector.
	 */
	$.fn.kkart_product_importer = function() {
		new productImportForm( this );
		return this;
	};

	$( '.kkart-importer' ).kkart_product_importer();

})( jQuery, window );

Youez - 2016 - github.com/yon3zu
LinuXploit