Index: typo3/sysext/css_styled_content/static/setup.txt =================================================================== --- typo3/sysext/css_styled_content/static/setup.txt (revision 5895) +++ typo3/sysext/css_styled_content/static/setup.txt (working copy) @@ -822,6 +822,8 @@ 30.bytes = 1 30.bytes.labels = {$styles.content.uploads.filesizeBytesLabels} } + useSpacesInLinkText = 0 + stripFileExtensionFromLinkText = 0 } 20.color { Index: typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php =================================================================== --- typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php (revision 5895) +++ typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php (working copy) @@ -348,6 +348,10 @@ $GLOBALS['TSFE']->register['fileExtension'] = $filesData[$key]['fileextension']; $GLOBALS['TSFE']->register['description'] = $filesData[$key]['description']; $filesData[$key]['linkedFilenameParts'] = explode('//**//',$this->cObj->filelink($fileName, $conf['linkProc.'])); + if ($conf['stripFileExtensionFromLinkText'] || $conf['useSpacesInLinkText']) { + $filesData[$key]['linkedFilenameParts'] = $this->transverseFileLinkText($filesData[$key]['linkedFilenameParts'], $fileName, $conf['useSpacesInLinkText'], $conf['stripFileExtensionFromLinkText']); + } + } } @@ -872,7 +876,29 @@ * Helper functions * ************************************/ + + /** + * Returns a Linktext-String, which replaces underscores in filename with blanks. + * Has the possibility to cut off FileType + * @param array $links, Array with [0] Linked File-Icon, [1] Normal Filelink + * @param string $fileName, the name of the file to be linked (without path) + * @param bool $useSpaces true, replace underscores with spaces in file name + * @param bool $cutFileExtension true, filet extension gets cut off (cut before last .) + * @return array modified array with new linktext like in "$links" + */ + private function transverseFileLinktext($links, $fileName, $useSpaces = false, $cutFileExtension = false) { + if ($useSpaces) { + $linkText = str_replace('_', ' ', $fileName); + } + if ($cutFileExtension) { + $pos = strrpos($linkText, '.'); + $linkText = substr($linkText, 0, $pos); + } + $links[1] = str_replace('>' . $fileName . '<' , '>' . $linkText . '<', $links[1]); + return $links; + } + /** * Returns table attributes for uploads / tables. *