Completed
Push — master ( ea1817...bbd140 )
by Chris
03:35
created
php/hamle/Tag/Html.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Braces   +23 added lines, -13 removed lines patch added patch discarded remove patch
@@ -42,17 +42,21 @@  discard block
 block discarded – undo
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 48
     $this->source = array();
48 49
     $this->type = $tag ? $tag : "div";
49 50
     if($class) {
50
-      if (isset($this->opt['class']))
51
-        $this->opt['class'] = array_merge($this->opt['class'], $class);
52
-      else
53
-        $this->opt['class'] = $class;
51
+      if (isset($this->opt['class'])) {
52
+              $this->opt['class'] = array_merge($this->opt['class'], $class);
53
+      } else {
54
+              $this->opt['class'] = $class;
55
+      }
56
+    }
57
+    if($id) {
58
+      $this->opt['id'] = $id;
54 59
     }
55
-    if($id) $this->opt['id'] = $id;
56 60
   }
57 61
 
58 62
   function renderStTag() {
@@ -61,8 +65,9 @@  discard block
 block discarded – undo
61 65
   }
62 66
 
63 67
   function renderEnTag() {
64
-    if (in_array($this->type, self::$selfCloseTags))
65
-      return "";
68
+    if (in_array($this->type, self::$selfCloseTags)) {
69
+          return "";
70
+    }
66 71
     return "</{$this->type}>";
67 72
   }
68 73
 
@@ -74,10 +79,15 @@  discard block
 block discarded – undo
74 79
   function optToTags() {
75 80
     $out = array();
76 81
     foreach ($this->opt as $k => $v) {
77
-      if ($k == "class" && !$v) continue;
78
-      if (is_array($v)) $v = implode(" ", $v);
79
-      if (!$v instanceof H\Text)
80
-        $v = new H\Text($v);
82
+      if ($k == "class" && !$v) {
83
+        continue;
84
+      }
85
+      if (is_array($v)) {
86
+        $v = implode(" ", $v);
87
+      }
88
+      if (!$v instanceof H\Text) {
89
+              $v = new H\Text($v);
90
+      }
81 91
       $k = new H\Text($k);
82 92
       $out[] = " " . $k->toHTML() . "=\"" . $v->toHTMLAtt() . "\"";
83 93
     }
Please login to merge, or discard this patch.
php/hamle/Form.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
    * Fills the $this->fields array with hamleFields
45 45
    */
46 46
   function setup() {
47
-    throw new Exception\RunTime("You must configure the form in the setup ".
47
+    throw new Exception\RunTime("You must configure the form in the setup " .
48 48
       "function, by adding fields to the \$this->fields array");
49 49
   }
50 50
   
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     $this->setup();
55 55
     $fields = $this->_fields;
56 56
     $this->_fields = array();
57
-    foreach($fields as $v) {
57
+    foreach ($fields as $v) {
58 58
       $this->_fields[$v->name] = $v;
59 59
       $v->form($this->_name);
60 60
     }
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
   
65 65
   function process() {
66 66
     $clicked = "";
67
-    foreach($this->_fields as $f)
68
-      if($f instanceOf Field\Button)
69
-        if($f->isClicked())
67
+    foreach ($this->_fields as $f)
68
+      if ($f instanceOf Field\Button)
69
+        if ($f->isClicked())
70 70
           $clicked = $f;
71
-    foreach($this->_fields as $f)
72
-      $f->doProcess($clicked?true:false);
73
-    if($clicked)
71
+    foreach ($this->_fields as $f)
72
+      $f->doProcess($clicked ? true : false);
73
+    if ($clicked)
74 74
       try {
75 75
         $this->onSubmit($clicked);
76
-      } catch(Exception\FormInvalid $e) {
76
+      } catch (Exception\FormInvalid $e) {
77 77
         $this->hint = $e->getMessage();
78 78
       }
79 79
   }
80 80
   
81 81
   function isValid() {
82 82
     $valid = true;
83
-    foreach($this->_fields as $f)
83
+    foreach ($this->_fields as $f)
84 84
       $valid = $f->valid && $valid;
85 85
     return $valid;
86 86
   }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     return $this->_fields;
96 96
   }
97 97
   function getField($n) {
98
-    if(!isset($this->_fields[$n]))
98
+    if (!isset($this->_fields[$n]))
99 99
       throw new Exception\NoKey("unable to find form field ($n)");
100 100
     return $this->_fields[$n];
101 101
   }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
   }
105 105
   
106 106
   function getHTMLProp() {
107
-    return array('action'=>'','method'=>'post','name'=>$this->_name,
107
+    return array('action'=>'', 'method'=>'post', 'name'=>$this->_name,
108 108
                                         'enctype'=>'multipart/form-data');
109 109
   }
110 110
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,15 +64,18 @@  discard block
 block discarded – undo
64 64
   
65 65
   function process() {
66 66
     $clicked = "";
67
-    foreach($this->_fields as $f)
68
-      if($f instanceOf Field\Button)
67
+    foreach($this->_fields as $f) {
68
+          if($f instanceOf Field\Button)
69 69
         if($f->isClicked())
70
-          $clicked = $f;
71
-    foreach($this->_fields as $f)
72
-      $f->doProcess($clicked?true:false);
73
-    if($clicked)
74
-      try {
75
-        $this->onSubmit($clicked);
70
+          $clicked = $f;
71
+    }
72
+    foreach($this->_fields as $f) {
73
+          $f->doProcess($clicked?true:false);
74
+    }
75
+    if($clicked) {
76
+          try {
77
+        $this->onSubmit($clicked);
78
+    }
76 79
       } catch(Exception\FormInvalid $e) {
77 80
         $this->hint = $e->getMessage();
78 81
       }
@@ -80,8 +83,9 @@  discard block
 block discarded – undo
80 83
   
81 84
   function isValid() {
82 85
     $valid = true;
83
-    foreach($this->_fields as $f)
84
-      $valid = $f->valid && $valid;
86
+    foreach($this->_fields as $f) {
87
+          $valid = $f->valid && $valid;
88
+    }
85 89
     return $valid;
86 90
   }
87 91
   /**
@@ -95,8 +99,9 @@  discard block
 block discarded – undo
95 99
     return $this->_fields;
96 100
   }
97 101
   function getField($n) {
98
-    if(!isset($this->_fields[$n]))
99
-      throw new Exception\NoKey("unable to find form field ($n)");
102
+    if(!isset($this->_fields[$n])) {
103
+          throw new Exception\NoKey("unable to find form field ($n)");
104
+    }
100 105
     return $this->_fields[$n];
101 106
   }
102 107
   function __get($n) {
Please login to merge, or discard this patch.
php/hamle/Text/Func.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
     }
82 82
     $rand = false;
83 83
     if (preg_match_all('/\\^(-?)([a-zA-Z0-9\_]*)/', $s, $m)) {
84
-      foreach($m[0] as $k=>$mv)
84
+      foreach ($m[0] as $k=>$mv)
85 85
         if ($m[2][$k]) {
86
-          $dir = $m[1][$k] == "-"?Hamle\Hamle::SORT_DESCENDING:Hamle\Hamle::SORT_ASCENDING;
86
+          $dir = $m[1][$k] == "-" ? Hamle\Hamle::SORT_DESCENDING : Hamle\Hamle::SORT_ASCENDING;
87 87
           $att['sort'][$m[2][$k]] = $dir;
88 88
         } else $rand = true;
89 89
     }
90
-    if($rand)
90
+    if ($rand)
91 91
       $att['sort'] = [""=>$att['dir'] = Hamle\Hamle::SORT_RANDOM];
92 92
     return $att;
93 93
   }
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
         $this->sortlimit['limit'] . "," . $this->sortlimit['offset'];
107 107
     $sub = $this->sub ? "->" . $this->sub->toPHP() : "";
108 108
     if ($this->scope) {
109
-      if($this->scope === true)
109
+      if ($this->scope === true)
110 110
         return "Hamle\\Scope::get(0)$sub";
111
-      return $this->scope->toPHP().$sub;
111
+      return $this->scope->toPHP() . $sub;
112 112
     }
113 113
     if (count($this->filt['tag']))
114 114
       return "Hamle\\Run::modelTypeTags(" .
Please login to merge, or discard this patch.
Braces   +41 added lines, -25 removed lines patch added patch discarded remove patch
@@ -38,10 +38,12 @@  discard block
 block discarded – undo
38 38
 
39 39
   function __construct($s) {
40 40
     $m = array();
41
-    if (!preg_match('/^\$\((' . self::REGEX_FUNCSEL . '*)(.*)\)$/', $s, $m))
42
-      throw new ParseError("Unable to read \$ func in '$s'");
43
-    if (trim($m[2]))
44
-      $this->sub = new FuncSub($m[2]);
41
+    if (!preg_match('/^\$\((' . self::REGEX_FUNCSEL . '*)(.*)\)$/', $s, $m)) {
42
+          throw new ParseError("Unable to read \$ func in '$s'");
43
+    }
44
+    if (trim($m[2])) {
45
+          $this->sub = new FuncSub($m[2]);
46
+    }
45 47
     if (!trim($m[1])) {
46 48
       $this->scope = true;
47 49
       return;
@@ -58,17 +60,24 @@  discard block
 block discarded – undo
58 60
     $m = array();
59 61
     $att = array('id' => array(), 'tag' => array());
60 62
     foreach (explode(",", $s) as $str) {
61
-      if (preg_match('/^[a-zA-Z0-9\\_]+/', $str, $m)) $type = $m[0];
62
-      else $type = "*";
63
-      if (preg_match('/#([a-zA-Z0-9\_\\${}]+)/', $str, $m)) $att['id'][$type][] = $m[1];
64
-      elseif (preg_match_all('/\\.([a-zA-Z0-9\_\-\\${}]+)/', $str, $m))
65
-        foreach ($m[1] as $tag)
63
+      if (preg_match('/^[a-zA-Z0-9\\_]+/', $str, $m)) {
64
+        $type = $m[0];
65
+      } else {
66
+        $type = "*";
67
+      }
68
+      if (preg_match('/#([a-zA-Z0-9\_\\${}]+)/', $str, $m)) {
69
+        $att['id'][$type][] = $m[1];
70
+      } elseif (preg_match_all('/\\.([a-zA-Z0-9\_\-\\${}]+)/', $str, $m)) {
71
+              foreach ($m[1] as $tag)
66 72
           $att['tag'][$type][] = new Text($tag, Text::TOKEN_CODE);
67
-      else $att['tag'][$type] = array();
73
+      } else {
74
+        $att['tag'][$type] = array();
75
+      }
68 76
     }
69 77
     //var_dump($att);
70
-    if (!(count($att['id']) xor count($att['tag'])))
71
-      throw new ParseError("Only tag, type or id can be combined");
78
+    if (!(count($att['id']) xor count($att['tag']))) {
79
+          throw new ParseError("Only tag, type or id can be combined");
80
+    }
72 81
     return $att;
73 82
   }
74 83
 
@@ -81,14 +90,18 @@  discard block
 block discarded – undo
81 90
     }
82 91
     $rand = false;
83 92
     if (preg_match_all('/\\^(-?)([a-zA-Z0-9\_]*)/', $s, $m)) {
84
-      foreach($m[0] as $k=>$mv)
85
-        if ($m[2][$k]) {
93
+      foreach($m[0] as $k=>$mv) {
94
+              if ($m[2][$k]) {
86 95
           $dir = $m[1][$k] == "-"?Hamle\Hamle::SORT_DESCENDING:Hamle\Hamle::SORT_ASCENDING;
96
+      }
87 97
           $att['sort'][$m[2][$k]] = $dir;
88
-        } else $rand = true;
98
+        } else {
99
+          $rand = true;
100
+        }
101
+    }
102
+    if($rand) {
103
+          $att['sort'] = [""=>$att['dir'] = Hamle\Hamle::SORT_RANDOM];
89 104
     }
90
-    if($rand)
91
-      $att['sort'] = [""=>$att['dir'] = Hamle\Hamle::SORT_RANDOM];
92 105
     return $att;
93 106
   }
94 107
 
@@ -106,21 +119,24 @@  discard block
 block discarded – undo
106 119
         $this->sortlimit['limit'] . "," . $this->sortlimit['offset'];
107 120
     $sub = $this->sub ? "->" . $this->sub->toPHP() : "";
108 121
     if ($this->scope) {
109
-      if($this->scope === true)
110
-        return "Hamle\\Scope::get(0)$sub";
122
+      if($this->scope === true) {
123
+              return "Hamle\\Scope::get(0)$sub";
124
+      }
111 125
       return $this->scope->toPHP().$sub;
112 126
     }
113
-    if (count($this->filt['tag']))
114
-      return "Hamle\\Run::modelTypeTags(" .
127
+    if (count($this->filt['tag'])) {
128
+          return "Hamle\\Run::modelTypeTags(" .
115 129
       Text::varToCode($this->filt['tag']) . ",$limit)$sub";
116
-    if (count($this->filt['id']))
117
-      if (isset($this->filt['id']['*']) && count($this->filt['id']['*']) == 1)
130
+    }
131
+    if (count($this->filt['id'])) {
132
+          if (isset($this->filt['id']['*']) && count($this->filt['id']['*']) == 1)
118 133
         return "Hamle\\Run::modelId(" .
119 134
         Text::varToCode(current($this->filt['id']['*'])) .
120 135
         ",$limit)$sub";
121
-      else
122
-        return "Hamle\\Run::modelTypeId(" .
136
+    } else {
137
+              return "Hamle\\Run::modelTypeId(" .
123 138
         Text::varToCode($this->filt['id']) . ",$limit)$sub";
139
+      }
124 140
     return "";
125 141
   }
126 142
 
Please login to merge, or discard this patch.
php/hamle/Text/Scope.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,16 +34,18 @@
 block discarded – undo
34 34
   function __construct($s) {
35 35
     $m = array();
36 36
     //var_dump($s);
37
-    if (!preg_match('/\$\[(-?[0-9]+|[a-zA-Z][a-zA-Z0-9]+)\]/', $s, $m))
38
-      throw new ParseError("Unable to match scope ($s)");
37
+    if (!preg_match('/\$\[(-?[0-9]+|[a-zA-Z][a-zA-Z0-9]+)\]/', $s, $m)) {
38
+          throw new ParseError("Unable to match scope ($s)");
39
+    }
39 40
     $this->scope = $m[1];
40 41
   }
41 42
 
42 43
   function toPHP() {
43
-    if (is_numeric($this->scope))
44
-      return "Hamle\\Scope::get(" . Text::varToCode($this->scope) . ")";
45
-    else
46
-      return "Hamle\\Scope::getName(" . Text::varToCode($this->scope) . ")";
44
+    if (is_numeric($this->scope)) {
45
+          return "Hamle\\Scope::get(" . Text::varToCode($this->scope) . ")";
46
+    } else {
47
+          return "Hamle\\Scope::getName(" . Text::varToCode($this->scope) . ")";
48
+    }
47 49
   }
48 50
 
49 51
   function toHTML($escape = false) {
Please login to merge, or discard this patch.
php/hamle/Text/SimpleVar.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,22 +33,22 @@
 block discarded – undo
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() . ")?>";
45
+    if ($escape)
46
+      return "<?=htmlspecialchars(" . $this->toPHP() . ")?>";
47 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() {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@
 block discarded – undo
42 42
   }
43 43
 
44 44
   function toHTML($escape = false) {
45
-    if($escape)
46
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
45
+    if($escape) {
46
+          return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
47
+    }
47 48
     return "<?=" . $this->toPHP() . "?>";
48 49
   }
49 50
 
Please login to merge, or discard this patch.
php/hamle/Text/Select.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
   function __construct($s) {
32 32
     $s = explode("->", $s, 2);
33 33
     $this->key = $s[0];
34
-    if (count($s) > 1)
35
-      $this->sel = $s[1];
34
+    if (count($s) > 1) {
35
+          $this->sel = $s[1];
36
+    }
36 37
   }
37 38
 }
38 39
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Exception.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
  */
26 26
 namespace Seufert\Hamle;
27 27
 /**
28
- * HAMLE Exception base class
29
- *
30
- * @author Chris Seufert <[email protected]>
31
- * @package hamle
32
- *
33
- */
28
+   * HAMLE Exception base class
29
+   *
30
+   * @author Chris Seufert <[email protected]>
31
+   * @package hamle
32
+   *
33
+   */
34 34
 class Exception extends \Exception {
35 35
   //put your code here
36 36
 }
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Tag.php 1 patch
Braces   +33 added lines, -21 removed lines patch added patch discarded remove patch
@@ -76,9 +76,10 @@  discard block
 block discarded – undo
76 76
       }
77 77
       array_shift($path);
78 78
     }
79
-    foreach ($this->tags as $tag)
80
-      if ($found = $tag->find($path))
81
-        $list = array_merge($list, $found);
79
+    foreach ($this->tags as $tag) {
80
+          if ($found = $tag->find($path))
81
+        $list = array_merge($list, $found);
82
+    }
82 83
     return $list;
83 84
   }
84 85
 
@@ -90,7 +91,9 @@  discard block
 block discarded – undo
90 91
    */
91 92
   function replace($path, Tag $newTag) {
92 93
     if ($this->compare($path[0])) {
93
-      if (count($path) == 1) return $newTag;
94
+      if (count($path) == 1) {
95
+        return $newTag;
96
+      }
94 97
       array_shift($path);
95 98
     }
96 99
     foreach ($this->tags as $k => $tag) {
@@ -103,21 +106,25 @@  discard block
 block discarded – undo
103 106
   }
104 107
 
105 108
   function addSnipContent($contentTag, &$tagArray = array(), $key = 0) {
106
-    foreach ($this->tags as $k => $tag)
107
-      $tag->addSnipContent($contentTag, $this->tags, $k);
109
+    foreach ($this->tags as $k => $tag) {
110
+          $tag->addSnipContent($contentTag, $this->tags, $k);
111
+    }
108 112
   }
109 113
 
110 114
   function compare($tic) {
111
-    if (isset($tic['type']) && $this->type != $tic['type'])
112
-      return false;
115
+    if (isset($tic['type']) && $this->type != $tic['type']) {
116
+          return false;
117
+    }
113 118
     if (isset($tic['id']) &&
114 119
         !(isset($this->opt['id']) && $tic['id'] == $this->opt['id'])
115
-    )
116
-      return false;
120
+    ) {
121
+          return false;
122
+    }
117 123
     if (isset($tic['class']) && !(isset($this->opt['class'])
118 124
             && !array_diff($tic['class'], $this->opt['class']))
119
-    )
120
-      return false;
125
+    ) {
126
+          return false;
127
+    }
121 128
     return true;
122 129
   }
123 130
 
@@ -127,10 +134,11 @@  discard block
 block discarded – undo
127 134
    * @param string $mode Mode to add child [append|prepend]
128 135
    */
129 136
   function addChild(Tag $tag, $mode = "append") {
130
-    if ($mode == "prepend")
131
-      array_unshift($this->tags, $tag);
132
-    else
133
-      $this->tags[] = $tag;
137
+    if ($mode == "prepend") {
138
+          array_unshift($this->tags, $tag);
139
+    } else {
140
+          $this->tags[] = $tag;
141
+    }
134 142
   }
135 143
 
136 144
   /**
@@ -145,9 +153,12 @@  discard block
 block discarded – undo
145 153
     $ind = $doIndent ? str_pad("", $indent, " ") : "";
146 154
     $oneliner = ((count($this->content) > 1 || $this->tags) ? false : true);
147 155
     $out = $ind . $this->renderStTag() . ($oneliner ? "" : "\n");
148
-    if ($this->content) $out .= $this->renderContent($ind, $oneliner);
149
-    foreach ($this->tags as $tag)
150
-      $out .= $tag->render($indent + self::INDENT_SIZE);
156
+    if ($this->content) {
157
+      $out .= $this->renderContent($ind, $oneliner);
158
+    }
159
+    foreach ($this->tags as $tag) {
160
+          $out .= $tag->render($indent + self::INDENT_SIZE);
161
+    }
151 162
     $out .= ($oneliner ? "" : $ind) . $this->renderEnTag() . "\n";
152 163
     return $out;
153 164
   }
@@ -161,8 +172,9 @@  discard block
 block discarded – undo
161 172
    */
162 173
   function renderContent($pad = "", $oneliner = false) {
163 174
     $out = "";
164
-    foreach ($this->content as $c)
165
-      $out .= ($oneliner ? "" : $pad) . $c . ($oneliner ? "" : "\n");
175
+    foreach ($this->content as $c) {
176
+          $out .= ($oneliner ? "" : $pad) . $c . ($oneliner ? "" : "\n");
177
+    }
166 178
     return $out;
167 179
   }
168 180
 
Please login to merge, or discard this patch.
php/hamle/Field/Checkbox.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,14 +36,18 @@
 block discarded – undo
36 36
   function getInputAttDynamic(&$atts, &$type, &$content) {
37 37
     parent::getInputAttDynamic($atts, $type, $content);
38 38
     $atts['value'] = "ON";
39
-    if ($this->getValue())
40
-      $atts['checked'] = "checked";
39
+    if ($this->getValue()) {
40
+          $atts['checked'] = "checked";
41
+    }
41 42
   }
42 43
 
43 44
   function getValue() {
44
-    if (!is_null($this->setValue)) return $this->setValue;
45
-    if (isset($_REQUEST[$this->form . "__submit"]))
46
-      return isset($_REQUEST[$this->form . "_" . $this->name]);
45
+    if (!is_null($this->setValue)) {
46
+      return $this->setValue;
47
+    }
48
+    if (isset($_REQUEST[$this->form . "__submit"])) {
49
+          return isset($_REQUEST[$this->form . "_" . $this->name]);
50
+    }
47 51
     return $this->opt['default'];
48 52
   }
49 53
 }
50 54
\ No newline at end of file
Please login to merge, or discard this patch.