summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknut <>2008-07-30 01:43:12 +0000
committerknut <>2008-07-30 01:43:12 +0000
commit411fbb72f5a4c72e43af08ee403c79c73eb4b53f (patch)
tree3915b0d98ca3c0608b56ad280cb08b8837a43dea
parentd15b608ef693c8dbc92c3a5f5ae826ca2812a61f (diff)
fixed #890
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordManager.php7
-rw-r--r--framework/Data/SqlMap/TSqlMapConfig.php12
-rw-r--r--framework/I18N/core/CultureInfo.php6
-rw-r--r--framework/I18N/core/DateFormat.php4
-rw-r--r--framework/I18N/core/DateTimeFormatInfo.php2
-rw-r--r--framework/I18N/core/HTTPNegotiator.php6
-rw-r--r--framework/I18N/core/MessageSource_XLIFF.php6
-rw-r--r--framework/I18N/core/MessageSource_gettext.php6
-rw-r--r--framework/I18N/core/NumberFormat.php5
-rw-r--r--framework/I18N/core/NumberFormatInfo.php2
-rw-r--r--framework/PradoBase.php8
-rw-r--r--framework/Util/TSimpleDateFormatter.php15
-rw-r--r--framework/Web/Javascripts/TJavaScript.php4
-rw-r--r--framework/Web/UI/TClientScriptManager.php9
-rwxr-xr-xframework/prado-cli.php2
15 files changed, 54 insertions, 40 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php
index 3790773d..a2f9a44f 100644
--- a/framework/Data/ActiveRecord/TActiveRecordManager.php
+++ b/framework/Data/ActiveRecord/TActiveRecordManager.php
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
* TActiveRecordManager class file.
*
@@ -93,8 +93,9 @@ class TActiveRecordManager extends TComponent
*/
public function getRecordGateway()
{
- if(is_null($this->_gateway))
+ if($this->_gateway === null) {
$this->_gateway = $this->createRecordGateway();
+ }
return $this->_gateway;
}
@@ -107,5 +108,5 @@ class TActiveRecordManager extends TComponent
}
}
-
+
?> \ No newline at end of file
diff --git a/framework/Data/SqlMap/TSqlMapConfig.php b/framework/Data/SqlMap/TSqlMapConfig.php
index 5ee4de54..b51ac122 100644
--- a/framework/Data/SqlMap/TSqlMapConfig.php
+++ b/framework/Data/SqlMap/TSqlMapConfig.php
@@ -47,8 +47,9 @@ class TSqlMapConfig extends TDataSourceConfig
public function clearCache()
{
$cache = $this->getApplication()->getCache();
- if(!is_null($cache))
+ if($cache !== null) {
$cache->delete($this->getCacheKey());
+ }
}
/**
@@ -60,8 +61,9 @@ class TSqlMapConfig extends TDataSourceConfig
if($this->getEnableCache())
{
$cache = $this->getApplication()->getCache();
- if(!is_null($cache))
+ if($cache !== null) {
return $cache->set($this->getCacheKey(), $manager);
+ }
}
return false;
}
@@ -75,7 +77,7 @@ class TSqlMapConfig extends TDataSourceConfig
if($this->getEnableCache())
{
$cache = $this->getApplication()->getCache();
- if(!is_null($cache))
+ if($cache !== null)
{
$manager = $cache->get($this->getCacheKey());
if($manager instanceof TSqlMapManager)
@@ -104,7 +106,7 @@ class TSqlMapConfig extends TDataSourceConfig
else
{
$file = Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT);
- if(is_null($file) || !is_file($file))
+ if($file === null || !is_file($file))
throw new TConfigurationException('sqlmap_configfile_invalid',$value);
else
$this->_configFile = $file;
@@ -159,5 +161,5 @@ class TSqlMapConfig extends TDataSourceConfig
return $this->_sqlmap;
}
}
-
+
?> \ No newline at end of file
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;
diff --git a/framework/PradoBase.php b/framework/PradoBase.php
index 2fba2ffd..203dc667 100644
--- a/framework/PradoBase.php
+++ b/framework/PradoBase.php
@@ -414,7 +414,7 @@ class PradoBase
echo 'array(' . count($item) . ')';
else if (is_bool($item))
echo $item ? 'true' : 'false';
- else if (is_null($item))
+ else if ($item === null)
echo 'NULL';
else if (is_resource($item))
echo get_resource_type($item);
@@ -571,9 +571,9 @@ class PradoBase
//no translation handler provided
if($app===null || ($config = $app->getTranslationConfiguration())===null)
return strtr($text, $params);
-
- if ($catalogue===null)
- $catalogue=isset($config['catalogue'])?$config['catalogue']:'messages';
+
+ if ($catalogue===null)
+ $catalogue=isset($config['catalogue'])?$config['catalogue']:'messages';
Translation::init($catalogue);
diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php
index 8da02aa6..7e5ad415 100644
--- a/framework/Util/TSimpleDateFormatter.php
+++ b/framework/Util/TSimpleDateFormatter.php
@@ -189,10 +189,11 @@ class TSimpleDateFormatter
*/
public function isValidDate($value)
{
- if(is_null($value))
+ if($value === null) {
return false;
- else
- return !is_null($this->parse($value, false));
+ } else {
+ return $this->parse($value, false) !== null;
+ }
}
/**
@@ -254,7 +255,7 @@ class TSimpleDateFormatter
if ($token=='yy') { $x=2;$y=2; }
if ($token=='y') { $x=2;$y=4; }
$year = $this->getInteger($value,$i_val,$x,$y);
- if(is_null($year))
+ if($year === null)
return null;
//throw new TInvalidDataValueException('Invalid year', $value);
$i_val += strlen($year);
@@ -273,7 +274,7 @@ class TSimpleDateFormatter
$month=$this->getInteger($value,$i_val,
$this->length($token),2);
$iMonth = intval($month);
- if(is_null($month) || $iMonth < 1 || $iMonth > 12 )
+ if($month === null || $iMonth < 1 || $iMonth > 12 )
return null;
//throw new TInvalidDataValueException('Invalid month', $value);
$i_val += strlen($month);
@@ -284,7 +285,7 @@ class TSimpleDateFormatter
$day = $this->getInteger($value,$i_val,
$this->length($token), 2);
$iDay = intval($day);
- if(is_null($day) || $iDay < 1 || $iDay >31)
+ if($day === null || $iDay < 1 || $iDay >31)
return null;
//throw new TInvalidDataValueException('Invalid day', $value);
$i_val += strlen($day);
@@ -301,7 +302,7 @@ class TSimpleDateFormatter
}
if ($i_val != $this->length($value))
throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value);
- if(!$defaultToCurrentTime && (is_null($month) || is_null($day) || is_null($year)))
+ if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
return null;
else
{
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php
index d26d243a..9524076c 100644
--- a/framework/Web/Javascripts/TJavaScript.php
+++ b/framework/Web/Javascripts/TJavaScript.php
@@ -208,7 +208,7 @@ class TJavaScript
*/
public static function jsonEncode($value)
{
- if(is_null(self::$_json))
+ if(self::$_json === null)
self::$_json = Prado::createComponent('System.Web.Javascripts.TJSON');
return self::$_json->encode($value);
}
@@ -221,7 +221,7 @@ class TJavaScript
*/
public static function jsonDecode($value)
{
- if(is_null(self::$_json))
+ if(self::$_json === null)
self::$_json = Prado::createComponent('System.Web.Javascripts.TJSON');
return self::$_json->decode($value);
}
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 6d4775bf..3a51bf76 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -115,7 +115,7 @@ class TClientScriptManager extends TApplicationComponent
{
if(!isset($this->_registeredPradoScripts[$name]))
{
- if(is_null(self::$_pradoScripts))
+ if(self::$_pradoScripts === null)
{
$packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH.'/packages.php';
list($packages,$deps)= include($packageFile);
@@ -207,8 +207,9 @@ class TClientScriptManager extends TApplicationComponent
$assets = Prado::getApplication()->getAssetManager();
if(strpos($base, $assets->getBaseUrl())===false)
{
- if(!is_null($dir = Prado::getPathOfNameSpace($base)))
+ if(($dir = Prado::getPathOfNameSpace($base)) !== null) {
$base = $dir;
+ }
return array($assets->getPublishedPath($base), $assets->publishFilePath($base));
}
else
@@ -259,7 +260,9 @@ class TClientScriptManager extends TApplicationComponent
*/
public function registerPostBackControl($class,$options)
{
- if(is_null($class)) return;
+ if($class === null) {
+ return;
+ }
if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null)
$options['FormID']=$form->getClientID();
$optionString=TJavaScript::encode($options);
diff --git a/framework/prado-cli.php b/framework/prado-cli.php
index 18efb651..4fa8e1fb 100755
--- a/framework/prado-cli.php
+++ b/framework/prado-cli.php
@@ -79,7 +79,7 @@ class PradoCommandLineInterpreter
public static function getInstance()
{
static $instance;
- if(is_null($instance))
+ if($instance === null)
$instance = new self;
return $instance;
}