@@ -16,24 +16,24 @@ |
||
16 | 16 | */ |
17 | 17 | class TypoScriptFrontend { |
18 | 18 | |
19 | - /** |
|
20 | - * Call the end of rendering hook |
|
21 | - * |
|
22 | - * @hook TYPO3_CONF_VARS|SC_OPTIONS|tslib/class.tslib_fe.php|hook_eofe |
|
23 | - * |
|
24 | - * @param array $params |
|
25 | - * @param TypoScriptFrontendController $obj |
|
26 | - */ |
|
27 | - public function endOfRendering(array $params, TypoScriptFrontendController $obj) { |
|
28 | - if (!isset($obj->config['config']['newsletterPostprocessing.']) || !is_array($obj->config['config']['newsletterPostprocessing.'])) { |
|
29 | - return; |
|
30 | - } |
|
19 | + /** |
|
20 | + * Call the end of rendering hook |
|
21 | + * |
|
22 | + * @hook TYPO3_CONF_VARS|SC_OPTIONS|tslib/class.tslib_fe.php|hook_eofe |
|
23 | + * |
|
24 | + * @param array $params |
|
25 | + * @param TypoScriptFrontendController $obj |
|
26 | + */ |
|
27 | + public function endOfRendering(array $params, TypoScriptFrontendController $obj) { |
|
28 | + if (!isset($obj->config['config']['newsletterPostprocessing.']) || !is_array($obj->config['config']['newsletterPostprocessing.'])) { |
|
29 | + return; |
|
30 | + } |
|
31 | 31 | |
32 | - foreach ($obj->config['config']['newsletterPostprocessing.'] as $postprocessorClass) { |
|
33 | - /** @var PostprocessingInterface $processor */ |
|
34 | - $processor = GeneralUtility::makeInstance($postprocessorClass); |
|
35 | - $obj->content = $processor->process($obj->content); |
|
36 | - } |
|
37 | - } |
|
32 | + foreach ($obj->config['config']['newsletterPostprocessing.'] as $postprocessorClass) { |
|
33 | + /** @var PostprocessingInterface $processor */ |
|
34 | + $processor = GeneralUtility::makeInstance($postprocessorClass); |
|
35 | + $obj->content = $processor->process($obj->content); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | 39 | } |
@@ -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 | } |
@@ -16,106 +16,106 @@ |
||
16 | 16 | */ |
17 | 17 | abstract class AbstractRendering implements RenderingInterface { |
18 | 18 | |
19 | - /** |
|
20 | - * Content object |
|
21 | - * |
|
22 | - * @var ContentObjectRenderer |
|
23 | - */ |
|
24 | - protected $contentObject; |
|
19 | + /** |
|
20 | + * Content object |
|
21 | + * |
|
22 | + * @var ContentObjectRenderer |
|
23 | + */ |
|
24 | + protected $contentObject; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Configuration |
|
28 | - * |
|
29 | - * @var array |
|
30 | - */ |
|
31 | - protected $configuration; |
|
26 | + /** |
|
27 | + * Configuration |
|
28 | + * |
|
29 | + * @var array |
|
30 | + */ |
|
31 | + protected $configuration; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Set the content object and configuration |
|
35 | - * Call the renderInternal after preparation |
|
36 | - * |
|
37 | - * @param ContentObjectRenderer $contentObject |
|
38 | - * @param array $configuration |
|
39 | - * |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function render($contentObject, $configuration) { |
|
43 | - $this->contentObject = $contentObject; |
|
44 | - $this->configuration = $configuration; |
|
45 | - return $this->renderInternal(); |
|
46 | - } |
|
33 | + /** |
|
34 | + * Set the content object and configuration |
|
35 | + * Call the renderInternal after preparation |
|
36 | + * |
|
37 | + * @param ContentObjectRenderer $contentObject |
|
38 | + * @param array $configuration |
|
39 | + * |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function render($contentObject, $configuration) { |
|
43 | + $this->contentObject = $contentObject; |
|
44 | + $this->configuration = $configuration; |
|
45 | + return $this->renderInternal(); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Parsing the bodytext field content, removing typical entities and <br /> tags. |
|
50 | - * |
|
51 | - * @param string $str : Field content from "bodytext" or other text field |
|
52 | - * @param string $altConf : Altername conf name (especially when bodyext field in other table then tt_content) |
|
53 | - * |
|
54 | - * @return string Processed content |
|
55 | - */ |
|
56 | - function parseBody($str, $altConf = 'bodytext') { |
|
57 | - if ($this->configuration[$altConf . '.']['doubleLF']) { |
|
58 | - $str = preg_replace("/\n/", "\n\n", $str); |
|
59 | - } |
|
60 | - // Regular parsing: |
|
61 | - $str = preg_replace('/<br\s*\/?>/i', chr(10), $str); |
|
62 | - $str = $this->contentObject->stdWrap($str, $this->configuration[$altConf . '.']['stdWrap.']); |
|
48 | + /** |
|
49 | + * Parsing the bodytext field content, removing typical entities and <br /> tags. |
|
50 | + * |
|
51 | + * @param string $str : Field content from "bodytext" or other text field |
|
52 | + * @param string $altConf : Altername conf name (especially when bodyext field in other table then tt_content) |
|
53 | + * |
|
54 | + * @return string Processed content |
|
55 | + */ |
|
56 | + function parseBody($str, $altConf = 'bodytext') { |
|
57 | + if ($this->configuration[$altConf . '.']['doubleLF']) { |
|
58 | + $str = preg_replace("/\n/", "\n\n", $str); |
|
59 | + } |
|
60 | + // Regular parsing: |
|
61 | + $str = preg_replace('/<br\s*\/?>/i', chr(10), $str); |
|
62 | + $str = $this->contentObject->stdWrap($str, $this->configuration[$altConf . '.']['stdWrap.']); |
|
63 | 63 | |
64 | - // Then all a-tags: |
|
65 | - $aConf = array(); |
|
66 | - $aConf['parseFunc.']['tags.']['a'] = 'USER'; |
|
67 | - // check direct mail usage @todo |
|
68 | - $aConf['parseFunc.']['tags.']['a.']['userFunc'] = 'FRUIT\\Ink\\PlainRenderer->atag_to_http'; |
|
69 | - $aConf['parseFunc.']['tags.']['a.']['siteUrl'] = 'http://www.google.de'; |
|
70 | - $str = $this->contentObject->stdWrap($str, $aConf); |
|
71 | - $str = str_replace(' ', ' ', htmlspecialchars_decode($str)); |
|
64 | + // Then all a-tags: |
|
65 | + $aConf = array(); |
|
66 | + $aConf['parseFunc.']['tags.']['a'] = 'USER'; |
|
67 | + // check direct mail usage @todo |
|
68 | + $aConf['parseFunc.']['tags.']['a.']['userFunc'] = 'FRUIT\\Ink\\PlainRenderer->atag_to_http'; |
|
69 | + $aConf['parseFunc.']['tags.']['a.']['siteUrl'] = 'http://www.google.de'; |
|
70 | + $str = $this->contentObject->stdWrap($str, $aConf); |
|
71 | + $str = str_replace(' ', ' ', htmlspecialchars_decode($str)); |
|
72 | 72 | |
73 | - if ($this->configuration[$altConf . '.']['header']) { |
|
74 | - $str = $this->configuration[$altConf . '.']['header'] . LF . $str; |
|
75 | - } |
|
73 | + if ($this->configuration[$altConf . '.']['header']) { |
|
74 | + $str = $this->configuration[$altConf . '.']['header'] . LF . $str; |
|
75 | + } |
|
76 | 76 | |
77 | - return chr(10) . $str; |
|
78 | - } |
|
77 | + return chr(10) . $str; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Function used to wrap the bodytext field content (or image caption) into lines of a max length of |
|
82 | - * |
|
83 | - * @param string $str : The content to break |
|
84 | - * |
|
85 | - * @return string Processed value. |
|
86 | - * @see main_plaintext(), breakLines() |
|
87 | - */ |
|
88 | - function breakContent($str) { |
|
89 | - $cParts = explode(chr(10), $str); |
|
90 | - $lines = array(); |
|
91 | - foreach ($cParts as $substrs) { |
|
92 | - $lines[] = $this->breakLines($substrs, LF); |
|
93 | - } |
|
94 | - return implode(chr(10), $lines); |
|
95 | - } |
|
80 | + /** |
|
81 | + * Function used to wrap the bodytext field content (or image caption) into lines of a max length of |
|
82 | + * |
|
83 | + * @param string $str : The content to break |
|
84 | + * |
|
85 | + * @return string Processed value. |
|
86 | + * @see main_plaintext(), breakLines() |
|
87 | + */ |
|
88 | + function breakContent($str) { |
|
89 | + $cParts = explode(chr(10), $str); |
|
90 | + $lines = array(); |
|
91 | + foreach ($cParts as $substrs) { |
|
92 | + $lines[] = $this->breakLines($substrs, LF); |
|
93 | + } |
|
94 | + return implode(chr(10), $lines); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Returns a typolink URL based on input. |
|
99 | - * |
|
100 | - * @param string $ll : Parameter to typolink |
|
101 | - * |
|
102 | - * @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already |
|
103 | - */ |
|
104 | - function getLink($ll) { |
|
105 | - return $this->contentObject->getTypoLink_URL($ll); |
|
106 | - } |
|
97 | + /** |
|
98 | + * Returns a typolink URL based on input. |
|
99 | + * |
|
100 | + * @param string $ll : Parameter to typolink |
|
101 | + * |
|
102 | + * @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already |
|
103 | + */ |
|
104 | + function getLink($ll) { |
|
105 | + return $this->contentObject->getTypoLink_URL($ll); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Breaking lines into fixed length lines, using GeneralUtility::breakLinesForEmail() |
|
110 | - * |
|
111 | - * @param string $str : The string to break |
|
112 | - * @param string $implChar : Line break character |
|
113 | - * @param integer $charWidth : Length of lines, default is $this->charWidth |
|
114 | - * |
|
115 | - * @return string Processed string |
|
116 | - */ |
|
117 | - function breakLines($str, $implChar = LF, $charWidth = FALSE) { |
|
118 | - $charWidth = $charWidth === FALSE ? Configuration::getPlainTextWith() : (int)$charWidth; |
|
119 | - return MailUtility::breakLinesForEmail($str, $implChar, $charWidth); |
|
120 | - } |
|
108 | + /** |
|
109 | + * Breaking lines into fixed length lines, using GeneralUtility::breakLinesForEmail() |
|
110 | + * |
|
111 | + * @param string $str : The string to break |
|
112 | + * @param string $implChar : Line break character |
|
113 | + * @param integer $charWidth : Length of lines, default is $this->charWidth |
|
114 | + * |
|
115 | + * @return string Processed string |
|
116 | + */ |
|
117 | + function breakLines($str, $implChar = LF, $charWidth = FALSE) { |
|
118 | + $charWidth = $charWidth === FALSE ? Configuration::getPlainTextWith() : (int)$charWidth; |
|
119 | + return MailUtility::breakLinesForEmail($str, $implChar, $charWidth); |
|
120 | + } |
|
121 | 121 | } |
122 | 122 | \ No newline at end of file |
@@ -15,24 +15,24 @@ |
||
15 | 15 | */ |
16 | 16 | class Templavoila extends AbstractRendering { |
17 | 17 | |
18 | - /** |
|
19 | - * Render the given element |
|
20 | - * |
|
21 | - * @return array |
|
22 | - */ |
|
23 | - public function renderInternal() { |
|
18 | + /** |
|
19 | + * Render the given element |
|
20 | + * |
|
21 | + * @return array |
|
22 | + */ |
|
23 | + public function renderInternal() { |
|
24 | 24 | |
25 | - // TV nicht geladen |
|
26 | - if (!ExtensionManagementUtility::isLoaded('templavoila')) { |
|
27 | - $defaultOutput = $this->configuration['defaultOutput']; |
|
28 | - if ($defaultOutput) { |
|
29 | - $defaultOutput = str_replace('###CType###', $this->contentObject->data['CType'], $defaultOutput); |
|
30 | - } |
|
31 | - return $defaultOutput; |
|
32 | - } |
|
33 | - $pi1 = GeneralUtility::makeInstance('tx_templavoila_pi1'); |
|
34 | - $pi1->cObj = $this->contentObject; |
|
35 | - $lines[] = $pi1->renderElement($this->contentObject->data, 'tt_content'); |
|
36 | - return $lines; |
|
37 | - } |
|
25 | + // TV nicht geladen |
|
26 | + if (!ExtensionManagementUtility::isLoaded('templavoila')) { |
|
27 | + $defaultOutput = $this->configuration['defaultOutput']; |
|
28 | + if ($defaultOutput) { |
|
29 | + $defaultOutput = str_replace('###CType###', $this->contentObject->data['CType'], $defaultOutput); |
|
30 | + } |
|
31 | + return $defaultOutput; |
|
32 | + } |
|
33 | + $pi1 = GeneralUtility::makeInstance('tx_templavoila_pi1'); |
|
34 | + $pi1->cObj = $this->contentObject; |
|
35 | + $lines[] = $pi1->renderElement($this->contentObject->data, 'tt_content'); |
|
36 | + return $lines; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -12,12 +12,12 @@ |
||
12 | 12 | */ |
13 | 13 | class Html extends AbstractRendering { |
14 | 14 | |
15 | - /** |
|
16 | - * Get the liens for the current HTML element |
|
17 | - * |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function renderInternal() { |
|
21 | - return array($this->breakContent(strip_tags($this->contentObject->data['bodytext']))); |
|
22 | - } |
|
15 | + /** |
|
16 | + * Get the liens for the current HTML element |
|
17 | + * |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function renderInternal() { |
|
21 | + return array($this->breakContent(strip_tags($this->contentObject->data['bodytext']))); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -12,22 +12,22 @@ |
||
12 | 12 | */ |
13 | 13 | class TextPicture extends AbstractRendering { |
14 | 14 | |
15 | - /** |
|
16 | - * Render the given element |
|
17 | - * |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function renderInternal() { |
|
21 | - $image = new Image(); |
|
22 | - if (!($this->contentObject->data['imageorient'] & 24)) { |
|
23 | - $lines = $image->render($this->contentObject, $this->configuration); |
|
24 | - $lines[] = ''; |
|
25 | - } |
|
26 | - $lines[] = $this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext']))); |
|
27 | - if ($this->contentObject->data['imageorient'] & 24) { |
|
28 | - $lines[] = ''; |
|
29 | - $lines = array_merge($lines, $image->render($this->contentObject, $this->configuration)); |
|
30 | - } |
|
31 | - return $lines; |
|
32 | - } |
|
15 | + /** |
|
16 | + * Render the given element |
|
17 | + * |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function renderInternal() { |
|
21 | + $image = new Image(); |
|
22 | + if (!($this->contentObject->data['imageorient'] & 24)) { |
|
23 | + $lines = $image->render($this->contentObject, $this->configuration); |
|
24 | + $lines[] = ''; |
|
25 | + } |
|
26 | + $lines[] = $this->breakContent(strip_tags($this->parseBody($this->contentObject->data['bodytext']))); |
|
27 | + if ($this->contentObject->data['imageorient'] & 24) { |
|
28 | + $lines[] = ''; |
|
29 | + $lines = array_merge($lines, $image->render($this->contentObject, $this->configuration)); |
|
30 | + } |
|
31 | + return $lines; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -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 |
@@ -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 |
@@ -12,48 +12,48 @@ |
||
12 | 12 | */ |
13 | 13 | class Plugin extends AbstractRendering { |
14 | 14 | |
15 | - /** |
|
16 | - * Render the given element |
|
17 | - * |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function renderInternal() { |
|
21 | - $lines = array(); |
|
22 | - $lines[] = 'Test'; |
|
23 | - $myName = FALSE; |
|
24 | - $listType = $this->contentObject->data['list_type']; |
|
25 | - $template = $GLOBALS['TSFE']->tmpl; |
|
15 | + /** |
|
16 | + * Render the given element |
|
17 | + * |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function renderInternal() { |
|
21 | + $lines = array(); |
|
22 | + $lines[] = 'Test'; |
|
23 | + $myName = FALSE; |
|
24 | + $listType = $this->contentObject->data['list_type']; |
|
25 | + $template = $GLOBALS['TSFE']->tmpl; |
|
26 | 26 | |
27 | - if (isset($template->setup['tt_content.']['list.']['20.'][$listType])) { |
|
28 | - $theValue = $template->setup['tt_content.']['list.']['20.'][$listType]; |
|
29 | - $theConf = $template->setup['tt_content.']['list.']['20.'][$listType . '.']; |
|
30 | - } else { |
|
31 | - $tmp = explode('_pi', $listType); |
|
32 | - if (count($tmp) < 2) { |
|
33 | - $myName = 'tx_' . str_replace('_', '', $tmp[0]); |
|
34 | - } else { |
|
35 | - $myName = 'tx_' . str_replace('_', '', $tmp[0]) . '_pi' . $tmp[1]; |
|
36 | - } |
|
37 | - $theValue = $template->setup['plugin.'][$myName]; |
|
38 | - $theConf = $template->setup['plugin.'][$myName . '.']; |
|
39 | - } |
|
40 | - $content = $this->contentObject->cObjGetSingle($theValue, $theConf); |
|
27 | + if (isset($template->setup['tt_content.']['list.']['20.'][$listType])) { |
|
28 | + $theValue = $template->setup['tt_content.']['list.']['20.'][$listType]; |
|
29 | + $theConf = $template->setup['tt_content.']['list.']['20.'][$listType . '.']; |
|
30 | + } else { |
|
31 | + $tmp = explode('_pi', $listType); |
|
32 | + if (count($tmp) < 2) { |
|
33 | + $myName = 'tx_' . str_replace('_', '', $tmp[0]); |
|
34 | + } else { |
|
35 | + $myName = 'tx_' . str_replace('_', '', $tmp[0]) . '_pi' . $tmp[1]; |
|
36 | + } |
|
37 | + $theValue = $template->setup['plugin.'][$myName]; |
|
38 | + $theConf = $template->setup['plugin.'][$myName . '.']; |
|
39 | + } |
|
40 | + $content = $this->contentObject->cObjGetSingle($theValue, $theConf); |
|
41 | 41 | |
42 | - $myContent = $this->breakContent(strip_tags($content)); |
|
43 | - if (strlen($myContent) > 1) { |
|
44 | - if (substr($myContent, 0, 1) == '|' && substr($myContent, -1) == '|') { |
|
45 | - $myContent = substr($myContent, 1, strlen($myContent) - 2); |
|
46 | - } |
|
47 | - } |
|
42 | + $myContent = $this->breakContent(strip_tags($content)); |
|
43 | + if (strlen($myContent) > 1) { |
|
44 | + if (substr($myContent, 0, 1) == '|' && substr($myContent, -1) == '|') { |
|
45 | + $myContent = substr($myContent, 1, strlen($myContent) - 2); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - if (!is_array($theConf) || strlen($theConf['plainType']) < 2) { |
|
50 | - $defaultOutput = $this->configuration['defaultOutput']; |
|
51 | - if ($defaultOutput && $myName) { |
|
52 | - $lines[] = str_replace('###CType###', $this->contentObject->data['CType'] . ': "' . $this->contentObject->data['list_type'] . '"; plugin: "' . $myName . '"; plainType: "' . (is_array($theConf) ? $theConf['plainType'] : '') . '"', $defaultOutput); |
|
53 | - } |
|
54 | - } |
|
49 | + if (!is_array($theConf) || strlen($theConf['plainType']) < 2) { |
|
50 | + $defaultOutput = $this->configuration['defaultOutput']; |
|
51 | + if ($defaultOutput && $myName) { |
|
52 | + $lines[] = str_replace('###CType###', $this->contentObject->data['CType'] . ': "' . $this->contentObject->data['list_type'] . '"; plugin: "' . $myName . '"; plainType: "' . (is_array($theConf) ? $theConf['plainType'] : '') . '"', $defaultOutput); |
|
53 | + } |
|
54 | + } |
|
55 | 55 | |
56 | - $lines[] = $myContent; |
|
57 | - return $lines; |
|
58 | - } |
|
56 | + $lines[] = $myContent; |
|
57 | + return $lines; |
|
58 | + } |
|
59 | 59 | } |
60 | 60 | \ No newline at end of file |