diff options
author | ctrlaltca <ctrlaltca@gmail.com> | 2014-08-26 16:59:21 +0200 |
---|---|---|
committer | ctrlaltca <ctrlaltca@gmail.com> | 2014-08-26 16:59:21 +0200 |
commit | 74b31be9515eddfa63005d6760614badfaba9fea (patch) | |
tree | 47c952901dcb5eccd6dd8b7c6ee7e0b6bf176510 /framework/pradolite.php | |
parent | 2b11341614ac4a15be697fa8acad07055154ac54 (diff) | |
parent | 0c5026b55cde5c104f10686afd8b441568175d38 (diff) |
Backports for Prado 3.2.4
Diffstat (limited to 'framework/pradolite.php')
-rw-r--r-- | framework/pradolite.php | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/framework/pradolite.php b/framework/pradolite.php index d9627d13..a01c3f98 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/08/26 16:44:14 * Generated By: buildscripts/phpbuilder/build.php * * This file is used in lieu of prado.php to boost PRADO application performance. @@ -25,7 +25,7 @@ class PradoBase protected static $classExists = array(); public static function getVersion() { - return '3.2.3'; + return '3.2.4'; } public static function initErrorHandlers() { @@ -1248,7 +1248,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 +1483,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 +1500,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; @@ -2393,7 +2393,7 @@ class TXmlDocument extends TXmlElement { return $this->saveToString(); } - private function buildElement($node) + protected function buildElement($node) { $element=new TXmlElement($node->tagName); $element->setValue($node->nodeValue); @@ -2895,14 +2895,23 @@ class TJavaScript } public static function jsonEncode($value, $options = 0) { - if (is_string($value) && - ($g=Prado::getApplication()->getGlobalization(false))!==null && - strtoupper($enc=$g->getCharset())!='UTF-8') - $value=iconv($enc, 'UTF-8', $value); + if (($g=Prado::getApplication()->getGlobalization(false))!==null && + strtoupper($enc=$g->getCharset())!='UTF-8') { + self::convertToUtf8($value, $enc); + } $s = @json_encode($value,$options); self::checkJsonError(); return $s; } + private static function convertToUtf8(&$value, $sourceEncoding) { + if(is_string($value)) + $value=iconv($sourceEncoding, 'UTF-8', $value); + else if (is_array($value)) + { + foreach($value as &$element) + self::convertToUtf8($element, $sourceEncoding); + } + } public static function jsonDecode($value, $assoc = false, $depth = 512) { $s= @json_decode($value, $assoc, $depth); @@ -3129,7 +3138,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) @@ -6385,7 +6394,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 +6693,7 @@ class TWebControl extends TControl implements IStyleable $decorator->renderPostContentsText($writer); $writer->renderEndTag(); $decorator->renderPostTagText($writer); - } else + } else $writer->renderEndTag($writer); } } @@ -7089,7 +7098,7 @@ class TClientScriptManager extends TApplicationComponent 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'] = 'Prado.Element.focus('.$id.');'; $params=func_get_args(); $this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params); } @@ -7281,8 +7290,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 +7318,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; } @@ -7465,6 +7477,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) @@ -9672,7 +9687,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 +9774,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 +10188,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'; @@ -10822,7 +10837,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 +10961,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 +10997,7 @@ class TApplicationConfiguration extends TComponent $properties['id'] = $id; $this->_services[$id] = array($type,$properties,$service); $this->_empty = false; - } + } } protected function loadServicesXml($servicesNode,$configPath) { |