X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=application%2FBootstrap.php;h=0d0d4cf36664fc9f71200b1c7d3b42d5203c1596;hp=5da7d3e218aa93533a938652c4da1edecfe43c38;hb=00c2579ade64a20ba2d82e98d3eea5f864864cdb;hpb=e6d781eb4614d9bb8f87133e16c62a1a5a564e77 diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 5da7d3e..0d0d4cf 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -1,9 +1,9 @@ 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;