WP_HTML_Tag_Processor::get_doctype_info()publicWP 1.0

Gets DOCTYPE declaration info from a DOCTYPE token.

DOCTYPE tokens may appear in many places in an HTML document. In most places, they are simply ignored. The main parsing functions find the basic shape of DOCTYPE tokens but do not perform detailed parsing.

This method can be called to perform a full parse of the DOCTYPE token and retrieve its information.

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

Хуков нет.

Возвращает

WP_HTML_Doctype_Info|null. The DOCTYPE declaration information or null if not currently at a DOCTYPE node.

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

$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor();
$WP_HTML_Tag_Processor->get_doctype_info(): ?WP_HTML_Doctype_Info;

Код WP_HTML_Tag_Processor::get_doctype_info() WP 6.7.1

public function get_doctype_info(): ?WP_HTML_Doctype_Info {
	if ( self::STATE_DOCTYPE !== $this->parser_state ) {
		return null;
	}

	return WP_HTML_Doctype_Info::from_doctype_token( substr( $this->html, $this->token_starts_at, $this->token_length ) );
}