Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFormProcessor::get_posted_text_value │ private │ WC 1.0

Get a sanitized text value from the current POST request.

Метод класса: OrderWithdrawalFormProcessor{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_posted_text_value( $field_name ): string;
$field_name(строка) (обязательный)
Field name.

Код OrderWithdrawalFormProcessor::get_posted_text_value() WC 11.2.2

private function get_posted_text_value( string $field_name ): string {
	// phpcs:disable WordPress.Security.NonceVerification.Missing -- Nonce verification happens before submitted data is used.
	if ( ! isset( $_POST[ $field_name ] ) || ! is_scalar( $_POST[ $field_name ] ) ) {
		return '';
	}

	return sanitize_text_field( wp_unslash( (string) $_POST[ $field_name ] ) );
	// phpcs:enable WordPress.Security.NonceVerification.Missing
}