From 0f56538795061eb81e4c49392f49fc9c89c63225 Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Wed, 6 Dec 2006 16:52:54 +0000
Subject: [PATCH] "Updates for new location of framework files"

---
 library/Nmc.php | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/library/Nmc.php b/library/Nmc.php
index 6e00538..4d5b5c0 100644
--- a/library/Nmc.php
+++ b/library/Nmc.php
@@ -15,6 +15,36 @@ class Nmc extends Nmc_Friendly
         echo "ha ha!";
         return parent::__get($key);
     }
+
+    static public function loadApplicationClass($class, $dirs = null)
+    {
+        $nameParts = explode('_', $class);
+        if($nameParts[0] != 'Application') {
+            throw new Nmc_Exception('Not an Application Class.');
+        }
+
+        if (class_exists($class, false)) {
+            return;
+        }
+
+        // autodiscover the path from the class name
+        $path = str_replace('_', DIRECTORY_SEPARATOR, $class);
+        $path = substr($path, 12);
+        if ($dirs === null && $path != $class) {
+            // use the autodiscovered path
+            $dirs = dirname($path);
+            $file = basename($path) . '.php';
+        } else {
+            $file = $class . '.php';
+        }
+
+        self::loadFile($file, $dirs, true);
+
+        if (!class_exists($class, false)) {
+            throw new Zend_Exception("File \"$file\" was loaded "
+                               . "but class \"$class\" was not found within.");
+        }
+    }
 }
 
 ?>
\ No newline at end of file
-- 
GitLab