summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2009-07-10 08:38:40 +0000
committergodzilla80@gmx.net <>2009-07-10 08:38:40 +0000
commitdca4b44183e65bd1252a8f224548152279d63ee8 (patch)
treeeb4f8a57287e02d3fc1f8a56723781e5df7ce829
parentf21513edfa5d9fad074a247967d846d71c51e81a (diff)
ENH: Add property TPage.EnableStateCompression and related modifications in TPageStateFormatter since it is unnecessary to compress clientstate if TCachePageStatePersister/TSessionPageStatePersister is used
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/TPage.php31
2 files changed, 28 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index cb2df0e2..7aecdc24 100644
--- a/HISTORY
+++ b/HISTORY
@@ -12,6 +12,7 @@ BUG: TCallbackErrorHandler::displayException() force HTTP status "500 Internal S
ENH: TAssetManager: introduce protected property "Published" to allow subclasses access (Yves)
ENH: TFirePhpLogRoute: bypass to TBrowserLogRoute if headers already sent / php.ini (output_buffering=Off, implicit_flush=On) (Yves)
EHN: Performance optimization in PradoBase::createComponent() (Yves)
+EHN: Add property TPage.EnableStateCompression and related modifications in TPageStateFormatter since it is unnecessary to compress clientstate if TCachePageStatePersister/TSessionPageStatePersister is used (Yves)
Version 3.1.5 May 24, 2009
BUG: Issue#55 - TPropertyAccess.get and has don't recognize magic getter __get (Yves)
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 12433715..6f7e533d 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -134,6 +134,11 @@ class TPage extends TTemplateControl
*/
private $_enableStateEncryption=false;
/**
+ * @var boolean whether page state should be compressed
+ * @since 3.1.6
+ */
+ private $_enableStateCompression=true;
+ /**
* @var string page state persister class name
*/
private $_statePersisterClass='System.Web.UI.TPageStatePersister';
@@ -283,7 +288,7 @@ class TPage extends TTemplateControl
$this->setAdapter(new TActivePageAdapter($this));
// Decode Callback postData from UTF-8 to current Charset
- if (($g=$this->getApplication()->getGlobalization(false))!==null &&
+ if (($g=$this->getApplication()->getGlobalization(false))!==null &&
strtoupper($enc=$g->getCharset())!='UTF-8')
foreach ($this->_postData as $k=>$v)
$this->_postData[$k]=iconv('UTF-8',$enc.'//IGNORE',$v);
@@ -1124,6 +1129,24 @@ class TPage extends TTemplateControl
}
/**
+ * @return boolean whether page state should be compressed. Defaults to true.
+ * @since 3.1.6
+ */
+ public function getEnableStateCompression()
+ {
+ return $this->_enableStateCompression;
+ }
+
+ /**
+ * @param boolean whether page state should be compressed.
+ * @since 3.1.6
+ */
+ public function setEnableStateCompression($value)
+ {
+ $this->_enableStateCompression=TPropertyValue::ensureBoolean($value);
+ }
+
+ /**
* @return string the requested page path for this page
*/
public function getPagePath()
@@ -1234,7 +1257,7 @@ class TPageStateFormatter
$str=$sm->hashData(Prado::serialize($data));
else
$str=Prado::serialize($data);
- if(extension_loaded('zlib'))
+ if($page->getEnableStateCompression() && extension_loaded('zlib'))
$str=gzcompress($str);
if($page->getEnableStateEncryption())
$str=$sm->encrypt($str);
@@ -1256,7 +1279,7 @@ class TPageStateFormatter
$sm=$page->getApplication()->getSecurityManager();
if($page->getEnableStateEncryption())
$str=$sm->decrypt($str);
- if(extension_loaded('zlib'))
+ if($page->getEnableStateCompression() && extension_loaded('zlib'))
$str=@gzuncompress($str);
if($page->getEnableStateValidation())
{
@@ -1270,4 +1293,4 @@ class TPageStateFormatter
}
}
-?>
+?> \ No newline at end of file