diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2016-04-19 16:15:39 +0200 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2016-04-19 16:15:39 +0200 |
commit | 5f6db9b9942053215532d9bc6bdc2c09ec7cb1d1 (patch) | |
tree | 7ae6feac742171713331c24875677d86de4bfe5f | |
parent | 51702c7564454b18232e19fa9ca0d05ed33c4b3c (diff) |
Don't throw an error when trying to autoload a not-existing class
related #582
-rw-r--r-- | framework/PradoBase.php | 2 | ||||
-rw-r--r-- | framework/pradolite.php | 58 |
2 files changed, 55 insertions, 5 deletions
diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 7cd26187..d9c49898 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -104,7 +104,7 @@ class PradoBase */ public static function autoload($className) { - include_once($className.self::CLASS_FILE_EXT); + @include_once($className.self::CLASS_FILE_EXT); } /** diff --git a/framework/pradolite.php b/framework/pradolite.php index 4a6de98d..6823f16d 100644 --- a/framework/pradolite.php +++ b/framework/pradolite.php @@ -1,7 +1,7 @@ <?php /** * File Name: pradolite.php - * Last Update: 2016/03/09 11:34:32 + * Last Update: 2016/04/19 16:01:56 * Generated By: buildscripts/phpbuilder/build.php * * This file is used in lieu of prado.php to boost PRADO application performance. @@ -32,12 +32,11 @@ class PradoBase set_error_handler(array('PradoBase','phpErrorHandler')); register_shutdown_function(array('PradoBase','phpFatalErrorHandler')); set_exception_handler(array('PradoBase','exceptionHandler')); + ini_set('display_errors', 0); } public static function autoload($className) { - include_once($className.self::CLASS_FILE_EXT); - if(!class_exists($className,false) && !interface_exists($className,false)) - self::fatalError("Class file for '$className' cannot be found."); + @include_once($className.self::CLASS_FILE_EXT); } public static function poweredByPrado($logoType=0) { @@ -6996,6 +6995,7 @@ class TClientScriptManager extends TApplicationComponent { const SCRIPT_PATH='Web/Javascripts/source'; const PACKAGES_FILE='Web/Javascripts/packages.php'; + const CSS_PACKAGES_FILE='Web/Javascripts/css-packages.php'; private $_page; private $_hiddenFields=array(); private $_beginScripts=array(); @@ -7008,9 +7008,13 @@ class TClientScriptManager extends TApplicationComponent private $_registeredPradoScripts=array(); private static $_pradoScripts; private static $_pradoPackages; + private $_registeredPradoStyles=array(); + private static $_pradoStyles; + private static $_pradoStylePackages; private $_renderedHiddenFields; private $_renderedScriptFiles=array(); private $_expandedPradoScripts; + private $_expandedPradoStyles; public function __construct(TPage $owner) { $this->_page=$owner; @@ -7186,6 +7190,52 @@ class TClientScriptManager extends TApplicationComponent $params=func_get_args(); $this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params); } + public function registerPradoStyle($name) + { + $this->registerPradoStyleInternal($name); + $params=func_get_args(); + $this->_page->registerCachingAction('Page.ClientScript','registerPradoStyle',$params); + } + protected function registerPradoStyleInternal($name) + { + if(!isset($this->_registeredPradoStyles[$name])) + { + $base = $this->getPradoScriptAssetUrl(); + if(self::$_pradoStyles === null) + { + $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; + list($packages,$deps)= include($packageFile); + self::$_pradoStyles = $deps; + self::$_pradoStylePackages = $packages; + } + if (isset(self::$_pradoStyles[$name])) + $this->_registeredPradoStyles[$name]=true; + else + throw new TInvalidOperationException('csmanager_pradostyle_invalid',$name); + if(($packages=array_keys($this->_registeredPradoStyles))!==array()) + { + $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; + list($path,$baseUrl)=$this->getPackagePathUrl($base); + $packagesUrl=array(); + $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; + foreach ($packages as $p) + { + foreach (self::$_pradoStyles[$p] as $dep) + { + foreach (self::$_pradoStylePackages[$dep] as $style) + if (!isset($this->_expandedPradoStyles[$style])) + { + $this->_expandedPradoStyles[$style] = true; + if (!in_array($url=$baseUrl.'/'.$style,$packagesUrl)) + $packagesUrl[]=$url; + } + } + } + foreach($packagesUrl as $url) + $this->registerStyleSheetFile($url,$url); + } + } + } public function registerStyleSheetFile($key,$url,$media='') { if($media==='') |