PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/polo-family.com/wp-content/plugins/wwcAliAff/modules/alibaba_debug/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/polo-family.com/wp-content/plugins/wwcAliAff/modules/alibaba_debug/ajax-request.php

<?php 
if (class_exists('_wwcAliAffAlibabaDebugUtils') != true) {
    class _wwcAliAffAlibabaDebugUtils
    {
        /*
        * Some required plugin information
        */
        const VERSION = '1.0';
		
		static protected $_instance;
		

        /*
        * Required __construct() function that initalizes the AA-Team Framework
        */
        public function __construct() {
		}
		
		public function escape($str) {
			return preg_replace("!([\b\t\n\r\f\"\\'])!", "\\\\\\1", $str);
		}

		// php.net / bohwaz / This is intended to be a simple readable json encode function for PHP 5.3+ (and licensed under GNU/AGPLv3 or GPLv3 like you prefer)
		public function json_readable_encode($in, $indent = 0, $from_array = false) {
		    $out = '';
		
		    foreach ($in as $key=>$value)
		    {
		        $out .= str_repeat("\t", $indent + 1);
		        $out .= "\"".$this->escape((string)$key)."\": ";
		
		        if (is_object($value) || is_array($value))
		        {
		            $out .= "\n";
		            $out .= $this->json_readable_encode($value, $indent + 1);
		        }
		        elseif (is_bool($value))
		        {
		            $out .= $value ? 'true' : 'false';
		        }
		        elseif (is_null($value))
		        {
		            $out .= 'null';
		        }
		        elseif (is_string($value))
		        {
		            $out .= "\"" . $this->escape($value) ."\"";
		        }
		        else
		        {
		            $out .= $value;
		        }
		
		        $out .= ",\n";
		    }
		
		    if (!empty($out))
		    {
		        $out = substr($out, 0, -2);
		    }
		
		    $out = str_repeat("\t", $indent) . "{\n" . $out;
		    $out .= "\n" . str_repeat("\t", $indent) . "}";
		
		    return $out;
		}

		/**
	    * Singleton pattern
	    *
	    * @return wwcAliAffPriceSelect Singleton instance
	    */
	    static public function getInstance()
	    {
	        if (!self::$_instance) {
	            self::$_instance = new self;
	        }
  
	        return self::$_instance;
	    }
    }
}
// Initialize the _wwcAliAffAlibabaDebugUtils class
//$_wwcAliAffAlibabaDebugUtils = _wwcAliAffAlibabaDebugUtils::getInstance();


add_action('wp_ajax_wwcAliAffAlibabaDebugGetResponse', 'wwcAliAffAlibabaDebugGetResponse');
function wwcAliAffAlibabaDebugGetResponse() {
	$html = array();
	$ret = array(
		'status' => 'invalid',
		'html'	=> implode( PHP_EOL, $html )
	);
   
	$req = array(
		'wwcaliaff_sku'	=> isset($_REQUEST['wwcaliaff_sku']) ? (string) $_REQUEST['wwcaliaff_sku'] : 0,
		'rg'	=> isset($_REQUEST['rg']) ? $_REQUEST['rg'] : 'ItemAttributes,Large,OfferFull,PromotionSummary,Variations',
	);
	extract($req);
	
	global $wwcAliAff;
	//$wwcAliAff->alibabaHelper->setupAlibabaWS();

	// create new alibaba instance
	$aaAlibabaWS = $wwcAliAff->alibabaHelper->aaAlibabaWS;
  
	// create request by Alibaba SKU
	$product = $aaAlibabaWS->get_product_details($wwcaliaff_sku);
  
  	//global $_wwcAliAffAlibabaDebugUtils;
  	$_wwcAliAffAlibabaDebugUtils = _wwcAliAffAlibabaDebugUtils::getInstance();
	//$product = $_wwcAliAffAlibabaDebugUtils->json_readable_encode( $product );
	$product = json_encode(	$product ); 
	
	die( json_encode(array(
		'status' => 'valid',
		'html' => $product
	)) );
}