bddc48be465743c7d4d2305020f91023f411badd
[Packages/TYPO3.CMS.git] / typo3 / sysext / compatibility6 / Classes / ContentObject / HorizontalRulerContentObject.php
1 <?php
2 namespace TYPO3\CMS\Compatibility6\ContentObject;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Contains HRULER content object.
19 */
20 class HorizontalRulerContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractContentObject {
21
22 /**
23 * Rendering the cObject, HRULER
24 *
25 * @param array $conf Array of TypoScript properties
26 * @return string Output
27 */
28 public function render($conf = array()) {
29 $lineThickness = isset($conf['lineThickness.']) ? $this->cObj->stdWrap($conf['lineThickness'], $conf['lineThickness.']) : $conf['lineThickness'];
30 $lineThickness = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($lineThickness, 1, 50);
31 $lineColor = isset($conf['lineColor.']) ? $this->cObj->stdWrap($conf['lineColor'], $conf['lineColor.']) : $conf['lineColor'];
32 if (!$lineColor) {
33 $lineColor = 'black';
34 }
35 $spaceBefore = isset($conf['spaceLeft.']) ? (int)$this->cObj->stdWrap($conf['spaceLeft'], $conf['spaceLeft.']) : (int)$conf['spaceLeft'];
36 $spaceAfter = isset($conf['spaceRight.']) ? (int)$this->cObj->stdWrap($conf['spaceRight'], $conf['spaceRight.']) : (int)$conf['spaceRight'];
37 $tableWidth = isset($conf['tableWidth.']) ? (int)$this->cObj->stdWrap($conf['tableWidth'], $conf['tableWidth.']) : (int)$conf['tableWidth'];
38 if (!$tableWidth) {
39 $tableWidth = '99%';
40 }
41 $theValue = '';
42 $theValue .= '<table border="0" cellspacing="0" cellpadding="0"
43 width="' . htmlspecialchars($tableWidth) . '"
44 summary=""><tr>';
45 if ($spaceBefore) {
46 $theValue .= '<td width="1">
47 <img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
48 width="' . $spaceBefore . '"
49 height="1" alt="" title="" />
50 </td>';
51 }
52 $theValue .= '<td bgcolor="' . $lineColor . '">
53 <img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
54 width="1"
55 height="' . $lineThickness . '"
56 alt="" title="" />
57 </td>';
58 if ($spaceAfter) {
59 $theValue .= '<td width="1">
60 <img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
61 width="' . $spaceAfter . '"
62 height="1" alt="" title="" />
63 </td>';
64 }
65 $theValue .= '</tr></table>';
66 if (isset($conf['stdWrap.'])) {
67 $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
68 }
69 return $theValue;
70 }
71
72 }