Completed
Push — master ( b23d1e...03b6f4 )
by Jean-Christophe
04:33
created
Ajax/semantic/html/modules/HtmlAccordion.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@  discard block
 block discarded – undo
6 6
 use Ajax\semantic\html\content\HtmlAccordionItem;
7 7
 use Ajax\JsUtils;
8 8
 
9
-class HtmlAccordion extends HtmlSemCollection{
9
+class HtmlAccordion extends HtmlSemCollection {
10 10
 
11 11
 	protected $params=array();
12 12
 
13
-	public function __construct( $identifier, $tagName="div", $baseClass="ui"){
14
-		parent::__construct( $identifier, "div", "ui accordion");
13
+	public function __construct($identifier, $tagName="div", $baseClass="ui") {
14
+		parent::__construct($identifier, "div", "ui accordion");
15 15
 	}
16 16
 
17 17
 
18
-	protected function createItem($value){
18
+	protected function createItem($value) {
19 19
 		$count=$this->count();
20 20
 		$title=$value;
21 21
 		$content=NULL;
22
-		if(\is_array($value)){
23
-			$title=@$value[0];$content=@$value[1];
22
+		if (\is_array($value)) {
23
+			$title=@$value[0]; $content=@$value[1];
24 24
 		}
25
-		return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content);
25
+		return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content);
26 26
 	}
27 27
 
28
-	protected function createCondition($value){
28
+	protected function createCondition($value) {
29 29
 		return ($value instanceof HtmlAccordionItem)===false;
30 30
 	}
31 31
 
32
-	public function addPanel($title,$content){
33
-		return $this->addItem([$title,$content]);
32
+	public function addPanel($title, $content) {
33
+		return $this->addItem([$title, $content]);
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param string $action a Phalcon action
43 43
 	 * @param array $params
44 44
 	 */
45
-	public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
46
-		return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params));
45
+	public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
46
+		return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params));
47 47
 	}
48 48
 
49 49
 	/**
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
 	 * @param string $viewName
55 55
 	 * @param $params The parameters to pass to the view
56 56
 	 */
57
-	public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
58
-		return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params));
57
+	public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
58
+		return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params));
59 59
 	}
60 60
 	/*
61 61
 	 * (non-PHPdoc)
62 62
 	 * @see BaseHtml::run()
63 63
 	 */
64 64
 	public function run(JsUtils $js) {
65
-		if(isset($this->_bsComponent)===false)
66
-			$this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params);
65
+		if (isset($this->_bsComponent)===false)
66
+			$this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params);
67 67
 			$this->addEventsOnRun($js);
68 68
 			return $this->_bsComponent;
69 69
 	}
70 70
 
71
-	public function setStyled(){
71
+	public function setStyled() {
72 72
 		return $this->addToProperty("class", "styled");
73 73
 	}
74 74
 
75
-	public function setActive($index){
75
+	public function setActive($index) {
76 76
 		$this->getItem($index)->setActive(true);
77 77
 		return $this;
78 78
 	}
79 79
 
80
-	public function setExclusive($value){
80
+	public function setExclusive($value) {
81 81
 		$this->params["exclusive"]=$value;
82 82
 	}
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlBreadcrumb.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$this->startIndex=$startIndex;
52 52
 		$this->autoActive=$autoActive;
53 53
 		$this->_contentSeparator="<div class='divider'> / </div>";
54
-		$this->_hrefFunction=function ($e) {
54
+		$this->_hrefFunction=function($e) {
55 55
 			return $e->getContent();
56 56
 		};
57 57
 		if (isset($hrefFunction)) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return HtmlBreadcrumbs
69 69
 	 */
70 70
 	public function autoGetOnClick($targetSelector) {
71
-		return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr ));
71
+		return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr));
72 72
 	}
73 73
 
74 74
 	public function contentAsString() {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 	public function setActive($index=null) {
82 82
 		if (!isset($index)) {
83
-			$index=sizeof($this->content) - 1;
83
+			$index=sizeof($this->content)-1;
84 84
 		}
85 85
 		$activeItem=$this->content[$index];
86 86
 		$activeItem->addToProperty("class", "active");
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param Dispatcher $dispatcher the request dispatcher
94 94
 	 * @return \Ajax\bootstrap\html\HtmlBreadcrumbs
95 95
 	 */
96
-	public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) {
96
+	public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) {
97 97
 		return $this->addItems($js->fromDispatcher($dispatcher));
98 98
 	}
99 99
 
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 		if (!isset($index)) {
108 108
 			$index=sizeof($this->content);
109 109
 		}
110
-		if ($this->absolutePaths === true) {
110
+		if ($this->absolutePaths===true) {
111 111
 			return $this->_hrefFunction($this->content[$index]);
112
-		} else {
113
-			return $this->root . implode($separator, array_slice(array_map(function ($e) {
112
+		}else {
113
+			return $this->root.implode($separator, array_slice(array_map(function($e) {
114 114
 				return $this->_hrefFunction($e);
115
-			}, $this->content), $this->startIndex, $index + 1));
115
+			}, $this->content), $this->startIndex, $index+1));
116 116
 		}
117 117
 	}
118 118
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 			$this->setActive();
147 147
 		}
148 148
 		$count=$this->count();
149
-		for($i=1; $i < $count; $i++) {
150
-			$this->content[$i]->wrap($this->getContentDivider($i - 1));
149
+		for ($i=1; $i<$count; $i++) {
150
+			$this->content[$i]->wrap($this->getContentDivider($i-1));
151 151
 		}
152 152
 		return parent::compile($js, $view);
153 153
 	}
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
158 158
 	 */
159 159
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
160
-		foreach ( $this->content as $element ) {
160
+		foreach ($this->content as $element) {
161 161
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
162 162
 		}
163 163
 		return $this;
164 164
 	}
165 165
 
166 166
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
167
-		foreach ( $this->content as $element ) {
168
-			if ($element->getProperty($this->attr) != NULL){
167
+		foreach ($this->content as $element) {
168
+			if ($element->getProperty($this->attr)!=NULL) {
169 169
 				$element->_ajaxOn($operation, $event, $url, $responseElement, $parameters);
170 170
 			}
171 171
 		}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	protected function createItem($value) {
182 182
 		$count=$this->count();
183
-		$itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section");
183
+		$itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section");
184 184
 		if (\is_array($value))
185 185
 			$itemO->fromArray($value);
186 186
 		else {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	public function addIconAt($icon, $index) {
193 193
 		$item=$this->getItem($index);
194 194
 		if (isset($item)) {
195
-			$icon=new HtmlIcon("icon-" . $this->identifier, $icon);
195
+			$icon=new HtmlIcon("icon-".$this->identifier, $icon);
196 196
 			$item->wrapContent($icon);
197 197
 		}
198 198
 	}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	public function addItem($item) {
201 201
 		$count=$this->count();
202 202
 		$itemO=parent::addItem($item);
203
-		$this->addToPropertyCtrl("class", "section", array ("section" ));
203
+		$this->addToPropertyCtrl("class", "section", array("section"));
204 204
 		$itemO->setProperty($this->attr, $this->getHref($count));
205 205
 		return $itemO;
206 206
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -181,9 +181,9 @@
 block discarded – undo
181 181
 	protected function createItem($value) {
182 182
 		$count=$this->count();
183 183
 		$itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section");
184
-		if (\is_array($value))
185
-			$itemO->fromArray($value);
186
-		else {
184
+		if (\is_array($value)) {
185
+					$itemO->fromArray($value);
186
+		} else {
187 187
 			$itemO->setContent($value);
188 188
 		}
189 189
 		return $itemO;
Please login to merge, or discard this patch.
Ajax/Jquery.php 2 patches
Spacing   +27 added lines, -27 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 $_ui;
22 22
 	protected $_bootstrap;
23 23
 	protected $_semantic;
24 24
 	protected $libraryFile;
25 25
 	protected $_javascript_folder='js';
26
-	protected $jquery_code_for_load=array ();
27
-	protected $jquery_code_for_compile=array ();
26
+	protected $jquery_code_for_load=array();
27
+	protected $jquery_code_for_compile=array();
28 28
 	protected $jquery_corner_active=FALSE;
29 29
 	protected $jquery_table_sorter_active=FALSE;
30 30
 	protected $jquery_table_sorter_pager_active=FALSE;
31 31
 	protected $jsUtils;
32 32
 
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 ui($ui=NULL) {
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 		return $this->_semantic;
56 56
 	}
57 57
 
58
-	public function __construct($params,$jsUtils) {
58
+	public function __construct($params, $jsUtils) {
59 59
 		$this->params=array();
60
-		foreach ( $params as $key => $val ) {
60
+		foreach ($params as $key => $val) {
61 61
 				$this->params[$key]=$params[$key];
62 62
 		}
63 63
 		$this->jsUtils=$jsUtils;
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function _output($array_js='') {
127 127
 		if (!is_array($array_js)) {
128
-			$array_js=array (
128
+			$array_js=array(
129 129
 					$array_js
130 130
 			);
131 131
 		}
132 132
 
133
-		foreach ( $array_js as $js ) {
133
+		foreach ($array_js as $js) {
134 134
 			$this->jquery_code_for_compile[]="\t$js\n";
135 135
 		}
136 136
 	}
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 	 * @param string $param
143 143
 	 * @param boolean $immediatly delayed if false
144 144
 	 */
145
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
145
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
146 146
 		$element=$this->_prep_element($element);
147 147
 		if (isset($param)) {
148 148
 			$param=$this->_prep_value($param);
149 149
 			$str="$({$element}).{$jQueryCall}({$param});";
150
-		} else
150
+		}else
151 151
 			$str="$({$element}).{$jQueryCall}();";
152 152
 			if ($immediatly)
153 153
 				$this->jquery_code_for_compile[]=$str;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @param boolean $immediatly delayed if false
162 162
 	 * @return string
163 163
 	 */
164
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
164
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
165 165
 		$to=$this->_prep_element($to);
166 166
 		$element=$this->_prep_element($element);
167 167
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function sortable($element, $options=array()) {
181 181
 		if (count($options)>0) {
182
-			$sort_options=array ();
183
-			foreach ( $options as $k => $v ) {
182
+			$sort_options=array();
183
+			foreach ($options as $k => $v) {
184 184
 				$sort_options[]="\n\t\t".$k.': '.$v."";
185 185
 			}
186 186
 			$sort_options=implode(",", $sort_options);
187
-		} else {
187
+		}else {
188 188
 			$sort_options='';
189 189
 		}
190 190
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
213 213
 	 * @return string
214 214
 	 */
215
-	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
215
+	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
216 216
 		if (is_array($js)) {
217 217
 			$js=implode("\n\t\t", $js);
218 218
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
227 227
 		else
228 228
 			$event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
229
-		if($immediatly)
229
+		if ($immediatly)
230 230
 			$this->jquery_code_for_compile[]=$event;
231 231
 		return $event;
232 232
 	}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		// External references
268 268
 		$external_scripts=implode('', $this->jquery_code_for_load);
269
-		extract(array (
269
+		extract(array(
270 270
 				'library_src' => $external_scripts
271 271
 		));
272 272
 
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 		$script.='});';
282 282
 
283 283
 		$this->jquery_code_for_compile=array();
284
-		if($this->params["debug"]==false){
284
+		if ($this->params["debug"]==false) {
285 285
 			$script=$this->minify($script);
286 286
 		}
287 287
 		$output=($script_tags===FALSE) ? $script : $this->inline($script);
288 288
 
289
-		if ($view!==NULL){
290
-			$this->jsUtils->createScriptVariable($view,$view_var, $output);
289
+		if ($view!==NULL) {
290
+			$this->jsUtils->createScriptVariable($view, $view_var, $output);
291 291
 		}
292 292
 		return $output;
293 293
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return void
303 303
 	 */
304 304
 	public function _clear_compile() {
305
-		$this->jquery_code_for_compile=array ();
305
+		$this->jquery_code_for_compile=array();
306 306
 	}
307 307
 
308 308
 	/**
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	public function _document_ready($js) {
313 313
 		if (!is_array($js)) {
314
-			$js=array (
314
+			$js=array(
315 315
 					$js
316 316
 			);
317 317
 		}
318 318
 
319
-		foreach ( $js as $script ) {
319
+		foreach ($js as $script) {
320 320
 			$this->jquery_code_for_compile[]=$script;
321 321
 		}
322 322
 	}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * @return string
331 331
 	 */
332 332
 	public function _prep_element($element) {
333
-		if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) {
333
+		if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) {
334 334
 			$element='"'.addslashes($element).'"';
335 335
 		}
336 336
 		return $element;
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 		if (is_array($value)) {
349 349
 			$value=implode(",", $value);
350 350
 		}
351
-		if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) {
351
+		if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) {
352 352
 			$value='"'.$value.'"';
353 353
 		}
354 354
 		return $value;
355 355
 	}
356 356
 
357 357
 	private function minify($input) {
358
-	if(trim($input) === "") return $input;
358
+	if (trim($input)==="") return $input;
359 359
 	return preg_replace(
360 360
 			array(
361 361
 					// Remove comment(s)
Please login to merge, or discard this patch.
Braces   +20 added lines, -13 removed lines patch added patch discarded remove patch
@@ -147,10 +147,12 @@  discard block
 block discarded – undo
147 147
 		if (isset($param)) {
148 148
 			$param=$this->_prep_value($param);
149 149
 			$str="$({$element}).{$jQueryCall}({$param});";
150
-		} else
151
-			$str="$({$element}).{$jQueryCall}();";
152
-			if ($immediatly)
153
-				$this->jquery_code_for_compile[]=$str;
150
+		} else {
151
+					$str="$({$element}).{$jQueryCall}();";
152
+		}
153
+			if ($immediatly) {
154
+							$this->jquery_code_for_compile[]=$str;
155
+			}
154 156
 			return $str;
155 157
 	}
156 158
 	/**
@@ -165,8 +167,9 @@  discard block
 block discarded – undo
165 167
 		$to=$this->_prep_element($to);
166 168
 		$element=$this->_prep_element($element);
167 169
 		$str="$({$to}).{$jQueryCall}({$element});";
168
-		if ($immediatly)
169
-			$this->jquery_code_for_compile[]=$str;
170
+		if ($immediatly) {
171
+					$this->jquery_code_for_compile[]=$str;
172
+		}
170 173
 			return $str;
171 174
 	}
172 175
 
@@ -222,12 +225,14 @@  discard block
 block discarded – undo
222 225
 		if ($stopPropagation===true) {
223 226
 			$js="event.stopPropagation();\n".$js;
224 227
 		}
225
-		if (array_search($event, $this->jquery_events)===false)
226
-			$event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
227
-		else
228
-			$event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
229
-		if($immediatly)
230
-			$this->jquery_code_for_compile[]=$event;
228
+		if (array_search($event, $this->jquery_events)===false) {
229
+					$event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
230
+		} else {
231
+					$event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
232
+		}
233
+		if($immediatly) {
234
+					$this->jquery_code_for_compile[]=$event;
235
+		}
231 236
 		return $event;
232 237
 	}
233 238
 
@@ -355,7 +360,9 @@  discard block
 block discarded – undo
355 360
 	}
356 361
 
357 362
 	private function minify($input) {
358
-	if(trim($input) === "") return $input;
363
+	if(trim($input) === "") {
364
+		return $input;
365
+	}
359 366
 	return preg_replace(
360 367
 			array(
361 368
 					// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/JsUtils.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * JsUtils Class : Service to be injected
23 23
  */
24
-abstract class JsUtils{
25
-	use JsUtilsEventsTrait,JsUtilsActionsTrait,JsUtilsAjaxTrait;
24
+abstract class JsUtils {
25
+	use JsUtilsEventsTrait, JsUtilsActionsTrait, JsUtilsAjaxTrait;
26 26
 
27 27
 	protected $js;
28 28
 	protected $cdns;
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	protected $config;
52 52
 
53 53
 	protected function _setDi($di) {
54
-		if ($this->js!=null&&$di!=null)
54
+		if ($this->js!=null && $di!=null)
55 55
 			$this->js->setDi($di);
56 56
 	}
57 57
 
58 58
 	public abstract function getUrl($url);
59
-	public abstract function addViewElement($identifier,$content,&$view);
60
-	public abstract function createScriptVariable(&$view,$view_var, $output);
59
+	public abstract function addViewElement($identifier, $content, &$view);
60
+	public abstract function createScriptVariable(&$view, $view_var, $output);
61 61
 	/**
62 62
 	 * render the content of $controller::$action and set the response to the modal content
63 63
 	 * @param Controller $initialController
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	 * @param string $action a Phalcon action
66 66
 	 * @param array $params
67 67
 	 */
68
-	public abstract function forward($initialController,$controller,$action,$params);
68
+	public abstract function forward($initialController, $controller, $action, $params);
69 69
 	/**
70 70
 	 * render the content of an existing view : $viewName and set the response to the modal content
71 71
  	 * @param Controller $initialControllerInstance
72 72
 	 * @param View $viewName
73 73
 	 * @param $params The parameters to pass to the view
74 74
 	 */
75
-	public abstract function renderContent($initialControllerInstance,$viewName, $params=NULL);
75
+	public abstract function renderContent($initialControllerInstance, $viewName, $params=NULL);
76 76
 
77 77
 	/**
78 78
 	 * Collect url parts from the request dispatcher : controllerName, actionName, parameters
@@ -163,28 +163,28 @@  discard block
 block discarded – undo
163 163
 		return $this->config;
164 164
 	}
165 165
 
166
-	public function __construct($params=array(),$injected=NULL) {
167
-		$defaults=array (
166
+	public function __construct($params=array(), $injected=NULL) {
167
+		$defaults=array(
168 168
 				'driver' => 'Jquery',
169 169
 				'debug' => true
170 170
 		);
171
-		foreach ( $defaults as $key => $val ) {
171
+		foreach ($defaults as $key => $val) {
172 172
 			if (isset($params[$key])===false || $params[$key]==="") {
173 173
 				$params[$key]=$defaults[$key];
174 174
 			}
175 175
 		}
176
-		$this->js=new Jquery($params,$this);
176
+		$this->js=new Jquery($params, $this);
177 177
 
178
-		if(\array_key_exists("semantic", $params)){
178
+		if (\array_key_exists("semantic", $params)) {
179 179
 			$this->semantic(new Semantic());
180 180
 		}
181
-		$this->cdns=array ();
181
+		$this->cdns=array();
182 182
 		$this->params=$params;
183 183
 		$this->injected=$injected;
184 184
 	}
185 185
 
186
-	public function __set($property, $value){
187
-		switch ($property){
186
+	public function __set($property, $value) {
187
+		switch ($property) {
188 188
 			case "bootstrap":
189 189
 				$this->bootstrap($value);
190 190
 				break;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		}
200 200
 	}
201 201
 
202
-	public function getParam($key){
202
+	public function getParam($key) {
203 203
 		return $this->params[$key];
204 204
 	}
205 205
 
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function compile(&$view=NULL, $view_var='script_foot', $script_tags=TRUE) {
239 239
 		$bs=$this->_bootstrap;
240
-		if (isset($bs)&&isset($view)) {
240
+		if (isset($bs) && isset($view)) {
241 241
 			$bs->compileHtml($this, $view);
242 242
 		}
243 243
 		$sem=$this->_semantic;
244
-		if (isset($sem)&&isset($view)) {
244
+		if (isset($sem) && isset($view)) {
245 245
 			$sem->compileHtml($this, $view);
246 246
 		}
247 247
 		return $this->js->_compile($view, $view_var, $script_tags);
@@ -308,27 +308,27 @@  discard block
 block discarded – undo
308 308
 				$json_result=$result->result_array();
309 309
 			} elseif (is_array($result)) {
310 310
 				$json_result=$result;
311
-			} else {
311
+			}else {
312 312
 				return $this->_prep_args($result);
313 313
 			}
314
-		} else {
314
+		}else {
315 315
 			return 'null';
316 316
 		}
317 317
 		return $this->_create_json($json_result, $match_array_type);
318 318
 	}
319 319
 
320 320
 	private function _create_json($json_result, $match_array_type) {
321
-		$json=array ();
321
+		$json=array();
322 322
 		$_is_assoc=TRUE;
323
-		if (!is_array($json_result)&&empty($json_result)) {
323
+		if (!is_array($json_result) && empty($json_result)) {
324 324
 			show_error("Generate JSON Failed - Illegal key, value pair.");
325 325
 		} elseif ($match_array_type) {
326 326
 			$_is_assoc=$this->_is_associative_array($json_result);
327 327
 		}
328
-		foreach ( $json_result as $k => $v ) {
328
+		foreach ($json_result as $k => $v) {
329 329
 			if ($_is_assoc) {
330 330
 				$json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type);
331
-			} else {
331
+			}else {
332 332
 				$json[]=$this->generate_json($v, $match_array_type);
333 333
 			}
334 334
 		}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 * @return type
344 344
 	 */
345 345
 	public function _is_associative_array($arr) {
346
-		foreach ( array_keys($arr) as $key => $val ) {
346
+		foreach (array_keys($arr) as $key => $val) {
347 347
 			if ($key!==$val) {
348 348
 				return TRUE;
349 349
 			}
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 			return 'null';
363 363
 		} elseif (is_bool($result)) {
364 364
 			return ($result===TRUE) ? 'true' : 'false';
365
-		} elseif (is_string($result)||$is_key) {
366
-			return '"'.str_replace(array (
367
-					'\\',"\t","\n","\r",'"','/'
368
-			), array (
369
-					'\\\\','\\t','\\n',"\\r",'\"','\/'
365
+		} elseif (is_string($result) || $is_key) {
366
+			return '"'.str_replace(array(
367
+					'\\', "\t", "\n", "\r", '"', '/'
368
+			), array(
369
+					'\\\\', '\\t', '\\n', "\\r", '\"', '\/'
370 370
 			), $result).'"';
371 371
 		} elseif (is_scalar($result)) {
372 372
 			return $result;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
 	public function setCDNs($cdns) {
381 381
 		if (is_array($cdns)===false) {
382
-			$cdns=array (
382
+			$cdns=array(
383 383
 					$cdns
384 384
 			);
385 385
 		}
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		$hasJQueryUI=false;
392 392
 		$hasBootstrap=false;
393 393
 		$hasSemantic=false;
394
-		$result=array ();
395
-		foreach ( $this->cdns as $cdn ) {
396
-			switch(get_class($cdn)) {
394
+		$result=array();
395
+		foreach ($this->cdns as $cdn) {
396
+			switch (get_class($cdn)) {
397 397
 				case "Ajax\lib\CDNJQuery":
398 398
 					$hasJQuery=true;
399 399
 					$result[0]=$cdn;
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 					$result[1]=$cdn;
404 404
 					break;
405 405
 				case "Ajax\lib\CDNCoreCss":
406
-					if($cdn->getFramework()==="Bootstrap")
406
+					if ($cdn->getFramework()==="Bootstrap")
407 407
 						$hasBootstrap=true;
408
-					elseif($cdn->getFramework()==="Semantic")
408
+					elseif ($cdn->getFramework()==="Semantic")
409 409
 						$hasSemantic=true;
410
-					if($hasSemantic || $hasBootstrap)
410
+					if ($hasSemantic || $hasBootstrap)
411 411
 						$result[2]=$cdn;
412 412
 					break;
413 413
 			}
@@ -415,14 +415,14 @@  discard block
 block discarded – undo
415 415
 		if ($hasJQuery===false) {
416 416
 			$result[0]=new CDNJQuery("x");
417 417
 		}
418
-		if ($hasJQueryUI===false&&isset($this->_ui)) {
418
+		if ($hasJQueryUI===false && isset($this->_ui)) {
419 419
 			$result[1]=new CDNGuiGen("x", $template);
420 420
 		}
421
-		if ($hasBootstrap===false&&isset($this->_bootstrap)) {
422
-			$result[2]=new CDNCoreCss("Bootstrap","x");
421
+		if ($hasBootstrap===false && isset($this->_bootstrap)) {
422
+			$result[2]=new CDNCoreCss("Bootstrap", "x");
423 423
 		}
424
-		if ($hasSemantic===false&&isset($this->_semantic)) {
425
-			$result[2]=new CDNCoreCss("Semantic","x");
424
+		if ($hasSemantic===false && isset($this->_semantic)) {
425
+			$result[2]=new CDNCoreCss("Semantic", "x");
426 426
 		}
427 427
 		ksort($result);
428 428
 		return implode("\n", $result);
Please login to merge, or discard this patch.
Ajax/php/phalcon/JsUtils.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Phalcon\Mvc\View;
8 8
 use Phalcon\Mvc\Controller;
9 9
 
10
-class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface{
10
+class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface {
11 11
 	protected $_di;
12 12
 	public function setDi(DiInterface $di) {
13 13
 		$this->_di=$di;
@@ -18,50 +18,50 @@  discard block
 block discarded – undo
18 18
 		return $this->_di;
19 19
 	}
20 20
 
21
-	public function getUrl($url){
21
+	public function getUrl($url) {
22 22
 		return $this->_di->get("url")->get($url);
23 23
 	}
24 24
 
25
-	public function addViewElement($identifier,$content,&$view){
25
+	public function addViewElement($identifier, $content, &$view) {
26 26
 		$controls=$view->getVar("q");
27
-		if (isset($controls) === false) {
28
-			$controls=array ();
27
+		if (isset($controls)===false) {
28
+			$controls=array();
29 29
 		}
30 30
 		$controls[$identifier]=$content;
31 31
 		$view->setVar("q", $controls);
32 32
 	}
33 33
 
34
-	public function createScriptVariable(&$view,$view_var, $output){
35
-		$view->setVar($view_var,$output);
34
+	public function createScriptVariable(&$view, $view_var, $output) {
35
+		$view->setVar($view_var, $output);
36 36
 	}
37 37
 
38
-	public function forward($initialController,$controller,$action,$params=array()){
39
-		$dispatcher = $initialController->dispatcher;
38
+	public function forward($initialController, $controller, $action, $params=array()) {
39
+		$dispatcher=$initialController->dispatcher;
40 40
 		$dispatcher->setControllerName($controller);
41 41
 		$dispatcher->setActionName($action);
42 42
 		$dispatcher->dispatch();
43
-		$template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) {
43
+		$template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(), $dispatcher->getParams(), function($view) {
44 44
 			$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
45 45
 		});
46 46
 		return $template;
47 47
 	}
48 48
 
49
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
50
-		list($controller,$action)=\explode("@", $viewName);
51
-		$template=$initialControllerInstance->view->getRender($controller, $action, $params, function ($view) {
49
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
50
+		list($controller, $action)=\explode("@", $viewName);
51
+		$template=$initialControllerInstance->view->getRender($controller, $action, $params, function($view) {
52 52
 			$view->setRenderLevel(View::LEVEL_ACTION_VIEW);
53 53
 		});
54 54
 		return $template;
55 55
 	}
56 56
 
57
-	public function fromDispatcher($dispatcher){
57
+	public function fromDispatcher($dispatcher) {
58 58
 		$params=$dispatcher->getParams();
59 59
 		$action=$dispatcher->getActionName();
60 60
 		$items=array($dispatcher->getControllerName());
61
-		if(\sizeof($params)>0 || \strtolower($action)!="index" ){
61
+		if (\sizeof($params)>0 || \strtolower($action)!="index") {
62 62
 			$items[]=$action;
63
-			foreach ($params as $p){
64
-				if(\is_object($p)===false)
63
+			foreach ($params as $p) {
64
+				if (\is_object($p)===false)
65 65
 					$items[]=$p;
66 66
 			}
67 67
 		}
Please login to merge, or discard this patch.
Ajax/php/yii/JsUtils.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 
5 5
 use yii\helpers\Url;
6 6
 
7
-class JsUtils extends \Ajax\JsUtils{
8
-	public function getUrl($url){
9
-		if($url==="")
7
+class JsUtils extends \Ajax\JsUtils {
8
+	public function getUrl($url) {
9
+		if ($url==="")
10 10
 			$url="/";
11 11
 		return Url::toRoute($url);
12 12
 	}
13 13
 
14
-	public function addViewElement($identifier,$content,&$view){
14
+	public function addViewElement($identifier, $content, &$view) {
15 15
 		$params=$view->params;
16 16
 		if (\array_key_exists("q", $params)==false) {
17 17
 			$view->params["q"]=array();
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 		$view->params["q"][$identifier]=$content;
20 20
 	}
21 21
 
22
-	public function createScriptVariable(&$view,$view_var, $output){
22
+	public function createScriptVariable(&$view, $view_var, $output) {
23 23
 		$view->params[$view_var]=$output;
24 24
 	}
25 25
 
26
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){
26
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) {
27 27
 		\ob_start();
28 28
 		$ctrInfo=\yii::$app->createController($controllerName."/".$actionName);
29 29
 		$ctrInfo[0]->{$ctrInfo[1]}($params);
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 		return $result;
33 33
 	}
34 34
 
35
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
36
-		return \yii::$app->view->render($viewName,$params);
35
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
36
+		return \yii::$app->view->render($viewName, $params);
37 37
 	}
38 38
 
39
-	public function fromDispatcher($dispatcher){
39
+	public function fromDispatcher($dispatcher) {
40 40
 		$uri=new \Ajax\php\yii\URI();
41 41
 		return $uri->segment_array();
42 42
 	}
Please login to merge, or discard this patch.
Ajax/php/laravel/JsUtils.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Illuminate\Support\Facades\App;
6 6
 
7
-class JsUtils extends \Ajax\JsUtils{
8
-	public function getUrl($url){
7
+class JsUtils extends \Ajax\JsUtils {
8
+	public function getUrl($url) {
9 9
 		return \url($url);
10 10
 	}
11
-	public function addViewElement($identifier,$content,&$view){
11
+	public function addViewElement($identifier, $content, &$view) {
12 12
 		$controls=$view->__get("q");
13
-		if (isset($controls) === false) {
14
-			$controls=array ();
13
+		if (isset($controls)===false) {
14
+			$controls=array();
15 15
 		}
16 16
 		$controls[$identifier]=$content;
17 17
 		$view->__set("q", $controls);
18 18
 	}
19 19
 
20
-	public function createScriptVariable(&$view,$view_var, $output){
21
-		$view->__set($view_var,$output);
20
+	public function createScriptVariable(&$view, $view_var, $output) {
21
+		$view->__set($view_var, $output);
22 22
 	}
23 23
 
24
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){
24
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) {
25 25
 		\ob_start();
26 26
 		App::make($controllerName)->{$actionName}($params);
27 27
 		$result=\ob_get_contents();
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 		return $result;
30 30
 	}
31 31
 
32
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
33
-		return \view()->make($viewName,$params)->render();
32
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
33
+		return \view()->make($viewName, $params)->render();
34 34
 	}
35 35
 
36
-	public function fromDispatcher($dispatcher){
36
+	public function fromDispatcher($dispatcher) {
37 37
 		return $dispatcher->segments();
38 38
 	}
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/php/symfony/JsUtils.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,15 +48,15 @@
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
51
-        if ($initialControllerInstance->has('templating')) {
52
-            return $initialControllerInstance->get('templating')->render($viewName, $params);
53
-        }
51
+		if ($initialControllerInstance->has('templating')) {
52
+			return $initialControllerInstance->get('templating')->render($viewName, $params);
53
+		}
54 54
 
55
-        if (!$initialControllerInstance->has('twig')) {
56
-            throw new \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available.');
57
-        }
55
+		if (!$initialControllerInstance->has('twig')) {
56
+			throw new \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available.');
57
+		}
58 58
 
59
-        return $initialControllerInstance->get('twig')->render($viewName, $params);
59
+		return $initialControllerInstance->get('twig')->render($viewName, $params);
60 60
 	}
61 61
 
62 62
 	public function fromDispatcher($dispatcher){
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@  discard block
 block discarded – undo
6 6
 use Symfony\Component\HttpFoundation\Request;
7 7
 use Symfony\Component\HttpKernel\HttpKernelInterface;
8 8
 use Ajax\service\JString;
9
-class JsUtils extends \Ajax\JsUtils{
10
-	public function getUrl($url){
9
+class JsUtils extends \Ajax\JsUtils {
10
+	public function getUrl($url) {
11 11
 		//$request = Request::createFromGlobals();
12 12
 		$router=$this->getInjected();
13
-		if(isset($router)===true){
13
+		if (isset($router)===true) {
14 14
 			try {
15 15
 			$url=$router->generate($url);
16
-			}catch (\Exception $e){
16
+			} catch (\Exception $e) {
17 17
 				return $router->getContext()->getBaseUrl();
18 18
 			}
19 19
 		}
20 20
 		return $url;
21 21
 	}
22
-	public function addViewElement($identifier,$content,&$view){
23
-		if(\array_key_exists("q", $view)===false){
22
+	public function addViewElement($identifier, $content, &$view) {
23
+		if (\array_key_exists("q", $view)===false) {
24 24
 			$view["q"]=array();
25 25
 		}
26 26
 		$view["q"][$identifier]=$content;
27 27
 	}
28 28
 
29
-	public function createScriptVariable(&$view,$view_var, $output){
29
+	public function createScriptVariable(&$view, $view_var, $output) {
30 30
 		$view[$view_var]=$output;
31 31
 	}
32 32
 
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
 	 * @param array $params
38 38
 	 * @see \Ajax\JsUtils::forward()
39 39
 	 */
40
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){
40
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) {
41 41
 		$path=$params;
42
-		$request = $initialControllerInstance->get('request_stack')->getCurrentRequest();
43
-		$path['_forwarded'] = $request->attributes;
44
-		$path['_controller'] = $controllerName.":".$actionName;
45
-		$subRequest = $request->duplicate([], null, $path);
46
-		$response= $initialControllerInstance->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
42
+		$request=$initialControllerInstance->get('request_stack')->getCurrentRequest();
43
+		$path['_forwarded']=$request->attributes;
44
+		$path['_controller']=$controllerName.":".$actionName;
45
+		$subRequest=$request->duplicate([], null, $path);
46
+		$response=$initialControllerInstance->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
47 47
 		return $response->getContent();
48 48
 	}
49 49
 
50
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
50
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
51 51
         if ($initialControllerInstance->has('templating')) {
52 52
             return $initialControllerInstance->get('templating')->render($viewName, $params);
53 53
         }
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
         return $initialControllerInstance->get('twig')->render($viewName, $params);
60 60
 	}
61 61
 
62
-	public function fromDispatcher($dispatcher){
63
-		$request = $dispatcher->get('request_stack')->getCurrentRequest();
62
+	public function fromDispatcher($dispatcher) {
63
+		$request=$dispatcher->get('request_stack')->getCurrentRequest();
64 64
 		$uri=$request->getPathInfo();
65
-		if(JString::startswith($uri, "/")){
65
+		if (JString::startswith($uri, "/")) {
66 66
 			$uri=\substr($uri, 1);
67 67
 		}
68 68
 		return \explode("/", $uri);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 		if(isset($router)===true){
14 14
 			try {
15 15
 			$url=$router->generate($url);
16
-			}catch (\Exception $e){
16
+			} catch (\Exception $e){
17 17
 				return $router->getContext()->getBaseUrl();
18 18
 			}
19 19
 		}
Please login to merge, or discard this patch.