Changeset 40
- Timestamp:
- 01/05/07 17:43:54 (2 years ago)
- Files:
-
- trunk/docroot/index.php (modified) (2 diffs)
- trunk/src/main/php/helper/RegistryFactory.php (modified) (2 diffs)
- trunk/src/main/php/helper/stubXJConfLoader.php (added)
- trunk/src/main/php/stubClassLoader.php (modified) (4 diffs)
- trunk/src/main/php/websites/PageFactory.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docroot/index.php
r2 r40 2 2 require '../src/main/php/stubClassLoader.php'; 3 3 stubClassLoader::load('websites.PageFactory', 4 'helper.RegistryFactory' 4 'helper.RegistryFactory', 5 'helper.stubXJConfLoader' 5 6 ); 6 7 class Bootstrap … … 8 9 public static function main() 9 10 { 10 $pageFactory = new PageFactory(stub ClassLoader::getInstance());11 $pageFactory = new PageFactory(stubXJConfLoader::getInstance()); 11 12 var_dump($pageFactory->getPage('../config/xml/pages/index.xml')); 12 13 trunk/src/main/php/helper/RegistryFactory.php
r2 r40 7 7 * @subpackage helper 8 8 */ 9 stubClassLoader::load('helper.stubXJConfLoader'); 9 10 /** 10 11 * Class for initializing the Registry. … … 22 23 public static function init($configFile) 23 24 { 24 $tagParser = new DefinitionParser(array('http://stubbles.net/registry' => stub ClassLoader::getInstance()));25 $tagParser = new DefinitionParser(array('http://stubbles.net/registry' => stubXJConfLoader::getInstance())); 25 26 $defs = $tagParser->parse(stubFactory::getResourcePath() . '/xjconf/registry.xml'); 26 27 $xmlParser = new XmlParser(); trunk/src/main/php/stubClassLoader.php
r2 r40 5 5 * @author Frank Kleine <mikey@stubbles.net> 6 6 */ 7 require 'XJConf/XJConfLoader.php';8 XJConfLoader::load('XJConfClassLoader');9 7 /** 10 8 * Class loader for all stubbles classes. … … 16 14 * @package stubbles 17 15 */ 18 class stubClassLoader implements XJConfClassLoader16 class stubClassLoader 19 17 { 20 18 /** … … 24 22 */ 25 23 private static $loadedFiles = array(); 26 /**27 * instance of the class loader28 *29 * @var stubClassLoader30 */31 private static $instance;32 24 33 25 /** … … 78 70 return str_replace('.', '/', $classname) . '.php'; 79 71 } 80 81 /**82 * forbidden constructor (singleton)83 */84 private final function __construct()85 {86 // nothing to do87 }88 89 /**90 * returns an instance of the class loader91 *92 * @return stubClassLoader93 */94 public static function getInstance()95 {96 if (null == self::$instance) {97 self::$instance = new self();98 }99 100 return self::$instance;101 }102 103 /**104 * forbidden cloning (singleton)105 */106 private final function __clone()107 {108 // nothing to do109 }110 111 /**112 * load the file with the given class113 *114 * @param string $fqClassName the full qualified class name115 */116 public function loadClass($fqClassName)117 {118 self::load($fqClassName);119 }120 121 /**122 * returns short class name123 *124 * @param string $fqClassName the full qualified class name125 */126 public function getType($fqClassName)127 {128 $className = explode('.', $fqClassName);129 return $className[count($className) - 1];130 }131 72 } 132 73 ?> trunk/src/main/php/websites/PageFactory.php
r2 r40 7 7 * @subpackage websites 8 8 */ 9 require_once 'XJConf/XJConfLoader.php'; 9 stubClassLoader::load('stubFactory', 10 'helper.stubXJConfLoader', 11 'websites.exceptions.PageConfigurationException' 12 ); 10 13 XJConfLoader::load('DefinitionParser', 11 14 'XmlParser', 12 15 'XJConfClassLoader' 13 );14 stubClassLoader::load('stubFactory',15 'websites.exceptions.PageConfigurationException'16 16 ); 17 17 /** … … 35 35 * @param stubClassLoader $classLoader class loader to use for loading unloaded classes 36 36 */ 37 public function __construct(stub ClassLoader $classLoader)37 public function __construct(stubXJConfLoader $classLoader) 38 38 { 39 39 if (null == self::$xmlParser) {
