شاهد أيضاً
بابتكار سعودي وروح تراثية “حرف السعودية” تحصد المركز الثالث عالميًا في مسابقة تحدي هدايا الطعام 2025 في إيطاليا
ضمن مشاركتها للسنة الثانية على التوالي حققت “حرف السعودية” إنجازًا عالميًا جديدًا بفوزها بالمركز الثالث …
// If no description found in styled div, try alternative approaches if (empty($result['full_description'])) { // Look for paragraphs with substantial Arabic content anywhere on the page $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; } } } }