From 79e70a627e074f4c8aa58fc9004f1a0b761c1900 Mon Sep 17 00:00:00 2001 From: Rupert Germann Date: Sat, 14 May 2005 10:33:39 +0000 Subject: [PATCH] - added a new function to class.tslib_content.php (getBorderAttr()) which returns only a border attribute for images if the doctype is not xhtml_strict, xhtml_11 or xhtml_2 or if the config parameter 'disableImgBorderAttr' is not set. (fixes bug 797) git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@718 709f56b5-9817-0410-a4d7-c38de5d9e867 --- .../sysext/cms/tslib/class.tslib_content.php | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/typo3/sysext/cms/tslib/class.tslib_content.php b/typo3/sysext/cms/tslib/class.tslib_content.php index 89df66a6dfe1..ee1c7b870ee8 100755 --- a/typo3/sysext/cms/tslib/class.tslib_content.php +++ b/typo3/sysext/cms/tslib/class.tslib_content.php @@ -603,7 +603,7 @@ class tslib_cObj { $w = $w ? $w : 1; $h = $h ? $h : 1; $wrap = $conf['wrap'] ? $conf['wrap'] : '|
'; - $theValue = $this->wrap('', $wrap); + $theValue = $this->wrap('getBorderAttr(' border="0"').' alt="" title="" />', $wrap); return $this->stdWrap($theValue,$conf['stdWrap.']); } @@ -1023,15 +1023,15 @@ class tslib_cObj { // draw table for ($c=0;$c<$rowCount;$c++) { // Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows! if ($c && $rowspacing) { // If this is NOT the first time in the loop AND if space is required, a row-spacer is added. In case of "noRows" rowspacing is done further down. - $tablecode.=''; + $tablecode.='getBorderAttr(' border="0"').' alt="" title="" />'; } $tablecode.=''; // starting row for ($b=0; $b<$colCount_temp; $b++) { // Looping through the columns if ($b && $colspacing) { // If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell. if (!$noCols) { - $tablecode.=''; + $tablecode.='getBorderAttr(' border="0"').' alt="" title="" />'; } else { - $colSpacer=''; + $colSpacer='getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />'; $colSpacer=''.$colSpacer.''; // added 160301, needed for the new "noCols"-table... $tablecode.=$colSpacer; } @@ -2487,7 +2487,7 @@ class tslib_cObj { } $altParam = $this->getAltParam($conf); - $theValue = ''; + $theValue = 'getBorderAttr(' border="'.intval($conf['border']).'"').($conf['params']?' '.$conf['params']:'').($altParam).' />'; if ($conf['linkWrap']) { $theValue = $this->linkWrap($theValue,$conf['linkWrap']); } elseif ($conf['imageLinkWrap']) { @@ -2496,6 +2496,17 @@ class tslib_cObj { return $this->wrap($theValue,$conf['wrap']); } } + /** + * Returns the 'border' attribute for an tag only if the doctype is not xhtml_strict,xhtml_11 or xhtml_2 or if the config parameter 'disableImgBorderAttr' is not set. + * + * @param string the border attribute + * @return string the border attribute + */ + function getBorderAttr($borderAttr) { + if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->config['config']['doctype']) || $GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) { + return $borderAttr; + } + } /** * Wraps the input string in link-tags that opens the image in a new window. @@ -2579,7 +2590,7 @@ class tslib_cObj { if (t3lib_div::inList('jpg,gif,jpeg,png',$fileinfo['fileext'])) { $imgFile = $incFile; $imgInfo = @getImageSize($imgFile); - return ''; + return 'getBorderAttr(' border="0"').' '.$addParams.' />'; } elseif (filesize($incFile)<1024*1024) { return $GLOBALS['TSFE']->tmpl->fileContent($incFile); } @@ -3708,10 +3719,10 @@ class tslib_cObj { } else { $icon = 't3lib/gfx/notfound_thumb.gif'; } - $icon = 'getAltParam($conf).' />'; + $icon = 'getBorderAttr(' border="0"').''.$this->getAltParam($conf).' />'; } } else { - $icon = 'getAltParam($conf).' />'; + $icon = 'getBorderAttr(' border="0"').''.$this->getAltParam($conf).' />'; } if ($conf['icon_link']) {$icon = $this->wrap($icon, $theLinkWrap);} $icon = $this->stdWrap($icon,$conf['icon.']); @@ -5320,10 +5331,10 @@ class tslib_cObj { $wrapBefore = intval($wrapArray[0]); $wrapAfter = intval($wrapArray[1]); if ($wrapBefore) { - $result = '
'.$result; + $result = 'getBorderAttr(' border="0"').' class="spacer-gif" alt="" title="" />
'.$result; } if ($wrapAfter) { - $result.='
'; + $result.='getBorderAttr(' border="0"').' class="spacer-gif" alt="" title="" />
'; } } return $result; -- 2.20.1