@@ -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 ""; |
@@ -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) { |
@@ -33,25 +33,25 @@ |
||
33 | 33 | protected $filter; |
34 | 34 | |
35 | 35 | function __construct($s) { |
36 | - if(FALSE !== $pos = strpos($s,'|')) { |
|
37 | - $this->var = substr($s,1,$pos-1); |
|
38 | - $this->filter = new Filter(substr($s, $pos+1), $this); |
|
36 | + if (FALSE !== $pos = strpos($s, '|')) { |
|
37 | + $this->var = substr($s, 1, $pos - 1); |
|
38 | + $this->filter = new Filter(substr($s, $pos + 1), $this); |
|
39 | 39 | } else { |
40 | 40 | $this->var = substr($s, 1); |
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | function toHTML($escape = false) { |
45 | - if($escape) |
|
46 | - return "<?=htmlspecialchars(" .$this->toPHP() . ")?>"; |
|
47 | - return "<?=" . $this->toPHP() . "?>"; |
|
45 | + if ($escape) |
|
46 | + return "<?=htmlspecialchars(".$this->toPHP().")?>"; |
|
47 | + return "<?=".$this->toPHP()."?>"; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | function toPHP() { |
51 | - return $this->filter?$this->filter->toPHP():$this->toPHPVar(); |
|
51 | + return $this->filter ? $this->filter->toPHP() : $this->toPHPVar(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | function toPHPVar() { |
55 | - return "Hamle\\Scope::get()->hamleGet(" . Text::varToCode($this->var) . ")"; |
|
55 | + return "Hamle\\Scope::get()->hamleGet(".Text::varToCode($this->var).")"; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | |
36 | 36 | function __construct($s, $mode = self::TOKEN_CONTROL) { |
37 | 37 | $m = array(); |
38 | - if(preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) { |
|
39 | - $this->param1 = new Text($m[1],Text::TOKEN_HTML); |
|
40 | - $this->param2 = new Text($m[3],Text::TOKEN_HTML); |
|
38 | + if (preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) { |
|
39 | + $this->param1 = new Text($m[1], Text::TOKEN_HTML); |
|
40 | + $this->param2 = new Text($m[3], Text::TOKEN_HTML); |
|
41 | 41 | $this->operator = $m[2]; |
42 | 42 | } else |
43 | - $this->param1 = new Text($s,Text::TOKEN_HTML); |
|
43 | + $this->param1 = new Text($s, Text::TOKEN_HTML); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // function __construct(String $p1, String $p2, $operator) { |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | // $this->operator = $operator; |
50 | 50 | // } |
51 | 51 | function toPHP() { |
52 | - if(!$this->param2) return $this->param1->toPHP(); |
|
52 | + if (!$this->param2) return $this->param1->toPHP(); |
|
53 | 53 | $p1 = $this->param1->toPHP(); |
54 | 54 | $p2 = $this->param2->toPHP(); |
55 | - switch($this->operator) { |
|
55 | + switch ($this->operator) { |
|
56 | 56 | case "equals": |
57 | 57 | case "equal": |
58 | 58 | return $p1." == ".$p2; |
@@ -35,10 +35,10 @@ |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | function toPHP() { |
38 | - return '$form->getField(' . Text::varToCode($this->var) . ')->getValue()'; |
|
38 | + return '$form->getField('.Text::varToCode($this->var).')->getValue()'; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | function toHTML($escape = false) { |
42 | - return '<?=' . $this->toPHP() . '?>'; |
|
42 | + return '<?='.$this->toPHP().'?>'; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | protected $filter; |
35 | 35 | |
36 | 36 | function __construct($s) { |
37 | - if(FALSE !== $pos = strpos($s,'|')) { |
|
38 | - $this->filter = new Filter(substr($s, $pos+1), $this); |
|
39 | - $s = substr($s,0,$pos); |
|
37 | + if (FALSE !== $pos = strpos($s, '|')) { |
|
38 | + $this->filter = new Filter(substr($s, $pos + 1), $this); |
|
39 | + $s = substr($s, 0, $pos); |
|
40 | 40 | } |
41 | 41 | $s = explode("->", $s); |
42 | - if(count($s) == 1) $s = explode("-!",$s[0]); |
|
42 | + if (count($s) == 1) $s = explode("-!", $s[0]); |
|
43 | 43 | if (!$s[0]) throw new ParseError("Unable to parse Complex Expression"); |
44 | 44 | if ($s[0][1] == "(") |
45 | 45 | $this->func = new Text\Func($s[0]); |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | function toHTML($escape = false) { |
55 | - if($escape) |
|
56 | - return "<?=htmlspecialchars(" .$this->toPHP() . ")?>"; |
|
57 | - return "<?=" . $this->toPHP() . "?>"; |
|
55 | + if ($escape) |
|
56 | + return "<?=htmlspecialchars(".$this->toPHP().")?>"; |
|
57 | + return "<?=".$this->toPHP()."?>"; |
|
58 | 58 | } |
59 | 59 | function toPHP() { |
60 | - return $this->filter?$this->filter->toPHP():$this->toPHPVar(); |
|
60 | + return $this->filter ? $this->filter->toPHP() : $this->toPHPVar(); |
|
61 | 61 | } |
62 | 62 | function toPHPVar() { |
63 | 63 | if ($this->sel) { |
64 | 64 | $sel = array(); |
65 | 65 | foreach ($this->sel as $s) |
66 | 66 | $sel[] = "hamleGet('$s')"; |
67 | - return $this->func->toPHP() . "->" . implode('->', $sel); |
|
67 | + return $this->func->toPHP()."->".implode('->', $sel); |
|
68 | 68 | } else |
69 | 69 | return $this->func->toPHP(); |
70 | 70 | } |