Exemplo n.º 1
0
 /**
  * check if the request is of type GET or HEAD
  */
 protected function _checkRequestType()
 {
     $allowedTypes = array('GET', 'HEAD');
     if (in_array($_SERVER['REQUEST_METHOD'], $allowedTypes)) {
         return true;
     } else {
         trigger_error(\Jelix\Locale\Locale::get('jelix~errors.rep.bad.request.method'), E_USER_WARNING);
         return false;
     }
 }
Exemplo n.º 2
0
 protected static function tryOtherLocales($key, $args, $locale, $charset, $config)
 {
     $otherLocales = array();
     $similarLocale = self::langToLocale(substr($locale, 0, strpos($locale, '_')));
     if ($similarLocale != $locale) {
         $otherLocales[] = $similarLocale;
     }
     if ($locale != $config->locale) {
         $otherLocales[] = $config->locale;
     }
     if ($config->fallbackLocale && $locale != $config->fallbackLocale) {
         $otherLocales[] = $config->fallbackLocale;
     }
     foreach ($otherLocales as $loc) {
         try {
             return Locale::get($key, $args, $loc, $charset, false);
         } catch (\Exception $e) {
         }
     }
     return null;
 }