Completed
Push — master ( 8b49e3...3c0bc3 )
by Jean-Christophe
03:22
created
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
 	 * @return \Ajax\semantic\html\collections\HtmlMenu
40 40
 	 */
41 41
 	public function setType($type="") {
42
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
42
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
43 43
 	}
44 44
 
45 45
 	public function setActiveItem($index) {
46 46
 		$item=$this->getItem($index);
47
-		if ($item !== null) {
47
+		if ($item!==null) {
48 48
 			$item->addToProperty("class", "active");
49 49
 		}
50 50
 		return $this;
51 51
 	}
52 52
 
53 53
 	private function getItemToInsert($item) {
54
-		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton ) {
55
-			$itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item);
54
+		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton) {
55
+			$itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item);
56 56
 			$item=$itemO;
57 57
 		}
58 58
 		return $item;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 	private function afterInsert($item) {
62 62
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
63
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
63
+			$item->addToPropertyCtrl("class", "item", array("item"));
64 64
 		else {
65 65
 			$this->setSecondary();
66 66
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function addItem($item) {
77 77
 		$number=$item;
78 78
 		$item=parent::addItem($this->getItemToInsert($item));
79
-		if(\is_int($number))
79
+		if (\is_int($number))
80 80
 			$item->setProperty("data-page", $number);
81 81
 		return $this->afterInsert($item);
82 82
 	}
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 
95 95
 	public function generateMenuAsItem($menu, $header=null) {
96 96
 		$count=$this->count();
97
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
97
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
98 98
 		if (isset($header)) {
99
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
99
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
100 100
 			$headerItem->setContent($header);
101 101
 			$item->addContent($headerItem);
102 102
 			$this->_itemHeader=$headerItem;
103 103
 		}
104
-		if(\is_array($menu)){
105
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
104
+		if (\is_array($menu)) {
105
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
106 106
 		}
107 107
 		$menu->setClass("menu");
108 108
 		$item->addContent($menu);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
118 118
 		$value->addContent(new HtmlIcon("", "dropdown"));
119 119
 		$value=$this->addItem($value);
120
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
120
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
121 121
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
122 122
 		$this->wrap("", $popup);
123 123
 		return $popup;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	public function addDropdownAsItem($value, $items=NULL) {
127 127
 		$dd=$value;
128 128
 		if (\is_string($value)) {
129
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
129
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
130 130
 		}
131 131
 		$this->addItem($dd);
132 132
 		return $dd;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
140 140
 	 */
141 141
 	protected function createItem($value) {
142
-		$itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),"");
142
+		$itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), "");
143 143
 		$itemO->setTagName("a");
144 144
 		$itemO->setContent($value);
145 145
 		return $itemO;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	public function setSecondary($value=true) {
153
-		if($value)
153
+		if ($value)
154 154
 			$this->addToProperty("class", "secondary");
155 155
 		else
156 156
 			$this->removePropertyValue("class", "secondary");
@@ -158,28 +158,28 @@  discard block
 block discarded – undo
158 158
 	}
159 159
 
160 160
 	public function setVertical() {
161
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
161
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
162 162
 	}
163 163
 
164 164
 	public function setPosition($value="right") {
165
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
165
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
166 166
 	}
167 167
 
168 168
 	public function setPointing($value=Direction::NONE) {
169
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
169
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
170 170
 	}
171 171
 
172 172
 	public function asTab($vertical=false) {
173
-		$this->apply(function (HtmlDoubleElement &$item) {
173
+		$this->apply(function(HtmlDoubleElement&$item) {
174 174
 			$item->setTagName("a");
175 175
 		});
176
-		if ($vertical === true)
176
+		if ($vertical===true)
177 177
 			$this->setVertical();
178 178
 		return $this->addToProperty("class", "tabular");
179 179
 	}
180 180
 
181 181
 	public function asPagination() {
182
-		$this->apply(function (HtmlDoubleElement &$item) {
182
+		$this->apply(function(HtmlDoubleElement&$item) {
183 183
 			$item->setTagName("a");
184 184
 		});
185 185
 		return $this->addToProperty("class", "pagination");
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function setWidth($width) {
218 218
 		if (\is_int($width)) {
219
-			$width=Wide::getConstants()["W" . $width];
219
+			$width=Wide::getConstants()["W".$width];
220 220
 		}
221 221
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
222
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
222
+		return $this->addToPropertyCtrl("class", "item", array("item"));
223 223
 	}
224 224
 
225 225
 	public function addImage($identifier, $src="", $alt="") {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 		return $this->_itemHeader;
235 235
 	}
236 236
 
237
-	public function run(JsUtils $js){
238
-		$result= parent::run($js);
237
+	public function run(JsUtils $js) {
238
+		$result=parent::run($js);
239 239
 		return $result->setItemSelector(".item");
240 240
 	}
241 241
 }
242 242
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -16,121 +16,121 @@
 block discarded – undo
16 16
  * @property InstanceViewer $_instanceViewer
17 17
  */
18 18
 
19
-trait FieldAsTrait{
19
+trait FieldAsTrait {
20 20
 
21 21
 	abstract protected function _getFieldIdentifier($prefix);
22
-	abstract public function setValueFunction($index,$callback);
22
+	abstract public function setValueFunction($index, $callback);
23 23
 
24
-	private function _getLabelField($caption,$icon=NULL){
25
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
24
+	private function _getLabelField($caption, $icon=NULL) {
25
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
26 26
 		return $label;
27 27
 	}
28 28
 
29
-	protected function _addRules($element,&$attributes){}
29
+	protected function _addRules($element, &$attributes) {}
30 30
 
31
-	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){
32
-		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){
31
+	protected function _fieldAs($elementCallback, $index, $attributes=NULL, $prefix=null) {
32
+		$this->setValueFunction($index, function($value) use ($index, &$attributes, $elementCallback, $prefix){
33 33
 			$name=$this->_instanceViewer->getCaption($index)."[]";
34
-			if(isset($attributes["name"])){
34
+			if (isset($attributes["name"])) {
35 35
 				$name=$attributes["name"];
36 36
 			}
37
-			$element=$elementCallback($this->_getFieldIdentifier($prefix),$name,$value,"");
38
-			if(\is_array($attributes))
39
-				$this->_applyAttributes($element, $attributes,$index);
37
+			$element=$elementCallback($this->_getFieldIdentifier($prefix), $name, $value, "");
38
+			if (\is_array($attributes))
39
+				$this->_applyAttributes($element, $attributes, $index);
40 40
 			return $element;
41 41
 		});
42 42
 			return $this;
43 43
 	}
44 44
 
45 45
 
46
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
47
-		$this->setValueFunction($index,function($value) use($label,$attributes){
48
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
46
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
47
+		$this->setValueFunction($index, function($value) use($label, $attributes){
48
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
49 49
 			return $pb;
50 50
 		});
51 51
 			return $this;
52 52
 	}
53 53
 
54
-	public function fieldAsRating($index,$max=5, $icon=""){
55
-		$this->setValueFunction($index,function($value) use($max,$icon){
56
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
54
+	public function fieldAsRating($index, $max=5, $icon="") {
55
+		$this->setValueFunction($index, function($value) use($max, $icon){
56
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
57 57
 			return $rating;
58 58
 		});
59 59
 			return $this;
60 60
 	}
61 61
 
62
-	public function fieldAsLabel($index,$icon=NULL){
63
-		$this->setValueFunction($index,function($caption) use($icon){
64
-			$lbl=$this->_getLabelField($caption,$icon);
62
+	public function fieldAsLabel($index, $icon=NULL) {
63
+		$this->setValueFunction($index, function($caption) use($icon){
64
+			$lbl=$this->_getLabelField($caption, $icon);
65 65
 			return $lbl;
66 66
 		});
67 67
 			return $this;
68 68
 	}
69 69
 
70
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
71
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
72
-			$header=new HtmlHeader($id,$niveau,$value);
73
-			if(isset($icon))
70
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
71
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
72
+			$header=new HtmlHeader($id, $niveau, $value);
73
+			if (isset($icon))
74 74
 				$header->asIcon($icon, $value);
75 75
 			return $header;
76
-		}, $index,$attributes,"header");
76
+		}, $index, $attributes, "header");
77 77
 	}
78 78
 
79 79
 
80
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
81
-		$this->setValueFunction($index,function($img) use($size,$circular){
82
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
80
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
81
+		$this->setValueFunction($index, function($img) use($size, $circular){
82
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
83 83
 			return $image;
84 84
 		});
85 85
 			return $this;
86 86
 	}
87 87
 
88
-	public function fieldAsAvatar($index,$attributes=NULL){
89
-		return $this->_fieldAs(function($id,$name,$value){
90
-			$img=new HtmlImage($id,$value);
88
+	public function fieldAsAvatar($index, $attributes=NULL) {
89
+		return $this->_fieldAs(function($id, $name, $value) {
90
+			$img=new HtmlImage($id, $value);
91 91
 			$img->asAvatar();
92 92
 			return $img;
93
-		}, $index,$attributes,"avatar");
93
+		}, $index, $attributes, "avatar");
94 94
 	}
95 95
 
96
-	public function fieldAsRadio($index,$attributes=NULL){
97
-		return $this->_fieldAs(function($id,$name,$value){
98
-			$input= new HtmlRadio($id,$name,$value,$value);
96
+	public function fieldAsRadio($index, $attributes=NULL) {
97
+		return $this->_fieldAs(function($id, $name, $value) {
98
+			$input=new HtmlRadio($id, $name, $value, $value);
99 99
 			return $input;
100
-		}, $index,$attributes,"radio");
100
+		}, $index, $attributes, "radio");
101 101
 	}
102 102
 
103
-	public function fieldAsInput($index,$attributes=NULL){
104
-		return $this->_fieldAs(function($id,$name,$value){
105
-			$input= new HtmlInput($id,"text",$value);
103
+	public function fieldAsInput($index, $attributes=NULL) {
104
+		return $this->_fieldAs(function($id, $name, $value) {
105
+			$input=new HtmlInput($id, "text", $value);
106 106
 			//TODO check getField
107 107
 			$input->setName($name);
108 108
 			return $input;
109
-		}, $index,$attributes,"input");
109
+		}, $index, $attributes, "input");
110 110
 	}
111 111
 
112
-	public function fieldAsHidden($index,$attributes=NULL){
113
-		if(\is_array($attributes)===false){
112
+	public function fieldAsHidden($index, $attributes=NULL) {
113
+		if (\is_array($attributes)===false) {
114 114
 			$attributes=[];
115 115
 		}
116 116
 		$attributes["imputType"]="hidden";
117
-		return $this->fieldAsInput($index,$attributes);
117
+		return $this->fieldAsInput($index, $attributes);
118 118
 	}
119 119
 
120
-	public function fieldAsCheckbox($index,$attributes=NULL){
121
-		return $this->_fieldAs(function($id,$name,$value){
122
-			$input=new HtmlCheckbox($id,"",$this->_instanceViewer->getIdentifier());
120
+	public function fieldAsCheckbox($index, $attributes=NULL) {
121
+		return $this->_fieldAs(function($id, $name, $value) {
122
+			$input=new HtmlCheckbox($id, "", $this->_instanceViewer->getIdentifier());
123 123
 			$input->setChecked(JString::isBooleanTrue($value));
124 124
 			$input->getField()->setProperty("name", $name);
125 125
 			return $input;
126
-		}, $index,$attributes,"ck");
126
+		}, $index, $attributes, "ck");
127 127
 	}
128 128
 
129
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
130
-		return $this->_fieldAs(function($id,$name,$value) use($elements,$multiple){
131
-			$dd=new HtmlDropdown($id,$value,$elements);
132
-			$dd->asSelect($name,$multiple);
129
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
130
+		return $this->_fieldAs(function($id, $name, $value) use($elements, $multiple){
131
+			$dd=new HtmlDropdown($id, $value, $elements);
132
+			$dd->asSelect($name, $multiple);
133 133
 			return $dd;
134
-		}, $index,$attributes,"dd");
134
+		}, $index, $attributes, "dd");
135 135
 	}
136 136
 }
137 137
\ No newline at end of file
Please login to merge, or discard this patch.
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/collections/form/HtmlForm.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class HtmlForm extends HtmlSemCollection {
22 22
 
23
-	use FieldsTrait,FormTrait;
23
+	use FieldsTrait, FormTrait;
24 24
 	/**
25 25
 	 * @var array
26 26
 	 */
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct($identifier, $elements=array()) {
35 35
 		parent::__construct($identifier, "form", "ui form");
36
-		$this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ];
36
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
37 37
 		$this->setProperty("name", $this->identifier);
38
-		$this->_fields=array ();
38
+		$this->_fields=array();
39 39
 		$this->_validationParams=[];
40 40
 		$this->addItems($elements);
41 41
 	}
42 42
 
43
-	protected function getForm(){
43
+	protected function getForm() {
44 44
 		return $this;
45 45
 	}
46 46
 
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 	 * @param string $caption
62 62
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
63 63
 	 */
64
-	public function addDivider($caption=NULL){
65
-		return $this->addContent(new HtmlDivider("",$caption));
64
+	public function addDivider($caption=NULL) {
65
+		return $this->addContent(new HtmlDivider("", $caption));
66 66
 	}
67 67
 
68 68
 	public function addFields($fields=NULL, $label=NULL) {
69 69
 		if (isset($fields)) {
70 70
 			if (!$fields instanceof HtmlFormFields) {
71
-				if (\is_array($fields) === false) {
71
+				if (\is_array($fields)===false) {
72 72
 					$fields=\func_get_args();
73 73
 					$end=\end($fields);
74 74
 					if (\is_string($end)) {
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 						$label=NULL;
79 79
 				}
80 80
 				$this->_fields=\array_merge($this->_fields, $fields);
81
-				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
81
+				$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
82 82
 			}
83 83
 			if (isset($label))
84 84
 				$fields=new HtmlFormField("", $fields, $label);
85 85
 		} else {
86
-			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
86
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count());
87 87
 		}
88 88
 		$this->addItem($fields);
89 89
 		return $fields;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	public function addItem($item) {
93 93
 		$item=parent::addItem($item);
94
-		if (\is_subclass_of($item, HtmlFormField::class) === true) {
94
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
95 95
 			$this->_fields[]=$item;
96 96
 		}
97 97
 		return $item;
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 		return $this->addItem($message);
144 144
 	}
145 145
 
146
-	private function addCompoValidation($js,$compo,$field){
146
+	private function addCompoValidation($js, $compo, $field) {
147 147
 		$validation=$field->getValidation();
148
-		if(isset($validation)){
149
-			if(isset($compo)===false){
148
+		if (isset($validation)) {
149
+			if (isset($compo)===false) {
150 150
 				$compo=$js->semantic()->form("#".$this->identifier);
151 151
 			}
152 152
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
@@ -155,38 +155,38 @@  discard block
 block discarded – undo
155 155
 		return $compo;
156 156
 	}
157 157
 
158
-	public function compile(JsUtils $js=NULL,&$view=NULL){
159
-		if(\sizeof($this->_validationParams)>0)
158
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
159
+		if (\sizeof($this->_validationParams)>0)
160 160
 			$this->setProperty("novalidate", "");
161
-		return parent::compile($js,$view);
161
+		return parent::compile($js, $view);
162 162
 	}
163 163
 
164 164
 	public function run(JsUtils $js) {
165 165
 		$compo=NULL;
166
-		foreach ($this->_fields as $field){
167
-			if($field instanceof HtmlFormField)
166
+		foreach ($this->_fields as $field) {
167
+			if ($field instanceof HtmlFormField)
168 168
 				$compo=$this->addCompoValidation($js, $compo, $field);
169 169
 		}
170
-		foreach ($this->content as $field){
171
-			if($field instanceof HtmlFormFields){
170
+		foreach ($this->content as $field) {
171
+			if ($field instanceof HtmlFormFields) {
172 172
 				$items=$field->getItems();
173
-				foreach ($items as $_field){
174
-					if($_field instanceof HtmlFormField)
173
+				foreach ($items as $_field) {
174
+					if ($_field instanceof HtmlFormField)
175 175
 						$compo=$this->addCompoValidation($js, $compo, $_field);
176 176
 				}
177 177
 			}
178 178
 		}
179
-		if(isset($compo)===false){
179
+		if (isset($compo)===false) {
180 180
 			return parent::run($js);
181 181
 		}
182
-		$this->_runValidationParams($compo,$js);
182
+		$this->_runValidationParams($compo, $js);
183 183
 		return $this->_bsComponent;
184 184
 	}
185 185
 
186
-	private function _runValidationParams(&$compo,JsUtils $js=NULL){
187
-		if(isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall){
186
+	private function _runValidationParams(&$compo, JsUtils $js=NULL) {
187
+		if (isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall) {
188 188
 			$compilation=$this->_validationParams["_ajaxSubmit"]->compile($js);
189
-			$compilation=str_ireplace("\"","%quote%", $compilation);
189
+			$compilation=str_ireplace("\"", "%quote%", $compilation);
190 190
 			$this->onSuccess($compilation);
191 191
 			unset($this->_validationParams["_ajaxSubmit"]);
192 192
 		}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		$this->addEventsOnRun($js);
196 196
 	}
197 197
 
198
-	public function addValidationParam($paramName,$paramValue){
198
+	public function addValidationParam($paramName, $paramValue) {
199 199
 		$this->_validationParams[$paramName]=$paramValue;
200 200
 		return $this;
201 201
 	}
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlEventsTrait.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
  * @property SimpleExtComponent $_bsComponent
11 11
  * @property string identifier
12 12
  */
13
-trait BaseHtmlEventsTrait{
13
+trait BaseHtmlEventsTrait {
14 14
 
15
-	protected $_events=array ();
15
+	protected $_events=array();
16 16
 
17 17
 	public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
18
-		if ($stopPropagation === true) {
19
-			$jsCode="event.stopPropagation();" . $jsCode;
18
+		if ($stopPropagation===true) {
19
+			$jsCode="event.stopPropagation();".$jsCode;
20 20
 		}
21
-		if ($preventDefault === true) {
22
-			$jsCode="event.preventDefault();" . $jsCode;
21
+		if ($preventDefault===true) {
22
+			$jsCode="event.preventDefault();".$jsCode;
23 23
 		}
24 24
 		return $this->_addEvent($event, $jsCode);
25 25
 	}
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			if (is_array($this->_events[$event])) {
30 30
 				$this->_events[$event][]=$jsCode;
31 31
 			} else {
32
-				$this->_events[$event]=array ($this->_events[$event],$jsCode );
32
+				$this->_events[$event]=array($this->_events[$event], $jsCode);
33 33
 			}
34 34
 		} else {
35 35
 			$this->_events[$event]=$jsCode;
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 		return $this->onClick($jsCode);
50 50
 	}
51 51
 
52
-	public function onCreate($jsCode){
53
-		if(isset($this->_events["_create"])){
52
+	public function onCreate($jsCode) {
53
+		if (isset($this->_events["_create"])) {
54 54
 			$this->_events["_create"][]=$jsCode;
55
-		}else{
55
+		} else {
56 56
 			$this->_events["_create"]=[$jsCode];
57 57
 		}
58 58
 		return $this;
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 	public function addEventsOnRun(JsUtils $js=NULL) {
62 62
 		$this->_eventsOnCreate($js);
63 63
 		if (isset($this->_bsComponent)) {
64
-			foreach ( $this->_events as $event => $jsCode ) {
64
+			foreach ($this->_events as $event => $jsCode) {
65 65
 				$code=$jsCode;
66 66
 				if (is_array($jsCode)) {
67 67
 					$code="";
68
-					foreach ( $jsCode as $jsC ) {
68
+					foreach ($jsCode as $jsC) {
69 69
 						if ($jsC instanceof AjaxCall) {
70
-							$code.="\n" . $jsC->compile($js);
70
+							$code.="\n".$jsC->compile($js);
71 71
 						} else {
72
-							$code.="\n" . $jsC;
72
+							$code.="\n".$jsC;
73 73
 						}
74 74
 					}
75 75
 				} elseif ($jsCode instanceof AjaxCall) {
@@ -77,24 +77,24 @@  discard block
 block discarded – undo
77 77
 				}
78 78
 				$this->_bsComponent->addEvent($event, $code);
79 79
 			}
80
-			$this->_events=array ();
80
+			$this->_events=array();
81 81
 		}
82 82
 	}
83 83
 
84
-	protected function _eventsOnCreate(JsUtils $js=NULL){
85
-		if(isset($this->_events["_create"])){
84
+	protected function _eventsOnCreate(JsUtils $js=NULL) {
85
+		if (isset($this->_events["_create"])) {
86 86
 			$create=$this->_events["_create"];
87
-			if(\is_array($create)){
87
+			if (\is_array($create)) {
88 88
 				$create=\implode("", $create);
89 89
 			}
90
-			if(isset($js) && $create!=="")
91
-				$js->exec($create,true);
90
+			if (isset($js) && $create!=="")
91
+				$js->exec($create, true);
92 92
 			unset($this->_events["_create"]);
93 93
 		}
94 94
 	}
95 95
 
96 96
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
97
-		$params=array ("url" => $url,"responseElement" => $responseElement );
97
+		$params=array("url" => $url, "responseElement" => $responseElement);
98 98
 		$params=array_merge($params, $parameters);
99 99
 		$this->_addEvent($event, new AjaxCall($operation, $params));
100 100
 		return $this;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	public function jsDoJquery($jqueryCall, $param="") {
130
-		return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");";
130
+		return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");";
131 131
 	}
132 132
 
133 133
 	public function executeOnRun($jsCode) {
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -16,163 +16,163 @@  discard block
 block discarded – undo
16 16
 
17 17
 	public static $index=0;
18 18
 
19
-	public function __construct($identifier,$instance=NULL,$captions=NULL){
19
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
20 20
 		$this->widgetIdentifier=$identifier;
21 21
 		$this->values=[];
22 22
 		$this->afterCompile=[];
23
-		if(isset($instance))
23
+		if (isset($instance))
24 24
 			$this->setInstance($instance);
25 25
 		$this->setCaptions($captions);
26 26
 		$this->captionCallback=NULL;
27 27
 	}
28 28
 
29
-	public function getValues(){
29
+	public function getValues() {
30 30
 		$values=[];
31 31
 		$index=0;
32 32
 		$count=$this->count();
33
-		while($index<$count){
33
+		while ($index<$count) {
34 34
 			$values[]=$this->getValue($index++);
35 35
 		}
36 36
 		return $values;
37 37
 	}
38 38
 
39
-	public function getIdentifier(){
39
+	public function getIdentifier() {
40 40
 		$value=self::$index;
41
-		if(isset($this->values["identifier"]))
42
-			$value=$this->values["identifier"](self::$index,$this->instance);
41
+		if (isset($this->values["identifier"]))
42
+			$value=$this->values["identifier"](self::$index, $this->instance);
43 43
 		return $value;
44 44
 	}
45 45
 
46
-	public function getValue($index){
46
+	public function getValue($index) {
47 47
 		$property=$this->properties[$index];
48 48
 		return $this->_getValue($property, $index);
49 49
 	}
50 50
 
51
-	protected function _beforeAddProperty($index,&$field){
51
+	protected function _beforeAddProperty($index, &$field) {
52 52
 
53 53
 	}
54 54
 
55
-	protected function _getDefaultValue($name,$value,$index){
55
+	protected function _getDefaultValue($name, $value, $index) {
56 56
 		return $value;
57 57
 	}
58 58
 
59
-	protected function _getValue($property,$index){
60
-		if($property instanceof \ReflectionProperty){
59
+	protected function _getValue($property, $index) {
60
+		if ($property instanceof \ReflectionProperty) {
61 61
 			$property->setAccessible(true);
62 62
 			$value=$property->getValue($this->instance);
63
-			if(isset($this->values[$index])){
64
-				$value= $this->values[$index]($value,$this->instance,$index);
65
-			}else{
66
-				$value=$this->_getDefaultValue($property->getName(),$value, $index);
63
+			if (isset($this->values[$index])) {
64
+				$value=$this->values[$index]($value, $this->instance, $index);
65
+			} else {
66
+				$value=$this->_getDefaultValue($property->getName(), $value, $index);
67 67
 			}
68
-		}else{
69
-			if(\is_callable($property))
68
+		} else {
69
+			if (\is_callable($property))
70 70
 				$value=$property($this->instance);
71
-			elseif(\is_array($property)){
72
-				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
71
+			elseif (\is_array($property)) {
72
+				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property);
73 73
 				$value=\implode("", $values);
74
-			}else{
75
-				if(isset($this->values[$index])){
76
-					$value= $this->values[$index]($property,$this->instance,$index);
77
-				}else{
74
+			} else {
75
+				if (isset($this->values[$index])) {
76
+					$value=$this->values[$index]($property, $this->instance, $index);
77
+				} else {
78 78
 					$value=$property;
79 79
 				}
80 80
 			}
81 81
 		}
82
-		if(isset($this->afterCompile[$index])){
83
-			if(\is_callable($this->afterCompile[$index])){
84
-				$this->afterCompile[$index]($value,$this->instance,$index);
82
+		if (isset($this->afterCompile[$index])) {
83
+			if (\is_callable($this->afterCompile[$index])) {
84
+				$this->afterCompile[$index]($value, $this->instance, $index);
85 85
 			}
86 86
 		}
87 87
 		return $value;
88 88
 	}
89 89
 
90
-	public function insertField($index,$field){
91
-		array_splice( $this->visibleProperties, $index, 0, $field );
90
+	public function insertField($index, $field) {
91
+		array_splice($this->visibleProperties, $index, 0, $field);
92 92
 		return $this;
93 93
 	}
94 94
 
95
-	public function insertInField($index,$field){
95
+	public function insertInField($index, $field) {
96 96
 		$vb=$this->visibleProperties;
97
-		if(isset($vb[$index])){
98
-			if(\is_array($vb[$index])){
97
+		if (isset($vb[$index])) {
98
+			if (\is_array($vb[$index])) {
99 99
 				$this->visibleProperties[$index][]=$field;
100
-			}else{
101
-				$this->visibleProperties[$index]=[$vb[$index],$field];
100
+			} else {
101
+				$this->visibleProperties[$index]=[$vb[$index], $field];
102 102
 			}
103
-		}else{
103
+		} else {
104 104
 			return $this->insertField($index, $field);
105 105
 		}
106 106
 		return $this;
107 107
 	}
108 108
 
109
-	public function addField($field){
109
+	public function addField($field) {
110 110
 		$this->visibleProperties[]=$field;
111 111
 		return $this;
112 112
 	}
113 113
 
114
-	public function count(){
114
+	public function count() {
115 115
 		return \sizeof($this->properties);
116 116
 	}
117 117
 
118
-	public function visiblePropertiesCount(){
118
+	public function visiblePropertiesCount() {
119 119
 		return \sizeof($this->visibleProperties);
120 120
 	}
121 121
 
122
-	public function getProperty($index){
122
+	public function getProperty($index) {
123 123
 		return $this->properties[$index];
124 124
 	}
125 125
 
126
-	protected function showableProperty(\ReflectionProperty $rProperty){
127
-		return JString::startswith($rProperty->getName(),"_")===false;
126
+	protected function showableProperty(\ReflectionProperty $rProperty) {
127
+		return JString::startswith($rProperty->getName(), "_")===false;
128 128
 	}
129 129
 
130 130
 	public function setInstance($instance) {
131
-		if(\is_string($instance)){
131
+		if (\is_string($instance)) {
132 132
 			$instance=new $instance();
133 133
 		}
134 134
 		$this->instance=$instance;
135 135
 		$this->properties=[];
136 136
 		$this->reflect=new \ReflectionClass($instance);
137
-		if(\sizeof($this->visibleProperties)===0){
137
+		if (\sizeof($this->visibleProperties)===0) {
138 138
 			$this->properties=$this->getDefaultProperties();
139
-		}else{
140
-			foreach ($this->visibleProperties as $property){
139
+		} else {
140
+			foreach ($this->visibleProperties as $property) {
141 141
 				$this->setInstanceProperty($property);
142 142
 			}
143 143
 		}
144 144
 		return $this;
145 145
 	}
146 146
 
147
-	private function setInstanceProperty($property){
148
-		if(\is_callable($property)){
147
+	private function setInstanceProperty($property) {
148
+		if (\is_callable($property)) {
149 149
 			$this->properties[]=$property;
150
-		}elseif(\is_string($property)){
151
-			try{
150
+		}elseif (\is_string($property)) {
151
+			try {
152 152
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
153 153
 				$rProperty=$this->reflect->getProperty($property);
154 154
 				$this->properties[]=$rProperty;
155
-			}catch(\Exception $e){
155
+			}catch (\Exception $e) {
156 156
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
157 157
 				$this->properties[]=$property;
158 158
 			}
159
-		}elseif(\is_int($property)){
159
+		}elseif (\is_int($property)) {
160 160
 			$props=$this->getDefaultProperties();
161
-			if(isset($props[$property]))
161
+			if (isset($props[$property]))
162 162
 				$this->properties[]=$props[$property];
163 163
 				else
164 164
 					$this->properties[]=$property;
165
-		}else{
165
+		} else {
166 166
 			$this->properties[]=$property;
167 167
 		}
168 168
 	}
169 169
 
170
-	protected function getDefaultProperties(){
170
+	protected function getDefaultProperties() {
171 171
 		$result=[];
172 172
 		$properties=$this->reflect->getProperties();
173
-		foreach ($properties as $property){
173
+		foreach ($properties as $property) {
174 174
 			$showable=$this->showableProperty($property);
175
-			if($showable!==false){
175
+			if ($showable!==false) {
176 176
 				$result[]=$property;
177 177
 			}
178 178
 		}
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 		return $this;
185 185
 	}
186 186
 
187
-	public function setValueFunction($index,$callback){
187
+	public function setValueFunction($index, $callback) {
188 188
 		$this->values[$index]=$callback;
189 189
 		return $this;
190 190
 	}
191 191
 
192
-	public function setIdentifierFunction($callback){
192
+	public function setIdentifierFunction($callback) {
193 193
 		$this->values["identifier"]=$callback;
194 194
 		return $this;
195 195
 	}
@@ -202,41 +202,41 @@  discard block
 block discarded – undo
202 202
 		return $this->properties;
203 203
 	}
204 204
 
205
-	public function getCaption($index){
206
-		if(isset($this->captions[$index])){
205
+	public function getCaption($index) {
206
+		if (isset($this->captions[$index])) {
207 207
 			return $this->captions[$index];
208 208
 		}
209
-		if($this->properties[$index] instanceof \ReflectionProperty)
209
+		if ($this->properties[$index] instanceof \ReflectionProperty)
210 210
 			return $this->properties[$index]->getName();
211
-		elseif(\is_callable($this->properties[$index]))
211
+		elseif (\is_callable($this->properties[$index]))
212 212
 			return "";
213 213
 		else
214 214
 			return $this->properties[$index];
215 215
 	}
216 216
 
217
-	public function getCaptions(){
218
-		if(isset($this->captions)){
219
-			$captions= $this->captions;
220
-			for($i=\sizeof($captions);$i<$this->count();$i++){
217
+	public function getCaptions() {
218
+		if (isset($this->captions)) {
219
+			$captions=$this->captions;
220
+			for ($i=\sizeof($captions); $i<$this->count(); $i++) {
221 221
 				$captions[]="";
222 222
 			}
223
-		}else{
223
+		} else {
224 224
 			$captions=[];
225 225
 			$index=0;
226 226
 			$count=$this->count();
227
-			while($index<$count){
227
+			while ($index<$count) {
228 228
 				$captions[]=$this->getCaption($index++);
229 229
 			}
230 230
 		}
231
-		if(isset($this->captionCallback) && \is_callable($this->captionCallback)){
231
+		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
232 232
 			$callback=$this->captionCallback;
233
-			$callback($captions,$this->instance);
233
+			$callback($captions, $this->instance);
234 234
 		}
235 235
 		return $captions;
236 236
 	}
237 237
 
238
-	public function setCaption($index,$caption){
239
-		if(isset($this->captions)===false)
238
+	public function setCaption($index, $caption) {
239
+		if (isset($this->captions)===false)
240 240
 			$this->captions=[];
241 241
 		$this->captions[$index]=$caption;
242 242
 		return $this;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 * @param callable $callback function called after the field compilation
255 255
 	 * @return \Ajax\semantic\widgets\datatable\InstanceViewer
256 256
 	 */
257
-	public function afterCompile($index,$callback){
257
+	public function afterCompile($index, $callback) {
258 258
 		$this->afterCompile[$index]=$callback;
259 259
 		return $this;
260 260
 	}
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	use BaseHtmlEventsTrait;
18 18
 	protected $_template;
19 19
 	protected $tagName;
20
-	protected $properties=array ();
21
-	protected $_wrapBefore=array ();
22
-	protected $_wrapAfter=array ();
20
+	protected $properties=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,26 +212,26 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 
214 214
 	public function fromArray($array) {
215
-		foreach ( $this as $key => $value ) {
216
-			if(array_key_exists($key, $array)===true)
217
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
215
+		foreach ($this as $key => $value) {
216
+			if (array_key_exists($key, $array)===true)
217
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
218 218
 		}
219
-		foreach ( $array as $key => $value ) {
220
-			if($this->_callSetter($key, $key, $value, $array)===false){
221
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
219
+		foreach ($array as $key => $value) {
220
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
221
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
222 222
 			}
223 223
 		}
224 224
 		return $array;
225 225
 	}
226 226
 
227
-	private function _callSetter($setter,$key,$value,&$array){
227
+	private function _callSetter($setter, $key, $value, &$array) {
228 228
 		$result=false;
229 229
 		if (method_exists($this, $setter) && !JString::startswith($key, "_")) {
230 230
 			try {
231 231
 				$this->$setter($value);
232 232
 				unset($array[$key]);
233 233
 				$result=true;
234
-			} catch ( \Exception $e ) {
234
+			}catch (\Exception $e) {
235 235
 				$result=false;
236 236
 			}
237 237
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 	public function fromDatabaseObjects($objects, $function) {
242 242
 		if (isset($objects)) {
243
-			foreach ( $objects as $object ) {
243
+			foreach ($objects as $object) {
244 244
 				$this->fromDatabaseObject($object, $function);
245 245
 			}
246 246
 		}
@@ -264,33 +264,33 @@  discard block
 block discarded – undo
264 264
 		if (is_array($elements)) {
265 265
 			$flag=false;
266 266
 			$index=0;
267
-			while ( !$flag && $index < sizeof($elements) ) {
267
+			while (!$flag && $index<sizeof($elements)) {
268 268
 				if ($elements[$index] instanceof BaseHtml)
269
-					$flag=($elements[$index]->getIdentifier() === $identifier);
269
+					$flag=($elements[$index]->getIdentifier()===$identifier);
270 270
 				$index++;
271 271
 			}
272
-			if ($flag === true)
273
-				return $elements[$index - 1];
272
+			if ($flag===true)
273
+				return $elements[$index-1];
274 274
 		} elseif ($elements instanceof BaseHtml) {
275
-			if ($elements->getIdentifier() === $identifier)
275
+			if ($elements->getIdentifier()===$identifier)
276 276
 				return $elements;
277 277
 		}
278 278
 		return null;
279 279
 	}
280 280
 
281
-	protected function getElementByPropertyValue($propertyName,$value, $elements) {
281
+	protected function getElementByPropertyValue($propertyName, $value, $elements) {
282 282
 		if (is_array($elements)) {
283 283
 			$flag=false;
284 284
 			$index=0;
285
-			while ( !$flag && $index < sizeof($elements) ) {
285
+			while (!$flag && $index<sizeof($elements)) {
286 286
 				if ($elements[$index] instanceof BaseHtml)
287
-					$flag=($elements[$index]->propertyContains($propertyName, $value) === true);
287
+					$flag=($elements[$index]->propertyContains($propertyName, $value)===true);
288 288
 					$index++;
289 289
 			}
290
-			if ($flag === true)
291
-				return $elements[$index - 1];
290
+			if ($flag===true)
291
+				return $elements[$index-1];
292 292
 		} elseif ($elements instanceof BaseHtml) {
293
-			if ($elements->propertyContains($propertyName, $value) === true)
293
+			if ($elements->propertyContains($propertyName, $value)===true)
294 294
 				return $elements;
295 295
 		}
296 296
 		return null;
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlLinkTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 trait HtmlLinkTrait {
6 6
 
7
-	abstract public function setProperty($name,$value);
7
+	abstract public function setProperty($name, $value);
8 8
 	abstract public function getProperty($name);
9 9
 
10 10
 	public function setHref($value) {
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/AttachedTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
 	 */
15 15
 	public function setAttachment($toElement, $side=Side::BOTH) {
16 16
 		if (isset($toElement)) {
17
-			$toElement->addToPropertyCtrl("class", "attached", array ("attached" ));
17
+			$toElement->addToPropertyCtrl("class", "attached", array("attached"));
18 18
 		}
19
-		return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached"));
19
+		return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
20 20
 	}
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.