当前位置: 首页>>代码示例>>PHP>>正文


PHP Spotter::getAllAircraftType方法代码示例

本文整理汇总了PHP中Spotter::getAllAircraftType方法的典型用法代码示例。如果您正苦于以下问题:PHP Spotter::getAllAircraftType方法的具体用法?PHP Spotter::getAllAircraftType怎么用?PHP Spotter::getAllAircraftType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spotter的用法示例。


在下文中一共展示了Spotter::getAllAircraftType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 static function add($line)
 {
     global $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBSupdate, $globalDebug;
     date_default_timezone_set('UTC');
     // signal handler - playing nice with sockets and dump1090
     // pcntl_signal_dispatch();
     // get the time (so we can figure the timeout)
     $time = time();
     //pcntl_signal_dispatch();
     $dataFound = false;
     $putinarchive = false;
     $send = false;
     // SBS format is CSV format
     if (is_array($line) && isset($line['hex'])) {
         //print_r($line);
         if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) == 6) {
             $hex = trim($line['hex']);
             $id = trim($line['hex']);
             //print_r(self::$all_flights);
             if (!isset(self::$all_flights[$id]['hex'])) {
                 self::$all_flights[$id] = array('hex' => $hex, 'datetime' => $line['datetime']);
                 if (!isset($line['aircraft_icao'])) {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('aircraft_icao' => Spotter::getAllAircraftType($hex)));
                 } else {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('aircraft_icao' => $line['aircraft_icao']));
                 }
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => ''));
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('lastupdate' => time()));
                 if ($globalDebug) {
                     echo "*********** New aircraft hex : " . $hex . " ***********\n";
                 }
             }
             if (isset($line['datetime']) && $line['datetime'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('datetime' => $line['datetime']));
             }
             if (isset($line['registration']) && $line['registration'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('registration' => $line['registration']));
             }
             if (isset($line['waypoints']) && $line['waypoints'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('waypoints' => $line['waypoints']));
             }
             if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('pilot_id' => $line['pilot_id']));
             }
             if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('pilot_name' => $line['pilot_name']));
             }
             if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && self::$all_flights[$id]['ident'] != trim($line['ident'])) {
                 self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('ident' => trim($line['ident'])));
                 if (!isset($line['id'])) {
                     if (!isset($globalDaemon)) {
                         $globalDaemon = TRUE;
                     }
                     if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) {
                         self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('id' => self::$all_flights[$id]['hex'] . '-' . self::$all_flights[$id]['ident'] . '-' . date('YmdGi')));
                     } else {
                         self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('id' => self::$all_flights[$id]['hex'] . '-' . self::$all_flights[$id]['ident']));
                     }
                 } else {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('id' => $line['id']));
                 }
                 $putinarchive = true;
                 if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) {
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
                 } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) {
                     $line['departure_airport_icao'] = Spotter::getAirportIcao($line['departure_airport_iata']);
                     $line['arrival_airport_icao'] = Spotter::getAirportIcao($line['arrival_airport_iata']);
                     self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => ''));
                 } else {
                     $route = Spotter::getRouteInfo(trim($line['ident']));
                     if (count($route) > 0) {
                         //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
                         if ($route['fromairport_icao'] != $route['toairport_icao']) {
                             //    self::$all_flights[$id] = array_merge(self::$all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop']));
                             self::$all_flights[$id] = array_merge(self::$all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop']));
                         }
                     }
                     if (!isset($globalFork)) {
                         $globalFork = TRUE;
                     }
                     if (function_exists('pcntl_fork') && $globalFork) {
                         $pids[$id] = pcntl_fork();
                         if (!$pids[$id]) {
                             $sid = posix_setsid();
                             SBS::get_Schedule($id, trim($line['ident']));
                             exit(0);
                         }
                     }
                 }
             }
             if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
                 if (!isset(self::$all_flights[$id]['latitude']) || self::$all_flights[$id]['latitude'] == '' || abs(self::$all_flights[$id]['latitude'] - $line['latitude']) < 3 || $line['format_source'] != 'sbs') {
                     if (!isset(self::$all_flights[$id]['archive_latitude'])) {
                         self::$all_flights[$id]['archive_latitude'] = $line['latitude'];
                     }
                     if (!isset(self::$all_flights[$id]['livedb_latitude']) || abs(self::$all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.02) {
                         self::$all_flights[$id]['livedb_latitude'] = $line['latitude'];
                         $dataFound = true;
                     }
                     // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n";
//.........这里部分代码省略.........
开发者ID:kletellier,项目名称:FlightAirMap,代码行数:101,代码来源:class.SBS.php

示例2: add

 function add($line)
 {
     global $globalDebug, $globalServerUserID;
     date_default_timezone_set('UTC');
     if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'aprs')) {
         if (is_array($line) && isset($line['hex'])) {
             if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
                 $data['hex'] = trim($line['hex']);
                 if (preg_match('/^(\\d{4}(?:\\-\\d{2}){2} \\d{2}(?:\\:\\d{2}){2})$/', $line['datetime'])) {
                     $data['datetime'] = $line['datetime'];
                 } else {
                     $data['datetime'] = date('Y-m-d H:i:s');
                 }
                 if (!isset($line['aircraft_icao'])) {
                     $Spotter = new Spotter();
                     $aircraft_icao = $Spotter->getAllAircraftType($data['hex']);
                     $Spotter->db = null;
                     if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
                         if ($line['aircraft_type'] == 'PARA_GLIDER') {
                             $aircraft_icao = 'GLID';
                         } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') {
                             $aircraft_icao = 'UHEL';
                         } elseif ($line['aircraft_type'] == 'TOW_PLANE') {
                             $aircraft_icao = 'TOWPLANE';
                         } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') {
                             $aircraft_icao = 'POWAIRC';
                         }
                     }
                     $data['aircraft_icao'] = $aircraft_icao;
                 } else {
                     $data['aircraft_icao'] = $line['aircraft_icao'];
                 }
                 //if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n";
             }
             if (isset($line['registration']) && $line['registration'] != '') {
                 $data['registration'] = $line['registration'];
             } else {
                 $data['registration'] = null;
             }
             if (isset($line['waypoints']) && $line['waypoints'] != '') {
                 $data['waypoints'] = $line['waypoints'];
             } else {
                 $data['waypoints'] = null;
             }
             if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
                 $data['ident'] = trim($line['ident']);
             } else {
                 $data['ident'] = null;
             }
             if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
                 if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
                     $data['latitude'] = $line['latitude'];
                 } else {
                     $data['latitude'] = null;
                 }
                 if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
                     if ($line['longitude'] > 180) {
                         $line['longitude'] = $line['longitude'] - 360;
                     }
                     $data['longitude'] = $line['longitude'];
                 } else {
                     $data['longitude'] = null;
                 }
             } else {
                 $data['latitude'] = null;
                 $data['longitude'] = null;
             }
             if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
                 $data['verticalrate'] = $line['verticalrate'];
             } else {
                 $data['verticalrate'] = null;
             }
             if (isset($line['emergency']) && $line['emergency'] != '') {
                 $data['emergency'] = $line['emergency'];
             } else {
                 $data['emergency'] = null;
             }
             if (isset($line['ground']) && $line['ground'] != '') {
                 $data['ground'] = $line['ground'];
             } else {
                 $data['ground'] = null;
             }
             if (isset($line['speed']) && $line['speed'] != '') {
                 $data['speed'] = round($line['speed']);
             } else {
                 $data['speed'] = null;
             }
             if (isset($line['squawk']) && $line['squawk'] != '') {
                 $data['squawk'] = $line['squawk'];
             } else {
                 $data['squawk'] = null;
             }
             if (isset($line['altitude']) && $line['altitude'] != '') {
                 $data['altitude'] = round($line['altitude']);
             } else {
                 $data['altitude'] = null;
             }
             if (isset($line['heading']) && $line['heading'] != '') {
                 $data['heading'] = round($line['heading']);
             } else {
//.........这里部分代码省略.........
开发者ID:linuxpronl,项目名称:FlightAirMap,代码行数:101,代码来源:class.SpotterServer.php

示例3: addSpotterData

 /**
  * Adds a new spotter data
  *
  * @param String $flightaware_id the ID from flightaware
  * @param String $ident the flight ident
  * @param String $aircraft_icao the aircraft type
  * @param String $departure_airport_icao the departure airport
  * @param String $arrival_airport_icao the arrival airport
  * @return String success or false
  *
  */
 public static function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '')
 {
     global $globalURL, $globalIVAO;
     if (!isset($globalIVAO)) {
         $globalIVAO = FALSE;
     }
     date_default_timezone_set('UTC');
     //getting the registration
     if ($flightaware_id != "" && $registration == '') {
         if (!is_string($flightaware_id)) {
             return false;
         } else {
             if ($ModeS != '') {
                 $registration = Spotter::getAircraftRegistrationBymodeS($ModeS);
             } else {
                 $myhex = explode('-', $flightaware_id);
                 if (count($myhex) > 0) {
                     $registration = Spotter::getAircraftRegistrationBymodeS($myhex[0]);
                 }
             }
         }
     }
     //getting the airline information
     if ($ident != "") {
         if (!is_string($ident)) {
             return false;
         } else {
             if (!is_numeric(substr($ident, 0, 3))) {
                 if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
                     $airline_array = Spotter::getAllAirlineInfo(substr($ident, 0, 2));
                 } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
                     $airline_array = Spotter::getAllAirlineInfo(substr($ident, 0, 3));
                 } else {
                     $airline_array = Spotter::getAllAirlineInfo("NA");
                 }
                 if (count($airline_array) == 0) {
                     $airline_array = Spotter::getAllAirlineInfo("NA");
                 }
                 if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") {
                     $airline_array = Spotter::getAllAirlineInfo("NA");
                 }
             } else {
                 $airline_array = Spotter::getAllAirlineInfo("NA");
             }
         }
     }
     //getting the aircraft information
     if ($aircraft_icao != "") {
         if (!is_string($aircraft_icao)) {
             return false;
         } else {
             if ($aircraft_icao == "" || $aircraft_icao == "XXXX") {
                 $aircraft_array = Spotter::getAllAircraftInfo("NA");
             } else {
                 $aircraft_array = Spotter::getAllAircraftInfo($aircraft_icao);
             }
         }
     } else {
         if ($flightaware_id != "") {
             $myhex = explode('-', $flightaware_id);
             if (count($myhex) > 0) {
                 $aircraft_icao = Spotter::getAllAircraftType($myhex[0]);
                 if ($aircraft_icao == "" || $aircraft_icao == "XXXX") {
                     $aircraft_array = Spotter::getAllAircraftInfo("NA");
                 } else {
                     $aircraft_array = Spotter::getAllAircraftInfo($aircraft_icao);
                 }
             }
         }
     }
     //getting the departure airport information
     if ($departure_airport_icao != "") {
         if (!is_string($departure_airport_icao)) {
             return false;
         } else {
             $departure_airport_array = Spotter::getAllAirportInfo($departure_airport_icao);
         }
     }
     //getting the arrival airport information
     if ($arrival_airport_icao != "") {
         if (!is_string($arrival_airport_icao)) {
             return false;
         } else {
             $arrival_airport_array = Spotter::getAllAirportInfo($arrival_airport_icao);
         }
     }
     if ($latitude != "") {
         if (!is_numeric($latitude)) {
             return false;
//.........这里部分代码省略.........
开发者ID:kletellier,项目名称:FlightAirMap,代码行数:101,代码来源:class.Spotter.php

示例4: add

 function add($line)
 {
     global $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBSupdate, $globalDebug, $globalIVAO;
     /*
     	$Spotter = new Spotter();
     	$dbc = $Spotter->db;
     	$SpotterLive = new SpotterLive($dbc);
     	$Common = new Common();
     	$Schedule = new Schedule($dbc);
     */
     date_default_timezone_set('UTC');
     // signal handler - playing nice with sockets and dump1090
     // pcntl_signal_dispatch();
     // get the time (so we can figure the timeout)
     $time = time();
     //pcntl_signal_dispatch();
     $dataFound = false;
     $putinarchive = false;
     $send = false;
     // SBS format is CSV format
     if (is_array($line) && isset($line['hex'])) {
         //print_r($line);
         if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
             /*
             $dbc = $this->db;
             $Connection = new Connection($dbc);
             $Connection->connectionExists();
             $dbc = $Connection->db;
             */
             //$Spotter = new Spotter($dbc);
             //$SpotterLive = new SpotterLive($dbc);
             $Common = new Common();
             //		echo $this->nb++."\n";
             //$this->db = $dbc;
             $hex = trim($line['hex']);
             $id = trim($line['hex']);
             //print_r($this->all_flights);
             if (!isset($this->all_flights[$id]['hex'])) {
                 $this->all_flights[$id] = array('hex' => $hex);
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0));
                 if (preg_match('/^(\\d{4}(?:\\-\\d{2}){2} \\d{2}(?:\\:\\d{2}){2})$/', $line['datetime'])) {
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime']));
                 } else {
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s')));
                 }
                 if (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') {
                     $Spotter = new Spotter();
                     $aircraft_icao = $Spotter->getAllAircraftType($hex);
                     $Spotter->db = null;
                     if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
                         if ($line['aircraft_type'] == 'PARA_GLIDER') {
                             $aircraft_icao = 'GLID';
                         } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') {
                             $aircraft_icao = 'UHEL';
                         } elseif ($line['aircraft_type'] == 'TOW_PLANE') {
                             $aircraft_icao = 'TOWPLANE';
                         } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') {
                             $aircraft_icao = 'POWAIRC';
                         }
                     }
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao));
                 } else {
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $line['aircraft_icao']));
                 }
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'noarchive' => false));
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time()));
                 if (!isset($line['id'])) {
                     if (!isset($globalDaemon)) {
                         $globalDaemon = TRUE;
                     }
                     //			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
                     if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) {
                         $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'] . '-' . date('YmdHi')));
                     }
                     //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
                 } else {
                     $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id']));
                 }
                 if ($globalDebug) {
                     echo "*********** New aircraft hex : " . $hex . " ***********\n";
                 }
             }
             if (isset($line['datetime']) && $line['datetime'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime']));
             }
             if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration']));
             }
             if (isset($line['waypoints']) && $line['waypoints'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints']));
             }
             if (isset($line['pilot_id']) && $line['pilot_id'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id']));
             }
             if (isset($line['pilot_name']) && $line['pilot_name'] != '') {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name']));
             }
             if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && $this->all_flights[$id]['ident'] != trim($line['ident']) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident'])));
                 /*
//.........这里部分代码省略.........
开发者ID:sysrun,项目名称:FlightAirMap,代码行数:101,代码来源:class.SpotterImport.php


注:本文中的Spotter::getAllAircraftType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。