=3) { $topic=$tmp[0]; $domain_keyword=$tmp[1]; $x_main_keyword=$tmp[2]; } } /* ----------------------------- Queue marching orders ----------------------- */ $queue_row = null; if ($qLink && $queue_id) { $rs = @mysql_query("SELECT * FROM c_domain_build_queue WHERE id=".(int)$queue_id." LIMIT 1", $qLink); } elseif ($qLink && $domain !== '') { $rs = @mysql_query("SELECT * FROM c_domain_build_queue WHERE domain='".mysql_real_escape_string($domain)."' ORDER BY id DESC LIMIT 1", $qLink); } if (isset($rs) && $rs && mysql_num_rows($rs)) { $queue_row = mysql_fetch_assoc($rs); } if (is_array($queue_row)) { if (isset($queue_row['slug']) && $queue_row['slug']!=='') { $SLUG = $queue_row['slug']; } if (isset($queue_row['type']) && $queue_row['type']!=='') { $TEMPLATE = $queue_row['type']; } } /* ------------------------------- Build plan -------------------------------- */ $PLAN = @json_decode('{{PLAN_JSON}}', true); if (!is_array($PLAN)) $PLAN=array(); /* ------------------------------- Meta/title -------------------------------- */ $dividers = array(' - ', ' | '); $divider = $dividers[ (crc32($domain) % count($dividers)) ]; $meta_title = (isset($PLAN['title_prefix'])?$PLAN['title_prefix']:'') . $divider . $topic; $meta_title = trim($meta_title, ' -|'); if (function_exists('ai_complete')) { $ask = "Write a concise, data-backed H1 title (max 60 chars) for a page about: {$topic}. Return ONLY the title."; $meta_title = ai_complete($ask, 'Title'); } $meta_desc = isset($PLAN['meta_override'])?$PLAN['meta_override']:''; if ($meta_desc==='') { if (function_exists('ai_complete')) { $meta_desc = ai_complete("Write a 2-sentence meta description (<= 160 chars) about {$topic}. No emojis. No guarantees.", "Meta Description"); } else { $meta_desc = "Learn about {$topic}."; } } if (function_exists('smart_meta')) $meta_desc = smart_meta($meta_desc, 160); /* ------------------------------ Content HTML -------------------------------- */ $content = array(); // collect sections, then implode // Intro paragraph if (function_exists('ai_complete')) { $intro = ai_complete("Write a short, friendly intro paragraph about {$topic}. No links, no guarantees.", "Intro"); } else { $intro = "Welcome! This page covers {$topic}."; } $content[] = '
'.htmlspecialchars($intro, ENT_QUOTES, 'UTF-8').'
'; // Images $imgCount = isset($PLAN['images_count']) ? intval($PLAN['images_count']) : 0; $imgTopic = isset($PLAN['images_topic']) && strlen($PLAN['images_topic']) ? $PLAN['images_topic'] : $topic; if ($imgCount > 0) { $imgs = array(); for ($i=0; $i<$imgCount; $i++) { // At runtime you likely use your vector/images helper $imgs[] = '
';
}
$content[] = '| '.htmlspecialchars($tt.' Col '.($j+1), ENT_QUOTES, 'UTF-8').' | '; } $html.='
|---|
| '.htmlspecialchars($cell, ENT_QUOTES, 'UTF-8').' | '; } $html.='
'.htmlspecialchars($free, ENT_QUOTES, 'UTF-8').'