[BUGFIX] softrefproc typolink lacks support for separation by line feed 81/33481/2
authorMarc Bastian Heinrichs <typo3@mbh-software.de>
Mon, 17 Mar 2014 22:11:20 +0000 (23:11 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 23 Oct 2014 20:47:48 +0000 (22:47 +0200)
Since #24121 the field content in "image_link" is separated by line
feeds instead of commas. Since then the soft reference processor
for "typolink[linkList]" is broken for this field. This results in broken
image links in imports and exports and possible unchecked links in
linkvalidator extension. In 4.7 this applies also for the field
"longdescURL".

This have not to be fixed for versions later than 4.7, because since 6.0
the fields "image_link" and "longdescURL" aren't used anymore.

Resolves: #57006
Releases: 4.7, 4.5
Change-Id: I3a070d4d6e24b60a0658ec5bb6cc77d26a3e2f2d
Reviewed-on: http://review.typo3.org/33481
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
t3lib/class.t3lib_softrefproc.php

index b194f15..c86b762 100644 (file)
@@ -280,9 +280,17 @@ class t3lib_softrefproc {
                        // First, split the input string by a comma if the "linkList" parameter is set.
                        // An example: the link field for images in content elements of type "textpic" or "image". This field CAN be configured to define a link per image, separated by comma.
                if (is_array($spParams) && in_array('linkList', $spParams)) {
-                       $linkElement = explode(',', $content); // Preserving whitespace on purpose.
+                       // Preserving whitespace on purpose.
+                       if (strpos($content, LF) !== FALSE) {
+                               $linkElement = explode(LF, $content);
+                               $glue = LF;
+                       } else {
+                               $linkElement = explode(',', $content);
+                               $glue = ',';
+                       }
                } else {
                        $linkElement = array($content); // If only one element, just set in this array to make it easy below.
+                       $glue = '';
                }
 
                        // Traverse the links now:
@@ -295,7 +303,7 @@ class t3lib_softrefproc {
                        // Return output:
                if (count($elements)) {
                        $resultArray = array(
-                               'content' => implode(',', $linkElement),
+                               'content' => implode($glue, $linkElement),
                                'elements' => $elements
                        );
 
@@ -868,4 +876,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_softrefproc.php']);
 }
 
-?>
\ No newline at end of file
+?>