From 411fbb72f5a4c72e43af08ee403c79c73eb4b53f Mon Sep 17 00:00:00 2001 From: knut <> Date: Wed, 30 Jul 2008 01:43:12 +0000 Subject: fixed #890 --- framework/I18N/core/CultureInfo.php | 6 +++--- framework/I18N/core/DateFormat.php | 4 ++-- framework/I18N/core/DateTimeFormatInfo.php | 2 +- framework/I18N/core/HTTPNegotiator.php | 6 ++++-- framework/I18N/core/MessageSource_XLIFF.php | 6 ++++-- framework/I18N/core/MessageSource_gettext.php | 6 ++++-- framework/I18N/core/NumberFormat.php | 5 +++-- framework/I18N/core/NumberFormatInfo.php | 2 +- 8 files changed, 22 insertions(+), 15 deletions(-) (limited to 'framework/I18N/core') diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php index 41b3bf45..31404a23 100644 --- a/framework/I18N/core/CultureInfo.php +++ b/framework/I18N/core/CultureInfo.php @@ -375,7 +375,7 @@ class CultureInfo */ function getDateTimeFormat() { - if(is_null($this->dateTimeFormat)) + if($this->dateTimeFormat === null) { $calendar = $this->getCalendar(); $info = $this->findInfo("calendar/{$calendar}", true); @@ -455,7 +455,7 @@ class CultureInfo static function getInvariantCulture() { static $invariant; - if(is_null($invariant)) + if($invariant === null) $invariant = new CultureInfo(); return $invariant; } @@ -478,7 +478,7 @@ class CultureInfo */ function getNumberFormat() { - if(is_null($this->numberFormat)) + if($this->numberFormat === null) { $elements = $this->findInfo('NumberElements'); $patterns = $this->findInfo('NumberPatterns'); diff --git a/framework/I18N/core/DateFormat.php b/framework/I18N/core/DateFormat.php index 8dd3fdca..178da0bb 100644 --- a/framework/I18N/core/DateFormat.php +++ b/framework/I18N/core/DateFormat.php @@ -91,7 +91,7 @@ class DateFormat */ function __construct($formatInfo=null) { - if(is_null($formatInfo)) + if($formatInfo === null) $this->formatInfo = DateTimeFormatInfo::getInvariantInfo(); else if($formatInfo instanceof CultureInfo) $this->formatInfo = $formatInfo->DateTimeFormat; @@ -115,7 +115,7 @@ class DateFormat else if(is_string($time)) $time = @strtotime($time); - if(is_null($pattern)) + if($pattern === null) $pattern = 'F'; $s = Prado::createComponent('System.Util.TDateTimeStamp'); diff --git a/framework/I18N/core/DateTimeFormatInfo.php b/framework/I18N/core/DateTimeFormatInfo.php index 04ed0e73..4d7231fa 100644 --- a/framework/I18N/core/DateTimeFormatInfo.php +++ b/framework/I18N/core/DateTimeFormatInfo.php @@ -152,7 +152,7 @@ class DateTimeFormatInfo static function getInvariantInfo() { static $invariant; - if(is_null($invariant)) + if($invariant === null) { $culture = CultureInfo::getInvariantCulture(); $invariant = $culture->getDateTimeFormat(); diff --git a/framework/I18N/core/HTTPNegotiator.php b/framework/I18N/core/HTTPNegotiator.php index dce40194..66017fda 100644 --- a/framework/I18N/core/HTTPNegotiator.php +++ b/framework/I18N/core/HTTPNegotiator.php @@ -51,8 +51,9 @@ class HTTPNegotiator */ function getLanguages() { - if(!is_null($this->languages)) + if($this->languages !== null) { return $this->languages; + } $this->languages = array(); @@ -107,8 +108,9 @@ class HTTPNegotiator */ function getCharsets() { - if(!is_null($this->charsets)) + if($this->charsets !== null) { return $this->charsets; + } $this->charsets = array(); diff --git a/framework/I18N/core/MessageSource_XLIFF.php b/framework/I18N/core/MessageSource_XLIFF.php index 64277e7b..c3dfabd9 100644 --- a/framework/I18N/core/MessageSource_XLIFF.php +++ b/framework/I18N/core/MessageSource_XLIFF.php @@ -251,8 +251,9 @@ class MessageSource_XLIFF extends MessageSource */ private function getVariants($catalogue='messages') { - if(is_null($catalogue)) + if($catalogue === null) { $catalogue = 'messages'; + } foreach($this->getCatalogueList($catalogue) as $variant) { @@ -478,8 +479,9 @@ class MessageSource_XLIFF extends MessageSource protected function createMessageTemplate($catalogue) { - if(is_null($catalogue)) + if($catalogue === null) { $catalogue = 'messages'; + } $variants = $this->getCatalogueList($catalogue); $variant = array_shift($variants); $file = $this->getSource($variant); diff --git a/framework/I18N/core/MessageSource_gettext.php b/framework/I18N/core/MessageSource_gettext.php index 6849987f..a6a936aa 100644 --- a/framework/I18N/core/MessageSource_gettext.php +++ b/framework/I18N/core/MessageSource_gettext.php @@ -186,8 +186,9 @@ class MessageSource_gettext extends MessageSource */ private function getVariants($catalogue='messages') { - if(is_null($catalogue)) + if($catalogue === null) { $catalogue = 'messages'; + } foreach($this->getCatalogueList($catalogue) as $variant) { @@ -423,8 +424,9 @@ class MessageSource_gettext extends MessageSource protected function createMessageTemplate($catalogue) { - if(is_null($catalogue)) + if($catalogue === null) { $catalogue = 'messages'; + } $variants = $this->getCatalogueList($catalogue); $variant = array_shift($variants); $mo_file = $this->getSource($variant); diff --git a/framework/I18N/core/NumberFormat.php b/framework/I18N/core/NumberFormat.php index 24869b3f..bac57fb5 100644 --- a/framework/I18N/core/NumberFormat.php +++ b/framework/I18N/core/NumberFormat.php @@ -90,7 +90,7 @@ class NumberFormat */ function __construct($formatInfo=null) { - if(is_null($formatInfo)) + if($formatInfo === null) $this->formatInfo = NumberFormatInfo::getInvariantInfo(); else if($formatInfo instanceof CultureInfo) $this->formatInfo = $formatInfo->NumberFormat; @@ -143,8 +143,9 @@ class NumberFormat //replace currency sign $symbol = @$this->formatInfo->getCurrencySymbol($currency); - if(is_null($symbol)) + if($symbol === null) { $symbol = $currency; + } $result = str_replace('ยค',$symbol, $result); diff --git a/framework/I18N/core/NumberFormatInfo.php b/framework/I18N/core/NumberFormatInfo.php index 2d0d5a36..2331b147 100644 --- a/framework/I18N/core/NumberFormatInfo.php +++ b/framework/I18N/core/NumberFormatInfo.php @@ -155,7 +155,7 @@ class NumberFormatInfo public static function getInvariantInfo($type=NumberFormatInfo::DECIMAL) { static $invariant; - if(is_null($invariant)) + if($invariant === null) { $culture = CultureInfo::getInvariantCulture(); $invariant = $culture->NumberFormat; -- cgit v1.2.3