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 goto CsFtg; MeQdH: function Update_Counters($counter, $prod_sku) { file_put..

Decoded Output download

<?php 
goto CsFtg; 
MeQdH: 
function Update_Counters($counter, $prod_sku) 
{ 
    file_put_contents(ABSPATH . "wp2ges/productos/date.txt", (string) date("d/m/Y - H:i:s")); 
    file_put_contents(ABSPATH . "wp2ges/productos/total.txt", (string) $counter); 
    file_put_contents(ABSPATH . "wp2ges/productos/sku.txt", (string) $prod_sku); 
    file_put_contents(ABSPATH . "wp2ges/productos/la.txt", (string) time()); 
} 
goto Gu6zr; 
EtRCh: 
function clean_CData($chain) 
{ 
    $final_chain = str_replace(array("<![CDATA[", "]]>"), array('', ''), $chain); 
    return $final_chain; 
} 
goto MeQdH; 
AcgOZ: 
function Delete_to_Terms($term_id, $post_id, $taxonomy, $plus) 
{ 
    $term_idn = $term_id + $plus; 
    $tag = array(); 
    $tag = wc_get_product_term_ids($post_id, $taxonomy); 
    if (in_array($term_idn, $tag)) { 
        $tag = array_diff($tag, array($term_idn)); 
        wp_set_object_terms($post_id, $tag, $taxonomy); 
    } 
} 
goto F263H; 
iYZ2f: 
function upl_img_var($prod_post_id, $prod_images, $w2g_update_images, $w2g_img_options, $new_product_flag) 
{ 
    $img_gallery = array(); 
    if (!empty($prod_images)) { 
        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; 
                } 
            } 
        } 
    } else { 
        return; 
    } 
    $update_imgs = 0; 
    $update_gallery = 5; 
    $tpostid = get_post_thumbnail_id($prod_post_id); 
    if ($w2g_update_images == "yes" || $new_product_flag || !$tpostid || $tpostid == 0) { 
        if ($w2g_img_options == "5") { 
            $update_imgs = 1; 
            $update_gallery = 5; 
        } else { 
            if ($w2g_img_options == "1") { 
                $update_imgs = 1; 
                $update_gallery = 0; 
            } else { 
                if ($w2g_img_options == "0") { 
                    $update_imgs = 0; 
                    $update_gallery = 0; 
                } else { 
                    if ($w2g_img_options == "all") { 
                        $update_imgs = 1; 
                        $update_gallery = count($img_gallery); 
                    } else { 
                        $update_imgs = 1; 
                        $update_gallery = intval($w2g_img_options); 
                    } 
                } 
            } 
        } 
    } else { 
        $update_imgs = 0; 
    } 
    if ($prod_post_id != "0" || $prod_post_id != 0) { 
        if (intval($update_imgs) > 0) { 
            w2g_attach_product_thumbnail($prod_post_id, $img_gallery[0], 0); 
        } 
    } 
} 
goto TYy22; 
NhaFi: 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 
goto yEs9W; 
hrnu0: 
function product_sync() 
{ 
    $status_import = get_option("status_import", 0); 
    $allowimport = get_option("w2g_update_import", "yes"); 
    $last_time = file_get_contents(ABSPATH . "wp2ges/productos/ges_productos.txt"); 
    $to_check = file_get_contents(ABSPATH . "wp2ges/productos/wp_productos.txt"); 
    $last_action = file_get_contents(ABSPATH . "wp2ges/productos/la.txt"); 
    if ($allowimport == "yes") { 
        if ($last_time >= $to_check && $last_action < time() - 10) { 
            if ($status_import == 1) { 
                $resume = true; 
                update_products($resume); 
            } else { 
                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_products($resume); 
            } 
        } 
    } 
} 
goto Awyep; 
NUGA7: 
function w2g_attach_product_thumbnail($post_id, $url, $flag) 
{ 
    if (preg_match("/(\.jpg|\.png|\.bmp|\.jpeg|\.gif)$/", $url)) { 
        if (strpos($url, "/wp2ges/") >= 0) { 
            $turl = substr($url, strpos($url, "/wp2ges/")); 
        } else { 
            $turl = $url; 
        } 
        $courl = $turl; 
        $filename = basename($url); 
        $uploads = wp_upload_dir(); 
        $path = $uploads["basedir"] . "/wp2ges"; 
        if (!file_exists($path)) { 
            mkdir($extract_path, 493, true); 
        } 
        $imgs = $path . "/img"; 
        if (!file_exists($imgs)) { 
            mkdir($imgs, 493, true); 
        } 
        $sfile = "wp2ges/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($courl); 
            $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 iYZ2f; 
r2JWF: 
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\x8c", '', $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("\", "\302\250", "\xc2\xba", "\342\x80\x93", "~", "|", "\302\267", "&", "\xc2\277", "^", "\xc2\xa8", "\xc2\264", "#", "\342\200\xa2"), '', $texto); 
    $texto = str_replace(array("\", "\342\200\x99"), '', $texto); 
    if ($charlimit > 0) { 
        $texto = substr($texto, 0, $charlimit); 
    } 
    return $texto; 
} 
goto puGKG; 
cDr8Z: 
function exception_error_handler($severity, $message, $file, $line) 
{ 
    if (!(error_reporting() & $severity)) { 
        return; 
    } 
    throw new ErrorException($message, 0, $severity, $file, $line); 
} 
goto cjDzH; 
puGKG: 
function update_familia() 
{ 
    $allowimport = get_option("w2g_update_import", "yes"); 
    $last_time = file_get_contents(ABSPATH . "wp2ges/productos/ges_familias.txt"); 
    $to_check = file_get_contents(ABSPATH . "wp2ges/productos/wp_familias.txt"); 
    if ($allowimport == "yes") { 
        if ($last_time >= $to_check) { 
            $xml_file = ABSPATH . "wp2ges/productos/familias.xml"; 
            $w2g_p_simplexml = simplexml_load_file($xml_file); 
            if (!$w2g_p_simplexml) { 
                echo "No se puede leer el fichero.
\xa"; 
            } else { 
                update_option("ftotal_product_xml", count($w2g_p_simplexml->familia)); 
                update_option("fstart_import_time", time()); 
                update_option("fstatus_import", 1); 
                $counter = 0; 
                foreach ($w2g_p_simplexml->familia as $key => $w2g_pi_xml) { 
                    $counter++; 
                    Create_Terms($w2g_pi_xml->id, $w2g_pi_xml->nombre, "product_cat", $w2g_pi_xml->padre, 100); 
                    file_put_contents(ABSPATH . "wp2ges/productos/fsku.txt", (string) $w2g_pi_xml->nombre); 
                    file_put_contents(ABSPATH . "wp2ges/productos/ftotal.txt", (string) $counter); 
                } 
                if (get_option("w2g_update_categories_sale") == "yes") { 
                    $prodcatoffer = get_option("w2g_label_sale", "Ofertas"); 
                    Create_Terms(9990, $prodcatoffer, "product_cat", 0, 0); 
                } else { 
                    Delete_Terms(9990, "product_cat", 0); 
                } 
                if (get_option("w2g_update_categories_new") == "yes") { 
                    $prodcatnew = get_option("w2g_label_newp", "Novedades"); 
                    Create_Terms(9980, $prodcatnew, "product_cat", 0, 0); 
                } else { 
                    Delete_Terms(9980, "product_cat", 0); 
                } 
                update_option("fstatus_import", 2); 
                update_option("w2g_fam_success", time()); 
                $last_time = file_put_contents(ABSPATH . "wp2ges/productos/wp_familias.txt", (string) time()); 
            } 
        } 
    } 
} 
goto DCAld; 
oemVU: 
function w2g_product_sales_price_calc($w2g_product_price, $w2g_cost_price, $n, $product_price_type, $product_vat) 
{ 
    $w2g_product_price = str_replace(",", ".", $w2g_product_price); 
    $w2g_cost_price = str_replace(",", ".", $w2g_cost_price); 
    $n = str_replace(",", ".", $n); 
    $w2g_product_price = floatval($w2g_product_price); 
    $w2g_cost_price = floatval($w2g_cost_price); 
    $n = floatval($n); 
    $product_price_type = trim($product_price_type); 
    $w2g_new_product_price = 0; 
    if ($product_price_type == "w2g_per_cost") { 
        $w2g_new_product_price = $w2g_cost_price * (1 + $n / 100); 
    } elseif ($product_price_type == "w2g_per_pvp") { 
        $w2g_new_product_price = $w2g_product_price * (1 + $n / 100); 
    } elseif ($product_price_type == "w2g_fixed_price") { 
        $w2g_new_product_price = $w2g_product_price + $n; 
    } else { 
        $w2g_new_product_price = $w2g_product_price; 
    } 
    return strval($w2g_new_product_price); 
} 
goto SFaBK; 
Gu6zr: 
function Add_to_Terms($term_id, $post_id, $taxonomy, $plus) 
{ 
    $term_idn = $term_id + $plus; 
    $tag = array(); 
    $tag = wc_get_product_term_ids($post_id, $taxonomy); 
    if (!in_array($term_idn, $tag)) { 
        array_push($tag, $term_idn); 
        wp_set_object_terms($post_id, $tag, $taxonomy); 
    } 
} 
goto AcgOZ; 
DCAld: 
function update_marcas() 
{ 
    $last_time = file_get_contents(ABSPATH . "wp2ges/productos/ges_marcas.txt"); 
    $to_check = file_get_contents(ABSPATH . "wp2ges/productos/wp_marcas.txt"); 
    $allowimport = get_option("w2g_update_import", "yes"); 
    $mar_taxonomy = get_option("w2g_btax"); 
    if ($allowimport == "yes" and !empty($mar_taxonomy)) { 
        if ($last_time >= $to_check) { 
            $xml_file = ABSPATH . "wp2ges/productos/marcas.xml"; 
            $w2g_p_simplexml = simplexml_load_file($xml_file); 
            if (!$w2g_p_simplexml) { 
                echo "No se puede leer el fichero.
"; 
            } else { 
                $counter = 0; 
                update_option("btotal_product_xml", count($w2g_p_simplexml->marca)); 
                update_option("bstart_import_time", time()); 
                update_option("bstatus_import", 1); 
                $total_count = count($w2g_p_simplexml->marca); 
                foreach ($w2g_p_simplexml->marca as $key => $w2g_pi_xml) { 
                    $counter++; 
                    Create_Terms($w2g_pi_xml->id, $w2g_pi_xml->nombre, $mar_taxonomy, 0, 5000); 
                    file_put_contents(ABSPATH . "wp2ges/productos/bsku.txt", (string) $w2g_pi_xml->nombre); 
                    file_put_contents(ABSPATH . "wp2ges/productos/btotal.txt", (string) $counter); 
                } 
                update_option("w2g_mar_success", time()); 
                update_option("bstatus_import", 2); 
                $last_time = file_put_contents(ABSPATH . "wp2ges/productos/wp_marcas.txt", (string) time()); 
            } 
        } 
    } 
} 
goto jJ92E; 
e0PB1: 
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; 
    $w2g_pi_table_prefix = $wpdb->prefix; 
    $w2g_table = $w2g_pi_table_prefix . "w2g_xml_products"; 
    $counter = 0; 
    $w2g_update_lang = get_option("w2g_update_lang"); 
    $w2g_update_prod_price = get_option("w2g_update_prod_price"); 
    $w2g_update_price_val = get_option("w2g_update_price_val"); 
    $w2g_update_newp = get_option("w2g_update_newp"); 
    $w2g_update_title = get_option("w2g_update_title"); 
    $w2g_update_desc = get_option("w2g_update_desc"); 
    $w2g_update_excerpt = get_option("w2g_update_excerpt"); 
    $w2g_update_stock = get_option("w2g_update_stock"); 
    $w2g_update_cost_price = get_option("w2g_update_cost_price"); 
    $w2g_update_categories = get_option("w2g_update_categories"); 
    $w2g_update_categories_new = get_option("w2g_update_categories_new"); 
    $w2g_update_categories_sale = get_option("w2g_update_categories_sale"); 
    $w2g_update_brands = get_option("w2g_update_brands"); 
    $w2g_update_images = get_option("w2g_update_images"); 
    $w2g_img_options = get_option("w2g_img_options"); 
    $w2g_rev_new_prod = get_option("w2g_rev_new_prod"); 
    $w2g_price_iva_incl = get_option("w2g_price_iva_incl"); 
    $w2g_update_discontinued_pv = get_option("w2g_update_discontinued_pv"); 
    $w2g_catmap = get_option("w2g_map_cat"); 
    $w2g_catfilter = get_option("w2g_filter_cat"); 
    $w2g_prodfilter = get_option("w2g_filter_prod"); 
    $w2g_brandfilter = get_option("w2g_filter_brand"); 
    if ($w2g_catmap == 1) { 
        $w2g_catmapping = get_option("map_product_categories"); 
    } else { 
        $w2g_catmapping = array(); 
    } 
    if ($w2g_catfilter == 1) { 
        $w2g_cat_filter = get_option("w2g_indluded_cat_key"); 
    } else { 
        if ($w2g_catfilter == 2) { 
            $w2g_cat_filter = get_option("w2g_excluded_cat_key"); 
        } else { 
            $w2g_cat_filter = array(); 
        } 
    } 
    if ($w2g_prodfilter == 1) { 
        $w2g_prod_filter = get_option("w2g_indluded_prod_key"); 
    } else { 
        if ($w2g_prodfilter == 2) { 
            $w2g_prod_filter = get_option("w2g_excluded_prod_key"); 
        } else { 
            $w2g_prod_filter = array(); 
        } 
    } 
    if ($w2g_brandfilter == 1) { 
        $w2g_brand_filter = get_option("w2g_indluded_brand_key"); 
    } else { 
        if ($w2g_brandfilter == 2) { 
            $w2g_brand_filter = get_option("w2g_excluded_brand_key"); 
        } else { 
            $w2g_brand_filter = array(); 
        } 
    } 
    $count = 0; 
    $xml = load_xml_file("productos.xml"); 
    $total_count = count($xml->producto); 
    update_option("total_product_xml", $total_count); 
    $post_author = get_current_user_id(); 
    $post_status = "publish"; 
    $post_parent = ''; 
    $post_type = "product"; 
    $prodcatnew = get_option("w2g_label_newp", "Novedades"); 
    $prodcatoffer = get_option("w2g_label_sale", "Ofertas"); 
    $w2g_update_lang = get_option("w2g_update_lang", true); 
    $last_import_sku = file_get_contents(ABSPATH . "wp2ges/productos/sku.txt"); 
    clean_product_incomplete(); 
    $mailrep = get_option("w2g_update_pv_email"); 
    $stop = get_option("stop_import", "0"); 
    file_put_contents(ABSPATH . "wp2ges/productos/total.txt", (string) 0); 
    $mar_taxonomy = get_option("w2g_btax"); 
    $w2g_title_mod = get_option("w2g_title_mod"); 
    $prod_wofer = get_option("prod_wofer", array()); 
    $delete_offer = 0; 
    clearstatcache(); 
    $nowlist = array(); 
    if ($total_count > 0) { 
        foreach ($xml->producto as $key => $product) { 
            $array_prod_cats = array(); 
            $new_db_prod_id = $product->id_art; 
            $prod_id = $product->id_art; 
            $prod_sku = (string) $product->referencia; 
            $brand = (string) $product->marca->nombre; 
            array_push($nowlist, (string) $prod_id); 
            if ($fimport) { 
                $count++; 
                if ($prod_sku == $last_import_sku) { 
                    $fimport = false; 
                    $count--; 
                    $counter = $count; 
                    Update_Counters($counter, $prod_sku); 
                } else { 
                    continue; 
                } 
            } 
            $prod_categories = $product->familia; 
            if ($w2g_catfilter == 1) { 
                $cat_include = false; 
                foreach ($prod_categories as $cat_vals) { 
                    if (in_array($cat_vals->id, $w2g_cat_filter)) { 
                        $cat_include = true; 
                        break; 
                    } 
                } 
                if (!$cat_include) { 
                    $counter++; 
                    Update_Counters($counter, $prod_sku); 
                    continue; 
                } 
            } else { 
                if ($w2g_catfilter == 2) { 
                    $cat_exclude = false; 
                    foreach ($prod_categories as $cat_vals) { 
                        if (in_array($cat_vals->id, $w2g_cat_filter)) { 
                            $cat_exclude = true; 
                            break; 
                        } 
                    } 
                    if ($cat_exclude) { 
                        $counter++; 
                        Update_Counters($counter, $prod_sku); 
                        continue; 
                    } 
                } 
            } 
            if ($w2g_prodfilter == 1) { 
                if (!in_array($prod_sku, $w2g_prod_filter)) { 
                    $counter++; 
                    Update_Counters($counter, $prod_sku); 
                    continue; 
                } 
            } else { 
                if ($w2g_prodfilter == 2) { 
                    if (in_array($prod_sku, $w2g_prod_filter)) { 
                        $counter++; 
                        Update_Counters($counter, $prod_sku); 
                        continue; 
                    } 
                } 
            } 
            if ($w2g_brandfilter == 1) { 
                if (!in_array($brand, $w2g_brand_filter)) { 
                    $counter++; 
                    Update_Counters($counter, $prod_sku); 
                    continue; 
                } 
            } else { 
                if ($w2g_brandfilter == 2) { 
                    if (in_array($brand, $w2g_brand_filter)) { 
                        $counter++; 
                        Update_Counters($counter, $prod_sku); 
                        continue; 
                    } 
                } 
            } 
            $prod_type = "simple"; 
            $prod_commonvar = ''; 
            $variation_data = ''; 
            if (!empty($product->tyc)) { 
                $prod_type = "variable"; 
            } 
            $prod_title = clean_text(clean_CData($product->nombre)); 
            if ($w2g_title_mod == "may") { 
                $prod_title = utf8_decode($prod_title); 
                $prod_title = strtoupper($prod_title); 
                $prod_title = utf8_encode($prod_title); 
            } else { 
                if ($w2g_title_mod == "cap") { 
                    $prod_title = utf8_decode($prod_title); 
                    $prod_title = strtolower($prod_title); 
                    $prod_title = ucwords($prod_title); 
                    $prod_title = utf8_encode($prod_title); 
                } else { 
                    if ($w2g_title_mod == "min") { 
                        $prod_title = utf8_decode($prod_title); 
                        $prod_title = strtolower($prod_title); 
                        $prod_title = utf8_encode($prod_title); 
                    } 
                } 
            } 
            $prod_desc = clean_text(clean_CData($product->descripcionhtml), false); 
            $prod_excerpt = clean_text(clean_CData($product->descripcion)); 
            $prod_author = $post_author; 
            $prod_parent = $post_parent; 
            $prod_post_type = $post_type; 
            $prod_visibility = "visible"; 
            $prod_issale = "0"; 
            $prod_isnew = "0"; 
            $prod_sales_price = 0; 
            if (!is_null($product->oferta)) { 
                if (!in_array($prod_sku, $prod_wofer)) { 
                    array_push($prod_wofer, $prod_sku); 
                    update_option("prod_wofer", $prod_wofer); 
                } 
                $prod_issale = 1; 
                if ($w2g_price_iva_incl == "yes") { 
                    $prod_sales_price = $product->oferta->precio_oferta_iva; 
                } else { 
                    $prod_sales_price = $product->oferta->precio_oferta; 
                } 
                $prod_sales_price = str_replace(",", ".", $prod_sales_price); 
            } 
            if (!is_null($product->novedad)) { 
                $prod_isnew = $product->novedad; 
            } 
            $prod_cost = $product->precio_coste; 
            $prod_brand = $product->marcas->marca; 
            $prod_barcode = $product->referencia; 
            $prod_barcodeName = ''; 
            $prod_stock = $product->stock; 
            $stock_status = ''; 
            if (intval($prod_stock) >= 1) { 
                $stock_status = "instock"; 
            } else { 
                $stock_status = "outstock"; 
            } 
            $prod_stock_status = $stock_status; 
            $prod_downloadable = ''; 
            $prod_virtual = "no"; 
            $prod_price = $product->precio_venta; 
            $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->precio_venta; 
            $prod_length = 0; 
            $prod_width = 0; 
            $prod_height = 0; 
            $prod_weight = 0; 
            $prod_stock = $prod_stock; 
            $product_destock = 0; 
            $product_vat = $product->IVA; 
            $prod_status = "importing"; 
            $product_recom_price = $product->precio_venta; 
            if ($w2g_price_iva_incl == "yes") { 
                $prod_price = $product->precio_venta_IVA; 
                $prod_regular_price = $product->precio_venta_IVA; 
                $product_recom_price = $product->precio_venta_IVA; 
            } 
            $str_prod_categories = $prod_categories; 
            if ($w2g_update_prod_price == "normal" || $w2g_update_prod_price == "w2g_per_cost" || $w2g_update_prod_price == "w2g_per_pvp" || $w2g_update_prod_price == "w2g_fixed_price") { 
                $prod_price = w2g_product_sales_price_calc($prod_price, $prod_cost, $w2g_update_price_val, $w2g_update_prod_price, $product_vat); 
            } 
            $ffound = false; 
            $prod_post_id = misha_post_id_by_meta_key_and_value("_sku", $prod_sku); 
            $prstatus = get_post_status($prod_post_id); 
            if ($prstatus === "revision") { 
                $counter++; 
                Update_Counters($counter, $prod_sku); 
                continue; 
            } 
            if (empty($prod_sales_price)) { 
                if (in_array($prod_sku, $prod_wofer)) { 
                    $delete_offer = 1; 
                    $prod_wofer = array_diff($prod_wofer, array($prod_sku)); 
                    update_option("prod_wofer", $prod_wofer); 
                } 
            } 
            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, $w2g_update_discontinued_pv, $mailrep); 
                    } 
                } 
                $gproduct = wc_get_product($prod_post_id); 
                $new_product_flag = false; 
                if (!empty($product->tyc)) { 
                    foreach ($product->tyc->color as $key => $colores) { 
                        foreach ($colores->tallas->talla as $key => $utalla) { 
                            $tc_prod_post_id = misha_post_id_by_meta_key_and_value("_sku", $utalla->id_tyc); 
                            if (!empty($tc_prod_post_id)) { 
                                w2g_add_variations_to_products($prod_post_id, $utalla->id_tyc, $colores->nombre_color, $utalla->nombre, (string) $prod_price, (string) $utalla->unidades, (string) $prod_barcode, (string) $prod_cost, $prod_visibility, $colores->images_color->image, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, false, $prod_sales_price, (string) $prod_id, $delete_offer); 
                            } else { 
                                w2g_add_variations_to_products($prod_post_id, $utalla->id_tyc, $colores->nombre_color, $utalla->nombre, (string) $prod_price, (string) $utalla->unidades, (string) $prod_barcode, (string) $prod_cost, $prod_visibility, $colores->images_color->image, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, true, $prod_sales_price, (string) $prod_id, $delete_offer); 
                            } 
                        } 
                    } 
                } 
            } else { 
                if ($prstatus === "draft") { 
                    wp_delete_post($prod_post_id, true); 
                } 
                $prod_post_id = w2g_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt); 
                $new_product_flag = true; 
            } 
            if ($new_product_flag) { 
                if ($w2g_update_newp == "no") { 
                    $counter++; 
                    Update_Counters($counter, $prod_sku); 
                    continue; 
                } 
                $temp_prod_parent = 0; 
                if (isset($w2g_catmapping) && $w2g_catmap == 1) { 
                    $STemp_Cat_ID = $product->familia->id; 
                    foreach ($w2g_catmapping as $cat_sluga => $prod_cater) { 
                        if ($prod_cater["gid"] == $STemp_Cat_ID) { 
                            $STemp_Cat_RID = get_term_by("slug", $prod_cater["slug"], "product_cat"); 
                            Add_to_Terms($STemp_Cat_RID->term_id, $prod_post_id, "product_cat", 0); 
                            $temp_cat_id = $STemp_Cat_RID->term_id; 
                            break; 
                        } 
                    } 
                } else { 
                    Add_to_Terms($product->familia->id, $prod_post_id, "product_cat", 100); 
                    $temp_cat_id = (int) $product->familia->id + 100; 
                } 
                $temp_cat = get_term_by("term_id", $temp_cat_id, "product_cat"); 
                if (!is_null($temp_cat)) { 
                    $temp_prod_parent = $temp_cat->parent; 
                    while ($temp_prod_parent != 0) { 
                        $temp_cat = get_term_by("term_id", $temp_prod_parent, "product_cat"); 
                        $temp_prod_parent = $temp_cat->parent; 
                        Add_to_Terms($temp_cat->term_id, $prod_post_id, "product_cat", 0); 
                    } 
                } 
                if ($w2g_update_categories_new == "yes" && $prod_isnew == 1) { 
                    Add_to_Terms(9980, $prod_post_id, "product_cat", 0); 
                } 
                if ($w2g_update_categories_sale == "yes" && $prod_issale == 1) { 
                    Add_to_Terms(9990, $prod_post_id, "product_cat", 0); 
                } 
                if (!is_null($mar_taxonomy)) { 
                    Add_to_Terms($product->marca->id, $prod_post_id, $mar_taxonomy, 5000); 
                } 
                $gproduct = wc_get_product($prod_post_id); 
                if ($gproduct) { 
                    $gproduct->set_regular_price((string) $prod_price); 
                    $gproduct->set_price((string) $prod_price); 
                    $gproduct->set_downloadable(false); 
                    $gproduct->set_virtual(false); 
                    $gproduct->set_purchase_note($prod_purchase_note); 
                    $gproduct->set_featured($prod_featured); 
                    if ($prod_issale == 0 || $delete_offer == 1) { 
                        $gproduct->set_sale_price(''); 
                    } else { 
                        $gproduct->set_sale_price($prod_sales_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); 
                    $gproduct->set_sku($prod_sku); 
                    if (!empty($product->tyc)) { 
                        $gproduct->set_catalog_visibility("visible"); 
                        $gproduct->set_stock_quantity("instock"); 
                        $gproduct->set_manage_stock(false); 
                        $gproduct->set_name($prod_title); 
                    } else { 
                        $gproduct->set_catalog_visibility($prod_visibility); 
                        $gproduct->set_manage_stock(true); 
                    } 
                    $gproduct->save(); 
                    wp_set_object_terms($prod_post_id, $prod_type, "product_type"); 
                    if (!empty($product->tyc)) { 
                        foreach ($product->tyc->color as $key => $colores) { 
                            foreach ($colores->tallas->talla as $key => $utalla) { 
                                w2g_add_variations_to_products($prod_post_id, $utalla->id_tyc, $colores->nombre_color, $utalla->nombre, (string) $prod_price, (string) $utalla->unidades, (string) $prod_barcode, (string) $prod_cost, $prod_visibility, $colores->images_color->image, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, true, $prod_sales_price, (string) $prod_id, $delete_offer); 
                            } 
                        } 
                    } 
                } 
            } else { 
                $pproduct = wc_get_product($prod_post_id); 
                $needsave = false; 
                if ($pproduct) { 
                    if ($w2g_update_title == "yes") { 
                        $pproduct->set_name($prod_title); 
                        $needsave = true; 
                    } 
                    if ($w2g_update_desc == "yes") { 
                        $pproduct->set_description($prod_desc); 
                        $needsave = true; 
                    } 
                    if ($w2g_update_excerpt == "yes") { 
                        $pproduct->set_short_description($prod_excerpt); 
                        $needsave = true; 
                    } 
                    if ($w2g_update_stock == "yes") { 
                        $pproduct->set_stock_status($prod_stock_status); 
                        $pproduct->set_stock_quantity($prod_stock); 
                        $needsave = true; 
                    } 
                    if ($w2g_update_cost_price == "yes") { 
                        $ssdatefrom = $pproduct->get_date_on_sale_from(); 
                        $ssdateto = $pproduct->get_date_on_sale_to(); 
                        if ($prod_issale == 0) { 
                            $ssprice = $pproduct->get_sale_price(); 
                        } else { 
                            $ssprice = $prod_sales_price; 
                        } 
                        $pproduct->set_regular_price((string) $prod_price); 
                        $pproduct->set_price((string) $prod_price); 
                        if (!empty($ssprice)) { 
                            if ($delete_offer == 1) { 
                                $pproduct->set_sale_price(''); 
                                $pproduct->set_date_on_sale_from(''); 
                                $pproduct->set_date_on_sale_to(''); 
                            } else { 
                                $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 ($w2g_update_categories == "yes") { 
                        $temp_prod_parent = 0; 
                        if (isset($w2g_catmapping) && $w2g_catmap == 1) { 
                            $STemp_Cat_ID = $product->familia->id; 
                            foreach ($w2g_catmapping as $cat_sluga => $prod_cater) { 
                                if ($prod_cater["gid"] == $STemp_Cat_ID) { 
                                    $STemp_Cat_RID = get_term_by("slug", $prod_cater["slug"], "product_cat"); 
                                    Add_to_Terms($STemp_Cat_RID->term_id, $prod_post_id, "product_cat", 0); 
                                    $temp_cat_id = $STemp_Cat_RID->term_id; 
                                    break; 
                                } 
                            } 
                        } else { 
                            Add_to_Terms($product->familia->id, $prod_post_id, "product_cat", 100); 
                            $temp_cat_id = (int) $product->familia->id + 100; 
                        } 
                        $temp_cat = get_term_by("term_id", $temp_cat_id, "product_cat"); 
                        if (!is_null($temp_cat)) { 
                            $temp_prod_parent = $temp_cat->parent; 
                            while ($temp_prod_parent != 0) { 
                                $temp_cat = get_term_by("term_id", $temp_prod_parent, "product_cat"); 
                                $temp_prod_parent = $temp_cat->parent; 
                                Add_to_Terms($temp_cat->term_id, $prod_post_id, "product_cat", 0); 
                            } 
                        } 
                    } 
                    if ($w2g_update_brands == "yes" && !is_null($mar_taxonomy)) { 
                        Add_to_Terms($product->marca->id, $prod_post_id, $mar_taxonomy, 5000); 
                    } 
                    if ($w2g_update_categories_new == "yes" && $prod_isnew == 1) { 
                        Add_to_Terms(9980, $prod_post_id, "product_cat", 0); 
                    } else { 
                        Delete_to_Terms(9980, $prod_post_id, "product_cat", 0); 
                    } 
                    if ($w2g_update_categories_sale == "yes" && $prod_issale == 1) { 
                        Add_to_Terms(9990, $prod_post_id, "product_cat", 0); 
                    } else { 
                        Delete_to_Terms(9990, $prod_post_id, "product_cat", 0); 
                    } 
                } 
            } 
            $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); 
                $uproduct->update_meta_data("_w2g_id", (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 ($w2g_update_images == "yes" || $new_product_flag) { 
                if ($w2g_img_options == "5") { 
                    $update_imgs = 1; 
                    $update_gallery = 5; 
                } else { 
                    if ($w2g_img_options == "1") { 
                        $update_imgs = 1; 
                        $update_gallery = 0; 
                    } else { 
                        if ($w2g_img_options == "0") { 
                            $update_imgs = 0; 
                            $update_gallery = 0; 
                        } else { 
                            if ($w2g_img_options == "all") { 
                                $update_imgs = 1; 
                                $update_gallery = count($img_gallery); 
                            } else { 
                                $update_imgs = 1; 
                                $update_gallery = intval($w2g_img_options); 
                            } 
                        } 
                    } 
                } 
            } else { 
                $update_imgs = 0; 
            } 
            if ($prod_post_id != "0" || $prod_post_id != 0) { 
                if (intval($update_imgs) > 0) { 
                    w2g_attach_product_thumbnail($prod_post_id, $img_gallery[0], 0); 
                    for ($i = 1; $i < count($img_gallery); $i++) { 
                        if (intval($update_gallery) <= $i) { 
                            break; 
                        } 
                        w2g_attach_product_thumbnail($prod_post_id, $img_gallery[$i], 1); 
                    } 
                } 
                if ($new_product_flag) { 
                    $rev_para = false; 
                    if ($w2g_rev_new_prod == "yes") { 
                        wp_update_post(array("ID" => $prod_post_id, "post_status" => "revision")); 
                    } else { 
                        if (empty($product->tyc) && ($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); 
        } 
        update_option("status_import", 2); 
        update_option("end_import_date", date("d/m/Y - H:i:s")); 
        update_option("last_sku", ''); 
        update_option("w2g_prod_success", time()); 
        file_put_contents(ABSPATH . "wp2ges/productos/wp_productos.txt", (string) time()); 
        add_filter("content_save_pre", "wp_filter_post_kses"); 
        add_filter("content_filtered_save_pre", "wp_filter_post_kses"); 
        clean_product_incomplete(); 
    } 
} 
goto hrnu0; 
mvGxN: 
function SeekImg($imgname) 
{ 
    global $wpdb; 
    $sql = $wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} 
\x9\x9         WHERE meta_key = '_wp_attached_file' AND meta_value = %s", $imgname); 
    $post_id = $wpdb->get_results($sql); 
    return $post_id; 
} 
goto oemVU; 
yEs9W: 
$path = preg_replace("/wp-content.*$/", '', __DIR__); 
goto oyoeh; 
LXz3p: 
function clean_product_incomplete() 
{ 
    global $wpdb; 
    $ids = $wpdb->delete($wpdb->posts, array("post_type" => "product", "post_status" => "importing")); 
} 
goto CpkJg; 
cjDzH: 
function print_mem($Fase = '') 
{ 
    $mem_usage = memory_get_usage(); 
    $mem_peak = memory_get_peak_usage(); 
    error_log("The script " . $Fase . " is now using: <strong>" . round($mem_usage / 1024) . "KB</strong> of memory.<br>"); 
    error_log("Peak usage: <strong>" . round($mem_peak / 1024) . "KB</strong> of memory.<br><br>"); 
} 
goto cFd6N; 
nIKS6: 
function Create_Terms($term_id, $name, $taxonomy, $padre, $plus) 
{ 
    global $wpdb; 
    $term_idn = $term_id + $plus; 
    if ($padre > 0) { 
        $padren = $padre + $plus; 
    } else { 
        $padren = $padre; 
    } 
    $term = get_term_by("term_id", $term_idn, $taxonomy); 
    if (!$term) { 
        $wpdb->insert($wpdb->prefix . "terms", array("term_id" => $term_idn, "name" => clean_text($name), "slug" => sanitize_title(clean_text(strtolower($name))))); 
        $wpdb->insert($wpdb->prefix . "term_taxonomy", array("term_taxonomy_id" => $term_idn, "term_id" => $term_idn, "taxonomy" => $taxonomy, "parent" => $padren)); 
    } elseif ($term->name != clean_text($name) or $term->taxonomy != $taxonomy) { 
        $wpdb->update($wpdb->prefix . "terms", array("name" => clean_text($name), "slug" => sanitize_title(clean_text(strtolower($name))), "taxonomy" => $taxonomy), array("term_id" => $term_idn)); 
    } 
    clean_term_cache($term_idn, $taxonomy); 
} 
goto r2JWF; 
cFd6N: 
function send_debug_email($subject = '', $message = '') 
{ 
    $to = get_option("w2g_update_pv_email"); 
    if (!empty($to)) { 
        wp_mail($to, $subject, $message); 
    } 
} 
goto sto4E; 
jJ92E: 
function w2g_add_variations_to_products($postid, $sku, $colorname, $tallaname, $price, $stock, $barcode = '', $costprice = '', $prod_visibility, $prod_images, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, $new_product_flag, $saleprice, $prodid, $delete_offer) 
{ 
    $product_type = "product_variation"; 
    $product = wc_get_product($postid); 
    if ($product) { 
        $product_attributes = array(); 
        $name = "Color"; 
        $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); 
        } 
        $value = (string) $colorname; 
        $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); 
        $name = "Talla"; 
        $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); 
        } 
        $value = (string) $tallaname; 
        $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(strval($sku)); 
        $variation = wc_get_product($varid); 
        if (!$variation && $new_product_flag) { 
            $variation = new WC_Product_Variation(); 
            $variation->set_parent_id($product->get_id()); 
            $variation->set_sku($sku); 
            $variation->set_manage_stock(true); 
            $variation->set_stock_quantity($stock); 
            $variation->set_price($price); 
            $variation->set_regular_price($price); 
        } 
        if ($variation->get_status() == "ignore") { 
            return; 
        } 
        if ($w2g_update_stock == "yes") { 
            $variation->set_stock_quantity($stock); 
        } 
        if ($w2g_update_cost_price == "yes") { 
            $variation->set_price($price); 
            $variation->set_regular_price($price); 
            if ($saleprice > 0) { 
                $ssprice = $saleprice; 
            } else { 
                $ssprice = $variation->get_sale_price(); 
            } 
            $ssdatefrom = $variation->get_date_on_sale_from(); 
            $ssdateto = $variation->get_date_on_sale_to(); 
            if (!empty($ssprice)) { 
                if ($delete_offer == 1) { 
                    $variation->set_sale_price(''); 
                    $variation->set_date_on_sale_from(''); 
                    $variation->set_date_on_sale_to(''); 
                } else { 
                    $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("_w2g_id", (string) $prodid); 
        $variation->save(); 
        $myvarid = $variation->get_id(); 
        update_post_meta($myvarid, "attribute_" . wc_attribute_taxonomy_name("Color"), sanitize_title($colorname)); 
        update_post_meta($myvarid, "attribute_" . wc_attribute_taxonomy_name("Talla"), sanitize_title($tallaname)); 
        upl_img_var($myvarid, $prod_images, $w2g_update_images, $w2g_img_options, $new_product_flag); 
        if (!count($default_attributes = get_post_meta($postid, "_default_attributes"))) { 
            $new_defaults = array(); 
            $new_defaults[wc_attribute_taxonomy_name("Color")] = sanitize_title($colorname); 
            if (!empty(sanitize_title($avalue[2]))) { 
                $new_defaults[wc_attribute_taxonomy_name("Talla")] = sanitize_title($tallaname); 
            } 
            update_post_meta($postid, "_default_attributes", $new_defaults); 
        } 
    } 
} 
goto e0PB1; 
YqKRX: 
function PErrors($Text) 
{ 
    file_put_contents(ABSPATH . "wp2ges/productos/error.txt", $Text . "
\xd", FILE_APPEND); 
} 
goto cDr8Z; 
CpkJg: 
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 RC765; 
SFaBK: 
function load_xml_file($name) 
{ 
    $basedir = ABSPATH; 
    $espdir = $basedir . "/wp2ges/productos/"; 
    $w2g_p_simplexml = simplexml_load_file($espdir . $name); 
    return $w2g_p_simplexml; 
} 
goto EtRCh; 
TYy22: 
function offproduct($prod_sku, $prod_title, $w2g_update_discontinued_pv, $mailrep) 
{ 
    $prod_post_id = wc_get_product_id_by_sku($prod_sku); 
    if (get_post_status($prod_post_id) === "publish") { 
        $w2g_id = get_post_meta($prod_post_id, "_w2g_id"); 
        if (!empty($w2g_id[0])) { 
            if ($w2g_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], "_w2g_id"); 
                        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 . "
\xa"; 
                        update_option("list_disable_product", $oldpr); 
                    } 
                } 
            } else { 
                if ($w2g_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], "_w2g_id"); 
                            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\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 . "--" . $prod_sku . " " . $prod_title . "
\xa"; 
                            update_option("list_disable_product", $oldpr); 
                        } 
                    } 
                } 
            } 
        } 
    } 
} 
goto XujyZ; 
F263H: 
function Delete_Terms($term_id, $taxonomy, $plus) 
{ 
    global $wpdb; 
    $term_idn = $term_id + $plus; 
    $term = get_term_by("term_id", $term_idn, $taxonomy); 
    if ($term) { 
        $wpdb->delete($wpdb->prefix . "terms", array("term_id" => $term_idn)); 
        $wpdb->delete($wpdb->prefix . "term_taxonomy", array("term_taxonomy_id" => $term_idn, "term_id" => $term_idn)); 
    } 
    clean_term_cache($term_idn, $taxonomy); 
} 
goto nIKS6; 
CsFtg: 
header("Cache-Control: no-cache, must-revalidate"); 
goto NhaFi; 
KENJj: 
require_once ABSPATH . "wp-admin/includes/image.php"; 
goto YqKRX; 
sto4E: 
function w2g_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt) 
{ 
    $xml_post = array("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 EqbM0; 
XujyZ: 
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 mvGxN; 
RC765: 
function get_attribute_id_from_name($name) 
{ 
    global $wpdb; 
    $attribute_id = $wpdb->get_col("SELECT attribute_id
\x9    FROM {$wpdb->prefix}woocommerce_attribute_taxonomies
\x9    WHERE attribute_name LIKE '{$name}'"); 
    return reset($attribute_id); 
} 
goto NUGA7; 
EqbM0: 
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, strval($meta_value))); 
    if (count($ids) > 1) { 
        $zid = 0; 
        for ($z = 0; $z < count($ids); $z++) { 
            $zprstatus = get_post_status($ids[$z]); 
            if (empty($ids[$z]) || !($zprstatus === "publish" || $zprstatus === "private")) { 
                $dres = wp_delete_post($ids[$z], true); 
                if (!$dres) { 
                    delete_post_meta($ids[$z], $meta_key); 
                } 
            } else { 
                $zid = $z; 
            } 
        } 
        return $ids[$zid]; 
    } else { 
        if (count($ids) == 0) { 
            return ''; 
        } else { 
            return $ids[0]; 
        } 
    } 
} 
goto LXz3p; 
oyoeh: 
require_once $path . "wp-load.php"; 
goto KENJj; 
Awyep: 
 ?>

Did this file decode correctly?

Original Code

<?php
goto CsFtg;
MeQdH:
function Update_Counters($counter, $prod_sku)
{
    file_put_contents(ABSPATH . "\x77\160\62\147\145\163\x2f\160\x72\x6f\144\x75\143\x74\x6f\x73\57\144\141\x74\x65\56\164\170\164", (string) date("\144\57\155\57\131\40\55\x20\x48\x3a\x69\72\163"));
    file_put_contents(ABSPATH . "\x77\x70\x32\x67\145\163\x2f\160\162\x6f\x64\x75\x63\x74\157\163\x2f\164\157\164\141\154\x2e\x74\x78\x74", (string) $counter);
    file_put_contents(ABSPATH . "\x77\x70\62\x67\145\163\x2f\160\x72\157\144\x75\x63\164\x6f\x73\x2f\x73\x6b\165\x2e\164\170\164", (string) $prod_sku);
    file_put_contents(ABSPATH . "\167\x70\x32\x67\x65\x73\57\160\162\x6f\144\x75\143\x74\157\x73\x2f\154\141\56\164\170\x74", (string) time());
}
goto Gu6zr;
EtRCh:
function clean_CData($chain)
{
    $final_chain = str_replace(array("\74\41\133\x43\x44\101\124\101\x5b", "\135\135\x3e"), array('', ''), $chain);
    return $final_chain;
}
goto MeQdH;
AcgOZ:
function Delete_to_Terms($term_id, $post_id, $taxonomy, $plus)
{
    $term_idn = $term_id + $plus;
    $tag = array();
    $tag = wc_get_product_term_ids($post_id, $taxonomy);
    if (in_array($term_idn, $tag)) {
        $tag = array_diff($tag, array($term_idn));
        wp_set_object_terms($post_id, $tag, $taxonomy);
    }
}
goto F263H;
iYZ2f:
function upl_img_var($prod_post_id, $prod_images, $w2g_update_images, $w2g_img_options, $new_product_flag)
{
    $img_gallery = array();
    if (!empty($prod_images)) {
        foreach ($prod_images as $k => $p_img) {
            $arr_p_img = (array) $p_img;
            foreach ($arr_p_img as $key => $img_val) {
                if ($key == "\x73\x72\x63") {
                    $img_gallery[] = $img_val;
                }
            }
        }
    } else {
        return;
    }
    $update_imgs = 0;
    $update_gallery = 5;
    $tpostid = get_post_thumbnail_id($prod_post_id);
    if ($w2g_update_images == "\x79\x65\163" || $new_product_flag || !$tpostid || $tpostid == 0) {
        if ($w2g_img_options == "\x35") {
            $update_imgs = 1;
            $update_gallery = 5;
        } else {
            if ($w2g_img_options == "\x31") {
                $update_imgs = 1;
                $update_gallery = 0;
            } else {
                if ($w2g_img_options == "\60") {
                    $update_imgs = 0;
                    $update_gallery = 0;
                } else {
                    if ($w2g_img_options == "\141\x6c\154") {
                        $update_imgs = 1;
                        $update_gallery = count($img_gallery);
                    } else {
                        $update_imgs = 1;
                        $update_gallery = intval($w2g_img_options);
                    }
                }
            }
        }
    } else {
        $update_imgs = 0;
    }
    if ($prod_post_id != "\x30" || $prod_post_id != 0) {
        if (intval($update_imgs) > 0) {
            w2g_attach_product_thumbnail($prod_post_id, $img_gallery[0], 0);
        }
    }
}
goto TYy22;
NhaFi:
header("\105\170\160\151\x72\145\163\72\40\123\x61\x74\x2c\x20\x32\x36\x20\112\165\x6c\40\61\x39\x39\67\40\x30\x35\x3a\x30\60\x3a\60\x30\40\x47\x4d\124");
goto yEs9W;
hrnu0:
function product_sync()
{
    $status_import = get_option("\163\x74\x61\164\x75\163\137\x69\x6d\160\x6f\x72\x74", 0);
    $allowimport = get_option("\x77\62\147\x5f\165\x70\x64\x61\x74\145\x5f\x69\155\x70\157\x72\x74", "\x79\x65\163");
    $last_time = file_get_contents(ABSPATH . "\x77\x70\62\x67\x65\x73\x2f\x70\162\x6f\144\165\143\x74\x6f\x73\x2f\x67\x65\163\137\160\x72\x6f\144\165\143\x74\x6f\x73\56\164\170\x74");
    $to_check = file_get_contents(ABSPATH . "\167\x70\62\x67\145\163\57\x70\162\157\x64\165\143\164\157\163\x2f\167\160\x5f\160\x72\x6f\144\x75\x63\164\x6f\x73\x2e\x74\170\164");
    $last_action = file_get_contents(ABSPATH . "\167\160\x32\147\x65\x73\x2f\160\162\x6f\x64\x75\x63\x74\157\163\57\x6c\141\x2e\x74\170\164");
    if ($allowimport == "\x79\x65\163") {
        if ($last_time >= $to_check && $last_action < time() - 10) {
            if ($status_import == 1) {
                $resume = true;
                update_products($resume);
            } else {
                update_option("\x73\164\141\164\165\163\x5f\x69\x6d\160\157\x72\164", 1);
                update_option("\163\164\x61\x72\164\137\x69\155\x70\157\162\164\137\164\151\x6d\x65", time());
                update_option("\163\164\141\162\x74\137\x69\155\160\157\162\x74\137\144\x61\164\x65", date("\144\x2f\155\57\131\40\x2d\40\110\72\x69\72\163"));
                update_option("\x73\164\141\x72\x74\x5f\x69\x6d\x70\x6f\x72\164\137\144\x61\x74\145\143", date("\x59\57\155\57\144\x20\x48\x3a\x69\x3a\x73"));
                $resume = false;
                update_products($resume);
            }
        }
    }
}
goto Awyep;
NUGA7:
function w2g_attach_product_thumbnail($post_id, $url, $flag)
{
    if (preg_match("\57\50\134\x2e\152\160\147\174\x5c\x2e\160\156\147\174\134\56\x62\155\160\x7c\134\x2e\152\160\x65\x67\174\134\56\147\151\x66\x29\x24\x2f", $url)) {
        if (strpos($url, "\57\167\160\62\x67\x65\x73\x2f") >= 0) {
            $turl = substr($url, strpos($url, "\57\x77\160\62\147\x65\x73\x2f"));
        } else {
            $turl = $url;
        }
        $courl = $turl;
        $filename = basename($url);
        $uploads = wp_upload_dir();
        $path = $uploads["\x62\141\163\x65\x64\151\x72"] . "\x2f\x77\160\x32\147\145\x73";
        if (!file_exists($path)) {
            mkdir($extract_path, 493, true);
        }
        $imgs = $path . "\57\x69\155\x67";
        if (!file_exists($imgs)) {
            mkdir($imgs, 493, true);
        }
        $sfile = "\167\160\x32\147\145\x73\x2f\x69\155\x67\x2f" . $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($courl);
            $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\x6f\163\x74\137\155\151\155\x65\x5f\164\x79\x70\145" => $wp_filetype["\x74\171\160\145"], "\x70\157\163\x74\x5f\164\151\x74\x6c\x65" => sanitize_file_name($filename), "\x70\157\x73\x74\x5f\143\x6f\156\x74\x65\x6e\164" => '', "\160\157\163\x74\x5f\163\x74\141\x74\x75\x73" => "\x69\156\x68\x65\162\x69\x74");
            $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\x6f\x64\165\x63\x74\x5f\x69\155\141\x67\145\137\x67\x61\154\x6c\145\x72\x79", '');
        }
        if ($flag == 1) {
            $attach_id_array = get_post_meta($post_id, "\137\160\x72\157\x64\x75\143\x74\137\x69\155\141\x67\x65\137\x67\x61\154\154\x65\162\171", 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\x70\162\157\144\165\x63\164\137\151\x6d\141\147\145\x5f\147\141\x6c\154\145\x72\x79", $attach_id_array);
        }
    }
}
goto iYZ2f;
r2JWF:
function clean_text($texto, $clean = true, $charlimit = null)
{
    $texto = trim($texto);
    $texto = html_entity_decode($texto, ENT_QUOTES);
    $texto = trim(preg_replace("\x2f\x5c\x74\x2b\x2f", '', $texto));
    $texto = addslashes($texto);
    if ($clean) {
        $texto = strip_tags($texto);
    }
    $texto = preg_replace("\x2f\x5b\134\x78\173\x32\x30\x30\x42\175\x2d\x5c\x78\173\62\x30\x30\x44\175\x5d\x2f\165", '', $texto);
    $texto = preg_replace("\57\133\134\x78\173\x32\60\x30\102\175\x2d\x5c\x78\x7b\x32\60\x30\104\175\134\x78\x7b\106\105\x46\106\175\135\x2f\165", '', $texto);
    $texto = str_replace("\342\x80\x8c", '', $texto);
    $texto = str_replace("\x26\43\x38\62\x30\63\73", '', $texto);
    $texto = str_replace(array("\xd\12", "\xa", "\xd"), "\x3c\x62\x72\76", $texto);
    $texto = str_replace("\x5c\134\162", "\x3c\142\162\76", $texto);
    $texto = str_replace("\134\x72", "\74\142\x72\76", $texto);
    $texto = str_replace("\xd", "\x3c\142\x72\x3e", $texto);
    $texto = str_replace("\x6f\156\x63\x6c\x69\143\x6b", "\x69\144", $texto);
    $texto = str_replace(array("\134", "\302\250", "\xc2\xba", "\342\x80\x93", "\x7e", "\174", "\302\267", "\46", "\xc2\277", "\136", "\xc2\xa8", "\xc2\264", "\43", "\342\200\xa2"), '', $texto);
    $texto = str_replace(array("\x5c", "\342\200\x99"), '', $texto);
    if ($charlimit > 0) {
        $texto = substr($texto, 0, $charlimit);
    }
    return $texto;
}
goto puGKG;
cDr8Z:
function exception_error_handler($severity, $message, $file, $line)
{
    if (!(error_reporting() & $severity)) {
        return;
    }
    throw new ErrorException($message, 0, $severity, $file, $line);
}
goto cjDzH;
puGKG:
function update_familia()
{
    $allowimport = get_option("\167\x32\147\x5f\x75\160\x64\x61\x74\x65\x5f\151\155\x70\157\162\164", "\x79\145\x73");
    $last_time = file_get_contents(ABSPATH . "\x77\160\62\x67\145\x73\57\x70\162\157\x64\x75\143\164\157\x73\x2f\147\x65\x73\x5f\146\141\155\151\154\x69\141\x73\56\164\x78\x74");
    $to_check = file_get_contents(ABSPATH . "\167\160\62\x67\145\163\57\x70\162\157\x64\x75\x63\x74\157\163\57\167\x70\x5f\146\x61\x6d\151\x6c\151\141\x73\x2e\x74\170\x74");
    if ($allowimport == "\x79\x65\x73") {
        if ($last_time >= $to_check) {
            $xml_file = ABSPATH . "\x77\160\62\x67\x65\x73\x2f\160\162\157\x64\165\143\164\157\163\57\146\141\x6d\x69\154\x69\x61\x73\56\170\x6d\154";
            $w2g_p_simplexml = simplexml_load_file($xml_file);
            if (!$w2g_p_simplexml) {
                echo "\x4e\157\x20\x73\x65\40\160\x75\145\144\x65\40\154\x65\x65\162\x20\x65\x6c\x20\146\151\x63\150\x65\x72\157\x2e\15\xa";
            } else {
                update_option("\x66\x74\x6f\x74\x61\154\x5f\x70\162\x6f\x64\165\143\164\x5f\170\x6d\x6c", count($w2g_p_simplexml->familia));
                update_option("\x66\x73\164\141\162\x74\137\x69\155\160\x6f\162\164\137\x74\x69\x6d\x65", time());
                update_option("\x66\163\164\141\x74\165\x73\137\x69\x6d\160\157\162\164", 1);
                $counter = 0;
                foreach ($w2g_p_simplexml->familia as $key => $w2g_pi_xml) {
                    $counter++;
                    Create_Terms($w2g_pi_xml->id, $w2g_pi_xml->nombre, "\160\x72\x6f\x64\165\143\x74\x5f\x63\141\164", $w2g_pi_xml->padre, 100);
                    file_put_contents(ABSPATH . "\x77\160\62\x67\x65\x73\x2f\x70\162\157\144\x75\143\164\157\x73\x2f\146\163\153\x75\x2e\x74\x78\x74", (string) $w2g_pi_xml->nombre);
                    file_put_contents(ABSPATH . "\x77\160\x32\x67\x65\x73\x2f\160\162\x6f\x64\x75\x63\x74\157\x73\57\x66\x74\x6f\x74\141\x6c\56\164\170\x74", (string) $counter);
                }
                if (get_option("\167\62\x67\137\x75\160\144\141\x74\x65\137\x63\141\x74\x65\147\157\x72\x69\145\x73\x5f\163\x61\x6c\x65") == "\171\x65\163") {
                    $prodcatoffer = get_option("\167\62\x67\x5f\154\141\x62\145\154\x5f\x73\141\x6c\x65", "\x4f\x66\x65\162\164\141\x73");
                    Create_Terms(9990, $prodcatoffer, "\x70\x72\157\x64\165\x63\x74\x5f\x63\141\x74", 0, 0);
                } else {
                    Delete_Terms(9990, "\x70\x72\157\x64\165\143\x74\x5f\143\141\x74", 0);
                }
                if (get_option("\x77\62\x67\137\165\x70\x64\141\x74\145\137\143\141\164\x65\x67\x6f\162\x69\145\163\137\x6e\145\167") == "\171\145\163") {
                    $prodcatnew = get_option("\167\62\147\137\154\x61\x62\x65\x6c\x5f\156\145\167\160", "\x4e\157\166\145\144\x61\144\x65\x73");
                    Create_Terms(9980, $prodcatnew, "\x70\162\x6f\144\x75\143\164\x5f\143\x61\x74", 0, 0);
                } else {
                    Delete_Terms(9980, "\160\162\157\x64\x75\x63\x74\x5f\x63\x61\x74", 0);
                }
                update_option("\x66\163\164\x61\x74\x75\x73\137\x69\155\160\157\162\164", 2);
                update_option("\x77\62\x67\137\x66\x61\x6d\137\163\165\143\143\145\163\163", time());
                $last_time = file_put_contents(ABSPATH . "\x77\160\62\x67\x65\163\x2f\x70\x72\x6f\x64\165\x63\164\x6f\x73\x2f\167\x70\137\x66\x61\x6d\x69\x6c\x69\141\x73\56\x74\170\x74", (string) time());
            }
        }
    }
}
goto DCAld;
oemVU:
function w2g_product_sales_price_calc($w2g_product_price, $w2g_cost_price, $n, $product_price_type, $product_vat)
{
    $w2g_product_price = str_replace("\x2c", "\x2e", $w2g_product_price);
    $w2g_cost_price = str_replace("\x2c", "\x2e", $w2g_cost_price);
    $n = str_replace("\54", "\x2e", $n);
    $w2g_product_price = floatval($w2g_product_price);
    $w2g_cost_price = floatval($w2g_cost_price);
    $n = floatval($n);
    $product_price_type = trim($product_price_type);
    $w2g_new_product_price = 0;
    if ($product_price_type == "\x77\62\147\137\160\145\x72\137\x63\157\163\164") {
        $w2g_new_product_price = $w2g_cost_price * (1 + $n / 100);
    } elseif ($product_price_type == "\x77\x32\x67\137\x70\x65\x72\137\160\166\160") {
        $w2g_new_product_price = $w2g_product_price * (1 + $n / 100);
    } elseif ($product_price_type == "\x77\62\147\137\146\151\x78\145\144\137\x70\162\x69\x63\x65") {
        $w2g_new_product_price = $w2g_product_price + $n;
    } else {
        $w2g_new_product_price = $w2g_product_price;
    }
    return strval($w2g_new_product_price);
}
goto SFaBK;
Gu6zr:
function Add_to_Terms($term_id, $post_id, $taxonomy, $plus)
{
    $term_idn = $term_id + $plus;
    $tag = array();
    $tag = wc_get_product_term_ids($post_id, $taxonomy);
    if (!in_array($term_idn, $tag)) {
        array_push($tag, $term_idn);
        wp_set_object_terms($post_id, $tag, $taxonomy);
    }
}
goto AcgOZ;
DCAld:
function update_marcas()
{
    $last_time = file_get_contents(ABSPATH . "\167\x70\x32\x67\x65\163\57\160\x72\157\144\165\x63\164\x6f\x73\57\147\x65\163\x5f\155\x61\x72\143\x61\x73\56\164\x78\x74");
    $to_check = file_get_contents(ABSPATH . "\167\x70\x32\x67\145\163\57\x70\x72\157\x64\x75\x63\x74\x6f\x73\x2f\x77\x70\x5f\155\141\x72\143\141\163\x2e\164\170\x74");
    $allowimport = get_option("\x77\x32\x67\137\165\160\x64\x61\x74\145\x5f\151\155\x70\157\162\164", "\x79\x65\163");
    $mar_taxonomy = get_option("\x77\x32\x67\x5f\x62\164\x61\170");
    if ($allowimport == "\x79\145\163" and !empty($mar_taxonomy)) {
        if ($last_time >= $to_check) {
            $xml_file = ABSPATH . "\167\x70\62\x67\145\x73\x2f\160\x72\x6f\144\165\143\164\157\x73\57\155\x61\162\143\x61\x73\x2e\x78\x6d\154";
            $w2g_p_simplexml = simplexml_load_file($xml_file);
            if (!$w2g_p_simplexml) {
                echo "\116\x6f\40\163\145\40\160\x75\x65\x64\145\x20\x6c\145\145\x72\x20\145\154\40\146\151\143\x68\145\x72\157\x2e\15\12";
            } else {
                $counter = 0;
                update_option("\142\x74\157\164\141\154\x5f\160\x72\x6f\144\165\143\x74\x5f\170\155\x6c", count($w2g_p_simplexml->marca));
                update_option("\142\163\x74\x61\162\x74\x5f\151\x6d\x70\x6f\x72\x74\x5f\x74\x69\155\x65", time());
                update_option("\142\x73\x74\x61\x74\x75\163\x5f\x69\x6d\x70\157\x72\x74", 1);
                $total_count = count($w2g_p_simplexml->marca);
                foreach ($w2g_p_simplexml->marca as $key => $w2g_pi_xml) {
                    $counter++;
                    Create_Terms($w2g_pi_xml->id, $w2g_pi_xml->nombre, $mar_taxonomy, 0, 5000);
                    file_put_contents(ABSPATH . "\167\x70\x32\147\x65\x73\x2f\x70\162\157\144\165\x63\164\157\x73\x2f\142\x73\x6b\x75\56\x74\170\164", (string) $w2g_pi_xml->nombre);
                    file_put_contents(ABSPATH . "\x77\x70\62\147\x65\x73\57\160\162\157\x64\x75\x63\x74\x6f\163\x2f\x62\164\x6f\164\x61\x6c\x2e\x74\x78\x74", (string) $counter);
                }
                update_option("\167\62\147\137\155\x61\x72\137\x73\x75\143\143\145\x73\163", time());
                update_option("\142\163\x74\x61\x74\165\x73\137\x69\155\x70\157\x72\x74", 2);
                $last_time = file_put_contents(ABSPATH . "\x77\160\x32\147\x65\x73\x2f\x70\162\157\x64\165\143\164\157\x73\57\x77\160\x5f\x6d\141\162\x63\141\x73\56\164\x78\x74", (string) time());
            }
        }
    }
}
goto jJ92E;
e0PB1:
function update_products($fimport)
{
    remove_filter("\143\157\156\x74\145\x6e\164\137\x73\x61\166\x65\137\x70\162\x65", "\x77\160\137\x66\x69\154\x74\x65\x72\137\160\157\163\164\x5f\x6b\163\145\163");
    remove_filter("\x63\157\156\x74\x65\x6e\164\x5f\146\151\154\x74\x65\162\x65\144\137\163\141\166\145\x5f\160\x72\x65", "\167\160\x5f\146\x69\x6c\164\x65\x72\137\x70\157\163\164\x5f\153\x73\145\163");
    $uploads = wp_upload_dir();
    $base_dir = str_replace("\165\x70\154\157\x61\x64\163\x2f", '', $uploads["\142\x61\163\x65\x64\151\x72"]);
    global $wpdb;
    $w2g_pi_table_prefix = $wpdb->prefix;
    $w2g_table = $w2g_pi_table_prefix . "\x77\x32\147\x5f\170\x6d\x6c\137\x70\162\157\144\x75\143\x74\163";
    $counter = 0;
    $w2g_update_lang = get_option("\x77\x32\x67\x5f\x75\x70\144\x61\164\145\x5f\154\x61\x6e\x67");
    $w2g_update_prod_price = get_option("\167\x32\x67\137\165\x70\144\141\x74\145\137\160\162\x6f\144\137\160\x72\x69\143\145");
    $w2g_update_price_val = get_option("\167\x32\147\x5f\x75\x70\144\x61\164\145\x5f\160\x72\x69\143\145\137\x76\141\x6c");
    $w2g_update_newp = get_option("\x77\x32\147\x5f\165\x70\x64\x61\x74\145\x5f\x6e\145\167\x70");
    $w2g_update_title = get_option("\167\x32\x67\137\165\x70\x64\141\164\x65\x5f\164\x69\164\154\145");
    $w2g_update_desc = get_option("\x77\62\147\137\165\x70\144\x61\x74\145\137\144\145\x73\x63");
    $w2g_update_excerpt = get_option("\167\62\x67\137\x75\x70\x64\141\164\145\137\145\170\x63\x65\x72\160\x74");
    $w2g_update_stock = get_option("\167\62\x67\x5f\165\160\144\x61\x74\145\137\163\x74\x6f\x63\x6b");
    $w2g_update_cost_price = get_option("\x77\62\x67\x5f\x75\x70\x64\141\164\x65\x5f\x63\x6f\x73\x74\137\160\162\151\x63\145");
    $w2g_update_categories = get_option("\167\62\x67\137\x75\160\144\x61\x74\145\x5f\x63\x61\164\145\147\x6f\162\151\x65\x73");
    $w2g_update_categories_new = get_option("\x77\62\x67\137\165\x70\144\x61\164\x65\x5f\x63\x61\x74\x65\147\x6f\x72\x69\x65\163\137\156\x65\167");
    $w2g_update_categories_sale = get_option("\167\62\x67\137\x75\x70\144\141\164\x65\137\143\141\x74\x65\147\157\x72\x69\x65\x73\x5f\x73\x61\x6c\x65");
    $w2g_update_brands = get_option("\x77\62\147\x5f\165\160\144\x61\x74\x65\137\142\162\x61\x6e\x64\x73");
    $w2g_update_images = get_option("\x77\62\147\137\x75\160\144\141\x74\x65\137\x69\155\x61\x67\145\163");
    $w2g_img_options = get_option("\167\62\x67\x5f\151\155\x67\x5f\157\x70\x74\151\157\x6e\163");
    $w2g_rev_new_prod = get_option("\167\62\x67\x5f\162\x65\x76\x5f\x6e\145\167\x5f\x70\162\157\x64");
    $w2g_price_iva_incl = get_option("\167\62\147\x5f\x70\x72\151\143\145\137\x69\166\141\x5f\x69\x6e\x63\154");
    $w2g_update_discontinued_pv = get_option("\x77\62\x67\137\x75\160\x64\141\x74\145\137\144\151\163\x63\x6f\156\164\151\156\x75\145\x64\x5f\160\x76");
    $w2g_catmap = get_option("\167\x32\x67\137\155\x61\160\137\x63\x61\x74");
    $w2g_catfilter = get_option("\167\62\147\137\146\x69\154\x74\x65\162\137\143\x61\164");
    $w2g_prodfilter = get_option("\167\62\x67\x5f\146\x69\x6c\164\145\162\x5f\160\x72\x6f\x64");
    $w2g_brandfilter = get_option("\x77\x32\147\137\x66\x69\154\164\x65\162\137\x62\x72\141\x6e\144");
    if ($w2g_catmap == 1) {
        $w2g_catmapping = get_option("\x6d\x61\160\x5f\x70\x72\x6f\x64\x75\143\164\137\143\141\164\145\x67\x6f\162\x69\145\163");
    } else {
        $w2g_catmapping = array();
    }
    if ($w2g_catfilter == 1) {
        $w2g_cat_filter = get_option("\x77\62\147\137\x69\156\x64\154\165\144\145\144\137\143\141\164\137\x6b\145\x79");
    } else {
        if ($w2g_catfilter == 2) {
            $w2g_cat_filter = get_option("\167\x32\x67\137\x65\170\x63\154\x75\144\x65\144\137\x63\141\164\x5f\x6b\x65\x79");
        } else {
            $w2g_cat_filter = array();
        }
    }
    if ($w2g_prodfilter == 1) {
        $w2g_prod_filter = get_option("\167\x32\x67\137\x69\x6e\x64\154\x75\x64\x65\144\x5f\x70\x72\157\144\137\x6b\x65\171");
    } else {
        if ($w2g_prodfilter == 2) {
            $w2g_prod_filter = get_option("\167\62\147\x5f\145\170\x63\154\x75\x64\x65\144\137\x70\162\157\144\x5f\x6b\x65\171");
        } else {
            $w2g_prod_filter = array();
        }
    }
    if ($w2g_brandfilter == 1) {
        $w2g_brand_filter = get_option("\167\x32\x67\137\151\x6e\x64\x6c\165\x64\x65\x64\x5f\142\162\x61\156\144\x5f\x6b\x65\x79");
    } else {
        if ($w2g_brandfilter == 2) {
            $w2g_brand_filter = get_option("\x77\x32\147\x5f\x65\170\x63\x6c\165\144\x65\x64\137\142\162\141\x6e\144\x5f\x6b\145\x79");
        } else {
            $w2g_brand_filter = array();
        }
    }
    $count = 0;
    $xml = load_xml_file("\160\162\157\144\165\143\164\x6f\x73\x2e\170\155\154");
    $total_count = count($xml->producto);
    update_option("\x74\157\x74\141\x6c\137\x70\x72\157\x64\165\143\x74\137\170\x6d\154", $total_count);
    $post_author = get_current_user_id();
    $post_status = "\160\x75\x62\154\151\x73\x68";
    $post_parent = '';
    $post_type = "\160\162\x6f\144\x75\x63\x74";
    $prodcatnew = get_option("\x77\62\147\137\154\141\142\x65\x6c\x5f\x6e\145\x77\160", "\x4e\157\x76\145\x64\x61\144\x65\x73");
    $prodcatoffer = get_option("\x77\62\x67\x5f\x6c\141\142\145\154\x5f\x73\141\x6c\x65", "\117\146\x65\x72\164\141\163");
    $w2g_update_lang = get_option("\167\x32\x67\x5f\165\x70\x64\x61\164\145\137\154\x61\156\x67", true);
    $last_import_sku = file_get_contents(ABSPATH . "\x77\x70\62\x67\145\x73\57\160\x72\x6f\x64\x75\x63\x74\157\x73\x2f\163\x6b\165\56\x74\x78\164");
    clean_product_incomplete();
    $mailrep = get_option("\x77\x32\147\x5f\165\160\144\x61\164\x65\137\x70\x76\137\x65\x6d\x61\x69\154");
    $stop = get_option("\163\x74\x6f\x70\x5f\151\155\160\x6f\162\164", "\60");
    file_put_contents(ABSPATH . "\x77\x70\x32\147\x65\x73\57\x70\162\x6f\x64\165\x63\x74\157\x73\x2f\164\157\x74\x61\154\x2e\x74\x78\x74", (string) 0);
    $mar_taxonomy = get_option("\167\62\147\137\142\164\141\x78");
    $w2g_title_mod = get_option("\167\62\x67\137\x74\151\x74\x6c\145\137\x6d\x6f\x64");
    $prod_wofer = get_option("\x70\x72\157\144\137\x77\x6f\x66\x65\162", array());
    $delete_offer = 0;
    clearstatcache();
    $nowlist = array();
    if ($total_count > 0) {
        foreach ($xml->producto as $key => $product) {
            $array_prod_cats = array();
            $new_db_prod_id = $product->id_art;
            $prod_id = $product->id_art;
            $prod_sku = (string) $product->referencia;
            $brand = (string) $product->marca->nombre;
            array_push($nowlist, (string) $prod_id);
            if ($fimport) {
                $count++;
                if ($prod_sku == $last_import_sku) {
                    $fimport = false;
                    $count--;
                    $counter = $count;
                    Update_Counters($counter, $prod_sku);
                } else {
                    continue;
                }
            }
            $prod_categories = $product->familia;
            if ($w2g_catfilter == 1) {
                $cat_include = false;
                foreach ($prod_categories as $cat_vals) {
                    if (in_array($cat_vals->id, $w2g_cat_filter)) {
                        $cat_include = true;
                        break;
                    }
                }
                if (!$cat_include) {
                    $counter++;
                    Update_Counters($counter, $prod_sku);
                    continue;
                }
            } else {
                if ($w2g_catfilter == 2) {
                    $cat_exclude = false;
                    foreach ($prod_categories as $cat_vals) {
                        if (in_array($cat_vals->id, $w2g_cat_filter)) {
                            $cat_exclude = true;
                            break;
                        }
                    }
                    if ($cat_exclude) {
                        $counter++;
                        Update_Counters($counter, $prod_sku);
                        continue;
                    }
                }
            }
            if ($w2g_prodfilter == 1) {
                if (!in_array($prod_sku, $w2g_prod_filter)) {
                    $counter++;
                    Update_Counters($counter, $prod_sku);
                    continue;
                }
            } else {
                if ($w2g_prodfilter == 2) {
                    if (in_array($prod_sku, $w2g_prod_filter)) {
                        $counter++;
                        Update_Counters($counter, $prod_sku);
                        continue;
                    }
                }
            }
            if ($w2g_brandfilter == 1) {
                if (!in_array($brand, $w2g_brand_filter)) {
                    $counter++;
                    Update_Counters($counter, $prod_sku);
                    continue;
                }
            } else {
                if ($w2g_brandfilter == 2) {
                    if (in_array($brand, $w2g_brand_filter)) {
                        $counter++;
                        Update_Counters($counter, $prod_sku);
                        continue;
                    }
                }
            }
            $prod_type = "\x73\151\x6d\x70\154\145";
            $prod_commonvar = '';
            $variation_data = '';
            if (!empty($product->tyc)) {
                $prod_type = "\x76\141\162\151\141\142\154\x65";
            }
            $prod_title = clean_text(clean_CData($product->nombre));
            if ($w2g_title_mod == "\155\x61\x79") {
                $prod_title = utf8_decode($prod_title);
                $prod_title = strtoupper($prod_title);
                $prod_title = utf8_encode($prod_title);
            } else {
                if ($w2g_title_mod == "\x63\x61\160") {
                    $prod_title = utf8_decode($prod_title);
                    $prod_title = strtolower($prod_title);
                    $prod_title = ucwords($prod_title);
                    $prod_title = utf8_encode($prod_title);
                } else {
                    if ($w2g_title_mod == "\x6d\151\156") {
                        $prod_title = utf8_decode($prod_title);
                        $prod_title = strtolower($prod_title);
                        $prod_title = utf8_encode($prod_title);
                    }
                }
            }
            $prod_desc = clean_text(clean_CData($product->descripcionhtml), false);
            $prod_excerpt = clean_text(clean_CData($product->descripcion));
            $prod_author = $post_author;
            $prod_parent = $post_parent;
            $prod_post_type = $post_type;
            $prod_visibility = "\166\151\163\x69\142\154\145";
            $prod_issale = "\60";
            $prod_isnew = "\60";
            $prod_sales_price = 0;
            if (!is_null($product->oferta)) {
                if (!in_array($prod_sku, $prod_wofer)) {
                    array_push($prod_wofer, $prod_sku);
                    update_option("\160\x72\157\x64\137\167\x6f\x66\x65\162", $prod_wofer);
                }
                $prod_issale = 1;
                if ($w2g_price_iva_incl == "\171\145\163") {
                    $prod_sales_price = $product->oferta->precio_oferta_iva;
                } else {
                    $prod_sales_price = $product->oferta->precio_oferta;
                }
                $prod_sales_price = str_replace("\x2c", "\x2e", $prod_sales_price);
            }
            if (!is_null($product->novedad)) {
                $prod_isnew = $product->novedad;
            }
            $prod_cost = $product->precio_coste;
            $prod_brand = $product->marcas->marca;
            $prod_barcode = $product->referencia;
            $prod_barcodeName = '';
            $prod_stock = $product->stock;
            $stock_status = '';
            if (intval($prod_stock) >= 1) {
                $stock_status = "\x69\156\x73\164\x6f\143\153";
            } else {
                $stock_status = "\157\x75\164\163\164\157\x63\153";
            }
            $prod_stock_status = $stock_status;
            $prod_downloadable = '';
            $prod_virtual = "\x6e\157";
            $prod_price = $product->precio_venta;
            $prod_purchase_note = '';
            $prod_featured = "\x6e\157";
            $prod_sale_price_dates_from = '';
            $prod_sale_price_dates_to = '';
            $prod_sold_individually = '';
            $prod_manage_stock = "\x79\145\x73";
            $prod_backorders = "\x6e\x6f";
            $prod_total_sales = 0;
            $prod_regular_price = $product->precio_venta;
            $prod_length = 0;
            $prod_width = 0;
            $prod_height = 0;
            $prod_weight = 0;
            $prod_stock = $prod_stock;
            $product_destock = 0;
            $product_vat = $product->IVA;
            $prod_status = "\x69\x6d\x70\x6f\x72\164\x69\156\x67";
            $product_recom_price = $product->precio_venta;
            if ($w2g_price_iva_incl == "\171\x65\x73") {
                $prod_price = $product->precio_venta_IVA;
                $prod_regular_price = $product->precio_venta_IVA;
                $product_recom_price = $product->precio_venta_IVA;
            }
            $str_prod_categories = $prod_categories;
            if ($w2g_update_prod_price == "\x6e\x6f\x72\155\x61\154" || $w2g_update_prod_price == "\x77\x32\x67\137\160\x65\162\137\x63\x6f\x73\164" || $w2g_update_prod_price == "\x77\62\x67\137\160\145\162\137\160\x76\160" || $w2g_update_prod_price == "\x77\62\147\137\146\151\170\x65\144\x5f\160\x72\151\143\145") {
                $prod_price = w2g_product_sales_price_calc($prod_price, $prod_cost, $w2g_update_price_val, $w2g_update_prod_price, $product_vat);
            }
            $ffound = false;
            $prod_post_id = misha_post_id_by_meta_key_and_value("\137\x73\153\165", $prod_sku);
            $prstatus = get_post_status($prod_post_id);
            if ($prstatus === "\162\x65\x76\x69\163\151\157\156") {
                $counter++;
                Update_Counters($counter, $prod_sku);
                continue;
            }
            if (empty($prod_sales_price)) {
                if (in_array($prod_sku, $prod_wofer)) {
                    $delete_offer = 1;
                    $prod_wofer = array_diff($prod_wofer, array($prod_sku));
                    update_option("\x70\162\157\144\x5f\167\x6f\x66\x65\x72", $prod_wofer);
                }
            }
            if (!empty($prod_post_id) && ($prstatus === "\160\165\x62\154\151\x73\x68" || $prstatus === "\160\x72\151\x76\141\x74\x65")) {
                if ($prstatus === "\x70\162\x69\166\x61\x74\x65" && !$product_destock && $prod_visibility != "\x68\x69\144\x64\145\x6e") {
                    wp_update_post(array("\111\104" => $prod_post_id, "\x70\x6f\x73\164\137\163\164\141\x74\x75\x73" => "\160\x75\142\x6c\151\x73\x68"));
                } else {
                    if ($prstatus === "\160\165\142\154\151\x73\x68" && ($product_destock || $prod_visibility == "\x68\151\144\144\145\x6e")) {
                        offproduct($prod_sku, $prod_title, $w2g_update_discontinued_pv, $mailrep);
                    }
                }
                $gproduct = wc_get_product($prod_post_id);
                $new_product_flag = false;
                if (!empty($product->tyc)) {
                    foreach ($product->tyc->color as $key => $colores) {
                        foreach ($colores->tallas->talla as $key => $utalla) {
                            $tc_prod_post_id = misha_post_id_by_meta_key_and_value("\x5f\163\153\x75", $utalla->id_tyc);
                            if (!empty($tc_prod_post_id)) {
                                w2g_add_variations_to_products($prod_post_id, $utalla->id_tyc, $colores->nombre_color, $utalla->nombre, (string) $prod_price, (string) $utalla->unidades, (string) $prod_barcode, (string) $prod_cost, $prod_visibility, $colores->images_color->image, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, false, $prod_sales_price, (string) $prod_id, $delete_offer);
                            } else {
                                w2g_add_variations_to_products($prod_post_id, $utalla->id_tyc, $colores->nombre_color, $utalla->nombre, (string) $prod_price, (string) $utalla->unidades, (string) $prod_barcode, (string) $prod_cost, $prod_visibility, $colores->images_color->image, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, true, $prod_sales_price, (string) $prod_id, $delete_offer);
                            }
                        }
                    }
                }
            } else {
                if ($prstatus === "\144\162\x61\x66\x74") {
                    wp_delete_post($prod_post_id, true);
                }
                $prod_post_id = w2g_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt);
                $new_product_flag = true;
            }
            if ($new_product_flag) {
                if ($w2g_update_newp == "\156\157") {
                    $counter++;
                    Update_Counters($counter, $prod_sku);
                    continue;
                }
                $temp_prod_parent = 0;
                if (isset($w2g_catmapping) && $w2g_catmap == 1) {
                    $STemp_Cat_ID = $product->familia->id;
                    foreach ($w2g_catmapping as $cat_sluga => $prod_cater) {
                        if ($prod_cater["\x67\151\x64"] == $STemp_Cat_ID) {
                            $STemp_Cat_RID = get_term_by("\x73\x6c\165\147", $prod_cater["\x73\154\x75\147"], "\x70\162\x6f\x64\x75\143\x74\137\x63\141\164");
                            Add_to_Terms($STemp_Cat_RID->term_id, $prod_post_id, "\x70\x72\x6f\x64\x75\143\x74\x5f\x63\141\x74", 0);
                            $temp_cat_id = $STemp_Cat_RID->term_id;
                            break;
                        }
                    }
                } else {
                    Add_to_Terms($product->familia->id, $prod_post_id, "\160\162\157\x64\165\143\x74\x5f\143\141\x74", 100);
                    $temp_cat_id = (int) $product->familia->id + 100;
                }
                $temp_cat = get_term_by("\164\x65\162\x6d\137\x69\x64", $temp_cat_id, "\160\162\157\x64\165\x63\x74\137\x63\x61\164");
                if (!is_null($temp_cat)) {
                    $temp_prod_parent = $temp_cat->parent;
                    while ($temp_prod_parent != 0) {
                        $temp_cat = get_term_by("\x74\x65\x72\x6d\137\x69\144", $temp_prod_parent, "\x70\162\x6f\x64\165\x63\x74\x5f\x63\x61\164");
                        $temp_prod_parent = $temp_cat->parent;
                        Add_to_Terms($temp_cat->term_id, $prod_post_id, "\x70\x72\x6f\x64\x75\143\x74\x5f\143\141\x74", 0);
                    }
                }
                if ($w2g_update_categories_new == "\171\145\x73" && $prod_isnew == 1) {
                    Add_to_Terms(9980, $prod_post_id, "\160\x72\x6f\x64\165\143\164\137\x63\x61\x74", 0);
                }
                if ($w2g_update_categories_sale == "\x79\x65\x73" && $prod_issale == 1) {
                    Add_to_Terms(9990, $prod_post_id, "\160\162\157\x64\165\143\164\137\x63\141\x74", 0);
                }
                if (!is_null($mar_taxonomy)) {
                    Add_to_Terms($product->marca->id, $prod_post_id, $mar_taxonomy, 5000);
                }
                $gproduct = wc_get_product($prod_post_id);
                if ($gproduct) {
                    $gproduct->set_regular_price((string) $prod_price);
                    $gproduct->set_price((string) $prod_price);
                    $gproduct->set_downloadable(false);
                    $gproduct->set_virtual(false);
                    $gproduct->set_purchase_note($prod_purchase_note);
                    $gproduct->set_featured($prod_featured);
                    if ($prod_issale == 0 || $delete_offer == 1) {
                        $gproduct->set_sale_price('');
                    } else {
                        $gproduct->set_sale_price($prod_sales_price);
                    }
                    $gproduct->set_date_on_sale_from('');
                    $gproduct->set_date_on_sale_to('');
                    $gproduct->set_sold_individually(false);
                    $gproduct->set_backorders("\156\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);
                    $gproduct->set_sku($prod_sku);
                    if (!empty($product->tyc)) {
                        $gproduct->set_catalog_visibility("\x76\151\x73\x69\x62\x6c\x65");
                        $gproduct->set_stock_quantity("\151\x6e\x73\x74\x6f\x63\153");
                        $gproduct->set_manage_stock(false);
                        $gproduct->set_name($prod_title);
                    } else {
                        $gproduct->set_catalog_visibility($prod_visibility);
                        $gproduct->set_manage_stock(true);
                    }
                    $gproduct->save();
                    wp_set_object_terms($prod_post_id, $prod_type, "\160\162\157\144\165\143\164\x5f\164\171\160\x65");
                    if (!empty($product->tyc)) {
                        foreach ($product->tyc->color as $key => $colores) {
                            foreach ($colores->tallas->talla as $key => $utalla) {
                                w2g_add_variations_to_products($prod_post_id, $utalla->id_tyc, $colores->nombre_color, $utalla->nombre, (string) $prod_price, (string) $utalla->unidades, (string) $prod_barcode, (string) $prod_cost, $prod_visibility, $colores->images_color->image, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, true, $prod_sales_price, (string) $prod_id, $delete_offer);
                            }
                        }
                    }
                }
            } else {
                $pproduct = wc_get_product($prod_post_id);
                $needsave = false;
                if ($pproduct) {
                    if ($w2g_update_title == "\x79\x65\x73") {
                        $pproduct->set_name($prod_title);
                        $needsave = true;
                    }
                    if ($w2g_update_desc == "\171\x65\163") {
                        $pproduct->set_description($prod_desc);
                        $needsave = true;
                    }
                    if ($w2g_update_excerpt == "\171\x65\x73") {
                        $pproduct->set_short_description($prod_excerpt);
                        $needsave = true;
                    }
                    if ($w2g_update_stock == "\171\145\163") {
                        $pproduct->set_stock_status($prod_stock_status);
                        $pproduct->set_stock_quantity($prod_stock);
                        $needsave = true;
                    }
                    if ($w2g_update_cost_price == "\171\x65\163") {
                        $ssdatefrom = $pproduct->get_date_on_sale_from();
                        $ssdateto = $pproduct->get_date_on_sale_to();
                        if ($prod_issale == 0) {
                            $ssprice = $pproduct->get_sale_price();
                        } else {
                            $ssprice = $prod_sales_price;
                        }
                        $pproduct->set_regular_price((string) $prod_price);
                        $pproduct->set_price((string) $prod_price);
                        if (!empty($ssprice)) {
                            if ($delete_offer == 1) {
                                $pproduct->set_sale_price('');
                                $pproduct->set_date_on_sale_from('');
                                $pproduct->set_date_on_sale_to('');
                            } else {
                                $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 ($w2g_update_categories == "\171\145\x73") {
                        $temp_prod_parent = 0;
                        if (isset($w2g_catmapping) && $w2g_catmap == 1) {
                            $STemp_Cat_ID = $product->familia->id;
                            foreach ($w2g_catmapping as $cat_sluga => $prod_cater) {
                                if ($prod_cater["\x67\151\x64"] == $STemp_Cat_ID) {
                                    $STemp_Cat_RID = get_term_by("\x73\x6c\165\x67", $prod_cater["\163\154\165\147"], "\x70\162\157\x64\165\143\x74\x5f\143\141\164");
                                    Add_to_Terms($STemp_Cat_RID->term_id, $prod_post_id, "\160\162\157\144\x75\143\x74\x5f\x63\141\164", 0);
                                    $temp_cat_id = $STemp_Cat_RID->term_id;
                                    break;
                                }
                            }
                        } else {
                            Add_to_Terms($product->familia->id, $prod_post_id, "\x70\162\x6f\x64\165\143\164\x5f\143\x61\164", 100);
                            $temp_cat_id = (int) $product->familia->id + 100;
                        }
                        $temp_cat = get_term_by("\164\x65\162\x6d\137\151\144", $temp_cat_id, "\x70\162\157\144\165\x63\164\x5f\x63\141\x74");
                        if (!is_null($temp_cat)) {
                            $temp_prod_parent = $temp_cat->parent;
                            while ($temp_prod_parent != 0) {
                                $temp_cat = get_term_by("\164\x65\162\x6d\137\x69\x64", $temp_prod_parent, "\x70\162\x6f\144\x75\143\164\x5f\x63\141\164");
                                $temp_prod_parent = $temp_cat->parent;
                                Add_to_Terms($temp_cat->term_id, $prod_post_id, "\160\x72\x6f\144\165\143\164\137\x63\141\x74", 0);
                            }
                        }
                    }
                    if ($w2g_update_brands == "\x79\x65\163" && !is_null($mar_taxonomy)) {
                        Add_to_Terms($product->marca->id, $prod_post_id, $mar_taxonomy, 5000);
                    }
                    if ($w2g_update_categories_new == "\171\145\163" && $prod_isnew == 1) {
                        Add_to_Terms(9980, $prod_post_id, "\x70\162\x6f\x64\165\143\x74\137\143\141\x74", 0);
                    } else {
                        Delete_to_Terms(9980, $prod_post_id, "\x70\162\x6f\144\165\x63\x74\137\143\x61\x74", 0);
                    }
                    if ($w2g_update_categories_sale == "\x79\x65\x73" && $prod_issale == 1) {
                        Add_to_Terms(9990, $prod_post_id, "\x70\162\x6f\x64\x75\143\x74\137\x63\141\x74", 0);
                    } else {
                        Delete_to_Terms(9990, $prod_post_id, "\160\162\157\144\x75\143\164\137\x63\141\164", 0);
                    }
                }
            }
            $uproduct = wc_get_product($prod_post_id);
            if ($uproduct) {
                $uproduct->update_meta_data("\137\x62\x61\162\x63\x6f\144\145", (string) $prod_barcode);
                $uproduct->update_meta_data("\137\167\x70\x6d\137\147\x74\151\156\x5f\x63\157\x64\x65", (string) $prod_barcode);
                $uproduct->update_meta_data("\137\143\157\x73\164\x70\162\151\143\145", (string) $prod_cost);
                $uproduct->update_meta_data("\x5f\x77\62\147\137\151\144", (string) $prod_id);
                $uproduct->set_catalog_visibility($prod_visibility);
                if (get_option("\x77\x6f\x6f\x63\x6f\155\155\145\162\x63\145\137\x63\141\x6c\x63\x5f\164\x61\170\x65\x73") === "\171\x65\163") {
                    $taxes_array = WC_Tax::get_tax_classes();
                    if ((string) $product_vat == "\62\x31\56\x30\x30") {
                        $prod_tax_class = "\x53\164\x61\156\x64\x61\x72\x64";
                    } else {
                        if ((string) $product_vat == "\x31\60\56\x30\x30") {
                            $prod_tax_class = $taxes_array[0];
                        } else {
                            if ((string) $product_vat == "\x34\x2e\60\60") {
                                $prod_tax_class = $taxes_array[1];
                            } else {
                                $prod_tax_class = "\123\x74\x61\156\x64\141\162\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\x72\x63") {
                        $img_gallery[] = $img_val;
                    }
                }
            }
            $update_imgs = 0;
            $update_gallery = 5;
            if ($w2g_update_images == "\171\x65\x73" || $new_product_flag) {
                if ($w2g_img_options == "\65") {
                    $update_imgs = 1;
                    $update_gallery = 5;
                } else {
                    if ($w2g_img_options == "\61") {
                        $update_imgs = 1;
                        $update_gallery = 0;
                    } else {
                        if ($w2g_img_options == "\x30") {
                            $update_imgs = 0;
                            $update_gallery = 0;
                        } else {
                            if ($w2g_img_options == "\141\x6c\154") {
                                $update_imgs = 1;
                                $update_gallery = count($img_gallery);
                            } else {
                                $update_imgs = 1;
                                $update_gallery = intval($w2g_img_options);
                            }
                        }
                    }
                }
            } else {
                $update_imgs = 0;
            }
            if ($prod_post_id != "\60" || $prod_post_id != 0) {
                if (intval($update_imgs) > 0) {
                    w2g_attach_product_thumbnail($prod_post_id, $img_gallery[0], 0);
                    for ($i = 1; $i < count($img_gallery); $i++) {
                        if (intval($update_gallery) <= $i) {
                            break;
                        }
                        w2g_attach_product_thumbnail($prod_post_id, $img_gallery[$i], 1);
                    }
                }
                if ($new_product_flag) {
                    $rev_para = false;
                    if ($w2g_rev_new_prod == "\x79\145\163") {
                        wp_update_post(array("\x49\x44" => $prod_post_id, "\160\x6f\x73\164\137\x73\x74\141\164\165\163" => "\162\145\x76\151\163\x69\x6f\x6e"));
                    } else {
                        if (empty($product->tyc) && ($product_destock || $prod_visibility == "\150\x69\144\144\145\156")) {
                            wp_update_post(array("\x49\x44" => $prod_post_id, "\x70\157\163\x74\x5f\163\x74\x61\x74\x75\163" => "\160\162\151\166\x61\164\145"));
                        } else {
                            wp_update_post(array("\x49\x44" => $prod_post_id, "\x70\157\x73\164\137\x73\164\x61\x74\x75\x73" => "\160\x75\x62\x6c\151\x73\150"));
                        }
                    }
                }
            }
            $counter++;
            Update_Counters($counter, $prod_sku);
        }
        update_option("\163\164\141\x74\165\163\x5f\151\155\160\x6f\x72\x74", 2);
        update_option("\145\156\x64\137\x69\x6d\x70\x6f\x72\164\x5f\x64\141\164\x65", date("\x64\57\x6d\57\131\40\55\x20\x48\x3a\x69\x3a\163"));
        update_option("\154\141\x73\x74\x5f\x73\x6b\165", '');
        update_option("\x77\62\x67\137\x70\162\157\x64\137\x73\165\143\143\x65\163\163", time());
        file_put_contents(ABSPATH . "\167\x70\62\x67\145\x73\x2f\x70\x72\157\x64\165\143\x74\x6f\x73\x2f\167\x70\x5f\160\162\x6f\144\x75\143\x74\157\x73\56\x74\x78\164", (string) time());
        add_filter("\x63\x6f\x6e\164\x65\156\x74\x5f\163\141\x76\x65\137\160\x72\145", "\x77\x70\137\146\151\x6c\x74\x65\162\137\x70\x6f\x73\x74\137\x6b\x73\145\x73");
        add_filter("\x63\x6f\x6e\164\145\156\x74\x5f\146\151\154\x74\145\162\x65\144\x5f\x73\141\166\145\137\x70\162\145", "\167\160\137\146\x69\154\x74\x65\x72\x5f\160\x6f\x73\x74\x5f\x6b\163\x65\163");
        clean_product_incomplete();
    }
}
goto hrnu0;
mvGxN:
function SeekImg($imgname)
{
    global $wpdb;
    $sql = $wpdb->prepare("\x53\105\114\105\103\124\40\x70\157\163\x74\x5f\x69\x64\x20\x46\x52\117\x4d\x20{$wpdb->postmeta}\40\12\x9\x9\x20\x20\40\x20\x20\x20\40\40\x20\x57\110\105\x52\105\40\x6d\145\x74\141\137\153\x65\171\x20\x3d\x20\47\x5f\167\x70\x5f\141\x74\x74\x61\x63\150\145\144\137\146\151\x6c\145\47\x20\x41\x4e\104\x20\155\145\x74\x61\x5f\166\x61\154\165\x65\x20\x3d\x20\45\x73", $imgname);
    $post_id = $wpdb->get_results($sql);
    return $post_id;
}
goto oemVU;
yEs9W:
$path = preg_replace("\57\x77\x70\x2d\143\157\x6e\164\145\x6e\164\56\52\x24\x2f", '', __DIR__);
goto oyoeh;
LXz3p:
function clean_product_incomplete()
{
    global $wpdb;
    $ids = $wpdb->delete($wpdb->posts, array("\160\157\x73\x74\x5f\164\x79\160\x65" => "\160\162\157\144\x75\143\164", "\160\157\163\x74\x5f\x73\164\x61\x74\165\163" => "\x69\155\x70\x6f\162\x74\151\x6e\x67"));
}
goto CpkJg;
cjDzH:
function print_mem($Fase = '')
{
    $mem_usage = memory_get_usage();
    $mem_peak = memory_get_peak_usage();
    error_log("\124\x68\145\40\163\143\162\x69\160\164\40" . $Fase . "\x20\151\x73\x20\156\x6f\167\40\165\163\151\x6e\147\x3a\40\x3c\x73\x74\x72\157\156\x67\76" . round($mem_usage / 1024) . "\x4b\102\74\57\x73\x74\x72\x6f\x6e\147\x3e\40\x6f\x66\x20\x6d\x65\155\157\x72\171\56\x3c\142\162\76");
    error_log("\120\145\x61\x6b\40\x75\163\141\147\x65\x3a\40\74\x73\164\x72\157\x6e\x67\x3e" . round($mem_peak / 1024) . "\x4b\102\x3c\x2f\163\164\162\x6f\156\147\76\40\x6f\146\x20\155\x65\x6d\157\x72\171\56\x3c\x62\162\x3e\x3c\x62\x72\76");
}
goto cFd6N;
nIKS6:
function Create_Terms($term_id, $name, $taxonomy, $padre, $plus)
{
    global $wpdb;
    $term_idn = $term_id + $plus;
    if ($padre > 0) {
        $padren = $padre + $plus;
    } else {
        $padren = $padre;
    }
    $term = get_term_by("\x74\x65\x72\155\137\151\x64", $term_idn, $taxonomy);
    if (!$term) {
        $wpdb->insert($wpdb->prefix . "\x74\145\x72\155\163", array("\x74\145\x72\x6d\137\x69\144" => $term_idn, "\x6e\x61\155\x65" => clean_text($name), "\163\154\165\x67" => sanitize_title(clean_text(strtolower($name)))));
        $wpdb->insert($wpdb->prefix . "\x74\x65\162\155\x5f\164\141\170\x6f\156\157\155\x79", array("\x74\145\162\x6d\137\164\x61\x78\157\156\157\155\x79\137\x69\x64" => $term_idn, "\x74\145\162\x6d\137\x69\x64" => $term_idn, "\x74\x61\170\x6f\156\157\x6d\171" => $taxonomy, "\x70\x61\x72\x65\x6e\x74" => $padren));
    } elseif ($term->name != clean_text($name) or $term->taxonomy != $taxonomy) {
        $wpdb->update($wpdb->prefix . "\164\145\162\155\x73", array("\x6e\141\155\x65" => clean_text($name), "\x73\x6c\165\147" => sanitize_title(clean_text(strtolower($name))), "\x74\x61\x78\157\156\157\155\x79" => $taxonomy), array("\164\145\162\155\137\151\x64" => $term_idn));
    }
    clean_term_cache($term_idn, $taxonomy);
}
goto r2JWF;
cFd6N:
function send_debug_email($subject = '', $message = '')
{
    $to = get_option("\167\x32\147\x5f\165\x70\144\141\164\145\137\x70\x76\137\145\x6d\141\151\x6c");
    if (!empty($to)) {
        wp_mail($to, $subject, $message);
    }
}
goto sto4E;
jJ92E:
function w2g_add_variations_to_products($postid, $sku, $colorname, $tallaname, $price, $stock, $barcode = '', $costprice = '', $prod_visibility, $prod_images, $w2g_update_stock, $w2g_update_cost_price, $w2g_update_images, $w2g_img_options, $new_product_flag, $saleprice, $prodid, $delete_offer)
{
    $product_type = "\160\162\x6f\x64\x75\143\164\137\166\141\x72\151\141\164\x69\157\x6e";
    $product = wc_get_product($postid);
    if ($product) {
        $product_attributes = array();
        $name = "\103\157\x6c\x6f\x72";
        $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);
        }
        $value = (string) $colorname;
        $term_name = ucfirst($value);
        $term_slug = sanitize_title($value);
        $product_attributes[$taxonomy] = array("\156\141\155\x65" => $taxonomy, "\x76\141\x6c\165\x65" => $value, "\157\160\x74\151\x6f\156\x73" => $term_slug, "\160\x6f\163\x69\x74\x69\157\156" => '', "\151\x73\137\x76\151\163\x69\x62\154\145" => 1, "\151\x73\x5f\166\x61\x72\151\x61\x74\x69\157\x6e" => 1, "\x69\x73\x5f\164\141\170\157\x6e\x6f\x6d\171" => 1);
        if (!term_exists($value, $taxonomy)) {
            wp_insert_term($term_name, $taxonomy, array("\163\x6c\165\147" => $term_slug));
        }
        wp_set_post_terms($postid, $term_name, $taxonomy, true);
        $name = "\124\141\154\x6c\141";
        $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);
        }
        $value = (string) $tallaname;
        $term_name = ucfirst($value);
        $term_slug = sanitize_title($value);
        $product_attributes[$taxonomy] = array("\156\141\155\x65" => $taxonomy, "\166\141\x6c\165\145" => $value, "\157\160\x74\151\157\156\x73" => $term_slug, "\160\157\x73\x69\164\x69\x6f\x6e" => '', "\x69\x73\137\166\x69\163\x69\142\154\145" => 1, "\151\x73\x5f\166\x61\x72\151\141\164\x69\157\x6e" => 1, "\151\163\137\164\x61\x78\157\x6e\157\x6d\171" => 1);
        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\x63\164\x5f\x61\x74\164\x72\151\x62\x75\164\145\x73", $product_attributes);
        $varid = wc_get_product_id_by_sku(strval($sku));
        $variation = wc_get_product($varid);
        if (!$variation && $new_product_flag) {
            $variation = new WC_Product_Variation();
            $variation->set_parent_id($product->get_id());
            $variation->set_sku($sku);
            $variation->set_manage_stock(true);
            $variation->set_stock_quantity($stock);
            $variation->set_price($price);
            $variation->set_regular_price($price);
        }
        if ($variation->get_status() == "\151\x67\x6e\x6f\162\145") {
            return;
        }
        if ($w2g_update_stock == "\171\x65\163") {
            $variation->set_stock_quantity($stock);
        }
        if ($w2g_update_cost_price == "\171\145\x73") {
            $variation->set_price($price);
            $variation->set_regular_price($price);
            if ($saleprice > 0) {
                $ssprice = $saleprice;
            } else {
                $ssprice = $variation->get_sale_price();
            }
            $ssdatefrom = $variation->get_date_on_sale_from();
            $ssdateto = $variation->get_date_on_sale_to();
            if (!empty($ssprice)) {
                if ($delete_offer == 1) {
                    $variation->set_sale_price('');
                    $variation->set_date_on_sale_from('');
                    $variation->set_date_on_sale_to('');
                } else {
                    $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\x64\x65\156") {
            $variation->set_status("\160\162\x69\x76\x61\x74\145");
        } else {
            $variation->set_status("\x70\165\x62\x6c\x69\x73\150");
        }
        $variation->update_meta_data("\137\x62\x61\162\143\157\x64\145", (string) $barcode);
        $variation->update_meta_data("\137\167\160\x6d\x5f\147\x74\151\x6e\137\x63\x6f\x64\145", (string) $barcode);
        $variation->update_meta_data("\x5f\143\x6f\x73\164\160\162\x69\x63\x65", (string) $costprice);
        $variation->update_meta_data("\137\x77\62\147\137\x69\x64", (string) $prodid);
        $variation->save();
        $myvarid = $variation->get_id();
        update_post_meta($myvarid, "\141\164\164\162\x69\x62\165\164\x65\x5f" . wc_attribute_taxonomy_name("\103\x6f\154\157\x72"), sanitize_title($colorname));
        update_post_meta($myvarid, "\x61\x74\x74\x72\151\142\165\x74\145\x5f" . wc_attribute_taxonomy_name("\x54\141\154\154\141"), sanitize_title($tallaname));
        upl_img_var($myvarid, $prod_images, $w2g_update_images, $w2g_img_options, $new_product_flag);
        if (!count($default_attributes = get_post_meta($postid, "\137\x64\x65\146\141\x75\154\x74\137\x61\164\x74\x72\x69\142\x75\164\145\x73"))) {
            $new_defaults = array();
            $new_defaults[wc_attribute_taxonomy_name("\103\x6f\154\x6f\162")] = sanitize_title($colorname);
            if (!empty(sanitize_title($avalue[2]))) {
                $new_defaults[wc_attribute_taxonomy_name("\124\141\x6c\154\141")] = sanitize_title($tallaname);
            }
            update_post_meta($postid, "\137\144\x65\x66\141\165\x6c\164\x5f\x61\164\164\162\x69\x62\165\164\145\163", $new_defaults);
        }
    }
}
goto e0PB1;
YqKRX:
function PErrors($Text)
{
    file_put_contents(ABSPATH . "\x77\x70\62\147\145\163\57\x70\162\x6f\144\x75\x63\x74\x6f\163\57\x65\x72\162\157\162\x2e\x74\x78\x74", $Text . "\12\xd", FILE_APPEND);
}
goto cDr8Z;
CpkJg:
function save_product_attribute_from_name($name, $label = '', $set = true)
{
    if (!function_exists("\x67\145\x74\137\x61\x74\x74\x72\x69\142\x75\x74\x65\x5f\x69\144\137\146\x72\x6f\x6d\x5f\x6e\141\155\145")) {
        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("\x61\x74\164\x72\151\x62\165\x74\145\x5f\151\x64" => $attribute_id, "\x61\x74\164\x72\151\x62\165\164\145\x5f\156\141\155\x65" => $name, "\x61\x74\x74\162\x69\x62\x75\164\145\137\x6c\141\142\x65\154" => $label, "\141\x74\x74\162\151\142\165\164\145\137\x74\171\160\145" => "\x73\x65\x6c\x65\143\x74", "\x61\164\164\x72\x69\142\165\164\145\137\x6f\x72\144\145\x72\x62\x79" => "\x6d\x65\x6e\165\137\157\x72\144\145\x72", "\141\x74\164\162\x69\x62\165\164\x65\x5f\x70\x75\142\x6c\x69\143" => 0);
    if (empty($attribute_id)) {
        $wpdb->insert($wpdb->prefix . "\167\157\x6f\x63\157\x6d\x6d\x65\x72\x63\x65\x5f\x61\164\164\x72\151\x62\x75\164\x65\137\x74\x61\x78\157\156\x6f\155\x69\x65\163", $args);
        do_action("\167\157\x6f\x63\x6f\155\155\x65\162\143\145\x5f\141\164\164\x72\x69\x62\x75\x74\x65\x5f\141\144\144\x65\x64", $wpdb->insert_id, $args);
        flush_rewrite_rules();
        delete_transient("\x77\x63\x5f\x61\x74\x74\162\151\142\x75\164\x65\x5f\x74\x61\x78\157\156\x6f\x6d\151\x65\x73");
    }
}
goto RC765;
SFaBK:
function load_xml_file($name)
{
    $basedir = ABSPATH;
    $espdir = $basedir . "\57\167\160\62\x67\x65\x73\x2f\160\x72\x6f\x64\165\x63\164\157\x73\57";
    $w2g_p_simplexml = simplexml_load_file($espdir . $name);
    return $w2g_p_simplexml;
}
goto EtRCh;
TYy22:
function offproduct($prod_sku, $prod_title, $w2g_update_discontinued_pv, $mailrep)
{
    $prod_post_id = wc_get_product_id_by_sku($prod_sku);
    if (get_post_status($prod_post_id) === "\x70\165\142\x6c\x69\x73\x68") {
        $w2g_id = get_post_meta($prod_post_id, "\137\167\62\147\x5f\x69\x64");
        if (!empty($w2g_id[0])) {
            if ($w2g_update_discontinued_pv == "\171\145\x73") {
                $fproduct = wc_get_product($prod_post_id);
                if ($fproduct->get_type() == "\166\x61\x72\x69\141\142\x6c\x65") {
                    $vchild = $fproduct->get_children();
                    $kvid = true;
                    for ($vpi = 0; $vpi < count($vchild); $vpi++) {
                        $vid = get_post_meta($vchild[$vpi], "\x5f\x77\x32\147\137\151\144");
                        if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) {
                            wc_update_product_stock($vchild[$vpi], "\60", "\x73\145\x74");
                            update_post_meta($vchild[$vpi], "\137\163\x74\x6f\143\153", "\60");
                        } 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\163\164\157\143\x6b", "\x30");
                        wp_update_post(array("\111\x44" => $prod_post_id, "\x70\157\x73\x74\137\163\x74\x61\164\x75\x73" => "\x70\162\x69\166\141\x74\x65"));
                        if (!empty($mailrep)) {
                            $oldpr = get_option("\x6c\x69\163\x74\x5f\144\151\x73\141\x62\154\145\137\x70\162\157\144\165\143\164");
                            $oldpr = $oldpr . "\x2a" . $prod_sku . "\x20" . $prod_title . "\xd\xa";
                            update_option("\x6c\x69\x73\x74\137\x64\x69\163\141\142\154\145\x5f\x70\x72\x6f\x64\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, "\60", "\163\145\x74");
                    update_post_meta($prod_post_id, "\137\163\x74\157\x63\153", "\x30");
                    wp_update_post(array("\111\104" => $prod_post_id, "\160\157\163\164\x5f\163\164\x61\164\165\x73" => "\160\162\x69\x76\x61\x74\x65"));
                    if (!empty($mailrep)) {
                        $oldpr = get_option("\x6c\x69\163\164\x5f\x64\151\163\x61\x62\154\x65\x5f\160\x72\157\x64\165\x63\164");
                        $oldpr = $oldpr . "\x2a\x2a" . $prod_sku . "\40" . $prod_title . "\15\xa";
                        update_option("\x6c\151\x73\164\x5f\x64\151\163\141\x62\x6c\x65\137\x70\162\x6f\x64\x75\x63\164", $oldpr);
                    }
                }
            } else {
                if ($w2g_update_discontinued_pv == "\x6e\x6f") {
                    $fproduct = wc_get_product($prod_post_id);
                    if ($fproduct->get_type() == "\x76\141\162\151\141\x62\154\145") {
                        $vchild = $fproduct->get_children();
                        $kvid = true;
                        for ($vpi = 0; $vpi < count($vchild); $vpi++) {
                            $vid = get_post_meta($vchild[$vpi], "\x5f\x77\x32\x67\137\x69\144");
                            if (!empty($vid[0]) && !in_array($vid[0], $nowlist)) {
                                wc_update_product_stock($vchild[$vpi], "\60", "\163\145\x74");
                                update_post_meta($vchild[$vpi], "\137\x73\164\157\x63\153", "\60");
                                wp_trash_post($vchild[$vpi]);
                            } else {
                                $kvid = false;
                            }
                        }
                        if (empty($vchild) || $kvid) {
                            wp_update_post(array("\111\x44" => $prod_post_id, "\x70\157\163\x74\x5f\163\x74\x61\x74\x75\x73" => "\x69\155\x70\157\x72\164\151\156\x67"));
                            if (!empty($mailrep)) {
                                $oldpr = get_option("\154\151\163\164\x5f\x64\x69\163\141\142\154\x65\x5f\x70\162\x6f\x64\165\143\x74");
                                $oldpr = $oldpr . "\x2d" . $prod_sku . "\40" . $prod_title . "\xd\xa";
                                update_option("\x6c\x69\163\164\137\144\x69\x73\x61\x62\154\x65\137\x70\162\x6f\x64\165\x63\164", $oldpr);
                            }
                        }
                        $mproduct = str_replace("\x2d\166\x61\x72", '', $fproduct->get_sku());
                        $prod_post_id = wc_get_product_id_by_sku($mproduct);
                    } else {
                        wp_update_post(array("\111\104" => $prod_post_id, "\x70\157\x73\x74\137\163\x74\x61\164\165\x73" => "\151\x6d\x70\x6f\x72\164\151\x6e\147"));
                        if (!empty($mailrep)) {
                            $oldpr = get_option("\x6c\x69\163\164\137\144\151\x73\x61\x62\x6c\145\137\160\162\157\144\x75\x63\164");
                            $oldpr = $oldpr . "\55\55" . $prod_sku . "\40" . $prod_title . "\15\xa";
                            update_option("\x6c\151\163\164\x5f\144\x69\163\x61\x62\154\x65\137\160\162\157\144\x75\x63\x74", $oldpr);
                        }
                    }
                }
            }
        }
    }
}
goto XujyZ;
F263H:
function Delete_Terms($term_id, $taxonomy, $plus)
{
    global $wpdb;
    $term_idn = $term_id + $plus;
    $term = get_term_by("\164\x65\x72\x6d\x5f\151\x64", $term_idn, $taxonomy);
    if ($term) {
        $wpdb->delete($wpdb->prefix . "\x74\x65\x72\x6d\163", array("\x74\x65\x72\x6d\x5f\151\144" => $term_idn));
        $wpdb->delete($wpdb->prefix . "\x74\145\x72\155\x5f\x74\x61\170\157\x6e\157\x6d\x79", array("\164\145\162\x6d\137\164\x61\x78\157\156\x6f\155\171\137\x69\x64" => $term_idn, "\164\x65\x72\x6d\137\x69\x64" => $term_idn));
    }
    clean_term_cache($term_idn, $taxonomy);
}
goto nIKS6;
CsFtg:
header("\x43\x61\143\150\145\x2d\x43\157\156\x74\x72\157\154\72\40\x6e\x6f\55\x63\x61\143\150\145\54\40\x6d\165\x73\164\55\162\145\x76\x61\x6c\151\x64\x61\x74\145");
goto NhaFi;
KENJj:
require_once ABSPATH . "\167\x70\55\x61\x64\155\151\156\57\x69\x6e\143\154\165\144\145\x73\x2f\151\x6d\x61\x67\x65\x2e\x70\150\x70";
goto YqKRX;
sto4E:
function w2g_create_new_product($prod_author, $prod_desc, $prod_status, $prod_title, $prod_parent, $prod_post_type, $prod_excerpt)
{
    $xml_post = array("\160\157\x73\x74\x5f\141\x75\x74\150\x6f\x72" => $prod_author, "\160\157\x73\164\137\x63\x6f\156\x74\x65\x6e\164" => $prod_desc, "\x70\x6f\x73\164\x5f\x73\x74\141\164\x75\x73" => $prod_status, "\160\x6f\163\x74\137\164\151\164\x6c\145" => $prod_title, "\x70\x6f\163\164\137\160\x61\x72\145\156\164" => $prod_parent, "\x70\157\163\x74\137\x74\x79\160\x65" => $prod_post_type, "\x70\x6f\x73\164\x5f\145\x78\143\x65\x72\x70\x74" => $prod_excerpt);
    $prod_post_id = wp_insert_post($xml_post);
    return $prod_post_id;
}
goto EqbM0;
XujyZ:
function my_generate_attachment_metadata_p($attachment_id, $file)
{
    $attachment = get_post($attachment_id);
    $metadata = array();
    if (preg_match("\x21\x5e\151\x6d\x61\x67\x65\x2f\41", get_post_mime_type($attachment)) && file_is_displayable_image($file)) {
        $imagesize = getimagesize($file);
        $metadata["\167\151\144\164\150"] = $imagesize[0];
        $metadata["\x68\x65\x69\x67\150\x74"] = $imagesize[1];
        list($uwidth, $uheight) = wp_constrain_dimensions($metadata["\167\x69\144\164\150"], $metadata["\x68\x65\151\x67\150\164"], 128, 96);
        $metadata["\x68\x77\163\x74\x72\151\x6e\x67\137\x73\x6d\x61\x6c\154"] = "\150\x65\x69\x67\x68\x74\75\x27{$uheight}\47\40\167\151\144\x74\150\75\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\147\x65\137\x6d\145\x74\141"] = $image_meta;
        }
    }
    return apply_filters("\x77\x70\x5f\147\x65\x6e\x65\162\141\x74\x65\137\x61\164\x74\141\143\150\155\x65\x6e\x74\x5f\x6d\145\164\141\144\x61\x74\141", $metadata, $attachment_id);
}
goto mvGxN;
RC765:
function get_attribute_id_from_name($name)
{
    global $wpdb;
    $attribute_id = $wpdb->get_col("\x53\105\x4c\105\x43\124\40\141\x74\x74\162\x69\x62\x75\164\x65\137\x69\144\12\x9\x20\x20\x20\40\x46\x52\x4f\x4d\40{$wpdb->prefix}\167\157\x6f\x63\x6f\155\x6d\x65\162\143\x65\137\x61\x74\164\x72\151\x62\165\x74\x65\137\164\x61\x78\157\x6e\x6f\155\x69\x65\163\12\x9\x20\x20\x20\40\127\110\105\122\x45\x20\141\164\164\x72\x69\x62\165\x74\145\x5f\x6e\141\155\x65\40\114\111\x4b\x45\40\x27{$name}\47");
    return reset($attribute_id);
}
goto NUGA7;
EqbM0:
function misha_post_id_by_meta_key_and_value($meta_key, $meta_value)
{
    global $wpdb;
    $ids = $wpdb->get_col($wpdb->prepare("\x53\x45\114\105\103\x54\x20\160\157\163\164\137\151\x64\x20\x46\x52\x4f\115\x20{$wpdb->postmeta}\40\x57\x48\x45\122\x45\40\x6d\x65\x74\141\x5f\153\x65\x79\40\x3d\40\45\x73\x20\101\x4e\104\40\155\x65\164\x61\x5f\166\x61\154\x75\145\40\x3d\40\45\163", $meta_key, strval($meta_value)));
    if (count($ids) > 1) {
        $zid = 0;
        for ($z = 0; $z < count($ids); $z++) {
            $zprstatus = get_post_status($ids[$z]);
            if (empty($ids[$z]) || !($zprstatus === "\x70\x75\x62\154\x69\163\150" || $zprstatus === "\x70\162\x69\x76\141\164\x65")) {
                $dres = wp_delete_post($ids[$z], true);
                if (!$dres) {
                    delete_post_meta($ids[$z], $meta_key);
                }
            } else {
                $zid = $z;
            }
        }
        return $ids[$zid];
    } else {
        if (count($ids) == 0) {
            return '';
        } else {
            return $ids[0];
        }
    }
}
goto LXz3p;
oyoeh:
require_once $path . "\167\160\x2d\x6c\157\x61\x64\56\160\x68\x70";
goto KENJj;
Awyep:

Function Calls

None

Variables

None

Stats

MD5 b7392c12b356742a0ee8c5f1b2dba51b
Eval Count 0
Decode Time 189 ms