summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2006-03-09 02:18:49 +0000
committerxue <>2006-03-09 02:18:49 +0000
commit36b52fa8ecbcd3b1559a1f49cbfdb4bf413e2773 (patch)
tree4209096a817a434f34710ee1e7a56f6c04067933 /framework
parentdfc35208915df9d4c054113a6a3fba86d72c4db1 (diff)
Many small fixes due to the result of zend analyzer.
Diffstat (limited to 'framework')
-rw-r--r--framework/Data/TMemCache.php4
-rw-r--r--framework/Data/TSimpleDateFormatter.php41
-rw-r--r--framework/Exceptions/TErrorHandler.php2
-rw-r--r--framework/Log/TLogRouter.php9
-rw-r--r--framework/Web/Services/TPageService.php1
-rw-r--r--framework/Web/THttpSession.php2
-rw-r--r--framework/Web/UI/TTemplateManager.php3
-rw-r--r--framework/Web/UI/WebControls/TBoundColumn.php2
-rw-r--r--framework/Web/UI/WebControls/TBulletedList.php4
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxColumn.php2
-rw-r--r--framework/Web/UI/WebControls/TDataList.php1
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php1
-rw-r--r--framework/Web/UI/WebControls/TImage.php2
-rw-r--r--framework/Web/UI/WebControls/TInlineFrame.php2
-rw-r--r--framework/Web/UI/WebControls/TMultiView.php2
-rw-r--r--framework/Web/UI/WebControls/TRatingList.php2
-rw-r--r--framework/Web/UI/WebControls/TSafeHtml.php2
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php4
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php8
19 files changed, 49 insertions, 45 deletions
diff --git a/framework/Data/TMemCache.php b/framework/Data/TMemCache.php
index b2b1643d..4a8527c8 100644
--- a/framework/Data/TMemCache.php
+++ b/framework/Data/TMemCache.php
@@ -201,7 +201,7 @@ class TMemCache extends TModule implements ICache
*/
public function add($key,$value,$expiry=0)
{
- return $this->_cache->add($this->generateUniqueKey($key),$value,0,$expire);
+ return $this->_cache->add($this->generateUniqueKey($key),$value,0,$expiry);
}
/**
@@ -217,7 +217,7 @@ class TMemCache extends TModule implements ICache
*/
public function replace($key,$value,$expiry=0)
{
- return $this->_cache->replace($this->generateUniqueKey($key),$value,0,$expire);
+ return $this->_cache->replace($this->generateUniqueKey($key),$value,0,$expiry);
}
/**
diff --git a/framework/Data/TSimpleDateFormatter.php b/framework/Data/TSimpleDateFormatter.php
index f6c04027..ec69a045 100644
--- a/framework/Data/TSimpleDateFormatter.php
+++ b/framework/Data/TSimpleDateFormatter.php
@@ -30,7 +30,7 @@
* Usage example, to format a date
* <code>
* $formatter = new TSimpleDateFormatter("dd/MM/yyy");
- * echo $formatter->format(time());
+ * echo $formatter->format(time());
* </code>
*
* To parse the date string into a date timestamp.
@@ -117,7 +117,7 @@ class TSimpleDateFormatter
$bits['dd'] = str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT);
$bits['d'] = $date['mday'];
-
+
return str_replace(array_keys($bits), $bits, $this->pattern);
}
@@ -131,6 +131,7 @@ class TSimpleDateFormatter
return 'MM';
if(is_int(strpos($this->pattern, 'M')))
return 'M';
+ return false;
}
public function getDayPattern()
@@ -139,6 +140,7 @@ class TSimpleDateFormatter
return 'dd';
if(is_int(strpos($this->pattern, 'd')))
return 'd';
+ return false;
}
public function getYearPattern()
@@ -147,6 +149,7 @@ class TSimpleDateFormatter
return 'yyyy';
if(is_int(strpos($this->pattern, 'yy')))
return 'yy';
+ return false;
}
public function getDayMonthYearOrdering()
@@ -176,7 +179,7 @@ class TSimpleDateFormatter
throw new TInvalidDataValueException('invalid_date', $value);
return @getdate($date);
}
-
+
/**
* @return boolean true if the given value matches with the date pattern.
*/
@@ -199,7 +202,7 @@ class TSimpleDateFormatter
if(empty($this->pattern)) return time();
$date = $this->getDate(time());
-
+
if($this->length(trim($value)) < 1)
return $defaultToCurrentTime ? $date : null;
@@ -211,7 +214,7 @@ class TSimpleDateFormatter
$c = '';
$token='';
$x=null; $y=null;
-
+
if($defaultToCurrentTime)
{
@@ -230,19 +233,19 @@ class TSimpleDateFormatter
{
$c = $this->charAt($pattern,$i_format);
$token='';
- while ($this->charEqual($pattern, $i_format, $c)
+ while ($this->charEqual($pattern, $i_format, $c)
&& ($i_format < $pattern_length))
{
$token .= $this->charAt($pattern, $i_format++);
}
-
- if ($token=='yyyy' || $token=='yy' || $token=='y')
+
+ if ($token=='yyyy' || $token=='yy' || $token=='y')
{
if ($token=='yyyy') { $x=4;$y=4; }
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(is_null($year))
throw new TInvalidDataValueException('Invalid year', $value);
$i_val += strlen($year);
if(strlen($year) == 2)
@@ -257,7 +260,7 @@ class TSimpleDateFormatter
}
elseif($token=='MM' || $token=='M')
{
- $month=$this->getInteger($value,$i_val,
+ $month=$this->getInteger($value,$i_val,
$this->length($token),2);
$iMonth = intval($month);
if(is_null($month) || $iMonth < 1 || $iMonth > 12 )
@@ -265,7 +268,7 @@ class TSimpleDateFormatter
$i_val += strlen($month);
$month = $iMonth;
}
- elseif ($token=='dd' || $token=='d')
+ elseif ($token=='dd' || $token=='d')
{
$day = $this->getInteger($value,$i_val,
$this->length($token), 2);
@@ -275,20 +278,20 @@ class TSimpleDateFormatter
$i_val += strlen($day);
$day = $iDay;
}
- else
+ else
{
if($this->substring($value, $i_val, $this->length($token)) != $token)
throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value);
- else
+ else
$i_val += $this->length($token);
}
}
- if ($i_val != $this->length($value))
+ 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)))
return null;
- else
+ else
return $this->getDate(@mktime(0, 0, 0, $month, $day, $year));
}
@@ -333,15 +336,15 @@ class TSimpleDateFormatter
* @param int maximum integer length
* @return string integer portition of the string, null otherwise
*/
- private function getInteger($str,$i,$minlength,$maxlength)
+ private function getInteger($str,$i,$minlength,$maxlength)
{
//match for digits backwards
- for ($x = $maxlength; $x >= $minlength; $x--)
+ for ($x = $maxlength; $x >= $minlength; $x--)
{
$token= $this->substring($str, $i,$x);
- if ($this->length($token) < $minlength)
+ if ($this->length($token) < $minlength)
return null;
- if (preg_match('/^\d+$/', $token))
+ if (preg_match('/^\d+$/', $token))
return $token;
}
return null;
diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php
index 449f8c96..a1632271 100644
--- a/framework/Exceptions/TErrorHandler.php
+++ b/framework/Exceptions/TErrorHandler.php
@@ -192,7 +192,7 @@ class TErrorHandler extends TModule
}
else
{
- error_log("Error happened while processing an existing error:\n".$param->__toString());
+ error_log("Error happened while processing an existing error:\n".$exception->__toString());
header('HTTP/1.0 500 Internal Error');
}
}
diff --git a/framework/Log/TLogRouter.php b/framework/Log/TLogRouter.php
index 3b8bef94..d5bf3cb1 100644
--- a/framework/Log/TLogRouter.php
+++ b/framework/Log/TLogRouter.php
@@ -584,13 +584,15 @@ class TBrowserLogRoute extends TLogRoute
public function processLogs($logs)
{
if(empty($logs) || $this->getApplication()->getMode()==='Performance') return;
- $first = $logs[0][3]; $prev = $first; $total = 0; $delta = 0; $even = true;
+ $first = $logs[0][3];
+ $prev = $first;
+ $even = true;
$response = $this->getApplication()->getResponse();
$response->write($this->renderHeader());
foreach($logs as $log)
{
$timing['total'] = $log[3] - $first;
- $timing['delta'] = $log[3]-$prev;
+ $timing['delta'] = $log[3] - $prev;
$timing['even'] = !($even = !$even);
$prev=$log[3];
$response->write($this->renderMessage($log,$timing));
@@ -600,8 +602,6 @@ class TBrowserLogRoute extends TLogRoute
protected function renderHeader()
{
- $category = is_array($this->getCategories()) ?
- implode(', ',$this->getCategories()) : '';
$string = <<<EOD
<table cellspacing="0" cellpadding="2" border="0" width="100%">
<tr>
@@ -648,6 +648,7 @@ EOD;
case TLogger::ALERT: return '#ff00ff';
case TLogger::FATAL: return 'red';
}
+ return '';
}
protected function renderFooter()
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php
index cebedc63..991da05b 100644
--- a/framework/Web/Services/TPageService.php
+++ b/framework/Web/Services/TPageService.php
@@ -417,7 +417,6 @@ class TPageService extends TService
public function run()
{
Prado::trace("Running page service",'System.Web.Services.TPageService');
- $page=null;
$path=$this->getBasePath().'/'.strtr($this->getRequestedPagePath(),'.','/');
if(is_file($path.self::PAGE_FILE_EXT))
{
diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php
index 1292b548..ad7d272a 100644
--- a/framework/Web/THttpSession.php
+++ b/framework/Web/THttpSession.php
@@ -193,7 +193,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar
else if(ctype_alnum($value))
session_name($value);
else
- throw new TInvalidDataValueException('httpsession_sessionname_invalid',$name);
+ throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value);
}
/**
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index b2b2f830..7c32e6a1 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -583,7 +583,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
}
else if(strpos($str,'<!--')===0) // HTML comments
{
- $state=0;
+ // do nothing
}
else if(strpos($str,'<!')===0) // template comments
{
@@ -685,6 +685,7 @@ class TTemplate extends TApplicationComponent implements ITemplate
return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6)));
else if($value[2]==='$')
return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5)));
+ return '';
}
protected function validateAttributes($type,$attributes)
diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php
index f5b5517c..393d5c11 100644
--- a/framework/Web/UI/WebControls/TBoundColumn.php
+++ b/framework/Web/UI/WebControls/TBoundColumn.php
@@ -111,7 +111,7 @@ class TBoundColumn extends TDataGridColumn
case 'Item':
case 'AlternatingItem':
case 'SelectedItem':
- if(($dataField=$this->getDataField())!=='')
+ if($this->getDataField()!=='')
$cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
break;
}
diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php
index 233ace4e..fd0226c0 100644
--- a/framework/Web/UI/WebControls/TBulletedList.php
+++ b/framework/Web/UI/WebControls/TBulletedList.php
@@ -273,12 +273,14 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
switch($this->getDisplayMode())
{
case 'Text':
- return $this->renderTextItem($writer, $item, $index);
+ $this->renderTextItem($writer, $item, $index);
+ break;
case 'HyperLink':
$this->renderHyperLinkItem($writer, $item, $index);
break;
case 'LinkButton':
$this->renderLinkButtonItem($writer, $item, $index);
+ break;
}
if(($accesskey=$this->getAccessKey())!=='')
$writer->addAttribute('accesskey',$accesskey);
diff --git a/framework/Web/UI/WebControls/TCheckBoxColumn.php b/framework/Web/UI/WebControls/TCheckBoxColumn.php
index 4b13a171..f695bcdc 100644
--- a/framework/Web/UI/WebControls/TCheckBoxColumn.php
+++ b/framework/Web/UI/WebControls/TCheckBoxColumn.php
@@ -83,7 +83,7 @@ class TCheckBoxColumn extends TDataGridColumn
$checkBox->setEnabled(false);
$cell->setHorizontalAlign('Center');
$cell->getControls()->add($checkBox);
- if(($dataField=$this->getDataField())!=='')
+ if($this->getDataField()!=='')
$checkBox->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
}
}
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index ab1e8085..56e8d43c 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -926,7 +926,6 @@ class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUs
$headerStyle=$this->getViewState('HeaderStyle',null);
$footerStyle=$this->getViewState('FooterStyle',null);
- $pagerStyle=$this->getViewState('PagerStyle',null);
$separatorStyle=$this->getViewState('SeparatorStyle',null);
foreach($this->getControls() as $index=>$item)
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 71358ee7..70f116a8 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -622,7 +622,6 @@ class TDatePicker extends TTextBox
*/
protected function publishDefaultButtonImage()
{
- $cs = $this->getPage()->getClientScript();
$image = 'System.Web.Javascripts.datepicker.calendar';
if(($file = Prado::getPathOfNamespace($image, '.png'))!==null)
return $this->publishFilePath($file);
diff --git a/framework/Web/UI/WebControls/TImage.php b/framework/Web/UI/WebControls/TImage.php
index f995da8e..e4b07f79 100644
--- a/framework/Web/UI/WebControls/TImage.php
+++ b/framework/Web/UI/WebControls/TImage.php
@@ -47,7 +47,7 @@ class TImage extends TWebControl
$writer->addAttribute('longdesc',$desc);
if(($align=$this->getImageAlign())!=='')
$writer->addAttribute('align',$align);
- if(($width=$this->getBorderWidth())==='')
+ if($this->getBorderWidth()==='')
$writer->addStyleAttribute('border-width','0px');
parent::addAttributesToRender($writer);
}
diff --git a/framework/Web/UI/WebControls/TInlineFrame.php b/framework/Web/UI/WebControls/TInlineFrame.php
index 0daee2d3..0bc38c30 100644
--- a/framework/Web/UI/WebControls/TInlineFrame.php
+++ b/framework/Web/UI/WebControls/TInlineFrame.php
@@ -170,7 +170,7 @@ class TInlineFrame extends TWebControl
*/
protected function addAttributesToRender($writer)
{
- if(($id=$this->getID())!=='')
+ if($this->getID()!=='')
$writer->addAttribute('name',$this->getUniqueID());
if(($src=$this->getFrameUrl())!=='')
diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php
index fc4385c6..d44668f4 100644
--- a/framework/Web/UI/WebControls/TMultiView.php
+++ b/framework/Web/UI/WebControls/TMultiView.php
@@ -109,7 +109,7 @@ class TMultiView extends TControl
$index=$this->getActiveViewIndex();
$views=$this->getViews();
if($index>=$views->getCount())
- throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$value);
+ throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
if($index<0)
return null;
$view=$views->itemAt($index);
diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php
index 9a6932b0..6397660f 100644
--- a/framework/Web/UI/WebControls/TRatingList.php
+++ b/framework/Web/UI/WebControls/TRatingList.php
@@ -58,7 +58,7 @@ class TRatingList extends TRadioButtonList
if($this->getAllowInput())
$this->setSelectedIndex($value);
else
- return $this->setViewState('Rating', TPropertyValue::ensureFloat($value),0);
+ $this->setViewState('Rating', TPropertyValue::ensureFloat($value),0);
}
/**
diff --git a/framework/Web/UI/WebControls/TSafeHtml.php b/framework/Web/UI/WebControls/TSafeHtml.php
index 5015a5ac..432cb104 100644
--- a/framework/Web/UI/WebControls/TSafeHtml.php
+++ b/framework/Web/UI/WebControls/TSafeHtml.php
@@ -41,7 +41,7 @@ class TSafeHtml extends TControl
protected function parseSafeHtml($text)
{
$renderer = Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
- return $renderer->parse($content);
+ return $renderer->parse($text);
}
}
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index b91a72ef..7d1b9cba 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -120,9 +120,9 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
$writer->addAttribute('vcard_name','BusinessCountry');
else
{
- if(($pos=strpos($act,'Business'))===0)
+ if(strpos($act,'Business')===0)
$act='Business'.'.'.substr($act,8);
- else if(($pos=strpos($act,'Home'))===0)
+ else if(strpos($act,'Home')===0)
$act='Home'.'.'.substr($act,4);
$writer->addAttribute('vcard_name','vCard.'.$act);
}
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 41362264..437e10d6 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -275,14 +275,14 @@ class TValidationSummary extends TWebControl
switch($this->getDisplayMode())
{
case 'List':
- $content = $this->renderList($writer);
+ $this->renderList($writer);
break;
case 'SingleParagraph':
- $content = $this->renderSingleParagraph($writer);
+ $this->renderSingleParagraph($writer);
break;
case 'BulletList':
- default:
- $content = $this->renderBulletList($writer);
+ $this->renderBulletList($writer);
+ break;
}
}
}