Passed
Push — master ( e370f7...d93737 )
by Jean-Christophe
03:07
created
Ajax/ui/components/DialogButton.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 class DialogButton extends BaseComponent {
15 15
 
16 16
 	private function addFunction($jsCode) {
17
-		if (! JString::startsWith($jsCode, "function"))
18
-			$jsCode = "%function(){" . $jsCode . "}%";
17
+		if (!JString::startsWith($jsCode, "function"))
18
+			$jsCode="%function(){".$jsCode."}%";
19 19
 		return $jsCode;
20 20
 	}
21 21
 
22
-	public function __construct($caption, $jsCode, $event = "click") {
22
+	public function __construct($caption, $jsCode, $event="click") {
23 23
 		parent::__construct(NULL);
24
-		$this->params["text"] = $caption;
25
-		$this->params[$event] = $this->addFunction($jsCode);
24
+		$this->params["text"]=$caption;
25
+		$this->params[$event]=$this->addFunction($jsCode);
26 26
 	}
27 27
 
28 28
 	public function __toString() {
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		return json_encode($this->params, JSON_UNESCAPED_SLASHES);
38 38
 	}
39 39
 
40
-	public static function cancelButton($caption = "Annuler") {
40
+	public static function cancelButton($caption="Annuler") {
41 41
 		return new DialogButton($caption, "$( this ).dialog( 'close' );");
42 42
 	}
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *        	default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null)
53 53
 	 * @return DialogButton
54 54
 	 */
55
-	public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption = "Okay", $parameters = []) {
56
-		return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters) . ";$( this ).dialog( 'close' );");
55
+	public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[]) {
56
+		return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters).";$( this ).dialog( 'close' );");
57 57
 	}
58 58
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
 class DialogButton extends BaseComponent {
15 15
 
16 16
 	private function addFunction($jsCode) {
17
-		if (! JString::startsWith($jsCode, "function"))
18
-			$jsCode = "%function(){" . $jsCode . "}%";
17
+		if (! JString::startsWith($jsCode, "function")) {
18
+					$jsCode = "%function(){" . $jsCode . "}%";
19
+		}
19 20
 		return $jsCode;
20 21
 	}
21 22
 
Please login to merge, or discard this patch.
Ajax/ui/components/Buttonset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 	public function __construct(JsUtils $js) {
16 16
 		parent::__construct($js);
17
-		$this->uiName = "buttonset";
17
+		$this->uiName="buttonset";
18 18
 	}
19 19
 
20 20
 	/**
Please login to merge, or discard this patch.
Ajax/ui/properties/Position.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class Position extends BaseComponent {
13 13
 
14
-	public function __construct($my = "left top", $at = "left bottom", $collision = "none", $within = "window") {
14
+	public function __construct($my="left top", $at="left bottom", $collision="none", $within="window") {
15 15
 		$this->setParam("my", $my);
16 16
 		$this->setParam("at", $at);
17 17
 		$this->setParam("collision", $collision);
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	protected function setParamCtrl($key, $value, $typeCtrl) {
85
-		if (! $typeCtrl($value)) {
86
-			throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $key . " à la position");
85
+		if (!$typeCtrl($value)) {
86
+			throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position");
87 87
 		} else
88 88
 			$this->setParam($key, $value);
89 89
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@
 block discarded – undo
84 84
 	protected function setParamCtrl($key, $value, $typeCtrl) {
85 85
 		if (! $typeCtrl($value)) {
86 86
 			throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $key . " à la position");
87
-		} else
88
-			$this->setParam($key, $value);
87
+		} else {
88
+					$this->setParam($key, $value);
89
+		}
89 90
 	}
90 91
 
91 92
 	/*
Please login to merge, or discard this patch.
Ajax/ui/properties/Animation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  */
12 12
 class Animation extends BaseComponent {
13 13
 
14
-	public function __construct($duration = 400, $easing = "swing", $queue = false) {
14
+	public function __construct($duration=400, $easing="swing", $queue=false) {
15 15
 		$this->setDuration($duration);
16 16
 		$this->setEasing($easing);
17 17
 		$this->setQueue($queue);
Please login to merge, or discard this patch.
Ajax/semantic/html/base/HtmlSemDoubleElement.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
 class HtmlSemDoubleElement extends HtmlDoubleElement {
24 24
 	use BaseTrait;
25 25
 
26
-	protected $_popup = NULL;
26
+	protected $_popup=NULL;
27 27
 
28
-	protected $_dimmer = NULL;
28
+	protected $_dimmer=NULL;
29 29
 
30
-	protected $_toast = NULL;
30
+	protected $_toast=NULL;
31 31
 
32
-	protected $_sidebar = NULL;
32
+	protected $_sidebar=NULL;
33 33
 
34
-	protected $_params = array();
34
+	protected $_params=array();
35 35
 
36
-	public function __construct($identifier, $tagName = "p", $baseClass = "ui", $content = NULL) {
36
+	public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) {
37 37
 		parent::__construct($identifier, $tagName);
38
-		$this->_baseClass = $baseClass;
38
+		$this->_baseClass=$baseClass;
39 39
 		$this->setClass($baseClass);
40 40
 		if (isset($content)) {
41
-			$this->content = $content;
41
+			$this->content=$content;
42 42
 		}
43 43
 	}
44 44
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param string $variation
49 49
 	 * @param string $popupEvent
50 50
 	 */
51
-	public function setPopupAttributes($variation = NULL, $popupEvent = NULL) {
51
+	public function setPopupAttributes($variation=NULL, $popupEvent=NULL) {
52 52
 		if (isset($this->_popup))
53 53
 			$this->_popup->setAttributes($variation, $popupEvent);
54 54
 	}
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param array $params
63 63
 	 * @return HtmlSemDoubleElement
64 64
 	 */
65
-	public function addPopup($title = "", $content = "", $variation = NULL, $params = array()) {
66
-		$this->_popup = new InternalPopup($this, $title, $content, $variation, $params);
65
+	public function addPopup($title="", $content="", $variation=NULL, $params=array()) {
66
+		$this->_popup=new InternalPopup($this, $title, $content, $variation, $params);
67 67
 		return $this;
68 68
 	}
69 69
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 * @param array $params
76 76
 	 * @return HtmlSemDoubleElement
77 77
 	 */
78
-	public function addPopupHtml($html = "", $variation = NULL, $params = array()) {
79
-		$this->_popup = new InternalPopup($this);
78
+	public function addPopupHtml($html="", $variation=NULL, $params=array()) {
79
+		$this->_popup=new InternalPopup($this);
80 80
 		$this->_popup->setHtml($html);
81 81
 		$this->_popup->setAttributes($variation, $params);
82 82
 		return $this;
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 * @param mixed $content
90 90
 	 * @return HtmlDimmer
91 91
 	 */
92
-	public function addDimmer($params = array(), $content = NULL) {
93
-		$dimmer = new HtmlDimmer("dimmer-" . $this->identifier, $content);
92
+	public function addDimmer($params=array(), $content=NULL) {
93
+		$dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content);
94 94
 		$dimmer->setParams($params);
95 95
 		$dimmer->setContainer($this);
96 96
 		$this->addContent($dimmer);
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	 * @param string $icon
106 106
 	 * @return mixed|HtmlLabel
107 107
 	 */
108
-	public function addLabel($label, $before = false, $icon = NULL) {
109
-		$labelO = $label;
110
-		if (\is_object($label) === false) {
111
-			$labelO = new HtmlLabel("label-" . $this->identifier, $label);
108
+	public function addLabel($label, $before=false, $icon=NULL) {
109
+		$labelO=$label;
110
+		if (\is_object($label)===false) {
111
+			$labelO=new HtmlLabel("label-".$this->identifier, $label);
112 112
 			if (isset($icon))
113 113
 				$labelO->addIcon($icon);
114 114
 		} else {
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * @param string $icon
130 130
 	 * @return HtmlSemDoubleElement
131 131
 	 */
132
-	public function attachLabel($label, $side = Side::TOP, $direction = Direction::NONE, $icon = NULL) {
133
-		$label = $this->addLabel($label, true, $icon);
132
+	public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) {
133
+		$label=$this->addLabel($label, true, $icon);
134 134
 		$label->setAttached($side, $direction);
135 135
 		return $this;
136 136
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return HtmlSemDoubleElement
142 142
 	 */
143
-	public function asLink($href = NULL, $target = NULL) {
143
+	public function asLink($href=NULL, $target=NULL) {
144 144
 		if (isset($href))
145 145
 			$this->setProperty("href", $href);
146 146
 		if (isset($target))
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	 * @param boolean $show
155 155
 	 * @return string
156 156
 	 */
157
-	public function jsShowDimmer($show = true) {
158
-		$status = "hide";
159
-		if ($show === true)
160
-			$status = "show";
161
-		return '$("#.' . $this->identifier . ').dimmer("' . $status . '");';
157
+	public function jsShowDimmer($show=true) {
158
+		$status="hide";
159
+		if ($show===true)
160
+			$status="show";
161
+		return '$("#.'.$this->identifier.').dimmer("'.$status.'");';
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * {@inheritdoc}
167 167
 	 * @see BaseHtml::compile()
168 168
 	 */
169
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
169
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
170 170
 		if (isset($this->_popup)) {
171 171
 			$this->_popup->compile($js);
172 172
 		}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @see HtmlDoubleElement::run()
180 180
 	 */
181 181
 	public function run(JsUtils $js) {
182
-		$this->_bsComponent = $js->semantic()->generic("#" . $this->identifier);
182
+		$this->_bsComponent=$js->semantic()->generic("#".$this->identifier);
183 183
 		parent::run($js);
184 184
 		$this->addEventsOnRun($js);
185 185
 		if (isset($this->_popup)) {
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param boolean $ordered
198 198
 	 * @return \Ajax\common\html\html5\HtmlList
199 199
 	 */
200
-	public function addList($items, $ordered = false) {
201
-		$list = new HtmlList("list-" . $this->identifier, $items);
200
+	public function addList($items, $ordered=false) {
201
+		$list=new HtmlList("list-".$this->identifier, $items);
202 202
 		$list->setOrdered($ordered);
203 203
 		$list->setClass("ui list");
204 204
 		$this->addContent($list);
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * @param ?array $params
211 211
 	 * @return \Ajax\semantic\components\Toast
212 212
 	 */
213
-	public function asToast($params = NULL) {
214
-		$this->_toast = new Toast();
215
-		$this->_toast->attach('#' . $this->_identifier);
213
+	public function asToast($params=NULL) {
214
+		$this->_toast=new Toast();
215
+		$this->_toast->attach('#'.$this->_identifier);
216 216
 		$this->setProperty('style', 'display:none;');
217 217
 		if (isset($params)) {
218 218
 			$this->_toast->setParams($params);
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @param string $classes
227 227
 	 * @return \Ajax\semantic\components\Sidebar
228 228
 	 */
229
-	public function asSideBar($classes = '') {
230
-		$this->_sidebar = new Sidebar();
229
+	public function asSideBar($classes='') {
230
+		$this->_sidebar=new Sidebar();
231 231
 		$this->addToProperty('class', 'sidebar');
232 232
 		return $this->_sidebar;
233 233
 	}
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param string $popupEvent
50 50
 	 */
51 51
 	public function setPopupAttributes($variation = NULL, $popupEvent = NULL) {
52
-		if (isset($this->_popup))
53
-			$this->_popup->setAttributes($variation, $popupEvent);
52
+		if (isset($this->_popup)) {
53
+					$this->_popup->setAttributes($variation, $popupEvent);
54
+		}
54 55
 	}
55 56
 
56 57
 	/**
@@ -109,8 +110,9 @@  discard block
 block discarded – undo
109 110
 		$labelO = $label;
110 111
 		if (\is_object($label) === false) {
111 112
 			$labelO = new HtmlLabel("label-" . $this->identifier, $label);
112
-			if (isset($icon))
113
-				$labelO->addIcon($icon);
113
+			if (isset($icon)) {
114
+							$labelO->addIcon($icon);
115
+			}
114 116
 		} else {
115 117
 			$labelO->addToPropertyCtrl("class", "label", array(
116 118
 				"label"
@@ -141,10 +143,12 @@  discard block
 block discarded – undo
141 143
 	 * @return HtmlSemDoubleElement
142 144
 	 */
143 145
 	public function asLink($href = NULL, $target = NULL) {
144
-		if (isset($href))
145
-			$this->setProperty("href", $href);
146
-		if (isset($target))
147
-			$this->setProperty("target", $target);
146
+		if (isset($href)) {
147
+					$this->setProperty("href", $href);
148
+		}
149
+		if (isset($target)) {
150
+					$this->setProperty("target", $target);
151
+		}
148 152
 		return $this->setTagName("a");
149 153
 	}
150 154
 
@@ -156,8 +160,9 @@  discard block
 block discarded – undo
156 160
 	 */
157 161
 	public function jsShowDimmer($show = true) {
158 162
 		$status = "hide";
159
-		if ($show === true)
160
-			$status = "show";
163
+		if ($show === true) {
164
+					$status = "show";
165
+		}
161 166
 		return '$("#.' . $this->identifier . ').dimmer("' . $status . '");';
162 167
 	}
163 168
 
Please login to merge, or discard this patch.
Ajax/semantic/components/Sidebar.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class Sidebar extends SimpleSemExtComponent {
16 16
 
17
-	public function __construct(JsUtils $js = NULL) {
17
+	public function __construct(JsUtils $js=NULL) {
18 18
 		parent::__construct($js);
19
-		$this->uiName = 'sidebar';
19
+		$this->uiName='sidebar';
20 20
 	}
21 21
 
22 22
 	public function show() {
@@ -46,32 +46,32 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	public function setContext($value) {
49
-		$this->params['context'] = $value;
49
+		$this->params['context']=$value;
50 50
 		return $this;
51 51
 	}
52 52
 
53
-	public function setExclusive($value = true) {
54
-		$this->params['exclusive'] = true;
53
+	public function setExclusive($value=true) {
54
+		$this->params['exclusive']=true;
55 55
 		return $this;
56 56
 	}
57 57
 
58
-	public function setClosable($value = true) {
59
-		$this->params['closable'] = $value;
58
+	public function setClosable($value=true) {
59
+		$this->params['closable']=$value;
60 60
 		return $this;
61 61
 	}
62 62
 
63
-	public function setDimPage($value = true) {
64
-		$this->params['dimPage'] = $value;
63
+	public function setDimPage($value=true) {
64
+		$this->params['dimPage']=$value;
65 65
 		return $this;
66 66
 	}
67 67
 
68
-	public function setScrollLock($value = false) {
69
-		$this->params['scrollLock'] = $value;
68
+	public function setScrollLock($value=false) {
69
+		$this->params['scrollLock']=$value;
70 70
 		return $this;
71 71
 	}
72 72
 
73
-	public function setReturnScroll($value = false) {
74
-		$this->params['returnScroll'] = $value;
73
+	public function setReturnScroll($value=false) {
74
+		$this->params['returnScroll']=$value;
75 75
 		return $this;
76 76
 	}
77 77
 
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,28 +3,28 @@  discard block
 block discarded – undo
3 3
 
4 4
 class Javascript {
5 5
 
6
-	public static $preventDefault = "\nif(event && event.preventDefault) event.preventDefault();\n";
6
+	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 
8
-	public static $stopPropagation = "\nif(event && event.stopPropagation) event.stopPropagation();\n";
8
+	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
9 9
 
10
-	public static function draggable($attr = "id") {
11
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("' . $attr . '")}));';
10
+	public static function draggable($attr="id") {
11
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("'.$attr.'")}));';
12 12
 	}
13 13
 
14
-	public static function dropZone($jqueryDone, $jsCallback = "") {
15
-		$done = ($jqueryDone != null) ? '$(event.target).' . $jqueryDone . '($("#"+_data.id));' : '';
16
-		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));' . $done . 'var data=_data.data;' . $jsCallback;
14
+	public static function dropZone($jqueryDone, $jsCallback="") {
15
+		$done=($jqueryDone!=null) ? '$(event.target).'.$jqueryDone.'($("#"+_data.id));' : '';
16
+		return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));'.$done.'var data=_data.data;'.$jsCallback;
17 17
 	}
18 18
 
19 19
 	public static function containsCode($expression) {
20
-		return strrpos($expression, 'this') !== false || strrpos($expression, 'event') !== false || strrpos($expression, 'self') !== false;
20
+		return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false;
21 21
 	}
22 22
 
23 23
 	public static function isFunction($jsCode) {
24 24
 		return JString::startswith($jsCode, "function");
25 25
 	}
26 26
 
27
-	public static function fileUploadBehavior($id = '') {
27
+	public static function fileUploadBehavior($id='') {
28 28
 		return "$('input:text, .ui.button', '#{$id}').on('click', function (e) {e.preventDefault();\$('input:file', '#{$id}').click();});
29 29
 				$('input:file', '#{$id}').on('change', function (e) {if(e.target.files.length){var name = e.target.files[0].name;$('input:text', $(e.target).parent()).val(name);}});";
30 30
 	}
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return string
39 39
 	 */
40 40
 	public static function prep_element($element) {
41
-		if (self::containsCode($element) === false) {
42
-			$element = '"' . addslashes($element) . '"';
41
+		if (self::containsCode($element)===false) {
42
+			$element='"'.addslashes($element).'"';
43 43
 		}
44 44
 		return $element;
45 45
 	}
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public static function prep_value($value) {
56 56
 		if (\is_array($value)) {
57
-			$value = implode(",", $value);
57
+			$value=implode(",", $value);
58 58
 		}
59
-		if (self::containsCode($value) === false) {
60
-			$value = \str_replace([
59
+		if (self::containsCode($value)===false) {
60
+			$value=\str_replace([
61 61
 				"\\",
62 62
 				"\""
63 63
 			], [
64 64
 				"\\\\",
65 65
 				"\\\""
66 66
 			], $value);
67
-			$value = '"' . $value . '"';
67
+			$value='"'.$value.'"';
68 68
 		}
69 69
 		return trim($value, "%");
70 70
 	}
71 71
 
72 72
 	public static function prep_jquery_selector($value) {
73
-		if (JString::startswith($value, '$(') === false) {
74
-			return '$(' . self::prep_value($value) . ')';
73
+		if (JString::startswith($value, '$(')===false) {
74
+			return '$('.self::prep_value($value).')';
75 75
 		}
76 76
 		return $value;
77 77
 	}
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,50 +10,50 @@  discard block
 block discarded – undo
10 10
 	private $parameters;
11 11
 
12 12
 	public function __construct($method, $parameters) {
13
-		$this->method = $method;
14
-		$this->parameters = $parameters;
13
+		$this->method=$method;
14
+		$this->parameters=$parameters;
15 15
 	}
16 16
 
17
-	public function compile(JsUtils $js = null) {
18
-		if ($js === null)
17
+	public function compile(JsUtils $js=null) {
18
+		if ($js===null)
19 19
 			return;
20
-		$params = "{}";
21
-		$stopPropagation = true;
22
-		$preventDefault = true;
23
-		$method = "get";
24
-		$this->parameters["immediatly"] = false;
20
+		$params="{}";
21
+		$stopPropagation=true;
22
+		$preventDefault=true;
23
+		$method="get";
24
+		$this->parameters["immediatly"]=false;
25 25
 		extract($this->parameters);
26
-		$result = $this->_eventPreparing($preventDefault, $stopPropagation);
26
+		$result=$this->_eventPreparing($preventDefault, $stopPropagation);
27 27
 		switch ($this->method) {
28 28
 			case "get":
29
-				$result .= $js->getDeferred($url, $responseElement, $this->parameters);
29
+				$result.=$js->getDeferred($url, $responseElement, $this->parameters);
30 30
 				break;
31 31
 			case "post":
32
-				$result .= $js->postDeferred($url, $params, $responseElement, $this->parameters);
32
+				$result.=$js->postDeferred($url, $params, $responseElement, $this->parameters);
33 33
 				break;
34 34
 			case "postForm":
35
-				$result .= $js->postFormDeferred($url, $form, $responseElement, $this->parameters);
35
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters);
36 36
 				break;
37 37
 			case "json":
38
-				$result .= $js->jsonDeferred($url, $method, $this->parameters);
38
+				$result.=$js->jsonDeferred($url, $method, $this->parameters);
39 39
 				break;
40 40
 			case "jsonArray":
41
-				$result .= $js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters);
41
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters);
42 42
 				break;
43 43
 			default:
44
-				$result .= $js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters);
44
+				$result.=$js->ajaxDeferred($this->method, $url, $responseElement, $this->parameters);
45 45
 				break;
46 46
 		}
47 47
 		return $result;
48 48
 	}
49 49
 
50 50
 	protected function _eventPreparing($preventDefault, $stopPropagation) {
51
-		$result = "";
52
-		if ($preventDefault === true) {
53
-			$result .= Javascript::$preventDefault;
51
+		$result="";
52
+		if ($preventDefault===true) {
53
+			$result.=Javascript::$preventDefault;
54 54
 		}
55
-		if ($stopPropagation === true) {
56
-			$result .= Javascript::$stopPropagation;
55
+		if ($stopPropagation===true) {
56
+			$result.=Javascript::$stopPropagation;
57 57
 		}
58 58
 		return $result;
59 59
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	public function setMethod($method) {
66
-		$this->method = $method;
66
+		$this->method=$method;
67 67
 		return $this;
68 68
 	}
69 69
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	public function setParameters($parameters) {
75
-		$this->parameters = $parameters;
75
+		$this->parameters=$parameters;
76 76
 		return $this;
77 77
 	}
78 78
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	public function compile(JsUtils $js = null) {
18
-		if ($js === null)
19
-			return;
18
+		if ($js === null) {
19
+					return;
20
+		}
20 21
 		$params = "{}";
21 22
 		$stopPropagation = true;
22 23
 		$preventDefault = true;
Please login to merge, or discard this patch.
Ajax/common/Widget.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\common\html\traits\BaseHooksTrait;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait,BaseHooksTrait;
23
+	use FieldAsTrait, FormTrait, BaseHooksTrait;
24 24
 
25 25
 	/**
26 26
 	 *
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 
67 67
 	protected $_hasRules;
68 68
 
69
-	public function __construct($identifier, $model, $modelInstance = NULL) {
69
+	public function __construct($identifier, $model, $modelInstance=NULL) {
70 70
 		parent::__construct($identifier);
71
-		$this->_template = "%wrapContentBefore%%content%%wrapContentAfter%";
71
+		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
72 72
 		$this->setModel($model);
73 73
 		if (isset($modelInstance)) {
74 74
 			$this->show($modelInstance);
75 75
 		}
76
-		$this->_generated = false;
76
+		$this->_generated=false;
77 77
 	}
78 78
 
79 79
 	protected function _init($instanceViewer, $contentKey, $content, $edition) {
80
-		$this->_instanceViewer = $instanceViewer;
81
-		$this->content = [
80
+		$this->_instanceViewer=$instanceViewer;
81
+		$this->content=[
82 82
 			$contentKey => $content
83 83
 		];
84
-		$this->_self = $content;
85
-		$this->_toolbarPosition = PositionInTable::BEFORETABLE;
86
-		$this->_edition = $edition;
84
+		$this->_self=$content;
85
+		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
86
+		$this->_edition=$edition;
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
 	 * @return int|string|boolean
93 93
 	 */
94 94
 	protected function _getIndex($fieldName) {
95
-		$index = $fieldName;
95
+		$index=$fieldName;
96 96
 		if (\is_string($fieldName)) {
97
-			$fields = $this->_instanceViewer->getVisibleProperties();
98
-			$index = \array_search($fieldName, $fields);
97
+			$fields=$this->_instanceViewer->getVisibleProperties();
98
+			$index=\array_search($fieldName, $fields);
99 99
 		}
100 100
 		return $index;
101 101
 	}
102 102
 
103
-	protected function _getFieldIdentifier($prefix, $name = "") {
104
-		return $this->identifier . "-{$prefix}-" . $this->_instanceViewer->getIdentifier();
103
+	protected function _getFieldIdentifier($prefix, $name="") {
104
+		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
105 105
 	}
106 106
 
107 107
 	protected function _getFieldName($index) {
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 		return $this->_instanceViewer->getCaption($index);
113 113
 	}
114 114
 
115
-	abstract protected function _setToolbarPosition($table, $captions = NULL);
115
+	abstract protected function _setToolbarPosition($table, $captions=NULL);
116 116
 
117 117
 	public function show($modelInstance) {
118 118
 		if (\is_array($modelInstance)) {
119
-			$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
119
+			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
120 120
 		}
121
-		$this->_modelInstance = $modelInstance;
121
+		$this->_modelInstance=$modelInstance;
122 122
 	}
123 123
 
124 124
 	public function getModel() {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	public function setModel($_model) {
129
-		$this->_model = $_model;
129
+		$this->_model=$_model;
130 130
 		return $this;
131 131
 	}
132 132
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	}
136 136
 
137 137
 	public function setInstanceViewer($_instanceViewer) {
138
-		$this->_instanceViewer = $_instanceViewer;
138
+		$this->_instanceViewer=$_instanceViewer;
139 139
 		return $this;
140 140
 	}
141 141
 
142 142
 	abstract public function getHtmlComponent();
143 143
 
144
-	public function setAttached($value = true) {
144
+	public function setAttached($value=true) {
145 145
 		return $this->getHtmlComponent()->setAttached($value);
146 146
 	}
147 147
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	 * @return Widget
157 157
 	 */
158 158
 	public function afterCompile($index, $callback) {
159
-		$index = $this->_getIndex($index);
160
-		if ($index !== false) {
159
+		$index=$this->_getIndex($index);
160
+		if ($index!==false) {
161 161
 			$this->_instanceViewer->afterCompile($index, $callback);
162 162
 		}
163 163
 		return $this;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		return $this;
183 183
 	}
184 184
 
185
-	public function addField($field, $key = null) {
185
+	public function addField($field, $key=null) {
186 186
 		$this->_instanceViewer->addField($field, $key);
187 187
 		return $this;
188 188
 	}
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 		return $this->_instanceViewer->visiblePropertiesCount();
197 197
 	}
198 198
 
199
-	public function addMessage($attributes = NULL, $fieldName = "message") {
199
+	public function addMessage($attributes=NULL, $fieldName="message") {
200 200
 		$this->_instanceViewer->addField($fieldName);
201
-		$count = $this->_instanceViewer->visiblePropertiesCount();
202
-		return $this->fieldAsMessage($count - 1, $attributes);
201
+		$count=$this->_instanceViewer->visiblePropertiesCount();
202
+		return $this->fieldAsMessage($count-1, $attributes);
203 203
 	}
204 204
 
205 205
 	public function addErrorMessage() {
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
 		], "message");
209 209
 	}
210 210
 
211
-	public function insertField($index, $field, $key = null) {
212
-		$index = $this->_getIndex($index);
211
+	public function insertField($index, $field, $key=null) {
212
+		$index=$this->_getIndex($index);
213 213
 		$this->_instanceViewer->insertField($index, $field, $key);
214 214
 		return $this;
215 215
 	}
216 216
 
217
-	public function insertInField($index, $field, $key = null) {
218
-		$index = $this->_getIndex($index);
219
-		if ($index !== false) {
217
+	public function insertInField($index, $field, $key=null) {
218
+		$index=$this->_getIndex($index);
219
+		if ($index!==false) {
220 220
 			$this->_instanceViewer->insertInField($index, $field, $key);
221 221
 		}
222 222
 		return $this;
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 	 * @return Widget
233 233
 	 */
234 234
 	public function setValueFunction($index, $callback) {
235
-		$index = $this->_getIndex($index);
236
-		if ($index !== false) {
235
+		$index=$this->_getIndex($index);
236
+		if ($index!==false) {
237 237
 			$this->_instanceViewer->setValueFunction($index, $callback);
238 238
 		}
239 239
 		return $this;
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
250 250
 	 */
251 251
 	public function getToolbar() {
252
-		if (isset($this->_toolbar) === false) {
253
-			$this->_toolbar = new HtmlMenu("toolbar-" . $this->identifier);
252
+		if (isset($this->_toolbar)===false) {
253
+			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
254 254
 		}
255 255
 		return $this->_toolbar;
256 256
 	}
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	 *        	function to call on $element
264 264
 	 * @return \Ajax\common\html\HtmlDoubleElement
265 265
 	 */
266
-	public function addInToolbar($element, $callback = NULL) {
267
-		$tb = $this->getToolbar();
266
+	public function addInToolbar($element, $callback=NULL) {
267
+		$tb=$this->getToolbar();
268 268
 		if ($element instanceof BaseWidget) {
269
-			if ($element->getIdentifier() === "") {
270
-				$element->setIdentifier("tb-item-" . $this->identifier . "-" . $tb->count());
269
+			if ($element->getIdentifier()==="") {
270
+				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
271 271
 			}
272 272
 		}
273 273
 		if (isset($callback)) {
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 *        	function($element)
287 287
 	 * @return \Ajax\common\html\HtmlDoubleElement
288 288
 	 */
289
-	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
290
-		$result = $this->addInToolbar($caption, $callback);
289
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
290
+		$result=$this->addInToolbar($caption, $callback);
291 291
 		if (isset($icon) && method_exists($result, "addIcon"))
292 292
 			$result->addIcon($icon);
293 293
 		return $result;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 *        	function($element)
301 301
 	 * @return \Ajax\common\Widget
302 302
 	 */
303
-	public function addItemsInToolbar(array $items, $callback = NULL) {
303
+	public function addItemsInToolbar(array $items, $callback=NULL) {
304 304
 		if (JArray::isAssociative($items)) {
305 305
 			foreach ($items as $icon => $item) {
306 306
 				$this->addItemInToolbar($item, $icon, $callback);
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 	 *        	function($element)
322 322
 	 * @return \Ajax\common\html\HtmlDoubleElement
323 323
 	 */
324
-	public function addDropdownInToolbar($value, $items, $callback = NULL) {
325
-		$dd = $value;
324
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
325
+		$dd=$value;
326 326
 		if (\is_string($value)) {
327
-			$dd = new HtmlDropdown("dropdown-" . $this->identifier . "-" . $value, $value, $items);
327
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
328 328
 		}
329 329
 		return $this->addInToolbar($dd, $callback);
330 330
 	}
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 *        	function($element)
338 338
 	 * @return \Ajax\common\html\HtmlDoubleElement
339 339
 	 */
340
-	public function addButtonInToolbar($caption, $cssStyle = null, $callback = NULL) {
341
-		$bt = new HtmlButton("bt-" . $caption, $caption, $cssStyle);
340
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
341
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
342 342
 		return $this->addInToolbar($bt, $callback);
343 343
 	}
344 344
 
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 	 *        	function($element)
351 351
 	 * @return \Ajax\common\html\HtmlDoubleElement
352 352
 	 */
353
-	public function addButtonsInToolbar(array $captions, $asIcon = false, $callback = NULL) {
354
-		$bts = new HtmlButtonGroups("", $captions, $asIcon);
353
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
354
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
355 355
 		return $this->addInToolbar($bts, $callback);
356 356
 	}
357 357
 
@@ -363,14 +363,14 @@  discard block
 block discarded – undo
363 363
 	 * @param boolean $labeled
364 364
 	 * @return \Ajax\common\html\HtmlDoubleElement
365 365
 	 */
366
-	public function addLabelledIconButtonInToolbar($caption, $icon, $before = true, $labeled = false) {
367
-		$bt = new HtmlButton("", $caption);
366
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
367
+		$bt=new HtmlButton("", $caption);
368 368
 		$bt->addIcon($icon, $before, $labeled);
369 369
 		return $this->addInToolbar($bt);
370 370
 	}
371 371
 
372
-	public function addSubmitInToolbar($identifier, $value, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $parameters = NULL) {
373
-		$button = new HtmlButton($identifier, $value, $cssStyle);
372
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
373
+		$button=new HtmlButton($identifier, $value, $cssStyle);
374 374
 		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
375 375
 		return $this->addInToolbar($button);
376 376
 	}
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param boolean $_edition
394 394
 	 * @return \Ajax\common\Widget
395 395
 	 */
396
-	public function setEdition($_edition = true) {
397
-		$this->_edition = $_edition;
396
+	public function setEdition($_edition=true) {
397
+		$this->_edition=$_edition;
398 398
 		return $this;
399 399
 	}
400 400
 
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 	 * @param string|boolean $disable
424 424
 	 * @return string
425 425
 	 */
426
-	public function jsDisabled($disable = true) {
427
-		return "$('#" . $this->identifier . " .ui.input,#" . $this->identifier . " .ui.dropdown,#" . $this->identifier . " .ui.checkbox').toggleClass('disabled'," . $disable . ");";
426
+	public function jsDisabled($disable=true) {
427
+		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
428 428
 	}
429 429
 
430 430
 	/**
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 *        	function($element)
435 435
 	 * @return \Ajax\common\html\HtmlDoubleElement
436 436
 	 */
437
-	public function addEditButtonInToolbar($caption, $callback = NULL) {
438
-		$bt = new HtmlButton($this->identifier . "-editBtn", $caption);
437
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
438
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
439 439
 		$bt->setToggle();
440 440
 		$bt->setActive($this->_edition);
441 441
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
@@ -443,18 +443,18 @@  discard block
 block discarded – undo
443 443
 	}
444 444
 
445 445
 	public function setToolbar(HtmlMenu $_toolbar) {
446
-		$this->_toolbar = $_toolbar;
446
+		$this->_toolbar=$_toolbar;
447 447
 		return $this;
448 448
 	}
449 449
 
450 450
 	public function setToolbarPosition($_toolbarPosition) {
451
-		$this->_toolbarPosition = $_toolbarPosition;
451
+		$this->_toolbarPosition=$_toolbarPosition;
452 452
 		return $this;
453 453
 	}
454 454
 
455 455
 	public function getForm() {
456
-		if (! isset($this->_form)) {
457
-			$this->_form = new HtmlForm("frm-" . $this->identifier);
456
+		if (!isset($this->_form)) {
457
+			$this->_form=new HtmlForm("frm-".$this->identifier);
458 458
 			$this->setEdition(true);
459 459
 		}
460 460
 		return $this->_form;
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	}
469 469
 
470 470
 	protected function runForm(JsUtils $js) {
471
-		$fields = $this->getContentInstances(HtmlFormField::class);
471
+		$fields=$this->getContentInstances(HtmlFormField::class);
472 472
 		foreach ($fields as $field) {
473 473
 			$this->_form->addField($field);
474 474
 		}
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 
478 478
 	protected function _compileForm() {
479 479
 		if (isset($this->_form)) {
480
-			$noValidate = "";
481
-			if (\sizeof($this->_form->getValidationParams()) > 0)
482
-				$noValidate = "novalidate";
483
-			$this->wrapContent("<form class='ui form' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
480
+			$noValidate="";
481
+			if (\sizeof($this->_form->getValidationParams())>0)
482
+				$noValidate="novalidate";
483
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
484 484
 		}
485 485
 	}
486 486
 
@@ -502,21 +502,21 @@  discard block
 block discarded – undo
502 502
 	}
503 503
 
504 504
 	public function swapFields($index1, $index2) {
505
-		$index1 = $this->_getIndex($index1);
506
-		$index2 = $this->_getIndex($index2);
505
+		$index1=$this->_getIndex($index1);
506
+		$index2=$this->_getIndex($index2);
507 507
 		return $this->_instanceViewer->swapFields($index1, $index2);
508 508
 	}
509 509
 
510 510
 	public function removeField($index) {
511
-		$index = $this->_getIndex($index);
512
-		if ($index !== false) {
511
+		$index=$this->_getIndex($index);
512
+		if ($index!==false) {
513 513
 			$this->_instanceViewer->removeField($index);
514 514
 		}
515 515
 		return $this;
516 516
 	}
517 517
 
518
-	public function asModal($header = null) {
519
-		$modal = new HtmlModal("modal-" . $this->identifier, $header);
518
+	public function asModal($header=null) {
519
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
520 520
 		$modal->setContent($this);
521 521
 		if (isset($this->_form)) {
522 522
 			$this->_form->onSuccess($modal->jsHide());
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		return $modal;
525 525
 	}
526 526
 
527
-	public function addToProperty($name, $value, $separator = " ") {
527
+	public function addToProperty($name, $value, $separator=" ") {
528 528
 		return $this->getHtmlComponent()->addToProperty($name, $value, $separator);
529 529
 	}
530 530
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -288,8 +288,9 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
290 290
 		$result = $this->addInToolbar($caption, $callback);
291
-		if (isset($icon) && method_exists($result, "addIcon"))
292
-			$result->addIcon($icon);
291
+		if (isset($icon) && method_exists($result, "addIcon")) {
292
+					$result->addIcon($icon);
293
+		}
293 294
 		return $result;
294 295
 	}
295 296
 
@@ -478,8 +479,9 @@  discard block
 block discarded – undo
478 479
 	protected function _compileForm() {
479 480
 		if (isset($this->_form)) {
480 481
 			$noValidate = "";
481
-			if (\sizeof($this->_form->getValidationParams()) > 0)
482
-				$noValidate = "novalidate";
482
+			if (\sizeof($this->_form->getValidationParams()) > 0) {
483
+							$noValidate = "novalidate";
484
+			}
483 485
 			$this->wrapContent("<form class='ui form' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
484 486
 		}
485 487
 	}
Please login to merge, or discard this patch.