@@ -24,8 +24,8 @@ |
||
24 | 24 | |
25 | 25 | */ |
26 | 26 | namespace Seufert\Hamle; |
27 | -use Seufert\Hamle\Exception\ParseError; |
|
28 | -use Seufert\Hamle\Parse\Filter; |
|
27 | +use Seufert\Hamle\Exception\ParseError; |
|
28 | +use Seufert\Hamle\Parse\Filter; |
|
29 | 29 | use Seufert\Hamle\Text; |
30 | 30 | |
31 | 31 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $i = self::indentLevel($indent); |
157 | 157 | unset($m[0]); |
158 | 158 | switch (strlen($code) ? $code[0] : ($textcode ? $textcode : "")) { |
159 | - case "|": //Control Tag |
|
159 | + case "|" : //Control Tag |
|
160 | 160 | if ($code == "|snippet") |
161 | 161 | $hTag = new Tag\Snippet($text); |
162 | 162 | elseif ($code == "|form") |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | break; |
192 | 192 | default: |
193 | 193 | $attr = array(); |
194 | - if(isset($params[0]) && $params[0] == "[") { |
|
194 | + if (isset($params[0]) && $params[0] == "[") { |
|
195 | 195 | $param = substr($params, 1, strlen($params) - 2); |
196 | - $param = str_replace('+','%2B', $param); |
|
196 | + $param = str_replace('+', '%2B', $param); |
|
197 | 197 | parse_str($param, $attr); |
198 | 198 | } |
199 | 199 | $class = array(); $id = ""; $ref = ""; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if ($s[0] == ".") $class[] = substr($s, 1); |
204 | 204 | if ($s[0] == "!") $ref = substr($s, 1); |
205 | 205 | } |
206 | - if($ref) |
|
206 | + if ($ref) |
|
207 | 207 | $hTag = new Tag\DynHtml($tag, $class, $attr, $id, $ref); |
208 | 208 | else |
209 | 209 | $hTag = new Tag\Html($tag, $class, $attr, $id); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | namespace Seufert\Hamle; |
27 | 27 | |
28 | -use Seufert\Hamle\Exception\RunTime; |
|
28 | +use Seufert\Hamle\Exception\RunTime; |
|
29 | 29 | use Seufert\Hamle\Model; |
30 | 30 | |
31 | 31 | /** |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Seufert\Hamle; |
3 | 3 | |
4 | -use Seufert\Hamle\Exception\OutOfScope; |
|
5 | -use Seufert\Hamle\Exception\Unsupported; |
|
6 | -use Seufert\Hamle\Exception\RunTime; |
|
4 | +use Seufert\Hamle\Exception\OutOfScope; |
|
5 | +use Seufert\Hamle\Exception\Unsupported; |
|
6 | +use Seufert\Hamle\Exception\RunTime; |
|
7 | 7 | use Seufert\Hamle\Model; |
8 | 8 | |
9 | 9 | /** |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | static function add($model, $name = null) { |
21 | 21 | if (!$model instanceOf Model) |
22 | - throw new Unsupported("Unsupported Model (".get_class($model)."), Needs to implement hamleModel Interface"); |
|
22 | + throw new Unsupported("Unsupported Model (" . get_class($model) . "), Needs to implement hamleModel Interface"); |
|
23 | 23 | if ($name) |
24 | 24 | self::$namedScopes[$name] = $model; |
25 | 25 | else |
@@ -34,11 +34,11 @@ |
||
34 | 34 | * @param string $class Class name to be autoloaded |
35 | 35 | */ |
36 | 36 | spl_autoload_register(function($class) { |
37 | - if(strpos($class, "Seufert\\Hamle\\") === 0) { |
|
37 | + if (strpos($class, "Seufert\\Hamle\\") === 0) { |
|
38 | 38 | $s = DIRECTORY_SEPARATOR; |
39 | - $class = str_replace("\\",$s,substr($class,14)); |
|
40 | - $path = __DIR__.$s."hamle".$s."$class.php"; |
|
41 | - if(is_file($path)) include_once($path); |
|
39 | + $class = str_replace("\\", $s, substr($class, 14)); |
|
40 | + $path = __DIR__ . $s . "hamle" . $s . "$class.php"; |
|
41 | + if (is_file($path)) include_once($path); |
|
42 | 42 | } |
43 | -},true,true); |
|
43 | +},true, true); |
|
44 | 44 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | function getInputAttStatic(&$atts, &$type, &$content) { |
125 | 125 | $atts['id'] = $atts['name'] = $this->form . "_" . $this->name; |
126 | 126 | $atts['type'] = "text"; |
127 | - $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this)); |
|
127 | + $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this)); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | function getInputAttDynamic(&$atts, &$type, &$content) { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | function getLabelAttStatic(&$atts, &$type, &$content) { |
145 | - $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this)); |
|
145 | + $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this)); |
|
146 | 146 | $atts["for"] = $this->form . "_" . $this->name; |
147 | 147 | $content = array($this->opt['label']); |
148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | function getHintAttStatic(&$atts, &$type, &$content) { |
154 | - $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this)); |
|
154 | + $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this)); |
|
155 | 155 | $atts['class'][] = "hamleFormHint"; |
156 | 156 | } |
157 | 157 |
@@ -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,10 +87,10 @@ 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 | 96 | return "<form " . implode(" ", $out) . "><?php \$form = " . $this->var->toPHP() . "; \$form->process(); ?>"; |
@@ -97,8 +97,8 @@ |
||
97 | 97 | break; |
98 | 98 | case "include": |
99 | 99 | $file = $hsv->toHTML(); |
100 | - if($file[0] == "#") |
|
101 | - $out .= "echo Hamle\\Run::includeFragment(".$hsv->toPHP().");"; |
|
100 | + if ($file[0] == "#") |
|
101 | + $out .= "echo Hamle\\Run::includeFragment(" . $hsv->toPHP() . ");"; |
|
102 | 102 | else |
103 | 103 | $out .= "echo Hamle\\Run::includeFile(" . $hsv->toPHP() . ");"; |
104 | 104 | break; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | static function decodeClassId($s) { |
47 | 47 | $out = $m = array(); |
48 | - if(preg_match('/^[a-zA-Z0-9\_]+/', $s, $m)) |
|
48 | + if (preg_match('/^[a-zA-Z0-9\_]+/', $s, $m)) |
|
49 | 49 | $out['type'] = $m[0]; |
50 | 50 | preg_match_all('/[#\.][a-zA-Z0-9\-\_]+/m', $s, $m); |
51 | 51 | if (isset($m[0])) foreach ($m[0] as $s) { |
@@ -42,17 +42,17 @@ |
||
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() { |