WP_HTML_Processor::bail()privateWP 6.7.0

Stops the parser and terminates its execution when encountering unsupported markup.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->bail( $message );
$message(строка) (обязательный)
Explains support is missing in order to parse the current node.

Список изменений

С версии 6.7.0 Введена.

Код WP_HTML_Processor::bail() WP 6.8.1

private function bail( string $message ) {
	$here  = $this->bookmarks[ $this->state->current_token->bookmark_name ];
	$token = substr( $this->html, $here->start, $here->length );

	$open_elements = array();
	foreach ( $this->state->stack_of_open_elements->stack as $item ) {
		$open_elements[] = $item->node_name;
	}

	$active_formats = array();
	foreach ( $this->state->active_formatting_elements->walk_down() as $item ) {
		$active_formats[] = $item->node_name;
	}

	$this->last_error = self::ERROR_UNSUPPORTED;

	$this->unsupported_exception = new WP_HTML_Unsupported_Exception(
		$message,
		$this->state->current_token->node_name,
		$here->start,
		$token,
		$open_elements,
		$active_formats
	);

	throw $this->unsupported_exception;
}