From 3cafc180b2997a4081bcfe8469eaa7efddbaa5b5 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 5 May 2024 16:31:15 +0900 Subject: [PATCH] Merge HTMLDisplayHandler::_moveLinkToHeader() and _moveMetaToHeader(), and add special treatment for non-stylesheet elements --- classes/display/HTMLDisplayHandler.php | 37 +++++++++++--------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 9c4013086..ad1ab48c2 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -243,14 +243,11 @@ class HTMLDisplayHandler $start = microtime(true); - // move in body to the header + // move in body to the header $output = preg_replace_callback('!(.*?)<\/style>!is', array($this, '_moveStyleToHeader'), $output); - // move in body to the header - $output = preg_replace_callback('!!is', array($this, '_moveLinkToHeader'), $output); - - // move in body to the header - $output = preg_replace_callback('!!is', array($this, '_moveMetaToHeader'), $output); + // move and in body to the header + $output = preg_replace_callback('!<(link|meta)\b(.*?)>!is', array($this, '_moveLinkToHeader'), $output); // change a meta fine(widget often put the tag like to the content because of caching) $output = preg_replace_callback('//is', array($this, '_transMeta'), $output); @@ -396,8 +393,8 @@ class HTMLDisplayHandler } /** - * add html style code extracted from html body to Context, which will be - * printed inside
later. + * Move