|
From: <var...@us...> - 2016-02-11 10:04:43
|
Revision: 9798
http://sourceforge.net/p/phpwiki/code/9798
Author: vargenau
Date: 2016-02-11 10:04:41 +0000 (Thu, 11 Feb 2016)
Log Message:
-----------
Replace ereg with preg
Modified Paths:
--------------
trunk/lib/phpweather-2.2.2/config/pw_validator_ereg.php
trunk/lib/phpweather-2.2.2/config/pw_validator_range.php
trunk/lib/phpweather-2.2.2/data_retrieval.php
trunk/lib/phpweather-2.2.2/db/pw_db_dba.php
trunk/lib/phpweather-2.2.2/db/pw_db_mysql.php
trunk/lib/phpweather-2.2.2/db/pw_db_pgsql.php
trunk/lib/phpweather-2.2.2/db_updater.php
trunk/lib/phpweather-2.2.2/output/pw_images.php
trunk/lib/phpweather-2.2.2/phpweather.php
trunk/lib/phpweather-2.2.2/pw_utilities.php
Modified: trunk/lib/phpweather-2.2.2/config/pw_validator_ereg.php
===================================================================
--- trunk/lib/phpweather-2.2.2/config/pw_validator_ereg.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/config/pw_validator_ereg.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -41,7 +41,7 @@
*/
function validate($value) {
$this->value = $value;
- return ereg($this->regex, $value);
+ return preg_match('/' . addcslashes($this->regex, '/') . '/', $value);
}
/**
Modified: trunk/lib/phpweather-2.2.2/config/pw_validator_range.php
===================================================================
--- trunk/lib/phpweather-2.2.2/config/pw_validator_range.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/config/pw_validator_range.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -62,7 +62,7 @@
if ($this->empty_ok && empty($value)) return true;
- return (ereg('^[-+]?[0-9]+$', $value) && $this->low <= $value && $value <= $this->high);
+ return (preg_match('/^[-+]?[0-9]+$/', $value) && $this->low <= $value && $value <= $this->high);
}
/**
Modified: trunk/lib/phpweather-2.2.2/data_retrieval.php
===================================================================
--- trunk/lib/phpweather-2.2.2/data_retrieval.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/data_retrieval.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -372,7 +372,7 @@
/* The remaining lines are the METAR itself. This will merge the
* remaining lines into one line by removing new-lines:
*/
- $metar = ereg_replace("[\n\r ]+", ' ', trim(implode(' ', $metar_data)));
+ $metar = preg_replace("/[\n\r ]+/", ' ', trim(implode(' ', $metar_data)));
$date = explode(':', strtr($date, '/ ', '::'));
if ($date[2] > gmdate('j')) {
@@ -388,7 +388,7 @@
$date[1], $date[2], $date[0]);
$metar_time = $timestamp;
- if (!ereg('[0-9]{6}Z', $metar)) {
+ if (!preg_match('/[0-9]{6}Z/', $metar)) {
/* Some reports don't even have a time-part, so we insert the
* current time. This might not be the time of the report, but
* it was broken anyway :-)
@@ -613,7 +613,7 @@
/* The remaining lines are the TAF itself. This will merge the
* remaining lines into one line by removing new-lines:
*/
- $taf = ereg_replace("[\n\r ]+", ' ', trim(implode(' ', $taf_data)));
+ $taf = preg_replace("/[\n\r ]+/", ' ', trim(implode(' ', $taf_data)));
$date = explode(':', strtr($date, '/ ', '::'));
if ($date[2] > gmdate('j')) {
@@ -625,7 +625,7 @@
$timestamp = gmmktime($date[3], $date[4], 0,
$date[1], $date[2], $date[0]);
- if (!ereg('[0-9]{6}Z', $taf)) {
+ if (!preg_match('/[0-9]{6}Z/', $taf)) {
/* Some reports don't even have a time-part, so we insert the
* current time. This might not be the time of the report, but
* it was broken anyway :-)
Modified: trunk/lib/phpweather-2.2.2/db/pw_db_dba.php
===================================================================
--- trunk/lib/phpweather-2.2.2/db/pw_db_dba.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/db/pw_db_dba.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -46,7 +46,7 @@
function pw_db_dba($input) {
/* We have to load the DBA extension on some systems: */
if (!extension_loaded('dba')) {
- if (ereg('win', PHP_OS)) {
+ if (preg_match('/win/', PHP_OS)) {
dl('php_dba.dll');
} else {
dl('dba.so');
Modified: trunk/lib/phpweather-2.2.2/db/pw_db_mysql.php
===================================================================
--- trunk/lib/phpweather-2.2.2/db/pw_db_mysql.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/db/pw_db_mysql.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -23,7 +23,7 @@
function pw_db_mysql($input) {
/* We have to load the MySQL extension on some systems: */
if (!extension_loaded('mysql')) {
- if (ereg('win', PHP_OS)) {
+ if (preg_match('/win/', PHP_OS)) {
dl('mysql.dll');
} else {
dl('mysql.so');
Modified: trunk/lib/phpweather-2.2.2/db/pw_db_pgsql.php
===================================================================
--- trunk/lib/phpweather-2.2.2/db/pw_db_pgsql.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/db/pw_db_pgsql.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -35,7 +35,7 @@
function pw_db_pgsql($input = array()) {
/* We have to load the PgSQL extension on some systems: */
if (!extension_loaded('pgsql')) {
- if (ereg('win', PHP_OS)) {
+ if (preg_match('/win/', PHP_OS)) {
dl('pgsql.dll');
} else {
dl('pgsql.so');
Modified: trunk/lib/phpweather-2.2.2/db_updater.php
===================================================================
--- trunk/lib/phpweather-2.2.2/db_updater.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/db_updater.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -12,15 +12,15 @@
if (!empty($filename) &&
file_exists($filename) &&
- ereg('[012][0-9]Z.TXT', $filename)) {
+ preg_match('/[012][0-9]Z.TXT/', $filename)) {
$fn = $filename;
} elseif (!empty($argv[0]) &&
file_exists($argv[0]) &&
- ereg('[012][0-9]Z.TXT', $argv[0])) {
+ preg_match('/[012][0-9]Z.TXT/', $argv[0])) {
$fn = $argv[0];
} elseif (!empty($argv[1]) &&
file_exists($argv[1]) &&
- ereg('[012][0-9]Z.TXT', $argv[1])) {
+ preg_match('/[012][0-9]Z.TXT/', $argv[1])) {
$fn = $argv[1];
} else {
print_usage();
Modified: trunk/lib/phpweather-2.2.2/output/pw_images.php
===================================================================
--- trunk/lib/phpweather-2.2.2/output/pw_images.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/output/pw_images.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -251,23 +251,23 @@
for ($i = 0; $i < $num_parts; $i++) {
$part = $parts[$i];
- if (ereg('RMK|TEMPO|BECMG', $part)) {
+ if (preg_match('/RMK|TEMPO|BECMG/', $part)) {
/* The rest of the METAR is either a remark or temporary
information. We skip the rest of the METAR. */
break;
- } elseif (ereg('([0-9]{2})([0-9]{2})([0-9]{2})Z', $part, $regs)) {
+ } elseif (preg_match('/([0-9]{2})([0-9]{2})([0-9]{2})Z/', $part, $regs)) {
if (($regs[2] < 6) || ($regs[2] > 18)) {
$night = 1;
}
}
- elseif (ereg('^(-|\+|VC)?(TS|SH|FZ|BL|DR|MI|BC|PR|RA|DZ|SN|SG|GR|GS|PE|IC|UP|BR|FG|FU|VA|DU|SA|HZ|PY|PO|SQ|FC|SS|DS)+$', $part)) {
+ elseif (preg_match('/^(-|\+|VC)?(TS|SH|FZ|BL|DR|MI|BC|PR|RA|DZ|SN|SG|GR|GS|PE|IC|UP|BR|FG|FU|VA|DU|SA|HZ|PY|PO|SQ|FC|SS|DS)+$/', $part)) {
/*
* Is this the current weather group?
*/
// Get the intensity and get rid of it in the $part string
$intensity = '';
- if (ereg('^(-|\+|VC)(..)*$',$part)) {
+ if (preg_match('/^(-|\+|VC)(..)*$/',$part)) {
if ($part[0] == '-') {
$intensity = '-';
$part = substr($part,1);
@@ -284,11 +284,11 @@
// Now, take only the precipitation types that have images.
// Ignore the others In case more then one exist, take only the
// first one (highest predominance).
- ereg('(TS|RA|DZ|SN|SG|GR|GS|PE|IC|BR|FG)(..)*$',$part,$match);
+ preg_match('/(TS|RA|DZ|SN|SG|GR|GS|PE|IC|BR|FG)(..)*$/',$part,$match);
if (!empty($match[1])) {
$phenomena = $match[1];
} else {
- ereg('(..)(TS|RA|DZ|SN|SG|GR|GS|PE|IC|BR|FG)(..)*$',$part,$match);
+ preg_match('/(..)(TS|RA|DZ|SN|SG|GR|GS|PE|IC|BR|FG)(..)*$/',$part,$match);
if (!empty($match[2])) {
$phenomena = $match[2];
} else {
@@ -300,13 +300,13 @@
// I.e. drizzle (DZ) and rain (RA) are both considered to be
// rain (as far as the images are concerned). Add intensity only
// in case of rain and snow.
- if (ereg('^(Snow|Hail)$',$this->phenomena_array[$phenomena])) {
+ if (preg_match('/^(Snow|Hail)$/',$this->phenomena_array[$phenomena])) {
if ($intensity == '') {
$intensity = '-';
}
}
- if (ereg('^(Rain|Snow|Hail)$',$this->phenomena_array[$phenomena])) {
+ if (preg_match('/^(Rain|Snow|Hail)$/',$this->phenomena_array[$phenomena])) {
$phenomena_group = $intensity . $this->phenomena_array[$phenomena];
} else {
$phenomena_group = $this->phenomena_array[$phenomena];
@@ -319,13 +319,13 @@
// clouds, thus find the highest cloudcoverage layer, by
// maximizing the $maxcoverage param
- elseif (ereg('(SKC|CLR)(...)', $part, $regs)) {
+ elseif (preg_match('/(SKC|CLR)(...)/', $part, $regs)) {
$maxcoverage = max($maxcoverage,$this->coverage[$regs[1]]);
// if ($maxcoverage < $this->coverage[$regs[1]]) {
// $maxcoverage = $this->coverage[$regs[1]];
// }
}
- elseif (ereg('^(VV|FEW|SCT|BKN|OVC)([0-9]{3})(CB|TCU)?$', $part, $regs)) {
+ elseif (preg_match('/^(VV|FEW|SCT|BKN|OVC)([0-9]{3})(CB|TCU)?$/', $part, $regs)) {
$maxcoverage = max($maxcoverage,$this->coverage[$regs[1]]);
// if ($maxcoverage < $this->coverage[$regs[1]]) {
// $maxcoverage = $this->coverage[$regs[1]];
Modified: trunk/lib/phpweather-2.2.2/phpweather.php
===================================================================
--- trunk/lib/phpweather-2.2.2/phpweather.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/phpweather.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -196,7 +196,7 @@
for ($i = 0; $i < $num_parts; $i++) {
$part = $parts[$i];
- if (ereg('RMK|TEMPO|BECMG|INTER', $part)) {
+ if (preg_match('/RMK|TEMPO|BECMG|INTER/', $part)) {
/* The rest of the METAR is either a remark or temporary
* information. We keep the remark.
*/
@@ -214,13 +214,13 @@
* Type of Report: SPECI
*/
$decoded_metar['type'] = 'SPECI';
- } elseif (ereg('^[A-Z]{4}$', $part) &&
+ } elseif (preg_match('/^[A-Z]{4}$/', $part) &&
empty($decoded_metar['icao'])) {
/*
* Station Identifier
*/
$decoded_metar['icao'] = $part;
-// } elseif (ereg('([0-9]{2})([0-9]{2})([0-9]{2})Z', $part, $regs)) {
+// } elseif (preg_match('/([0-9]{2})([0-9]{2})([0-9]{2})Z/', $part, $regs)) {
// /*
// * Date and Time of Report.
// *
@@ -249,12 +249,12 @@
// $regs[3], 0, $month, $regs[1], gmdate('Y'));
- } elseif (ereg('(AUTO|COR|RTD|CC[A-Z]|RR[A-Z])', $part, $regs)) {
+ } elseif (preg_match('/(AUTO|COR|RTD|CC[A-Z]|RR[A-Z])/', $part, $regs)) {
/*
* Report Modifier: AUTO, COR, CCx or RRx
*/
$decoded_metar['report_mod'] = $regs[1];
- } elseif (ereg('([0-9]{3}|VRB)([0-9]{2,3})G?([0-9]{2,3})?(KT|MPS|KMH)', $part, $regs)) {
+ } elseif (preg_match('/([0-9]{3}|VRB)([0-9]{2,3})G?([0-9]{2,3})?(KT|MPS|KMH)/', $part, $regs)) {
/* Wind Group */
@@ -277,7 +277,7 @@
$decoded_metar['wind']['gust_meters_per_second'],
$decoded_metar['wind']['gust_miles_per_hour']);
}
- } elseif (ereg('^([0-9]{3})V([0-9]{3})$', $part, $regs) &&
+ } elseif (preg_match('/^([0-9]{3})V([0-9]{3})$/', $part, $regs) &&
!empty($decoded_metar['wind'])) {
/*
@@ -285,7 +285,7 @@
*/
$decoded_metar['wind']['var_beg'] = $regs[1];
$decoded_metar['wind']['var_end'] = $regs[2];
- } elseif (ereg('^([0-9]{4})([NS]?[EW]?)$', $part, $regs)) {
+ } elseif (preg_match('/^([0-9]{4})([NS]?[EW]?)$/', $part, $regs)) {
/*
* Visibility in meters (4 digits only)
*/
@@ -319,13 +319,13 @@
}
$decoded_metar['visibility'][] = $group;
- } elseif (ereg('^[0-9]$', $part)) {
+ } elseif (preg_match('/^[0-9]$/', $part)) {
/*
* Temp Visibility Group, single digit followed by space.
*/
$temp_visibility_miles = $part;
- } elseif (ereg('^M?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$',
- $temp_visibility_miles . ' ' . $part, $regs)) {
+ } elseif (preg_match('#^M?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$#',
+ $temp_visibility_miles . ' ' . $part, $regs)) {
/*
* Visibility Group
*/
@@ -370,8 +370,8 @@
$decoded_metar['visibility'][] = $group;
$decoded_metar['clouds'][]['condition'] = 'CAVOK';
- } elseif (ereg('^R([0-9]{2})([RLC]?)/([MP]?)([0-9]{4})' .
- '([DNU]?)V?(P?)([0-9]{4})?([DNU]?)$', $part, $regs)) {
+ } elseif (preg_match('#^R([0-9]{2})([RLC]?)/([MP]?)([0-9]{4})' .
+ '([DNU]?)V?(P?)([0-9]{4})?([DNU]?)$#', $part, $regs)) {
/* Runway-group */
unset($group);
$group['nr'] = $regs[1];
@@ -427,12 +427,12 @@
}
$decoded_metar['runway'][] = $group;
- } elseif (ereg('^(VC)?' . /* Proximity */
+ } elseif (preg_match('/^(VC)?' . /* Proximity */
'(-|\+)?' . /* Intensity */
'(MI|PR|BC|DR|BL|SH|TS|FZ)?' . /* Descriptor */
'((DZ|RA|SN|SG|IC|PL|GR|GS|UP)+)?' . /* Precipitation */
'(BR|FG|FU|VA|DU|SA|HZ|PY)?' . /* Obscuration */
- '(PO|SQ|FC|SS)?$', /* Other */
+ '(PO|SQ|FC|SS)?$/', /* Other */
$part, $regs)) {
/*
* Current weather-group.
@@ -449,8 +449,8 @@
/* Cloud-group */
$decoded_metar['clouds'][]['condition'] = $part;
- } elseif (ereg('^(VV|FEW|SCT|BKN|OVC)([0-9]{3}|///)' .
- '(CB|TCU)?$', $part, $regs)) {
+ } elseif (preg_match('#^(VV|FEW|SCT|BKN|OVC)([0-9]{3}|///)' .
+ '(CB|TCU)?$#', $part, $regs)) {
/* We have found (another) a cloud-layer-group. */
unset($group);
@@ -473,7 +473,7 @@
}
$decoded_metar['clouds'][] = $group;
- } elseif (ereg('^(M?[0-9]{2})/(M?[0-9]{2}|//)?$', $part, $regs)) {
+ } elseif (preg_match('#^(M?[0-9]{2})/(M?[0-9]{2}|//)?$#', $part, $regs)) {
/*
* Temperature/Dew Point Group.
*/
@@ -491,7 +491,7 @@
$decoded_metar['temperature']['dew_f'] =
round(strtr($regs[2], 'M', '-') * (9/5) + 32);
}
- } elseif (ereg('A([0-9]{4})', $part, $regs)) {
+ } elseif (preg_match('/A([0-9]{4})/', $part, $regs)) {
/*
* Altimeter.
* The pressure measured in inHg.
@@ -506,7 +506,7 @@
round($regs[1] * 0.33864);
$decoded_metar['altimeter']['atm'] =
number_format($regs[1] * 3.3421e-4, 3, '.', '');
- } elseif (ereg('Q([0-9]{4})', $part, $regs)) {
+ } elseif (preg_match('/Q([0-9]{4})/', $part, $regs)) {
/*
* Altimeter.
* The specification doesn't say anything about
@@ -523,7 +523,7 @@
number_format($regs[1] * 0.02953, 2);
$decoded_metar['altimeter']['atm'] =
number_format($regs[1] * 9.8692e-4, 3, '.', '');
- } elseif (ereg('^T([0-9]{4})([0-9]{4})', $part, $regs)) {
+ } elseif (preg_match('/^T([0-9]{4})([0-9]{4})/', $part, $regs)) {
/*
* Temperature/Dew Point Group, coded to tenth of degree Celsius.
@@ -534,11 +534,11 @@
$this->store_temp($regs[2] / 10,
$decoded_metar['temperature']['dew_c'],
$decoded_metar['temperature']['dew_f']);
- } elseif (ereg('^T([0-9]{4}$)', $part, $regs)) {
+ } elseif (preg_match('/^T([0-9]{4}$)/', $part, $regs)) {
$this->store_temp($regs[1],
$decoded_metar['temperature']['temp_c'],
$decoded_metar['temperature']['temp_f']);
- } elseif (ereg('^1([0-9]{4}$)', $part, $regs)) {
+ } elseif (preg_match('/^1([0-9]{4}$)/', $part, $regs)) {
/*
* 6 hour maximum temperature Celsius, coded to tenth of degree
@@ -546,7 +546,7 @@
$this->store_temp($regs[1] / 10,
$decoded_metar['temp_min_max']['max6h_c'],
$decoded_metar['temp_min_max']['max6h_f']);
- } elseif (ereg('^2([0-9]{4}$)', $part, $regs)) {
+ } elseif (preg_match('/^2([0-9]{4}$)/', $part, $regs)) {
/*
* 6 hour minimum temperature Celsius, coded to tenth of degree
@@ -554,7 +554,7 @@
$this->store_temp($regs[1] / 10,
$decoded_metar['temp_min_max']['min6h_c'],
$decoded_metar['temp_min_max']['min6h_f']);
- } elseif (ereg('^4([0-9]{4})([0-9]{4})$', $part, $regs)) {
+ } elseif (preg_match('/^4([0-9]{4})([0-9]{4})$/', $part, $regs)) {
/*
* 24 hour maximum and minimum temperature Celsius, coded to
@@ -566,7 +566,7 @@
$this->store_temp($regs[2] / 10,
$decoded_metar['temp_min_max']['min24h_c'],
$decoded_metar['temp_min_max']['min24h_f']);
- } elseif (ereg('^P([0-9]{4})', $part, $regs)) {
+ } elseif (preg_match('/^P([0-9]{4})/', $part, $regs)) {
/*
* Precipitation during last hour in hundredths of an inch
@@ -580,7 +580,7 @@
$decoded_metar['precipitation']['mm'] =
number_format($regs[1]*0.254, 2);
}
- } elseif (ereg('^6([0-9]{4})', $part, $regs)) {
+ } elseif (preg_match('/^6([0-9]{4})/', $part, $regs)) {
/*
* Precipitation during last 3 or 6 hours in hundredths of an
@@ -595,7 +595,7 @@
$decoded_metar['precipitation']['mm_6h'] =
number_format($regs[1]*0.254, 2);
}
- } elseif (ereg('^7([0-9]{4})', $part, $regs)) {
+ } elseif (preg_match('/^7([0-9]{4})/', $part, $regs)) {
/*
* Precipitation during last 24 hours in hundredths of an inch.
@@ -609,7 +609,7 @@
$decoded_metar['precipitation']['mm_24h'] =
number_format($regs[1]*0.254, 2, '.', '');
}
- } elseif (ereg('^4/([0-9]{3})', $part, $regs)) {
+ } elseif (preg_match('/^4/([0-9]{3})/', $part, $regs)) {
/*
* Snow depth in inches
@@ -924,7 +924,7 @@
for($i=$first_i;$i<$num_parts;$i++) {
$part = $parts[$i];
- if (ereg('^([0-9]{3}|VRB)([0-9]{2,3})G?([0-9]{2,3})?(KT)', $part, $regs)) {
+ if (preg_match('/^([0-9]{3}|VRB)([0-9]{2,3})G?([0-9]{2,3})?(KT)/', $part, $regs)) {
/* Wind Group */
$decoded_period['desc']['wind']['deg'] = $regs[1];
@@ -945,14 +945,14 @@
$decoded_period['desc']['wind']['gust_meters_per_second'],
$decoded_period['desc']['wind']['gust_miles_per_hour']);
}
- } elseif (ereg('^([0-9]{3})V([0-9]{3})$', $part, $regs) &&
+ } elseif (preg_match('/^([0-9]{3})V([0-9]{3})$/', $part, $regs) &&
!empty($decoded_period['desc']['wind']['deg'])) {
/*
* Variable wind-direction
*/
$decoded_period['desc']['wind']['var_beg'] = $regs[1];
$decoded_period['desc']['wind']['var_end'] = $regs[2];
- } elseif (ereg('^([0-9]{4})([NS]?[EW]?)$', $part, $regs)) {
+ } elseif (preg_match('/^([0-9]{4})([NS]?[EW]?)$/', $part, $regs)) {
/*
* Visibility in meters (4 digits only)
*/
@@ -986,7 +986,7 @@
}
$decoded_period['desc']['visibility'][] = $group;
- } elseif (ereg('^[0-9]$', $part)) {
+ } elseif (preg_match('/^[0-9]$/', $part)) {
/*
* Temp Visibility Group, single digit followed by space.
*/
@@ -1002,7 +1002,7 @@
$group['meter'] = round($vis_miles * 1609.3);
$decoded_period['desc']['visibility'][] = $group;
- } elseif (ereg('^[M]?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$',
+ } elseif (preg_match('#^[M]?(([0-9]?)[ ]?([0-9])(/?)([0-9]*))SM$#',
$temp_visibility_miles . ' ' . $part, $regs)) {
/*
* Visibility Group
@@ -1035,12 +1035,12 @@
$decoded_period['desc']['visibility'][] = $group;
- } elseif (ereg('^(VC)?' . /* Proximity */
+ } elseif (preg_match('/^(VC)?' . /* Proximity */
'(-|\+)?' . /* Intensity */
- '(MI|PR|BC|DR|BL|SH|TS|FZ|NSW)?' . /* Descriptor */
+ '(MI|PR|BC|DR|BL|SH|TS|FZ|NSW)?' . /* Descriptor */
'((DZ|RA|SN|SG|IC|PL|GR|GS|UP)+)?' . /* Precipitation */
'(BR|FG|FU|VA|DU|SA|HZ|PY)?' . /* Obscuration */
- '(PO|SQ|FC|SS)?$', /* Other */
+ '(PO|SQ|FC|SS)?$/', /* Other */
$part, $regs)) {
/*
* Current weather-group.
@@ -1057,8 +1057,8 @@
/* Cloud-group */
$decoded_period['desc']['clouds'][]['condition'] = $part;
- } elseif (ereg('^(VV|FEW|SCT|BKN|OVC)([0-9]{3}|///)' .
- '(CB|TCU)?$', $part, $regs)) {
+ } elseif (preg_match('#^(VV|FEW|SCT|BKN|OVC)([0-9]{3}|///)' .
+ '(CB|TCU)?$#', $part, $regs)) {
/* We have found (another) a cloud-layer-group. */
unset($group);
@@ -1081,7 +1081,7 @@
}
$decoded_period['desc']['clouds'][] = $group;
- } elseif (ereg('^WS([0-9]{3})/([0-9]{3})([0-9]{2})KT$', $part, $regs)) {
+ } elseif (preg_match('#^WS([0-9]{3})/([0-9]{3})([0-9]{2})KT$#', $part, $regs)) {
/* We have found a Wind Shear group. example WS011/27050KT */
unset($ws);
if ($regs[1] == '000') {
Modified: trunk/lib/phpweather-2.2.2/pw_utilities.php
===================================================================
--- trunk/lib/phpweather-2.2.2/pw_utilities.php 2016-02-11 09:33:23 UTC (rev 9797)
+++ trunk/lib/phpweather-2.2.2/pw_utilities.php 2016-02-11 10:04:41 UTC (rev 9798)
@@ -91,7 +91,7 @@
$dir = opendir(dirname(__FILE__) . '/output');
while($file = readdir($dir)) {
- if (ereg("^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$", $file, $regs)) {
+ if (preg_match("/^pw_${type}_([a-z][a-z])(_[A-Z][A-Z])?\.php$/", $file, $regs)) {
$output[$regs[1] . $regs[2]] = $languages[$regs[1] . $regs[2]];
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|