Completed
Push — master ( 79b035...e37d9a )
by Jean-Christophe
03:44
created
Ajax/semantic/traits/SemanticHtmlElementsTrait.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @param boolean $asIcons
36 36
 	 * @return HtmlButtonGroups
37 37
 	 */
38
-	public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){
39
-		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons));
38
+	public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) {
39
+		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons));
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param string $content
46 46
 	 * @return HtmlContainer
47 47
 	 */
48
-	public function htmlContainer($identifier,$content=""){
48
+	public function htmlContainer($identifier, $content="") {
49 49
 		return $this->addHtmlComponent(new HtmlContainer($identifier, $content));
50 50
 	}
51 51
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 * @param string $content
55 55
 	 * @return HtmlDivider
56 56
 	 */
57
-	public function htmlDivider($identifier,$content="",$tagName="div"){
58
-		return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName));
57
+	public function htmlDivider($identifier, $content="", $tagName="div") {
58
+		return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName));
59 59
 	}
60 60
 
61 61
 	/**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 * @param string $type
66 66
 	 * @return HtmlHeader
67 67
 	 */
68
-	public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){
69
-		return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type));
68
+	public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") {
69
+		return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type));
70 70
 	}
71 71
 
72 72
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param string $icon
75 75
 	 * @return HtmlIcon
76 76
 	 */
77
-	public function htmlIcon($identifier,$icon){
77
+	public function htmlIcon($identifier, $icon) {
78 78
 		return $this->addHtmlComponent(new HtmlIcon($identifier, $icon));
79 79
 	}
80 80
 
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 * @param array $icons
85 85
 	 * @return HtmlIconGroups
86 86
 	 */
87
-	public function htmlIconGroups($identifier,$size="",$icons=array()){
88
-		$group=new HtmlIconGroups($identifier,$size);
89
-		if(JArray::isAssociative($icons)){
90
-			foreach ($icons as $icon=>$size){
91
-				$group->add($icon,$size);
87
+	public function htmlIconGroups($identifier, $size="", $icons=array()) {
88
+		$group=new HtmlIconGroups($identifier, $size);
89
+		if (JArray::isAssociative($icons)) {
90
+			foreach ($icons as $icon=>$size) {
91
+				$group->add($icon, $size);
92 92
 			}
93
-		}else{
94
-			foreach ($icons as $icon){
93
+		}else {
94
+			foreach ($icons as $icon) {
95 95
 				$group->add($icon);
96 96
 			}
97 97
 		}
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param string $placeholder
107 107
 	 * @return HtmlInput
108 108
 	 */
109
-	public function htmlInput($identifier,$type="text",$value="",$placeholder=""){
110
-		return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder));
109
+	public function htmlInput($identifier, $type="text", $value="", $placeholder="") {
110
+		return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder));
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @param string $tagName
117 117
 	 * @return HtmlLabel
118 118
 	 */
119
-	public function htmlLabel($identifier,$content="",$tagName="div"){
120
-		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName));
119
+	public function htmlLabel($identifier, $content="", $tagName="div") {
120
+		return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName));
121 121
 	}
122 122
 
123 123
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @param array $items
127 127
 	 * @return HtmlList
128 128
 	 */
129
-	public function htmlList($identifier,$items=array()){
130
-		return $this->addHtmlComponent(new HtmlList($identifier,$items));
129
+	public function htmlList($identifier, $items=array()) {
130
+		return $this->addHtmlComponent(new HtmlList($identifier, $items));
131 131
 	}
132 132
 
133 133
 	/**
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 * @param string $content
137 137
 	 * @return HtmlSegment
138 138
 	 */
139
-	public function htmlSegment($identifier, $content=""){
140
-		return $this->addHtmlComponent(new HtmlSegment($identifier,$content));
139
+	public function htmlSegment($identifier, $content="") {
140
+		return $this->addHtmlComponent(new HtmlSegment($identifier, $content));
141 141
 	}
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param array $items the segments
147 147
 	 * @return HtmlSegmentGroups
148 148
 	 */
149
-	public function htmlSegmentGroups($identifier, $items=array()){
150
-		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items));
149
+	public function htmlSegmentGroups($identifier, $items=array()) {
150
+		return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items));
151 151
 	}
152 152
 }
153 153
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/Jquery.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@  discard block
 block discarded – undo
17 17
  * jQuery Class
18 18
  */
19 19
 class Jquery {
20
-	use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait;
20
+	use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait;
21 21
 	protected $_di;
22 22
 	protected $_ui;
23 23
 	protected $_bootstrap;
24 24
 	protected $_semantic;
25 25
 	protected $libraryFile;
26 26
 	protected $_javascript_folder='js';
27
-	protected $jquery_code_for_load=array ();
28
-	protected $jquery_code_for_compile=array ();
27
+	protected $jquery_code_for_load=array();
28
+	protected $jquery_code_for_compile=array();
29 29
 	protected $jquery_corner_active=FALSE;
30 30
 	protected $jquery_table_sorter_active=FALSE;
31 31
 	protected $jquery_table_sorter_pager_active=FALSE;
32 32
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
33
-	protected $jquery_events=array (
34
-			"bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload"
33
+	protected $jquery_events=array(
34
+			"bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload"
35 35
 	);
36 36
 
37 37
 	public function setDi($di) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 	public function __construct($params) {
63 63
 		$this->params=array();
64
-		foreach ( $params as $key => $val ) {
64
+		foreach ($params as $key => $val) {
65 65
 				$this->params[$key]=$params[$key];
66 66
 		}
67 67
 	}
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function _output($array_js='') {
146 146
 		if (!is_array($array_js)) {
147
-			$array_js=array (
147
+			$array_js=array(
148 148
 					$array_js
149 149
 			);
150 150
 		}
151 151
 
152
-		foreach ( $array_js as $js ) {
152
+		foreach ($array_js as $js) {
153 153
 			$this->jquery_code_for_compile[]="\t$js\n";
154 154
 		}
155 155
 	}
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 * @param string $param
169 169
 	 * @param boolean $immediatly delayed if false
170 170
 	 */
171
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
171
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
172 172
 		$element=$this->_prep_element($element);
173 173
 		if (isset($param)) {
174 174
 			$param=$this->_prep_value($param);
175 175
 			$str="$({$element}).{$jQueryCall}({$param});";
176
-		} else
176
+		}else
177 177
 			$str="$({$element}).{$jQueryCall}();";
178 178
 			if ($immediatly)
179 179
 				$this->jquery_code_for_compile[]=$str;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @param boolean $immediatly delayed if false
188 188
 	 * @return string
189 189
 	 */
190
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
190
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
191 191
 		$to=$this->_prep_element($to);
192 192
 		$element=$this->_prep_element($element);
193 193
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function sortable($element, $options=array()) {
213 213
 		if (count($options)>0) {
214
-			$sort_options=array ();
215
-			foreach ( $options as $k => $v ) {
214
+			$sort_options=array();
215
+			foreach ($options as $k => $v) {
216 216
 				$sort_options[]="\n\t\t".$k.': '.$v."";
217 217
 			}
218 218
 			$sort_options=implode(",", $sort_options);
219
-		} else {
219
+		}else {
220 220
 			$sort_options='';
221 221
 		}
222 222
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
251 251
 	 * @return string
252 252
 	 */
253
-	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
253
+	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
254 254
 		if (is_array($js)) {
255 255
 			$js=implode("\n\t\t", $js);
256 256
 		}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			$event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
265 265
 		else
266 266
 			$event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
267
-		if($immediatly)
267
+		if ($immediatly)
268 268
 			$this->jquery_code_for_compile[]=$event;
269 269
 		return $event;
270 270
 	}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
 		// External references
308 308
 		$external_scripts=implode('', $this->jquery_code_for_load);
309
-		extract(array (
309
+		extract(array(
310 310
 				'library_src' => $external_scripts
311 311
 		));
312 312
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		$script.='});';
322 322
 
323 323
 		$this->jquery_code_for_compile=array();
324
-		if($this->params["debug"]==false){
324
+		if ($this->params["debug"]==false) {
325 325
 			$script=$this->minify($script);
326 326
 		}
327 327
 		$output=($script_tags===FALSE) ? $script : $this->inline($script);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 * @return void
344 344
 	 */
345 345
 	public function _clear_compile() {
346
-		$this->jquery_code_for_compile=array ();
346
+		$this->jquery_code_for_compile=array();
347 347
 	}
348 348
 
349 349
 	// --------------------------------------------------------------------
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	public function _document_ready($js) {
357 357
 		if (!is_array($js)) {
358
-			$js=array (
358
+			$js=array(
359 359
 					$js
360 360
 			);
361 361
 		}
362 362
 
363
-		foreach ( $js as $script ) {
363
+		foreach ($js as $script) {
364 364
 			$this->jquery_code_for_compile[]=$script;
365 365
 		}
366 366
 	}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 * @return string
377 377
 	 */
378 378
 	public function _prep_element($element) {
379
-		if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) {
379
+		if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) {
380 380
 			$element='"'.addslashes($element).'"';
381 381
 		}
382 382
 		return $element;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		if (is_array($value)) {
395 395
 			$value=implode(",", $value);
396 396
 		}
397
-		if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) {
397
+		if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) {
398 398
 			$value='"'.$value.'"';
399 399
 		}
400 400
 		return $value;
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	 * @return string
410 410
 	 */
411 411
 	private function _validate_speed($speed) {
412
-		if (in_array($speed, array (
413
-				'slow','normal','fast'
412
+		if (in_array($speed, array(
413
+				'slow', 'normal', 'fast'
414 414
 		))) {
415 415
 			$speed='"'.$speed.'"';
416 416
 		} elseif (preg_match("/[^0-9]/", $speed)) {
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 
423 423
 	private function minify($input) {
424
-	if(trim($input) === "") return $input;
424
+	if (trim($input)==="") return $input;
425 425
 	return preg_replace(
426 426
 			array(
427 427
 					// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/JsUtils.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * JsUtils Class : Phalcon service to be injected
26 26
  */
27 27
 abstract class _JsUtils implements InjectionAwareInterface {
28
-	use JsUtilsEventsTrait,JsUtilsActionsTrait,JsUtilsAjaxTrait;
28
+	use JsUtilsEventsTrait, JsUtilsActionsTrait, JsUtilsAjaxTrait;
29 29
 
30 30
 	protected $_di;
31 31
 	protected $js;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	protected function _setDi($di) {
56 56
 		$this->_di=$di;
57
-		if ($this->js!=null&&$di!=null)
57
+		if ($this->js!=null && $di!=null)
58 58
 			$this->js->setDi($di);
59 59
 	}
60 60
 
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
 
148 148
 
149 149
 	public function __construct($params=array()) {
150
-		$defaults=array (
150
+		$defaults=array(
151 151
 				'driver' => 'Jquery',
152 152
 				'debug' => true
153 153
 		);
154
-		foreach ( $defaults as $key => $val ) {
155
-			if (isset($params[$key])&&$params[$key]!=="") {
154
+		foreach ($defaults as $key => $val) {
155
+			if (isset($params[$key]) && $params[$key]!=="") {
156 156
 				$defaults[$key]=$params[$key];
157 157
 			}
158 158
 		}
159 159
 		extract($defaults);
160 160
 		$this->js=new Jquery($defaults);
161
-		$this->cdns=array ();
161
+		$this->cdns=array();
162 162
 	}
163 163
 
164 164
 	public function addToCompile($jsScript) {
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) {
198 198
 		$bs=$this->_bootstrap;
199
-		if (isset($bs)&&isset($view)) {
199
+		if (isset($bs) && isset($view)) {
200 200
 			$bs->compileHtml($this, $view);
201 201
 		}
202 202
 		$sem=$this->_semantic;
203
-		if (isset($sem)&&isset($view)) {
203
+		if (isset($sem) && isset($view)) {
204 204
 			$sem->compileHtml($this, $view);
205 205
 		}
206 206
 		return $this->js->_compile($view, $view_var, $script_tags);
@@ -280,27 +280,27 @@  discard block
 block discarded – undo
280 280
 				$json_result=$result->result_array();
281 281
 			} elseif (is_array($result)) {
282 282
 				$json_result=$result;
283
-			} else {
283
+			}else {
284 284
 				return $this->_prep_args($result);
285 285
 			}
286
-		} else {
286
+		}else {
287 287
 			return 'null';
288 288
 		}
289 289
 		return $this->_create_json($json_result, $match_array_type);
290 290
 	}
291 291
 
292 292
 	private function _create_json($json_result, $match_array_type) {
293
-		$json=array ();
293
+		$json=array();
294 294
 		$_is_assoc=TRUE;
295
-		if (!is_array($json_result)&&empty($json_result)) {
295
+		if (!is_array($json_result) && empty($json_result)) {
296 296
 			show_error("Generate JSON Failed - Illegal key, value pair.");
297 297
 		} elseif ($match_array_type) {
298 298
 			$_is_assoc=$this->_is_associative_array($json_result);
299 299
 		}
300
-		foreach ( $json_result as $k => $v ) {
300
+		foreach ($json_result as $k => $v) {
301 301
 			if ($_is_assoc) {
302 302
 				$json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type);
303
-			} else {
303
+			}else {
304 304
 				$json[]=$this->generate_json($v, $match_array_type);
305 305
 			}
306 306
 		}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @return type
316 316
 	 */
317 317
 	public function _is_associative_array($arr) {
318
-		foreach ( array_keys($arr) as $key => $val ) {
318
+		foreach (array_keys($arr) as $key => $val) {
319 319
 			if ($key!==$val) {
320 320
 				return TRUE;
321 321
 			}
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 			return 'null';
335 335
 		} elseif (is_bool($result)) {
336 336
 			return ($result===TRUE) ? 'true' : 'false';
337
-		} elseif (is_string($result)||$is_key) {
338
-			return '"'.str_replace(array (
339
-					'\\',"\t","\n","\r",'"','/'
340
-			), array (
341
-					'\\\\','\\t','\\n',"\\r",'\"','\/'
337
+		} elseif (is_string($result) || $is_key) {
338
+			return '"'.str_replace(array(
339
+					'\\', "\t", "\n", "\r", '"', '/'
340
+			), array(
341
+					'\\\\', '\\t', '\\n', "\\r", '\"', '\/'
342 342
 			), $result).'"';
343 343
 		} elseif (is_scalar($result)) {
344 344
 			return $result;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 
352 352
 	public function setCDNs($cdns) {
353 353
 		if (is_array($cdns)===false) {
354
-			$cdns=array (
354
+			$cdns=array(
355 355
 					$cdns
356 356
 			);
357 357
 		}
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
 		$hasJQueryUI=false;
364 364
 		$hasBootstrap=false;
365 365
 		$hasSemantic=false;
366
-		$result=array ();
367
-		foreach ( $this->cdns as $cdn ) {
368
-			switch(get_class($cdn)) {
366
+		$result=array();
367
+		foreach ($this->cdns as $cdn) {
368
+			switch (get_class($cdn)) {
369 369
 				case "Ajax\lib\CDNJQuery":
370 370
 					$hasJQuery=true;
371 371
 					$result[0]=$cdn;
@@ -375,11 +375,11 @@  discard block
 block discarded – undo
375 375
 					$result[1]=$cdn;
376 376
 					break;
377 377
 				case "Ajax\lib\CDNCoreCss":
378
-					if($cdn->getFramework()==="Bootstrap")
378
+					if ($cdn->getFramework()==="Bootstrap")
379 379
 						$hasBootstrap=true;
380
-					elseif($cdn->getFramework()==="Semantic")
380
+					elseif ($cdn->getFramework()==="Semantic")
381 381
 						$hasSemantic=true;
382
-					if($hasSemantic || $hasBootstrap)
382
+					if ($hasSemantic || $hasBootstrap)
383 383
 						$result[2]=$cdn;
384 384
 					break;
385 385
 			}
@@ -387,14 +387,14 @@  discard block
 block discarded – undo
387 387
 		if ($hasJQuery===false) {
388 388
 			$result[0]=new CDNJQuery("x");
389 389
 		}
390
-		if ($hasJQueryUI===false&&isset($this->_ui)) {
390
+		if ($hasJQueryUI===false && isset($this->_ui)) {
391 391
 			$result[1]=new CDNGuiGen("x", $template);
392 392
 		}
393
-		if ($hasBootstrap===false&&isset($this->_bootstrap)) {
394
-			$result[2]=new CDNCoreCss("Bootstrap","x");
393
+		if ($hasBootstrap===false && isset($this->_bootstrap)) {
394
+			$result[2]=new CDNCoreCss("Bootstrap", "x");
395 395
 		}
396
-		if ($hasSemantic===false&&isset($this->_semantic)) {
397
-			$result[2]=new CDNCoreCss("Semantic","x");
396
+		if ($hasSemantic===false && isset($this->_semantic)) {
397
+			$result[2]=new CDNCoreCss("Semantic", "x");
398 398
 		}
399 399
 		ksort($result);
400 400
 		return implode("\n", $result);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 			$this->_setDi($di);
408 408
 		}
409 409
 	}
410
-} else {
410
+}else {
411 411
 	class JsUtils extends _JsUtils {
412 412
 
413 413
 		public function setDi(DiInterface $di) {
Please login to merge, or discard this patch.