1 <?php
2
3 4 5 6 7
8 class rex_var_value extends rex_var
9 {
10 protected function getOutput()
11 {
12 $id = $this->getArg('id', 0, true);
13 if (!in_array($this->getContext(), ['module', 'action']) || !is_numeric($id) || $id < 1 || $id > 20) {
14 return false;
15 }
16
17 $value = $this->getContextData()->getValue('value' . $id);
18
19 if ($this->hasArg('isset') && $this->getArg('isset')) {
20 return $value ? 'true' : 'false';
21 }
22
23 $output = $this->getArg('output');
24 if ($output == 'php') {
25 if ($this->environmentIs(self::ENV_BACKEND)) {
26 $value = rex_string::highlight($value);
27 } else {
28 return 'rex_var::nothing(require rex_stream::factory(substr(__FILE__, 6) . \'/REX_VALUE/' . $id . '\', ' . self::quote($value) . '))';
29 }
30 } elseif ($output == 'html') {
31 $value = str_replace(['<?', '?>'], ['<?', '?>'], $value);
32 } else {
33 $value = rex_escape($value);
34 if (!$this->environmentIs(self::ENV_INPUT)) {
35 $value = nl2br($value);
36 }
37 }
38
39 return self::quote($value);
40 }
41 }
42