@@ -39,7 +39,7 @@ |
||
39 | 39 | * @param string $content |
40 | 40 | * @param array $conf |
41 | 41 | * |
42 | - * @return array |
|
42 | + * @return string |
|
43 | 43 | */ |
44 | 44 | public function render($content, $conf) { |
45 | 45 | $lines = array(); |
@@ -17,88 +17,88 @@ |
||
17 | 17 | */ |
18 | 18 | class PlainRenderer { |
19 | 19 | |
20 | - /** |
|
21 | - * The content object |
|
22 | - * |
|
23 | - * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer |
|
24 | - */ |
|
25 | - public $cObj; |
|
20 | + /** |
|
21 | + * The content object |
|
22 | + * |
|
23 | + * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer |
|
24 | + */ |
|
25 | + public $cObj; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Configuration |
|
29 | - * |
|
30 | - * @var |
|
31 | - */ |
|
32 | - protected $conf; |
|
27 | + /** |
|
28 | + * Configuration |
|
29 | + * |
|
30 | + * @var |
|
31 | + */ |
|
32 | + protected $conf; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Render the different elements and collect the single lines. |
|
36 | - * After the rendering the lines will be imploded. Notice: |
|
37 | - * All methods after this are CType rendering helper |
|
38 | - * |
|
39 | - * @param string $content |
|
40 | - * @param array $conf |
|
41 | - * |
|
42 | - * @return array |
|
43 | - */ |
|
44 | - public function render($content, $conf) { |
|
45 | - $lines = array(); |
|
46 | - $this->conf = $conf; |
|
47 | - $CType = (string)$this->cObj->data['CType']; |
|
48 | - if (isset($this->conf['forceCType']) && trim($this->conf['forceCType']) !== '') { |
|
49 | - $CType = trim($this->conf['forceCType']); |
|
50 | - } |
|
34 | + /** |
|
35 | + * Render the different elements and collect the single lines. |
|
36 | + * After the rendering the lines will be imploded. Notice: |
|
37 | + * All methods after this are CType rendering helper |
|
38 | + * |
|
39 | + * @param string $content |
|
40 | + * @param array $conf |
|
41 | + * |
|
42 | + * @return array |
|
43 | + */ |
|
44 | + public function render($content, $conf) { |
|
45 | + $lines = array(); |
|
46 | + $this->conf = $conf; |
|
47 | + $CType = (string)$this->cObj->data['CType']; |
|
48 | + if (isset($this->conf['forceCType']) && trim($this->conf['forceCType']) !== '') { |
|
49 | + $CType = trim($this->conf['forceCType']); |
|
50 | + } |
|
51 | 51 | |
52 | - $renderer = array( |
|
53 | - 'html' => 'FRUIT\\Ink\\Rendering\\Html', |
|
54 | - 'header' => 'FRUIT\\Ink\\Rendering\\Header', |
|
55 | - 'table' => 'FRUIT\\Ink\\Rendering\\Table', |
|
56 | - 'menu' => 'FRUIT\\Ink\\Rendering\\Menu', |
|
57 | - 'text' => 'FRUIT\\Ink\\Rendering\\Text', |
|
58 | - 'image' => 'FRUIT\\Ink\\Rendering\\Image', |
|
59 | - 'textpic' => 'FRUIT\\Ink\\Rendering\\TextPicture', |
|
60 | - 'templavoila_pi1' => 'FRUIT\\Ink\\Rendering\\Templavoila', |
|
61 | - 'list' => 'FRUIT\\Ink\\Rendering\\Plugin', |
|
62 | - ); |
|
52 | + $renderer = array( |
|
53 | + 'html' => 'FRUIT\\Ink\\Rendering\\Html', |
|
54 | + 'header' => 'FRUIT\\Ink\\Rendering\\Header', |
|
55 | + 'table' => 'FRUIT\\Ink\\Rendering\\Table', |
|
56 | + 'menu' => 'FRUIT\\Ink\\Rendering\\Menu', |
|
57 | + 'text' => 'FRUIT\\Ink\\Rendering\\Text', |
|
58 | + 'image' => 'FRUIT\\Ink\\Rendering\\Image', |
|
59 | + 'textpic' => 'FRUIT\\Ink\\Rendering\\TextPicture', |
|
60 | + 'templavoila_pi1' => 'FRUIT\\Ink\\Rendering\\Templavoila', |
|
61 | + 'list' => 'FRUIT\\Ink\\Rendering\\Plugin', |
|
62 | + ); |
|
63 | 63 | |
64 | - GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Plugin.php')); |
|
65 | - GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Image.php')); |
|
66 | - GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Menu.php')); |
|
64 | + GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Plugin.php')); |
|
65 | + GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Image.php')); |
|
66 | + GeneralUtility::requireOnce(ExtensionManagementUtility::extPath('ink', 'Classes/Rendering/Menu.php')); |
|
67 | 67 | |
68 | - $objectManager = new ObjectManager(); |
|
69 | - /** @var Dispatcher $signalSlot */ |
|
70 | - $signalSlot = $objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); |
|
71 | - $returnData = $signalSlot->dispatch(__CLASS__, 'renderer', array('renderer' => $renderer)); |
|
72 | - $renderer = $returnData['renderer']; |
|
68 | + $objectManager = new ObjectManager(); |
|
69 | + /** @var Dispatcher $signalSlot */ |
|
70 | + $signalSlot = $objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); |
|
71 | + $returnData = $signalSlot->dispatch(__CLASS__, 'renderer', array('renderer' => $renderer)); |
|
72 | + $renderer = $returnData['renderer']; |
|
73 | 73 | |
74 | - if (isset($renderer[$CType])) { |
|
75 | - $className = $renderer[$CType]; |
|
76 | - /** @var RenderingInterface $renderObject */ |
|
77 | - $renderObject = $objectManager->get($className); |
|
78 | - $lines = $renderObject->render($this->cObj, $this->conf); |
|
79 | - } else { |
|
80 | - $lines[] = 'CType: ' . $CType . ' have no rendering definitions'; |
|
81 | - } |
|
82 | - $content = implode(LF, $lines); |
|
83 | - return trim($content, CRLF . TAB); |
|
84 | - } |
|
74 | + if (isset($renderer[$CType])) { |
|
75 | + $className = $renderer[$CType]; |
|
76 | + /** @var RenderingInterface $renderObject */ |
|
77 | + $renderObject = $objectManager->get($className); |
|
78 | + $lines = $renderObject->render($this->cObj, $this->conf); |
|
79 | + } else { |
|
80 | + $lines[] = 'CType: ' . $CType . ' have no rendering definitions'; |
|
81 | + } |
|
82 | + $content = implode(LF, $lines); |
|
83 | + return trim($content, CRLF . TAB); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Function used by TypoScript "parseFunc" to process links in the bodytext. |
|
88 | - * Extracts the link and shows it in plain text in a parathesis next to the link text. If link was relative the site URL was prepended. |
|
89 | - * |
|
90 | - * @param string $content : Empty, ignore. |
|
91 | - * @param array $conf : TypoScript parameters |
|
92 | - * |
|
93 | - * @return string Processed output. |
|
94 | - * @see parseBody() |
|
95 | - */ |
|
96 | - function atag_to_http($content, $conf) { |
|
97 | - $this->conf = $conf; |
|
98 | - $theLink = trim($this->cObj->parameters['href']); |
|
99 | - if (strtolower(substr($theLink, 0, 7)) == 'mailto:') { |
|
100 | - $theLink = substr($theLink, 7); |
|
101 | - } |
|
102 | - return $this->cObj->getCurrentVal() . ' ( ' . $theLink . ' )'; |
|
103 | - } |
|
86 | + /** |
|
87 | + * Function used by TypoScript "parseFunc" to process links in the bodytext. |
|
88 | + * Extracts the link and shows it in plain text in a parathesis next to the link text. If link was relative the site URL was prepended. |
|
89 | + * |
|
90 | + * @param string $content : Empty, ignore. |
|
91 | + * @param array $conf : TypoScript parameters |
|
92 | + * |
|
93 | + * @return string Processed output. |
|
94 | + * @see parseBody() |
|
95 | + */ |
|
96 | + function atag_to_http($content, $conf) { |
|
97 | + $this->conf = $conf; |
|
98 | + $theLink = trim($this->cObj->parameters['href']); |
|
99 | + if (strtolower(substr($theLink, 0, 7)) == 'mailto:') { |
|
100 | + $theLink = substr($theLink, 7); |
|
101 | + } |
|
102 | + return $this->cObj->getCurrentVal() . ' ( ' . $theLink . ' )'; |
|
103 | + } |
|
104 | 104 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function render($content, $conf) { |
45 | 45 | $lines = array(); |
46 | 46 | $this->conf = $conf; |
47 | - $CType = (string)$this->cObj->data['CType']; |
|
47 | + $CType = (string) $this->cObj->data['CType']; |
|
48 | 48 | if (isset($this->conf['forceCType']) && trim($this->conf['forceCType']) !== '') { |
49 | 49 | $CType = trim($this->conf['forceCType']); |
50 | 50 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $renderObject = $objectManager->get($className); |
78 | 78 | $lines = $renderObject->render($this->cObj, $this->conf); |
79 | 79 | } else { |
80 | - $lines[] = 'CType: ' . $CType . ' have no rendering definitions'; |
|
80 | + $lines[] = 'CType: '.$CType.' have no rendering definitions'; |
|
81 | 81 | } |
82 | 82 | $content = implode(LF, $lines); |
83 | - return trim($content, CRLF . TAB); |
|
83 | + return trim($content, CRLF.TAB); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -99,6 +99,6 @@ discard block |
||
99 | 99 | if (strtolower(substr($theLink, 0, 7)) == 'mailto:') { |
100 | 100 | $theLink = substr($theLink, 7); |
101 | 101 | } |
102 | - return $this->cObj->getCurrentVal() . ' ( ' . $theLink . ' )'; |
|
102 | + return $this->cObj->getCurrentVal().' ( '.$theLink.' )'; |
|
103 | 103 | } |
104 | 104 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** |
20 | 20 | * Render the given element |
21 | 21 | * |
22 | - * @return array |
|
22 | + * @return string[] |
|
23 | 23 | */ |
24 | 24 | public function renderInternal() { |
25 | 25 | $headerWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['header']), LF, Configuration::getPlainTextWith()); |
@@ -16,30 +16,30 @@ |
||
16 | 16 | */ |
17 | 17 | class Header extends AbstractRendering { |
18 | 18 | |
19 | - /** |
|
20 | - * Render the given element |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function renderInternal() { |
|
25 | - $headerWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['header']), LF, Configuration::getPlainTextWith()); |
|
26 | - $subHeaderWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['subheader']), LF, Configuration::getPlainTextWith()); |
|
19 | + /** |
|
20 | + * Render the given element |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function renderInternal() { |
|
25 | + $headerWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['header']), LF, Configuration::getPlainTextWith()); |
|
26 | + $subHeaderWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['subheader']), LF, Configuration::getPlainTextWith()); |
|
27 | 27 | |
28 | - // align |
|
29 | - $header = array_merge(GeneralUtility::trimExplode(LF, $headerWrap, TRUE), GeneralUtility::trimExplode(LF, $subHeaderWrap, TRUE)); |
|
30 | - if ($this->contentObject->data['header_position'] == 'right') { |
|
31 | - foreach ($header as $key => $l) { |
|
32 | - $l = trim($l); |
|
33 | - $header[$key] = str_pad(' ', (Configuration::getPlainTextWith() - strlen($l)), ' ', STR_PAD_LEFT) . $l; |
|
34 | - } |
|
35 | - } elseif ($this->contentObject->data['header_position'] == 'center') { |
|
36 | - foreach ($header as $key => $l) { |
|
37 | - $l = trim($l); |
|
38 | - $header[$key] = str_pad(' ', floor((Configuration::getPlainTextWith() - strlen($l)) / 2), ' ', STR_PAD_LEFT) . $l; |
|
39 | - } |
|
40 | - } |
|
41 | - $header = implode(LF, $header); |
|
42 | - $lines[] = $header; |
|
43 | - return $lines; |
|
44 | - } |
|
28 | + // align |
|
29 | + $header = array_merge(GeneralUtility::trimExplode(LF, $headerWrap, TRUE), GeneralUtility::trimExplode(LF, $subHeaderWrap, TRUE)); |
|
30 | + if ($this->contentObject->data['header_position'] == 'right') { |
|
31 | + foreach ($header as $key => $l) { |
|
32 | + $l = trim($l); |
|
33 | + $header[$key] = str_pad(' ', (Configuration::getPlainTextWith() - strlen($l)), ' ', STR_PAD_LEFT) . $l; |
|
34 | + } |
|
35 | + } elseif ($this->contentObject->data['header_position'] == 'center') { |
|
36 | + foreach ($header as $key => $l) { |
|
37 | + $l = trim($l); |
|
38 | + $header[$key] = str_pad(' ', floor((Configuration::getPlainTextWith() - strlen($l)) / 2), ' ', STR_PAD_LEFT) . $l; |
|
39 | + } |
|
40 | + } |
|
41 | + $header = implode(LF, $header); |
|
42 | + $lines[] = $header; |
|
43 | + return $lines; |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -30,12 +30,12 @@ |
||
30 | 30 | if ($this->contentObject->data['header_position'] == 'right') { |
31 | 31 | foreach ($header as $key => $l) { |
32 | 32 | $l = trim($l); |
33 | - $header[$key] = str_pad(' ', (Configuration::getPlainTextWith() - strlen($l)), ' ', STR_PAD_LEFT) . $l; |
|
33 | + $header[$key] = str_pad(' ', (Configuration::getPlainTextWith() - strlen($l)), ' ', STR_PAD_LEFT).$l; |
|
34 | 34 | } |
35 | 35 | } elseif ($this->contentObject->data['header_position'] == 'center') { |
36 | 36 | foreach ($header as $key => $l) { |
37 | 37 | $l = trim($l); |
38 | - $header[$key] = str_pad(' ', floor((Configuration::getPlainTextWith() - strlen($l)) / 2), ' ', STR_PAD_LEFT) . $l; |
|
38 | + $header[$key] = str_pad(' ', floor((Configuration::getPlainTextWith() - strlen($l)) / 2), ' ', STR_PAD_LEFT).$l; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | $header = implode(LF, $header); |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** |
20 | 20 | * Render the given element |
21 | 21 | * |
22 | - * @return array |
|
22 | + * @return string[] |
|
23 | 23 | */ |
24 | 24 | public function renderInternal() { |
25 | 25 | $objectManager = new ObjectManager(); |
@@ -16,81 +16,81 @@ |
||
16 | 16 | */ |
17 | 17 | class Image extends AbstractRendering { |
18 | 18 | |
19 | - /** |
|
20 | - * Render the given element |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function renderInternal() { |
|
25 | - $objectManager = new ObjectManager(); |
|
26 | - /** @var FileRepository $fileRepository */ |
|
27 | - $fileRepository = $objectManager->get('TYPO3\\CMS\\Core\\Resource\\FileRepository'); |
|
28 | - $files = $fileRepository->findByRelation('tt_content', 'image', $this->contentObject->data['uid']); |
|
19 | + /** |
|
20 | + * Render the given element |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function renderInternal() { |
|
25 | + $objectManager = new ObjectManager(); |
|
26 | + /** @var FileRepository $fileRepository */ |
|
27 | + $fileRepository = $objectManager->get('TYPO3\\CMS\\Core\\Resource\\FileRepository'); |
|
28 | + $files = $fileRepository->findByRelation('tt_content', 'image', $this->contentObject->data['uid']); |
|
29 | 29 | |
30 | - $images_arr = array(); |
|
31 | - foreach ($files as $file) { |
|
32 | - /** @var $file File */ |
|
33 | - $images_arr[] = $this->getLink($file->getPublicUrl()); |
|
34 | - } |
|
30 | + $images_arr = array(); |
|
31 | + foreach ($files as $file) { |
|
32 | + /** @var $file File */ |
|
33 | + $images_arr[] = $this->getLink($file->getPublicUrl()); |
|
34 | + } |
|
35 | 35 | |
36 | - $lines[] = $this->renderImagesHelper($images_arr, !$this->contentObject->data['image_zoom'] ? $this->contentObject->data['image_link'] : '', $this->contentObject->data['imagecaption']); |
|
36 | + $lines[] = $this->renderImagesHelper($images_arr, !$this->contentObject->data['image_zoom'] ? $this->contentObject->data['image_link'] : '', $this->contentObject->data['imagecaption']); |
|
37 | 37 | |
38 | - return $lines; |
|
38 | + return $lines; |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Render block of images - which means creating lines with links to the images. |
|
44 | - * |
|
45 | - * @param array $images_arr : the image array |
|
46 | - * @param string $links : Link value from the "image_link" field in tt_content records |
|
47 | - * @param string $caption : Caption text |
|
48 | - * |
|
49 | - * @return string Content |
|
50 | - * @see getImages() |
|
51 | - */ |
|
52 | - function renderImagesHelper($images_arr, $links, $caption) { |
|
53 | - $linksArr = explode(',', $links); |
|
54 | - $lines = array(); |
|
55 | - $imageExists = FALSE; |
|
42 | + /** |
|
43 | + * Render block of images - which means creating lines with links to the images. |
|
44 | + * |
|
45 | + * @param array $images_arr : the image array |
|
46 | + * @param string $links : Link value from the "image_link" field in tt_content records |
|
47 | + * @param string $caption : Caption text |
|
48 | + * |
|
49 | + * @return string Content |
|
50 | + * @see getImages() |
|
51 | + */ |
|
52 | + function renderImagesHelper($images_arr, $links, $caption) { |
|
53 | + $linksArr = explode(',', $links); |
|
54 | + $lines = array(); |
|
55 | + $imageExists = FALSE; |
|
56 | 56 | |
57 | - foreach ($images_arr as $k => $file) { |
|
58 | - if (strlen(trim($file)) > 0) { |
|
59 | - $lines[] = $file; |
|
60 | - if ($links && count($linksArr) > 1) { |
|
61 | - if (isset($linksArr[$k])) { |
|
62 | - $ll = $linksArr[$k]; |
|
63 | - } else { |
|
64 | - $ll = $linksArr[0]; |
|
65 | - } |
|
57 | + foreach ($images_arr as $k => $file) { |
|
58 | + if (strlen(trim($file)) > 0) { |
|
59 | + $lines[] = $file; |
|
60 | + if ($links && count($linksArr) > 1) { |
|
61 | + if (isset($linksArr[$k])) { |
|
62 | + $ll = $linksArr[$k]; |
|
63 | + } else { |
|
64 | + $ll = $linksArr[0]; |
|
65 | + } |
|
66 | 66 | |
67 | - $theLink = $this->getLink($ll); |
|
68 | - if ($theLink) { |
|
69 | - $lines[] = $this->configuration['images.']['linkPrefix'] . $theLink; |
|
70 | - } |
|
71 | - } |
|
72 | - $imageExists = TRUE; |
|
73 | - } |
|
74 | - } |
|
75 | - if ($this->configuration['images.']['header'] && $imageExists) { |
|
76 | - array_unshift($lines, $this->configuration['images.']['header']); |
|
77 | - } |
|
78 | - if ($links && count($linksArr) == 1) { |
|
79 | - $theLink = $this->getLink($links); |
|
80 | - if ($theLink) { |
|
81 | - $lines[] = $this->configuration['images.']['linkPrefix'] . $theLink; |
|
82 | - } |
|
83 | - } |
|
84 | - if ($caption) { |
|
85 | - $lines[] = ''; |
|
86 | - $cHeader = trim($this->configuration['images.']['captionHeader']); |
|
87 | - if ($cHeader) { |
|
88 | - $lines[] = $cHeader; |
|
89 | - } |
|
90 | - $lines[] = $this->breakContent($caption); |
|
91 | - } |
|
67 | + $theLink = $this->getLink($ll); |
|
68 | + if ($theLink) { |
|
69 | + $lines[] = $this->configuration['images.']['linkPrefix'] . $theLink; |
|
70 | + } |
|
71 | + } |
|
72 | + $imageExists = TRUE; |
|
73 | + } |
|
74 | + } |
|
75 | + if ($this->configuration['images.']['header'] && $imageExists) { |
|
76 | + array_unshift($lines, $this->configuration['images.']['header']); |
|
77 | + } |
|
78 | + if ($links && count($linksArr) == 1) { |
|
79 | + $theLink = $this->getLink($links); |
|
80 | + if ($theLink) { |
|
81 | + $lines[] = $this->configuration['images.']['linkPrefix'] . $theLink; |
|
82 | + } |
|
83 | + } |
|
84 | + if ($caption) { |
|
85 | + $lines[] = ''; |
|
86 | + $cHeader = trim($this->configuration['images.']['captionHeader']); |
|
87 | + if ($cHeader) { |
|
88 | + $lines[] = $cHeader; |
|
89 | + } |
|
90 | + $lines[] = $this->breakContent($caption); |
|
91 | + } |
|
92 | 92 | |
93 | - return chr(10) . implode(chr(10), $lines); |
|
94 | - } |
|
93 | + return chr(10) . implode(chr(10), $lines); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | \ No newline at end of file |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $theLink = $this->getLink($ll); |
68 | 68 | if ($theLink) { |
69 | - $lines[] = $this->configuration['images.']['linkPrefix'] . $theLink; |
|
69 | + $lines[] = $this->configuration['images.']['linkPrefix'].$theLink; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | $imageExists = TRUE; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if ($links && count($linksArr) == 1) { |
79 | 79 | $theLink = $this->getLink($links); |
80 | 80 | if ($theLink) { |
81 | - $lines[] = $this->configuration['images.']['linkPrefix'] . $theLink; |
|
81 | + $lines[] = $this->configuration['images.']['linkPrefix'].$theLink; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | if ($caption) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $lines[] = $this->breakContent($caption); |
91 | 91 | } |
92 | 92 | |
93 | - return chr(10) . implode(chr(10), $lines); |
|
93 | + return chr(10).implode(chr(10), $lines); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | } |
97 | 97 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** |
20 | 20 | * Render the given element |
21 | 21 | * |
22 | - * @return array |
|
22 | + * @return string |
|
23 | 23 | */ |
24 | 24 | public function renderInternal() { |
25 | 25 | $str = $this->contentObject->cObjGetSingle($this->configuration['menu'], $this->configuration['menu.']); |
@@ -16,52 +16,52 @@ |
||
16 | 16 | */ |
17 | 17 | class Menu extends AbstractRendering { |
18 | 18 | |
19 | - /** |
|
20 | - * Render the given element |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function renderInternal() { |
|
25 | - $str = $this->contentObject->cObjGetSingle($this->configuration['menu'], $this->configuration['menu.']); |
|
26 | - $str = $this->breakBulletList($this->contentObject, trim(strip_tags(preg_replace('/<br\s*\/?>/i', chr(10), $this->parseBody($str))))); |
|
27 | - return $str; |
|
28 | - } |
|
19 | + /** |
|
20 | + * Render the given element |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function renderInternal() { |
|
25 | + $str = $this->contentObject->cObjGetSingle($this->configuration['menu'], $this->configuration['menu.']); |
|
26 | + $str = $this->breakBulletList($this->contentObject, trim(strip_tags(preg_replace('/<br\s*\/?>/i', chr(10), $this->parseBody($str))))); |
|
27 | + return $str; |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Breaks content lines into a bullet list |
|
32 | - * |
|
33 | - * @param ContentObjectRenderer $contentObject |
|
34 | - * @param string $str Content string to make into a bullet list |
|
35 | - * |
|
36 | - * @return string Processed value |
|
37 | - */ |
|
38 | - function breakBulletList($contentObject, $str) { |
|
39 | - $type = $contentObject->data['layout']; |
|
40 | - $type = MathUtility::forceIntegerInRange($type, 0, 3); |
|
30 | + /** |
|
31 | + * Breaks content lines into a bullet list |
|
32 | + * |
|
33 | + * @param ContentObjectRenderer $contentObject |
|
34 | + * @param string $str Content string to make into a bullet list |
|
35 | + * |
|
36 | + * @return string Processed value |
|
37 | + */ |
|
38 | + function breakBulletList($contentObject, $str) { |
|
39 | + $type = $contentObject->data['layout']; |
|
40 | + $type = MathUtility::forceIntegerInRange($type, 0, 3); |
|
41 | 41 | |
42 | - $tConf = $this->configuration['bulletlist.'][$type . '.']; |
|
42 | + $tConf = $this->configuration['bulletlist.'][$type . '.']; |
|
43 | 43 | |
44 | - $cParts = explode(chr(10), $str); |
|
45 | - $lines = array(); |
|
46 | - $c = 0; |
|
44 | + $cParts = explode(chr(10), $str); |
|
45 | + $lines = array(); |
|
46 | + $c = 0; |
|
47 | 47 | |
48 | - foreach ($cParts as $substrs) { |
|
49 | - if (!strlen($substrs)) { |
|
50 | - continue; |
|
51 | - } |
|
52 | - $c++; |
|
53 | - $bullet = $tConf['bullet'] ? $tConf['bullet'] : ' - '; |
|
54 | - $bLen = strlen($bullet); |
|
55 | - $bullet = substr(str_replace('#', $c, $bullet), 0, $bLen); |
|
56 | - $secondRow = substr($tConf['secondRow'] ? $tConf['secondRow'] : str_pad('', strlen($bullet), ' '), 0, $bLen); |
|
48 | + foreach ($cParts as $substrs) { |
|
49 | + if (!strlen($substrs)) { |
|
50 | + continue; |
|
51 | + } |
|
52 | + $c++; |
|
53 | + $bullet = $tConf['bullet'] ? $tConf['bullet'] : ' - '; |
|
54 | + $bLen = strlen($bullet); |
|
55 | + $bullet = substr(str_replace('#', $c, $bullet), 0, $bLen); |
|
56 | + $secondRow = substr($tConf['secondRow'] ? $tConf['secondRow'] : str_pad('', strlen($bullet), ' '), 0, $bLen); |
|
57 | 57 | |
58 | - $lines[] = $bullet . $this->breakLines($substrs, chr(10) . $secondRow, Configuration::getPlainTextWith() - $bLen); |
|
58 | + $lines[] = $bullet . $this->breakLines($substrs, chr(10) . $secondRow, Configuration::getPlainTextWith() - $bLen); |
|
59 | 59 | |
60 | - $blanks = MathUtility::forceIntegerInRange($tConf['blanks'], 0, 1000); |
|
61 | - if ($blanks) { |
|
62 | - $lines[] = str_pad('', $blanks - 1, chr(10)); |
|
63 | - } |
|
64 | - } |
|
65 | - return implode(chr(10), $lines); |
|
66 | - } |
|
60 | + $blanks = MathUtility::forceIntegerInRange($tConf['blanks'], 0, 1000); |
|
61 | + if ($blanks) { |
|
62 | + $lines[] = str_pad('', $blanks - 1, chr(10)); |
|
63 | + } |
|
64 | + } |
|
65 | + return implode(chr(10), $lines); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $type = $contentObject->data['layout']; |
40 | 40 | $type = MathUtility::forceIntegerInRange($type, 0, 3); |
41 | 41 | |
42 | - $tConf = $this->configuration['bulletlist.'][$type . '.']; |
|
42 | + $tConf = $this->configuration['bulletlist.'][$type.'.']; |
|
43 | 43 | |
44 | 44 | $cParts = explode(chr(10), $str); |
45 | 45 | $lines = array(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $bullet = substr(str_replace('#', $c, $bullet), 0, $bLen); |
56 | 56 | $secondRow = substr($tConf['secondRow'] ? $tConf['secondRow'] : str_pad('', strlen($bullet), ' '), 0, $bLen); |
57 | 57 | |
58 | - $lines[] = $bullet . $this->breakLines($substrs, chr(10) . $secondRow, Configuration::getPlainTextWith() - $bLen); |
|
58 | + $lines[] = $bullet.$this->breakLines($substrs, chr(10).$secondRow, Configuration::getPlainTextWith() - $bLen); |
|
59 | 59 | |
60 | 60 | $blanks = MathUtility::forceIntegerInRange($tConf['blanks'], 0, 1000); |
61 | 61 | if ($blanks) { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Render the current content |
17 | 17 | * |
18 | - * @return array |
|
18 | + * @return string[] |
|
19 | 19 | */ |
20 | 20 | public function renderInternal() { |
21 | 21 |
@@ -12,15 +12,15 @@ |
||
12 | 12 | */ |
13 | 13 | class Text extends AbstractRendering { |
14 | 14 | |
15 | - /** |
|
16 | - * Render the current content |
|
17 | - * |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function renderInternal() { |
|
15 | + /** |
|
16 | + * Render the current content |
|
17 | + * |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function renderInternal() { |
|
21 | 21 | |
22 | - $lines[] = trim($this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext']))), CRLF . TAB); |
|
23 | - return $lines; |
|
22 | + $lines[] = trim($this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext']))), CRLF . TAB); |
|
23 | + return $lines; |
|
24 | 24 | |
25 | - } |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function renderInternal() { |
21 | 21 | |
22 | - $lines[] = trim($this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext']))), CRLF . TAB); |
|
22 | + $lines[] = trim($this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext']))), CRLF.TAB); |
|
23 | 23 | return $lines; |
24 | 24 | |
25 | 25 | } |
@@ -341,6 +341,10 @@ |
||
341 | 341 | return $file; |
342 | 342 | } |
343 | 343 | |
344 | + /** |
|
345 | + * @param string $class |
|
346 | + * @param string $ext |
|
347 | + */ |
|
344 | 348 | private function findFileWithExtension($class, $ext) |
345 | 349 | { |
346 | 350 | // PSR-4 lookup |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | private function findFileWithExtension($class, $ext) |
345 | 345 | { |
346 | 346 | // PSR-4 lookup |
347 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
347 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
348 | 348 | |
349 | 349 | $first = $class[0]; |
350 | 350 | if (isset($this->prefixLengthsPsr4[$first])) { |
351 | 351 | foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { |
352 | 352 | if (0 === strpos($class, $prefix)) { |
353 | 353 | foreach ($this->prefixDirsPsr4[$prefix] as $dir) { |
354 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { |
|
354 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) { |
|
355 | 355 | return $file; |
356 | 356 | } |
357 | 357 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | // PSR-4 fallback dirs |
363 | 363 | foreach ($this->fallbackDirsPsr4 as $dir) { |
364 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
364 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
365 | 365 | return $file; |
366 | 366 | } |
367 | 367 | } |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
374 | 374 | } else { |
375 | 375 | // PEAR-like class name |
376 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
376 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | if (isset($this->prefixesPsr0[$first])) { |
380 | 380 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
381 | 381 | if (0 === strpos($class, $prefix)) { |
382 | 382 | foreach ($dirs as $dir) { |
383 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
383 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
384 | 384 | return $file; |
385 | 385 | } |
386 | 386 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | // PSR-0 fallback dirs |
392 | 392 | foreach ($this->fallbackDirsPsr0 as $dir) { |
393 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
393 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
394 | 394 | return $file; |
395 | 395 | } |
396 | 396 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | * |
59 | 59 | * @throws SyntaxErrorException |
60 | 60 | * |
61 | - * @return array |
|
61 | + * @return integer[] |
|
62 | 62 | */ |
63 | 63 | public static function parseSeries(array $tokens) |
64 | 64 | { |
@@ -68,11 +68,11 @@ |
||
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - $joined = trim(implode('', array_map(function (Token $token) { |
|
71 | + $joined = trim(implode('', array_map(function(Token $token) { |
|
72 | 72 | return $token->getValue(); |
73 | 73 | }, $tokens))); |
74 | 74 | |
75 | - $int = function ($string) { |
|
75 | + $int = function($string) { |
|
76 | 76 | if (!is_numeric($string)) { |
77 | 77 | throw SyntaxErrorException::stringAsFunctionArgument(); |
78 | 78 | } |
@@ -89,7 +89,7 @@ |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
92 | - * @param array $values |
|
92 | + * @param string[] $values |
|
93 | 93 | * |
94 | 94 | * @return bool |
95 | 95 | */ |
@@ -66,7 +66,7 @@ |
||
66 | 66 | /** |
67 | 67 | * @param int $flag |
68 | 68 | * |
69 | - * @return bool |
|
69 | + * @return integer |
|
70 | 70 | */ |
71 | 71 | public function hasFlag($flag) |
72 | 72 | { |