예제 #1
0
 protected function _default()
 {
     require_once DURA_TRUST_PATH . '/language/list.php';
     $languages = dura_get_language_list();
     foreach ($languages as $langcode => $name) {
         if (!file_exists(DURA_TRUST_PATH . '/language/' . $langcode . '.php')) {
             unset($languages[$langcode]);
         }
     }
     $acceptLangs = getenv('HTTP_ACCEPT_LANGUAGE');
     $acceptLangs = explode(',', $acceptLangs);
     $defaultLanguage = DURA_LANGUAGE;
     foreach ($acceptLangs as $k => $acceptLang) {
         @(list($langcode, $dummy) = explode(';', $acceptLang));
         foreach ($languages as $language => $v) {
             if (stripos($language, $langcode) === 0) {
                 $defaultLanguage = $language;
                 break 2;
             }
         }
     }
     asort($languages);
     $this->output['languages'] = $languages;
     $this->output['default_language'] = $defaultLanguage;
     $this->output['icons'] = $this->icons;
     $this->output['error'] = $this->error;
     $this->output['token'] = Dura_Class_Ticket::issue();
     $this->_view();
 }
예제 #2
0
 protected function _languages()
 {
     require_once DURA_TRUST_PATH . '/language/list.php';
     $languages = dura_get_language_list();
     foreach ($languages as $langcode => $name) {
         if (!file_exists(DURA_TRUST_PATH . '/language/' . $langcode . '.php')) {
             unset($languages[$langcode]);
         }
     }
     $this->languages = $languages;
 }