Passed
Push — master ( f022dc...ec835f )
by Jean-Christophe
02:32
created
Ajax/common/traits/JsUtilsEventsTrait.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @property array $jquery_code_for_compile
11 11
  */
12 12
 trait JsUtilsEventsTrait {
13
-	protected $jquery_events = array (
13
+	protected $jquery_events=array(
14 14
 			"bind",
15 15
 			"blur",
16 16
 			"change",
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			"unload"
52 52
 	);
53 53
 
54
-	abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn=false);
54
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false);
55 55
 
56 56
 	/**
57 57
 	 * Outputs a javascript library blur event
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 *        	code to execute
63 63
 	 * @return string
64 64
 	 */
65
-	public function blur($element = 'this', $js = '') {
66
-		return $this->_add_event ( $element, $js, 'blur' );
65
+	public function blur($element='this', $js='') {
66
+		return $this->_add_event($element, $js, 'blur');
67 67
 	}
68 68
 
69 69
 	/**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param boolean $stopPropagation
78 78
 	 * @return string
79 79
 	 */
80
-	public function change($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) {
81
-		return $this->_add_event ( $element, $js, 'change', $preventDefault, $stopPropagation );
80
+	public function change($element='this', $js='', $preventDefault=false, $stopPropagation=false) {
81
+		return $this->_add_event($element, $js, 'change', $preventDefault, $stopPropagation);
82 82
 	}
83 83
 
84 84
 	/**
@@ -94,18 +94,18 @@  discard block
 block discarded – undo
94 94
 	 * @param boolean $stopPropagation
95 95
 	 * @return string
96 96
 	 */
97
-	public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDefault = false, $stopPropagation = false) {
98
-		if (! is_array ( $js )) {
99
-			$js = array (
97
+	public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false) {
98
+		if (!is_array($js)) {
99
+			$js=array(
100 100
 					$js
101 101
 			);
102 102
 		}
103 103
 
104 104
 		if ($ret_false) {
105
-			$js [] = "return false;";
105
+			$js []="return false;";
106 106
 		}
107 107
 
108
-		return $this->_add_event ( $element, $js, 'click', $preventDefault, $stopPropagation );
108
+		return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation);
109 109
 	}
110 110
 
111 111
 	/**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	 *        	code to execute
118 118
 	 * @return string
119 119
 	 */
120
-	public function contextmenu($element = 'this', $js = '') {
121
-		return $this->_add_event ( $element, $js, 'contextmenu' );
120
+	public function contextmenu($element='this', $js='') {
121
+		return $this->_add_event($element, $js, 'contextmenu');
122 122
 	}
123 123
 
124 124
 	/**
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 *        	code to execute
131 131
 	 * @return string
132 132
 	 */
133
-	public function dblclick($element = 'this', $js = '') {
134
-		return $this->_add_event ( $element, $js, 'dblclick' );
133
+	public function dblclick($element='this', $js='') {
134
+		return $this->_add_event($element, $js, 'dblclick');
135 135
 	}
136 136
 
137 137
 	/**
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *        	code to execute
144 144
 	 * @return string
145 145
 	 */
146
-	public function error($element = 'this', $js = '') {
147
-		return $this->_add_event ( $element, $js, 'error' );
146
+	public function error($element='this', $js='') {
147
+		return $this->_add_event($element, $js, 'error');
148 148
 	}
149 149
 
150 150
 	/**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	 *        	code to execute
157 157
 	 * @return string
158 158
 	 */
159
-	public function focus($element = 'this', $js = '') {
160
-		return $this->_add_event ( $element, $js, 'focus' );
159
+	public function focus($element='this', $js='') {
160
+		return $this->_add_event($element, $js, 'focus');
161 161
 	}
162 162
 
163 163
 	/**
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 *        	code for mouse out
171 171
 	 * @return string
172 172
 	 */
173
-	public function hover($element = 'this', $over = '', $out = '') {
174
-		$event = "\n\t$(" . Javascript::prep_element ( $element ) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n";
175
-		$this->jquery_code_for_compile [] = $event;
173
+	public function hover($element='this', $over='', $out='') {
174
+		$event="\n\t$(".Javascript::prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n";
175
+		$this->jquery_code_for_compile []=$event;
176 176
 		return $event;
177 177
 	}
178 178
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 *        	code to execute
186 186
 	 * @return string
187 187
 	 */
188
-	public function keydown($element = 'this', $js = '') {
189
-		return $this->_add_event ( $element, $js, 'keydown' );
188
+	public function keydown($element='this', $js='') {
189
+		return $this->_add_event($element, $js, 'keydown');
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 *        	code to execute
199 199
 	 * @return string
200 200
 	 */
201
-	public function keypress($element = 'this', $js = '') {
202
-		return $this->_add_event ( $element, $js, 'keypress' );
201
+	public function keypress($element='this', $js='') {
202
+		return $this->_add_event($element, $js, 'keypress');
203 203
 	}
204 204
 
205 205
 	/**
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 	 *        	code to execute
212 212
 	 * @return string
213 213
 	 */
214
-	public function keyup($element = 'this', $js = '') {
215
-		return $this->_add_event ( $element, $js, 'keyup' );
214
+	public function keyup($element='this', $js='') {
215
+		return $this->_add_event($element, $js, 'keyup');
216 216
 	}
217 217
 
218 218
 	/**
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 *        	code to execute
225 225
 	 * @return string
226 226
 	 */
227
-	public function load($element = 'this', $js = '') {
228
-		return $this->_add_event ( $element, $js, 'load' );
227
+	public function load($element='this', $js='') {
228
+		return $this->_add_event($element, $js, 'load');
229 229
 	}
230 230
 
231 231
 	/**
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 *        	code to execute
238 238
 	 * @return string
239 239
 	 */
240
-	public function mousedown($element = 'this', $js = '') {
241
-		return $this->_add_event ( $element, $js, 'mousedown' );
240
+	public function mousedown($element='this', $js='') {
241
+		return $this->_add_event($element, $js, 'mousedown');
242 242
 	}
243 243
 
244 244
 	/**
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 *        	code to execute
251 251
 	 * @return string
252 252
 	 */
253
-	public function mouseout($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) {
254
-		return $this->_add_event ( $element, $js, 'mouseout', $preventDefault, $stopPropagation );
253
+	public function mouseout($element='this', $js='', $preventDefault=false, $stopPropagation=false) {
254
+		return $this->_add_event($element, $js, 'mouseout', $preventDefault, $stopPropagation);
255 255
 	}
256 256
 
257 257
 	/**
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 *        	code to execute
264 264
 	 * @return string
265 265
 	 */
266
-	public function mouseleave($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) {
267
-		return $this->_add_event ( $element, $js, 'mouseleave', $preventDefault, $stopPropagation );
266
+	public function mouseleave($element='this', $js='', $preventDefault=false, $stopPropagation=false) {
267
+		return $this->_add_event($element, $js, 'mouseleave', $preventDefault, $stopPropagation);
268 268
 	}
269 269
 
270 270
 	/**
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 	 *        	code to execute
277 277
 	 * @return string
278 278
 	 */
279
-	public function mouseenter($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) {
280
-		return $this->_add_event ( $element, $js, 'mouseenter', $preventDefault, $stopPropagation );
279
+	public function mouseenter($element='this', $js='', $preventDefault=false, $stopPropagation=false) {
280
+		return $this->_add_event($element, $js, 'mouseenter', $preventDefault, $stopPropagation);
281 281
 	}
282 282
 
283 283
 	/**
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 *        	code to execute
290 290
 	 * @return string
291 291
 	 */
292
-	public function mouseover($element = 'this', $js = '') {
293
-		return $this->_add_event ( $element, $js, 'mouseover' );
292
+	public function mouseover($element='this', $js='') {
293
+		return $this->_add_event($element, $js, 'mouseover');
294 294
 	}
295 295
 
296 296
 	/**
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 *        	code to execute
303 303
 	 * @return string
304 304
 	 */
305
-	public function mouseup($element = 'this', $js = '') {
306
-		return $this->_add_event ( $element, $js, 'mouseup' );
305
+	public function mouseup($element='this', $js='') {
306
+		return $this->_add_event($element, $js, 'mouseup');
307 307
 	}
308 308
 
309 309
 	/**
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 	 *        	code to execute
316 316
 	 * @return string
317 317
 	 */
318
-	public function unload($element = 'this', $js = '') {
319
-		return $this->_add_event ( $element, $js, 'unload' );
318
+	public function unload($element='this', $js='') {
319
+		return $this->_add_event($element, $js, 'unload');
320 320
 	}
321 321
 
322 322
 	// --------------------------------------------------------------------
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 	 *        	code to execute
330 330
 	 * @return string
331 331
 	 */
332
-	public function resize($element = 'this', $js = '') {
333
-		return $this->_add_event ( $element, $js, 'resize' );
332
+	public function resize($element='this', $js='') {
333
+		return $this->_add_event($element, $js, 'resize');
334 334
 	}
335 335
 
336 336
 	// --------------------------------------------------------------------
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 *        	code to execute
344 344
 	 * @return string
345 345
 	 */
346
-	public function scroll($element = 'this', $js = '') {
347
-		return $this->_add_event ( $element, $js, 'scroll' );
346
+	public function scroll($element='this', $js='') {
347
+		return $this->_add_event($element, $js, 'scroll');
348 348
 	}
349 349
 }
Please login to merge, or discard this patch.