Completed
Push — master ( 73aa8e...3a9bcf )
by Jean-Christophe
06:21
created
Ajax/common/html/BaseHtml.php 3 patches
Doc Comments   +42 added lines patch added patch discarded remove patch
@@ -124,6 +124,10 @@  discard block
 block discarded – undo
124 124
 		return $this;
125 125
 	}
126 126
 
127
+	/**
128
+	 * @param string $name
129
+	 * @param string[] $typeCtrl
130
+	 */
127 131
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
128 132
 		if ($this->ctrl($name, $value, $typeCtrl) === true) {
129 133
 			return $name=$value;
@@ -139,22 +143,35 @@  discard block
 block discarded – undo
139 143
 		return $this;
140 144
 	}
141 145
 
146
+	/**
147
+	 * @param string $name
148
+	 */
142 149
 	protected function removePropertyValue($name, $value) {
143 150
 		$this->properties[$name]=\str_replace($value, "", $this->properties[$name]);
144 151
 		return $this;
145 152
 	}
146 153
 
154
+	/**
155
+	 * @param string $name
156
+	 */
147 157
 	protected function removePropertyValues($name, $values) {
148 158
 		$this->removeOldValues($this->properties[$name], $values);
149 159
 		return $this;
150 160
 	}
151 161
 
162
+	/**
163
+	 * @param string $name
164
+	 */
152 165
 	public function removeProperty($name) {
153 166
 		if (\array_key_exists($name, $this->properties))
154 167
 			unset($this->properties[$name]);
155 168
 		return $this;
156 169
 	}
157 170
 
171
+	/**
172
+	 * @param string $name
173
+	 * @param string[] $typeCtrl
174
+	 */
158 175
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
159 176
 		if ($this->ctrl($name, $value, $typeCtrl) === true) {
160 177
 			if (is_array($typeCtrl)) {
@@ -165,6 +182,9 @@  discard block
 block discarded – undo
165 182
 		return $this;
166 183
 	}
167 184
 
185
+	/**
186
+	 * @param string $name
187
+	 */
168 188
 	protected function addToMember(&$name, $value, $separator=" ") {
169 189
 		$name=str_ireplace($value, "", $name) . $separator . $value;
170 190
 		return $this;
@@ -179,6 +199,9 @@  discard block
 block discarded – undo
179 199
 		return $this->addToProperty($name, $value);
180 200
 	}
181 201
 
202
+	/**
203
+	 * @param string $name
204
+	 */
182 205
 	public function addToPropertyCtrl($name, $value, $typeCtrl) {
183 206
 		return $this->addToPropertyUnique($name, $value, $typeCtrl);
184 207
 	}
@@ -327,14 +350,23 @@  discard block
 block discarded – undo
327 350
 		return $this;
328 351
 	}
329 352
 
353
+	/**
354
+	 * @param string $event
355
+	 */
330 356
 	public function getOn($event, $url, $responseElement="", $parameters=array()) {
331 357
 		return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters);
332 358
 	}
333 359
 
360
+	/**
361
+	 * @param string $url
362
+	 */
334 363
 	public function getOnClick($url, $responseElement="", $parameters=array()) {
335 364
 		return $this->getOn("click", $url, $responseElement, $parameters);
336 365
 	}
337 366
 
367
+	/**
368
+	 * @param string $event
369
+	 */
338 370
 	public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) {
339 371
 		$parameters["params"]=$params;
340 372
 		return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters);
@@ -344,6 +376,9 @@  discard block
 block discarded – undo
344 376
 		return $this->postOn("click", $url, $params, $responseElement, $parameters);
345 377
 	}
346 378
 
379
+	/**
380
+	 * @param string $event
381
+	 */
347 382
 	public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) {
348 383
 		$parameters["form"]=$form;
349 384
 		return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters);
@@ -371,6 +406,10 @@  discard block
 block discarded – undo
371 406
 		return null;
372 407
 	}
373 408
 
409
+	/**
410
+	 * @param string $propertyName
411
+	 * @param string $value
412
+	 */
374 413
 	protected function getElementByPropertyValue($propertyName,$value, $elements) {
375 414
 		if (is_array($elements)) {
376 415
 			$flag=false;
@@ -411,6 +450,9 @@  discard block
 block discarded – undo
411 450
 		return $value;
412 451
 	}
413 452
 
453
+	/**
454
+	 * @param string $jqueryCall
455
+	 */
414 456
 	public function jsDoJquery($jqueryCall, $param="") {
415 457
 		return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");";
416 458
 	}
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 abstract class BaseHtml extends BaseWidget {
17 17
 	protected $_template;
18 18
 	protected $tagName;
19
-	protected $properties=array ();
20
-	protected $_events=array ();
21
-	protected $_wrapBefore=array ();
22
-	protected $_wrapAfter=array ();
19
+	protected $properties=array();
20
+	protected $_events=array();
21
+	protected $_wrapBefore=array();
22
+	protected $_wrapAfter=array();
23 23
 	protected $_bsComponent;
24 24
 
25 25
 	public function getBsComponent() {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	protected function getTemplate(JsUtils $js=NULL) {
35
-		return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js);
35
+		return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js);
36 36
 	}
37 37
 
38 38
 	public function getProperties() {
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 
57 57
 	public function addToProperty($name, $value, $separator=" ") {
58 58
 		if (\is_array($value)) {
59
-			foreach ( $value as $v ) {
59
+			foreach ($value as $v) {
60 60
 				$this->addToProperty($name, $v, $separator);
61 61
 			}
62
-		} else if ($value !== "" && $this->propertyContains($name, $value) === false) {
62
+		} else if ($value!=="" && $this->propertyContains($name, $value)===false) {
63 63
 			$v=@$this->properties[$name];
64
-			if (isset($v) && $v !== "")
65
-				$v=$v . $separator . $value;
64
+			if (isset($v) && $v!=="")
65
+				$v=$v.$separator.$value;
66 66
 			else
67 67
 				$v=$value;
68 68
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
80 80
 		$result=$this->getTemplate($js);
81
-		foreach ( $this as $key => $value ) {
82
-			if (JString::startswith($key, "_") === false && $key !== "events") {
81
+		foreach ($this as $key => $value) {
82
+			if (JString::startswith($key, "_")===false && $key!=="events") {
83 83
 				if (is_array($value)) {
84 84
 					$v=PropertyWrapper::wrap($value, $js);
85 85
 				} else {
86 86
 					$v=$value;
87 87
 				}
88
-				$result=str_ireplace("%" . $key . "%", $v, $result);
88
+				$result=str_ireplace("%".$key."%", $v, $result);
89 89
 			}
90 90
 		}
91 91
 		if (isset($js)===true) {
92 92
 			$this->run($js);
93
-			if (isset($view) === true) {
93
+			if (isset($view)===true) {
94 94
 				$js->addViewElement($this->identifier, $result, $view);
95 95
 			}
96 96
 		}
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 
100 100
 	protected function ctrl($name, $value, $typeCtrl) {
101 101
 		if (is_array($typeCtrl)) {
102
-			if (array_search($value, $typeCtrl) === false) {
103
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
102
+			if (array_search($value, $typeCtrl)===false) {
103
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
104 104
 			}
105 105
 		} else {
106 106
 			if (!$typeCtrl($value)) {
107
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
107
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
108 108
 			}
109 109
 		}
110 110
 		return true;
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	}
120 120
 
121 121
 	protected function setPropertyCtrl($name, $value, $typeCtrl) {
122
-		if ($this->ctrl($name, $value, $typeCtrl) === true)
122
+		if ($this->ctrl($name, $value, $typeCtrl)===true)
123 123
 			return $this->setProperty($name, $value);
124 124
 		return $this;
125 125
 	}
126 126
 
127 127
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
128
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
128
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
129 129
 			return $name=$value;
130 130
 		}
131 131
 		return $this;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
135 135
 		if (is_array($typeCtrl)) {
136 136
 			$this->removeOldValues($name, $typeCtrl);
137
-			$name.=$separator . $value;
137
+			$name.=$separator.$value;
138 138
 		}
139 139
 		return $this;
140 140
 	}
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 	}
157 157
 
158 158
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
159
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
159
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
160 160
 			if (is_array($typeCtrl)) {
161 161
 				$this->removeOldValues($name, $typeCtrl);
162 162
 			}
163
-			$name.=$separator . $value;
163
+			$name.=$separator.$value;
164 164
 		}
165 165
 		return $this;
166 166
 	}
167 167
 
168 168
 	protected function addToMember(&$name, $value, $separator=" ") {
169
-		$name=str_ireplace($value, "", $name) . $separator . $value;
169
+		$name=str_ireplace($value, "", $name).$separator.$value;
170 170
 		return $this;
171 171
 	}
172 172
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 
186 186
 	public function addToPropertyCtrlCheck($name, $value, $typeCtrl) {
187
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
187
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
188 188
 			return $this->addToProperty($name, $value);
189 189
 		}
190 190
 		return $this;
@@ -212,28 +212,28 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 
214 214
 	public function fromArray($array) {
215
-		foreach ( $this as $key => $value ) {
215
+		foreach ($this as $key => $value) {
216 216
 			if (array_key_exists($key, $array) && !JString::startswith($key, "_")) {
217
-				$setter="set" . ucfirst($key);
217
+				$setter="set".ucfirst($key);
218 218
 				$this->$setter($array[$key]);
219 219
 				unset($array[$key]);
220 220
 			}
221 221
 		}
222
-		foreach ( $array as $key => $value ) {
222
+		foreach ($array as $key => $value) {
223 223
 			if (method_exists($this, $key)) {
224 224
 				try {
225 225
 					$this->$key($value);
226 226
 					unset($array[$key]);
227
-				} catch ( \Exception $e ) {
227
+				}catch (\Exception $e) {
228 228
 					// Nothing to do
229 229
 				}
230 230
 			} else {
231
-				$setter="set" . ucfirst($key);
231
+				$setter="set".ucfirst($key);
232 232
 				if (method_exists($this, $setter)) {
233 233
 					try {
234 234
 						$this->$setter($value);
235 235
 						unset($array[$key]);
236
-					} catch ( \Exception $e ) {
236
+					}catch (\Exception $e) {
237 237
 						// Nothing to do
238 238
 					}
239 239
 				}
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 	public function fromDatabaseObjects($objects, $function) {
246 246
 		if (isset($objects)) {
247
-			foreach ( $objects as $object ) {
247
+			foreach ($objects as $object) {
248 248
 				$this->fromDatabaseObject($object, $function);
249 249
 			}
250 250
 		}
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 	}
265 265
 
266 266
 	public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
267
-		if ($stopPropagation === true) {
268
-			$jsCode="event.stopPropagation();" . $jsCode;
267
+		if ($stopPropagation===true) {
268
+			$jsCode="event.stopPropagation();".$jsCode;
269 269
 		}
270
-		if ($preventDefault === true) {
271
-			$jsCode="event.preventDefault();" . $jsCode;
270
+		if ($preventDefault===true) {
271
+			$jsCode="event.preventDefault();".$jsCode;
272 272
 		}
273 273
 		return $this->_addEvent($event, $jsCode);
274 274
 	}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			if (is_array($this->_events[$event])) {
279 279
 				$this->_events[$event][]=$jsCode;
280 280
 			} else {
281
-				$this->_events[$event]=array ($this->_events[$event],$jsCode );
281
+				$this->_events[$event]=array($this->_events[$event], $jsCode);
282 282
 			}
283 283
 		} else {
284 284
 			$this->_events[$event]=$jsCode;
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 
301 301
 	public function addEventsOnRun(JsUtils $js) {
302 302
 		if (isset($this->_bsComponent)) {
303
-			foreach ( $this->_events as $event => $jsCode ) {
303
+			foreach ($this->_events as $event => $jsCode) {
304 304
 				$code=$jsCode;
305 305
 				if (is_array($jsCode)) {
306 306
 					$code="";
307
-					foreach ( $jsCode as $jsC ) {
307
+					foreach ($jsCode as $jsC) {
308 308
 						if ($jsC instanceof AjaxCall) {
309
-							$code.="\n" . $jsC->compile($js);
309
+							$code.="\n".$jsC->compile($js);
310 310
 						} else {
311
-							$code.="\n" . $jsC;
311
+							$code.="\n".$jsC;
312 312
 						}
313 313
 					}
314 314
 				} elseif ($jsCode instanceof AjaxCall) {
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
 				}
317 317
 				$this->_bsComponent->addEvent($event, $code);
318 318
 			}
319
-			$this->_events=array ();
319
+			$this->_events=array();
320 320
 		}
321 321
 	}
322 322
 
323 323
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
324
-		$params=array ("url" => $url,"responseElement" => $responseElement );
324
+		$params=array("url" => $url, "responseElement" => $responseElement);
325 325
 		$params=array_merge($params, $parameters);
326 326
 		$this->_addEvent($event, new AjaxCall($operation, $params));
327 327
 		return $this;
@@ -357,33 +357,33 @@  discard block
 block discarded – undo
357 357
 		if (is_array($elements)) {
358 358
 			$flag=false;
359 359
 			$index=0;
360
-			while ( !$flag && $index < sizeof($elements) ) {
360
+			while (!$flag && $index<sizeof($elements)) {
361 361
 				if ($elements[$index] instanceof BaseHtml)
362
-					$flag=($elements[$index]->getIdentifier() === $identifier);
362
+					$flag=($elements[$index]->getIdentifier()===$identifier);
363 363
 				$index++;
364 364
 			}
365
-			if ($flag === true)
366
-				return $elements[$index - 1];
365
+			if ($flag===true)
366
+				return $elements[$index-1];
367 367
 		} elseif ($elements instanceof BaseHtml) {
368
-			if ($elements->getIdentifier() === $identifier)
368
+			if ($elements->getIdentifier()===$identifier)
369 369
 				return $elements;
370 370
 		}
371 371
 		return null;
372 372
 	}
373 373
 
374
-	protected function getElementByPropertyValue($propertyName,$value, $elements) {
374
+	protected function getElementByPropertyValue($propertyName, $value, $elements) {
375 375
 		if (is_array($elements)) {
376 376
 			$flag=false;
377 377
 			$index=0;
378
-			while ( !$flag && $index < sizeof($elements) ) {
378
+			while (!$flag && $index<sizeof($elements)) {
379 379
 				if ($elements[$index] instanceof BaseHtml)
380
-					$flag=($elements[$index]->propertyContains($propertyName, $value) === true);
380
+					$flag=($elements[$index]->propertyContains($propertyName, $value)===true);
381 381
 					$index++;
382 382
 			}
383
-			if ($flag === true)
384
-				return $elements[$index - 1];
383
+			if ($flag===true)
384
+				return $elements[$index-1];
385 385
 		} elseif ($elements instanceof BaseHtml) {
386
-			if ($elements->propertyContains($propertyName, $value) === true)
386
+			if ($elements->propertyContains($propertyName, $value)===true)
387 387
 				return $elements;
388 388
 		}
389 389
 		return null;
@@ -405,14 +405,14 @@  discard block
 block discarded – undo
405 405
 		if (is_array($value)) {
406 406
 			$value=implode(",", $value);
407 407
 		}
408
-		if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) {
409
-			$value='"' . $value . '"';
408
+		if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) {
409
+			$value='"'.$value.'"';
410 410
 		}
411 411
 		return $value;
412 412
 	}
413 413
 
414 414
 	public function jsDoJquery($jqueryCall, $param="") {
415
-		return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");";
415
+		return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");";
416 416
 	}
417 417
 
418 418
 	public function executeOnRun($jsCode) {
Please login to merge, or discard this patch.
Braces   +35 added lines, -24 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	public function getProperty($name) {
53
-		if (array_key_exists($name, $this->properties))
54
-			return $this->properties[$name];
53
+		if (array_key_exists($name, $this->properties)) {
54
+					return $this->properties[$name];
55
+		}
55 56
 	}
56 57
 
57 58
 	public function addToProperty($name, $value, $separator=" ") {
@@ -61,10 +62,11 @@  discard block
 block discarded – undo
61 62
 			}
62 63
 		} else if ($value !== "" && $this->propertyContains($name, $value) === false) {
63 64
 			$v=@$this->properties[$name];
64
-			if (isset($v) && $v !== "")
65
-				$v=$v . $separator . $value;
66
-			else
67
-				$v=$value;
65
+			if (isset($v) && $v !== "") {
66
+							$v=$v . $separator . $value;
67
+			} else {
68
+							$v=$value;
69
+			}
68 70
 
69 71
 			return $this->setProperty($name, $v);
70 72
 		}
@@ -119,8 +121,9 @@  discard block
 block discarded – undo
119 121
 	}
120 122
 
121 123
 	protected function setPropertyCtrl($name, $value, $typeCtrl) {
122
-		if ($this->ctrl($name, $value, $typeCtrl) === true)
123
-			return $this->setProperty($name, $value);
124
+		if ($this->ctrl($name, $value, $typeCtrl) === true) {
125
+					return $this->setProperty($name, $value);
126
+		}
124 127
 		return $this;
125 128
 	}
126 129
 
@@ -150,8 +153,9 @@  discard block
 block discarded – undo
150 153
 	}
151 154
 
152 155
 	public function removeProperty($name) {
153
-		if (\array_key_exists($name, $this->properties))
154
-			unset($this->properties[$name]);
156
+		if (\array_key_exists($name, $this->properties)) {
157
+					unset($this->properties[$name]);
158
+		}
155 159
 		return $this;
156 160
 	}
157 161
 
@@ -171,8 +175,9 @@  discard block
 block discarded – undo
171 175
 	}
172 176
 
173 177
 	protected function addToPropertyUnique($name, $value, $typeCtrl) {
174
-		if (@class_exists($typeCtrl, true))
175
-			$typeCtrl=$typeCtrl::getConstants();
178
+		if (@class_exists($typeCtrl, true)) {
179
+					$typeCtrl=$typeCtrl::getConstants();
180
+		}
176 181
 		if (is_array($typeCtrl)) {
177 182
 			$this->removeOldValues($this->properties[$name], $typeCtrl);
178 183
 		}
@@ -358,15 +363,18 @@  discard block
 block discarded – undo
358 363
 			$flag=false;
359 364
 			$index=0;
360 365
 			while ( !$flag && $index < sizeof($elements) ) {
361
-				if ($elements[$index] instanceof BaseHtml)
362
-					$flag=($elements[$index]->getIdentifier() === $identifier);
366
+				if ($elements[$index] instanceof BaseHtml) {
367
+									$flag=($elements[$index]->getIdentifier() === $identifier);
368
+				}
363 369
 				$index++;
364 370
 			}
365
-			if ($flag === true)
366
-				return $elements[$index - 1];
371
+			if ($flag === true) {
372
+							return $elements[$index - 1];
373
+			}
367 374
 		} elseif ($elements instanceof BaseHtml) {
368
-			if ($elements->getIdentifier() === $identifier)
369
-				return $elements;
375
+			if ($elements->getIdentifier() === $identifier) {
376
+							return $elements;
377
+			}
370 378
 		}
371 379
 		return null;
372 380
 	}
@@ -376,15 +384,18 @@  discard block
 block discarded – undo
376 384
 			$flag=false;
377 385
 			$index=0;
378 386
 			while ( !$flag && $index < sizeof($elements) ) {
379
-				if ($elements[$index] instanceof BaseHtml)
380
-					$flag=($elements[$index]->propertyContains($propertyName, $value) === true);
387
+				if ($elements[$index] instanceof BaseHtml) {
388
+									$flag=($elements[$index]->propertyContains($propertyName, $value) === true);
389
+				}
381 390
 					$index++;
382 391
 			}
383
-			if ($flag === true)
384
-				return $elements[$index - 1];
392
+			if ($flag === true) {
393
+							return $elements[$index - 1];
394
+			}
385 395
 		} elseif ($elements instanceof BaseHtml) {
386
-			if ($elements->propertyContains($propertyName, $value) === true)
387
-				return $elements;
396
+			if ($elements->propertyContains($propertyName, $value) === true) {
397
+							return $elements;
398
+			}
388 399
 		}
389 400
 		return null;
390 401
 	}
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlLinkTrait.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 
5 5
 trait HtmlLinkTrait {
6 6
 
7
+	/**
8
+	 * @param string $value
9
+	 */
7 10
 	public function setHref($value) {
8 11
 		$this->setProperty("href", $value);
9 12
 	}
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -84,6 +84,9 @@  discard block
 block discarded – undo
84 84
 		return $this;
85 85
 	}
86 86
 
87
+	/**
88
+	 * @param integer $index
89
+	 */
87 90
 	public function removeItem($index){
88 91
 		return array_splice($this->content, $index, 1);
89 92
 	}
@@ -99,6 +102,9 @@  discard block
 block discarded – undo
99 102
 		return $this->addItem($function($object));
100 103
 	}
101 104
 
105
+	/**
106
+	 * @param \Closure $callBack
107
+	 */
102 108
 	public function apply($callBack){
103 109
 		foreach ($this->content as $item){
104 110
 			$callBack($item);
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Ajax\common\html\HtmlDoubleElement;
6 6
 use Ajax\service\JArray;
7
-use Ajax\JsUtils;
8 7
 
9 8
 /**
10 9
  * Base class for Html collections
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -13,36 +13,36 @@  discard block
 block discarded – undo
13 13
  */
14 14
 abstract class HtmlCollection extends HtmlDoubleElement {
15 15
 
16
-	public function __construct($identifier,$tagName="div"){
17
-		parent::__construct($identifier,$tagName);
16
+	public function __construct($identifier, $tagName="div") {
17
+		parent::__construct($identifier, $tagName);
18 18
 		$this->content=array();
19 19
 	}
20 20
 
21
-	public function addItems($items){
22
-		if(JArray::isAssociative($items)){
23
-			foreach ($items as $k=>$v){
24
-				$this->addItem([$k,$v]);
21
+	public function addItems($items) {
22
+		if (JArray::isAssociative($items)) {
23
+			foreach ($items as $k=>$v) {
24
+				$this->addItem([$k, $v]);
25 25
 			}
26
-		}else{
27
-			foreach ($items as $item){
26
+		} else {
27
+			foreach ($items as $item) {
28 28
 				$this->addItem($item);
29 29
 			}
30 30
 		}
31 31
 		return $this;
32 32
 	}
33 33
 
34
-	public function setItems($items){
34
+	public function setItems($items) {
35 35
 		$this->content=$items;
36 36
 		return $this;
37 37
 	}
38 38
 
39
-	public function getItems(){
39
+	public function getItems() {
40 40
 		return $this->content;
41 41
 	}
42 42
 
43
-	protected function getItemToAdd($item){
43
+	protected function getItemToAdd($item) {
44 44
 		$itemO=$item;
45
-		if($this->createCondition($item)===true){
45
+		if ($this->createCondition($item)===true) {
46 46
 			$itemO=$this->createItem($item);
47 47
 		}
48 48
 		return $itemO;
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 	 * @param HtmlDoubleElement|string $item
54 54
 	 * @return \Ajax\common\html\HtmlDoubleElement
55 55
 	 */
56
-	public function addItem($item){
56
+	public function addItem($item) {
57 57
 		$itemO=$this->getItemToAdd($item);
58 58
 		$this->addContent($itemO);
59 59
 		return $itemO;
60 60
 	}
61 61
 
62
-	public function insertItem($item,$position=0){
62
+	public function insertItem($item, $position=0) {
63 63
 		$itemO=$this->getItemToAdd($item);
64
-		\array_splice( $this->content, $position, 0, array($itemO));
64
+		\array_splice($this->content, $position, 0, array($itemO));
65 65
 		return $itemO;
66 66
 	}
67 67
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 		return $this;
85 85
 	}
86 86
 
87
-	public function removeItem($index){
87
+	public function removeItem($index) {
88 88
 		return array_splice($this->content, $index, 1);
89 89
 	}
90 90
 
91
-	public function count(){
91
+	public function count() {
92 92
 		return \sizeof($this->content);
93 93
 	}
94 94
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 		return $this->addItem($function($object));
100 100
 	}
101 101
 
102
-	public function apply($callBack){
103
-		foreach ($this->content as $item){
102
+	public function apply($callBack) {
103
+		foreach ($this->content as $item) {
104 104
 			$callBack($item);
105 105
 		}
106 106
 		return $this;
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected abstract function createItem($value);
122 122
 
123
-	protected function createCondition($value){
123
+	protected function createCondition($value) {
124 124
 		return \is_object($value)===false;
125 125
 	}
126 126
 
127
-	protected function contentAs($tagName){
128
-		foreach ($this->content as $item){
127
+	protected function contentAs($tagName) {
128
+		foreach ($this->content as $item) {
129 129
 			$item->setTagName($tagName);
130 130
 		}
131 131
 		return $this;
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 			foreach ($items as $k=>$v){
24 24
 				$this->addItem([$k,$v]);
25 25
 			}
26
-		}else{
26
+		} else{
27 27
 			foreach ($items as $item){
28 28
 				$this->addItem($item);
29 29
 			}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 * @return \Ajax\common\html\HtmlDoubleElement
72 72
 	 */
73 73
 	public function getItem($index) {
74
-		if (is_int($index))
75
-			return $this->content[$index];
76
-		else {
74
+		if (is_int($index)) {
75
+					return $this->content[$index];
76
+		} else {
77 77
 			$elm=$this->getElementById($index, $this->content);
78 78
 			return $elm;
79 79
 		}
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryActionsTrait.php 3 patches
Doc Comments   +11 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,17 @@  discard block
 block discarded – undo
3 3
 namespace Ajax\common\traits;
4 4
 
5 5
 trait JqueryActionsTrait {
6
+
7
+	/**
8
+	 * @param string $element
9
+	 * @param string $js
10
+	 * @param string $event
11
+	 */
6 12
 	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
13
+
14
+	/**
15
+	 * @param string $element
16
+	 */
7 17
 	public abstract function _prep_element($element);
8 18
 	public abstract function _prep_value($value);
9 19
 
@@ -384,7 +394,7 @@  discard block
 block discarded – undo
384 394
 
385 395
 	/**
386 396
 	 * Ensures the speed parameter is valid for jQuery
387
-	 * @param string|int $speed
397
+	 * @param string $speed
388 398
 	 * @return string
389 399
 	 */
390 400
 	private function _validate_speed($speed) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 namespace Ajax\common\traits;
4 4
 
5 5
 trait JqueryActionsTrait {
6
-	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
6
+	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
7 7
 	public abstract function _prep_element($element);
8 8
 	public abstract function _prep_value($value);
9 9
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param boolean $immediatly defers the execution if set to false
34 34
 	 * @return string
35 35
 	 */
36
-	public function after($element='this', $value='', $immediatly=false){
36
+	public function after($element='this', $value='', $immediatly=false) {
37 37
 		$element=$this->_prep_element($element);
38 38
 		$value=$this->_prep_value($value);
39 39
 		$str="$({$element}).after({$value});";
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 		$animations="\t\t\t";
60 60
 		if (is_array($params)) {
61
-			foreach ( $params as $param => $value ) {
61
+			foreach ($params as $param => $value) {
62 62
 				$animations.=$param.': \''.$value.'\', ';
63 63
 			}
64 64
 		}
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 	 * @param boolean $immediatly
352 352
 	 * @return string
353 353
 	 */
354
-	public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) {
355
-		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly);
354
+	public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) {
355
+		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly);
356 356
 	}
357 357
 
358 358
 	/**
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 	 * @param boolean $immediatly
379 379
 	 * @return String
380 380
 	 */
381
-	public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
382
-		return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly);
381
+	public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
382
+		return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly);
383 383
 	}
384 384
 
385 385
 	/**
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 	 * @return string
389 389
 	 */
390 390
 	private function _validate_speed($speed) {
391
-		if (in_array($speed, array (
392
-				'slow','normal','fast'
391
+		if (in_array($speed, array(
392
+				'slow', 'normal', 'fast'
393 393
 		))) {
394 394
 			$speed='"'.$speed.'"';
395 395
 		} elseif (preg_match("/[^0-9]/", $speed)) {
Please login to merge, or discard this patch.
Braces   +51 added lines, -34 removed lines patch added patch discarded remove patch
@@ -19,10 +19,12 @@  discard block
 block discarded – undo
19 19
 		if (isset($value)) {
20 20
 			$value=$this->_prep_value($value);
21 21
 			$str="$({$element}).attr(\"$attributeName\",{$value});";
22
-		} else
23
-			$str="$({$element}).attr(\"$attributeName\");";
24
-			if ($immediatly)
25
-				$this->jquery_code_for_compile[]=$str;
22
+		} else {
23
+					$str="$({$element}).attr(\"$attributeName\");";
24
+		}
25
+			if ($immediatly) {
26
+							$this->jquery_code_for_compile[]=$str;
27
+			}
26 28
 				return $str;
27 29
 	}
28 30
 
@@ -37,8 +39,9 @@  discard block
 block discarded – undo
37 39
 		$element=$this->_prep_element($element);
38 40
 		$value=$this->_prep_value($value);
39 41
 		$str="$({$element}).after({$value});";
40
-		if ($immediatly)
41
-			$this->jquery_code_for_compile[]=$str;
42
+		if ($immediatly) {
43
+					$this->jquery_code_for_compile[]=$str;
44
+		}
42 45
 			return $str;
43 46
 	}
44 47
 
@@ -74,8 +77,9 @@  discard block
 block discarded – undo
74 77
 
75 78
 		$str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
76 79
 
77
-		if ($immediatly)
78
-			$this->jquery_code_for_compile[]=$str;
80
+		if ($immediatly) {
81
+					$this->jquery_code_for_compile[]=$str;
82
+		}
79 83
 			return $str;
80 84
 	}
81 85
 
@@ -100,8 +104,9 @@  discard block
 block discarded – undo
100 104
 
101 105
 		$str="$({$element}).fadeIn({$speed}{$callback});";
102 106
 
103
-		if ($immediatly)
104
-			$this->jquery_code_for_compile[]=$str;
107
+		if ($immediatly) {
108
+					$this->jquery_code_for_compile[]=$str;
109
+		}
105 110
 			return $str;
106 111
 	}
107 112
 
@@ -126,8 +131,9 @@  discard block
 block discarded – undo
126 131
 
127 132
 		$str="$({$element}).fadeOut({$speed}{$callback});";
128 133
 
129
-		if ($immediatly)
130
-			$this->jquery_code_for_compile[]=$str;
134
+		if ($immediatly) {
135
+					$this->jquery_code_for_compile[]=$str;
136
+		}
131 137
 			return $str;
132 138
 	}
133 139
 
@@ -152,8 +158,9 @@  discard block
 block discarded – undo
152 158
 
153 159
 		$str="$({$element}).hide({$speed}{$callback});";
154 160
 
155
-		if ($immediatly)
156
-			$this->jquery_code_for_compile[]=$str;
161
+		if ($immediatly) {
162
+					$this->jquery_code_for_compile[]=$str;
163
+		}
157 164
 			return $str;
158 165
 	}
159 166
 
@@ -180,8 +187,9 @@  discard block
 block discarded – undo
180 187
 
181 188
 		$str="$({$element}).slideUp({$speed}{$callback});";
182 189
 
183
-		if ($immediatly)
184
-			$this->jquery_code_for_compile[]=$str;
190
+		if ($immediatly) {
191
+					$this->jquery_code_for_compile[]=$str;
192
+		}
185 193
 			return $str;
186 194
 	}
187 195
 
@@ -206,8 +214,9 @@  discard block
 block discarded – undo
206 214
 
207 215
 		$str="$({$element}).slideDown({$speed}{$callback});";
208 216
 
209
-		if ($immediatly)
210
-			$this->jquery_code_for_compile[]=$str;
217
+		if ($immediatly) {
218
+					$this->jquery_code_for_compile[]=$str;
219
+		}
211 220
 			return $str;
212 221
 	}
213 222
 
@@ -232,8 +241,9 @@  discard block
 block discarded – undo
232 241
 
233 242
 		$str="$({$element}).slideToggle({$speed}{$callback});";
234 243
 
235
-		if ($immediatly)
236
-			$this->jquery_code_for_compile[]=$str;
244
+		if ($immediatly) {
245
+					$this->jquery_code_for_compile[]=$str;
246
+		}
237 247
 			return $str;
238 248
 	}
239 249
 
@@ -250,8 +260,9 @@  discard block
 block discarded – undo
250 260
 		$element=$this->_prep_element($element);
251 261
 		$str="$({$element}).toggle();";
252 262
 
253
-		if ($immediatly)
254
-			$this->jquery_code_for_compile[]=$str;
263
+		if ($immediatly) {
264
+					$this->jquery_code_for_compile[]=$str;
265
+		}
255 266
 			return $str;
256 267
 	}
257 268
 
@@ -267,8 +278,9 @@  discard block
 block discarded – undo
267 278
 		$element=$this->_prep_element($element);
268 279
 		$str="$({$element}).trigger(\"$event\");";
269 280
 
270
-		if ($immediatly)
271
-			$this->jquery_code_for_compile[]=$str;
281
+		if ($immediatly) {
282
+					$this->jquery_code_for_compile[]=$str;
283
+		}
272 284
 			return $str;
273 285
 	}
274 286
 
@@ -293,8 +305,9 @@  discard block
 block discarded – undo
293 305
 
294 306
 		$str="$({$element}).show({$speed}{$callback});";
295 307
 
296
-		if ($immediatly)
297
-			$this->jquery_code_for_compile[]=$str;
308
+		if ($immediatly) {
309
+					$this->jquery_code_for_compile[]=$str;
310
+		}
298 311
 			return $str;
299 312
 	}
300 313
 
@@ -312,8 +325,9 @@  discard block
 block discarded – undo
312 325
 			$str.="else{".$jsCodeIfFalse."}";
313 326
 		}
314 327
 
315
-		if ($immediatly)
316
-			$this->jquery_code_for_compile[]=$str;
328
+		if ($immediatly) {
329
+					$this->jquery_code_for_compile[]=$str;
330
+		}
317 331
 			return $str;
318 332
 	}
319 333
 
@@ -330,11 +344,13 @@  discard block
 block discarded – undo
330 344
 	public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) {
331 345
 		$param=$this->_prep_value($param);
332 346
 		$callback="";
333
-		if ($jsCallback!="")
334
-			$callback=", function(event){\n{$jsCallback}\n}";
347
+		if ($jsCallback!="") {
348
+					$callback=", function(event){\n{$jsCallback}\n}";
349
+		}
335 350
 			$script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n";
336
-			if ($immediatly)
337
-				$this->jquery_code_for_compile[]=$script;
351
+			if ($immediatly) {
352
+							$this->jquery_code_for_compile[]=$script;
353
+			}
338 354
 				return $script;
339 355
 	}
340 356
 
@@ -363,8 +379,9 @@  discard block
 block discarded – undo
363 379
 	 */
364 380
 	public function _exec($js, $immediatly=false) {
365 381
 		$script=$js."\n";
366
-		if ($immediatly)
367
-			$this->jquery_code_for_compile[]=$script;
382
+		if ($immediatly) {
383
+					$this->jquery_code_for_compile[]=$script;
384
+		}
368 385
 			return $script;
369 386
 	}
370 387
 
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 4 patches
Doc Comments   +28 added lines patch added patch discarded remove patch
@@ -10,7 +10,17 @@  discard block
 block discarded – undo
10 10
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
11 11
 
12 12
 	public abstract function _prep_value($value);
13
+
14
+	/**
15
+	 * @param string $element
16
+	 * @param string $js
17
+	 * @param string $event
18
+	 */
13 19
 	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
20
+
21
+	/**
22
+	 * @param string $retour
23
+	 */
14 24
 	protected function addLoading(&$retour, $responseElement) {
15 25
 		$loading_notifier='<div class="ajax-loader">';
16 26
 		if ($this->ajaxLoader=='') {
@@ -23,13 +33,23 @@  discard block
 block discarded – undo
23 33
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
24 34
 	}
25 35
 
36
+	/**
37
+	 * @param string $url
38
+	 */
26 39
 	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
27 40
 		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly);
28 41
 	}
42
+
43
+	/**
44
+	 * @param string $url
45
+	 */
29 46
 	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
30 47
 		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly);
31 48
 	}
32 49
 
50
+	/**
51
+	 * @param string $method
52
+	 */
33 53
 	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
34 54
 		if(JString::isNull($params)){$params="{}";}
35 55
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
@@ -46,6 +66,9 @@  discard block
 block discarded – undo
46 66
 			return $retour;
47 67
 	}
48 68
 
69
+	/**
70
+	 * @param string $attr
71
+	 */
49 72
 	protected function _getAjaxUrl($url,$attr){
50 73
 		$url=$this->_correctAjaxUrl($url);
51 74
 		$retour="url='".$url."';\n";
@@ -177,6 +200,11 @@  discard block
 block discarded – undo
177 200
 		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
178 201
 	}
179 202
 
203
+	/**
204
+	 * @param string $url
205
+	 * @param string $form
206
+	 * @param string $responseElement
207
+	 */
180 208
 	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
181 209
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
182 210
 		$retour=$this->_getAjaxUrl($url, $attr);
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,6 @@
 block discarded – undo
3 3
 namespace Ajax\common\traits;
4 4
 
5 5
 use Ajax\service\JString;
6
-use Ajax\service\PhalconUtils;
7
-use Symfony\Component\Config\Definition\Exception\Exception;
8 6
 trait JqueryAjaxTrait {
9 7
 
10 8
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
11 11
 
12 12
 	public abstract function _prep_value($value);
13
-	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
13
+	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
14 14
 	protected function addLoading(&$retour, $responseElement) {
15 15
 		$loading_notifier='<div class="ajax-loader">';
16 16
 		if ($this->ajaxLoader=='') {
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
24 24
 	}
25 25
 
26
-	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
27
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly);
26
+	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
27
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly);
28 28
 	}
29
-	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
30
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly);
29
+	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
30
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly);
31 31
 	}
32 32
 
33
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
34
-		if(JString::isNull($params)){$params="{}";}
33
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
34
+		if (JString::isNull($params)) {$params="{}"; }
35 35
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
36 36
 		$retour=$this->_getAjaxUrl($url, $attr);
37 37
 		$responseElement=$this->_getResponseElement($responseElement);
38 38
 		$retour.="var self=this;\n";
39
-		if($hasLoader===true){
39
+		if ($hasLoader===true) {
40 40
 			$this->addLoading($retour, $responseElement);
41 41
 		}
42 42
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 			return $retour;
47 47
 	}
48 48
 
49
-	protected function _getAjaxUrl($url,$attr){
49
+	protected function _getAjaxUrl($url, $attr) {
50 50
 		$url=$this->_correctAjaxUrl($url);
51 51
 		$retour="url='".$url."';\n";
52 52
 		$slash="/";
53
-		if(JString::endswith($url, "/")===true)
53
+		if (JString::endswith($url, "/")===true)
54 54
 			$slash="";
55
-		if(JString::isNotNull($attr)){
55
+		if (JString::isNotNull($attr)) {
56 56
 			if ($attr=="value")
57 57
 				$retour.="url=url+'".$slash."'+$(this).val();\n";
58
-				else if($attr!=null && $attr!=="")
58
+				else if ($attr!=null && $attr!=="")
59 59
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
60 60
 		}
61 61
 		return $retour;
62 62
 	}
63 63
 
64
-	protected function _getOnAjaxDone($responseElement,$jsCallback){
64
+	protected function _getOnAjaxDone($responseElement, $jsCallback) {
65 65
 		$retour="";
66 66
 		if ($responseElement!=="") {
67 67
 			$retour="\t$({$responseElement}).html( data );\n";
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		return $retour;
71 71
 	}
72 72
 
73
-	protected function _getResponseElement($responseElement){
73
+	protected function _getResponseElement($responseElement) {
74 74
 		if ($responseElement!=="") {
75 75
 			$responseElement=$this->_prep_value($responseElement);
76 76
 		}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	protected function _correctAjaxUrl($url) {
81 81
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
82 82
 			$url=substr($url, 0, strlen($url)-1);
83
-		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
83
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
84 84
 			$url=$this->jsUtils->getUrl($url);
85 85
 		}
86 86
 		return $url;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param string $jsCallback javascript code to execute after the request
95 95
 	 * @param boolean $immediatly
96 96
 	 */
97
-	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
97
+	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
98 98
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
99 99
 		$retour=$this->_getAjaxUrl($url, $attr);
100 100
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @param string $url the request address
116 116
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
117 117
 	 */
118
-	public function _jsonOn($event,$element, $url,$parameters=array()) {
118
+	public function _jsonOn($event, $element, $url, $parameters=array()) {
119 119
 		$preventDefault=true;
120 120
 		$stopPropagation=true;
121 121
 		$jsCallback=null;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		$params="{}";
126 126
 		$immediatly=true;
127 127
 		extract($parameters);
128
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
128
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
129 129
 	}
130 130
 
131 131
 	/**
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 	 * @param string $context jquery DOM element, array container.
138 138
 	 * @param boolean $immediatly
139 139
 	 */
140
-	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) {
140
+	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) {
141 141
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
142 142
 		$retour=$this->_getAjaxUrl($url, $attr);
143
-		if($context===null){
143
+		if ($context===null) {
144 144
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
145
-			$newElm = "$('#'+newId)";
146
-		}else{
145
+			$newElm="$('#'+newId)";
146
+		} else {
147 147
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
148
-			$newElm = $context.".find('#'+newId)";
148
+			$newElm=$context.".find('#'+newId)";
149 149
 		}
150 150
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
151 151
 		$retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n";
152
-		$retour.= $appendTo;
152
+		$retour.=$appendTo;
153 153
 		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
154 154
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
155 155
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -164,26 +164,26 @@  discard block
 block discarded – undo
164 164
 	 * @param string $url the request address
165 165
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
166 166
 	 */
167
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
167
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
168 168
 		$preventDefault=true;
169 169
 		$stopPropagation=true;
170 170
 		$jsCallback=null;
171 171
 		$attr="id";
172 172
 		$method="get";
173
-		$context = null;
173
+		$context=null;
174 174
 		$params="{}";
175 175
 		$immediatly=true;
176 176
 		extract($parameters);
177
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
177
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
178 178
 	}
179 179
 
180
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) {
180
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) {
181 181
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
182 182
 		$retour=$this->_getAjaxUrl($url, $attr);
183 183
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
184 184
 		$responseElement=$this->_getResponseElement($responseElement);
185 185
 		$retour.="var self=this;\n";
186
-		if($hasLoader===true){
186
+		if ($hasLoader===true) {
187 187
 			$this->addLoading($retour, $responseElement);
188 188
 		}
189 189
 		$retour.="$.post(url,params).done(function( data ) {\n";
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param string $responseElement
211 211
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true)
212 212
 	 */
213
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
213
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
214 214
 		$preventDefault=true;
215 215
 		$stopPropagation=true;
216 216
 		$jsCallback=null;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		$hasLoader=true;
219 219
 		$immediatly=true;
220 220
 		extract($parameters);
221
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly);
221
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly);
222 222
 	}
223 223
 
224 224
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @param string $responseElement
232 232
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true)
233 233
 	 */
234
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
234
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
235 235
 		$preventDefault=true;
236 236
 		$stopPropagation=true;
237 237
 		$jsCallback=null;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		$hasLoader=true;
240 240
 		$immediatly=true;
241 241
 		extract($parameters);
242
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly);
242
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly);
243 243
 	}
244 244
 
245 245
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param string $responseElement
253 253
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true)
254 254
 	 */
255
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
255
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
256 256
 		$preventDefault=true;
257 257
 		$stopPropagation=true;
258 258
 		$validation=false;
@@ -261,6 +261,6 @@  discard block
 block discarded – undo
261 261
 		$hasLoader=true;
262 262
 		$immediatly=true;
263 263
 		extract($parameters);
264
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly);
264
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly);
265 265
 	}
266 266
 }
267 267
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
 		}
42 42
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
43 43
 		$retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n";
44
-		if ($immediatly)
45
-			$this->jquery_code_for_compile[]=$retour;
44
+		if ($immediatly) {
45
+					$this->jquery_code_for_compile[]=$retour;
46
+		}
46 47
 			return $retour;
47 48
 	}
48 49
 
@@ -50,13 +51,15 @@  discard block
 block discarded – undo
50 51
 		$url=$this->_correctAjaxUrl($url);
51 52
 		$retour="url='".$url."';\n";
52 53
 		$slash="/";
53
-		if(JString::endswith($url, "/")===true)
54
-			$slash="";
54
+		if(JString::endswith($url, "/")===true) {
55
+					$slash="";
56
+		}
55 57
 		if(JString::isNotNull($attr)){
56
-			if ($attr=="value")
57
-				$retour.="url=url+'".$slash."'+$(this).val();\n";
58
-				else if($attr!=null && $attr!=="")
59
-					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
58
+			if ($attr=="value") {
59
+							$retour.="url=url+'".$slash."'+$(this).val();\n";
60
+			} else if($attr!=null && $attr!=="") {
61
+									$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
62
+				}
60 63
 		}
61 64
 		return $retour;
62 65
 	}
@@ -78,8 +81,9 @@  discard block
 block discarded – undo
78 81
 	}
79 82
 
80 83
 	protected function _correctAjaxUrl($url) {
81
-		if ($url!=="/" && JString::endsWith($url, "/")===true)
82
-			$url=substr($url, 0, strlen($url)-1);
84
+		if ($url!=="/" && JString::endsWith($url, "/")===true) {
85
+					$url=substr($url, 0, strlen($url)-1);
86
+		}
83 87
 		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
84 88
 			$url=$this->jsUtils->getUrl($url);
85 89
 		}
@@ -103,8 +107,9 @@  discard block
 block discarded – undo
103 107
 				$retour.="\t".$jsCallback."\n".
104 108
 						"\t$(document).trigger('jsonReady',[data]);\n".
105 109
 						"});\n";
106
-				if ($immediatly)
107
-					$this->jquery_code_for_compile[]=$retour;
110
+				if ($immediatly) {
111
+									$this->jquery_code_for_compile[]=$retour;
112
+				}
108 113
 					return $retour;
109 114
 	}
110 115
 
@@ -143,7 +148,7 @@  discard block
 block discarded – undo
143 148
 		if($context===null){
144 149
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
145 150
 			$newElm = "$('#'+newId)";
146
-		}else{
151
+		} else{
147 152
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
148 153
 			$newElm = $context.".find('#'+newId)";
149 154
 		}
@@ -153,8 +158,9 @@  discard block
 block discarded – undo
153 158
 		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
154 159
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
155 160
 		$retour.="\t".$jsCallback."\n"."});\n";
156
-		if ($immediatly)
157
-			$this->jquery_code_for_compile[]=$retour;
161
+		if ($immediatly) {
162
+					$this->jquery_code_for_compile[]=$retour;
163
+		}
158 164
 			return $retour;
159 165
 	}
160 166
 	/**
@@ -195,8 +201,9 @@  discard block
 block discarded – undo
195 201
 			}});\n";
196 202
 			$retour.="$('#".$form."').submit();\n";
197 203
 		}
198
-		if ($immediatly)
199
-			$this->jquery_code_for_compile[]=$retour;
204
+		if ($immediatly) {
205
+					$this->jquery_code_for_compile[]=$retour;
206
+		}
200 207
 			return $retour;
201 208
 	}
202 209
 
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryEventsTrait.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -3,7 +3,16 @@
 block discarded – undo
3 3
 namespace Ajax\common\traits;
4 4
 
5 5
 trait JqueryEventsTrait {
6
+
7
+	/**
8
+	 * @param string $element
9
+	 */
6 10
 	public abstract function _prep_element($element);
11
+
12
+	/**
13
+	 * @param string $element
14
+	 * @param string $event
15
+	 */
7 16
 	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
8 17
 
9 18
 	/**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 trait JqueryEventsTrait {
6 6
 	public abstract function _prep_element($element);
7
-	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
7
+	public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
8 8
 
9 9
 	/**
10 10
 	 * Blur
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function _click($element='this', $js=array(), $ret_false=TRUE) {
48 48
 		if (!is_array($js)) {
49
-			$js=array (
49
+			$js=array(
50 50
 					$js
51 51
 			);
52 52
 		}
Please login to merge, or discard this patch.
Ajax/php/yii/URI.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@
 block discarded – undo
429 429
 	 *
430 430
 	 * @access public
431 431
 	 * @param array an associative array of key/values
432
-	 * @return array
432
+	 * @return string
433 433
 	 *
434 434
 	 */
435 435
 	function assoc_to_uri($array) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * @access public
11 11
 	 *
12 12
 	 */
13
-	var $keyval=array ();
13
+	var $keyval=array();
14 14
 	/**
15 15
 	 * Current uri string
16 16
 	 *
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @access public
27 27
 	 *
28 28
 	 */
29
-	var $segments=array ();
29
+	var $segments=array();
30 30
 	/**
31 31
 	 * Re-indexed list of uri segments
32 32
 	 * Starts at 1 instead of 0
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @access public
36 36
 	 *
37 37
 	 */
38
-	var $rsegments=array ();
38
+	var $rsegments=array();
39 39
 	var $permitted_uri_chars="a-z 0-9~%.:_\-";
40 40
 	var $enable_query_strings=false;
41 41
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	function _fetch_uri_string() {
77 77
 		$uri="";
78
-		if ($this->uri_protocol == 'AUTO') {
78
+		if ($this->uri_protocol=='AUTO') {
79 79
 			// Is the request coming from the command line?
80
-			if (php_sapi_name() == 'cli' or defined('STDIN')) {
80
+			if (php_sapi_name()=='cli' or defined('STDIN')) {
81 81
 				$this->_set_uri_string($this->_parse_cli_args());
82 82
 				return;
83 83
 			}
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
 			// Is there a PATH_INFO variable?
92 92
 			// Note: some servers seem to have trouble with getenv() so we'll test it two ways
93 93
 			$path=(isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
94
-			if (trim($path, '/') != '' && $path != "/" . SELF) {
94
+			if (trim($path, '/')!='' && $path!="/".SELF) {
95 95
 				$this->_set_uri_string($path);
96 96
 				return;
97 97
 			}
98 98
 
99 99
 			// No PATH_INFO?... What about QUERY_STRING?
100 100
 			$path=(isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
101
-			if (trim($path, '/') != '') {
101
+			if (trim($path, '/')!='') {
102 102
 				$this->_set_uri_string($path);
103 103
 				return;
104 104
 			}
105 105
 
106 106
 			// As a last ditch effort lets try using the $_GET array
107
-			if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '') {
107
+			if (is_array($_GET) && count($_GET)==1 && trim(key($_GET), '/')!='') {
108 108
 				$this->_set_uri_string(key($_GET));
109 109
 				return;
110 110
 			}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			return;
115 115
 		}
116 116
 
117
-		if ($uri == 'REQUEST_URI') {
117
+		if ($uri=='REQUEST_URI') {
118 118
 			$this->_set_uri_string($this->_detect_uri());
119 119
 			return;
120 120
 		}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		// $str = remove_invisible_characters($str, FALSE);
139 139
 
140 140
 		// If the URI contains only a slash we'll kill it
141
-		$this->uri_string=($str == '/') ? '' : $str;
141
+		$this->uri_string=($str=='/') ? '' : $str;
142 142
 	}
143 143
 
144 144
 	// --------------------------------------------------------------------
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 
161 161
 		$uri=$_SERVER['REQUEST_URI'];
162
-		if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) {
162
+		if (strpos($uri, $_SERVER['SCRIPT_NAME'])===0) {
163 163
 			$uri=substr($uri, strlen($_SERVER['SCRIPT_NAME']));
164
-		} elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) {
164
+		} elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME']))===0) {
165 165
 			$uri=substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
166 166
 		}
167 167
 
168 168
 		// This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct
169 169
 		// URI is found, and also fixes the QUERY_STRING server var and $_GET array.
170
-		if (strncmp($uri, '?/', 2) === 0) {
170
+		if (strncmp($uri, '?/', 2)===0) {
171 171
 			$uri=substr($uri, 2);
172 172
 		}
173 173
 		$parts=preg_split('#\?#i', $uri, 2);
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
 			parse_str($_SERVER['QUERY_STRING'], $_GET);
178 178
 		} else {
179 179
 			$_SERVER['QUERY_STRING']='';
180
-			$_GET=array ();
180
+			$_GET=array();
181 181
 		}
182 182
 
183
-		if ($uri == '/' || empty($uri)) {
183
+		if ($uri=='/' || empty($uri)) {
184 184
 			return '/';
185 185
 		}
186 186
 
187 187
 		$uri=parse_url($uri, PHP_URL_PATH);
188 188
 
189 189
 		// Do some final cleaning of the URI and return it
190
-		return str_replace(array ('//','../' ), '/', trim($uri, '/'));
190
+		return str_replace(array('//', '../'), '/', trim($uri, '/'));
191 191
 	}
192 192
 
193 193
 	// --------------------------------------------------------------------
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	private function _parse_cli_args() {
205 205
 		$args=array_slice($_SERVER['argv'], 1);
206 206
 
207
-		return $args ? '/' . implode('/', $args) : '';
207
+		return $args ? '/'.implode('/', $args) : '';
208 208
 	}
209 209
 
210 210
 	// --------------------------------------------------------------------
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 */
220 220
 	function _filter_uri($str) {
221
-		if ($str != '' && $this->permitted_uri_chars != '' && $this->enable_query_strings == FALSE) {
221
+		if ($str!='' && $this->permitted_uri_chars!='' && $this->enable_query_strings==FALSE) {
222 222
 			// preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
223 223
 			// compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
224
-			if (!preg_match("|^[" . str_replace(array ('\\-','\-' ), '-', preg_quote($this->permitted_uri_chars, '-')) . "]+$|i", $str)) {
224
+			if (!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->permitted_uri_chars, '-'))."]+$|i", $str)) {
225 225
 				show_error('The URI you submitted has disallowed characters.', 400);
226 226
 			}
227 227
 		}
228 228
 
229 229
 		// Convert programatic characters to entities
230
-		$bad=array ('$','(',')','%28','%29' );
231
-		$good=array ('&#36;','&#40;','&#41;','&#40;','&#41;' );
230
+		$bad=array('$', '(', ')', '%28', '%29');
231
+		$good=array('&#36;', '&#40;', '&#41;', '&#40;', '&#41;');
232 232
 
233 233
 		return str_replace($bad, $good, $str);
234 234
 	}
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 */
245 245
 	function _explode_segments() {
246
-		foreach ( explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val ) {
246
+		foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val) {
247 247
 			// Filter segments for security
248 248
 			$val=trim($this->_filter_uri($val));
249 249
 
250
-			if ($val != '') {
250
+			if ($val!='') {
251 251
 				$this->segments[]=$val;
252 252
 			}
253 253
 		}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 *
365 365
 	 */
366 366
 	function _uri_to_assoc($n=3, $default=array(), $which='segment') {
367
-		if ($which == 'segment') {
367
+		if ($which=='segment') {
368 368
 			$total_segments='total_segments';
369 369
 			$segment_array='segment_array';
370 370
 		} else {
@@ -380,25 +380,25 @@  discard block
 block discarded – undo
380 380
 			return $this->keyval[$n];
381 381
 		}
382 382
 
383
-		if ($this->$total_segments() < $n) {
384
-			if (count($default) == 0) {
385
-				return array ();
383
+		if ($this->$total_segments()<$n) {
384
+			if (count($default)==0) {
385
+				return array();
386 386
 			}
387 387
 
388
-			$retval=array ();
389
-			foreach ( $default as $val ) {
388
+			$retval=array();
389
+			foreach ($default as $val) {
390 390
 				$retval[$val]=FALSE;
391 391
 			}
392 392
 			return $retval;
393 393
 		}
394 394
 
395
-		$segments=array_slice($this->$segment_array(), ($n - 1));
395
+		$segments=array_slice($this->$segment_array(), ($n-1));
396 396
 
397 397
 		$i=0;
398 398
 		$lastval='';
399
-		$retval=array ();
400
-		foreach ( $segments as $seg ) {
401
-			if ($i % 2) {
399
+		$retval=array();
400
+		foreach ($segments as $seg) {
401
+			if ($i%2) {
402 402
 				$retval[$lastval]=$seg;
403 403
 			} else {
404 404
 				$retval[$seg]=FALSE;
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 			$i++;
409 409
 		}
410 410
 
411
-		if (count($default) > 0) {
412
-			foreach ( $default as $val ) {
411
+		if (count($default)>0) {
412
+			foreach ($default as $val) {
413 413
 				if (!array_key_exists($val, $retval)) {
414 414
 					$retval[$val]=FALSE;
415 415
 				}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 */
435 435
 	function assoc_to_uri($array) {
436
-		$temp=array ();
437
-		foreach ( ( array ) $array as $key => $val ) {
436
+		$temp=array();
437
+		foreach ((array)$array as $key => $val) {
438 438
 			$temp[]=$key;
439 439
 			$temp[]=$val;
440 440
 		}
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
 		$leading='/';
489 489
 		$trailing='/';
490 490
 
491
-		if ($where == 'trailing') {
491
+		if ($where=='trailing') {
492 492
 			$leading='';
493
-		} elseif ($where == 'leading') {
493
+		} elseif ($where=='leading') {
494 494
 			$trailing='';
495 495
 		}
496 496
 
497
-		return $leading . $this->$which($n) . $trailing;
497
+		return $leading.$this->$which($n).$trailing;
498 498
 	}
499 499
 
500 500
 	// --------------------------------------------------------------------
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	 *
573 573
 	 */
574 574
 	function ruri_string() {
575
-		return '/' . implode('/', $this->rsegment_array());
575
+		return '/'.implode('/', $this->rsegment_array());
576 576
 	}
577 577
 }
578 578
 // END URI Class
579 579
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/HtmlSemNavElement.php 3 patches
Doc Comments   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,6 +22,11 @@  discard block
 block discarded – undo
22 22
 	protected $_contentSeparator="";
23 23
 
24 24
 
25
+	/**
26
+	 * @param string $identifier
27
+	 * @param string $tagName
28
+	 * @param string $baseClass
29
+	 */
25 30
 	public function __construct($identifier,$tagName,$baseClass){
26 31
 		parent::__construct($identifier,$tagName,$baseClass);
27 32
 		$this->root="";
@@ -31,7 +36,7 @@  discard block
 block discarded – undo
31 36
 	/**
32 37
 	 * Associate an ajax get to the elements, displayed in $targetSelector
33 38
 	 * @param string $targetSelector the target of the get
34
-	 * @return HtmlNavElement
39
+	 * @return HtmlSemNavElement
35 40
 	 */
36 41
 	public function autoGetOnClick($targetSelector){
37 42
 		return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr));
@@ -63,7 +68,7 @@  discard block
 block discarded – undo
63 68
 	/**
64 69
 	 * Define the html attribute for each element url in ajax
65 70
 	 * @param string $attr html attribute
66
-	 * @return HtmlNavElement
71
+	 * @return HtmlSemNavElement
67 72
 	 */
68 73
 	public function setAttr($attr) {
69 74
 		$this->attr = $attr;
@@ -103,6 +108,9 @@  discard block
 block discarded – undo
103 108
 		return $this;
104 109
 	}
105 110
 
111
+	/**
112
+	 * @param integer $index
113
+	 */
106 114
 	protected function getContentDivider($index){
107 115
 		if(\is_array($this->_contentSeparator)===true){
108 116
 			return @$this->_contentSeparator[$index];
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	protected $_contentSeparator="";
23 23
 
24 24
 
25
-	public function __construct($identifier,$tagName,$baseClass){
26
-		parent::__construct($identifier,$tagName,$baseClass);
25
+	public function __construct($identifier, $tagName, $baseClass) {
26
+		parent::__construct($identifier, $tagName, $baseClass);
27 27
 		$this->root="";
28 28
 		$this->attr="data-ajax";
29 29
 	}
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	 * @param string $targetSelector the target of the get
34 34
 	 * @return HtmlNavElement
35 35
 	 */
36
-	public function autoGetOnClick($targetSelector){
37
-		return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr));
36
+	public function autoGetOnClick($targetSelector) {
37
+		return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr));
38 38
 	}
39 39
 
40
-	public function contentAsString(){
40
+	public function contentAsString() {
41 41
 		return JArray::implode($this->_contentSeparator, $this->content);
42 42
 	}
43 43
 
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
 	 * Generate the jquery script to set the elements to the HtmlNavElement
46 46
 	 * @param JsUtils $jsUtils
47 47
 	 */
48
-	public function jsSetContent(JsUtils $jsUtils){
49
-		$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
48
+	public function jsSetContent(JsUtils $jsUtils) {
49
+		$jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true);
50 50
 	}
51 51
 
52 52
 	public function getRoot() {
53 53
 		return $this->root;
54 54
 	}
55 55
 	public function setRoot($root) {
56
-		$this->root = $root;
56
+		$this->root=$root;
57 57
 		return $this;
58 58
 	}
59 59
 	public function getAttr() {
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * @return HtmlNavElement
67 67
 	 */
68 68
 	public function setAttr($attr) {
69
-		$this->attr = $attr;
69
+		$this->attr=$attr;
70 70
 		return $this;
71 71
 	}
72 72
 
73 73
 	public function __call($method, $args) {
74
-		if(isset($this->$method) && is_callable($this->$method)) {
74
+		if (isset($this->$method) && is_callable($this->$method)) {
75 75
 			return call_user_func_array(
76 76
 					$this->$method,
77 77
 					$args
@@ -79,32 +79,32 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 	}
81 81
 
82
-	public abstract function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0);
82
+	public abstract function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0);
83 83
 
84 84
 
85
-	public function setContentDivider($divider,$index=NULL) {
85
+	public function setContentDivider($divider, $index=NULL) {
86 86
 		$divider="<div class='divider'> {$divider} </div>";
87 87
 		return $this->setDivider($divider, $index);
88 88
 	}
89 89
 
90
-	public function setIconContentDivider($iconContentDivider,$index=NULL) {
90
+	public function setIconContentDivider($iconContentDivider, $index=NULL) {
91 91
 		$contentDivider="<i class='".$iconContentDivider." icon divider'></i>";
92 92
 		return $this->setDivider($contentDivider, $index);
93 93
 	}
94 94
 
95
-	protected function setDivider($divider,$index){
96
-		if(isset($index)){
97
-			if(\is_array($this->_contentSeparator)===false)
98
-				$this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator);
95
+	protected function setDivider($divider, $index) {
96
+		if (isset($index)) {
97
+			if (\is_array($this->_contentSeparator)===false)
98
+				$this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator);
99 99
 			$this->_contentSeparator[$index]=$divider;
100
-		}else{
100
+		} else {
101 101
 			$this->_contentSeparator=$divider;
102 102
 		}
103 103
 		return $this;
104 104
 	}
105 105
 
106
-	protected function getContentDivider($index){
107
-		if(\is_array($this->_contentSeparator)===true){
106
+	protected function getContentDivider($index) {
107
+		if (\is_array($this->_contentSeparator)===true) {
108 108
 			return @$this->_contentSeparator[$index];
109 109
 		}
110 110
 		return $this->_contentSeparator;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -94,10 +94,11 @@
 block discarded – undo
94 94
 
95 95
 	protected function setDivider($divider,$index){
96 96
 		if(isset($index)){
97
-			if(\is_array($this->_contentSeparator)===false)
98
-				$this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator);
97
+			if(\is_array($this->_contentSeparator)===false) {
98
+							$this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator);
99
+			}
99 100
 			$this->_contentSeparator[$index]=$divider;
100
-		}else{
101
+		} else{
101 102
 			$this->_contentSeparator=$divider;
102 103
 		}
103 104
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 3 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -12,12 +12,24 @@
 block discarded – undo
12 12
 	protected $_states=[ ];
13 13
 	protected $_baseClass;
14 14
 
15
+	/**
16
+	 * @param string $name
17
+	 */
15 18
 	protected abstract function setPropertyCtrl($name, $value, $typeCtrl);
16 19
 
20
+	/**
21
+	 * @param string $name
22
+	 */
17 23
 	protected abstract function addToPropertyCtrl($name, $value, $typeCtrl);
18 24
 
25
+	/**
26
+	 * @param string $name
27
+	 */
19 28
 	protected abstract function addToPropertyCtrlCheck($name, $value, $typeCtrl);
20 29
 
30
+	/**
31
+	 * @param string $name
32
+	 */
21 33
 	public abstract function addToProperty($name, $value, $separator=" ");
22 34
 
23 35
 	public function addVariation($variation) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
 	public function setVariations($variations) {
37 37
 		$this->setProperty("class", $this->_baseClass);
38
-		if (\is_string($variations))
39
-			$variations=\explode(" ", $variations);
38
+		if (\is_string($variations)) {
39
+					$variations=\explode(" ", $variations);
40
+		}
40 41
 		foreach ( $variations as $variation ) {
41 42
 			$this->addVariation($variation);
42 43
 		}
@@ -49,8 +50,9 @@  discard block
 block discarded – undo
49 50
 	}
50 51
 
51 52
 	public function addVariations($variations=array()) {
52
-		if (\is_string($variations))
53
-			$variations=\explode(" ", $variations);
53
+		if (\is_string($variations)) {
54
+					$variations=\explode(" ", $variations);
55
+		}
54 56
 		foreach ( $variations as $variation ) {
55 57
 			$this->addVariation($variation);
56 58
 		}
@@ -58,8 +60,9 @@  discard block
 block discarded – undo
58 60
 	}
59 61
 
60 62
 	public function addStates($states=array()) {
61
-		if (\is_string($states))
62
-			$states=\explode(" ", $states);
63
+		if (\is_string($states)) {
64
+					$states=\explode(" ", $states);
65
+		}
63 66
 		foreach ( $states as $state ) {
64 67
 			$this->addState($state);
65 68
 		}
@@ -68,8 +71,9 @@  discard block
 block discarded – undo
68 71
 
69 72
 	public function setStates($states) {
70 73
 		$this->setProperty("class", $this->_baseClass);
71
-		if (\is_string($states))
72
-			$states=\explode(" ", $states);
74
+		if (\is_string($states)) {
75
+					$states=\explode(" ", $states);
76
+		}
73 77
 		foreach ( $states as $state ) {
74 78
 			$this->addState($state);
75 79
 		}
Please login to merge, or discard this patch.