function scg_apply_placeholders($text, $post_link, $title) { if (!$text) return $text; $keywords = scg_get_keywords(); // المقدمة: رابط واحد على الكلمة الأولى $bold_anchor = '' . esc_html($title) . ''; $search = array('{BOLD_TITLE}'); $replace = array($bold_anchor); foreach ($keywords as $i => $k) { $search[] = '{A_KW' . $i . '}'; $replace[] = '' . esc_html($title . ' ' . $k) . ''; // Bold فقط } return str_replace($search, $replace, $text); } function scg_build_for_post($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return false; if (wp_is_post_revision($post_id)) return false; if (get_post_type($post_id) !== 'post') return false; $title = get_the_title($post_id); $post_link = get_permalink($post_id); $intros_text = get_option(SCG_OPT_INTROS, ''); $outros_text = get_option(SCG_OPT_OUTROS, ''); $intros = scg_split_units($intros_text); $outros = scg_split_units($outros_text); if (empty($intros)) $intros = array('

{BOLD_TITLE}

'); if (empty($outros)) $outros = array('

{BOLD_TITLE}

'); $intro_idx = intval(get_option(SCG_OPT_INTRO_IDX, -1)); $outro_idx = intval(get_option(SCG_OPT_OUTRO_IDX, -1)); $next_intro = ($intro_idx + 1) % count($intros); $next_outro = ($outro_idx + 1) % count($outros); update_option(SCG_OPT_INTRO_IDX, $next_intro); update_option(SCG_OPT_OUTRO_IDX, $next_outro); $intro_tpl = $intros[$next_intro]; $outro_tpl = $outros[$next_outro]; $intro_html = scg_apply_placeholders($intro_tpl, $post_link, $title); $outro_html = scg_apply_placeholders($outro_tpl, $post_link, $title); $keywords = scg_get_keywords(); $pros_kw = array_slice($keywords, 2, 3); $cons_kw = array_slice($keywords, 5, 3); $faq_kw = array_slice($keywords, 9, 3); $get_kw_bold = function(&$arr) use ($title) { if (empty($arr)) return ''; $k = array_shift($arr); return '' . esc_html($title . ' ' . $k) . ''; }; $pros = "

Pros of {$title}

"; $cons = "

Cons of {$title}

"; $faq_tpl = "

FAQs about {BOLD_TITLE}

What is {BOLD_TITLE}?

{BOLD_TITLE} simplifies digital tasks and offers powerful tools. " . $get_kw_bold($faq_kw) . "

Is {BOLD_TITLE} free?

Basic features are free; premium upgrades available. " . $get_kw_bold($faq_kw) . "

How to install?

Install via official stores. " . $get_kw_bold($faq_kw) . "

Is it safe?

Regular updates and verified sources ensure safety.

"; $faq_html = scg_apply_placeholders($faq_tpl, $post_link, $title); $download_section = "

How to Download and Install {$title}

Easy installation on Android and iOS devices ensures quick access to advanced features. Furthermore, users can follow step-by-step instructions seamlessly.

  1. Open Google Play or App Store.
  2. Search for {$title} official application.
  3. Tap Install or Get.
  4. Open the app and start using immediately.
"; $final = $intro_html . $pros . $cons . $faq_html . $download_section . $outro_html; remove_action('save_post', 'scg_on_save'); wp_update_post(array('ID' => $post_id, 'post_content' => $final)); add_action('save_post', 'scg_on_save'); return true; } Captain Tsubasa: Dream Team Pro | Souq Apps
TAG: Captain Tsubasa: Dream Team Pro