TYPO3 API  SVNRelease
class.tslib_content_horizontalruler.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010-2011 Xavier Perseguers <typo3@perseguers.ch>
00006  *  (c) 2010-2011 Steffen Kamper <steffen@typo3.org>
00007  *  All rights reserved
00008  *
00009  *  This script is part of the TYPO3 project. The TYPO3 project is
00010  *  free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  The GNU General Public License can be found at
00016  *  http://www.gnu.org/copyleft/gpl.html.
00017  *  A copy is found in the textfile GPL.txt and important notices to the license
00018  *  from the author is found in LICENSE.txt distributed with these scripts.
00019  *
00020  *
00021  *  This script is distributed in the hope that it will be useful,
00022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *  GNU General Public License for more details.
00025  *
00026  *  This copyright notice MUST APPEAR in all copies of the script!
00027  ***************************************************************/
00028 
00029 /**
00030  * Contains TEXT class object.
00031  *
00032  * $Id: class.tslib_content.php 7905 2010-06-13 14:42:33Z ohader $
00033  * @author Xavier Perseguers <typo3@perseguers.ch>
00034  * @author Steffen Kamper <steffen@typo3.org>
00035  */
00036 class tslib_content_HorizontalRuler extends tslib_content_Abstract {
00037 
00038     /**
00039      * Rendering the cObject, HRULER
00040      *
00041      * @param   array       Array of TypoScript properties
00042      * @return  string      Output
00043      */
00044     public function render($conf = array()) {
00045 
00046         $lineThickness = isset($conf['lineThickness.'])
00047             ? $this->cObj->stdWrap($conf['lineThickness'], $conf['lineThickness.'])
00048             : $conf['lineThickness'];
00049         $lineThickness = t3lib_div::intInRange($lineThickness, 1, 50);
00050 
00051         $lineColor = isset($conf['lineColor.'])
00052             ? $this->cObj->stdWrap($conf['lineColor'], $conf['lineColor.'])
00053             : $conf['lineColor'];
00054         if(!$lineColor) {
00055             $lineColor = 'black';
00056         }
00057 
00058         $spaceBefore = isset($conf['spaceLeft.'])
00059             ? intval($this->cObj->stdWrap($conf['spaceLeft'], $conf['spaceLeft.']))
00060             : intval($conf['spaceLeft']);
00061 
00062         $spaceAfter = isset($conf['spaceRight.'])
00063             ? intval($this->cObj->stdWrap($conf['spaceRight'], $conf['spaceRight.']))
00064             : intval($conf['spaceRight']);
00065 
00066         $tableWidth = isset($conf['tableWidth.'])
00067             ? intval($this->cObj->stdWrap($conf['tableWidth'], $conf['tableWidth.']))
00068             : intval($conf['tableWidth']);
00069         if(!$tableWidth) {
00070             $tableWidth = '99%';
00071         }
00072 
00073         $theValue = '';
00074 
00075         $theValue .= '<table border="0" cellspacing="0" cellpadding="0"
00076             width="' . htmlspecialchars($tableWidth) . '"
00077             summary=""><tr>';
00078         if ($spaceBefore) {
00079             $theValue .= '<td width="1">
00080                 <img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
00081                 width="' . $spaceBefore . '"
00082                 height="1" alt="" title="" />
00083             </td>';
00084         }
00085         $theValue .= '<td bgcolor="' . $lineColor . '">
00086             <img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
00087             width="1"
00088             height="' . $lineThickness . '"
00089             alt="" title="" />
00090         </td>';
00091         if ($spaceAfter) {
00092             $theValue .= '<td width="1">
00093                 <img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
00094                 width="' . $spaceAfter . '"
00095                 height="1" alt="" title="" />
00096             </td>';
00097         }
00098         $theValue .= '</tr></table>';
00099 
00100         if (isset($conf['stdWrap.'])) {
00101             $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
00102         }
00103 
00104         return $theValue;
00105 
00106     }
00107 
00108 }
00109 
00110 
00111 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_horizontalruler.php'])) {
00112     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/content/class.tslib_content_horizontalruler.php']);
00113 }
00114 
00115 ?>