From 5230f8f8a86fc1ae5d90f8c74ae65c93e197502b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 22 Jan 2015 09:14:12 +0100 Subject: Apply namespaces to class inheritances (pt1) --- framework/Caching/ICache.php | 64 +++++ framework/Caching/ICacheDependency.php | 32 +++ framework/Caching/TAPCCache.php | 1 + .../Caching/TApplicationStateCacheDependency.php | 2 + framework/Caching/TCache.php | 16 +- framework/Caching/TCacheDependency.php | 2 +- framework/Caching/TCacheDependencyList.php | 1 + framework/Caching/TDbCache.php | 26 +- framework/Caching/TDirectoryCacheDependency.php | 3 + framework/Caching/TEACache.php | 2 +- framework/Caching/TGlobalStateCacheDependency.php | 1 + framework/Caching/TMemCache.php | 7 +- framework/Caching/TSqliteCache.php | 5 +- framework/Caching/TXCache.php | 1 + framework/Collections/TAttributeCollection.php | 6 +- framework/Collections/TDummyDataSource.php | 4 +- framework/Collections/TDummyDataSourceIterator.php | 4 +- framework/Collections/TList.php | 24 +- framework/Collections/TListItemCollection.php | 9 +- framework/Collections/TListIterator.php | 4 +- framework/Collections/TMap.php | 19 +- framework/Collections/TMapIterator.php | 4 +- framework/Collections/TPagedDataSource.php | 9 +- framework/Collections/TPagedList.php | 6 +- .../TPagedListFetchDataEventParameter.php | 2 +- framework/Collections/TPagedListIterator.php | 4 +- .../TPagedListPageChangedEventParameter.php | 2 +- framework/Collections/TPagedMapIterator.php | 4 +- framework/Collections/TPriorityList.php | 22 +- framework/Collections/TPriorityMap.php | 22 +- framework/Collections/TQueue.php | 12 +- framework/Collections/TQueueIterator.php | 4 +- framework/Collections/TStack.php | 12 +- framework/Collections/TStackIterator.php | 4 +- .../Relations/TActiveRecordRelation.php | 6 +- framework/Data/ActiveRecord/TActiveRecord.php | 2 +- .../TActiveRecordChangeEventParameter.php | 2 +- .../Data/ActiveRecord/TActiveRecordGateway.php | 2 +- .../Data/ActiveRecord/TActiveRecordManager.php | 2 +- framework/Data/Common/Oracle/TOracleTableInfo.php | 2 +- framework/Data/Common/TDbCommandBuilder.php | 2 +- framework/Data/Common/TDbMetaData.php | 2 +- framework/Data/Common/TDbTableColumn.php | 2 +- framework/Data/Common/TDbTableInfo.php | 2 +- framework/Data/DataGateway/TDataGatewayCommand.php | 2 +- .../DataGateway/TDataGatewayEventParameter.php | 2 +- .../TDataGatewayResultEventParameter.php | 2 +- framework/Data/DataGateway/TSqlCriteria.php | 8 +- framework/Data/DataGateway/TTableGateway.php | 2 +- .../Data/SqlMap/Configuration/TDiscriminator.php | 2 +- .../Data/SqlMap/Configuration/TParameterMap.php | 2 +- .../SqlMap/Configuration/TParameterProperty.php | 2 +- framework/Data/SqlMap/Configuration/TResultMap.php | 2 +- .../Data/SqlMap/Configuration/TResultProperty.php | 12 +- .../SqlMap/Configuration/TSqlMapCacheModel.php | 2 +- .../Data/SqlMap/Configuration/TSqlMapStatement.php | 10 +- framework/Data/SqlMap/Configuration/TSubMap.php | 2 +- .../Data/SqlMap/DataMapper/TPropertyAccess.php | 6 +- .../Data/SqlMap/DataMapper/TSqlMapTypeHandler.php | 2 +- .../Data/SqlMap/Statements/TCachingStatement.php | 2 +- .../Data/SqlMap/Statements/TMappedStatement.php | 6 +- .../Data/SqlMap/Statements/TPreparedStatement.php | 2 +- .../Statements/TResultSetListItemParameter.php | 2 +- .../Statements/TResultSetMapItemParameter.php | 2 +- .../Statements/TSqlMapObjectCollectionTree.php | 2 +- framework/Data/SqlMap/Statements/TStaticSql.php | 2 +- framework/Data/SqlMap/TSqlMapGateway.php | 2 +- framework/Data/SqlMap/TSqlMapManager.php | 2 +- framework/Data/TDataSourceConfig.php | 2 +- framework/Data/TDbCommand.php | 2 +- framework/Data/TDbConnection.php | 2 +- framework/Data/TDbDataReader.php | 2 +- framework/Data/TDbTransaction.php | 2 +- framework/Exceptions/TErrorHandler.php | 6 +- framework/Exceptions/TException.php | 4 +- framework/Exceptions/THttpException.php | 1 + framework/Exceptions/TTemplateException.php | 1 + framework/I18N/TGlobalization.php | 2 +- framework/I18N/Translation.php | 2 +- framework/IActiveControl.php | 29 -- framework/IBaseBehavior.php | 37 --- framework/IBehavior.php | 39 --- framework/IBindable.php | 29 -- framework/ICache.php | 64 ----- framework/ICacheDependency.php | 32 --- framework/ICallbackEventHandler.php | 33 --- framework/IClassBehavior.php | 49 ---- framework/IO/ITextWriter.php | 34 +++ framework/IO/TTarFileExtractor.php | 2 +- framework/IO/TTextWriter.php | 2 +- framework/IRenderable.php | 31 --- framework/ITextWriter.php | 34 --- framework/IUser.php | 63 ----- framework/PradoBase.php | 81 +++--- framework/Security/IUser.php | 63 +++++ framework/Security/TAuthManager.php | 12 +- framework/Security/TAuthorizationRule.php | 3 +- .../Security/TAuthorizationRuleCollection.php | 3 +- framework/Security/TDbUser.php | 1 + framework/Security/TDbUserManager.php | 13 +- framework/Security/TSecurityManager.php | 5 +- framework/Security/TUser.php | 8 +- framework/Security/TUserManager.php | 12 +- framework/TApplication.php | 68 ++--- framework/TApplicationComponent.php | 4 +- framework/TApplicationConfiguration.php | 4 +- framework/TApplicationStatePersister.php | 2 +- framework/TClassBehaviorEventParameter.php | 2 +- framework/TComponentReflection.php | 6 +- framework/TEnumerable.php | 4 +- framework/TEventParameter.php | 2 +- framework/TJavaScriptLiteral.php | 57 ---- framework/TJavaScriptString.php | 31 --- framework/TModule.php | 2 +- framework/TPropertyValue.php | 6 +- framework/TService.php | 2 +- framework/Util/IBaseBehavior.php | 37 +++ framework/Util/IBehavior.php | 39 +++ framework/Util/IClassBehavior.php | 49 ++++ framework/Util/TBehavior.php | 2 +- framework/Util/TClassBehavior.php | 2 +- framework/Util/TDataFieldAccessor.php | 2 +- framework/Util/TLogRoute.php | 2 +- framework/Util/TLogRouter.php | 2 +- framework/Util/TLogger.php | 2 +- framework/Util/TParameterModule.php | 2 +- framework/Util/TRpcClient.php | 2 +- framework/Web/Javascripts/TJavaScript.php | 7 +- framework/Web/Javascripts/TJavaScriptLiteral.php | 57 ++++ framework/Web/Javascripts/TJavaScriptString.php | 31 +++ framework/Web/Services/TFeedService.php | 5 +- framework/Web/Services/TJsonResponse.php | 2 +- framework/Web/Services/TJsonRpcProtocol.php | 5 +- framework/Web/Services/TJsonService.php | 7 +- framework/Web/Services/TPageConfiguration.php | 8 +- framework/Web/Services/TPageService.php | 21 +- framework/Web/Services/TRpcApiProvider.php | 2 +- framework/Web/Services/TRpcServer.php | 2 +- framework/Web/Services/TRpcService.php | 6 +- framework/Web/Services/TSoapServer.php | 10 +- framework/Web/Services/TSoapService.php | 6 +- framework/Web/Services/TXmlRpcProtocol.php | 3 +- framework/Web/TAssetManager.php | 9 +- framework/Web/TCacheHttpSession.php | 1 + framework/Web/THttpCookie.php | 3 +- framework/Web/THttpCookieCollection.php | 3 +- framework/Web/THttpRequest.php | 23 +- framework/Web/THttpRequestUrlFormat.php | 2 +- framework/Web/THttpResponse.php | 17 +- framework/Web/THttpResponseAdapter.php | 2 +- framework/Web/THttpSession.php | 17 +- framework/Web/TSessionIterator.php | 4 +- framework/Web/TUri.php | 3 +- framework/Web/TUrlManager.php | 4 +- framework/Web/TUrlMapping.php | 10 +- framework/Web/TUrlMappingPattern.php | 6 +- framework/Web/UI/ActiveControls/IActiveControl.php | 29 ++ .../UI/ActiveControls/ICallbackEventHandler.php | 33 +++ .../UI/ActiveControls/TAutoCompleteTemplate.php | 2 +- .../Web/UI/ActiveControls/TBaseActiveControl.php | 2 +- .../UI/ActiveControls/TCallbackClientScript.php | 2 +- .../UI/ActiveControls/TCallbackEventParameter.php | 2 +- .../TDropContainerEventParameter.php | 2 +- framework/Web/UI/IBindable.php | 29 ++ framework/Web/UI/IRenderable.php | 31 +++ .../UI/JuiControls/TJuiAutoCompleteTemplate.php | 2 +- .../Web/UI/JuiControls/TJuiSelectableTemplate.php | 2 +- .../Web/UI/JuiControls/TJuiSortableTemplate.php | 2 +- framework/Web/UI/TBroadcastEventParameter.php | 2 +- framework/Web/UI/TCachePageStatePersister.php | 7 +- framework/Web/UI/TClientScriptManager.php | 13 +- framework/Web/UI/TClientSideOptions.php | 6 +- framework/Web/UI/TCommandEventParameter.php | 2 +- framework/Web/UI/TCompositeLiteral.php | 4 +- framework/Web/UI/TControl.php | 19 +- framework/Web/UI/TControlAdapter.php | 2 +- framework/Web/UI/TControlCollection.php | 3 +- framework/Web/UI/TForm.php | 2 + framework/Web/UI/THtmlWriter.php | 3 +- framework/Web/UI/TPage.php | 310 +++++++++++---------- framework/Web/UI/TPageStatePersister.php | 3 +- framework/Web/UI/TSessionPageStatePersister.php | 5 +- framework/Web/UI/TTemplate.php | 14 +- framework/Web/UI/TTemplateControl.php | 10 +- framework/Web/UI/TTemplateControlInheritable.php | 3 +- framework/Web/UI/TTemplateManager.php | 10 +- framework/Web/UI/TTheme.php | 8 +- framework/Web/UI/TThemeManager.php | 9 +- .../UI/WebControls/TBulletedListEventParameter.php | 2 +- framework/Web/UI/WebControls/TDataGridColumn.php | 2 +- .../UI/WebControls/TDataGridItemEventParameter.php | 2 +- .../TDataGridPageChangedEventParameter.php | 2 +- .../WebControls/TDataGridPagerEventParameter.php | 2 +- .../TDataGridSortCommandEventParameter.php | 2 +- .../UI/WebControls/TDataListItemEventParameter.php | 2 +- .../UI/WebControls/TDataSourceSelectParameters.php | 2 +- framework/Web/UI/WebControls/TDataSourceView.php | 2 +- framework/Web/UI/WebControls/TFont.php | 2 +- framework/Web/UI/WebControls/THotSpot.php | 2 +- .../UI/WebControls/TImageClickEventParameter.php | 2 +- .../Web/UI/WebControls/TImageMapEventParameter.php | 2 +- framework/Web/UI/WebControls/TListItem.php | 2 +- framework/Web/UI/WebControls/TMetaTag.php | 2 +- .../TOutputCacheCalculateKeyEventParameter.php | 2 +- .../TOutputCacheCheckDependencyEventParameter.php | 2 +- .../TPagerPageChangedEventParameter.php | 2 +- framework/Web/UI/WebControls/TRepeatInfo.php | 2 +- .../UI/WebControls/TRepeaterItemEventParameter.php | 2 +- .../WebControls/TServerValidateEventParameter.php | 2 +- framework/Web/UI/WebControls/TStyle.php | 2 +- .../Web/UI/WebControls/TWebControlDecorator.php | 2 +- .../TWizardNavigationEventParameter.php | 2 +- .../UI/WebControls/TWizardNavigationTemplate.php | 2 +- .../WebControls/TWizardSideBarListItemTemplate.php | 2 +- .../Web/UI/WebControls/TWizardSideBarTemplate.php | 2 +- framework/Xml/TXmlDocument.php | 7 +- framework/Xml/TXmlElement.php | 5 +- framework/Xml/TXmlElementList.php | 3 +- framework/prado.php | 26 +- 219 files changed, 1260 insertions(+), 1164 deletions(-) create mode 100644 framework/Caching/ICache.php create mode 100644 framework/Caching/ICacheDependency.php delete mode 100644 framework/IActiveControl.php delete mode 100644 framework/IBaseBehavior.php delete mode 100644 framework/IBehavior.php delete mode 100644 framework/IBindable.php delete mode 100644 framework/ICache.php delete mode 100644 framework/ICacheDependency.php delete mode 100644 framework/ICallbackEventHandler.php delete mode 100644 framework/IClassBehavior.php create mode 100644 framework/IO/ITextWriter.php delete mode 100644 framework/IRenderable.php delete mode 100644 framework/ITextWriter.php delete mode 100644 framework/IUser.php create mode 100644 framework/Security/IUser.php delete mode 100644 framework/TJavaScriptLiteral.php delete mode 100644 framework/TJavaScriptString.php create mode 100644 framework/Util/IBaseBehavior.php create mode 100644 framework/Util/IBehavior.php create mode 100644 framework/Util/IClassBehavior.php create mode 100644 framework/Web/Javascripts/TJavaScriptLiteral.php create mode 100644 framework/Web/Javascripts/TJavaScriptString.php create mode 100644 framework/Web/UI/ActiveControls/IActiveControl.php create mode 100644 framework/Web/UI/ActiveControls/ICallbackEventHandler.php create mode 100644 framework/Web/UI/IBindable.php create mode 100644 framework/Web/UI/IRenderable.php (limited to 'framework') diff --git a/framework/Caching/ICache.php b/framework/Caching/ICache.php new file mode 100644 index 00000000..f2a13f03 --- /dev/null +++ b/framework/Caching/ICache.php @@ -0,0 +1,64 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Caching + */ + +namespace Prado\Caching; + +/** + * ICache interface. + * + * This interface must be implemented by cache managers. + * + * @author Qiang Xue + * @package Prado\Caching + * @since 3.0 + */ +interface ICache +{ + /** + * Retrieves a value from cache with a specified key. + * @param string a key identifying the cached value + * @return mixed the value stored in cache, false if the value is not in the cache or expired. + */ + public function get($id); + /** + * Stores a value identified by a key into cache. + * If the cache already contains such a key, the existing value and + * expiration time will be replaced with the new ones. + * + * @param string the key identifying the value to be cached + * @param mixed the value to be cached + * @param integer the number of seconds in which the cached value will expire. 0 means never expire. + * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid. + * @return boolean true if the value is successfully stored into cache, false otherwise + */ + public function set($id,$value,$expire=0,$dependency=null); + /** + * Stores a value identified by a key into cache if the cache does not contain this key. + * Nothing will be done if the cache already contains the key. + * @param string the key identifying the value to be cached + * @param mixed the value to be cached + * @param integer the number of seconds in which the cached value will expire. 0 means never expire. + * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid. + * @return boolean true if the value is successfully stored into cache, false otherwise + */ + public function add($id,$value,$expire=0,$dependency=null); + /** + * Deletes a value with the specified key from cache + * @param string the key of the value to be deleted + * @return boolean if no error happens during deletion + */ + public function delete($id); + /** + * Deletes all values from cache. + * Be careful of performing this operation if the cache is shared by multiple applications. + */ + public function flush(); +} \ No newline at end of file diff --git a/framework/Caching/ICacheDependency.php b/framework/Caching/ICacheDependency.php new file mode 100644 index 00000000..4a81b714 --- /dev/null +++ b/framework/Caching/ICacheDependency.php @@ -0,0 +1,32 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Caching + */ + +namespace Prado\Caching; + +/** + * ICacheDependency interface. + * + * This interface must be implemented by classes meant to be used as + * cache dependencies. + * + * Classes implementing this interface must support serialization and unserialization. + * + * @author Qiang Xue + * @package Prado\Caching + * @since 3.0 + */ +interface ICacheDependency +{ + /** + * @return boolean whether the dependency has changed. Defaults to false. + */ + public function getHasChanged(); +} \ No newline at end of file diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php index 53f1069e..77c114d8 100644 --- a/framework/Caching/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -10,6 +10,7 @@ */ namespace Prado\Caching; +use Prado\Exceptions\TConfigurationException; /** * TAPCCache class diff --git a/framework/Caching/TApplicationStateCacheDependency.php b/framework/Caching/TApplicationStateCacheDependency.php index ee36ba54..db7c38d3 100644 --- a/framework/Caching/TApplicationStateCacheDependency.php +++ b/framework/Caching/TApplicationStateCacheDependency.php @@ -10,6 +10,8 @@ */ namespace Prado\Caching; +use Prado\Prado; +use Prado\TApplicationMode; /** * TApplicationStateCacheDependency class. diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php index 88a391c9..a243c236 100644 --- a/framework/Caching/TCache.php +++ b/framework/Caching/TCache.php @@ -10,7 +10,9 @@ */ namespace Prado\Caching; -Prado::using('System.Collections.TList'); +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TNotSupportedException; +use Prado\TPropertyValue; /** * TCache class @@ -38,14 +40,14 @@ Prado::using('System.Collections.TList'); * - {@link deleteValue} * and optionally {@link flush} * - * Since version 3.1.2, TCache implements the ArrayAccess interface such that + * Since version 3.1.2, TCache implements the \ArrayAccess interface such that * the cache acts as an array. * * @author Qiang Xue * @package Prado\Caching * @since 3.0 */ -abstract class TCache extends TModule implements ICache, ArrayAccess +abstract class TCache extends \Prado\TModule implements ICache, \ArrayAccess { private $_prefix=null; private $_primary=true; @@ -241,7 +243,7 @@ abstract class TCache extends TModule implements ICache, ArrayAccess /** * Returns whether there is a cache entry with a specified key. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param string a key identifying the cached value * @return boolean */ @@ -252,7 +254,7 @@ abstract class TCache extends TModule implements ICache, ArrayAccess /** * Retrieves the value from cache with a specified key. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param string a key identifying the cached value * @return mixed the value stored in cache, false if the value is not in the cache or expired. */ @@ -265,7 +267,7 @@ abstract class TCache extends TModule implements ICache, ArrayAccess * Stores the value identified by a key into cache. * If the cache already contains such a key, the existing value will be * replaced with the new ones. To add expiration and dependencies, use the set() method. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param string the key identifying the value to be cached * @param mixed the value to be cached */ @@ -276,7 +278,7 @@ abstract class TCache extends TModule implements ICache, ArrayAccess /** * Deletes the value with the specified key from cache - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ diff --git a/framework/Caching/TCacheDependency.php b/framework/Caching/TCacheDependency.php index 7b2b1261..e10793f6 100644 --- a/framework/Caching/TCacheDependency.php +++ b/framework/Caching/TCacheDependency.php @@ -39,6 +39,6 @@ namespace Prado\Caching; * @package Prado\Caching * @since 3.1.0 */ -abstract class TCacheDependency extends TComponent implements ICacheDependency +abstract class TCacheDependency extends \Prado\TComponent implements ICacheDependency { } \ No newline at end of file diff --git a/framework/Caching/TCacheDependencyList.php b/framework/Caching/TCacheDependencyList.php index 6e43d428..a093825a 100644 --- a/framework/Caching/TCacheDependencyList.php +++ b/framework/Caching/TCacheDependencyList.php @@ -10,6 +10,7 @@ */ namespace Prado\Caching; +use Prado\Exceptions\TInvalidDataTypeException; /** * TCacheDependencyList class. diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php index 968fac30..cee1b193 100644 --- a/framework/Caching/TDbCache.php +++ b/framework/Caching/TDbCache.php @@ -10,7 +10,11 @@ */ namespace Prado\Caching; -Prado::using('System.Data.TDbConnection'); +use Prado\Prado; +use Prado\Data\TDataSourceConfig; +use Prado\Data\TDbConnection; +use Prado\Exceptions\TConfigurationException; +use Prado\TPropertyValue; /** * TDbCache class @@ -201,7 +205,7 @@ class TDbCache extends TCache $this -> getApplication() -> setGlobalState($key, time()); } } - catch(Exception $e) + catch(\Exception $e) { // DB table not exists if($this->_autoCreate) @@ -464,7 +468,7 @@ class TDbCache extends TCache $command=$this->getDbConnection()->createCommand($sql); return unserialize($command->queryScalar()); } - catch(Exception $e) + catch(\Exception $e) { $this->initializeCache(true); return unserialize($command->queryScalar()); @@ -503,12 +507,12 @@ class TDbCache extends TCache try { $command=$this->getDbConnection()->createCommand($sql); - $command->bindValue(':key',$key,PDO::PARAM_STR); - $command->bindValue(':value',serialize($value),PDO::PARAM_LOB); + $command->bindValue(':key',$key,\PDO::PARAM_STR); + $command->bindValue(':value',serialize($value),\PDO::PARAM_LOB); $command->execute(); return true; } - catch(Exception $e) + catch(\Exception $e) { try { @@ -516,7 +520,7 @@ class TDbCache extends TCache $command->execute(); return true; } - catch(Exception $e) + catch(\Exception $e) { return false; } @@ -535,11 +539,11 @@ class TDbCache extends TCache try { $command=$this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable} WHERE itemkey=:key"); - $command->bindValue(':key',$key,PDO::PARAM_STR); + $command->bindValue(':key',$key,\PDO::PARAM_STR); $command->execute(); return true; } - catch(Exception $e) + catch(\Exception $e) { $this->initializeCache(true); $command->execute(); @@ -559,7 +563,7 @@ class TDbCache extends TCache $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); $command->execute(); } - catch(Exception $e) + catch(\Exception $e) { try { @@ -567,7 +571,7 @@ class TDbCache extends TCache $command->execute(); return true; } - catch(Exception $e) + catch(\Exception $e) { return false; } diff --git a/framework/Caching/TDirectoryCacheDependency.php b/framework/Caching/TDirectoryCacheDependency.php index d78aa87a..28924f12 100644 --- a/framework/Caching/TDirectoryCacheDependency.php +++ b/framework/Caching/TDirectoryCacheDependency.php @@ -10,6 +10,9 @@ */ namespace Prado\Caching; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TIOException; +use Prado\TPropertyValue; /** * TDirectoryCacheDependency class. diff --git a/framework/Caching/TEACache.php b/framework/Caching/TEACache.php index 073b7f79..29dabffa 100644 --- a/framework/Caching/TEACache.php +++ b/framework/Caching/TEACache.php @@ -1 +1 @@ - * @link http://www.pradosoft.com/ * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @package Prado\Caching */ namespace Prado\Caching; /** * TEACache class * * TEACache implements a cache application module based on {@link http://eaccelerator.net/ eAccelerator}. * * By definition, cache does not ensure the existence of a value * even if it never expires. Cache is not meant to be an persistent storage. * * To use this module, the eAccelerator PHP extension must be loaded and enabled * * Please note that as of v0.9.6, eAccelerator no longer supports data caching. * This means if you still want to use this component, your eAccelerator should be of 0.9.5.x or lower version. * * Some usage examples of TEACache are as follows, * * $cache=new TEACache; // TEACache may also be loaded as a Prado application module * $cache->init(null); * $cache->add('object',$object); * $object2=$cache->get('object'); * * * If loaded, TEACache will register itself with {@link TApplication} as the * cache module. It can be accessed via {@link TApplication::getCache()}. * * TEACache may be configured in application configuration file as follows * * * * * @author Dario Rigolin * @package Prado\Caching * @since 3.2.2 */ class TEACache extends TCache { /** * Initializes this module. * This method is required by the IModule interface. * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if eaccelerator extension is not installed or not started, check your php.ini */ public function init($config) { if(!function_exists('eaccelerator_get')) throw new TConfigurationException('eacceleratorcache_extension_required'); parent::init($config); } /** * Retrieves a value from cache with a specified key. * This is the implementation of the method declared in the parent class. * @param string a unique key identifying the cached value * @return string the value stored in cache, false if the value is not in the cache or expired. */ protected function getValue($key) { $value = eaccelerator_get($key); return ($value === null) ? false : $value; } /** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function setValue($key,$value,$expire) { return eaccelerator_put($key,$value,$expire); } /** * Stores a value identified by a key into cache if the cache does not contain this key. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function addValue($key,$value,$expire) { return (null === eaccelerator_get($key)) ? $this->setValue($key,$value,$expire) : false; } /** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return eaccelerator_rm($key); } /** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { // first, remove expired content from cache eaccelerator_gc(); // now, remove leftover cache-keys $keys = eaccelerator_list_keys(); foreach($keys as $key) $this->deleteValue(substr($key['name'], 1)); return true; } } \ No newline at end of file + * @link http://www.pradosoft.com/ * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @package Prado\Caching */ namespace Prado\Caching; use Prado\Exceptions\TConfigurationException; /** * TEACache class * * TEACache implements a cache application module based on {@link http://eaccelerator.net/ eAccelerator}. * * By definition, cache does not ensure the existence of a value * even if it never expires. Cache is not meant to be an persistent storage. * * To use this module, the eAccelerator PHP extension must be loaded and enabled * * Please note that as of v0.9.6, eAccelerator no longer supports data caching. * This means if you still want to use this component, your eAccelerator should be of 0.9.5.x or lower version. * * Some usage examples of TEACache are as follows, * * $cache=new TEACache; // TEACache may also be loaded as a Prado application module * $cache->init(null); * $cache->add('object',$object); * $object2=$cache->get('object'); * * * If loaded, TEACache will register itself with {@link TApplication} as the * cache module. It can be accessed via {@link TApplication::getCache()}. * * TEACache may be configured in application configuration file as follows * * * * * @author Dario Rigolin * @package Prado\Caching * @since 3.2.2 */ class TEACache extends TCache { /** * Initializes this module. * This method is required by the IModule interface. * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if eaccelerator extension is not installed or not started, check your php.ini */ public function init($config) { if(!function_exists('eaccelerator_get')) throw new TConfigurationException('eacceleratorcache_extension_required'); parent::init($config); } /** * Retrieves a value from cache with a specified key. * This is the implementation of the method declared in the parent class. * @param string a unique key identifying the cached value * @return string the value stored in cache, false if the value is not in the cache or expired. */ protected function getValue($key) { $value = eaccelerator_get($key); return ($value === null) ? false : $value; } /** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function setValue($key,$value,$expire) { return eaccelerator_put($key,$value,$expire); } /** * Stores a value identified by a key into cache if the cache does not contain this key. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function addValue($key,$value,$expire) { return (null === eaccelerator_get($key)) ? $this->setValue($key,$value,$expire) : false; } /** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return eaccelerator_rm($key); } /** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { // first, remove expired content from cache eaccelerator_gc(); // now, remove leftover cache-keys $keys = eaccelerator_list_keys(); foreach($keys as $key) $this->deleteValue(substr($key['name'], 1)); return true; } } \ No newline at end of file diff --git a/framework/Caching/TGlobalStateCacheDependency.php b/framework/Caching/TGlobalStateCacheDependency.php index b10b5e01..0c622445 100644 --- a/framework/Caching/TGlobalStateCacheDependency.php +++ b/framework/Caching/TGlobalStateCacheDependency.php @@ -10,6 +10,7 @@ */ namespace Prado\Caching; +use Prado\Prado; /** * TGlobalStateCacheDependency class. diff --git a/framework/Caching/TMemCache.php b/framework/Caching/TMemCache.php index 8c92bab1..659d9fd5 100644 --- a/framework/Caching/TMemCache.php +++ b/framework/Caching/TMemCache.php @@ -11,6 +11,11 @@ */ namespace Prado\Caching; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; +use Prado\TPropertyValue; +use Prado\Xml\TXmlElement; /** * TMemCache class @@ -159,7 +164,7 @@ class TMemCache extends TCache { if(!extension_loaded('memcache')) throw new TConfigurationException('memcache_extension_required'); - $this->_cache=new Memcache; + $this->_cache=new \Memcache; $this->loadConfig($config); if(count($this->_servers)) { diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php index 12d3e225..348a37f0 100644 --- a/framework/Caching/TSqliteCache.php +++ b/framework/Caching/TSqliteCache.php @@ -10,6 +10,9 @@ */ namespace Prado\Caching; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; /** * TSqliteCache class @@ -121,7 +124,7 @@ class TSqliteCache extends TCache if($this->_file===null) $this->_file=$this->getApplication()->getRuntimePath().'/sqlite.cache'; $error=''; - if(($this->_db=new SQLiteDatabase($this->_file,0666,$error))===false) + if(($this->_db=new \SQLiteDatabase($this->_file,0666,$error))===false) throw new TConfigurationException('sqlitecache_connection_failed',$error); if(@$this->_db->query('DELETE FROM '.self::CACHE_TABLE.' WHERE expire<>0 AND expire<'.time())===false) { diff --git a/framework/Caching/TXCache.php b/framework/Caching/TXCache.php index 96af68f5..6f3cf815 100644 --- a/framework/Caching/TXCache.php +++ b/framework/Caching/TXCache.php @@ -10,6 +10,7 @@ */ namespace Prado\Caching; +use Prado\Exceptions\TConfigurationException; /** * TXCache class diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php index 818d98d8..4e439bfd 100644 --- a/framework/Collections/TAttributeCollection.php +++ b/framework/Collections/TAttributeCollection.php @@ -10,11 +10,7 @@ */ namespace Prado\Collections; - -/** - * Includes TMap class - */ -Prado::using('System.Collections.TMap'); +use Prado\TPropertyValue; /** * TAttributeCollection class diff --git a/framework/Collections/TDummyDataSource.php b/framework/Collections/TDummyDataSource.php index 479a0e8f..e4aebc4c 100644 --- a/framework/Collections/TDummyDataSource.php +++ b/framework/Collections/TDummyDataSource.php @@ -26,7 +26,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TDummyDataSource extends TComponent implements IteratorAggregate, Countable +class TDummyDataSource extends \Prado\TComponent implements \IteratorAggregate, \Countable { private $_count; @@ -57,7 +57,7 @@ class TDummyDataSource extends TComponent implements IteratorAggregate, Countabl /** * Returns the number of (virtual) items in the data source. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of (virtual) items in the data source. */ public function count() diff --git a/framework/Collections/TDummyDataSourceIterator.php b/framework/Collections/TDummyDataSourceIterator.php index 4934fa7f..d03ec3d7 100644 --- a/framework/Collections/TDummyDataSourceIterator.php +++ b/framework/Collections/TDummyDataSourceIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TDummyDataSourceIterator class * - * TDummyDataSourceIterator implements Iterator interface. + * TDummyDataSourceIterator implements \Iterator interface. * * TDummyDataSourceIterator is used by {@link TDummyDataSource}. * It allows TDummyDataSource to return a new iterator @@ -24,7 +24,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TDummyDataSourceIterator implements Iterator +class TDummyDataSourceIterator implements \Iterator { private $_index; private $_count; diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index 04cbd772..c0bf8d3a 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -10,6 +10,10 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\TPropertyValue; /** * TList class @@ -36,7 +40,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable +class TList extends \Prado\TComponent implements \IteratorAggregate, \ArrayAccess, \Countable { /** * internal data storage @@ -85,17 +89,17 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl /** * Returns an iterator for traversing the items in the list. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the list. */ public function getIterator() { - return new ArrayIterator( $this->_d ); + return new \ArrayIterator( $this->_d ); } /** * Returns the number of items in the list. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the list. */ public function count() @@ -315,7 +319,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl */ public function copyFrom($data) { - if(is_array($data) || ($data instanceof Traversable)) + if(is_array($data) || ($data instanceof \Traversable)) { if($this->_c>0) $this->clear(); @@ -334,7 +338,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl */ public function mergeWith($data) { - if(is_array($data) || ($data instanceof Traversable)) + if(is_array($data) || ($data instanceof \Traversable)) { foreach($data as $item) $this->add($item); @@ -345,7 +349,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl /** * Returns whether there is an item at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to check on * @return boolean */ @@ -356,7 +360,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl /** * Returns the item at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve item. * @return mixed the item at the offset * @throws TInvalidDataValueException if the offset is invalid @@ -368,7 +372,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl /** * Sets the item at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to set item * @param mixed the item value */ @@ -385,7 +389,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl /** * Unsets the item at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to unset item */ public function offsetUnset($offset) diff --git a/framework/Collections/TListItemCollection.php b/framework/Collections/TListItemCollection.php index bb71c85d..e6637e2a 100644 --- a/framework/Collections/TListItemCollection.php +++ b/framework/Collections/TListItemCollection.php @@ -12,12 +12,9 @@ */ namespace Prado\Collections; - -/** - * Includes the supporting classes - */ -Prado::using('System.Collections.TList'); -Prado::using('System.Web.UI.WebControls.TListItem'); +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\TPropertyValue; +use Prado\Web\TListItem; /** * TListItemCollection class. diff --git a/framework/Collections/TListIterator.php b/framework/Collections/TListIterator.php index b810d5dd..268215a9 100644 --- a/framework/Collections/TListIterator.php +++ b/framework/Collections/TListIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TListIterator class * - * TListIterator implements Iterator interface. + * TListIterator implements \Iterator interface. * * TListIterator is used by TList. It allows TList to return a new iterator * for traversing the items in the list. @@ -24,7 +24,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TListIterator implements Iterator +class TListIterator implements \Iterator { /** * @var array the data to be iterated through diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php index d06028e0..3a83fa4c 100644 --- a/framework/Collections/TMap.php +++ b/framework/Collections/TMap.php @@ -10,6 +10,9 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\TPropertyValue; /** * TMap class @@ -32,7 +35,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable +class TMap extends \Prado\TComponent implements \IteratorAggregate, \ArrayAccess, \Countable { /** * @var array internal data storage @@ -75,17 +78,17 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable /** * Returns an iterator for traversing the items in the list. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the list. */ public function getIterator() { - return new ArrayIterator( $this->_d ); + return new \ArrayIterator( $this->_d ); } /** * Returns the number of items in the map. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the map. */ public function count() @@ -222,7 +225,7 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable /** * Returns whether there is an element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to check on * @return boolean */ @@ -233,7 +236,7 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable /** * Returns the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve element. * @return mixed the element at the offset, null if no element is found at the offset */ @@ -244,7 +247,7 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable /** * Sets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to set element * @param mixed the element value */ @@ -255,7 +258,7 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable /** * Unsets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to unset element */ public function offsetUnset($offset) diff --git a/framework/Collections/TMapIterator.php b/framework/Collections/TMapIterator.php index a2b813d7..303700d2 100644 --- a/framework/Collections/TMapIterator.php +++ b/framework/Collections/TMapIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TMapIterator class * - * TMapIterator implements Iterator interface. + * TMapIterator implements \Iterator interface. * * TMapIterator is used by TMap. It allows TMap to return a new iterator * for traversing the items in the map. @@ -24,7 +24,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TMapIterator implements Iterator +class TMapIterator implements \Iterator { /** * @var array the data to be iterated through diff --git a/framework/Collections/TPagedDataSource.php b/framework/Collections/TPagedDataSource.php index db929048..92a9898e 100644 --- a/framework/Collections/TPagedDataSource.php +++ b/framework/Collections/TPagedDataSource.php @@ -10,6 +10,9 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\TPropertyValue; /** * TPagedDataSource class @@ -28,7 +31,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TPagedDataSource extends TComponent implements IteratorAggregate,Countable +class TPagedDataSource extends \Prado\TComponent implements \IteratorAggregate, \Countable { /** * @var mixed original data source @@ -72,7 +75,7 @@ class TPagedDataSource extends TComponent implements IteratorAggregate,Countable { if(is_array($value)) $value=new TMap($value); - else if($value instanceof Traversable) + else if($value instanceof \Traversable) $value=new TList($value); else if($value!==null) throw new TInvalidDataTypeException('pageddatasource_datasource_invalid'); @@ -184,7 +187,7 @@ class TPagedDataSource extends TComponent implements IteratorAggregate,Countable /** * Returns the number of items in the current page. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the current page. */ public function count() diff --git a/framework/Collections/TPagedList.php b/framework/Collections/TPagedList.php index f62942c8..f324e472 100644 --- a/framework/Collections/TPagedList.php +++ b/framework/Collections/TPagedList.php @@ -10,6 +10,8 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\TPropertyValue; /** * TPagedList class @@ -331,7 +333,7 @@ class TPagedList extends TList /** * Returns whether there is an item at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to check on * @return boolean */ @@ -342,7 +344,7 @@ class TPagedList extends TList /** * Returns the item at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve item. * @return mixed the item at the offset * @throws TInvalidDataValueException if the offset is invalid diff --git a/framework/Collections/TPagedListFetchDataEventParameter.php b/framework/Collections/TPagedListFetchDataEventParameter.php index a805ab87..6c0b2cee 100644 --- a/framework/Collections/TPagedListFetchDataEventParameter.php +++ b/framework/Collections/TPagedListFetchDataEventParameter.php @@ -26,7 +26,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TPagedListFetchDataEventParameter extends TEventParameter +class TPagedListFetchDataEventParameter extends \Prado\TEventParameter { private $_pageIndex; private $_offset; diff --git a/framework/Collections/TPagedListIterator.php b/framework/Collections/TPagedListIterator.php index e63f9a22..0e23df83 100644 --- a/framework/Collections/TPagedListIterator.php +++ b/framework/Collections/TPagedListIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TPagedListIterator class * - * TPagedListIterator implements Iterator interface. + * TPagedListIterator implements \Iterator interface. * * TPagedListIterator is used by {@link TPagedDataSource}. It allows TPagedDataSource * to return a new iterator for traversing the items in a {@link TList} object. @@ -23,7 +23,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TPagedListIterator implements Iterator +class TPagedListIterator implements \Iterator { private $_list; private $_startIndex; diff --git a/framework/Collections/TPagedListPageChangedEventParameter.php b/framework/Collections/TPagedListPageChangedEventParameter.php index 476f2b05..7cf07669 100644 --- a/framework/Collections/TPagedListPageChangedEventParameter.php +++ b/framework/Collections/TPagedListPageChangedEventParameter.php @@ -21,7 +21,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TPagedListPageChangedEventParameter extends TEventParameter +class TPagedListPageChangedEventParameter extends \Prado\TEventParameter { private $_oldPage; diff --git a/framework/Collections/TPagedMapIterator.php b/framework/Collections/TPagedMapIterator.php index be223f50..87bc0a8a 100644 --- a/framework/Collections/TPagedMapIterator.php +++ b/framework/Collections/TPagedMapIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TPagedMapIterator class * - * TPagedMapIterator implements Iterator interface. + * TPagedMapIterator implements \Iterator interface. * * TPagedMapIterator is used by {@link TPagedDataSource}. It allows TPagedDataSource * to return a new iterator for traversing the items in a {@link TMap} object. @@ -23,7 +23,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TPagedMapIterator implements Iterator +class TPagedMapIterator implements \Iterator { private $_map; private $_startIndex; diff --git a/framework/Collections/TPriorityList.php b/framework/Collections/TPriorityList.php index 53486f45..27dd4017 100644 --- a/framework/Collections/TPriorityList.php +++ b/framework/Collections/TPriorityList.php @@ -10,6 +10,10 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\TPropertyValue; /** * TPriorityList class @@ -95,7 +99,7 @@ class TPriorityList extends TList /** * Returns the number of items in the list. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the list. */ public function count() @@ -164,12 +168,12 @@ class TPriorityList extends TList /** * Returns an iterator for traversing the items in the list. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the list. */ public function getIterator() { - return new ArrayIterator($this->flattenPriorities()); + return new \ArrayIterator($this->flattenPriorities()); } /** @@ -646,7 +650,7 @@ class TPriorityList extends TList foreach($data->itemsAtPriority($priority) as $index=>$item) $this->insertAtIndexInPriority($item,$index,$priority); } - } else if(is_array($data)||$data instanceof Traversable) { + } else if(is_array($data)||$data instanceof \Traversable) { if($this->getCount()>0) $this->clear(); foreach($data as $key=>$item) @@ -673,7 +677,7 @@ class TPriorityList extends TList $this->insertAtIndexInPriority($item,false,$priority); } } - else if(is_array($data)||$data instanceof Traversable) + else if(is_array($data)||$data instanceof \Traversable) { foreach($data as $priority=>$item) $this->add($item); @@ -685,7 +689,7 @@ class TPriorityList extends TList /** * Returns whether there is an element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to check on * @return boolean */ @@ -696,7 +700,7 @@ class TPriorityList extends TList /** * Returns the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve element. * @return mixed the element at the offset, null if no element is found at the offset */ @@ -706,7 +710,7 @@ class TPriorityList extends TList } /** - * Sets the element at the specified offset. This method is required by the interface ArrayAccess. + * Sets the element at the specified offset. This method is required by the interface \ArrayAccess. * Setting elements in a priority list is not straight forword when appending and setting at the * end boundary. When appending without an offset (a null offset), the item will be added at * the default priority. The item may not be the last item in the list. When appending with an @@ -733,7 +737,7 @@ class TPriorityList extends TList /** * Unsets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to unset element */ public function offsetUnset($offset) diff --git a/framework/Collections/TPriorityMap.php b/framework/Collections/TPriorityMap.php index 7cdde7f0..6f1bbba9 100644 --- a/framework/Collections/TPriorityMap.php +++ b/framework/Collections/TPriorityMap.php @@ -10,6 +10,9 @@ */ namespace Prado\Collections; +use Prado\TPropertyValue; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Exceptions\TInvalidDataTypeException; /** * TPriorityMap class @@ -55,7 +58,6 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.2a */ -Prado::using('System.Collections.TMap'); class TPriorityMap extends TMap { @@ -158,12 +160,12 @@ class TPriorityMap extends TMap /** * Returns an iterator for traversing the items in the map. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the map. */ public function getIterator() { - return new ArrayIterator($this->flattenPriorities()); + return new \ArrayIterator($this->flattenPriorities()); } @@ -194,7 +196,7 @@ class TPriorityMap extends TMap /** * Returns the number of items in the map. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the map. */ public function count() @@ -524,7 +526,7 @@ class TPriorityMap extends TMap } } } - else if(is_array($data)||$data instanceof Traversable) + else if(is_array($data)||$data instanceof \Traversable) { if($this->getCount()>0) $this->clear(); @@ -552,7 +554,7 @@ class TPriorityMap extends TMap $this->add($key,$value,$priority); } } - else if(is_array($data)||$data instanceof Traversable) + else if(is_array($data)||$data instanceof \Traversable) { foreach($data as $key=>$value) $this->add($key,$value); @@ -563,7 +565,7 @@ class TPriorityMap extends TMap /** * Returns whether there is an element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to check on * @return boolean */ @@ -574,7 +576,7 @@ class TPriorityMap extends TMap /** * Returns the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve element. * @return mixed the element at the offset, null if no element is found at the offset */ @@ -585,7 +587,7 @@ class TPriorityMap extends TMap /** * Sets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to set element * @param mixed the element value */ @@ -596,7 +598,7 @@ class TPriorityMap extends TMap /** * Unsets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to unset element */ public function offsetUnset($offset) diff --git a/framework/Collections/TQueue.php b/framework/Collections/TQueue.php index 5126e5d9..6bb38377 100644 --- a/framework/Collections/TQueue.php +++ b/framework/Collections/TQueue.php @@ -10,6 +10,8 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidOperationException; /** * TQueue class @@ -32,7 +34,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.1 */ -class TQueue extends TComponent implements IteratorAggregate,Countable +class TQueue extends \Prado\TComponent implements \IteratorAggregate, \Countable { /** * internal data storage @@ -73,7 +75,7 @@ class TQueue extends TComponent implements IteratorAggregate,Countable */ public function copyFrom($data) { - if(is_array($data) || ($data instanceof Traversable)) + if(is_array($data) || ($data instanceof \Traversable)) { $this->clear(); foreach($data as $item) @@ -146,12 +148,12 @@ class TQueue extends TComponent implements IteratorAggregate,Countable /** * Returns an iterator for traversing the items in the queue. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the queue. */ public function getIterator() { - return new ArrayIterator( $this->_d ); + return new \ArrayIterator( $this->_d ); } /** @@ -164,7 +166,7 @@ class TQueue extends TComponent implements IteratorAggregate,Countable /** * Returns the number of items in the queue. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the queue. */ public function count() diff --git a/framework/Collections/TQueueIterator.php b/framework/Collections/TQueueIterator.php index 40919686..2e454af2 100644 --- a/framework/Collections/TQueueIterator.php +++ b/framework/Collections/TQueueIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TQueueIterator class * - * TQueueIterator implements Iterator interface. + * TQueueIterator implements \Iterator interface. * * TQueueIterator is used by TQueue. It allows TQueue to return a new iterator * for traversing the items in the queue. @@ -23,7 +23,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.1 */ -class TQueueIterator implements Iterator +class TQueueIterator implements \Iterator { /** * @var array the data to be iterated through diff --git a/framework/Collections/TStack.php b/framework/Collections/TStack.php index 3c903e7e..540c213b 100644 --- a/framework/Collections/TStack.php +++ b/framework/Collections/TStack.php @@ -10,6 +10,8 @@ */ namespace Prado\Collections; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidOperationException; /** * TStack class @@ -31,7 +33,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TStack extends TComponent implements IteratorAggregate,Countable +class TStack extends \Prado\TComponent implements \IteratorAggregate, \Countable { /** * internal data storage @@ -72,7 +74,7 @@ class TStack extends TComponent implements IteratorAggregate,Countable */ public function copyFrom($data) { - if(is_array($data) || ($data instanceof Traversable)) + if(is_array($data) || ($data instanceof \Traversable)) { $this->clear(); foreach($data as $item) @@ -145,12 +147,12 @@ class TStack extends TComponent implements IteratorAggregate,Countable /** * Returns an iterator for traversing the items in the stack. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the stack. */ public function getIterator() { - return new ArrayIterator( $this->_d ); + return new \ArrayIterator( $this->_d ); } /** @@ -163,7 +165,7 @@ class TStack extends TComponent implements IteratorAggregate,Countable /** * Returns the number of items in the stack. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the stack. */ public function count() diff --git a/framework/Collections/TStackIterator.php b/framework/Collections/TStackIterator.php index 1ebc2ccd..43b1a8bd 100644 --- a/framework/Collections/TStackIterator.php +++ b/framework/Collections/TStackIterator.php @@ -14,7 +14,7 @@ namespace Prado\Collections; /** * TStackIterator class * - * TStackIterator implements Iterator interface. + * TStackIterator implements \Iterator interface. * * TStackIterator is used by TStack. It allows TStack to return a new iterator * for traversing the items in the list. @@ -24,7 +24,7 @@ namespace Prado\Collections; * @package Prado\Collections * @since 3.0 */ -class TStackIterator implements Iterator +class TStackIterator implements \Iterator { /** * @var array the data to be iterated through diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index cd115cbe..e9c79e1a 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -77,7 +77,7 @@ abstract class TActiveRecordRelation $results = call_user_func_array(array($this->getSourceRecord(),$method),$args); $validArray = is_array($results) && count($results) > 0; - if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord) + if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord) { $this->collectForeignObjects($results); while($obj = array_pop($stack)) @@ -193,7 +193,7 @@ abstract class TActiveRecordRelation */ protected function getIndexValues($keys, $results) { - if(!is_array($results) && !$results instanceof ArrayAccess) + if(!is_array($results) && !$results instanceof \ArrayAccess) $results = array($results); $values=array(); foreach($results as $result) @@ -229,7 +229,7 @@ abstract class TActiveRecordRelation */ protected function setResultCollection(&$results, &$collections, $properties) { - if(is_array($results) || $results instanceof ArrayAccess) + if(is_array($results) || $results instanceof \ArrayAccess) { for($i=0,$k=count($results);$i<$k;$i++) $this->setObjectProperty($results[$i], $properties, $collections); diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 8b295c2f..e8fcbb9a 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -146,7 +146,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelationContext'); * @package Prado\Data\ActiveRecord * @since 3.1 */ -abstract class TActiveRecord extends TComponent +abstract class TActiveRecord extends \Prado\TComponent { const BELONGS_TO='BELONGS_TO'; const HAS_ONE='HAS_ONE'; diff --git a/framework/Data/ActiveRecord/TActiveRecordChangeEventParameter.php b/framework/Data/ActiveRecord/TActiveRecordChangeEventParameter.php index 95f923df..7ee35aed 100644 --- a/framework/Data/ActiveRecord/TActiveRecordChangeEventParameter.php +++ b/framework/Data/ActiveRecord/TActiveRecordChangeEventParameter.php @@ -24,7 +24,7 @@ namespace Prado\Data\ActiveRecord; * @package Prado\Data\ActiveRecord * @since 3.1.2 */ -class TActiveRecordChangeEventParameter extends TEventParameter +class TActiveRecordChangeEventParameter extends \Prado\TEventParameter { private $_isValid=true; diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php index de0be08d..c4eaeb2c 100644 --- a/framework/Data/ActiveRecord/TActiveRecordGateway.php +++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php @@ -19,7 +19,7 @@ namespace Prado\Data\ActiveRecord; * @package Prado\Data\ActiveRecord * @since 3.1 */ -class TActiveRecordGateway extends TComponent +class TActiveRecordGateway extends \Prado\TComponent { private $_manager; private $_tables=array(); //table cache diff --git a/framework/Data/ActiveRecord/TActiveRecordManager.php b/framework/Data/ActiveRecord/TActiveRecordManager.php index 74a78e0e..63f51bfa 100644 --- a/framework/Data/ActiveRecord/TActiveRecordManager.php +++ b/framework/Data/ActiveRecord/TActiveRecordManager.php @@ -35,7 +35,7 @@ Prado::using('System.Data.ActiveRecord.TActiveRecordGateway'); * @package Prado\Data\ActiveRecord * @since 3.1 */ -class TActiveRecordManager extends TComponent +class TActiveRecordManager extends \Prado\TComponent { const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway'; diff --git a/framework/Data/Common/Oracle/TOracleTableInfo.php b/framework/Data/Common/Oracle/TOracleTableInfo.php index e3935d5f..d5c66ab8 100644 --- a/framework/Data/Common/Oracle/TOracleTableInfo.php +++ b/framework/Data/Common/Oracle/TOracleTableInfo.php @@ -19,7 +19,7 @@ namespace Prado\Data\Common\Oracle; * @package Prado\Data\Common\Oracle * @since 3.1 */ -class TOracleTableInfo extends TComponent +class TOracleTableInfo extends \Prado\TComponent { private $_info=array(); diff --git a/framework/Data/Common/TDbCommandBuilder.php b/framework/Data/Common/TDbCommandBuilder.php index 0094a964..eacc4ad4 100644 --- a/framework/Data/Common/TDbCommandBuilder.php +++ b/framework/Data/Common/TDbCommandBuilder.php @@ -19,7 +19,7 @@ namespace Prado\Data\Common; * @package Prado\Data\Common * @since 3.1 */ -class TDbCommandBuilder extends TComponent +class TDbCommandBuilder extends \Prado\TComponent { private $_connection; private $_tableInfo; diff --git a/framework/Data/Common/TDbMetaData.php b/framework/Data/Common/TDbMetaData.php index a34c18bf..4b289b1c 100644 --- a/framework/Data/Common/TDbMetaData.php +++ b/framework/Data/Common/TDbMetaData.php @@ -21,7 +21,7 @@ namespace Prado\Data\Common; * @package Prado\Data\Common * @since 3.1 */ -abstract class TDbMetaData extends TComponent +abstract class TDbMetaData extends \Prado\TComponent { private $_tableInfoCache=array(); private $_connection; diff --git a/framework/Data/Common/TDbTableColumn.php b/framework/Data/Common/TDbTableColumn.php index 1543cd46..f7c83ace 100644 --- a/framework/Data/Common/TDbTableColumn.php +++ b/framework/Data/Common/TDbTableColumn.php @@ -18,7 +18,7 @@ namespace Prado\Data\Common; * @package Prado\Data\Common * @since 3.1 */ -class TDbTableColumn extends TComponent +class TDbTableColumn extends \Prado\TComponent { const UNDEFINED_VALUE= INF; //use infinity for undefined value diff --git a/framework/Data/Common/TDbTableInfo.php b/framework/Data/Common/TDbTableInfo.php index 5fd6956c..a46a1b58 100644 --- a/framework/Data/Common/TDbTableInfo.php +++ b/framework/Data/Common/TDbTableInfo.php @@ -18,7 +18,7 @@ namespace Prado\Data\Common; * @package Prado\Data\Common * @since 3.1 */ -class TDbTableInfo extends TComponent +class TDbTableInfo extends \Prado\TComponent { private $_info=array(); diff --git a/framework/Data/DataGateway/TDataGatewayCommand.php b/framework/Data/DataGateway/TDataGatewayCommand.php index 622f7683..ee380914 100644 --- a/framework/Data/DataGateway/TDataGatewayCommand.php +++ b/framework/Data/DataGateway/TDataGatewayCommand.php @@ -34,7 +34,7 @@ namespace Prado\Data\DataGateway; * @package Prado\Data\DataGateway * @since 3.1 */ -class TDataGatewayCommand extends TComponent +class TDataGatewayCommand extends \Prado\TComponent { private $_builder; diff --git a/framework/Data/DataGateway/TDataGatewayEventParameter.php b/framework/Data/DataGateway/TDataGatewayEventParameter.php index 0ea10f6a..20649069 100644 --- a/framework/Data/DataGateway/TDataGatewayEventParameter.php +++ b/framework/Data/DataGateway/TDataGatewayEventParameter.php @@ -19,7 +19,7 @@ namespace Prado\Data\DataGateway; * @package Prado\Data\DataGateway * @since 3.1 */ -class TDataGatewayEventParameter extends TEventParameter +class TDataGatewayEventParameter extends \Prado\TEventParameter { private $_command; private $_criteria; diff --git a/framework/Data/DataGateway/TDataGatewayResultEventParameter.php b/framework/Data/DataGateway/TDataGatewayResultEventParameter.php index 05e85670..8117f21e 100644 --- a/framework/Data/DataGateway/TDataGatewayResultEventParameter.php +++ b/framework/Data/DataGateway/TDataGatewayResultEventParameter.php @@ -20,7 +20,7 @@ namespace Prado\Data\DataGateway; * @package Prado\Data\DataGateway * @since 3.1 */ -class TDataGatewayResultEventParameter extends TEventParameter +class TDataGatewayResultEventParameter extends \Prado\TEventParameter { private $_command; private $_result; diff --git a/framework/Data/DataGateway/TSqlCriteria.php b/framework/Data/DataGateway/TSqlCriteria.php index f86b18dd..a962b079 100644 --- a/framework/Data/DataGateway/TSqlCriteria.php +++ b/framework/Data/DataGateway/TSqlCriteria.php @@ -29,7 +29,7 @@ namespace Prado\Data\DataGateway; * @package Prado\Data\DataGateway * @since 3.1 */ -class TSqlCriteria extends TComponent +class TSqlCriteria extends \Prado\TComponent { /** * @var mixed @@ -178,12 +178,12 @@ class TSqlCriteria extends TComponent } /** - * @param ArrayAccess named parameters. + * @param \ArrayAccess named parameters. */ public function setParameters($value) { - if(!(is_array($value) || $value instanceof ArrayAccess)) - throw new TException('value must be array or ArrayAccess'); + if(!(is_array($value) || $value instanceof \ArrayAccess)) + throw new TException('value must be array or \ArrayAccess'); $this->_parameters->copyFrom($value); } diff --git a/framework/Data/DataGateway/TTableGateway.php b/framework/Data/DataGateway/TTableGateway.php index d415df2b..68efa7f5 100644 --- a/framework/Data/DataGateway/TTableGateway.php +++ b/framework/Data/DataGateway/TTableGateway.php @@ -76,7 +76,7 @@ Prado::using('System.Data.DataGateway.TDataGatewayCommand'); * @package Prado\Data\DataGateway * @since 3.1 */ -class TTableGateway extends TComponent +class TTableGateway extends \Prado\TComponent { private $_command; private $_connection; diff --git a/framework/Data/SqlMap/Configuration/TDiscriminator.php b/framework/Data/SqlMap/Configuration/TDiscriminator.php index 100e1816..a5cbed30 100644 --- a/framework/Data/SqlMap/Configuration/TDiscriminator.php +++ b/framework/Data/SqlMap/Configuration/TDiscriminator.php @@ -25,7 +25,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TDiscriminator extends TComponent +class TDiscriminator extends \Prado\TComponent { private $_column; private $_type; diff --git a/framework/Data/SqlMap/Configuration/TParameterMap.php b/framework/Data/SqlMap/Configuration/TParameterMap.php index 08ca6471..d1e78984 100644 --- a/framework/Data/SqlMap/Configuration/TParameterMap.php +++ b/framework/Data/SqlMap/Configuration/TParameterMap.php @@ -30,7 +30,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TParameterMap extends TComponent +class TParameterMap extends \Prado\TComponent { private $_extend; private $_properties; diff --git a/framework/Data/SqlMap/Configuration/TParameterProperty.php b/framework/Data/SqlMap/Configuration/TParameterProperty.php index d691d1f9..ee6f8838 100644 --- a/framework/Data/SqlMap/Configuration/TParameterProperty.php +++ b/framework/Data/SqlMap/Configuration/TParameterProperty.php @@ -29,7 +29,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TParameterProperty extends TComponent +class TParameterProperty extends \Prado\TComponent { private $_typeHandler; private $_type; diff --git a/framework/Data/SqlMap/Configuration/TResultMap.php b/framework/Data/SqlMap/Configuration/TResultMap.php index d4707c5d..e183438f 100644 --- a/framework/Data/SqlMap/Configuration/TResultMap.php +++ b/framework/Data/SqlMap/Configuration/TResultMap.php @@ -36,7 +36,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TResultMap extends TComponent +class TResultMap extends \Prado\TComponent { private $_columns; private $_class; diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php index 2404d2c9..59ce44a9 100644 --- a/framework/Data/SqlMap/Configuration/TResultProperty.php +++ b/framework/Data/SqlMap/Configuration/TResultProperty.php @@ -33,7 +33,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TResultProperty extends TComponent +class TResultProperty extends \Prado\TComponent { private $_nullValue; private $_propertyName; @@ -275,7 +275,7 @@ class TResultProperty extends TComponent } /** - * Determines if the type is an instance of ArrayAccess, TList or an array. + * Determines if the type is an instance of \ArrayAccess, TList or an array. * @return int TResultProperty::LIST_TYPE or TResultProperty::ARRAY_TYPE */ protected function getPropertyValueType() @@ -308,10 +308,10 @@ class TResultProperty extends TComponent } /** - * Returns true if the result property {@link Type getType()} is of ArrayAccess - * or that the actual result object is an array or implements ArrayAccess + * Returns true if the result property {@link Type getType()} is of \ArrayAccess + * or that the actual result object is an array or implements \ArrayAccess * @param object result object - * @return boolean true if the result object is an instance of ArrayAccess or is an array. + * @return boolean true if the result object is an instance of \ArrayAccess or is an array. */ public function instanceOfArrayType($target) { @@ -319,7 +319,7 @@ class TResultProperty extends TComponent { $prop = TPropertyAccess::get($target,$this->getProperty()); if(is_object($prop)) - return $prop instanceof ArrayAccess; + return $prop instanceof \ArrayAccess; return is_array($prop); } return $this->getPropertyValueType() == self::ARRAY_TYPE; diff --git a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php index 8f1aed63..393b61e6 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php @@ -32,7 +32,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TSqlMapCacheModel extends TComponent +class TSqlMapCacheModel extends \Prado\TComponent { private $_cache; private $_hits = 0; diff --git a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php index b631e1b0..7cc278b5 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapStatement.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapStatement.php @@ -28,7 +28,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TSqlMapStatement extends TComponent +class TSqlMapStatement extends \Prado\TComponent { private $_parameterMapName; private $_parameterMap; @@ -185,7 +185,7 @@ class TSqlMapStatement extends TComponent } /** - * @return string name of a PHP class that implements ArrayAccess. + * @return string name of a PHP class that implements \ArrayAccess. */ public function getListClass() { @@ -193,8 +193,8 @@ class TSqlMapStatement extends TComponent } /** - * An ArrayAccess class can be specified to handle the type of objects in the collection. - * @param string name of a PHP class that implements ArrayAccess. + * An \ArrayAccess class can be specified to handle the type of objects in the collection. + * @param string name of a PHP class that implements \ArrayAccess. */ public function setListClass($value) { @@ -256,7 +256,7 @@ class TSqlMapStatement extends TComponent /** * @param TSqlMapTypeHandlerRegistry type handler registry - * @return ArrayAccess new instance of list class. + * @return \ArrayAccess new instance of list class. */ public function createInstanceOfListClass($registry) { diff --git a/framework/Data/SqlMap/Configuration/TSubMap.php b/framework/Data/SqlMap/Configuration/TSubMap.php index c8ec3d64..c6d01e0d 100644 --- a/framework/Data/SqlMap/Configuration/TSubMap.php +++ b/framework/Data/SqlMap/Configuration/TSubMap.php @@ -23,7 +23,7 @@ namespace Prado\Data\SqlMap\Configuration; * @package Prado\Data\SqlMap\Configuration * @since 3.1 */ -class TSubMap extends TComponent +class TSubMap extends \Prado\TComponent { private $_value; private $_resultMapping; diff --git a/framework/Data/SqlMap/DataMapper/TPropertyAccess.php b/framework/Data/SqlMap/DataMapper/TPropertyAccess.php index d5956d9d..666f105b 100644 --- a/framework/Data/SqlMap/DataMapper/TPropertyAccess.php +++ b/framework/Data/SqlMap/DataMapper/TPropertyAccess.php @@ -57,7 +57,7 @@ class TPropertyAccess $properties = explode('.', $path); foreach($properties as $prop) { - if(is_array($object) || $object instanceof ArrayAccess) + if(is_array($object) || $object instanceof \ArrayAccess) { if(array_key_exists($prop, $object)) $object = $object[$prop]; @@ -94,7 +94,7 @@ class TPropertyAccess $properties = explode('.', $path); foreach($properties as $prop) { - if(is_array($object) || $object instanceof ArrayAccess) + if(is_array($object) || $object instanceof \ArrayAccess) { if(array_key_exists($prop, $object)) $object = $object[$prop]; @@ -135,7 +135,7 @@ class TPropertyAccess else $object = &$originalObject; - if(is_array($object) || $object instanceof ArrayAccess) + if(is_array($object) || $object instanceof \ArrayAccess) { $object[$prop] = $value; } diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php index 1c5c33bf..3105e80a 100644 --- a/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php +++ b/framework/Data/SqlMap/DataMapper/TSqlMapTypeHandler.php @@ -28,7 +28,7 @@ namespace Prado\Data\SqlMap\DataMapper; * @package Prado\Data\SqlMap\DataMapper * @since 3.1 */ -abstract class TSqlMapTypeHandler extends TComponent +abstract class TSqlMapTypeHandler extends \Prado\TComponent { private $_dbType='NULL'; private $_type; diff --git a/framework/Data/SqlMap/Statements/TCachingStatement.php b/framework/Data/SqlMap/Statements/TCachingStatement.php index 32dde2e7..745249e4 100644 --- a/framework/Data/SqlMap/Statements/TCachingStatement.php +++ b/framework/Data/SqlMap/Statements/TCachingStatement.php @@ -18,7 +18,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.1 */ -class TCachingStatement extends TComponent implements IMappedStatement +class TCachingStatement extends \Prado\TComponent implements IMappedStatement { private $_mappedStatement; diff --git a/framework/Data/SqlMap/Statements/TMappedStatement.php b/framework/Data/SqlMap/Statements/TMappedStatement.php index db83f755..2f7e8619 100644 --- a/framework/Data/SqlMap/Statements/TMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TMappedStatement.php @@ -21,7 +21,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.0 */ -class TMappedStatement extends TComponent implements IMappedStatement +class TMappedStatement extends \Prado\TComponent implements IMappedStatement { /** * @var TSqlMapStatement current SQL statement. @@ -226,7 +226,7 @@ class TMappedStatement extends TComponent implements IMappedStatement public function runQueryForList($connection, $parameter, $sql, $result, $delegate=null) { $registry=$this->getManager()->getTypeHandlers(); - $list = $result instanceof ArrayAccess ? $result : + $list = $result instanceof \ArrayAccess ? $result : $this->_statement->createInstanceOfListClass($registry); $connection->setActive(true); $reader = $sql->query(); @@ -581,7 +581,7 @@ class TMappedStatement extends TComponent implements IMappedStatement $resultObject = $this->_statement->createInstanceOfResultClass($registry,$row); } - if($resultObject instanceOf ArrayAccess) + if($resultObject instanceOf \ArrayAccess) return $this->fillResultArrayList($row, $resultObject); else if(is_object($resultObject)) return $this->fillResultObjectProperty($row, $resultObject); diff --git a/framework/Data/SqlMap/Statements/TPreparedStatement.php b/framework/Data/SqlMap/Statements/TPreparedStatement.php index 9084621a..b978996e 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatement.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatement.php @@ -18,7 +18,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.1 */ -class TPreparedStatement extends TComponent +class TPreparedStatement extends \Prado\TComponent { private $_sqlString=''; private $_parameterNames; diff --git a/framework/Data/SqlMap/Statements/TResultSetListItemParameter.php b/framework/Data/SqlMap/Statements/TResultSetListItemParameter.php index ec580a5a..fe954ac2 100644 --- a/framework/Data/SqlMap/Statements/TResultSetListItemParameter.php +++ b/framework/Data/SqlMap/Statements/TResultSetListItemParameter.php @@ -18,7 +18,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.1 */ -class TResultSetListItemParameter extends TComponent +class TResultSetListItemParameter extends \Prado\TComponent { private $_resultObject; private $_parameterObject; diff --git a/framework/Data/SqlMap/Statements/TResultSetMapItemParameter.php b/framework/Data/SqlMap/Statements/TResultSetMapItemParameter.php index d44cd844..53d5b9b1 100644 --- a/framework/Data/SqlMap/Statements/TResultSetMapItemParameter.php +++ b/framework/Data/SqlMap/Statements/TResultSetMapItemParameter.php @@ -18,7 +18,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.1 */ -class TResultSetMapItemParameter extends TComponent +class TResultSetMapItemParameter extends \Prado\TComponent { private $_key; private $_value; diff --git a/framework/Data/SqlMap/Statements/TSqlMapObjectCollectionTree.php b/framework/Data/SqlMap/Statements/TSqlMapObjectCollectionTree.php index cc0c300b..041eda6b 100644 --- a/framework/Data/SqlMap/Statements/TSqlMapObjectCollectionTree.php +++ b/framework/Data/SqlMap/Statements/TSqlMapObjectCollectionTree.php @@ -22,7 +22,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.1 */ -class TSqlMapObjectCollectionTree extends TComponent +class TSqlMapObjectCollectionTree extends \Prado\TComponent { /** * @var array object graph as tree diff --git a/framework/Data/SqlMap/Statements/TStaticSql.php b/framework/Data/SqlMap/Statements/TStaticSql.php index 445461b3..2434de59 100644 --- a/framework/Data/SqlMap/Statements/TStaticSql.php +++ b/framework/Data/SqlMap/Statements/TStaticSql.php @@ -18,7 +18,7 @@ namespace Prado\Data\SqlMap\Statements; * @package Prado\Data\SqlMap\Statements * @since 3.1 */ -class TStaticSql extends TComponent +class TStaticSql extends \Prado\TComponent { private $_preparedStatement; diff --git a/framework/Data/SqlMap/TSqlMapGateway.php b/framework/Data/SqlMap/TSqlMapGateway.php index 6f548256..83f90572 100644 --- a/framework/Data/SqlMap/TSqlMapGateway.php +++ b/framework/Data/SqlMap/TSqlMapGateway.php @@ -27,7 +27,7 @@ Prado::using('System.Data.SqlMap.TSqlMapManager'); * @package Prado\Data\SqlMap * @since 3.1 */ -class TSqlMapGateway extends TComponent +class TSqlMapGateway extends \Prado\TComponent { /** * @var TSqlMapManager manager diff --git a/framework/Data/SqlMap/TSqlMapManager.php b/framework/Data/SqlMap/TSqlMapManager.php index 0624c4a7..55a15b72 100644 --- a/framework/Data/SqlMap/TSqlMapManager.php +++ b/framework/Data/SqlMap/TSqlMapManager.php @@ -41,7 +41,7 @@ Prado::using('System.Caching.TCache'); * @package Prado\Data\SqlMap * @since 3.1 */ -class TSqlMapManager extends TComponent +class TSqlMapManager extends \Prado\TComponent { private $_mappedStatements; private $_resultMaps; diff --git a/framework/Data/TDataSourceConfig.php b/framework/Data/TDataSourceConfig.php index ebe948d8..f5477d30 100644 --- a/framework/Data/TDataSourceConfig.php +++ b/framework/Data/TDataSourceConfig.php @@ -46,7 +46,7 @@ Prado::using('System.Data.TDbConnection'); * @package Prado\Data * @since 3.1 */ -class TDataSourceConfig extends TModule +class TDataSourceConfig extends \Prado\TModule { private $_connID=''; private $_conn; diff --git a/framework/Data/TDbCommand.php b/framework/Data/TDbCommand.php index 7d68fd6a..61d69b3d 100644 --- a/framework/Data/TDbCommand.php +++ b/framework/Data/TDbCommand.php @@ -36,7 +36,7 @@ namespace Prado\Data; * @package Prado\Data * @since 3.0 */ -class TDbCommand extends TComponent +class TDbCommand extends \Prado\TComponent { private $_connection; private $_text=''; diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php index ed9252d0..ea07c084 100644 --- a/framework/Data/TDbConnection.php +++ b/framework/Data/TDbConnection.php @@ -81,7 +81,7 @@ Prado::using('System.Data.TDbCommand'); * @package Prado\Data * @since 3.0 */ -class TDbConnection extends TComponent +class TDbConnection extends \Prado\TComponent { /** * diff --git a/framework/Data/TDbDataReader.php b/framework/Data/TDbDataReader.php index 9aa5d5ca..5f8541d9 100644 --- a/framework/Data/TDbDataReader.php +++ b/framework/Data/TDbDataReader.php @@ -34,7 +34,7 @@ namespace Prado\Data; * @package Prado\Data * @since 3.0 */ -class TDbDataReader extends TComponent implements Iterator +class TDbDataReader extends \Prado\TComponent implements \Iterator { private $_statement; private $_closed=false; diff --git a/framework/Data/TDbTransaction.php b/framework/Data/TDbTransaction.php index 9616d623..e9c245f9 100644 --- a/framework/Data/TDbTransaction.php +++ b/framework/Data/TDbTransaction.php @@ -39,7 +39,7 @@ Prado::using('System.Data.TDbDataReader'); * @package Prado\Data * @since 3.0 */ -class TDbTransaction extends TComponent +class TDbTransaction extends \Prado\TComponent { private $_connection=null; private $_active; diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php index 13d1203f..82a483a8 100644 --- a/framework/Exceptions/TErrorHandler.php +++ b/framework/Exceptions/TErrorHandler.php @@ -10,6 +10,8 @@ */ namespace Prado\Exceptions; +use \Prado\TApplicationMode; +use \Prado\Prado; /** * TErrorHandler class @@ -49,7 +51,7 @@ namespace Prado\Exceptions; * @package Prado\Exceptions * @since 3.0 */ -class TErrorHandler extends TModule +class TErrorHandler extends \Prado\TModule { /** * error template file basename @@ -149,7 +151,7 @@ class TErrorHandler extends TModule protected static function hideSecurityRelated($value, $exception=null) { $aRpl = array(); - if($exception !== null && $exception instanceof Exception) + if($exception !== null && $exception instanceof \Exception) { $aTrace = $exception->getTrace(); foreach($aTrace as $item) diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index fb1db200..faa46abf 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -10,6 +10,8 @@ */ namespace Prado\Exceptions; +use Prado\Prado; +use Prado\TPropertyValue; /** * TException class @@ -32,7 +34,7 @@ namespace Prado\Exceptions; * @package Prado\Exceptions * @since 3.0 */ -class TException extends Exception +class TException extends \Exception { private $_errorCode=''; static $_messageCache=array(); diff --git a/framework/Exceptions/THttpException.php b/framework/Exceptions/THttpException.php index 883c2b63..39649c5d 100644 --- a/framework/Exceptions/THttpException.php +++ b/framework/Exceptions/THttpException.php @@ -10,6 +10,7 @@ */ namespace Prado\Exceptions; +use Prado\TPropertyValue; /** * THttpException class diff --git a/framework/Exceptions/TTemplateException.php b/framework/Exceptions/TTemplateException.php index 4b58df10..25b5caa5 100644 --- a/framework/Exceptions/TTemplateException.php +++ b/framework/Exceptions/TTemplateException.php @@ -10,6 +10,7 @@ */ namespace Prado\Exceptions; +use Prado\TPropertyValue; /** * TTemplateException class diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index 5ac7f616..d722d809 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -23,7 +23,7 @@ namespace Prado\I18N; * @package Prado\I18N * @since 3.0 */ -class TGlobalization extends TModule +class TGlobalization extends \Prado\TModule { /** * Default character set is 'UTF-8'. diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php index 6059e34f..0f2bc614 100644 --- a/framework/I18N/Translation.php +++ b/framework/I18N/Translation.php @@ -25,7 +25,7 @@ Prado::using('System.I18N.core.MessageFormat'); * @author Xiang Wei Zhuo * @package Prado\I18N */ -class Translation extends TComponent +class Translation extends \Prado\TComponent { /** * The array of formatters. We define 1 formatter per translation catalog diff --git a/framework/IActiveControl.php b/framework/IActiveControl.php deleted file mode 100644 index cb56f9b6..00000000 --- a/framework/IActiveControl.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IActiveControl interface. - * - * Active controls must implement IActiveControl interface. - * - * @author Wei Zhuo - * @package Prado - * @since 3.1 - */ -interface IActiveControl -{ - /** - * @return TBaseActiveControl Active control properties. - */ - public function getActiveControl(); -} \ No newline at end of file diff --git a/framework/IBaseBehavior.php b/framework/IBaseBehavior.php deleted file mode 100644 index 3a3644f0..00000000 --- a/framework/IBaseBehavior.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * Global Events, intra-object events, Class behaviors, expanded behaviors - * @author Brad Anderson - * - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IBaseBehavior interface is the base behavior class from which all other - * behaviors types are derived - * - * @author Brad Anderson - * @package Prado - * @since 3.2.3 - */ -interface IBaseBehavior { - /** - * Attaches the behavior object to the component. - * @param CComponent the component that this behavior is to be attached to. - */ - public function attach($component); - /** - * Detaches the behavior object from the component. - * @param CComponent the component that this behavior is to be detached from. - */ - public function detach($component); -} \ No newline at end of file diff --git a/framework/IBehavior.php b/framework/IBehavior.php deleted file mode 100644 index a9924106..00000000 --- a/framework/IBehavior.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * Global Events, intra-object events, Class behaviors, expanded behaviors - * @author Brad Anderson - * - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IBehavior interfaces is implemented by instance behavior classes. - * - * A behavior is a way to enhance a component with additional methods and - * events that are defined in the behavior class and not available in the - * class. Objects may signal behaviors through dynamic events. - * - * @author Brad Anderson - * @package Prado - * @since 3.2.3 - */ -interface IBehavior extends IBaseBehavior -{ - /** - * @return boolean whether this behavior is enabled - */ - public function getEnabled(); - /** - * @param boolean whether this behavior is enabled - */ - public function setEnabled($value); -} \ No newline at end of file diff --git a/framework/IBindable.php b/framework/IBindable.php deleted file mode 100644 index 073408ab..00000000 --- a/framework/IBindable.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IBindable interface. - * - * This interface must be implemented by classes that are capable of performing databinding. - * - * @author Qiang Xue - * @package Prado - * @since 3.0 - */ -interface IBindable -{ - /** - * Performs databinding. - */ - public function dataBind(); -} \ No newline at end of file diff --git a/framework/ICache.php b/framework/ICache.php deleted file mode 100644 index 3a5a5a1e..00000000 --- a/framework/ICache.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * ICache interface. - * - * This interface must be implemented by cache managers. - * - * @author Qiang Xue - * @package Prado - * @since 3.0 - */ -interface ICache -{ - /** - * Retrieves a value from cache with a specified key. - * @param string a key identifying the cached value - * @return mixed the value stored in cache, false if the value is not in the cache or expired. - */ - public function get($id); - /** - * Stores a value identified by a key into cache. - * If the cache already contains such a key, the existing value and - * expiration time will be replaced with the new ones. - * - * @param string the key identifying the value to be cached - * @param mixed the value to be cached - * @param integer the number of seconds in which the cached value will expire. 0 means never expire. - * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid. - * @return boolean true if the value is successfully stored into cache, false otherwise - */ - public function set($id,$value,$expire=0,$dependency=null); - /** - * Stores a value identified by a key into cache if the cache does not contain this key. - * Nothing will be done if the cache already contains the key. - * @param string the key identifying the value to be cached - * @param mixed the value to be cached - * @param integer the number of seconds in which the cached value will expire. 0 means never expire. - * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid. - * @return boolean true if the value is successfully stored into cache, false otherwise - */ - public function add($id,$value,$expire=0,$dependency=null); - /** - * Deletes a value with the specified key from cache - * @param string the key of the value to be deleted - * @return boolean if no error happens during deletion - */ - public function delete($id); - /** - * Deletes all values from cache. - * Be careful of performing this operation if the cache is shared by multiple applications. - */ - public function flush(); -} \ No newline at end of file diff --git a/framework/ICacheDependency.php b/framework/ICacheDependency.php deleted file mode 100644 index 06157f88..00000000 --- a/framework/ICacheDependency.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * ICacheDependency interface. - * - * This interface must be implemented by classes meant to be used as - * cache dependencies. - * - * Classes implementing this interface must support serialization and unserialization. - * - * @author Qiang Xue - * @package Prado - * @since 3.0 - */ -interface ICacheDependency -{ - /** - * @return boolean whether the dependency has changed. Defaults to false. - */ - public function getHasChanged(); -} \ No newline at end of file diff --git a/framework/ICallbackEventHandler.php b/framework/ICallbackEventHandler.php deleted file mode 100644 index 9c12c141..00000000 --- a/framework/ICallbackEventHandler.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * ICallbackEventHandler interface. - * - * If a control wants to respond to callback event, it must implement this - * interface. - * - * @author Wei Zhuo - * @package Prado - * @since 3.1 - */ -interface ICallbackEventHandler -{ - /** - * Raises callback event. The implementation of this function should raise - * appropriate event(s) (e.g. OnClick, OnCommand) indicating the component - * is responsible for the callback event. - * @param TCallbackEventParameter the parameter associated with the callback event - */ - public function raiseCallbackEvent($eventArgument); -} \ No newline at end of file diff --git a/framework/IClassBehavior.php b/framework/IClassBehavior.php deleted file mode 100644 index 37d23b4f..00000000 --- a/framework/IClassBehavior.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * Global Events, intra-object events, Class behaviors, expanded behaviors - * @author Brad Anderson - * - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IClassBehavior interface is implements behaviors across all instances of - * a particular class - * - * Any calls to functions not present in the original object but to behaviors - * derived from this class, will have inserted as the first argument parameter - * the object containing the behavior. - * - * For example: - * - * $objWithClassBehavior->MethodOfClassBehavior(1, 20); - * - * will be acted within the class behavior like this: - * - * public function MethodOfClassBehavior($object, $firstParam, $secondParam){ - * // $object === $objWithClassBehavior, $firstParam === 1, $secondParam === 20 - * } - * - * - * This also holds for 'dy' events as well. For dynamic events, method arguments would be: - * - * public function dyMethodOfClassBehavior($object, $firstParam, $secondParam, $callchain){ - * // $object === $objWithClassBehavior, $firstParam === 1, $secondParam === 20, $callchain instanceof {@link TCallChain} - * } - * - * - * @author Brad Anderson - * @package Prado - * @since 3.2.3 - */ -interface IClassBehavior extends IBaseBehavior { -} \ No newline at end of file diff --git a/framework/IO/ITextWriter.php b/framework/IO/ITextWriter.php new file mode 100644 index 00000000..d22e5cfe --- /dev/null +++ b/framework/IO/ITextWriter.php @@ -0,0 +1,34 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\IO + */ + +namespace Prado\IO; + +/** + * ITextWriter interface. + * + * This interface must be implemented by writers. + * + * @author Qiang Xue + * @package Prado\IO + * @since 3.0 + */ +interface ITextWriter +{ + /** + * Writes a string. + * @param string string to be written + */ + public function write($str); + /** + * Flushes the content that has been written. + */ + public function flush(); +} \ No newline at end of file diff --git a/framework/IO/TTarFileExtractor.php b/framework/IO/TTarFileExtractor.php index e8eee004..672ea59b 100644 --- a/framework/IO/TTarFileExtractor.php +++ b/framework/IO/TTarFileExtractor.php @@ -126,7 +126,7 @@ class TTarFileExtractor protected function _error($p_message) { - throw new Exception($p_message); + throw new \Exception($p_message); } private function _isArchive($p_filename=null) diff --git a/framework/IO/TTextWriter.php b/framework/IO/TTextWriter.php index d9033b81..c47bc410 100644 --- a/framework/IO/TTextWriter.php +++ b/framework/IO/TTextWriter.php @@ -22,7 +22,7 @@ namespace Prado\IO; * @package Prado\IO * @since 3.0 */ -class TTextWriter extends TComponent implements ITextWriter +class TTextWriter extends \Prado\TComponent implements \Prado\IO\ITextWriter { private $_str=''; diff --git a/framework/IRenderable.php b/framework/IRenderable.php deleted file mode 100644 index 3283ddfc..00000000 --- a/framework/IRenderable.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IRenderable interface. - * - * This interface must be implemented by classes that can be rendered - * to end-users. - * - * @author Qiang Xue - * @package Prado - * @since 3.0 - */ -interface IRenderable -{ - /** - * Renders the component to end-users. - * @param ITextWriter writer for the rendering purpose - */ - public function render($writer); -} \ No newline at end of file diff --git a/framework/ITextWriter.php b/framework/ITextWriter.php deleted file mode 100644 index 9b85cfe8..00000000 --- a/framework/ITextWriter.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * ITextWriter interface. - * - * This interface must be implemented by writers. - * - * @author Qiang Xue - * @package Prado - * @since 3.0 - */ -interface ITextWriter -{ - /** - * Writes a string. - * @param string string to be written - */ - public function write($str); - /** - * Flushes the content that has been written. - */ - public function flush(); -} \ No newline at end of file diff --git a/framework/IUser.php b/framework/IUser.php deleted file mode 100644 index 893eb5f3..00000000 --- a/framework/IUser.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * IUser interface. - * - * This interface must be implemented by user objects. - * - * @author Qiang Xue - * @package Prado - * @since 3.0 - */ -interface IUser -{ - /** - * @return string username - */ - public function getName(); - /** - * @param string username - */ - public function setName($value); - /** - * @return boolean if the user is a guest - */ - public function getIsGuest(); - /** - * @param boolean if the user is a guest - */ - public function setIsGuest($value); - /** - * @return array list of roles that the user is of - */ - public function getRoles(); - /** - * @return array|string list of roles that the user is of. If it is a string, roles are assumed by separated by comma - */ - public function setRoles($value); - /** - * @param string role to be tested - * @return boolean whether the user is of this role - */ - public function isInRole($role); - /** - * @return string user data that is serialized and will be stored in session - */ - public function saveToString(); - /** - * @param string user data that is serialized and restored from session - * @return IUser the user object - */ - public function loadFromString($string); -} \ No newline at end of file diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 21c26b6a..20c79112 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -13,12 +13,17 @@ */ namespace Prado; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Exceptions\TPhpErrorException; +use Prado\Util\TLogger; +use Prado\Util\TVarDumper; +use Prado\I18N\Translation; /** * Defines the PRADO framework installation path. */ if(!defined('PRADO_DIR')) - define('PRADO_DIR',dirname(__FILE__)); + define('PRADO_DIR', __DIR__); /** * Defines the default permission for writable directories and files */ @@ -61,11 +66,6 @@ class PradoBase */ private static $_logger=null; - /** - * @var array list of class exists checks - */ - protected static $classExists = array(); - /** * @return string the version of Prado framework */ @@ -84,23 +84,11 @@ class PradoBase /** * Sets error handler to be Prado::phpErrorHandler */ - set_error_handler(array('PradoBase','phpErrorHandler')); + set_error_handler(array('\Prado\PradoBase','phpErrorHandler')); /** * Sets exception handler to be Prado::exceptionHandler */ - set_exception_handler(array('PradoBase','exceptionHandler')); - } - - /** - * Class autoload loader. - * This method is provided to be invoked within an __autoload() magic method. - * @param string class name - */ - 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."); + set_exception_handler(array('\Prado\PradoBase','exceptionHandler')); } /** @@ -190,12 +178,26 @@ class PradoBase return PRADO_DIR; } + /** + * Convert old Prado namespaces to PHP namespaces + * @param string old class name in Prado3 namespace format + * @return string Equivalent class name in PHP namespace format + */ + + protected static function prado3NamespaceToPhpNamespace(&$type) + { + if(substr($type, 0, 6) === 'System') + $type='Prado'.substr($type, 6); + + return str_replace($type, '.', '\\'); + } + /** * Creates a component with the specified type. * A component type can be either the component class name * or a namespace referring to the path of the component class file. - * For example, 'TButton', 'System.Web.UI.WebControls.TButton' are both - * valid component type. + * For example, 'TButton', '\Prado\Web|UI\WeControls\', + * 'System.Web.UI.WebControls.TButton' are valid component type. * This method can also pass parameters to component constructors. * All parameters passed to this method except the first one (the component type) * will be supplied as component constructor parameters. @@ -205,19 +207,15 @@ class PradoBase */ public static function createComponent($type) { - if(!isset(self::$classExists[$type])) - self::$classExists[$type] = class_exists($type, false); + self::prado3NamespaceToPhpNamespace($type); - if( !isset(self::$_usings[$type]) && !self::$classExists[$type]) { - self::using($type); - self::$classExists[$type] = class_exists($type, false); - } - - if( ($pos = strrpos($type, '.')) !== false) - $type = substr($type,$pos+1); + if(!class_exists($type,true) && !interface_exists($type,true)) + self::fatalError("Class file for '$type' cannot be found."); + // Instanciate the object if(($n=func_num_args())>1) { + // ReflectionClass::newInstanceArgs can't accept refereces $args = func_get_args(); switch($n) { case 2: @@ -256,15 +254,17 @@ class PradoBase */ public static function using($namespace,$checkClassExistence=true) { + self::prado3NamespaceToPhpNamespace($type); + if(isset(self::$_usings[$namespace]) || class_exists($namespace,false)) return; - if(($pos=strrpos($namespace,'.'))===false) // a class name + if(($pos=strrpos($namespace,'\\'))===false) // a class name { try { include_once($namespace.self::CLASS_FILE_EXT); } - catch(Exception $e) + catch(\Exception $e) { if($checkClassExistence && !class_exists($namespace,false)) throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage()); @@ -289,7 +289,7 @@ class PradoBase { include_once($path); } - catch(Exception $e) + catch(\Exception $e) { if($checkClassExistence && !class_exists($className,false)) throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage()); @@ -317,6 +317,8 @@ class PradoBase */ public static function getPathOfNamespace($namespace, $ext='') { + self::prado3NamespaceToPhpNamespace($namespace); + if(self::CLASS_FILE_EXT === $ext || empty($ext)) { if(isset(self::$_usings[$namespace])) @@ -326,7 +328,7 @@ class PradoBase return self::$_aliases[$namespace]; } - $segs = explode('.',$namespace); + $segs = explode('\\',$namespace); $alias = array_shift($segs); if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias))) @@ -569,7 +571,6 @@ class PradoBase */ public static function localize($text, $parameters=array(), $catalogue=null, $charset=null) { - Prado::using('System.I18N.Translation'); $app = Prado::getApplication()->getGlobalization(false); $params = array(); @@ -598,11 +599,3 @@ class PradoBase return Translation::formatter($catalogue)->format($text,$params,$catalogue,$charset); } } - - -/** - * Includes the classes essential for PradoBase class - */ -PradoBase::using('System.TComponent'); -PradoBase::using('System.Exceptions.TException'); -PradoBase::using('System.Util.TLogger'); diff --git a/framework/Security/IUser.php b/framework/Security/IUser.php new file mode 100644 index 00000000..fd7db297 --- /dev/null +++ b/framework/Security/IUser.php @@ -0,0 +1,63 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Security + */ + +namespace Prado\Security; + +/** + * IUser interface. + * + * This interface must be implemented by user objects. + * + * @author Qiang Xue + * @package Prado\Security + * @since 3.0 + */ +interface IUser +{ + /** + * @return string username + */ + public function getName(); + /** + * @param string username + */ + public function setName($value); + /** + * @return boolean if the user is a guest + */ + public function getIsGuest(); + /** + * @param boolean if the user is a guest + */ + public function setIsGuest($value); + /** + * @return array list of roles that the user is of + */ + public function getRoles(); + /** + * @return array|string list of roles that the user is of. If it is a string, roles are assumed by separated by comma + */ + public function setRoles($value); + /** + * @param string role to be tested + * @return boolean whether the user is of this role + */ + public function isInRole($role); + /** + * @return string user data that is serialized and will be stored in session + */ + public function saveToString(); + /** + * @param string user data that is serialized and restored from session + * @return IUser the user object + */ + public function loadFromString($string); +} \ No newline at end of file diff --git a/framework/Security/TAuthManager.php b/framework/Security/TAuthManager.php index be83b695..0e1db884 100644 --- a/framework/Security/TAuthManager.php +++ b/framework/Security/TAuthManager.php @@ -10,11 +10,11 @@ */ namespace Prado\Security; - -/** - * Using IUserManager interface - */ -Prado::using('System.Security.IUserManager'); +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\TPropertyValue; +use Prado\Web\Services\TPageService; +use Prado\Web\THttpCookie; /** * TAuthManager class @@ -41,7 +41,7 @@ Prado::using('System.Security.IUserManager'); * @package Prado\Security * @since 3.0 */ -class TAuthManager extends TModule +class TAuthManager extends \Prado\TModule { /** * GET variable name for return url diff --git a/framework/Security/TAuthorizationRule.php b/framework/Security/TAuthorizationRule.php index ce0835de..6fffbf35 100644 --- a/framework/Security/TAuthorizationRule.php +++ b/framework/Security/TAuthorizationRule.php @@ -10,6 +10,7 @@ */ namespace Prado\Security; +use Prado\Exceptions\TInvalidDataValueException; /** * TAuthorizationRule class @@ -30,7 +31,7 @@ namespace Prado\Security; * @package Prado\Security * @since 3.0 */ -class TAuthorizationRule extends TComponent +class TAuthorizationRule extends \Prado\TComponent { /** * @var string action, either 'allow' or 'deny' diff --git a/framework/Security/TAuthorizationRuleCollection.php b/framework/Security/TAuthorizationRuleCollection.php index a2356a92..bee3e1fa 100644 --- a/framework/Security/TAuthorizationRuleCollection.php +++ b/framework/Security/TAuthorizationRuleCollection.php @@ -10,6 +10,7 @@ */ namespace Prado\Security; +use Prado\Exceptions\TInvalidDataTypeException; /** * TAuthorizationRuleCollection class. @@ -20,7 +21,7 @@ namespace Prado\Security; * @package Prado\Security * @since 3.0 */ -class TAuthorizationRuleCollection extends TList +class TAuthorizationRuleCollection extends \Prado\Collections\TList { /** * @param IUser the user to be authorized diff --git a/framework/Security/TDbUser.php b/framework/Security/TDbUser.php index 8b30e0f3..fec4795c 100644 --- a/framework/Security/TDbUser.php +++ b/framework/Security/TDbUser.php @@ -10,6 +10,7 @@ */ namespace Prado\Security; +use Prado\Data\TDbConnection; /** * TDbUser class diff --git a/framework/Security/TDbUserManager.php b/framework/Security/TDbUserManager.php index 4d04ece1..93e48159 100644 --- a/framework/Security/TDbUserManager.php +++ b/framework/Security/TDbUserManager.php @@ -10,13 +10,10 @@ */ namespace Prado\Security; - -/** - * Using IUserManager interface - */ -Prado::using('System.Security.IUserManager'); -Prado::using('System.Data.TDataSourceConfig'); -Prado::using('System.Security.TUser'); +use Prado\Data\TDataSourceConfig; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Prado; /** * TDbUserManager class @@ -48,7 +45,7 @@ Prado::using('System.Security.TUser'); * @package Prado\Security * @since 3.1.0 */ -class TDbUserManager extends TModule implements IUserManager +class TDbUserManager extends \Prado\TModule implements IUserManager { private $_connID=''; private $_conn; diff --git a/framework/Security/TSecurityManager.php b/framework/Security/TSecurityManager.php index 57d2f70a..e0239f8e 100644 --- a/framework/Security/TSecurityManager.php +++ b/framework/Security/TSecurityManager.php @@ -10,6 +10,9 @@ */ namespace Prado\Security; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TNotSupportedException; +use Prado\TPropertyValue; /** * TSecurityManager class @@ -39,7 +42,7 @@ namespace Prado\Security; * @package Prado\Security * @since 3.0 */ -class TSecurityManager extends TModule +class TSecurityManager extends \Prado\TModule { const STATE_VALIDATION_KEY = 'prado:securitymanager:validationkey'; const STATE_ENCRYPTION_KEY = 'prado:securitymanager:encryptionkey'; diff --git a/framework/Security/TUser.php b/framework/Security/TUser.php index cf89e46f..c30bc6eb 100644 --- a/framework/Security/TUser.php +++ b/framework/Security/TUser.php @@ -10,11 +10,7 @@ */ namespace Prado\Security; - -/** - * Using IUserManager interface - */ -Prado::using('System.Security.IUserManager'); +use Prado\TPropertyValue; /** * TUser class @@ -31,7 +27,7 @@ Prado::using('System.Security.IUserManager'); * @package Prado\Security * @since 3.0 */ -class TUser extends TComponent implements IUser +class TUser extends \Prado\TComponent implements IUser { /** * @var array persistent state diff --git a/framework/Security/TUserManager.php b/framework/Security/TUserManager.php index 361f0e5b..1b72c44e 100644 --- a/framework/Security/TUserManager.php +++ b/framework/Security/TUserManager.php @@ -10,11 +10,11 @@ */ namespace Prado\Security; - -/** - * Using TUser class - */ -Prado::using('System.Security.TUser'); +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\TApplication; +use Prado\TPropertyValue; +use Prado\Xml\TXmlDocument; /** * TUserManager class @@ -68,7 +68,7 @@ Prado::using('System.Security.TUser'); * @package Prado\Security * @since 3.0 */ -class TUserManager extends TModule implements IUserManager +class TUserManager extends \Prado\TModule implements IUserManager { /** * extension name to the user file diff --git a/framework/TApplication.php b/framework/TApplication.php index f8b5d256..63ea72b8 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -10,35 +10,15 @@ */ namespace Prado; - -/** - * Includes core interfaces essential for TApplication class - */ -require_once(PRADO_DIR.'/interfaces.php'); - -/** - * Includes core classes essential for TApplication class - */ -Prado::using('System.TApplicationComponent'); -Prado::using('System.TModule'); -Prado::using('System.TService'); -Prado::using('System.Exceptions.TErrorHandler'); -Prado::using('System.Caching.TCache'); -Prado::using('System.IO.TTextWriter'); -Prado::using('System.Collections.TPriorityList'); -Prado::using('System.Collections.TPriorityMap'); -Prado::using('System.Collections.TStack'); -Prado::using('System.Xml.TXmlDocument'); -Prado::using('System.Security.TAuthorizationRule'); -Prado::using('System.Security.TSecurityManager'); -Prado::using('System.Web.THttpUtility'); -Prado::using('System.Web.Javascripts.TJavaScript'); -Prado::using('System.Web.THttpRequest'); -Prado::using('System.Web.THttpResponse'); -Prado::using('System.Web.THttpSession'); -Prado::using('System.Web.Services.TPageService'); -Prado::using('System.Web.TAssetManager'); -Prado::using('System.I18N.TGlobalization'); +use Prado\Exceptions\TErrorHandler; +use Prado\Exceptions\THttpException; +use Prado\Exceptions\TConfigurationException; +use Prado\Security\TSecurityManager; +use Prado\Web\TAssetManager; +use Prado\Web\THttpRequest; +use Prado\Web\THttpResponse; +use Prado\Web\THttpSession; +use Prado\Util\TLogger; /** * TApplication class. @@ -109,7 +89,7 @@ Prado::using('System.I18N.TGlobalization'); * @package Prado * @since 3.0 */ -class TApplication extends TComponent +class TApplication extends \Prado\TComponent { /** * possible application mode. @@ -213,7 +193,7 @@ class TApplication extends TComponent */ private $_lazyModules=array(); /** - * @var TMap list of application parameters + * @var \Prado\Collections\TMap list of application parameters */ private $_parameters; /** @@ -332,7 +312,7 @@ class TApplication extends TComponent // generates unique ID by hashing the runtime path $this->_uniqueID=md5($this->_runtimePath); - $this->_parameters=new TMap; + $this->_parameters=new \Prado\Collections\TMap; $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); Prado::setPathOfAlias('Application',$this->_basePath); @@ -411,7 +391,7 @@ class TApplication extends TComponent $this->_step++; } } - catch(Exception $e) + catch(\Exception $e) { $this->onError($e); } @@ -691,7 +671,7 @@ class TApplication extends TComponent * @param string ID of the module * @param IModule module object or null if the module has not been loaded yet */ - public function setModule($id,IModule $module=null) + public function setModule($id, IModule $module=null) { if(isset($this->_modules[$id])) throw new TConfigurationException('application_moduleid_duplicated',$id); @@ -729,9 +709,9 @@ class TApplication extends TComponent /** * Returns the list of application parameters. - * Since the parameters are returned as a {@link TMap} object, you may use + * Since the parameters are returned as a {@link \Prado\Collections\TMap} object, you may use * the returned result to access, add or remove individual parameters. - * @return TMap the list of application parameters + * @return \Prado\Collections\TMap the list of application parameters */ public function getParameters() { @@ -745,7 +725,7 @@ class TApplication extends TComponent { if(!$this->_request) { - $this->_request=new THttpRequest; + $this->_request=new \Prado\Web\THttpRequest; $this->_request->init(null); } return $this->_request; @@ -896,7 +876,7 @@ class TApplication extends TComponent /** * @param ICache the cache module */ - public function setCache(ICache $cache) + public function setCache(\Prado\Caching\ICache $cache) { $this->_cache=$cache; } @@ -912,7 +892,7 @@ class TApplication extends TComponent /** * @param IUser the application user */ - public function setUser(IUser $user) + public function setUser(\Prado\Security\IUser $user) { $this->_user=$user; } @@ -934,7 +914,7 @@ class TApplication extends TComponent /** * @param TGlobalization globalization module */ - public function setGlobalization(TGlobalization $glob) + public function setGlobalization(\Prado\I18N\TGlobalization $glob) { $this->_globalization=$glob; } @@ -945,13 +925,13 @@ class TApplication extends TComponent public function getAuthorizationRules() { if($this->_authRules===null) - $this->_authRules=new TAuthorizationRuleCollection; + $this->_authRules=new \Prado\Security\TAuthorizationRuleCollection; return $this->_authRules; } protected function getApplicationConfigurationClass() { - return 'TApplicationConfiguration'; + return '\Prado\TApplicationConfiguration'; } protected function internalLoadModule($id, $force=false) @@ -959,12 +939,12 @@ class TApplication extends TComponent list($moduleClass, $initProperties, $configElement)=$this->_lazyModules[$id]; if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force) { - Prado::trace("Postponed loading of lazy module $id ({$moduleClass})",'System.TApplication'); + Prado::trace("Postponed loading of lazy module $id ({$moduleClass})",'\Prado\TApplication'); $this->setModule($id, null); return null; } - Prado::trace("Loading module $id ({$moduleClass})",'System.TApplication'); + Prado::trace("Loading module $id ({$moduleClass})",'\Prado\TApplication'); $module=Prado::createComponent($moduleClass); foreach($initProperties as $name=>$value) { diff --git a/framework/TApplicationComponent.php b/framework/TApplicationComponent.php index da976549..855261a5 100644 --- a/framework/TApplicationComponent.php +++ b/framework/TApplicationComponent.php @@ -32,7 +32,7 @@ namespace Prado; * @package Prado * @since 3.0 */ -class TApplicationComponent extends TComponent +class TApplicationComponent extends \Prado\TComponent { /** * @return TApplication current application instance @@ -100,7 +100,7 @@ class TApplicationComponent extends TComponent { if($className===null) $className=get_class($this); - $class=new ReflectionClass($className); + $class=new \ReflectionClass($className); $fullPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$assetPath; return $this->publishFilePath($fullPath); } diff --git a/framework/TApplicationConfiguration.php b/framework/TApplicationConfiguration.php index 46836bb5..19f24cb1 100644 --- a/framework/TApplicationConfiguration.php +++ b/framework/TApplicationConfiguration.php @@ -10,6 +10,8 @@ */ namespace Prado; +use Prado\Exceptions\TConfigurationException; +use Prado\Xml\TXmlDocument; /** * TApplicationConfiguration class. @@ -21,7 +23,7 @@ namespace Prado; * @package Prado * @since 3.0 */ -class TApplicationConfiguration extends TComponent +class TApplicationConfiguration extends \Prado\TComponent { /** * @var array list of application initial property values, indexed by property names diff --git a/framework/TApplicationStatePersister.php b/framework/TApplicationStatePersister.php index 1689b816..2d6f5e9e 100644 --- a/framework/TApplicationStatePersister.php +++ b/framework/TApplicationStatePersister.php @@ -22,7 +22,7 @@ namespace Prado; * @package Prado * @since 3.0 */ -class TApplicationStatePersister extends TModule implements IStatePersister +class TApplicationStatePersister extends \Prado\TModule implements IStatePersister { /** * Name of the value stored in cache diff --git a/framework/TClassBehaviorEventParameter.php b/framework/TClassBehaviorEventParameter.php index f28a9e04..9c555ccf 100644 --- a/framework/TClassBehaviorEventParameter.php +++ b/framework/TClassBehaviorEventParameter.php @@ -23,7 +23,7 @@ namespace Prado; * @package Prado * @since 3.2.3 */ -class TClassBehaviorEventParameter extends TEventParameter +class TClassBehaviorEventParameter extends \Prado\TEventParameter { private $_class; private $_name; diff --git a/framework/TComponentReflection.php b/framework/TComponentReflection.php index 27ba50b3..66fb5547 100644 --- a/framework/TComponentReflection.php +++ b/framework/TComponentReflection.php @@ -14,7 +14,7 @@ */ namespace Prado; - +use Prado\Exceptions\TInvalidDataTypeException; /** * TComponentReflection class. * @@ -32,7 +32,7 @@ namespace Prado; * @package Prado * @since 3.0 */ -class TComponentReflection extends TComponent +class TComponentReflection extends \Prado\TComponent { private $_className; private $_properties=array(); @@ -72,7 +72,7 @@ class TComponentReflection extends TComponent private function reflect() { - $class=new ReflectionClass($this->_className); + $class=new \ReflectionClass($this->_className); $properties=array(); $events=array(); $methods=array(); diff --git a/framework/TEnumerable.php b/framework/TEnumerable.php index 45283933..172e7870 100644 --- a/framework/TEnumerable.php +++ b/framework/TEnumerable.php @@ -36,12 +36,12 @@ namespace Prado; * @package Prado * @since 3.0 */ -class TEnumerable implements Iterator +class TEnumerable implements \Iterator { private $_enums=array(); public function __construct() { - $reflection=new ReflectionClass($this); + $reflection=new \ReflectionClass($this); $this->_enums=$reflection->getConstants(); } diff --git a/framework/TEventParameter.php b/framework/TEventParameter.php index 4a80b8b0..d85bac2e 100644 --- a/framework/TEventParameter.php +++ b/framework/TEventParameter.php @@ -23,6 +23,6 @@ namespace Prado; * @package Prado * @since 3.0 */ -class TEventParameter extends TComponent +class TEventParameter extends \Prado\TComponent { } \ No newline at end of file diff --git a/framework/TJavaScriptLiteral.php b/framework/TJavaScriptLiteral.php deleted file mode 100644 index 56dc6e85..00000000 --- a/framework/TJavaScriptLiteral.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * Global Events, intra-object events, Class behaviors, expanded behaviors - * @author Brad Anderson - * - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * TJavaScriptLiteral class that encloses string literals that are not - * supposed to be escaped by {@link TJavaScript::encode() } - * - * Since Prado 3.2 all the data that gets sent clientside inside a javascript statement - * is encoded by default to avoid any kind of injection. - * Sometimes there's the need to bypass this encoding and send raw javascript code. - * To ensure that a string doesn't get encoded by {@link TJavaScript::encode() }, - * construct a new TJavaScriptLiteral: - * - * // a javascript test string - * $js="alert('hello')"; - * // the string in $raw will not be encoded when sent clientside inside a javascript block - * $raw=new TJavaScriptLiteral($js); - * // shortened form - * $raw=_js($js); - * - * - * @package Prado - * @since 3.2.0 - */ -class TJavaScriptLiteral -{ - protected $_s; - - public function __construct($s) - { - $this->_s = $s; - } - - public function __toString() - { - return (string)$this->_s; - } - - public function toJavaScriptLiteral() - { - return $this->__toString(); - } -} \ No newline at end of file diff --git a/framework/TJavaScriptString.php b/framework/TJavaScriptString.php deleted file mode 100644 index 76280ff7..00000000 --- a/framework/TJavaScriptString.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * Global Events, intra-object events, Class behaviors, expanded behaviors - * @author Brad Anderson - * - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ - * @package Prado - */ - -namespace Prado; - -/** - * TJavaScriptString class is an internal class that marks strings that will be - * forcibly encoded when rendered inside a javascript block - * - * @package Prado - * @since 3.2.0 - */ -class TJavaScriptString extends TJavaScriptLiteral -{ - public function toJavaScriptLiteral() - { - return TJavaScript::jsonEncode((string)$this->_s,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG); - } -} \ No newline at end of file diff --git a/framework/TModule.php b/framework/TModule.php index 1c4f40b1..eaf9bcc0 100644 --- a/framework/TModule.php +++ b/framework/TModule.php @@ -21,7 +21,7 @@ namespace Prado; * @package Prado * @since 3.0 */ -abstract class TModule extends TApplicationComponent implements IModule +abstract class TModule extends \Prado\TApplicationComponent implements IModule { /** * @var string module id diff --git a/framework/TPropertyValue.php b/framework/TPropertyValue.php index a920cc4a..8c106f82 100644 --- a/framework/TPropertyValue.php +++ b/framework/TPropertyValue.php @@ -14,6 +14,8 @@ */ namespace Prado; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Web\Javascripts\TJavascript; /** * TPropertyValue class @@ -74,7 +76,7 @@ class TPropertyValue */ public static function ensureString($value) { - if (TJavaScript::isJsLiteral($value)) + if (TJavascript::isJsLiteral($value)) return $value; if (is_bool($value)) return $value?'true':'false'; @@ -161,7 +163,7 @@ class TPropertyValue if(func_num_args()===2 && is_string($enums)) { if(!isset($types[$enums])) - $types[$enums]=new ReflectionClass($enums); + $types[$enums]=new \ReflectionClass($enums); if($types[$enums]->hasConstant($value)) return $value; else diff --git a/framework/TService.php b/framework/TService.php index c3f40c44..3fae286d 100644 --- a/framework/TService.php +++ b/framework/TService.php @@ -21,7 +21,7 @@ namespace Prado; * @package Prado * @since 3.0 */ -abstract class TService extends TApplicationComponent implements IService +abstract class TService extends \Prado\TApplicationComponent implements IService { /** * @var string service id diff --git a/framework/Util/IBaseBehavior.php b/framework/Util/IBaseBehavior.php new file mode 100644 index 00000000..2f2ca858 --- /dev/null +++ b/framework/Util/IBaseBehavior.php @@ -0,0 +1,37 @@ + + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Util + */ + +namespace Prado\Util; + +/** + * IBaseBehavior interface is the base behavior class from which all other + * behaviors types are derived + * + * @author Brad Anderson + * @package Prado\Util + * @since 3.2.3 + */ +interface IBaseBehavior { + /** + * Attaches the behavior object to the component. + * @param CComponent the component that this behavior is to be attached to. + */ + public function attach($component); + /** + * Detaches the behavior object from the component. + * @param CComponent the component that this behavior is to be detached from. + */ + public function detach($component); +} \ No newline at end of file diff --git a/framework/Util/IBehavior.php b/framework/Util/IBehavior.php new file mode 100644 index 00000000..6b5e92d1 --- /dev/null +++ b/framework/Util/IBehavior.php @@ -0,0 +1,39 @@ + + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Util + */ + +namespace Prado\Util; + +/** + * IBehavior interfaces is implemented by instance behavior classes. + * + * A behavior is a way to enhance a component with additional methods and + * events that are defined in the behavior class and not available in the + * class. Objects may signal behaviors through dynamic events. + * + * @author Brad Anderson + * @package Prado\Util + * @since 3.2.3 + */ +interface IBehavior extends IBaseBehavior +{ + /** + * @return boolean whether this behavior is enabled + */ + public function getEnabled(); + /** + * @param boolean whether this behavior is enabled + */ + public function setEnabled($value); +} \ No newline at end of file diff --git a/framework/Util/IClassBehavior.php b/framework/Util/IClassBehavior.php new file mode 100644 index 00000000..ee708c06 --- /dev/null +++ b/framework/Util/IClassBehavior.php @@ -0,0 +1,49 @@ + + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Util + */ + +namespace Prado\Util; + +/** + * IClassBehavior interface is implements behaviors across all instances of + * a particular class + * + * Any calls to functions not present in the original object but to behaviors + * derived from this class, will have inserted as the first argument parameter + * the object containing the behavior. + * + * For example: + * + * $objWithClassBehavior->MethodOfClassBehavior(1, 20); + * + * will be acted within the class behavior like this: + * + * public function MethodOfClassBehavior($object, $firstParam, $secondParam){ + * // $object === $objWithClassBehavior, $firstParam === 1, $secondParam === 20 + * } + * + * + * This also holds for 'dy' events as well. For dynamic events, method arguments would be: + * + * public function dyMethodOfClassBehavior($object, $firstParam, $secondParam, $callchain){ + * // $object === $objWithClassBehavior, $firstParam === 1, $secondParam === 20, $callchain instanceof {@link TCallChain} + * } + * + * + * @author Brad Anderson + * @package Prado\Util + * @since 3.2.3 + */ +interface IClassBehavior extends IBaseBehavior { +} \ No newline at end of file diff --git a/framework/Util/TBehavior.php b/framework/Util/TBehavior.php index 83a24b75..c95f7cc3 100644 --- a/framework/Util/TBehavior.php +++ b/framework/Util/TBehavior.php @@ -16,7 +16,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.2.3 */ -class TBehavior extends TComponent implements IBehavior +class TBehavior extends \Prado\TComponent implements IBehavior { private $_enabled; private $_owner; diff --git a/framework/Util/TClassBehavior.php b/framework/Util/TClassBehavior.php index 113c9c68..183e8ec7 100644 --- a/framework/Util/TClassBehavior.php +++ b/framework/Util/TClassBehavior.php @@ -16,7 +16,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.2.3 */ -class TClassBehavior extends TComponent implements IClassBehavior +class TClassBehavior extends \Prado\TComponent implements IClassBehavior { /** diff --git a/framework/Util/TDataFieldAccessor.php b/framework/Util/TDataFieldAccessor.php index 35ae5228..10bb678e 100644 --- a/framework/Util/TDataFieldAccessor.php +++ b/framework/Util/TDataFieldAccessor.php @@ -54,7 +54,7 @@ class TDataFieldAccessor { try { - if(is_array($data) || ($data instanceof ArrayAccess)) + if(is_array($data) || ($data instanceof \ArrayAccess)) { if(isset($data[$field])) return $data[$field]; diff --git a/framework/Util/TLogRoute.php b/framework/Util/TLogRoute.php index 9a2d5699..d905f553 100644 --- a/framework/Util/TLogRoute.php +++ b/framework/Util/TLogRoute.php @@ -32,7 +32,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.0 */ -abstract class TLogRoute extends TApplicationComponent +abstract class TLogRoute extends \Prado\TApplicationComponent { /** * @var array lookup table for level names diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index cbbfc434..2b2106f1 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -40,7 +40,7 @@ Prado::using('System.Data.TDbConnection'); * @package Prado\Util * @since 3.0 */ -class TLogRouter extends TModule +class TLogRouter extends \Prado\TModule { /** * @var array list of routes available diff --git a/framework/Util/TLogger.php b/framework/Util/TLogger.php index 2397704f..556e8a73 100644 --- a/framework/Util/TLogger.php +++ b/framework/Util/TLogger.php @@ -22,7 +22,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.0 */ -class TLogger extends TComponent +class TLogger extends \Prado\TComponent { /** * Log levels. diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index 1ca1a5cf..4cb26c7d 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -45,7 +45,7 @@ namespace Prado\Util; * @package Prado\Util * @since 3.0 */ -class TParameterModule extends TModule +class TParameterModule extends \Prado\TModule { /** * @deprecated since 3.2 diff --git a/framework/Util/TRpcClient.php b/framework/Util/TRpcClient.php index f665dce6..15d29955 100644 --- a/framework/Util/TRpcClient.php +++ b/framework/Util/TRpcClient.php @@ -45,7 +45,7 @@ namespace Prado\Util; * @since 3.2 */ -class TRpcClient extends TApplicationComponent +class TRpcClient extends \Prado\TApplicationComponent { /** * @var string url of the RPC server diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index eedeb5a2..847903a7 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -9,6 +9,10 @@ * @package Prado\Web\Javascripts */ +namespace Prado\Web\Javascripts; +use Prado\Web\THttpUtility; +use Prado\Prado; + /** * TJavaScript class. * @@ -291,7 +295,7 @@ class TJavaScript $msg = 'Unknown error'; break; } - throw new Exception("JSON error ($err): $msg"); + throw new \Exception("JSON error ($err): $msg"); } /** @@ -302,7 +306,6 @@ class TJavaScript */ public static function JSMin($code) { - Prado::using('System.Web.Javascripts.JSMin'); return JSMin::minify($code); } } diff --git a/framework/Web/Javascripts/TJavaScriptLiteral.php b/framework/Web/Javascripts/TJavaScriptLiteral.php new file mode 100644 index 00000000..f1b67709 --- /dev/null +++ b/framework/Web/Javascripts/TJavaScriptLiteral.php @@ -0,0 +1,57 @@ + + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Web\Javascripts + */ + +namespace Prado\Web\Javascripts; + +/** + * TJavaScriptLiteral class that encloses string literals that are not + * supposed to be escaped by {@link TJavaScript::encode() } + * + * Since Prado 3.2 all the data that gets sent clientside inside a javascript statement + * is encoded by default to avoid any kind of injection. + * Sometimes there's the need to bypass this encoding and send raw javascript code. + * To ensure that a string doesn't get encoded by {@link TJavaScript::encode() }, + * construct a new TJavaScriptLiteral: + * + * // a javascript test string + * $js="alert('hello')"; + * // the string in $raw will not be encoded when sent clientside inside a javascript block + * $raw=new TJavaScriptLiteral($js); + * // shortened form + * $raw=_js($js); + * + * + * @package Prado\Web\Javascripts + * @since 3.2.0 + */ +class TJavaScriptLiteral +{ + protected $_s; + + public function __construct($s) + { + $this->_s = $s; + } + + public function __toString() + { + return (string)$this->_s; + } + + public function toJavaScriptLiteral() + { + return $this->__toString(); + } +} \ No newline at end of file diff --git a/framework/Web/Javascripts/TJavaScriptString.php b/framework/Web/Javascripts/TJavaScriptString.php new file mode 100644 index 00000000..826ea28f --- /dev/null +++ b/framework/Web/Javascripts/TJavaScriptString.php @@ -0,0 +1,31 @@ + + * + * Global Events, intra-object events, Class behaviors, expanded behaviors + * @author Brad Anderson + * + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Web\Javascripts + */ + +namespace Prado\Web\Javascripts; + +/** + * TJavaScriptString class is an internal class that marks strings that will be + * forcibly encoded when rendered inside a javascript block + * + * @package Prado\Web\Javascripts + * @since 3.2.0 + */ +class TJavaScriptString extends TJavaScriptLiteral +{ + public function toJavaScriptLiteral() + { + return TJavaScript::jsonEncode((string)$this->_s,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG); + } +} \ No newline at end of file diff --git a/framework/Web/Services/TFeedService.php b/framework/Web/Services/TFeedService.php index 9b0a937d..7b2ece8b 100644 --- a/framework/Web/Services/TFeedService.php +++ b/framework/Web/Services/TFeedService.php @@ -11,6 +11,9 @@ */ namespace Prado\Web\Services; +use Prado\TApplication; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\THttpException; /** * TFeedService class @@ -57,7 +60,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.1 */ -class TFeedService extends TService +class TFeedService extends \Prado\TService { private $_feeds=array(); diff --git a/framework/Web/Services/TJsonResponse.php b/framework/Web/Services/TJsonResponse.php index 3f7c1a44..401a7d79 100644 --- a/framework/Web/Services/TJsonResponse.php +++ b/framework/Web/Services/TJsonResponse.php @@ -24,7 +24,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.1 */ -abstract class TJsonResponse extends TApplicationComponent +abstract class TJsonResponse extends \Prado\TApplicationComponent { private $_id=''; diff --git a/framework/Web/Services/TJsonRpcProtocol.php b/framework/Web/Services/TJsonRpcProtocol.php index 78b7cdc4..e0b30445 100644 --- a/framework/Web/Services/TJsonRpcProtocol.php +++ b/framework/Web/Services/TJsonRpcProtocol.php @@ -9,6 +9,7 @@ */ namespace Prado\Web\Services; +use Prado\Exceptions\THttpException; /** * TJsonRpcProtocol class @@ -86,7 +87,7 @@ class TJsonRpcProtocol extends TRpcProtocol { throw $e; } - catch(Exception $e) + catch(\Exception $e) { return $this->createErrorResponse(new TRpcException('An internal error occured', '-32603')); } @@ -160,7 +161,7 @@ class TJsonRpcProtocol extends TRpcProtocol { $errnum = json_last_error(); if($errnum != JSON_ERROR_NONE) - throw new Exception("JSON error: $msg", $err); + throw new \Exception("JSON error: $msg", $err); } /** diff --git a/framework/Web/Services/TJsonService.php b/framework/Web/Services/TJsonService.php index 0f800aff..e5481145 100644 --- a/framework/Web/Services/TJsonService.php +++ b/framework/Web/Services/TJsonService.php @@ -10,6 +10,11 @@ */ namespace Prado\Web\Services; +use Prado\TApplication; +use Prado\Prado; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\THttpException; +use Prado\Web\Javascripts\TJavaScript; /** * TJsonService class provides to end-users javascript content response in @@ -51,7 +56,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.1 */ -class TJsonService extends TService +class TJsonService extends \Prado\TService { /** * @var array registered services diff --git a/framework/Web/Services/TPageConfiguration.php b/framework/Web/Services/TPageConfiguration.php index fe11d3ee..a442ab1c 100644 --- a/framework/Web/Services/TPageConfiguration.php +++ b/framework/Web/Services/TPageConfiguration.php @@ -10,6 +10,12 @@ */ namespace Prado\Web\Services; +use Prado\Exceptions\TConfigurationException; +use Prado\Prado; +use Prado\Security\TAuthorizationRuleCollection; +use Prado\TApplication; +use Prado\Xml\TXmlElement; +use Prado\Xml\TXmlDocument; /** * TPageConfiguration class @@ -22,7 +28,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.0 */ -class TPageConfiguration extends TComponent +class TPageConfiguration extends \Prado\TComponent { /** * @var array list of application configurations diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index 87640e5a..be865d89 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -10,13 +10,14 @@ */ namespace Prado\Web\Services; - -/** - * Include classes to be used by page service - */ -Prado::using('System.Web.UI.TPage'); -Prado::using('System.Web.UI.TTemplateManager'); -Prado::using('System.Web.UI.TThemeManager'); +use Prado\Prado; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\THttpException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\TApplication; +use Prado\TApplicationMode; +use Prado\Web\UI\TTemplateManager; +use Prado\Web\UI\TThemeManager; /** * TPageService class. @@ -74,7 +75,7 @@ Prado::using('System.Web.UI.TThemeManager'); * @package Prado\Web\Services * @since 3.0 */ -class TPageService extends TService +class TPageService extends \Prado\TService { /** * Configuration file name @@ -112,7 +113,7 @@ class TPageService extends TService * @var string clientscript manager class in namespace format * @since 3.1.7 */ - private $_clientScriptManagerClass='System.Web.UI.TClientScriptManager'; + private $_clientScriptManagerClass='\Prado\Web\UI\TClientScriptManager'; /** * @var string default page */ @@ -149,7 +150,7 @@ class TPageService extends TService */ public function init($config) { - Prado::trace("Initializing TPageService",'System.Web.Services.TPageService'); + Prado::trace("Initializing TPageService",'\Prado\Web\Services\TPageService'); $pageConfig=$this->loadPageConfig($config); diff --git a/framework/Web/Services/TRpcApiProvider.php b/framework/Web/Services/TRpcApiProvider.php index c63ed44d..ce7b5838 100644 --- a/framework/Web/Services/TRpcApiProvider.php +++ b/framework/Web/Services/TRpcApiProvider.php @@ -43,7 +43,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.2 */ -abstract class TRpcApiProvider extends TModule +abstract class TRpcApiProvider extends \Prado\TModule { /** * @var TRpcServer instance diff --git a/framework/Web/Services/TRpcServer.php b/framework/Web/Services/TRpcServer.php index 36130c9d..746246c7 100644 --- a/framework/Web/Services/TRpcServer.php +++ b/framework/Web/Services/TRpcServer.php @@ -25,7 +25,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.2 **/ -class TRpcServer extends TModule +class TRpcServer extends \Prado\TModule { /** * @var TRpcProtocol instance diff --git a/framework/Web/Services/TRpcService.php b/framework/Web/Services/TRpcService.php index 77bfe254..b1a2bd1d 100644 --- a/framework/Web/Services/TRpcService.php +++ b/framework/Web/Services/TRpcService.php @@ -9,6 +9,10 @@ */ namespace Prado\Web\Services; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\THttpException; +use Prado\Prado; +use Prado\Xml\TXmlElement; /** * TRpcService class @@ -53,7 +57,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.2 **/ -class TRpcService extends TService +class TRpcService extends \Prado\TService { /** * const string base api provider class which every API must extend diff --git a/framework/Web/Services/TSoapServer.php b/framework/Web/Services/TSoapServer.php index d6a04a4a..7bfa7d86 100644 --- a/framework/Web/Services/TSoapServer.php +++ b/framework/Web/Services/TSoapServer.php @@ -11,6 +11,10 @@ */ namespace Prado\Web\Services; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\TPropertyValue; +use Prado\Prado; +use Prado\TApplicationMode; /** * TSoapServer class. @@ -23,7 +27,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.1 */ -class TSoapServer extends TApplicationComponent +class TSoapServer extends \Prado\TApplicationComponent { const WSDL_CACHE_PREFIX='wsdl.'; @@ -82,7 +86,7 @@ class TSoapServer extends TApplicationComponent { $server->handle(); } - catch (Exception $e) + catch (\Exception $e) { if($this->getApplication()->getMode()===TApplicationMode::Debug) $this->fault($e->getMessage(), $e->__toString()); @@ -143,7 +147,7 @@ class TSoapServer extends TApplicationComponent { if($this->getApplication()->getMode()===TApplicationMode::Debug) ini_set("soap.wsdl_cache_enabled",0); - $this->_server = new SoapServer($this->getWsdlUri(),$this->getOptions()); + $this->_server = new \SoapServer($this->getWsdlUri(),$this->getOptions()); } return $this->_server; } diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php index f77737e2..5760f63c 100644 --- a/framework/Web/Services/TSoapService.php +++ b/framework/Web/Services/TSoapService.php @@ -11,6 +11,10 @@ */ namespace Prado\Web\Services; +use Prado\Exceptions\THttpException; +use Prado\Prado; +use Prado\TApplication; +use Prado\Xml\TXmlDocument; /** * TSoapService class @@ -88,7 +92,7 @@ namespace Prado\Web\Services; * @package Prado\Web\Services * @since 3.1 */ -class TSoapService extends TService +class TSoapService extends \Prado\TService { const DEFAULT_SOAP_SERVER='TSoapServer'; private $_servers=array(); diff --git a/framework/Web/Services/TXmlRpcProtocol.php b/framework/Web/Services/TXmlRpcProtocol.php index b200fe2e..9b62d7ab 100644 --- a/framework/Web/Services/TXmlRpcProtocol.php +++ b/framework/Web/Services/TXmlRpcProtocol.php @@ -9,6 +9,7 @@ */ namespace Prado\Web\Services; +use Prado\Exceptions\THttpException; /** * TXmlRpcProtocol class @@ -80,7 +81,7 @@ class TXmlRpcProtocol extends TRpcProtocol { throw $e; } - catch(Exception $e) + catch(\Exception $e) { return $this->createErrorResponse(new TRpcException('An internal error occured')); } diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php index 2e9c0975..d6bcab6d 100644 --- a/framework/Web/TAssetManager.php +++ b/framework/Web/TAssetManager.php @@ -10,6 +10,13 @@ */ namespace Prado\Web; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; +use Prado\TApplicationMode; +use Prado\IO\TIOException; +use Prado\IO\TTarFileExtractor; /** * TAssetManager class @@ -42,7 +49,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class TAssetManager extends TModule +class TAssetManager extends \Prado\TModule { /** * Default web accessible base path for storing private files diff --git a/framework/Web/TCacheHttpSession.php b/framework/Web/TCacheHttpSession.php index b06b1378..56c3ff61 100644 --- a/framework/Web/TCacheHttpSession.php +++ b/framework/Web/TCacheHttpSession.php @@ -12,6 +12,7 @@ */ namespace Prado\Web; +use Prado\Exceptions\TConfigurationException; /** * TCacheHttpSession class diff --git a/framework/Web/THttpCookie.php b/framework/Web/THttpCookie.php index 17208cff..4a72fcec 100644 --- a/framework/Web/THttpCookie.php +++ b/framework/Web/THttpCookie.php @@ -10,6 +10,7 @@ */ namespace Prado\Web; +use Prado\TPropertyValue; /** * THttpCookie class. @@ -21,7 +22,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class THttpCookie extends TComponent +class THttpCookie extends \Prado\TComponent { /** * @var string domain of the cookie diff --git a/framework/Web/THttpCookieCollection.php b/framework/Web/THttpCookieCollection.php index 8e99f131..46d1bbc6 100644 --- a/framework/Web/THttpCookieCollection.php +++ b/framework/Web/THttpCookieCollection.php @@ -10,6 +10,7 @@ */ namespace Prado\Web; +use Prado\Exceptions\TInvalidDataTypeException; /** * THttpCookieCollection class. @@ -26,7 +27,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class THttpCookieCollection extends TList +class THttpCookieCollection extends \Prado\Collections\TList { /** * @var mixed owner of this collection diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 7ab5083f..5742b1c6 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -10,8 +10,13 @@ */ namespace Prado\Web; - -Prado::using('System.Web.TUrlManager'); +use Prado\Caching\TFileCacheDependency; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TPhpErrorException; +use Prado\Prado; +use Prado\TPropertyValue; +use Prado\TApplicationMode; /** * THttpRequest class @@ -68,7 +73,7 @@ Prado::using('System.Web.TUrlManager'); * @package Prado\Web * @since 3.0 */ -class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule +class THttpRequest extends \Prado\TApplicationComponent implements \IteratorAggregate, \ArrayAccess, \Countable, \Prado\IModule { const CGIFIX__PATH_INFO = 1; const CGIFIX__SCRIPT_NAME = 2; @@ -813,7 +818,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /** * Returns an iterator for traversing the items in the list. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return Iterator an iterator for traversing the items in the list. */ public function getIterator() @@ -831,7 +836,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /** * Returns the number of items in the request. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the request. */ public function count() @@ -915,7 +920,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /** * Returns whether there is an element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to check on * @return boolean */ @@ -926,7 +931,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /** * Returns the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve element. * @return mixed the element at the offset, null if no element is found at the offset */ @@ -937,7 +942,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /** * Sets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to set element * @param mixed the element value */ @@ -948,7 +953,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar /** * Unsets the element at the specified offset. - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to unset element */ public function offsetUnset($offset) diff --git a/framework/Web/THttpRequestUrlFormat.php b/framework/Web/THttpRequestUrlFormat.php index 9c6560a7..61367107 100644 --- a/framework/Web/THttpRequestUrlFormat.php +++ b/framework/Web/THttpRequestUrlFormat.php @@ -25,7 +25,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0.4 */ -class THttpRequestUrlFormat extends TEnumerable +class THttpRequestUrlFormat extends \Prado\TEnumerable { const Get='Get'; const Path='Path'; diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index 31b37504..24787359 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -10,11 +10,10 @@ */ namespace Prado\Web; - -/** - * Includes the THttpResponse adapter. - */ -Prado::using('System.Web.THttpResponseAdapter'); +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; +use Prado\TPropertyValue; /** * THttpResponse class @@ -64,7 +63,7 @@ Prado::using('System.Web.THttpResponseAdapter'); * @package Prado\Web * @since 3.0 */ -class THttpResponse extends TModule implements ITextWriter +class THttpResponse extends \Prado\TModule implements \Prado\IO\ITextWriter { const DEFAULT_CONTENTTYPE = 'text/html'; const DEFAULT_CHARSET = 'UTF-8'; @@ -103,7 +102,7 @@ class THttpResponse extends TModule implements ITextWriter /** * @var string HTML writer type */ - private $_htmlWriterType='System.Web.UI.THtmlWriter'; + private $_htmlWriterType='\Prado\Web\UI\THtmlWriter'; /** * @var string content type */ @@ -212,7 +211,7 @@ class THttpResponse extends TModule implements ITextWriter public function setContentType($type) { if ($this->_contentTypeHeaderSent) - throw new Exception('Unable to alter content-type as it has been already sent'); + throw new \Exception('Unable to alter content-type as it has been already sent'); $this->_contentType = $type; } @@ -279,7 +278,7 @@ class THttpResponse extends TModule implements ITextWriter public function setStatusCode($status, $reason=null) { if ($this->_httpHeaderSent) - throw new Exception('Unable to alter response as HTTP header already sent'); + throw new \Exception('Unable to alter response as HTTP header already sent'); $status=TPropertyValue::ensureInteger($status); if(isset(self::$HTTP_STATUS_CODES[$status])) { $this->_reason=self::$HTTP_STATUS_CODES[$status]; diff --git a/framework/Web/THttpResponseAdapter.php b/framework/Web/THttpResponseAdapter.php index f0ced064..4ff7fb67 100644 --- a/framework/Web/THttpResponseAdapter.php +++ b/framework/Web/THttpResponseAdapter.php @@ -21,7 +21,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class THttpResponseAdapter extends TApplicationComponent +class THttpResponseAdapter extends \Prado\TApplicationComponent { /** * @var THttpResponse the response object the adapter is attached. diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php index 873baafe..1e995fd6 100644 --- a/framework/Web/THttpSession.php +++ b/framework/Web/THttpSession.php @@ -10,6 +10,9 @@ */ namespace Prado\Web; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\TPropertyValue; /** * THttpSession class @@ -69,7 +72,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class THttpSession extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule +class THttpSession extends \Prado\TApplicationComponent implements \IteratorAggregate, \ArrayAccess, \Countable, \Prado\IModule { /** * @var boolean whether this module has been initialized @@ -491,7 +494,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar /** * Returns an iterator for traversing the session variables. - * This method is required by the interface IteratorAggregate. + * This method is required by the interface \IteratorAggregate. * @return TSessionIterator an iterator for traversing the session variables. */ public function getIterator() @@ -509,7 +512,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar /** * Returns the number of items in the session. - * This method is required by Countable interface. + * This method is required by \Countable interface. * @return integer number of items in the session. */ public function count() @@ -591,7 +594,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar } /** - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to check on * @return boolean */ @@ -601,7 +604,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar } /** - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to retrieve element. * @return mixed the element at the offset, null if no element is found at the offset */ @@ -611,7 +614,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar } /** - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param integer the offset to set element * @param mixed the element value */ @@ -621,7 +624,7 @@ class THttpSession extends TApplicationComponent implements IteratorAggregate,Ar } /** - * This method is required by the interface ArrayAccess. + * This method is required by the interface \ArrayAccess. * @param mixed the offset to unset element */ public function offsetUnset($offset) diff --git a/framework/Web/TSessionIterator.php b/framework/Web/TSessionIterator.php index e9328bd1..d8024deb 100644 --- a/framework/Web/TSessionIterator.php +++ b/framework/Web/TSessionIterator.php @@ -14,7 +14,7 @@ namespace Prado\Web; /** * TSessionIterator class * - * TSessionIterator implements Iterator interface. + * TSessionIterator implements \Iterator interface. * * TSessionIterator is used by THttpSession. It allows THttpSession to return a new iterator * for traversing the session variables. @@ -23,7 +23,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class TSessionIterator implements Iterator +class TSessionIterator implements \Iterator { /** * @var array list of keys in the map diff --git a/framework/Web/TUri.php b/framework/Web/TUri.php index 3223b46f..cd700691 100644 --- a/framework/Web/TUri.php +++ b/framework/Web/TUri.php @@ -10,6 +10,7 @@ */ namespace Prado\Web; +use Prado\Exceptions\TInvalidDataValueException; /** * TUri class @@ -30,7 +31,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0 */ -class TUri extends TComponent +class TUri extends \Prado\TComponent { /** * @var array list of default ports for known schemes diff --git a/framework/Web/TUrlManager.php b/framework/Web/TUrlManager.php index 4b86644a..483556d1 100644 --- a/framework/Web/TUrlManager.php +++ b/framework/Web/TUrlManager.php @@ -30,7 +30,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0.6 */ -class TUrlManager extends TModule +class TUrlManager extends \Prado\TModule { /** * Constructs a URL that can be recognized by PRADO. @@ -69,7 +69,7 @@ class TUrlManager extends TModule $url=$serviceID.'='.urlencode($serviceParam); $amp=$encodeAmpersand?'&':'&'; $request=$this->getRequest(); - if(is_array($getItems) || $getItems instanceof Traversable) + if(is_array($getItems) || $getItems instanceof \Traversable) { if($encodeGetItems) { diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php index fdca7482..d8c0aed7 100644 --- a/framework/Web/TUrlMapping.php +++ b/framework/Web/TUrlMapping.php @@ -10,9 +10,11 @@ */ namespace Prado\Web; - -Prado::using('System.Web.TUrlManager'); -Prado::using('System.Collections.TAttributeCollection'); +use Prado\Exceptions\TConfigurationException; +use Prado\Prado; +use Prado\TApplication; +use Prado\Xml\TXmlDocument; +use Prado\Xml\TXmlElement; /** * TUrlMapping Class @@ -351,7 +353,7 @@ class TUrlMapping extends TUrlManager { if($this->_customUrl) { - if(!(is_array($getItems) || ($getItems instanceof Traversable))) + if(!(is_array($getItems) || ($getItems instanceof \Traversable))) $getItems=array(); $key=$serviceID.':'.$serviceParam; $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ? diff --git a/framework/Web/TUrlMappingPattern.php b/framework/Web/TUrlMappingPattern.php index 47c28539..e32a9130 100644 --- a/framework/Web/TUrlMappingPattern.php +++ b/framework/Web/TUrlMappingPattern.php @@ -10,6 +10,10 @@ */ namespace Prado\Web; +use Prado\Collections\TAttributeCollection; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\TPropertyValue; /** * TUrlMappingPattern class. @@ -110,7 +114,7 @@ namespace Prado\Web; * @package Prado\Web * @since 3.0.5 */ -class TUrlMappingPattern extends TComponent +class TUrlMappingPattern extends \Prado\TComponent { /** * @var string service parameter such as Page class name. diff --git a/framework/Web/UI/ActiveControls/IActiveControl.php b/framework/Web/UI/ActiveControls/IActiveControl.php new file mode 100644 index 00000000..a3c8e72d --- /dev/null +++ b/framework/Web/UI/ActiveControls/IActiveControl.php @@ -0,0 +1,29 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Web\UI\ActiveControls + */ + +namespace Prado\Web\UI\ActiveControls; + +/** + * IActiveControl interface. + * + * Active controls must implement IActiveControl interface. + * + * @author Wei Zhuo + * @package Prado\Web\UI\ActiveControls + * @since 3.1 + */ +interface IActiveControl +{ + /** + * @return TBaseActiveControl Active control properties. + */ + public function getActiveControl(); +} \ No newline at end of file diff --git a/framework/Web/UI/ActiveControls/ICallbackEventHandler.php b/framework/Web/UI/ActiveControls/ICallbackEventHandler.php new file mode 100644 index 00000000..2abe1225 --- /dev/null +++ b/framework/Web/UI/ActiveControls/ICallbackEventHandler.php @@ -0,0 +1,33 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Web\UI\ActiveControls + */ + +namespace Prado\Web\UI\ActiveControls; + +/** + * ICallbackEventHandler interface. + * + * If a control wants to respond to callback event, it must implement this + * interface. + * + * @author Wei Zhuo + * @package Prado\Web\UI\ActiveControls + * @since 3.1 + */ +interface ICallbackEventHandler +{ + /** + * Raises callback event. The implementation of this function should raise + * appropriate event(s) (e.g. OnClick, OnCommand) indicating the component + * is responsible for the callback event. + * @param TCallbackEventParameter the parameter associated with the callback event + */ + public function raiseCallbackEvent($eventArgument); +} \ No newline at end of file diff --git a/framework/Web/UI/ActiveControls/TAutoCompleteTemplate.php b/framework/Web/UI/ActiveControls/TAutoCompleteTemplate.php index 0cdcbb85..246bfaf3 100644 --- a/framework/Web/UI/ActiveControls/TAutoCompleteTemplate.php +++ b/framework/Web/UI/ActiveControls/TAutoCompleteTemplate.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\ActiveControls; * @package Prado\Web\UI\ActiveControls * @since 3.1 */ -class TAutoCompleteTemplate extends TComponent implements ITemplate +class TAutoCompleteTemplate extends \Prado\TComponent implements ITemplate { private $_template; diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php index 4af7ac2c..74adecc2 100644 --- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php +++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php @@ -27,7 +27,7 @@ Prado::using('System.Web.UI.ActiveControls.TCallbackClientSide'); * @package Prado\Web\UI\ActiveControls * @since 3.1 */ -class TBaseActiveControl extends TComponent +class TBaseActiveControl extends \Prado\TComponent { /** * @var TMap map of active control options. diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php index 812c9b2a..e8656792 100644 --- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php +++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php @@ -58,7 +58,7 @@ namespace Prado\Web\UI\ActiveControls; * @package Prado\Web\UI\ActiveControls * @since 3.1 */ -class TCallbackClientScript extends TApplicationComponent +class TCallbackClientScript extends \Prado\TApplicationComponent { /** * @var TList list of client functions to execute. diff --git a/framework/Web/UI/ActiveControls/TCallbackEventParameter.php b/framework/Web/UI/ActiveControls/TCallbackEventParameter.php index 612fccbd..515051fb 100644 --- a/framework/Web/UI/ActiveControls/TCallbackEventParameter.php +++ b/framework/Web/UI/ActiveControls/TCallbackEventParameter.php @@ -32,7 +32,7 @@ namespace Prado\Web\UI\ActiveControls; * @package Prado\Web\UI\ActiveControls * @since 3.1 */ -class TCallbackEventParameter extends TEventParameter +class TCallbackEventParameter extends \Prado\TEventParameter { /** * @var THttpResponse output content. diff --git a/framework/Web/UI/ActiveControls/TDropContainerEventParameter.php b/framework/Web/UI/ActiveControls/TDropContainerEventParameter.php index 2c5876c3..5844e3cd 100644 --- a/framework/Web/UI/ActiveControls/TDropContainerEventParameter.php +++ b/framework/Web/UI/ActiveControls/TDropContainerEventParameter.php @@ -22,7 +22,7 @@ namespace Prado\Web\UI\ActiveControls; * @license http://www.pradosoft.com/license * @package Prado\Web\UI\ActiveControls */ -class TDropContainerEventParameter extends TEventParameter +class TDropContainerEventParameter extends \Prado\TEventParameter { private $_dragElementId; private $_screenX; diff --git a/framework/Web/UI/IBindable.php b/framework/Web/UI/IBindable.php new file mode 100644 index 00000000..efe195f9 --- /dev/null +++ b/framework/Web/UI/IBindable.php @@ -0,0 +1,29 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Web\UI + */ + +namespace Prado\Web\UI; + +/** + * IBindable interface. + * + * This interface must be implemented by classes that are capable of performing databinding. + * + * @author Qiang Xue + * @package Prado\Web\UI + * @since 3.0 + */ +interface IBindable +{ + /** + * Performs databinding. + */ + public function dataBind(); +} \ No newline at end of file diff --git a/framework/Web/UI/IRenderable.php b/framework/Web/UI/IRenderable.php new file mode 100644 index 00000000..2aeda744 --- /dev/null +++ b/framework/Web/UI/IRenderable.php @@ -0,0 +1,31 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package Prado\Web\UI + */ + +namespace Prado\Web\UI; + +/** + * IRenderable interface. + * + * This interface must be implemented by classes that can be rendered + * to end-users. + * + * @author Qiang Xue + * @package Prado\Web\UI + * @since 3.0 + */ +interface IRenderable +{ + /** + * Renders the component to end-users. + * @param ITextWriter writer for the rendering purpose + */ + public function render($writer); +} \ No newline at end of file diff --git a/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php b/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php index 9e5f34bb..56c953fd 100644 --- a/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php +++ b/framework/Web/UI/JuiControls/TJuiAutoCompleteTemplate.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\JuiControls; * @package Prado\Web\UI\JuiControls * @since 3.1 */ -class TJuiAutoCompleteTemplate extends TComponent implements ITemplate +class TJuiAutoCompleteTemplate extends \Prado\TComponent implements ITemplate { private $_template; diff --git a/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php b/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php index 82573384..723462a9 100644 --- a/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php +++ b/framework/Web/UI/JuiControls/TJuiSelectableTemplate.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\JuiControls; * @package Prado\Web\UI\JuiControls * @since 3.1 */ -class TJuiSelectableTemplate extends TComponent implements ITemplate +class TJuiSelectableTemplate extends \Prado\TComponent implements ITemplate { private $_template; diff --git a/framework/Web/UI/JuiControls/TJuiSortableTemplate.php b/framework/Web/UI/JuiControls/TJuiSortableTemplate.php index 3ef13741..121a2bdc 100644 --- a/framework/Web/UI/JuiControls/TJuiSortableTemplate.php +++ b/framework/Web/UI/JuiControls/TJuiSortableTemplate.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\JuiControls; * @package Prado\Web\UI\JuiControls * @since 3.1 */ -class TJuiSortableTemplate extends TComponent implements ITemplate +class TJuiSortableTemplate extends \Prado\TComponent implements ITemplate { private $_template; diff --git a/framework/Web/UI/TBroadcastEventParameter.php b/framework/Web/UI/TBroadcastEventParameter.php index 934f6b51..c2827672 100644 --- a/framework/Web/UI/TBroadcastEventParameter.php +++ b/framework/Web/UI/TBroadcastEventParameter.php @@ -23,7 +23,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TBroadcastEventParameter extends TEventParameter +class TBroadcastEventParameter extends \Prado\TEventParameter { private $_name; private $_param; diff --git a/framework/Web/UI/TCachePageStatePersister.php b/framework/Web/UI/TCachePageStatePersister.php index 19a832fa..53dd5916 100644 --- a/framework/Web/UI/TCachePageStatePersister.php +++ b/framework/Web/UI/TCachePageStatePersister.php @@ -10,6 +10,11 @@ */ namespace Prado\Web\UI; +use Prado\Caching\ICache; +use Prado\Prado; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\THttpException; +use Prado\Exceptions\TInvalidDataValueException; /** * TCachePageStatePersister class @@ -58,7 +63,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.1.1 */ -class TCachePageStatePersister extends TComponent implements IPageStatePersister +class TCachePageStatePersister extends \Prado\TComponent implements IPageStatePersister { private $_prefix='statepersister'; private $_page; diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 1fb460fa..ad63416e 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -11,6 +11,13 @@ */ namespace Prado\Web\UI; +use Prado\Prado; +use Prado\TApplicationMode; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Web\Javascripts\TJavaScript; +use Prado\Web\UI\ActiveControls\ICallbackEventHandler; +use Prado\Web\THttpUtility; /** * TClientScriptManager class. @@ -22,7 +29,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TClientScriptManager extends TApplicationComponent +class TClientScriptManager extends \Prado\TApplicationComponent { /** * directory containing Prado javascript files @@ -244,7 +251,7 @@ class TClientScriptManager extends TApplicationComponent public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null) { $options = !is_array($options) ? array() : $options; - $class = new ReflectionClass($callbackHandler); + $class = new \ReflectionClass($callbackHandler); $clientSide = $callbackHandler->getActiveControl()->getClientSide(); $options = array_merge($options, $clientSide->getOptions()->toArray()); $optionString = TJavaScript::encode($options); @@ -772,6 +779,6 @@ class TClientScriptManager extends TApplicationComponent protected function checkIfNotInRender() { if ($form = $this->_page->InFormRender) - throw new Exception('Operation invalid when page is already rendering'); + throw new \Exception('Operation invalid when page is already rendering'); } } diff --git a/framework/Web/UI/TClientSideOptions.php b/framework/Web/UI/TClientSideOptions.php index 438ff87f..88d5751e 100644 --- a/framework/Web/UI/TClientSideOptions.php +++ b/framework/Web/UI/TClientSideOptions.php @@ -11,6 +11,8 @@ */ namespace Prado\Web\UI; +use Prado\Collections\TMap; +use Prado\Web\Javascripts\TJavaScript; /** * TClientSideOptions abstract class. @@ -23,7 +25,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -abstract class TClientSideOptions extends TComponent +abstract class TClientSideOptions extends \Prado\TComponent { /** * @var TMap list of client-side options. @@ -71,7 +73,7 @@ abstract class TClientSideOptions extends TComponent public function getOptions() { if (!$this->_options) - $this->_options = Prado::createComponent('System.Collections.TMap'); + $this->_options = new TMap; return $this->_options; } diff --git a/framework/Web/UI/TCommandEventParameter.php b/framework/Web/UI/TCommandEventParameter.php index 5ad7ca3e..5ccee42a 100644 --- a/framework/Web/UI/TCommandEventParameter.php +++ b/framework/Web/UI/TCommandEventParameter.php @@ -23,7 +23,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TCommandEventParameter extends TEventParameter +class TCommandEventParameter extends \Prado\TEventParameter { private $_name; private $_param; diff --git a/framework/Web/UI/TCompositeLiteral.php b/framework/Web/UI/TCompositeLiteral.php index 8f8df3a5..19b2d42a 100644 --- a/framework/Web/UI/TCompositeLiteral.php +++ b/framework/Web/UI/TCompositeLiteral.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TCompositeLiteral extends TComponent implements IRenderable, IBindable +class TCompositeLiteral extends \Prado\TComponent implements IRenderable, IBindable { const TYPE_EXPRESSION=0; const TYPE_STATEMENTS=1; @@ -69,7 +69,7 @@ class TCompositeLiteral extends TComponent implements IRenderable, IBindable /** * @param TComponent container of this component. It serves as the evaluation context of expressions and statements. */ - public function setContainer(TComponent $value) + public function setContainer(\Prado\TComponent $value) { $this->_container=$value; } diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 0b1dd087..6e34a439 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -10,12 +10,11 @@ */ namespace Prado\Web\UI; - -/** - * Includes TAttributeCollection and TControlAdapter class - */ -Prado::using('System.Collections.TAttributeCollection'); -Prado::using('System.Web.UI.TControlAdapter'); +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; +use Prado\TPropertyValue; +use Prado\Web\UI\ActiveControls\IActiveControl; /** * TControl class @@ -68,7 +67,7 @@ Prado::using('System.Web.UI.TControlAdapter'); * @package Prado\Web\UI * @since 3.0 */ -class TControl extends TApplicationComponent implements IRenderable, IBindable +class TControl extends \Prado\TApplicationComponent implements IRenderable, IBindable { /** * format of control ID @@ -846,7 +845,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable */ protected function dataBindProperties() { - Prado::trace("Data bind properties",'System.Web.UI.TControl'); + Prado::trace("Data bind properties",'Prado\Web\UI\TControl'); if(isset($this->_rf[self::RF_DATA_BINDINGS])) { if(($context=$this->getTemplateControl())===null) @@ -875,7 +874,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable */ protected function dataBindChildren() { - Prado::trace("dataBindChildren()",'System.Web.UI.TControl'); + Prado::trace("dataBindChildren()",'Prado\Web\UI\TControl'); if(isset($this->_rf[self::RF_CONTROLS])) { foreach($this->_rf[self::RF_CONTROLS] as $control) @@ -1385,7 +1384,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable */ public function onDataBinding($param) { - Prado::trace("onDataBinding()",'System.Web.UI.TControl'); + Prado::trace("onDataBinding()",'Prado\Web\UI\TControl'); $this->raiseEvent('OnDataBinding',$this,$param); } diff --git a/framework/Web/UI/TControlAdapter.php b/framework/Web/UI/TControlAdapter.php index cb993fbc..b0e947dc 100644 --- a/framework/Web/UI/TControlAdapter.php +++ b/framework/Web/UI/TControlAdapter.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TControlAdapter extends TApplicationComponent +class TControlAdapter extends \Prado\TApplicationComponent { /** * @var TControl the control to which the adapter is attached diff --git a/framework/Web/UI/TControlCollection.php b/framework/Web/UI/TControlCollection.php index b410568b..a23e930b 100644 --- a/framework/Web/UI/TControlCollection.php +++ b/framework/Web/UI/TControlCollection.php @@ -10,6 +10,7 @@ */ namespace Prado\Web\UI; +use Prado\Exceptions\TInvalidDataTypeException; /** * TControlCollection class @@ -21,7 +22,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TControlCollection extends TList +class TControlCollection extends \Prado\Collections\TList { /** * the control that owns this collection. diff --git a/framework/Web/UI/TForm.php b/framework/Web/UI/TForm.php index c343ceb4..92d20477 100644 --- a/framework/Web/UI/TForm.php +++ b/framework/Web/UI/TForm.php @@ -10,6 +10,8 @@ */ namespace Prado\Web\UI; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\TPropertyValue; /** * TForm class diff --git a/framework/Web/UI/THtmlWriter.php b/framework/Web/UI/THtmlWriter.php index 56ba610a..13a3252f 100644 --- a/framework/Web/UI/THtmlWriter.php +++ b/framework/Web/UI/THtmlWriter.php @@ -10,6 +10,7 @@ */ namespace Prado\Web\UI; +use Prado\THttpUtility; /** * THtmlWriter class @@ -36,7 +37,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class THtmlWriter extends TApplicationComponent implements ITextWriter +class THtmlWriter extends \Prado\TApplicationComponent implements \Prado\IO\ITextWriter { /** * @var array list of tags are do not need a closing tag diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index a982768b..8dc1f1e7 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -10,14 +10,18 @@ */ namespace Prado\Web\UI; - -Prado::using('System.Web.UI.WebControls.*'); -Prado::using('System.Web.UI.TControl'); -Prado::using('System.Web.UI.WebControls.TWebControl'); -Prado::using('System.Web.UI.TCompositeControl'); -Prado::using('System.Web.UI.TTemplateControl'); -Prado::using('System.Web.UI.TForm'); -Prado::using('System.Web.UI.TClientScriptManager'); +use Prado\Collections\TList; +use Prado\Collections\TMap; +use Prado\Collections\TStack; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\THttpException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidDataTypeException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; +use Prado\TPropertyValue; +use Prado\Web\UI\ActiveControls\TActivePageAdapter; +use Prado\Web\UI\ActiveControls\TCallbackClientScript; /** * TPage class @@ -141,7 +145,7 @@ class TPage extends TTemplateControl /** * @var string page state persister class name */ - private $_statePersisterClass='System.Web.UI.TPageStatePersister'; + private $_statePersisterClass='\Prado\Web\UI\TPageStatePersister'; /** * @var mixed page state persister */ @@ -183,7 +187,7 @@ class TPage extends TTemplateControl */ public function run($writer) { - Prado::trace("Running page life cycles",'System.Web.UI.TPage'); + Prado::trace("Running page life cycles",'Prado\Web\UI\TPage'); $this->_writer = $writer; $this->determinePostBackMode(); @@ -203,80 +207,80 @@ class TPage extends TTemplateControl protected function processNormalRequest($writer) { - Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); + Prado::trace("Page onPreInit()",'Prado\Web\UI\TPage'); $this->onPreInit(null); - Prado::trace("Page initRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page initRecursive()",'Prado\Web\UI\TPage'); $this->initRecursive(); - Prado::trace("Page onInitComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onInitComplete()",'Prado\Web\UI\TPage'); $this->onInitComplete(null); - Prado::trace("Page onPreLoad()",'System.Web.UI.TPage'); + Prado::trace("Page onPreLoad()",'Prado\Web\UI\TPage'); $this->onPreLoad(null); - Prado::trace("Page loadRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page loadRecursive()",'Prado\Web\UI\TPage'); $this->loadRecursive(); - Prado::trace("Page onLoadComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onLoadComplete()",'Prado\Web\UI\TPage'); $this->onLoadComplete(null); - Prado::trace("Page preRenderRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page preRenderRecursive()",'Prado\Web\UI\TPage'); $this->preRenderRecursive(); - Prado::trace("Page onPreRenderComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onPreRenderComplete()",'Prado\Web\UI\TPage'); $this->onPreRenderComplete(null); - Prado::trace("Page savePageState()",'System.Web.UI.TPage'); + Prado::trace("Page savePageState()",'Prado\Web\UI\TPage'); $this->savePageState(); - Prado::trace("Page onSaveStateComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onSaveStateComplete()",'Prado\Web\UI\TPage'); $this->onSaveStateComplete(null); - Prado::trace("Page renderControl()",'System.Web.UI.TPage'); + Prado::trace("Page renderControl()",'Prado\Web\UI\TPage'); $this->renderControl($writer); - Prado::trace("Page unloadRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page unloadRecursive()",'Prado\Web\UI\TPage'); $this->unloadRecursive(); } protected function processPostBackRequest($writer) { - Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); + Prado::trace("Page onPreInit()",'Prado\Web\UI\TPage'); $this->onPreInit(null); - Prado::trace("Page initRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page initRecursive()",'Prado\Web\UI\TPage'); $this->initRecursive(); - Prado::trace("Page onInitComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onInitComplete()",'Prado\Web\UI\TPage'); $this->onInitComplete(null); $this->_restPostData=new TMap; - Prado::trace("Page loadPageState()",'System.Web.UI.TPage'); + Prado::trace("Page loadPageState()",'Prado\Web\UI\TPage'); $this->loadPageState(); - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); + Prado::trace("Page processPostData()",'Prado\Web\UI\TPage'); $this->processPostData($this->_postData,true); - Prado::trace("Page onPreLoad()",'System.Web.UI.TPage'); + Prado::trace("Page onPreLoad()",'Prado\Web\UI\TPage'); $this->onPreLoad(null); - Prado::trace("Page loadRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page loadRecursive()",'Prado\Web\UI\TPage'); $this->loadRecursive(); - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); + Prado::trace("Page processPostData()",'Prado\Web\UI\TPage'); $this->processPostData($this->_restPostData,false); - Prado::trace("Page raiseChangedEvents()",'System.Web.UI.TPage'); + Prado::trace("Page raiseChangedEvents()",'Prado\Web\UI\TPage'); $this->raiseChangedEvents(); - Prado::trace("Page raisePostBackEvent()",'System.Web.UI.TPage'); + Prado::trace("Page raisePostBackEvent()",'Prado\Web\UI\TPage'); $this->raisePostBackEvent(); - Prado::trace("Page onLoadComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onLoadComplete()",'Prado\Web\UI\TPage'); $this->onLoadComplete(null); - Prado::trace("Page preRenderRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page preRenderRecursive()",'Prado\Web\UI\TPage'); $this->preRenderRecursive(); - Prado::trace("Page onPreRenderComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onPreRenderComplete()",'Prado\Web\UI\TPage'); $this->onPreRenderComplete(null); - Prado::trace("Page savePageState()",'System.Web.UI.TPage'); + Prado::trace("Page savePageState()",'Prado\Web\UI\TPage'); $this->savePageState(); - Prado::trace("Page onSaveStateComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onSaveStateComplete()",'Prado\Web\UI\TPage'); $this->onSaveStateComplete(null); - Prado::trace("Page renderControl()",'System.Web.UI.TPage'); + Prado::trace("Page renderControl()",'Prado\Web\UI\TPage'); $this->renderControl($writer); - Prado::trace("Page unloadRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page unloadRecursive()",'Prado\Web\UI\TPage'); $this->unloadRecursive(); } @@ -300,72 +304,72 @@ class TPage extends TTemplateControl */ protected function processCallbackRequest($writer) { - Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter'); + Prado::using('Prado\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); + $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); + if(strlen($callbackEventParameter) > 0) + $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); - // Decode Callback postData from UTF-8 to current Charset - if (($g=$this->getApplication()->getGlobalization(false))!==null && - strtoupper($enc=$g->getCharset())!='UTF-8') - foreach ($this->_postData as $k=>$v) - $this->_postData[$k]=self::decodeUTF8($v, $enc); + // Decode Callback postData from UTF-8 to current Charset + if (($g=$this->getApplication()->getGlobalization(false))!==null && + strtoupper($enc=$g->getCharset())!='UTF-8') + foreach ($this->_postData as $k=>$v) + $this->_postData[$k]=self::decodeUTF8($v, $enc); - Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); + Prado::trace("Page onPreInit()",'Prado\Web\UI\TPage'); $this->onPreInit(null); - Prado::trace("Page initRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page initRecursive()",'Prado\Web\UI\TPage'); $this->initRecursive(); - Prado::trace("Page onInitComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onInitComplete()",'Prado\Web\UI\TPage'); $this->onInitComplete(null); $this->_restPostData=new TMap; - Prado::trace("Page loadPageState()",'System.Web.UI.TPage'); + Prado::trace("Page loadPageState()",'Prado\Web\UI\TPage'); $this->loadPageState(); - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); + Prado::trace("Page processPostData()",'Prado\Web\UI\TPage'); $this->processPostData($this->_postData,true); - Prado::trace("Page onPreLoad()",'System.Web.UI.TPage'); + Prado::trace("Page onPreLoad()",'Prado\Web\UI\TPage'); $this->onPreLoad(null); - Prado::trace("Page loadRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page loadRecursive()",'Prado\Web\UI\TPage'); $this->loadRecursive(); - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); + Prado::trace("Page processPostData()",'Prado\Web\UI\TPage'); $this->processPostData($this->_restPostData,false); - Prado::trace("Page raiseChangedEvents()",'System.Web.UI.TPage'); + Prado::trace("Page raiseChangedEvents()",'Prado\Web\UI\TPage'); $this->raiseChangedEvents(); $this->getAdapter()->processCallbackEvent($writer); /* - Prado::trace("Page raisePostBackEvent()",'System.Web.UI.TPage'); + Prado::trace("Page raisePostBackEvent()",'Prado\Web\UI\TPage'); $this->raisePostBackEvent(); */ - Prado::trace("Page onLoadComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onLoadComplete()",'Prado\Web\UI\TPage'); $this->onLoadComplete(null); - Prado::trace("Page preRenderRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page preRenderRecursive()",'Prado\Web\UI\TPage'); $this->preRenderRecursive(); - Prado::trace("Page onPreRenderComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onPreRenderComplete()",'Prado\Web\UI\TPage'); $this->onPreRenderComplete(null); - Prado::trace("Page savePageState()",'System.Web.UI.TPage'); + Prado::trace("Page savePageState()",'Prado\Web\UI\TPage'); $this->savePageState(); - Prado::trace("Page onSaveStateComplete()",'System.Web.UI.TPage'); + Prado::trace("Page onSaveStateComplete()",'Prado\Web\UI\TPage'); $this->onSaveStateComplete(null); /* - Prado::trace("Page renderControl()",'System.Web.UI.TPage'); + Prado::trace("Page renderControl()",'Prado\Web\UI\TPage'); $this->renderControl($writer); */ $this->getAdapter()->renderCallbackResponse($writer); - Prado::trace("Page unloadRecursive()",'System.Web.UI.TPage'); + Prado::trace("Page unloadRecursive()",'Prado\Web\UI\TPage'); $this->unloadRecursive(); } @@ -478,7 +482,7 @@ class TPage extends TTemplateControl */ public function validate($validationGroup=null) { - Prado::trace("Page validate()",'System.Web.UI.TPage'); + Prado::trace("Page validate()",'Prado\Web\UI\TPage'); $this->_validated=true; if($this->_validators && $this->_validators->getCount()) { @@ -592,7 +596,7 @@ class TPage extends TTemplateControl if(($pos=strrpos($className,'.'))!==false) $className=substr($className,$pos+1); - if(!class_exists($className,false) || ($className!=='TClientScriptManager' && !is_subclass_of($className,'TClientScriptManager'))) + if(!class_exists($className,false) || ($className!=='TClientScriptManager' && !is_subclass_of($className,'TClientScriptManager'))) throw new THttpException(404,'page_csmanagerclass_invalid',$classPath); $this->_clientScript=new $className($this); @@ -769,7 +773,7 @@ class TPage extends TTemplateControl */ protected function loadPageState() { - Prado::trace("Loading state",'System.Web.UI.TPage'); + Prado::trace("Loading state",'Prado\Web\UI\TPage'); $state=$this->getStatePersister()->load(); $this->loadStateRecursive($state,$this->getEnableViewState()); } @@ -779,7 +783,7 @@ class TPage extends TTemplateControl */ protected function savePageState() { - Prado::trace("Saving state",'System.Web.UI.TPage'); + Prado::trace("Saving state",'Prado\Web\UI\TPage'); $state=&$this->saveStateRecursive($this->getEnableViewState()); $this->getStatePersister()->save($state); } @@ -1214,89 +1218,89 @@ class TPage extends TTemplateControl if ($this->_writer) $this->Response->write($this->_writer->flush()); } - - /** - * Function to update view controls with data in a given AR object. - * View controls and AR object need to have the same name in IDs and Attrs respectively. - * @param TActiveRecord $arObj - * @param Boolean $throwExceptions Wheter or not to throw exceptions - * @author Daniel Sampedro - */ - public function tryToUpdateView($arObj, $throwExceptions = false) - { - $objAttrs = get_class_vars(get_class($arObj)); - foreach (array_keys($objAttrs) as $key) - { - try - { - if ($key != "RELATIONS") - { - $control = $this->{$key}; - if ($control instanceof TTextBox) - $control->Text = $arObj->{$key}; - elseif ($control instanceof TCheckBox) - $control->Checked = (boolean) $arObj->{$key}; - elseif ($control instanceof TDatePicker) - $control->Date = $arObj->{$key}; - } - else - { - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) - { - $relControl = $this->{$relKey}; - switch ($relValues[0]) - { - case TActiveRecord::BELONGS_TO: - case TActiveRecord::HAS_ONE: - $relControl->Text = $arObj->{$relKey}; - break; - case TActiveRecord::HAS_MANY: - if ($relControl instanceof TListControl) - { - $relControl->DataSource = $arObj->{$relKey}; - $relControl->dataBind(); - } - break; - } - } - break; - } - } catch (Exception $ex) - { - if ($throwExceptions) - throw $ex; - } - } - } - - /** - * Function to try to update an AR object with data in view controls. - * @param TActiveRecord $arObj - * @param Boolean $throwExceptions Wheter or not to throw exceptions - * @author Daniel Sampedro - */ - public function tryToUpdateAR($arObj, $throwExceptions = false) - { - $objAttrs = get_class_vars(get_class($arObj)); - foreach (array_keys($objAttrs) as $key) - { - try - { - if ($key == "RELATIONS") - break; - $control = $this->{$key}; - if ($control instanceof TTextBox) - $arObj->{$key} = $control->Text; - elseif ($control instanceof TCheckBox) - $arObj->{$key} = $control->Checked; - elseif ($control instanceof TDatePicker) - $arObj->{$key} = $control->Date; - } catch (Exception $ex) - { - if ($throwExceptions) - throw $ex; - } - } - } + + /** + * Function to update view controls with data in a given AR object. + * View controls and AR object need to have the same name in IDs and Attrs respectively. + * @param TActiveRecord $arObj + * @param Boolean $throwExceptions Wheter or not to throw exceptions + * @author Daniel Sampedro + */ + public function tryToUpdateView($arObj, $throwExceptions = false) + { + $objAttrs = get_class_vars(get_class($arObj)); + foreach (array_keys($objAttrs) as $key) + { + try + { + if ($key != "RELATIONS") + { + $control = $this->{$key}; + if ($control instanceof \Prado\Web\UI\WebControls\TTextBox) + $control->Text = $arObj->{$key}; + elseif ($control instanceof \Prado\Web\UI\WebControls\TCheckBox) + $control->Checked = (boolean) $arObj->{$key}; + elseif ($control instanceof \Prado\Web\UI\WebControls\TDatePicker) + $control->Date = $arObj->{$key}; + } + else + { + foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) + { + $relControl = $this->{$relKey}; + switch ($relValues[0]) + { + case TActiveRecord::BELONGS_TO: + case TActiveRecord::HAS_ONE: + $relControl->Text = $arObj->{$relKey}; + break; + case TActiveRecord::HAS_MANY: + if ($relControl instanceof \Prado\Web\UI\WebControls\TListControl) + { + $relControl->DataSource = $arObj->{$relKey}; + $relControl->dataBind(); + } + break; + } + } + break; + } + } catch (\Exception $ex) + { + if ($throwExceptions) + throw $ex; + } + } + } + + /** + * Function to try to update an AR object with data in view controls. + * @param TActiveRecord $arObj + * @param Boolean $throwExceptions Wheter or not to throw exceptions + * @author Daniel Sampedro + */ + public function tryToUpdateAR($arObj, $throwExceptions = false) + { + $objAttrs = get_class_vars(get_class($arObj)); + foreach (array_keys($objAttrs) as $key) + { + try + { + if ($key == "RELATIONS") + break; + $control = $this->{$key}; + if ($control instanceof \Prado\Web\UI\WebControls\TTextBox) + $arObj->{$key} = $control->Text; + elseif ($control instanceof \Prado\Web\UI\WebControls\TCheckBox) + $arObj->{$key} = $control->Checked; + elseif ($control instanceof \Prado\Web\UI\WebControls\TDatePicker) + $arObj->{$key} = $control->Date; + } catch (\Exception $ex) + { + if ($throwExceptions) + throw $ex; + } + } + } } \ No newline at end of file diff --git a/framework/Web/UI/TPageStatePersister.php b/framework/Web/UI/TPageStatePersister.php index 4acde277..1aebe5fd 100644 --- a/framework/Web/UI/TPageStatePersister.php +++ b/framework/Web/UI/TPageStatePersister.php @@ -10,6 +10,7 @@ */ namespace Prado\Web\UI; +use Prado\Exceptions\THttpException; /** * TPageStatePersister class @@ -26,7 +27,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TPageStatePersister extends TComponent implements IPageStatePersister +class TPageStatePersister extends \Prado\TComponent implements IPageStatePersister { private $_page; diff --git a/framework/Web/UI/TSessionPageStatePersister.php b/framework/Web/UI/TSessionPageStatePersister.php index 85c7ffb4..a83e3a9e 100644 --- a/framework/Web/UI/TSessionPageStatePersister.php +++ b/framework/Web/UI/TSessionPageStatePersister.php @@ -10,6 +10,9 @@ */ namespace Prado\Web\UI; +use Prado\TPropertyValue; +use Prado\Exceptions\THttpException; +use Prado\Exceptions\TInvalidDataValueException; /** * TSessionPageStatePersister class @@ -43,7 +46,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.1 */ -class TSessionPageStatePersister extends TComponent implements IPageStatePersister +class TSessionPageStatePersister extends \Prado\TComponent implements IPageStatePersister { const STATE_SESSION_KEY='PRADO_SESSION_PAGESTATE'; const QUEUE_SESSION_KEY='PRADO_SESSION_STATEQUEUE'; diff --git a/framework/Web/UI/TTemplate.php b/framework/Web/UI/TTemplate.php index f3a782b7..cf32c4cc 100644 --- a/framework/Web/UI/TTemplate.php +++ b/framework/Web/UI/TTemplate.php @@ -10,6 +10,12 @@ */ namespace Prado\Web\UI; +use Prado\Prado; +use Prado\TComponent; +use Prado\Web\Javascripts\TJavaScriptLiteral; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TTemplateException; +use Prado\Exceptions\TException; /** * TTemplate implements PRADO template parsing logic. @@ -44,7 +50,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TTemplate extends TApplicationComponent implements ITemplate +class TTemplate extends \Prado\TApplicationComponent implements ITemplate { /** * '' - template comments @@ -206,7 +212,7 @@ class TTemplate extends TApplicationComponent implements ITemplate $properties=&$object[2]; if($component instanceof TControl) { - if($component instanceof TOutputCache) + if($component instanceof \Prado\Web\UI\WebControls\TOutputCache) $component->setCacheKeyPrefix($this->_hashCode.$key); $component->setTemplateControl($tplControl); if(isset($properties['id'])) @@ -641,7 +647,7 @@ class TTemplate extends TApplicationComponent implements ITemplate if($textStart$att) diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php index 1e57ba45..f705ec1e 100644 --- a/framework/Web/UI/TTemplateControl.php +++ b/framework/Web/UI/TTemplateControl.php @@ -10,11 +10,11 @@ */ namespace Prado\Web\UI; - -/** - * Includes TCompositeControl class - */ -Prado::using('System.Web.UI.TCompositeControl'); +use Prado\Prado; +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Web\UI\WebControls\TContent; +use Prado\Web\UI\WebControls\TContentPlaceHolder; /** * TTemplateControl class. diff --git a/framework/Web/UI/TTemplateControlInheritable.php b/framework/Web/UI/TTemplateControlInheritable.php index 683d81bf..d22d6421 100644 --- a/framework/Web/UI/TTemplateControlInheritable.php +++ b/framework/Web/UI/TTemplateControlInheritable.php @@ -11,8 +11,7 @@ */ namespace Prado\Web\UI; - -Prado::using('System.Web.UI.TTemplateControl'); +use Prado\Exceptions\TConfigurationException; /** * TTemplateControlInheritable class. diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 1ac8c275..31f7c56d 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -10,11 +10,7 @@ */ namespace Prado\Web\UI; - -/** - * Includes TOutputCache class file - */ -Prado::using('System.Web.UI.WebControls.TOutputCache'); +use Prado\Prado; /** * TTemplateManager class @@ -36,7 +32,7 @@ Prado::using('System.Web.UI.WebControls.TOutputCache'); * @package Prado\Web\UI * @since 3.0 */ -class TTemplateManager extends TModule +class TTemplateManager extends \Prado\TModule { /** * Template file extension @@ -64,7 +60,7 @@ class TTemplateManager extends TModule */ public function getTemplateByClassName($className) { - $class=new ReflectionClass($className); + $class=new \ReflectionClass($className); $tplFile=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$className.self::TEMPLATE_FILE_EXT; return $this->getTemplateByFileName($tplFile); } diff --git a/framework/Web/UI/TTheme.php b/framework/Web/UI/TTheme.php index 5b37299e..f12c38b5 100644 --- a/framework/Web/UI/TTheme.php +++ b/framework/Web/UI/TTheme.php @@ -10,6 +10,10 @@ */ namespace Prado\Web\UI; +use Prado\Exceptions\TIOException; +use Prado\Exceptions\TConfigurationException; +use Prado\Prado; +use Prado\TApplicationMode; /** * TTheme class @@ -36,7 +40,7 @@ namespace Prado\Web\UI; * @package Prado\Web\UI * @since 3.0 */ -class TTheme extends TApplicationComponent implements ITheme +class TTheme extends \Prado\TApplicationComponent implements ITheme { /** * prefix for cache variable name used to store parsed themes @@ -252,7 +256,7 @@ class TTheme extends TApplicationComponent implements ITheme { foreach($this->_skins[$type][$id] as $name=>$value) { - Prado::trace("Applying skin $name to $type",'System.Web.UI.TThemeManager'); + Prado::trace("Applying skin $name to $type",'Prado\Web\UI\TThemeManager'); if(is_array($value)) { switch($value[0]) diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index 8f8337ee..9b8d19c8 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -10,8 +10,11 @@ */ namespace Prado\Web\UI; - -Prado::using('System.Web.Services.TPageService'); +use Prado\Exceptions\TConfigurationException; +use Prado\Exceptions\TInvalidDataValueException; +use Prado\Exceptions\TInvalidOperationException; +use Prado\Prado; +use Prado\Web\Services\TPageService; /** * TThemeManager class @@ -38,7 +41,7 @@ Prado::using('System.Web.Services.TPageService'); * @package Prado\Web\UI * @since 3.0 */ -class TThemeManager extends TModule +class TThemeManager extends \Prado\TModule { /** * default themes base path diff --git a/framework/Web/UI/WebControls/TBulletedListEventParameter.php b/framework/Web/UI/WebControls/TBulletedListEventParameter.php index a28cb29b..1c0c22e4 100644 --- a/framework/Web/UI/WebControls/TBulletedListEventParameter.php +++ b/framework/Web/UI/WebControls/TBulletedListEventParameter.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TBulletedListEventParameter extends TEventParameter +class TBulletedListEventParameter extends \Prado\TEventParameter { /** * @var integer index of the item clicked diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php index 3796e1f3..3325b97c 100644 --- a/framework/Web/UI/WebControls/TDataGridColumn.php +++ b/framework/Web/UI/WebControls/TDataGridColumn.php @@ -62,7 +62,7 @@ Prado::using('System.Web.UI.WebControls.TDataGrid'); * @package Prado\Web\UI\WebControls * @since 3.0 */ -abstract class TDataGridColumn extends TApplicationComponent +abstract class TDataGridColumn extends \Prado\TApplicationComponent { private $_id=''; private $_owner=null; diff --git a/framework/Web/UI/WebControls/TDataGridItemEventParameter.php b/framework/Web/UI/WebControls/TDataGridItemEventParameter.php index bc519012..23daa44f 100644 --- a/framework/Web/UI/WebControls/TDataGridItemEventParameter.php +++ b/framework/Web/UI/WebControls/TDataGridItemEventParameter.php @@ -27,7 +27,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TDataGridItemEventParameter extends TEventParameter +class TDataGridItemEventParameter extends \Prado\TEventParameter { /** * The TDataGridItem control responsible for the event. diff --git a/framework/Web/UI/WebControls/TDataGridPageChangedEventParameter.php b/framework/Web/UI/WebControls/TDataGridPageChangedEventParameter.php index 182881bf..14104fa4 100644 --- a/framework/Web/UI/WebControls/TDataGridPageChangedEventParameter.php +++ b/framework/Web/UI/WebControls/TDataGridPageChangedEventParameter.php @@ -30,7 +30,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TDataGridPageChangedEventParameter extends TEventParameter +class TDataGridPageChangedEventParameter extends \Prado\TEventParameter { /** * @var integer new page index diff --git a/framework/Web/UI/WebControls/TDataGridPagerEventParameter.php b/framework/Web/UI/WebControls/TDataGridPagerEventParameter.php index 456a5814..2e16c351 100644 --- a/framework/Web/UI/WebControls/TDataGridPagerEventParameter.php +++ b/framework/Web/UI/WebControls/TDataGridPagerEventParameter.php @@ -27,7 +27,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TDataGridPagerEventParameter extends TEventParameter +class TDataGridPagerEventParameter extends \Prado\TEventParameter { /** * The TDataGridPager control responsible for the event. diff --git a/framework/Web/UI/WebControls/TDataGridSortCommandEventParameter.php b/framework/Web/UI/WebControls/TDataGridSortCommandEventParameter.php index f9bc61c6..8f8273e4 100644 --- a/framework/Web/UI/WebControls/TDataGridSortCommandEventParameter.php +++ b/framework/Web/UI/WebControls/TDataGridSortCommandEventParameter.php @@ -30,7 +30,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TDataGridSortCommandEventParameter extends TEventParameter +class TDataGridSortCommandEventParameter extends \Prado\TEventParameter { /** * @var string sort expression diff --git a/framework/Web/UI/WebControls/TDataListItemEventParameter.php b/framework/Web/UI/WebControls/TDataListItemEventParameter.php index 8ea7c4c0..f023db3b 100644 --- a/framework/Web/UI/WebControls/TDataListItemEventParameter.php +++ b/framework/Web/UI/WebControls/TDataListItemEventParameter.php @@ -22,7 +22,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TDataListItemEventParameter extends TEventParameter +class TDataListItemEventParameter extends \Prado\TEventParameter { /** * The datalist item control responsible for the event. diff --git a/framework/Web/UI/WebControls/TDataSourceSelectParameters.php b/framework/Web/UI/WebControls/TDataSourceSelectParameters.php index a0d7f760..2c4a6d3e 100644 --- a/framework/Web/UI/WebControls/TDataSourceSelectParameters.php +++ b/framework/Web/UI/WebControls/TDataSourceSelectParameters.php @@ -18,7 +18,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TDataSourceSelectParameters extends TComponent +class TDataSourceSelectParameters extends \Prado\TComponent { private $_retrieveTotalRowCount=false; private $_startRowIndex=0; diff --git a/framework/Web/UI/WebControls/TDataSourceView.php b/framework/Web/UI/WebControls/TDataSourceView.php index e64ecabf..251bf572 100644 --- a/framework/Web/UI/WebControls/TDataSourceView.php +++ b/framework/Web/UI/WebControls/TDataSourceView.php @@ -18,7 +18,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -abstract class TDataSourceView extends TComponent +abstract class TDataSourceView extends \Prado\TComponent { private $_owner; private $_name; diff --git a/framework/Web/UI/WebControls/TFont.php b/framework/Web/UI/WebControls/TFont.php index 706fc974..82a8ed38 100644 --- a/framework/Web/UI/WebControls/TFont.php +++ b/framework/Web/UI/WebControls/TFont.php @@ -20,7 +20,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TFont extends TComponent +class TFont extends \Prado\TComponent { /** * Bits indicating the font states. diff --git a/framework/Web/UI/WebControls/THotSpot.php b/framework/Web/UI/WebControls/THotSpot.php index 79d09a14..45fd6ae5 100644 --- a/framework/Web/UI/WebControls/THotSpot.php +++ b/framework/Web/UI/WebControls/THotSpot.php @@ -22,7 +22,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -abstract class THotSpot extends TComponent +abstract class THotSpot extends \Prado\TComponent { private $_viewState=array(); diff --git a/framework/Web/UI/WebControls/TImageClickEventParameter.php b/framework/Web/UI/WebControls/TImageClickEventParameter.php index 746815fa..4dac6009 100644 --- a/framework/Web/UI/WebControls/TImageClickEventParameter.php +++ b/framework/Web/UI/WebControls/TImageClickEventParameter.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TImageClickEventParameter extends TEventParameter +class TImageClickEventParameter extends \Prado\TEventParameter { /** * the X coordinate of the clicking point diff --git a/framework/Web/UI/WebControls/TImageMapEventParameter.php b/framework/Web/UI/WebControls/TImageMapEventParameter.php index 0b37b217..2f082d32 100644 --- a/framework/Web/UI/WebControls/TImageMapEventParameter.php +++ b/framework/Web/UI/WebControls/TImageMapEventParameter.php @@ -23,7 +23,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TImageMapEventParameter extends TEventParameter +class TImageMapEventParameter extends \Prado\TEventParameter { private $_postBackValue; diff --git a/framework/Web/UI/WebControls/TListItem.php b/framework/Web/UI/WebControls/TListItem.php index 11cf98aa..11fede51 100644 --- a/framework/Web/UI/WebControls/TListItem.php +++ b/framework/Web/UI/WebControls/TListItem.php @@ -25,7 +25,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TListItem extends TComponent +class TListItem extends \Prado\TComponent { /** * @var TMap list of custom attributes diff --git a/framework/Web/UI/WebControls/TMetaTag.php b/framework/Web/UI/WebControls/TMetaTag.php index f831b898..afc6b131 100644 --- a/framework/Web/UI/WebControls/TMetaTag.php +++ b/framework/Web/UI/WebControls/TMetaTag.php @@ -24,7 +24,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TMetaTag extends TComponent +class TMetaTag extends \Prado\TComponent { /** * @var string id of the meta tag diff --git a/framework/Web/UI/WebControls/TOutputCacheCalculateKeyEventParameter.php b/framework/Web/UI/WebControls/TOutputCacheCalculateKeyEventParameter.php index 13a5ddb8..404751a2 100644 --- a/framework/Web/UI/WebControls/TOutputCacheCalculateKeyEventParameter.php +++ b/framework/Web/UI/WebControls/TOutputCacheCalculateKeyEventParameter.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TOutputCacheCalculateKeyEventParameter extends TEventParameter +class TOutputCacheCalculateKeyEventParameter extends \Prado\TEventParameter { /** * @var string cache key to be appended to the default calculation scheme. diff --git a/framework/Web/UI/WebControls/TOutputCacheCheckDependencyEventParameter.php b/framework/Web/UI/WebControls/TOutputCacheCheckDependencyEventParameter.php index 50aa11fd..fd2451fd 100644 --- a/framework/Web/UI/WebControls/TOutputCacheCheckDependencyEventParameter.php +++ b/framework/Web/UI/WebControls/TOutputCacheCheckDependencyEventParameter.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TOutputCacheCheckDependencyEventParameter extends TEventParameter +class TOutputCacheCheckDependencyEventParameter extends \Prado\TEventParameter { private $_isValid=true; private $_cacheTime=0; diff --git a/framework/Web/UI/WebControls/TPagerPageChangedEventParameter.php b/framework/Web/UI/WebControls/TPagerPageChangedEventParameter.php index 3b9710e0..53d46289 100644 --- a/framework/Web/UI/WebControls/TPagerPageChangedEventParameter.php +++ b/framework/Web/UI/WebControls/TPagerPageChangedEventParameter.php @@ -25,7 +25,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0.2 */ -class TPagerPageChangedEventParameter extends TEventParameter +class TPagerPageChangedEventParameter extends \Prado\TEventParameter { /** * @var integer new page index diff --git a/framework/Web/UI/WebControls/TRepeatInfo.php b/framework/Web/UI/WebControls/TRepeatInfo.php index da153030..c32d9d72 100644 --- a/framework/Web/UI/WebControls/TRepeatInfo.php +++ b/framework/Web/UI/WebControls/TRepeatInfo.php @@ -29,7 +29,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TRepeatInfo extends TComponent +class TRepeatInfo extends \Prado\TComponent { /** * @var string caption of the table used to organize the repeated items diff --git a/framework/Web/UI/WebControls/TRepeaterItemEventParameter.php b/framework/Web/UI/WebControls/TRepeaterItemEventParameter.php index 8be36efb..2d86df38 100644 --- a/framework/Web/UI/WebControls/TRepeaterItemEventParameter.php +++ b/framework/Web/UI/WebControls/TRepeaterItemEventParameter.php @@ -22,7 +22,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TRepeaterItemEventParameter extends TEventParameter +class TRepeaterItemEventParameter extends \Prado\TEventParameter { /** * The repeater item control responsible for the event. diff --git a/framework/Web/UI/WebControls/TServerValidateEventParameter.php b/framework/Web/UI/WebControls/TServerValidateEventParameter.php index a23f01e2..cc1f30f3 100644 --- a/framework/Web/UI/WebControls/TServerValidateEventParameter.php +++ b/framework/Web/UI/WebControls/TServerValidateEventParameter.php @@ -21,7 +21,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TServerValidateEventParameter extends TEventParameter +class TServerValidateEventParameter extends \Prado\TEventParameter { /** * the value to be validated diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index 34cfaa19..04fac62d 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -25,7 +25,7 @@ Prado::using('System.Web.UI.WebControls.TFont'); * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TStyle extends TComponent +class TStyle extends \Prado\TComponent { /** * @var array storage of CSS fields diff --git a/framework/Web/UI/WebControls/TWebControlDecorator.php b/framework/Web/UI/WebControls/TWebControlDecorator.php index e41afc2a..a74d1815 100644 --- a/framework/Web/UI/WebControls/TWebControlDecorator.php +++ b/framework/Web/UI/WebControls/TWebControlDecorator.php @@ -55,7 +55,7 @@ namespace Prado\Web\UI\WebControls; * @since 3.2 */ -class TWebControlDecorator extends TComponent { +class TWebControlDecorator extends \Prado\TComponent { /** * @var boolean tells if there should only be decoration around the inner content diff --git a/framework/Web/UI/WebControls/TWizardNavigationEventParameter.php b/framework/Web/UI/WebControls/TWizardNavigationEventParameter.php index 9ecab1db..5a25b8b1 100644 --- a/framework/Web/UI/WebControls/TWizardNavigationEventParameter.php +++ b/framework/Web/UI/WebControls/TWizardNavigationEventParameter.php @@ -29,7 +29,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TWizardNavigationEventParameter extends TEventParameter +class TWizardNavigationEventParameter extends \Prado\TEventParameter { private $_cancel=false; private $_currentStep; diff --git a/framework/Web/UI/WebControls/TWizardNavigationTemplate.php b/framework/Web/UI/WebControls/TWizardNavigationTemplate.php index 1286cc89..edcf83ca 100644 --- a/framework/Web/UI/WebControls/TWizardNavigationTemplate.php +++ b/framework/Web/UI/WebControls/TWizardNavigationTemplate.php @@ -18,7 +18,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TWizardNavigationTemplate extends TComponent implements ITemplate +class TWizardNavigationTemplate extends \Prado\TComponent implements ITemplate { private $_wizard; diff --git a/framework/Web/UI/WebControls/TWizardSideBarListItemTemplate.php b/framework/Web/UI/WebControls/TWizardSideBarListItemTemplate.php index 457f8eaa..53291a0f 100644 --- a/framework/Web/UI/WebControls/TWizardSideBarListItemTemplate.php +++ b/framework/Web/UI/WebControls/TWizardSideBarListItemTemplate.php @@ -18,7 +18,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TWizardSideBarListItemTemplate extends TComponent implements ITemplate +class TWizardSideBarListItemTemplate extends \Prado\TComponent implements ITemplate { /** * Instantiates the template. diff --git a/framework/Web/UI/WebControls/TWizardSideBarTemplate.php b/framework/Web/UI/WebControls/TWizardSideBarTemplate.php index 2b71decb..8572a467 100644 --- a/framework/Web/UI/WebControls/TWizardSideBarTemplate.php +++ b/framework/Web/UI/WebControls/TWizardSideBarTemplate.php @@ -18,7 +18,7 @@ namespace Prado\Web\UI\WebControls; * @package Prado\Web\UI\WebControls * @since 3.0 */ -class TWizardSideBarTemplate extends TComponent implements ITemplate +class TWizardSideBarTemplate extends \Prado\TComponent implements ITemplate { /** * Instantiates the template. diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php index ca19a0cf..18f0611f 100644 --- a/framework/Xml/TXmlDocument.php +++ b/framework/Xml/TXmlDocument.php @@ -10,6 +10,7 @@ */ namespace Prado\Xml; +use Prado\Exceptions\TIOException; /** * TXmlDocument class. @@ -138,7 +139,7 @@ class TXmlDocument extends TXmlElement public function loadFromString($string) { // TODO: since PHP 5.1, we can get parsing errors and throw them as exception - $doc=new DOMDocument(); + $doc=new \DOMDocument(); if($doc->loadXML($string)===false) return false; @@ -175,7 +176,7 @@ class TXmlDocument extends TXmlElement $attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value); foreach($element->childNodes as $child) { - if($child instanceof DOMElement) + if($child instanceof \DOMElement) $elements->add($this->buildElement($child)); } @@ -243,7 +244,7 @@ class TXmlDocument extends TXmlElement foreach($node->childNodes as $child) { - if($child instanceof DOMElement) + if($child instanceof \DOMElement) $element->getElements()->add($this->buildElement($child)); } return $element; diff --git a/framework/Xml/TXmlElement.php b/framework/Xml/TXmlElement.php index 6ed1c62f..f55afed5 100644 --- a/framework/Xml/TXmlElement.php +++ b/framework/Xml/TXmlElement.php @@ -10,6 +10,9 @@ */ namespace Prado\Xml; +use \Prado\TPropertyValue; +use \Prado\Collections\TList; +use \Prado\Collections\TMap; /** * TXmlElement class. @@ -26,7 +29,7 @@ namespace Prado\Xml; * @package Prado\Xml * @since 3.0 */ -class TXmlElement extends TComponent +class TXmlElement extends \Prado\TComponent { /** * @var TXmlElement parent of this element diff --git a/framework/Xml/TXmlElementList.php b/framework/Xml/TXmlElementList.php index f94d0cf1..ec4d5d21 100644 --- a/framework/Xml/TXmlElementList.php +++ b/framework/Xml/TXmlElementList.php @@ -10,6 +10,7 @@ */ namespace Prado\Xml; +use Prado\Exceptions\TInvalidDataTypeException; /** * TXmlElementList class. @@ -21,7 +22,7 @@ namespace Prado\Xml; * @package Prado\Xml * @since 3.0 */ -class TXmlElementList extends TList +class TXmlElementList extends \Prado\Collections\TList { /** * @var TXmlElement owner of this list diff --git a/framework/prado.php b/framework/prado.php index a9298756..e619c398 100644 --- a/framework/prado.php +++ b/framework/prado.php @@ -19,10 +19,7 @@ namespace Prado; -/** - * Includes the PradoBase class file - */ -require_once(dirname(__FILE__).'/PradoBase.php'); +require_once __DIR__ . '/../vendor/autoload.php'; /** * Defines Prado class if not defined. @@ -41,26 +38,11 @@ if(!class_exists('Prado',false)) } } -/** - * Registers the autoload function. - * Since Prado::autoload will report a fatal error if the class file - * cannot be found, if you have multiple autoloaders, Prado::autoload - * should be registered in the last. - */ -spl_autoload_register(array('Prado','autoload')); - /** * Initializes error and exception handlers */ Prado::initErrorHandlers(); -/** - * Includes TApplication class file - */ -require_once(dirname(__FILE__).'/TApplication.php'); - -/** - * Includes TShellApplication class file - */ -require_once(dirname(__FILE__).'/TShellApplication.php'); - +class_alias('\Prado\TApplication', 'TApplication', true); +class_alias('\Prado\Web\Services\TPageService', 'TPageService', true); +class_alias('\Prado\Web\UI\TPage', 'TPage', true); -- cgit v1.2.3