Beispiel #1
0
 private static function checkPath($path)
 {
     static $searchMasksCache = false;
     if (is_array($searchMasksCache)) {
         $arExc = $searchMasksCache["exc"];
         $arInc = $searchMasksCache["inc"];
     } else {
         $arExc = array();
         $arInc = array();
         $inc = Config\Option::get("main", "urlrewrite_include_mask", "*.php");
         $inc = str_replace("'", "\\'", str_replace("*", ".*?", str_replace("?", ".", str_replace(".", "\\.", str_replace("\\", "/", $inc)))));
         $arIncTmp = explode(";", $inc);
         foreach ($arIncTmp as $preg_mask) {
             if (strlen(trim($preg_mask)) > 0) {
                 $arInc[] = "'^" . trim($preg_mask) . "\$'";
             }
         }
         $exc = Config\Option::get("main", "urlrewrite_exclude_mask", "/freetrix/*;");
         $exc = str_replace("'", "\\'", str_replace("*", ".*?", str_replace("?", ".", str_replace(".", "\\.", str_replace("\\", "/", $exc)))));
         $arExcTmp = explode(";", $exc);
         foreach ($arExcTmp as $preg_mask) {
             if (strlen(trim($preg_mask)) > 0) {
                 $arExc[] = "'^" . trim($preg_mask) . "\$'";
             }
         }
         $searchMasksCache = array("exc" => $arExc, "inc" => $arInc);
     }
     $file = IO\Path::getName($path);
     if (substr($file, 0, 1) === ".") {
         return 0;
     }
     foreach ($arExc as $preg_mask) {
         if (preg_match($preg_mask, $path)) {
             return false;
         }
     }
     foreach ($arInc as $preg_mask) {
         if (preg_match($preg_mask, $path)) {
             return true;
         }
     }
     return false;
 }
Beispiel #2
0
 public function getName()
 {
     return Path::getName($this->path);
 }