Пример #1
0
 /**
  * @static
  * @return array
  */
 public static function getValidLanguages()
 {
     if (empty(self::$validLanguages)) {
         $config = Config::getSystemConfig();
         $validLanguages = strval($config->general->validLanguages);
         if (empty($validLanguages)) {
             return array();
         }
         $validLanguages = str_replace(" ", "", $validLanguages);
         $languages = explode(",", $validLanguages);
         if (!is_array($languages)) {
             $languages = array();
         }
         self::$validLanguages = $languages;
     }
     return self::$validLanguages;
 }
Пример #2
0
 /**
  * @static
  * @return bool
  */
 public static function isFrontend()
 {
     if (self::$isFrontend !== null) {
         return self::$isFrontend;
     }
     $isFrontend = true;
     if ($isFrontend && php_sapi_name() == "cli") {
         $isFrontend = false;
     }
     if ($isFrontend && \Pimcore::inAdmin()) {
         $isFrontend = false;
     }
     if ($isFrontend) {
         $excludePatterns = ["/^\\/admin.*/", "/^\\/install.*/", "/^\\/plugin.*/", "/^\\/webservice.*/"];
         foreach ($excludePatterns as $pattern) {
             if (preg_match($pattern, $_SERVER["REQUEST_URI"])) {
                 $isFrontend = false;
                 break;
             }
         }
     }
     self::$isFrontend = $isFrontend;
     return $isFrontend;
 }