function tarek_end_content() {

    if (!is_single()) return '';

    $settings = get_option('tarek_options');

    if (!is_array($settings)) return '';

    // التحقق من التفعيل
    if (empty($settings['link_end'])) return '';

    // جلب التصنيفات الحالية
    $categories = wp_get_post_categories(get_the_ID());

    $posts = get_posts([
        'posts_per_page' => 4,
        'post__not_in'   => [get_the_ID()], // استثناء المقال الحالي
        'category__in'   => $categories,
    ]);

    if (empty($posts)) return '';

    $html = '<div class="tarek-end-links">';
    $html .= '<h3>مقالات ذات صلة</h3>';

    foreach ($posts as $post) {

        $title = esc_html($post->post_title);
        $link  = esc_url(get_permalink($post->ID));

        $html .= '<a href="'.$link.'">'.$title.'</a>';
    }

    $html .= '</div>';

    return $html;
}function tarek_auto_linking($content) {

    // جلب الإعدادات الموحدة
    $settings = get_option('tarek_options');

    if (!is_array($settings)) return $content;

    // التحقق من تفعيل الميزة
    if (empty($settings['link_auto'])) return $content;

    // جلب الكلمات
    $keywords = $settings['auto_keywords'] ?? [];

    if (empty($keywords) || !is_array($keywords)) return $content;

    foreach ($keywords as $item) {

        if (empty($item['keyword']) || empty($item['url'])) continue;

        $word  = trim($item['keyword']);
        $url   = esc_url($item['url']);
        $limit = isset($item['limit']) ? (int)$item['limit'] : 1;

        $count = 0;

        // منع التعديل داخل روابط موجودة
        $content = preg_replace_callback(
            '/(?!<a[^>]*?>)(\b'.preg_quote($word, '/').'\b)(?![^<]*?<\/a>)/u',
            function($matches) use ($url, &$count, $limit){

                if ($count >= $limit) return $matches[0];

                $count++;

                return '<a href="'.$url.'">'.$matches[0].'</a>';
            },
            $content
        );
    }

    return $content;
}<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.shipping-sa.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://www.shipping-sa.com/post-sitemap.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/page-sitemap.xml</loc>
		<lastmod>2026-01-19T02:24:40+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/elementskit_content-sitemap.xml</loc>
		<lastmod>2026-01-14T20:25:34+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/elementor-hf-sitemap.xml</loc>
		<lastmod>2026-03-02T10:40:42+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/metform-form-sitemap.xml</loc>
		<lastmod>2026-01-19T02:45:44+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/category-sitemap.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/post_tag-sitemap.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/post_tag-sitemap2.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/post_tag-sitemap3.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/post_tag-sitemap4.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/post_tag-sitemap5.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/post_tag-sitemap6.xml</loc>
		<lastmod>2026-04-07T20:26:02+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.shipping-sa.com/author-sitemap.xml</loc>
		<lastmod>2026-01-14T19:36:26+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->