// If no English title found, try broader searches with fallbacks if (empty($result['english_title'])) { // Try looking for images with less strict criteria $all_images = $xpath->query("//img[@title or @alt]"); foreach ($all_images as $img) { $title = $img->getAttribute('title'); $alt = $img->getAttribute('alt'); // Accept any meaningful English text (10+ chars, mostly Latin) if (!empty($title) && strlen($title) > 10 && preg_match('/[a-zA-Z\s]{10,}/', $title)) { $title_lower = strtolower($title); // Only skip the most obvious unwanted terms $strict_unwanted = ['logo', 'banner', 'image', 'photo', 'icon', 'youtube']; $is_unwanted = false; foreach ($strict_unwanted as $term) { if (strpos($title_lower, $term) !== false) { $is_unwanted = true; break; } // If no description found in styled div, try fallback approaches if (empty($result['full_description'])) { // Look for paragraphs with substantial Arabic content $all_paragraphs = $xpath->query("//p"); foreach ($all_paragraphs as $p) { $text = trim($p->nodeValue); // Skip if too short or contains unwanted content if (strlen($text) < 100 || preg_match('/(الهاتف|البريد|رابط|إضغط|تسجيل|أضف|تقويم|\+966|@|www\.|http)/ui', $text)) { continue; } // Check if it's substantial Arabic content if (preg_match('/[أ-ي]/u', $text)) { $result['full_description'] = sanitize_textarea_field($text); break; } } } // Final fallback: Look for any div with substantial Arabic text if (empty($result['full_description'])) { $content_divs = $xpath->query("//div[string-length(normalize-space(text())) > 100]"); foreach ($content_divs as $div) { $text = trim($div->nodeValue); // Skip if contains unwanted content if (preg_match('/(الهاتف|البريد|رابط|إضغط|تسجيل|أضف|تقويم|\+966|@|www\.|http|تواصل|اتصل)/ui', $text)) { continue; } // Check if it's substantial Arabic content if (strlen($text) > 100 && preg_match('/[أ-ي]/u', $text)) { // Additional cleaning $lines = explode("\n", $text); $clean_lines = []; foreach ($lines as $line) { $line = trim($line); if (!empty($line) && !preg_match('/(الهاتف|البريد|رابط|إضغط|تسجيل|أضف|تقويم|\+966|@|www\.|http)/ui', $line)) { $clean_lines[] = $line; } } $clean_text = implode(' ', $clean_lines); $clean_text = preg_replace('/\s+/', ' ', $clean_text); $clean_text = trim($clean_text); if (strlen($clean_text) > 100) { $result['full_description'] = sanitize_textarea_field($clean_text); break; } } } } } if (!$is_unwanted) { $result['english_title'] = sanitize_text_field($title); break; } } elseif (!empty($alt) && strlen($alt) > 10 && preg_match('/[a-zA-Z\s]{10,}/', $alt)) { $alt_lower = strtolower($alt); $strict_unwanted = ['logo', 'banner', 'image', 'photo', 'icon', 'youtube']; $is_unwanted = false; foreach ($strict_unwanted as $term) { if (strpos($alt_lower, $term) !== false) { $is_unwanted = true; break; } } if (!$is_unwanted) { $result['english_title'] = sanitize_text_field($alt); break; } } } } // Final fallback: Look for English text in headers if (empty($result['english_title'])) { $text_elements = $xpath->query("//h1 | //h2 | //h3 | //strong | //b"); foreach ($text_elements as $element) { $text = trim($element->nodeValue); if (strlen($text) > 10 && strlen($text) < 100 && preg_match('/[a-zA-Z\s]{10,}/', $text)) { // Check if it's mostly English (more than 60% Latin characters) $latin_chars = preg_match_all('/[a-zA-Z]/', $text); $total_chars = mb_strlen(preg_replace('/\s/', '', $text)); if ($total_chars > 0 && $latin_chars > ($total_chars * 0.6)) { $result['english_title'] = sanitize_text_field($text); break; } } } } Elastic Slider – BIG – الصفحة 60 – ياهلا

Recent Posts

ساس تطلق أداة قياس أداء الذكاء الاصطناعي التوليدي لتمكين المؤسسات من تحقيق أقصى استفادة من هذه التقنية

  [كاري – نورث كارولينا 17 أبريل 2025] – بهدف مساعدة المؤسسات على تحقيق أقصى استفادة من الذكاء الاصطناعي التوليدي بطريقة مسؤولة، أعلنت ساس، الشركة الرائدة في مجال البيانات والذكاء الاصطناعي، عن تطويرها أداة معايرة لمساعدة مديري الشركات على فهم طرق التعامل مع آليات تبني هذه التكنولوجيا بأعلى مستويات الأمن …

أكمل القراءة »

تحويل قطاع الطباعة: تبني الاستدامة من أجل الابتكار والنمو

يشهد قطاع الطباعة تحولاً جذرياً. ففي ظل تزايد الوعي البيئي لدى الشركات والمستهلكين، لم يعد بالإمكان التركيز على الإنتاجية والكفاءة فقط، بل أصبح التحدي الحقيقي يكمن في تقديم خدمات طباعة عالية الجودة مع تقليل الأثر البيئي إلى أدنى حد ممكن، وبطريقة عملية. وتشير الأبحاث إلى توجه المستهلكين المتزايد حالياً نحو …

أكمل القراءة »

هواوي تستعرض حلولها للأمن السيبراني المدعومة بالذكاء الاصطناعي في “جيسيك جلوبال 2025”

تستعد هواوي، الشركة الرائدة عالمياً في مجال تقنية المعلومات والاتصالات، لعرض مجموعتها الشاملة من حلول الأمن السيبراني المدعومة بالذكاء الاصطناعي في معرض ومؤتمر “جيسيك جلوبال 2025″؛ الحدث الأبرز في مجال الأمن السيبراني في منطقة الشرق الأوسط وأفريقيا، بصفتها الشريك الاستراتيجي الرئيسي للحدث. وينعقد “جيسيك جلوبال 2025” في مركز دبي التجاري …

أكمل القراءة »