From a30da2e71ad2ed23cbcb6011ab848ab888b2dd46 Mon Sep 17 00:00:00 2001 From: knut <> Date: Wed, 22 Feb 2006 21:46:16 +0000 Subject: Did some minor optimization tweaks --- framework/I18N/core/CultureInfo.php | 18 +++++++++--------- framework/I18N/core/DateFormat.php | 2 +- framework/I18N/core/HTTPNegotiator.php | 2 +- framework/I18N/core/MessageSource_MySQL.php | 6 +++--- framework/I18N/core/MessageSource_SQLite.php | 4 ++-- framework/I18N/core/MessageSource_XLIFF.php | 8 ++++---- framework/I18N/core/MessageSource_gettext.php | 8 ++++---- framework/I18N/core/TCache_Lite.php | 4 ++-- framework/I18N/core/util.php | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) (limited to 'framework/I18N') diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php index b03f794f..39b8495a 100644 --- a/framework/I18N/core/CultureInfo.php +++ b/framework/I18N/core/CultureInfo.php @@ -241,7 +241,7 @@ class CultureInfo $files = array($current_part); - for($i = 1; $i < count($file_parts); $i++) + for($i = 1, $k = count($file_parts); $i < $k; ++$i) { $current_part .= '_'.$file_parts[$i]; $files[] = $current_part; @@ -254,7 +254,7 @@ class CultureInfo if(is_file($filename) == false) throw new Exception('Data file for "'.$file.'" was not found.'); - if(in_array($filename, $this->dataFiles) == false) + if(!isset($this->dataFiles[$filename])) { array_unshift($this->dataFiles, $file); @@ -336,13 +336,13 @@ class CultureInfo $array = $info; - for($i = 0; $i < count($index); $i++) + for($i = 0, $k = count($index); $i < $k; ++$i) { - $k = $index[$i]; - if($i < count($index)-1 && isset($array[$k])) - $array = $array[$k]; - else if ($i == count($index)-1 && isset($array[$k])) - return $array[$k]; + $value = $index[$i]; + if($i < $k-1 && isset($array[$value])) + $array = $array[$value]; + else if ($i == $k-1 && isset($array[$value])) + return $array[$value]; } } @@ -558,7 +558,7 @@ class CultureInfo */ private function simplify($array) { - for($i = 0; $igetTokens($pattern); - for($i = 0; $i0) + for($i = 0, $k = count($variants); $i < $k; ++$i) + { + if(isset($variants[$i]{0})) { $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; $catalogues[] = $catalogue.'.'.$variant; diff --git a/framework/I18N/core/MessageSource_SQLite.php b/framework/I18N/core/MessageSource_SQLite.php index 68aceaaf..ac98df77 100644 --- a/framework/I18N/core/MessageSource_SQLite.php +++ b/framework/I18N/core/MessageSource_SQLite.php @@ -148,9 +148,9 @@ class MessageSource_SQLite extends MessageSource $variant = null; - for($i = 0; $i < count($variants); $i++) + for($i = 0, $k = count($variants); $i < $k; ++$i) { - if(strlen($variants[$i])>0) + if(isset($variants[$i]{0})) { $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; $catalogues[] = $catalogue.'.'.$variant; diff --git a/framework/I18N/core/MessageSource_XLIFF.php b/framework/I18N/core/MessageSource_XLIFF.php index a2b36611..a938342d 100644 --- a/framework/I18N/core/MessageSource_XLIFF.php +++ b/framework/I18N/core/MessageSource_XLIFF.php @@ -138,9 +138,9 @@ class MessageSource_XLIFF extends MessageSource $variant = null; - for($i = 0; $i < count($variants); $i++) + for($i = 0, $k = count($variants); $i < $k; ++$i) { - if(strlen($variants[$i])>0) + if(isset($variants[$i]{0})) { $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; $catalogues[] = $catalogue.$this->dataSeparator. @@ -167,9 +167,9 @@ class MessageSource_XLIFF extends MessageSource $variant = null; - for($i = 0; $i < count($variants); $i++) + for($i = 0, $k = count($variants); $i < $k; ++$i) { - if(strlen($variants[$i])>0) + if(isset($variants[$i]{0})) { $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; $catalogues[] = $variant.'/'.$catalogue.$this->dataExt; diff --git a/framework/I18N/core/MessageSource_gettext.php b/framework/I18N/core/MessageSource_gettext.php index 5c6d05af..b358a618 100644 --- a/framework/I18N/core/MessageSource_gettext.php +++ b/framework/I18N/core/MessageSource_gettext.php @@ -136,9 +136,9 @@ class MessageSource_gettext extends MessageSource $variant = null; - for($i = 0; $i < count($variants); $i++) + for($i = 0, $k = count($variants); $i < $k; ++$i) { - if(strlen($variants[$i])>0) + if(isset($variants[$i]{0})) { $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; $catalogues[] = $catalogue.$this->dataSeparator. @@ -165,9 +165,9 @@ class MessageSource_gettext extends MessageSource $variant = null; - for($i = 0; $i < count($variants); $i++) + for($i = 0, $k = count($variants); $i < $k; ++$i) { - if(strlen($variants[$i])>0) + if(isset($variants[$i]{0})) { $variant .= ($variant)?'_'.$variants[$i]:$variants[$i]; $catalogues[] = $variant.'/'.$catalogue.$this->dataExt; diff --git a/framework/I18N/core/TCache_Lite.php b/framework/I18N/core/TCache_Lite.php index 45f1dc95..078b0fe2 100644 --- a/framework/I18N/core/TCache_Lite.php +++ b/framework/I18N/core/TCache_Lite.php @@ -226,7 +226,7 @@ class TCache_Lite * @param array $options options * @access public */ - function TCache_Lite($options = array(NULL)) + function TCache_Lite($options = array(null)) { $availableOptions = array( 'automaticSerialization', 'fileNameProtection', @@ -310,7 +310,7 @@ class TCache_Lite * @return boolean true if no problem * @access public */ - function save($data, $id = NULL, $group = 'default') + function save($data, $id = null, $group = 'default') { if ($this->_caching) { if ($this->_automaticSerialization) { diff --git a/framework/I18N/core/util.php b/framework/I18N/core/util.php index 346c6bd4..7b4f7864 100644 --- a/framework/I18N/core/util.php +++ b/framework/I18N/core/util.php @@ -48,7 +48,7 @@ $dsn = substr($dsn, $pos + 3); } else { $str = $dsn; - $dsn = NULL; + $dsn = null; } // Get phptype and dbsyntax -- cgit v1.2.3