add_seo_disclaimer_notice(); $instance->add_auth_admin_notices(); $instance->add_batch_request_admin_notices(); $instance->maybe_add_import_admin_notice(); $instance->maybe_show_debug_notice( $instance ); self::maybe_show_php_version_notice(); } /** * Show a notice if the PHP version is below the required minimum. * * @return void */ private static function maybe_show_php_version_notice() { if ( version_compare( PHP_VERSION, '8.1', '<' ) ) { $message = sprintf( /* translators: %s: current PHP version. */ __( 'AI Content by Parallax requires PHP 8.1 or higher. Your current PHP version is %s. Please upgrade your PHP version to use the plugin.', 'ai-content-by-parallax' ), esc_html( PHP_VERSION ) ); printf( '
%s
Debug mode is enabled: Detailed logs will be recorded here View Log File
'; $instance->maybe_get_middleware_override_notice(); $instance->maybe_get_refresh_data_button(); $instance->get_client_info(); echo '' . esc_html__( 'Client Information:', 'ai-content-by-parallax' ) . '
'; $name_line = $client->get_name() !== '' ? sprintf( '%s %s
', esc_html__( 'Client:', 'ai-content-by-parallax' ), esc_html( $client->get_name() ) ) : ''; $desc_line = $client->get_description() !== '' ? sprintf( '%s %s
', esc_html__( 'Description:', 'ai-content-by-parallax' ), esc_html( $client->get_description() ) ) : ''; $api_key_line = $client->get_api_key() !== '' ? sprintf( '%s %s
', esc_html__( 'API Key:', 'ai-content-by-parallax' ), esc_html( $client->get_api_key() ) ) : ''; $client_id_line = $client->get_client_id() !== '' ? sprintf( '%s %s
', esc_html__( 'Client ID:', 'ai-content-by-parallax' ), esc_html( $client->get_client_id() ) ) : ''; printf( '%s%s%s%s', wp_kses_post( $name_line ), wp_kses_post( $desc_line ), wp_kses_post( $api_key_line ), wp_kses_post( $client_id_line ) ); echo '%s
', esc_html( sprintf( 'API Middleware URL override is active: %s', esc_html( $api_base ) ) ) ); } } /** * Determine if we should show notices on this screen */ private static function show_notices() { $screen = get_current_screen(); $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); if ( $screen && isset( $screen->id ) && strpos( $screen->id, 'ai-content-by-parallax' ) !== false && 'ai-content-by-parallax' === $page ) { return true; } return false; } /** * Determine if the current request is asking to refresh batch data. */ private static function is_refresh_request(): bool { $refresh = filter_input( INPUT_GET, 'ai_content_by_parallax_refresh', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); return '1' === $refresh; } /** * Generate the refresh URL with a nonce attached. */ private static function get_refresh_url(): string { $url = add_query_arg( 'ai_content_by_parallax_refresh', '1' ); return wp_nonce_url( $url, 'ai_content_by_parallax_refresh_action' ); } /** * Check whether the refresh request carries a valid nonce. */ private static function has_valid_refresh_nonce(): bool { $nonce = filter_input( INPUT_GET, '_wpnonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); return is_string( $nonce ) && wp_verify_nonce( $nonce, 'ai_content_by_parallax_refresh_action' ); } /** * Display import-related admin notice from WordPress options. */ private static function maybe_add_import_admin_notice(): void { $import_notice = get_option( 'ai_content_by_parallax_import_notice' ); if ( is_array( $import_notice ) && ! empty( $import_notice['message'] ) ) { $type = isset( $import_notice['type'] ) && in_array( $import_notice['type'], array( 'success', 'error', 'warning', 'info' ), true ) ? $import_notice['type'] : 'info'; printf( '%2$s
%s
', esc_html__( 'Insufficient Credits', 'ai-content-by-parallax' ), esc_html__( 'You do not have enough credits to use Parallax AI features.', 'ai-content-by-parallax' ) ); printf( ':
%s
', /* translators: %1$d: number of products, %2$d: number of terms. */ esc_html( sprintf( __( 'Restored originals: %1$d products and %2$d terms.', 'ai-content-by-parallax' ), $p, $t ) ) ); } // Success notice after retake snapshots. if ( isset( $_GET['ai_content_by_parallax_retake'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'parallax_retake_notice' ) ) { $p = isset( $_GET['rp'] ) ? (int) $_GET['rp'] : 0; $t = isset( $_GET['rt'] ) ? (int) $_GET['rt'] : 0; printf( '%s
%1$s: %2$s
%2$s: %3$s