From dd7f80ee5aecba6be54561cacb4d9e0d68c86e55 Mon Sep 17 00:00:00 2001 From: HugoPoi Date: Wed, 19 Oct 2022 21:50:10 +0200 Subject: [PATCH] feat: remove HTML blocks --- www/index.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/www/index.php b/www/index.php index 9ab9293..856cbf5 100644 --- a/www/index.php +++ b/www/index.php @@ -30,7 +30,7 @@ * @link https://archivarix.com */ -@ini_set( 'display_errors', 0 ); +@ini_set( 'display_errors', 1 ); /** * Switch mode to integrate with 3rd party CMS. @@ -393,6 +393,17 @@ function prepareContent( $file, $sourcePath ) $content = preg_replace( '~' . $includeCustom['KEYPHRASE'] . '~is', $includedContent, $content, $includeCustom['LIMIT'] ); } } + + $doc = new DOMDocument(); + $doc->loadHTML($content); + $xpath = new DOMXpath($doc); + $hostedByElements = $xpath->query("//*[@id='text-6']"); + $hostedByElements->item(0)?->remove(); + $twitterWidgetElements = $xpath->query("//*[@id='twitter-2']"); + $twitterWidgetElements->item(0)?->remove(); + //$content = ''; + $content = $doc->saveHTML(); + if ( function_exists( 'mb_strlen' ) ) { header( 'Content-Length: ' . mb_strlen( $content, '8bit' ), true ); }