Back to index

php5  5.3.10
Static Public Member Functions | Static Protected Attributes
gtAutoload Class Reference

Autoloader using a map file (gtClassMap.php) defining the file to load each class from. More...

List of all members.

Static Public Member Functions

static init ()
 Initialize the autoloader.
static autoload ($class)
 Autoload method.

Static Protected Attributes

static $classMap
static $classPath

Detailed Description

Autoloader using a map file (gtClassMap.php) defining the file to load each class from.

Definition at line 10 of file gtAutoload.php.


Member Function Documentation

static gtAutoload::autoload ( class) [static]

Autoload method.

Parameters:
string$classClass name to autoload
Returns:
null

Definition at line 55 of file gtAutoload.php.

  {
    if (isset(self::$classMap[$class])) {
      include self::$classPath . self::$classMap[$class];
    }
  }
static gtAutoload::init ( ) [static]

Initialize the autoloader.

Returns:
null

Definition at line 28 of file gtAutoload.php.

  {
    self::$classPath = dirname(__FILE__);

    if (substr(self::$classPath, -1) != '/') {
      self::$classPath .= '/';
    }

    if (file_exists(self::$classPath . 'gtClassMap.php')) {
      include self::$classPath . 'gtClassMap.php';
      self::$classMap = $gtClassMap;
    }

    if (function_exists('__autoload')) {
      spl_autoload_register('__autoload');
    }

    spl_autoload_register(array('gtAutoload', 'autoload'));
  }

Here is the call graph for this function:


Member Data Documentation

gtAutoload::$classMap [static, protected]

Definition at line 15 of file gtAutoload.php.

gtAutoload::$classPath [static, protected]

Definition at line 20 of file gtAutoload.php.


The documentation for this class was generated from the following file: