@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | public function addDimmer($content=NULL) { |
49 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
49 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
50 | 50 | $this->addContent($dimmer); |
51 | 51 | return $dimmer; |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function jsShowDimmer($show=true) { |
55 | 55 | $status="hide"; |
56 | - if ($show === true) |
|
56 | + if ($show===true) |
|
57 | 57 | $status="show"; |
58 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
58 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | public function run(JsUtils $js) { |
68 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
68 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
69 | 69 | parent::run($js); |
70 | 70 | $this->addEventsOnRun($js); |
71 | 71 | if (isset($this->_popup)) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->startIndex=$startIndex; |
52 | 52 | $this->autoActive=$autoActive; |
53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
54 | - $this->_hrefFunction=function ($e) { |
|
54 | + $this->_hrefFunction=function($e) { |
|
55 | 55 | return $e->getContent(); |
56 | 56 | }; |
57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setActive($index=null) { |
82 | 82 | if (!isset($index)) { |
83 | - $index=sizeof($this->content) - 1; |
|
83 | + $index=sizeof($this->content)-1; |
|
84 | 84 | } |
85 | 85 | $activeItem=$this->content[$index]; |
86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $this->startIndex=$startIndex; |
97 | 97 | $params=$dispatcher->getParams(); |
98 | 98 | $action=$dispatcher->getActionName(); |
99 | - $items=array ($dispatcher->getControllerName() ); |
|
100 | - if (\sizeof($params) > 0 || \strtolower($action) != "index") { |
|
99 | + $items=array($dispatcher->getControllerName()); |
|
100 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
101 | 101 | $items[]=$action; |
102 | - foreach ( $params as $p ) { |
|
103 | - if (\is_object($p) === false) |
|
102 | + foreach ($params as $p) { |
|
103 | + if (\is_object($p)===false) |
|
104 | 104 | $items[]=$p; |
105 | 105 | } |
106 | 106 | } |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | if (!isset($index)) { |
118 | 118 | $index=sizeof($this->content); |
119 | 119 | } |
120 | - if ($this->absolutePaths === true) { |
|
120 | + if ($this->absolutePaths===true) { |
|
121 | 121 | return $this->_hrefFunction($this->content[$index]); |
122 | - } else { |
|
123 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
122 | + }else { |
|
123 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
124 | 124 | return $this->_hrefFunction($e); |
125 | - }, $this->content), $this->startIndex, $index + 1)); |
|
125 | + }, $this->content), $this->startIndex, $index+1)); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | $this->setActive(); |
157 | 157 | } |
158 | 158 | $count=$this->count(); |
159 | - for($i=1; $i < $count; $i++) { |
|
160 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
159 | + for ($i=1; $i<$count; $i++) { |
|
160 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
161 | 161 | } |
162 | 162 | return parent::compile($js, $view); |
163 | 163 | } |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
168 | 168 | */ |
169 | 169 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
170 | - foreach ( $this->content as $element ) { |
|
170 | + foreach ($this->content as $element) { |
|
171 | 171 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
172 | 172 | } |
173 | 173 | return $this; |
174 | 174 | } |
175 | 175 | |
176 | 176 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
177 | - foreach ( $this->content as $element ) { |
|
178 | - if ($element->getProperty($this->attr) != NULL) |
|
177 | + foreach ($this->content as $element) { |
|
178 | + if ($element->getProperty($this->attr)!=NULL) |
|
179 | 179 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
180 | 180 | } |
181 | 181 | return $this; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function createItem($value) { |
191 | 191 | $count=$this->count(); |
192 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
192 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
193 | 193 | if (\is_array($value)) |
194 | 194 | $itemO->fromArray($value); |
195 | 195 | else { |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | public function addIconAt($icon, $index) { |
203 | 203 | $item=$this->getItem($index); |
204 | 204 | if (isset($item)) { |
205 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
205 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
206 | 206 | $item->wrapContent($icon); |
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | 210 | public function addItem($item) { |
211 | 211 | $itemO=parent::addItem($item); |
212 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
212 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
213 | 213 | return $itemO; |
214 | 214 | } |
215 | 215 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 9 | |
10 | 10 | trait BaseTrait { |
11 | - protected $_variations=[ ]; |
|
12 | - protected $_states=[ ]; |
|
11 | + protected $_variations=[]; |
|
12 | + protected $_states=[]; |
|
13 | 13 | protected $_baseClass; |
14 | 14 | |
15 | 15 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->setProperty("class", $this->_baseClass); |
38 | 38 | if (\is_string($variations)) |
39 | 39 | $variations=\explode(" ", $variations); |
40 | - foreach ( $variations as $variation ) { |
|
40 | + foreach ($variations as $variation) { |
|
41 | 41 | $this->addVariation($variation); |
42 | 42 | } |
43 | 43 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function addVariations($variations=array()) { |
52 | 52 | if (\is_string($variations)) |
53 | 53 | $variations=\explode(" ", $variations); |
54 | - foreach ( $variations as $variation ) { |
|
54 | + foreach ($variations as $variation) { |
|
55 | 55 | $this->addVariation($variation); |
56 | 56 | } |
57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function addStates($states=array()) { |
61 | 61 | if (\is_string($states)) |
62 | 62 | $states=\explode(" ", $states); |
63 | - foreach ( $states as $state ) { |
|
63 | + foreach ($states as $state) { |
|
64 | 64 | $this->addState($state); |
65 | 65 | } |
66 | 66 | return $this; |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | $this->setProperty("class", $this->_baseClass); |
71 | 71 | if (\is_string($states)) |
72 | 72 | $states=\explode(" ", $states); |
73 | - foreach ( $states as $state ) { |
|
73 | + foreach ($states as $state) { |
|
74 | 74 | $this->addState($state); |
75 | 75 | } |
76 | 76 | return $this; |
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addIcon($icon, $before=true) { |
80 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
80 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | public function setFloated($direction="right") { |
130 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
130 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function floatRight() { |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | $output=$input; |
13 | 13 | } |
14 | 14 | if (is_array($input)) { |
15 | - if (sizeof($input) > 0) { |
|
16 | - if (self::containsElement($input) === false) { |
|
15 | + if (sizeof($input)>0) { |
|
16 | + if (self::containsElement($input)===false) { |
|
17 | 17 | $output=self::wrapStrings($input, $js, $separator=' ', $valueQuote='"'); |
18 | - } else { |
|
18 | + }else { |
|
19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
20 | 20 | } |
21 | 21 | } |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
28 | - if (\is_object($v) === true || \is_array($v)) |
|
27 | + foreach ($input as $v) { |
|
28 | + if (\is_object($v)===true || \is_array($v)) |
|
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | return false; |
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function wrapStrings($input, $js, $separator=' ', $valueQuote='"') { |
35 | - if (JArray::isAssociative($input) === true) { |
|
36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
35 | + if (JArray::isAssociative($input)===true) { |
|
36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
38 | 38 | }, $input, array_keys($input))); |
39 | - } else { |
|
39 | + }else { |
|
40 | 40 | $result=implode($separator, array_values($input)); |
41 | 41 | } |
42 | 42 | return $result; |
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
47 | 47 | if (is_object($v)) |
48 | 48 | return $v->compile($js); |
49 | 49 | elseif (\is_array($v)) { |
50 | 50 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } else |
|
51 | + }else |
|
52 | 52 | return $v; |
53 | 53 | }, $input)); |
54 | 54 | } |
@@ -24,8 +24,8 @@ |
||
24 | 24 | use Ajax\semantic\traits\SemanticHtmlViewsTrait; |
25 | 25 | |
26 | 26 | class Semantic extends BaseGui { |
27 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
28 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait; |
|
27 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
28 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait; |
|
29 | 29 | |
30 | 30 | public function __construct($autoCompile=true) { |
31 | 31 | parent::__construct($autoCompile=true); |
@@ -21,13 +21,13 @@ |
||
21 | 21 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::run() |
22 | 22 | */ |
23 | 23 | public function run(JsUtils $js) { |
24 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
24 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
25 | 25 | $this->addEventsOnRun($js); |
26 | 26 | return $this->_bsComponent; |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function addIcon($icon, $before=true) { |
30 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
30 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public static function icon($identifier, $icon, $href="#", $label=NULL) { |
@@ -16,8 +16,8 @@ |
||
16 | 16 | |
17 | 17 | public function addIcon($icon, $before=true) { |
18 | 18 | $content=$this->content; |
19 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content"); |
|
19 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
20 | 20 | $this->content->setContent($content); |
21 | - $this->content->addContent(new HtmlIcon("icon" . $this->identifier, $icon), $before); |
|
21 | + $this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon), $before); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | 18 | protected $_template; |
19 | 19 | protected $tagName; |
20 | - protected $properties=array (); |
|
21 | - protected $_events=array (); |
|
22 | - protected $_wrapBefore=array (); |
|
23 | - protected $_wrapAfter=array (); |
|
20 | + protected $properties=array(); |
|
21 | + protected $_events=array(); |
|
22 | + protected $_wrapBefore=array(); |
|
23 | + protected $_wrapAfter=array(); |
|
24 | 24 | protected $_bsComponent; |
25 | 25 | |
26 | 26 | public function getBsComponent() { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | protected function getTemplate(JsUtils $js=NULL) { |
36 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
36 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function getProperties() { |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | public function addToProperty($name, $value, $separator=" ") { |
59 | 59 | if (\is_array($value)) { |
60 | - foreach ( $value as $v ) { |
|
60 | + foreach ($value as $v) { |
|
61 | 61 | $this->addToProperty($name, $v, $separator); |
62 | 62 | } |
63 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
63 | + }else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
64 | 64 | $v=@$this->properties[$name]; |
65 | - if (isset($v) && $v !== "") |
|
66 | - $v=$v . $separator . $value; |
|
65 | + if (isset($v) && $v!=="") |
|
66 | + $v=$v.$separator.$value; |
|
67 | 67 | else |
68 | 68 | $v=$value; |
69 | 69 | |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | |
80 | 80 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
81 | 81 | $result=$this->getTemplate($js); |
82 | - foreach ( $this as $key => $value ) { |
|
83 | - if (PhalconUtils::startsWith($key, "_") === false && $key !== "events") { |
|
82 | + foreach ($this as $key => $value) { |
|
83 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
84 | 84 | if (is_array($value)) { |
85 | 85 | $v=PropertyWrapper::wrap($value, $js); |
86 | - } else { |
|
86 | + }else { |
|
87 | 87 | $v=$value; |
88 | 88 | } |
89 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
89 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | if (isset($js)) { |
93 | 93 | $this->run($js); |
94 | 94 | } |
95 | - if (isset($view) === true) { |
|
95 | + if (isset($view)===true) { |
|
96 | 96 | $controls=$view->getVar("q"); |
97 | - if (isset($controls) === false) { |
|
98 | - $controls=array (); |
|
97 | + if (isset($controls)===false) { |
|
98 | + $controls=array(); |
|
99 | 99 | } |
100 | 100 | $controls[$this->identifier]=$result; |
101 | 101 | $view->setVar("q", $controls); |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | |
106 | 106 | protected function ctrl($name, $value, $typeCtrl) { |
107 | 107 | if (is_array($typeCtrl)) { |
108 | - if (array_search($value, $typeCtrl) === false) { |
|
109 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
108 | + if (array_search($value, $typeCtrl)===false) { |
|
109 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
110 | 110 | } |
111 | - } else { |
|
111 | + }else { |
|
112 | 112 | if (!$typeCtrl($value)) { |
113 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
113 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return true; |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
129 | 129 | return $this->setProperty($name, $value); |
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
134 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
134 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
135 | 135 | return $name=$value; |
136 | 136 | } |
137 | 137 | return $this; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
141 | 141 | if (is_array($typeCtrl)) { |
142 | 142 | $this->removeOldValues($name, $typeCtrl); |
143 | - $name.=$separator . $value; |
|
143 | + $name.=$separator.$value; |
|
144 | 144 | } |
145 | 145 | return $this; |
146 | 146 | } |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
165 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
165 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
166 | 166 | if (is_array($typeCtrl)) { |
167 | 167 | $this->removeOldValues($name, $typeCtrl); |
168 | 168 | } |
169 | - $name.=$separator . $value; |
|
169 | + $name.=$separator.$value; |
|
170 | 170 | } |
171 | 171 | return $this; |
172 | 172 | } |
173 | 173 | |
174 | 174 | protected function addToMember(&$name, $value, $separator=" ") { |
175 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
175 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
176 | 176 | return $this; |
177 | 177 | } |
178 | 178 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
193 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
193 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
194 | 194 | return $this->addToProperty($name, $value); |
195 | 195 | } |
196 | 196 | return $this; |
@@ -218,28 +218,28 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | public function fromArray($array) { |
221 | - foreach ( $this as $key => $value ) { |
|
221 | + foreach ($this as $key => $value) { |
|
222 | 222 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
223 | - $setter="set" . ucfirst($key); |
|
223 | + $setter="set".ucfirst($key); |
|
224 | 224 | $this->$setter($array[$key]); |
225 | 225 | unset($array[$key]); |
226 | 226 | } |
227 | 227 | } |
228 | - foreach ( $array as $key => $value ) { |
|
228 | + foreach ($array as $key => $value) { |
|
229 | 229 | if (method_exists($this, $key)) { |
230 | 230 | try { |
231 | 231 | $this->$key($value); |
232 | 232 | unset($array[$key]); |
233 | - } catch ( \Exception $e ) { |
|
233 | + } catch (\Exception $e) { |
|
234 | 234 | // Nothing to do |
235 | 235 | } |
236 | - } else { |
|
237 | - $setter="set" . ucfirst($key); |
|
236 | + }else { |
|
237 | + $setter="set".ucfirst($key); |
|
238 | 238 | if (method_exists($this, $setter)) { |
239 | 239 | try { |
240 | 240 | $this->$setter($value); |
241 | 241 | unset($array[$key]); |
242 | - } catch ( \Exception $e ) { |
|
242 | + } catch (\Exception $e) { |
|
243 | 243 | // Nothing to do |
244 | 244 | } |
245 | 245 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | public function fromDatabaseObjects($objects, $function) { |
252 | 252 | if (isset($objects)) { |
253 | - foreach ( $objects as $object ) { |
|
253 | + foreach ($objects as $object) { |
|
254 | 254 | $this->fromDatabaseObject($object, $function); |
255 | 255 | } |
256 | 256 | } |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
273 | - if ($stopPropagation === true) { |
|
274 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
273 | + if ($stopPropagation===true) { |
|
274 | + $jsCode="event.stopPropagation();".$jsCode; |
|
275 | 275 | } |
276 | - if ($preventDefault === true) { |
|
277 | - $jsCode="event.preventDefault();" . $jsCode; |
|
276 | + if ($preventDefault===true) { |
|
277 | + $jsCode="event.preventDefault();".$jsCode; |
|
278 | 278 | } |
279 | 279 | return $this->_addEvent($event, $jsCode); |
280 | 280 | } |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | if (array_key_exists($event, $this->_events)) { |
284 | 284 | if (is_array($this->_events[$event])) { |
285 | 285 | $this->_events[$event][]=$jsCode; |
286 | - } else { |
|
287 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
286 | + }else { |
|
287 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
288 | 288 | } |
289 | - } else { |
|
289 | + }else { |
|
290 | 290 | $this->_events[$event]=$jsCode; |
291 | 291 | } |
292 | 292 | return $this; |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | |
307 | 307 | public function addEventsOnRun(JsUtils $js) { |
308 | 308 | if (isset($this->_bsComponent)) { |
309 | - foreach ( $this->_events as $event => $jsCode ) { |
|
309 | + foreach ($this->_events as $event => $jsCode) { |
|
310 | 310 | $code=$jsCode; |
311 | 311 | if (is_array($jsCode)) { |
312 | 312 | $code=""; |
313 | - foreach ( $jsCode as $jsC ) { |
|
313 | + foreach ($jsCode as $jsC) { |
|
314 | 314 | if ($jsC instanceof AjaxCall) { |
315 | - $code.="\n" . $jsC->compile($js); |
|
316 | - } else { |
|
317 | - $code.="\n" . $jsC; |
|
315 | + $code.="\n".$jsC->compile($js); |
|
316 | + }else { |
|
317 | + $code.="\n".$jsC; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -322,12 +322,12 @@ discard block |
||
322 | 322 | } |
323 | 323 | $this->_bsComponent->addEvent($event, $code); |
324 | 324 | } |
325 | - $this->_events=array (); |
|
325 | + $this->_events=array(); |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | 329 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
330 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
330 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
331 | 331 | $params=array_merge($params, $parameters); |
332 | 332 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
333 | 333 | return $this; |
@@ -363,15 +363,15 @@ discard block |
||
363 | 363 | if (is_array($elements)) { |
364 | 364 | $flag=false; |
365 | 365 | $index=0; |
366 | - while ( !$flag && $index < sizeof($elements) ) { |
|
366 | + while (!$flag && $index<sizeof($elements)) { |
|
367 | 367 | if ($elements[$index] instanceof BaseHtml) |
368 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
368 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
369 | 369 | $index++; |
370 | 370 | } |
371 | - if ($flag === true) |
|
372 | - return $elements[$index - 1]; |
|
371 | + if ($flag===true) |
|
372 | + return $elements[$index-1]; |
|
373 | 373 | } elseif ($elements instanceof BaseHtml) { |
374 | - if ($elements->getIdentifier() === $identifier) |
|
374 | + if ($elements->getIdentifier()===$identifier) |
|
375 | 375 | return $elements; |
376 | 376 | } |
377 | 377 | return null; |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | if (is_array($value)) { |
394 | 394 | $value=implode(",", $value); |
395 | 395 | } |
396 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
397 | - $value='"' . $value . '"'; |
|
396 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
397 | + $value='"'.$value.'"'; |
|
398 | 398 | } |
399 | 399 | return $value; |
400 | 400 | } |
401 | 401 | |
402 | 402 | public function jsDoJquery($jqueryCall, $param="") { |
403 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
403 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | public function executeOnRun($jsCode) { |
@@ -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)) { |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function getConstantValues($postFix="") { |
27 | - if ($postFix == "") |
|
27 | + if ($postFix=="") |
|
28 | 28 | return \array_values(self::getConstants()); |
29 | 29 | else { |
30 | - return \array_map(function ($elem) use($postFix) { |
|
31 | - return $elem . " " . $postFix; |
|
30 | + return \array_map(function($elem) use($postFix) { |
|
31 | + return $elem." ".$postFix; |
|
32 | 32 | }, \array_values(self::getConstants())); |
33 | 33 | } |
34 | 34 | } |