WP_HTML_Processor::create_full_parser
Creates an HTML processor in the full parsing mode.
It's likely that a fragment parser is more appropriate, unless sending an entire HTML document from start to finish. Consider a fragment parser with a context node of <body>.
UTF-8 is the only allowed encoding. If working with a document that isn't UTF-8, first convert the document to UTF-8, then pass in the converted HTML.
Метод класса: WP_HTML_Processor{}
Хуков нет.
Возвращает
static|null. The created processor if successful, otherwise null.
Использование
$result = WP_HTML_Processor::create_full_parser( $html, $known_definite_encoding );
- $html(строка) (обязательный)
- Input HTML document to process.
- $known_definite_encoding(строка|null)
- If provided, specifies the charset used in the input byte stream. Currently must be UTF-8.
По умолчанию:'UTF-8'
Код WP_HTML_Processor::create_full_parser() WP HTML Processor::create full parser WP 7.0.2
public static function create_full_parser( $html, $known_definite_encoding = 'UTF-8' ) {
if ( 'UTF-8' !== $known_definite_encoding ) {
return null;
}
if ( ! is_string( $html ) ) {
_doing_it_wrong(
__METHOD__,
__( 'The HTML parameter must be a string.' ),
'6.9.0'
);
return null;
}
$processor = new static( $html, self::CONSTRUCTOR_UNLOCK_CODE );
$processor->state->encoding = $known_definite_encoding;
$processor->state->encoding_confidence = 'certain';
return $processor;
}