@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -8,8 +8,11 @@ |
||
8 | 8 | } |
9 | 9 | header('Content-Type: text/javascript'); |
10 | 10 | $timearray = array(); |
11 | -if (isset($_GET['now'])) $begin = time(); |
|
12 | -else $begin = strtotime(date("Y").'-12-24T02:00:00Z'); |
|
11 | +if (isset($_GET['now'])) { |
|
12 | + $begin = time(); |
|
13 | +} else { |
|
14 | + $begin = strtotime(date("Y").'-12-24T02:00:00Z'); |
|
15 | +} |
|
13 | 16 | for ($i =0; $i <= 288; $i++) { |
14 | 17 | $timearray[] = ($begin + $i*300)*1000; |
15 | 18 | } |
@@ -159,8 +159,9 @@ discard block |
||
159 | 159 | if ($show_attr && count($this->attr)>0) |
160 | 160 | { |
161 | 161 | echo '('; |
162 | - foreach ($this->attr as $k=>$v) |
|
163 | - echo "[$k]=>\"".$this->$k.'", '; |
|
162 | + foreach ($this->attr as $k=>$v) { |
|
163 | + echo "[$k]=>\"".$this->$k.'", '; |
|
164 | + } |
|
164 | 165 | echo ')'; |
165 | 166 | } |
166 | 167 | echo "\n"; |
@@ -218,8 +219,7 @@ discard block |
||
218 | 219 | if (isset($node->_[HDOM_INFO_INNER])) |
219 | 220 | { |
220 | 221 | $string .= $node->_[HDOM_INFO_INNER] . "'"; |
221 | - } |
|
222 | - else |
|
222 | + } else |
|
223 | 223 | { |
224 | 224 | $string .= ' NULL '; |
225 | 225 | } |
@@ -233,8 +233,7 @@ discard block |
||
233 | 233 | { |
234 | 234 | echo $string; |
235 | 235 | return; |
236 | - } |
|
237 | - else |
|
236 | + } else |
|
238 | 237 | { |
239 | 238 | return $string; |
240 | 239 | } |
@@ -320,12 +319,17 @@ discard block |
||
320 | 319 | // returns the previous sibling of node |
321 | 320 | function prev_sibling() |
322 | 321 | { |
323 | - if ($this->parent===null) return null; |
|
322 | + if ($this->parent===null) { |
|
323 | + return null; |
|
324 | + } |
|
324 | 325 | $idx = 0; |
325 | 326 | $count = count($this->parent->children); |
326 | - while ($idx<$count && $this!==$this->parent->children[$idx]) |
|
327 | - ++$idx; |
|
328 | - if (--$idx<0) return null; |
|
327 | + while ($idx<$count && $this!==$this->parent->children[$idx]) { |
|
328 | + ++$idx; |
|
329 | + } |
|
330 | + if (--$idx<0) { |
|
331 | + return null; |
|
332 | + } |
|
329 | 333 | return $this->parent->children[$idx]; |
330 | 334 | } |
331 | 335 | |
@@ -354,12 +358,17 @@ discard block |
||
354 | 358 | // get dom node's inner html |
355 | 359 | function innertext() |
356 | 360 | { |
357 | - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; |
|
358 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
361 | + if (isset($this->_[HDOM_INFO_INNER])) { |
|
362 | + return $this->_[HDOM_INFO_INNER]; |
|
363 | + } |
|
364 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
365 | + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
366 | + } |
|
359 | 367 | |
360 | 368 | $ret = ''; |
361 | - foreach ($this->nodes as $n) |
|
362 | - $ret .= $n->outertext(); |
|
369 | + foreach ($this->nodes as $n) { |
|
370 | + $ret .= $n->outertext(); |
|
371 | + } |
|
363 | 372 | return $ret; |
364 | 373 | } |
365 | 374 | |
@@ -380,7 +389,9 @@ discard block |
||
380 | 389 | $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text); |
381 | 390 | } |
382 | 391 | |
383 | - if ($this->tag==='root') return $this->innertext(); |
|
392 | + if ($this->tag==='root') { |
|
393 | + return $this->innertext(); |
|
394 | + } |
|
384 | 395 | |
385 | 396 | // trigger callback |
386 | 397 | if ($this->dom && $this->dom->callback!==null) |
@@ -388,8 +399,12 @@ discard block |
||
388 | 399 | call_user_func_array($this->dom->callback, array($this)); |
389 | 400 | } |
390 | 401 | |
391 | - if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER]; |
|
392 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
402 | + if (isset($this->_[HDOM_INFO_OUTER])) { |
|
403 | + return $this->_[HDOM_INFO_OUTER]; |
|
404 | + } |
|
405 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
406 | + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
407 | + } |
|
393 | 408 | |
394 | 409 | // render begin tag |
395 | 410 | if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]) |
@@ -418,23 +433,30 @@ discard block |
||
418 | 433 | } |
419 | 434 | |
420 | 435 | // render end tag |
421 | - if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) |
|
422 | - $ret .= '</'.$this->tag.'>'; |
|
436 | + if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) { |
|
437 | + $ret .= '</'.$this->tag.'>'; |
|
438 | + } |
|
423 | 439 | return $ret; |
424 | 440 | } |
425 | 441 | |
426 | 442 | // get dom node's plain text |
427 | 443 | function text() |
428 | 444 | { |
429 | - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; |
|
445 | + if (isset($this->_[HDOM_INFO_INNER])) { |
|
446 | + return $this->_[HDOM_INFO_INNER]; |
|
447 | + } |
|
430 | 448 | switch ($this->nodetype) |
431 | 449 | { |
432 | 450 | case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
433 | 451 | case HDOM_TYPE_COMMENT: return ''; |
434 | 452 | case HDOM_TYPE_UNKNOWN: return ''; |
435 | 453 | } |
436 | - if (strcasecmp($this->tag, 'script')===0) return ''; |
|
437 | - if (strcasecmp($this->tag, 'style')===0) return ''; |
|
454 | + if (strcasecmp($this->tag, 'script')===0) { |
|
455 | + return ''; |
|
456 | + } |
|
457 | + if (strcasecmp($this->tag, 'style')===0) { |
|
458 | + return ''; |
|
459 | + } |
|
438 | 460 | |
439 | 461 | $ret = ''; |
440 | 462 | // 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. |
@@ -470,7 +492,9 @@ discard block |
||
470 | 492 | function makeup() |
471 | 493 | { |
472 | 494 | // text, comment, unknown |
473 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
495 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
496 | + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
497 | + } |
|
474 | 498 | |
475 | 499 | $ret = '<'.$this->tag; |
476 | 500 | $i = -1; |
@@ -480,14 +504,15 @@ discard block |
||
480 | 504 | ++$i; |
481 | 505 | |
482 | 506 | // skip removed attribute |
483 | - if ($val===null || $val===false) |
|
484 | - continue; |
|
507 | + if ($val===null || $val===false) { |
|
508 | + continue; |
|
509 | + } |
|
485 | 510 | |
486 | 511 | $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; |
487 | 512 | //no value attr: nowrap, checked selected... |
488 | - if ($val===true) |
|
489 | - $ret .= $key; |
|
490 | - else { |
|
513 | + if ($val===true) { |
|
514 | + $ret .= $key; |
|
515 | + } else { |
|
491 | 516 | switch ($this->_[HDOM_INFO_QUOTE][$i]) |
492 | 517 | { |
493 | 518 | case HDOM_QUOTE_DOUBLE: $quote = '"'; break; |
@@ -506,7 +531,9 @@ discard block |
||
506 | 531 | function find($selector, $idx=null, $lowercase=false) |
507 | 532 | { |
508 | 533 | $selectors = $this->parse_selector($selector); |
509 | - if (($count=count($selectors))===0) return array(); |
|
534 | + if (($count=count($selectors))===0) { |
|
535 | + return array(); |
|
536 | + } |
|
510 | 537 | $found_keys = array(); |
511 | 538 | |
512 | 539 | // find each selector |
@@ -514,8 +541,12 @@ discard block |
||
514 | 541 | { |
515 | 542 | // The change on the below line was documented on the sourceforge code tracker id 2788009 |
516 | 543 | // used to be: if (($levle=count($selectors[0]))===0) return array(); |
517 | - if (($levle=count($selectors[$c]))===0) return array(); |
|
518 | - if (!isset($this->_[HDOM_INFO_BEGIN])) return array(); |
|
544 | + if (($levle=count($selectors[$c]))===0) { |
|
545 | + return array(); |
|
546 | + } |
|
547 | + if (!isset($this->_[HDOM_INFO_BEGIN])) { |
|
548 | + return array(); |
|
549 | + } |
|
519 | 550 | |
520 | 551 | $head = array($this->_[HDOM_INFO_BEGIN]=>1); |
521 | 552 | |
@@ -545,12 +576,16 @@ discard block |
||
545 | 576 | ksort($found_keys); |
546 | 577 | |
547 | 578 | $found = array(); |
548 | - foreach ($found_keys as $k=>$v) |
|
549 | - $found[] = $this->dom->nodes[$k]; |
|
579 | + foreach ($found_keys as $k=>$v) { |
|
580 | + $found[] = $this->dom->nodes[$k]; |
|
581 | + } |
|
550 | 582 | |
551 | 583 | // return nth-element or array |
552 | - if (is_null($idx)) return $found; |
|
553 | - else if ($idx<0) $idx = count($found) + $idx; |
|
584 | + if (is_null($idx)) { |
|
585 | + return $found; |
|
586 | + } else if ($idx<0) { |
|
587 | + $idx = count($found) + $idx; |
|
588 | + } |
|
554 | 589 | return (isset($found[$idx])) ? $found[$idx] : null; |
555 | 590 | } |
556 | 591 | |
@@ -595,8 +630,9 @@ discard block |
||
595 | 630 | $pass = true; |
596 | 631 | |
597 | 632 | if ($tag==='*' && !$key) { |
598 | - if (in_array($node, $this->children, true)) |
|
599 | - $ret[$i] = 1; |
|
633 | + if (in_array($node, $this->children, true)) { |
|
634 | + $ret[$i] = 1; |
|
635 | + } |
|
600 | 636 | continue; |
601 | 637 | } |
602 | 638 | |
@@ -605,9 +641,13 @@ discard block |
||
605 | 641 | // compare key |
606 | 642 | if ($pass && $key) { |
607 | 643 | if ($no_key) { |
608 | - if (isset($node->attr[$key])) $pass=false; |
|
644 | + if (isset($node->attr[$key])) { |
|
645 | + $pass=false; |
|
646 | + } |
|
609 | 647 | } else { |
610 | - if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false; |
|
648 | + if (($key != "plaintext") && !isset($node->attr[$key])) { |
|
649 | + $pass=false; |
|
650 | + } |
|
611 | 651 | } |
612 | 652 | } |
613 | 653 | // compare value |
@@ -640,13 +680,19 @@ discard block |
||
640 | 680 | } else { |
641 | 681 | $check = $this->match($exp, $val, $k); |
642 | 682 | } |
643 | - if ($check) break; |
|
683 | + if ($check) { |
|
684 | + break; |
|
685 | + } |
|
644 | 686 | } |
645 | 687 | } |
646 | 688 | } |
647 | - if (!$check) $pass = false; |
|
689 | + if (!$check) { |
|
690 | + $pass = false; |
|
691 | + } |
|
692 | + } |
|
693 | + if ($pass) { |
|
694 | + $ret[$i] = 1; |
|
648 | 695 | } |
649 | - if ($pass) $ret[$i] = 1; |
|
650 | 696 | unset($node); |
651 | 697 | } |
652 | 698 | // It's passed by reference so this is actually what this function returns. |
@@ -696,9 +742,13 @@ discard block |
||
696 | 742 | |
697 | 743 | foreach ($matches as $m) { |
698 | 744 | $m[0] = trim($m[0]); |
699 | - if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue; |
|
745 | + if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') { |
|
746 | + continue; |
|
747 | + } |
|
700 | 748 | // for browser generated xpath |
701 | - if ($m[1]==='tbody') continue; |
|
749 | + if ($m[1]==='tbody') { |
|
750 | + continue; |
|
751 | + } |
|
702 | 752 | |
703 | 753 | list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false); |
704 | 754 | if (!empty($m[2])) {$key='id'; $val=$m[2];} |
@@ -718,8 +768,9 @@ discard block |
||
718 | 768 | $result = array(); |
719 | 769 | } |
720 | 770 | } |
721 | - if (count($result)>0) |
|
722 | - $selectors[] = $result; |
|
771 | + if (count($result)>0) { |
|
772 | + $selectors[] = $result; |
|
773 | + } |
|
723 | 774 | return $selectors; |
724 | 775 | } |
725 | 776 | |
@@ -748,7 +799,9 @@ discard block |
||
748 | 799 | { |
749 | 800 | case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; |
750 | 801 | case 'innertext': |
751 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; |
|
802 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
803 | + return $this->_[HDOM_INFO_TEXT] = $value; |
|
804 | + } |
|
752 | 805 | return $this->_[HDOM_INFO_INNER] = $value; |
753 | 806 | } |
754 | 807 | if (!isset($this->attr[$name])) |
@@ -772,8 +825,9 @@ discard block |
||
772 | 825 | } |
773 | 826 | |
774 | 827 | function __unset($name) { |
775 | - if (isset($this->attr[$name])) |
|
776 | - unset($this->attr[$name]); |
|
828 | + if (isset($this->attr[$name])) { |
|
829 | + unset($this->attr[$name]); |
|
830 | + } |
|
777 | 831 | } |
778 | 832 | |
779 | 833 | // PaperG - Function to convert the text from one character set to another if the two sets are not the same. |
@@ -800,8 +854,7 @@ discard block |
||
800 | 854 | if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text))) |
801 | 855 | { |
802 | 856 | $converted_text = $text; |
803 | - } |
|
804 | - else |
|
857 | + } else |
|
805 | 858 | { |
806 | 859 | $converted_text = iconv($sourceCharset, $targetCharset, $text); |
807 | 860 | } |
@@ -839,19 +892,31 @@ discard block |
||
839 | 892 | $c=ord($str[$i]); |
840 | 893 | if($c > 128) |
841 | 894 | { |
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 | - else return false; |
|
849 | - if(($i+$bits) > $len) return false; |
|
895 | + if(($c >= 254)) { |
|
896 | + return false; |
|
897 | + } elseif($c >= 252) { |
|
898 | + $bits=6; |
|
899 | + } elseif($c >= 248) { |
|
900 | + $bits=5; |
|
901 | + } elseif($c >= 240) { |
|
902 | + $bits=4; |
|
903 | + } elseif($c >= 224) { |
|
904 | + $bits=3; |
|
905 | + } elseif($c >= 192) { |
|
906 | + $bits=2; |
|
907 | + } else { |
|
908 | + return false; |
|
909 | + } |
|
910 | + if(($i+$bits) > $len) { |
|
911 | + return false; |
|
912 | + } |
|
850 | 913 | while($bits > 1) |
851 | 914 | { |
852 | 915 | $i++; |
853 | 916 | $b=ord($str[$i]); |
854 | - if($b < 128 || $b > 191) return false; |
|
917 | + if($b < 128 || $b > 191) { |
|
918 | + return false; |
|
919 | + } |
|
855 | 920 | $bits--; |
856 | 921 | } |
857 | 922 | } |
@@ -1035,8 +1100,7 @@ discard block |
||
1035 | 1100 | if (preg_match("/^http:\/\//i",$str) || is_file($str)) |
1036 | 1101 | { |
1037 | 1102 | $this->load_file($str); |
1038 | - } |
|
1039 | - else |
|
1103 | + } else |
|
1040 | 1104 | { |
1041 | 1105 | $this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText); |
1042 | 1106 | } |
@@ -1118,7 +1182,9 @@ discard block |
||
1118 | 1182 | function save($filepath='') |
1119 | 1183 | { |
1120 | 1184 | $ret = $this->root->innertext(); |
1121 | - if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX); |
|
1185 | + if ($filepath!=='') { |
|
1186 | + file_put_contents($filepath, $ret, LOCK_EX); |
|
1187 | + } |
|
1122 | 1188 | return $ret; |
1123 | 1189 | } |
1124 | 1190 | |
@@ -1134,7 +1200,10 @@ discard block |
||
1134 | 1200 | { |
1135 | 1201 | foreach ($this->nodes as $n) {$n->clear(); $n = null;} |
1136 | 1202 | // 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;} |
|
1203 | + if (isset($this->children)) { |
|
1204 | + foreach ($this->children as $n) {$n->clear(); |
|
1205 | + } |
|
1206 | + $n = null;} |
|
1138 | 1207 | if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);} |
1139 | 1208 | if (isset($this->root)) {$this->root->clear(); unset($this->root);} |
1140 | 1209 | unset($this->doc); |
@@ -1178,7 +1247,9 @@ discard block |
||
1178 | 1247 | $this->root->_[HDOM_INFO_BEGIN] = -1; |
1179 | 1248 | $this->root->nodetype = HDOM_TYPE_ROOT; |
1180 | 1249 | $this->parent = $this->root; |
1181 | - if ($this->size>0) $this->char = $this->doc[0]; |
|
1250 | + if ($this->size>0) { |
|
1251 | + $this->char = $this->doc[0]; |
|
1252 | + } |
|
1182 | 1253 | } |
1183 | 1254 | |
1184 | 1255 | // parse html content |
@@ -1232,8 +1303,7 @@ discard block |
||
1232 | 1303 | if ($success) |
1233 | 1304 | { |
1234 | 1305 | $charset = $matches[1]; |
1235 | - } |
|
1236 | - else |
|
1306 | + } else |
|
1237 | 1307 | { |
1238 | 1308 | // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1 |
1239 | 1309 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');} |
@@ -1296,8 +1366,9 @@ discard block |
||
1296 | 1366 | $tag = $this->copy_until_char('>'); |
1297 | 1367 | |
1298 | 1368 | // skip attributes in end tag |
1299 | - if (($pos = strpos($tag, ' '))!==false) |
|
1300 | - $tag = substr($tag, 0, $pos); |
|
1369 | + if (($pos = strpos($tag, ' '))!==false) { |
|
1370 | + $tag = substr($tag, 0, $pos); |
|
1371 | + } |
|
1301 | 1372 | |
1302 | 1373 | $parent_lower = strtolower($this->parent->tag); |
1303 | 1374 | $tag_lower = strtolower($tag); |
@@ -1309,23 +1380,26 @@ discard block |
||
1309 | 1380 | $this->parent->_[HDOM_INFO_END] = 0; |
1310 | 1381 | $org_parent = $this->parent; |
1311 | 1382 | |
1312 | - while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) |
|
1313 | - $this->parent = $this->parent->parent; |
|
1383 | + while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) { |
|
1384 | + $this->parent = $this->parent->parent; |
|
1385 | + } |
|
1314 | 1386 | |
1315 | 1387 | if (strtolower($this->parent->tag)!==$tag_lower) { |
1316 | 1388 | $this->parent = $org_parent; // restore origonal parent |
1317 | - if ($this->parent->parent) $this->parent = $this->parent->parent; |
|
1389 | + if ($this->parent->parent) { |
|
1390 | + $this->parent = $this->parent->parent; |
|
1391 | + } |
|
1318 | 1392 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
1319 | 1393 | return $this->as_text_node($tag); |
1320 | 1394 | } |
1321 | - } |
|
1322 | - else if (($this->parent->parent) && isset($this->block_tags[$tag_lower])) |
|
1395 | + } else if (($this->parent->parent) && isset($this->block_tags[$tag_lower])) |
|
1323 | 1396 | { |
1324 | 1397 | $this->parent->_[HDOM_INFO_END] = 0; |
1325 | 1398 | $org_parent = $this->parent; |
1326 | 1399 | |
1327 | - while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) |
|
1328 | - $this->parent = $this->parent->parent; |
|
1400 | + while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) { |
|
1401 | + $this->parent = $this->parent->parent; |
|
1402 | + } |
|
1329 | 1403 | |
1330 | 1404 | if (strtolower($this->parent->tag)!==$tag_lower) |
1331 | 1405 | { |
@@ -1333,18 +1407,19 @@ discard block |
||
1333 | 1407 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
1334 | 1408 | return $this->as_text_node($tag); |
1335 | 1409 | } |
1336 | - } |
|
1337 | - else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) |
|
1410 | + } else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) |
|
1338 | 1411 | { |
1339 | 1412 | $this->parent->_[HDOM_INFO_END] = 0; |
1340 | 1413 | $this->parent = $this->parent->parent; |
1414 | + } else { |
|
1415 | + return $this->as_text_node($tag); |
|
1341 | 1416 | } |
1342 | - else |
|
1343 | - return $this->as_text_node($tag); |
|
1344 | 1417 | } |
1345 | 1418 | |
1346 | 1419 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
1347 | - if ($this->parent->parent) $this->parent = $this->parent->parent; |
|
1420 | + if ($this->parent->parent) { |
|
1421 | + $this->parent = $this->parent->parent; |
|
1422 | + } |
|
1348 | 1423 | |
1349 | 1424 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
1350 | 1425 | return true; |
@@ -1367,7 +1442,9 @@ discard block |
||
1367 | 1442 | $node->nodetype = HDOM_TYPE_UNKNOWN; |
1368 | 1443 | $node->tag = 'unknown'; |
1369 | 1444 | } |
1370 | - if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; |
|
1445 | + if ($this->char==='>') { |
|
1446 | + $node->_[HDOM_INFO_TEXT].='>'; |
|
1447 | + } |
|
1371 | 1448 | $this->link_nodes($node, true); |
1372 | 1449 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
1373 | 1450 | return true; |
@@ -1389,7 +1466,9 @@ discard block |
||
1389 | 1466 | return true; |
1390 | 1467 | } |
1391 | 1468 | |
1392 | - if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; |
|
1469 | + if ($this->char==='>') { |
|
1470 | + $node->_[HDOM_INFO_TEXT].='>'; |
|
1471 | + } |
|
1393 | 1472 | $this->link_nodes($node, false); |
1394 | 1473 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
1395 | 1474 | return true; |
@@ -1455,22 +1534,26 @@ discard block |
||
1455 | 1534 | if ($name!=='/' && $name!=='') { |
1456 | 1535 | $space[1] = $this->copy_skip($this->token_blank); |
1457 | 1536 | $name = $this->restore_noise($name); |
1458 | - if ($this->lowercase) $name = strtolower($name); |
|
1537 | + if ($this->lowercase) { |
|
1538 | + $name = strtolower($name); |
|
1539 | + } |
|
1459 | 1540 | if ($this->char==='=') { |
1460 | 1541 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
1461 | 1542 | $this->parse_attr($node, $name, $space); |
1462 | - } |
|
1463 | - else { |
|
1543 | + } else { |
|
1464 | 1544 | //no value attr: nowrap, checked selected... |
1465 | 1545 | $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO; |
1466 | 1546 | $node->attr[$name] = true; |
1467 | - if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev |
|
1547 | + if ($this->char!='>') { |
|
1548 | + $this->char = $this->doc[--$this->pos]; |
|
1549 | + } |
|
1550 | + // prev |
|
1468 | 1551 | } |
1469 | 1552 | $node->_[HDOM_INFO_SPACE][] = $space; |
1470 | 1553 | $space = array($this->copy_skip($this->token_blank), '', ''); |
1554 | + } else { |
|
1555 | + break; |
|
1471 | 1556 | } |
1472 | - else |
|
1473 | - break; |
|
1474 | 1557 | } while ($this->char!=='>' && $this->char!=='/'); |
1475 | 1558 | |
1476 | 1559 | $this->link_nodes($node, true); |
@@ -1481,11 +1564,12 @@ discard block |
||
1481 | 1564 | { |
1482 | 1565 | $node->_[HDOM_INFO_ENDSPACE] .= '/'; |
1483 | 1566 | $node->_[HDOM_INFO_END] = 0; |
1484 | - } |
|
1485 | - else |
|
1567 | + } else |
|
1486 | 1568 | { |
1487 | 1569 | // reset parent |
1488 | - if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node; |
|
1570 | + if (!isset($this->self_closing_tags[strtolower($node->tag)])) { |
|
1571 | + $this->parent = $node; |
|
1572 | + } |
|
1489 | 1573 | } |
1490 | 1574 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
1491 | 1575 | |
@@ -1571,7 +1655,9 @@ discard block |
||
1571 | 1655 | $len = strspn($this->doc, $chars, $pos); |
1572 | 1656 | $this->pos += $len; |
1573 | 1657 | $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
1574 | - if ($len===0) return ''; |
|
1658 | + if ($len===0) { |
|
1659 | + return ''; |
|
1660 | + } |
|
1575 | 1661 | return substr($this->doc, $pos, $len); |
1576 | 1662 | } |
1577 | 1663 | |
@@ -1586,7 +1672,9 @@ discard block |
||
1586 | 1672 | |
1587 | 1673 | protected function copy_until_char($char) |
1588 | 1674 | { |
1589 | - if ($this->char===null) return ''; |
|
1675 | + if ($this->char===null) { |
|
1676 | + return ''; |
|
1677 | + } |
|
1590 | 1678 | |
1591 | 1679 | if (($pos = strpos($this->doc, $char, $this->pos))===false) { |
1592 | 1680 | $ret = substr($this->doc, $this->pos, $this->size-$this->pos); |
@@ -1595,7 +1683,9 @@ discard block |
||
1595 | 1683 | return $ret; |
1596 | 1684 | } |
1597 | 1685 | |
1598 | - if ($pos===$this->pos) return ''; |
|
1686 | + if ($pos===$this->pos) { |
|
1687 | + return ''; |
|
1688 | + } |
|
1599 | 1689 | $pos_old = $this->pos; |
1600 | 1690 | $this->char = $this->doc[$pos]; |
1601 | 1691 | $this->pos = $pos; |
@@ -1604,7 +1694,9 @@ discard block |
||
1604 | 1694 | |
1605 | 1695 | protected function copy_until_char_escape($char) |
1606 | 1696 | { |
1607 | - if ($this->char===null) return ''; |
|
1697 | + if ($this->char===null) { |
|
1698 | + return ''; |
|
1699 | + } |
|
1608 | 1700 | |
1609 | 1701 | $start = $this->pos; |
1610 | 1702 | while (1) |
@@ -1617,7 +1709,9 @@ discard block |
||
1617 | 1709 | return $ret; |
1618 | 1710 | } |
1619 | 1711 | |
1620 | - if ($pos===$this->pos) return ''; |
|
1712 | + if ($pos===$this->pos) { |
|
1713 | + return ''; |
|
1714 | + } |
|
1621 | 1715 | |
1622 | 1716 | if ($this->doc[$pos-1]==='\\') { |
1623 | 1717 | $start = $pos+1; |
@@ -1674,14 +1768,12 @@ discard block |
||
1674 | 1768 | if (isset($this->noise[$key])) |
1675 | 1769 | { |
1676 | 1770 | $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16); |
1677 | - } |
|
1678 | - else |
|
1771 | + } else |
|
1679 | 1772 | { |
1680 | 1773 | // do this to prevent an infinite loop. |
1681 | 1774 | $text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16); |
1682 | 1775 | } |
1683 | - } |
|
1684 | - else |
|
1776 | + } else |
|
1685 | 1777 | { |
1686 | 1778 | // There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem. |
1687 | 1779 | $text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | $limit_start = 0; |
15 | 15 | $limit_end = 25; |
16 | 16 | $absolute_difference = 25; |
17 | - } else { |
|
17 | + } else { |
|
18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
19 | 19 | $limit_start = $limit_explode[0]; |
20 | 20 | $limit_end = $limit_explode[1]; |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -12,7 +12,7 @@ |
||
12 | 12 | $limit_start = 0; |
13 | 13 | $limit_end = 25; |
14 | 14 | $absolute_difference = 25; |
15 | -} else { |
|
15 | +} else { |
|
16 | 16 | $limit_explode = explode(",", $_GET['limit']); |
17 | 17 | $limit_start = $limit_explode[0]; |
18 | 18 | $limit_end = $limit_explode[1]; |
@@ -12,7 +12,9 @@ |
||
12 | 12 | $METAR = new METAR(); |
13 | 13 | $metar_info = $METAR->getMETAR($icao); |
14 | 14 | //print_r($metar_info); |
15 | - if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']); |
|
15 | + if (isset($metar_info[0]['metar'])) { |
|
16 | + $metar_parse = $METAR->parse($metar_info[0]['metar']); |
|
17 | + } |
|
16 | 18 | //print_r($metar_parse); |
17 | 19 | } |
18 | 20 | ?> |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |