Completed
Push — master ( 13fe45...9e80e5 )
by Jean-Christophe
04:06
created
Ajax/semantic/html/collections/HtmlMessage.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,42 +30,42 @@  discard block
 block discarded – undo
30 30
 	 * @param string|HtmlSemDoubleElement $header
31 31
 	 * @return \Ajax\semantic\html\collections\HtmlMessage
32 32
 	 */
33
-	public function addHeader($header){
33
+	public function addHeader($header) {
34 34
 		$headerO=$header;
35
-		if(\is_string($header)){
36
-			$headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div");
35
+		if (\is_string($header)) {
36
+			$headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div");
37 37
 			$headerO->setClass("header");
38 38
 			$headerO->setContent($header);
39 39
 		}
40
-		return $this->addContent($headerO,true);
40
+		return $this->addContent($headerO, true);
41 41
 	}
42 42
 
43
-	public function setHeader($header){
43
+	public function setHeader($header) {
44 44
 		return $this->addHeader($header);
45 45
 	}
46 46
 
47
-	public function addList($elements,$ordered=false){
48
-		$list=new HtmlList("list-".$this->identifier,$elements);
47
+	public function addList($elements, $ordered=false) {
48
+		$list=new HtmlList("list-".$this->identifier, $elements);
49 49
 		$list->setOrdered($ordered);
50 50
 		$list->setClass("ui list");
51 51
 		$this->addContent($list);
52 52
 	}
53 53
 
54
-	public function setIcon($icon){
54
+	public function setIcon($icon) {
55 55
 		$this->addToProperty("class", "icon");
56
-		$this->wrapContent("<div class='content'>","</div>");
56
+		$this->wrapContent("<div class='content'>", "</div>");
57 57
 		$this->icon=new HtmlIcon("icon-".$this->identifier, $icon);
58 58
 		return $this;
59 59
 	}
60 60
 
61
-	public function addLoader($loaderIcon="notched circle"){
61
+	public function addLoader($loaderIcon="notched circle") {
62 62
 		$this->setIcon($loaderIcon);
63 63
 		$this->icon->addToIcon("loading");
64 64
 		return $this;
65 65
 	}
66 66
 
67
-	public function setDismissable($dismiss=true){
68
-		if($dismiss===true)
67
+	public function setDismissable($dismiss=true) {
68
+		if ($dismiss===true)
69 69
 			$this->close=new HtmlIcon("close-".$this->identifier, "close");
70 70
 		else
71 71
 			$this->close=NULL;
@@ -76,38 +76,38 @@  discard block
 block discarded – undo
76 76
 	 * {@inheritDoc}
77 77
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
78 78
 	 */
79
-	public function run(JsUtils $js){
79
+	public function run(JsUtils $js) {
80 80
 		parent::run($js);
81
-		if(isset($this->close)){
81
+		if (isset($this->close)) {
82 82
 			$js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition('fade')");
83 83
 		}
84 84
 	}
85 85
 
86
-	public function setState($visible=true){
87
-		$visible=($visible===true)?"visible":"hidden";
88
-		return $this->addToPropertyCtrl("class", $visible, array("visible","hidden"));
86
+	public function setState($visible=true) {
87
+		$visible=($visible===true) ? "visible" : "hidden";
88
+		return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden"));
89 89
 	}
90 90
 
91
-	public function setVariation($value="floating"){
92
-		return $this->addToPropertyCtrl("class", $value, array("floating","compact"));
91
+	public function setVariation($value="floating") {
92
+		return $this->addToPropertyCtrl("class", $value, array("floating", "compact"));
93 93
 	}
94 94
 
95
-	public function setStyle($style){
95
+	public function setStyle($style) {
96 96
 		return $this->addToPropertyCtrl("class", $style, Style::getConstants());
97 97
 	}
98 98
 
99
-	public function setError(){
99
+	public function setError() {
100 100
 		return $this->setStyle("error");
101 101
 	}
102 102
 
103
-	public function setWarning(){
103
+	public function setWarning() {
104 104
 		return $this->setStyle("warning");
105 105
 	}
106 106
 
107
-	public function setMessage($message){
108
-		if(\is_array($this->content)){
107
+	public function setMessage($message) {
108
+		if (\is_array($this->content)) {
109 109
 			$this->content[\sizeof($this->content)-1]=$message;
110
-		}else
110
+		} else
111 111
 			$this->setContent($message);
112 112
 	}
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -25,23 +25,23 @@  discard block
 block discarded – undo
25 25
  * @property boolean $_edition
26 26
  * @property mixed _modelInstance
27 27
  */
28
-trait FieldAsTrait{
28
+trait FieldAsTrait {
29 29
 
30
-	abstract protected function _getFieldIdentifier($prefix,$name="");
31
-	abstract public function setValueFunction($index,$callback);
30
+	abstract protected function _getFieldIdentifier($prefix, $name="");
31
+	abstract public function setValueFunction($index, $callback);
32 32
 	abstract protected function _getFieldName($index);
33 33
 	abstract protected function _getFieldCaption($index);
34
-	abstract protected function _buttonAsSubmit(HtmlButton &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
34
+	abstract protected function _buttonAsSubmit(HtmlButton&$button, $event, $url, $responseElement=NULL, $parameters=NULL);
35 35
 
36 36
 	/**
37 37
 	 * @param HtmlFormField $element
38 38
 	 * @param array $attributes
39 39
 	 */
40
-	protected function _applyAttributes($element,&$attributes,$index){
41
-		if(isset($attributes["callback"])){
40
+	protected function _applyAttributes($element, &$attributes, $index) {
41
+		if (isset($attributes["callback"])) {
42 42
 			$callback=$attributes["callback"];
43
-			if(\is_callable($callback)){
44
-				$callback($element,$this->_modelInstance,$index);
43
+			if (\is_callable($callback)) {
44
+				$callback($element, $this->_modelInstance, $index);
45 45
 				unset($attributes["callback"]);
46 46
 			}
47 47
 		}
@@ -51,43 +51,43 @@  discard block
 block discarded – undo
51 51
 		$element->fromArray($attributes);
52 52
 	}
53 53
 
54
-	private function _getLabelField($caption,$icon=NULL){
55
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
54
+	private function _getLabelField($caption, $icon=NULL) {
55
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
56 56
 		return $label;
57 57
 	}
58 58
 
59 59
 
60
-	protected function _addRules($element,&$attributes){
61
-		if(isset($attributes["rules"])){
60
+	protected function _addRules($element, &$attributes) {
61
+		if (isset($attributes["rules"])) {
62 62
 			$rules=$attributes["rules"];
63
-			if(\is_array($rules)){
63
+			if (\is_array($rules)) {
64 64
 				$element->addRules($rules);
65 65
 			}
66
-			else{
66
+			else {
67 67
 				$element->addRule($rules);
68 68
 			}
69 69
 			unset($attributes["rules"]);
70 70
 		}
71 71
 	}
72 72
 
73
-	protected function _prepareFormFields(&$field,$name,&$attributes){
73
+	protected function _prepareFormFields(&$field, $name, &$attributes) {
74 74
 		$field->setName($name);
75 75
 		$this->_addRules($field, $attributes);
76 76
 		return $field;
77 77
 	}
78 78
 
79
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
80
-		$this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){
79
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
80
+		$this->setValueFunction($index, function($value, $instance, $index) use (&$attributes, $elementCallback, $prefix){
81 81
 			$caption=$this->_getFieldCaption($index);
82 82
 			$name=$this->_getFieldName($index);
83
-			$id=$this->_getFieldIdentifier($prefix,$name);
84
-			if(isset($attributes["name"])){
83
+			$id=$this->_getFieldIdentifier($prefix, $name);
84
+			if (isset($attributes["name"])) {
85 85
 				$name=$attributes["name"];
86 86
 				unset($attributes["name"]);
87 87
 			}
88
-			$element=$elementCallback($id,$name,$value,$caption);
89
-			if(\is_array($attributes)){
90
-				$this->_applyAttributes($element, $attributes,$index);
88
+			$element=$elementCallback($id, $name, $value, $caption);
89
+			if (\is_array($attributes)) {
90
+				$this->_applyAttributes($element, $attributes, $index);
91 91
 			}
92 92
 			$element->setDisabled(!$this->_edition);
93 93
 			return $element;
@@ -96,169 +96,169 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 
99
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
100
-		$this->setValueFunction($index,function($value) use($label,$attributes){
101
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
99
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
100
+		$this->setValueFunction($index, function($value) use($label, $attributes){
101
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
102 102
 			return $pb;
103 103
 		});
104 104
 			return $this;
105 105
 	}
106 106
 
107
-	public function fieldAsRating($index,$max=5, $icon=""){
108
-		$this->setValueFunction($index,function($value) use($max,$icon){
109
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
107
+	public function fieldAsRating($index, $max=5, $icon="") {
108
+		$this->setValueFunction($index, function($value) use($max, $icon){
109
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
110 110
 			return $rating;
111 111
 		});
112 112
 			return $this;
113 113
 	}
114 114
 
115
-	public function fieldAsLabel($index,$icon=NULL){
116
-		$this->setValueFunction($index,function($caption) use($icon){
117
-			$lbl=$this->_getLabelField($caption,$icon);
115
+	public function fieldAsLabel($index, $icon=NULL) {
116
+		$this->setValueFunction($index, function($caption) use($icon){
117
+			$lbl=$this->_getLabelField($caption, $icon);
118 118
 			return $lbl;
119 119
 		});
120 120
 			return $this;
121 121
 	}
122 122
 
123
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
124
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
125
-			$header=new HtmlHeader($id,$niveau,$value);
126
-			if(isset($icon))
123
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
124
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
125
+			$header=new HtmlHeader($id, $niveau, $value);
126
+			if (isset($icon))
127 127
 				$header->asIcon($icon, $value);
128 128
 			return $header;
129
-		}, $index,$attributes,"header");
129
+		}, $index, $attributes, "header");
130 130
 	}
131 131
 
132 132
 
133
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
134
-		$this->setValueFunction($index,function($img) use($size,$circular){
135
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
133
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
134
+		$this->setValueFunction($index, function($img) use($size, $circular){
135
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
136 136
 			return $image;
137 137
 		});
138 138
 			return $this;
139 139
 	}
140 140
 
141
-	public function fieldAsAvatar($index,$attributes=NULL){
142
-		return $this->_fieldAs(function($id,$name,$value){
143
-			$img=new HtmlImage($id,$value);
141
+	public function fieldAsAvatar($index, $attributes=NULL) {
142
+		return $this->_fieldAs(function($id, $name, $value) {
143
+			$img=new HtmlImage($id, $value);
144 144
 			$img->asAvatar();
145 145
 			return $img;
146
-		}, $index,$attributes,"avatar");
146
+		}, $index, $attributes, "avatar");
147 147
 	}
148 148
 
149
-	public function fieldAsRadio($index,$attributes=NULL){
150
-		return $this->_fieldAs(function($id,$name,$value){
151
-			$input= new HtmlRadio($id,$name,$value,$value);
149
+	public function fieldAsRadio($index, $attributes=NULL) {
150
+		return $this->_fieldAs(function($id, $name, $value) {
151
+			$input=new HtmlRadio($id, $name, $value, $value);
152 152
 			return $input;
153
-		}, $index,$attributes,"radio");
153
+		}, $index, $attributes, "radio");
154 154
 	}
155 155
 
156
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
157
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
158
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
159
-		}, $index,$attributes,"radios");
156
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
157
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
158
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
159
+		}, $index, $attributes, "radios");
160 160
 	}
161 161
 
162
-	public function fieldAsInput($index,$attributes=NULL){
163
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
164
-			$input= new HtmlFormInput($id,$caption,"text",$value);
162
+	public function fieldAsInput($index, $attributes=NULL) {
163
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
164
+			$input=new HtmlFormInput($id, $caption, "text", $value);
165 165
 			return $this->_prepareFormFields($input, $name, $attributes);
166
-		}, $index,$attributes,"input");
166
+		}, $index, $attributes, "input");
167 167
 	}
168 168
 
169
-	public function fieldAsTextarea($index,$attributes=NULL){
170
-		return $this->_fieldAs(function($id,$name,$value,$caption){
171
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
169
+	public function fieldAsTextarea($index, $attributes=NULL) {
170
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
171
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
172 172
 			$textarea->setName($name);
173 173
 			return $textarea;
174
-		}, $index,$attributes,"textarea");
174
+		}, $index, $attributes, "textarea");
175 175
 	}
176 176
 
177
-	public function fieldAsHidden($index,$attributes=NULL){
178
-		if(!\is_array($attributes)){
177
+	public function fieldAsHidden($index, $attributes=NULL) {
178
+		if (!\is_array($attributes)) {
179 179
 			$attributes=[];
180 180
 		}
181 181
 		$attributes["imputType"]="hidden";
182
-		return $this->fieldAsInput($index,$attributes);
182
+		return $this->fieldAsInput($index, $attributes);
183 183
 	}
184 184
 
185
-	public function fieldAsCheckbox($index,$attributes=NULL){
186
-		return $this->_fieldAs(function($id,$name,$value,$caption){
187
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
185
+	public function fieldAsCheckbox($index, $attributes=NULL) {
186
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
187
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
188 188
 			$input->setChecked(JString::isBooleanTrue($value));
189 189
 			$input->setName($name);
190 190
 			return $input;
191
-		}, $index,$attributes,"ck");
191
+		}, $index, $attributes, "ck");
192 192
 	}
193 193
 
194
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
195
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple){
196
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
197
-			$dd->asSelect($name,$multiple);
194
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
195
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple){
196
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
197
+			$dd->asSelect($name, $multiple);
198 198
 			return $dd;
199
-		}, $index,$attributes,"dd");
199
+		}, $index, $attributes, "dd");
200 200
 	}
201 201
 
202
-	public function fieldAsMessage($index,$attributes=NULL){
203
-		return $this->_fieldAs(function($id,$name,$value,$caption){
204
-			$mess= new HtmlMessage("message-".$id,$caption);
202
+	public function fieldAsMessage($index, $attributes=NULL) {
203
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
204
+			$mess=new HtmlMessage("message-".$id, $caption);
205 205
 			$mess->addHeader($value);
206 206
 			return $mess;
207
-		}, $index,$attributes,"message");
207
+		}, $index, $attributes, "message");
208 208
 	}
209 209
 
210
-	public function fieldAsLink($index,$attributes=NULL){
211
-		return $this->_fieldAs(function($id,$name,$value,$caption){
212
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
210
+	public function fieldAsLink($index, $attributes=NULL) {
211
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
212
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
213 213
 			return $lnk;
214
-		}, $index,$attributes,"link");
214
+		}, $index, $attributes, "link");
215 215
 	}
216 216
 
217 217
 	/**Change fields type
218 218
 	 * @param array $types an array or associative array $type=>$attributes
219 219
 	 */
220
-	public function fieldsAs(array $types){
220
+	public function fieldsAs(array $types) {
221 221
 		$i=0;
222
-		if(JArray::isAssociative($types)){
223
-			foreach ($types as $type=>$attributes){
224
-				if(\is_int($type))
225
-					$this->fieldAs($i++,$attributes,[]);
226
-				else{
227
-					$type=preg_replace('/\d/', '', $type );
228
-					$this->fieldAs($i++,$type,$attributes);
222
+		if (JArray::isAssociative($types)) {
223
+			foreach ($types as $type=>$attributes) {
224
+				if (\is_int($type))
225
+					$this->fieldAs($i++, $attributes, []);
226
+				else {
227
+					$type=preg_replace('/\d/', '', $type);
228
+					$this->fieldAs($i++, $type, $attributes);
229 229
 				}
230 230
 			}
231
-		}else{
232
-			foreach ($types as $type){
233
-				$this->fieldAs($i++,$type);
231
+		} else {
232
+			foreach ($types as $type) {
233
+				$this->fieldAs($i++, $type);
234 234
 			}
235 235
 		}
236 236
 	}
237 237
 
238
-	public function fieldAs($index,$type,$attributes=NULL){
238
+	public function fieldAs($index, $type, $attributes=NULL) {
239 239
 		$method="fieldAs".\ucfirst($type);
240
-		if(\method_exists($this, $method)){
241
-			if(!\is_array($attributes)){
240
+		if (\method_exists($this, $method)) {
241
+			if (!\is_array($attributes)) {
242 242
 				$attributes=[$index];
243
-			}else{
243
+			} else {
244 244
 				\array_unshift($attributes, $index);
245 245
 			}
246
-			\call_user_func_array([$this,$method], $attributes);
246
+			\call_user_func_array([$this, $method], $attributes);
247 247
 		}
248 248
 	}
249 249
 
250
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
251
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
252
-			$button=new HtmlButton($id,$caption,$cssStyle);
253
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
250
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
251
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
252
+			$button=new HtmlButton($id, $caption, $cssStyle);
253
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
254 254
 			return $button;
255
-		}, $index,$attributes,"submit");
255
+		}, $index, $attributes, "submit");
256 256
 	}
257 257
 
258
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
259
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
260
-			$button=new HtmlButton($id,$value,$cssStyle);
258
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
259
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
260
+			$button=new HtmlButton($id, $value, $cssStyle);
261 261
 			return $button;
262
-		}, $index,$attributes,"button");
262
+		}, $index, $attributes, "button");
263 263
 	}
264 264
 }
265 265
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormInstanceViewer.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -11,58 +11,58 @@  discard block
 block discarded – undo
11 11
 	protected $headers;
12 12
 	protected $wrappers;
13 13
 
14
-	public function __construct($identifier,$instance=NULL, $captions=NULL) {
15
-		parent::__construct($identifier,$instance=NULL, $captions=NULL);
14
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
15
+		parent::__construct($identifier, $instance=NULL, $captions=NULL);
16 16
 		$this->separators=[-1];
17 17
 		$this->headers=[];
18 18
 		$this->wrappers=[];
19
-		$this->defaultValueFunction=function($name,$value,$index){
19
+		$this->defaultValueFunction=function($name, $value, $index) {
20 20
 			$caption=$this->getCaption($index);
21
-			$input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value);
21
+			$input=new HtmlFormInput($this->widgetIdentifier."-".$name, $caption, "text", $value);
22 22
 			$input->setName($name);
23 23
 			return $input;
24 24
 		};
25 25
 	}
26 26
 
27
-	protected function _beforeAddProperty($index,&$field){
28
-		if(JString::endswith($field, "\n")===true){
27
+	protected function _beforeAddProperty($index, &$field) {
28
+		if (JString::endswith($field, "\n")===true) {
29 29
 			$this->addSeparatorAfter($index);
30 30
 		}
31
-		if($index>1 && JString::startswith($field, "\n")===true){
31
+		if ($index>1 && JString::startswith($field, "\n")===true) {
32 32
 			$this->addSeparatorAfter($index-1);
33 33
 		}
34 34
 		$field=\str_replace("\n", "", $field);
35
-		if(($header=$this->hasHeader($field))!==false){
35
+		if (($header=$this->hasHeader($field))!==false) {
36 36
 			$this->addHeaderDividerBefore($index, $header);
37 37
 		}
38 38
 	}
39 39
 
40
-	protected function hasHeader(&$field){
41
-		$matches=[];$result=false;
42
-		if(\preg_match('/\{(.*?)\}/s', $field, $matches)===1){
40
+	protected function hasHeader(&$field) {
41
+		$matches=[]; $result=false;
42
+		if (\preg_match('/\{(.*?)\}/s', $field, $matches)===1) {
43 43
 			$result=$matches[1];
44
-			$field=\str_replace("{".$result."}","", $field);
44
+			$field=\str_replace("{".$result."}", "", $field);
45 45
 		}
46 46
 		return $result;
47 47
 	}
48 48
 
49 49
 
50 50
 
51
-	public function addSeparatorAfter($fieldNum){
52
-		if(\array_search($fieldNum, $this->separators)===false)
51
+	public function addSeparatorAfter($fieldNum) {
52
+		if (\array_search($fieldNum, $this->separators)===false)
53 53
 			$this->separators[]=$fieldNum;
54 54
 		return $this;
55 55
 	}
56 56
 
57
-	public function addHeaderDividerBefore($fieldNum,$header){
57
+	public function addHeaderDividerBefore($fieldNum, $header) {
58 58
 		$this->headers[$fieldNum]=$header;
59
-		if($fieldNum>0)
59
+		if ($fieldNum>0)
60 60
 			$this->addSeparatorAfter($fieldNum-1);
61 61
 		return $this;
62 62
 	}
63 63
 
64
-	public function addWrapper($fieldNum,$contentBefore,$contentAfter=null){
65
-		$this->wrappers[$fieldNum]=[$contentBefore,$contentAfter];
64
+	public function addWrapper($fieldNum, $contentBefore, $contentAfter=null) {
65
+		$this->wrappers[$fieldNum]=[$contentBefore, $contentAfter];
66 66
 			return $this;
67 67
 	}
68 68
 
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 		return $this->separators;
71 71
 	}
72 72
 
73
-	public function removeSeparator($index){
74
-		\array_splice($this->separators,$index,1);
73
+	public function removeSeparator($index) {
74
+		\array_splice($this->separators, $index, 1);
75 75
 	}
76 76
 
77
-	public function removeField($index){
77
+	public function removeField($index) {
78 78
 		parent::removeField($index);
79 79
 		$pos=\array_search($index, $this->separators);
80
-		if($pos!==false){
81
-			for($i=$pos+1;$i<\sizeof($this->separators);$i++){
80
+		if ($pos!==false) {
81
+			for ($i=$pos+1; $i<\sizeof($this->separators); $i++) {
82 82
 				$this->separators[$i]--;
83 83
 			}
84 84
 			\array_splice($this->separators, $pos, 1);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -19,64 +19,64 @@  discard block
 block discarded – undo
19 19
 class DataForm extends Widget {
20 20
 
21 21
 	public function __construct($identifier, $modelInstance=NULL) {
22
-		parent::__construct($identifier, null,$modelInstance);
22
+		parent::__construct($identifier, null, $modelInstance);
23 23
 		$this->_form=new HtmlForm($identifier);
24 24
 		$this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true);
25 25
 	}
26 26
 
27
-	protected function _getFieldIdentifier($prefix,$name=""){
27
+	protected function _getFieldIdentifier($prefix, $name="") {
28 28
 		return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier();
29 29
 	}
30 30
 
31
-	public function compile(JsUtils $js=NULL,&$view=NULL){
32
-		if(!$this->_generated){
31
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
32
+		if (!$this->_generated) {
33 33
 			$this->_instanceViewer->setInstance($this->_modelInstance);
34 34
 
35 35
 			$form=$this->content["form"];
36 36
 			$this->_generateContent($form);
37 37
 
38
-			if(isset($this->_toolbar)){
38
+			if (isset($this->_toolbar)) {
39 39
 				$this->_setToolbarPosition($form);
40 40
 			}
41
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]);
41
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]);
42 42
 			$this->_generated=true;
43 43
 		}
44
-		return parent::compile($js,$view);
44
+		return parent::compile($js, $view);
45 45
 	}
46 46
 
47 47
 	/**
48 48
 	 * @param HtmlForm $form
49 49
 	 */
50
-	protected function _generateContent($form){
51
-		$values= $this->_instanceViewer->getValues();
50
+	protected function _generateContent($form) {
51
+		$values=$this->_instanceViewer->getValues();
52 52
 		$count=$this->_instanceViewer->count();
53 53
 		$separators=$this->_instanceViewer->getSeparators();
54 54
 		$headers=$this->_instanceViewer->getHeaders();
55 55
 		$wrappers=$this->_instanceViewer->getWrappers();
56 56
 		\sort($separators);
57 57
 		$size=\sizeof($separators);
58
-		if($size===1){
59
-			foreach ($values as $v){
58
+		if ($size===1) {
59
+			foreach ($values as $v) {
60 60
 				$form->addField($v);
61 61
 			}
62
-		}else{
62
+		} else {
63 63
 			$separators[]=$count;
64
-			for($i=0;$i<$size;$i++){
64
+			for ($i=0; $i<$size; $i++) {
65 65
 				$wrapper=null;
66
-				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
67
-				if(isset($headers[$separators[$i]+1]))
68
-					$form->addHeader($headers[$separators[$i]+1],4,true);
69
-				if(isset($wrappers[$separators[$i]+1])){
66
+				$fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]);
67
+				if (isset($headers[$separators[$i]+1]))
68
+					$form->addHeader($headers[$separators[$i]+1], 4, true);
69
+				if (isset($wrappers[$separators[$i]+1])) {
70 70
 					$wrapper=$wrappers[$separators[$i]+1];
71 71
 				}
72 72
 				//TODO check why $fields is empty
73
-				if(\sizeof($fields)===1){
73
+				if (\sizeof($fields)===1) {
74 74
 					$added=$form->addField($fields[0]);
75
-				}elseif(\sizeof($fields)>1){
75
+				}elseif (\sizeof($fields)>1) {
76 76
 					$added=$form->addFields($fields);
77 77
 				}
78
-				if(isset($wrapper))
79
-					$added->wrap($wrapper[0],$wrapper[1]);
78
+				if (isset($wrapper))
79
+					$added->wrap($wrapper[0], $wrapper[1]);
80 80
 			}
81 81
 		}
82 82
 	}
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 	 * {@inheritDoc}
86 86
 	 * @see \Ajax\common\Widget::getForm()
87 87
 	 */
88
-	public function getForm(){
88
+	public function getForm() {
89 89
 		return $this->content["form"];
90 90
 	}
91 91
 
92
-	public function addSeparatorAfter($fieldNum){
92
+	public function addSeparatorAfter($fieldNum) {
93 93
 		$fieldNum=$this->_getIndex($fieldNum);
94 94
 		$this->_instanceViewer->addSeparatorAfter($fieldNum);
95 95
 		return $this;
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 		return $this;
105 105
 	}
106 106
 
107
-	public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){
108
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
109
-			$button=new HtmlButton($id,$value,$cssStyle);
107
+	public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) {
108
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
109
+			$button=new HtmlButton($id, $value, $cssStyle);
110 110
 			$button->setProperty("type", "reset");
111 111
 			return $button;
112
-		}, $index,$attributes);
112
+		}, $index, $attributes);
113 113
 	}
114 114
 
115 115
 	/**
@@ -128,19 +128,19 @@  discard block
 block discarded – undo
128 128
 		$this->content[$this->_toolbarPosition]=$this->_toolbar;
129 129
 	}
130 130
 
131
-	public function addDividerBefore($index,$title){
131
+	public function addDividerBefore($index, $title) {
132 132
 		$index=$this->_getIndex($index);
133 133
 		$this->_instanceViewer->addHeaderDividerBefore($index, $title);
134 134
 		return $this;
135 135
 	}
136 136
 
137
-	public function addWrapper($index,$contentBefore,$contentAfter=null){
137
+	public function addWrapper($index, $contentBefore, $contentAfter=null) {
138 138
 		$index=$this->_getIndex($index);
139
-		$this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter);
139
+		$this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter);
140 140
 		return $this;
141 141
 	}
142 142
 
143
-	public function run(JsUtils $js){
143
+	public function run(JsUtils $js) {
144 144
 		return parent::run($js);
145 145
 	}
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/business/user/FormLogin.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,50 +10,50 @@
 block discarded – undo
10 10
 	 * @param string $identifier
11 11
 	 * @param object $modelInstance
12 12
 	 */
13
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) {
14
-		parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators);
13
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) {
14
+		parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
15 15
 	}
16 16
 
17
-	protected function getDefaultModelInstance(){
17
+	protected function getDefaultModelInstance() {
18 18
 		return new UserModel();
19 19
 	}
20 20
 
21
-	public static function regular($identifier,$modelInstance=null){
22
-		return new FormLogin($identifier,$modelInstance,
23
-				["message","login","password","remember","forget","submit","error"],
24
-				["message"=>[["icon"=>"sign in"]],"input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"checkbox","link","submit"=>["green fluid"],"message2"=>[["error"=>true]]],
25
-				["Connection","login","password","remember","forget","submit","error"],
26
-				["Please enter login and password to connect","Login","Password","Remember me.","Forgot your password?","Connection"],
27
-				[0,2,4,5,6]);
21
+	public static function regular($identifier, $modelInstance=null) {
22
+		return new FormLogin($identifier, $modelInstance,
23
+				["message", "login", "password", "remember", "forget", "submit", "error"],
24
+				["message"=>[["icon"=>"sign in"]], "input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "checkbox", "link", "submit"=>["green fluid"], "message2"=>[["error"=>true]]],
25
+				["Connection", "login", "password", "remember", "forget", "submit", "error"],
26
+				["Please enter login and password to connect", "Login", "Password", "Remember me.", "Forgot your password?", "Connection"],
27
+				[0, 2, 4, 5, 6]);
28 28
 	}
29 29
 
30
-	public static function smallInline($identifier,$modelInstance=null){
31
-		$result=new FormLogin($identifier,$modelInstance,
32
-				["login","password","submit"],
33
-				["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]],
34
-				["login","password","submit"],
35
-				["","","Connection"],
30
+	public static function smallInline($identifier, $modelInstance=null) {
31
+		$result=new FormLogin($identifier, $modelInstance,
32
+				["login", "password", "submit"],
33
+				["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]],
34
+				["login", "password", "submit"],
35
+				["", "", "Connection"],
36 36
 				[2]);
37 37
 			$result->addDividerBefore(0, "Connection");
38 38
 		return $result;
39 39
 	}
40 40
 
41
-	public static function small($identifier,$modelInstance=null){
42
-		$result=new FormLogin($identifier,$modelInstance,
43
-				["login","password","submit"],
44
-				["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]],
45
-				["login","password","submit"],
46
-				["Login","Password","Connection"],
47
-				[1,2]);
41
+	public static function small($identifier, $modelInstance=null) {
42
+		$result=new FormLogin($identifier, $modelInstance,
43
+				["login", "password", "submit"],
44
+				["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]],
45
+				["login", "password", "submit"],
46
+				["Login", "Password", "Connection"],
47
+				[1, 2]);
48 48
 		$result->addDividerBefore(0, "Connection");
49 49
 		return $result;
50 50
 	}
51 51
 
52
-	public static function attachedSegment($identifier,$modelInstance=null){
53
-		$result=self::regular($identifier,$modelInstance);
54
-		$result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]);
55
-		$result->addWrapper("message",null,"<div class='ui attached segment'>");
56
-		$result->addWrapper("error", null,"</div>");
52
+	public static function attachedSegment($identifier, $modelInstance=null) {
53
+		$result=self::regular($identifier, $modelInstance);
54
+		$result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]);
55
+		$result->addWrapper("message", null, "<div class='ui attached segment'>");
56
+		$result->addWrapper("error", null, "</div>");
57 57
 		return $result;
58 58
 	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/traits/SemanticWidgetsTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	 * @param array $instances
17 17
 	 * @return DataTable
18 18
 	 */
19
-	public function dataTable($identifier,$model, $instances){
20
-		return $this->addHtmlComponent(new DataTable($identifier,$model,$instances));
19
+	public function dataTable($identifier, $model, $instances) {
20
+		return $this->addHtmlComponent(new DataTable($identifier, $model, $instances));
21 21
 	}
22 22
 
23 23
 	/**
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param object $instance
26 26
 	 * @return DataElement
27 27
 	 */
28
-	public function dataElement($identifier, $instance){
29
-		return $this->addHtmlComponent(new DataElement($identifier,$instance));
28
+	public function dataElement($identifier, $instance) {
29
+		return $this->addHtmlComponent(new DataElement($identifier, $instance));
30 30
 	}
31 31
 
32 32
 	/**
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 	 * @param object $instance
35 35
 	 * @return DataForm
36 36
 	 */
37
-	public function dataForm($identifier, $instance){
38
-		return $this->addHtmlComponent(new DataForm($identifier,$instance));
37
+	public function dataForm($identifier, $instance) {
38
+		return $this->addHtmlComponent(new DataForm($identifier, $instance));
39 39
 	}
40 40
 
41
-	public function defaultLogin($identifier,$instance=null){
42
-		return $this->addHtmlComponent(FormLogin::regular($identifier,$instance));
41
+	public function defaultLogin($identifier, $instance=null) {
42
+		return $this->addHtmlComponent(FormLogin::regular($identifier, $instance));
43 43
 	}
44 44
 
45
-	public function smallLogin($identifier,$instance=null){
46
-		return $this->addHtmlComponent(FormLogin::small($identifier,$instance));
45
+	public function smallLogin($identifier, $instance=null) {
46
+		return $this->addHtmlComponent(FormLogin::small($identifier, $instance));
47 47
 	}
48 48
 
49
-	public function segmentedLogin($identifier,$instance=null){
50
-		return $this->addHtmlComponent(FormLogin::attachedSegment($identifier,$instance));
49
+	public function segmentedLogin($identifier, $instance=null) {
50
+		return $this->addHtmlComponent(FormLogin::attachedSegment($identifier, $instance));
51 51
 	}
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  * @version 1.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 	protected $_template;
20 20
 	protected $tagName;
21
-	protected $_wrapBefore=array ();
22
-	protected $_wrapAfter=array ();
21
+	protected $_wrapBefore=array();
22
+	protected $_wrapAfter=array();
23 23
 	protected $_bsComponent;
24 24
 
25 25
 	/**
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	abstract public function run(JsUtils $js);
31 31
 
32
-	private function _callSetter($setter,$key,$value,&$array){
32
+	private function _callSetter($setter, $key, $value, &$array) {
33 33
 		$result=false;
34 34
 		if (method_exists($this, $setter) && !JString::startswith($key, "_")) {
35 35
 			try {
36 36
 				$this->$setter($value);
37 37
 				unset($array[$key]);
38 38
 				$result=true;
39
-			} catch ( \Exception $e ) {
39
+			}catch (\Exception $e) {
40 40
 				$result=false;
41 41
 			}
42 42
 		}
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 	}
45 45
 
46 46
 	protected function getTemplate(JsUtils $js=NULL) {
47
-		return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js);
47
+		return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js);
48 48
 	}
49 49
 
50 50
 	protected function ctrl($name, $value, $typeCtrl) {
51 51
 		if (\is_array($typeCtrl)) {
52
-			if (array_search($value, $typeCtrl) === false) {
53
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
52
+			if (array_search($value, $typeCtrl)===false) {
53
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
54 54
 			}
55 55
 		} else {
56 56
 			if (!$typeCtrl($value)) {
57
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
57
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
58 58
 			}
59 59
 		}
60 60
 		return true;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 
65 65
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
66
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
66
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
67 67
 			return $name=$value;
68 68
 		}
69 69
 		return $this;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
73 73
 		if (\is_array($typeCtrl)) {
74 74
 			$this->removeOldValues($name, $typeCtrl);
75
-			$name.=$separator . $value;
75
+			$name.=$separator.$value;
76 76
 		}
77 77
 		return $this;
78 78
 	}
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
83
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
83
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
84 84
 			if (\is_array($typeCtrl)) {
85 85
 				$this->removeOldValues($name, $typeCtrl);
86 86
 			}
87
-			$name.=$separator . $value;
87
+			$name.=$separator.$value;
88 88
 		}
89 89
 		return $this;
90 90
 	}
91 91
 
92 92
 	protected function addToMember(&$name, $value, $separator=" ") {
93
-		$name=str_ireplace($value, "", $name) . $separator . $value;
93
+		$name=str_ireplace($value, "", $name).$separator.$value;
94 94
 		return $this;
95 95
 	}
96 96
 
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
 		$oldValue=trim($oldValue);
102 102
 	}
103 103
 
104
-	protected function _getElementBy($callback,$elements){
104
+	protected function _getElementBy($callback, $elements) {
105 105
 		if (\is_array($elements)) {
106 106
 			$flag=false;
107 107
 			$index=0;
108
-			while ( !$flag && $index < sizeof($elements) ) {
108
+			while (!$flag && $index<sizeof($elements)) {
109 109
 				if ($elements[$index] instanceof BaseHtml)
110 110
 					$flag=($callback($elements[$index]));
111 111
 					$index++;
112 112
 			}
113
-			if ($flag === true)
114
-				return $elements[$index - 1];
113
+			if ($flag===true)
114
+				return $elements[$index-1];
115 115
 		} elseif ($elements instanceof BaseHtml) {
116 116
 			if ($callback($elements))
117 117
 				return $elements;
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 	}
140 140
 
141 141
 	public function fromArray($array) {
142
-		foreach ( $this as $key => $value ) {
143
-			if(array_key_exists($key, $array)===true)
144
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
142
+		foreach ($this as $key => $value) {
143
+			if (array_key_exists($key, $array)===true)
144
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
145 145
 		}
146
-		foreach ( $array as $key => $value ) {
147
-			if($this->_callSetter($key, $key, $value, $array)===false){
148
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
146
+		foreach ($array as $key => $value) {
147
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
148
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
149 149
 			}
150 150
 		}
151 151
 		return $array;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 	public function fromDatabaseObjects($objects, $function) {
155 155
 		if (isset($objects)) {
156
-			foreach ( $objects as $object ) {
156
+			foreach ($objects as $object) {
157 157
 				$this->fromDatabaseObject($object, $function);
158 158
 			}
159 159
 		}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 	public function getElementById($identifier, $elements) {
177
-		return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements);
177
+		return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements);
178 178
 	}
179 179
 
180 180
 	public function getBsComponent() {
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 
189 189
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
190 190
 		$result=$this->getTemplate($js);
191
-		foreach ( $this as $key => $value ) {
192
-			if (JString::startswith($key, "_") === false && $key !== "events") {
191
+		foreach ($this as $key => $value) {
192
+			if (JString::startswith($key, "_")===false && $key!=="events") {
193 193
 				if (\is_array($value)) {
194 194
 					$v=PropertyWrapper::wrap($value, $js);
195 195
 				} else {
196 196
 					$v=$value;
197 197
 				}
198
-				$result=str_ireplace("%" . $key . "%", $v, $result);
198
+				$result=str_ireplace("%".$key."%", $v, $result);
199 199
 			}
200 200
 		}
201 201
 		if (isset($js)===true) {
202 202
 			$this->run($js);
203
-			if (isset($view) === true) {
203
+			if (isset($view)===true) {
204 204
 				$js->addViewElement($this->_identifier, $result, $view);
205 205
 			}
206 206
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlSearch.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 use Ajax\semantic\html\base\constants\Direction;
9 9
 
10 10
 class HtmlSearch extends HtmlSemDoubleElement {
11
-	private $_elements=array ();
12
-	private $_searchFields=array ("title" );
11
+	private $_elements=array();
12
+	private $_searchFields=array("title");
13 13
 	private $_local=false;
14 14
 
15 15
 	public function __construct($identifier, $placeholder=NULL, $icon=NULL) {
16
-		parent::__construct("search-" . $identifier, "div", "ui search", array ());
16
+		parent::__construct("search-".$identifier, "div", "ui search", array());
17 17
 		$this->_identifier=$identifier;
18 18
 		$this->createField($placeholder, $icon);
19 19
 		$this->createResult();
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	private function createResult() {
36
-		$this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results");
36
+		$this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results");
37 37
 		return $this->content["result"];
38 38
 	}
39 39
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	public function setUrl($url) {
53
-		$this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%";
53
+		$this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%";
54 54
 		return $this;
55 55
 	}
56 56
 
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	public function run(JsUtils $js) {
76
-		$this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%';
76
+		$this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%';
77 77
 		$searchFields=\json_encode($this->_searchFields);
78 78
 		$searchFields=str_ireplace("\"", "%quote%", $searchFields);
79
-		$this->_params["searchFields"]="%" . $searchFields . "%";
80
-		if ($this->_local === true) {
79
+		$this->_params["searchFields"]="%".$searchFields."%";
80
+		if ($this->_local===true) {
81 81
 			$this->_params["source"]="%content%";
82
-			$this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
82
+			$this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";");
83 83
 		}
84
-		if (isset($this->_bsComponent) === false) {
85
-			$this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params);
84
+		if (isset($this->_bsComponent)===false) {
85
+			$this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params);
86 86
 		}
87 87
 		$this->addEventsOnRun($js);
88 88
 		return $this->_bsComponent;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormCheckbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 class HtmlFormCheckbox extends HtmlFormField {
16 16
 	use CheckboxTrait;
17 17
 	public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) {
18
-		parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type));
18
+		parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type));
19 19
 		$this->_identifier=$identifier;
20 20
 	}
21 21
 
Please login to merge, or discard this patch.