Completed
Push — master ( db492e...499e5d )
by Jean-Christophe
03:07
created
Ajax/Jquery.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
  * @license Apache 2 http://www.apache.org/licenses/
16 16
  **/
17 17
 class Jquery {
18
-	use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait;
18
+	use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait;
19 19
 	protected $_ui;
20 20
 	protected $_bootstrap;
21 21
 	protected $_semantic;
22
-	protected $jquery_code_for_compile=array ();
22
+	protected $jquery_code_for_compile=array();
23 23
 	protected $jsUtils;
24 24
 	protected $params;
25 25
 
26
-	protected $jquery_events=array (
27
-			"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"
26
+	protected $jquery_events=array(
27
+			"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"
28 28
 	);
29 29
 
30 30
 	public function ui($ui=NULL) {
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		return $this->_semantic;
49 49
 	}
50 50
 
51
-	public function __construct($params,$jsUtils) {
51
+	public function __construct($params, $jsUtils) {
52 52
 		$this->params=array();
53
-		foreach ( $params as $key => $val ) {
53
+		foreach ($params as $key => $val) {
54 54
 				$this->params[$key]=$params[$key];
55 55
 		}
56 56
 		$this->jsUtils=$jsUtils;
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function _output($array_js='') {
116 116
 		if (!is_array($array_js)) {
117
-			$array_js=array (
117
+			$array_js=array(
118 118
 					$array_js
119 119
 			);
120 120
 		}
121 121
 
122
-		foreach ( $array_js as $js ) {
122
+		foreach ($array_js as $js) {
123 123
 			$this->jquery_code_for_compile[]="\t$js\n";
124 124
 		}
125 125
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param string $param
132 132
 	 * @param boolean $immediatly delayed if false
133 133
 	 */
134
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
134
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
135 135
 		$element=Javascript::prep_element($element);
136 136
 		if (isset($param)) {
137 137
 			$param=Javascript::prep_value($param);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param boolean $immediatly delayed if false
151 151
 	 * @return string
152 152
 	 */
153
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
153
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
154 154
 		$to=Javascript::prep_element($to);
155 155
 		$element=Javascript::prep_element($element);
156 156
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function sortable($element, $options=array()) {
170 170
 		if (count($options)>0) {
171
-			$sort_options=array ();
172
-			foreach ( $options as $k => $v ) {
171
+			$sort_options=array();
172
+			foreach ($options as $k => $v) {
173 173
 				$sort_options[]="\n\t\t".$k.': '.$v."";
174 174
 			}
175 175
 			$sort_options=implode(",", $sort_options);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
202 202
 	 * @return string
203 203
 	 */
204
-	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
204
+	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
205 205
 		if (is_array($js)) {
206 206
 			$js=implode("\n\t\t", $js);
207 207
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			$event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
216 216
 		else
217 217
 			$event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
218
-		if($immediatly)
218
+		if ($immediatly)
219 219
 			$this->jquery_code_for_compile[]=$event;
220 220
 		return $event;
221 221
 	}
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
 		$script.='});';
248 248
 
249 249
 		$this->jquery_code_for_compile=array();
250
-		if($this->params["debug"]===false){
250
+		if ($this->params["debug"]===false) {
251 251
 			$script=$this->minify($script);
252 252
 		}
253 253
 		$output=($script_tags===FALSE) ? $script : $this->inline($script);
254 254
 
255
-		if ($view!==NULL){
256
-			$this->jsUtils->createScriptVariable($view,$view_var, $output);
255
+		if ($view!==NULL) {
256
+			$this->jsUtils->createScriptVariable($view, $view_var, $output);
257 257
 		}
258 258
 		return $output;
259 259
 	}
260 260
 
261
-	private function _compileLibrary($library){
261
+	private function _compileLibrary($library) {
262 262
 		if ($library!=NULL) {
263 263
 			if ($library->isAutoCompile()) {
264 264
 				$library->compile(true);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 * @return void
277 277
 	 */
278 278
 	public function _clear_compile() {
279
-		$this->jquery_code_for_compile=array ();
279
+		$this->jquery_code_for_compile=array();
280 280
 	}
281 281
 
282 282
 	/**
@@ -285,18 +285,18 @@  discard block
 block discarded – undo
285 285
 	 */
286 286
 	public function _document_ready($js) {
287 287
 		if (!is_array($js)) {
288
-			$js=array (
288
+			$js=array(
289 289
 					$js
290 290
 			);
291 291
 		}
292 292
 
293
-		foreach ( $js as $script ) {
293
+		foreach ($js as $script) {
294 294
 			$this->jquery_code_for_compile[]=$script;
295 295
 		}
296 296
 	}
297 297
 
298 298
 	private function minify($input) {
299
-	if(trim($input) === "") return $input;
299
+	if (trim($input)==="") return $input;
300 300
 	return preg_replace(
301 301
 			array(
302 302
 					// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/checkbox/AbstractCheckbox.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Ajax\JsUtils;
8 8
 
9 9
 abstract class AbstractCheckbox extends HtmlSemDoubleElement {
10
-	protected $_params=array ();
10
+	protected $_params=array();
11 11
 
12 12
 	public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") {
13 13
 		parent::__construct("ck-".$identifier, "div", "ui ".$type);
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 			$this->setLabel($label);
19 19
 	}
20 20
 
21
-	public function setChecked($value=true){
22
-		if($value===true){
21
+	public function setChecked($value=true) {
22
+		if ($value===true) {
23 23
 			$this->getField()->setProperty("checked", "checked");
24
-		}else{
24
+		} else {
25 25
 			$this->getField()->removeProperty("checked");
26 26
 		}
27 27
 		return $this;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox
84 84
 	 */
85 85
 	public function attachEvent($selector, $action=NULL) {
86
-		if (isset($action)||\is_numeric($action)===true) {
86
+		if (isset($action) || \is_numeric($action)===true) {
87 87
 			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");';
88 88
 		} else {
89 89
 			$js='$("#%identifier%").checkbox("attach events", "'.$selector.'");';
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function attachEvents($events=array()) {
101 101
 		if (\is_array($events)) {
102
-			foreach ( $events as $action => $selector ) {
102
+			foreach ($events as $action => $selector) {
103 103
 				$this->attachEvent($selector, $action);
104 104
 			}
105 105
 		}
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 		return $this->addToProperty("class", "fitted");
111 111
 	}
112 112
 
113
-	public function setOnChecked($jsCode){
113
+	public function setOnChecked($jsCode) {
114 114
 		$this->_params["onChecked"]=$jsCode;
115 115
 	}
116 116
 
117
-	public function setOnUnchecked($jsCode){
117
+	public function setOnUnchecked($jsCode) {
118 118
 		$this->_params["onUnchecked"]=$jsCode;
119 119
 	}
120 120
 
121 121
 	public function run(JsUtils $js) {
122
-			$this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params);
122
+			$this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params);
123 123
 			return parent::run($js);
124 124
 	}
125 125
 }
126 126
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlLabel.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 	public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") {
15 15
 		parent::__construct($identifier, $tagName, "ui label");
16 16
 		$this->content=$caption;
17
-		if (isset($icon))
18
-			$this->addIcon($icon);
17
+		if (isset($icon)) {
18
+					$this->addIcon($icon);
19
+		}
19 20
 	}
20 21
 
21 22
 	/**
@@ -24,10 +25,11 @@  discard block
 block discarded – undo
24 25
 	 * @return \Ajax\semantic\html\elements\HtmlLabel
25 26
 	 */
26 27
 	public function setPointing($value=Direction::NONE) {
27
-		if($value==="left" || $value==="right")
28
-			return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
29
-		else
30
-			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
28
+		if($value==="left" || $value==="right") {
29
+					return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
30
+		} else {
31
+					return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
32
+		}
31 33
 	}
32 34
 
33 35
 	/**
@@ -121,10 +123,11 @@  discard block
 block discarded – undo
121 123
 	}
122 124
 
123 125
 	public function setAttached($side=Side::TOP,$direction=Direction::NONE){
124
-		if($direction!==Direction::NONE)
125
-			return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
126
-		else
127
-			return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
126
+		if($direction!==Direction::NONE) {
127
+					return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
128
+		} else {
129
+					return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
130
+		}
128 131
 	}
129 132
 
130 133
 	public static function ribbon($identifier, $caption) {
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlGrid.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	public function asSegment() {
39
-		return $this->addToPropertyCtrl("class", "segment", array ("segment" ));
39
+		return $this->addToPropertyCtrl("class", "segment", array("segment"));
40 40
 	}
41 41
 
42 42
 	public function asContainer() {
43
-		return $this->addToPropertyCtrl("class", "container", array ("container" ));
43
+		return $this->addToPropertyCtrl("class", "container", array("container"));
44 44
 	}
45 45
 
46 46
 	/**
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param int $wide
49 49
 	 */
50 50
 	public function setWide($wide) {
51
-		if(isset(Wide::getConstants()["W" . $wide])){
52
-			$wide=Wide::getConstants()["W" . $wide];
51
+		if (isset(Wide::getConstants()["W".$wide])) {
52
+			$wide=Wide::getConstants()["W".$wide];
53 53
 			$this->addToPropertyCtrl("class", $wide, Wide::getConstants());
54
-			return $this->addToPropertyCtrl("class", "column", array ("column" ));
54
+			return $this->addToPropertyCtrl("class", "column", array("column"));
55 55
 		}
56 56
 		return $this;
57 57
 	}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 * @return mixed
72 72
 	 */
73 73
 	public function addRow($colsCount=NULL) {
74
-		$rowCount=$this->rowCount() + 1;
74
+		$rowCount=$this->rowCount()+1;
75 75
 		$this->setRowsCount($rowCount, $colsCount, true);
76
-		return $this->content[$rowCount - 1];
76
+		return $this->content[$rowCount-1];
77 77
 	}
78 78
 
79 79
 	/**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	 * @return mixed|\Ajax\semantic\html\collections\HtmlGrid
83 83
 	 */
84 84
 	public function addCol($width=NULL) {
85
-		$colCount=$this->colCount() + 1;
85
+		$colCount=$this->colCount()+1;
86 86
 		$this->setColsCount($colCount, true, $width);
87 87
 		if ($this->hasOnlyCols($this->count()))
88
-			return $this->content[$colCount - 1];
88
+			return $this->content[$colCount-1];
89 89
 		return $this;
90 90
 	}
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
96 96
 	 */
97 97
 	public function addCols($sizes=array()) {
98
-		foreach ( $sizes as $size ) {
98
+		foreach ($sizes as $size) {
99 99
 			$this->addCol($size);
100 100
 		}
101 101
 		return $this;
@@ -109,19 +109,19 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) {
111 111
 		$count=$this->count();
112
-		if ($rowsCount < 2 && $force === false) {
113
-			for($i=$count; $i < $colsCount; $i++) {
114
-				$this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i));
112
+		if ($rowsCount<2 && $force===false) {
113
+			for ($i=$count; $i<$colsCount; $i++) {
114
+				$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
115 115
 			}
116 116
 		} else {
117 117
 			if ($this->hasOnlyCols($count)) {
118 118
 				$tmpContent=$this->content;
119 119
 				$item=$this->addItem($colsCount);
120 120
 				$item->setContent($tmpContent);
121
-				$this->content=array ();
121
+				$this->content=array();
122 122
 				$count=1;
123 123
 			}
124
-			for($i=$count; $i < $rowsCount; $i++) {
124
+			for ($i=$count; $i<$rowsCount; $i++) {
125 125
 				$this->addItem($colsCount);
126 126
 			}
127 127
 		}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	protected function hasOnlyCols($count) {
132
-		return $count > 0 && $this->content[0] instanceof HtmlGridCol;
132
+		return $count>0 && $this->content[0] instanceof HtmlGridCol;
133 133
 	}
134 134
 
135 135
 	/**
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 		if (isset($width)===false) {
144 144
 			$this->setWide($numCols);
145 145
 		}
146
-		if ($toCreate === true) {
146
+		if ($toCreate===true) {
147 147
 			$count=$this->count();
148
-			if ($count == 0 || $this->hasOnlyCols($count)) {
149
-				for($i=$count; $i < $numCols; $i++) {
150
-					$this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width));
148
+			if ($count==0 || $this->hasOnlyCols($count)) {
149
+				for ($i=$count; $i<$numCols; $i++) {
150
+					$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width));
151 151
 				}
152 152
 			} else {
153
-				for($i=0; $i < $count; $i++) {
153
+				for ($i=0; $i<$count; $i++) {
154 154
 					$this->getItem($i)->setColsCount($numCols);
155 155
 				}
156 156
 			}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		$count=$this->count();
187 187
 		if ($this->hasOnlyCols($count))
188 188
 			return $count;
189
-		if ($count > 0)
189
+		if ($count>0)
190 190
 			return $this->getItem(0)->count();
191 191
 		return 0;
192 192
 	}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
199 199
 	 */
200 200
 	public function getCell($row, $col) {
201
-		if ($row < 2 && $this->hasOnlyCols($this->count()))
201
+		if ($row<2 && $this->hasOnlyCols($this->count()))
202 202
 			return $this->getItem($col);
203 203
 		$row=$this->getItem($row);
204 204
 		if (isset($row)) {
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
214 214
 	 */
215 215
 	public function setDivided($vertically=false) {
216
-		$value=($vertically === true) ? "vertically divided" : "divided";
217
-		return $this->addToPropertyCtrl("class", $value, array ("divided" ));
216
+		$value=($vertically===true) ? "vertically divided" : "divided";
217
+		return $this->addToPropertyCtrl("class", $value, array("divided"));
218 218
 	}
219 219
 
220 220
 	/**
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
224 224
 	 */
225 225
 	public function setCelled($internally=false) {
226
-		$value=($internally === true) ? "internally celled" : "celled";
227
-		return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" ));
226
+		$value=($internally===true) ? "internally celled" : "celled";
227
+		return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled"));
228 228
 	}
229 229
 
230 230
 	/**
231 231
 	 * A grid can have its columns centered
232 232
 	 */
233 233
 	public function setCentered() {
234
-		return $this->addToPropertyCtrl("class", "centered", array ("centered" ));
234
+		return $this->addToPropertyCtrl("class", "centered", array("centered"));
235 235
 	}
236 236
 
237 237
 	/**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function setPadded($value=NULL) {
251 251
 		if (isset($value))
252
-			$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
252
+			$this->addToPropertyCtrl("class", $value, array("vertically", "horizontally"));
253 253
 		return $this->addToProperty("class", "padded");
254 254
 	}
255 255
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
260 260
 	 */
261 261
 	public function setRelaxed($very=false) {
262
-		$value=($very === true) ? "very relaxed" : "relaxed";
263
-		return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" ));
262
+		$value=($very===true) ? "very relaxed" : "relaxed";
263
+		return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed"));
264 264
 	}
265 265
 
266 266
 	public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) {
267
-		return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned"));
267
+		return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned"));
268 268
 	}
269 269
 
270 270
 	/**
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
275 275
 	 */
276 276
 	protected function createItem($value) {
277
-		if ($this->_createCols === false)
277
+		if ($this->_createCols===false)
278 278
 			$value=null;
279
-		$item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows);
279
+		$item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows);
280 280
 		return $item;
281 281
 	}
282 282
 
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function setValues($values, $force=true) {
288 288
 		$count=$this->count();
289
-		if ($this->_createCols === false || $force === true) {
290
-			for($i=$count; $i < \sizeof($values); $i++) {
289
+		if ($this->_createCols===false || $force===true) {
290
+			for ($i=$count; $i<\sizeof($values); $i++) {
291 291
 				$colSize=\sizeof($values[$i]);
292
-				$this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows));
292
+				$this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows));
293 293
 			}
294 294
 		}
295
-		$count=\min(array ($this->count(),\sizeof($values) ));
296
-		for($i=0; $i < $count; $i++) {
297
-			$this->content[$i]->setValues($values[$i], $this->_createCols === false);
295
+		$count=\min(array($this->count(), \sizeof($values)));
296
+		for ($i=0; $i<$count; $i++) {
297
+			$this->content[$i]->setValues($values[$i], $this->_createCols===false);
298 298
 		}
299 299
 	}
300 300
 
Please login to merge, or discard this patch.