Source for file Settings.php
Documentation is available at Settings.php
* DotBoost Technologies Inc.
* DotKernel Application Framework
* @copyright Copyright (c) 2009 DotBoost Technologies (http://www.dotboost.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @version $Id: Settings.php 158 2010-06-25 08:59:20Z teo $
* Loading Settings from database, also set PHP settings from config file
* @author DotKernel Team <team@dotkernel.com>
* Get settings from database, table, and load into registry $settings
* @param database connection singleton
* @return object with values from setting table
$db = Zend_Registry::get('database');
$results = $db->fetchAll($select);
foreach ($results as $key => $val)
$settings[$val['key']] = $val['value'];
return (object) $settings;
* Set PHP configuration settings
* @param string $prefix Key prefix to prepend to array values (used to map . separated INI values)
* @return copied from Zend_Application class
public static function setPhpSettings(array $phpSettings, $prefix = '')
foreach ($phpSettings as $key => $value)
$key = empty($prefix) ? $key : $prefix . $key;
elseif (is_array($value)) self::setPhpSettings($value, $key . '.');
* Require the files according to MVC pattern, and the modules there are in application.ini file
* @param string $requestModule
$resource = Zend_Registry::get('resource');
$modules = $resource->controllers->toArray();
* if we are in frontend , we have an empty variable for $requestModule
* Also, fix with $modulePath for modules path other then frontend
if( $requestModule != '' )
$modulePath = $requestModule . '/';
$requestModule = 'frontend';
// get the list of controllers for that specific module
$modules = $modules[$requestModule];
die ('You must define at least one controller for the <b>' . $requestModule . '</b> module');
// Now require the files specific for each controller
foreach ($modules as $value)
else die ('The file: ' . DOTKERNEL_PATH . '/' . $modulePath . $value . '.php' . ' does NOT exist');
else die ('The file: ' . DOTKERNEL_PATH . '/' . $modulePath . 'views/' . ucfirst($value) . 'View.php' . ' does NOT exist');
* Get the option variables from an xml file for the current dots
* @param string $requestModule
* @param string $requestController
$fileOption = strtolower($requestController). '.xml';
$validFile = new Zend_Validate_File_Exists();
$validFile->setDirectory($dirOption);
if($validFile->isValid($fileOption))
$xml = new Zend_Config_Xml($dirOption. $fileOption, 'body');
$arrayOption = $xml->variable->toArray();
foreach ($arrayOption as $v)
if(in_array($v['option'], array('global', $requestModule)))
// allow that SEO options may be changed - the 2nd param is true(allowModifications)
$option = new Zend_Config($option, true);
|