diff --git a/app/Entities/Tools/PageContent.php b/app/Entities/Tools/PageContent.php index 2613359c3..b4bc8b91b 100644 --- a/app/Entities/Tools/PageContent.php +++ b/app/Entities/Tools/PageContent.php @@ -449,8 +449,8 @@ class PageContent { libxml_use_internal_errors(true); $doc = new DOMDocument(); - $html = '' . $html . ''; - $doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); + $html = '' . $html . ''; + $doc->loadHTML($html); return $doc; } diff --git a/app/References/CrossLinkParser.php b/app/References/CrossLinkParser.php index 37db203df..e7afea5f1 100644 --- a/app/References/CrossLinkParser.php +++ b/app/References/CrossLinkParser.php @@ -54,10 +54,10 @@ class CrossLinkParser { $links = []; - $html = '' . $html . ''; + $html = '' . $html . ''; libxml_use_internal_errors(true); $doc = new DOMDocument(); - $doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); + $doc->loadHTML($html); $xPath = new DOMXPath($doc); $anchors = $xPath->query('//a[@href]'); diff --git a/app/Search/SearchIndex.php b/app/Search/SearchIndex.php index 54ed95ebb..25389226a 100644 --- a/app/Search/SearchIndex.php +++ b/app/Search/SearchIndex.php @@ -15,25 +15,18 @@ class SearchIndex { /** * A list of delimiter characters used to break-up parsed content into terms for indexing. - * - * @var string */ - public static $delimiters = " \n\t.,!?:;()[]{}<>`'\""; + public static string $delimiters = " \n\t.,!?:;()[]{}<>`'\""; - /** - * @var EntityProvider - */ - protected $entityProvider; - - public function __construct(EntityProvider $entityProvider) - { - $this->entityProvider = $entityProvider; + public function __construct( + protected EntityProvider $entityProvider + ) { } /** * Index the given entity. */ - public function indexEntity(Entity $entity) + public function indexEntity(Entity $entity): void { $this->deleteEntityTerms($entity); $terms = $this->entityToTermDataArray($entity); @@ -45,7 +38,7 @@ class SearchIndex * * @param Entity[] $entities */ - public function indexEntities(array $entities) + public function indexEntities(array $entities): void { $terms = []; foreach ($entities as $entity) { @@ -69,7 +62,7 @@ class SearchIndex * * @param callable(Entity, int, int):void|null $progressCallback */ - public function indexAllEntities(?callable $progressCallback = null) + public function indexAllEntities(?callable $progressCallback = null): void { SearchTerm::query()->truncate(); @@ -101,7 +94,7 @@ class SearchIndex /** * Delete related Entity search terms. */ - public function deleteEntityTerms(Entity $entity) + public function deleteEntityTerms(Entity $entity): void { $entity->searchTerms()->delete(); } @@ -145,12 +138,12 @@ class SearchIndex 'h6' => 1.5, ]; - $html = '' . $html . ''; + $html = '' . $html . ''; $html = str_ireplace(['
', '
', '
'], "\n", $html); libxml_use_internal_errors(true); $doc = new DOMDocument(); - $doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); + $doc->loadHTML($html); $topElems = $doc->documentElement->childNodes->item(0)->childNodes; /** @var DOMNode $child */ diff --git a/app/Util/HtmlContentFilter.php b/app/Util/HtmlContentFilter.php index 5e3c4822c..e51f512bd 100644 --- a/app/Util/HtmlContentFilter.php +++ b/app/Util/HtmlContentFilter.php @@ -19,10 +19,10 @@ class HtmlContentFilter return $html; } - $html = '' . $html . ''; + $html = '' . $html . ''; libxml_use_internal_errors(true); $doc = new DOMDocument(); - $doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); + $doc->loadHTML($html); $xPath = new DOMXPath($doc); // Remove standard script tags