/** * Default constructor * * @return void */ public function __construct() { // define the Named Application if (!defined('NAMED_APPLICATION')) { define('NAMED_APPLICATION', 'backend'); } // set the module $this->setModule(SpoonFilter::getGetValue('module', null, '')); // set the requested file $this->setFile(SpoonFilter::getGetValue('file', null, '')); // set the language $this->setLanguage(SpoonFilter::getGetValue('language', BackendLanguage::getActiveLanguages(), SITE_DEFAULT_LANGUAGE)); // build the path if ($this->module == 'core') { $path = BACKEND_CORE_PATH . '/js/' . $this->getFile(); } else { $path = BACKEND_MODULES_PATH . '/' . $this->getModule() . '/js/' . $this->getFile(); } // set correct headers SpoonHTTP::setHeaders('content-type: application/javascript'); // create a new template instance (this will handle all stuff for us) $tpl = new BackendTemplate(); // display $tpl->display($path, true); }
/** * Get info about the site. * * @return array */ public static function getInfo() { if (API::authorize()) { $info = array(); // get all languages $languages = BackendLanguage::getActiveLanguages(); $default = BackendModel::getModuleSetting('core', 'default_language', SITE_DEFAULT_LANGUAGE); // loop languages foreach ($languages as $language) { // create array $var = array(); // set attributes $var['language']['@attributes']['language'] = $language; if ($language == $default) { $var['language']['@attributes']['is_default'] = 'true'; } // set attributes $var['language']['title'] = BackendModel::getModuleSetting('core', 'site_title_' . $language); $var['language']['url'] = SITE_URL . '/' . $language; // add $info['languages'][] = $var; } return $info; } }