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

Dir : /home/trave494/polo-family.com/wp-content/plugins/aawzone-ebay/include/helpers/
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/aawzone-ebay/include/helpers/helpers.php

<?php
/**
 * WooZoneProviderEbay Main manager.
 *
 * @package WooZoneProviderEbay
 * @since   1.0
 */
if ( ! function_exists( 'WooZoneProviderEbay' ) ) {
	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay
	 */
	function WooZoneProviderEbay() {
		global $WooZoneProviderEbay;

		return $WooZoneProviderEbay;
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_Settings' ) ) {
	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Settings
	 */
	function WooZoneProviderEbay_Settings() {
		return new WooZoneProviderEbay_Settings();
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_Social' ) ) {
	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Social
	 */
	function WooZoneProviderEbay_Social() {
		return new WooZoneProviderEbay_Social();
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_Settings_Build_Options' ) ) {
	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Settings
	 */
	function WooZoneProviderEbay_Settings_Build_Options( $options=array(), $box_id='' ) {
		return WooZoneProviderEbay_Settings()->build_options( $options, $box_id );
	}
}


if ( ! function_exists( 'WooZoneProviderEbay_Helper' ) ) {
	function WooZoneProviderEbay_Helper() {
		return new WooZoneProviderEbay_Helper();
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_Woocommerce' ) ) {
	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Settings
	 */
	function WooZoneProviderEbay_Woocommerce() {
		return new WooZoneProviderEbay_Woocommerce();
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_Load_Options' ) ) {
	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Settings
	 */
	function WooZoneProviderEbay_Load_Options( $dir ) {
	    new WooZoneProviderEbay_Settings(); // save settings first!
	    
		$options = array();
		// find if we have a options.php into the same folder
		$options_file = $dir . '/options.php';
		if( is_file($options_file) ){
			
			ob_start();
			require_once $options_file;
			
			$content = ob_get_contents();
			ob_clean();
 
			if( trim($content) != "" ){
				$options = json_decode( $content, true );
			}
		}
		return $options;
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_mapper' ) ) {
	/**
	 * Shorthand for WooZoneProviderEbay Mapper.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Mapper
	 */
	function WooZoneProviderEbay_mapper() {
		return WooZoneProviderEbay()->mapper();
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_settings' ) ) {
	/**
	 * Shorthand for WooZoneProviderEbay settings.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Settings
	 */
	function WooZoneProviderEbay_settings() {
		return WooZoneProviderEbay()->settings();
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_path_dir' ) ) {
	/**
	 * Get file/directory path in WooZoneProviderEbay.
	 *
	 * @param string $name - path name
	 * @param string $file
	 *
	 * @since 1.0
	 * @return string
	 */
	function WooZoneProviderEbay_path_dir( $name, $file = '' ) {
		return WooZoneProviderEbay()->path( $name, $file );
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_upload_dir' ) ) {
	/**
	 * Temporary files upload dir;
	 * @since 1.0
	 * @return string
	 */
	function WooZoneProviderEbay_upload_dir() {
		return WooZoneProviderEbay()->uploadDir();
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_path_dir' ) ) {
	/**
	 * Get file/directory path in WooZoneProviderEbay.
	 *
	 * @param string $name - path name
	 * @param string $file
	 *
	 * @since 4.2
	 * @return string
	 */
	function WooZoneProviderEbay_path_dir( $name, $file = '' ) {
		return WooZoneProviderEbay()->path( $name, $file );
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_post_param' ) ) {
	/**
	 * Get param value from $_POST if exists.
	 *
	 * @param $param
	 * @param $default
	 *
	 * @since 1.0
	 * @return null|string - null for undefined param.
	 */
	function WooZoneProviderEbay_post_param( $param, $default = null ) {
		return isset( $_POST[ $param ] ) ? $_POST[ $param ] : $default;
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_get_param' ) ) {
	/**
	 * Get param value from $_GET if exists.
	 *
	 * @param $param
	 * @param $default
	 *
	 * @since 1.0
	 * @return null|string - null for undefined param.
	 */
	function WooZoneProviderEbay_get_param( $param, $default = null ) {
		return isset( $_GET[ $param ] ) ? $_GET[ $param ] : $default;
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_request_param' ) ) {
	/**
	 * Get param value from $_REQUEST if exists.
	 *
	 * @param $param
	 * @param $default
	 *
	 * @since 4.4
	 * @return null|string - null for undefined param.
	 */
	function WooZoneProviderEbay_request_param( $param, $default = null ) {
		return isset( $_REQUEST[ $param ] ) ? $_REQUEST[ $param ] : $default;
	}
}
if ( ! function_exists( 'WooZoneProviderEbay_action' ) ) {
	/**
	 * Get WooZoneProviderEbay special action param.
	 * @since 1.0
	 * @return string|null
	 */
	function WooZoneProviderEbay_action() {
		$WooZoneProviderEbay_action = 'dashboard';
		if ( isset( $_GET['WooZoneProviderEbay_action'] ) ) {
			$WooZoneProviderEbay_action = $_GET['WooZoneProviderEbay_action'];
		} elseif ( isset( $_POST['WooZoneProviderEbay_action'] ) ) {
			$WooZoneProviderEbay_action = $_POST['WooZoneProviderEbay_action'];
		}

		return $WooZoneProviderEbay_action;
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_asset_url' ) ) {
	/**
	 * Get full url for assets.
	 *
	 * @param string $file
	 *
	 * @since 4.2
	 * @return string
	 */
	function WooZoneProviderEbay_asset_url( $file ) {
		return WooZoneProviderEbay()->assetUrl( $file );
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_templates_url' ) ) {
	/**
	 * Get full url for assets.
	 *
	 * @param string $file
	 *
	 * @since 4.2
	 * @return string
	 */
	function WooZoneProviderEbay_templates_url( $file ) {
		return WooZoneProviderEbay()->templatesUrl( $file );
	}
}

if ( ! function_exists( 'WooZoneProviderEbay_locate_template' ) ) {
	function WooZoneProviderEbay_locate_template( $template_name, $template_path = '', $default_path = '' ) 
	{
	    if ( ! $template_path ) {
	        $template_path = 'templates/';
	    }

	    if ( ! $default_path ) {
	        $default_path = WooZoneProviderEbay()->path( 'TEMPLATES_DIR', '' );
	    }
 
	    // Look within passed path within the theme - this is priority.
	    $template = locate_template(
	        array(
	            trailingslashit( $template_path ) . $template_name,
	            $template_name
	        )
	    );

	    // Get default template/
	    if ( ! $template ) {
	        $template = $default_path . $template_name;
	    }

	    // Return what we found.
	    return apply_filters( 'WooZoneProviderEbay_locate_template', $template, $template_name, $template_path );
	}
}


if ( ! function_exists( 'WooZoneProviderEbay_Get_IP' ) ) {
	function WooZoneProviderEbay_Get_IP() 
	{
		//Just get the headers if we can or else use the SERVER global
		if ( function_exists( 'apache_request_headers' ) ) {
			$headers = apache_request_headers();
		} else {
			$headers = $_SERVER;
		}
		//Get the forwarded IP if it exists
		if ( array_key_exists( 'X-Forwarded-For', $headers ) && filter_var( $headers['X-Forwarded-For'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) ) {
			$the_ip = $headers['X-Forwarded-For'];
		} elseif ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $headers ) && filter_var( $headers['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 )
		) {
			$the_ip = $headers['HTTP_X_FORWARDED_FOR'];
		} else {
			$the_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 );
		}
		return $the_ip;
	}
}

/**
 * Plugin name for WooZoneProviderEbay_time_elapsed_string.
 *
 * @since 1.0
 * @return string
 */
if ( ! function_exists( 'WooZoneProviderEbay_time_elapsed_string' ) ) {
	function WooZoneProviderEbay_time_elapsed_string($ptime)
	{
	    $etime = time() - $ptime;
	
	    if ($etime < 1)
	    {
	        return '0 seconds';
	    }
	
	    $a = array( 365 * 24 * 60 * 60  =>  'year',
	                 30 * 24 * 60 * 60  =>  'month',
	                      24 * 60 * 60  =>  'day',
	                           60 * 60  =>  'hour',
	                                60  =>  'minute',
	                                 1  =>  'second'
	                );
	    $a_plural = array( 'year'   => 'years',
	                       'month'  => 'months',
	                       'day'    => 'days',
	                       'hour'   => 'hours',
	                       'minute' => 'minutes',
	                       'second' => 'seconds'
	                );
	
	    foreach ($a as $secs => $str)
	    {
	        $d = $etime / $secs;
	        if ($d >= 1)
	        {
	            $r = round($d);
	            return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago';
	        }
	    }
	}
}


/**
 * Plugin name for WooZoneProviderEbay.
 *
 * @since 1.0
 * @return string
 */
function WooZoneProviderEbay_plugin_name() {
	return WooZoneProviderEbay()->pluginName();
}

if ( ! function_exists( 'WooZoneProviderEbay_db_custom_insert' ) ) {
	
	function WooZoneProviderEbay_prepareForInList($v) {
		return "'".$v."'";
	}

	/**
	 * WooZoneProviderEbay manager.
	 * @since 1.0
	 * @return WooZoneProviderEbay_Settings
	 */
	function WooZoneProviderEbay_db_custom_insert( $table, $fields, $ignore=false, $wp_way=false ) {
		global $wpdb;
		
		if ( $wp_way && !$ignore ) {
			$wpdb->insert( 
				$table, 
				$fields['values'], 
				$fields['format']
			);
		} else {
			$formatVals = implode(', ', array_map('WooZoneProviderEbay_prepareForInList', $fields['format']));
			$theVals = array();
			foreach ( $fields['values'] as $k => $v ) $theVals[] = $k;

			$q = "INSERT " . ($ignore ? "IGNORE" : "") . " INTO $table (" . implode(', ', $theVals) . ") VALUES (" . $formatVals . ");";
			foreach ($fields['values'] as $kk => $vv)
				$fields['values']["$kk"] = esc_sql($vv);

			$q = vsprintf($q, $fields['values']);
			$r = $wpdb->query( $q ); 
		}
		return $wpdb->insert_id;
	}
}