Current path: home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app/Handlers/
?? Go up: /home/webdevt/www/cryptoimpot.fr/wp-content/plugins/divi-contact-form-helper/app
<?php
namespace KS_PAC_DCFH\Handlers;
use DOMDocument;
if (!defined('ABSPATH')) {
exit;
}
class DOM_Handler
{
private static $_instance;
public static function instance(): self
{
if (self::$_instance === null) {
self::$_instance = new self();
}
return self::$_instance;
}
public static function dom($html): DOMDocument
{
$charset = 'utf-8';
$dom = new DOMDocument('1.0', $charset);
libxml_use_internal_errors(true);
$html = mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, 0x1FFFFF], $charset);
$dom->loadHTML($html, LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
libxml_clear_errors();
return $dom;
}
}
/* // https://stackoverflow.com/questions/4879946/how-to-savehtml-of-domdocument-without-html-wrapper
$charset = 'utf-8';
$dom = new DOMDocument('1.0', $charset);
$dom->loadHTML('<?xml version="1.0" encoding="'.$charset.'"?>'."\n".$html, LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
return $dom;*/