WP_oEmbed::_parse_xml()privateWP 3.0.0

Parses an XML response body.

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

Хуков нет.

Возвращает

Объект|false.

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

// private - только в коде основоного (родительского) класса
$result = $this->_parse_xml( $response_body );
$response_body(строка) (обязательный)
-

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

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

Код WP_oEmbed::_parse_xml() WP 6.5.2

private function _parse_xml( $response_body ) {
	if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
		return false;
	}

	if ( PHP_VERSION_ID < 80000 ) {
		/*
		 * This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading
		 * is disabled by default, so this function is no longer needed to protect against XXE attacks.
		 */
		$loader = libxml_disable_entity_loader( true );
	}

	$errors = libxml_use_internal_errors( true );

	$return = $this->_parse_xml_body( $response_body );

	libxml_use_internal_errors( $errors );

	if ( PHP_VERSION_ID < 80000 && isset( $loader ) ) {
		// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.libxml_disable_entity_loaderDeprecated
		libxml_disable_entity_loader( $loader );
	}

	return $return;
}