[ PHPXref.com ] [ Generated: Sun Jul 20 20:05:41 2008 ] [ PRADO 3.0.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/framework/ -> PradoBase.php (summary)

PradoBase class file. This is the file that establishes the PRADO component model and error handling mechanism.

Author: Qiang Xue
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Revision: $ $Date: $
File Size: 648 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 4 files
 framework/Exceptions/TException.php
 framework/TComponent.php
 framework/Util/TVarDumper.php
 framework/Util/TLogger.php

Defines 3 classes

PradoBase:: (24 methods):
  getVersion()
  initErrorHandlers()
  autoload()
  poweredByPrado()
  phpErrorHandler()
  exceptionHandler()
  setApplication()
  getApplication()
  getFrameworkPath()
  serialize()
  unserialize()
  createComponent()
  using()
  getPathOfNamespace()
  getPathOfAlias()
  setPathOfAlias()
  fatalError()
  getUserLanguages()
  getPreferredLanguage()
  trace()
  log()
  getLogger()
  varDump()
  localize()

TReflectionClass:: (3 methods):
  hasMethod()
  hasProperty()
  property_exists()

TReflectionClass:: (3 methods):
  hasMethod()
  hasProperty()
  property_exists()


Class: PradoBase  - X-Ref

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.

getVersion()   X-Ref

return: string the version of Prado framework

initErrorHandlers()   X-Ref
Initializes error handlers.
This method set error and exception handlers to be functions
defined in this class.


autoload($className)   X-Ref
Class autoload loader.
This method is provided to be invoked within an __auload() magic method.

param: string class name

poweredByPrado()   X-Ref

return: string a string that can be displayed on your Web page showing powered-by-PRADO information

phpErrorHandler($errno,$errstr,$errfile,$errline)   X-Ref
PHP error handler.
This method should be registered as PHP error handler using
{@link set_error_handler}. The method throws an exception that
contains the error information.

param: integer the level of the error raised
param: string the error message
param: string the filename that the error was raised in
param: integer the line number the error was raised at

exceptionHandler($exception)   X-Ref
Default exception handler.
This method should be registered as default exception handler using
{@link 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.

param: Exception exception that is not caught

setApplication($application)   X-Ref
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.

param: TApplication the application instance

getApplication()   X-Ref

return: TApplication the application singleton, null if the singleton has not be created yet.

getFrameworkPath()   X-Ref

return: string the path of the framework

serialize($data)   X-Ref
Serializes a data.
The original PHP serialize function has a bug that may not serialize
properly an object.

param: mixed data to be serialized
return: string the serialized data

unserialize($str)   X-Ref
Unserializes a data.
The original PHP unserialize function has a bug that may not unserialize
properly an object.

param: string data to be unserialized
return: mixed unserialized data, null if unserialize failed

createComponent($type)   X-Ref
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 paramters passed to this method except the first one (the component type)
will be supplied as component constructor paramters.

param: string component type
return: TComponent component instance of the specified type

using($namespace)   X-Ref
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).

param: string namespace to be used

getPathOfNamespace($namespace,$ext='')   X-Ref
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.

param: string namespace
param: string extension to be appended if the namespace refers to a file
return: string file path corresponding to the namespace, null if namespace is invalid

getPathOfAlias($alias)   X-Ref

param: string alias to the path
return: string the path corresponding to the alias, null if alias not defined.

setPathOfAlias($alias,$path)   X-Ref

param: string alias to the path
param: string the path corresponding to the alias

fatalError($msg)   X-Ref
Fatal error handler.
This method displays an error message together with the current call stack.
The application will exit after calling this method.

param: string error message

getUserLanguages()   X-Ref
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.

return: array list of user preferred languages.

getPreferredLanguage()   X-Ref
Returns the most preferred language by the client user.

return: string the most preferred language by the client user, defaults to English.

trace($msg,$category='Uncategorized')   X-Ref
Writes a log message.
This method wraps {@link 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.

param: string message to be logged
param: string category of the message

log($msg,$level=TLogger::INFO,$category='Uncategorized')   X-Ref
Logs a message.
Messages logged by this method may be retrieved via {@link TLogger::getLogs}
and may be recorded in different media, such as file, email, database, using
{@link TLogRouter}.

param: string message to be logged
param: integer level of the message. Valid values include
param: string category of the message

getLogger()   X-Ref

return: TLogger message logger

varDump($var,$depth=10,$highlight=false)   X-Ref
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.
param: boolean whether to syntax highlight the output. Defaults to false.
return: string the string representation of the variable

localize($text, $parameters=array()   X-Ref
Localize a text to the locale/culture specified in the globalization handler.

param: string text to be localized.
param: array a set of parameters to substitute.
param: string a different catalogue to find the localize text.
param: string the input AND output charset.
return: string localized text.

Class: TReflectionClass  - X-Ref

TReflectionClass class.
This class is written to cope with the incompatibility between different PHP versions.
It is equivalent to ReflectionClass if PHP version >= 5.1.0

hasMethod($method)   X-Ref

param: string method name
return: boolean whether the method exists

hasProperty($property)   X-Ref

param: string property name
return: boolean whether the property exists

property_exists($object, $property)   X-Ref
Detects whether an object contains the specified member variable.

param: object
param: string member variable (property) name
return: boolean

Class: TReflectionClass  - X-Ref

TReflectionClass class.
This class is written to cope with the incompatibility between different PHP versions.
It mainly provides a way to detect if a method exists for a given class name.

hasMethod($method)   X-Ref

param: string method name
return: boolean whether the method exists

hasProperty($property)   X-Ref

param: string property name
return: boolean whether the property exists

property_exists($object, $property)   X-Ref
Detects whether an object contains the specified member variable.

param: object
param: string member variable (property) name
return: boolean



[ Powered by PHPXref - Served by Debian GNU/Linux ]