예제 #1
0
 /**
  * Registers gChart_ClassLoader as an SPL class loader.
  * Inserts self first, retains existing loaders and __autoload()
  *
  * @param string $path Path to gChart
  */
 public static function register($path)
 {
     self::$_path = $path;
     self::addPath($path);
     if ($loaders = spl_autoload_functions()) {
         array_map('spl_autoload_unregister', $loaders);
     } else {
         $loaders = function_exists('__autoload') ? array('__autoload') : array();
     }
     $loaders[] = array(__CLASS__, 'load');
     array_map('spl_autoload_register', $loaders);
 }
예제 #2
0
<?php

/**
 * gChartPhp init script.
 * Sets up include paths based on the directory this file is in.
 * Registers an SPL class autoload function.
 * 
 * Taken from https://github.com/pda/pheanstalk/blob/master/pheanstalk_init.php and modified
 */
$gChartClassRoot = dirname(__FILE__);
require_once $gChartClassRoot . '/ClassLoader.php';
gChart_ClassLoader::register($gChartClassRoot);