New autoloader usage (add a Prefix mapper instead of the static addClassPattern(...
authorChuck Hagenbuch <chuck@horde.org>
Fri, 4 Jun 2010 20:03:27 +0000 (16:03 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 4 Jun 2010 20:14:33 +0000 (16:14 -0400)
horde/rampage.php
ingo/lib/tests/AllTests.php
koward/script/Koward/koward.php
koward/test/Koward/TestInit.php
koward/www/htdocs/koward/koward.php
kronolith/lib/Application.php
wicked/lib/Page.php

index ab71eb8..4c90b5a 100644 (file)
@@ -62,8 +62,7 @@ include $routeFile;
 // Set up application class and controller loading
 // @TODO separate $app from class names so that there can be multiple instances
 // of an app in the registry?
-Horde_Autoloader::addClassPattern('/^' . $app . '_/i', $fileroot . '/lib/');
-Horde_Autoloader::addClassPattern('/^' . $app . '_/i', $fileroot . '/app/controllers/');
+$injector->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^' . $app . '(?:$|_)/i', $fileroot . '/lib/'));
 
 // Create our controller context.
 $context = array(
index a52b256..d42545d 100644 (file)
@@ -18,7 +18,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
  * Prepare the test setup.
  */
 @define('INGO_BASE', dirname(__FILE__) . '/../..');
-require_once 'Horde/Autoloader.php';
+require_once 'Horde/Core/Autoloader.php';
 date_default_timezone_set('Europe/Berlin');
 
 /**
@@ -39,7 +39,7 @@ class Ingo_AllTests extends Horde_Test_AllTests
 
         // Set up autoload
         $basedir = dirname(__FILE__);
-        Horde_Autoloader::addClassPattern('/^Ingo(?:$|_)/', $basedir . '/../');
+        $GLOBALS['__autoloader']->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Ingo(?:$|_)/', $basedir . '/../'));
 
         $suite = new PHPUnit_Framework_TestSuite('Ingo');
         $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/');
index 8b1e0c0..c68cde9 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * The Autoloader allows us to omit "require/include" statements.
  */
-require_once 'Horde/Autoloader.php';
+require_once 'Horde/Core/Autoloader.php';
 
 /**
  * FIXME START
@@ -46,10 +46,10 @@ require_once $opts->base . '/koward/config/base.php';
  * FIXME END
  */
 
-/** Configure the Autoloader to handle the "Koward" pattern */
-Horde_Autoloader::addClassPattern('/^Koward_/', 'Koward/');
+/* Configure the Autoloader to handle the "Koward" pattern */
+$__autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Koward_/', 'Koward/'));
 
-/** Dispatch the request. */
+/* Dispatch the request. */
 try {
   Koward::dispatch($opts->base . '/htdocs/koward/koward.php', 'Koward_Cli');
 } catch (Exception $e) {
index 8091e44..ac6ec3a 100644 (file)
 /**
  * The Autoloader allows us to omit "require/include" statements.
  */
-require_once 'Horde/Autoloader.php';
+require_once 'Horde/Core/Autoloader.php';
 
 if (!defined('KOWARD_BASE')) {
     define('KOWARD_BASE', dirname(__FILE__) . '/../');
 }
 
 /* Set up the application class and controller loading */
-Horde_Autoloader::addClassPattern('/^Koward_/', KOWARD_BASE . '/lib/');
-Horde_Autoloader::addClassPattern('/^Koward_/', KOWARD_BASE . '/app/controllers/');
+$__autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Koward_/', KOWARD_BASE . '/lib/'));
index 38f9ed6..b729710 100644 (file)
@@ -7,12 +7,12 @@ require_once dirname(__FILE__) . '/../../koward/config/base.php';
 /**
  * The Autoloader allows us to omit "require/include" statements.
  */
-require_once 'Horde/Autoloader.php';
+require_once 'Horde/Core/Autoloader.php';
 
-/** Configure the Autoloader to handle the "Koward" pattern */
-Horde_Autoloader::addClassPattern('/^Koward_/', 'Koward/');
+/* Configure the Autoloader to handle the "Koward" pattern */
+$__autoloader->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Koward_/', 'Koward/'));
 
-/** Dispatch the request. */
+/* Dispatch the request. */
 try {
     Koward::dispatch(__FILE__);
 } catch (Exception $e) {
index 6bcca8c..63c9709 100644 (file)
@@ -59,7 +59,7 @@ class Kronolith_Application extends Horde_Registry_Application
         /* For now, autoloading the Content_* classes depend on there being a
          * registry entry for the 'content' application that contains at least
          * the fileroot entry. */
-        Horde_Autoloader::addClassPattern('/^Content_/', $GLOBALS['registry']->get('fileroot', 'content') . '/lib/');
+        $GLOBALS['injector']->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Content_/', $GLOBALS['registry']->get('fileroot', 'content') . '/lib/'));
         if (!class_exists('Content_Tagger')) {
             throw new Horde_Exception('The Content_Tagger class could not be found. Make sure the registry entry for the Content system is present.');
         }
index 538c7df..785cba9 100644 (file)
@@ -479,10 +479,10 @@ class Page {
                                               'css_td' => 'table-cell',
                                               'css_th' => 'table-cell'));
 
-            Horde_Autoloader::addClassPattern('/^Text_Wiki_Render_Xhtml/', WICKED_BASE . '/lib/Text_Wiki/Render/Xhtml');
+            $GLOBALS['injector']->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Text_Wiki_Render_Xhtml/', WICKED_BASE . '/lib/Text_Wiki/Render/Xhtml'));
         }
 
-        Horde_Autoloader::addClassPattern('/^Text_Wiki_Parse/', WICKED_BASE . '/lib/Text_Wiki/Parse/' . $format);
+        $GLOBALS['injector']->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Text_Wiki_Parse/', WICKED_BASE . '/lib/Text_Wiki/Parse/' . $format));
 
         return $this->_proc;
     }