'statwrite-settings' ), admin_url( 'admin.php' ) ); $site = is_array( $overview['site'] ?? null ) ? $overview['site'] : array(); $speed = is_array( $overview['speed'] ?? null ) ? $overview['speed'] : array(); $security = is_array( $overview['security'] ?? null ) ? $overview['security'] : null; $monitoring = is_array( $overview['monitoring'] ?? null ) ? $overview['monitoring'] : null; $mobile = isset( $speed['mobile'] ) && is_array( $speed['mobile'] ) ? $speed['mobile'] : null; $desktop = isset( $speed['desktop'] ) && is_array( $speed['desktop'] ) ? $speed['desktop'] : null; $score_class = static function ( $score ) { if ( ! is_numeric( $score ) ) { return 'is-na'; } $score = (int) $score; if ( $score >= 90 ) { return 'is-good'; } if ( $score >= 50 ) { return 'is-mid'; } return 'is-bad'; }; $fmt_score = static function ( $score ) { return is_numeric( $score ) ? number_format_i18n( (int) $score ) : '—'; }; $fmt_seconds = static function ( $ms ) { if ( ! is_numeric( $ms ) || (float) $ms <= 0 ) { return '—'; } return number_format_i18n( (float) $ms / 1000, 2 ) . ' ' . __( 'sec', 'statwrite' ); }; $fmt_ms = static function ( $ms ) { if ( ! is_numeric( $ms ) || (float) $ms <= 0 ) { return '—'; } return number_format_i18n( (float) $ms, 0 ) . ' ms'; }; $fmt_cls = static function ( $cls ) { return is_numeric( $cls ) ? number_format_i18n( (float) $cls, 2 ) : '—'; }; $fmt_date = static function ( $iso ) { $ts = is_string( $iso ) && '' !== $iso ? strtotime( $iso ) : 0; return $ts ? wp_date( 'Y/m/d H:i', $ts ) : '—'; }; $security_score = $security ? ( $security['security_score'] ?? ( $security['score'] ?? null ) ) : null; $security_grade = $security && ! empty( $security['grade'] ) ? (string) $security['grade'] : ''; $count_defs = array( 'critical' => array( 'label' => __( 'Critical', 'statwrite' ), 'class' => 'is-critical' ), 'high' => array( 'label' => __( 'High', 'statwrite' ), 'class' => 'is-high' ), 'medium' => array( 'label' => __( 'Medium', 'statwrite' ), 'class' => 'is-medium' ), 'low' => array( 'label' => __( 'Low', 'statwrite' ), 'class' => 'is-low' ), ); $has_counts = false; if ( $security ) { foreach ( $count_defs as $key => $def ) { if ( isset( $security[ $key ] ) && is_numeric( $security[ $key ] ) ) { $has_counts = true; break; } } } $component_defs = array( 'headers_score' => __( 'Headers', 'statwrite' ), 'ssl_score' => __( 'SSL', 'statwrite' ), 'vulnerabilities_score' => __( 'Vulnerabilities', 'statwrite' ), ); $has_components = false; if ( $security ) { foreach ( $component_defs as $key => $label ) { if ( isset( $security[ $key ] ) && is_numeric( $security[ $key ] ) ) { $has_components = true; break; } } } $monitor_status = $monitoring && ! empty( $monitoring['status'] ) ? (string) $monitoring['status'] : 'unknown'; $monitor_class = 'up' === $monitor_status ? 'is-up' : ( 'down' === $monitor_status ? 'is-down' : 'is-unknown' ); $monitor_label = 'up' === $monitor_status ? __( 'Online', 'statwrite' ) : ( 'down' === $monitor_status ? __( 'Offline', 'statwrite' ) : __( 'Unknown', 'statwrite' ) ); $security_link = $security && ! empty( $security['url'] ) ? $security['url'] : $console_url; $monitor_link = $monitoring && ! empty( $monitoring['url'] ) ? $monitoring['url'] : $console_url; ?>

__( 'Mobile', 'statwrite' ), 'desktop' => __( 'Desktop', 'statwrite' ), ) as $key => $label ) : $strategy_data = 'mobile' === $key ? $mobile : $desktop; ?>
LCP CLS TBT

$def ) : ?>
$label ) : ?>

TTFB SSL SSL