Ejemplo n.º 1
0
/**
 * Gets called, when an undefined class is being instanciated
 *d
 * @param_string $load_class_name
 */
function feng__autoload($load_class_name)
{
    static $loader = null;
    $class_name = strtoupper($load_class_name);
    // Try to get this data from index...
    if (isset($GLOBALS[AutoLoader::GLOBAL_VAR])) {
        if (isset($GLOBALS[AutoLoader::GLOBAL_VAR][$class_name])) {
            return include $GLOBALS[AutoLoader::GLOBAL_VAR][$class_name];
        }
        // if
    }
    // if
    if (!$loader) {
        $loader = new AutoLoader();
        $loader->addDir(ROOT . '/application');
        $loader->addDir(ROOT . '/environment');
        $loader->addDir(ROOT . '/library');
        $loader->setIndexFilename(ROOT . '/cache/autoloader.php');
    }
    // if
    try {
        $loader->loadClass($class_name);
    } catch (Exception $e) {
        try {
            if (function_exists("__autoload")) {
                __autoload($class_name);
            }
        } catch (Exception $ex) {
            die('Caught Exception in AutoLoader: ' . $ex->__toString());
        }
    }
    // try
}
Ejemplo n.º 2
0
/**
 * Gets called, when an undefined class is being instanciated
 *d
 * @param_string $load_class_name
 */
function feng__autoload($load_class_name) {
	static  $loader ;
	//$loader = null;
	$class_name = strtoupper($load_class_name);

	// Try to get this data from index...
	if(isset($GLOBALS[AutoLoader::GLOBAL_VAR])) {
		if(isset($GLOBALS[AutoLoader::GLOBAL_VAR][$class_name])) {
			return include $GLOBALS[AutoLoader::GLOBAL_VAR][$class_name];
		} // if
	} // if
	//pre_print_r($loader) ;exit;
	
	if(!$loader) {
		$loader = new AutoLoader();
		$loader->addDir(ROOT . '/application');
		$loader->addDir(ROOT . '/environment');
		$loader->addDir(ROOT . '/library');
		
		//TODO Pepe: No tengo la conexion ni las clases de DB en este momento.. me conecto derecho 
		$temp_link  = mysql_connect(DB_HOST, DB_USER, DB_PASS) ;
		mysql_select_db(DB_NAME) ;
		$res = mysql_query("SELECT name FROM ".TABLE_PREFIX."plugins WHERE is_installed = 1 AND is_activated = 1;");
		while ($row = mysql_fetch_object($res)) {	
			$plugin_name =  strtolower($row->name) ;
			$dir  = ROOT . '/plugins/'.$plugin_name.'/application' ;
			if (is_dir($dir)) {
				$loader->addDir($dir); 
			}
		}
		mysql_close($temp_link);
		
		
		$loader->setIndexFilename(CACHE_DIR . '/autoloader.php');
		
	} // if

	try {
		$loader->loadClass($class_name);
	} catch(Exception $e) {
		try {
			if (function_exists("__autoload")) __autoload($class_name);
		} catch(Exception $ex) {
			die('Caught Exception in AutoLoader: ' . $ex->__toString());
		}
	} // try
} // __autoload
Ejemplo n.º 3
0
 function setUp()
 {
     AutoLoader::loadClass('SVGMetadataExtractorTest');
 }
 protected function setUp()
 {
     parent::setUp();
     AutoLoader::loadClass('SVGMetadataExtractorTest');
 }
Ejemplo n.º 5
0
 function setUp()
 {
     AutoLoader::loadClass('Sanitizer');
 }
Ejemplo n.º 6
0
 function __autoload($name)
 {
     AutoLoader::loadClass($name);
 }
Ejemplo n.º 7
0
 protected function setUp()
 {
     parent::setUp();
     AutoLoader::loadClass('Sanitizer');
 }
Ejemplo n.º 8
0
/**
 * @todo The exception handling doesn't seem to work if we register
 * Buan\AutoLoader::loadClass() directly in spl_autload_register(), but using
 * this global "inbetweener" function does. Might it be the fact that this
 * routine defines a new class within the scope of a class method?
 *
 * @param string $className Class to load
 * @return bool
 */
function fAutoLoader($className)
{
    // Try to load class
    try {
        AutoLoader::loadClass($className);
    } catch (Exception $e) {
        // CLASS WAS NOT FOUND. DO NOTHING.
        return false;
    }
    return true;
}
Ejemplo n.º 9
0
 public function testAutoLoader()
 {
     // get codepath where session var is not array
     CoreLocal::set('ClassLookup', false);
     AutoLoader::loadClass('LocalStorage');
     $this->assertEquals(true, class_exists('LocalStorage', false));
     AutoLoader::loadMap();
     $class_map = CoreLocal::get('ClassLookup');
     $this->assertInternalType('array', $class_map);
     $this->assertNotEmpty($class_map);
     /**
       Verify base classes and required libraries
       were properly discovered
     */
     $required_classes = array('AutoLoader', 'Authenticate', 'PreParser', 'Parser', 'BasicCorePage', 'TenderModule', 'DisplayLib', 'ReceiptLib', 'Database', 'Kicker', 'SpecialUPC', 'SpecialDept', 'DiscountType', 'PriceMethod', 'LocalStorage', 'FooterBox', 'Plugin', 'PrintHandler');
     foreach ($required_classes as $class) {
         $this->assertArrayHasKey($class, $class_map);
         $this->assertFileExists($class_map[$class]);
     }
     $mods = AutoLoader::listModules('Parser');
     $this->assertInternalType('array', $mods);
     $this->assertNotEmpty($mods);
     foreach ($mods as $m) {
         $obj = new $m();
         $this->assertInstanceOf('Parser', $obj);
     }
     $listable = array('DiscountType', 'FooterBox', 'Kicker', 'Parser', 'PreParser', 'PriceMethod', 'SpecialUPC', 'SpecialDept', 'TenderModule', 'TenderReport', 'DefaultReceiptDataFetch', 'DefaultReceiptFilter', 'DefaultReceiptSort', 'DefaultReceiptTag', 'DefaultReceiptSavings', 'ReceiptMessage', 'CustomerReceiptMessage', 'ProductSearch', 'DiscountModule', 'PrintHandler', 'TotalAction', 'VariableWeightReWrite', 'ItemNotFound');
     foreach ($listable as $base_class) {
         $mods = AutoLoader::listModules($base_class);
         $this->assertInternalType('array', $mods);
     }
 }
Ejemplo n.º 10
0
 protected function setUp()
 {
     parent::setUp();
     $this->setMwGlobals('wgCleanupPresentationalAttributes', true);
     AutoLoader::loadClass('Sanitizer');
 }