[TYPO3-english] perfectlightbox/DAM: image link with spaces is not encoded and split apart to typolink options

Daniel Neugebauer mailinglists at energiequant.de
Wed Jun 20 13:06:12 CEST 2012


Looks like I had a copy & paste error in the TypoScript editor. Here's a 
more readable clean version:


## WORKAROUND PERFECTLIGHTBOX [BEGIN]
# workaround for some bug in Typo3 Core/DAM/Perfectlightbox (couldn't 
locate...)
# problem:       perfectlightbox links to original image (as is done 
without perfectlightbox
#                so the bug could be located in DAM or core).
#                If that image URL uses spaces that are not encoded to 
%20, the link is mangled.
# reason:        The URL will be split up by typolink handling funtion 
via a call to t3lib's unQuoteFilenames
#                which splits typolink.parameter on spaces (target and 
other options). Since parameter has not
#                been URL encoded, we get parts of the URL in other 
a-tag parameters and a broken URL...
# workaround:    encode spaces in typolink.parameter
# where to look: typo3conf/ext/perfectlightbox/static/setup.txt 
(overrides for tt_content ... typolink)
#                typo3/sysext/cms/tslib/class.tslib_content.php 
(function typoLink, line: $link_paramA = 
t3lib_div::unQuoteFilenames($link_param, TRUE);)
#                t3lib/class.t3lib_div.php 
(function unQuoteFilenames)
tt_content.image.20.1.imageLinkWrap.typolink.parameter.override.postUserFunc 
= user_SiteFunctions->encodeTypolinkURL
tt_content.image.20.1.imageLinkWrap.typolink.parameter.postUserFunc = 
user_SiteFunctions->encodeTypolinkURL
# possibly more calls needed for tt_news (see TypoScript of perfectlightbox)
## WORKAROUND PERFECTLIGHTBOX [END]


user_SiteFunctions: (may need modification)

         function encodeTypolinkURLRegexpCallback($m) {
             $s = $m[1].$m[2].$m[3];
             $s = str_replace(' ', '%20', $s);
             return $s;
         }

         function encodeTypolinkURL($s, $conf) {
             $s = 
preg_replace_callback('/^(fileadmin|typo3temp)(\/.*?\.)(jpe?g|gif|png)/i', 
array($this, 'encodeTypolinkURLRegexpCallback'), $s);
             return $s;
         }


More information about the TYPO3-english mailing list