]> dev.renevier.net Git - syj.git/blobdiff - application/Bootstrap.php
add mapquest layer back
[syj.git] / application / Bootstrap.php
index 08816c00be5d778f194331ce775dd4431f7b1691..f3fb3999fbdf836831c3fb20a20f7ee74c846ef7 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-/*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
+/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
     and is published under the AGPL license. */
 
 class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
@@ -14,12 +14,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
         parent::_bootstrap($resource);
     }
 
-    public function run()
-    {
-        $sessionConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
-        Zend_Session::setOptions($sessionConfig->toArray());
+    public function run() {
         Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->initView(APPLICATION_PATH . '/views/', 'Syj_View');
-
         parent::run();
     }
 
@@ -34,11 +30,32 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
         if (strpos ($class, "Syj_") === 0) {
             $segments = explode ('_', $class);
 
+            if (count($segments) < 2) {
+                return;
+            }
+
+            if (count($segments) == 2) {
+                $filename = APPLICATION_PATH . '/' . end($segments) . '.php';
+                if (Zend_Loader::isReadable($filename)) {
+                    include_once $filename;
+                }
+                return;
+            }
+
             if (count($segments) < 3) {
                 return;
             }
 
-            $dirpath = implode('/', array_map('strtolower', array_slice($segments, 1, -1)));
+            $isinterface = false;
+            if (strtolower(end($segments)) == "interface") {
+                $isinterface = true;
+                array_pop($segments);
+            }
+
+            $dirpath = implode(DIRECTORY_SEPARATOR, array_map('strtolower', array_slice($segments, 1, -1)));
+            if ($isinterface) {
+                $dirpath = "interface" . DIRECTORY_SEPARATOR . $dirpath;
+            }
             $filename = APPLICATION_PATH . '/' . ($dirpath ? $dirpath . '/' : '') . end($segments) . '.php';
             if (Zend_Loader::isReadable($filename)) {
                 include_once $filename;
@@ -47,4 +64,3 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
     }
 
 }
-