diff options
author | xue <> | 2006-03-31 12:42:22 +0000 |
---|---|---|
committer | xue <> | 2006-03-31 12:42:22 +0000 |
commit | 6845c00a3f752abecd9ef763848329bceaf63df4 (patch) | |
tree | d573c37ad864edde9a04f1c7b415afe6c2a9c1ef | |
parent | 06fdd252452217716b1062b632fd2fc2195a66e2 (diff) |
Reorganized folders under framework. This may break existing applications.
32 files changed, 619 insertions, 583 deletions
diff --git a/.gitattributes b/.gitattributes index 65ec8a99..c36622ca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -323,6 +323,10 @@ framework/3rdParty/geshi/geshi/prado.php -text framework/3rdParty/geshi/geshi/xml.php -text framework/3rdParty/geshi/highlight.css -text framework/3rdParty/readme.html -text +framework/Caching/TAPCCache.php -text +framework/Caching/TCache.php -text +framework/Caching/TMemCache.php -text +framework/Caching/TSqliteCache.php -text framework/Collections/TAttributeCollection.php -text framework/Collections/TDummyDataSource.php -text framework/Collections/TList.php -text @@ -330,14 +334,6 @@ framework/Collections/TMap.php -text framework/Collections/TPagedDataSource.php -text framework/Collections/TPagedList.php -text framework/Collections/TStack.php -text -framework/Data/TAPCCache.php -text -framework/Data/TCache.php -text -framework/Data/TDataFieldAccessor.php -text -framework/Data/TMemCache.php -text -framework/Data/TSimpleDateFormatter.php -text -framework/Data/TSqliteCache.php -text -framework/Data/TTarFileExtractor.php -text -framework/Data/TXmlDocument.php -text framework/DataAccess/TAdodbProvider.php -text framework/DataAccess/TCreoleProvider.php -text framework/DataAccess/TDatabaseProvider.php -text @@ -646,8 +642,9 @@ framework/I18N/core/data/zh_TW.dat -text framework/I18N/core/util.php -text framework/I18N/schema/mysql.sql -text framework/I18N/schema/sqlite.sql -text -framework/Log/TLogRouter.php -text -framework/Log/TLogger.php -text +framework/IO/TTarFileExtractor.php -text +framework/IO/TTextWriter.php -text +framework/PradoBase.php -text framework/Security/TAuthManager.php -text framework/Security/TAuthorizationRule.php -text framework/Security/TMembershipManager.php -text @@ -656,6 +653,13 @@ framework/Security/TUserManager.php -text framework/TApplication.php -text framework/TApplicationComponent.php -text framework/TComponent.php -text +framework/TModule.php -text +framework/TService.php -text +framework/Util/TDataFieldAccessor.php -text +framework/Util/TLogRouter.php -text +framework/Util/TLogger.php -text +framework/Util/TSimpleDateFormatter.php -text +framework/Util/TVarDumper.php -text framework/Web/Javascripts/TJSON.php -text framework/Web/Javascripts/TJavaScript.php -text framework/Web/Javascripts/colorpicker/background.png -text @@ -821,7 +825,8 @@ framework/Web/UI/WebControls/TValidationSummary.php -text framework/Web/UI/WebControls/TWebControl.php -text framework/Web/UI/WebControls/TWebControlAdapter.php -text framework/Web/UI/WebControls/TWizard.php -text -framework/core.php -text +framework/Xml/TXmlDocument.php -text +framework/interfaces.php -text framework/prado.php -text /index.html -text requirements/index.php -text diff --git a/buildscripts/phpbuilder/files.txt b/buildscripts/phpbuilder/files.txt index 0ec9127f..2c5e03f6 100644 --- a/buildscripts/phpbuilder/files.txt +++ b/buildscripts/phpbuilder/files.txt @@ -9,11 +9,10 @@ Collections/TAttributeCollection.php # Collections/TPagedDataSource.php
# Collections/TDummyDataSource.php
-Data/TXmlDocument.php
+Xml/TXmlDocument.php
Web/THttpUtility.php
Web/Javascripts/TJavaScript.php
Data/TCache.php
-Data/TDataFieldAccessor.php
Log/TLogger.php
core.php
diff --git a/demos/personal/protected/application.xml b/demos/personal/protected/application.xml index 48fa0490..2565d1a0 100644 --- a/demos/personal/protected/application.xml +++ b/demos/personal/protected/application.xml @@ -12,7 +12,7 @@ <!--
<module id="session" class="THttpSession" />
-->
- <module id="log" class="System.Log.TLogRouter">
+ <module id="log" class="System.Util.TLogRouter">
<route class="TBrowserLogRoute" Categories="System" />
<route class="TFileLogRoute" Categories="System" Levels="Notice,Warning,Error,Alert,Fatal" />
</module>
diff --git a/demos/quickstart/protected/application.xml b/demos/quickstart/protected/application.xml index cf00807c..0eba3be7 100644 --- a/demos/quickstart/protected/application.xml +++ b/demos/quickstart/protected/application.xml @@ -3,10 +3,10 @@ <application id="QuickStart" Mode="Debug">
<!--<modules>-->
<!-- uncomment the following to enable caching
- <module id="cache" class="System.Data.TSqliteCache" />
+ <module id="cache" class="System.Caching.TSqliteCache" />
-->
<!-- uncomment the following to enable logging to file
- <module id="log" class="System.Log.TLogRouter">
+ <module id="log" class="System.Util.TLogRouter">
<route class="TFileLogRoute" />
</module>
-->
diff --git a/framework/Data/TAPCCache.php b/framework/Caching/TAPCCache.php index 5c0a6eba..da493f63 100644 --- a/framework/Data/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
*/
/**
@@ -39,7 +39,7 @@ *
* @author Alban Hanry <compte_messagerie@hotmail.com>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
* @since 3.0b
*/
class TAPCCache extends TModule implements ICache
diff --git a/framework/Data/TCache.php b/framework/Caching/TCache.php index b598801d..d246b9d0 100644 --- a/framework/Data/TCache.php +++ b/framework/Caching/TCache.php @@ -7,7 +7,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
* @since 3.0
*/
interface ICache
diff --git a/framework/Data/TMemCache.php b/framework/Caching/TMemCache.php index c71de1de..bcd49036 100644 --- a/framework/Data/TMemCache.php +++ b/framework/Caching/TMemCache.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
*/
/**
@@ -59,7 +59,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
* @since 3.0
*/
class TMemCache extends TModule implements ICache
diff --git a/framework/Data/TSqliteCache.php b/framework/Caching/TSqliteCache.php index 1654d577..13aac8ca 100644 --- a/framework/Data/TSqliteCache.php +++ b/framework/Caching/TSqliteCache.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
*/
/**
@@ -62,7 +62,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Caching
* @since 3.0
*/
class TSqliteCache extends TModule implements ICache
diff --git a/framework/Data/TTarFileExtractor.php b/framework/IO/TTarFileExtractor.php index 12749d16..611662c5 100644 --- a/framework/Data/TTarFileExtractor.php +++ b/framework/IO/TTarFileExtractor.php @@ -3,11 +3,9 @@ * TTarFileExtractor class file
*
* @author Vincent Blavet <vincent@phpconcept.net>
- * @link http://www.pradosoft.com/
- * @copyright Copyright © 2005 PradoSoft
- * @license http://www.pradosoft.com/license/
+ * @copyright Copyright © 1997-2003 The PHP Group
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.IO
*/
/* vim: set ts=4 sw=4: */
@@ -34,7 +32,7 @@ *
* @author Vincent Blavet <vincent@phpconcept.net>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.IO
* @since 3.0
*/
class TTarFileExtractor
@@ -130,7 +128,7 @@ class TTarFileExtractor {
throw new Exception($p_message);
}
-
+
private function _isArchive($p_filename=null)
{
if ($p_filename == null) {
@@ -185,7 +183,7 @@ class TTarFileExtractor private function _close()
{
//if (isset($this->_file)) {
- if (is_resource($this->_file))
+ if (is_resource($this->_file))
{
@fclose($this->_file);
$this->_file = 0;
diff --git a/framework/IO/TTextWriter.php b/framework/IO/TTextWriter.php new file mode 100644 index 00000000..a6bf5751 --- /dev/null +++ b/framework/IO/TTextWriter.php @@ -0,0 +1,60 @@ +<?php
+/**
+ * TTextWriter class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.IO
+ */
+
+/**
+ * TTextWriter class.
+ *
+ * TTextWriter implements a memory-based text writer.
+ * Content written by TTextWriter are stored in memory
+ * and can be obtained by calling {@link flush()}.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @since 3.0
+ */
+class TTextWriter extends TComponent implements ITextWriter
+{
+ private $_str='';
+
+ /**
+ * Flushes the content that has been written.
+ * @return string the content being flushed
+ */
+ public function flush()
+ {
+ $str=$this->_str;
+ $this->_str='';
+ return $str;
+ }
+
+ /**
+ * Writes a string.
+ * @param string string to be written
+ */
+ public function write($str)
+ {
+ $this->_str.=$str;
+ }
+
+ /**
+ * Writers a string and terminates it with a newline.
+ * @param string content to be written
+ * @see write
+ */
+ public function writeLine($str='')
+ {
+ $this->write($str."\n");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/framework/core.php b/framework/PradoBase.php index 6f7d081d..09dcc9e9 100644 --- a/framework/core.php +++ b/framework/PradoBase.php @@ -1,8 +1,9 @@ <?php
/**
- * Prado core interfaces and classes.
+ * PradoBase class file.
*
- * This file contains and includes the definitions of Prado core interfaces and classes.
+ * This is the file that establishes the PRADO component model
+ * and error handling mechanism.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
@@ -13,463 +14,17 @@ */
/**
- * The framework installation path.
+ * Defines the PRADO framework installation path.
*/
-define('PRADO_DIR',dirname(__FILE__));
+if(!defined('PRADO_DIR'))
+ define('PRADO_DIR',dirname(__FILE__));
/**
- * Includes TComponent definition
+ * Includes the classes essential for PradoBase class
*/
require_once(PRADO_DIR.'/TComponent.php');
-/**
- * Includes TApplicationComponent definition
- */
-require_once(PRADO_DIR.'/TApplicationComponent.php');
-/**
- * Includes exception definitions
- */
require_once(PRADO_DIR.'/Exceptions/TException.php');
-/**
- * Includes TList definition
- */
-require_once(PRADO_DIR.'/Collections/TList.php');
-/**
- * Includes TMap definition
- */
-require_once(PRADO_DIR.'/Collections/TMap.php');
-/**
- * Includes TStack definition
- */
-require_once(PRADO_DIR.'/Collections/TStack.php');
-/**
- * Includes TXmlDocument, TXmlElement definition
- */
-require_once(PRADO_DIR.'/Data/TXmlDocument.php');
-/**
- * Includes THttpUtility definition
- */
-require_once(PRADO_DIR.'/Web/THttpUtility.php');
-/**
- * Includes TJavaScript definition
- */
-require_once(PRADO_DIR.'/Web/Javascripts/TJavaScript.php');
-/**
- * Includes TCache definition
- */
-require_once(PRADO_DIR.'/Data/TCache.php');
-/**
- * Includes TDataFieldAccessor definition
- */
-require_once(PRADO_DIR.'/Data/TDataFieldAccessor.php');
-/**
- * Includes TLogger definition
- */
-require_once(PRADO_DIR.'/Log/TLogger.php');
-
-/**
- * IModule interface.
- *
- * This interface must be implemented by application modules.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-interface IModule
-{
- /**
- * Initializes the module.
- * @param TXmlElement the configuration for the module
- */
- public function init($config);
- /**
- * @return string ID of the module
- */
- public function getID();
- /**
- * @param string ID of the module
- */
- public function setID($id);
-}
-
-/**
- * IService interface.
- *
- * This interface must be implemented by services.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-interface IService
-{
- /**
- * Initializes the service.
- * @param TXmlElement the configuration for the service
- */
- public function init($config);
- /**
- * @return string ID of the service
- */
- public function getID();
- /**
- * @param string ID of the service
- */
- public function setID($id);
- /**
- * Runs the service.
- */
- public function run();
-}
-
-/**
- * ITextWriter interface.
- *
- * This interface must be implemented by writers.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @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();
-}
-
-/**
- * ITheme interface.
- *
- * This interface must be implemented by theme.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-interface ITheme
-{
- /**
- * Applies this theme to the specified control.
- * @param TControl the control to be applied with this theme
- */
- public function applySkin($control);
-}
-
-/**
- * ITemplate interface
- *
- * ITemplate specifies the interface for classes encapsulating
- * parsed template structures.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-interface ITemplate
-{
- /**
- * Instantiates the template.
- * Content in the template will be instantiated as components and text strings
- * and passed to the specified parent control.
- * @param TControl the parent control
- */
- public function instantiateIn($parent);
-}
-
-/**
- * IUser interface.
- *
- * This interface must be implemented by user objects.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @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);
-}
-
-/**
- * IStatePersister class.
- *
- * This interface must be implemented by all state persister classes (such as
- * {@link TPageStatePersister}, {@link TApplicationStatePersister}.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-interface IStatePersister
-{
- /**
- * Loads state from a persistent storage.
- * @return mixed the state
- */
- public function load();
- /**
- * Saves state into a persistent storage.
- * @param mixed the state to be saved
- */
- public function save($state);
-}
-
-/**
- * TModule class.
- *
- * TModule implements the basic methods required by IModule and may be
- * used as the basic class for application modules.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-abstract class TModule extends TApplicationComponent implements IModule
-{
- /**
- * @var string module id
- */
- private $_id;
-
- /**
- * Initializes the module.
- * This method is required by IModule and is invoked by application.
- * @param TXmlElement module configuration
- */
- public function init($config)
- {
- }
-
- /**
- * @return string id of this module
- */
- public function getID()
- {
- return $this->_id;
- }
-
- /**
- * @param string id of this module
- */
- public function setID($value)
- {
- $this->_id=$value;
- }
-}
-
-/**
- * TService class.
- *
- * TService implements the basic methods required by IService and may be
- * used as the basic class for application services.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-abstract class TService extends TApplicationComponent implements IService
-{
- /**
- * @var string service id
- */
- private $_id;
-
- /**
- * Initializes the service and attaches {@link run} to the RunService event of application.
- * This method is required by IService and is invoked by application.
- * @param TXmlElement module configuration
- */
- public function init($config)
- {
- }
-
- /**
- * @return string id of this service
- */
- public function getID()
- {
- return $this->_id;
- }
-
- /**
- * @param string id of this service
- */
- public function setID($value)
- {
- $this->_id=$value;
- }
-
- /**
- * Runs the service.
- */
- public function run()
- {
- }
-}
-
-/**
- * TVarDumper class.
- *
- * TVarDumper is intended to replace the buggy PHP function var_dump and print_r.
- * It can correctly identify the recursively referenced objects in a complex
- * object structure. It also has a recurisve depth control to avoid indefinite
- * recursive display of some peculiar variables.
- *
- * TVarDumper can be used as follows,
- * <code>
- * echo TVarDumper::dump($var);
- * </code>
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-class TVarDumper
-{
- private static $_objects;
- private static $_output;
- private static $_depth;
-
- /**
- * Converts a variable into a string representation.
- * This method achieves the similar functionality as var_dump and print_r
- * but is more robust when handling complex objects such as PRADO controls.
- * @param mixed variable to be dumped
- * @param integer maximum depth that the dumper should go into the variable. Defaults to 10.
- * @return string the string representation of the variable
- */
- public static function dump($var,$depth=10)
- {
- self::$_output='';
- self::$_objects=array();
- self::$_depth=$depth;
- self::dumpInternal($var,0);
- return self::$_output;
- }
-
- private static function dumpInternal($var,$level)
- {
- switch(gettype($var))
- {
- case 'boolean':
- self::$_output.=$var?'true':'false';
- break;
- case 'integer':
- self::$_output.="$var";
- break;
- case 'double':
- self::$_output.="$var";
- break;
- case 'string':
- self::$_output.="'$var'";
- break;
- case 'resource':
- self::$_output.='{resource}';
- break;
- case 'NULL':
- self::$_output.="null";
- break;
- case 'unknown type':
- self::$_output.='{unknown}';
- break;
- case 'array':
- if(self::$_depth<=$level)
- self::$_output.='array(...)';
- else if(empty($var))
- self::$_output.='array()';
- else
- {
- $keys=array_keys($var);
- $spaces=str_repeat(' ',$level*4);
- self::$_output.="array\n".$spaces.'(';
- foreach($keys as $key)
- {
- self::$_output.="\n".$spaces." [$key] => ";
- self::$_output.=self::dumpInternal($var[$key],$level+1);
- }
- self::$_output.="\n".$spaces.')';
- }
- break;
- case 'object':
- if(($id=array_search($var,self::$_objects,true))!==false)
- self::$_output.=get_class($var).'#'.($id+1).'(...)';
- else if(self::$_depth<=$level)
- self::$_output.=get_class($var).'(...)';
- else
- {
- $id=array_push(self::$_objects,$var);
- $className=get_class($var);
- $members=(array)$var;
- $keys=array_keys($members);
- $spaces=str_repeat(' ',$level*4);
- self::$_output.="$className#$id\n".$spaces.'(';
- foreach($keys as $key)
- {
- $keyDisplay=strtr(trim($key),array("\0"=>':'));
- self::$_output.="\n".$spaces." [$keyDisplay] => ";
- self::$_output.=self::dumpInternal($members[$key],$level+1);
- }
- self::$_output.="\n".$spaces.')';
- }
- break;
- }
- }
-}
-
+require_once(PRADO_DIR.'/Util/TLogger.php');
/**
* PradoBase class.
@@ -960,56 +515,11 @@ class PradoBase */
public static function varDump($var,$depth=10)
{
+ require_once(PRADO_DIR.'/Util/TVarDumper.php');
return TVarDumper::dump($var,$depth);
}
}
-/**
- * TTextWriter class.
- *
- * TTextWriter implements a memory-based text writer.
- * Content written by TTextWriter are stored in memory
- * and can be obtained by calling {@link flush()}.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-class TTextWriter extends TComponent implements ITextWriter
-{
- private $_str='';
-
- /**
- * Flushes the content that has been written.
- * @return string the content being flushed
- */
- public function flush()
- {
- $str=$this->_str;
- $this->_str='';
- return $str;
- }
-
- /**
- * Writes a string.
- * @param string string to be written
- */
- public function write($str)
- {
- $this->_str.=$str;
- }
-
- /**
- * Writers a string and terminates it with a newline.
- * @param string content to be written
- * @see write
- */
- public function writeLine($str='')
- {
- $this->write($str."\n");
- }
-}
if(version_compare(phpversion(),'5.1.0','>='))
{
diff --git a/framework/TApplication.php b/framework/TApplication.php index b94a4e53..9d8db867 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -11,36 +11,30 @@ */ /** - * Includes TErrorHandler class + * Includes core interfaces essential for TApplication class */ -require_once(PRADO_DIR.'/Exceptions/TErrorHandler.php'); +require_once(PRADO_DIR.'/interfaces.php'); + /** - * Includes THttpRequest class + * Includes core classes essential for TApplication class */ +require_once(PRADO_DIR.'/TApplicationComponent.php'); +require_once(PRADO_DIR.'/TModule.php'); +require_once(PRADO_DIR.'/TService.php'); +require_once(PRADO_DIR.'/Exceptions/TErrorHandler.php'); +require_once(PRADO_DIR.'/Caching/TCache.php'); +require_once(PRADO_DIR.'/IO/TTextWriter.php'); +require_once(PRADO_DIR.'/Collections/TList.php'); +require_once(PRADO_DIR.'/Collections/TMap.php'); +require_once(PRADO_DIR.'/Xml/TXmlDocument.php'); +require_once(PRADO_DIR.'/Security/TAuthorizationRule.php'); +require_once(PRADO_DIR.'/Security/TSecurityManager.php'); +require_once(PRADO_DIR.'/Web/THttpUtility.php'); +require_once(PRADO_DIR.'/Web/Javascripts/TJavaScript.php'); require_once(PRADO_DIR.'/Web/THttpRequest.php'); -/** - * Includes THttpResponse class - */ require_once(PRADO_DIR.'/Web/THttpResponse.php'); -/** - * Includes THttpSession class - */ require_once(PRADO_DIR.'/Web/THttpSession.php'); -/** - * Includes TAuthorizationRule class - */ -require_once(PRADO_DIR.'/Security/TAuthorizationRule.php'); -/** - * Includes TSecurityManager class - */ -require_once(PRADO_DIR.'/Security/TSecurityManager.php'); -/** - * Includes TPageService class (default service) - */ require_once(PRADO_DIR.'/Web/Services/TPageService.php'); -/** - * Includes TAssetManager class - */ require_once(PRADO_DIR.'/Web/TAssetManager.php'); diff --git a/framework/TModule.php b/framework/TModule.php new file mode 100644 index 00000000..ad68ca9f --- /dev/null +++ b/framework/TModule.php @@ -0,0 +1,57 @@ +<?php
+/**
+ * TModule class file.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System
+ */
+
+/**
+ * TModule class.
+ *
+ * TModule implements the basic methods required by IModule and may be
+ * used as the basic class for application modules.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @since 3.0
+ */
+abstract class TModule extends TApplicationComponent implements IModule
+{
+ /**
+ * @var string module id
+ */
+ private $_id;
+
+ /**
+ * Initializes the module.
+ * This method is required by IModule and is invoked by application.
+ * @param TXmlElement module configuration
+ */
+ public function init($config)
+ {
+ }
+
+ /**
+ * @return string id of this module
+ */
+ public function getID()
+ {
+ return $this->_id;
+ }
+
+ /**
+ * @param string id of this module
+ */
+ public function setID($value)
+ {
+ $this->_id=$value;
+ }
+}
+
+?>
\ No newline at end of file diff --git a/framework/TService.php b/framework/TService.php new file mode 100644 index 00000000..f4a6244d --- /dev/null +++ b/framework/TService.php @@ -0,0 +1,64 @@ +<?php
+/**
+ * TService class file.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System
+ */
+
+/**
+ * TService class.
+ *
+ * TService implements the basic methods required by IService and may be
+ * used as the basic class for application services.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @since 3.0
+ */
+abstract class TService extends TApplicationComponent implements IService
+{
+ /**
+ * @var string service id
+ */
+ private $_id;
+
+ /**
+ * Initializes the service and attaches {@link run} to the RunService event of application.
+ * This method is required by IService and is invoked by application.
+ * @param TXmlElement module configuration
+ */
+ public function init($config)
+ {
+ }
+
+ /**
+ * @return string id of this service
+ */
+ public function getID()
+ {
+ return $this->_id;
+ }
+
+ /**
+ * @param string id of this service
+ */
+ public function setID($value)
+ {
+ $this->_id=$value;
+ }
+
+ /**
+ * Runs the service.
+ */
+ public function run()
+ {
+ }
+}
+
+?>
\ No newline at end of file diff --git a/framework/Data/TDataFieldAccessor.php b/framework/Util/TDataFieldAccessor.php index aa6d7be7..09512a28 100644 --- a/framework/Data/TDataFieldAccessor.php +++ b/framework/Util/TDataFieldAccessor.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Util
*/
/**
@@ -27,7 +27,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Util
* @since 3.0
*/
class TDataFieldAccessor
diff --git a/framework/Log/TLogRouter.php b/framework/Util/TLogRouter.php index d5bf3cb1..bdad8649 100644 --- a/framework/Log/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
*/
/**
@@ -30,7 +30,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
* @since 3.0
*/
class TLogRouter extends TModule
@@ -144,7 +144,7 @@ class TLogRouter extends TModule *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
* @since 3.0
*/
abstract class TLogRoute extends TApplicationComponent
@@ -311,7 +311,7 @@ abstract class TLogRoute extends TApplicationComponent *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
* @since 3.0
*/
class TFileLogRoute extends TLogRoute
@@ -451,7 +451,7 @@ class TFileLogRoute extends TLogRoute *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
* @since 3.0
*/
class TEmailLogRoute extends TLogRoute
@@ -576,7 +576,7 @@ class TEmailLogRoute extends TLogRoute *
* @author Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
* @since 3.0
*/
class TBrowserLogRoute extends TLogRoute
diff --git a/framework/Log/TLogger.php b/framework/Util/TLogger.php index 2eff5568..632c46f1 100644 --- a/framework/Log/TLogger.php +++ b/framework/Util/TLogger.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
*/
/**
@@ -19,7 +19,7 @@ *
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
- * @package System.Log
+ * @package System.Util
* @since 3.0
*/
class TLogger extends TComponent
diff --git a/framework/Data/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php index ec69a045..ce92a272 100644 --- a/framework/Data/TSimpleDateFormatter.php +++ b/framework/Util/TSimpleDateFormatter.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2006 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Util
*/
/**
@@ -41,7 +41,7 @@ *
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Revision: $ $Date: $
- * @package System.Data
+ * @package System.Util
* @since 3.0
*/
class TSimpleDateFormatter
diff --git a/framework/Util/TVarDumper.php b/framework/Util/TVarDumper.php new file mode 100644 index 00000000..0532a6ec --- /dev/null +++ b/framework/Util/TVarDumper.php @@ -0,0 +1,123 @@ +<?php
+/**
+ * TVarDumper class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Util
+ */
+
+/**
+ * TVarDumper class.
+ *
+ * TVarDumper is intended to replace the buggy PHP function var_dump and print_r.
+ * It can correctly identify the recursively referenced objects in a complex
+ * object structure. It also has a recurisve depth control to avoid indefinite
+ * recursive display of some peculiar variables.
+ *
+ * TVarDumper can be used as follows,
+ * <code>
+ * echo TVarDumper::dump($var);
+ * </code>
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Util
+ * @since 3.0
+ */
+class TVarDumper
+{
+ private static $_objects;
+ private static $_output;
+ private static $_depth;
+
+ /**
+ * Converts a variable into a string representation.
+ * This method achieves the similar functionality as var_dump and print_r
+ * but is more robust when handling complex objects such as PRADO controls.
+ * @param mixed variable to be dumped
+ * @param integer maximum depth that the dumper should go into the variable. Defaults to 10.
+ * @return string the string representation of the variable
+ */
+ public static function dump($var,$depth=10)
+ {
+ self::$_output='';
+ self::$_objects=array();
+ self::$_depth=$depth;
+ self::dumpInternal($var,0);
+ return self::$_output;
+ }
+
+ private static function dumpInternal($var,$level)
+ {
+ switch(gettype($var))
+ {
+ case 'boolean':
+ self::$_output.=$var?'true':'false';
+ break;
+ case 'integer':
+ self::$_output.="$var";
+ break;
+ case 'double':
+ self::$_output.="$var";
+ break;
+ case 'string':
+ self::$_output.="'$var'";
+ break;
+ case 'resource':
+ self::$_output.='{resource}';
+ break;
+ case 'NULL':
+ self::$_output.="null";
+ break;
+ case 'unknown type':
+ self::$_output.='{unknown}';
+ break;
+ case 'array':
+ if(self::$_depth<=$level)
+ self::$_output.='array(...)';
+ else if(empty($var))
+ self::$_output.='array()';
+ else
+ {
+ $keys=array_keys($var);
+ $spaces=str_repeat(' ',$level*4);
+ self::$_output.="array\n".$spaces.'(';
+ foreach($keys as $key)
+ {
+ self::$_output.="\n".$spaces." [$key] => ";
+ self::$_output.=self::dumpInternal($var[$key],$level+1);
+ }
+ self::$_output.="\n".$spaces.')';
+ }
+ break;
+ case 'object':
+ if(($id=array_search($var,self::$_objects,true))!==false)
+ self::$_output.=get_class($var).'#'.($id+1).'(...)';
+ else if(self::$_depth<=$level)
+ self::$_output.=get_class($var).'(...)';
+ else
+ {
+ $id=array_push(self::$_objects,$var);
+ $className=get_class($var);
+ $members=(array)$var;
+ $keys=array_keys($members);
+ $spaces=str_repeat(' ',$level*4);
+ self::$_output.="$className#$id\n".$spaces.'(';
+ foreach($keys as $key)
+ {
+ $keyDisplay=strtr(trim($key),array("\0"=>':'));
+ self::$_output.="\n".$spaces." [$keyDisplay] => ";
+ self::$_output.=self::dumpInternal($members[$key],$level+1);
+ }
+ self::$_output.="\n".$spaces.')';
+ }
+ break;
+ }
+ }
+}
+
+?>
\ No newline at end of file diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php index 267505c7..bfc5ef8b 100644 --- a/framework/Web/TAssetManager.php +++ b/framework/Web/TAssetManager.php @@ -280,7 +280,7 @@ class TAssetManager extends TModule throw new TIOException('assetmanager_tarfile_invalid',$path);
else
{
- Prado::using('System.Data.TTarFileExtractor');
+ Prado::using('System.IO.TTarFileExtractor');
$tar = new TTarFileExtractor($fullpath);
return $tar->extract($destination);
}
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index dba58555..52ec9bb1 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -1866,6 +1866,47 @@ interface IBroadcastEventReceiver }
/**
+ * ITheme interface.
+ *
+ * This interface must be implemented by theme.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI
+ * @since 3.0
+ */
+interface ITheme
+{
+ /**
+ * Applies this theme to the specified control.
+ * @param TControl the control to be applied with this theme
+ */
+ public function applySkin($control);
+}
+
+/**
+ * ITemplate interface
+ *
+ * ITemplate specifies the interface for classes encapsulating
+ * parsed template structures.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI
+ * @since 3.0
+ */
+interface ITemplate
+{
+ /**
+ * Instantiates the template.
+ * Content in the template will be instantiated as components and text strings
+ * and passed to the specified parent control.
+ * @param TControl the parent control
+ */
+ public function instantiateIn($parent);
+}
+
+/**
* TBroadcastEventParameter class
*
* TBroadcastEventParameter encapsulates the parameter data for
diff --git a/framework/Web/UI/WebControls/TBaseDataList.php b/framework/Web/UI/WebControls/TBaseDataList.php index b7c79cbe..479fb2ef 100644 --- a/framework/Web/UI/WebControls/TBaseDataList.php +++ b/framework/Web/UI/WebControls/TBaseDataList.php @@ -11,9 +11,10 @@ */
/**
- * Includes TDataBoundControl class
+ * Includes TDataBoundControl and TDataFieldAccessor classes
*/
Prado::using('System.Web.UI.WebControls.TDataBoundControl');
+Prado::using('System.Util.TDataFieldAccessor');
/**
* TBaseDataList class
diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php index 811ca50a..1bf4c529 100644 --- a/framework/Web/UI/WebControls/TCompareValidator.php +++ b/framework/Web/UI/WebControls/TCompareValidator.php @@ -201,7 +201,7 @@ class TCompareValidator extends TBaseValidator $dateFormat = $this->getDateFormat();
if($dateFormat!=='')
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter', $dateFormat);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
return array($formatter->parse($value1), $formatter->parse($value2));
}
else
diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php index e8cc81aa..de9d9d5c 100644 --- a/framework/Web/UI/WebControls/TDataGridColumn.php +++ b/framework/Web/UI/WebControls/TDataGridColumn.php @@ -11,6 +11,11 @@ */
/**
+ * Includes TDataFieldAccessor class
+ */
+Prado::using('System.Util.TDataFieldAccessor');
+
+/**
* TDataGridColumn class
*
* TDataGridColumn serves as the base class for the different column types of
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php index f3cf5a3c..81c23ce4 100644 --- a/framework/Web/UI/WebControls/TDataTypeValidator.php +++ b/framework/Web/UI/WebControls/TDataTypeValidator.php @@ -91,7 +91,7 @@ class TDataTypeValidator extends TBaseValidator $dateFormat = $this->getDateFormat();
if(strlen($dateFormat))
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',$dateFormat);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$dateFormat);
return $formatter->isValidDate($value);
}
else
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 8d6d45e4..0d30636c 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -256,7 +256,7 @@ class TDatePicker extends TTextBox public function setDate($value)
{
$date = TPropertyValue::ensureInteger($value);
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
$this->getDateFormat());
$this->setText($formatter->format($date));
}
@@ -358,7 +358,7 @@ class TDatePicker extends TTextBox $date = @mktime(0, 0, 0, $month, $day, $year);
$pattern = $this->getDateFormat();
$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter', $pattern);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
return $formatter->format($date);
}
@@ -452,7 +452,7 @@ class TDatePicker extends TTextBox protected function hasDayPattern()
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
$this->getDateFormat());
return !is_null($formatter->getDayPattern());
}
@@ -464,7 +464,7 @@ class TDatePicker extends TTextBox */
protected function renderCalendarSelections($writer, $date)
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
$this->getDateFormat());
foreach($formatter->getDayMonthYearOrdering() as $type)
{
@@ -485,7 +485,7 @@ class TDatePicker extends TTextBox {
$pattern = $this->getDateFormat();
$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',$pattern);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$pattern);
return $formatter->parse($this->getText());
}
@@ -550,7 +550,7 @@ class TDatePicker extends TTextBox */
protected function getLocalizedMonthNames($info)
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
$this->getDateFormat());
switch($formatter->getMonthPattern())
{
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index 3d73556a..ccbce4d6 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -18,6 +18,10 @@ Prado::using('System.Web.UI.WebControls.TDataBoundControl'); * Includes TAttributeCollection class
*/
Prado::using('System.Collections.TAttributeCollection');
+/**
+ * Includes TDataFieldAccessor class
+ */
+Prado::using('System.Util.TDataFieldAccessor');
/**
* TListControl class
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php index 842797ba..7ded3e71 100644 --- a/framework/Web/UI/WebControls/TRangeValidator.php +++ b/framework/Web/UI/WebControls/TRangeValidator.php @@ -226,7 +226,7 @@ class TRangeValidator extends TBaseValidator $dateFormat = $this->getDateFormat();
if($dateFormat!=='')
{
- $formatter=Prado::createComponent('System.Data.TSimpleDateFormatter', $dateFormat);
+ $formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
$value = $formatter->parse($value, $dateFormat);
if($minValue!=='')
$valid=$valid && ($value>=$formatter->parse($minValue));
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php index 0b44872b..ef4691bd 100644 --- a/framework/Web/UI/WebControls/TWizard.php +++ b/framework/Web/UI/WebControls/TWizard.php @@ -16,6 +16,7 @@ Prado::using('System.Web.UI.WebControls.TButton'); Prado::using('System.Web.UI.WebControls.TLinkButton');
Prado::using('System.Web.UI.WebControls.TImageButton');
Prado::using('System.Web.UI.WebControls.TDataList');
+Prado::using('System.Collections.TStack');
/**
* Class TWizard.
diff --git a/framework/Data/TXmlDocument.php b/framework/Xml/TXmlDocument.php index dfd65ebe..fb73a9f5 100644 --- a/framework/Data/TXmlDocument.php +++ b/framework/Xml/TXmlDocument.php @@ -7,7 +7,7 @@ * @copyright Copyright © 2005 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Revision: $ $Date: $ - * @package System.Data + * @package System.Xml */ /** @@ -23,7 +23,7 @@ * * @author Qiang Xue <qiang.xue@gmail.com> * @version $Revision: $ $Date: $ - * @package System + * @package System.Xml * @since 3.0 */ class TXmlElement extends TComponent @@ -222,7 +222,7 @@ class TXmlElement extends TComponent * * @author Qiang Xue <qiang.xue@gmail.com> * @version $Revision: $ $Date: $ - * @package System + * @package System.Xml * @since 3.0 */ class TXmlDocument extends TXmlElement @@ -387,7 +387,7 @@ class TXmlDocument extends TXmlElement * * @author Qiang Xue <qiang.xue@gmail.com> * @version $Revision: $ $Date: $ - * @package System + * @package System.Xml * @since 3.0 */ class TXmlElementList extends TList diff --git a/framework/interfaces.php b/framework/interfaces.php new file mode 100644 index 00000000..f63da347 --- /dev/null +++ b/framework/interfaces.php @@ -0,0 +1,172 @@ +<?php
+/**
+ * Core interfaces essential for TApplication class.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System
+ */
+
+/**
+ * IModule interface.
+ *
+ * This interface must be implemented by application modules.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @since 3.0
+ */
+interface IModule
+{
+ /**
+ * Initializes the module.
+ * @param TXmlElement the configuration for the module
+ */
+ public function init($config);
+ /**
+ * @return string ID of the module
+ */
+ public function getID();
+ /**
+ * @param string ID of the module
+ */
+ public function setID($id);
+}
+
+/**
+ * IService interface.
+ *
+ * This interface must be implemented by services.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @since 3.0
+ */
+interface IService
+{
+ /**
+ * Initializes the service.
+ * @param TXmlElement the configuration for the service
+ */
+ public function init($config);
+ /**
+ * @return string ID of the service
+ */
+ public function getID();
+ /**
+ * @param string ID of the service
+ */
+ public function setID($id);
+ /**
+ * Runs the service.
+ */
+ public function run();
+}
+
+/**
+ * ITextWriter interface.
+ *
+ * This interface must be implemented by writers.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @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();
+}
+
+
+/**
+ * IUser interface.
+ *
+ * This interface must be implemented by user objects.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @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);
+}
+
+/**
+ * IStatePersister class.
+ *
+ * This interface must be implemented by all state persister classes (such as
+ * {@link TPageStatePersister}, {@link TApplicationStatePersister}.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System
+ * @since 3.0
+ */
+interface IStatePersister
+{
+ /**
+ * Loads state from a persistent storage.
+ * @return mixed the state
+ */
+ public function load();
+ /**
+ * Saves state into a persistent storage.
+ * @param mixed the state to be saved
+ */
+ public function save($state);
+}
+
+?>
\ No newline at end of file diff --git a/framework/prado.php b/framework/prado.php index 59268105..d55898b4 100644 --- a/framework/prado.php +++ b/framework/prado.php @@ -4,8 +4,10 @@ *
* This file is intended to be included in the entry script of Prado applications.
* It defines Prado class by extending PradoBase, a static class providing globally
- * available functionalities to Prado applications. It also sets PHP error and
- * exception handler functions, and provides a __autoload function which automatically
+ * available functionalities that enable PRADO component model and error handling mechanism.
+ *
+ * By including this file, the PHP error and exception handlers are set as
+ * PRADO handlers, and an __autoload function is provided that automatiically
* loads a class file if the class is not defined.
*
* @author Qiang Xue <qiang.xue@gmail.com>
@@ -17,9 +19,9 @@ */
/**
- * Includes the Prado core header file
+ * Includes the PradoBase class file
*/
-require_once(dirname(__FILE__).'/core.php');
+require_once(dirname(__FILE__).'/PradoBase.php');
/**
* Defines Prado class if not defined.
|