From 2f7a40839f0c1be0175f967eddef612571bd8d82 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Tue, 12 Jan 2016 22:20:21 +0100
Subject: [PATCH] [!!!][TASK] Remove RTE transformation ts_strip

The conversion to strip certain all HTML tags out
of the RTE parser (ts_strip) on the way from the RTE
to the database is removed.

The hardcoded static list is superseeded by the
HTMLparser logic and all TSconfig used since 4.5 anyway,
so this static logic is obsolete.

Resolves: #72661
Releases: master
Change-Id: I7db74c99101e39d37191601c5e77a5abc04e8e6e
Reviewed-on: https://review.typo3.org/45848
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../core/Classes/Html/RteHtmlParser.php       | 18 +----------
 ...72661-RTETransformationTs_stripRemoved.rst | 31 +++++++++++++++++++
 2 files changed, 32 insertions(+), 17 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-72661-RTETransformationTs_stripRemoved.rst

diff --git a/typo3/sysext/core/Classes/Html/RteHtmlParser.php b/typo3/sysext/core/Classes/Html/RteHtmlParser.php
index 6913726fde65..09190c8131a0 100644
--- a/typo3/sysext/core/Classes/Html/RteHtmlParser.php
+++ b/typo3/sysext/core/Classes/Html/RteHtmlParser.php
@@ -242,9 +242,6 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser
                             $value = preg_replace('/<p>&nbsp;<\/p>$/', '<p>&nbsp;</p>' . '<p>&nbsp;</p>', $value);
                             $value = $this->TS_transform_db($value, $cmd == 'css_transform');
                             break;
-                        case 'ts_strip':
-                            $value = $this->TS_strip_db($value);
-                            break;
                         default:
                             // Do nothing
                     }
@@ -1022,19 +1019,6 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser
         return implode(LF, $blockSplit);
     }
 
-    /**
-     * Transformation handler: 'ts_strip' / direction: "db"
-     * Removing all non-allowed tags
-     *
-     * @param string $value Content input
-     * @return string Content output
-     */
-    public function TS_strip_db($value)
-    {
-        $value = strip_tags($value, '<' . implode('><', explode(',', 'b,i,u,a,img,br,div,center,pre,font,hr,sub,sup,p,strong,em,li,ul,ol,blockquote')) . '>');
-        return $value;
-    }
-
     /***************************************************************
      *
      * Generic RTE transformation, analysis and helper functions
@@ -1378,7 +1362,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser
 
     /**
      * Remove all tables from incoming code
-     * The function is trying to to this is some more or less respectfull way. The approach is to resolve each table cells content and implode it all by <br /> chars. Thus at least the content is preserved in some way.
+     * The function is trying to do this in a more or less respectful way. The approach is to resolve each table cells content and implode it all by <br /> chars. Thus at least the content is preserved in some way.
      *
      * @param string $value Input value
      * @param string $breakChar Break character to use for linebreaks.
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-72661-RTETransformationTs_stripRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-72661-RTETransformationTs_stripRemoved.rst
new file mode 100644
index 000000000000..054ac48aac0b
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-72661-RTETransformationTs_stripRemoved.rst
@@ -0,0 +1,31 @@
+======================================================
+Breaking: #72661 - RTE Transformation ts_strip removed
+======================================================
+
+Description
+===========
+
+The Rich Text Editor transformation that removes all HTML tags except a hard-coded white-list of allowed
+HTML tags when saving data from the RTE to the database - called ``ts_strip`` - was removed.
+
+
+Impact
+======
+
+Using the command ``ts_strip`` in the list of transformations via PageTSconfig or TCA directly will result in keeping
+the HTML tags inside the database.
+
+
+Affected Installations
+======================
+
+TYPO3 installations that use ``ts_strip`` explicitly in their TSconfig options, or instances with extensions that set this
+option.
+
+
+Migration
+=========
+
+Use TSconfig options like ``RTE.default.removeTags`` to specify which tags should be removed when saving data
+to the database, or even better ``RTE.default.proc.allowTags`` which tags are whitelisted to the database together
+with the default RTE processing command ``ts_css``.
\ No newline at end of file
-- 
GitLab