- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages: default System System.Caching System.Collections System.Data System.Data.ActiveRecord System.Data.ActiveRecord.Relations System.Data.ActiveRecord.Scaffold System.Data.ActiveReecord.Scaffold.InputBuilder System.Data.Commom.Sqlite System.Data.Common System.Data.Common.Mssql System.Data.Common.Mysql System.Data.Common.Oracle System.Data.Common.Pgsql System.Data.Common.Sqlite System.Data.DataGateway System.Data.SqlMap System.Data.SqlMap.Configuration System.Data.SqlMap.Statements System.Exceptions System.I18N System.IO System.Security System.Util System.Web System.Web.Services System.Web.UI System.Web.UI.ActiveControls System.Web.UI.WebControls System.Web.UI.WebControls.assets System.Xml Classes: IActiveControl IBindable ICache ICacheDependency ICallbackEventHandler IDataRenderer IModule IRenderable IService IStatePersister IStyleable ITextWriter IUser Prado PradoBase TApplication TApplicationComponent TApplicationConfiguration TApplicationMode TApplicationStatePersister TComponent TComponentReflection TDraggableConstraint TDropContainerEventParameter TEnumerable TEventParameter TModule TPropertyValue TReflectionClass TService TShellApplication |
Keyword
# Class PradoBase
#### Direct Known Sub-classes: Prado PradoBase class. PradoBase implements a few fundamental static methods. To use the static methods, Use Prado as the class name rather than PradoBase. PradoBase is meant to serve as the base class of Prado. The latter might be rewritten for customization. Since: 3.0 Author: Qiang Xue <qiang.xue@gmail.com>
Method Summary
void | autoload ( string $className) Class autoload loader.
TComponent | createComponent ( string $type) Creates a component with the specified type.
void | exceptionHandler ( Exception $exception) Default exception handler.
void | fatalError ( string $msg) Fatal error handler.
TApplication | getApplication ()
string | getFrameworkPath ()
TLogger | getLogger ()
protected void | getPathAliases ()
string | getPathOfAlias ( string $alias)
string | getPathOfNamespace ( string $namespace, string $ext) Translates a namespace into a file path.
string | getPreferredLanguage () Returns the most preferred language by the client user.
array | getUserLanguages () Returns a list of user preferred languages.
string | getVersion ()
void | initErrorHandlers () Initializes error handlers.
string | localize ( string $text, array $parameters, string $catalogue, string $charset) Localize a text to the locale/culture specified in the globalization handler.
void | log ( string $msg, integer $level, string $category) Logs a message.
void | phpErrorHandler ( integer $errno, string $errstr, string $errfile, integer $errline) PHP error handler.
string | poweredByPrado ( integer $logoType)
string | serialize ( mixed $data) Serializes a data.
void | setApplication ( TApplication $application) Stores the application instance in the class static member.
void | setPathOfAlias ( string $alias, string $path)
void | trace ( string $msg, string $category) Writes a log message.
mixed | unserialize ( string $str) Unserializes a data.
void | using ( string $namespace, boolean $checkClassExistence) Uses a namespace.
string | varDump ( mixed $var, integer $depth, boolean $highlight) Converts a variable into a string representation.
Constant Summary
string | CLASS_FILE_EXT | File extension for Prado class files.
Method Details
## autoload
public void autoload | (string $className )
Class autoload loader. This method is provided to be invoked within an __autoload() magic method.
Input
string | $className | class name
Output
Exception
## createComponent
public TComponent createComponent | (string $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. 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.
Input
string | $type | component type
Output
TComponent | component instance of the specified type
Exception
throws | TInvalidDataValueException if the component type is unknown
## exceptionHandler
public void exceptionHandler | (Exception $exception )
Default exception handler. This method should be registered as default exception handler using http://www.php.net/set_exception_handler. The method tries to use the errorhandler module of the Prado application to handle the exception. If the application or the module does not exist, it simply echoes the exception.
Input
Exception | $exception | exception that is not caught
Output
Exception
## fatalError
public void fatalError | (string $msg )
Fatal error handler. This method displays an error message together with the current call stack. The application will exit after calling this method.
Input
string | $msg | error message
Output
Exception
## getApplication
public TApplication getApplication | ()
Output
TApplication | the application singleton, null if the singleton has not be created yet.
Exception
## getFrameworkPath
public string getFrameworkPath | ()
Output
string | the path of the framework
Exception
## getLogger
public TLogger getLogger | ()
Output
TLogger | message logger
Exception
## getPathAliases
protected void getPathAliases | ()
Output
Exception
## getPathOfAlias
public string getPathOfAlias | (string $alias )
Input
string | $alias | alias to the path
Output
string | the path corresponding to the alias, null if alias not defined.
Exception
## getPathOfNamespace
public string getPathOfNamespace | (string $namespace , string $ext )
Translates a namespace into a file path. The first segment of the namespace is considered as a path alias which is replaced with the actual path. The rest segments are subdirectory names appended to the aliased path. If the namespace ends with an asterisk '*', it represents a directory; Otherwise it represents a file whose extension name is specified by the second parameter (defaults to empty). Note, this method does not ensure the existence of the resulting file path.
Input
string | $namespace | namespace
string | $ext | extension to be appended if the namespace refers to a file
Output
string | file path corresponding to the namespace, null if namespace is invalid
Exception
## getPreferredLanguage
public string getPreferredLanguage | ()
Returns the most preferred language by the client user.
Output
string | the most preferred language by the client user, defaults to English.
Exception
## getUserLanguages
public array getUserLanguages | ()
Returns a list of user preferred languages. The languages are returned as an array. Each array element represents a single language preference. The languages are ordered according to user preferences. The first language is the most preferred.
Output
array | list of user preferred languages.
Exception
## getVersion
public string getVersion | ()
Output
string | the version of Prado framework
Exception
## initErrorHandlers
public void initErrorHandlers | ()
Initializes error handlers. This method set error and exception handlers to be functions defined in this class.
Output
Exception
## localize
public string localize | (string $text , array $parameters , string $catalogue , string $charset )
Localize a text to the locale/culture specified in the globalization handler.
Input
string | $text | text to be localized.
array | $parameters | a set of parameters to substitute.
string | $catalogue | a different catalogue to find the localize text.
string | $charset | the input AND output charset.
Output
string | localized text.
Exception
## log
public void log | (string $msg , integer $level , string $category )
Logs a message. Messages logged by this method may be retrieved via TLogger::getLogs and may be recorded in different media, such as file, email, database, using TLogRouter.
Input
string | $msg | message to be logged
integer | $level | level of the message. Valid values include TLogger::DEBUG, TLogger::INFO, TLogger::NOTICE, TLogger::WARNING, TLogger::ERROR, TLogger::ALERT, TLogger::FATAL.
string | $category | category of the message
Output
Exception
## phpErrorHandler
public void phpErrorHandler | (integer $errno , string $errstr , string $errfile , integer $errline )
PHP error handler. This method should be registered as PHP error handler using http://www.php.net/set_error_handler. The method throws an exception that contains the error information.
Input
integer | $errno | the level of the error raised
string | $errstr | the error message
string | $errfile | the filename that the error was raised in
integer | $errline | the line number the error was raised at
Output
Exception
## poweredByPrado
public string poweredByPrado | (integer $logoType )
Input
integer | $logoType | the type of "powered logo". Valid values include 0 and 1.
Output
string | a string that can be displayed on your Web page showing powered-by-PRADO information
Exception
## serialize
public string serialize | (mixed $data )
Serializes a data. The original PHP serialize function has a bug that may not serialize properly an object.
Input
mixed | $data | data to be serialized
Output
string | the serialized data
Exception
## setApplication
public void setApplication | (TApplication $application )
Stores the application instance in the class static member. This method helps implement a singleton pattern for TApplication. Repeated invocation of this method or the application constructor will cause the throw of an exception. This method should only be used by framework developers.
Input
TApplication | $application | the application instance
Output
Exception
throws | TInvalidOperationException if this method is invoked twice or more.
## setPathOfAlias
public void setPathOfAlias | (string $alias , string $path )
Input
string | $alias | alias to the path
string | $path | the path corresponding to the alias
Output
Exception
throws | TInvalidOperationException if the alias is already defined
throws | TInvalidDataValueException if the path is not a valid file path
## trace
public void trace | (string $msg , string $category )
Writes a log message. This method wraps log() by checking the application mode. When the application is in Debug mode, debug backtrace information is appended to the message and the message is logged at DEBUG level. When the application is in Performance mode, this method does nothing. Otherwise, the message is logged at INFO level.
Input
string | $msg | message to be logged
string | $category | category of the message
Output
Exception
## unserialize
public mixed unserialize | (string $str )
Unserializes a data. The original PHP unserialize function has a bug that may not unserialize properly an object.
Input
string | $str | data to be unserialized
Output
mixed | unserialized data, null if unserialize failed
Exception
## using
public void using | (string $namespace , boolean $checkClassExistence )
Uses a namespace. A namespace ending with an asterisk '*' refers to a directory, otherwise it represents a PHP file. If the namespace corresponds to a directory, the directory will be appended to the include path. If the namespace corresponds to a file, it will be included (include_once).
Input
string | $namespace | namespace to be used
boolean | $checkClassExistence | whether to check the existence of the class after the class file is included
Output
Exception
throws | TInvalidDataValueException if the namespace is invalid
## varDump
public string varDump | (mixed $var , integer $depth , boolean $highlight )
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.
Input
mixed | $var | variable to be dumped
integer | $depth | maximum depth that the dumper should go into the variable. Defaults to 10.
boolean | $highlight | whether to syntax highlight the output. Defaults to false.
Output
string | the string representation of the variable
Exception
Constant Details
### CLASS_FILE_EXT File extension for Prado class files. #### Type: string #### Value: '.php'