|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Render a plugin |
|
4
|
|
|
* |
|
5
|
|
|
* @author Tim Lochmüller |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace FRUIT\Ink\Rendering; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Render a plugin |
|
12
|
|
|
*/ |
|
13
|
|
|
class Plugin extends AbstractRendering |
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Render the given element |
|
18
|
|
|
* |
|
19
|
|
|
* @return array |
|
20
|
|
|
*/ |
|
21
|
|
|
public function renderInternal() |
|
22
|
|
|
{ |
|
23
|
|
|
$lines = array(); |
|
24
|
|
|
$lines[] = 'Test'; |
|
25
|
|
|
$myName = false; |
|
26
|
|
|
$listType = $this->contentObject->data['list_type']; |
|
27
|
|
|
$template = $GLOBALS['TSFE']->tmpl; |
|
28
|
|
|
|
|
29
|
|
|
if (isset($template->setup['tt_content.']['list.']['20.'][$listType])) { |
|
30
|
|
|
$theValue = $template->setup['tt_content.']['list.']['20.'][$listType]; |
|
31
|
|
|
$theConf = $template->setup['tt_content.']['list.']['20.'][$listType . '.']; |
|
32
|
|
|
} else { |
|
33
|
|
|
$tmp = explode('_pi', $listType); |
|
34
|
|
|
if (count($tmp) < 2) { |
|
35
|
|
|
$myName = 'tx_' . str_replace('_', '', $tmp[0]); |
|
36
|
|
|
} else { |
|
37
|
|
|
$myName = 'tx_' . str_replace('_', '', $tmp[0]) . '_pi' . $tmp[1]; |
|
38
|
|
|
} |
|
39
|
|
|
$theValue = $template->setup['plugin.'][$myName]; |
|
40
|
|
|
$theConf = $template->setup['plugin.'][$myName . '.']; |
|
41
|
|
|
} |
|
42
|
|
|
$content = $this->contentObject->cObjGetSingle($theValue, $theConf); |
|
43
|
|
|
|
|
44
|
|
|
$myContent = $this->breakContent(strip_tags($content)); |
|
45
|
|
|
if (strlen($myContent) > 1) { |
|
46
|
|
|
if (substr($myContent, 0, 1) == '|' && substr($myContent, -1) == '|') { |
|
47
|
|
|
$myContent = substr($myContent, 1, strlen($myContent) - 2); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
if (!is_array($theConf) || strlen($theConf['plainType']) < 2) { |
|
52
|
|
|
$defaultOutput = $this->configuration['defaultOutput']; |
|
53
|
|
|
if ($defaultOutput && $myName) { |
|
|
|
|
|
|
54
|
|
|
$lines[] = str_replace('###CType###', $this->contentObject->data['CType'] . ': "' . $this->contentObject->data['list_type'] . '"; plugin: "' . $myName . '"; plainType: "' . (is_array($theConf) ? $theConf['plainType'] : '') . '"', $defaultOutput); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$lines[] = $myContent; |
|
59
|
|
|
return $lines; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: