403 ) ); } auth_redirect(); } public function handle(): void { nocache_headers(); header( "Content-Security-Policy: default-src 'none'; style-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'" ); header( 'Referrer-Policy: no-referrer' ); header( 'X-Content-Type-Options: nosniff' ); header( 'X-Frame-Options: DENY' ); if ( ! is_ssl() || ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'An HTTPS administrator session is required.', 'aculect-ai-companion' ), '', array( 'response' => 403 ) ); } $method = $_SERVER['REQUEST_METHOD'] ?? ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- GET only identifies a user-bound request; POST nonce is checked before input use below. $input = 'POST' === $method ? $_POST : $_GET; $id = is_string( $input['request_id'] ?? null ) ? wp_unslash( $input['request_id'] ) : ''; $requests = new PrivateSettingRequests(); $record = $requests->lookup( $id ); if ( array() === $record || ! in_array( $method, array( 'GET', 'POST' ), true ) ) { wp_die( esc_html__( 'This request expired or belongs to another account. Request a fresh form.', 'aculect-ai-companion' ), '', array( 'response' => 403 ) ); } if ( 'POST' === $method ) { $nonce = is_string( $input['_wpnonce'] ?? null ) ? wp_unslash( $input['_wpnonce'] ) : ''; if ( ! wp_verify_nonce( $nonce, 'aculect_private_setting_' . $id ) ) { wp_die( esc_html__( 'The form could not be verified. Request a fresh form.', 'aculect-ai-companion' ), '', array( 'response' => 403 ) ); } $value = is_string( $input['private_value'] ?? null ) ? wp_unslash( $input['private_value'] ) : null; $result = $requests->submit( $id, $value ); unset( $value, $input, $_POST['private_value'], $_REQUEST['private_value'] ); ( new PrivateSettingAudit() )->record( $record['target'], (string) ( $result['status'] ?? 'error' ) ); wp_safe_redirect( add_query_arg( array( 'action' => 'aculect_private_setting', 'request_id' => $id, ), admin_url( 'admin-post.php', 'https' ) ), 303 ); exit; } $this->render( $record ); exit; } /** * Render only fixed labels and sanitized operation status. Inputs are always blank. * * @param array $record Request metadata. */ private function render( array $record ): void { $target = ( new PrivateSettingTargets() )->get( $record['target'] ); if ( null === $target ) { return; } $numeric = in_array( $record['target'], array( 'posts_per_page', 'default_category' ), true ); $short_text = in_array( $record['target'], array( 'site_title', 'tagline' ), true ); header( 'Content-Type: text/html; charset=UTF-8' ); wp_enqueue_style( 'aculect-private-settings', plugins_url( 'assets/css/private-settings.css', ACULECT_AI_COMPANION_PLUGIN_FILE ), array(), '0.8.0' ); ?> ><?php esc_html_e( 'Aculect private settings', 'aculect-ai-companion' ); ?>

—

inputmode="numeric" min="1" step="1" max="">