summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknut <>2006-02-22 21:46:16 +0000
committerknut <>2006-02-22 21:46:16 +0000
commita30da2e71ad2ed23cbcb6011ab848ab888b2dd46 (patch)
tree1225b90b956f6489f504450bdd72ac63866224a5
parent45ddffcfc4ff5b732f9f39719430b461345c8f7a (diff)
Did some minor optimization tweaks
-rw-r--r--framework/Data/TTarFileExtractor.php26
-rw-r--r--framework/I18N/core/CultureInfo.php18
-rw-r--r--framework/I18N/core/DateFormat.php2
-rw-r--r--framework/I18N/core/HTTPNegotiator.php2
-rw-r--r--framework/I18N/core/MessageSource_MySQL.php6
-rw-r--r--framework/I18N/core/MessageSource_SQLite.php4
-rw-r--r--framework/I18N/core/MessageSource_XLIFF.php8
-rw-r--r--framework/I18N/core/MessageSource_gettext.php8
-rw-r--r--framework/I18N/core/TCache_Lite.php4
-rw-r--r--framework/I18N/core/util.php2
-rw-r--r--framework/Web/UI/WebControls/TWizard.php2
11 files changed, 41 insertions, 41 deletions
diff --git a/framework/Data/TTarFileExtractor.php b/framework/Data/TTarFileExtractor.php
index 3a63ec7c..12749d16 100644
--- a/framework/Data/TTarFileExtractor.php
+++ b/framework/Data/TTarFileExtractor.php
@@ -131,9 +131,9 @@ class TTarFileExtractor
throw new Exception($p_message);
}
- private function _isArchive($p_filename=NULL)
+ private function _isArchive($p_filename=null)
{
- if ($p_filename == NULL) {
+ if ($p_filename == null) {
$p_filename = $this->_tarname;
}
clearstatcache();
@@ -343,16 +343,16 @@ class TTarFileExtractor
switch ($p_mode) {
case "complete" :
- $v_extract_all = TRUE;
- $v_listing = FALSE;
+ $v_extract_all = true;
+ $v_listing = false;
break;
case "partial" :
- $v_extract_all = FALSE;
- $v_listing = FALSE;
+ $v_extract_all = false;
+ $v_listing = false;
break;
case "list" :
- $v_extract_all = FALSE;
- $v_listing = TRUE;
+ $v_extract_all = false;
+ $v_listing = true;
break;
default :
$this->_error('Invalid extract mode ('.$p_mode.')');
@@ -363,7 +363,7 @@ class TTarFileExtractor
while (strlen($v_binary_data = $this->_readBlock()) != 0)
{
- $v_extract_file = FALSE;
+ $v_extract_file = false;
$v_extraction_stopped = 0;
if (!$this->_readHeader($v_binary_data, $v_header))
@@ -390,19 +390,19 @@ class TTarFileExtractor
if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
&& (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
== $p_file_list[$i])) {
- $v_extract_file = TRUE;
+ $v_extract_file = true;
break;
}
}
// ----- It is a file, so compare the file names
elseif ($p_file_list[$i] == $v_header['filename']) {
- $v_extract_file = TRUE;
+ $v_extract_file = true;
break;
}
}
} else {
- $v_extract_file = TRUE;
+ $v_extract_file = true;
}
// ----- Look if this file need to be extracted
@@ -533,7 +533,7 @@ class TTarFileExtractor
*
* @param string $p_dir directory to check
*
- * @return bool TRUE if the directory exists or was created
+ * @return bool true if the directory exists or was created
*/
protected function _dirCheck($p_dir)
{
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; $i<count($array); $i++)
+ for($i = 0, $k = count($array); $i<$k; ++$i)
{
$key = key($array);
if(is_array($array[$key])
diff --git a/framework/I18N/core/DateFormat.php b/framework/I18N/core/DateFormat.php
index 1e340d95..a07d5e6d 100644
--- a/framework/I18N/core/DateFormat.php
+++ b/framework/I18N/core/DateFormat.php
@@ -122,7 +122,7 @@ class DateFormat
$tokens = $this->getTokens($pattern);
- for($i = 0; $i<count($tokens); $i++)
+ for($i = 0, $k = count($tokens); $i<$k; ++$i)
{
$pattern = $tokens[$i];
if($pattern{0} == "'"
diff --git a/framework/I18N/core/HTTPNegotiator.php b/framework/I18N/core/HTTPNegotiator.php
index d9158969..f5eb876c 100644
--- a/framework/I18N/core/HTTPNegotiator.php
+++ b/framework/I18N/core/HTTPNegotiator.php
@@ -81,7 +81,7 @@ class HTTPNegotiator
}
else
{
- for($i = 0; $i<count($codes); $i++)
+ for($i = 0, $k = count($codes); $i<$k; ++$i)
{
if($i == 0)
$lang = strtolower($codes[0]);
diff --git a/framework/I18N/core/MessageSource_MySQL.php b/framework/I18N/core/MessageSource_MySQL.php
index dab8de9f..67d86d87 100644
--- a/framework/I18N/core/MessageSource_MySQL.php
+++ b/framework/I18N/core/MessageSource_MySQL.php
@@ -225,9 +225,9 @@ class MessageSource_MySQL extends MessageSource
$variant = null;
- for($i = 0; $i < count($variants); $i++)
- {
- if(strlen($variants[$i])>0)
+ 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
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 20d80eca..a8ed806f 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -330,7 +330,7 @@ class TWizard extends TPanel implements INamingContainer
$this->_steps[$i]->setVisible($i == $index);
//determine which link is active
- for($i = 0; $i < count($this->_sidebarLinks); $i++)
+ for($i = 0, $k = count($this->_sidebarLinks); $i < $k; $i++)
$this->_sidebarLinks[$i]->CssClass= ($i == $index)?'active':'';
//hide all the navigations first.