From f8b812dd08f7e992daf7803f3c0efc1d034cc610 Mon Sep 17 00:00:00 2001 From: Benjamin Mack <benni@typo3.org> Date: Mon, 20 Jan 2014 20:20:49 +0100 Subject: [PATCH] [TASK] Move Tidy functionality to a TER ext As discussed in the Core newsgroup, the Tidy functionality should be removed from the TYPO3 CMS Core. The checks and options are removed, and a NEWS note is added. An already released replacement was added to the TER. As the importance is very low, and the drop-in replacement in the TER fits nicely, IMHO there is no need for an upgrade wizard, as nothing breaks if the functionality is missing. Every upgrader should read the NEWS anyway in order to know what to do to have the functionality back. Releases: 6.2 Resolves: #55190 Change-Id: I3101b7e09f36cbaa63b6b5d8930f61242e4e2cc6 Reviewed-on: https://review.typo3.org/26952 Reviewed-by: Wouter Wolters Reviewed-by: Markus Klein Tested-by: Markus Klein Reviewed-by: Georg Ringer Tested-by: Georg Ringer --- NEWS.md | 8 +++++++ .../Configuration/DefaultConfiguration.php | 3 --- .../TypoScriptFrontendController.php | 24 ++++--------------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/NEWS.md b/NEWS.md index f7e4ed70cd8a..3c08ee25cfc8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -116,6 +116,14 @@ After: getTreeList(42, 4) result: '0, 22, 11, 4' +* Removal of HTML Tidy and its options + +The possibility to use the external tool HTML Tidy that is used to clean up +incomplete HTML when a frontend page is rendered was removed from the TYPO3 +Core. Its functionality is now provided by the TER extension "Tidy". +The extension works with the same options as before. + + ### Administration / Customization * Content-length header (TypoScript setting config.enableContentLengthHeader) diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 162bd729014d..0a99d5b79e34 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -656,9 +656,6 @@ return array( ), 'FE' => array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend! 'png_to_gif' => FALSE, // Boolean: Enables conversion back to gif of all png-files generated in the frontend libraries. Notice that this leaves an increased number of temporary files in typo3temp/ - 'tidy' => FALSE, // Boolean: If set, the output html-code will be passed through "tidy" which is a little program you can get from <a href="http://www.w3.org/People/Raggett/tidy/" target="_blank">w3c.org</a>. "Tidy" cleans the HTML-code for nice display! - 'tidy_option' => 'cached', // options [all, cached, output]. "all" = the content is always passed through "tidy" before it may be stored in cache. "cached" = only if the page is put into the cache, "output" = only the output code just before it's echoed out. - 'tidy_path' => 'tidy -i --quiet true --tidy-mark true -wrap 0 -raw', // Path with options for tidy. For XHTML output, add " --output-xhtml true" 'addAllowedPaths' => '', // Additional relative paths (comma-list) to allow TypoScript resources be in. Should be prepended with '/'. If not, then any path where the first part is like this path will match. That is: 'myfolder/ , myarchive' will match eg. 'myfolder/', 'myarchive/', 'myarchive_one/', 'myarchive_2/' ... No check is done to see if this directory actually exists in the root of the site. Paths are matched by simply checking if these strings equals the first part of any TypoScript resource filepath. (See class template, function init() in \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser) 'allowedTempPaths' => '', // Additional paths allowed for temporary images. Used with imgResource. Eg. 'alttypo3temp/,another_temp_dir/'; 'debug' => FALSE, // Boolean: If set, some debug HTML-comments may be output somewhere. Can also be set by TypoScript. diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 15d0f177e6aa..87d24b4a2228 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -3309,7 +3309,7 @@ class TypoScriptFrontendController { /** * Does some processing AFTER the pagegen script is included. - * This includes calling tidy (if configured), XHTML cleaning (if configured), caching the page, indexing the page (if configured) and setting sysLastChanged + * This includes calling XHTML cleaning (if configured), caching the page, indexing the page (if configured) and setting sysLastChanged * * @return void * @todo Define visibility @@ -3319,12 +3319,6 @@ class TypoScriptFrontendController { if ($this->no_cacheBeforePageGen) { $this->set_no_cache('no_cache has been set before the page was generated - safety check', TRUE); } - // Tidy up the code, if flag... - if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'all') { - $GLOBALS['TT']->push('Tidy, all', ''); - $this->content = $this->tidyHTML($this->content); - $GLOBALS['TT']->pull(); - } // XHTML-clean the code, if flag set if ($this->doXHTML_cleaning() == 'all') { $GLOBALS['TT']->push('XHTML clean, all', ''); @@ -3347,12 +3341,6 @@ class TypoScriptFrontendController { } // Processing if caching is enabled: if (!$this->no_cache) { - // Tidy up the code, if flag... - if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'cached') { - $GLOBALS['TT']->push('Tidy, cached', ''); - $this->content = $this->tidyHTML($this->content); - $GLOBALS['TT']->pull(); - } // XHTML-clean the code, if flag set if ($this->doXHTML_cleaning() == 'cached') { $GLOBALS['TT']->push('XHTML clean, cached', ''); @@ -3627,7 +3615,7 @@ if (version == "n3") { /** * Process the output before it's actually outputted. Sends headers also. - * This includes substituting the "username" comment, sending additional headers (as defined in the TypoScript "config.additionalheaders" object), tidy'ing content, XHTML cleaning content (if configured) + * This includes substituting the "username" comment, sending additional headers (as defined in the TypoScript "config.additionalheaders" object), XHTML cleaning content (if configured) * Works on $this->content. * * @return void @@ -3659,12 +3647,6 @@ if (version == "n3") { if (!$this->isClientCachable) { $this->contentStrReplace(); } - // Tidy up the code, if flag... - if ($this->TYPO3_CONF_VARS['FE']['tidy_option'] == 'output') { - $GLOBALS['TT']->push('Tidy, output', ''); - $this->content = $this->tidyHTML($this->content); - $GLOBALS['TT']->pull(); - } // XHTML-clean the code, if flag set if ($this->doXHTML_cleaning() == 'output') { $GLOBALS['TT']->push('XHTML clean, output', ''); @@ -4215,9 +4197,11 @@ if (version == "n3") { * * @param string $content The page content to clean up. Will be written to a temporary file which "tidy" is then asked to clean up. File content is read back and returned. * @return string Returns the + * @deprecated tidy and its options were deprecated with TYPO3 CMS 6.2, this function will be removed two versions later. If you need tidy, use the extension "tidy" from TER. * @todo Define visibility */ public function tidyHTML($content) { + GeneralUtility::logDeprecatedFunction(); if ($this->TYPO3_CONF_VARS['FE']['tidy'] && $this->TYPO3_CONF_VARS['FE']['tidy_path']) { $oldContent = $content; // Create temporary name -- GitLab