Completed
Push — master ( 46434e...ad133e )
by Yannick
32:08 queued 16:03
created
registration-detailed.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 
6
-if (!isset($_GET['registration'])){
6
+if (!isset($_GET['registration'])) {
7 7
 	header('Location: '.$globalURL.'');
8 8
 } else {
9 9
 	$Spotter = new Spotter();
10 10
 	//calculuation for the pagination
11
-	if(!isset($_GET['limit']))
11
+	if (!isset($_GET['limit']))
12 12
 	{
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	$limit_next = $limit_end + $absolute_difference;
27 27
 	$limit_previous_1 = $limit_start - $absolute_difference;
28 28
 	$limit_previous_2 = $limit_end - $absolute_difference;
29
-	$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING);
30
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
29
+	$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
30
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
31 31
 	
32 32
 	$page_url = $globalURL.'/registration/'.$registration;
33 33
 	
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	
41 41
 	if (!empty($spotter_array))
42 42
 	{
43
-		$title = sprintf(_("Detailed View of aircraft with registration %s"),$registration);
43
+		$title = sprintf(_("Detailed View of aircraft with registration %s"), $registration);
44 44
 		require_once('header.php');
45 45
 		print '<div class="info column">';
46 46
 		print '<h1>'.$registration.' - '.$aircraft_array[0]['aircraft_name'].' ('.$aircraft_array[0]['aircraft_icao'].')</h1>';
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		
52 52
 		include('registration-sub-menu.php');
53 53
 		print '<div class="table column">';
54
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of aircraft with the registration <strong>%s</strong>."),$registration).'</p>';
54
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of aircraft with the registration <strong>%s</strong>."), $registration).'</p>';
55 55
 
56 56
 		include('table-output.php');
57 57
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
ident-statistics-manufacturer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
-$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
12
+$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort);
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Aircraft Manufacturer of %s"),$spotter_array[0]['ident']);
16
+	$title = sprintf(_("Most Common Aircraft Manufacturer of %s"), $spotter_array[0]['ident']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="info column">';
19 19
 	print '<h1>'.$spotter_array[0]['ident'].'</h1>';
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	include('ident-sub-menu.php');
25 25
 	print '<div class="column">';
26 26
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
27
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights using the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
27
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights using the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
28 28
 
29 29
 	$manufacturers_array = $Spotter->countAllAircraftManufacturerByIdent($ident);
30 30
 	if (!empty($manufacturers_array))
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		print '</thead>';
40 40
 		print '<tbody>';
41 41
 		$i = 1;
42
-		foreach($manufacturers_array as $manufacturer_item)
42
+		foreach ($manufacturers_array as $manufacturer_item)
43 43
 		{
44 44
 			print '<tr>';
45 45
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
footer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 	<?php
5 5
 	    if (isset($sql_time)) {
6 6
 	?>
7
-	<i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i>
7
+	<i><?php echo _("Page generated in").' '.round($sql_time + $page_time, 2); ?>s (<?php print round($page_time, 2); ?>ms PHP - <?php print round($sql_time, 2); ?>ms SQL)</i>
8 8
 	<br />
9 9
 	<?php
10 10
 	    }
Please login to merge, or discard this patch.
tools-acars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 $page_url = $globalURL.'/tools-acars';
10 10
 
11
-$message = filter_input(INPUT_POST,'acars_message',FILTER_SANITIZE_STRING);
11
+$message = filter_input(INPUT_POST, 'acars_message', FILTER_SANITIZE_STRING);
12 12
 
13 13
 print '<div class="info column">';
14 14
 print '<h1>'._("Parse ACARS messages").'</h1>';
Please login to merge, or discard this patch.
install/libs/sparqllib.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -10,37 +10,37 @@  discard block
 block discarded – undo
10 10
 
11 11
 # to document: CGIParams
12 12
 
13
-function sparql_connect( $endpoint ) { return new sparql_connection( $endpoint ); }
13
+function sparql_connect($endpoint) { return new sparql_connection($endpoint); }
14 14
 
15
-function sparql_ns( $short, $long, $db = null ) { return _sparql_a_connection( $db )->ns( $short, $long ); }
16
-function sparql_query( $sparql, $db = null ) { return _sparql_a_connection( $db )->query( $sparql ); }
17
-function sparql_errno( $db = null ) { return _sparql_a_connection( $db )->errno(); }
18
-function sparql_error( $db = null ) { return _sparql_a_connection( $db )->error(); }
15
+function sparql_ns($short, $long, $db = null) { return _sparql_a_connection($db)->ns($short, $long); }
16
+function sparql_query($sparql, $db = null) { return _sparql_a_connection($db)->query($sparql); }
17
+function sparql_errno($db = null) { return _sparql_a_connection($db)->errno(); }
18
+function sparql_error($db = null) { return _sparql_a_connection($db)->error(); }
19 19
 
20
-function sparql_fetch_array( $result ) { return $result->fetch_array(); }
21
-function sparql_num_rows( $result ) { return $result->num_rows(); }
22
-function sparql_field_array( $result ) { return $result->field_array(); }
23
-function sparql_field_name( $result, $i ) { return $result->field_name( $i ); }
20
+function sparql_fetch_array($result) { return $result->fetch_array(); }
21
+function sparql_num_rows($result) { return $result->num_rows(); }
22
+function sparql_field_array($result) { return $result->field_array(); }
23
+function sparql_field_name($result, $i) { return $result->field_name($i); }
24 24
 
25
-function sparql_fetch_all( $result ) { return $result->fetch_all(); }
25
+function sparql_fetch_all($result) { return $result->fetch_all(); }
26 26
 
27
-function sparql_get( $endpoint, $sparql ) 
27
+function sparql_get($endpoint, $sparql) 
28 28
 { 
29
-	$db = sparql_connect( $endpoint );
30
-	if( !$db ) { return; }
31
-	$result = $db->query( $sparql );
32
-	if( !$result ) { return; }
29
+	$db = sparql_connect($endpoint);
30
+	if (!$db) { return; }
31
+	$result = $db->query($sparql);
32
+	if (!$result) { return; }
33 33
 	return $result->fetch_all(); 
34 34
 }
35 35
 
36
-function _sparql_a_connection( $db )
36
+function _sparql_a_connection($db)
37 37
 {
38 38
 	global $sparql_last_connection;
39
-	if( !isset( $db ) )
39
+	if (!isset($db))
40 40
 	{
41
-		if( !isset( $sparql_last_connection ) )
41
+		if (!isset($sparql_last_connection))
42 42
 		{
43
-			print( "No currect SPARQL connection (connection) in play!" );
43
+			print("No currect SPARQL connection (connection) in play!");
44 44
 			return;
45 45
 		}
46 46
 		$db = $sparql_last_connection;
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	var $params = null;
63 63
 	# capabilities are either true, false or null if not yet tested.
64 64
 
65
-	function __construct( $endpoint )
65
+	function __construct($endpoint)
66 66
 	{
67 67
 		$this->endpoint = $endpoint;
68 68
 		global $sparql_last_connection;
69 69
 		$sparql_last_connection = $this;
70 70
 	}
71 71
 
72
-	function ns( $short, $long )
72
+	function ns($short, $long)
73 73
 	{
74 74
 		$this->ns[$short] = $long;
75 75
 	}
@@ -77,77 +77,77 @@  discard block
 block discarded – undo
77 77
 	function errno() { return $this->errno; }
78 78
 	function error() { return $this->error; }
79 79
 
80
-	function cgiParams( $params = null )
80
+	function cgiParams($params = null)
81 81
 	{
82
-		if( $params === null ) { return $this->params; }
83
-		if( $params === "" ) { $this->params = null; return; }
82
+		if ($params === null) { return $this->params; }
83
+		if ($params === "") { $this->params = null; return; }
84 84
 		$this->params = $params;
85 85
 	}
86 86
 
87
-	function query( $query, $timeout=null )
87
+	function query($query, $timeout = null)
88 88
 	{	
89 89
 		$prefixes = "";
90
-		foreach( $this->ns as $k=>$v )
90
+		foreach ($this->ns as $k=>$v)
91 91
 		{
92 92
 			$prefixes .= "PREFIX $k: <$v>\n";
93 93
 		}
94
-		$output = $this->dispatchQuery( $prefixes.$query, $timeout );
95
-		if( $this->errno ) { return; }
94
+		$output = $this->dispatchQuery($prefixes.$query, $timeout);
95
+		if ($this->errno) { return; }
96 96
 		$parser = new xx_xml($output, 'contents');
97
-		if( $parser->error() ) 
97
+		if ($parser->error()) 
98 98
 		{ 
99 99
 			$this->errno = -1; # to not clash with CURLOPT return; }
100 100
 			$this->error = $parser->error();
101 101
 			return;
102 102
 		}
103
-		return new sparql_result( $this, $parser->rows, $parser->fields );
103
+		return new sparql_result($this, $parser->rows, $parser->fields);
104 104
 	}
105 105
 
106
-	function alive( $timeout=3 )
106
+	function alive($timeout = 3)
107 107
 	{
108
-		$result = $this->query( "SELECT * WHERE { ?s ?p ?o } LIMIT 1", $timeout );
108
+		$result = $this->query("SELECT * WHERE { ?s ?p ?o } LIMIT 1", $timeout);
109 109
 
110
-		if( $this->errno ) { return false; }
110
+		if ($this->errno) { return false; }
111 111
 
112 112
 		return true;
113 113
 	}	
114 114
 
115
-	function dispatchQuery( $sparql, $timeout=null )
115
+	function dispatchQuery($sparql, $timeout = null)
116 116
 	{
117
-		$url = $this->endpoint."?query=".urlencode( $sparql );
118
-		if( $this->params !== null )
117
+		$url = $this->endpoint."?query=".urlencode($sparql);
118
+		if ($this->params !== null)
119 119
 		{
120 120
 			$url .= "&".$this->params;
121 121
 		}
122
-		if( $this->debug ) { print "<div class='debug'><a href='".htmlspecialchars($url)."'>".htmlspecialchars($prefixes.$query)."</a></div>\n"; }
122
+		if ($this->debug) { print "<div class='debug'><a href='".htmlspecialchars($url)."'>".htmlspecialchars($prefixes.$query)."</a></div>\n"; }
123 123
 		$this->errno = null;
124 124
 		$this->error = null;
125 125
 		$ch = curl_init($url);
126 126
 		#curl_setopt($ch, CURLOPT_HEADER, 1);
127
-		if( $timeout !== null )
127
+		if ($timeout !== null)
128 128
 		{
129
-			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout );
129
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
130 130
 		}
131 131
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
132
-		curl_setopt($ch, CURLOPT_HTTPHEADER,array (
132
+		curl_setopt($ch, CURLOPT_HTTPHEADER, array(
133 133
 			"Accept: application/sparql-results+xml"
134 134
 		));
135 135
 
136 136
 		$output = curl_exec($ch);      
137 137
 		$info = curl_getinfo($ch);
138
-		if(curl_errno($ch))
138
+		if (curl_errno($ch))
139 139
 		{
140
-			$this->errno = curl_errno( $ch );
141
-			$this->error = 'Curl error: ' . curl_error($ch);
140
+			$this->errno = curl_errno($ch);
141
+			$this->error = 'Curl error: '.curl_error($ch);
142 142
 			return;
143 143
 		}
144
-		if( $output === '' )
144
+		if ($output === '')
145 145
 		{
146 146
 			$this->errno = "-1";
147 147
 			$this->error = 'URL returned no data';
148 148
 			return;
149 149
 		}
150
-		if( $info['http_code'] != 200) 
150
+		if ($info['http_code'] != 200) 
151 151
 		{
152 152
 			$this->errno = $info['http_code'];
153 153
 			$this->error = 'Bad response, '.$info['http_code'].': '.$output;
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 
180 180
 	var $caps_cache;
181 181
 	var $caps_anysubject;
182
-	function capabilityCache( $filename, $dba_type='db4' )
182
+	function capabilityCache($filename, $dba_type = 'db4')
183 183
 	{
184
-		$this->caps_cache = dba_open($filename, "c", $dba_type );
184
+		$this->caps_cache = dba_open($filename, "c", $dba_type);
185 185
 	}
186 186
 	function capabilityCodes()
187 187
 	{
188
-		return array_keys( $this->caps_desc );
188
+		return array_keys($this->caps_desc);
189 189
 	}
190 190
 	function capabilityDescription($code)
191 191
 	{
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
 
195 195
 	# return true if the endpoint supports a capability
196 196
 	# nb. returns false if connecion isn't authoriased to use the feature, eg LOAD
197
-	function supports( $code ) 
197
+	function supports($code) 
198 198
 	{
199
-		if( isset( $this->caps[$code] ) ) { return $this->caps[$code]; }
199
+		if (isset($this->caps[$code])) { return $this->caps[$code]; }
200 200
 		$was_cached = false;
201
-		if( isset( $this->caps_cache ) )
201
+		if (isset($this->caps_cache))
202 202
 		{
203 203
 			$CACHE_TIMEOUT_SECONDS = 7*24*60*60;
204 204
 			$db_key = $this->endpoint.";".$code;
205
-			$db_val = dba_fetch( $db_key, $this->caps_cache );
206
-			if( $db_val !== false )
205
+			$db_val = dba_fetch($db_key, $this->caps_cache);
206
+			if ($db_val !== false)
207 207
 			{
208
-				list( $result, $when ) = preg_split( '/;/', $db_val );
209
-				if( $when + $CACHE_TIMEOUT_SECONDS > time() )
208
+				list($result, $when) = preg_split('/;/', $db_val);
209
+				if ($when + $CACHE_TIMEOUT_SECONDS > time())
210 210
 				{
211 211
 					return $result;
212 212
 				}
@@ -215,26 +215,26 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 		$r = null;
217 217
 
218
-		if( $code == "select" ) { $r = $this->test_select(); }
219
-		elseif( $code == "constant_as" ) { $r = $this->test_constant_as(); }
220
-		elseif( $code == "math_as" ) { $r = $this->test_math_as(); }
221
-		elseif( $code == "count" ) { $r = $this->test_count(); }
222
-		elseif( $code == "max" ) { $r = $this->test_max(); }
223
-		elseif( $code == "load" ) { $r = $this->test_load(); }
224
-		elseif( $code == "sample" ) { $r = $this->test_sample(); }
218
+		if ($code == "select") { $r = $this->test_select(); }
219
+		elseif ($code == "constant_as") { $r = $this->test_constant_as(); }
220
+		elseif ($code == "math_as") { $r = $this->test_math_as(); }
221
+		elseif ($code == "count") { $r = $this->test_count(); }
222
+		elseif ($code == "max") { $r = $this->test_max(); }
223
+		elseif ($code == "load") { $r = $this->test_load(); }
224
+		elseif ($code == "sample") { $r = $this->test_sample(); }
225 225
 		else { print "<p>Unknown capability code: '$code'</p>"; return false; }
226 226
 		$this->caps[$code] = $r;
227
-		if( isset( $this->caps_cache ) )
227
+		if (isset($this->caps_cache))
228 228
 		{
229 229
 			$db_key = $this->endpoint.";".$code;
230 230
 			$db_val = $r.";".time();
231
-			if( $was_cached )
231
+			if ($was_cached)
232 232
 			{
233
-				dba_replace( $db_key, $db_val, $this->caps_cache );
233
+				dba_replace($db_key, $db_val, $this->caps_cache);
234 234
 			}
235 235
 			else
236 236
 			{
237
-				dba_insert( $db_key, $db_val, $this->caps_cache );
237
+				dba_insert($db_key, $db_val, $this->caps_cache);
238 238
 			}
239 239
 		}
240 240
 		return $r;
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
 
243 243
 	function anySubject()
244 244
 	{
245
-		if( !isset( $this->caps_anysubject ) )
245
+		if (!isset($this->caps_anysubject))
246 246
 		{
247 247
 			$results = $this->query( 
248 248
 			  "SELECT * WHERE { ?s ?p ?o } LIMIT 1" );
249
-			if( sizeof($results)) 
249
+			if (sizeof($results)) 
250 250
 			{
251 251
 				$row = $results->fetch_array();
252 252
 				$this->caps_anysubject = $row["s"];
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	{
261 261
 		$output = $this->dispatchQuery( 
262 262
 		  "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 1" );
263
-		return !isset( $this->errno );
263
+		return !isset($this->errno);
264 264
 	}
265 265
 
266 266
 	# return true if the endpoint supports AS
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	{
269 269
 		$output = $this->dispatchQuery( 
270 270
 		  "SELECT (1+2 AS ?bar) WHERE { ?s ?p ?o } LIMIT 1" );
271
-		return !isset( $this->errno );
271
+		return !isset($this->errno);
272 272
 	}
273 273
 
274 274
 	# return true if the endpoint supports AS
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	{
277 277
 		$output = $this->dispatchQuery( 
278 278
 		  "SELECT (\"foo\" AS ?bar) WHERE { ?s ?p ?o } LIMIT 1" );
279
-		return !isset( $this->errno );
279
+		return !isset($this->errno);
280 280
 	}
281 281
 
282 282
 	# return true if the endpoint supports SELECT (COUNT(?x) as ?n) ... GROUP BY 
@@ -284,35 +284,35 @@  discard block
 block discarded – undo
284 284
 	{
285 285
 		# assumes at least one rdf:type predicate
286 286
 		$s = $this->anySubject();
287
-		if( !isset($s) ) { return false; }
287
+		if (!isset($s)) { return false; }
288 288
 		$output = $this->dispatchQuery( 
289 289
 		  "SELECT (COUNT(?p) AS ?n) ?o WHERE { <$s> ?p ?o } GROUP BY ?o" );
290
-		return !isset( $this->errno );
290
+		return !isset($this->errno);
291 291
 	}
292 292
 
293 293
 	function test_max() 
294 294
 	{
295 295
 		$s = $this->anySubject();
296
-		if( !isset($s) ) { return false; }
296
+		if (!isset($s)) { return false; }
297 297
 		$output = $this->dispatchQuery( 
298 298
 		  "SELECT (MAX(?p) AS ?max) ?o WHERE { <$s> ?p ?o } GROUP BY ?o" );
299
-		return !isset( $this->errno );
299
+		return !isset($this->errno);
300 300
 	}
301 301
 
302 302
 	function test_sample() 
303 303
 	{
304 304
 		$s = $this->anySubject();
305
-		if( !isset($s) ) { return false; }
305
+		if (!isset($s)) { return false; }
306 306
 		$output = $this->dispatchQuery( 
307 307
 		  "SELECT (SAMPLE(?p) AS ?sam) ?o WHERE { <$s> ?p ?o } GROUP BY ?o" );
308
-		return !isset( $this->errno );
308
+		return !isset($this->errno);
309 309
 	}
310 310
 
311 311
 	function test_load() 
312 312
 	{
313 313
 		$output = $this->dispatchQuery( 
314 314
 		  "LOAD <http://graphite.ecs.soton.ac.uk/sparqllib/examples/loadtest.rdf>" );
315
-		return !isset( $this->errno );
315
+		return !isset($this->errno);
316 316
 	}
317 317
 
318 318
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	var $fields;
325 325
 	var $db;
326 326
 	var $i = 0;
327
-	function __construct( $db, $rows, $fields )
327
+	function __construct($db, $rows, $fields)
328 328
 	{
329 329
 		$this->rows = $rows;
330 330
 		$this->fields = $fields;
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
 
334 334
 	function fetch_array()
335 335
 	{
336
-		if( !@$this->rows[$this->i] ) { return; }
336
+		if (!@$this->rows[$this->i]) { return; }
337 337
 		$r = array();
338
-		foreach( $this->rows[$this->i++]  as $k=>$v )
338
+		foreach ($this->rows[$this->i++]  as $k=>$v)
339 339
 		{
340 340
 			$r[$k] = $v["value"];
341 341
 			$r["$k.type"] = $v["type"];
342
-			if( isset( $v["language"] ) )
342
+			if (isset($v["language"]))
343 343
 			{
344 344
 				$r["$k.language"] = $v["language"];
345 345
 			}
346
-			if( isset( $v["datatype"] ) )
346
+			if (isset($v["datatype"]))
347 347
 			{
348 348
 				$r["$k.datatype"] = $v["datatype"];
349 349
 			}
@@ -355,16 +355,16 @@  discard block
 block discarded – undo
355 355
 	{
356 356
 		$r = new sparql_results();
357 357
 		$r->fields = $this->fields;
358
-		foreach( $this->rows as $i=>$row )
358
+		foreach ($this->rows as $i=>$row)
359 359
 		{
360
-			$r []= $this->fetch_array();
360
+			$r [] = $this->fetch_array();
361 361
 		}
362 362
 		return $r;
363 363
 	}
364 364
 
365 365
 	function num_rows()
366 366
 	{
367
-		return sizeof( $this->rows );
367
+		return sizeof($this->rows);
368 368
 	}
369 369
 
370 370
 	function field_array()
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	var $type;
401 401
 
402 402
 	// function with the default parameter value
403
-	function xx_xml($url='http://www.opocot.com', $type='url') {
403
+	function xx_xml($url = 'http://www.opocot.com', $type = 'url') {
404 404
 		$this->type = $type;
405 405
 		$this->url  = $url;
406 406
 		$this->parse();
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 		$this->rows = array();
415 415
 		$this->fields = array();
416 416
 		$data = '';
417
-		$this->parser = xml_parser_create ("UTF-8");
417
+		$this->parser = xml_parser_create("UTF-8");
418 418
 		xml_set_object($this->parser, $this);
419 419
 		xml_set_element_handler($this->parser, 'startXML', 'endXML');
420 420
 		xml_set_character_data_handler($this->parser, 'charXML');
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 	 	} else if ($this->type == 'contents') {
440 440
 	  	// Now we can pass the contents, maybe if you want
441 441
 			// to use CURL, SOCK or other method.
442
-			$lines = explode("\n",$this->url);
442
+			$lines = explode("\n", $this->url);
443 443
 			foreach ($lines as $val) {
444
-				$data = $val . "\n";
444
+				$data = $val."\n";
445 445
 				if (!xml_parse($this->parser, $data)) {
446 446
 					$this->error = $data."\n".sprintf('XML error at line %d column %d',
447 447
 						xml_get_current_line_number($this->parser),
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 				}
451 451
 			}
452 452
 		}
453
-		if( !$this->looks_legit ) 
453
+		if (!$this->looks_legit) 
454 454
 		{
455 455
 			$this->error = "Didn't even see a sparql element, is this really an endpoint?";
456 456
 		}
@@ -458,53 +458,53 @@  discard block
 block discarded – undo
458 458
 
459 459
 	function startXML($parser, $name, $attr)	
460 460
 	{
461
-		if( $name == "sparql" ) { $this->looks_legit = true; }
462
-		if( $name == "result" )
461
+		if ($name == "sparql") { $this->looks_legit = true; }
462
+		if ($name == "result")
463 463
 		{
464 464
 			$this->result = array();
465 465
 		}
466
-		if( $name == "binding" )
466
+		if ($name == "binding")
467 467
 		{
468 468
 			$this->part = $attr["name"];
469 469
 		}
470
-		if( $name == "uri" || $name == "bnode" )
470
+		if ($name == "uri" || $name == "bnode")
471 471
 		{
472 472
 			$this->part_type = $name;
473 473
 			$this->chars = "";
474 474
 		}
475
-		if( $name == "literal" )
475
+		if ($name == "literal")
476 476
 		{
477 477
 			$this->part_type = "literal";
478
-			if( isset( $attr["datatype"] ) )
478
+			if (isset($attr["datatype"]))
479 479
 			{
480 480
 				$this->part_datatype = $attr["datatype"];
481 481
 			}
482
-			if( isset( $attr["xml:lang"] ) )
482
+			if (isset($attr["xml:lang"]))
483 483
 			{
484 484
 				$this->part_lang = $attr["xml:lang"];
485 485
 			}
486 486
 			$this->chars = "";
487 487
 		}
488
-		if( $name == "variable" )
488
+		if ($name == "variable")
489 489
 		{
490 490
 			$this->fields[] = $attr["name"];
491 491
 		}
492 492
 	}
493 493
 
494
-	function endXML($parser, $name)	{
495
-		if( $name == "result" )
494
+	function endXML($parser, $name) {
495
+		if ($name == "result")
496 496
 		{
497 497
 			$this->rows[] = $this->result;
498 498
 			$this->result = array();
499 499
 		}
500
-		if( $name == "uri" || $name == "bnode" || $name == "literal" )
500
+		if ($name == "uri" || $name == "bnode" || $name == "literal")
501 501
 		{
502
-			$this->result[$this->part] = array( "type"=>$name, "value"=>$this->chars );
503
-			if( isset( $this->part_lang ) )
502
+			$this->result[$this->part] = array("type"=>$name, "value"=>$this->chars);
503
+			if (isset($this->part_lang))
504 504
 			{
505 505
 				$this->result[$this->part]["lang"] = $this->part_lang;
506 506
 			}
507
-			if( isset( $this->part_datatype ) )
507
+			if (isset($this->part_datatype))
508 508
 			{
509 509
 				$this->result[$this->part]["datatype"] = $this->part_datatype;
510 510
 			}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		}
514 514
 	}
515 515
 
516
-	function charXML($parser, $data)	{
516
+	function charXML($parser, $data) {
517 517
 		@$this->chars .= $data;
518 518
 	}
519 519
 
@@ -527,28 +527,28 @@  discard block
 block discarded – undo
527 527
 	function render_table()
528 528
 	{
529 529
 		$html = "<table class='sparql-results'><tr>";
530
-		foreach( $this->fields as $i=>$field )
530
+		foreach ($this->fields as $i=>$field)
531 531
 		{
532 532
 			$html .= "<th>?$field</th>";
533 533
 		}
534 534
 		$html .= "</tr>";
535
-		foreach( $this as $row )
535
+		foreach ($this as $row)
536 536
 		{
537
-			$html.="<tr>";
538
-			foreach( $row as $cell )
537
+			$html .= "<tr>";
538
+			foreach ($row as $cell)
539 539
 			{
540
-				$html .= "<td>".htmlspecialchars( $cell )."</td>";
540
+				$html .= "<td>".htmlspecialchars($cell)."</td>";
541 541
 			}
542
-			$html.="</tr>";
542
+			$html .= "</tr>";
543 543
 		}
544
-		$html.="</table>
544
+		$html .= "</table>
545 545
 <style>
546 546
 table.sparql-results { border-collapse: collapse; }
547 547
 table.sparql-results tr td { border: solid 1px #000 ; padding:4px;vertical-align:top}
548 548
 table.sparql-results tr th { border: solid 1px #000 ; padding:4px;vertical-align:top ; background-color:#eee;}
549 549
 </style>
550 550
 ";
551
-		return $html;exit;
551
+		return $html; exit;
552 552
 	}
553 553
 
554 554
 }
Please login to merge, or discard this patch.
tools-notam.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $page_url = $globalURL.'/tools-notam';
12 12
 
13
-$message = filter_input(INPUT_POST,'notam_message',FILTER_SANITIZE_STRING);
13
+$message = filter_input(INPUT_POST, 'notam_message', FILTER_SANITIZE_STRING);
14 14
 
15 15
 print '<div class="info column">';
16 16
 print '<h1>'._("Parse NOTAM messages").'</h1>';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	if (!empty($notam_parse)) {
35 35
 		print '<p>'._("NOTAM message in human readable format:").'</p>';
36 36
 		foreach ($notam_parse as $key => $value) {
37
-			print '<b>'.strtoupper(str_replace('_',' ',$key)).'</b>: '.$value.'<br />';
37
+			print '<b>'.strtoupper(str_replace('_', ' ', $key)).'</b>: '.$value.'<br />';
38 38
 		}
39 39
 	} else {
40 40
 		print '<p>'._("This NOTAM message can't be translated in human readable format :(").'</p>';
Please login to merge, or discard this patch.
ident-statistics-route.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
-$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
12
+$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort);
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Routes of %s"),$spotter_array[0]['ident']);
16
+	$title = sprintf(_("Most Common Routes of %s"), $spotter_array[0]['ident']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="info column">';
19 19
 	print '<h1>'.$spotter_array[0]['ident'].'</h1>';
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	include('ident-sub-menu.php');
25 25
 	print '<div class="column">';
26 26
 	print '<h2>'._("Most Common Routes").'</h2>';
27
-	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights with the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
27
+	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights with the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
28 28
 
29 29
 	$route_array = $Spotter->countAllRoutesByIdent($ident);
30 30
 	if (!empty($route_array))
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		print '</thead>';
42 42
 		print '<tbody>';
43 43
 		$i = 1;
44
-		foreach($route_array as $route_item)
44
+		foreach ($route_array as $route_item)
45 45
 		{
46 46
 			print '<tr>';
47 47
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
require/libs/uagent/uagent.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
      * Processors by Arch.
17 17
      */
18 18
     public static $processors = array(
19
-        'lin' => array( 'i686', 'x86_64' ),
20
-        'mac' => array( 'Intel', 'PPC', 'U; Intel', 'U; PPC' ),
21
-        'win' => array( 'foo' )
19
+        'lin' => array('i686', 'x86_64'),
20
+        'mac' => array('Intel', 'PPC', 'U; Intel', 'U; PPC'),
21
+        'win' => array('foo')
22 22
     );
23 23
 
24 24
     /**
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public static $browsers = array(
30 30
         34 => array(
31
-            89 => array( 'chrome', 'win' ),
32
-            9  => array( 'chrome', 'mac' ),
33
-            2  => array( 'chrome', 'lin' )
31
+            89 => array('chrome', 'win'),
32
+            9  => array('chrome', 'mac'),
33
+            2  => array('chrome', 'lin')
34 34
         ),
35 35
         32 => array(
36
-            100 => array( 'iexplorer', 'win' )
36
+            100 => array('iexplorer', 'win')
37 37
         ),
38 38
         25 => array(
39
-            83 => array( 'firefox', 'win' ),
40
-            16 => array( 'firefox', 'mac' ),
41
-            1  => array( 'firefox', 'lin' )
39
+            83 => array('firefox', 'win'),
40
+            16 => array('firefox', 'mac'),
41
+            1  => array('firefox', 'lin')
42 42
         ),
43 43
         7 => array(
44
-            95 => array( 'safari', 'mac' ),
45
-            4  => array( 'safari', 'win' ),
46
-            1  => array( 'safari', 'lin' )
44
+            95 => array('safari', 'mac'),
45
+            4  => array('safari', 'win'),
46
+            1  => array('safari', 'lin')
47 47
         ),
48 48
         2 => array(
49
-            91 => array( 'opera', 'win' ),
50
-            6  => array( 'opera', 'lin' ),
51
-            3  => array( 'opera', 'mac' )
49
+            91 => array('opera', 'win'),
50
+            6  => array('opera', 'lin'),
51
+            3  => array('opera', 'mac')
52 52
         )
53 53
     );
54 54
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         'bg-BG', 'ca-ES', 'cs-CZ', 'Cy-az-AZ', 'Cy-sr-SP', 'Cy-uz-UZ', 'da-DK', 'de-AT',
64 64
         'de-CH', 'de-DE', 'de-LI', 'de-LU', 'div-MV', 'el-GR', 'en-AU', 'en-BZ', 'en-CA', 
65 65
         'en-CB', 'en-GB', 'en-IE', 'en-JM', 'en-NZ', 'en-PH', 'en-TT', 'en-US', 'en-ZA', 
66
-        'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO',  'es-CR', 'es-DO', 'es-EC', 'es-ES',
66
+        'en-ZW', 'es-AR', 'es-BO', 'es-CL', 'es-CO', 'es-CR', 'es-DO', 'es-EC', 'es-ES',
67 67
         'es-GT', 'es-HN', 'es-MX', 'es-NI', 'es-PA', 'es-PE', 'es-PR', 'es-PY', 'es-SV',
68 68
         'es-UY', 'es-VE', 'et-EE', 'eu-ES', 'fa-IR', 'fi-FI', 'fo-FO', 'fr-BE', 'fr-CA',
69 69
         'fr-CH', 'fr-FR', 'fr-LU', 'fr-MC', 'gl-ES', 'gu-IN', 'he-IL', 'hi-IN', 'hr-HR', 
@@ -83,23 +83,23 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function generate_platform()
85 85
     {
86
-        $rand = mt_rand( 1, 100 );
86
+        $rand = mt_rand(1, 100);
87 87
         $sum = 0;
88 88
 
89
-        foreach ( self::$browsers as $share => $freq_os )
89
+        foreach (self::$browsers as $share => $freq_os)
90 90
         {
91 91
             $sum += $share;
92 92
 
93
-            if ( $rand <= $sum )
93
+            if ($rand <= $sum)
94 94
             {
95
-                $rand = mt_rand( 1, 100 );
95
+                $rand = mt_rand(1, 100);
96 96
                 $sum = 0;
97 97
 
98
-                foreach ( $freq_os as $share => $choice )
98
+                foreach ($freq_os as $share => $choice)
99 99
                 {
100 100
                     $sum += $share;
101 101
 
102
-                    if ( $rand <= $sum )
102
+                    if ($rand <= $sum)
103 103
                     {
104 104
                         return $choice;
105 105
                     }
@@ -107,61 +107,61 @@  discard block
 block discarded – undo
107 107
             }
108 108
         }
109 109
 
110
-        throw new Exception( 'Sum of $browsers frequency is not 100.' );
110
+        throw new Exception('Sum of $browsers frequency is not 100.');
111 111
     }
112 112
 
113
-    private static function array_random( $array )
113
+    private static function array_random($array)
114 114
     {
115
-        $i = array_rand( $array, 1 );
115
+        $i = array_rand($array, 1);
116 116
 
117 117
         return $array[$i];
118 118
     }
119 119
 
120
-    private static function get_language( $lang = array() )
120
+    private static function get_language($lang = array())
121 121
     {
122
-        return self::array_random( empty( $lang ) ? self::$languages : $lang );
122
+        return self::array_random(empty($lang) ? self::$languages : $lang);
123 123
     }
124 124
 
125
-    private static function get_processor( $os )
125
+    private static function get_processor($os)
126 126
     {
127
-        return self::array_random( self::$processors[$os] );
127
+        return self::array_random(self::$processors[$os]);
128 128
     }
129 129
 
130 130
     private static function get_version_nt()
131 131
     {   
132 132
         // Win2k (5.0) to Win 7 (6.1).
133
-        return mt_rand( 5, 6 ) . '.' . mt_rand( 0, 1 );
133
+        return mt_rand(5, 6).'.'.mt_rand(0, 1);
134 134
     }
135 135
 
136 136
     private static function get_version_osx()
137 137
     {
138
-        return '10_' . mt_rand( 5, 7 ) . '_' . mt_rand( 0, 9 );
138
+        return '10_'.mt_rand(5, 7).'_'.mt_rand(0, 9);
139 139
     }
140 140
 
141 141
     private static function get_version_webkit()
142 142
     {
143
-        return mt_rand( 531, 536 ) . mt_rand( 0, 2 );
143
+        return mt_rand(531, 536).mt_rand(0, 2);
144 144
     }
145 145
 
146 146
     private static function get_verison_chrome()
147 147
     {
148
-        return mt_rand( 13, 15 ) . '.0.' . mt_rand( 800, 899 ) . '.0';
148
+        return mt_rand(13, 15).'.0.'.mt_rand(800, 899).'.0';
149 149
     }
150 150
 
151 151
     private static function get_version_gecko()
152 152
     {
153
-        return mt_rand( 17, 31 ) . '.0';
153
+        return mt_rand(17, 31).'.0';
154 154
     }
155 155
 
156 156
     private static function get_version_ie()
157 157
     {
158
-        return mt_rand( 7, 9 ) . '.0';
158
+        return mt_rand(7, 9).'.0';
159 159
     }
160 160
 
161 161
     private static function get_version_trident()
162 162
     {
163 163
         // IE8 (4.0) to IE11 (7.0).
164
-        return mt_rand( 4, 7 ) . '.0';
164
+        return mt_rand(4, 7).'.0';
165 165
     }
166 166
 
167 167
     private static function get_version_net()
@@ -173,20 +173,20 @@  discard block
 block discarded – undo
173 173
             '3.5.30729',
174 174
         );
175 175
 
176
-        $rev = '.' . mt_rand( 26, 648 );
176
+        $rev = '.'.mt_rand(26, 648);
177 177
 
178
-        return self::array_random( $frameworks ) . $rev;
178
+        return self::array_random($frameworks).$rev;
179 179
     }
180 180
 
181 181
     private static function get_version_safari()
182 182
     {
183
-        if ( mt_rand( 0, 1 ) == 0 )
183
+        if (mt_rand(0, 1) == 0)
184 184
         {
185
-            $ver = mt_rand( 4, 5 ) . '.' . mt_rand( 0, 1 );
185
+            $ver = mt_rand(4, 5).'.'.mt_rand(0, 1);
186 186
         }
187 187
         else
188 188
         {
189
-            $ver = mt_rand( 4, 5 ) . '.0.' . mt_rand( 1, 5 );
189
+            $ver = mt_rand(4, 5).'.0.'.mt_rand(1, 5);
190 190
         }
191 191
 
192 192
         return $ver;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
     private static function get_version_opera()
196 196
     {
197
-        return mt_rand( 15, 19 ) . '.0.' . mt_rand( 1147, 1284 ) . mt_rand( 49, 100 );
197
+        return mt_rand(15, 19).'.0.'.mt_rand(1147, 1284).mt_rand(49, 100);
198 198
     }
199 199
 
200 200
     /**
@@ -202,28 +202,28 @@  discard block
 block discarded – undo
202 202
      * 
203 203
      * @see: http://dev.opera.com/blog/opera-user-agent-strings-opera-15-and-beyond/
204 204
      */
205
-    public static function opera( $arch )
205
+    public static function opera($arch)
206 206
     {
207
-        $opera = ' OPR/' . self::get_version_opera();
207
+        $opera = ' OPR/'.self::get_version_opera();
208 208
 
209 209
         // WebKit Rendering Engine (WebKit = Backend, Safari = Frontend).
210 210
         $engine = self::get_version_webkit();
211
-        $webkit = ' AppleWebKit/' . $engine . ' (KHTML, like Gecko)';
212
-        $chrome = ' Chrome/' . self::get_verison_chrome();
213
-        $safari = ' Safari/' . $engine;
211
+        $webkit = ' AppleWebKit/'.$engine.' (KHTML, like Gecko)';
212
+        $chrome = ' Chrome/'.self::get_verison_chrome();
213
+        $safari = ' Safari/'.$engine;
214 214
 
215
-        switch ( $arch )
215
+        switch ($arch)
216 216
         {
217 217
             case 'lin':
218
-                return '(X11; Linux {proc}) ' . $webkit . $chrome . $safari . $opera;
218
+                return '(X11; Linux {proc}) '.$webkit.$chrome.$safari.$opera;
219 219
             case 'mac':
220 220
                 $osx = self::get_version_osx();
221
-                return '(Macintosh; U; {proc} Mac OS X ' . $osx . ')' . $webkit . $chrome . $safari . $opera;
221
+                return '(Macintosh; U; {proc} Mac OS X '.$osx.')'.$webkit.$chrome.$safari.$opera;
222 222
             case 'win':
223 223
                 // fall through.
224 224
             default:
225 225
                 $nt = self::get_version_nt();
226
-                return '(Windows NT ' . $nt . '; WOW64) ' . $webkit . $chrome . $safari . $opera;
226
+                return '(Windows NT '.$nt.'; WOW64) '.$webkit.$chrome.$safari.$opera;
227 227
         }
228 228
     }    
229 229
 
@@ -231,25 +231,25 @@  discard block
 block discarded – undo
231 231
      * Safari
232 232
      *
233 233
      */
234
-    public static function safari( $arch )
234
+    public static function safari($arch)
235 235
     {
236
-        $version = ' Version/' . self::get_version_safari();
236
+        $version = ' Version/'.self::get_version_safari();
237 237
 
238 238
         // WebKit Rendering Engine (WebKit = Backend, Safari = Frontend).
239 239
         $engine = self::get_version_webkit();
240
-        $webkit = ' AppleWebKit/' . $engine . ' (KHTML, like Gecko)';
241
-        $safari = ' Safari/' . $engine;
240
+        $webkit = ' AppleWebKit/'.$engine.' (KHTML, like Gecko)';
241
+        $safari = ' Safari/'.$engine;
242 242
 
243
-        switch ( $arch )
243
+        switch ($arch)
244 244
         {
245 245
             case 'mac':
246 246
                 $osx = self::get_version_osx();
247
-                return '(Macintosh; U; {proc} Mac OS X ' . $osx . '; {lang})' . $webkit . $version . $safari;
247
+                return '(Macintosh; U; {proc} Mac OS X '.$osx.'; {lang})'.$webkit.$version.$safari;
248 248
             case 'win':
249 249
                 // fall through.
250 250
             default:
251 251
                 $nt = self::get_version_nt();
252
-                return '(Windows; U; Windows NT ' . $nt . ')' . $webkit . $version . $safari;
252
+                return '(Windows; U; Windows NT '.$nt.')'.$webkit.$version.$safari;
253 253
         }
254 254
 
255 255
     }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
      * 
260 260
      * @see: http://msdn.microsoft.com/en-gb/library/ms537503(v=vs.85).aspx
261 261
      */
262
-    public static function iexplorer( $arch )
262
+    public static function iexplorer($arch)
263 263
     {
264 264
         $nt = self::get_version_nt();
265 265
         $ie = self::get_version_ie();
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
         $net = self::get_version_net();
268 268
 
269 269
         return '(compatible' 
270
-            . '; MSIE ' . $ie 
271
-            . '; Windows NT ' . $nt 
270
+            . '; MSIE '.$ie 
271
+            . '; Windows NT '.$nt 
272 272
             . '; WOW64' // A 32-bit version of Internet Explorer is running on a 64-bit processor.
273
-            . '; Trident/' . $trident 
274
-            . '; .NET CLR ' . $net
273
+            . '; Trident/'.$trident 
274
+            . '; .NET CLR '.$net
275 275
             . ')';
276 276
     }
277 277
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      *
281 281
      * @see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference
282 282
      */
283
-    public static function firefox( $arch )
283
+    public static function firefox($arch)
284 284
     {
285 285
         // The release version of Gecko. 
286 286
         $gecko = self::get_version_gecko();
@@ -288,65 +288,65 @@  discard block
 block discarded – undo
288 288
         // On desktop, the gecko trail is fixed.
289 289
         $trail = '20100101';
290 290
 
291
-        $release = 'rv:' . $gecko;
292
-        $version = 'Gecko/' . $trail . ' Firefox/' . $gecko;
291
+        $release = 'rv:'.$gecko;
292
+        $version = 'Gecko/'.$trail.' Firefox/'.$gecko;
293 293
 
294
-        switch ( $arch )
294
+        switch ($arch)
295 295
         {
296 296
             case 'lin':
297
-                return '(X11; Linux {proc}; ' . $release . ') ' . $version;
297
+                return '(X11; Linux {proc}; '.$release.') '.$version;
298 298
             case 'mac':
299 299
                 $osx = self::get_version_osx();
300
-                return '(Macintosh; {proc} Mac OS X ' . $osx . '; ' . $release . ') ' . $version;
300
+                return '(Macintosh; {proc} Mac OS X '.$osx.'; '.$release.') '.$version;
301 301
             case 'win':
302 302
                 // fall through.
303 303
             default:
304 304
                 $nt = self::get_version_nt();
305
-                return '(Windows NT ' . $nt . '; {lang}; ' . $release . ') ' . $version;
305
+                return '(Windows NT '.$nt.'; {lang}; '.$release.') '.$version;
306 306
         }
307 307
     }
308 308
 
309
-    public static function chrome( $arch )
309
+    public static function chrome($arch)
310 310
     {
311
-        $chrome = ' Chrome/' . self::get_verison_chrome();
311
+        $chrome = ' Chrome/'.self::get_verison_chrome();
312 312
 
313 313
         // WebKit Rendering Engine (WebKit = Backend, Safari = Frontend).
314 314
         $engine = self::get_version_webkit();
315
-        $webkit = ' AppleWebKit/' . $engine . ' (KHTML, like Gecko)';
316
-        $safari = ' Safari/' . $engine;
315
+        $webkit = ' AppleWebKit/'.$engine.' (KHTML, like Gecko)';
316
+        $safari = ' Safari/'.$engine;
317 317
 
318
-        switch ( $arch )
318
+        switch ($arch)
319 319
         {
320 320
             case 'lin':
321
-                return '(X11; Linux {proc}) ' . $webkit . $chrome . $safari;
321
+                return '(X11; Linux {proc}) '.$webkit.$chrome.$safari;
322 322
             case 'mac':
323 323
                 $osx = self::get_version_osx();
324
-                return '(Macintosh; U; {proc} Mac OS X ' . $osx . ')' . $webkit . $chrome . $safari;
324
+                return '(Macintosh; U; {proc} Mac OS X '.$osx.')'.$webkit.$chrome.$safari;
325 325
             case 'win':
326 326
                 // fall through.
327 327
             default:
328 328
                 $nt = self::get_version_nt();
329
-                return '(Windows NT ' . $nt . ') ' . $webkit . $chrome . $safari;
329
+                return '(Windows NT '.$nt.') '.$webkit.$chrome.$safari;
330 330
         }
331 331
     }
332 332
 
333
-    public static function random( $lang = array( 'en-US' ) )
333
+    public static function random($lang = array('en-US'))
334 334
     {
335
-        list( $browser, $os ) = self::generate_platform();
335
+        list($browser, $os) = self::generate_platform();
336 336
 
337
-        return self::generate( $browser, $os, $lang );
337
+        return self::generate($browser, $os, $lang);
338 338
     }
339 339
 
340
-    public static function generate( $browser = 'chrome', $os = 'win', $lang = array( 'en-US' ) )
340
+    public static function generate($browser = 'chrome', $os = 'win', $lang = array('en-US'))
341 341
     {
342
-        $ua = self::MOZILLA . call_user_func( 'UAgent::' . $browser, $os );
342
+        $ua = self::MOZILLA.call_user_func('UAgent::'.$browser, $os);
343 343
 
344 344
         $tags = array(
345
-            '{proc}' => self::get_processor( $os ),
346
-            '{lang}' => self::get_language( $lang ),
345
+            '{proc}' => self::get_processor($os),
346
+            '{lang}' => self::get_language($lang),
347 347
         );
348 348
 
349
-        $ua = str_replace( array_keys( $tags ), array_values( $tags ), $ua );
349
+        $ua = str_replace(array_keys($tags), array_values($tags), $ua);
350 350
 
351 351
         return $ua;
352 352
     }
Please login to merge, or discard this patch.
require/libs/geoPHP/tests/tests/methodsTest.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
   function testMethods() {
12 12
     foreach (scandir('./input') as $file) {
13
-      $parts = explode('.',$file);
13
+      $parts = explode('.', $file);
14 14
       if ($parts[0]) {
15 15
         $format = $parts[1];
16 16
         $value = file_get_contents('./input/'.$file);
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
           array('name' => 'setSRID', 'argument' => '4326'),
44 44
         );
45 45
 
46
-        foreach($methods as $method) {
46
+        foreach ($methods as $method) {
47 47
           $argument = NULL;
48 48
           $method_name = $method['name'];
49 49
           if (isset($method['argument'])) {
@@ -69,32 +69,32 @@  discard block
 block discarded – undo
69 69
       case 'y':
70 70
       case 'x':
71 71
         if ($geometry->geometryType() == 'Point') {
72
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
72
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
73 73
         }
74 74
         if ($geometry->geometryType() == 'LineString') {
75
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
75
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
76 76
         }
77 77
         if ($geometry->geometryType() == 'MultiLineString') {
78
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
78
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
79 79
         }
80 80
         break;
81 81
       case 'geometryN':
82 82
         if ($geometry->geometryType() == 'Point') {
83
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
83
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
84 84
         }
85 85
         if ($geometry->geometryType() == 'LineString') {
86
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
86
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
87 87
         }
88 88
         if ($geometry->geometryType() == 'MultiLineString') {
89
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
89
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
90 90
         }
91 91
         break;
92 92
       case 'startPoint':
93 93
         if ($geometry->geometryType() == 'Point') {
94
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
94
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
95 95
         }
96 96
         if ($geometry->geometryType() == 'LineString') {
97
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
97
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
98 98
         }
99 99
         if ($geometry->geometryType() == 'MultiLineString') {
100 100
           //TODO: Add a method startPoint() to MultiLineString.
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
         break;
104 104
       case 'endPoint':
105 105
         if ($geometry->geometryType() == 'Point') {
106
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
106
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
107 107
         }
108 108
         if ($geometry->geometryType() == 'LineString') {
109
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
109
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
110 110
         }
111 111
         if ($geometry->geometryType() == 'MultiLineString') {
112 112
           //TODO: Add a method endPoint() to MultiLineString.
@@ -115,32 +115,32 @@  discard block
 block discarded – undo
115 115
         break;
116 116
       case 'isRing':
117 117
         if ($geometry->geometryType() == 'Point') {
118
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
118
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
119 119
         }
120 120
         if ($geometry->geometryType() == 'LineString') {
121
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
121
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
122 122
         }
123 123
         if ($geometry->geometryType() == 'MultiLineString') {
124
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
124
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
125 125
         }
126 126
         break;
127 127
       case 'isClosed':
128 128
         if ($geometry->geometryType() == 'Point') {
129
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
129
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
130 130
         }
131 131
         if ($geometry->geometryType() == 'LineString') {
132
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
132
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
133 133
         }
134 134
         if ($geometry->geometryType() == 'MultiLineString') {
135
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
135
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
136 136
         }
137 137
         break;
138 138
       case 'pointN':
139 139
         if ($geometry->geometryType() == 'Point') {
140
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
140
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
141 141
         }
142 142
         if ($geometry->geometryType() == 'LineString') {
143
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
143
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
144 144
         }
145 145
         if ($geometry->geometryType() == 'MultiLineString') {
146 146
           //TODO: Add a method pointN() to MultiLineString.
@@ -149,123 +149,123 @@  discard block
 block discarded – undo
149 149
         break;
150 150
       case 'exteriorRing':
151 151
         if ($geometry->geometryType() == 'Point') {
152
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
152
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
153 153
         }
154 154
         if ($geometry->geometryType() == 'LineString') {
155
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
155
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
156 156
         }
157 157
         if ($geometry->geometryType() == 'MultiLineString') {
158
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
158
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
159 159
         }
160 160
         break;
161 161
       case 'numInteriorRings':
162 162
         if ($geometry->geometryType() == 'Point') {
163
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
163
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
164 164
         }
165 165
         if ($geometry->geometryType() == 'LineString') {
166
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
166
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
167 167
         }
168 168
         if ($geometry->geometryType() == 'MultiLineString') {
169
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
169
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
170 170
         }
171 171
         break;
172 172
       case 'interiorRingN':
173 173
         if ($geometry->geometryType() == 'Point') {
174
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
174
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
175 175
         }
176 176
         if ($geometry->geometryType() == 'LineString') {
177
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
177
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
178 178
         }
179 179
         if ($geometry->geometryType() == 'MultiLineString') {
180
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
180
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
181 181
         }
182 182
         break;
183 183
       case 'SRID':
184 184
         if ($geometry->geometryType() == 'Point') {
185
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
185
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
186 186
         }
187 187
         if ($geometry->geometryType() == 'LineString') {
188
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
188
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
189 189
         }
190 190
         if ($geometry->geometryType() == 'MultiLineString') {
191
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
191
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
192 192
         }
193 193
         break;
194 194
       case 'getBBox':
195 195
         if ($geometry->geometryType() == 'Point') {
196
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
196
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
197 197
         }
198 198
         if ($geometry->geometryType() == 'LineString') {
199
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
199
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
200 200
         }
201 201
         if ($geometry->geometryType() == 'MultiLineString') {
202
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
202
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
203 203
         }
204 204
         break;
205 205
       case 'centroid':
206 206
         if ($geometry->geometryType() == 'Point') {
207
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
207
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
208 208
         }
209 209
         if ($geometry->geometryType() == 'LineString') {
210
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
210
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
211 211
         }
212 212
         if ($geometry->geometryType() == 'MultiLineString') {
213
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
213
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
214 214
         }
215 215
         break;
216 216
       case 'length':
217 217
         if ($geometry->geometryType() == 'Point') {
218
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
218
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
219 219
         }
220 220
         if ($geometry->geometryType() == 'LineString') {
221
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
221
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
222 222
         }
223 223
         if ($geometry->geometryType() == 'MultiLineString') {
224
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
224
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
225 225
         }
226 226
         break;
227 227
       case 'numGeometries':
228 228
         if ($geometry->geometryType() == 'Point') {
229
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
229
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
230 230
         }
231 231
         if ($geometry->geometryType() == 'LineString') {
232
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
232
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
233 233
         }
234 234
         if ($geometry->geometryType() == 'MultiLineString') {
235
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
235
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
236 236
         }
237 237
         break;
238 238
       case 'numPoints':
239 239
         if ($geometry->geometryType() == 'Point') {
240
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
240
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
241 241
         }
242 242
         if ($geometry->geometryType() == 'LineString') {
243
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
243
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
244 244
         }
245 245
         if ($geometry->geometryType() == 'MultiLineString') {
246
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
246
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
247 247
         }
248 248
         break;
249 249
       case 'dimension':
250 250
         if ($geometry->geometryType() == 'Point') {
251
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
251
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
252 252
         }
253 253
         if ($geometry->geometryType() == 'LineString') {
254
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
254
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
255 255
         }
256 256
         if ($geometry->geometryType() == 'MultiLineString') {
257
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
257
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
258 258
         }
259 259
         break;
260 260
       case 'boundary':
261 261
         if ($geometry->geometryType() == 'Point') {
262
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
262
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
263 263
         }
264 264
         if ($geometry->geometryType() == 'LineString') {
265
-          $this->assertNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
265
+          $this->assertNull($geometry->$method_name($argument), 'Failed on '.$method_name);
266 266
         }
267 267
         if ($geometry->geometryType() == 'MultiLineString') {
268
-          $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
268
+          $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
269 269
         }
270 270
         break;
271 271
       case 'haversineLength':
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
         break;
275 275
       case 'greatCircleLength':
276 276
       case 'area':
277
-        $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
277
+        $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
278 278
         break;
279 279
       case 'geometryType':
280
-        $this->assertNotNull($geometry->$method_name($argument), 'Failed on ' . $method_name);
280
+        $this->assertNotNull($geometry->$method_name($argument), 'Failed on '.$method_name);
281 281
         break;
282 282
       case 'setSRID':
283 283
         //TODO: The method setSRID() should return TRUE.
284 284
         break;
285 285
       default:
286
-        $this->assertTrue($geometry->$method_name($argument), 'Failed on ' . $method_name);
286
+        $this->assertTrue($geometry->$method_name($argument), 'Failed on '.$method_name);
287 287
     }
288 288
 
289 289
   }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
     $methods = array(
296 296
       //'boundary', //@@TODO: Uncomment this and fix errors
297
-      'envelope',   //@@TODO: Testing reveales errors in this method -- POINT vs. POLYGON
297
+      'envelope', //@@TODO: Testing reveales errors in this method -- POINT vs. POLYGON
298 298
       'getBBox',
299 299
       'x',
300 300
       'y',
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
       // Now check base on type
331 331
       if ($geos_type == 'object') {
332
-        $haus_dist = $geos_result->hausdorffDistance(geoPHP::load($norm_result->out('wkt'),'wkt'));
332
+        $haus_dist = $geos_result->hausdorffDistance(geoPHP::load($norm_result->out('wkt'), 'wkt'));
333 333
 
334 334
         // Get the length of the diagonal of the bbox - this is used to scale the haustorff distance
335 335
         // Using Pythagorean theorem
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         $scale = sqrt((($bb['maxy'] - $bb['miny'])^2) + (($bb['maxx'] - $bb['minx'])^2));
338 338
 
339 339
         // The difference in the output of GEOS and native-PHP methods should be less than 0.5 scaled haustorff units
340
-        if ($haus_dist / $scale > 0.5) {
340
+        if ($haus_dist/$scale > 0.5) {
341 341
           $this->fail('Output mismatch on '.$method);
342 342
           $this->dump('GEOS : ');
343 343
           $this->dump($geos_result->out('wkt'));
Please login to merge, or discard this patch.