'', 'entry_message' => __( 'This site is password protected. Please enter the access password below.', 'adminease' ), 'remember_device' => true, 'theme_class' => '', 'extra_css' => '', 'nocache_arg' => 'ae_nocache', 'hint_cookie_prefix' => 'wp-postpass_adminease_', ]; return wp_parse_args( $args, $defaults ); } /** * Retrieves the CSS file content for the theme. * Reads a CSS file from the predefined path and returns its content. * If the file cannot be read, an empty string is returned. * @return string The content of the CSS file, or an empty string if the file cannot be read. */ private static function get_theme_css(): string { $css_path = ADMINEASE_DIR . 'assets/css/AdminEasePasswordProtectSite.css'; $content = FileHandler::get_instance()->get_file_content( $css_path ); return ( false !== $content ) ? $content : ''; } /** * Retrieves the JavaScript content for the theme from a specified file. * This method reads the JavaScript file located at the predefined path and returns its contents. * If the file cannot be read, it returns an empty string. * @return string The content of the JavaScript file as a string, or an empty string if the file cannot be read. */ private static function get_theme_js(): string { $js_path = ADMINEASE_DIR . 'assets/js/AdminEasePasswordProtectSite.js'; $content = FileHandler::get_instance()->get_file_content( $js_path ); return ( false !== $content ) ? $content : ''; } /** * Generates an HTML string for a password-protected site interface based on input data. * * @param array $data An associative array containing data for rendering the HTML. Expected keys include: * 'page_title' (string) - The title for the HTML page. * 'primary_color' (string) - The primary color for the page styling. * 'secondary_color' (string) - The secondary color for the page styling. * 'text_color' (string) - The text color for the page styling. * 'logo_url' (string|null) - The URL of the logo to display (optional). * 'entry_message' (string) - The welcome message to display. * 'remember_device' (bool) - Whether to include the "Remember this device" option. * @param string $css A string containing custom CSS to be included in the page. * @param string $js A string containing custom JavaScript to be included in the page. * * @return string The generated HTML content as a string. */ private static function generate_html( array $data, string $css, string $js ): string { ob_start(); ?> > <?php echo esc_html( $data['page_title'] ); ?>