]=$locMap[$rid]['city']??[]; unset($row['tax_rate_id']); $tax[]=$row; } $zones=[]; $zoneIds=array_keys(WC_Shipping_Zones::get_zones()); array_unshift($zoneIds,0); foreach($zoneIds as $zid){ $zone=new WC_Shipping_Zone((int)$zid); $locations=[]; foreach($zone->get_zone_locations() as $loc)$locations[]=['code'=>$loc->code,'type'=>$loc->type]; $methods=[]; foreach($zone->get_shipping_methods(true) as $m){ if(!in_array($m->id,['free_shipping','flat_rate','local_pickup'],true))continue; $methods[]=['id'=>$m->id,'enabled'=>$m->enabled,'settings'=>is_array($m->instance_settings)?$m->instance_settings:[]]; } $zones[]=['source_id'=>(int)$zid,'name'=>$zone->get_zone_name(),'order'=>$zone->get_zone_order(),'locations'=>$locations,'methods'=>$methods]; } $classes=[]; foreach(get_terms(['taxonomy'=>'product_shipping_class','hide_empty'=>false]) as $t){ if($t instanceof WP_Term)$classes[]=['name'=>$t->name,'slug'=>$t->slug,'description'=>$t->description]; } $keys=['woocommerce_tax_classes','woocommerce_tax_based_on','woocommerce_shipping_tax_class','woocommerce_tax_round_at_subtotal','woocommerce_tax_display_shop','woocommerce_tax_display_cart','woocommerce_price_num_decimals','woocommerce_currency_pos','woocommerce_thousand_sep','woocommerce_decimal_sep','woocommerce_allowed_countries','woocommerce_specific_allowed_countries','woocommerce_ship_to_countries','woocommerce_ship_to_destination','woocommerce_enable_coupons','woocommerce_enable_shipping_calc','woocommerce_hide_shipping_costs_when_free','woocommerce_prices_include_tax','woocommerce_calc_taxes']; $settings=[]; foreach($keys as $k)$settings[$k]=get_option($k); $payload=['generated_at'=>gmdate('c'),'tax_rates'=>$tax,'shipping_zones'=>$zones,'shipping_classes'=>$classes,'settings'=>$settings]; $json=wp_json_encode($payload,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); if(!is_string($json)||file_put_contents(self::WORK.'/commerce.json',$json,LOCK_EX)!==strlen($json))return ['ok'=>false,'error'=>'commerce_write_failed']; $script=self::commerce_importer_script(); if(file_put_contents(self::WORK.'/commerce-import.php',$script,LOCK_EX)!==strlen($script))return ['ok'=>false,'error'=>'commerce_importer_write_failed']; @chmod(self::WORK.'/commerce.json',0600); @chmod(self::WORK.'/commerce-import.php',0600); $r=self::run_wp(['eval-file',self::WORK.'/commerce-import.php']); return ['ok'=>!empty($r['ok']),'source_tax_rates'=>count($tax),'source_shipping_zones'=>count($zones),'source_shipping_methods'=>array_sum(array_map(static fn($z)=>count($z['methods']),$zones)),'source_shipping_classes'=>count($classes),'result'=>['ok'=>!empty($r['ok']),'exit'=>$r['exit']??null,'stdout'=>$r['stdout']??'','stderr'=>$r['stderr']??'']]; } public static function http_probe(array $input=[]): array { $group=(string)($input['group']??'core'); if($group==='routes'){ $urls=[ 'checkout'=>'https://v10.skyleds.de/kasse/', 'cart'=>'https://v10.skyleds.de/warenkorb/', 'account'=>'https://v10.skyleds.de/mein-konto/', 'contact'=>'https://v10.skyleds.de/kontakt/', 'faq'=>'https://v10.skyleds.de/haeufig-gestellte-fragen/', 'configurator'=>'https://v10.skyleds.de/led-konfigurator/', 'irion'=>'https://v10.skyleds.de/shop/led-videowaende/indoor-led-videowaende/indoor-festinstallation/irion-pro-indoor-led-videowand/', ]; }elseif($group==='apis'){ $urls=[ 'environment'=>'https://v10.skyleds.de/v10-environment.php', 'mcp_health'=>'https://v10.skyleds.de/wp-json/skyleds-v10-control/v1/health', 'cart_sync'=>'https://v10.skyleds.de/v10-cart-sync.php', 'account_api'=>'https://v10.skyleds.de/v10-account-api.php', 'tracking'=>'https://v10.skyleds.de/v10-tracking-config.php', 'config_mail'=>'https://v10.skyleds.de/configurator-mail.php', 'catalog'=>'https://v10.skyleds.de/v10-catalog-data.php', 'guides'=>'https://v10.skyleds.de/v10-guide-data.php', 'knowledge'=>'https://v10.skyleds.de/v10-knowledge-data.php', 'faq_data'=>'https://v10.skyleds.de/v10-faq-data.php', 'solutions'=>'https://v10.skyleds.de/v10-solution-data.php', 'legal'=>'https://v10.skyleds.de/v10-legal-data.php', 'payment_data'=>'https://v10.skyleds.de/v10-payment-data.php', 'google_reviews'=>'https://v10.skyleds.de/v10-google-reviews.php', 'ai_bridge'=>'https://v10.skyleds.de/v10-ai-bridge.php', 'datasheet_skyserie'=>'https://v10.skyleds.de/v10-datasheet-data.php?id=skyserie', 'safety_skywall'=>'https://v10.skyleds.de/v10-product-safety.php?id=skywall', 'safety_skyserie'=>'https://v10.skyleds.de/v10-product-safety.php?id=skyserie', 'reviews_skywall'=>'https://v10.skyleds.de/v10-reviews-data.php?id=skywall', 'direct_ai_bridge'=>'https://v10.skyleds.de/humanity-preview-v10/v10-ai-bridge.php', 'direct_datasheet_skyserie'=>'https://v10.skyleds.de/humanity-preview-v10/v10-datasheet-data.php?id=skyserie', 'direct_safety_skywall'=>'https://v10.skyleds.de/humanity-preview-v10/v10-product-safety.php?id=skywall', 'direct_health'=>'https://v10.skyleds.de/humanity-preview-v10/v10-health.php', ]; }else{ $urls=[ 'root'=>'https://v10.skyleds.de/', 'shop'=>'https://v10.skyleds.de/shop/', 'robots'=>'https://v10.skyleds.de/robots.txt', 'registry'=>'https://v10.skyleds.de/v10-product-registry.php', ]; } $out=[]; foreach($urls as $key=>$url){ $r=wp_remote_get($url,[ 'timeout'=>4, 'redirection'=>0, 'sslverify'=>true, 'headers'=>['User-Agent'=>'Skyleds-V10-Probe/1.0'], ]); if(is_wp_error($r)){ $out[$key]=['ok'=>false,'error'=>$r->get_error_code()]; continue; } $body=(string)wp_remote_retrieve_body($r); $jsonSummary=null; $decoded=json_decode($body,true); if(is_array($decoded)){ $jsonSummary=[]; foreach(['ok','staging_mode','checkout_enabled','account_api_enabled','form_submission_enabled','staging_disabled','logged_in','tracking_enabled','consent_mode_enabled','submission_enabled','dry_run_enabled','message','code','count','available','field_count','product_id','legacy_12v_excluded','document_count','product_count','stores_conversation','wawi_on_chat','customer_mail_on_chat','explicit_submit_required','average','rating_count','review_count','staging_diagnostics','ga4_measurement_id','google_tag_id','gtm_container_id','ads_conversion_id','analytics_snippet_enabled','tagmanager_snippet_enabled','scope','abilities_api','category_registered','status_ability_registered','shadow_ability_registered','ledger_ability_registered','ability_count','token_configured','user_bound'] as $field){ if(array_key_exists($field,$decoded))$jsonSummary[$field]=$decoded[$field]; } } $out[$key]=[ 'ok'=>true, 'code'=>(int)wp_remote_retrieve_response_code($r), 'bytes'=>strlen($body), 'x_robots'=>(string)wp_remote_retrieve_header($r,'x-robots-tag'), 'location'=>(string)wp_remote_retrieve_header($r,'location'), 'content_type'=>(string)wp_remote_retrieve_header($r,'content-type'), 'contains_skyleds'=>stripos($body,'skyleds')!==false, 'json'=>$jsonSummary, ]; } return ['ok'=>true,'checked_at'=>gmdate('c'),'checks'=>$out]; } public static function health_selftest(): array { $code='ob_start(); include '.var_export(self::ROOT.'/humanity-preview-v10/v10-health.php',true).'; echo ob_get_clean();'; $r=self::run_wp(['eval',$code]); if(empty($r['ok'])) return ['ok'=>false,'error'=>'health_exec_failed','stderr'=>$r['stderr']??'']; $j=json_decode((string)($r['stdout']??''),true); if(!is_array($j)) return ['ok'=>false,'error'=>'health_json_invalid','stdout_prefix'=>substr((string)($r['stdout']??''),0,500)]; return $j; } public static function ai_selftest(): array { $url='https://v10.skyleds.de/humanity-preview-v10/v10-ai-bridge.php'; $res=wp_remote_post($url,[ 'timeout'=>45,'redirection'=>0, 'headers'=>['User-Agent'=>'Skyleds-V10-AI-QA/1.0','Accept'=>'application/json'], 'body'=>[ 'message'=>'Ich brauche eine 4 × 3 Meter Outdoor LED-Wand. Betrachtungsabstand etwa 5 Meter, teilweise direkte Sonne.', 'lang'=>'de', 'context'=>wp_json_encode(['state'=>[],'advisor_v10'=>['qa'=>true,'explicit_submit_required'=>true]]) ] ]); if(is_wp_error($res)) return ['ok'=>false,'error'=>$res->get_error_code()]; $code=(int)wp_remote_retrieve_response_code($res); $body=json_decode((string)wp_remote_retrieve_body($res),true); $data=is_array($body)&&is_array($body['data']??null)?$body['data']:[]; $structured=is_array($data['structured']??null)?$data['structured']:[]; $items=is_array($structured['items']??null)?$structured['items']:[]; return [ 'ok'=>$code===200 && !empty($body['success']) && !empty($data), 'http'=>$code, 'has_answer'=>!empty($data['answer']), 'has_structured'=>!empty($structured), 'title'=>sanitize_text_field((string)($structured['title']??'')), 'next_question'=>sanitize_text_field((string)($structured['next_question']??'')), 'item_titles'=>array_values(array_filter(array_map(static fn($x)=>is_array($x)?sanitize_text_field((string)($x['title']??'')):'',$items))), 'response_keys'=>is_array($body)?array_values(array_keys($body)):[], 'top_success'=>is_array($body)?($body['success']??null):null, 'top_ok'=>is_array($body)?($body['ok']??null):null, 'top_message'=>is_array($body)?sanitize_text_field((string)($body['message']??'')):'', 'data_keys'=>is_array($data)?array_values(array_keys($data)):[], ]; } public static function extended_selftest(): array { $base='https://v10.skyleds.de/'; $out=['ok'=>true,'checked_at'=>gmdate('c'),'tests'=>[]]; $beforeOrders=self::run_wp(['post','list','--post_type=shop_order','--post_status=any','--format=count']); $beforeCustomers=self::run_wp(['user','list','--role=customer','--format=count']); if(!is_dir(self::WORK) && !wp_mkdir_p(self::WORK)){ return ['ok'=>false,'error'=>'workdir_create_failed']; } @chmod(self::WORK,0700); $password=wp_generate_password(28,true,true); $email='v10-e2e-'.gmdate('YmdHis').'@skyleds.invalid'; $username='v10_e2e_'.gmdate('YmdHis'); $setup=self::WORK.'/account-e2e-setup.php'; $setupCode="ID);}\n". "\$uid=wp_create_user(\$username,\$password,\$email);if(is_wp_error(\$uid)){fwrite(STDERR,\$uid->get_error_message());exit(3);}\n". "\$u=new WP_User((int)\$uid);\$u->set_role('customer');\n". "update https://skyleds.de/post-sitemap.xml 2026-09-27T19:05:07+00:00 https://skyleds.de/page-sitemap.xml 2026-09-27T19:10:06+00:00 https://skyleds.de/product-sitemap.xml 2026-09-27T19:15:00+00:00 https://skyleds.de/category-sitemap.xml 2026-09-27T19:05:07+00:00 https://skyleds.de/video-sitemap.xml 2026-09-27T18:22:20+00:00