Ejemplo n.º 1
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;
 }