예제 #1
0
 /** 
  * Registers the autoloader to load classes when needed. See @ref hm_getting_started
  * @param	bool		$addThisPath			adds the path where the class resides as a directory
  * @param	bool		$useHelpers			load the ptc-helpers.php file if found, and registers the event class
  * @param	bool		$registerAutoLoader		registers the load method with the spl utilities
  */
 public static function register($addThisPath = true, $useHelpers = true, $registerAutoLoader = true)
 {
     $this_class = get_called_class();
     if ($addThisPath) {
         static::addDir(dirname(__FILE__));
     }
     // add this path
     if ($registerAutoLoader) {
         spl_autoload_register(array($this_class, 'load'));
     }
     if ($useHelpers && file_exists(dirname(__FILE__) . '/ptc-helpers.php')) {
         require_once dirname(__FILE__) . '/ptc-helpers.php';
     }
     if ($useHelpers && file_exists(dirname(__FILE__) . '/PtcEvent.php')) {
         __NAMESPACE__ . PtcEvent::register();
         // register PtcEvent with helpers
     }
     $namespace = @strtoupper(@str_replace('\\', '_', __NAMESPACE__)) . '_';
     @define('_PTCHANDYMAN_' . $namespace, $this_class);
     // declare the class namespace
     static::_debug('Autoloader registerd', '', 'Autoloader');
 }