Completed
Push — master ( 91ef4a...f9a26b )
by Yannick
23:48
created
airport-statistics-aircraft.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 
12
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
12
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", "");
14 14
 $airport_array = $Spotter->getAllAirportInfo($airport);
15 15
 
16 16
 if (!empty($airport_array))
17 17
 {
18
-	$title = sprintf(_("Most Common Aircraft to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
18
+	$title = sprintf(_("Most Common Aircraft to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']);
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
21 21
 	print '<form action="'.$globalURL.'/airport" method="post">';
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	$airport_names = $Stats->getAllAirportNames();
26 26
 	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
27 27
 	ksort($airport_names);
28
-	foreach($airport_names as $airport_name)
28
+	foreach ($airport_names as $airport_name)
29 29
 	{
30
-		if($airport == $airport_name['airport_icao'])
30
+		if ($airport == $airport_name['airport_icao'])
31 31
 		{
32 32
 			print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
33 33
 		} else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	include('airport-sub-menu.php');
59 59
 	print '<div class="column">';
60 60
 	print '<h2>'._("Most Common Aircraft").'</h2>';
61
- 	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>';
61
+ 	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>';
62 62
 	
63 63
 	$aircraft_array = $Spotter->countAllAircraftTypesByAirport($airport);
64 64
 	if (!empty($aircraft_array))
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		print '</thead>';
74 74
 		print '<tbody>';
75 75
 		$i = 1;
76
-		foreach($aircraft_array as $aircraft_item)
76
+		foreach ($aircraft_array as $aircraft_item)
77 77
 		{
78 78
 			print '<tr>';
79 79
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
date-statistics-aircraft.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 else $spotter_array = array();
10 10
 
11 11
 if (!empty($spotter_array))
12 12
 {
13
-	$title = sprintf(_("Most Common Aircraft on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
13
+	$title = sprintf(_("Most Common Aircraft on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
14 14
 	require_once('header.php');
15 15
 	print '<div class="select-item">';
16 16
 	print '<form action="'.$globalURL.'/date" method="post" class="form-inline">';
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 	print '<br />';
29 29
 
30 30
 	print '<div class="info column">';
31
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
32 32
 	print '</div>';
33 33
 
34 34
 	include('date-sub-menu.php');
35 35
 	print '<div class="column">';
36 36
 	print '<h2>'._("Most Common Aircraft").'</h2>';
37
-	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37
+	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
38 38
 	
39 39
 	$aircraft_array = $Spotter->countAllAircraftTypesByDate($date);
40 40
 	if (!empty($aircraft_array))
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		print '</thead>';
50 50
 		print '<tbody>';
51 51
 		$i = 1;
52
-		foreach($aircraft_array as $aircraft_item)
52
+		foreach ($aircraft_array as $aircraft_item)
53 53
 		{
54 54
 			print '<tr>';
55 55
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
live-santa-geojson.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 $timearray = array();
11 11
 if (isset($_GET['now'])) $begin = time();
12 12
 else $begin = strtotime(date("Y").'-12-24T02:00:00Z');
13
-for ($i =0; $i <= 288; $i++) {
13
+for ($i = 0; $i <= 288; $i++) {
14 14
 	$timearray[] = ($begin + $i*300)*1000;
15 15
 }
16
-$output = '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Name":"santaclaus","time": ['.implode(',',$timearray).']},"geometry":{"type":"MultiPoint","coordinates":[[-114.4,82.7,0],[-173.300003,64.379997,0],[177.479995,64.75,0],[158.65,53.016667,0],[165.545318,11.626074,0],[171.1300517813333,7.07999665990053,0],[179.380004,-16.469999,0],[178.429992,-18.129999,0],[174.759994,-36.849998,0],[176.839996,-39.639999,0],[174.779998,-41.279998,0],[172.639999,-43.529998,0],[167.838199,-46.986747,0],[168.320999,-17.740391,0],[167.149993,-15.51,0],[159.910003,-9.43,0],[156.850006,-8.1,0],[158.160003,6.92,0],[150.017702,45.873311,0],[154.796487,49.429802,0],[142.7262,46.948978,0],[150.800003,59.569999,0],[135.119995,48.419998,0],[131.899993,43.130001,0],[142.212096,27.070652,0],[141.312779,24.78389,0],[144.79373,13.444305,0],[151.783334,8.45,0],[151.749999,7.416667,0],[152.160003,-4.199999,0],[146.990005,-6.719999,0],[143.211639,-9.085352,0],[146.779998,-19.26,0],[149.179992,-21.139999,0],[153.020004,-27.459999,0],[151.210006,-33.869998,0],[147.291199,-42.85088,0],[138.600006,-34.93,0],[133.869995,-23.7,0],[130.850006,-12.43,0],[143.62,-3.56,0],[134.5552,7.3608,0],[135.169998,34.68,0],[138.690002,35.169998,0],[139.770004,35.669998,0],[140.740005,40.830001,0],[128.600006,35.869998,0],[125.925925,38.950981,0],[129.771118,62.093056,0],[104.239997,52.330001,0],[114.5056,48.060478,0],[106.580001,29.569999,0],[121.470001,31.229999,0],[113.25,23.12,0],[114.177465,22.307184,0],[121.639999,18.36,0],[122.080001,6.92,0],[114.639999,4.809999,0],[119.412399,-5.152193,0],[122.230003,-17.959999,0],[115.839996,-31.959999,0],[105.680687,-10.428593,0],[104.75,-2.99,0],[113.029998,3.17,0],[100.720001,4.86,0],[104.18,10.609999,0],[103.864403,13.36866,0],[99.330001,9.14,0],[105.073303,18.30217,0],[91.132088,29.6507,0],[116.477651,40.332809,0],[93.059997,56.02,0],[86.18,69.410003,0],[88.202881,69.315422,0],[73.400001,55,0],[76.949996,52.299999,0],[78.379997,42.490001,0],[69.779998,37.919998,0],[86.933333,27.983333,0],[84.870002,27.02,0],[88.36,22.569999,0],[90.389999,23.7,0],[97.04,20.78,0],[92.762917,11.66857,0],[50.23720550537109,-46.10261535644531,0],[72.422489,-7.336367,0],[73.510915,4.174199,0],[81.050003,6.989999,0],[72.819999,18.959999,0],[78.042222,27.174167,0],[71.449996,30.2,0],[67.109993,36.703819,0],[54.36,39.509998,0],[63.726529,40.214486,0],[58.853439,48.251126,0],[56.23246,58.00024,0],[49.659999,58.599998,0],[50.150001,53.2,0],[44.11,41.979999,0],[49.893226,40.38344,0],[44.75,40.5,0],[50.95,34.650001,0],[56.27433,27.18717,0],[54.989491,25.005817,0],[59.549999,22.569999,0],[47.58318996007591,-9.722414273737707,0],[57.471008,-20.26026,0],[37.946460723877,-46.6428451538086,0],[53,-67.5,0],[46.99004,-25.03233,0],[46.310001,-15.72,0],[44.41203117370608,-12.22338294982911,0],[39.3822,-6.097406,0],[39.659999,-4.039999,0],[40.033333,7.916667,0],[42.549999,16.899999,0],[43.970001,26.37,0],[41.12,30.455,0],[38.278671,34.547951,0],[37.619998,55.75,0],[30.453329,59.951889,0],[23.12,63.84,0],[26.709999,58.380001,0],[25.42,57.549999,0],[23.319999,55.93,0],[26.1,52.119998,0],[32.259998,48.5,0],[28.829999,47.029998,0],[25.61,45.659999,0],[27.469999,42.509998,0],[23.729999,37.979999,0],[27.149999,38.43,0],[31.132659,29.977088,0],[32.659999,13.17,0],[33.599998,1.71,0],[25.92,-2.95,0],[28.45,-14.439999,0],[30.819999,-20.059999,0],[21.639999,-21.7,0],[25.59,-33.959999,0],[18.129999,-26.579999,0],[13.767777,-10.722417,0],[10.13,-0.15,0],[20.67,5.76,0],[9.71,4.059999,0],[7.44,10.52,0],[18.69,12.189999,0],[7.98,17,0],[14.42,27.069999,0],[3.678539,32.489059,0],[-7.619999,33.599998,0],[13.611066,38.129963,0],[12.482323,41.895466,0],[17.189752,44.763891,0],[16.45,43.509998,0],[14.51,46.060001,0],[21.629999,47.54,0],[16.37,48.220001,0],[10.736111,47.554444,0],[14.43,50.080001,0],[17.129999,48.159999,0],[22.569999,51.240001,0],[13.411895,52.523781,0],[10.039999,56.470001,0],[13.02,55.61,0],[17.329999,62.400001,0],[14.229999,78.059997,0],[10.399999,63.439998,0],[2.350966,48.856558,0],[7.42,43.75,0],[1.57,42.54,0],[-0.991293,37.605651,0],[-7.429999,39.29,0],[-11.4053,16.5889,0],[-3.009999,16.78,0],[-5.36008,5.83885,0],[-12.3,11.319999,0],[-16.239999,12.829999,0],[-16.2507,28.457661,0],[-0.126197,51.500197,0],[-2.968111,56.461428,0],[-7.308429,54.998539,0],[-8.92,52.7,0],[-19.000959,63.427502,0],[-28.364049911499,38.47212219238281,0],[-23.76,15.279999,0],[-36.511219,-54.274151,0],[-58.979999,-51.830001,0],[-64.190002,-31.399999,0],[-54.18,-32.36,0],[-43.2,-22.909999,0],[-37.333333,65.666667,0],[-69.345131,77.48262,0],[-55.65049,48.929001,0],[-63.530471,44.681263,0],[-66.647818,45.957319,0],[-59.630001,13.18,0],[-61.744888,12.06526,0],[-61.171322,10.30501,0],[-67.470001,7.9,0],[-58.159999,6.789999,0],[-60.02,-3.119999,0],[-56.45,-14.409999,0],[-65.260002,-19.059999,0],[-56.636503,-24.158676,0],[-56.509998,-33.409999,0],[-68.523514,-50.021889,0],[-72.505127,-51.732529,0],[-71.639999,-33.04,0],[-72.515821,-13.162849,0],[-76.970001,-6.03,0],[-78.620002,-1.24,0],[-76.739997,8.1,0],[-79.879913,9.368985,0],[-76.949996,18,0],[-72.699996,19.11,0],[-75.220001,20.149999,0],[-73.682953,20.95027,0],[-80.605,28.405556,0],[-84.388056,33.748889,0],[-79.931111,32.776389,0],[-83.920833,35.960556,0],[-84.500278,38.049167,0],[-77.460833,38.303056,0],[-82.515556,40.758333,0],[-83.045833,42.331389,0],[-74.006389,40.714167,0],[-71.802778,42.2625,0],[-72.973056,43.610556,0],[-68.0125,46.860556,0],[-72.581779,46.357398,0],[-78.53632621543271,52.72737572958358,0],[-66.921779,52.940118,0],[-75.652573,62.201069,0],[-64.865257,67.935417,0],[-94.969443,74.716943,0],[-82.793909,76.395731,0],[-97.49276733398439,69.18675994873048,0],[-90.5537452697754,63.36753463745121,0],[-89.270113,48.412197,0],[-79.604159,43.68731,0],[-89.401111,43.073056,0],[-94.633611,42.395278,0],[-89.588889,40.693611,0],[-90.197778,38.627222,0],[-90.704167,35.842222,0],[-91.061667,33.41,0],[-92.445,31.311111,0],[-98.493333,29.423889,0],[-103.349998,20.67,0],[-86.830001,21.17,0],[-89.529998,14.979999,0],[-87.449996,13.42,0],[-83.709999,9.369999,0],[-91.5149765,-0.3781085,0],[-109.425598,-27.1546,0],[-109.9142,22.88093,0],[-110.910003,27.92,0],[-110.925833,32.221667,0],[-104.526667,33.395,0],[-113.061111,37.6775,0],[-104.820833,38.833889,0],[-108.73,42.833056,0],[-113.895,45.175833,0],[-113.993056,46.872222,0],[-114.080796,51.039877,0],[-102.3889594419702,57.15883691318781,0],[-118.0333,66.0833,0],[-140.55,64.45,0],[-122.690386,58.80667,0],[-121.92985,50.686341,0],[-122.330833,47.606389,0],[-122.274167,47.564167,0],[-122.968503,45.309901,0],[-122.874444,42.326667,0],[-122.390556,40.586667,0],[-117.068611,39.493333,0],[-122.418333,37.775,0],[-117.108333,34.207778,0],[-116.544444,33.830278,0],[-117.156389,32.715278,0],[-149.891667,61.218333,0],[-155.566389,62.948889,0],[-165.406389,64.501111,0],[-155.09,19.729722,0],[-156.337974,20.804858,0],[-157.043209,21.141189,0],[-158.009167,21.386667,0],[-159.371111,21.981111,0]]}}]}';
16
+$output = '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Name":"santaclaus","time": ['.implode(',', $timearray).']},"geometry":{"type":"MultiPoint","coordinates":[[-114.4,82.7,0],[-173.300003,64.379997,0],[177.479995,64.75,0],[158.65,53.016667,0],[165.545318,11.626074,0],[171.1300517813333,7.07999665990053,0],[179.380004,-16.469999,0],[178.429992,-18.129999,0],[174.759994,-36.849998,0],[176.839996,-39.639999,0],[174.779998,-41.279998,0],[172.639999,-43.529998,0],[167.838199,-46.986747,0],[168.320999,-17.740391,0],[167.149993,-15.51,0],[159.910003,-9.43,0],[156.850006,-8.1,0],[158.160003,6.92,0],[150.017702,45.873311,0],[154.796487,49.429802,0],[142.7262,46.948978,0],[150.800003,59.569999,0],[135.119995,48.419998,0],[131.899993,43.130001,0],[142.212096,27.070652,0],[141.312779,24.78389,0],[144.79373,13.444305,0],[151.783334,8.45,0],[151.749999,7.416667,0],[152.160003,-4.199999,0],[146.990005,-6.719999,0],[143.211639,-9.085352,0],[146.779998,-19.26,0],[149.179992,-21.139999,0],[153.020004,-27.459999,0],[151.210006,-33.869998,0],[147.291199,-42.85088,0],[138.600006,-34.93,0],[133.869995,-23.7,0],[130.850006,-12.43,0],[143.62,-3.56,0],[134.5552,7.3608,0],[135.169998,34.68,0],[138.690002,35.169998,0],[139.770004,35.669998,0],[140.740005,40.830001,0],[128.600006,35.869998,0],[125.925925,38.950981,0],[129.771118,62.093056,0],[104.239997,52.330001,0],[114.5056,48.060478,0],[106.580001,29.569999,0],[121.470001,31.229999,0],[113.25,23.12,0],[114.177465,22.307184,0],[121.639999,18.36,0],[122.080001,6.92,0],[114.639999,4.809999,0],[119.412399,-5.152193,0],[122.230003,-17.959999,0],[115.839996,-31.959999,0],[105.680687,-10.428593,0],[104.75,-2.99,0],[113.029998,3.17,0],[100.720001,4.86,0],[104.18,10.609999,0],[103.864403,13.36866,0],[99.330001,9.14,0],[105.073303,18.30217,0],[91.132088,29.6507,0],[116.477651,40.332809,0],[93.059997,56.02,0],[86.18,69.410003,0],[88.202881,69.315422,0],[73.400001,55,0],[76.949996,52.299999,0],[78.379997,42.490001,0],[69.779998,37.919998,0],[86.933333,27.983333,0],[84.870002,27.02,0],[88.36,22.569999,0],[90.389999,23.7,0],[97.04,20.78,0],[92.762917,11.66857,0],[50.23720550537109,-46.10261535644531,0],[72.422489,-7.336367,0],[73.510915,4.174199,0],[81.050003,6.989999,0],[72.819999,18.959999,0],[78.042222,27.174167,0],[71.449996,30.2,0],[67.109993,36.703819,0],[54.36,39.509998,0],[63.726529,40.214486,0],[58.853439,48.251126,0],[56.23246,58.00024,0],[49.659999,58.599998,0],[50.150001,53.2,0],[44.11,41.979999,0],[49.893226,40.38344,0],[44.75,40.5,0],[50.95,34.650001,0],[56.27433,27.18717,0],[54.989491,25.005817,0],[59.549999,22.569999,0],[47.58318996007591,-9.722414273737707,0],[57.471008,-20.26026,0],[37.946460723877,-46.6428451538086,0],[53,-67.5,0],[46.99004,-25.03233,0],[46.310001,-15.72,0],[44.41203117370608,-12.22338294982911,0],[39.3822,-6.097406,0],[39.659999,-4.039999,0],[40.033333,7.916667,0],[42.549999,16.899999,0],[43.970001,26.37,0],[41.12,30.455,0],[38.278671,34.547951,0],[37.619998,55.75,0],[30.453329,59.951889,0],[23.12,63.84,0],[26.709999,58.380001,0],[25.42,57.549999,0],[23.319999,55.93,0],[26.1,52.119998,0],[32.259998,48.5,0],[28.829999,47.029998,0],[25.61,45.659999,0],[27.469999,42.509998,0],[23.729999,37.979999,0],[27.149999,38.43,0],[31.132659,29.977088,0],[32.659999,13.17,0],[33.599998,1.71,0],[25.92,-2.95,0],[28.45,-14.439999,0],[30.819999,-20.059999,0],[21.639999,-21.7,0],[25.59,-33.959999,0],[18.129999,-26.579999,0],[13.767777,-10.722417,0],[10.13,-0.15,0],[20.67,5.76,0],[9.71,4.059999,0],[7.44,10.52,0],[18.69,12.189999,0],[7.98,17,0],[14.42,27.069999,0],[3.678539,32.489059,0],[-7.619999,33.599998,0],[13.611066,38.129963,0],[12.482323,41.895466,0],[17.189752,44.763891,0],[16.45,43.509998,0],[14.51,46.060001,0],[21.629999,47.54,0],[16.37,48.220001,0],[10.736111,47.554444,0],[14.43,50.080001,0],[17.129999,48.159999,0],[22.569999,51.240001,0],[13.411895,52.523781,0],[10.039999,56.470001,0],[13.02,55.61,0],[17.329999,62.400001,0],[14.229999,78.059997,0],[10.399999,63.439998,0],[2.350966,48.856558,0],[7.42,43.75,0],[1.57,42.54,0],[-0.991293,37.605651,0],[-7.429999,39.29,0],[-11.4053,16.5889,0],[-3.009999,16.78,0],[-5.36008,5.83885,0],[-12.3,11.319999,0],[-16.239999,12.829999,0],[-16.2507,28.457661,0],[-0.126197,51.500197,0],[-2.968111,56.461428,0],[-7.308429,54.998539,0],[-8.92,52.7,0],[-19.000959,63.427502,0],[-28.364049911499,38.47212219238281,0],[-23.76,15.279999,0],[-36.511219,-54.274151,0],[-58.979999,-51.830001,0],[-64.190002,-31.399999,0],[-54.18,-32.36,0],[-43.2,-22.909999,0],[-37.333333,65.666667,0],[-69.345131,77.48262,0],[-55.65049,48.929001,0],[-63.530471,44.681263,0],[-66.647818,45.957319,0],[-59.630001,13.18,0],[-61.744888,12.06526,0],[-61.171322,10.30501,0],[-67.470001,7.9,0],[-58.159999,6.789999,0],[-60.02,-3.119999,0],[-56.45,-14.409999,0],[-65.260002,-19.059999,0],[-56.636503,-24.158676,0],[-56.509998,-33.409999,0],[-68.523514,-50.021889,0],[-72.505127,-51.732529,0],[-71.639999,-33.04,0],[-72.515821,-13.162849,0],[-76.970001,-6.03,0],[-78.620002,-1.24,0],[-76.739997,8.1,0],[-79.879913,9.368985,0],[-76.949996,18,0],[-72.699996,19.11,0],[-75.220001,20.149999,0],[-73.682953,20.95027,0],[-80.605,28.405556,0],[-84.388056,33.748889,0],[-79.931111,32.776389,0],[-83.920833,35.960556,0],[-84.500278,38.049167,0],[-77.460833,38.303056,0],[-82.515556,40.758333,0],[-83.045833,42.331389,0],[-74.006389,40.714167,0],[-71.802778,42.2625,0],[-72.973056,43.610556,0],[-68.0125,46.860556,0],[-72.581779,46.357398,0],[-78.53632621543271,52.72737572958358,0],[-66.921779,52.940118,0],[-75.652573,62.201069,0],[-64.865257,67.935417,0],[-94.969443,74.716943,0],[-82.793909,76.395731,0],[-97.49276733398439,69.18675994873048,0],[-90.5537452697754,63.36753463745121,0],[-89.270113,48.412197,0],[-79.604159,43.68731,0],[-89.401111,43.073056,0],[-94.633611,42.395278,0],[-89.588889,40.693611,0],[-90.197778,38.627222,0],[-90.704167,35.842222,0],[-91.061667,33.41,0],[-92.445,31.311111,0],[-98.493333,29.423889,0],[-103.349998,20.67,0],[-86.830001,21.17,0],[-89.529998,14.979999,0],[-87.449996,13.42,0],[-83.709999,9.369999,0],[-91.5149765,-0.3781085,0],[-109.425598,-27.1546,0],[-109.9142,22.88093,0],[-110.910003,27.92,0],[-110.925833,32.221667,0],[-104.526667,33.395,0],[-113.061111,37.6775,0],[-104.820833,38.833889,0],[-108.73,42.833056,0],[-113.895,45.175833,0],[-113.993056,46.872222,0],[-114.080796,51.039877,0],[-102.3889594419702,57.15883691318781,0],[-118.0333,66.0833,0],[-140.55,64.45,0],[-122.690386,58.80667,0],[-121.92985,50.686341,0],[-122.330833,47.606389,0],[-122.274167,47.564167,0],[-122.968503,45.309901,0],[-122.874444,42.326667,0],[-122.390556,40.586667,0],[-117.068611,39.493333,0],[-122.418333,37.775,0],[-117.108333,34.207778,0],[-116.544444,33.830278,0],[-117.156389,32.715278,0],[-149.891667,61.218333,0],[-155.566389,62.948889,0],[-165.406389,64.501111,0],[-155.09,19.729722,0],[-156.337974,20.804858,0],[-157.043209,21.141189,0],[-158.009167,21.386667,0],[-159.371111,21.981111,0]]}}]}';
17 17
 print $output;
18 18
 
19 19
 ?>
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	/ @param String $source source of data
25 25
 	*/
26 26
 	
27
-	public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') {
27
+	public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') {
28 28
 		date_default_timezone_set('UTC');
29
-		$date = date("Y-m-d H:i:s",time());
29
+		$date = date("Y-m-d H:i:s", time());
30 30
 	        //if ($departure_airport_time == '' && $arrival_airport_time == '') exit;
31 31
 	        //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident";
32 32
 	        $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident";
@@ -34,69 +34,69 @@  discard block
 block discarded – undo
34 34
 		 try {
35 35
 			$sth = $this->db->prepare($query);
36 36
 			$sth->execute($query_values);
37
-		} catch(PDOException $e) {
37
+		} catch (PDOException $e) {
38 38
 			return "error : ".$e->getMessage();
39 39
 		}
40 40
 		if ($sth->fetchColumn() > 0) {
41 41
 			if ($departure_airport_time == '' && $arrival_airport_time == '') {
42 42
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao";
43
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao);
43
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao);
44 44
 			} elseif ($arrival_airport_time == '') {
45 45
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao";
46
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao);
46
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao);
47 47
 			} elseif ($departure_airport_time == '') {
48 48
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
49
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
49
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time);
50 50
 			} else {
51 51
 			    //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time";
52 52
 			    $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time";
53
-			    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time);
53
+			    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time);
54 54
 			}
55 55
 			try {
56 56
 				$sth = $this->db->prepare($query);
57 57
 				$sth->execute($query_values);
58
-			} catch(PDOException $e) {
58
+			} catch (PDOException $e) {
59 59
 				return "error : ".$e->getMessage();
60 60
 			}
61 61
 			if ($sth->fetchColumn() == 0) {
62 62
 				//$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident';
63 63
 				if ($departure_airport_time == '' && $arrival_airport_time == '') {
64 64
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
65
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
65
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
66 66
 				} elseif ($arrival_airport_time == '') {
67 67
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident';
68
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
68
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source);
69 69
 				} elseif ($departure_airport_time == '') {
70 70
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
71
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
71
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
72 72
 				} else {
73 73
                             	    $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident';
74
-				    $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
74
+				    $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
75 75
 				}
76 76
 				 try {
77 77
 					$sth = $this->db->prepare($query);
78 78
 					$sth->execute($query_values);
79
-				} catch(PDOException $e) {
79
+				} catch (PDOException $e) {
80 80
 					return "error : ".$e->getMessage();
81 81
 				}
82 82
 			} else {
83 83
 				//$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident';
84 84
 				$query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident';
85
-				$query_values = array(':ident' => $ident,':date' => $date);
85
+				$query_values = array(':ident' => $ident, ':date' => $date);
86 86
 				 try {
87 87
 					$sth = $this->db->prepare($query);
88 88
 					$sth->execute($query_values);
89
-				} catch(PDOException $e) {
89
+				} catch (PDOException $e) {
90 90
 					return "error : ".$e->getMessage();
91 91
 				}
92 92
 			}
93 93
 		} else {
94 94
 			$query = 'INSERT INTO  routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source)  VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)';
95
-			$query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
95
+			$query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source);
96 96
 			 try {
97 97
 				$sth = $this->db->prepare($query);
98 98
 				$sth->execute($query_values);
99
-			} catch(PDOException $e) {
99
+			} catch (PDOException $e) {
100 100
 				return "error : ".$e->getMessage();
101 101
 			}
102 102
 		}
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 
106 106
 	public function getSchedule($ident) {
107 107
 	        $Translation = new Translation($this->db);
108
-	        $operator = $Translation->checkTranslation($ident,false);
108
+	        $operator = $Translation->checkTranslation($ident, false);
109 109
 	        if ($ident != $operator) {
110 110
 	    		$query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :operator OR CallSign = :ident LIMIT 1";
111
-	    		$query_values = array(':ident' => $ident,'operator' => $operator);
111
+	    		$query_values = array(':ident' => $ident, 'operator' => $operator);
112 112
 	    	} else {
113 113
 		        $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE FromAirport_ICAO <> '' AND ToAirport_ICAO <> '' AND CallSign = :ident LIMIT 1";
114 114
 	    		$query_values = array(':ident' => $ident);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		 try {
117 117
 			$sth = $this->db->prepare($query);
118 118
 			$sth->execute($query_values);
119
-		} catch(PDOException $e) {
119
+		} catch (PDOException $e) {
120 120
 			return "error : ".$e->getMessage();
121 121
 		}
122 122
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 try {
141 141
 			$sth = $this->db->prepare($query);
142 142
 			$sth->execute($query_values);
143
-		} catch(PDOException $e) {
143
+		} catch (PDOException $e) {
144 144
 			return "error : ".$e->getMessage();
145 145
 		}
146 146
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 	* @param String $carrier IATA code
156 156
 	* @return Flight departure and arrival airports and time
157 157
 	*/
158
-	private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') {
158
+	private function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') {
159 159
 		$Common = new Common();
160 160
 		$check_date = new Datetime($date);
161
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
162
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
161
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
162
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
163 163
 		$url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym');
164 164
 		$json = $Common->getData($url);
165 165
 	
166 166
 		$parsed_json = json_decode($json);
167
-		if (property_exists($parsed_json,'errors') === false) {
167
+		if (property_exists($parsed_json, 'errors') === false) {
168 168
 			//$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'};
169 169
 			$originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'};
170 170
 			//$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'};
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 			//$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'};
175 175
 			$arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'};
176 176
 
177
-			preg_match('/\((.*?)\)/',$originShort,$originiata);
177
+			preg_match('/\((.*?)\)/', $originShort, $originiata);
178 178
 			$DepartureAirportIata = $originiata[1];
179
-			preg_match('/\((.*?)\)/',$destinationShort,$destinationiata);
179
+			preg_match('/\((.*?)\)/', $destinationShort, $destinationiata);
180 180
 			$ArrivalAirportIata = $destinationiata[1];
181 181
 
182 182
 			/*
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			$arrivalTime = gmdate('H:i',strtotime($arrivalTime));
186 186
 			*/
187 187
 		
188
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance');
188
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance');
189 189
 		} else return array();
190 190
 	}
191 191
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 		$Common = new Common();
201 201
 		date_default_timezone_set($globalTimezone);
202 202
 		$check_date = new Datetime($date);
203
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
204
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
203
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
204
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
205 205
 		$url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign;
206 206
 		$json = $Common->getData($url);
207 207
 		$parsed_json = json_decode($json);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 			$departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'};
214 214
 			$arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'};
215 215
 
216
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet');
216
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet');
217 217
 		} else return array();
218 218
 	}
219 219
 
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 	*/
225 225
 	private function getRyanair($callsign) {
226 226
 		$Common = new Common();
227
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
228
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
227
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
228
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
229 229
 		$url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/";
230 230
 		$post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}';
231
-		$headers = array('Content-Type: application/json','Content-Length: ' . strlen($post));
232
-		$json = $Common->getData($url,'post',$post,$headers);
231
+		$headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post));
232
+		$json = $Common->getData($url, 'post', $post, $headers);
233 233
 		$parsed_json = json_decode($json);
234 234
 		if (isset($parsed_json->{'flightInfo'})) {
235 235
 			$flights = $parsed_json->{'flightInfo'};
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 				$ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name
239 239
 				$departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'};
240 240
 				$arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'};
241
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
241
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
242 242
 			} else return array();
243 243
 		} else return array();
244 244
 	}
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	*/
251 251
 	private function getSwiss($callsign) {
252 252
 		$Common = new Common();
253
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
254
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
253
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
254
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
255 255
 		$url = "http://www.world-of-swiss.com/fr/routenetwork.json";
256 256
 		$json = $Common->getData($url);
257 257
 		$parsed_json = json_decode($json);
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 				if ($flight->{'no'} == "Vol LX ".$numvol) {
266 266
 					$DepartureAirportIata = $flight->{'from'}->{'code'}; //city
267 267
 					$ArrivalAirportIata = $flight->{'to'}->{'code'}; //city
268
-					$departureTime = substr($flight->{'from'}->{'hour'},0,5);
269
-					$arrivalTime = substr($flight->{'to'}->{'hour'},0,5);
268
+					$departureTime = substr($flight->{'from'}->{'hour'},0, 5);
269
+					$arrivalTime = substr($flight->{'to'}->{'hour'},0, 5);
270 270
 				}
271 271
 			}
272 272
 			if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) {
273
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss');
273
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss');
274 274
 			} else return array();
275 275
 		} else return array();
276 276
 	}
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 		global $globalBritishAirwaysKey;
286 286
 		$Common = new Common();
287 287
 		$check_date = new Datetime($date);
288
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
289
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
288
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
289
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
290 290
 		if ($globalBritishAirwaysKey == '') return array();
291 291
 		$url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json";
292 292
 		$headers = array('Client-Key: '.$globalBritishAirwaysKey);
293
-		$json = $Common->getData($url,'get','',$headers);
293
+		$json = $Common->getData($url, 'get', '', $headers);
294 294
 		if ($json == '') return array();
295 295
 		$parsed_json = json_decode($json);
296 296
 		$flights = $parsed_json->{'FlightsResponse'};
297 297
 		if (count($flights) > 0) {
298 298
 			$DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'};
299 299
 			$ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'};
300
-			$departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
301
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
302
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways');
300
+			$departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
301
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
302
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways');
303 303
 		} else return array();
304 304
 	}
305 305
 
@@ -313,27 +313,27 @@  discard block
 block discarded – undo
313 313
 		global $globalLufthansaKey;
314 314
 		$Common = new Common();
315 315
 		$check_date = new Datetime($date);
316
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
317
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
316
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
317
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
318 318
 		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array();
319 319
 		$url = "https://api.lufthansa.com/v1/oauth/token";
320
-		$post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials');
321
-		$data = $Common->getData($url,'post',$post);
320
+		$post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials');
321
+		$data = $Common->getData($url, 'post', $post);
322 322
 		$parsed_data = json_decode($data);
323 323
 		if (!isset($parsed_data->{'access_token'})) return array();
324 324
 		$token = $parsed_data->{'access_token'};
325 325
 		
326 326
 		$url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d');
327
-		$headers = array('Authorization: Bearer '.$token,'Accept: application/json');
328
-		$json = $Common->getData($url,'get','',$headers);
327
+		$headers = array('Authorization: Bearer '.$token, 'Accept: application/json');
328
+		$json = $Common->getData($url, 'get', '', $headers);
329 329
 		if ($json == '') return array();
330 330
 		$parsed_json = json_decode($json);
331 331
 		if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) {
332 332
 			$DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'};
333
-			$departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'}));
333
+			$departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'}));
334 334
 			$ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'};
335
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
336
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa');
335
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
336
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa');
337 337
 		} else return array();
338 338
 	}
339 339
 
@@ -347,23 +347,23 @@  discard block
 block discarded – undo
347 347
 		global $globalTransaviaKey;
348 348
 		$Common = new Common();
349 349
 		$check_date = new Datetime($date);
350
-		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
351
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
350
+		$numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign));
351
+		if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array();
352 352
 		if ($globalTransaviaKey == '') return array();
353 353
 		$url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
354 354
 		//$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
355 355
 		$headers = array('apikey: '.$globalTransaviaKey);
356
-		$json = $Common->getData($url,'get','',$headers);
356
+		$json = $Common->getData($url, 'get', '', $headers);
357 357
 		//echo 'result : '.$json;
358 358
 		if ($json == '') return array();
359 359
 		$parsed_json = json_decode($json);
360 360
 		
361 361
 		if (isset($parsed_json->{'data'}[0])) {
362 362
 			$DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'};
363
-			$departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'}));
363
+			$departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'}));
364 364
 			$ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'};
365
-			$arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
366
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia');
365
+			$arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
366
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia');
367 367
 		} else return array();
368 368
 	}
369 369
 
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
 	*/
375 375
 	public function getTunisair($callsign) {
376 376
 		$Common = new Common();
377
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
378
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
377
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
378
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
379 379
 		$url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp";
380 380
 		$data = $Common->getData($url);
381 381
 		$table = $Common->table2array($data);
382 382
 		foreach ($table as $flight) {
383
-			if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) {
384
-				return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair');
383
+			if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) {
384
+				return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair');
385 385
 			}
386 386
 		}
387 387
 		return array();
@@ -392,21 +392,21 @@  discard block
 block discarded – undo
392 392
 	* @param String $callsign The callsign
393 393
 	* @return Flight departure and arrival airports and time
394 394
 	*/
395
-	public function getVueling($callsign,$date = 'NOW') {
395
+	public function getVueling($callsign, $date = 'NOW') {
396 396
 		$Common = new Common();
397 397
 		$check_date = new Datetime($date);
398
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
399
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
400
-		$final_date = str_replace('/','%2F',$check_date->format('d/m/Y'));
398
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
399
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
400
+		$final_date = str_replace('/', '%2F', $check_date->format('d/m/Y'));
401 401
 		$url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB";
402 402
 		$data = $Common->getData($url);
403
-		$data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data));
403
+		$data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data));
404 404
 		if ($data != '') {
405
-			preg_match('/flightOri=[A-Z]{3}/',$data,$result);
406
-			$DepartureAirportIata = str_replace('flightOri=','',$result[0]);
407
-			preg_match('/flightDest=[A-Z]{3}/',$data,$result);
408
-			$ArrivalAirportIata = str_replace('flightDest=','',$result[0]);
409
-			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
405
+			preg_match('/flightOri=[A-Z]{3}/', $data, $result);
406
+			$DepartureAirportIata = str_replace('flightOri=', '', $result[0]);
407
+			preg_match('/flightDest=[A-Z]{3}/', $data, $result);
408
+			$ArrivalAirportIata = str_replace('flightDest=', '', $result[0]);
409
+			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling');
410 410
 			else return array();
411 411
 		}
412 412
 		return array();
@@ -420,27 +420,27 @@  discard block
 block discarded – undo
420 420
 	*/
421 421
 	public function getIberia($callsign, $date = 'NOW') {
422 422
 		$Common = new Common();
423
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
423
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
424 424
 		$check_date = new Datetime($date);
425
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
425
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
426 426
 		$url = "https://www.iberia.com/web/flightDetail.do";
427
-		$post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB');
428
-		$data = $Common->getData($url,'post',$post);
427
+		$post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB');
428
+		$data = $Common->getData($url, 'post', $post);
429 429
 		if ($data != '') {
430 430
 			$table = $Common->table2array($data);
431 431
 			//print_r($table);
432 432
 			if (count($table) > 0) {
433 433
 				$flight = $table;
434
-				preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch);
435
-				preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch);
434
+				preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch);
435
+				preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch);
436 436
 				$DepartureAirportIata = $DepartureAirportIataMatch[0];
437 437
 				$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
438
-				$departureTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[3][2]))),0,5);
439
-				$arrivalTime = trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][1])));
438
+				$departureTime = substr(trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[3][2]))), 0, 5);
439
+				$arrivalTime = trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[5][1])));
440 440
 				if ($arrivalTime == 'Hora estimada de llegada') {
441
-					$arrivalTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][2]))),0,5);
442
-				} else $arrivalTime = substr($arrivalTime,0,5);
443
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia');
441
+					$arrivalTime = substr(trim(str_replace(' lunes', '', str_replace('&nbsp;', '', $flight[5][2]))), 0, 5);
442
+				} else $arrivalTime = substr($arrivalTime, 0, 5);
443
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia');
444 444
 			}
445 445
 		}
446 446
 		return array();
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 	* @return Flight departure and arrival airports and time
454 454
 	*/
455 455
 
456
-	private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') {
456
+	private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') {
457 457
 		$Common = new Common();
458
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
458
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
459 459
 		$check_date = new Datetime($date);
460
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
460
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
461 461
 		$url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y');
462 462
 		$data = $Common->getData($url);
463 463
 		if ($data != '') {
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
 				$flight = $table;
467 467
 				//print_r($table);
468 468
 				if (isset($flight[25]) && isset($flight[29])) {
469
-					preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch);
470
-					preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch);
469
+					preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch);
470
+					preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch);
471 471
 					$DepartureAirportIata = $DepartureAirportIataMatch[0];
472 472
 					$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
473
-					$departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5);
474
-					$arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5);
475
-					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance');
473
+					$departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5);
474
+					$arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5);
475
+					return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance');
476 476
 				} else return array();
477 477
 			}
478 478
 			
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
 	*/
491 491
 	private function getAlitalia($callsign, $date = 'NOW') {
492 492
 		$Common = new Common();
493
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
493
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
494 494
 		$check_date = new Datetime($date);
495
-		$url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
496
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
495
+		$url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
496
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
497 497
 		$data = $Common->getData($url);
498 498
 		if ($data != '') {
499 499
 			$table = $Common->text2array($data);
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 			$ArrivalAirportIata = '';
502 502
 			$departureTime = $table[4];
503 503
 			$arrivalTime = $table[5];
504
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia');
504
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia');
505 505
 		}
506 506
 	}
507 507
 
@@ -513,21 +513,21 @@  discard block
 block discarded – undo
513 513
 	*/
514 514
 	private function getBrussels($callsign, $date = 'NOW') {
515 515
 		$Common = new Common();
516
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
516
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
517 517
 		$check_date = new Datetime($date);
518
-		$url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
518
+		$url = "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
519 519
 		//http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber";
520
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
520
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
521 521
 		$data = $Common->getData($url);
522 522
 		if ($data != '') {
523 523
 		    //echo $data;
524
-		    $parsed_json = json_decode($data,true);
524
+		    $parsed_json = json_decode($data, true);
525 525
 		    if (isset($parsed_json[0]['FromAirportCode'])) {
526 526
 			$DepartureAirportIata = $parsed_json[0]['FromAirportCode'];
527 527
 			$ArrivalAirportIata = $parsed_json[0]['ToAirportCode'];
528
-			$departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate']));
529
-			$arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate']));
530
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels');
528
+			$departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate']));
529
+			$arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate']));
530
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels');
531 531
 		    }
532 532
 		}
533 533
 	}
@@ -604,21 +604,21 @@  discard block
 block discarded – undo
604 604
 	*/
605 605
 	private function getFlyTap($callsign) {
606 606
 		$Common = new Common();
607
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
608
-		$url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
607
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
608
+		$url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
609 609
 		//$check_date = new Datetime($date);
610
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
611
-		$post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1');
612
-		$data = $Common->getData($url,'post',$post);
610
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
611
+		$post = array('arrivalsdepartures_content' => 'number', 'arrivalsdepartures_tp' => $numvol, 'arrivalsdepartures_trk' => 'ARR', 'arrivalsdepartures_date_trk' => '1', 'aptCode' => '', 'arrivalsdepartures' => 'DEP', 'arrivalsdepartures_date' => '1', 'aptCodeFrom' => '', 'aptCodeTo' => '', 'arrivalsdepartures2' => 'DEP', 'arrivalsdepartures_date2' => '1');
612
+		$data = $Common->getData($url, 'post', $post);
613 613
 		if ($data != '') {
614 614
 			$table = $Common->table2array($data);
615
-			$departureTime = trim(substr($table[15][0],0,5));
616
-			$arrivalTime = trim(substr($table[35][0],0,5));
617
-			preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch);
618
-			preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch);
615
+			$departureTime = trim(substr($table[15][0], 0, 5));
616
+			$arrivalTime = trim(substr($table[35][0], 0, 5));
617
+			preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch);
618
+			preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch);
619 619
 			$DepartureAirportIata = $DepartureAirportIataMatch[0];
620 620
 			$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
621
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap');
621
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap');
622 622
 		}
623 623
 		return array();
624 624
 	}
@@ -640,10 +640,10 @@  discard block
 block discarded – undo
640 640
 			} 
641 641
 		}
642 642
 		if ($airline_icao == '') return array();
643
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
644
-		$url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
643
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
644
+		$url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
645 645
 		//$check_date = new Datetime($date);
646
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
646
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
647 647
 		$data = $Common->getData($url);
648 648
 		if ($data != '') {
649 649
 			$table = $Common->table2array($data);
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
 				$darr = '';
654 654
 				$ahour = '';
655 655
 				$aarr = '';
656
-				$n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr);
656
+				$n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr);
657 657
 				if ($n == 7) {
658 658
 				    $departureTime = $dhour;
659 659
 				    $arrivalTime = $ahour;
660
-				    $DepartureAirportIata = str_replace(array('(',')'),'',$darr);
661
-				    $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr);
662
-				    return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper');
660
+				    $DepartureAirportIata = str_replace(array('(', ')'), '', $darr);
661
+				    $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr);
662
+				    return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper');
663 663
 				}
664 664
 			}
665 665
 		}
@@ -683,20 +683,20 @@  discard block
 block discarded – undo
683 683
 			} 
684 684
 		}
685 685
 		*/
686
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
687
-		$url= "http://fr.flightaware.com/live/flight/".$callsign;
686
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
687
+		$url = "http://fr.flightaware.com/live/flight/".$callsign;
688 688
 		//$check_date = new Datetime($date);
689
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
689
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
690 690
 		$data = $Common->getData($url);
691 691
 		if ($data != '') {
692 692
 			$table = $Common->table2array($data);
693 693
 			if (isset($table[11][0])) {
694
-				$departureTime = str_replace('h',':',substr($table[5][0],0,5));
695
-				$arrivalTime = str_replace('h',':',substr($table[5][1],0,5));
694
+				$departureTime = str_replace('h', ':', substr($table[5][0], 0, 5));
695
+				$arrivalTime = str_replace('h', ':', substr($table[5][1], 0, 5));
696 696
 				echo $table[3][0];
697
-				sscanf($table[3][0],'%*[^(] (%3[A-Z] / %*4[A-Z])',$DepartureAirportIata);
698
-				sscanf($table[3][1],'%*[^(] (%3[A-Z] / %*4[A-Z])',$ArrivalAirportIata);
699
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightaware');
697
+				sscanf($table[3][0], '%*[^(] (%3[A-Z] / %*4[A-Z])', $DepartureAirportIata);
698
+				sscanf($table[3][1], '%*[^(] (%3[A-Z] / %*4[A-Z])', $ArrivalAirportIata);
699
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightaware');
700 700
 			}
701 701
 		}
702 702
 		return array();
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	*/
710 710
 	public function getCostToTravel($callsign) {
711 711
 		$Common = new Common();
712
-		$url= "http://www.costtotravel.com/flight-number/".$callsign;
712
+		$url = "http://www.costtotravel.com/flight-number/".$callsign;
713 713
 		//$check_date = new Datetime($date);
714 714
 		//if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
715 715
 		$data = $Common->getData($url);
@@ -717,11 +717,11 @@  discard block
 block discarded – undo
717 717
 			$table = $Common->table2array($data);
718 718
 			//print_r($table);
719 719
 			if (isset($table[11][1])) {
720
-				$departureTime = substr($table[11][1],0,5);
721
-				$arrivalTime = substr($table[17][1],0,5);
722
-				$DepartureAirportIata = substr($table[13][1],0,3);
723
-				$ArrivalAirportIata = substr($table[15][1],0,3);
724
-				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel');
720
+				$departureTime = substr($table[11][1], 0, 5);
721
+				$arrivalTime = substr($table[17][1], 0, 5);
722
+				$DepartureAirportIata = substr($table[13][1], 0, 3);
723
+				$ArrivalAirportIata = substr($table[15][1], 0, 3);
724
+				return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel');
725 725
 			}
726 726
 		}
727 727
 		return array();
@@ -733,13 +733,13 @@  discard block
 block discarded – undo
733 733
 	* @param String $date date we want flight number info
734 734
 	* @return Flight departure and arrival airports and time
735 735
 	*/
736
-	private function getAirCanada($callsign,$date = 'NOW') {
736
+	private function getAirCanada($callsign, $date = 'NOW') {
737 737
 		$Common = new Common();
738 738
 		date_default_timezone_set('UTC');
739 739
 		$check_date = new Datetime($date);
740
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
741
-		$url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
742
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
740
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
741
+		$url = "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
742
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
743 743
 		$data = $Common->getData($url);
744 744
 		$dom = new DomDocument();
745 745
 		$dom->loadXML($data);
@@ -747,11 +747,11 @@  discard block
 block discarded – undo
747 747
 		$departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0);
748 748
 		if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) {
749 749
 			$DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
750
-			$departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
750
+			$departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
751 751
 			$arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0);
752 752
 			$ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
753
-			$arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
754
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada');
753
+			$arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
754
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada');
755 755
 		} else return array();
756 756
 	}
757 757
 
@@ -763,21 +763,21 @@  discard block
 block discarded – undo
763 763
 	*/
764 764
 	private function getVietnamAirlines($callsign, $date = 'NOW') {
765 765
 		$Common = new Common();
766
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
766
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
767 767
 		$check_date = new Datetime($date);
768
-		$url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
769
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
768
+		$url = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
769
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
770 770
 		$data = $Common->getData($url);
771 771
 		if ($data != '') {
772 772
 			$table = $Common->table2array($data);
773 773
 			$flight = $table;
774
-			preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch);
775
-			preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch);
774
+			preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch);
775
+			preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch);
776 776
 			$DepartureAirportIata = $DepartureAirportIataMatch[0];
777 777
 			$ArrivalAirportIata = $ArrivalAirportIataMatch[0];
778 778
 			$departureTime = $flight[5][1];
779 779
 			$arrivalTime = $flight[23][1];
780
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines');
780
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines');
781 781
 		}
782 782
 	}
783 783
 
@@ -788,16 +788,16 @@  discard block
 block discarded – undo
788 788
 	* @param String $carrier airline code
789 789
 	* @return Flight departure and arrival airports and time
790 790
 	*/
791
-	private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') {
791
+	private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') {
792 792
 		$Common = new Common();
793 793
 		date_default_timezone_set('UTC');
794 794
 		//AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair 
795
-		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
795
+		$numvol = preg_replace('/^[A-Z]*/', '', $callsign);
796 796
 		$check_date = new Datetime($date);
797
-		$url= "http://www.airberlin.com/en-US/site/aims.php";
798
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
799
-		$post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier);
800
-		$data = $Common->getData($url,'post',$post);
797
+		$url = "http://www.airberlin.com/en-US/site/aims.php";
798
+		if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array();
799
+		$post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier);
800
+		$data = $Common->getData($url, 'post', $post);
801 801
 		//echo $data;
802 802
 		$DepartureAirportIata = '';
803 803
 		$ArrivalAirportIata = '';
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 			if (isset($flight[5][2])) $departureAirport = $flight[5][2];
811 811
 			else $departureAirport = '';
812 812
 		} else return array();
813
-		$post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB');
814
-		$data = $Common->getData($url,'post',$post);
813
+		$post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB');
814
+		$data = $Common->getData($url, 'post', $post);
815 815
 		if ($data != '') {
816 816
 			$table = $Common->table2array($data);
817 817
 			$flight = $table;
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
 			}
840 840
 		}
841 841
 		if (isset($DepartureAirportIata)) {
842
-			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin');
842
+			return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin');
843 843
 		} else return array();
844 844
 	}
845 845
 
846 846
 
847 847
 	
848
-	public function fetchSchedule($ident,$date = 'NOW') {
848
+	public function fetchSchedule($ident, $date = 'NOW') {
849 849
 		global $globalSchedulesSources, $globalSchedulesFetch;
850 850
 		//$Common = new Common();
851 851
 		if (!$globalSchedulesFetch) return array();
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 				// Brussels Airlines
916 916
 				case "BEL":
917 917
 				case "SN":
918
-					return $this->getBrussels($ident,$date);
918
+					return $this->getBrussels($ident, $date);
919 919
 /*
920 920
 				// Copa Airlines
921 921
 				case "CMP":
@@ -1000,17 +1000,17 @@  discard block
 block discarded – undo
1000 1000
 				// Air France
1001 1001
 				case "AF":
1002 1002
 				case "AFR":
1003
-					return $this->getAirFrance($ident,$date,'AF');
1003
+					return $this->getAirFrance($ident, $date, 'AF');
1004 1004
 				// HOP
1005 1005
 				case "A5":
1006 1006
 				case "HOP":
1007
-					return $this->getAirFrance($ident,$date,'A5');
1007
+					return $this->getAirFrance($ident, $date, 'A5');
1008 1008
 				// EasyJet
1009 1009
 				case "U2":
1010 1010
 				case "DS":
1011 1011
 				case "EZY":
1012 1012
 				case "EZS":
1013
-					return $this->getEasyJet($ident,$date);
1013
+					return $this->getEasyJet($ident, $date);
1014 1014
 				// Ryanair
1015 1015
 				case "FR":
1016 1016
 				case "RYR":
@@ -1060,25 +1060,25 @@  discard block
 block discarded – undo
1060 1060
 					return $this->getIberia($ident);
1061 1061
 				// Vietnam Airlines
1062 1062
 				case "HVN":
1063
-					return $this->getVietnamAirlines($ident,$date);
1063
+					return $this->getVietnamAirlines($ident, $date);
1064 1064
 				// Air Berlin
1065 1065
 				case "AB":
1066 1066
 				case "BER":
1067
-					return $this->getAirBerlin($ident,$date,'AB');
1067
+					return $this->getAirBerlin($ident, $date, 'AB');
1068 1068
 				// NIKI
1069 1069
 				case "HG":
1070 1070
 				case "NLY":
1071
-					return $this->getAirBerlin($ident,$date,'HG');
1071
+					return $this->getAirBerlin($ident, $date, 'HG');
1072 1072
 				// BelAir
1073 1073
 				case "4T":
1074 1074
 				case "BHP":
1075
-					return $this->getAirBerlin($ident,$date,'4T');
1075
+					return $this->getAirBerlin($ident, $date, '4T');
1076 1076
 				default:
1077 1077
 					// Randomly use a generic function to get hours
1078 1078
 					if (strlen($airline_icao) == 2) {
1079
-						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1079
+						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1080 1080
 						if (count($globalSchedulesSources) > 0) {
1081
-							$rand = mt_rand(0,count($globalSchedulesSources)-1);
1081
+							$rand = mt_rand(0, count($globalSchedulesSources) - 1);
1082 1082
 							$source = $globalSchedulesSources[$rand];
1083 1083
 							if ($source == 'flightmapper') return $this->getFlightMapper($ident);
1084 1084
 							elseif ($source == 'costtotravel') return $this->getCostToTravel($ident);
Please login to merge, or discard this patch.
require/libs/simple_html_dom.php 1 patch
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -45,21 +45,21 @@  discard block
 block discarded – undo
45 45
  */
46 46
 define('HDOM_TYPE_ELEMENT', 1);
47 47
 define('HDOM_TYPE_COMMENT', 2);
48
-define('HDOM_TYPE_TEXT',	3);
49
-define('HDOM_TYPE_ENDTAG',  4);
50
-define('HDOM_TYPE_ROOT',	5);
48
+define('HDOM_TYPE_TEXT', 3);
49
+define('HDOM_TYPE_ENDTAG', 4);
50
+define('HDOM_TYPE_ROOT', 5);
51 51
 define('HDOM_TYPE_UNKNOWN', 6);
52 52
 define('HDOM_QUOTE_DOUBLE', 0);
53 53
 define('HDOM_QUOTE_SINGLE', 1);
54
-define('HDOM_QUOTE_NO',	 3);
55
-define('HDOM_INFO_BEGIN',   0);
56
-define('HDOM_INFO_END',	 1);
57
-define('HDOM_INFO_QUOTE',   2);
58
-define('HDOM_INFO_SPACE',   3);
59
-define('HDOM_INFO_TEXT',	4);
60
-define('HDOM_INFO_INNER',   5);
61
-define('HDOM_INFO_OUTER',   6);
62
-define('HDOM_INFO_ENDSPACE',7);
54
+define('HDOM_QUOTE_NO', 3);
55
+define('HDOM_INFO_BEGIN', 0);
56
+define('HDOM_INFO_END', 1);
57
+define('HDOM_INFO_QUOTE', 2);
58
+define('HDOM_INFO_SPACE', 3);
59
+define('HDOM_INFO_TEXT', 4);
60
+define('HDOM_INFO_INNER', 5);
61
+define('HDOM_INFO_OUTER', 6);
62
+define('HDOM_INFO_ENDSPACE', 7);
63 63
 define('DEFAULT_TARGET_CHARSET', 'UTF-8');
64 64
 define('DEFAULT_BR_TEXT', "\r\n");
65 65
 define('DEFAULT_SPAN_TEXT', " ");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 // -----------------------------------------------------------------------------
69 69
 // get html dom from file
70 70
 // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
71
-function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
71
+function file_get_html($url, $use_include_path = false, $context = null, $offset = -1, $maxLen = -1, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
72 72
 {
73 73
 	// We DO force the tags to be terminated.
74 74
 	$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 // get html dom from string
89
-function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
89
+function str_get_html($str, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
90 90
 {
91 91
 	$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
92 92
 	if (empty($str) || strlen($str) > MAX_FILE_SIZE)
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 // dump html dom tree
102
-function dump_html_tree($node, $show_attr=true, $deep=0)
102
+function dump_html_tree($node, $show_attr = true, $deep = 0)
103 103
 {
104 104
 	$node->dump($node);
105 105
 }
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	// dump node's tree
154
-	function dump($show_attr=true, $deep=0)
154
+	function dump($show_attr = true, $deep = 0)
155 155
 	{
156 156
 		$lead = str_repeat('	', $deep);
157 157
 
158 158
 		echo $lead.$this->tag;
159
-		if ($show_attr && count($this->attr)>0)
159
+		if ($show_attr && count($this->attr) > 0)
160 160
 		{
161 161
 			echo '(';
162 162
 			foreach ($this->attr as $k=>$v)
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		{
170 170
 			foreach ($this->nodes as $c)
171 171
 			{
172
-				$c->dump($show_attr, $deep+1);
172
+				$c->dump($show_attr, $deep + 1);
173 173
 			}
174 174
 		}
175 175
 	}
176 176
 
177 177
 
178 178
 	// Debugging function to dump a single dom node with a bunch of information about it.
179
-	function dump_node($echo=true)
179
+	function dump_node($echo = true)
180 180
 	{
181 181
 
182 182
 		$string = $this->tag;
183
-		if (count($this->attr)>0)
183
+		if (count($this->attr) > 0)
184 184
 		{
185 185
 			$string .= '(';
186 186
 			foreach ($this->attr as $k=>$v)
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			}
190 190
 			$string .= ')';
191 191
 		}
192
-		if (count($this->_)>0)
192
+		if (count($this->_) > 0)
193 193
 		{
194 194
 			$string .= ' $_ (';
195 195
 			foreach ($this->_ as $k=>$v)
@@ -211,22 +211,22 @@  discard block
 block discarded – undo
211 211
 
212 212
 		if (isset($this->text))
213 213
 		{
214
-			$string .= " text: (" . $this->text . ")";
214
+			$string .= " text: (".$this->text.")";
215 215
 		}
216 216
 
217 217
 		$string .= " HDOM_INNER_INFO: '";
218 218
 		if (isset($node->_[HDOM_INFO_INNER]))
219 219
 		{
220
-			$string .= $node->_[HDOM_INFO_INNER] . "'";
220
+			$string .= $node->_[HDOM_INFO_INNER]."'";
221 221
 		}
222 222
 		else
223 223
 		{
224 224
 			$string .= ' NULL ';
225 225
 		}
226 226
 
227
-		$string .= " children: " . count($this->children);
228
-		$string .= " nodes: " . count($this->nodes);
229
-		$string .= " tag_start: " . $this->tag_start;
227
+		$string .= " children: ".count($this->children);
228
+		$string .= " nodes: ".count($this->nodes);
229
+		$string .= " tag_start: ".$this->tag_start;
230 230
 		$string .= "\n";
231 231
 
232 232
 		if ($echo)
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 	// returns the parent of node
244 244
 	// If a node is passed in, it will reset the parent of the current node to that one.
245
-	function parent($parent=null)
245
+	function parent($parent = null)
246 246
 	{
247 247
 		// I am SURE that this doesn't work properly.
248 248
 		// It fails to unset the current node from it's current parents nodes or children list first.
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	}
264 264
 
265 265
 	// returns children of node
266
-	function children($idx=-1)
266
+	function children($idx = -1)
267 267
 	{
268
-		if ($idx===-1)
268
+		if ($idx === -1)
269 269
 		{
270 270
 			return $this->children;
271 271
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	// returns the first child of node
280 280
 	function first_child()
281 281
 	{
282
-		if (count($this->children)>0)
282
+		if (count($this->children) > 0)
283 283
 		{
284 284
 			return $this->children[0];
285 285
 		}
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
 	// returns the last child of node
290 290
 	function last_child()
291 291
 	{
292
-		if (($count=count($this->children))>0)
292
+		if (($count = count($this->children)) > 0)
293 293
 		{
294
-			return $this->children[$count-1];
294
+			return $this->children[$count - 1];
295 295
 		}
296 296
 		return null;
297 297
 	}
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 	// returns the next sibling of node
300 300
 	function next_sibling()
301 301
 	{
302
-		if ($this->parent===null)
302
+		if ($this->parent === null)
303 303
 		{
304 304
 			return null;
305 305
 		}
306 306
 
307 307
 		$idx = 0;
308 308
 		$count = count($this->parent->children);
309
-		while ($idx<$count && $this!==$this->parent->children[$idx])
309
+		while ($idx < $count && $this !== $this->parent->children[$idx])
310 310
 		{
311 311
 			++$idx;
312 312
 		}
313
-		if (++$idx>=$count)
313
+		if (++$idx >= $count)
314 314
 		{
315 315
 			return null;
316 316
 		}
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
 	// returns the previous sibling of node
321 321
 	function prev_sibling()
322 322
 	{
323
-		if ($this->parent===null) return null;
323
+		if ($this->parent === null) return null;
324 324
 		$idx = 0;
325 325
 		$count = count($this->parent->children);
326
-		while ($idx<$count && $this!==$this->parent->children[$idx])
326
+		while ($idx < $count && $this !== $this->parent->children[$idx])
327 327
 			++$idx;
328
-		if (--$idx<0) return null;
328
+		if (--$idx < 0) return null;
329 329
 		return $this->parent->children[$idx];
330 330
 	}
331 331
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 		while (!is_null($returnDom))
342 342
 		{
343
-			if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }
343
+			if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: ".$returnDom->tag); }
344 344
 
345 345
 			if ($returnDom->tag == $tag)
346 346
 			{
@@ -374,16 +374,16 @@  discard block
 block discarded – undo
374 374
 			{
375 375
 				if (!empty($this->text))
376 376
 				{
377
-					$text = " with text: " . $this->text;
377
+					$text = " with text: ".$this->text;
378 378
 				}
379 379
 			}
380
-			$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
380
+			$debug_object->debug_log(1, 'Innertext of tag: '.$this->tag.$text);
381 381
 		}
382 382
 
383
-		if ($this->tag==='root') return $this->innertext();
383
+		if ($this->tag === 'root') return $this->innertext();
384 384
 
385 385
 		// trigger callback
386
-		if ($this->dom && $this->dom->callback!==null)
386
+		if ($this->dom && $this->dom->callback !== null)
387 387
 		{
388 388
 			call_user_func_array($this->dom->callback, array($this));
389 389
 		}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		}
419 419
 
420 420
 		// render end tag
421
-		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0)
421
+		if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END] != 0)
422 422
 			$ret .= '</'.$this->tag.'>';
423 423
 		return $ret;
424 424
 	}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 			case HDOM_TYPE_COMMENT: return '';
434 434
 			case HDOM_TYPE_UNKNOWN: return '';
435 435
 		}
436
-		if (strcasecmp($this->tag, 'script')===0) return '';
437
-		if (strcasecmp($this->tag, 'style')===0) return '';
436
+		if (strcasecmp($this->tag, 'script') === 0) return '';
437
+		if (strcasecmp($this->tag, 'style') === 0) return '';
438 438
 
439 439
 		$ret = '';
440 440
 		// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL.
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 			++$i;
481 481
 
482 482
 			// skip removed attribute
483
-			if ($val===null || $val===false)
483
+			if ($val === null || $val === false)
484 484
 				continue;
485 485
 
486 486
 			$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
487 487
 			//no value attr: nowrap, checked selected...
488
-			if ($val===true)
488
+			if ($val === true)
489 489
 				$ret .= $key;
490 490
 			else {
491 491
 				switch ($this->_[HDOM_INFO_QUOTE][$i])
@@ -498,34 +498,34 @@  discard block
 block discarded – undo
498 498
 			}
499 499
 		}
500 500
 		$ret = $this->dom->restore_noise($ret);
501
-		return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
501
+		return $ret.$this->_[HDOM_INFO_ENDSPACE].'>';
502 502
 	}
503 503
 
504 504
 	// find elements by css selector
505 505
 	//PaperG - added ability for find to lowercase the value of the selector.
506
-	function find($selector, $idx=null, $lowercase=false)
506
+	function find($selector, $idx = null, $lowercase = false)
507 507
 	{
508 508
 		$selectors = $this->parse_selector($selector);
509
-		if (($count=count($selectors))===0) return array();
509
+		if (($count = count($selectors)) === 0) return array();
510 510
 		$found_keys = array();
511 511
 
512 512
 		// find each selector
513
-		for ($c=0; $c<$count; ++$c)
513
+		for ($c = 0; $c < $count; ++$c)
514 514
 		{
515 515
 			// The change on the below line was documented on the sourceforge code tracker id 2788009
516 516
 			// used to be: if (($levle=count($selectors[0]))===0) return array();
517
-			if (($levle=count($selectors[$c]))===0) return array();
517
+			if (($levle = count($selectors[$c])) === 0) return array();
518 518
 			if (!isset($this->_[HDOM_INFO_BEGIN])) return array();
519 519
 
520 520
 			$head = array($this->_[HDOM_INFO_BEGIN]=>1);
521 521
 
522 522
 			// handle descendant selectors, no recursive!
523
-			for ($l=0; $l<$levle; ++$l)
523
+			for ($l = 0; $l < $levle; ++$l)
524 524
 			{
525 525
 				$ret = array();
526 526
 				foreach ($head as $k=>$v)
527 527
 				{
528
-					$n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k];
528
+					$n = ($k === -1) ? $this->dom->root : $this->dom->nodes[$k];
529 529
 					//PaperG - Pass this optional parameter on to the seek function.
530 530
 					$n->seek($selectors[$c][$l], $ret, $lowercase);
531 531
 				}
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 
551 551
 		// return nth-element or array
552 552
 		if (is_null($idx)) return $found;
553
-		else if ($idx<0) $idx = count($found) + $idx;
553
+		else if ($idx < 0) $idx = count($found) + $idx;
554 554
 		return (isset($found[$idx])) ? $found[$idx] : null;
555 555
 	}
556 556
 
557 557
 	// seek for given conditions
558 558
 	// PaperG - added parameter to allow for case insensitive testing of the value of a selector.
559
-	protected function seek($selector, &$ret, $lowercase=false)
559
+	protected function seek($selector, &$ret, $lowercase = false)
560 560
 	{
561 561
 		global $debug_object;
562 562
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 			$count = 0;
570 570
 			foreach ($this->children as $c)
571 571
 			{
572
-				if ($tag==='*' || $tag===$c->tag) {
573
-					if (++$count==$key) {
572
+				if ($tag === '*' || $tag === $c->tag) {
573
+					if (++$count == $key) {
574 574
 						$ret[$c->_[HDOM_INFO_BEGIN]] = 1;
575 575
 						return;
576 576
 					}
@@ -580,38 +580,38 @@  discard block
 block discarded – undo
580 580
 		}
581 581
 
582 582
 		$end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
583
-		if ($end==0) {
583
+		if ($end == 0) {
584 584
 			$parent = $this->parent;
585
-			while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) {
585
+			while (!isset($parent->_[HDOM_INFO_END]) && $parent !== null) {
586 586
 				$end -= 1;
587 587
 				$parent = $parent->parent;
588 588
 			}
589 589
 			$end += $parent->_[HDOM_INFO_END];
590 590
 		}
591 591
 
592
-		for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) {
592
+		for ($i = $this->_[HDOM_INFO_BEGIN] + 1; $i < $end; ++$i) {
593 593
 			$node = $this->dom->nodes[$i];
594 594
 
595 595
 			$pass = true;
596 596
 
597
-			if ($tag==='*' && !$key) {
597
+			if ($tag === '*' && !$key) {
598 598
 				if (in_array($node, $this->children, true))
599 599
 					$ret[$i] = 1;
600 600
 				continue;
601 601
 			}
602 602
 
603 603
 			// compare tag
604
-			if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;}
604
+			if ($tag && $tag != $node->tag && $tag !== '*') {$pass = false; }
605 605
 			// compare key
606 606
 			if ($pass && $key) {
607 607
 				if ($no_key) {
608
-					if (isset($node->attr[$key])) $pass=false;
608
+					if (isset($node->attr[$key])) $pass = false;
609 609
 				} else {
610
-					if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false;
610
+					if (($key != "plaintext") && !isset($node->attr[$key])) $pass = false;
611 611
 				}
612 612
 			}
613 613
 			// compare value
614
-			if ($pass && $key && $val  && $val!=='*') {
614
+			if ($pass && $key && $val && $val !== '*') {
615 615
 				// If they have told us that this is a "plaintext" search then we want the plaintext of the node - right?
616 616
 				if ($key == "plaintext") {
617 617
 					// $node->plaintext actually returns $node->text();
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 					// this is a normal search, we want the value of that attribute of the tag.
621 621
 					$nodeKeyValue = $node->attr[$key];
622 622
 				}
623
-				if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
623
+				if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: ".$node->tag." for attribute: ".$key.$exp.$val." where nodes value is: ".$nodeKeyValue); }
624 624
 
625 625
 				//PaperG - If lowercase is set, do a case insensitive test of the value of the selector.
626 626
 				if ($lowercase) {
@@ -628,11 +628,11 @@  discard block
 block discarded – undo
628 628
 				} else {
629 629
 					$check = $this->match($exp, $val, $nodeKeyValue);
630 630
 				}
631
-				if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));}
631
+				if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: ".($check ? "true" : "false")); }
632 632
 
633 633
 				// handle multiple class
634
-				if (!$check && strcasecmp($key, 'class')===0) {
635
-					foreach (explode(' ',$node->attr[$key]) as $k) {
634
+				if (!$check && strcasecmp($key, 'class') === 0) {
635
+					foreach (explode(' ', $node->attr[$key]) as $k) {
636 636
 						// Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form.
637 637
 						if (!empty($k)) {
638 638
 							if ($lowercase) {
@@ -650,24 +650,24 @@  discard block
 block discarded – undo
650 650
 			unset($node);
651 651
 		}
652 652
 		// It's passed by reference so this is actually what this function returns.
653
-		if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);}
653
+		if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret); }
654 654
 	}
655 655
 
656 656
 	protected function match($exp, $pattern, $value) {
657 657
 		global $debug_object;
658
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
658
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
659 659
 
660 660
 		switch ($exp) {
661 661
 			case '=':
662
-				return ($value===$pattern);
662
+				return ($value === $pattern);
663 663
 			case '!=':
664
-				return ($value!==$pattern);
664
+				return ($value !== $pattern);
665 665
 			case '^=':
666
-				return preg_match("/^".preg_quote($pattern,'/')."/", $value);
666
+				return preg_match("/^".preg_quote($pattern, '/')."/", $value);
667 667
 			case '$=':
668
-				return preg_match("/".preg_quote($pattern,'/')."$/", $value);
668
+				return preg_match("/".preg_quote($pattern, '/')."$/", $value);
669 669
 			case '*=':
670
-				if ($pattern[0]=='/') {
670
+				if ($pattern[0] == '/') {
671 671
 					return preg_match($pattern, $value);
672 672
 				}
673 673
 				return preg_match("/".$pattern."/i", $value);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 
678 678
 	protected function parse_selector($selector_string) {
679 679
 		global $debug_object;
680
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
680
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
681 681
 
682 682
 		// pattern of CSS selectors, modified from mootools
683 683
 		// Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 //		$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
689 689
 		$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
690 690
 		preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
691
-		if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);}
691
+		if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches); }
692 692
 
693 693
 		$selectors = array();
694 694
 		$result = array();
@@ -696,29 +696,29 @@  discard block
 block discarded – undo
696 696
 
697 697
 		foreach ($matches as $m) {
698 698
 			$m[0] = trim($m[0]);
699
-			if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue;
699
+			if ($m[0] === '' || $m[0] === '/' || $m[0] === '//') continue;
700 700
 			// for browser generated xpath
701
-			if ($m[1]==='tbody') continue;
701
+			if ($m[1] === 'tbody') continue;
702 702
 
703 703
 			list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false);
704
-			if (!empty($m[2])) {$key='id'; $val=$m[2];}
705
-			if (!empty($m[3])) {$key='class'; $val=$m[3];}
706
-			if (!empty($m[4])) {$key=$m[4];}
707
-			if (!empty($m[5])) {$exp=$m[5];}
708
-			if (!empty($m[6])) {$val=$m[6];}
704
+			if (!empty($m[2])) {$key = 'id'; $val = $m[2]; }
705
+			if (!empty($m[3])) {$key = 'class'; $val = $m[3]; }
706
+			if (!empty($m[4])) {$key = $m[4]; }
707
+			if (!empty($m[5])) {$exp = $m[5]; }
708
+			if (!empty($m[6])) {$val = $m[6]; }
709 709
 
710 710
 			// convert to lowercase
711
-			if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);}
711
+			if ($this->dom->lowercase) {$tag = strtolower($tag); $key = strtolower($key); }
712 712
 			//elements that do NOT have the specified attribute
713
-			if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;}
713
+			if (isset($key[0]) && $key[0] === '!') {$key = substr($key, 1); $no_key = true; }
714 714
 
715 715
 			$result[] = array($tag, $key, $val, $exp, $no_key);
716
-			if (trim($m[7])===',') {
716
+			if (trim($m[7]) === ',') {
717 717
 				$selectors[] = $result;
718 718
 				$result = array();
719 719
 			}
720 720
 		}
721
-		if (count($result)>0)
721
+		if (count($result) > 0)
722 722
 			$selectors[] = $result;
723 723
 		return $selectors;
724 724
 	}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	function __set($name, $value)
743 743
 	{
744 744
 		global $debug_object;
745
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
745
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
746 746
 
747 747
 		switch ($name)
748 748
 		{
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	function convert_text($text)
781 781
 	{
782 782
 		global $debug_object;
783
-		if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
783
+		if (is_object($debug_object)) {$debug_object->debug_log_entry(1); }
784 784
 
785 785
 		$converted_text = $text;
786 786
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 			$sourceCharset = strtoupper($this->dom->_charset);
793 793
 			$targetCharset = strtoupper($this->dom->_target_charset);
794 794
 		}
795
-		if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
795
+		if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: ".$sourceCharset." target charaset: ".$targetCharset); }
796 796
 
797 797
 		if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))
798 798
 		{
@@ -831,27 +831,27 @@  discard block
 block discarded – undo
831 831
 	*/
832 832
 	static function is_utf8($str)
833 833
 	{
834
-		$c=0; $b=0;
835
-		$bits=0;
836
-		$len=strlen($str);
837
-		for($i=0; $i<$len; $i++)
834
+		$c = 0; $b = 0;
835
+		$bits = 0;
836
+		$len = strlen($str);
837
+		for ($i = 0; $i < $len; $i++)
838 838
 		{
839
-			$c=ord($str[$i]);
840
-			if($c > 128)
839
+			$c = ord($str[$i]);
840
+			if ($c > 128)
841 841
 			{
842
-				if(($c >= 254)) return false;
843
-				elseif($c >= 252) $bits=6;
844
-				elseif($c >= 248) $bits=5;
845
-				elseif($c >= 240) $bits=4;
846
-				elseif($c >= 224) $bits=3;
847
-				elseif($c >= 192) $bits=2;
842
+				if (($c >= 254)) return false;
843
+				elseif ($c >= 252) $bits = 6;
844
+				elseif ($c >= 248) $bits = 5;
845
+				elseif ($c >= 240) $bits = 4;
846
+				elseif ($c >= 224) $bits = 3;
847
+				elseif ($c >= 192) $bits = 2;
848 848
 				else return false;
849
-				if(($i+$bits) > $len) return false;
850
-				while($bits > 1)
849
+				if (($i + $bits) > $len) return false;
850
+				while ($bits > 1)
851 851
 				{
852 852
 					$i++;
853
-					$b=ord($str[$i]);
854
-					if($b < 128 || $b > 191) return false;
853
+					$b = ord($str[$i]);
854
+					if ($b < 128 || $b > 191) return false;
855 855
 					$bits--;
856 856
 				}
857 857
 			}
@@ -955,24 +955,24 @@  discard block
 block discarded – undo
955 955
 	}
956 956
 
957 957
 	// camel naming conventions
958
-	function getAllAttributes() {return $this->attr;}
959
-	function getAttribute($name) {return $this->__get($name);}
960
-	function setAttribute($name, $value) {$this->__set($name, $value);}
961
-	function hasAttribute($name) {return $this->__isset($name);}
962
-	function removeAttribute($name) {$this->__set($name, null);}
963
-	function getElementById($id) {return $this->find("#$id", 0);}
964
-	function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
965
-	function getElementByTagName($name) {return $this->find($name, 0);}
966
-	function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);}
967
-	function parentNode() {return $this->parent();}
968
-	function childNodes($idx=-1) {return $this->children($idx);}
969
-	function firstChild() {return $this->first_child();}
970
-	function lastChild() {return $this->last_child();}
971
-	function nextSibling() {return $this->next_sibling();}
972
-	function previousSibling() {return $this->prev_sibling();}
973
-	function hasChildNodes() {return $this->has_child();}
974
-	function nodeName() {return $this->tag;}
975
-	function appendChild($node) {$node->parent($this); return $node;}
958
+	function getAllAttributes() {return $this->attr; }
959
+	function getAttribute($name) {return $this->__get($name); }
960
+	function setAttribute($name, $value) {$this->__set($name, $value); }
961
+	function hasAttribute($name) {return $this->__isset($name); }
962
+	function removeAttribute($name) {$this->__set($name, null); }
963
+	function getElementById($id) {return $this->find("#$id", 0); }
964
+	function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); }
965
+	function getElementByTagName($name) {return $this->find($name, 0); }
966
+	function getElementsByTagName($name, $idx = null) {return $this->find($name, $idx); }
967
+	function parentNode() {return $this->parent(); }
968
+	function childNodes($idx = -1) {return $this->children($idx); }
969
+	function firstChild() {return $this->first_child(); }
970
+	function lastChild() {return $this->last_child(); }
971
+	function nextSibling() {return $this->next_sibling(); }
972
+	function previousSibling() {return $this->prev_sibling(); }
973
+	function hasChildNodes() {return $this->has_child(); }
974
+	function nodeName() {return $this->tag; }
975
+	function appendChild($node) {$node->parent($this); return $node; }
976 976
 
977 977
 }
978 978
 
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 		'option'=>array('option'=>1),
1029 1029
 	);
1030 1030
 
1031
-	function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1031
+	function __construct($str = null, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1032 1032
 	{
1033 1033
 		if ($str)
1034 1034
 		{
1035
-			if (preg_match("/^http:\/\//i",$str) || is_file($str))
1035
+			if (preg_match("/^http:\/\//i", $str) || is_file($str))
1036 1036
 			{
1037 1037
 				$this->load_file($str);
1038 1038
 			}
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		}
1044 1044
 		// Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html.
1045 1045
 		if (!$forceTagsClosed) {
1046
-			$this->optional_closing_array=array();
1046
+			$this->optional_closing_array = array();
1047 1047
 		}
1048 1048
 		$this->_target_charset = $target_charset;
1049 1049
 	}
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 	}
1055 1055
 
1056 1056
 	// load html from string
1057
-	function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1057
+	function load($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1058 1058
 	{
1059 1059
 		global $debug_object;
1060 1060
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 		$args = func_get_args();
1097 1097
 		$this->load(call_user_func_array('file_get_contents', $args), true);
1098 1098
 		// Throw an error if we can't properly load the dom.
1099
-		if (($error=error_get_last())!==null) {
1099
+		if (($error = error_get_last()) !== null) {
1100 1100
 			$this->clear();
1101 1101
 			return false;
1102 1102
 		}
@@ -1115,16 +1115,16 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 	// save dom as string
1118
-	function save($filepath='')
1118
+	function save($filepath = '')
1119 1119
 	{
1120 1120
 		$ret = $this->root->innertext();
1121
-		if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX);
1121
+		if ($filepath !== '') file_put_contents($filepath, $ret, LOCK_EX);
1122 1122
 		return $ret;
1123 1123
 	}
1124 1124
 
1125 1125
 	// find dom node by css selector
1126 1126
 	// Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
1127
-	function find($selector, $idx=null, $lowercase=false)
1127
+	function find($selector, $idx = null, $lowercase = false)
1128 1128
 	{
1129 1129
 		return $this->root->find($selector, $idx, $lowercase);
1130 1130
 	}
@@ -1132,22 +1132,22 @@  discard block
 block discarded – undo
1132 1132
 	// clean up memory due to php5 circular references memory leak...
1133 1133
 	function clear()
1134 1134
 	{
1135
-		foreach ($this->nodes as $n) {$n->clear(); $n = null;}
1135
+		foreach ($this->nodes as $n) {$n->clear(); $n = null; }
1136 1136
 		// This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear.
1137
-		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;}
1138
-		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);}
1139
-		if (isset($this->root)) {$this->root->clear(); unset($this->root);}
1137
+		if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null; }
1138
+		if (isset($this->parent)) {$this->parent->clear(); unset($this->parent); }
1139
+		if (isset($this->root)) {$this->root->clear(); unset($this->root); }
1140 1140
 		unset($this->doc);
1141 1141
 		unset($this->noise);
1142 1142
 	}
1143 1143
 
1144
-	function dump($show_attr=true)
1144
+	function dump($show_attr = true)
1145 1145
 	{
1146 1146
 		$this->root->dump($show_attr);
1147 1147
 	}
1148 1148
 
1149 1149
 	// prepare HTML data and init everything
1150
-	protected function prepare($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
1150
+	protected function prepare($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT)
1151 1151
 	{
1152 1152
 		$this->clear();
1153 1153
 
@@ -1178,13 +1178,13 @@  discard block
 block discarded – undo
1178 1178
 		$this->root->_[HDOM_INFO_BEGIN] = -1;
1179 1179
 		$this->root->nodetype = HDOM_TYPE_ROOT;
1180 1180
 		$this->parent = $this->root;
1181
-		if ($this->size>0) $this->char = $this->doc[0];
1181
+		if ($this->size > 0) $this->char = $this->doc[0];
1182 1182
 	}
1183 1183
 
1184 1184
 	// parse html content
1185 1185
 	protected function parse()
1186 1186
 	{
1187
-		if (($s = $this->copy_until_char('<'))==='')
1187
+		if (($s = $this->copy_until_char('<')) === '')
1188 1188
 		{
1189 1189
 			return $this->read_tag();
1190 1190
 		}
@@ -1213,18 +1213,18 @@  discard block
 block discarded – undo
1213 1213
 			if ($success)
1214 1214
 			{
1215 1215
 				$charset = $matches[1];
1216
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);}
1216
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: '.$charset); }
1217 1217
 			}
1218 1218
 
1219 1219
 		}
1220 1220
 
1221 1221
 		if (empty($charset))
1222 1222
 		{
1223
-			$el = $this->root->find('meta[http-equiv=Content-Type]',0, true);
1223
+			$el = $this->root->find('meta[http-equiv=Content-Type]', 0, true);
1224 1224
 			if (!empty($el))
1225 1225
 			{
1226 1226
 				$fullvalue = $el->content;
1227
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);}
1227
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found'.$fullvalue); }
1228 1228
 
1229 1229
 				if (!empty($fullvalue))
1230 1230
 				{
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 					else
1237 1237
 					{
1238 1238
 						// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
1239
-						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
1239
+						if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.'); }
1240 1240
 						$charset = 'ISO-8859-1';
1241 1241
 					}
1242 1242
 				}
@@ -1251,14 +1251,14 @@  discard block
 block discarded – undo
1251 1251
 			if (function_exists('mb_detect_encoding'))
1252 1252
 			{
1253 1253
 				// Have php try to detect the encoding from the text given to us.
1254
-				$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
1255
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);}
1254
+				$charset = mb_detect_encoding($this->root->plaintext."ascii", $encoding_list = array("UTF-8", "CP1252"));
1255
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: '.$charset); }
1256 1256
 			}
1257 1257
 
1258 1258
 			// and if this doesn't work...  then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...
1259 1259
 			if ($charset === false)
1260 1260
 			{
1261
-				if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');}
1261
+				if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8'); }
1262 1262
 				$charset = 'UTF-8';
1263 1263
 			}
1264 1264
 		}
@@ -1266,11 +1266,11 @@  discard block
 block discarded – undo
1266 1266
 		// Since CP1252 is a superset, if we get one of it's subsets, we want it instead.
1267 1267
 		if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))
1268 1268
 		{
1269
-			if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
1269
+			if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing '.$charset.' with CP1252 as its a superset'); }
1270 1270
 			$charset = 'CP1252';
1271 1271
 		}
1272 1272
 
1273
-		if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);}
1273
+		if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - '.$charset); }
1274 1274
 
1275 1275
 		return $this->_charset = $charset;
1276 1276
 	}
@@ -1278,41 +1278,41 @@  discard block
 block discarded – undo
1278 1278
 	// read tag info
1279 1279
 	protected function read_tag()
1280 1280
 	{
1281
-		if ($this->char!=='<')
1281
+		if ($this->char !== '<')
1282 1282
 		{
1283 1283
 			$this->root->_[HDOM_INFO_END] = $this->cursor;
1284 1284
 			return false;
1285 1285
 		}
1286 1286
 		$begin_tag_pos = $this->pos;
1287
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1287
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1288 1288
 
1289 1289
 		// end tag
1290
-		if ($this->char==='/')
1290
+		if ($this->char === '/')
1291 1291
 		{
1292
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1292
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1293 1293
 			// This represents the change in the simple_html_dom trunk from revision 180 to 181.
1294 1294
 			// $this->skip($this->token_blank_t);
1295 1295
 			$this->skip($this->token_blank);
1296 1296
 			$tag = $this->copy_until_char('>');
1297 1297
 
1298 1298
 			// skip attributes in end tag
1299
-			if (($pos = strpos($tag, ' '))!==false)
1299
+			if (($pos = strpos($tag, ' ')) !== false)
1300 1300
 				$tag = substr($tag, 0, $pos);
1301 1301
 
1302 1302
 			$parent_lower = strtolower($this->parent->tag);
1303 1303
 			$tag_lower = strtolower($tag);
1304 1304
 
1305
-			if ($parent_lower!==$tag_lower)
1305
+			if ($parent_lower !== $tag_lower)
1306 1306
 			{
1307 1307
 				if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower]))
1308 1308
 				{
1309 1309
 					$this->parent->_[HDOM_INFO_END] = 0;
1310 1310
 					$org_parent = $this->parent;
1311 1311
 
1312
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1312
+					while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower)
1313 1313
 						$this->parent = $this->parent->parent;
1314 1314
 
1315
-					if (strtolower($this->parent->tag)!==$tag_lower) {
1315
+					if (strtolower($this->parent->tag) !== $tag_lower) {
1316 1316
 						$this->parent = $org_parent; // restore origonal parent
1317 1317
 						if ($this->parent->parent) $this->parent = $this->parent->parent;
1318 1318
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
@@ -1324,17 +1324,17 @@  discard block
 block discarded – undo
1324 1324
 					$this->parent->_[HDOM_INFO_END] = 0;
1325 1325
 					$org_parent = $this->parent;
1326 1326
 
1327
-					while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower)
1327
+					while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower)
1328 1328
 						$this->parent = $this->parent->parent;
1329 1329
 
1330
-					if (strtolower($this->parent->tag)!==$tag_lower)
1330
+					if (strtolower($this->parent->tag) !== $tag_lower)
1331 1331
 					{
1332 1332
 						$this->parent = $org_parent; // restore origonal parent
1333 1333
 						$this->parent->_[HDOM_INFO_END] = $this->cursor;
1334 1334
 						return $this->as_text_node($tag);
1335 1335
 					}
1336 1336
 				}
1337
-				else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower)
1337
+				else if (($this->parent->parent) && strtolower($this->parent->parent->tag) === $tag_lower)
1338 1338
 				{
1339 1339
 					$this->parent->_[HDOM_INFO_END] = 0;
1340 1340
 					$this->parent = $this->parent->parent;
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 			$this->parent->_[HDOM_INFO_END] = $this->cursor;
1347 1347
 			if ($this->parent->parent) $this->parent = $this->parent->parent;
1348 1348
 
1349
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1349
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1350 1350
 			return true;
1351 1351
 		}
1352 1352
 
@@ -1357,25 +1357,25 @@  discard block
 block discarded – undo
1357 1357
 		$node->tag_start = $begin_tag_pos;
1358 1358
 
1359 1359
 		// doctype, cdata & comments...
1360
-		if (isset($tag[0]) && $tag[0]==='!') {
1361
-			$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
1360
+		if (isset($tag[0]) && $tag[0] === '!') {
1361
+			$node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until_char('>');
1362 1362
 
1363
-			if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') {
1363
+			if (isset($tag[2]) && $tag[1] === '-' && $tag[2] === '-') {
1364 1364
 				$node->nodetype = HDOM_TYPE_COMMENT;
1365 1365
 				$node->tag = 'comment';
1366 1366
 			} else {
1367 1367
 				$node->nodetype = HDOM_TYPE_UNKNOWN;
1368 1368
 				$node->tag = 'unknown';
1369 1369
 			}
1370
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1370
+			if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>';
1371 1371
 			$this->link_nodes($node, true);
1372
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1372
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1373 1373
 			return true;
1374 1374
 		}
1375 1375
 
1376 1376
 		// text
1377
-		if ($pos=strpos($tag, '<')!==false) {
1378
-			$tag = '<' . substr($tag, 0, -1);
1377
+		if ($pos = strpos($tag, '<') !== false) {
1378
+			$tag = '<'.substr($tag, 0, -1);
1379 1379
 			$node->_[HDOM_INFO_TEXT] = $tag;
1380 1380
 			$this->link_nodes($node, false);
1381 1381
 			$this->char = $this->doc[--$this->pos]; // prev
@@ -1383,15 +1383,15 @@  discard block
 block discarded – undo
1383 1383
 		}
1384 1384
 
1385 1385
 		if (!preg_match("/^[\w-:]+$/", $tag)) {
1386
-			$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
1387
-			if ($this->char==='<') {
1386
+			$node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until('<>');
1387
+			if ($this->char === '<') {
1388 1388
 				$this->link_nodes($node, false);
1389 1389
 				return true;
1390 1390
 			}
1391 1391
 
1392
-			if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>';
1392
+			if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>';
1393 1393
 			$this->link_nodes($node, false);
1394
-			$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1394
+			$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1395 1395
 			return true;
1396 1396
 		}
1397 1397
 
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 		$node->tag = ($this->lowercase) ? $tag_lower : $tag;
1402 1402
 
1403 1403
 		// handle optional closing tags
1404
-		if (isset($this->optional_closing_tags[$tag_lower]) )
1404
+		if (isset($this->optional_closing_tags[$tag_lower]))
1405 1405
 		{
1406 1406
 			while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)]))
1407 1407
 			{
@@ -1417,67 +1417,67 @@  discard block
 block discarded – undo
1417 1417
 		// attributes
1418 1418
 		do
1419 1419
 		{
1420
-			if ($this->char!==null && $space[0]==='')
1420
+			if ($this->char !== null && $space[0] === '')
1421 1421
 			{
1422 1422
 				break;
1423 1423
 			}
1424 1424
 			$name = $this->copy_until($this->token_equal);
1425
-			if ($guard===$this->pos)
1425
+			if ($guard === $this->pos)
1426 1426
 			{
1427
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1427
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1428 1428
 				continue;
1429 1429
 			}
1430 1430
 			$guard = $this->pos;
1431 1431
 
1432 1432
 			// handle endless '<'
1433
-			if ($this->pos>=$this->size-1 && $this->char!=='>') {
1433
+			if ($this->pos >= $this->size - 1 && $this->char !== '>') {
1434 1434
 				$node->nodetype = HDOM_TYPE_TEXT;
1435 1435
 				$node->_[HDOM_INFO_END] = 0;
1436
-				$node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name;
1436
+				$node->_[HDOM_INFO_TEXT] = '<'.$tag.$space[0].$name;
1437 1437
 				$node->tag = 'text';
1438 1438
 				$this->link_nodes($node, false);
1439 1439
 				return true;
1440 1440
 			}
1441 1441
 
1442 1442
 			// handle mismatch '<'
1443
-			if ($this->doc[$this->pos-1]=='<') {
1443
+			if ($this->doc[$this->pos - 1] == '<') {
1444 1444
 				$node->nodetype = HDOM_TYPE_TEXT;
1445 1445
 				$node->tag = 'text';
1446 1446
 				$node->attr = array();
1447 1447
 				$node->_[HDOM_INFO_END] = 0;
1448
-				$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1);
1448
+				$node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos - $begin_tag_pos - 1);
1449 1449
 				$this->pos -= 2;
1450
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1450
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1451 1451
 				$this->link_nodes($node, false);
1452 1452
 				return true;
1453 1453
 			}
1454 1454
 
1455
-			if ($name!=='/' && $name!=='') {
1455
+			if ($name !== '/' && $name !== '') {
1456 1456
 				$space[1] = $this->copy_skip($this->token_blank);
1457 1457
 				$name = $this->restore_noise($name);
1458 1458
 				if ($this->lowercase) $name = strtolower($name);
1459
-				if ($this->char==='=') {
1460
-					$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1459
+				if ($this->char === '=') {
1460
+					$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1461 1461
 					$this->parse_attr($node, $name, $space);
1462 1462
 				}
1463 1463
 				else {
1464 1464
 					//no value attr: nowrap, checked selected...
1465 1465
 					$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
1466 1466
 					$node->attr[$name] = true;
1467
-					if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev
1467
+					if ($this->char != '>') $this->char = $this->doc[--$this->pos]; // prev
1468 1468
 				}
1469 1469
 				$node->_[HDOM_INFO_SPACE][] = $space;
1470 1470
 				$space = array($this->copy_skip($this->token_blank), '', '');
1471 1471
 			}
1472 1472
 			else
1473 1473
 				break;
1474
-		} while ($this->char!=='>' && $this->char!=='/');
1474
+		} while ($this->char !== '>' && $this->char !== '/');
1475 1475
 
1476 1476
 		$this->link_nodes($node, true);
1477 1477
 		$node->_[HDOM_INFO_ENDSPACE] = $space[0];
1478 1478
 
1479 1479
 		// check self closing
1480
-		if ($this->copy_until_char_escape('>')==='/')
1480
+		if ($this->copy_until_char_escape('>') === '/')
1481 1481
 		{
1482 1482
 			$node->_[HDOM_INFO_ENDSPACE] .= '/';
1483 1483
 			$node->_[HDOM_INFO_END] = 0;
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 			// reset parent
1488 1488
 			if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node;
1489 1489
 		}
1490
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1490
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1491 1491
 
1492 1492
 		// If it's a BR tag, we need to set it's text to the default text.
1493 1493
 		// This way when we see it in plaintext, we can generate formatting that the user wants.
@@ -1514,15 +1514,15 @@  discard block
 block discarded – undo
1514 1514
 		switch ($this->char) {
1515 1515
 			case '"':
1516 1516
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
1517
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1517
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1518 1518
 				$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"'));
1519
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1519
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1520 1520
 				break;
1521 1521
 			case '\'':
1522 1522
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE;
1523
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1523
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1524 1524
 				$node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\''));
1525
-				$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1525
+				$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1526 1526
 				break;
1527 1527
 			default:
1528 1528
 				$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
@@ -1553,16 +1553,16 @@  discard block
 block discarded – undo
1553 1553
 	{
1554 1554
 		$node = new simple_html_dom_node($this);
1555 1555
 		++$this->cursor;
1556
-		$node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
1556
+		$node->_[HDOM_INFO_TEXT] = '</'.$tag.'>';
1557 1557
 		$this->link_nodes($node, false);
1558
-		$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1558
+		$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1559 1559
 		return true;
1560 1560
 	}
1561 1561
 
1562 1562
 	protected function skip($chars)
1563 1563
 	{
1564 1564
 		$this->pos += strspn($this->doc, $chars, $this->pos);
1565
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1565
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1566 1566
 	}
1567 1567
 
1568 1568
 	protected function copy_skip($chars)
@@ -1570,8 +1570,8 @@  discard block
 block discarded – undo
1570 1570
 		$pos = $this->pos;
1571 1571
 		$len = strspn($this->doc, $chars, $pos);
1572 1572
 		$this->pos += $len;
1573
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1574
-		if ($len===0) return '';
1573
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1574
+		if ($len === 0) return '';
1575 1575
 		return substr($this->doc, $pos, $len);
1576 1576
 	}
1577 1577
 
@@ -1580,70 +1580,70 @@  discard block
 block discarded – undo
1580 1580
 		$pos = $this->pos;
1581 1581
 		$len = strcspn($this->doc, $chars, $pos);
1582 1582
 		$this->pos += $len;
1583
-		$this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
1583
+		$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
1584 1584
 		return substr($this->doc, $pos, $len);
1585 1585
 	}
1586 1586
 
1587 1587
 	protected function copy_until_char($char)
1588 1588
 	{
1589
-		if ($this->char===null) return '';
1589
+		if ($this->char === null) return '';
1590 1590
 
1591
-		if (($pos = strpos($this->doc, $char, $this->pos))===false) {
1592
-			$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1591
+		if (($pos = strpos($this->doc, $char, $this->pos)) === false) {
1592
+			$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
1593 1593
 			$this->char = null;
1594 1594
 			$this->pos = $this->size;
1595 1595
 			return $ret;
1596 1596
 		}
1597 1597
 
1598
-		if ($pos===$this->pos) return '';
1598
+		if ($pos === $this->pos) return '';
1599 1599
 		$pos_old = $this->pos;
1600 1600
 		$this->char = $this->doc[$pos];
1601 1601
 		$this->pos = $pos;
1602
-		return substr($this->doc, $pos_old, $pos-$pos_old);
1602
+		return substr($this->doc, $pos_old, $pos - $pos_old);
1603 1603
 	}
1604 1604
 
1605 1605
 	protected function copy_until_char_escape($char)
1606 1606
 	{
1607
-		if ($this->char===null) return '';
1607
+		if ($this->char === null) return '';
1608 1608
 
1609 1609
 		$start = $this->pos;
1610 1610
 		while (1)
1611 1611
 		{
1612
-			if (($pos = strpos($this->doc, $char, $start))===false)
1612
+			if (($pos = strpos($this->doc, $char, $start)) === false)
1613 1613
 			{
1614
-				$ret = substr($this->doc, $this->pos, $this->size-$this->pos);
1614
+				$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
1615 1615
 				$this->char = null;
1616 1616
 				$this->pos = $this->size;
1617 1617
 				return $ret;
1618 1618
 			}
1619 1619
 
1620
-			if ($pos===$this->pos) return '';
1620
+			if ($pos === $this->pos) return '';
1621 1621
 
1622
-			if ($this->doc[$pos-1]==='\\') {
1623
-				$start = $pos+1;
1622
+			if ($this->doc[$pos - 1] === '\\') {
1623
+				$start = $pos + 1;
1624 1624
 				continue;
1625 1625
 			}
1626 1626
 
1627 1627
 			$pos_old = $this->pos;
1628 1628
 			$this->char = $this->doc[$pos];
1629 1629
 			$this->pos = $pos;
1630
-			return substr($this->doc, $pos_old, $pos-$pos_old);
1630
+			return substr($this->doc, $pos_old, $pos - $pos_old);
1631 1631
 		}
1632 1632
 	}
1633 1633
 
1634 1634
 	// remove noise from html content
1635 1635
 	// save the noise in the $this->noise array.
1636
-	protected function remove_noise($pattern, $remove_tag=false)
1636
+	protected function remove_noise($pattern, $remove_tag = false)
1637 1637
 	{
1638 1638
 		global $debug_object;
1639 1639
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1640 1640
 
1641 1641
 		$count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
1642 1642
 
1643
-		for ($i=$count-1; $i>-1; --$i)
1643
+		for ($i = $count - 1; $i > -1; --$i)
1644 1644
 		{
1645
-			$key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);
1646
-			if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); }
1645
+			$key = '___noise___'.sprintf('% 5d', count($this->noise) + 1000);
1646
+			if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: '.$key); }
1647 1647
 			$idx = ($remove_tag) ? 0 : 1;
1648 1648
 			$this->noise[$key] = $matches[$i][$idx][0];
1649 1649
 			$this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 
1652 1652
 		// reset the length of content
1653 1653
 		$this->size = strlen($this->doc);
1654
-		if ($this->size>0)
1654
+		if ($this->size > 0)
1655 1655
 		{
1656 1656
 			$this->char = $this->doc[0];
1657 1657
 		}
@@ -1663,28 +1663,28 @@  discard block
 block discarded – undo
1663 1663
 		global $debug_object;
1664 1664
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1665 1665
 
1666
-		while (($pos=strpos($text, '___noise___'))!==false)
1666
+		while (($pos = strpos($text, '___noise___')) !== false)
1667 1667
 		{
1668 1668
 			// Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us...
1669
-			if (strlen($text) > $pos+15)
1669
+			if (strlen($text) > $pos + 15)
1670 1670
 			{
1671
-				$key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];
1672
-				if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); }
1671
+				$key = '___noise___'.$text[$pos + 11].$text[$pos + 12].$text[$pos + 13].$text[$pos + 14].$text[$pos + 15];
1672
+				if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: '.$key); }
1673 1673
 
1674 1674
 				if (isset($this->noise[$key]))
1675 1675
 				{
1676
-					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16);
1676
+					$text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos + 16);
1677 1677
 				}
1678 1678
 				else
1679 1679
 				{
1680 1680
 					// do this to prevent an infinite loop.
1681
-					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16);
1681
+					$text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key.substr($text, $pos + 16);
1682 1682
 				}
1683 1683
 			}
1684 1684
 			else
1685 1685
 			{
1686 1686
 				// There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
1687
-				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11);
1687
+				$text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY'.substr($text, $pos + 11);
1688 1688
 			}
1689 1689
 		}
1690 1690
 		return $text;
@@ -1696,9 +1696,9 @@  discard block
 block discarded – undo
1696 1696
 		global $debug_object;
1697 1697
 		if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
1698 1698
 
1699
-		foreach($this->noise as $noiseElement)
1699
+		foreach ($this->noise as $noiseElement)
1700 1700
 		{
1701
-			if (strpos($noiseElement, $text)!==false)
1701
+			if (strpos($noiseElement, $text) !== false)
1702 1702
 			{
1703 1703
 				return $noiseElement;
1704 1704
 			}
@@ -1727,16 +1727,16 @@  discard block
 block discarded – undo
1727 1727
 	}
1728 1728
 
1729 1729
 	// camel naming conventions
1730
-	function childNodes($idx=-1) {return $this->root->childNodes($idx);}
1731
-	function firstChild() {return $this->root->first_child();}
1732
-	function lastChild() {return $this->root->last_child();}
1733
-	function createElement($name, $value=null) {return @str_get_html("<$name>$value</$name>")->first_child();}
1734
-	function createTextNode($value) {return @end(str_get_html($value)->nodes);}
1735
-	function getElementById($id) {return $this->find("#$id", 0);}
1736
-	function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);}
1737
-	function getElementByTagName($name) {return $this->find($name, 0);}
1738
-	function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);}
1739
-	function loadFile() {$args = func_get_args();$this->load_file($args);}
1730
+	function childNodes($idx = -1) {return $this->root->childNodes($idx); }
1731
+	function firstChild() {return $this->root->first_child(); }
1732
+	function lastChild() {return $this->root->last_child(); }
1733
+	function createElement($name, $value = null) {return @str_get_html("<$name>$value</$name>")->first_child(); }
1734
+	function createTextNode($value) {return @end(str_get_html($value)->nodes); }
1735
+	function getElementById($id) {return $this->find("#$id", 0); }
1736
+	function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); }
1737
+	function getElementByTagName($name) {return $this->find($name, 0); }
1738
+	function getElementsByTagName($name, $idx = -1) {return $this->find($name, $idx); }
1739
+	function loadFile() {$args = func_get_args(); $this->load_file($args); }
1740 1740
 }
1741 1741
 
1742 1742
 ?>
1743 1743
\ No newline at end of file
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Aircraft from %s"), $manufacturer);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Aircraft").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$aircraft_array = $Spotter->countAllAircraftTypesByManufacturer($manufacturer);
50 50
 	if (!empty($aircraft_array))
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		print '</thead>';
60 60
 		print '<tbody>';
61 61
 		$i = 1;
62
-		foreach($aircraft_array as $aircraft_item)
62
+		foreach ($aircraft_array as $aircraft_item)
63 63
 		{
64 64
 			print '<tr>';
65 65
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
install/class.settings.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 		$Common = new Common();
13 13
 		$settings_filename = '../require/settings.php';
14 14
 		$content = file_get_contents($settings_filename);
15
-		$fh = fopen($settings_filename,'w');
15
+		$fh = fopen($settings_filename, 'w');
16 16
 		foreach ($settings as $settingname => $value) {
17 17
 			if ($value == 'TRUE' || $value == 'FALSE') {
18 18
 				$pattern = '/\R\$'.$settingname." = ".'(TRUE|FALSE)'."/";
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 				$replace = "\n".'\$'.$settingname." = '".$value."'";
80 80
 			}
81 81
 			$rep_cnt = 0;
82
-			$content = preg_replace($pattern,$replace,$content,1,$rep_cnt);
82
+			$content = preg_replace($pattern, $replace, $content, 1, $rep_cnt);
83 83
 			
84 84
 			/// If setting was a string and is now an array
85 85
 			if ($rep_cnt === 0 && is_array($value)) {
86 86
 				$pattern = '/\R\$'.$settingname." = '".'(.*)'."'/";
87
-				$content = preg_replace($pattern,$replace,$content,1,$rep_cnt);
87
+				$content = preg_replace($pattern, $replace, $content, 1, $rep_cnt);
88 88
 			}
89 89
 			
90 90
 			// If setting is not in settings.php (for update)
91 91
 			if ($rep_cnt === 0) {
92
-				$content = preg_replace('/\?>/',$replace.";\n?>",$content,1,$rep_cnt);
92
+				$content = preg_replace('/\?>/', $replace.";\n?>", $content, 1, $rep_cnt);
93 93
 			}
94 94
 
95 95
 		}
96
-		fwrite($fh,$content);
96
+		fwrite($fh, $content);
97 97
 		fclose($fh);
98 98
 	}
99 99
 
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 		$Common = new Common();
106 106
 		$settings_filename = '../require/settings.php';
107 107
 		$content = file_get_contents($settings_filename);
108
-		$fh = fopen($settings_filename,'w');
108
+		$fh = fopen($settings_filename, 'w');
109 109
 		foreach ($settings as $settingname) {
110 110
 			$pattern = '/\R\$'.$settingname." = /";
111 111
 			$replace = '//$'.$settingname." = ";
112
-			$content = preg_replace($pattern,$replace,$content);
112
+			$content = preg_replace($pattern, $replace, $content);
113 113
 		}
114
-		fwrite($fh,$content);
114
+		fwrite($fh, $content);
115 115
 		fclose($fh);
116 116
 	}
117 117
 }
Please login to merge, or discard this patch.
airport-statistics-registration.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airport');
8 8
         die();
9 9
 }
10
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", "");
13 13
 $airport_array = $Spotter->getAllAirportInfo($airport);
14 14
 
15 15
 if (!empty($airport_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft by Registration to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
17
+	$title = sprintf(_("Most Common Aircraft by Registration to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	$airport_names = $Stats->getAllAirportNames();
26 26
 	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
27 27
 	ksort($airport_names);
28
-	foreach($airport_names as $airport_name)
28
+	foreach ($airport_names as $airport_name)
29 29
 	{
30
-		if($_GET['airport'] == $airport_name['airport_icao'])
30
+		if ($_GET['airport'] == $airport_name['airport_icao'])
31 31
 		{
32 32
 			print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
33 33
 		} else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	include('airport-sub-menu.php');
59 59
 	print '<div class="column">';
60 60
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
61
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>';
61
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>';
62 62
 
63 63
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByAirport($airport);
64 64
 	if (!empty($aircraft_array))
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		print '</thead>';
76 76
 		print '<tbody>';
77 77
 		$i = 1;
78
-		foreach($aircraft_array as $aircraft_item)
78
+		foreach ($aircraft_array as $aircraft_item)
79 79
 		{
80 80
 			print '<tr>';
81 81
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
aircraft.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
20 20
 	$previous = null;
21 21
 	print '<div class="alphabet-legend">';
22
-	foreach($aircraft_types as $value) {
22
+	foreach ($aircraft_types as $value) {
23 23
 		//$firstLetter = substr($value['aircraft_name'], 0, 1);
24 24
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
25
-		if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
25
+		if ($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
26 26
 		{
27 27
 			if ($previous !== null) print ' | ';
28 28
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 	print '</div>';
33 33
 	$previous = null;
34
-	foreach($aircraft_types as $value) {
34
+	foreach ($aircraft_types as $value) {
35 35
 		//$firstLetter = substr($value['aircraft_name'], 0, 1);
36 36
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
37 37
 		if ($firstLetter != "")
38 38
 		{
39
-			if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
39
+			if ($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
40 40
 			{
41 41
 				if ($previous !== null) print '</div>';
42 42
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.