From 5fe7483a3ecda194bc029b6353a6c29e7296265a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 9 Mar 2016 11:35:13 +0100 Subject: Updated pradolite.php --- framework/pradolite.php | 173 ++++++++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 70 deletions(-) (limited to 'framework') diff --git a/framework/pradolite.php b/framework/pradolite.php index bdbf1137..16154dfa 100644 --- a/framework/pradolite.php +++ b/framework/pradolite.php @@ -1,7 +1,7 @@ getErrorHandler())!==null) @@ -696,7 +707,12 @@ class TErrorHandler extends TModule $trace=$exception->getTrace(); $result=null; if($exception instanceof TPhpErrorException) - $result=isset($trace[0]['file'])?$trace[0]:$trace[1]; + { + if(isset($trace[0]['file'])) + $result=$trace[0]; + elseif(isset($trace[1])) + $result=$trace[1]; + } else if($exception instanceof TInvalidOperationException) { if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null) @@ -738,7 +754,7 @@ class TErrorHandler extends TModule private function addLink($message) { $baseUrl='http://pradosoft.github.io/docs/manual/class-'; - return preg_replace('/\b(T[A-Z]\w+)\b/',"\${1}",$message); + return preg_replace('/\b(T[A-Z]\w+)\b/',"\${1}",$message); } } class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable @@ -927,37 +943,8 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl $this->removeAt($offset); } } -class TListIterator implements Iterator +class TListIterator extends ArrayIterator { - private $_d; - private $_i; - private $_c; - public function __construct(&$data) - { - $this->_d=&$data; - $this->_i=0; - $this->_c=count($this->_d); - } - public function rewind() - { - $this->_i=0; - } - public function key() - { - return $this->_i; - } - public function current() - { - return $this->_d[$this->_i]; - } - public function next() - { - $this->_i++; - } - public function valid() - { - return $this->_i<$this->_c; - } } abstract class TCache extends TModule implements ICache, ArrayAccess { @@ -1604,6 +1591,14 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable { private $_d=array(); private $_r=false; + protected function __getZappableSleepProps(&$exprops) + { + parent::__getZappableSleepProps($exprops); + if ($this->_d===array()) + $exprops[] = "\0TMap\0_d"; + if ($this->_r===false) + $exprops[] = "\0TMap\0_r"; + } public function __construct($data=null,$readOnly=false) { if($data!==null) @@ -1713,36 +1708,8 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable $this->remove($offset); } } -class TMapIterator implements Iterator +class TMapIterator extends ArrayIterator { - private $_d; - private $_keys; - private $_key; - public function __construct(&$data) - { - $this->_d=&$data; - $this->_keys=array_keys($data); - } - public function rewind() - { - $this->_key=reset($this->_keys); - } - public function key() - { - return $this->_key; - } - public function current() - { - return $this->_d[$this->_key]; - } - public function next() - { - $this->_key=next($this->_keys); - } - public function valid() - { - return $this->_key!==false; - } } class TPriorityMap extends TMap { @@ -2321,7 +2288,7 @@ class TXmlDocument extends TXmlElement if($doc->loadXML($string)===false) return false; $this->setEncoding($doc->encoding); - $this->setVersion($doc->version); + $this->setVersion($doc->xmlVersion); $element=$doc->documentElement; $this->setTagName($element->tagName); $this->setValue($element->nodeValue); @@ -3424,7 +3391,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar } public function getIterator() { - return new TMapIterator($this->_items); + return new ArrayIterator($this->_items); } public function getCount() { @@ -4410,6 +4377,12 @@ Prado::using('System.Web.UI.WebControls.*'); class TAttributeCollection extends TMap { private $_caseSensitive=false; + protected function __getZappableSleepProps(&$exprops) + { + parent::__getZappableSleepProps($exprops); + if ($this->_caseSensitive===false) + $exprops[] = "\0TAttributeCollection\0_caseSensitive"; + } public function __get($name) { return $this->contains($name)?$this->itemAt($name):parent::__get($name); @@ -4845,13 +4818,19 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable { if($this->_trackViewState) { - $this->_viewState[$key]=$value; unset($this->_tempState[$key]); + if($value===$defaultValue) + unset($this->_viewState[$key]); + else + $this->_viewState[$key]=$value; } else { unset($this->_viewState[$key]); - $this->_tempState[$key]=$value; + if($value===$defaultValue) + unset($this->_tempState[$key]); + else + $this->_tempState[$key]=$value; } } public function clearViewState($key) @@ -5369,7 +5348,10 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable foreach($this->_rf[self::RF_CONTROLS] as $control) { if($control instanceof TControl) - $state[$control->_id]=&$control->saveStateRecursive($needViewState); + { + if(count($tmp = &$control->saveStateRecursive($needViewState))) + $state[$control->_id]=$tmp; + } } } if($needViewState && !empty($this->_viewState)) @@ -5658,6 +5640,16 @@ class TFont extends TComponent private $_flags=0; private $_name=''; private $_size=''; + protected function __getZappableSleepProps(&$exprops) + { + parent::__getZappableSleepProps($exprops); + if ($this->_flags===0) + $exprops[] = "\0TFont\0_flags"; + if ($this->_name==='') + $exprops[] = "\0TFont\0_name"; + if ($this->_size==='') + $exprops[] = "\0TFont\0_size"; + } public function getBold() { return ($this->_flags & self::IS_BOLD)!==0; @@ -5840,6 +5832,20 @@ class TStyle extends TComponent private $_class=null; private $_customStyle=null; private $_displayStyle='Fixed'; + protected function __getZappableSleepProps(&$exprops) + { + parent::__getZappableSleepProps($exprops); + if ($this->_fields===array()) + $exprops[] = "\0TStyle\0_fields"; + if($this->_font===null) + $exprops[] = "\0TStyle\0_font"; + if($this->_class===null) + $exprops[] = "\0TStyle\0_class"; + if ($this->_customStyle===null) + $exprops[] = "\0TStyle\0_customStyle"; + if ($this->_displayStyle==='Fixed') + $exprops[] = "\0TStyle\0_displayStyle"; + } public function __construct($style=null) { if($style!==null) @@ -6062,6 +6068,22 @@ class TTableStyle extends TStyle private $_cellSpacing=null; private $_gridLines=null; private $_borderCollapse=null; + protected function __getZappableSleepProps(&$exprops) + { + parent::__getZappableSleepProps($exprops); + if ($this->_backImageUrl===null) + $exprops[] = "\0TTableStyle\0_backImageUrl"; + if ($this->_horizontalAlign===null) + $exprops[] = "\0TTableStyle\0_horizontalAlign"; + if ($this->_cellPadding===null) + $exprops[] = "\0TTableStyle\0_cellPadding"; + if ($this->_cellSpacing===null) + $exprops[] = "\0TTableStyle\0_cellSpacing"; + if ($this->_gridLines===null) + $exprops[] = "\0TTableStyle\0_gridLines"; + if ($this->_borderCollapse===null) + $exprops[] = "\0TTableStyle\0_borderCollapse"; + } public function reset() { $this->_backImageUrl=null; @@ -6185,6 +6207,16 @@ class TTableItemStyle extends TStyle private $_horizontalAlign=null; private $_verticalAlign=null; private $_wrap=null; + protected function __getZappableSleepProps(&$exprops) + { + parent::__getZappableSleepProps($exprops); + if ($this->_horizontalAlign===null) + $exprops[] = "\0TTableItemStyle\0_horizontalAlign"; + if ($this->_verticalAlign===null) + $exprops[] = "\0TTableItemStyle\0_verticalAlign"; + if ($this->_wrap===null) + $exprops[] = "\0TTableItemStyle\0_wrap"; + } public function reset() { parent::reset(); @@ -7172,9 +7204,9 @@ class TClientScriptManager extends TApplicationComponent public function getStyleSheetUrls() { $stylesheets = array_values( - array_map( - create_function('$e', 'return is_array($e) ? $e[0] : $e;'), - $this->_styleSheetFiles) + array_map(function($e) { + return is_array($e) ? $e[0] : $e; + }, $this->_styleSheetFiles) ); foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) if (substr($url,strlen($url)-4)=='.css') @@ -7535,6 +7567,7 @@ class TPage extends TTemplateControl protected function processCallbackRequest($writer) { Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter'); + Prado::using('System.Web.UI.JuiControls.TJuiControlOptions'); $this->setAdapter(new TActivePageAdapter($this)); $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); if(strlen($callbackEventParameter) > 0) -- cgit v1.2.3