Update of /cvsroot/phpweather/phpweather/locales
In directory usw-pr-cvs1:/tmp/cvs-serv10758/locales
Modified Files:
locale_common.php
Log Message:
Re-positioning brackets for understanding the logic...
Index: locale_common.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/locales/locale_common.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- locale_common.php 2001/07/10 20:56:47 1.9
+++ locale_common.php 2001/07/11 20:13:25 1.10
@@ -83,7 +83,7 @@
*/
function get_marks() {
- return array($this->properties['mark_begin'], $this->properties['mark_end']);
+ return array($this->properties['mark_begin'], $this->properties['mark_end']);
}
/**
@@ -145,6 +145,7 @@
* @access public
* @see get_exclude()
*/
+
function set_exclude($new_exclude) {
if (is_array($new_exclude)) {
$this->properties['exclude'] = $new_exclude;
@@ -160,6 +161,7 @@
* @access public
* @see set_exclude()
*/
+
function get_exclude() {
return $this->properties['exclude'];
}
@@ -225,8 +227,7 @@
function list_sentences () {
$num_args = func_num_args();
- if ($num_args == 0) {
- /* No arg, return */
+ if ($num_args == 0) { /* No arg, return */
return;
}
@@ -243,18 +244,18 @@
if ($num_real_args == 0) {
return;
} elseif ($num_real_args == 1) {
- return $real_args[0];
- } elseif ($num_real_args == 2) {
- return $real_args[0] . $this->strings['list_sentences_and'] . $real_args[1];
- } else {
- $output = $real_args[0];
+ return $real_args[0];
+ } elseif ($num_real_args == 2) {
+ return $real_args[0] . $this->strings['list_sentences_and'] . $real_args[1];
+ } else {
+ $output = $real_args[0];
- for ($i = 1; $i < $num_real_args - 1; $i++) {
- $output .= $this->strings['list_sentences_comma']. $real_args[$i];
- }
- $output .= $this->strings['list_sentences_final_and'] . $real_args[$i];
+ for ($i = 1; $i < $num_real_args - 1; $i++) {
+ $output .= $this->strings['list_sentences_comma']. $real_args[$i];
+ }
+ $output .= $this->strings['list_sentences_final_and'] . $real_args[$i];
return $output;
- }
+ }
}
/**
@@ -279,10 +280,10 @@
$this->properties['mark_end'] .
$this->strings['mm'],
$this->properties['mark_begin'] . $in .
$this->properties['mark_end'] .
$this->strings['inches']);
- }
+ }
return $amount;
+ }
}
- }
/**
* Function used to parse a cloud-group.
@@ -304,7 +305,7 @@
$prefix = $this->strings['less_than'];
} else {
$prefix = '';
- }
+ }
if ($condition == 'OVC') {
$output = sprintf($this->strings['cloud_overcast'],
@@ -322,8 +323,8 @@
$this->properties['mark_end'] . $this->strings['meter'],
$this->properties['mark_begin'] . $ft .
$this->properties['mark_end'] . $this->strings['feet']);
- } elseif($condition == 'CAVOK') {
- $output = sprintf($this->strings['cavok'],
+ } elseif($condition == 'CAVOK') {
+ $output = sprintf($this->strings['cavok'],
$this->pref_units($this->properties['mark_begin'] .
'1500' .
$this->properties['mark_end'] .
@@ -332,17 +333,17 @@
'5000' .
$this->properties['mark_end'] .
$this->strings['feet']));
- } else {
- if (empty($cumulus)) {
- $cumulus = '';
- } elseif ($cumulus == 'CB') {
- $cumulus = $this->strings['cumulonimbus'];
- } elseif ($cumulus == 'TCU') {
- $cumulus = $this->strings['towering_cumulus'];
- } else {
- $cumulus = '';
- $this->error("\$cumulus not recognized: $cumulus");
- }
+ } else {
+ if (empty($cumulus)) {
+ $cumulus = '';
+ } elseif ($cumulus == 'CB') {
+ $cumulus = $this->strings['cumulonimbus'];
+ } elseif ($cumulus == 'TCU') {
+ $cumulus = $this->strings['towering_cumulus'];
+ } else {
+ $cumulus = '';
+ $this->error("\$cumulus not recognized: $cumulus");
+ }
$output = $this->properties['mark_begin'] .
$this->strings['cloud_condition'][$condition] .
$cumulus . $this->properties['mark_end'] . $this->strings['cloud_height'] .
@@ -375,19 +376,19 @@
/* The descriptor should be filled in */
if ($weather_group['descriptor'] == 'TS' &&
- !empty($weather_group['precipitation'])) {
+ !empty($weather_group['precipitation'])) {
- /* Special case for thunderstorms. They use the extra
- * word 'with' between the descriptor (which would be
- * 'thunderstorm' in this case) and the precipitation.
- * But this is only true if there's also precipitation.
- */
-
- $output .= $this->strings['weather'][$weather_group['descriptor']] .
- $this->strings['with'];
- } else {
- $output .= $this->strings['weather'][$weather_group['descriptor']];
- }
+ /* Special case for thunderstorms. They use the extra
+ * word 'with' between the descriptor (which would be
+ * 'thunderstorm' in this case) and the precipitation.
+ * But this is only true if there's also precipitation.
+ */
+
+ $output .= $this->strings['weather'][$weather_group['descriptor']] .
+ $this->strings['with'];
+ } else {
+ $output .= $this->strings['weather'][$weather_group['descriptor']];
+ }
}
/* If the intensity is non-empty, we just add it. If not, it could
@@ -399,17 +400,17 @@
$output .= $this->strings['weather'][$weather_group['intensity']];
} elseif (!empty($weather_group['precipitation'])) {
$output .= $this->strings['weather'][' '];
- }
+ }
- /* There can only be one of the next three items. */
+ /* There can only be one of the next three items. */
if (!empty($weather_group['precipitation'])) {
$output .= $this->strings['weather'][$weather_group['precipitation']];
} elseif (!empty($weather_group['obscuration'])) {
- $output .= $this->strings['weather'][$weather_group['obscuration']];
- } elseif (!empty($weather_group['other'])) {
- $output .= $this->strings['weather'][$weather_group['other']];
- }
+ $output .= $this->strings['weather'][$weather_group['obscuration']];
+ } elseif (!empty($weather_group['other'])) {
+ $output .= $this->strings['weather'][$weather_group['other']];
+ }
/* 'proximity' can only be 'VC'. We test for it here instead of
* earlier because it should be put last.
@@ -433,21 +434,21 @@
if (empty($tendency)) {
return;
} elseif ($tendency == 'U') {
- return sprintf($this->strings['runway_upward_tendency'],
+ return sprintf($this->strings['runway_upward_tendency'],
$this->properties['mark_begin'],
$this->properties['mark_end']);
- } elseif ($tendency == 'D') {
- return sprintf($this->strings['runway_downward_tendency'],
+ } elseif ($tendency == 'D') {
+ return sprintf($this->strings['runway_downward_tendency'],
$this->properties['mark_begin'],
$this->properties['mark_end']);
- } elseif ($tendency == 'N') {
- return sprintf($this->strings['runway_no_tendency'],
+ } elseif ($tendency == 'N') {
+ return sprintf($this->strings['runway_no_tendency'],
$this->properties['mark_begin'],
$this->properties['mark_end']);
- } else {
- $this->error("\$tendency is out of range: '$tendency'");
- return;
- }
+ } else {
+ $this->error("\$tendency is out of range: '$tendency'");
+ return;
+ }
}
/**
@@ -468,15 +469,17 @@
if (empty($approach)) {
$approach = '';
} elseif ($approach == 'L') {
- $approach = $this->strings['runway_left'];
- } elseif ($approach == 'C') {
- $approach = $this->strings['runway_central'];
- } elseif ($approach == 'R') {
- $approach = $this->strings['runway_right'];
- } else {
- $approach = '';
- $this->error("parse_runway_group(): \$approach not recognized: $approach");
- }
+ $approach = $this->strings['runway_left'];
+ } elseif ($approach == 'C') {
+ $approach = $this->strings['runway_central'];
+ } elseif ($approach == 'R') {
+ $approach = $this->strings['runway_right'];
+ } else {
+ $approach = '';
+ $this->error("parse_runway_group(): \$approach not recognized:
+$approach");
+ }
+
+ // I re-positioned the brackets to this point. - M. Gy.
if (!empty($min_meter)) {
@@ -529,20 +532,20 @@
function parse_visibility_group($visibility_group) {
if (empty($visibility_group) || !is_array($visibility_group)) {
return;
- }
+ }
extract($visibility_group);
if (empty($prefix)) {
$prefix = '';
} elseif ($prefix == -1) {
- $prefix = $this->strings['visibility_less_than'];
- } elseif ($prefix == 1) {
- $prefix = $this->strings['visibility_greater_than'];
- } else {
- $prefix = '';
- error("\$prefix is out of range: $prefix!");
- }
+ $prefix = $this->strings['visibility_less_than'];
+ } elseif ($prefix == 1) {
+ $prefix = $this->strings['visibility_greater_than'];
+ } else {
+ $prefix = '';
+ error("\$prefix is out of range: $prefix!");
+ }
if ($meter < 5000) {
$metric = $meter;
@@ -550,30 +553,30 @@
$imperial = $ft;
$im_unit = $this->strings['feet'];
} else {
- $metric = $km;
- $me_unit = $this->strings['kilometers'];
- $imperial = $miles;
- $im_unit = $this->strings['miles'];
- }
+ $metric = $km;
+ $me_unit = $this->strings['kilometers'];
+ $imperial = $miles;
+ $im_unit = $this->strings['miles'];
+ }
- if (empty($dir)) {
- $output = $prefix .
+ if (empty($dir)) {
+ $output = $prefix .
$this->pref_units($this->properties['mark_begin'] . $metric .
$this->properties['mark_end'] . $me_unit,
$this->properties['mark_begin'] . $imperial .
$this->properties['mark_end'] . $im_unit);
- } else {
+ } else {
- $output = $prefix .
- $this->pref_units($this->properties['mark_begin'] . $metric .
+ $output = $prefix .
+ $this->pref_units($this->properties['mark_begin'] . $metric .
$this->properties['mark_end'] . $me_unit,
$this->properties['mark_begin'] . $imperial .
$this->properties['mark_end'] . $im_unit) .
- $this->strings['to'] . $this->properties['mark_begin'] .
- $this->strings[$dir] . $this->properties['mark_end'];
+ $this->strings['to'] . $this->properties['mark_begin'] .
+ $this->strings[$dir] . $this->properties['mark_end'];
+ }
+ return $output;
}
- return $output;
- }
/**
* The pretty-print function.
@@ -590,9 +593,9 @@
if (empty($data['metar'])) {
- /* We don't want to display all sorts of silly things
- * if the metar is empty.
- */
+ /* We don't want to display all sorts of silly things
+ * if the metar is empty.
+ */
printf($this->strings['no_data'],
$this->properties['mark_begin'],
@@ -603,7 +606,7 @@
extract($data);
- /* Location. */
+ /* Location. */
if (!in_array('location', $this->properties['exclude'])) {
$output['location'] = sprintf($this->strings['location'],
@@ -612,9 +615,9 @@
$this->properties['mark_end']);
}
- /*********************
- * Time and date *
- *********************/
+ /*********************
+ * Time and date *
+ *********************/
if (!in_array('time', $this->properties['exclude'])) {
$minutes_old = round((time() - $time)/60);
@@ -624,31 +627,31 @@
if ($minutes < 1) {
$minutes = '';
} else {
- $minutes = sprintf($this->strings['time_minutes'],
+ $minutes = sprintf($this->strings['time_minutes'],
$this->properties['mark_begin'],
$minutes,
$this->properties['mark_end']);
- }
- if ($hours == 1) {
- $time_ago = sprintf($this->strings['time_one_hour'],
+ }
+ if ($hours == 1) {
+ $time_ago = sprintf($this->strings['time_one_hour'],
$this->properties['mark_begin'],
$this->properties['mark_end'],
$minutes);
- } else {
- $time_ago = sprintf($this->strings['time_several_hours'],
+ } else {
+ $time_ago = sprintf($this->strings['time_several_hours'],
$this->properties['mark_begin'],
$hours,
$this->properties['mark_end'],
$minutes);
- }
+ }
} else {
- if ($minutes_old < 5) {
- $time_ago = $this->properties['mark_begin'] . $this->strings['time_a_moment']
. $this->properties['mark_end'];
- } else {
- $time_ago = $this->properties['mark_begin'] . $minutes_old .
- $this->properties['mark_end'] . $this->strings['minutes'];
+ if ($minutes_old < 5) {
+ $time_ago = $this->properties['mark_begin'] .
+$this->strings['time_a_moment'] . $this->properties['mark_end'];
+ } else {
+ $time_ago = $this->properties['mark_begin'] . $minutes_old .
+ $this->properties['mark_end'] . $this->strings['minutes'];
+ }
}
- }
$gmtime = gmdate('H:i', $time);
$output['time'] = sprintf($this->strings['time_format'],
$time_ago,
@@ -663,9 +666,9 @@
if (!in_array('wind', $this->properties['exclude']) && !empty($wind)) {
extract($wind);
- if (!empty($meters_per_second)) {
+ if (!empty($meters_per_second)) {
$wind_str = $this->strings['wind_blowing'] .
- $this->pref_units($this->properties['mark_begin'] .
+ $this->pref_units($this->properties['mark_begin'] .
$meters_per_second .
$this->properties['mark_end'] .
$this->strings['meters_per_second'],
@@ -673,12 +676,12 @@
$miles_per_hour .
$this->properties['mark_end'] .
$this->strings['miles_per_hour']);
- if (!empty($gust_meters_per_second)) {
+ if (!empty($gust_meters_per_second)) {
$wind_str .= $this->strings['wind_with_gusts'] .
- $this->pref_units($this->properties['mark_begin'] . $gust_meters_per_second .
- $this->properties['mark_end'] .
$this->strings['meters_per_second'],
- $this->properties['mark_begin'] . $gust_miles_per_hour .
- $this->properties['mark_end'] .
$this->strings['miles_per_hour']);
+ $this->pref_units($this->properties['mark_begin'] . $gust_meters_per_second .
+ $this->properties['mark_end'] . $this->strings['meters_per_second'],
+ $this->properties['mark_begin'] . $gust_miles_per_hour .
+ $this->properties['mark_end'] . $this->strings['miles_per_hour']);
}
if ($deg == 'VRB') {
$wind_str .= sprintf($this->strings['wind_variable'],
@@ -686,18 +689,18 @@
$this->properties['mark_end']);
} else {
- $dir_str = $this->strings['wind_dir'][intval(round($deg/22.5))];
+ $dir_str = $this->strings['wind_dir'][intval(round($deg/22.5))];
- $wind_str .= $this->strings['wind_from'] . $this->properties['mark_begin'] .
+ $wind_str .= $this->strings['wind_from'] . $this->properties['mark_begin'] .
$dir_str . $this->properties['mark_end'] . ' (' .
$this->properties['mark_begin'] . $deg . '°' .
$this->properties['mark_end'] . ')';
- if (!empty($var_beg)) {
+ if (!empty($var_beg)) {
- $dir_beg_str = $this->strings['wind_dir'][intval(round($var_beg/22.5))];
- $dir_end_str = $this->strings['wind_dir'][intval(round($var_end/22.5))];
+ $dir_beg_str = $this->strings['wind_dir'][intval(round($var_beg/22.5))];
+ $dir_end_str = $this->strings['wind_dir'][intval(round($var_end/22.5))];
- $wind_str .= sprintf($this->strings['wind_varying'],
+ $wind_str .= sprintf($this->strings['wind_varying'],
$this->properties['mark_begin'],
$dir_beg_str,
$this->properties['mark_end'],
@@ -710,14 +713,14 @@
$this->properties['mark_begin'],
$var_end,
$this->properties['mark_end']);
- }
+ }
}
} else {
- $wind_str = sprintf($this->strings['wind_calm'],
+ $wind_str = sprintf($this->strings['wind_calm'],
$this->properties['mark_begin'],
$this->properties['mark_end']);
- }
- $output['wind'] = $wind_str . '.';
+ }
+ $output['wind'] = $wind_str . '.';
}
/*********************************
@@ -728,16 +731,16 @@
extract($temperature);
$output['temperature'] = $this->strings['temperature'] .
- $this->pref_units($this->properties['mark_begin'] . $temp_c .
- $this->properties['mark_end'] . ' °C',
- $this->properties['mark_begin'] . $temp_f .
- $this->properties['mark_end'] . ' °F');
+ $this->pref_units($this->properties['mark_begin'] . $temp_c .
+ $this->properties['mark_end'] . ' °C',
+ $this->properties['mark_begin'] . $temp_f .
+ $this->properties['mark_end'] . ' °F');
if (!empty($dew_c)) {
$output['temperature'] .= $this->strings['dew_point'] .
- $this->pref_units($this->properties['mark_begin'] . $dew_c .
- $this->properties['mark_end'] . ' °C',
- $this->properties['mark_begin'] . $dew_f .
- $this->properties['mark_end'] . ' °F') . '.';
+ $this->pref_units($this->properties['mark_begin'] . $dew_c .
+ $this->properties['mark_end'] . ' °C',
+ $this->properties['mark_begin'] . $dew_f .
+ $this->properties['mark_end'] . ' °F') . '.';
}
}
@@ -748,10 +751,10 @@
if (!in_array('altimeter', $this->properties['exclude']) && !empty($altimeter)) {
extract($altimeter);
$output['altimeter'] = $this->strings['altimeter'] .
- $this->pref_units($this->properties['mark_begin'] . $hpa .
- $this->properties['mark_end'] . ' hPa',
- $this->properties['mark_begin'] . $inhg .
- $this->properties['mark_end'] . ' inHg') . '.';
+ $this->pref_units($this->properties['mark_begin'] . $hpa .
+ $this->properties['mark_end'] . ' hPa',
+ $this->properties['mark_begin'] . $inhg .
+ $this->properties['mark_end'] . ' inHg') . '.';
}
/**************************
@@ -772,27 +775,27 @@
$cloud_group1['condition'] == 'CLR' ||
$cloud_group1['condition'] == 'SKC') {
$output['clouds'] = sprintf($this->strings['cloud_clear'],
- $this->properties['mark_begin'],
- $this->properties['mark_end']);
+ $this->properties['mark_begin'],
+ $this->properties['mark_end']);
} else {
- $cloud_str1 = $this->parse_cloud_group($cloud_group1);
- if (!empty($cloud_group2)) {
- $cloud_str2 = $this->parse_cloud_group($cloud_group2);
- } else {
- $cloud_str2 = '';
- }
-
- if (!empty($cloud_group3)) {
- $cloud_str3 = $this->parse_cloud_group($cloud_group3);
- } else {
- $cloud_str3 = '';
- }
+ $cloud_str1 = $this->parse_cloud_group($cloud_group1);
+ if (!empty($cloud_group2)) {
+ $cloud_str2 = $this->parse_cloud_group($cloud_group2);
+ } else {
+ $cloud_str2 = '';
+ }
+
+ if (!empty($cloud_group3)) {
+ $cloud_str3 = $this->parse_cloud_group($cloud_group3);
+ } else {
+ $cloud_str3 = '';
+ }
$output['clouds'] = $this->strings['cloud_group_beg'] .
$this->list_sentences($cloud_str1,
- $cloud_str2,
- $cloud_str3) .
+ $cloud_str2,
+ $cloud_str3) .
$this->strings['cloud_group_end'];
}
}
_______________________________________________
PHPWeather-checkins mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/phpweather-checkins