@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | function doEval() { |
104 | - return eval('return ' . $this->toPHP() . ';'); |
|
104 | + return eval('return '.$this->toPHP().';'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | static function varToCode($var) { |
108 | 108 | if (is_array($var)) { |
109 | 109 | $code = array(); |
110 | 110 | foreach ($var as $key => $value) |
111 | - $code[] = self::varToCode($key) . "=>" . self::varToCode($value); |
|
112 | - return 'array(' . implode(",", $code) . ')'; //remove unnecessary coma |
|
111 | + $code[] = self::varToCode($key)."=>".self::varToCode($value); |
|
112 | + return 'array('.implode(",", $code).')'; //remove unnecessary coma |
|
113 | 113 | } elseif (is_bool($var)) { |
114 | 114 | return ($var ? 'TRUE' : 'FALSE'); |
115 | 115 | } elseif (is_int($var) || is_float($var) || is_numeric($var)) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } elseif ($var instanceof Text) { |
118 | 118 | return $var->toPHP(); |
119 | 119 | } else { |
120 | - return "'" . str_replace(array('$', "'"), array('\\$', "\\'"), $var) . "'"; |
|
120 | + return "'".str_replace(array('$', "'"), array('\\$', "\\'"), $var)."'"; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -44,13 +44,13 @@ |
||
44 | 44 | $as[$k] = substr($v, $indent); |
45 | 45 | $s = implode("\n", $as); |
46 | 46 | |
47 | - require_once ME_DIR . "/lib/phpsass/SassParser.php"; |
|
47 | + require_once ME_DIR."/lib/phpsass/SassParser.php"; |
|
48 | 48 | $sp = new SassParser(array("cache" => FALSE, |
49 | 49 | "style" => stdConf::get("me.developer") ? SassRenderer::STYLE_EXPANDED : SassRenderer::STYLE_COMPRESSED, |
50 | 50 | "syntax" => SassFile::SASS, 'debug' => TRUE)); |
51 | 51 | $tree = $sp->toTree($s); |
52 | 52 | $out = $tree->render(); |
53 | 53 | $pad = str_pad("", $indent, " "); |
54 | - return $pad . str_replace("\n", "\n$pad", trim($out)); |
|
54 | + return $pad.str_replace("\n", "\n$pad", trim($out)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | \ No newline at end of file |
@@ -39,8 +39,8 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | static function filterText($s) { |
42 | - return "/*<![CDATA[*/\n" . |
|
42 | + return "/*<![CDATA[*/\n". |
|
43 | 43 | /*preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text)*/ |
44 | - $s . "/*]]>*/"; |
|
44 | + $s."/*]]>*/"; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -42,7 +42,7 @@ |
||
42 | 42 | function renderContent($pad = "", $oneliner = false) { |
43 | 43 | if ($this->commentstyle == "HTML") |
44 | 44 | if (count($this->content) > 1) |
45 | - return $pad . " " . implode("\n$pad", $this->content) . "\n"; |
|
45 | + return $pad." ".implode("\n$pad", $this->content)."\n"; |
|
46 | 46 | else |
47 | 47 | return current($this->content); |
48 | 48 | return ""; |
@@ -42,22 +42,22 @@ discard block |
||
42 | 42 | function __construct($tag, $class = array(), $attr = array(), $id = "") { |
43 | 43 | parent::__construct(); |
44 | 44 | $this->opt = $attr; |
45 | - if(isset($attr['class']) && !is_array($attr['class'])) |
|
46 | - $this->opt['class'] = $attr['class']?explode(" ",$attr['class']):array(); |
|
45 | + if (isset($attr['class']) && !is_array($attr['class'])) |
|
46 | + $this->opt['class'] = $attr['class'] ? explode(" ", $attr['class']) : array(); |
|
47 | 47 | $this->source = array(); |
48 | 48 | $this->type = $tag ? $tag : "div"; |
49 | - if($class) { |
|
49 | + if ($class) { |
|
50 | 50 | if (isset($this->opt['class'])) |
51 | 51 | $this->opt['class'] = array_merge($this->opt['class'], $class); |
52 | 52 | else |
53 | 53 | $this->opt['class'] = $class; |
54 | 54 | } |
55 | - if($id) $this->opt['id'] = $id; |
|
55 | + if ($id) $this->opt['id'] = $id; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | function renderStTag() { |
59 | 59 | $close = in_array($this->type, self::$selfCloseTags) ? " />" : ">"; |
60 | - return "<{$this->type}" . $this->optToTags() . $close; |
|
60 | + return "<{$this->type}".$this->optToTags().$close; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | function renderEnTag() { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (!$v instanceof H\Text) |
80 | 80 | $v = new H\Text($v); |
81 | 81 | $k = new H\Text($k); |
82 | - $out[] = " " . $k->toHTML() . "=\"" . $v->toHTMLAtt() . "\""; |
|
82 | + $out[] = " ".$k->toHTML()."=\"".$v->toHTMLAtt()."\""; |
|
83 | 83 | } |
84 | 84 | return implode("", $out); |
85 | 85 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | foreach ($labelTags as $tag) |
62 | 62 | if ($tag instanceOf Html) |
63 | 63 | foreach ($tag->source as $source) { |
64 | - if(isset($fields[$source])) |
|
64 | + if (isset($fields[$source])) |
|
65 | 65 | $fields[$source]->getLabelAttStatic($tag->opt, $tag->type, $tag->content); |
66 | 66 | else |
67 | 67 | $tag->opt['style'] = "display:none;"; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | foreach ($inputTags as $tag) |
71 | 71 | if ($tag instanceOf Html) |
72 | 72 | foreach ($tag->source as $source) { |
73 | - if(isset($fields[$source])) |
|
73 | + if (isset($fields[$source])) |
|
74 | 74 | $fields[$source]->getHintAttStatic($tag->opt, $tag->type, $tag->content); |
75 | 75 | else |
76 | 76 | $tag->opt['style'] = "display:none;"; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | foreach ($inputTags as $tag) |
80 | 80 | if ($tag instanceOf Html) |
81 | 81 | foreach ($tag->source as $source) { |
82 | - if(isset($fields[$source])) { |
|
82 | + if (isset($fields[$source])) { |
|
83 | 83 | $fields[$source]->getInputAttStatic($tag->opt, $tag->type, $tag->content); |
84 | 84 | unset($fields[$source]); |
85 | 85 | } else |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | } |
88 | 88 | foreach ($fields as $n => $f) { |
89 | 89 | if (!$f instanceOf Button) { |
90 | - $this->addChild($label = new DynHtml("label", [],[],"",$n)); |
|
90 | + $this->addChild($label = new DynHtml("label", [], [], "", $n)); |
|
91 | 91 | $f->getLabelAttStatic($label->opt, $label->type, $label->content); |
92 | 92 | } |
93 | - $this->addChild($input = new DynHtml("input", [],[],"",$n)); |
|
93 | + $this->addChild($input = new DynHtml("input", [], [], "", $n)); |
|
94 | 94 | $f->getInputAttStatic($input->opt, $input->type, $input->content); |
95 | 95 | } |
96 | - return "<form " . implode(" ", $out) . "><?php \$form = " . $this->var->toPHP() . "; \$form->process(); ?>"; |
|
96 | + return "<form ".implode(" ", $out)."><?php \$form = ".$this->var->toPHP()."; \$form->process(); ?>"; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | function renderEnTag() { |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | $this->source[] = $ref; |
39 | 39 | $this->baseType = $tag; |
40 | 40 | self::$var++; |
41 | - $this->varname = "\$dynhtml" . self::$var; |
|
41 | + $this->varname = "\$dynhtml".self::$var; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | function render($indent = 0, $doIndent = true) { |
45 | 45 | $data = H\Text::varToCode(array("base" => $this->baseType, "type" => $this->type, "opt" => $this->opt, "source" => $this->source, "content" => $this->content)); |
46 | - $out = "<?php " . $this->varname . "=$data; echo Hamle\\Tag\\DynHtml::toStTag(" . $this->varname . ",\$form)."; |
|
47 | - $out .= "implode(\"\\n\"," . $this->varname . "['content'])."; |
|
48 | - $out .= "Hamle\\Tag\\DynHtml::toEnTag(" . $this->varname . ",\$form)?>\n"; |
|
46 | + $out = "<?php ".$this->varname."=$data; echo Hamle\\Tag\\DynHtml::toStTag(".$this->varname.",\$form)."; |
|
47 | + $out .= "implode(\"\\n\",".$this->varname."['content'])."; |
|
48 | + $out .= "Hamle\\Tag\\DynHtml::toEnTag(".$this->varname.",\$form)?>\n"; |
|
49 | 49 | return $out; |
50 | 50 | } |
51 | 51 | |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | foreach ($d["source"] as $source) { |
58 | 58 | $form->getField($source)->getDynamicAtt($d['base'], $d['opt'], $d['type'], $d['content']); |
59 | 59 | } |
60 | - $out = "<" . $d['type'] . " "; |
|
60 | + $out = "<".$d['type']." "; |
|
61 | 61 | foreach ($d['opt'] as $k => $v) { |
62 | 62 | if (is_array($v)) { |
63 | 63 | foreach ($v as $k2 => $v2) |
64 | - if ($v[$k2] instanceof Text) $v[$k2] = eval('return ' . $v[$k2]->toPHP() . ';'); |
|
64 | + if ($v[$k2] instanceof Text) $v[$k2] = eval('return '.$v[$k2]->toPHP().';'); |
|
65 | 65 | $v = implode(" ", $v); |
66 | 66 | } |
67 | - if ($v instanceOf H\Text) $v = eval('return ' . $v->toPHP() . ';'); |
|
68 | - $out .= $k . "=\"" . htmlspecialchars($v) . "\" "; |
|
67 | + if ($v instanceOf H\Text) $v = eval('return '.$v->toPHP().';'); |
|
68 | + $out .= $k."=\"".htmlspecialchars($v)."\" "; |
|
69 | 69 | } |
70 | 70 | $out .= in_array($d['type'], self::$selfCloseTags) ? "/>" : ">"; |
71 | 71 | return $out; |
72 | 72 | } |
73 | 73 | |
74 | 74 | static function toEnTag($d, $form) { |
75 | - return in_array($d['type'], self::$selfCloseTags) ? "" : "</" . $d['type'] . ">"; |
|
75 | + return in_array($d['type'], self::$selfCloseTags) ? "" : "</".$d['type'].">"; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function __construct($tag, $parentTag = null) { |
49 | 49 | parent::__construct(); |
50 | - $this->o = "\$o" . self::$instCount++; |
|
50 | + $this->o = "\$o".self::$instCount++; |
|
51 | 51 | $this->type = strtolower($tag); |
52 | 52 | $this->var = ""; |
53 | 53 | if ($parentTag && $this->type == "else") { |
54 | - if($parentTag instanceof H\Tag) { |
|
54 | + if ($parentTag instanceof H\Tag) { |
|
55 | 55 | $elseTag = $parentTag->tags[count($parentTag->tags) - 1]; |
56 | - if($elseTag instanceof H\Tag\Control && |
|
56 | + if ($elseTag instanceof H\Tag\Control && |
|
57 | 57 | in_array($elseTag->type, array('with', 'if')) |
58 | 58 | ) { |
59 | 59 | $elseTag->else = true; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | function renderStTag() { |
70 | - $out = "<" . "?php "; |
|
70 | + $out = "<"."?php "; |
|
71 | 71 | $scopeName = ""; |
72 | 72 | if (preg_match('/ as ([a-zA-Z]+)$/', $this->var, $m)) { |
73 | 73 | $scopeName = $m[1]; |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | switch ($this->type) { |
79 | 79 | case "each": |
80 | 80 | if ($this->var) |
81 | - $out .= "foreach(" . $hsv->toPHP() . " as {$this->o}) { \n"; |
|
81 | + $out .= "foreach(".$hsv->toPHP()." as {$this->o}) { \n"; |
|
82 | 82 | else |
83 | 83 | $out .= "foreach(Hamle\\Scope::get() as {$this->o}) { \n"; |
84 | 84 | $out .= "Hamle\\Scope::add({$this->o}); "; |
85 | 85 | break; |
86 | 86 | case "if": |
87 | 87 | $hsvcomp = new H\Text\Comparison($this->var); |
88 | - $out .= "if(" . $hsvcomp->toPHP() . ") {"; |
|
88 | + $out .= "if(".$hsvcomp->toPHP().") {"; |
|
89 | 89 | break; |
90 | 90 | case "with": |
91 | 91 | if ($scopeName) |
92 | - $out .= "Hamle\\Scope::add(" . $hsv->toPHP() . ", \"$scopeName\");\n;"; |
|
92 | + $out .= "Hamle\\Scope::add(".$hsv->toPHP().", \"$scopeName\");\n;"; |
|
93 | 93 | else { |
94 | - $out .= "if(({$this->o} = " . $hsv->toPHP() . ") && " . |
|
94 | + $out .= "if(({$this->o} = ".$hsv->toPHP().") && ". |
|
95 | 95 | "{$this->o}->valid()) {\n"; |
96 | 96 | $out .= "Hamle\\Scope::add({$this->o});\n;"; |
97 | 97 | } |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | break; |
102 | 102 | case "include": |
103 | 103 | $file = $hsv->toHTML(); |
104 | - if($file[0] == "#") |
|
104 | + if ($file[0] == "#") |
|
105 | 105 | $out .= "echo Hamle\\Run::includeFragment(".$hsv->toPHP().");"; |
106 | 106 | else |
107 | - $out .= "echo Hamle\\Run::includeFile(" . $hsv->toPHP() . ");"; |
|
107 | + $out .= "echo Hamle\\Run::includeFile(".$hsv->toPHP().");"; |
|
108 | 108 | break; |
109 | 109 | } |
110 | - return $out . ' ?>'; |
|
110 | + return $out.' ?>'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | function renderEnTag() { |
121 | - $out = '<' . '?php '; |
|
121 | + $out = '<'.'?php '; |
|
122 | 122 | switch ($this->type) { |
123 | 123 | case "each"; |
124 | 124 | $out .= 'Hamle\\Scope::done(); '; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | break; |
142 | 142 | } |
143 | 143 | if ($this->else) $out .= "else{"; |
144 | - return $out . ' ?>'; |
|
144 | + return $out.' ?>'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | function render($indent = 0, $doIndent = true) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | function __construct($s) { |
45 | 45 | $m = array(); |
46 | - if (!preg_match('/^\$\((' . self::REGEX_FUNCSEL . '*)(.*)\)$/', $s, $m)) |
|
46 | + if (!preg_match('/^\$\(('.self::REGEX_FUNCSEL.'*)(.*)\)$/', $s, $m)) |
|
47 | 47 | throw new ParseError("Unable to read \$ func in '$s'"); |
48 | 48 | if (trim($m[2])) |
49 | 49 | $this->sub = new FuncSub($m[2]); |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | } |
87 | 87 | $rand = false; |
88 | 88 | if (preg_match_all('/\\^(-?)([a-zA-Z0-9\_]*)/', $s, $m)) { |
89 | - foreach($m[0] as $k=>$mv) |
|
89 | + foreach ($m[0] as $k=>$mv) |
|
90 | 90 | if ($m[2][$k]) { |
91 | - $dir = $m[1][$k] == "-"?Hamle\Hamle::SORT_DESCENDING:Hamle\Hamle::SORT_ASCENDING; |
|
91 | + $dir = $m[1][$k] == "-" ? Hamle\Hamle::SORT_DESCENDING : Hamle\Hamle::SORT_ASCENDING; |
|
92 | 92 | $att['sort'][$m[2][$k]] = $dir; |
93 | 93 | } else $rand = true; |
94 | 94 | } |
95 | - if($rand) |
|
95 | + if ($rand) |
|
96 | 96 | $att['sort'] = [""=>$att['dir'] = Hamle\Hamle::SORT_RANDOM]; |
97 | 97 | return $att; |
98 | 98 | } |
@@ -110,25 +110,25 @@ discard block |
||
110 | 110 | * @return string PHP Code |
111 | 111 | */ |
112 | 112 | function toPHP() { |
113 | - $sub = $this->sub ? "->" . $this->sub->toPHP() : ""; |
|
114 | - if($this->scope instanceof Scope) { |
|
115 | - return $this->scope->toPHP() . $sub; |
|
116 | - } elseif($this->scope === true) { |
|
113 | + $sub = $this->sub ? "->".$this->sub->toPHP() : ""; |
|
114 | + if ($this->scope instanceof Scope) { |
|
115 | + return $this->scope->toPHP().$sub; |
|
116 | + } elseif ($this->scope === true) { |
|
117 | 117 | return "Hamle\\Scope::get(0)$sub"; |
118 | 118 | } |
119 | - $limit = Text::varToCode($this->sortlimit['sort']) . "," . |
|
120 | - $this->sortlimit['limit'] . "," . $this->sortlimit['offset']; |
|
119 | + $limit = Text::varToCode($this->sortlimit['sort']).",". |
|
120 | + $this->sortlimit['limit'].",".$this->sortlimit['offset']; |
|
121 | 121 | if (count($this->filt['tag'])) |
122 | - return "Hamle\\Run::modelTypeTags(" . |
|
123 | - Text::varToCode($this->filt['tag']) . ",$limit)$sub"; |
|
122 | + return "Hamle\\Run::modelTypeTags(". |
|
123 | + Text::varToCode($this->filt['tag']).",$limit)$sub"; |
|
124 | 124 | if (count($this->filt['id'])) |
125 | 125 | if (isset($this->filt['id']['*']) && count($this->filt['id']['*']) == 1) |
126 | - return "Hamle\\Run::modelId(" . |
|
127 | - Text::varToCode(current($this->filt['id']['*'])) . |
|
126 | + return "Hamle\\Run::modelId(". |
|
127 | + Text::varToCode(current($this->filt['id']['*'])). |
|
128 | 128 | ",$limit)$sub"; |
129 | 129 | else |
130 | - return "Hamle\\Run::modelTypeId(" . |
|
131 | - Text::varToCode($this->filt['id']) . ",$limit)$sub"; |
|
130 | + return "Hamle\\Run::modelTypeId(". |
|
131 | + Text::varToCode($this->filt['id']).",$limit)$sub"; |
|
132 | 132 | return ""; |
133 | 133 | } |
134 | 134 |