@@ -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,12 +52,12 @@ discard block  | 
                                                    ||
| 52 | 52 | }  | 
                                                        
| 53 | 53 | |
| 54 | 54 |    function toHTML($escape = false) { | 
                                                        
| 55 | - if($escape)  | 
                                                        |
| 56 | -      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>"; | 
                                                        |
| 55 | + if ($escape)  | 
                                                        |
| 56 | +      return "<?=htmlspecialchars(" . $this->toPHP() . ")?>"; | 
                                                        |
| 57 | 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) { | 
                                                        
@@ -39,21 +39,27 @@ discard block  | 
                                                    ||
| 39 | 39 | $s = substr($s,0,$pos);  | 
                                                        
| 40 | 40 | }  | 
                                                        
| 41 | 41 |      $s = explode("->", $s); | 
                                                        
| 42 | -    if(count($s) == 1) $s = explode("-!",$s[0]); | 
                                                        |
| 43 | -    if (!$s[0]) throw new ParseError("Unable to parse Complex Expression"); | 
                                                        |
| 44 | -    if ($s[0][1] == "(") | 
                                                        |
| 45 | - $this->func = new Text\Func($s[0]);  | 
                                                        |
| 46 | - elseif ($s[0][1] == "[")  | 
                                                        |
| 47 | - $this->func = new Text\Scope($s[0]);  | 
                                                        |
| 48 | - else  | 
                                                        |
| 49 | - $this->func = new SimpleVar($s[0]);  | 
                                                        |
| 42 | +    if(count($s) == 1) { | 
                                                        |
| 43 | +      $s = explode("-!",$s[0]); | 
                                                        |
| 44 | + }  | 
                                                        |
| 45 | +    if (!$s[0]) { | 
                                                        |
| 46 | +      throw new ParseError("Unable to parse Complex Expression"); | 
                                                        |
| 47 | + }  | 
                                                        |
| 48 | +    if ($s[0][1] == "(") { | 
                                                        |
| 49 | + $this->func = new Text\Func($s[0]);  | 
                                                        |
| 50 | +    } elseif ($s[0][1] == "[") { | 
                                                        |
| 51 | + $this->func = new Text\Scope($s[0]);  | 
                                                        |
| 52 | +    } else { | 
                                                        |
| 53 | + $this->func = new SimpleVar($s[0]);  | 
                                                        |
| 54 | + }  | 
                                                        |
| 50 | 55 | array_shift($s);  | 
                                                        
| 51 | 56 | $this->sel = $s;  | 
                                                        
| 52 | 57 | }  | 
                                                        
| 53 | 58 | |
| 54 | 59 |    function toHTML($escape = false) { | 
                                                        
| 55 | - if($escape)  | 
                                                        |
| 56 | -      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>"; | 
                                                        |
| 60 | +    if($escape) { | 
                                                        |
| 61 | +          return "<?=htmlspecialchars(" .$this->toPHP() . ")?>"; | 
                                                        |
| 62 | + }  | 
                                                        |
| 57 | 63 | return "<?=" . $this->toPHP() . "?>";  | 
                                                        
| 58 | 64 | }  | 
                                                        
| 59 | 65 |    function toPHP() { | 
                                                        
@@ -62,11 +68,13 @@ discard block  | 
                                                    ||
| 62 | 68 |    function toPHPVar() { | 
                                                        
| 63 | 69 |      if ($this->sel) { | 
                                                        
| 64 | 70 | $sel = array();  | 
                                                        
| 65 | - foreach ($this->sel as $s)  | 
                                                        |
| 66 | -        $sel[] = "hamleGet('$s')"; | 
                                                        |
| 71 | +      foreach ($this->sel as $s) { | 
                                                        |
| 72 | +              $sel[] = "hamleGet('$s')"; | 
                                                        |
| 73 | + }  | 
                                                        |
| 67 | 74 |        return $this->func->toPHP() . "->" . implode('->', $sel); | 
                                                        
| 68 | - } else  | 
                                                        |
| 69 | - return $this->func->toPHP();  | 
                                                        |
| 75 | +    } else { | 
                                                        |
| 76 | + return $this->func->toPHP();  | 
                                                        |
| 77 | + }  | 
                                                        |
| 70 | 78 | }  | 
                                                        
| 71 | 79 | |
| 72 | 80 | }  | 
                                                        
| 73 | 81 | \ No newline at end of file  |