$checks Checks. * @return string */ public static function checks( array $checks ): string { $out = ''; } /** * Wrap content in the page shell. * * @param string $payload_json JSON payload for the client script. * @param string $body Body HTML. * @return string */ public static function page( string $payload_json, string $body ): string { $layout = self::layout(); $output = str_replace( '__CONFIG_JSON__', htmlspecialchars( $payload_json, ENT_QUOTES, 'UTF-8' ), $layout ); return str_replace( '', $body, $output ); } /** * Base HTML layout template. * * @return string */ private static function layout(): string { $template_file = __DIR__ . '/installer-layout.html'; if ( is_readable( $template_file ) ) { $raw = (string) file_get_contents( $template_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions $css_file = dirname( __DIR__, 2 ) . '/assets/css/installer.css'; $js_file = dirname( __DIR__, 2 ) . '/assets/js/installer.js'; $css = is_readable( $css_file ) ? (string) file_get_contents( $css_file ) : ''; // phpcs:ignore WordPress.WP.AlternativeFunctions $js = is_readable( $js_file ) ? (string) file_get_contents( $js_file ) : ''; // phpcs:ignore WordPress.WP.AlternativeFunctions $raw = str_replace( '/* __INSTALLER_CSS__ */', $css, $raw ); return str_replace( '/* __INSTALLER_JS__ */', $js, $raw ); } return '/* __BACKUPINO_COMPILED_LAYOUT__ */'; } }