Test Setup Failed
Branch master (9866f3)
by Eric Claver
07:57
created
src/Domain/Repository/AbstractRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 	 * @return array
83 83
 	 */
84 84
 	protected function _tableArray() {
85
-		return include dirname(dirname(__DIR__)). '/Config/tables.config.php';
85
+		return include dirname(dirname(__DIR__)).'/Config/tables.config.php';
86 86
 	}
87 87
 	protected function isValidQueryBuilder($builder) {
88 88
 		if ( ! $builder instanceof QueryInterface) {
Please login to merge, or discard this patch.
src/Utils/UserAgent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@
 block discarded – undo
80 80
         $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
81 81
         $remote  = $_SERVER['REMOTE_ADDR'];
82 82
 
83
-        if(filter_var($client, FILTER_VALIDATE_IP))
83
+        if (filter_var($client, FILTER_VALIDATE_IP))
84 84
         {
85 85
             $ip = $client;
86 86
         }
87
-        elseif(filter_var($forward, FILTER_VALIDATE_IP))
87
+        elseif (filter_var($forward, FILTER_VALIDATE_IP))
88 88
         {
89 89
             $ip = $forward;
90 90
         }
Please login to merge, or discard this patch.
src/Utils/CsvParser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
      * @param   delimiter  string  The values delimiter (e.g. ";" or ",").
44 44
      * @return  array
45 45
      */
46
-    public function parse($filepath=FALSE, $column_headers=FALSE, $detect_line_endings=FALSE, $initial_line=FALSE, $delimiter=FALSE)
46
+    public function parse($filepath = FALSE, $column_headers = FALSE, $detect_line_endings = FALSE, $initial_line = FALSE, $delimiter = FALSE)
47 47
     {
48 48
         // Raise memory limit (for big files)
49 49
         ini_set('memory_limit', '128M');
50 50
         
51 51
         // File path
52
-        if(! $filepath)
52
+        if ( ! $filepath)
53 53
         {
54 54
             $filepath = $this->_get_filepath();    
55 55
         }
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
         }
61 61
 
62 62
         // If file doesn't exists, return false
63
-        if(! file_exists($filepath))
63
+        if ( ! file_exists($filepath))
64 64
         {
65 65
             return FALSE;            
66 66
         }
67 67
 
68 68
         // auto detect row endings
69
-        if(! $detect_line_endings)
69
+        if ( ! $detect_line_endings)
70 70
         {
71 71
             $detect_line_endings = $this->_get_detect_line_endings();    
72 72
         }
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         // If true, auto detect row endings
80
-        if($detect_line_endings) 
80
+        if ($detect_line_endings) 
81 81
         {
82 82
             ini_set("auto_detect_line_endings", TRUE);
83 83
         }
84 84
 
85 85
         // Parse from this line on
86
-        if(! $initial_line)
86
+        if ( ! $initial_line)
87 87
         {
88 88
             $initial_line = $this->_get_initial_line();    
89 89
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         }
94 94
 
95 95
         // Delimiter
96
-        if(! $delimiter)
96
+        if ( ! $delimiter)
97 97
         {
98 98
             $delimiter = $this->_get_delimiter();    
99 99
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         // Column headers
107
-        if(! $column_headers)
107
+        if ( ! $column_headers)
108 108
         {
109 109
             $column_headers = $this->_get_column_headers();    
110 110
         }
@@ -123,17 +123,17 @@  discard block
 block discarded – undo
123 123
         {     
124 124
             if ($data[0] != NULL) 
125 125
             {
126
-                if($row < $this->initial_line)
126
+                if ($row < $this->initial_line)
127 127
                 {
128 128
                     $row++;
129 129
                     continue;
130 130
                 }
131 131
 
132 132
                 // If first row, parse for column_headers
133
-                if($row == $this->initial_line)
133
+                if ($row == $this->initial_line)
134 134
                 {
135 135
                     // If column_headers already provided, use them
136
-                    if($this->column_headers)
136
+                    if ($this->column_headers)
137 137
                     {
138 138
                         foreach ($this->column_headers as $key => $value)
139 139
                         {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                 else
152 152
                 {
153 153
                     $new_row = $row - $this->initial_line - 1; // needed so that the returned array starts at 0 instead of 1
154
-                    foreach($column_headers as $key => $value) // assumes there are as many columns as their are title columns
154
+                    foreach ($column_headers as $key => $value) // assumes there are as many columns as their are title columns
155 155
                     {
156 156
                     $result[$new_row][$value] = utf8_encode(trim($data[$key]));
157 157
                     }
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
      * @param   column_headers  array   Alternate column_headers that will be used instead of first line of CSV
322 322
      * @return  void
323 323
      */
324
-    private function _set_column_headers($column_headers='')
324
+    private function _set_column_headers($column_headers = '')
325 325
     {
326
-        if(is_array($column_headers) && !empty($column_headers))
326
+        if (is_array($column_headers) && ! empty($column_headers))
327 327
         {
328 328
             $this->column_headers = $column_headers;
329 329
         }
Please login to merge, or discard this patch.
src/Extensions/Database/Builder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		$this->db = $this->__connect();
29 29
 	}
30 30
 	public function getConfig() {
31
-		return include dirname(dirname(__DIR__)). '/Config/'.$this->cms.'.config.php';
31
+		return include dirname(dirname(__DIR__)).'/Config/'.$this->cms.'.config.php';
32 32
 	}
33 33
 	private function __connect() {
34 34
 		$config = $this->getConfig();
Please login to merge, or discard this patch.
src/Extensions/Database/DB.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
 namespace Mmanager\Extensions\Database;
21 21
 
22 22
 final class DB {
23
-	public static function connect($host,$usr,$pw,$db) { 
23
+	public static function connect($host, $usr, $pw, $db) { 
24 24
 		try {
25
-			$mysqli = new \Mysqli($host,$usr,$pw,$db);
25
+			$mysqli = new \Mysqli($host, $usr, $pw, $db);
26 26
 			return true;
27 27
 		} catch (mysqli_sql_exception $e) {
28 28
 			throw $e;
Please login to merge, or discard this patch.
src/Extensions/Database/ezSQLcore.php 1 patch
Spacing   +84 added lines, -87 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	class ezSQLcore
28 28
 	{
29 29
 
30
-		var $trace            = false;  // same as $debug_all
31
-		var $debug_all        = false;  // same as $trace
30
+		var $trace            = false; // same as $debug_all
31
+		var $debug_all        = false; // same as $trace
32 32
 		var $debug_called     = false;
33 33
 		var $vardump_called   = false;
34 34
 		var $show_errors      = true;
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 		*  Returns array of host and port. If port is omitted, returns $default
69 69
 		*/
70 70
 
71
-		function get_host_port( $host, $default = false )
71
+		function get_host_port($host, $default = false)
72 72
 		{
73 73
 			$port = $default;
74
-			if ( false !== strpos( $host, ':' ) ) {
75
-				list( $host, $port ) = explode( ':', $host );
74
+			if (false !== strpos($host, ':')) {
75
+				list($host, $port) = explode(':', $host);
76 76
 				$port = (int) $port;
77 77
 			}
78
-			return array( $host, $port );
78
+			return array($host, $port);
79 79
 		}
80 80
 
81 81
 		/**********************************************************************
@@ -88,8 +88,7 @@  discard block
 block discarded – undo
88 88
 			$this->last_error = $err_str;
89 89
 
90 90
 			// Capture all errors to an error array no matter what happens
91
-			$this->captured_errors[] = array
92
-			(
91
+			$this->captured_errors[] = array(
93 92
 				'error_str' => $err_str,
94 93
 				'query'     => $this->last_query
95 94
 			);
@@ -126,63 +125,63 @@  discard block
 block discarded – undo
126 125
 		*  Get one variable from the DB - see docs for more detail
127 126
 		*/
128 127
 
129
-		function get_var($query=null,$x=0,$y=0)
128
+		function get_var($query = null, $x = 0, $y = 0)
130 129
 		{
131 130
 
132 131
 			// Log how the function was called
133 132
 			$this->func_call = "\$db->get_var(\"$query\",$x,$y)";
134 133
 
135 134
 			// If there is a query then perform it if not then use cached results..
136
-			if ( $query )
135
+			if ($query)
137 136
 			{
138 137
 				$this->query($query);
139 138
 			}
140 139
 
141 140
 			// Extract var out of cached results based x,y vals
142
-			if ( $this->last_result[$y] )
141
+			if ($this->last_result[$y])
143 142
 			{
144 143
 				$values = array_values(get_object_vars($this->last_result[$y]));
145 144
 			}
146 145
 
147 146
 			// If there is a value return it else return null
148
-			return (isset($values[$x]) && $values[$x]!=='')?$values[$x]:null;
147
+			return (isset($values[$x]) && $values[$x] !== '') ? $values[$x] : null;
149 148
 		}
150 149
 
151 150
 		/**********************************************************************
152 151
 		*  Get one row from the DB - see docs for more detail
153 152
 		*/
154 153
 
155
-		function get_row($query=null,$output=OBJECT,$y=0)
154
+		function get_row($query = null, $output = OBJECT, $y = 0)
156 155
 		{
157 156
 
158 157
 			// Log how the function was called
159 158
 			$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
160 159
 
161 160
 			// If there is a query then perform it if not then use cached results..
162
-			if ( $query )
161
+			if ($query)
163 162
 			{
164 163
 				$this->query($query);
165 164
 			}
166 165
 
167 166
 			// If the output is an object then return object using the row offset..
168
-			if ( $output == OBJECT )
167
+			if ($output == OBJECT)
169 168
 			{
170
-				return $this->last_result[$y]?$this->last_result[$y]:null;
169
+				return $this->last_result[$y] ? $this->last_result[$y] : null;
171 170
 			}
172 171
 			// If the output is an associative array then return row as such..
173
-			elseif ( $output == ARRAY_A )
172
+			elseif ($output == ARRAY_A)
174 173
 			{
175
-				return $this->last_result[$y]?get_object_vars($this->last_result[$y]):null;
174
+				return $this->last_result[$y] ?get_object_vars($this->last_result[$y]) : null;
176 175
 			}
177 176
 			// If the output is an numerical array then return row as such..
178
-			elseif ( $output == ARRAY_N )
177
+			elseif ($output == ARRAY_N)
179 178
 			{
180
-				return $this->last_result[$y]?array_values(get_object_vars($this->last_result[$y])):null;
179
+				return $this->last_result[$y] ?array_values(get_object_vars($this->last_result[$y])) : null;
181 180
 			}
182 181
 			// If invalid output type was specified..
183 182
 			else
184 183
 			{
185
-				$this->show_errors ? trigger_error(" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N",E_USER_WARNING) : null;
184
+				$this->show_errors ? trigger_error(" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N", E_USER_WARNING) : null;
186 185
 			}
187 186
 
188 187
 		}
@@ -192,22 +191,22 @@  discard block
 block discarded – undo
192 191
 		*  see docs for usage and info
193 192
 		*/
194 193
 
195
-		function get_col($query=null,$x=0)
194
+		function get_col($query = null, $x = 0)
196 195
 		{
197 196
 
198 197
 			$new_array = array();
199 198
 
200 199
 			// If there is a query then perform it if not then use cached results..
201
-			if ( $query )
200
+			if ($query)
202 201
 			{
203 202
 				$this->query($query);
204 203
 			}
205 204
 
206 205
 			// Extract the column values
207 206
 			$j = count($this->last_result);
208
-			for ( $i=0; $i < $j; $i++ )
207
+			for ($i = 0; $i < $j; $i++)
209 208
 			{
210
-				$new_array[$i] = $this->get_var(null,$x,$i);
209
+				$new_array[$i] = $this->get_var(null, $x, $i);
211 210
 			}
212 211
 
213 212
 			return $new_array;
@@ -218,34 +217,34 @@  discard block
 block discarded – undo
218 217
 		*  Return the the query as a result set - see docs for more details
219 218
 		*/
220 219
 
221
-		function get_results($query=null, $output = OBJECT)
220
+		function get_results($query = null, $output = OBJECT)
222 221
 		{
223 222
 
224 223
 			// Log how the function was called
225 224
 			$this->func_call = "\$db->get_results(\"$query\", $output)";
226 225
 
227 226
 			// If there is a query then perform it if not then use cached results..
228
-			if ( $query )
227
+			if ($query)
229 228
 			{
230 229
 				$this->query($query);
231 230
 			}
232 231
 
233 232
 			// Send back array of objects. Each row is an object
234
-			if ( $output == OBJECT )
233
+			if ($output == OBJECT)
235 234
 			{
236 235
 				return $this->last_result;
237 236
 			}
238
-			elseif ( $output == ARRAY_A || $output == ARRAY_N )
237
+			elseif ($output == ARRAY_A || $output == ARRAY_N)
239 238
 			{
240
-				if ( $this->last_result )
239
+				if ($this->last_result)
241 240
 				{
242
-					$i=0;
243
-					foreach( $this->last_result as $row )
241
+					$i = 0;
242
+					foreach ($this->last_result as $row)
244 243
 					{
245 244
 
246 245
 						$new_array[$i] = get_object_vars($row);
247 246
 
248
-						if ( $output == ARRAY_N )
247
+						if ($output == ARRAY_N)
249 248
 						{
250 249
 							$new_array[$i] = array_values($new_array[$i]);
251 250
 						}
@@ -268,15 +267,15 @@  discard block
 block discarded – undo
268 267
 		* see docs for more info and usage
269 268
 		*/
270 269
 
271
-		function get_col_info($info_type="name",$col_offset=-1)
270
+		function get_col_info($info_type = "name", $col_offset = -1)
272 271
 		{
273 272
 
274
-			if ( $this->col_info )
273
+			if ($this->col_info)
275 274
 			{
276
-				if ( $col_offset == -1 )
275
+				if ($col_offset == -1)
277 276
 				{
278
-					$i=0;
279
-					foreach($this->col_info as $col )
277
+					$i = 0;
278
+					foreach ($this->col_info as $col)
280 279
 					{
281 280
 						$new_array[$i] = $col->{$info_type};
282 281
 						$i++;
@@ -296,33 +295,32 @@  discard block
 block discarded – undo
296 295
 		*  store_cache
297 296
 		*/
298 297
 
299
-		function store_cache($query,$is_insert)
298
+		function store_cache($query, $is_insert)
300 299
 		{
301 300
 
302 301
 			// The would be cache file for this query
303 302
 			$cache_file = $this->cache_dir.'/'.md5($query);
304 303
 
305 304
 			// disk caching of queries
306
-			if ( $this->use_disk_cache && ( $this->cache_queries && ! $is_insert ) || ( $this->cache_inserts && $is_insert ))
305
+			if ($this->use_disk_cache && ($this->cache_queries && ! $is_insert) || ($this->cache_inserts && $is_insert))
307 306
 			{
308
-				if ( ! is_dir($this->cache_dir) )
307
+				if ( ! is_dir($this->cache_dir))
309 308
 				{
310 309
 					$this->register_error("Could not open cache dir: $this->cache_dir");
311
-					$this->show_errors ? trigger_error("Could not open cache dir: $this->cache_dir",E_USER_WARNING) : null;
310
+					$this->show_errors ? trigger_error("Could not open cache dir: $this->cache_dir", E_USER_WARNING) : null;
312 311
 				}
313 312
 				else
314 313
 				{
315 314
 					// Cache all result values
316
-					$result_cache = array
317
-					(
315
+					$result_cache = array(
318 316
 						'col_info' => $this->col_info,
319 317
 						'last_result' => $this->last_result,
320 318
 						'num_rows' => $this->num_rows,
321 319
 						'return_value' => $this->num_rows,
322 320
 					);
323 321
 					file_put_contents($cache_file, serialize($result_cache));
324
-					if( file_exists($cache_file . ".updating") )
325
-						unlink($cache_file . ".updating");
322
+					if (file_exists($cache_file.".updating"))
323
+						unlink($cache_file.".updating");
326 324
 				}
327 325
 			}
328 326
 
@@ -339,13 +337,13 @@  discard block
 block discarded – undo
339 337
 			$cache_file = $this->cache_dir.'/'.md5($query);
340 338
 
341 339
 			// Try to get previously cached version
342
-			if ( $this->use_disk_cache && file_exists($cache_file) )
340
+			if ($this->use_disk_cache && file_exists($cache_file))
343 341
 			{
344 342
 				// Only use this cache file if less than 'cache_timeout' (hours)
345
-				if ( (time() - filemtime($cache_file)) > ($this->cache_timeout*3600) &&
346
-					!(file_exists($cache_file . ".updating") && (time() - filemtime($cache_file . ".updating") < 60)) )
343
+				if ((time() - filemtime($cache_file)) > ($this->cache_timeout * 3600) &&
344
+					! (file_exists($cache_file.".updating") && (time() - filemtime($cache_file.".updating") < 60)))
347 345
 				{
348
-					touch($cache_file . ".updating"); // Show that we in the process of updating the cache
346
+					touch($cache_file.".updating"); // Show that we in the process of updating the cache
349 347
 				}
350 348
 				else
351 349
 				{
@@ -358,7 +356,7 @@  discard block
 block discarded – undo
358 356
 					$this->from_disk_cache = true;
359 357
 
360 358
 					// If debug ALL queries
361
-					$this->trace || $this->debug_all ? $this->debug() : null ;
359
+					$this->trace || $this->debug_all ? $this->debug() : null;
362 360
 
363 361
 					return $result_cache['return_value'];
364 362
 				}
@@ -371,7 +369,7 @@  discard block
 block discarded – undo
371 369
 		*  formatted and easy to understand way - any type: Object, Var or Array
372 370
 		*/
373 371
 
374
-		function vardump($mixed='')
372
+		function vardump($mixed = '')
375 373
 		{
376 374
 
377 375
 			// Start outup buffering
@@ -380,16 +378,16 @@  discard block
 block discarded – undo
380 378
 			echo "<p><table><tr><td bgcolor=ffffff><blockquote><font color=000090>";
381 379
 			echo "<pre><font face=arial>";
382 380
 
383
-			if ( ! $this->vardump_called )
381
+			if ( ! $this->vardump_called)
384 382
 			{
385 383
 				echo "<font color=800080><b>ezSQL</b> (v".EZSQL_VERSION.") <b>Variable Dump..</b></font>\n\n";
386 384
 			}
387 385
 
388
-			$var_type = gettype ($mixed);
389
-			print_r(($mixed?$mixed:"<font color=red>No Value / False</font>"));
390
-			echo "\n\n<b>Type:</b> " . ucfirst($var_type) . "\n";
391
-			echo "<b>Last Query</b> [$this->num_queries]<b>:</b> ".($this->last_query?$this->last_query:"NULL")."\n";
392
-			echo "<b>Last Function Call:</b> " . ($this->func_call?$this->func_call:"None")."\n";
386
+			$var_type = gettype($mixed);
387
+			print_r(($mixed ? $mixed : "<font color=red>No Value / False</font>"));
388
+			echo "\n\n<b>Type:</b> ".ucfirst($var_type)."\n";
389
+			echo "<b>Last Query</b> [$this->num_queries]<b>:</b> ".($this->last_query ? $this->last_query : "NULL")."\n";
390
+			echo "<b>Last Function Call:</b> ".($this->func_call ? $this->func_call : "None")."\n";
393 391
 			echo "<b>Last Rows Returned:</b> ".count($this->last_result)."\n";
394 392
 			echo "</font></pre></font></blockquote></td></tr></table>".$this->donation();
395 393
 			echo "\n<hr size=1 noshade color=dddddd>";
@@ -399,7 +397,7 @@  discard block
 block discarded – undo
399 397
 			ob_end_clean();
400 398
 
401 399
 			// Only echo output if it is turned on
402
-			if ( $this->debug_echo_is_on )
400
+			if ($this->debug_echo_is_on)
403 401
 			{
404 402
 				echo $html;
405 403
 			}
@@ -425,7 +423,7 @@  discard block
 block discarded – undo
425 423
 		* (abstracted into a seperate file to save server overhead).
426 424
 		*/
427 425
 
428
-		function debug($print_to_screen=true)
426
+		function debug($print_to_screen = true)
429 427
 		{
430 428
 
431 429
 			// Start outup buffering
@@ -434,17 +432,17 @@  discard block
 block discarded – undo
434 432
 			echo "<blockquote>";
435 433
 
436 434
 			// Only show ezSQL credits once..
437
-			if ( ! $this->debug_called )
435
+			if ( ! $this->debug_called)
438 436
 			{
439 437
 				echo "<font color=800080 face=arial size=2><b>ezSQL</b> (v".EZSQL_VERSION.") <b>Debug..</b></font><p>\n";
440 438
 			}
441 439
 
442
-			if ( $this->last_error )
440
+			if ($this->last_error)
443 441
 			{
444 442
 				echo "<font face=arial size=2 color=000099><b>Last Error --</b> [<font color=000000><b>$this->last_error</b></font>]<p>";
445 443
 			}
446 444
 
447
-			if ( $this->from_disk_cache )
445
+			if ($this->from_disk_cache)
448 446
 			{
449 447
 				echo "<font face=arial size=2 color=000099><b>Results retrieved from disk cache</b></font><p>";
450 448
 			}
@@ -455,7 +453,7 @@  discard block
 block discarded – undo
455 453
 				echo "<font face=arial size=2 color=000099><b>Query Result..</b></font>";
456 454
 				echo "<blockquote>";
457 455
 
458
-			if ( $this->col_info )
456
+			if ($this->col_info)
459 457
 			{
460 458
 
461 459
 				// =====================================================
@@ -465,11 +463,11 @@  discard block
 block discarded – undo
465 463
 				echo "<tr bgcolor=eeeeee><td nowrap valign=bottom><font color=555599 face=arial size=2><b>(row)</b></font></td>";
466 464
 
467 465
 
468
-				for ( $i=0, $j=count($this->col_info); $i < $j; $i++ )
466
+				for ($i = 0, $j = count($this->col_info); $i < $j; $i++)
469 467
 				{
470 468
 					/* when selecting count(*) the maxlengh is not set, size is set instead. */
471 469
 					echo "<td nowrap align=left valign=top><font size=1 color=555599 face=arial>{$this->col_info[$i]->type}";
472
-					if (!isset($this->col_info[$i]->max_length))
470
+					if ( ! isset($this->col_info[$i]->max_length))
473 471
 					{
474 472
 						echo "{$this->col_info[$i]->size}";
475 473
 					} else {
@@ -483,16 +481,16 @@  discard block
 block discarded – undo
483 481
 				// ======================================================
484 482
 				// print main results
485 483
 
486
-			if ( $this->last_result )
484
+			if ($this->last_result)
487 485
 			{
488 486
 
489
-				$i=0;
490
-				foreach ( $this->get_results(null,ARRAY_N) as $one_row )
487
+				$i = 0;
488
+				foreach ($this->get_results(null, ARRAY_N) as $one_row)
491 489
 				{
492 490
 					$i++;
493 491
 					echo "<tr bgcolor=ffffff><td bgcolor=eeeeee nowrap align=middle><font size=2 color=555599 face=arial>$i</font></td>";
494 492
 
495
-					foreach ( $one_row as $item )
493
+					foreach ($one_row as $item)
496 494
 					{
497 495
 						echo "<td nowrap><font face=arial size=2>$item</font></td>";
498 496
 					}
@@ -503,7 +501,7 @@  discard block
 block discarded – undo
503 501
 			} // if last result
504 502
 			else
505 503
 			{
506
-				echo "<tr bgcolor=ffffff><td colspan=".(count($this->col_info)+1)."><font face=arial size=2>No Results</font></td></tr>";
504
+				echo "<tr bgcolor=ffffff><td colspan=".(count($this->col_info) + 1)."><font face=arial size=2>No Results</font></td></tr>";
507 505
 			}
508 506
 
509 507
 			echo "</table>";
@@ -521,7 +519,7 @@  discard block
 block discarded – undo
521 519
 			ob_end_clean();
522 520
 
523 521
 			// Only echo output if it is turned on
524
-			if ( $this->debug_echo_is_on && $print_to_screen)
522
+			if ($this->debug_echo_is_on && $print_to_screen)
525 523
 			{
526 524
 				echo $html;
527 525
 			}
@@ -547,8 +545,8 @@  discard block
 block discarded – undo
547 545
 
548 546
 		function timer_get_cur()
549 547
 		{
550
-			list($usec, $sec) = explode(" ",microtime());
551
-			return ((float)$usec + (float)$sec);
548
+			list($usec, $sec) = explode(" ", microtime());
549
+			return ((float) $usec + (float) $sec);
552 550
 		}
553 551
 
554 552
 		function timer_start($timer_name)
@@ -558,15 +556,14 @@  discard block
 block discarded – undo
558 556
 
559 557
 		function timer_elapsed($timer_name)
560 558
 		{
561
-			return round($this->timer_get_cur() - $this->timers[$timer_name],2);
559
+			return round($this->timer_get_cur() - $this->timers[$timer_name], 2);
562 560
 		}
563 561
 
564 562
 		function timer_update_global($timer_name)
565 563
 		{
566
-			if ( $this->do_profile )
564
+			if ($this->do_profile)
567 565
 			{
568
-				$this->profile_times[] = array
569
-				(
566
+				$this->profile_times[] = array(
570 567
 					'query' => $this->last_query,
571 568
 					'time' => $this->timer_elapsed($timer_name)
572 569
 				);
@@ -595,30 +592,30 @@  discard block
 block discarded – undo
595 592
 
596 593
 		function get_set($params)
597 594
 		{
598
-			if( !is_array( $params ) )
595
+			if ( ! is_array($params))
599 596
 			{
600
-				$this->register_error( 'get_set() parameter invalid. Expected array in '.__FILE__.' on line '.__LINE__);
597
+				$this->register_error('get_set() parameter invalid. Expected array in '.__FILE__.' on line '.__LINE__);
601 598
 				return;
602 599
 			}
603 600
 			$sql = array();
604
-			foreach ( $params as $field => $val )
601
+			foreach ($params as $field => $val)
605 602
 			{
606
-				if ( $val === 'true' || $val === true )
603
+				if ($val === 'true' || $val === true)
607 604
 					$val = 1;
608
-				if ( $val === 'false' || $val === false )
605
+				if ($val === 'false' || $val === false)
609 606
 					$val = 0;
610 607
 
611
-				switch( $val ){
608
+				switch ($val) {
612 609
 					case 'NOW()' :
613 610
 					case 'NULL' :
614 611
 					  $sql[] = "$field = $val";
615 612
 						break;
616 613
 					default :
617
-						$sql[] = "$field = '".$this->escape( $val )."'";
614
+						$sql[] = "$field = '".$this->escape($val)."'";
618 615
 				}
619 616
 			}
620 617
 
621
-			return implode( ', ' , $sql );
618
+			return implode(', ', $sql);
622 619
 		}
623 620
 
624 621
 		/**
@@ -628,7 +625,7 @@  discard block
 block discarded – undo
628 625
 		 * @param bool $increase Set to true to increase query count (internal usage)
629 626
 		 * @return int Returns query count base on $all
630 627
 		 */
631
-		function count ($all = true, $increase = false) {
628
+		function count($all = true, $increase = false) {
632 629
 			if ($increase) {
633 630
 				$this->num_queries++;
634 631
 				$this->conn_queries++;
Please login to merge, or discard this patch.
src/Extensions/Database/ezSQL_mysqli.php 1 patch
Spacing   +54 added lines, -55 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
     
15 15
     global $ezsql_mysqli_str;
16 16
 
17
-	$ezsql_mysqli_str = array
18
-	(
17
+	$ezsql_mysqli_str = array(
19 18
 		1 => 'Require $dbuser and $dbpassword to connect to a database server',
20 19
 		2 => 'Error establishing mySQLi database connection. Correct user/password? Correct hostname? Database server running?',
21 20
 		3 => 'Require $dbname to select a database',
@@ -27,8 +26,8 @@  discard block
 block discarded – undo
27 26
 	*  ezSQL Database specific class - mySQLi
28 27
 	*/
29 28
 
30
-	if ( ! function_exists ('mysqli_connect') ) die('<b>Fatal Error:</b> ezSQL_mysql requires mySQLi Lib to be compiled and or linked in to the PHP engine');
31
-	if ( ! class_exists ('ezSQLcore') ) die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
29
+	if ( ! function_exists('mysqli_connect')) die('<b>Fatal Error:</b> ezSQL_mysql requires mySQLi Lib to be compiled and or linked in to the PHP engine');
30
+	if ( ! class_exists('ezSQLcore')) die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
32 31
 
33 32
 	class ezSQL_mysqli extends ezSQLcore
34 33
 	{
@@ -46,12 +45,12 @@  discard block
 block discarded – undo
46 45
 		*  same time as initialising the ezSQL_mysqli class
47 46
 		*/
48 47
 
49
-		function __construct($dbuser='', $dbpassword='', $dbname='', $dbhost='localhost', $encoding='')
48
+		function __construct($dbuser = '', $dbpassword = '', $dbname = '', $dbhost = 'localhost', $encoding = '')
50 49
 		{
51 50
 			$this->dbuser = $dbuser;
52 51
 			$this->dbpassword = $dbpassword;
53 52
 			$this->dbname = $dbname;
54
-			list( $this->dbhost, $this->dbport ) = $this->get_host_port( $dbhost, 3306 );
53
+			list($this->dbhost, $this->dbport) = $this->get_host_port($dbhost, 3306);
55 54
 			$this->encoding = $encoding;
56 55
 		}
57 56
 
@@ -60,11 +59,11 @@  discard block
 block discarded – undo
60 59
 		*  and select a mySQL database at the same time
61 60
 		*/
62 61
 
63
-		function quick_connect($dbuser='', $dbpassword='', $dbname='', $dbhost='localhost', $dbport='3306', $encoding='')
62
+		function quick_connect($dbuser = '', $dbpassword = '', $dbname = '', $dbhost = 'localhost', $dbport = '3306', $encoding = '')
64 63
 		{
65 64
 			$return_val = false;
66
-			if ( ! $this->connect($dbuser, $dbpassword, $dbhost, $dbport) ) ;
67
-			else if ( ! $this->select($dbname,$encoding) ) ;
65
+			if ( ! $this->connect($dbuser, $dbpassword, $dbhost, $dbport));
66
+			else if ( ! $this->select($dbname, $encoding));
68 67
 			else $return_val = true;
69 68
 			return $return_val;
70 69
 		}
@@ -73,7 +72,7 @@  discard block
 block discarded – undo
73 72
 		*  Try to connect to mySQL database server
74 73
 		*/
75 74
 
76
-		function connect($dbuser='', $dbpassword='', $dbhost='localhost', $dbport=false)
75
+		function connect($dbuser = '', $dbpassword = '', $dbhost = 'localhost', $dbport = false)
77 76
 		{
78 77
 			global $ezsql_mysqli_str; $return_val = false;
79 78
 			
@@ -81,25 +80,25 @@  discard block
 block discarded – undo
81 80
 			$this->timer_start('db_connect_time');
82 81
 			
83 82
 			// If port not specified (new connection issued), get it
84
-			if( ! $dbport ) {
85
-				list( $dbhost, $dbport ) = $this->get_host_port( $dbhost, 3306 );
83
+			if ( ! $dbport) {
84
+				list($dbhost, $dbport) = $this->get_host_port($dbhost, 3306);
86 85
 			}
87 86
 			
88 87
 			// Must have a user and a password
89
-			if ( ! $dbuser )
88
+			if ( ! $dbuser)
90 89
 			{
91 90
 				$this->register_error($ezsql_mysqli_str[1].' in '.__FILE__.' on line '.__LINE__);
92
-				$this->show_errors ? trigger_error($ezsql_mysqli_str[1],E_USER_WARNING) : null;
91
+				$this->show_errors ? trigger_error($ezsql_mysqli_str[1], E_USER_WARNING) : null;
93 92
 			}
94 93
 			// Try to establish the server database handle
95 94
 			else
96 95
 			{
97
-				$this->dbh = new \Mysqli($dbhost,$dbuser,$dbpassword, '', $dbport);
96
+				$this->dbh = new \Mysqli($dbhost, $dbuser, $dbpassword, '', $dbport);
98 97
 				// Check for connection problem
99
-				if( $this->dbh->connect_errno )
98
+				if ($this->dbh->connect_errno)
100 99
 				{
101 100
 					$this->register_error($ezsql_mysqli_str[2].' in '.__FILE__.' on line '.__LINE__);
102
-					$this->show_errors ? trigger_error($ezsql_mysqli_str[2],E_USER_WARNING) : null;
101
+					$this->show_errors ? trigger_error($ezsql_mysqli_str[2], E_USER_WARNING) : null;
103 102
 				}
104 103
 				else
105 104
 				{
@@ -120,47 +119,47 @@  discard block
 block discarded – undo
120 119
 		*  Try to select a mySQL database
121 120
 		*/
122 121
 
123
-		function select($dbname='', $encoding='')
122
+		function select($dbname = '', $encoding = '')
124 123
 		{
125 124
 			global $ezsql_mysqli_str; $return_val = false;
126 125
 
127 126
 			// Must have a database name
128
-			if ( ! $dbname )
127
+			if ( ! $dbname)
129 128
 			{
130 129
 				$this->register_error($ezsql_mysqli_str[3].' in '.__FILE__.' on line '.__LINE__);
131
-				$this->show_errors ? trigger_error($ezsql_mysqli_str[3],E_USER_WARNING) : null;
130
+				$this->show_errors ? trigger_error($ezsql_mysqli_str[3], E_USER_WARNING) : null;
132 131
 			}
133 132
 
134 133
 			// Must have an active database connection
135
-			else if ( ! $this->dbh )
134
+			else if ( ! $this->dbh)
136 135
 			{
137 136
 				$this->register_error($ezsql_mysqli_str[4].' in '.__FILE__.' on line '.__LINE__);
138
-				$this->show_errors ? trigger_error($ezsql_mysqli_str[4],E_USER_WARNING) : null;
137
+				$this->show_errors ? trigger_error($ezsql_mysqli_str[4], E_USER_WARNING) : null;
139 138
 			}
140 139
 
141 140
 			// Try to connect to the database
142
-			else if ( !@$this->dbh->select_db($dbname) )
141
+			else if ( ! @$this->dbh->select_db($dbname))
143 142
 			{
144 143
 				// Try to get error supplied by mysql if not use our own
145
-				if ( !$str = @$this->dbh->error)
144
+				if ( ! $str = @$this->dbh->error)
146 145
 					  $str = $ezsql_mysqli_str[5];
147 146
 
148 147
 				$this->register_error($str.' in '.__FILE__.' on line '.__LINE__);
149
-				$this->show_errors ? trigger_error($str,E_USER_WARNING) : null;
148
+				$this->show_errors ? trigger_error($str, E_USER_WARNING) : null;
150 149
 			}
151 150
 			else
152 151
 			{
153 152
 				$this->dbname = $dbname;
154
-				if($encoding!='')
153
+				if ($encoding != '')
155 154
 				{
156
-					$encoding = strtolower(str_replace("-","",$encoding));
155
+					$encoding = strtolower(str_replace("-", "", $encoding));
157 156
 					$charsets = array();
158 157
 					$result = $this->dbh->query("SHOW CHARACTER SET");
159
-					while($row = $result->fetch_array(MYSQLI_ASSOC))
158
+					while ($row = $result->fetch_array(MYSQLI_ASSOC))
160 159
 					{
161 160
 						$charsets[] = $row["Charset"];
162 161
 					}
163
-					if(in_array($encoding,$charsets)){
162
+					if (in_array($encoding, $charsets)) {
164 163
 						$this->dbh->set_charset($encoding);
165 164
 					}
166 165
 				}
@@ -179,13 +178,13 @@  discard block
 block discarded – undo
179 178
 		function escape($str)
180 179
 		{
181 180
 			// If there is no existing database connection then try to connect
182
-			if ( ! isset($this->dbh) || ! $this->dbh )
181
+			if ( ! isset($this->dbh) || ! $this->dbh)
183 182
 			{
184 183
 				$this->connect($this->dbuser, $this->dbpassword, $this->dbhost, $this->dbport);
185 184
 				$this->select($this->dbname, $this->encoding);
186 185
 			}
187 186
                         
188
-                        if ( get_magic_quotes_gpc() ) {
187
+                        if (get_magic_quotes_gpc()) {
189 188
 				$str = stripslashes($str);
190 189
                         }                        
191 190
 
@@ -210,10 +209,10 @@  discard block
 block discarded – undo
210 209
 		{
211 210
 
212 211
 			// This keeps the connection alive for very long running scripts
213
-			if ( $this->count(false) >= 500 )
212
+			if ($this->count(false) >= 500)
214 213
 			{
215 214
 				$this->disconnect();
216
-				$this->quick_connect($this->dbuser,$this->dbpassword,$this->dbname,$this->dbhost,$this->dbport,$this->encoding);
215
+				$this->quick_connect($this->dbuser, $this->dbpassword, $this->dbname, $this->dbhost, $this->dbport, $this->encoding);
217 216
 			}
218 217
 
219 218
 			// Initialise return
@@ -238,13 +237,13 @@  discard block
 block discarded – undo
238 237
 			$this->timer_start($this->num_queries);
239 238
 
240 239
 			// Use core file cache function
241
-			if ( $cache = $this->get_cache($query) )
240
+			if ($cache = $this->get_cache($query))
242 241
 			{
243 242
 				// Keep tack of how long all queries have taken
244 243
 				$this->timer_update_global($this->num_queries);
245 244
 
246 245
 				// Trace all queries
247
-				if ( $this->use_trace_log )
246
+				if ($this->use_trace_log)
248 247
 				{
249 248
 					$this->trace_log[] = $this->debug(false);
250 249
 				}
@@ -253,12 +252,12 @@  discard block
 block discarded – undo
253 252
 			}
254 253
 
255 254
 			// If there is no existing database connection then try to connect
256
-			if ( ! isset($this->dbh) || ! $this->dbh )
255
+			if ( ! isset($this->dbh) || ! $this->dbh)
257 256
 			{
258 257
 				$this->connect($this->dbuser, $this->dbpassword, $this->dbhost, $this->dbport);
259
-				$this->select($this->dbname,$this->encoding);
258
+				$this->select($this->dbname, $this->encoding);
260 259
 				// No existing connection at this point means the server is unreachable
261
-				if ( ! isset($this->dbh) || ! $this->dbh || $this->dbh->connect_errno )
260
+				if ( ! isset($this->dbh) || ! $this->dbh || $this->dbh->connect_errno)
262 261
 					return false;
263 262
 			}
264 263
 
@@ -266,21 +265,21 @@  discard block
 block discarded – undo
266 265
 			$this->result = @$this->dbh->query($query);
267 266
 
268 267
 			// If there is an error then take note of it..
269
-			if ( $str = @$this->dbh->error )
268
+			if ($str = @$this->dbh->error)
270 269
 			{
271 270
 				$this->register_error($str);
272
-				$this->show_errors ? trigger_error($str,E_USER_WARNING) : null;
271
+				$this->show_errors ? trigger_error($str, E_USER_WARNING) : null;
273 272
 				return false;
274 273
 			}
275 274
 
276 275
 			// Query was a Data Manipulation Query (insert, delete, update, replace, ...)
277
-			if ( !is_object($this->result) )
276
+			if ( ! is_object($this->result))
278 277
 			{
279 278
 				$is_insert = true;
280 279
 				$this->rows_affected = @$this->dbh->affected_rows;
281 280
 
282 281
 				// Take note of the insert_id
283
-				if ( preg_match("/^(insert|replace)\s+/i",$query) )
282
+				if (preg_match("/^(insert|replace)\s+/i", $query))
284 283
 				{
285 284
 					$this->insert_id = @$this->dbh->insert_id;
286 285
 				}
@@ -294,7 +293,7 @@  discard block
 block discarded – undo
294 293
 				$is_insert = false;
295 294
 
296 295
 				// Take note of column info
297
-				$i=0;
296
+				$i = 0;
298 297
 				while ($i < @$this->result->field_count)
299 298
 				{
300 299
 					$this->col_info[$i] = @$this->result->fetch_field();
@@ -302,8 +301,8 @@  discard block
 block discarded – undo
302 301
 				}
303 302
 
304 303
 				// Store Query Results
305
-				$num_rows=0;
306
-				while ( $row = @$this->result->fetch_object() )
304
+				$num_rows = 0;
305
+				while ($row = @$this->result->fetch_object())
307 306
 				{
308 307
 					// Store relults as an objects within main array
309 308
 					$this->last_result[$num_rows] = $row;
@@ -320,16 +319,16 @@  discard block
 block discarded – undo
320 319
 			}
321 320
 
322 321
 			// disk caching of queries
323
-			$this->store_cache($query,$is_insert);
322
+			$this->store_cache($query, $is_insert);
324 323
 
325 324
 			// If debug ALL queries
326
-			$this->trace || $this->debug_all ? $this->debug() : null ;
325
+			$this->trace || $this->debug_all ? $this->debug() : null;
327 326
 
328 327
 			// Keep tack of how long all queries have taken
329 328
 			$this->timer_update_global($this->num_queries);
330 329
 
331 330
 			// Trace all queries
332
-			if ( $this->use_trace_log )
331
+			if ($this->use_trace_log)
333 332
 			{
334 333
 				$this->trace_log[] = $this->debug(false);
335 334
 			}
@@ -368,21 +367,21 @@  discard block
 block discarded – undo
368 367
 		*/
369 368
 		function execute()
370 369
 		{
371
-			if($this->s_query != '')
370
+			if ($this->s_query != '')
372 371
 			{
373 372
 				$query = $this->s_query;
374 373
 
375
-				if(!empty($this->s_params))
374
+				if ( ! empty($this->s_params))
376 375
 				{
377
-					foreach($this->s_params as $param => $value)
376
+					foreach ($this->s_params as $param => $value)
378 377
 					{
379 378
 						$count = 0;
380 379
 						$query = str_replace($param, $value, $query, $count);
381
-						if($count == 0)
380
+						if ($count == 0)
382 381
 						{
383
-							$str = $query .' no parameter was changed';
384
-							$this->register_error($str .' in '.__FILE__.' on line '.__LINE__);
385
-							$this->show_errors ? trigger_error($str,E_USER_WARNING) : null;
382
+							$str = $query.' no parameter was changed';
383
+							$this->register_error($str.' in '.__FILE__.' on line '.__LINE__);
384
+							$this->show_errors ? trigger_error($str, E_USER_WARNING) : null;
386 385
 						}
387 386
 					}
388 387
 				}
Please login to merge, or discard this patch.
src/Extensions/Woocommerce/Functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,13 +133,13 @@
 block discarded – undo
133 133
 	public function wc_api_connect() {
134 134
 	    static $connection;
135 135
 	 
136
-	    if ( isset( $connection ) ) {
136
+	    if (isset($connection)) {
137 137
 	        return $connection;
138 138
 	    }
139 139
 	 
140 140
 	    $keys = $this->getUserKeys();
141 141
 
142
-	    if ( ! $keys ) {
142
+	    if ( ! $keys) {
143 143
 	        $connection = false;
144 144
 	 
145 145
 	        return $connection;
Please login to merge, or discard this patch.
src/Extensions/Mrepair/MRepair.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 		$fn = new Functions();
43 43
 		return $fn->generateRepairReference();
44 44
 	}
45
-	public static function implodeAddress($id=null, $context) {
45
+	public static function implodeAddress($id = null, $context) {
46 46
 		$fn = new Functions();
47 47
 		return $fn->implodeAddress($id, $context);
48 48
 	}
Please login to merge, or discard this patch.