jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [ClassLoading/] [ApplicationLoader.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3namespace Phem\ClassLoading;
4 
5/**
6 *
7 * Loads site application classes
8 *
9 * @author Jakub PetrŞílka <petrzilka@czweb.net>
10 */
11class ApplicationLoader extends Loader
12{
13 
14 public function commit()
15 {
16 spl_autoload_register(function ($class)
17 {
18 if ((strpos($class, APP_NAMESPACE) !== false)&&((strpos($class,"__CG__") === false)))
19 {
20 /*
21 * here we cas use include for better efficiency
22 * because this called only once anyway
23 */
24 // echo APP_DIR."\n";
25 $path = APP_DIR . DS
26 . str_replace(APP_NAMESPACE . DS, "", str_replace('\\', DS, $class))
27 . '.php';
28 //echo "path: ".$path."\n\n";
29 include $path;
30 }
31 });
32 
33 /* INIT APPLICATION */
34 $bootstrapperClass = APP_NAMESPACE . "\\" . APP_NAME . "Boot";
35 
36 if (!class_exists($bootstrapperClass))
37 die("Invalid application bootfile (missing ". $bootstrapperClass ." class) ");
38 
39 //the class must be descendant of BootStrapper
40 $bootstrapper = new $bootstrapperClass();
41 if (!is_a($bootstrapper, "Phem\ClassLoading\Bootstrapping\Bootstrapper"))
42 die("Application bootstrapper must be inherited from Bootstrapper class");
43 
44 $bootstrapper->init();
45 }
46 
47}

Powered by WebSVN 2.2.1