@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | //package base folder in prado alias notation |
| 4 | -$folders = [ |
|
| 4 | +$folders=[ |
|
| 5 | 5 | 'prado' => 'Prado\\Web\\Javascripts\\source\\prado', |
| 6 | 6 | 'jquery' => 'Vendor\\bower-asset\\jquery\\dist', |
| 7 | 7 | 'jquery-ui' => 'Vendor\\bower-asset\\jquery-ui', |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | ]; |
| 14 | 14 | |
| 15 | 15 | //package names and its contents (files relative to the current directory) |
| 16 | -$packages = [ |
|
| 16 | +$packages=[ |
|
| 17 | 17 | // base prado scripts |
| 18 | 18 | 'prado' => [ |
| 19 | 19 | 'prado/prado.js', |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ]; |
| 113 | 113 | |
| 114 | 114 | //package names and their dependencies |
| 115 | -$dependencies = [ |
|
| 115 | +$dependencies=[ |
|
| 116 | 116 | 'jquery' => ['jquery'], |
| 117 | 117 | 'prado' => ['jquery', 'prado'], |
| 118 | 118 | 'bootstrap' => ['jquery', 'bootstrap'], |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | //package base folder in prado alias notation |
| 4 | -$folders = [ |
|
| 4 | +$folders=[ |
|
| 5 | 5 | 'jquery-ui' => 'Vendor\\bower-asset\\jquery-ui', |
| 6 | 6 | 'bootstrap' => 'Vendor\\bower-asset\\bootstrap\\dist', |
| 7 | 7 | 'highlightjs' => 'Vendor\\bower-asset\\highlightjs', |
| 8 | 8 | ]; |
| 9 | 9 | |
| 10 | 10 | //package names and its contents (files relative to the current directory) |
| 11 | -$packages = [ |
|
| 11 | +$packages=[ |
|
| 12 | 12 | 'jquery-ui' => [ |
| 13 | 13 | 'jquery-ui/themes/base/jquery-ui.css', |
| 14 | 14 | ], |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | ]; |
| 74 | 74 | |
| 75 | 75 | //package names and their dependencies |
| 76 | -$dependencies = [ |
|
| 76 | +$dependencies=[ |
|
| 77 | 77 | 'jquery-ui' => ['jquery-ui'], |
| 78 | 78 | 'jquery.ui.accordion' => ['jquery.ui.core', 'jquery.ui.accordion'], |
| 79 | 79 | 'jquery.ui.autocomplete' => ['jquery.ui.core', 'jquery.ui.autocomplete'], |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class THttpRequestUrlFormat extends \Prado\TEnumerable |
| 29 | 29 | { |
| 30 | - const Get = 'Get'; |
|
| 31 | - const Path = 'Path'; |
|
| 32 | - const HiddenPath = 'HiddenPath'; |
|
| 30 | + const Get='Get'; |
|
| 31 | + const Path='Path'; |
|
| 32 | + const HiddenPath='HiddenPath'; |
|
| 33 | 33 | } |
| 34 | 34 | \ No newline at end of file |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class THttpUtility |
| 22 | 22 | { |
| 23 | - private static $_encodeTable = ['<' => '<','>' => '>','"' => '"']; |
|
| 24 | - private static $_decodeTable = ['<' => '<','>' => '>','"' => '"']; |
|
| 25 | - private static $_stripTable = ['<' => '','>' => '','"' => '']; |
|
| 23 | + private static $_encodeTable=['<' => '<', '>' => '>', '"' => '"']; |
|
| 24 | + private static $_decodeTable=['<' => '<', '>' => '>', '"' => '"']; |
|
| 25 | + private static $_stripTable=['<' => '', '>' => '', '"' => '']; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * HTML-encodes a string. |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct($response) |
| 36 | 36 | { |
| 37 | - $this->_response = $response; |
|
| 37 | + $this->_response=$response; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * prefix for cache variable name used to store parsed themes |
| 48 | 48 | */ |
| 49 | - const THEME_CACHE_PREFIX = 'prado:theme:'; |
|
| 49 | + const THEME_CACHE_PREFIX='prado:theme:'; |
|
| 50 | 50 | /** |
| 51 | 51 | * Extension name of skin files |
| 52 | 52 | */ |
| 53 | - const SKIN_FILE_EXT = '.skin'; |
|
| 53 | + const SKIN_FILE_EXT='.skin'; |
|
| 54 | 54 | /** |
| 55 | 55 | * @var string theme path |
| 56 | 56 | */ |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | /** |
| 67 | 67 | * @var string theme name |
| 68 | 68 | */ |
| 69 | - private $_name = ''; |
|
| 69 | + private $_name=''; |
|
| 70 | 70 | /** |
| 71 | 71 | * @var array list of css files |
| 72 | 72 | */ |
| 73 | - private $_cssFiles = []; |
|
| 73 | + private $_cssFiles=[]; |
|
| 74 | 74 | /** |
| 75 | 75 | * @var array list of js files |
| 76 | 76 | */ |
| 77 | - private $_jsFiles = []; |
|
| 77 | + private $_jsFiles=[]; |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Constructor. |
@@ -84,75 +84,75 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function __construct($themePath, $themeUrl) |
| 86 | 86 | { |
| 87 | - $this->_themeUrl = $themeUrl; |
|
| 88 | - $this->_themePath = realpath($themePath); |
|
| 89 | - $this->_name = basename($themePath); |
|
| 90 | - $cacheValid = false; |
|
| 87 | + $this->_themeUrl=$themeUrl; |
|
| 88 | + $this->_themePath=realpath($themePath); |
|
| 89 | + $this->_name=basename($themePath); |
|
| 90 | + $cacheValid=false; |
|
| 91 | 91 | // TODO: the following needs to be cleaned up (Qiang) |
| 92 | - if(($cache = $this->getApplication()->getCache()) !== null) |
|
| 92 | + if(($cache=$this->getApplication()->getCache())!==null) |
|
| 93 | 93 | { |
| 94 | - $array = $cache->get(self::THEME_CACHE_PREFIX . $themePath); |
|
| 94 | + $array=$cache->get(self::THEME_CACHE_PREFIX.$themePath); |
|
| 95 | 95 | if(is_array($array)) |
| 96 | 96 | { |
| 97 | - list($skins, $cssFiles, $jsFiles, $timestamp) = $array; |
|
| 98 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
| 97 | + list($skins, $cssFiles, $jsFiles, $timestamp)=$array; |
|
| 98 | + if($this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
| 99 | 99 | { |
| 100 | - if(($dir = opendir($themePath)) === false) |
|
| 100 | + if(($dir=opendir($themePath))===false) |
|
| 101 | 101 | throw new TIOException('theme_path_inexistent', $themePath); |
| 102 | - $cacheValid = true; |
|
| 103 | - while(($file = readdir($dir)) !== false) |
|
| 102 | + $cacheValid=true; |
|
| 103 | + while(($file=readdir($dir))!==false) |
|
| 104 | 104 | { |
| 105 | - if($file === '.' || $file === '..') |
|
| 105 | + if($file==='.' || $file==='..') |
|
| 106 | 106 | continue; |
| 107 | - elseif(basename($file, '.css') !== $file) |
|
| 108 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
| 109 | - elseif(basename($file, '.js') !== $file) |
|
| 110 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
| 111 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp) |
|
| 107 | + elseif(basename($file, '.css')!==$file) |
|
| 108 | + $this->_cssFiles[]=$themeUrl.'/'.$file; |
|
| 109 | + elseif(basename($file, '.js')!==$file) |
|
| 110 | + $this->_jsFiles[]=$themeUrl.'/'.$file; |
|
| 111 | + elseif(basename($file, self::SKIN_FILE_EXT)!==$file && filemtime($themePath.DIRECTORY_SEPARATOR.$file) > $timestamp) |
|
| 112 | 112 | { |
| 113 | - $cacheValid = false; |
|
| 113 | + $cacheValid=false; |
|
| 114 | 114 | break; |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | closedir($dir); |
| 118 | 118 | if($cacheValid) |
| 119 | - $this->_skins = $skins; |
|
| 119 | + $this->_skins=$skins; |
|
| 120 | 120 | } |
| 121 | 121 | else |
| 122 | 122 | { |
| 123 | - $cacheValid = true; |
|
| 124 | - $this->_cssFiles = $cssFiles; |
|
| 125 | - $this->_jsFiles = $jsFiles; |
|
| 126 | - $this->_skins = $skins; |
|
| 123 | + $cacheValid=true; |
|
| 124 | + $this->_cssFiles=$cssFiles; |
|
| 125 | + $this->_jsFiles=$jsFiles; |
|
| 126 | + $this->_skins=$skins; |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | if(!$cacheValid) |
| 131 | 131 | { |
| 132 | - $this->_cssFiles = []; |
|
| 133 | - $this->_jsFiles = []; |
|
| 134 | - $this->_skins = []; |
|
| 135 | - if(($dir = opendir($themePath)) === false) |
|
| 132 | + $this->_cssFiles=[]; |
|
| 133 | + $this->_jsFiles=[]; |
|
| 134 | + $this->_skins=[]; |
|
| 135 | + if(($dir=opendir($themePath))===false) |
|
| 136 | 136 | throw new TIOException('theme_path_inexistent', $themePath); |
| 137 | - while(($file = readdir($dir)) !== false) |
|
| 137 | + while(($file=readdir($dir))!==false) |
|
| 138 | 138 | { |
| 139 | - if($file === '.' || $file === '..') |
|
| 139 | + if($file==='.' || $file==='..') |
|
| 140 | 140 | continue; |
| 141 | - elseif(basename($file, '.css') !== $file) |
|
| 142 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
| 143 | - elseif(basename($file, '.js') !== $file) |
|
| 144 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
| 145 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file) |
|
| 141 | + elseif(basename($file, '.css')!==$file) |
|
| 142 | + $this->_cssFiles[]=$themeUrl.'/'.$file; |
|
| 143 | + elseif(basename($file, '.js')!==$file) |
|
| 144 | + $this->_jsFiles[]=$themeUrl.'/'.$file; |
|
| 145 | + elseif(basename($file, self::SKIN_FILE_EXT)!==$file) |
|
| 146 | 146 | { |
| 147 | - $template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file); |
|
| 147 | + $template=new TTemplate(file_get_contents($themePath.'/'.$file), $themePath, $themePath.'/'.$file); |
|
| 148 | 148 | foreach($template->getItems() as $skin) |
| 149 | 149 | { |
| 150 | 150 | if(!isset($skin[2])) // a text string, ignored |
| 151 | 151 | continue; |
| 152 | - elseif($skin[0] !== -1) |
|
| 152 | + elseif($skin[0]!==-1) |
|
| 153 | 153 | throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath)); |
| 154 | - $type = $skin[1]; |
|
| 155 | - $id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0; |
|
| 154 | + $type=$skin[1]; |
|
| 155 | + $id=isset($skin[2]['skinid']) ? $skin[2]['skinid'] : 0; |
|
| 156 | 156 | unset($skin[2]['skinid']); |
| 157 | 157 | if(isset($this->_skins[$type][$id])) |
| 158 | 158 | throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath)); |
@@ -163,15 +163,15 @@ discard block |
||
| 163 | 163 | throw new TConfigurationException('theme_databind_forbidden',dirname($themePath),$type,$id); |
| 164 | 164 | } |
| 165 | 165 | */ |
| 166 | - $this->_skins[$type][$id] = $skin[2]; |
|
| 166 | + $this->_skins[$type][$id]=$skin[2]; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | closedir($dir); |
| 171 | 171 | sort($this->_cssFiles); |
| 172 | 172 | sort($this->_jsFiles); |
| 173 | - if($cache !== null) |
|
| 174 | - $cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]); |
|
| 173 | + if($cache!==null) |
|
| 174 | + $cache->set(self::THEME_CACHE_PREFIX.$themePath, [$this->_skins, $this->_cssFiles, $this->_jsFiles, time()]); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function setName($value) |
| 190 | 190 | { |
| 191 | - $this->_name = $value; |
|
| 191 | + $this->_name=$value; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | protected function setBaseUrl($value) |
| 206 | 206 | { |
| 207 | - $this->_themeUrl = rtrim($value, '/'); |
|
| 207 | + $this->_themeUrl=rtrim($value, '/'); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | protected function setBasePath($value) |
| 222 | 222 | { |
| 223 | - $this->_themePath = $value; |
|
| 223 | + $this->_themePath=$value; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | protected function setSkins($value) |
| 238 | 238 | { |
| 239 | - $this->_skins = $value; |
|
| 239 | + $this->_skins=$value; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function applySkin($control) |
| 252 | 252 | { |
| 253 | - $type = get_class($control); |
|
| 254 | - if(($id = $control->getSkinID()) === '') |
|
| 255 | - $id = 0; |
|
| 253 | + $type=get_class($control); |
|
| 254 | + if(($id=$control->getSkinID())==='') |
|
| 255 | + $id=0; |
|
| 256 | 256 | if(isset($this->_skins[$type][$id])) |
| 257 | 257 | { |
| 258 | 258 | foreach($this->_skins[$type][$id] as $name => $value) |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | switch($value[0]) |
| 264 | 264 | { |
| 265 | 265 | case TTemplate::CONFIG_EXPRESSION: |
| 266 | - $value = $this->evaluateExpression($value[1]); |
|
| 266 | + $value=$this->evaluateExpression($value[1]); |
|
| 267 | 267 | break; |
| 268 | 268 | case TTemplate::CONFIG_ASSET: |
| 269 | - $value = $this->_themeUrl . '/' . ltrim($value[1], '/'); |
|
| 269 | + $value=$this->_themeUrl.'/'.ltrim($value[1], '/'); |
|
| 270 | 270 | break; |
| 271 | 271 | case TTemplate::CONFIG_DATABIND: |
| 272 | 272 | $control->bindProperty($name, $value[1]); |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | if(!is_array($value)) |
| 289 | 289 | { |
| 290 | - if(strpos($name, '.') === false) // is simple property or custom attribute |
|
| 290 | + if(strpos($name, '.')===false) // is simple property or custom attribute |
|
| 291 | 291 | { |
| 292 | 292 | if($control->hasProperty($name)) |
| 293 | 293 | { |
| 294 | 294 | if($control->canSetProperty($name)) |
| 295 | 295 | { |
| 296 | - $setter = 'set' . $name; |
|
| 296 | + $setter='set'.$name; |
|
| 297 | 297 | $control->$setter($value); |
| 298 | 298 | } |
| 299 | 299 | else |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | protected function setStyleSheetFiles($value) |
| 327 | 327 | { |
| 328 | - $this->_cssFiles = $value; |
|
| 328 | + $this->_cssFiles=$value; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -341,6 +341,6 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | protected function setJavaScriptFiles($value) |
| 343 | 343 | { |
| 344 | - $this->_jsFiles = $value; |
|
| 344 | + $this->_jsFiles=$value; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | \ No newline at end of file |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | closedir($dir); |
| 118 | 118 | if($cacheValid) |
| 119 | 119 | $this->_skins = $skins; |
| 120 | - } |
|
| 121 | - else |
|
| 120 | + } else |
|
| 122 | 121 | { |
| 123 | 122 | $cacheValid = true; |
| 124 | 123 | $this->_cssFiles = $cssFiles; |
@@ -295,20 +294,16 @@ discard block |
||
| 295 | 294 | { |
| 296 | 295 | $setter = 'set' . $name; |
| 297 | 296 | $control->$setter($value); |
| 298 | - } |
|
| 299 | - else |
|
| 297 | + } else |
|
| 300 | 298 | throw new TConfigurationException('theme_property_readonly', $type, $name); |
| 301 | - } |
|
| 302 | - else |
|
| 299 | + } else |
|
| 303 | 300 | throw new TConfigurationException('theme_property_undefined', $type, $name); |
| 304 | - } |
|
| 305 | - else // complex property |
|
| 301 | + } else // complex property |
|
| 306 | 302 | $control->setSubProperty($name, $value); |
| 307 | 303 | } |
| 308 | 304 | } |
| 309 | 305 | return true; |
| 310 | - } |
|
| 311 | - else |
|
| 306 | + } else |
|
| 312 | 307 | return false; |
| 313 | 308 | } |
| 314 | 309 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * Only framework developers should use this method. |
| 30 | 30 | * @param TControl the naming container control |
| 31 | 31 | */ |
| 32 | - protected function initRecursive($namingContainer = null) |
|
| 32 | + protected function initRecursive($namingContainer=null) |
|
| 33 | 33 | { |
| 34 | 34 | $this->ensureChildControls(); |
| 35 | 35 | parent::initRecursive($namingContainer); |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * template file extension. |
| 35 | 35 | */ |
| 36 | - const EXT_TEMPLATE = '.tpl'; |
|
| 36 | + const EXT_TEMPLATE='.tpl'; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @var ITemplate the parsed template structure shared by the same control class |
| 40 | 40 | */ |
| 41 | - private static $_template = []; |
|
| 41 | + private static $_template=[]; |
|
| 42 | 42 | /** |
| 43 | 43 | * @var ITemplate the parsed template structure specific for this control instance |
| 44 | 44 | */ |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @var string master control class name |
| 52 | 52 | */ |
| 53 | - private $_masterClass = ''; |
|
| 53 | + private $_masterClass=''; |
|
| 54 | 54 | /** |
| 55 | 55 | * @var array list of TContent controls |
| 56 | 56 | */ |
| 57 | - private $_contents = []; |
|
| 57 | + private $_contents=[]; |
|
| 58 | 58 | /** |
| 59 | 59 | * @var array list of TContentPlaceHolder controls |
| 60 | 60 | */ |
| 61 | - private $_placeholders = []; |
|
| 61 | + private $_placeholders=[]; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Returns the template object associated with this control object. |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function getTemplate() |
| 68 | 68 | { |
| 69 | - if($this->_localTemplate === null) |
|
| 69 | + if($this->_localTemplate===null) |
|
| 70 | 70 | { |
| 71 | - $class = get_class($this); |
|
| 71 | + $class=get_class($this); |
|
| 72 | 72 | if(!isset(self::$_template[$class])) |
| 73 | - self::$_template[$class] = $this->loadTemplate(); |
|
| 73 | + self::$_template[$class]=$this->loadTemplate(); |
|
| 74 | 74 | return self::$_template[$class]; |
| 75 | 75 | } |
| 76 | 76 | else |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function setTemplate($value) |
| 87 | 87 | { |
| 88 | - $this->_localTemplate = $value; |
|
| 88 | + $this->_localTemplate=$value; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function getIsSourceTemplateControl() |
| 97 | 97 | { |
| 98 | - if(($template = $this->getTemplate()) !== null) |
|
| 98 | + if(($template=$this->getTemplate())!==null) |
|
| 99 | 99 | return $template->getIsSourceTemplate(); |
| 100 | 100 | else |
| 101 | 101 | return false; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function getTemplateDirectory() |
| 108 | 108 | { |
| 109 | - if(($template = $this->getTemplate()) !== null) |
|
| 109 | + if(($template=$this->getTemplate())!==null) |
|
| 110 | 110 | return $template->getContextPath(); |
| 111 | 111 | else |
| 112 | 112 | return ''; |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function loadTemplate() |
| 120 | 120 | { |
| 121 | - Prado::trace("Loading template " . get_class($this), '\Prado\Web\UI\TTemplateControl'); |
|
| 122 | - $template = $this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this)); |
|
| 121 | + Prado::trace("Loading template ".get_class($this), '\Prado\Web\UI\TTemplateControl'); |
|
| 122 | + $template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this)); |
|
| 123 | 123 | return $template; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function createChildControls() |
| 132 | 132 | { |
| 133 | - if($tpl = $this->getTemplate()) |
|
| 133 | + if($tpl=$this->getTemplate()) |
|
| 134 | 134 | { |
| 135 | 135 | foreach($tpl->getDirective() as $name => $value) |
| 136 | 136 | { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if(isset($this->_contents[$id])) |
| 154 | 154 | throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
| 155 | 155 | else |
| 156 | - $this->_contents[$id] = $object; |
|
| 156 | + $this->_contents[$id]=$object; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if(isset($this->_placeholders[$id])) |
| 168 | 168 | throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
| 169 | 169 | else |
| 170 | - $this->_placeholders[$id] = $object; |
|
| 170 | + $this->_placeholders[$id]=$object; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function setMasterClass($value) |
| 185 | 185 | { |
| 186 | - $this->_masterClass = $value; |
|
| 186 | + $this->_masterClass=$value; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | if(isset($this->_placeholders[$id])) |
| 206 | 206 | { |
| 207 | - $placeholder = $this->_placeholders[$id]; |
|
| 208 | - $controls = $placeholder->getParent()->getControls(); |
|
| 209 | - $loc = $controls->remove($placeholder); |
|
| 207 | + $placeholder=$this->_placeholders[$id]; |
|
| 208 | + $controls=$placeholder->getParent()->getControls(); |
|
| 209 | + $loc=$controls->remove($placeholder); |
|
| 210 | 210 | $controls->insertAt($loc, $content); |
| 211 | 211 | } |
| 212 | 212 | else |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | * Only framework developers should use this method. |
| 222 | 222 | * @param TControl the naming container control |
| 223 | 223 | */ |
| 224 | - protected function initRecursive($namingContainer = null) |
|
| 224 | + protected function initRecursive($namingContainer=null) |
|
| 225 | 225 | { |
| 226 | 226 | $this->ensureChildControls(); |
| 227 | - if($this->_masterClass !== '') |
|
| 227 | + if($this->_masterClass!=='') |
|
| 228 | 228 | { |
| 229 | - $master = Prado::createComponent($this->_masterClass); |
|
| 229 | + $master=Prado::createComponent($this->_masterClass); |
|
| 230 | 230 | if(!($master instanceof TTemplateControl)) |
| 231 | 231 | throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
| 232 | - $this->_master = $master; |
|
| 232 | + $this->_master=$master; |
|
| 233 | 233 | $this->getControls()->clear(); |
| 234 | 234 | $this->getControls()->add($master); |
| 235 | 235 | $master->ensureChildControls(); |
@@ -248,38 +248,38 @@ discard block |
||
| 248 | 248 | * @param Boolean $throwExceptions Wheter or not to throw exceptions |
| 249 | 249 | * @author Daniel Sampedro <[email protected]> |
| 250 | 250 | */ |
| 251 | - public function tryToUpdateView($arObj, $throwExceptions = false) |
|
| 251 | + public function tryToUpdateView($arObj, $throwExceptions=false) |
|
| 252 | 252 | { |
| 253 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
| 254 | - foreach (array_keys($objAttrs) as $key) |
|
| 253 | + $objAttrs=get_class_vars(get_class($arObj)); |
|
| 254 | + foreach(array_keys($objAttrs) as $key) |
|
| 255 | 255 | { |
| 256 | 256 | try |
| 257 | 257 | { |
| 258 | - if ($key != "RELATIONS") |
|
| 258 | + if($key!="RELATIONS") |
|
| 259 | 259 | { |
| 260 | - $control = $this->{$key}; |
|
| 261 | - if ($control instanceof TTextBox) |
|
| 262 | - $control->Text = $arObj->{$key}; |
|
| 263 | - elseif ($control instanceof TCheckBox) |
|
| 264 | - $control->Checked = (boolean) $arObj->{$key}; |
|
| 265 | - elseif ($control instanceof TDatePicker) |
|
| 266 | - $control->Date = $arObj->{$key}; |
|
| 260 | + $control=$this->{$key}; |
|
| 261 | + if($control instanceof TTextBox) |
|
| 262 | + $control->Text=$arObj->{$key}; |
|
| 263 | + elseif($control instanceof TCheckBox) |
|
| 264 | + $control->Checked=(boolean) $arObj->{$key}; |
|
| 265 | + elseif($control instanceof TDatePicker) |
|
| 266 | + $control->Date=$arObj->{$key}; |
|
| 267 | 267 | } |
| 268 | 268 | else |
| 269 | 269 | { |
| 270 | - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
| 270 | + foreach($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
| 271 | 271 | { |
| 272 | - $relControl = $this->{$relKey}; |
|
| 273 | - switch ($relValues[0]) |
|
| 272 | + $relControl=$this->{$relKey}; |
|
| 273 | + switch($relValues[0]) |
|
| 274 | 274 | { |
| 275 | 275 | case TActiveRecord::BELONGS_TO: |
| 276 | 276 | case TActiveRecord::HAS_ONE: |
| 277 | - $relControl->Text = $arObj->{$relKey}; |
|
| 277 | + $relControl->Text=$arObj->{$relKey}; |
|
| 278 | 278 | break; |
| 279 | 279 | case TActiveRecord::HAS_MANY: |
| 280 | - if ($relControl instanceof TListControl) |
|
| 280 | + if($relControl instanceof TListControl) |
|
| 281 | 281 | { |
| 282 | - $relControl->DataSource = $arObj->{$relKey}; |
|
| 282 | + $relControl->DataSource=$arObj->{$relKey}; |
|
| 283 | 283 | $relControl->dataBind(); |
| 284 | 284 | } |
| 285 | 285 | break; |
@@ -288,9 +288,9 @@ discard block |
||
| 288 | 288 | break; |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | - catch (Exception $ex) |
|
| 291 | + catch(Exception $ex) |
|
| 292 | 292 | { |
| 293 | - if ($throwExceptions) |
|
| 293 | + if($throwExceptions) |
|
| 294 | 294 | throw $ex; |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -302,26 +302,26 @@ discard block |
||
| 302 | 302 | * @param Boolean $throwExceptions Wheter or not to throw exceptions |
| 303 | 303 | * @author Daniel Sampedro <[email protected]> |
| 304 | 304 | */ |
| 305 | - public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
| 305 | + public function tryToUpdateAR($arObj, $throwExceptions=false) |
|
| 306 | 306 | { |
| 307 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
| 308 | - foreach (array_keys($objAttrs) as $key) |
|
| 307 | + $objAttrs=get_class_vars(get_class($arObj)); |
|
| 308 | + foreach(array_keys($objAttrs) as $key) |
|
| 309 | 309 | { |
| 310 | 310 | try |
| 311 | 311 | { |
| 312 | - if ($key == "RELATIONS") |
|
| 312 | + if($key=="RELATIONS") |
|
| 313 | 313 | break; |
| 314 | - $control = $this->{$key}; |
|
| 315 | - if ($control instanceof TTextBox) |
|
| 316 | - $arObj->{$key} = $control->Text; |
|
| 317 | - elseif ($control instanceof TCheckBox) |
|
| 318 | - $arObj->{$key} = $control->Checked; |
|
| 319 | - elseif ($control instanceof TDatePicker) |
|
| 320 | - $arObj->{$key} = $control->Date; |
|
| 314 | + $control=$this->{$key}; |
|
| 315 | + if($control instanceof TTextBox) |
|
| 316 | + $arObj->{$key}=$control->Text; |
|
| 317 | + elseif($control instanceof TCheckBox) |
|
| 318 | + $arObj->{$key}=$control->Checked; |
|
| 319 | + elseif($control instanceof TDatePicker) |
|
| 320 | + $arObj->{$key}=$control->Date; |
|
| 321 | 321 | } |
| 322 | - catch (Exception $ex) |
|
| 322 | + catch(Exception $ex) |
|
| 323 | 323 | { |
| 324 | - if ($throwExceptions) |
|
| 324 | + if($throwExceptions) |
|
| 325 | 325 | throw $ex; |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | if(!isset(self::$_template[$class])) |
| 73 | 73 | self::$_template[$class] = $this->loadTemplate(); |
| 74 | 74 | return self::$_template[$class]; |
| 75 | - } |
|
| 76 | - else |
|
| 75 | + } else |
|
| 77 | 76 | return $this->_localTemplate; |
| 78 | 77 | } |
| 79 | 78 | |
@@ -208,8 +207,7 @@ discard block |
||
| 208 | 207 | $controls = $placeholder->getParent()->getControls(); |
| 209 | 208 | $loc = $controls->remove($placeholder); |
| 210 | 209 | $controls->insertAt($loc, $content); |
| 211 | - } |
|
| 212 | - else |
|
| 210 | + } else |
|
| 213 | 211 | throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
| 214 | 212 | } |
| 215 | 213 | |
@@ -235,8 +233,7 @@ discard block |
||
| 235 | 233 | $master->ensureChildControls(); |
| 236 | 234 | foreach($this->_contents as $id => $content) |
| 237 | 235 | $master->injectContent($id, $content); |
| 238 | - } |
|
| 239 | - elseif(!empty($this->_contents)) |
|
| 236 | + } elseif(!empty($this->_contents)) |
|
| 240 | 237 | throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
| 241 | 238 | parent::initRecursive($namingContainer); |
| 242 | 239 | } |
@@ -264,8 +261,7 @@ discard block |
||
| 264 | 261 | $control->Checked = (boolean) $arObj->{$key}; |
| 265 | 262 | elseif ($control instanceof TDatePicker) |
| 266 | 263 | $control->Date = $arObj->{$key}; |
| 267 | - } |
|
| 268 | - else |
|
| 264 | + } else |
|
| 269 | 265 | { |
| 270 | 266 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
| 271 | 267 | { |
@@ -287,8 +283,7 @@ discard block |
||
| 287 | 283 | } |
| 288 | 284 | break; |
| 289 | 285 | } |
| 290 | - } |
|
| 291 | - catch (Exception $ex) |
|
| 286 | + } catch (Exception $ex) |
|
| 292 | 287 | { |
| 293 | 288 | if ($throwExceptions) |
| 294 | 289 | throw $ex; |
@@ -318,8 +313,7 @@ discard block |
||
| 318 | 313 | $arObj->{$key} = $control->Checked; |
| 319 | 314 | elseif ($control instanceof TDatePicker) |
| 320 | 315 | $arObj->{$key} = $control->Date; |
| 321 | - } |
|
| 322 | - catch (Exception $ex) |
|
| 316 | + } catch (Exception $ex) |
|
| 323 | 317 | { |
| 324 | 318 | if ($throwExceptions) |
| 325 | 319 | throw $ex; |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Template file extension |
| 41 | 41 | */ |
| 42 | - const TEMPLATE_FILE_EXT = '.tpl'; |
|
| 42 | + const TEMPLATE_FILE_EXT='.tpl'; |
|
| 43 | 43 | /** |
| 44 | 44 | * Prefix of the cache variable name for storing parsed templates |
| 45 | 45 | */ |
| 46 | - const TEMPLATE_CACHE_PREFIX = 'prado:template:'; |
|
| 46 | + const TEMPLATE_CACHE_PREFIX='prado:template:'; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Initializes the module. |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getTemplateByClassName($className) |
| 64 | 64 | { |
| 65 | - $class = new \ReflectionClass($className); |
|
| 66 | - $tplFile = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . $class->getShortName() . self::TEMPLATE_FILE_EXT; |
|
| 65 | + $class=new \ReflectionClass($className); |
|
| 66 | + $tplFile=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$class->getShortName().self::TEMPLATE_FILE_EXT; |
|
| 67 | 67 | return $this->getTemplateByFileName($tplFile); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -73,38 +73,38 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function getTemplateByFileName($fileName) |
| 75 | 75 | { |
| 76 | - if(($fileName = $this->getLocalizedTemplate($fileName)) !== null) |
|
| 76 | + if(($fileName=$this->getLocalizedTemplate($fileName))!==null) |
|
| 77 | 77 | { |
| 78 | 78 | Prado::trace("Loading template $fileName", '\Prado\Web\UI\TTemplateManager'); |
| 79 | - if(($cache = $this->getApplication()->getCache()) === null) |
|
| 79 | + if(($cache=$this->getApplication()->getCache())===null) |
|
| 80 | 80 | return new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName); |
| 81 | 81 | else |
| 82 | 82 | { |
| 83 | - $array = $cache->get(self::TEMPLATE_CACHE_PREFIX . $fileName); |
|
| 83 | + $array=$cache->get(self::TEMPLATE_CACHE_PREFIX.$fileName); |
|
| 84 | 84 | if(is_array($array)) |
| 85 | 85 | { |
| 86 | - list($template, $timestamps) = $array; |
|
| 87 | - if($this->getApplication()->getMode() === TApplicationMode::Performance) |
|
| 86 | + list($template, $timestamps)=$array; |
|
| 87 | + if($this->getApplication()->getMode()===TApplicationMode::Performance) |
|
| 88 | 88 | return $template; |
| 89 | - $cacheValid = true; |
|
| 89 | + $cacheValid=true; |
|
| 90 | 90 | foreach($timestamps as $tplFile => $timestamp) |
| 91 | 91 | { |
| 92 | 92 | if(!is_file($tplFile) || filemtime($tplFile) > $timestamp) |
| 93 | 93 | { |
| 94 | - $cacheValid = false; |
|
| 94 | + $cacheValid=false; |
|
| 95 | 95 | break; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if($cacheValid) |
| 99 | 99 | return $template; |
| 100 | 100 | } |
| 101 | - $template = new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName); |
|
| 102 | - $includedFiles = $template->getIncludedFiles(); |
|
| 103 | - $timestamps = []; |
|
| 104 | - $timestamps[$fileName] = filemtime($fileName); |
|
| 101 | + $template=new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName); |
|
| 102 | + $includedFiles=$template->getIncludedFiles(); |
|
| 103 | + $timestamps=[]; |
|
| 104 | + $timestamps[$fileName]=filemtime($fileName); |
|
| 105 | 105 | foreach($includedFiles as $includedFile) |
| 106 | - $timestamps[$includedFile] = filemtime($includedFile); |
|
| 107 | - $cache->set(self::TEMPLATE_CACHE_PREFIX . $fileName, [$template,$timestamps]); |
|
| 106 | + $timestamps[$includedFile]=filemtime($includedFile); |
|
| 107 | + $cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName, [$template, $timestamps]); |
|
| 108 | 108 | return $template; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function getLocalizedTemplate($filename) |
| 121 | 121 | { |
| 122 | - if(($app = $this->getApplication()->getGlobalization(false)) === null) |
|
| 123 | - return is_file($filename)?$filename:null; |
|
| 122 | + if(($app=$this->getApplication()->getGlobalization(false))===null) |
|
| 123 | + return is_file($filename) ? $filename : null; |
|
| 124 | 124 | foreach($app->getLocalizedResource($filename) as $file) |
| 125 | 125 | { |
| 126 | - if(($file = realpath($file)) !== false && is_file($file)) |
|
| 126 | + if(($file=realpath($file))!==false && is_file($file)) |
|
| 127 | 127 | return $file; |
| 128 | 128 | } |
| 129 | 129 | return null; |