@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use Ajax\common\JsCode; |
7 | 7 | |
8 | 8 | class SimpleExtComponent extends SimpleComponent { |
9 | - protected $events=array (); |
|
10 | - protected $jsCodes=array (); |
|
9 | + protected $events=array(); |
|
10 | + protected $jsCodes=array(); |
|
11 | 11 | |
12 | 12 | public function addEvent($event, $jsCode) { |
13 | 13 | $this->events [$event]=$jsCode; |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | public function getScript() { |
17 | 17 | parent::getScript(); |
18 | - foreach ( $this->jsCodes as $jsCode ) { |
|
19 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
18 | + foreach ($this->jsCodes as $jsCode) { |
|
19 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
20 | 20 | "identifier" => $this->attachTo |
21 | 21 | )); |
22 | 22 | } |
@@ -11,9 +11,9 @@ |
||
11 | 11 | * @see \Ajax\common\components\SimpleExtComponent::getScript() |
12 | 12 | */ |
13 | 13 | public function getScript() { |
14 | - $this->jquery_code_for_compile=array (); |
|
15 | - foreach ( $this->jsCodes as $jsCode ) { |
|
16 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
14 | + $this->jquery_code_for_compile=array(); |
|
15 | + foreach ($this->jsCodes as $jsCode) { |
|
16 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
17 | 17 | "identifier" => $this->attachTo |
18 | 18 | )); |
19 | 19 | } |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct($autoCompile=true) { |
29 | 29 | $this->autoCompile=$autoCompile; |
30 | - $this->components=array (); |
|
31 | - $this->htmlComponents=array (); |
|
30 | + $this->components=array(); |
|
31 | + $this->htmlComponents=array(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function isAutoCompile() { |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public function compile($internal=false) { |
44 | - if ($internal===false&&$this->autoCompile===true) |
|
44 | + if ($internal===false && $this->autoCompile===true) |
|
45 | 45 | throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
46 | - foreach ( $this->components as $component ) { |
|
46 | + foreach ($this->components as $component) { |
|
47 | 47 | $component->compile(); |
48 | 48 | } |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | public function compileHtml(JsUtils $js=NULL, &$view=NULL) { |
72 | - foreach ( $this->htmlComponents as $htmlComponent ) { |
|
72 | + foreach ($this->htmlComponents as $htmlComponent) { |
|
73 | 73 | $htmlComponent->compile($js, $view); |
74 | 74 | } |
75 | 75 | } |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public function compile($internal=false) { |
44 | - if ($internal===false&&$this->autoCompile===true) |
|
45 | - throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
44 | + if ($internal===false&&$this->autoCompile===true) { |
|
45 | + throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
|
46 | + } |
|
46 | 47 | foreach ( $this->components as $component ) { |
47 | 48 | $component->compile(); |
48 | 49 | } |
@@ -53,13 +54,16 @@ discard block |
||
53 | 54 | } |
54 | 55 | |
55 | 56 | public function addComponent(SimpleComponent $component, $attachTo, $params) { |
56 | - if ($this->autoCompile) |
|
57 | - $this->components []=$component; |
|
58 | - if (isset($attachTo)) |
|
59 | - $component->attach($attachTo); |
|
60 | - if (isset($params)) |
|
61 | - if (is_array($params)) |
|
57 | + if ($this->autoCompile) { |
|
58 | + $this->components []=$component; |
|
59 | + } |
|
60 | + if (isset($attachTo)) { |
|
61 | + $component->attach($attachTo); |
|
62 | + } |
|
63 | + if (isset($params)) { |
|
64 | + if (is_array($params)) |
|
62 | 65 | $component->setParams($params); |
66 | + } |
|
63 | 67 | return $component; |
64 | 68 | } |
65 | 69 |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | private static $constCacheArray=NULL; |
13 | 13 | |
14 | 14 | public static function getConstants() { |
15 | - if (self::$constCacheArray == NULL) { |
|
16 | - self::$constCacheArray=[ ]; |
|
15 | + if (self::$constCacheArray==NULL) { |
|
16 | + self::$constCacheArray=[]; |
|
17 | 17 | } |
18 | 18 | $calledClass=get_called_class(); |
19 | 19 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | return self::$constCacheArray[$calledClass]; |
24 | 24 | } |
25 | 25 | |
26 | - public static function getConstantValues($postFix="",$prefixBefore=false) { |
|
27 | - if ($postFix == "") |
|
26 | + public static function getConstantValues($postFix="", $prefixBefore=false) { |
|
27 | + if ($postFix=="") |
|
28 | 28 | return \array_values(self::getConstants()); |
29 | 29 | else { |
30 | - if($prefixBefore===false){ |
|
31 | - return \array_map(function ($elem) use($postFix) { |
|
32 | - return $elem . " " . $postFix; |
|
30 | + if ($prefixBefore===false) { |
|
31 | + return \array_map(function($elem) use($postFix) { |
|
32 | + return $elem." ".$postFix; |
|
33 | 33 | }, \array_values(self::getConstants())); |
34 | - }else{ |
|
35 | - return \array_map(function ($elem) use($postFix) { |
|
34 | + } else { |
|
35 | + return \array_map(function($elem) use($postFix) { |
|
36 | 36 | return $postFix." ".$elem; |
37 | 37 | }, \array_values(self::getConstants())); |
38 | 38 | } |
@@ -24,14 +24,14 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function getConstantValues($postFix="",$prefixBefore=false) { |
27 | - if ($postFix == "") |
|
28 | - return \array_values(self::getConstants()); |
|
29 | - else { |
|
27 | + if ($postFix == "") { |
|
28 | + return \array_values(self::getConstants()); |
|
29 | + } else { |
|
30 | 30 | if($prefixBefore===false){ |
31 | 31 | return \array_map(function ($elem) use($postFix) { |
32 | 32 | return $elem . " " . $postFix; |
33 | 33 | }, \array_values(self::getConstants())); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | return \array_map(function ($elem) use($postFix) { |
36 | 36 | return $postFix." ".$elem; |
37 | 37 | }, \array_values(self::getConstants())); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | public function compile($keyAndvalues) { |
27 | 27 | $result=$this->mask; |
28 | - foreach ( $keyAndvalues as $k => $v ) { |
|
28 | + foreach ($keyAndvalues as $k => $v) { |
|
29 | 29 | $result=str_ireplace("%{$k}%", $v, $result); |
30 | 30 | } |
31 | 31 | return $result; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class HtmlInput extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
10 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
11 | 11 | parent::__construct($identifier, "input"); |
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setValue($value); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
19 | + if (isset($value)) |
|
20 | 20 | $this->setProperty("value", $value); |
21 | 21 | return $this; |
22 | 22 | } |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | return $this->setProperty("type", $value); |
26 | 26 | } |
27 | 27 | |
28 | - public function setPlaceholder($value){ |
|
29 | - if(JString::isNull($value)){ |
|
30 | - if(JString::isNotNull($this->identifier)) |
|
28 | + public function setPlaceholder($value) { |
|
29 | + if (JString::isNull($value)) { |
|
30 | + if (JString::isNotNull($this->identifier)) |
|
31 | 31 | $value=\ucfirst($this->identifier); |
32 | 32 | } |
33 | - if(JString::isNotNull($value)) |
|
33 | + if (JString::isNotNull($value)) |
|
34 | 34 | $this->setProperty("placeholder", $value); |
35 | 35 | return $this; |
36 | 36 | } |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
20 | - $this->setProperty("value", $value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setProperty("value", $value); |
|
21 | + } |
|
21 | 22 | return $this; |
22 | 23 | } |
23 | 24 | |
@@ -27,11 +28,13 @@ discard block |
||
27 | 28 | |
28 | 29 | public function setPlaceholder($value){ |
29 | 30 | if(JString::isNull($value)){ |
30 | - if(JString::isNotNull($this->identifier)) |
|
31 | - $value=\ucfirst($this->identifier); |
|
31 | + if(JString::isNotNull($this->identifier)) { |
|
32 | + $value=\ucfirst($this->identifier); |
|
33 | + } |
|
34 | + } |
|
35 | + if(JString::isNotNull($value)) { |
|
36 | + $this->setProperty("placeholder", $value); |
|
32 | 37 | } |
33 | - if(JString::isNotNull($value)) |
|
34 | - $this->setProperty("placeholder", $value); |
|
35 | 38 | return $this; |
36 | 39 | } |
37 | 40 | } |
38 | 41 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | class HtmlOption extends HtmlDoubleElement { |
11 | 11 | protected $value; |
12 | 12 | protected $selected; |
13 | - public function __construct($identifier,$caption,$value="") { |
|
13 | + public function __construct($identifier, $caption, $value="") { |
|
14 | 14 | parent::__construct($identifier, "option"); |
15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->selected=""; |
19 | 19 | } |
20 | 20 | |
21 | - public function select(){ |
|
21 | + public function select() { |
|
22 | 22 | $this->selected="selected"; |
23 | 23 | return $this; |
24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | return $this->value; |
28 | 28 | } |
29 | 29 | public function setValue($value) { |
30 | - $this->value = $value; |
|
30 | + $this->value=$value; |
|
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class HtmlImg extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$src="",$alt="") { |
|
10 | + public function __construct($identifier, $src="", $alt="") { |
|
11 | 11 | parent::__construct($identifier, "img"); |
12 | 12 | $this->setSrc($src); |
13 | 13 | $this->setAlt($alt); |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlTextarea extends HtmlDoubleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
10 | + public function __construct($identifier, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
11 | 11 | parent::__construct($identifier, "textarea"); |
12 | 12 | $this->setValue($value); |
13 | 13 | $this->setPlaceholder($placeholder); |
14 | - if(isset($rows)) |
|
14 | + if (isset($rows)) |
|
15 | 15 | $this->setRows($rows); |
16 | 16 | } |
17 | 17 | public function setValue($value) { |
18 | - if(isset($value)) |
|
18 | + if (isset($value)) |
|
19 | 19 | $this->setContent($value); |
20 | 20 | return $this; |
21 | 21 | } |
22 | 22 | |
23 | - public function setPlaceholder($value){ |
|
24 | - if(JString::isNotNull($value)) |
|
23 | + public function setPlaceholder($value) { |
|
24 | + if (JString::isNotNull($value)) |
|
25 | 25 | $this->setProperty("placeholder", $value); |
26 | 26 | return $this; |
27 | 27 | } |
28 | 28 | |
29 | - public function setRows($count){ |
|
29 | + public function setRows($count) { |
|
30 | 30 | $this->setProperty("rows", $count); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -11,18 +11,21 @@ |
||
11 | 11 | parent::__construct($identifier, "textarea"); |
12 | 12 | $this->setValue($value); |
13 | 13 | $this->setPlaceholder($placeholder); |
14 | - if(isset($rows)) |
|
15 | - $this->setRows($rows); |
|
14 | + if(isset($rows)) { |
|
15 | + $this->setRows($rows); |
|
16 | + } |
|
16 | 17 | } |
17 | 18 | public function setValue($value) { |
18 | - if(isset($value)) |
|
19 | - $this->setContent($value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setContent($value); |
|
21 | + } |
|
20 | 22 | return $this; |
21 | 23 | } |
22 | 24 | |
23 | 25 | public function setPlaceholder($value){ |
24 | - if(JString::isNotNull($value)) |
|
25 | - $this->setProperty("placeholder", $value); |
|
26 | + if(JString::isNotNull($value)) { |
|
27 | + $this->setProperty("placeholder", $value); |
|
28 | + } |
|
26 | 29 | return $this; |
27 | 30 | } |
28 | 31 |