Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . str_replace("wp-content/plugi..

Decoded Output download

<?php 
	require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . str_replace("wp-content/plugins/dl_import_products/".basename(__FILE__),"",$_SERVER['REQUEST_URI']).'wp-load.php'); 
	require_once(ABSPATH . 'wp-admin/includes/image.php'); 
 
	goto smtds; jHReb: function Update_Counters($counter, $prod_sku) { update_option("total_product_ip", $counter); update_option("last_update_import_date", date("d/m/Y - H:i:s")); update_option("last_update_import_time", time()); update_option("last_sku", $prod_sku); } goto uRx7N; khOJ_: function clean_CData($chain) { $final_chain = str_replace(array("<![CDATA[", "]]>"), array('', ''), $chain); return $final_chain; } goto jHReb; V8zdF: function misha_post_id_by_meta_key_and_value($meta_key, $meta_value) { global $wpdb; $ids = $wpdb->get_col($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s", $meta_key, $meta_value)); if (count($ids) > 1) { return $ids[count($ids) - 1]; } else { if (count($ids) == 0) { return ''; } else { return $ids[0]; } } } goto g1bd4; yByqU: function clean_text($texto, $clean = true, $charlimit = null) { $texto = trim($texto); $texto = html_entity_decode($texto, ENT_QUOTES); $texto = trim(preg_replace("/\t+/", '', $texto)); $texto = addslashes($texto); if ($clean) { $texto = strip_tags($texto); } $texto = preg_replace("/[\x{200B}-\x{200D}]/u", '', $texto); $texto = preg_replace("/[\x{200B}-\x{200D}\x{FEFF}]/u", '', $texto); $texto = str_replace("\342\x80\214", '', $texto); $texto = str_replace("&#8203;", '', $texto); $texto = str_replace(array("\xd\xa", "
", "\xd"), "<br>", $texto); $texto = str_replace("\\r", "<br>", $texto); $texto = str_replace("\r", "<br>", $texto); $texto = str_replace("\xd", "<br>", $texto); $texto = str_replace("onclick", "id", $texto); $texto = str_replace(array("\", "\xc2\xa8", "\xc2\272", "\342\x80\x93", "~", "|", "\302\xb7", "&", "\302\277", "^", "\302\250", "\xc2\264", "#"), '', $texto); $texto = str_replace(array("\", "\342\x80\231"), '', $texto); if ($charlimit > 0) { $texto = substr($texto, 0, $charlimit); } return $texto; } goto khOJ_; smtds: function send_debug_email($subject = '', $message = '') { $to = get_option("dl_update_pv_email"); if (!empty($to)) { wp_mail($to, $subject, $message); } } goto STT7b; uRx7N: function offproduct($prod_sku, $prod_title, $dl_update_discontinued_pv, $mailrep) { $prod_post_id = wc_get_product_id_by_sku($prod_sku); if (get_post_status($prod_post_id) === "publish") { $dlid = get_post_meta($prod_post_id, "_dlid"); if (!empty($dlid[0])) { if ($dl_update_discontinued_pv == "yes") { $fproduct = wc_get_product($prod_post_id); if ($fproduct->get_type() == "variable") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "_dlid"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "0", "set"); update_post_meta($vchild[$vpi], "_stock", "0"); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wc_update_product_stock($prod_post_id, "0", "set"); update_post_meta($prod_post_id, "_stock", "0"); wp_update_post(array("ID" => $prod_post_id, "post_status" => "private")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . "*" . $prod_sku . " " . $prod_title . "\xd\xa"; update_option("list_disable_product", $oldpr); } } $mproduct = str_replace("-var", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wc_update_product_stock($prod_post_id, "0", "set"); update_post_meta($prod_post_id, "_stock", "0"); wp_update_post(array("ID" => $prod_post_id, "post_status" => "private")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . "**" . $prod_sku . " " . $prod_title . "\xd
"; update_option("list_disable_product", $oldpr); } } } else { if ($dl_update_discontinued_pv == "no") { $fproduct = wc_get_product($prod_post_id); if ($fproduct->get_type() == "variable") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "_dlid"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "0", "set"); update_post_meta($vchild[$vpi], "_stock", "0"); wp_trash_post($vchild[$vpi]); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wp_update_post(array("ID" => $prod_post_id, "post_status" => "importing")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . "-" . $prod_sku . " " . $prod_title . "\xd
"; update_option("list_disable_product", $oldpr); } } $mproduct = str_replace("-var", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wp_update_post(array("ID" => $prod_post_id, "post_status" => "importing")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . "--" . $prod_sku . " " . $prod_title . "\xd
"; update_option("list_disable_product", $oldpr); } } } } } } } goto uZKBm; STT7b: function dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id) { $xml_post = array("import_id" => $prod_id, "post_author" => $prod_author, "post_content" => $prod_desc, "post_status" => $prod_status, "post_title" => $prod_title, "post_parent" => $prod_parent, "post_type" => $prod_post_type, "post_excerpt" => $prod_excerpt); $prod_post_id = wp_insert_post($xml_post); return $prod_post_id; } goto V8zdF; f9jry: function save_product_attribute_from_name($name, $label = '', $set = true) { if (!function_exists("get_attribute_id_from_name")) { return; } global $wpdb; $label = $label == '' ? ucfirst($name) : $label; $attribute_id = get_attribute_id_from_name($name); if (empty($attribute_id)) { $attribute_id = NULL; } else { $set = false; } $args = array("attribute_id" => $attribute_id, "attribute_name" => $name, "attribute_label" => $label, "attribute_type" => "select", "attribute_orderby" => "menu_order", "attribute_public" => 0); if (empty($attribute_id)) { $wpdb->insert($wpdb->prefix . "woocommerce_attribute_taxonomies", $args); do_action("woocommerce_attribute_added", $wpdb->insert_id, $args); flush_rewrite_rules(); delete_transient("wc_attribute_taxonomies"); } } goto oK1lq; C6qNQ: function Create_Brand_Parent($pTerm, $Name, $SName, $taxo) { $slug = sanitize_title(clean_text(strtolower($SName))); $term = wp_insert_term($Name, $taxo, array("slug" => $slug, "parent" => intval($pTerm))); return $term; } goto JxmNa; lCYF0: function ssdl_attach_product_thumbnail($post_id, $url, $flag) { if (preg_match("/(\.jpg|\.png|\.bmp|\.jpeg|\.gif)$/", $url)) { $url_array = explode("/", $url); $image_name = $url_array[count($url_array) - 1]; $filename = basename($image_name); $uploads = wp_upload_dir(); $path = $uploads["basedir"] . "/dl"; if (!file_exists($path)) { mkdir($extract_path, 493, true); } $imgs = $path . "/img"; if (!file_exists($imgs)) { mkdir($imgs, 493, true); } $sfile = "dl/img/" . $filename; $file = $imgs . "/" . $filename; $Seek = SeekImg($sfile); if (count($Seek) > 0 && file_exists($file)) { $itotal = count($Seek); $attach_id = $Seek[$itotal - 1]->post_id; } else { $image_data = file_get_contents($url); $save_img = fopen($file, "w"); fwrite($save_img, $image_data); fclose($save_img); set_post_thumbnail_size(150, 150); $wp_filetype = wp_check_filetype($filename, null); $attachment = array("post_mime_type" => $wp_filetype["type"], "post_title" => sanitize_file_name($filename), "post_content" => '', "post_status" => "inherit"); $attach_id = wp_insert_attachment($attachment, $file, $post_id); $attach_data = my_generate_attachment_metadata_p($attach_id, $file); wp_update_attachment_metadata($attach_id, $attach_data); } if ($flag == 0) { set_post_thumbnail($post_id, $attach_id); update_post_meta($post_id, "_product_image_gallery", ''); } if ($flag == 1) { $attach_id_array = get_post_meta($post_id, "_product_image_gallery", true); if (strlen($attach_id_array) > 0) { $attach_id_array .= "," . $attach_id; } else { $attach_id_array .= $attach_id; } update_post_meta($post_id, "_product_image_gallery", $attach_id_array); } } } goto Ch8ws; WmpMD: function dl_add_variations_to_products($postid, $prod_visibility, $variation_data, $price, $stock, $sku, $dl_update_stock, $dl_update_cost_price, $iscreate = false, $prod_commonvar = '', $barcode = '', $costprice = '', $prodid = '') { 
    $product_type = "product_variation"; 
    $variation_prod = (string) $variation_data->common_title; 
    $json_string = json_encode($variation_data); 
    $result_array = json_decode($json_string, TRUE); 
    $product = wc_get_product($postid); if ($product) { if (!empty($prod_commonvar)) { $product->set_name($prod_commonvar); } $allattr = $product->get_attributes(); $agroup = array(); $aname = array(); $avalue = array(); $exist = false; for ($i = 1; $i <= 2; $i++) { if (array_key_exists("var_groupname_" . $i, $result_array)) { $var_key = "var_groupname_" . $i; $agroup[$i] = (string) clean_text(clean_Cdata($variation_data->{$var_key})); $exist = true; } else { $agroup[$i] = " "; } if (array_key_exists("var_name_" . $i, $result_array)) { $var_key = "var_name_" . $i; $aname[$i] = (string) clean_text(clean_Cdata($variation_data->{$var_key})); $exist = true; } else { $aname[$i] = ''; } if (array_key_exists("var_value_" . $i, $result_array)) { $var_key = "var_value_" . $i; $avalue[$i] = (string) clean_text(clean_Cdata($variation_data->{$var_key})); $exist = true; } else { $avalue[$i] = ''; } } $product_attributes = array(); if ($aname[2] !== '') { $allval = ''; for ($i = 1; $i <= 2; $i++) { $group = $agroup[$i]; $name = $aname[$i]; $value = $avalue[$i]; if (!empty($value)) { $taxonomy = wc_attribute_taxonomy_name($name); $attr_label = ucfirst($name); $attr_name = wc_sanitize_taxonomy_name($name); if (!taxonomy_exists($taxonomy)) { save_product_attribute_from_name($attr_name, $attr_label); } $term_name = ucfirst($value); $term_slug = sanitize_title($value); $product_attributes[$taxonomy] = array("name" => $taxonomy, "value" => $value, "options" => $term_slug, "position" => '', "is_visible" => 1, "is_variation" => 1, "is_taxonomy" => 1); if (!term_exists($value, $taxonomy)) { wp_insert_term($term_name, $taxonomy, array("slug" => $term_slug)); } wp_set_post_terms($postid, $term_name, $taxonomy, true); } } update_post_meta($postid, "_product_attributes", $product_attributes); $varid = wc_get_product_id_by_sku($sku); $variation = wc_get_product($varid); if (!$variation || $iscreate) { $variation = new WC_Product_Variation(); $variation->set_parent_id($product->get_id()); if ($sku !== $product->get_sku()) { $variation->set_sku($sku); $variation->set_manage_stock(true); } $variation->set_stock_quantity($stock); $variation->set_price($price); $variation->set_regular_price($price); } if ($dl_update_stock == "yes") { $variation->set_stock_quantity($stock); } if ($dl_update_cost_price == "yes") { $variation->set_price($price); $variation->set_regular_price($price); $ssprice = $variation->get_sale_price(); $ssdatefrom = $variation->get_date_on_sale_from(); $ssdateto = $variation->get_date_on_sale_to(); if (!empty($ssprice)) { $variation->set_sale_price((string) $ssprice); $variation->set_date_on_sale_from((string) $ssdatefrom); $variation->set_date_on_sale_to((string) $ssdateto); } } if ($prod_visibility == "hidden") { $variation->set_status("private"); } else { $variation->set_status("publish"); } $variation->update_meta_data("_barcode", (string) $barcode); $variation->update_meta_data("_wpm_gtin_code", (string) $barcode); $variation->update_meta_data("_costprice", (string) $costprice); $variation->update_meta_data("_dlid", (string) $prodid); $variation->save(); $myvarid = $variation->get_id(); update_post_meta($myvarid, "attribute_" . wc_attribute_taxonomy_name($aname[1]), sanitize_title($avalue[1])); update_post_meta($myvarid, "attribute_" . wc_attribute_taxonomy_name($aname[2]), sanitize_title($avalue[2])); } else { for ($i = 1; $i <= 1; $i++) { $group = $agroup[$i]; $name = $aname[$i]; $value = $avalue[$i]; if (!empty($value)) { $taxonomy = wc_attribute_taxonomy_name($name); $attr_label = ucfirst($name); $attr_name = wc_sanitize_taxonomy_name($name); if (!taxonomy_exists($taxonomy)) { save_product_attribute_from_name($attr_name, $attr_label); } $product_attributes[$taxonomy] = array("name" => $taxonomy, "value" => $value, "options" => $term_slug, "position" => '', "is_visible" => 1, "is_variation" => 1, "is_taxonomy" => 1); $term_name = ucfirst($value); $term_slug = sanitize_title($value); if (!term_exists($value, $taxonomy)) { wp_insert_term($term_name, $taxonomy, array("slug" => $term_slug)); } wp_set_post_terms($postid, $term_name, $taxonomy, true); } } update_post_meta($postid, "_product_attributes", $product_attributes); $product->save(); $varid = wc_get_product_id_by_sku($sku); $variation = wc_get_product($varid); if (!$variation) { $variation = new WC_Product_Variation(); $variation->set_parent_id($product->get_id()); if ($sku !== $product->get_sku()) { $variation->set_sku($sku); $variation->set_manage_stock(true); } $variation->set_stock_quantity($stock); $variation->set_price($price); $variation->set_regular_price($price); $ssprice = $variation->get_sale_price(); $ssdatefrom = $variation->get_date_on_sale_from(); $ssdateto = $variation->get_date_on_sale_to(); if (!empty($ssprice)) { $variation->set_sale_price((string) $ssprice); $variation->set_date_on_sale_from((string) $ssdatefrom); $variation->set_date_on_sale_to((string) $ssdateto); } } if ($dl_update_stock == "yes") { $variation->set_stock_quantity($stock); } if ($dl_update_cost_price == "yes") { $variation->set_price($price); $variation->set_regular_price($price); } if ($prod_visibility == "hidden") { $variation->set_status("private"); } else { $variation->set_status("publish"); } $variation->update_meta_data("_barcode", (string) $barcode); $variation->update_meta_data("_wpm_gtin_code", (string) $barcode); $variation->update_meta_data("_costprice", (string) $costprice); $variation->update_meta_data("_dlid", (string) $prodid); $variation->save(); $myvarid = $variation->get_id(); update_post_meta($myvarid, "attribute_" . wc_attribute_taxonomy_name($aname[1]), sanitize_title($avalue[1])); } } } goto lCYF0; ilwXR: function load_xml_file() { $xml_url = get_option("dl_update_xml_url", true); if (!filter_var($xml_url, FILTER_VALIDATE_URL)) { echo "Invalid URL
"; } else { $uploads = wp_upload_dir(); $extract_path = $uploads["basedir"] . "/dl"; if (!file_exists($extract_path)) { mkdir($extract_path, 493, true); } $extracted_xmls = $extract_path . "/xml/"; if (!file_exists($extracted_xmls)) { mkdir($extracted_xmls, 484, true); } $extract_dir = $extract_path . "/zip/"; if (!file_exists($extract_dir)) { mkdir($extract_dir, 484, true); } $dlp_new_xml_zip = $extract_dir . "/xml_products.zip"; $file = file_put_contents($dlp_new_xml_zip, fopen($xml_url, "r")); if ($file) { $zip = new ZipArchive(); if ($zip->open($dlp_new_xml_zip) != "true") { echo "Unable to open the Zip File.\xd
"; } else { $zip->extractTo($extracted_xmls); $zip->close(); $dlp_simplexml = simplexml_load_file($extracted_xmls . "xml_001.xml"); return $dlp_simplexml; } } return $dlp_simplexml; } } goto yByqU; oK1lq: function get_attribute_id_from_name($name) { global $wpdb; $attribute_id = $wpdb->get_col("SELECT attribute_id\xa\x9    FROM {$wpdb->prefix}woocommerce_attribute_taxonomies
	    WHERE attribute_name LIKE '{$name}'"); return reset($attribute_id); } goto WmpMD; JxmNa: function dl_product_sales_price_calc($dl_product_price, $dl_cost_price, $n, $product_price_type) { $dl_product_price = floatval($dl_product_price); $dl_cost_price = floatval($dl_cost_price); $n = floatval($n); $product_price_type = trim($product_price_type); $dl_new_product_price = 0; if ($product_price_type == "dl_per_cost") { $dl_new_product_price = $dl_cost_price * (1 + $n / 100); } elseif ($product_price_type == "dl_per_pvp") { $dl_new_product_price = $dl_product_price * (1 + $n / 100); } elseif ($product_price_type == "dl_fixed_price") { $dl_new_product_price = $dl_product_price + $n; } else { $dl_new_product_price = $dl_product_price; } return strval($dl_new_product_price); } goto ilwXR; vkDuG: function SeekImg($imgname) { global $wpdb; $sql = $wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} \xa	\x9         WHERE meta_key = '_wp_attached_file' AND meta_value = %s", $imgname); $post_id = $wpdb->get_results($sql); return $post_id; } goto NhjVP; Ud7W3: function Create_Cats_Parent($pTerm, $Name, $SName) { $slug = sanitize_title(clean_text(strtolower($SName))); $term = wp_insert_term($Name, "product_cat", array("slug" => $slug, "parent" => intval($pTerm))); return $term; } goto fRioq; NhjVP: function dl_espcategory_to_products($post_id, $prod_categories, $acc) { $tag = array(); $oldtag = wp_get_object_terms($post_id, "product_cat"); $cat_vals = $prod_categories; if ($acc == "1") { if (!term_exists(sanitize_title(clean_text($cat_vals)), "product_cat")) { $slug = sanitize_title(clean_text(strtolower($cat_vals))); $term = wp_insert_term($cat_vals, "product_cat", array("slug" => $slug)); $term_id = $term["term_id"]; } else { $term_s = get_term_by("slug", sanitize_title(clean_text($cat_vals)), "product_cat"); $term_id = $term_s->term_id; } foreach ($oldtag as $ootag) { $oterm = $ootag->term_id; array_push($tag, $oterm); } array_push($tag, $term_id); } else { $Sslug = sanitize_title(clean_text($prod_categories)); foreach ($oldtag as $ootag) { if ($ootag->slug != $Sslug) { $oterm = $ootag->term_id; array_push($tag, $oterm); } } } wp_set_object_terms($post_id, $tag, "product_cat"); } goto iG_Xt; iG_Xt: function dl_add_category_to_products($post_id, $prod_categories, $catmap, $catmapping) { $tag = array(); foreach ($prod_categories->category as $cat_vals) { $cat_valsa = str_replace(array("<![CDATA[", "]]>"), array('', ''), $cat_vals); $cat_valse = explode("|", $cat_vals); $total = count($cat_valse); if ($catmap == 1) { $catfound = false; $CSlug = $cat_valse[0]; for ($i = 0; $i < count($cat_valse); $i++) { foreach ($catmapping as $mapping) { if ($mapping["xslug"] == sanitize_title(clean_text($CSlug))) { $term = get_term_by("slug", sanitize_title($mapping["slug"]), "product_cat"); array_push($tag, $term->term_id); $catfound = true; break; } } if ($i + 1 < count($cat_valse)) { $CSlug .= "|" . $cat_valse[$i + 1]; } } if ($catfound) { continue; } } if (!term_exists(sanitize_title(clean_text($cat_vals)), "product_cat")) { if (count($cat_valse) > 1) { $TSlug = $cat_valse[0]; for ($i = 1; $i < count($cat_valse); $i++) { $padre = clean_text($cat_valse[$i - 1]); $term_s = get_term_by("slug", sanitize_title(clean_text($TSlug)), "product_cat"); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), "product_cat", array("slug" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["term_id"]; array_push($tag, $term_s["term_id"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "|" . $cat_valse[$i]; $hijo = clean_text($cat_valse[$i]); if (!term_exists(sanitize_title($TSlug), "product_cat")) { $term = Create_Cats_Parent($term_id, $hijo, $TSlug); array_push($tag, $term["term_id"]); } else { $term = get_term_by("slug", sanitize_title(clean_text($TSlug)), "product_cat"); array_push($tag, $term->term_id); } } } else { $term = wp_insert_term(clean_text(strval($cat_valse[$total - 1])), "product_cat", array("slug" => sanitize_title(clean_text(strtolower($cat_vals))))); array_push($tag, $term["term_id"]); } } else { if (count($cat_valse) > 1) { $TSlug = $cat_valse[0]; for ($i = 1; $i < count($cat_valse); $i++) { $padre = clean_text($cat_valse[$i - 1]); $term_s = get_term_by("slug", sanitize_title(clean_text($TSlug)), "product_cat"); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), "product_cat", array("slug" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["term_id"]; array_push($tag, $term_s["term_id"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "|" . $cat_valse[$i]; $hijo = clean_text($cat_valse[$i]); if (!term_exists(sanitize_title($TSlug), "product_cat")) { $term = Create_Cats_Parent($term_id, $hijo, $TSlug); array_push($tag, $term["term_id"]); } else { $term = get_term_by("slug", sanitize_title(clean_text($TSlug)), "product_cat"); array_push($tag, $term->term_id); } } } else { $term = get_term_by("slug", sanitize_title(clean_text($cat_valse[$total - 1])), "product_cat"); if (!$term) { $term = wp_insert_term(clean_text(strval($cat_valse[$total - 1])), "product_cat", array("slug" => sanitize_title(clean_text(strtolower($cat_vals))))); array_push($tag, $term["term_id"]); } else { array_push($tag, $term->term_id); } } } } wp_set_object_terms($post_id, $tag, "product_cat"); } goto Ud7W3; uZKBm: function update_products($fimport) { remove_filter("content_save_pre", "wp_filter_post_kses"); remove_filter("content_filtered_save_pre", "wp_filter_post_kses"); $uploads = wp_upload_dir(); $base_dir = str_replace("uploads/", '', $uploads["basedir"]); global $wpdb; $dlpi_table_prefix = $wpdb->prefix; $dl_table = $dlpi_table_prefix . "dl_xml_products"; $counter = 0; $dl_update_lang = get_option("dl_update_lang"); $dl_update_prod_price = get_option("dl_update_prod_price"); $dl_update_price_val = get_option("dl_update_price_val"); $dl_update_newp = get_option("dl_update_newp"); $dl_update_title = get_option("dl_update_title"); $dl_update_desc = get_option("dl_update_desc"); $dl_update_excerpt = get_option("dl_update_excerpt"); $dl_update_stock = get_option("dl_update_stock"); $dl_update_cost_price = get_option("dl_update_cost_price"); $dl_update_categories = get_option("dl_update_categories"); $dl_update_categories_new = get_option("dl_update_categories_new"); $dl_update_categories_sale = get_option("dl_update_categories_sale"); $dl_update_brands = get_option("dl_update_brands"); $dl_update_images = get_option("dl_update_images"); $dl_img_options = get_option("dl_img_options"); $dl_update_discontinued_pv = get_option("dl_update_discontinued_pv"); $dl_catmap = get_option("dl_map_cat"); $dl_catfilter = get_option("dl_filter_cat"); $dl_prodfilter = get_option("dl_filter_prod"); $dl_brandfilter = get_option("dl_filter_brand"); if ($dl_catmap == 1) { $dl_catmapping = get_option("map_product_categories"); } else { $dl_catmapping = array(); } if ($dl_catfilter == 1) { $dl_cat_filter = get_option("dl_indluded_cat_key"); } else { if ($dl_catfilter == 2) { $dl_cat_filter = get_option("dl_excluded_cat_key"); } else { $dl_cat_filter = array(); } } if ($dl_prodfilter == 1) { $dl_prod_filter = get_option("dl_indluded_prod_key"); } else { if ($dl_prodfilter == 2) { $dl_prod_filter = get_option("dl_excluded_prod_key"); } else { $dl_prod_filter = array(); } } if ($dl_brandfilter == 1) { $dl_brand_filter = get_option("dl_indluded_brand_key"); } else { if ($dl_brandfilter == 2) { $dl_brand_filter = get_option("dl_excluded_brand_key"); } else { $dl_brand_filter = array(); } } $langtag = "en-UK"; if ($dl_update_lang == "english") { $langtag = "en-UK"; } else { if ($dl_update_lang == "french") { $langtag = "fr-FR"; } else { if ($dl_update_lang == "italian") { $langtag = "it-IT"; } else { if ($dl_update_lang == "german") { $langtag = "de-DE"; } else { if ($dl_update_lang == "portuguese") { $langtag = "pt-PT"; } else { if ($dl_update_lang == "spanish") { $langtag = "es-ES"; } } } } } } $count = 0; $xml = load_xml_file(); $total_count = count($xml->product); update_option("total_product_xml", $total_count); $post_author = get_current_user_id(); $post_status = "publish"; $post_parent = ''; $post_type = "product"; $dl_update_lang = get_option("dl_update_lang", true); $last_import_sku = get_option("last_sku", ''); $start_import_sku = get_option("start_sku", ''); clean_product_incomplete(); $mailrep = get_option("dl_update_pv_email"); $stop = get_option("stop_import", "0"); update_option("total_product_ip", 0); clearstatcache(); $nowlist = array(); if ($total_count > 0) { foreach ($xml->product as $key => $product) { update_option("last_update_import_time", time()); $array_prod_cats = array(); $new_db_prod_id = $product->id; $prod_id = $product->id; $prod_sku = (string) $product->public_id; $brand = (string) $product->brand_hierarchy; $brand = str_replace("'", " ", $brand); array_push($nowlist, (string) $prod_id); if ($fimport) { $count++; if ($prod_sku == $last_import_sku) { $fimport = false; $count--; $counter = $count; update_option("total_product_ip", $counter); } else { continue; } } update_option("start_sku", $prod_sku); $prod_categories = $product->categories; if ($dl_catfilter == 1) { $cat_include = false; foreach ($prod_categories->category as $cat_vals) { if (in_array($cat_vals["gesioid"], $dl_cat_filter)) { $cat_include = true; break; } } if (!$cat_include) { $counter++; Update_Counters($counter, $prod_sku); continue; } } else { if ($dl_catfilter == 2) { $cat_exclude = false; foreach ($prod_categories->category as $cat_vals) { if (in_array($cat_vals["gesioid"], $dl_cat_filter)) { $cat_exclude = true; break; } } if ($cat_exclude) { $counter++; Update_Counters($counter, $prod_sku); continue; } } } if ($dl_prodfilter == 1) { if (!in_array($prod_sku, $dl_prod_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } else { if ($dl_prodfilter == 2) { if (in_array($prod_sku, $dl_prod_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } } if ($dl_brandfilter == 1) { if (!in_array($brand, $dl_brand_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } else { if ($dl_brandfilter == 2) { if (in_array($brand, $dl_brand_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } } $prod_type = "simple"; $prod_commonvar = ''; $variation_data = ''; if (!empty($product->variant)) { $prod_type = "variable"; $variation_data = $product->variant; } if ($dl_update_lang == "english" || $dl_update_lang == "french" || $dl_update_lang == "italian" || $dl_update_lang == "german" || $dl_update_lang == "portuguese") { if (!is_null($product->internationalization)) { if (!is_null($product->internationalization->title)) { $pr_title = $product->internationalization->title->value; $xml_lang = ''; $prod_title = clean_text(clean_CData($product->title)); if (!is_null($pr_title)) { foreach ($pr_title as $prt => $p_title) { $xml_lang = $p_title["lang"]; if ($xml_lang == $langtag) { if ($p_title) { $prod_title = $p_title; $prod_title = clean_text(clean_CData($prod_title)); } else { $prod_title = clean_text(clean_CData($product->title)); } break; } } } } else { $prod_title = clean_text(clean_CData($product->title)); } if (!is_null($product->internationalization->description)) { $pr_excerpt = $product->internationalization->description->value; $xml_lang = ''; $prod_excerpt = clean_text(clean_CData($product->description)); if (!is_null($pr_excerpt)) { foreach ($pr_excerpt as $prt => $p_excerpt) { $xml_lang = $p_excerpt["lang"]; if ($xml_lang == $langtag) { if ($p_excerpt) { $prod_excerpt = $p_title; $prod_excerpt = clean_text(clean_CData($prod_excerpt)); } else { $prod_excerpt = clean_text(clean_CData($product->description)); } break; } } } } else { $prod_excerpt = clean_text(clean_CData($product->description)); } if (!is_null($product->internationalization->html_description)) { $pr_desc = $product->internationalization->html_description->value; $xml_lang = ''; $prod_desc = clean_text(clean_CData($product->html_description), false); if (!is_null($pr_desc)) { foreach ($pr_desc as $prt => $p_desc) { $xml_lang = $p_desc["lang"]; if ($xml_lang == $langtag) { if ($p_desc) { $prod_desc = $p_desc; $prod_desc = clean_text(clean_CData($prod_desc), false); } else { $prod_desc = clean_text(clean_CData($product->html_description), false); } break; } } } } else { $prod_desc = clean_text(clean_CData($product->html_description), false); } if (!empty($product->variant)) { if (!is_null($product->internationalization->variant_common_title)) { $pr_commonvar = $product->internationalization->variant_common_title->value; $xml_lang = ''; $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); if (!is_null($pr_commonvar)) { foreach ($pr_commonvar as $prt => $p_commonvar) { $xml_lang = $p_commonvar["lang"]; if ($xml_lang == $langtag) { if ($p_commonvar) { $prod_commonvar = $p_commonvar; $prod_commonvar = clean_text(clean_CData($prod_commonvar)); } else { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } break; } } } } else { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } } } else { $prod_title = clean_text(clean_CData($product->title)); $prod_desc = clean_text(clean_CData($product->html_description), false); $prod_excerpt = clean_text(clean_CData($product->description)); if (!empty($product->variant)) { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } } } else { $prod_title = clean_text(clean_CData($product->title)); $prod_desc = clean_text(clean_CData($product->html_description), false); $prod_excerpt = clean_text(clean_CData($product->description)); if (!empty($product->variant)) { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } } $prod_author = $post_author; $prod_parent = $post_parent; $prod_post_type = $post_type; $prod_visibility = $product->available; $prod_issale = "0"; $prod_isnew = "0"; if (!is_null($product->sale)) { $prod_issale = $product->sale["value"]; } if (!is_null($product->new)) { $prod_isnew = $product->new["value"]; } if (intval($prod_visibility) == 1) { $prod_visibility = "visible"; } else { $prod_visibility = "hidden"; } $prod_cost = $product->cost_price; $prod_brand = explode("|", $product->brand_hierarchy); $prod_brand = clean_text(clean_CData($prod_brand[0])); $prod_barcode = $product->barcodes->barcode; if (!is_null($prod_barcode)) { $prod_barcodeName = $product->barcodes->barcode["type"]; } else { $prod_barcodeName = ''; } $prod_stock = $product->stock->location; $stock_status = ''; $prodcatnew = ''; $prodcatoffer = ''; if (intval($prod_stock) >= 1) { $stock_status = "instock"; } if ($dl_update_lang == "spanish") { $prodcatnew = "Novedades"; $prodcatoffer = "Ofertas"; } else { if ($dl_update_lang == "french") { $prodcatnew = "Nouveautes"; $prodcatoffer = "Offres"; } else { if ($dl_update_lang == "italian") { $prodcatnew = "Nuovo"; $prodcatoffer = "Offerte"; } else { if ($dl_update_lang == "german") { $prodcatnew = "Nachrichten"; $prodcatoffer = "Sale"; } else { if ($dl_update_lang == "portuguese") { $prodcatnew = "Novidades"; $prodcatoffer = "Ofertas"; } else { if ($dl_update_lang == "english") { $prodcatnew = "News"; $prodcatoffer = "Offers"; } } } } } } $prod_stock_status = $stock_status; $prod_downloadable = ''; $prod_virtual = "no"; $prod_price = $product->price; $prod_sales_price = 0; $prod_purchase_note = ''; $prod_featured = "no"; $prod_sale_price_dates_from = ''; $prod_sale_price_dates_to = ''; $prod_sold_individually = ''; $prod_manage_stock = "yes"; $prod_backorders = "no"; $prod_total_sales = 0; $prod_regular_price = $product->price; $prod_length = $product->size->depth; $prod_width = $product->size->width; $prod_height = $product->size->height; $prod_weight = $product->shipping_weight; $prod_stock = $prod_stock; $product_destock = (int) $product->destocking; $product_vat = $product->vat; $prod_status = "importing"; $product_recom_price = $product->recommended_retail_price; $str_prod_categories = $prod_categories; if ($dl_update_prod_price == "normal" || $dl_update_prod_price == "dl_per_cost" || $dl_update_prod_price == "dl_per_pvp" || $dl_update_prod_price == "dl_fixed_price") { $prod_price = dl_product_sales_price_calc($prod_price, $prod_cost, $dl_update_price_val, $dl_update_prod_price); } $ffound = false; if (!empty($variation_data)) { $prod_post_id = misha_post_id_by_meta_key_and_value("_sku", $prod_sku . "-var"); $ffound = true; } else { $prod_post_id = misha_post_id_by_meta_key_and_value("_sku", $prod_sku); } $prstatus = get_post_status($prod_post_id); if (!empty($prod_post_id) && ($prstatus === "publish" || $prstatus === "private")) { if ($prstatus === "private" && !$product_destock && $prod_visibility != "hidden") { wp_update_post(array("ID" => $prod_post_id, "post_status" => "publish")); } else { if ($prstatus === "publish" && ($product_destock || $prod_visibility == "hidden")) { offproduct($prod_sku, $prod_title, $dl_update_discontinued_pv, $mailrep); } } $gproduct = wc_get_product($prod_post_id); $new_product_flag = false; if (!empty($variation_data)) { $post = misha_post_id_by_meta_key_and_value("_int_id", (string) (int) $variation_data->item_group_id); $gproduct = wc_get_product($post); if (!$gproduct && $ffound) { update_post_meta($prod_post_id, "_int_id", (string) (int) $variation_data->item_group_id); $post = misha_post_id_by_meta_key_and_value("_int_id", (string) (int) $variation_data->item_group_id); $gproduct = wc_get_product($post); } if (!$gproduct) { $prod_post_id = dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id); $new_product_flag = true; } else { dl_add_variations_to_products($post, $variation_data, (string) $prod_price, (string) $prod_stock, $prod_sku, $dl_update_stock, $dl_update_cost_price, false, $prod_commonvar, (string) $prod_barcode, (string) $prod_cost, (string) $prod_id, $prod_visibility); } } } else { if ($prstatus === "draft") { wp_delete_post($prod_post_id, true); } if (!empty($variation_data)) { $post = misha_post_id_by_meta_key_and_value("_int_id", (string) (int) $variation_data->item_group_id); $gproduct = wc_get_product($post); if (!$gproduct) { $prod_post_id = dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id); $new_product_flag = true; } else { dl_add_variations_to_products($post, $variation_data, (string) $prod_price, (string) $prod_stock, $prod_sku, $dl_update_stock, $dl_update_cost_price, false, $prod_commonvar, (string) $prod_barcode, (string) $prod_cost, (string) $prod_id, $prod_visibility); $counter++; Update_Counters($counter, $prod_sku); continue; } } else { $prod_post_id = dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id); $new_product_flag = true; } } if ($new_product_flag) { if ($dl_update_newp == "no") { $counter++; Update_Counters($counter, $prod_sku); continue; } dl_add_category_to_products($prod_post_id, $str_prod_categories, $dl_catmap, $dl_catmapping); if ($dl_update_categories_new == "yes") { dl_espcategory_to_products($prod_post_id, $prodcatnew, $prod_isnew); } if ($dl_update_categories_sale == "yes") { dl_espcategory_to_products($prod_post_id, $prodcatoffer, $prod_issale); } dl_add_brand_to_products($prod_post_id, $brand); $gproduct = wc_get_product($prod_post_id); if ($gproduct) { $gproduct->set_regular_price((string) $prod_price); $gproduct->set_price((string) $prod_price); $gproduct->set_catalog_visibility($prod_visibility); $gproduct->set_downloadable(false); $gproduct->set_virtual(false); $gproduct->set_purchase_note($prod_purchase_note); $gproduct->set_featured($prod_featured); $gproduct->set_sale_price(''); $gproduct->set_date_on_sale_from(''); $gproduct->set_date_on_sale_to(''); $gproduct->set_sold_individually(false); $gproduct->set_backorders("no"); $gproduct->set_total_sales($prod_total_sales); $gproduct->set_weight((string) $prod_weight); $gproduct->set_length((string) $prod_length); $gproduct->set_width((string) $prod_width); $gproduct->set_height((string) $prod_height); $gproduct->set_stock_quantity($prod_stock); $gproduct->set_stock_status($prod_stock_status); if (!empty($variation_data)) { $gproduct->set_manage_stock(false); $gproduct->set_sku($prod_sku . "-var"); $gproduct->update_meta_data("_int_id", (string) (int) $variation_data->item_group_id); if (!empty($prod_commonvar)) { $gproduct->set_name($prod_commonvar); } else { $gproduct->set_name($prod_title); } } else { $gproduct->set_manage_stock(true); $gproduct->set_sku($prod_sku); } $gproduct->save(); wp_set_object_terms($prod_post_id, $prod_type, "product_type"); } if (!empty($variation_data)) { dl_add_variations_to_products($prod_post_id, $variation_data, (string) $prod_price, (string) $prod_stock, $prod_sku, $dl_update_stock, $dl_update_cost_price, false, $prod_commonvar, (string) $prod_barcode, (string) $prod_cost, (string) $prod_id, $prod_visibility); $prod_post_idvar = wc_get_product_id_by_sku($prod_sku); } } else { $pproduct = wc_get_product($prod_post_id); $needsave = false; if ($pproduct) { if ($dl_update_title == "yes") { if (!empty($variation_data) && !empty($prod_commonvar)) { $pproduct->set_name($prod_commonvar); } else { $pproduct->set_name($prod_title); } $needsave = true; } if ($dl_update_desc == "yes") { $pproduct->set_description($prod_desc); $needsave = true; } if ($dl_update_excerpt == "yes") { $pproduct->set_short_description($prod_excerpt); $needsave = true; } if ($dl_update_stock == "yes") { $pproduct->set_stock_quantity($prod_stock); $needsave = true; } if ($dl_update_cost_price == "yes") { $ssprice = $pproduct->get_sale_price(); $ssdatefrom = $pproduct->get_date_on_sale_from(); $ssdateto = $pproduct->get_date_on_sale_to(); $pproduct->set_regular_price((string) $prod_price); $pproduct->set_price((string) $prod_price); if (!empty($ssprice)) { $pproduct->set_sale_price((string) $ssprice); $pproduct->set_date_on_sale_from((string) $ssdatefrom); $pproduct->set_date_on_sale_to((string) $ssdateto); } $needsave = true; } if ($needsave) { $pproduct->save(); } if ($dl_update_categories == "yes") { $map_product_category = get_option("map_product_category"); dl_add_category_to_products($prod_post_id, $str_prod_categories, $dl_catmap, $dl_catmapping); } if ($dl_update_brands == "yes") { dl_add_brand_to_products($prod_post_id, $brand); } if ($dl_update_categories_new == "yes") { dl_espcategory_to_products($prod_post_id, $prodcatnew, $prod_isnew); } if ($dl_update_categories_sale == "yes") { dl_espcategory_to_products($prod_post_id, $prodcatoffer, $prod_issale); } } } $uproduct = wc_get_product($prod_post_id); if ($uproduct) { $uproduct->update_meta_data("_barcode", (string) $prod_barcode); $uproduct->update_meta_data("_wpm_gtin_code", (string) $prod_barcode); $uproduct->update_meta_data("_costprice", (string) $prod_cost); if (!empty($variation_data)) { $uproduct->update_meta_data("_dlid", (string) $prod_id . "-var"); } else { $uproduct->update_meta_data("_dlid", (string) $prod_id); } $uproduct->set_catalog_visibility($prod_visibility); if (get_option("woocommerce_calc_taxes") === "yes") { $taxes_array = WC_Tax::get_tax_classes(); if ((string) $product_vat == "21.00") { $prod_tax_class = "Standard"; } else { if ((string) $product_vat == "10.00") { $prod_tax_class = $taxes_array[0]; } else { if ((string) $product_vat == "4.00") { $prod_tax_class = $taxes_array[1]; } else { $prod_tax_class = "Standard"; } } } $uproduct->set_tax_class($prod_tax_class); } $uproduct->save(); } $prod_images = $product->images->image; $img_gallery = array(); foreach ($prod_images as $k => $p_img) { $arr_p_img = (array) $p_img; foreach ($arr_p_img as $key => $img_val) { if ($key == "src") { $img_gallery[] = $img_val; } } } $update_imgs = 0; $update_gallery = 5; if ($dl_update_images == "yes" || $new_product_flag) { if ($dl_img_options == "5") { $update_imgs = 1; $update_gallery = 5; } else { if ($dl_img_options == "1") { $update_imgs = 1; $update_gallery = 0; } else { if ($dl_img_options == "0") { $update_imgs = 0; $update_gallery = 0; } else { if ($dl_img_options == "all") { $update_imgs = 1; $update_gallery = count($img_gallery); } else { $update_imgs = 1; $update_gallery = intval($dl_img_options); } } } } } else { $update_imgs = 0; } if ($prod_post_id != "0" || $prod_post_id != 0) { if (intval($update_imgs) > 0) { ssdl_attach_product_thumbnail($prod_post_id, $img_gallery[0], 0); for ($i = 1; $i < count($img_gallery); $i++) { if (intval($update_gallery) <= $i) { break; } ssdl_attach_product_thumbnail($prod_post_id, $img_gallery[$i], 1); } } if ($new_product_flag) { if (empty($variation_data) && ($product_destock || $prod_visibility == "hidden")) { wp_update_post(array("ID" => $prod_post_id, "post_status" => "private")); } else { wp_update_post(array("ID" => $prod_post_id, "post_status" => "publish")); } } } $counter++; Update_Counters($counter, $prod_sku); } if ($dl_update_discontinued_pv != "none") { $lastpage = 500; $oldlastpage = get_option("del_lastpage"); if (!empty($oldlastpage)) { $lastpage = $oldlastpage; } for ($apr = $lastpage; $apr >= 1; $apr--) { $args = array("post_type" => "product", "post_status" => "publish", "posts_per_page" => 100, "paged" => $apr); $products = get_posts($args); foreach ($products as $key => $product) { $prod_post_id = $product->ID; $dlid = get_post_meta($prod_post_id, "_dlid"); if ($dl_update_discontinued_pv == "yes") { if (!empty($dlid[0]) && !in_array($dlid[0], $nowlist)) { $fproduct = wc_get_product($prod_post_id); $tempname = $fproduct->get_title(); $tempsku = $fproduct->get_sku(); if ($fproduct->get_type() == "variable") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "_dlid"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "0", "set"); update_post_meta($vchild[$vpi], "_stock", "0"); wp_trash_post($vchild[$vpi]); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wc_update_product_stock($prod_post_id, "0", "set"); update_post_meta($prod_post_id, "_stock", "0"); wp_update_post(array("ID" => $prod_post_id, "post_status" => "private")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . $tempsku . " " . $tempname . "\xd\xa"; update_option("list_disable_product", $oldpr); } } $mproduct = str_replace("-var", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wc_update_product_stock($prod_post_id, "0", "set"); update_post_meta($prod_post_id, "_stock", "0"); wp_update_post(array("ID" => $prod_post_id, "post_status" => "private")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . $tempsku . " " . $tempname . "
"; update_option("list_disable_product", $oldpr); } } } } else { if ($dl_update_discontinued_pv == "no") { if (!empty($dlid[0]) && !in_array($dlid[0], $nowlist)) { $fproduct = wc_get_product($prod_post_id); $tempname = $fproduct->get_title(); $tempsku = $fproduct->get_sku(); if ($fproduct->get_type() == "variable") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "_dlid"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "0", "set"); update_post_meta($vchild[$vpi], "_stock", "0"); wp_trash_post($vchild[$vpi]); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wp_update_post(array("ID" => $prod_post_id, "post_status" => "importing")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . $tempsku . " " . $tempname . "
\xa"; update_option("list_disable_product", $oldpr); } } $mproduct = str_replace("-var", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wp_update_post(array("ID" => $prod_post_id, "post_status" => "importing")); if (!empty($mailrep)) { $oldpr = get_option("list_disable_product"); $oldpr = $oldpr . $tempsku . " " . $tempname . "
\xa"; update_option("list_disable_product", $oldpr); } } } } } } update_option("del_lastpage", $apr); } update_option("del_lastpage", 500); } $oldpr = get_option("list_disable_product"); if (!empty($oldpr)) { send_debug_email(__("Products Disabled:", "dl_import_products"), $oldpr); update_option("list_disable_product", ''); } update_option("status_import", 2); update_option("end_import_date", date("d/m/Y - H:i:s")); update_option("last_sku", ''); add_filter("content_save_pre", "wp_filter_post_kses"); add_filter("content_filtered_save_pre", "wp_filter_post_kses"); clean_product_incomplete(); } } goto ALyND; g1bd4: function clean_product_incomplete() { global $wpdb; $ids = $wpdb->delete($wpdb->posts, array("post_type" => "product", "post_status" => "importing")); } goto f9jry; Ch8ws: function my_generate_attachment_metadata_p($attachment_id, $file) { $attachment = get_post($attachment_id); $metadata = array(); if (preg_match("!^image/!", get_post_mime_type($attachment)) && file_is_displayable_image($file)) { $imagesize = getimagesize($file); $metadata["width"] = $imagesize[0]; $metadata["height"] = $imagesize[1]; list($uwidth, $uheight) = wp_constrain_dimensions($metadata["width"], $metadata["height"], 128, 96); $metadata["hwstring_small"] = "height='{$uheight}' width='{$uwidth}'"; $metadata["file"] = _wp_relative_upload_path($file); $image_meta = wp_read_image_metadata($file); if ($image_meta) { $metadata["image_meta"] = $image_meta; } } return apply_filters("wp_generate_attachment_metadata", $metadata, $attachment_id); } goto vkDuG; fRioq: function dl_add_brand_to_products($post_id, $brand) { $tag = array(); $taxbrand = get_option("dl_btax"); $branda = str_replace(array("<![CDATA[", "]]>"), array('', ''), $brand); $brande = explode("|", $brand); $total = count($brande); if (empty($brand) || empty($taxbrand)) { return; } if (!term_exists(sanitize_title(clean_text($brand)), $taxbrand)) { if (count($brande) > 1) { $TSlug = $brande[0]; for ($i = 1; $i < count($brande); $i++) { $padre = clean_text($brande[$i - 1]); $term_s = get_term_by("slug", sanitize_title(clean_text($TSlug)), $taxbrand); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), $taxbrand, array("slug" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["term_id"]; array_push($tag, $term_s["term_id"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "|" . $brande[$i]; $hijo = clean_text($brande[$i]); if (!term_exists(sanitize_title($TSlug), $taxbrand)) { $term = Create_Brand_Parent($term_id, $hijo, $TSlug, $taxbrand); array_push($tag, $term["term_id"]); } else { $term = get_term_by("slug", sanitize_title(clean_text($TSlug)), $taxbrand); array_push($tag, $term->term_id); } } } else { $term = wp_insert_term(clean_text(strval($brande[$total - 1])), $taxbrand, array("slug" => sanitize_title(clean_text(strtolower($brand))))); array_push($tag, $term["term_id"]); } } else { if (count($brande) > 1) { $TSlug = $brande[0]; for ($i = 1; $i < count($brande); $i++) { $padre = clean_text($brande[$i - 1]); $term_s = get_term_by("slug", sanitize_title(clean_text($TSlug)), $taxbrand); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), $taxbrand, array("slug" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["term_id"]; array_push($tag, $term_s["term_id"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "|" . $brande[$i]; $hijo = clean_text($brande[$i]); if (!term_exists(sanitize_title($TSlug), $taxbrand)) { $term = Create_Brand_Parent($term_id, $hijo, $TSlug, $taxbrand); array_push($tag, $term["term_id"]); } else { $term = get_term_by("slug", sanitize_title(clean_text($TSlug)), $taxbrand); array_push($tag, $term->term_id); } } } else { $term = get_term_by("slug", sanitize_title(clean_text($brande[$total - 1])), $taxbrand); if (!$term) { $term = wp_insert_term(clean_text(strval($brande[$total - 1])), $taxbrand, array("slug" => sanitize_title(clean_text(strtolower($brand))))); array_push($tag, $term["term_id"]); } else { array_push($tag, $term->term_id); } } } wp_set_object_terms($post_id, $tag, $taxbrand); } goto C6qNQ; ALyND: if (trim(get_option("dl_update_xml_url")) != '') { $status_import = get_option("status_import", 0); $last_time = get_option("last_update_import_time", 0); $allowimport = get_option("dl_update_import"); $crontime = (int) get_option("dl_cron"); $to_check = time() - 10; if ($allowimport == "yes") { if ($last_time <= $to_check) { $pid = getmypid(); update_option("last_pid", $pid); if ($status_import == 0 || $status_import == 3) { update_option("status_import", 1); update_option("start_import_time", time()); update_option("start_import_datec", date("Y/m/d H:i:s")); $resume = false; update_option("next_import", time() + 3600 * $crontime); update_products($resume); } else { if ($status_import == 1) { $resume = true; update_products($resume); } else { if ($status_import == 2) { $next_import = get_option("next_import"); $now = time(); if ($now >= $next_import) { update_option("status_import", 1); update_option("start_import_time", time()); update_option("start_import_date", date("d/m/Y - H:i:s")); update_option("start_import_datec", date("Y/m/d H:i:s")); $resume = false; update_option("next_import", time() + 3600 * $crontime); update_products($resume); } } } } } } } goto YrHLL; YrHLL:  
	?>

Did this file decode correctly?

Original Code

<?php
	require_once(rtrim($_SERVER['DOCUMENT_ROOT'], '/') . str_replace("wp-content/plugins/dl_import_products/".basename(__FILE__),"",$_SERVER['REQUEST_URI']).'wp-load.php');
	require_once(ABSPATH . 'wp-admin/includes/image.php');

	goto smtds; jHReb: function Update_Counters($counter, $prod_sku) { update_option("\x74\x6f\164\141\154\137\x70\x72\x6f\x64\165\x63\x74\137\151\x70", $counter); update_option("\154\141\163\164\x5f\x75\x70\144\x61\x74\x65\x5f\x69\x6d\160\157\x72\x74\x5f\x64\x61\x74\145", date("\x64\57\155\57\131\x20\55\x20\x48\x3a\x69\72\163")); update_option("\x6c\x61\163\164\137\165\160\144\x61\x74\145\137\151\x6d\160\157\x72\x74\137\x74\x69\x6d\x65", time()); update_option("\x6c\141\163\164\x5f\x73\153\x75", $prod_sku); } goto uRx7N; khOJ_: function clean_CData($chain) { $final_chain = str_replace(array("\74\41\x5b\x43\104\101\124\x41\133", "\135\135\x3e"), array('', ''), $chain); return $final_chain; } goto jHReb; V8zdF: function misha_post_id_by_meta_key_and_value($meta_key, $meta_value) { global $wpdb; $ids = $wpdb->get_col($wpdb->prepare("\x53\105\x4c\105\x43\124\40\160\x6f\163\x74\137\x69\x64\x20\106\122\117\115\x20{$wpdb->postmeta}\40\x57\110\x45\x52\x45\40\x6d\x65\x74\141\x5f\153\145\x79\40\75\x20\45\x73\40\x41\116\x44\x20\155\x65\x74\x61\x5f\166\141\154\165\x65\40\75\40\45\163", $meta_key, $meta_value)); if (count($ids) > 1) { return $ids[count($ids) - 1]; } else { if (count($ids) == 0) { return ''; } else { return $ids[0]; } } } goto g1bd4; yByqU: function clean_text($texto, $clean = true, $charlimit = null) { $texto = trim($texto); $texto = html_entity_decode($texto, ENT_QUOTES); $texto = trim(preg_replace("\x2f\134\x74\x2b\x2f", '', $texto)); $texto = addslashes($texto); if ($clean) { $texto = strip_tags($texto); } $texto = preg_replace("\x2f\133\134\170\173\62\x30\x30\102\175\55\x5c\x78\x7b\x32\x30\x30\x44\x7d\x5d\x2f\x75", '', $texto); $texto = preg_replace("\57\133\x5c\170\173\x32\60\x30\x42\175\55\134\170\173\x32\60\60\x44\x7d\x5c\170\173\x46\105\x46\106\175\135\x2f\165", '', $texto); $texto = str_replace("\342\x80\214", '', $texto); $texto = str_replace("\46\x23\70\62\x30\63\73", '', $texto); $texto = str_replace(array("\xd\xa", "\12", "\xd"), "\x3c\142\x72\x3e", $texto); $texto = str_replace("\x5c\x5c\162", "\x3c\x62\162\76", $texto); $texto = str_replace("\134\x72", "\74\142\x72\76", $texto); $texto = str_replace("\xd", "\x3c\142\x72\76", $texto); $texto = str_replace("\157\x6e\x63\x6c\x69\x63\153", "\x69\x64", $texto); $texto = str_replace(array("\x5c", "\xc2\xa8", "\xc2\272", "\342\x80\x93", "\x7e", "\x7c", "\302\xb7", "\46", "\302\277", "\136", "\302\250", "\xc2\264", "\43"), '', $texto); $texto = str_replace(array("\134", "\342\x80\231"), '', $texto); if ($charlimit > 0) { $texto = substr($texto, 0, $charlimit); } return $texto; } goto khOJ_; smtds: function send_debug_email($subject = '', $message = '') { $to = get_option("\144\x6c\x5f\x75\x70\144\141\x74\145\137\160\x76\x5f\145\x6d\x61\151\x6c"); if (!empty($to)) { wp_mail($to, $subject, $message); } } goto STT7b; uRx7N: function offproduct($prod_sku, $prod_title, $dl_update_discontinued_pv, $mailrep) { $prod_post_id = wc_get_product_id_by_sku($prod_sku); if (get_post_status($prod_post_id) === "\160\165\142\x6c\x69\x73\150") { $dlid = get_post_meta($prod_post_id, "\x5f\x64\154\x69\144"); if (!empty($dlid[0])) { if ($dl_update_discontinued_pv == "\171\145\x73") { $fproduct = wc_get_product($prod_post_id); if ($fproduct->get_type() == "\166\141\x72\151\141\x62\154\145") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "\137\144\x6c\151\144"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "\60", "\x73\x65\x74"); update_post_meta($vchild[$vpi], "\137\x73\164\x6f\x63\153", "\60"); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wc_update_product_stock($prod_post_id, "\60", "\163\x65\164"); update_post_meta($prod_post_id, "\137\x73\164\157\143\153", "\x30"); wp_update_post(array("\111\104" => $prod_post_id, "\160\157\x73\164\137\163\164\x61\x74\165\163" => "\160\x72\151\x76\141\x74\145")); if (!empty($mailrep)) { $oldpr = get_option("\154\x69\x73\164\x5f\x64\x69\x73\141\142\154\x65\x5f\x70\x72\x6f\144\x75\x63\164"); $oldpr = $oldpr . "\52" . $prod_sku . "\40" . $prod_title . "\xd\xa"; update_option("\x6c\151\163\x74\137\x64\x69\x73\141\142\x6c\x65\137\x70\x72\x6f\144\x75\x63\x74", $oldpr); } } $mproduct = str_replace("\55\166\141\162", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wc_update_product_stock($prod_post_id, "\x30", "\x73\145\x74"); update_post_meta($prod_post_id, "\137\x73\164\157\x63\153", "\x30"); wp_update_post(array("\x49\104" => $prod_post_id, "\160\157\x73\x74\137\163\x74\141\164\165\163" => "\160\162\151\166\x61\x74\145")); if (!empty($mailrep)) { $oldpr = get_option("\154\151\163\164\x5f\144\x69\x73\141\x62\154\x65\x5f\160\x72\157\x64\165\x63\x74"); $oldpr = $oldpr . "\x2a\x2a" . $prod_sku . "\40" . $prod_title . "\xd\12"; update_option("\x6c\x69\x73\x74\137\144\151\163\x61\x62\154\x65\137\160\x72\157\x64\x75\143\164", $oldpr); } } } else { if ($dl_update_discontinued_pv == "\156\157") { $fproduct = wc_get_product($prod_post_id); if ($fproduct->get_type() == "\x76\x61\x72\151\x61\x62\154\x65") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "\137\144\154\151\144"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "\x30", "\163\x65\x74"); update_post_meta($vchild[$vpi], "\137\x73\164\x6f\143\153", "\60"); wp_trash_post($vchild[$vpi]); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wp_update_post(array("\111\x44" => $prod_post_id, "\160\x6f\x73\x74\x5f\163\164\141\x74\x75\x73" => "\x69\155\160\157\162\x74\151\156\x67")); if (!empty($mailrep)) { $oldpr = get_option("\154\151\163\164\137\x64\x69\x73\141\x62\154\145\137\160\x72\157\144\165\x63\164"); $oldpr = $oldpr . "\x2d" . $prod_sku . "\40" . $prod_title . "\xd\12"; update_option("\x6c\151\163\x74\137\x64\151\x73\141\142\154\x65\137\160\162\157\144\x75\x63\164", $oldpr); } } $mproduct = str_replace("\55\x76\x61\x72", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wp_update_post(array("\111\x44" => $prod_post_id, "\160\157\x73\164\137\163\x74\x61\x74\x75\163" => "\151\x6d\x70\x6f\162\x74\151\x6e\x67")); if (!empty($mailrep)) { $oldpr = get_option("\154\151\163\x74\137\144\x69\x73\141\142\x6c\145\137\160\x72\157\x64\x75\x63\164"); $oldpr = $oldpr . "\55\55" . $prod_sku . "\x20" . $prod_title . "\xd\12"; update_option("\154\x69\x73\164\x5f\144\x69\163\x61\142\154\145\137\160\162\157\x64\165\143\164", $oldpr); } } } } } } } goto uZKBm; STT7b: function dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id) { $xml_post = array("\151\x6d\160\157\162\164\137\x69\144" => $prod_id, "\160\x6f\163\164\137\x61\x75\x74\150\x6f\x72" => $prod_author, "\160\157\x73\164\137\x63\157\156\164\145\x6e\164" => $prod_desc, "\160\157\163\x74\x5f\x73\164\x61\164\165\x73" => $prod_status, "\x70\157\163\x74\137\x74\x69\164\154\x65" => $prod_title, "\160\x6f\x73\x74\137\x70\x61\162\x65\x6e\164" => $prod_parent, "\160\157\x73\164\x5f\164\171\x70\x65" => $prod_post_type, "\x70\157\x73\x74\137\x65\x78\x63\145\x72\x70\164" => $prod_excerpt); $prod_post_id = wp_insert_post($xml_post); return $prod_post_id; } goto V8zdF; f9jry: function save_product_attribute_from_name($name, $label = '', $set = true) { if (!function_exists("\147\x65\164\x5f\141\x74\x74\x72\x69\x62\x75\x74\x65\137\x69\x64\137\x66\162\x6f\155\x5f\x6e\141\155\x65")) { return; } global $wpdb; $label = $label == '' ? ucfirst($name) : $label; $attribute_id = get_attribute_id_from_name($name); if (empty($attribute_id)) { $attribute_id = NULL; } else { $set = false; } $args = array("\141\164\164\x72\x69\x62\165\x74\x65\137\151\x64" => $attribute_id, "\x61\164\x74\x72\151\x62\x75\164\145\137\x6e\141\x6d\145" => $name, "\x61\164\164\x72\x69\x62\x75\x74\x65\137\154\x61\x62\145\x6c" => $label, "\x61\164\164\x72\151\x62\165\x74\145\137\164\x79\160\x65" => "\x73\145\x6c\x65\143\x74", "\x61\164\164\x72\x69\x62\165\164\145\x5f\157\162\x64\145\x72\x62\x79" => "\155\145\156\165\x5f\x6f\162\x64\x65\162", "\x61\x74\164\x72\151\142\165\x74\x65\137\160\x75\x62\x6c\x69\143" => 0); if (empty($attribute_id)) { $wpdb->insert($wpdb->prefix . "\167\157\x6f\x63\x6f\155\155\145\162\143\x65\137\141\x74\164\162\151\x62\x75\164\x65\137\x74\141\170\x6f\x6e\x6f\155\x69\145\x73", $args); do_action("\x77\x6f\157\x63\x6f\x6d\155\145\162\x63\145\x5f\141\164\x74\x72\x69\142\x75\164\145\137\141\144\144\145\144", $wpdb->insert_id, $args); flush_rewrite_rules(); delete_transient("\167\x63\137\x61\x74\x74\x72\151\142\x75\x74\145\137\x74\141\x78\x6f\x6e\157\x6d\151\x65\x73"); } } goto oK1lq; C6qNQ: function Create_Brand_Parent($pTerm, $Name, $SName, $taxo) { $slug = sanitize_title(clean_text(strtolower($SName))); $term = wp_insert_term($Name, $taxo, array("\163\154\x75\x67" => $slug, "\x70\x61\x72\x65\156\x74" => intval($pTerm))); return $term; } goto JxmNa; lCYF0: function ssdl_attach_product_thumbnail($post_id, $url, $flag) { if (preg_match("\x2f\x28\x5c\x2e\x6a\160\147\x7c\134\x2e\x70\x6e\x67\174\x5c\56\142\x6d\160\174\134\56\x6a\x70\145\147\x7c\x5c\x2e\147\x69\146\x29\x24\57", $url)) { $url_array = explode("\57", $url); $image_name = $url_array[count($url_array) - 1]; $filename = basename($image_name); $uploads = wp_upload_dir(); $path = $uploads["\142\x61\163\x65\144\151\162"] . "\57\144\x6c"; if (!file_exists($path)) { mkdir($extract_path, 493, true); } $imgs = $path . "\x2f\x69\155\x67"; if (!file_exists($imgs)) { mkdir($imgs, 493, true); } $sfile = "\x64\x6c\57\x69\155\147\57" . $filename; $file = $imgs . "\57" . $filename; $Seek = SeekImg($sfile); if (count($Seek) > 0 && file_exists($file)) { $itotal = count($Seek); $attach_id = $Seek[$itotal - 1]->post_id; } else { $image_data = file_get_contents($url); $save_img = fopen($file, "\167"); fwrite($save_img, $image_data); fclose($save_img); set_post_thumbnail_size(150, 150); $wp_filetype = wp_check_filetype($filename, null); $attachment = array("\x70\157\x73\x74\137\x6d\x69\155\x65\x5f\164\171\x70\x65" => $wp_filetype["\164\171\x70\x65"], "\x70\x6f\163\x74\137\164\151\164\154\145" => sanitize_file_name($filename), "\160\157\163\164\137\143\x6f\x6e\x74\145\156\164" => '', "\160\x6f\x73\x74\137\163\164\141\164\165\x73" => "\x69\156\150\x65\162\x69\164"); $attach_id = wp_insert_attachment($attachment, $file, $post_id); $attach_data = my_generate_attachment_metadata_p($attach_id, $file); wp_update_attachment_metadata($attach_id, $attach_data); } if ($flag == 0) { set_post_thumbnail($post_id, $attach_id); update_post_meta($post_id, "\x5f\x70\162\157\144\165\143\164\137\x69\155\x61\x67\145\x5f\x67\141\x6c\x6c\x65\162\x79", ''); } if ($flag == 1) { $attach_id_array = get_post_meta($post_id, "\x5f\160\162\157\x64\165\x63\164\137\151\x6d\x61\147\x65\137\147\x61\154\x6c\x65\162\x79", true); if (strlen($attach_id_array) > 0) { $attach_id_array .= "\54" . $attach_id; } else { $attach_id_array .= $attach_id; } update_post_meta($post_id, "\137\160\162\157\144\165\x63\x74\137\x69\x6d\141\x67\x65\x5f\x67\x61\x6c\x6c\145\162\x79", $attach_id_array); } } } goto Ch8ws; WmpMD: function dl_add_variations_to_products($postid, $prod_visibility, $variation_data, $price, $stock, $sku, $dl_update_stock, $dl_update_cost_price, $iscreate = false, $prod_commonvar = '', $barcode = '', $costprice = '', $prodid = '') {
    $product_type = "\160\162\x6f\x64\165\143\x74\x5f\166\141\x72\151\141\164\151\157\x6e";
    $variation_prod = (string) $variation_data->common_title;
    $json_string = json_encode($variation_data);
    $result_array = json_decode($json_string, TRUE);
    $product = wc_get_product($postid); if ($product) { if (!empty($prod_commonvar)) { $product->set_name($prod_commonvar); } $allattr = $product->get_attributes(); $agroup = array(); $aname = array(); $avalue = array(); $exist = false; for ($i = 1; $i <= 2; $i++) { if (array_key_exists("\x76\x61\162\137\147\162\x6f\x75\x70\x6e\141\x6d\x65\x5f" . $i, $result_array)) { $var_key = "\x76\141\x72\137\147\162\x6f\x75\x70\x6e\x61\x6d\x65\137" . $i; $agroup[$i] = (string) clean_text(clean_Cdata($variation_data->{$var_key})); $exist = true; } else { $agroup[$i] = "\40"; } if (array_key_exists("\166\x61\162\x5f\156\x61\x6d\145\x5f" . $i, $result_array)) { $var_key = "\166\141\162\137\156\x61\155\145\137" . $i; $aname[$i] = (string) clean_text(clean_Cdata($variation_data->{$var_key})); $exist = true; } else { $aname[$i] = ''; } if (array_key_exists("\x76\141\162\x5f\x76\141\154\165\145\137" . $i, $result_array)) { $var_key = "\x76\x61\162\137\x76\141\x6c\x75\145\137" . $i; $avalue[$i] = (string) clean_text(clean_Cdata($variation_data->{$var_key})); $exist = true; } else { $avalue[$i] = ''; } } $product_attributes = array(); if ($aname[2] !== '') { $allval = ''; for ($i = 1; $i <= 2; $i++) { $group = $agroup[$i]; $name = $aname[$i]; $value = $avalue[$i]; if (!empty($value)) { $taxonomy = wc_attribute_taxonomy_name($name); $attr_label = ucfirst($name); $attr_name = wc_sanitize_taxonomy_name($name); if (!taxonomy_exists($taxonomy)) { save_product_attribute_from_name($attr_name, $attr_label); } $term_name = ucfirst($value); $term_slug = sanitize_title($value); $product_attributes[$taxonomy] = array("\x6e\141\x6d\x65" => $taxonomy, "\x76\141\x6c\165\x65" => $value, "\157\160\x74\151\x6f\x6e\163" => $term_slug, "\x70\x6f\163\x69\164\x69\x6f\156" => '', "\x69\163\x5f\166\151\163\151\x62\154\x65" => 1, "\151\163\x5f\x76\141\162\151\x61\164\x69\157\x6e" => 1, "\151\x73\x5f\x74\141\x78\157\x6e\x6f\x6d\x79" => 1); if (!term_exists($value, $taxonomy)) { wp_insert_term($term_name, $taxonomy, array("\163\154\x75\147" => $term_slug)); } wp_set_post_terms($postid, $term_name, $taxonomy, true); } } update_post_meta($postid, "\137\160\x72\x6f\x64\x75\x63\x74\137\141\x74\164\x72\151\142\165\164\x65\163", $product_attributes); $varid = wc_get_product_id_by_sku($sku); $variation = wc_get_product($varid); if (!$variation || $iscreate) { $variation = new WC_Product_Variation(); $variation->set_parent_id($product->get_id()); if ($sku !== $product->get_sku()) { $variation->set_sku($sku); $variation->set_manage_stock(true); } $variation->set_stock_quantity($stock); $variation->set_price($price); $variation->set_regular_price($price); } if ($dl_update_stock == "\x79\x65\x73") { $variation->set_stock_quantity($stock); } if ($dl_update_cost_price == "\171\x65\163") { $variation->set_price($price); $variation->set_regular_price($price); $ssprice = $variation->get_sale_price(); $ssdatefrom = $variation->get_date_on_sale_from(); $ssdateto = $variation->get_date_on_sale_to(); if (!empty($ssprice)) { $variation->set_sale_price((string) $ssprice); $variation->set_date_on_sale_from((string) $ssdatefrom); $variation->set_date_on_sale_to((string) $ssdateto); } } if ($prod_visibility == "\150\151\x64\144\145\x6e") { $variation->set_status("\x70\x72\151\x76\x61\x74\x65"); } else { $variation->set_status("\160\165\142\154\151\163\150"); } $variation->update_meta_data("\137\x62\x61\162\143\157\x64\x65", (string) $barcode); $variation->update_meta_data("\x5f\167\160\155\137\147\x74\x69\x6e\137\143\157\144\145", (string) $barcode); $variation->update_meta_data("\x5f\x63\x6f\163\164\160\x72\151\143\145", (string) $costprice); $variation->update_meta_data("\x5f\x64\154\151\144", (string) $prodid); $variation->save(); $myvarid = $variation->get_id(); update_post_meta($myvarid, "\141\x74\x74\162\x69\142\x75\164\x65\137" . wc_attribute_taxonomy_name($aname[1]), sanitize_title($avalue[1])); update_post_meta($myvarid, "\141\164\x74\x72\x69\142\x75\x74\x65\x5f" . wc_attribute_taxonomy_name($aname[2]), sanitize_title($avalue[2])); } else { for ($i = 1; $i <= 1; $i++) { $group = $agroup[$i]; $name = $aname[$i]; $value = $avalue[$i]; if (!empty($value)) { $taxonomy = wc_attribute_taxonomy_name($name); $attr_label = ucfirst($name); $attr_name = wc_sanitize_taxonomy_name($name); if (!taxonomy_exists($taxonomy)) { save_product_attribute_from_name($attr_name, $attr_label); } $product_attributes[$taxonomy] = array("\156\x61\x6d\x65" => $taxonomy, "\x76\x61\x6c\165\145" => $value, "\157\160\x74\x69\x6f\156\163" => $term_slug, "\x70\157\163\151\x74\151\157\x6e" => '', "\x69\163\137\x76\x69\163\x69\142\x6c\x65" => 1, "\x69\x73\x5f\x76\x61\x72\x69\x61\164\x69\157\156" => 1, "\x69\163\x5f\x74\141\170\157\156\x6f\155\x79" => 1); $term_name = ucfirst($value); $term_slug = sanitize_title($value); if (!term_exists($value, $taxonomy)) { wp_insert_term($term_name, $taxonomy, array("\163\154\x75\x67" => $term_slug)); } wp_set_post_terms($postid, $term_name, $taxonomy, true); } } update_post_meta($postid, "\x5f\x70\x72\x6f\x64\165\143\x74\137\141\x74\x74\x72\x69\x62\165\x74\x65\163", $product_attributes); $product->save(); $varid = wc_get_product_id_by_sku($sku); $variation = wc_get_product($varid); if (!$variation) { $variation = new WC_Product_Variation(); $variation->set_parent_id($product->get_id()); if ($sku !== $product->get_sku()) { $variation->set_sku($sku); $variation->set_manage_stock(true); } $variation->set_stock_quantity($stock); $variation->set_price($price); $variation->set_regular_price($price); $ssprice = $variation->get_sale_price(); $ssdatefrom = $variation->get_date_on_sale_from(); $ssdateto = $variation->get_date_on_sale_to(); if (!empty($ssprice)) { $variation->set_sale_price((string) $ssprice); $variation->set_date_on_sale_from((string) $ssdatefrom); $variation->set_date_on_sale_to((string) $ssdateto); } } if ($dl_update_stock == "\x79\145\163") { $variation->set_stock_quantity($stock); } if ($dl_update_cost_price == "\x79\145\x73") { $variation->set_price($price); $variation->set_regular_price($price); } if ($prod_visibility == "\x68\x69\144\x64\x65\156") { $variation->set_status("\x70\162\x69\166\x61\x74\x65"); } else { $variation->set_status("\x70\x75\142\154\x69\x73\x68"); } $variation->update_meta_data("\137\142\x61\x72\x63\x6f\x64\x65", (string) $barcode); $variation->update_meta_data("\137\x77\x70\155\137\x67\x74\x69\156\x5f\x63\157\x64\145", (string) $barcode); $variation->update_meta_data("\137\143\157\x73\x74\x70\x72\x69\x63\x65", (string) $costprice); $variation->update_meta_data("\x5f\x64\154\x69\x64", (string) $prodid); $variation->save(); $myvarid = $variation->get_id(); update_post_meta($myvarid, "\141\x74\164\162\151\142\x75\164\x65\137" . wc_attribute_taxonomy_name($aname[1]), sanitize_title($avalue[1])); } } } goto lCYF0; ilwXR: function load_xml_file() { $xml_url = get_option("\144\154\x5f\165\x70\144\141\164\145\137\x78\x6d\x6c\x5f\x75\x72\154", true); if (!filter_var($xml_url, FILTER_VALIDATE_URL)) { echo "\x49\156\166\141\154\151\x64\x20\x55\122\x4c\15\12"; } else { $uploads = wp_upload_dir(); $extract_path = $uploads["\142\141\x73\145\x64\x69\x72"] . "\x2f\144\x6c"; if (!file_exists($extract_path)) { mkdir($extract_path, 493, true); } $extracted_xmls = $extract_path . "\57\x78\155\x6c\x2f"; if (!file_exists($extracted_xmls)) { mkdir($extracted_xmls, 484, true); } $extract_dir = $extract_path . "\x2f\x7a\x69\160\x2f"; if (!file_exists($extract_dir)) { mkdir($extract_dir, 484, true); } $dlp_new_xml_zip = $extract_dir . "\57\x78\155\154\137\160\162\157\144\165\143\164\163\x2e\x7a\x69\160"; $file = file_put_contents($dlp_new_xml_zip, fopen($xml_url, "\162")); if ($file) { $zip = new ZipArchive(); if ($zip->open($dlp_new_xml_zip) != "\x74\x72\165\145") { echo "\125\156\141\x62\x6c\x65\x20\164\x6f\40\157\160\145\156\40\164\150\x65\x20\132\x69\160\x20\x46\151\154\x65\x2e\xd\12"; } else { $zip->extractTo($extracted_xmls); $zip->close(); $dlp_simplexml = simplexml_load_file($extracted_xmls . "\170\155\x6c\137\60\60\x31\56\170\x6d\x6c"); return $dlp_simplexml; } } return $dlp_simplexml; } } goto yByqU; oK1lq: function get_attribute_id_from_name($name) { global $wpdb; $attribute_id = $wpdb->get_col("\x53\x45\114\x45\103\124\40\x61\x74\x74\162\151\142\165\164\x65\x5f\151\144\xa\x9\40\40\40\x20\x46\122\117\115\x20{$wpdb->prefix}\167\x6f\157\x63\x6f\155\155\145\162\x63\x65\x5f\x61\164\x74\162\151\142\x75\x74\145\137\164\141\x78\x6f\x6e\x6f\x6d\x69\145\x73\12\11\x20\40\40\x20\127\x48\105\x52\x45\x20\x61\x74\164\x72\151\x62\165\x74\145\137\x6e\141\155\x65\x20\114\x49\x4b\x45\x20\47{$name}\47"); return reset($attribute_id); } goto WmpMD; JxmNa: function dl_product_sales_price_calc($dl_product_price, $dl_cost_price, $n, $product_price_type) { $dl_product_price = floatval($dl_product_price); $dl_cost_price = floatval($dl_cost_price); $n = floatval($n); $product_price_type = trim($product_price_type); $dl_new_product_price = 0; if ($product_price_type == "\144\154\x5f\160\145\x72\x5f\x63\x6f\x73\x74") { $dl_new_product_price = $dl_cost_price * (1 + $n / 100); } elseif ($product_price_type == "\144\x6c\x5f\x70\x65\x72\x5f\x70\166\x70") { $dl_new_product_price = $dl_product_price * (1 + $n / 100); } elseif ($product_price_type == "\144\x6c\x5f\x66\x69\x78\145\144\x5f\x70\x72\x69\143\x65") { $dl_new_product_price = $dl_product_price + $n; } else { $dl_new_product_price = $dl_product_price; } return strval($dl_new_product_price); } goto ilwXR; vkDuG: function SeekImg($imgname) { global $wpdb; $sql = $wpdb->prepare("\x53\x45\x4c\x45\103\x54\40\160\157\x73\x74\137\151\x64\40\106\122\x4f\x4d\x20{$wpdb->postmeta}\40\xa\11\x9\x20\40\x20\x20\40\40\x20\40\40\127\x48\x45\x52\105\x20\155\x65\x74\141\x5f\153\145\171\x20\75\x20\47\137\x77\x70\x5f\141\164\164\x61\143\150\145\144\137\146\x69\x6c\145\x27\40\x41\x4e\104\40\x6d\145\164\141\x5f\166\x61\x6c\165\145\x20\75\40\45\163", $imgname); $post_id = $wpdb->get_results($sql); return $post_id; } goto NhjVP; Ud7W3: function Create_Cats_Parent($pTerm, $Name, $SName) { $slug = sanitize_title(clean_text(strtolower($SName))); $term = wp_insert_term($Name, "\160\162\157\144\165\x63\x74\137\143\x61\x74", array("\163\x6c\x75\x67" => $slug, "\x70\141\162\x65\156\164" => intval($pTerm))); return $term; } goto fRioq; NhjVP: function dl_espcategory_to_products($post_id, $prod_categories, $acc) { $tag = array(); $oldtag = wp_get_object_terms($post_id, "\160\162\x6f\144\x75\x63\164\x5f\143\141\164"); $cat_vals = $prod_categories; if ($acc == "\61") { if (!term_exists(sanitize_title(clean_text($cat_vals)), "\x70\162\x6f\144\165\143\x74\137\143\141\164")) { $slug = sanitize_title(clean_text(strtolower($cat_vals))); $term = wp_insert_term($cat_vals, "\160\x72\x6f\x64\165\143\x74\x5f\x63\141\164", array("\x73\x6c\165\x67" => $slug)); $term_id = $term["\164\x65\x72\x6d\x5f\151\144"]; } else { $term_s = get_term_by("\x73\x6c\x75\147", sanitize_title(clean_text($cat_vals)), "\x70\162\x6f\x64\x75\143\164\x5f\x63\141\164"); $term_id = $term_s->term_id; } foreach ($oldtag as $ootag) { $oterm = $ootag->term_id; array_push($tag, $oterm); } array_push($tag, $term_id); } else { $Sslug = sanitize_title(clean_text($prod_categories)); foreach ($oldtag as $ootag) { if ($ootag->slug != $Sslug) { $oterm = $ootag->term_id; array_push($tag, $oterm); } } } wp_set_object_terms($post_id, $tag, "\160\x72\x6f\x64\x75\x63\164\137\x63\x61\164"); } goto iG_Xt; iG_Xt: function dl_add_category_to_products($post_id, $prod_categories, $catmap, $catmapping) { $tag = array(); foreach ($prod_categories->category as $cat_vals) { $cat_valsa = str_replace(array("\74\41\133\103\104\x41\124\x41\133", "\135\x5d\x3e"), array('', ''), $cat_vals); $cat_valse = explode("\x7c", $cat_vals); $total = count($cat_valse); if ($catmap == 1) { $catfound = false; $CSlug = $cat_valse[0]; for ($i = 0; $i < count($cat_valse); $i++) { foreach ($catmapping as $mapping) { if ($mapping["\x78\x73\154\x75\147"] == sanitize_title(clean_text($CSlug))) { $term = get_term_by("\163\x6c\x75\147", sanitize_title($mapping["\163\154\x75\x67"]), "\x70\162\x6f\x64\165\x63\x74\x5f\143\141\164"); array_push($tag, $term->term_id); $catfound = true; break; } } if ($i + 1 < count($cat_valse)) { $CSlug .= "\174" . $cat_valse[$i + 1]; } } if ($catfound) { continue; } } if (!term_exists(sanitize_title(clean_text($cat_vals)), "\x70\x72\157\x64\165\x63\164\137\x63\141\x74")) { if (count($cat_valse) > 1) { $TSlug = $cat_valse[0]; for ($i = 1; $i < count($cat_valse); $i++) { $padre = clean_text($cat_valse[$i - 1]); $term_s = get_term_by("\163\154\165\x67", sanitize_title(clean_text($TSlug)), "\x70\162\157\144\165\143\x74\137\x63\x61\164"); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), "\160\x72\x6f\x64\x75\x63\164\x5f\x63\x61\x74", array("\163\154\x75\147" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["\x74\x65\x72\155\x5f\x69\144"]; array_push($tag, $term_s["\x74\x65\x72\x6d\x5f\151\x64"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "\x7c" . $cat_valse[$i]; $hijo = clean_text($cat_valse[$i]); if (!term_exists(sanitize_title($TSlug), "\160\x72\157\x64\165\x63\x74\137\x63\141\x74")) { $term = Create_Cats_Parent($term_id, $hijo, $TSlug); array_push($tag, $term["\164\x65\162\x6d\x5f\x69\x64"]); } else { $term = get_term_by("\163\154\x75\x67", sanitize_title(clean_text($TSlug)), "\160\x72\157\x64\x75\x63\x74\x5f\143\141\x74"); array_push($tag, $term->term_id); } } } else { $term = wp_insert_term(clean_text(strval($cat_valse[$total - 1])), "\160\x72\157\x64\x75\143\x74\137\x63\141\164", array("\163\x6c\x75\147" => sanitize_title(clean_text(strtolower($cat_vals))))); array_push($tag, $term["\164\145\162\x6d\137\x69\x64"]); } } else { if (count($cat_valse) > 1) { $TSlug = $cat_valse[0]; for ($i = 1; $i < count($cat_valse); $i++) { $padre = clean_text($cat_valse[$i - 1]); $term_s = get_term_by("\163\154\x75\147", sanitize_title(clean_text($TSlug)), "\x70\x72\x6f\x64\165\x63\164\x5f\143\141\164"); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), "\x70\162\157\144\165\x63\164\137\x63\141\164", array("\x73\x6c\165\147" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["\164\x65\x72\x6d\x5f\x69\x64"]; array_push($tag, $term_s["\164\145\162\x6d\137\x69\144"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "\x7c" . $cat_valse[$i]; $hijo = clean_text($cat_valse[$i]); if (!term_exists(sanitize_title($TSlug), "\160\x72\157\144\x75\143\164\137\143\x61\x74")) { $term = Create_Cats_Parent($term_id, $hijo, $TSlug); array_push($tag, $term["\x74\145\x72\x6d\137\x69\144"]); } else { $term = get_term_by("\163\154\x75\147", sanitize_title(clean_text($TSlug)), "\x70\162\157\x64\165\143\164\137\143\x61\164"); array_push($tag, $term->term_id); } } } else { $term = get_term_by("\x73\x6c\165\147", sanitize_title(clean_text($cat_valse[$total - 1])), "\x70\162\x6f\x64\x75\x63\164\x5f\143\141\x74"); if (!$term) { $term = wp_insert_term(clean_text(strval($cat_valse[$total - 1])), "\x70\162\x6f\x64\x75\143\164\137\143\141\x74", array("\163\x6c\165\x67" => sanitize_title(clean_text(strtolower($cat_vals))))); array_push($tag, $term["\x74\x65\x72\x6d\x5f\x69\144"]); } else { array_push($tag, $term->term_id); } } } } wp_set_object_terms($post_id, $tag, "\160\x72\157\144\x75\x63\164\x5f\143\141\164"); } goto Ud7W3; uZKBm: function update_products($fimport) { remove_filter("\143\157\x6e\x74\145\156\164\137\x73\141\x76\145\137\x70\x72\145", "\x77\160\x5f\x66\x69\154\x74\145\x72\137\160\x6f\163\x74\137\153\x73\x65\163"); remove_filter("\143\157\156\x74\x65\156\x74\137\146\x69\x6c\x74\x65\x72\x65\x64\x5f\163\141\166\x65\137\160\162\145", "\167\160\137\146\x69\154\164\145\162\137\x70\157\163\x74\x5f\x6b\163\145\163"); $uploads = wp_upload_dir(); $base_dir = str_replace("\165\x70\x6c\157\x61\x64\163\57", '', $uploads["\142\141\163\145\144\x69\162"]); global $wpdb; $dlpi_table_prefix = $wpdb->prefix; $dl_table = $dlpi_table_prefix . "\x64\154\137\x78\x6d\x6c\x5f\160\x72\x6f\144\x75\x63\x74\x73"; $counter = 0; $dl_update_lang = get_option("\144\x6c\137\x75\x70\144\141\x74\145\137\154\141\x6e\147"); $dl_update_prod_price = get_option("\144\x6c\137\165\x70\144\141\164\x65\137\x70\162\x6f\144\x5f\160\x72\x69\x63\145"); $dl_update_price_val = get_option("\144\x6c\137\x75\160\x64\141\164\145\137\160\x72\x69\x63\x65\x5f\x76\141\x6c"); $dl_update_newp = get_option("\144\x6c\x5f\165\160\x64\141\x74\x65\137\x6e\x65\x77\x70"); $dl_update_title = get_option("\x64\x6c\137\165\x70\144\x61\164\145\x5f\x74\x69\x74\x6c\x65"); $dl_update_desc = get_option("\144\x6c\x5f\165\160\x64\x61\x74\145\137\144\145\x73\x63"); $dl_update_excerpt = get_option("\144\x6c\x5f\165\x70\x64\x61\164\x65\137\x65\x78\143\x65\x72\x70\164"); $dl_update_stock = get_option("\x64\154\137\x75\160\144\x61\164\x65\x5f\163\x74\x6f\143\x6b"); $dl_update_cost_price = get_option("\x64\x6c\137\x75\160\144\141\x74\x65\137\x63\x6f\x73\164\x5f\x70\162\x69\143\145"); $dl_update_categories = get_option("\x64\154\137\x75\x70\144\x61\x74\x65\137\143\141\x74\145\x67\x6f\x72\151\145\x73"); $dl_update_categories_new = get_option("\144\x6c\x5f\165\160\144\141\x74\145\137\x63\141\164\x65\147\157\162\151\x65\x73\x5f\156\x65\167"); $dl_update_categories_sale = get_option("\144\x6c\x5f\165\x70\x64\x61\164\145\137\x63\x61\x74\x65\147\x6f\x72\x69\145\x73\137\x73\x61\154\145"); $dl_update_brands = get_option("\x64\x6c\137\x75\160\144\x61\164\145\x5f\142\162\x61\x6e\144\163"); $dl_update_images = get_option("\144\154\137\x75\160\144\141\164\145\137\x69\155\141\147\145\x73"); $dl_img_options = get_option("\x64\154\x5f\151\x6d\147\137\x6f\160\x74\151\157\x6e\163"); $dl_update_discontinued_pv = get_option("\144\x6c\x5f\165\160\x64\x61\164\145\x5f\x64\x69\x73\x63\157\x6e\164\x69\156\165\x65\x64\x5f\160\166"); $dl_catmap = get_option("\144\154\137\x6d\141\160\x5f\x63\x61\x74"); $dl_catfilter = get_option("\144\154\137\x66\x69\x6c\x74\x65\x72\x5f\x63\x61\164"); $dl_prodfilter = get_option("\x64\x6c\137\146\151\x6c\x74\x65\x72\137\160\162\157\x64"); $dl_brandfilter = get_option("\x64\154\137\146\151\x6c\x74\x65\162\137\142\x72\x61\156\144"); if ($dl_catmap == 1) { $dl_catmapping = get_option("\155\x61\x70\137\x70\162\157\x64\x75\x63\x74\137\x63\141\164\145\147\157\162\151\145\163"); } else { $dl_catmapping = array(); } if ($dl_catfilter == 1) { $dl_cat_filter = get_option("\x64\x6c\x5f\151\156\144\x6c\165\144\145\x64\x5f\143\141\164\137\153\145\x79"); } else { if ($dl_catfilter == 2) { $dl_cat_filter = get_option("\x64\x6c\x5f\145\x78\x63\x6c\165\x64\145\x64\137\x63\x61\x74\x5f\x6b\145\x79"); } else { $dl_cat_filter = array(); } } if ($dl_prodfilter == 1) { $dl_prod_filter = get_option("\144\154\x5f\x69\x6e\144\154\x75\x64\x65\x64\137\x70\162\157\x64\x5f\x6b\145\171"); } else { if ($dl_prodfilter == 2) { $dl_prod_filter = get_option("\x64\x6c\137\145\x78\143\154\165\144\145\x64\x5f\160\162\x6f\x64\137\153\145\x79"); } else { $dl_prod_filter = array(); } } if ($dl_brandfilter == 1) { $dl_brand_filter = get_option("\144\154\x5f\151\156\144\154\x75\x64\x65\x64\x5f\x62\162\x61\x6e\144\x5f\153\x65\171"); } else { if ($dl_brandfilter == 2) { $dl_brand_filter = get_option("\144\x6c\137\145\x78\143\154\x75\144\x65\x64\x5f\142\x72\141\x6e\x64\137\153\x65\x79"); } else { $dl_brand_filter = array(); } } $langtag = "\x65\156\55\x55\113"; if ($dl_update_lang == "\145\x6e\x67\154\x69\163\x68") { $langtag = "\x65\156\55\125\113"; } else { if ($dl_update_lang == "\146\x72\145\x6e\x63\150") { $langtag = "\146\x72\55\106\122"; } else { if ($dl_update_lang == "\151\164\141\x6c\151\x61\156") { $langtag = "\151\164\55\x49\124"; } else { if ($dl_update_lang == "\x67\x65\162\155\141\x6e") { $langtag = "\x64\145\55\104\105"; } else { if ($dl_update_lang == "\x70\x6f\162\164\165\147\165\x65\163\x65") { $langtag = "\160\164\55\x50\x54"; } else { if ($dl_update_lang == "\x73\x70\x61\156\x69\163\150") { $langtag = "\145\163\x2d\x45\123"; } } } } } } $count = 0; $xml = load_xml_file(); $total_count = count($xml->product); update_option("\164\157\x74\x61\154\x5f\x70\162\x6f\144\x75\143\x74\x5f\x78\155\x6c", $total_count); $post_author = get_current_user_id(); $post_status = "\160\x75\142\x6c\151\x73\x68"; $post_parent = ''; $post_type = "\160\x72\x6f\x64\x75\143\164"; $dl_update_lang = get_option("\x64\x6c\137\165\x70\144\141\164\145\137\154\x61\x6e\x67", true); $last_import_sku = get_option("\x6c\x61\x73\164\137\x73\x6b\165", ''); $start_import_sku = get_option("\x73\164\141\162\x74\137\163\x6b\165", ''); clean_product_incomplete(); $mailrep = get_option("\x64\x6c\x5f\165\160\x64\x61\164\145\x5f\x70\x76\x5f\x65\x6d\x61\x69\x6c"); $stop = get_option("\x73\x74\157\x70\137\151\155\160\157\x72\164", "\x30"); update_option("\164\x6f\164\x61\154\137\160\162\x6f\144\x75\x63\x74\x5f\151\x70", 0); clearstatcache(); $nowlist = array(); if ($total_count > 0) { foreach ($xml->product as $key => $product) { update_option("\x6c\x61\163\164\137\x75\x70\x64\141\164\145\137\x69\x6d\x70\157\x72\164\x5f\164\151\x6d\145", time()); $array_prod_cats = array(); $new_db_prod_id = $product->id; $prod_id = $product->id; $prod_sku = (string) $product->public_id; $brand = (string) $product->brand_hierarchy; $brand = str_replace("\47", "\x20", $brand); array_push($nowlist, (string) $prod_id); if ($fimport) { $count++; if ($prod_sku == $last_import_sku) { $fimport = false; $count--; $counter = $count; update_option("\x74\x6f\164\x61\x6c\x5f\160\162\157\144\165\x63\x74\137\x69\x70", $counter); } else { continue; } } update_option("\163\164\x61\x72\164\137\x73\x6b\165", $prod_sku); $prod_categories = $product->categories; if ($dl_catfilter == 1) { $cat_include = false; foreach ($prod_categories->category as $cat_vals) { if (in_array($cat_vals["\x67\145\x73\x69\x6f\151\x64"], $dl_cat_filter)) { $cat_include = true; break; } } if (!$cat_include) { $counter++; Update_Counters($counter, $prod_sku); continue; } } else { if ($dl_catfilter == 2) { $cat_exclude = false; foreach ($prod_categories->category as $cat_vals) { if (in_array($cat_vals["\147\x65\163\151\157\151\144"], $dl_cat_filter)) { $cat_exclude = true; break; } } if ($cat_exclude) { $counter++; Update_Counters($counter, $prod_sku); continue; } } } if ($dl_prodfilter == 1) { if (!in_array($prod_sku, $dl_prod_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } else { if ($dl_prodfilter == 2) { if (in_array($prod_sku, $dl_prod_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } } if ($dl_brandfilter == 1) { if (!in_array($brand, $dl_brand_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } else { if ($dl_brandfilter == 2) { if (in_array($brand, $dl_brand_filter)) { $counter++; Update_Counters($counter, $prod_sku); continue; } } } $prod_type = "\x73\x69\x6d\x70\154\145"; $prod_commonvar = ''; $variation_data = ''; if (!empty($product->variant)) { $prod_type = "\x76\141\162\151\141\142\154\x65"; $variation_data = $product->variant; } if ($dl_update_lang == "\145\x6e\x67\x6c\151\x73\x68" || $dl_update_lang == "\x66\162\x65\x6e\143\x68" || $dl_update_lang == "\151\164\x61\x6c\151\x61\156" || $dl_update_lang == "\147\145\162\155\x61\x6e" || $dl_update_lang == "\x70\x6f\162\164\x75\147\x75\145\163\x65") { if (!is_null($product->internationalization)) { if (!is_null($product->internationalization->title)) { $pr_title = $product->internationalization->title->value; $xml_lang = ''; $prod_title = clean_text(clean_CData($product->title)); if (!is_null($pr_title)) { foreach ($pr_title as $prt => $p_title) { $xml_lang = $p_title["\x6c\x61\x6e\x67"]; if ($xml_lang == $langtag) { if ($p_title) { $prod_title = $p_title; $prod_title = clean_text(clean_CData($prod_title)); } else { $prod_title = clean_text(clean_CData($product->title)); } break; } } } } else { $prod_title = clean_text(clean_CData($product->title)); } if (!is_null($product->internationalization->description)) { $pr_excerpt = $product->internationalization->description->value; $xml_lang = ''; $prod_excerpt = clean_text(clean_CData($product->description)); if (!is_null($pr_excerpt)) { foreach ($pr_excerpt as $prt => $p_excerpt) { $xml_lang = $p_excerpt["\x6c\x61\156\147"]; if ($xml_lang == $langtag) { if ($p_excerpt) { $prod_excerpt = $p_title; $prod_excerpt = clean_text(clean_CData($prod_excerpt)); } else { $prod_excerpt = clean_text(clean_CData($product->description)); } break; } } } } else { $prod_excerpt = clean_text(clean_CData($product->description)); } if (!is_null($product->internationalization->html_description)) { $pr_desc = $product->internationalization->html_description->value; $xml_lang = ''; $prod_desc = clean_text(clean_CData($product->html_description), false); if (!is_null($pr_desc)) { foreach ($pr_desc as $prt => $p_desc) { $xml_lang = $p_desc["\154\x61\x6e\x67"]; if ($xml_lang == $langtag) { if ($p_desc) { $prod_desc = $p_desc; $prod_desc = clean_text(clean_CData($prod_desc), false); } else { $prod_desc = clean_text(clean_CData($product->html_description), false); } break; } } } } else { $prod_desc = clean_text(clean_CData($product->html_description), false); } if (!empty($product->variant)) { if (!is_null($product->internationalization->variant_common_title)) { $pr_commonvar = $product->internationalization->variant_common_title->value; $xml_lang = ''; $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); if (!is_null($pr_commonvar)) { foreach ($pr_commonvar as $prt => $p_commonvar) { $xml_lang = $p_commonvar["\x6c\x61\156\x67"]; if ($xml_lang == $langtag) { if ($p_commonvar) { $prod_commonvar = $p_commonvar; $prod_commonvar = clean_text(clean_CData($prod_commonvar)); } else { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } break; } } } } else { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } } } else { $prod_title = clean_text(clean_CData($product->title)); $prod_desc = clean_text(clean_CData($product->html_description), false); $prod_excerpt = clean_text(clean_CData($product->description)); if (!empty($product->variant)) { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } } } else { $prod_title = clean_text(clean_CData($product->title)); $prod_desc = clean_text(clean_CData($product->html_description), false); $prod_excerpt = clean_text(clean_CData($product->description)); if (!empty($product->variant)) { $prod_commonvar = (string) clean_text(clean_Cdata($variation_data->common_title)); } } $prod_author = $post_author; $prod_parent = $post_parent; $prod_post_type = $post_type; $prod_visibility = $product->available; $prod_issale = "\60"; $prod_isnew = "\60"; if (!is_null($product->sale)) { $prod_issale = $product->sale["\x76\141\154\x75\145"]; } if (!is_null($product->new)) { $prod_isnew = $product->new["\x76\x61\154\x75\145"]; } if (intval($prod_visibility) == 1) { $prod_visibility = "\166\151\163\151\x62\154\x65"; } else { $prod_visibility = "\150\151\144\144\145\156"; } $prod_cost = $product->cost_price; $prod_brand = explode("\x7c", $product->brand_hierarchy); $prod_brand = clean_text(clean_CData($prod_brand[0])); $prod_barcode = $product->barcodes->barcode; if (!is_null($prod_barcode)) { $prod_barcodeName = $product->barcodes->barcode["\x74\171\160\145"]; } else { $prod_barcodeName = ''; } $prod_stock = $product->stock->location; $stock_status = ''; $prodcatnew = ''; $prodcatoffer = ''; if (intval($prod_stock) >= 1) { $stock_status = "\x69\x6e\x73\164\157\x63\153"; } if ($dl_update_lang == "\x73\160\x61\x6e\151\x73\x68") { $prodcatnew = "\x4e\157\x76\x65\144\141\x64\x65\x73"; $prodcatoffer = "\117\146\x65\162\164\141\163"; } else { if ($dl_update_lang == "\x66\x72\x65\156\x63\x68") { $prodcatnew = "\116\157\x75\166\145\x61\x75\x74\x65\x73"; $prodcatoffer = "\117\146\146\162\x65\x73"; } else { if ($dl_update_lang == "\151\x74\141\154\151\x61\x6e") { $prodcatnew = "\116\x75\x6f\166\157"; $prodcatoffer = "\x4f\x66\146\x65\x72\x74\x65"; } else { if ($dl_update_lang == "\147\145\162\155\x61\156") { $prodcatnew = "\x4e\x61\x63\x68\x72\x69\143\150\164\x65\156"; $prodcatoffer = "\x53\141\x6c\x65"; } else { if ($dl_update_lang == "\x70\x6f\162\164\x75\x67\165\x65\163\x65") { $prodcatnew = "\x4e\x6f\166\x69\144\x61\x64\x65\163"; $prodcatoffer = "\x4f\x66\145\162\164\x61\163"; } else { if ($dl_update_lang == "\x65\156\147\154\x69\x73\x68") { $prodcatnew = "\x4e\145\167\163"; $prodcatoffer = "\117\146\x66\145\162\x73"; } } } } } } $prod_stock_status = $stock_status; $prod_downloadable = ''; $prod_virtual = "\156\157"; $prod_price = $product->price; $prod_sales_price = 0; $prod_purchase_note = ''; $prod_featured = "\156\x6f"; $prod_sale_price_dates_from = ''; $prod_sale_price_dates_to = ''; $prod_sold_individually = ''; $prod_manage_stock = "\171\145\x73"; $prod_backorders = "\156\x6f"; $prod_total_sales = 0; $prod_regular_price = $product->price; $prod_length = $product->size->depth; $prod_width = $product->size->width; $prod_height = $product->size->height; $prod_weight = $product->shipping_weight; $prod_stock = $prod_stock; $product_destock = (int) $product->destocking; $product_vat = $product->vat; $prod_status = "\x69\x6d\x70\157\x72\164\x69\x6e\147"; $product_recom_price = $product->recommended_retail_price; $str_prod_categories = $prod_categories; if ($dl_update_prod_price == "\156\x6f\162\155\141\x6c" || $dl_update_prod_price == "\144\154\137\160\x65\x72\137\143\157\x73\x74" || $dl_update_prod_price == "\144\154\x5f\x70\145\x72\137\x70\166\x70" || $dl_update_prod_price == "\144\x6c\137\x66\x69\x78\x65\x64\x5f\x70\x72\x69\143\x65") { $prod_price = dl_product_sales_price_calc($prod_price, $prod_cost, $dl_update_price_val, $dl_update_prod_price); } $ffound = false; if (!empty($variation_data)) { $prod_post_id = misha_post_id_by_meta_key_and_value("\x5f\163\153\x75", $prod_sku . "\x2d\166\141\x72"); $ffound = true; } else { $prod_post_id = misha_post_id_by_meta_key_and_value("\137\x73\x6b\165", $prod_sku); } $prstatus = get_post_status($prod_post_id); if (!empty($prod_post_id) && ($prstatus === "\160\165\142\x6c\151\x73\x68" || $prstatus === "\160\x72\x69\x76\x61\164\x65")) { if ($prstatus === "\160\x72\x69\166\141\x74\145" && !$product_destock && $prod_visibility != "\x68\151\144\x64\x65\156") { wp_update_post(array("\111\x44" => $prod_post_id, "\160\157\163\164\x5f\163\x74\141\164\165\x73" => "\x70\x75\x62\x6c\151\x73\150")); } else { if ($prstatus === "\160\x75\x62\154\x69\163\150" && ($product_destock || $prod_visibility == "\150\151\x64\x64\145\x6e")) { offproduct($prod_sku, $prod_title, $dl_update_discontinued_pv, $mailrep); } } $gproduct = wc_get_product($prod_post_id); $new_product_flag = false; if (!empty($variation_data)) { $post = misha_post_id_by_meta_key_and_value("\x5f\x69\x6e\164\137\x69\144", (string) (int) $variation_data->item_group_id); $gproduct = wc_get_product($post); if (!$gproduct && $ffound) { update_post_meta($prod_post_id, "\x5f\x69\156\164\x5f\151\144", (string) (int) $variation_data->item_group_id); $post = misha_post_id_by_meta_key_and_value("\137\151\x6e\164\x5f\x69\144", (string) (int) $variation_data->item_group_id); $gproduct = wc_get_product($post); } if (!$gproduct) { $prod_post_id = dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id); $new_product_flag = true; } else { dl_add_variations_to_products($post, $variation_data, (string) $prod_price, (string) $prod_stock, $prod_sku, $dl_update_stock, $dl_update_cost_price, false, $prod_commonvar, (string) $prod_barcode, (string) $prod_cost, (string) $prod_id, $prod_visibility); } } } else { if ($prstatus === "\144\162\141\146\164") { wp_delete_post($prod_post_id, true); } if (!empty($variation_data)) { $post = misha_post_id_by_meta_key_and_value("\137\x69\156\164\x5f\151\144", (string) (int) $variation_data->item_group_id); $gproduct = wc_get_product($post); if (!$gproduct) { $prod_post_id = dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id); $new_product_flag = true; } else { dl_add_variations_to_products($post, $variation_data, (string) $prod_price, (string) $prod_stock, $prod_sku, $dl_update_stock, $dl_update_cost_price, false, $prod_commonvar, (string) $prod_barcode, (string) $prod_cost, (string) $prod_id, $prod_visibility); $counter++; Update_Counters($counter, $prod_sku); continue; } } else { $prod_post_id = dl_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt, $prod_id); $new_product_flag = true; } } if ($new_product_flag) { if ($dl_update_newp == "\x6e\157") { $counter++; Update_Counters($counter, $prod_sku); continue; } dl_add_category_to_products($prod_post_id, $str_prod_categories, $dl_catmap, $dl_catmapping); if ($dl_update_categories_new == "\171\x65\163") { dl_espcategory_to_products($prod_post_id, $prodcatnew, $prod_isnew); } if ($dl_update_categories_sale == "\171\145\163") { dl_espcategory_to_products($prod_post_id, $prodcatoffer, $prod_issale); } dl_add_brand_to_products($prod_post_id, $brand); $gproduct = wc_get_product($prod_post_id); if ($gproduct) { $gproduct->set_regular_price((string) $prod_price); $gproduct->set_price((string) $prod_price); $gproduct->set_catalog_visibility($prod_visibility); $gproduct->set_downloadable(false); $gproduct->set_virtual(false); $gproduct->set_purchase_note($prod_purchase_note); $gproduct->set_featured($prod_featured); $gproduct->set_sale_price(''); $gproduct->set_date_on_sale_from(''); $gproduct->set_date_on_sale_to(''); $gproduct->set_sold_individually(false); $gproduct->set_backorders("\x6e\x6f"); $gproduct->set_total_sales($prod_total_sales); $gproduct->set_weight((string) $prod_weight); $gproduct->set_length((string) $prod_length); $gproduct->set_width((string) $prod_width); $gproduct->set_height((string) $prod_height); $gproduct->set_stock_quantity($prod_stock); $gproduct->set_stock_status($prod_stock_status); if (!empty($variation_data)) { $gproduct->set_manage_stock(false); $gproduct->set_sku($prod_sku . "\55\166\x61\162"); $gproduct->update_meta_data("\x5f\151\x6e\x74\x5f\x69\144", (string) (int) $variation_data->item_group_id); if (!empty($prod_commonvar)) { $gproduct->set_name($prod_commonvar); } else { $gproduct->set_name($prod_title); } } else { $gproduct->set_manage_stock(true); $gproduct->set_sku($prod_sku); } $gproduct->save(); wp_set_object_terms($prod_post_id, $prod_type, "\160\162\157\x64\165\x63\x74\x5f\164\x79\160\145"); } if (!empty($variation_data)) { dl_add_variations_to_products($prod_post_id, $variation_data, (string) $prod_price, (string) $prod_stock, $prod_sku, $dl_update_stock, $dl_update_cost_price, false, $prod_commonvar, (string) $prod_barcode, (string) $prod_cost, (string) $prod_id, $prod_visibility); $prod_post_idvar = wc_get_product_id_by_sku($prod_sku); } } else { $pproduct = wc_get_product($prod_post_id); $needsave = false; if ($pproduct) { if ($dl_update_title == "\171\x65\x73") { if (!empty($variation_data) && !empty($prod_commonvar)) { $pproduct->set_name($prod_commonvar); } else { $pproduct->set_name($prod_title); } $needsave = true; } if ($dl_update_desc == "\x79\145\x73") { $pproduct->set_description($prod_desc); $needsave = true; } if ($dl_update_excerpt == "\x79\x65\163") { $pproduct->set_short_description($prod_excerpt); $needsave = true; } if ($dl_update_stock == "\x79\x65\163") { $pproduct->set_stock_quantity($prod_stock); $needsave = true; } if ($dl_update_cost_price == "\171\x65\x73") { $ssprice = $pproduct->get_sale_price(); $ssdatefrom = $pproduct->get_date_on_sale_from(); $ssdateto = $pproduct->get_date_on_sale_to(); $pproduct->set_regular_price((string) $prod_price); $pproduct->set_price((string) $prod_price); if (!empty($ssprice)) { $pproduct->set_sale_price((string) $ssprice); $pproduct->set_date_on_sale_from((string) $ssdatefrom); $pproduct->set_date_on_sale_to((string) $ssdateto); } $needsave = true; } if ($needsave) { $pproduct->save(); } if ($dl_update_categories == "\x79\x65\x73") { $map_product_category = get_option("\x6d\x61\160\x5f\160\x72\x6f\144\x75\143\164\137\143\x61\164\x65\x67\x6f\162\171"); dl_add_category_to_products($prod_post_id, $str_prod_categories, $dl_catmap, $dl_catmapping); } if ($dl_update_brands == "\x79\x65\163") { dl_add_brand_to_products($prod_post_id, $brand); } if ($dl_update_categories_new == "\171\x65\x73") { dl_espcategory_to_products($prod_post_id, $prodcatnew, $prod_isnew); } if ($dl_update_categories_sale == "\x79\x65\163") { dl_espcategory_to_products($prod_post_id, $prodcatoffer, $prod_issale); } } } $uproduct = wc_get_product($prod_post_id); if ($uproduct) { $uproduct->update_meta_data("\137\x62\141\162\x63\157\x64\x65", (string) $prod_barcode); $uproduct->update_meta_data("\137\167\160\155\x5f\x67\x74\151\x6e\137\143\x6f\144\145", (string) $prod_barcode); $uproduct->update_meta_data("\137\x63\x6f\x73\x74\x70\162\x69\143\x65", (string) $prod_cost); if (!empty($variation_data)) { $uproduct->update_meta_data("\x5f\144\154\x69\x64", (string) $prod_id . "\55\166\x61\162"); } else { $uproduct->update_meta_data("\137\144\154\x69\x64", (string) $prod_id); } $uproduct->set_catalog_visibility($prod_visibility); if (get_option("\x77\x6f\x6f\143\x6f\x6d\x6d\145\162\143\x65\137\x63\141\154\143\137\164\x61\170\x65\163") === "\171\145\163") { $taxes_array = WC_Tax::get_tax_classes(); if ((string) $product_vat == "\62\x31\x2e\60\x30") { $prod_tax_class = "\x53\x74\x61\x6e\x64\x61\162\144"; } else { if ((string) $product_vat == "\x31\60\x2e\x30\x30") { $prod_tax_class = $taxes_array[0]; } else { if ((string) $product_vat == "\64\x2e\x30\x30") { $prod_tax_class = $taxes_array[1]; } else { $prod_tax_class = "\123\x74\141\x6e\144\x61\x72\144"; } } } $uproduct->set_tax_class($prod_tax_class); } $uproduct->save(); } $prod_images = $product->images->image; $img_gallery = array(); foreach ($prod_images as $k => $p_img) { $arr_p_img = (array) $p_img; foreach ($arr_p_img as $key => $img_val) { if ($key == "\x73\162\x63") { $img_gallery[] = $img_val; } } } $update_imgs = 0; $update_gallery = 5; if ($dl_update_images == "\x79\145\163" || $new_product_flag) { if ($dl_img_options == "\x35") { $update_imgs = 1; $update_gallery = 5; } else { if ($dl_img_options == "\x31") { $update_imgs = 1; $update_gallery = 0; } else { if ($dl_img_options == "\x30") { $update_imgs = 0; $update_gallery = 0; } else { if ($dl_img_options == "\x61\154\154") { $update_imgs = 1; $update_gallery = count($img_gallery); } else { $update_imgs = 1; $update_gallery = intval($dl_img_options); } } } } } else { $update_imgs = 0; } if ($prod_post_id != "\60" || $prod_post_id != 0) { if (intval($update_imgs) > 0) { ssdl_attach_product_thumbnail($prod_post_id, $img_gallery[0], 0); for ($i = 1; $i < count($img_gallery); $i++) { if (intval($update_gallery) <= $i) { break; } ssdl_attach_product_thumbnail($prod_post_id, $img_gallery[$i], 1); } } if ($new_product_flag) { if (empty($variation_data) && ($product_destock || $prod_visibility == "\x68\x69\144\144\x65\x6e")) { wp_update_post(array("\x49\104" => $prod_post_id, "\x70\x6f\x73\x74\x5f\163\x74\141\x74\x75\163" => "\160\162\151\166\x61\164\145")); } else { wp_update_post(array("\111\104" => $prod_post_id, "\x70\157\x73\164\137\163\164\141\164\x75\x73" => "\160\x75\142\154\151\x73\x68")); } } } $counter++; Update_Counters($counter, $prod_sku); } if ($dl_update_discontinued_pv != "\x6e\x6f\156\145") { $lastpage = 500; $oldlastpage = get_option("\x64\145\154\137\154\141\163\x74\x70\141\147\x65"); if (!empty($oldlastpage)) { $lastpage = $oldlastpage; } for ($apr = $lastpage; $apr >= 1; $apr--) { $args = array("\160\157\163\164\137\164\x79\160\x65" => "\160\162\157\x64\x75\x63\x74", "\x70\x6f\163\164\137\163\164\x61\164\x75\163" => "\160\165\x62\154\151\x73\x68", "\160\157\x73\164\x73\137\160\145\162\137\160\141\147\145" => 100, "\160\141\147\145\x64" => $apr); $products = get_posts($args); foreach ($products as $key => $product) { $prod_post_id = $product->ID; $dlid = get_post_meta($prod_post_id, "\137\144\x6c\151\144"); if ($dl_update_discontinued_pv == "\x79\x65\x73") { if (!empty($dlid[0]) && !in_array($dlid[0], $nowlist)) { $fproduct = wc_get_product($prod_post_id); $tempname = $fproduct->get_title(); $tempsku = $fproduct->get_sku(); if ($fproduct->get_type() == "\166\141\162\151\141\x62\154\x65") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "\x5f\x64\154\x69\144"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "\60", "\x73\x65\164"); update_post_meta($vchild[$vpi], "\x5f\163\x74\x6f\143\x6b", "\x30"); wp_trash_post($vchild[$vpi]); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wc_update_product_stock($prod_post_id, "\60", "\x73\145\x74"); update_post_meta($prod_post_id, "\x5f\x73\164\x6f\143\153", "\x30"); wp_update_post(array("\111\104" => $prod_post_id, "\x70\157\x73\x74\137\x73\x74\x61\164\165\x73" => "\160\x72\151\x76\141\164\145")); if (!empty($mailrep)) { $oldpr = get_option("\154\151\x73\164\137\144\151\x73\141\142\x6c\x65\x5f\160\x72\157\144\165\x63\164"); $oldpr = $oldpr . $tempsku . "\40" . $tempname . "\xd\xa"; update_option("\154\151\163\164\137\x64\x69\163\141\x62\154\x65\137\160\x72\x6f\x64\x75\143\164", $oldpr); } } $mproduct = str_replace("\x2d\x76\141\x72", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wc_update_product_stock($prod_post_id, "\x30", "\x73\145\164"); update_post_meta($prod_post_id, "\x5f\x73\164\157\143\x6b", "\x30"); wp_update_post(array("\x49\104" => $prod_post_id, "\160\x6f\163\164\137\x73\x74\x61\164\x75\163" => "\160\x72\151\x76\141\x74\145")); if (!empty($mailrep)) { $oldpr = get_option("\154\x69\x73\164\137\x64\151\x73\x61\x62\x6c\145\137\160\162\157\144\x75\143\x74"); $oldpr = $oldpr . $tempsku . "\x20" . $tempname . "\15\12"; update_option("\154\x69\x73\164\x5f\x64\x69\163\141\x62\154\x65\x5f\x70\x72\157\x64\x75\x63\x74", $oldpr); } } } } else { if ($dl_update_discontinued_pv == "\x6e\x6f") { if (!empty($dlid[0]) && !in_array($dlid[0], $nowlist)) { $fproduct = wc_get_product($prod_post_id); $tempname = $fproduct->get_title(); $tempsku = $fproduct->get_sku(); if ($fproduct->get_type() == "\166\x61\162\151\141\x62\154\x65") { $vchild = $fproduct->get_children(); $kvid = true; for ($vpi = 0; $vpi < count($vchild); $vpi++) { $vid = get_post_meta($vchild[$vpi], "\x5f\144\154\151\144"); if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) { wc_update_product_stock($vchild[$vpi], "\x30", "\163\145\x74"); update_post_meta($vchild[$vpi], "\x5f\x73\164\157\143\153", "\x30"); wp_trash_post($vchild[$vpi]); } else { $kvid = false; } } if (empty($vchild) || $kvid) { wp_update_post(array("\x49\x44" => $prod_post_id, "\x70\157\x73\x74\x5f\163\x74\141\x74\x75\x73" => "\151\x6d\160\157\x72\164\x69\x6e\x67")); if (!empty($mailrep)) { $oldpr = get_option("\x6c\x69\x73\164\x5f\x64\x69\x73\x61\x62\154\145\137\160\162\x6f\x64\165\x63\164"); $oldpr = $oldpr . $tempsku . "\40" . $tempname . "\15\xa"; update_option("\x6c\151\163\164\137\144\x69\x73\141\x62\154\145\x5f\x70\162\x6f\144\165\x63\164", $oldpr); } } $mproduct = str_replace("\55\x76\141\x72", '', $fproduct->get_sku()); $prod_post_id = wc_get_product_id_by_sku($mproduct); } else { wp_update_post(array("\111\x44" => $prod_post_id, "\160\x6f\x73\164\137\163\164\141\164\165\163" => "\151\x6d\160\157\x72\164\x69\156\147")); if (!empty($mailrep)) { $oldpr = get_option("\x6c\x69\x73\x74\x5f\x64\x69\163\x61\142\x6c\145\137\x70\162\157\144\x75\143\164"); $oldpr = $oldpr . $tempsku . "\40" . $tempname . "\15\xa"; update_option("\x6c\151\x73\x74\x5f\x64\x69\163\x61\x62\x6c\x65\137\x70\x72\157\x64\165\x63\164", $oldpr); } } } } } } update_option("\144\x65\x6c\137\154\x61\163\164\160\x61\147\145", $apr); } update_option("\x64\145\x6c\x5f\x6c\x61\x73\x74\160\x61\147\145", 500); } $oldpr = get_option("\154\x69\163\164\137\x64\151\163\141\x62\154\145\137\160\162\x6f\144\165\x63\164"); if (!empty($oldpr)) { send_debug_email(__("\x50\162\x6f\144\x75\x63\164\163\x20\x44\x69\163\141\142\154\145\144\72", "\x64\154\137\151\155\x70\x6f\162\x74\137\160\x72\x6f\144\x75\143\x74\163"), $oldpr); update_option("\x6c\151\x73\x74\137\144\151\163\x61\142\x6c\x65\137\x70\162\157\x64\165\x63\x74", ''); } update_option("\163\164\x61\164\165\x73\x5f\x69\155\160\x6f\x72\164", 2); update_option("\145\x6e\144\137\151\155\160\157\162\x74\x5f\144\x61\164\x65", date("\x64\57\155\57\x59\40\x2d\x20\110\72\x69\x3a\163")); update_option("\x6c\x61\163\164\x5f\x73\x6b\165", ''); add_filter("\x63\x6f\156\164\145\156\164\x5f\x73\141\166\145\137\160\x72\145", "\x77\160\x5f\x66\x69\154\x74\x65\x72\137\x70\x6f\163\x74\x5f\x6b\x73\145\163"); add_filter("\143\x6f\x6e\164\x65\156\x74\137\146\151\x6c\164\145\x72\x65\144\x5f\x73\141\x76\145\137\x70\x72\x65", "\x77\160\137\146\x69\x6c\164\x65\x72\x5f\x70\157\x73\x74\x5f\x6b\x73\145\x73"); clean_product_incomplete(); } } goto ALyND; g1bd4: function clean_product_incomplete() { global $wpdb; $ids = $wpdb->delete($wpdb->posts, array("\x70\157\x73\x74\137\x74\x79\x70\145" => "\160\x72\x6f\x64\165\143\x74", "\160\157\x73\x74\x5f\163\x74\141\164\x75\163" => "\151\x6d\x70\157\x72\x74\x69\x6e\x67")); } goto f9jry; Ch8ws: function my_generate_attachment_metadata_p($attachment_id, $file) { $attachment = get_post($attachment_id); $metadata = array(); if (preg_match("\41\136\x69\x6d\x61\147\145\x2f\x21", get_post_mime_type($attachment)) && file_is_displayable_image($file)) { $imagesize = getimagesize($file); $metadata["\x77\151\x64\164\x68"] = $imagesize[0]; $metadata["\150\x65\151\147\150\x74"] = $imagesize[1]; list($uwidth, $uheight) = wp_constrain_dimensions($metadata["\x77\x69\x64\x74\x68"], $metadata["\x68\145\x69\147\x68\x74"], 128, 96); $metadata["\150\167\x73\x74\162\x69\156\x67\137\163\155\141\x6c\x6c"] = "\150\x65\151\147\150\x74\x3d\x27{$uheight}\x27\40\x77\x69\144\x74\x68\x3d\47{$uwidth}\47"; $metadata["\146\x69\x6c\145"] = _wp_relative_upload_path($file); $image_meta = wp_read_image_metadata($file); if ($image_meta) { $metadata["\x69\155\x61\x67\145\x5f\155\x65\x74\x61"] = $image_meta; } } return apply_filters("\x77\160\x5f\147\x65\156\x65\162\141\x74\x65\x5f\141\164\x74\x61\x63\x68\155\145\156\x74\x5f\x6d\145\164\x61\x64\141\x74\141", $metadata, $attachment_id); } goto vkDuG; fRioq: function dl_add_brand_to_products($post_id, $brand) { $tag = array(); $taxbrand = get_option("\x64\154\x5f\x62\x74\x61\x78"); $branda = str_replace(array("\74\41\133\103\x44\x41\x54\x41\x5b", "\x5d\x5d\76"), array('', ''), $brand); $brande = explode("\174", $brand); $total = count($brande); if (empty($brand) || empty($taxbrand)) { return; } if (!term_exists(sanitize_title(clean_text($brand)), $taxbrand)) { if (count($brande) > 1) { $TSlug = $brande[0]; for ($i = 1; $i < count($brande); $i++) { $padre = clean_text($brande[$i - 1]); $term_s = get_term_by("\163\154\165\147", sanitize_title(clean_text($TSlug)), $taxbrand); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), $taxbrand, array("\163\154\x75\x67" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["\x74\145\162\155\x5f\x69\x64"]; array_push($tag, $term_s["\x74\x65\162\155\x5f\151\144"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "\174" . $brande[$i]; $hijo = clean_text($brande[$i]); if (!term_exists(sanitize_title($TSlug), $taxbrand)) { $term = Create_Brand_Parent($term_id, $hijo, $TSlug, $taxbrand); array_push($tag, $term["\164\x65\162\x6d\137\x69\144"]); } else { $term = get_term_by("\x73\154\165\x67", sanitize_title(clean_text($TSlug)), $taxbrand); array_push($tag, $term->term_id); } } } else { $term = wp_insert_term(clean_text(strval($brande[$total - 1])), $taxbrand, array("\163\x6c\165\147" => sanitize_title(clean_text(strtolower($brand))))); array_push($tag, $term["\164\145\162\x6d\x5f\151\144"]); } } else { if (count($brande) > 1) { $TSlug = $brande[0]; for ($i = 1; $i < count($brande); $i++) { $padre = clean_text($brande[$i - 1]); $term_s = get_term_by("\x73\x6c\x75\147", sanitize_title(clean_text($TSlug)), $taxbrand); if (!$term_s) { $term_s = wp_insert_term(clean_text(strval($padre)), $taxbrand, array("\x73\154\x75\x67" => sanitize_title(clean_text(strtolower($TSlug))))); $term_id = $term_s["\164\145\x72\155\137\x69\x64"]; array_push($tag, $term_s["\x74\x65\x72\x6d\137\x69\x64"]); } else { $term_id = $term_s->term_id; array_push($tag, $term_id); } $TSlug .= "\x7c" . $brande[$i]; $hijo = clean_text($brande[$i]); if (!term_exists(sanitize_title($TSlug), $taxbrand)) { $term = Create_Brand_Parent($term_id, $hijo, $TSlug, $taxbrand); array_push($tag, $term["\164\x65\162\x6d\137\151\x64"]); } else { $term = get_term_by("\x73\154\165\147", sanitize_title(clean_text($TSlug)), $taxbrand); array_push($tag, $term->term_id); } } } else { $term = get_term_by("\x73\154\x75\x67", sanitize_title(clean_text($brande[$total - 1])), $taxbrand); if (!$term) { $term = wp_insert_term(clean_text(strval($brande[$total - 1])), $taxbrand, array("\163\x6c\165\147" => sanitize_title(clean_text(strtolower($brand))))); array_push($tag, $term["\x74\145\x72\x6d\137\151\x64"]); } else { array_push($tag, $term->term_id); } } } wp_set_object_terms($post_id, $tag, $taxbrand); } goto C6qNQ; ALyND: if (trim(get_option("\x64\154\137\x75\160\x64\141\x74\x65\x5f\x78\155\154\x5f\x75\x72\154")) != '') { $status_import = get_option("\x73\x74\141\x74\x75\163\x5f\151\155\x70\157\x72\x74", 0); $last_time = get_option("\x6c\141\163\164\x5f\x75\160\144\141\164\145\x5f\151\155\160\157\x72\x74\x5f\x74\151\x6d\145", 0); $allowimport = get_option("\x64\154\x5f\165\x70\144\x61\164\x65\137\151\x6d\x70\x6f\x72\x74"); $crontime = (int) get_option("\x64\x6c\137\x63\x72\157\x6e"); $to_check = time() - 10; if ($allowimport == "\171\x65\163") { if ($last_time <= $to_check) { $pid = getmypid(); update_option("\154\141\x73\164\137\x70\x69\x64", $pid); if ($status_import == 0 || $status_import == 3) { update_option("\163\x74\141\x74\165\163\x5f\x69\x6d\x70\157\x72\164", 1); update_option("\163\x74\141\162\x74\137\x69\x6d\x70\157\162\x74\137\x74\x69\x6d\145", time()); update_option("\x73\x74\x61\x72\164\137\x69\x6d\x70\157\x72\x74\x5f\144\141\164\x65\x63", date("\x59\x2f\x6d\x2f\144\x20\110\72\151\x3a\163")); $resume = false; update_option("\156\145\170\164\x5f\x69\x6d\x70\x6f\x72\x74", time() + 3600 * $crontime); update_products($resume); } else { if ($status_import == 1) { $resume = true; update_products($resume); } else { if ($status_import == 2) { $next_import = get_option("\x6e\x65\x78\164\137\151\155\160\157\162\164"); $now = time(); if ($now >= $next_import) { update_option("\x73\164\x61\x74\x75\163\x5f\x69\x6d\x70\157\162\x74", 1); update_option("\163\x74\141\x72\x74\x5f\151\x6d\160\x6f\162\x74\x5f\x74\x69\x6d\x65", time()); update_option("\x73\x74\141\162\164\x5f\x69\x6d\x70\157\x72\164\137\144\x61\164\x65", date("\144\57\155\x2f\131\x20\55\x20\x48\x3a\151\72\x73")); update_option("\163\164\141\162\x74\x5f\x69\155\x70\157\x72\x74\x5f\144\x61\x74\145\x63", date("\131\57\x6d\x2f\144\x20\110\x3a\151\72\163")); $resume = false; update_option("\x6e\x65\170\164\x5f\151\155\x70\157\162\164", time() + 3600 * $crontime); update_products($resume); } } } } } } } goto YrHLL; YrHLL: 
	?>

Function Calls

None

Variables

None

Stats

MD5 97fc847d37cdb320dad6122aebc4f77a
Eval Count 0
Decode Time 87 ms