Continued a bit:

- converted some else if to elseif (only PHP)
- converted some space -> tab (intending)

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-27 11:58:40 +01:00 committed by Roland Haeder
parent c2d8738285
commit d9c22c7f3e
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
6 changed files with 42 additions and 30 deletions

View file

@ -53,8 +53,9 @@ class Template implements ITemplateEngine {
private function _get_var($name, $retNoKey = false) { private function _get_var($name, $retNoKey = false) {
$keys = array_map('trim', explode(".", $name)); $keys = array_map('trim', explode(".", $name));
if ($retNoKey && !array_key_exists($keys[0], $this->r)) if ($retNoKey && !array_key_exists($keys[0], $this->r)) {
return KEY_NOT_EXISTS; return KEY_NOT_EXISTS;
}
$val = $this->r; $val = $this->r;
foreach ($keys as $k) { foreach ($keys as $k) {
$val = (isset($val[$k]) ? $val[$k] : null); $val = (isset($val[$k]) ? $val[$k] : null);
@ -73,14 +74,16 @@ class Template implements ITemplateEngine {
if (strpos($args[2], "==") > 0) { if (strpos($args[2], "==") > 0) {
list($a, $b) = array_map("trim", explode("==", $args[2])); list($a, $b) = array_map("trim", explode("==", $args[2]));
$a = $this->_get_var($a); $a = $this->_get_var($a);
if ($b[0] == "$") if ($b[0] == "$") {
$b = $this->_get_var($b); $b = $this->_get_var($b);
}
$val = ($a == $b); $val = ($a == $b);
} elseif (strpos($args[2], "!=") > 0) { } elseif (strpos($args[2], "!=") > 0) {
list($a, $b) = array_map("trim", explode("!=", $args[2])); list($a, $b) = array_map("trim", explode("!=", $args[2]));
$a = $this->_get_var($a); $a = $this->_get_var($a);
if ($b[0] == "$") if ($b[0] == "$") {
$b = $this->_get_var($b); $b = $this->_get_var($b);
}
$val = ($a != $b); $val = ($a != $b);
} else { } else {
$val = $this->_get_var($args[2]); $val = $this->_get_var($args[2]);
@ -138,8 +141,9 @@ class Template implements ITemplateEngine {
$newctx = null; $newctx = null;
} }
if ($tplfile[0] == "$") if ($tplfile[0] == "$") {
$tplfile = $this->_get_var($tplfile); $tplfile = $this->_get_var($tplfile);
}
$this->_push_stack(); $this->_push_stack();
$r = $this->r; $r = $this->r;

View file

@ -5,22 +5,29 @@ function duepuntozero_init(App $a) {
set_template_engine($a, 'smarty3'); set_template_engine($a, 'smarty3');
$colorset = get_pconfig( local_user(), 'duepuntozero','colorset'); $colorset = get_pconfig( local_user(), 'duepuntozero','colorset');
if (!$colorset) if (!$colorset) {
$colorset = get_config('duepuntozero', 'colorset'); // user setting have priority, then node settings $colorset = get_config('duepuntozero', 'colorset'); // user setting have priority, then node settings
}
if ($colorset) { if ($colorset) {
if ($colorset == 'greenzero') if ($colorset == 'greenzero') {
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'purplezero') }
if ($colorset == 'purplezero') {
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'easterbunny') }
if ($colorset == 'easterbunny') {
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'darkzero') }
if ($colorset == 'darkzero') {
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'comix') }
if ($colorset == 'comix') {
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'slackr') }
if ($colorset == 'slackr') {
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
} }
}
$a->page['htmlhead'] .= <<< EOT $a->page['htmlhead'] .= <<< EOT
<script> <script>
function insertFormatting(BBcode, id) { function insertFormatting(BBcode, id) {

View file

@ -9,6 +9,7 @@
/** /**
* A color utility that helps manipulate HEX colors * A color utility that helps manipulate HEX colors
* @todo convert space -> tab
*/ */
class Color { class Color {