Commit 59cd61ea authored by Benni Mack's avatar Benni Mack
Browse files

[!!!][TASK] Remove RTE transformation for typolist and typohead

The transformation of the tags typolist and typohead are removed.

Resolves: #68206
Releases: master
Change-Id: I78427b0e7b91b2d1acd4405ab4c195ff641ed88b
Reviewed-on: http://review.typo3.org/41379


Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack's avatarBenjamin Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenjamin Mack <benni@typo3.org>
parent 1752a391
......@@ -889,25 +889,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
case 'ol':
case 'ul':
// Transform lists into <typolist>-tags:
if (!$css) {
if (!isset($this->procOptions['typolist']) || $this->procOptions['typolist']) {
$parts = $this->getAllParts($this->splitIntoBlock('LI', $this->removeFirstAndLastTag($blockSplit[$k])), 1, 0);
foreach ($parts as $k2 => $value) {
$parts[$k2] = preg_replace('/[' . LF . CR . ']+/', '', $parts[$k2]);
// remove all linesbreaks!
$parts[$k2] = $this->defaultTStagMapping($parts[$k2], 'db');
$parts[$k2] = $this->cleanFontTags($parts[$k2], 0, 0, 0);
$parts[$k2] = $this->HTMLcleaner_db($parts[$k2], strtolower($this->procOptions['allowTagsInTypolists'] ? $this->procOptions['allowTagsInTypolists'] : 'br,font,b,i,u,a,img,span,strong,em'));
}
if ($tagName == 'ol') {
$params = ' type="1"';
} else {
$params = '';
}
$blockSplit[$k] = '<typolist' . $params . '>' . LF . implode(LF, $parts) . LF . '</typolist>' . $lastBR;
}
} else {
if ($css) {
$blockSplit[$k] = preg_replace(('/[' . LF . CR . ']+/'), ' ', $this->transformStyledATags($blockSplit[$k])) . $lastBR;
}
break;
......@@ -934,12 +916,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
$attribArray = $this->get_tag_attributes_classic($tag);
// Processing inner content here:
$innerContent = $this->HTMLcleaner_db($this->removeFirstAndLastTag($blockSplit[$k]));
if (!isset($this->procOptions['typohead']) || $this->procOptions['typohead']) {
$type = (int)substr($tagName, 1);
$blockSplit[$k] = '<typohead' . ($type != 6 ? ' type="' . $type . '"' : '') . ($attribArray['align'] ? ' align="' . $attribArray['align'] . '"' : '') . ($attribArray['class'] ? ' class="' . $attribArray['class'] . '"' : '') . '>' . $innerContent . '</typohead>' . $lastBR;
} else {
$blockSplit[$k] = '<' . $tagName . ($attribArray['align'] ? ' align="' . htmlspecialchars($attribArray['align']) . '"' : '') . ($attribArray['class'] ? ' class="' . htmlspecialchars($attribArray['class']) . '"' : '') . '>' . $innerContent . '</' . $tagName . '>' . $lastBR;
}
$blockSplit[$k] = '<' . $tagName . ($attribArray['align'] ? ' align="' . htmlspecialchars($attribArray['align']) . '"' : '') . ($attribArray['class'] ? ' class="' . htmlspecialchars($attribArray['class']) . '"' : '') . '>' . $innerContent . '</' . $tagName . '>' . $lastBR;
} else {
// Eliminate true linebreaks inside Hx tags
$blockSplit[$k] = preg_replace(('/[' . LF . CR . ']+/'), ' ', $this->transformStyledATags($blockSplit[$k])) . $lastBR;
......@@ -1006,7 +983,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
*/
public function TS_transform_rte($value, $css = 0) {
// Split the content from database by the occurrence of the block elements
$blockElementList = 'TABLE,BLOCKQUOTE,TYPOLIST,TYPOHEAD,' . ($this->procOptions['preserveDIVSections'] ? 'DIV,' : '') . $this->blockElementList;
$blockElementList = 'TABLE,BLOCKQUOTE,' . ($this->procOptions['preserveDIVSections'] ? 'DIV,' : '') . $this->blockElementList;
$blockSplit = $this->splitIntoBlock($blockElementList, $value);
// Traverse the blocks
foreach ($blockSplit as $k => $v) {
......@@ -1037,30 +1014,6 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
case 'aside':
$blockSplit[$k] = $tag . $this->TS_transform_rte($this->removeFirstAndLastTag($blockSplit[$k]), $css) . '</' . $tagName . '>';
break;
case 'typolist':
// Transform typolist blocks into OL/UL lists. Type 1 is expected to be numerical block
if (!isset($this->procOptions['typolist']) || $this->procOptions['typolist']) {
$tListContent = $this->removeFirstAndLastTag($blockSplit[$k]);
$tListContent = preg_replace('/^[ ]*' . LF . '/', '', $tListContent);
$tListContent = preg_replace('/' . LF . '[ ]*$/', '', $tListContent);
$lines = explode(LF, $tListContent);
$typ = $attribArray['type'] == 1 ? 'ol' : 'ul';
$blockSplit[$k] = '<' . $typ . '>' . LF . '<li>' . implode(('</li>' . LF . '<li>'), $lines) . '</li>' . '</' . $typ . '>';
}
break;
case 'typohead':
// Transform typohead into Hx tags.
if (!isset($this->procOptions['typohead']) || $this->procOptions['typohead']) {
$tC = $this->removeFirstAndLastTag($blockSplit[$k]);
$typ = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($attribArray['type'], 0, 6);
if (!$typ) {
$typ = 6;
}
$align = $attribArray['align'] ? ' align="' . $attribArray['align'] . '"' : '';
$class = $attribArray['class'] ? ' class="' . $attribArray['class'] . '"' : '';
$blockSplit[$k] = '<h' . $typ . $align . $class . '>' . $tC . '</h' . $typ . '>';
}
break;
}
$blockSplit[$k + 1] = preg_replace('/^[ ]*' . LF . '/', '', $blockSplit[$k + 1]);
} else {
......@@ -1271,10 +1224,6 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
* @see setDivTags()
*/
public function divideIntoLines($value, $count = 5, $returnArray = FALSE) {
// Internalize font tags (move them from OUTSIDE p/div to inside it that is the case):
if ($this->procOptions['internalizeFontTags']) {
$value = $this->internalizeFontTags($value);
}
// Setting configuration for processing:
$allowTagsOutside = GeneralUtility::trimExplode(',', strtolower($this->procOptions['allowTagsOutside'] ? 'hr,' . $this->procOptions['allowTagsOutside'] : 'hr,img'), TRUE);
$remapParagraphTag = strtoupper($this->procOptions['remapParagraphTag']);
......@@ -1435,49 +1384,6 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
return implode(LF, $parts);
}
/**
* This splits the $value in font-tag chunks.
* If there are any <P>/<DIV> sections inside of them, the font-tag is wrapped AROUND the content INSIDE of the P/DIV sections and the outer font-tag is removed.
* This functions seems to be a good choice for pre-processing content if it has been pasted into the RTE from eg. star-office.
* In that case the font-tags are normally on the OUTSIDE of the sections.
* This function is used by eg. divideIntoLines() if the procesing option 'internalizeFontTags' is set.
*
* @param string Input content
* @return string Output content
* @see divideIntoLines()
*/
public function internalizeFontTags($value) {
// Splitting into font tag blocks:
$fontSplit = $this->splitIntoBlock('font', $value);
foreach ($fontSplit as $k => $v) {
// Inside
if ($k % 2) {
// Fint font-tag
$fTag = $this->getFirstTag($v);
$divSplit_sub = $this->splitIntoBlock('div,p', $this->removeFirstAndLastTag($v), 1);
// If there were div/p sections inside the font-tag, do something about it...
if (count($divSplit_sub) > 1) {
// Traverse those sections:
foreach ($divSplit_sub as $k2 => $v2) {
// Inside
if ($k2 % 2) {
// Fint font-tag
$div_p = $this->getFirstTag($v2);
// Fint font-tag
$div_p_tagname = $this->getFirstTagName($v2);
// ... and remove it from original.
$v2 = $this->removeFirstAndLastTag($v2);
$divSplit_sub[$k2] = $div_p . $fTag . $v2 . '</font>' . '</' . $div_p_tagname . '>';
} elseif (trim(strip_tags($v2))) {
$divSplit_sub[$k2] = $fTag . $v2 . '</font>';
}
}
$fontSplit[$k] = implode('', $divSplit_sub);
}
}
}
return implode('', $fontSplit);
}
/**
* Returns SiteURL based on thisScript.
......
===============================================================
Breaking: #68206 - Remove usage of typolist and typohead in RTE
===============================================================
Description
===========
The transformation for the tags ``typolist`` and ``typohead`` are removed from the RTE.
The option and method ``internalizeFontTags`` from RteHtmlParser have been removed.
Impact
======
The tags are not processed anymore by the RteHtmlParser.
Fonts are not internalized anymore.
Affected Installations
======================
All installations using the custom tags ``typolist`` and ``typohead``.
All installations that use the method ``internalizeFontTags`` will throw an fatal error.
Migration
=========
Substitute the tags by a tag ``ul```or ``header``.
Remove any usage of ``internalizeFontTags``
\ No newline at end of file
......@@ -88,8 +88,7 @@ These are the more technical specs:
rendered by a USER cObject calling methods from
"tx\_cssstyledcontent\_pi1" for rendering.
- TYPO3 specific tags: skipping typolist, typohead, typocode tags (using
native HTML from RTE instead). Preserving the <LINK> tag.
- TYPO3 specific tags: Preserving the <LINK> tag.
- The position of the parseFunc object has changed to "lib.parseFunc"
and with TYPO3 versions > 3.6.0RC1 parseFunc can be referenced (which
......
......@@ -4878,8 +4878,7 @@ class ContentObjectRenderer {
/**
* Implements the stdWrap property, "parseFunc".
* This is a function with a lot of interesting uses. In classic TypoScript this is used to process text
* from the bodytext field; This included highlighting of search words, changing http:// and mailto: prefixed strings into links,
* parsing <typolist>, <typohead> and <typocode> tags etc.
* from the bodytext field; This included highlighting of search words, changing http:// and mailto: prefixed strings into etc.
* It is still a very important function for processing of bodytext which is normally stored in the database
* in a format which is not fully ready to be outputted.
* This situation has not become better by having a RTE around...
......@@ -7181,7 +7180,6 @@ class ContentObjectRenderer {
* @param array $confArr The TypoScript array
* @param string $prop The property name: If this value is a reference (eg. " < plugins.tx_something") then the reference will be retrieved and inserted at that position (into the properties only, not the value...) AND overlaid with the old properties if any.
* @return array The modified TypoScript array
* @see user_plaintext::typolist(),user_plaintext::typohead()
*/
public function mergeTSRef($confArr, $prop) {
if ($confArr[$prop][0] === '<') {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment