summaryrefslogtreecommitdiff
path: root/framework/pradolite.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/pradolite.php')
-rw-r--r--framework/pradolite.php104
1 files changed, 48 insertions, 56 deletions
diff --git a/framework/pradolite.php b/framework/pradolite.php
index d9627d13..fcf73364 100644
--- a/framework/pradolite.php
+++ b/framework/pradolite.php
@@ -1,7 +1,7 @@
<?php
/**
* File Name: pradolite.php
- * Last Update: 2013/11/26 10:04:34
+ * Last Update: 2014/02/02 21:38:53
* Generated By: buildscripts/phpbuilder/build.php
*
* This file is used in lieu of prado.php to boost PRADO application performance.
@@ -81,14 +81,6 @@ class PradoBase
{
return PRADO_DIR;
}
- public static function serialize($data)
- {
- return serialize($data);
- }
- public static function unserialize($str)
- {
- return unserialize($str);
- }
public static function createComponent($type)
{
if(!isset(self::$classExists[$type]))
@@ -1248,7 +1240,7 @@ class TTextWriter extends TComponent implements ITextWriter
$this->write($str."\n");
}
}
-class TPriorityList extends TList
+class TPriorityList extends TList
{
private $_d=array();
private $_o=false;
@@ -1483,7 +1475,7 @@ class TPriorityList extends TList
foreach($this->_d as $priority=>$items) {
if(($index=array_search($item,$items,true))!==false) {
$absindex+=$index;
- return $withindex?array($priority,$index,$absindex,
+ return $withindex?array($priority,$index,$absindex,
'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
} else
$absindex+=count($items);
@@ -1500,7 +1492,7 @@ class TPriorityList extends TList
if($index>=($c=count($items)))
$index-=$c;
else
- return $withindex?array($priority,$index,$absindex,
+ return $withindex?array($priority,$index,$absindex,
'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
}
return false;
@@ -2799,6 +2791,13 @@ class TJavaScript
else
return '';
}
+ public static function renderScriptBlocksCallback($scripts)
+ {
+ if(count($scripts))
+ return implode("\n",$scripts)."\n";
+ else
+ return '';
+ }
public static function renderScriptBlock($script)
{
return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n{$script}\n/*]]>*/\n</script>\n";
@@ -3129,7 +3128,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
if($this->getEnableCache())
{
$cache = $this->getApplication()->getCache();
- if($cache !== null)
+ if($cache !== null)
{
$dependencies = null;
if($this->getApplication()->getMode() !== TApplicationMode::Performance)
@@ -5191,15 +5190,9 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
$control->evaluateDynamicContent();
}
}
- $this->addToPostDataLoader();
}
$this->_stage=self::CS_PRERENDERED;
}
- protected function addToPostDataLoader()
- {
- if($this instanceof IPostBackDataHandler)
- $this->getPage()->registerPostDataLoader($this);
- }
protected function unloadRecursive()
{
if(!($this->_flags & self::IS_ID_SET))
@@ -6385,7 +6378,7 @@ class TWebControlDecorator extends TComponent {
$this->_posttagtemplate = $value;
}
public function instantiate($outercontrol = null) {
- if($this->getPreTagTemplate() || $this->getPreContentsTemplate() ||
+ if($this->getPreTagTemplate() || $this->getPreContentsTemplate() ||
$this->getPostContentsTemplate() || $this->getPostTagTemplate()) {
$this->_outercontrol = $outercontrol;
if($this->getUseState())
@@ -6684,7 +6677,7 @@ class TWebControl extends TControl implements IStyleable
$decorator->renderPostContentsText($writer);
$writer->renderEndTag();
$decorator->renderPostTagText($writer);
- } else
+ } else
$writer->renderEndTag($writer);
}
}
@@ -7050,8 +7043,6 @@ class TClientScriptManager extends TApplicationComponent
$optionString=TJavaScript::encode($options);
$code="new {$class}({$optionString});";
$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
- $this->_hiddenFields[TPage::FIELD_POSTBACK_TARGET]='';
- $this->_hiddenFields[TPage::FIELD_POSTBACK_PARAMETER]='';
$this->registerPradoScriptInternal('prado');
$params=func_get_args();
$this->_page->registerCachingAction('Page.ClientScript','registerPostBackControl',$params);
@@ -7069,7 +7060,6 @@ class TClientScriptManager extends TApplicationComponent
$options = TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
$code = "new Prado.WebUI.DefaultButton($options);";
$this->_endScripts['prado:'.$panelID]=$code;
- $this->_hiddenFields[TPage::FIELD_POSTBACK_TARGET]='';
$this->registerPradoScriptInternal('prado');
$params=array($panelID,$buttonID);
$this->_page->registerCachingAction('Page.ClientScript','registerDefaultButton',$params);
@@ -7085,11 +7075,10 @@ class TClientScriptManager extends TApplicationComponent
}
public function registerFocusControl($target)
{
- $this->registerPradoScriptInternal('effects');
+ $this->registerPradoScriptInternal('jquery');
if($target instanceof TControl)
$target=$target->getClientID();
- $id = TJavaScript::quoteString($target);
- $this->_endScripts['prado:focus'] = 'new Effect.ScrollTo('.$id.'); Prado.Element.focus('.$id.');';
+ $this->_endScripts['prado:focus'] = 'new Prado.Element.scrollTo(\''.$target.'\'); jQuery(\'#'.$target.'\').focus();';
$params=func_get_args();
$this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params);
}
@@ -7271,6 +7260,14 @@ class TClientScriptManager extends TApplicationComponent
{
$writer->write(TJavaScript::renderScriptBlocks($this->_endScripts));
}
+ public function renderBeginScriptsCallback($writer)
+ {
+ $writer->write(TJavaScript::renderScriptBlocksCallback($this->_beginScripts));
+ }
+ public function renderEndScriptsCallback($writer)
+ {
+ $writer->write(TJavaScript::renderScriptBlocksCallback($this->_endScripts));
+ }
public function renderHiddenFieldsBegin($writer)
{
$this->renderHiddenFieldsInt($writer,true);
@@ -7281,8 +7278,11 @@ class TClientScriptManager extends TApplicationComponent
}
public function flushScriptFiles($writer, $control=null)
{
- $this->_page->ensureRenderInForm($control);
- $this->renderAllPendingScriptFiles($writer);
+ if(!$this->_page->getIsCallback())
+ {
+ $this->_page->ensureRenderInForm($control);
+ $this->renderAllPendingScriptFiles($writer);
+ }
}
protected function renderHiddenFieldsInt($writer, $initial)
{
@@ -7306,7 +7306,7 @@ class TClientScriptManager extends TApplicationComponent
if($str!=='')
$writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n");
}
- public function getHiddenFields()
+ public function getHiddenFields()
{
return $this->_hiddenFields;
}
@@ -7389,7 +7389,6 @@ class TPage extends TTemplateControl
private $_statePersister;
private $_cachingStack;
private $_clientState='';
- protected $_postDataLoaders=array();
protected $_isLoadingPostData=false;
private $_enableJavaScript=true;
private $_writer;
@@ -7465,6 +7464,9 @@ class TPage extends TTemplateControl
{
Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter');
$this->setAdapter(new TActivePageAdapter($this));
+ $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
+ if(strlen($callbackEventParameter) > 0)
+ $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter);
if (($g=$this->getApplication()->getGlobalization(false))!==null &&
strtoupper($enc=$g->getCharset())!='UTF-8')
foreach ($this->_postData as $k=>$v)
@@ -7515,15 +7517,6 @@ class TPage extends TTemplateControl
{
$this->getAdapter()->setCallbackEventParameter($value);
}
- public function registerPostDataLoader($control)
- {
- $id=is_string($control)?$control:$control->getUniqueID();
- $this->_postDataLoaders[$id] = true;
- }
- public function getPostDataLoaders()
- {
- return array_keys($this->_postDataLoaders);
- }
public function getForm()
{
return $this->_form;
@@ -7721,7 +7714,6 @@ class TPage extends TTemplateControl
{
$id=is_string($control)?$control:$control->getUniqueID();
$this->_controlsRegisteredForPostData[$id]=true;
- $this->registerPostDataLoader($id);
$params=func_get_args();
foreach($this->getCachingStack() as $item)
$item->registerAction('Page','registerRequiresPostData',array($id));
@@ -7978,9 +7970,9 @@ class TPageStateFormatter
{
$sm=$page->getApplication()->getSecurityManager();
if($page->getEnableStateValidation())
- $str=$sm->hashData(Prado::serialize($data));
+ $str=$sm->hashData(serialize($data));
else
- $str=Prado::serialize($data);
+ $str=serialize($data);
if($page->getEnableStateCompression() && extension_loaded('zlib'))
$str=gzcompress($str);
if($page->getEnableStateEncryption())
@@ -8002,10 +7994,10 @@ class TPageStateFormatter
if($page->getEnableStateValidation())
{
if(($str=$sm->validateData($str))!==false)
- return Prado::unserialize($str);
+ return unserialize($str);
}
else
- return Prado::unserialize($str);
+ return unserialize($str);
}
return null;
}
@@ -9672,7 +9664,7 @@ class TPageConfiguration extends TComponent
$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
}
else
- {
+ {
$dom=new TXmlDocument;
if($dom->loadFromFile($fname))
$this->loadFromXml($dom,dirname($fname),$configPagePath);
@@ -9759,7 +9751,7 @@ class TPageConfiguration extends TComponent
if(isset($page['properties']))
{
$properties=$page['properties'];
- unset($page['properties']);
+ unset($page['properties']);
}
$matching=false;
$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
@@ -10173,7 +10165,7 @@ class TApplication extends TComponent
const STATE_PERFORMANCE='Performance';
const PAGE_SERVICE_ID='page';
const CONFIG_FILE_XML='application.xml';
- const CONFIG_FILE_EXT_XML='.xml';
+ const CONFIG_FILE_EXT_XML='.xml';
const CONFIG_TYPE_XML = 'xml';
const CONFIG_FILE_PHP='application.php';
const CONFIG_FILE_EXT_PHP='.php';
@@ -10674,10 +10666,10 @@ class TApplication extends TComponent
$config=new TApplicationConfiguration;
$config->loadFromFile($this->_configFile);
if($this->_cacheFile!==null)
- file_put_contents($this->_cacheFile,Prado::serialize($config),LOCK_EX);
+ file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
}
else
- $config=Prado::unserialize(file_get_contents($this->_cacheFile));
+ $config=unserialize(file_get_contents($this->_cacheFile));
$this->applyConfiguration($config,false);
}
if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null)
@@ -10822,7 +10814,7 @@ class TApplicationConfiguration extends TComponent
$this->_properties[$name]=$value;
}
$this->_empty = false;
- }
+ }
if(isset($config['paths']) && is_array($config['paths']))
$this->loadPathsPhp($config['paths'],$configPath);
if(isset($config['modules']) && is_array($config['modules']))
@@ -10946,7 +10938,7 @@ class TApplicationConfiguration extends TComponent
$properties['id'] = $id;
$this->_modules[$id]=array($type,$properties,$module);
$this->_empty=false;
- }
+ }
}
protected function loadModulesXml($modulesNode,$configPath)
{
@@ -10982,7 +10974,7 @@ class TApplicationConfiguration extends TComponent
$properties['id'] = $id;
$this->_services[$id] = array($type,$properties,$service);
$this->_empty = false;
- }
+ }
}
protected function loadServicesXml($servicesNode,$configPath)
{
@@ -11118,18 +11110,18 @@ class TApplicationStatePersister extends TModule implements IStatePersister
public function load()
{
if(($cache=$this->getApplication()->getCache())!==null && ($value=$cache->get(self::CACHE_NAME))!==false)
- return Prado::unserialize($value);
+ return unserialize($value);
else
{
if(($content=@file_get_contents($this->getStateFilePath()))!==false)
- return Prado::unserialize($content);
+ return unserialize($content);
else
return null;
}
}
public function save($state)
{
- $content=Prado::serialize($state);
+ $content=serialize($state);
$saveFile=true;
if(($cache=$this->getApplication()->getCache())!==null)
{