// start the template object, empty for the moment require DOTKERNEL_PATH . '/' . $registry->requestModule . '/' . 'View.php'; $tpl = View::getInstance(TEMPLATES_PATH . '/' . $registry->requestModule); $tpl->init(); // assign Index Template file $tpl->setViewFile(); // set paths in templates $tpl->setViewPaths(); /** * each Controller must load its own specific models and views */ Dot_Settings::loadControllerFiles($registry->requestModule); /** * Load option(specific configuration file for current dot) file */ $option = Dot_Settings::getOptionVariables($registry->requestModule, $registry->requestControllerProcessed); $registry->option = $option; /** * Start the variable for Page Title, this will be used as H1 tag too */ $pageTitle = 'Overwrite Me Please !'; /** * From rev 833 * DotAuth::checkUserToken() will be given at least one parameter * $userToken - mandatory * $userType - optional - by default 'admin' * * To simplify it, we will put the variable $userToken * If we do not have the token, it will be marked with NULL * * NULL - user does not have a token
$jsonString = Zend_Json::encode($data); echo $jsonString; exit; } // check rate limit if ($registry->configuration->api->params->lifetime == strtolower('minute')) { $timeKey = date("i"); $ttl = 60; } else { // h - 12 hrs ; H - 24 hrs $timeKey = date("H"); $ttl = 3600; } $cacheRateKey = $registry->configuration->cache->namespace . '_' . $registry->configuration->api->params->prefix . '_' . $registry->arguments['key'] . '_' . $timeKey; // using apcu directly // for more info about the caching layer see http://www.dotkernel.com/tag/dotkernel-caching/ $rate = (int) apc_fetch($cacheRateKey); $rateLimit = $registry->configuration->api->params->rate_limit; if ($rate > $rateLimit) { Api_Model_Header::setHeaderByCode(403); exit; } apc_store($cacheRateKey, 1 + $rate, $ttl); // Create connection to database, as singleton , and store it in registry $db = Zend_Db::factory('Pdo_Mysql', $config->database->params->toArray()); $registry->database = $db; // Load specific configuration settings from database, and store it in registry $settings = Dot_Settings::getSettings(); $registry->settings = $settings; $registry->option = array(); include 'Controller.php';
/** * Initialize the global variables * @access public * @static * @param int $startTime * @return bool $success */ public static function initialize($startTime) { // Create registry object, as read-only object to store there config, settings, and database $registry = self::_initializeRegistry(); // mark the start time $registry->startTime = $startTime; //Load configuration settings from application.ini file and store it in registry $config = new Zend_Config_Ini(CONFIGURATION_PATH . '/application.ini', APPLICATION_ENV); $registry->configuration = $config; //start the cache Dot_Cache::loadCache(); //Load routes(modules, controllers, actions) settings from router.xml file and store it in registry $registry->router = self::_loadRouter(); // load the plugin configuration $registry->pluginConfiguration = self::_loadPluginConfiguration(); //Load configuration settings from application.ini file and store it in registry $config = new Zend_Config_Ini(CONFIGURATION_PATH . '/application.ini', APPLICATION_ENV); $registry->configuration = $config; // Create connection to database, as singleton , and store it in registry $db = Zend_Db::factory('Pdo_Mysql', $config->database->params->toArray()); $registry->database = $db; //Load specific configuration settings from database, and store it in registry $settings = Dot_Settings::getSettings(); $registry->settings = $settings; //Set PHP configuration settings from application.ini file Dot_Settings::setPhpSettings($config->phpSettings->toArray()); // Extract the route from the URI Dot_Route::setRoute(); // initialize seo options $registry->seo = Dot_Route::getOption(); // initialize default options for dots that may be overwritten $option = Dot_Settings::getOptionVariables($registry->requestModule, 'default'); $registry->option = $option; return true; }
/** * Get SEO options * * @static * @access public * @return array */ public static function getOption() { $registry = Zend_Registry::getInstance(); $option = Dot_Settings::getOptionVariables($registry->requestModule, 'seo'); //remove the 'option' xml atribute $option->__unset('option'); $option->__set('canonicalUrl', Dot_Route::createCanonicalUrl()); return $option; }
} if ($opts->getOption('environment') === null) { // environment variable not set, falling back to production define('APPLICATION_ENV', 'production'); } else { define('APPLICATION_ENV', $opts->getOption('environment')); } // Create registry object, as read-only object to store there config, settings, and database $registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS); Zend_Registry::setInstance($registry); $registry->startTime = $startTime; // Load configuration settings from application.ini file and store it in registry $config = new Zend_Config_Ini(CONFIGURATION_PATH . '/application.ini', APPLICATION_ENV); $registry->configuration = $config; // Create connection to database, as singleton , and store it in registry $db = Zend_Db::factory('Pdo_Mysql', $config->database->params->toArray()); $registry->database = $db; // Load specific configuration settings from database, and store it in registry $settings = Dot_Settings::getSettings(); $registry->settings = $settings; $registry->option = array(); // Set PHP configuration settings from application.ini file Dot_Settings::setPhpSettings($config->phpSettings->toArray()); // Get the action and the other command line arguments $registry->action = $opts->getOption('action'); $registry->arguments = $opts->getRemainingArgs(); if ($registry->action === null) { echo $opts->getUsageMessage(); exit; } include 'Controller.php';