1, 'phpVersion' => PHP_VERSION, 'wordpressVersion' => $wp_version, 'osFamily' => PHP_OS_FAMILY, 'uploadProgressEnabled' => $upload, 'curlBrotliSupported' => $brotli, 'brotliVersion' => is_array( $curl ) ? ( $curl['brotli_version'] ?? '' ) : '' ); } function dashe_seo_host_security( $report = null, $now = null ) { $report = null === $report ? dashe_seo_host_report() : $report; $now = null === $now ? time() : $now; $policy = json_decode( file_get_contents( __DIR__ . '/host-security-policy.json' ), true ); $code = 'unverified'; if ( is_array( $report ) && isset( $report['schema'] ) && 1 === $report['schema'] ) { $version = $report['phpVersion'] ?? ''; $match = array(); if ( ! is_string( $version ) || strlen( $version ) > 80 || ! preg_match( '/^(\d+)\.(\d+)\.(\d+)(?:[-+][A-Za-z0-9.+~-]+)?$/D', $version, $match ) || preg_match( '/dev|alpha|beta|rc/i', $version ) ) { $code = 'unverified'; } else { $branch = $policy['branches'][$match[1] . '.' . $match[2]] ?? null; if ( ! $branch || (int) $match[3] < $branch['minimum'] || $now >= strtotime( $branch['expires'] . ' UTC' ) ) { $code = 'php_update'; } elseif ( ! isset( $report['uploadProgressEnabled'] ) || ! is_bool( $report['uploadProgressEnabled'] ) || ! in_array( $report['osFamily'] ?? '', array( 'Linux', 'Windows', 'Darwin', 'BSD', 'Solaris', 'Unknown' ), true ) ) { $code = 'unverified'; } elseif ( $report['uploadProgressEnabled'] ) { $code = 'session_update'; } elseif ( 'Windows' === $report['osFamily'] && false !== ( $report['curlBrotliSupported'] ?? null ) ) { $b = $report['brotliVersion'] ?? ''; $code = true === ( $report['curlBrotliSupported'] ?? null ) && is_string( $b ) && preg_match( '/^\d+\.\d+\.\d+$/D', $b ) && version_compare( $b, '1.2.1', '>=' ) ? 'passed' : 'brotli_update'; } else { $code = 'passed'; } } } return array( 'status' => 'passed' === $code ? 'passed' : ( 'unverified' === $code ? 'unverified' : 'blocked' ), 'code' => $code, 'message' => $policy['messages'][$code], 'policy' => $policy['id'], 'advisory' => $policy['advisory'] ); }