2 /* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3 and is published under the AGPL license. */
5 class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
6 protected static $libns = array('gisconverter', 'phptojs', 'pwdgen');
8 public function _bootstrap($resource = null) {
9 $autoloader = Zend_Loader_Autoloader::getInstance();
10 foreach (self::$libns as $namespace) {
11 $autoloader->pushAutoloader(array($this, 'syj_autoload'), array($namespace, 'Syj_'));
14 parent::_bootstrap($resource);
19 $sessionConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/session.ini', APPLICATION_ENV);
20 Zend_Session::setOptions($sessionConfig->toArray());
21 Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->initView(APPLICATION_PATH . '/views/', 'Syj_View');
26 static public function syj_autoload($class) {
27 foreach (self::$libns as $namespace) {
28 if (strpos ($class, $namespace) === 0) {
29 include_once ($namespace . ".php");
34 if (strpos ($class, "Syj_") === 0) {
35 $segments = explode ('_', $class);
37 if (count($segments) < 3) {
41 $dirpath = implode('/', array_map('strtolower', array_slice($segments, 1, -1)));
42 $filename = APPLICATION_PATH . '/' . ($dirpath ? $dirpath . '/' : '') . end($segments) . '.php';
43 if (Zend_Loader::isReadable($filename)) {
44 include_once $filename;