get_running_run('audit'); $latest_completed = $repo->get_latest_completed_run('audit'); $latest_any = $repo->get_latest_run('audit'); $trend = $repo->get_recent_runs('audit', 10); $settings = Settings::get(); $limits = isset($settings['scan_limits']) && is_array($settings['scan_limits']) ? $settings['scan_limits'] : []; // 4.0.17: show the limit the crawler actually applies. The dashboard // used to print the hidden legacy `full_scan_max_pages` value. $scan_mode = (string) ($settings['scan_mode'] ?? 'full'); $crawl_max_urls = (int) ($limits['crawl_max_urls'] ?? 0); $full_scan_max_pages = $crawl_max_urls > 0 ? $crawl_max_urls : (int) ($limits['full_scan_max_pages'] ?? 0); $audit_analysis_max_pages = (int) ($limits['audit_analysis_max_pages'] ?? 0); echo wp_kses(Brand::wrap_open(), Brand::admin_kses()); echo wp_kses(Brand::header(I18n::tr('Dashboard', 'لوحة التحكم')), Brand::admin_kses()); $runtime_version = defined('AETOS_SEO_VERSION') ? (string) AETOS_SEO_VERSION : 'unknown'; $runtime_slug = defined('AETOS_SEO_SLUG') ? (string) AETOS_SEO_SLUG : 'unknown'; if ($runtime_slug !== 'unknown' && $runtime_slug !== 'aetos-seo') { echo '
'; echo esc_html(I18n::tr( 'The plugin is running from a non-standard folder name. Keep only wp-content/plugins/aetos-seo active to avoid running old code.', 'تعمل الإضافة من مجلد باسم غير معتاد. أبقِ wp-content/plugins/aetos-seo وحده مفعلًا حتى لا يعمل كود قديم.' )); echo '
' . esc_html(I18n::tr('The audit is complete. Your results are below.', 'اكتمل الفحص، والنتائج بالأسفل.')) . '
' . esc_html(I18n::tr('The audit has started and runs in the background. You can keep working; this page updates by itself.', 'بدأ الفحص ويعمل في الخلفية. يمكنك متابعة عملك، وستتحدث هذه الصفحة تلقائيًا.')) . '
' . esc_html(I18n::tr('An audit is already running.', 'يوجد فحص يعمل حاليًا.')) . '
' . esc_html(I18n::tr('The audit could not start or finish. Try again from this page. If it fails again, contact support from the Help menu.', 'تعذر بدء الفحص أو إكماله. حاول مرة أخرى من هذه الصفحة، وإذا تكرر ذلك فتواصل مع الدعم من قائمة المساعدة.')) . '
' . esc_html(I18n::tr('Stale crawl data detected', 'تم رصد بيانات زحف قديمة')) . ': ' . esc_html($stale_warning) . ' ' . esc_html(I18n::tr('Run a fresh crawl', 'شغّل زحفاً جديداً')) . '.
' . esc_html(I18n::tr('Your first audit is running. Results appear here automatically when it finishes.', 'أول فحص يعمل الآن، وستظهر النتائج هنا تلقائيًا عند انتهائه.')) . '
'; } echo ''; return; } if (!$latest_completed && $pending) { echo ''; return; } $latest = $latest_completed ?: $latest_any; if (!$latest_completed && !$pending && $notice !== 'audit_failed') { echo '' . esc_html(I18n::tr('The latest audit did not finish. Run a new audit from this page.', 'آخر فحص لم يكتمل. شغّل فحصًا جديدًا من هذه الصفحة.')) . '
' . esc_html(self::sentence_case($line)) . '
'; } elseif (!empty($open_improve)) { echo '' . esc_html(sprintf(I18n::tr('Nothing urgent. %s.', 'لا توجد مشكلات عاجلة، وهناك %s.'), self::improve_phrase(count($open_improve)))) . '
'; } else { echo '' . esc_html(I18n::tr('No open issues in the latest audit.', 'لا توجد مشكلات مفتوحة في آخر فحص.')) . '
'; } $this->render_progress_line($trend, $latest_run_id, $overall, $latest); echo '' . esc_html(sprintf( I18n::tr('Analysed %1$s of %2$s found on this site.', 'حُللت %1$s من أصل %2$s عُثر عليها في الموقع.'), self::page_phrase((int) ($coverage['parsed_html'] ?? 0)), self::page_phrase((int) ($scope['discovered_urls'] ?? 0), true) )) . '
'; } $duration_s = round((int) ($latest['duration_ms'] ?? 0) / 1000, 1); echo '' . esc_html(sprintf(I18n::tr('The checks took %s seconds after the pages were collected.', 'استغرقت الفحوصات %s ثانية بعد جمع الصفحات.'), number_format_i18n($duration_s, 1))) . '
'; echo '' . esc_html(sprintf( I18n::tr('Current limits: up to %1$s pages collected, %2$s analysed in detail.', 'الحدود الحالية: جمع حتى %1$s صفحة، وتحليل %2$s بالتفصيل.'), $full_scan_max_pages > 0 ? number_format_i18n($full_scan_max_pages) : I18n::tr('all', 'كل الصفحات'), $audit_analysis_max_pages > 0 ? number_format_i18n($audit_analysis_max_pages) : I18n::tr('all', 'كلها') )) . ' ' . esc_html(I18n::tr('Change settings', 'تغيير الإعدادات')) . '
'; if (count($trend) >= 2) { echo '' . esc_html($has_pro_addon ? I18n::tr('One audit checks your pages for search, speed, security and AI readiness, including your Pro modules, and lists what to fix first.', 'فحص واحد يراجع صفحاتك في البحث والسرعة والأمان وجاهزية الذكاء الاصطناعي، مع وحدات Pro، ويرتب لك ما تصلحه أولًا.') : I18n::tr('One audit checks your pages for search, speed, security and AI readiness, and lists what to fix first.', 'فحص واحد يراجع صفحاتك في البحث والسرعة والأمان وجاهزية الذكاء الاصطناعي، ويرتب لك ما تصلحه أولًا.')) . '
'; echo '' . esc_html($label) . '
'; echo '' . esc_html($phase) . '
'; echo '' . esc_html($text) . '
'; } /** * @param array' . esc_html(I18n::tr('No trend data yet.', 'لا توجد بيانات اتجاه حتى الآن.')) . '
'; } $scores = []; foreach (array_reverse($runs) as $run) { $scores[] = (int) ($run['overall_score'] ?? 0); } if (count($scores) < 2) { $baseline = (int) ($scores[0] ?? 0); return '' . esc_html(sprintf(I18n::tr('First score saved: %d of 100. The history line appears after the next audit.', 'حُفظت أول نتيجة: %d من 100. يظهر خط السجل بعد الفحص التالي.'), $baseline)) . '
'; } $width = 420; $height = 80; $padding = 8; $count = count($scores); $dx = ($width - 2 * $padding) / max(1, ($count - 1)); $points = []; foreach ($scores as $index => $score) { $x = $padding + ($index * $dx); $y = $height - $padding - ($score / 100) * ($height - 2 * $padding); $points[] = sprintf('%.2f,%.2f', $x, $y); } $polyline = implode(' ', $points); $last = end($scores); $out = '