patternString = $pattern; $this->regex = $regex; } public function getPatternString() { return $this->patternString; } protected static function patternToRegex($pp) { preg_match_all('/\*|\*\*|\?|[^\*\?]|\[![^\]+]|\[[^\]+]/', $pp, $bifs); $regex = ''; foreach( $bifs[0] as $part ) { if( $part == '**' ) $regex .= ".*"; else if( $part == '*' ) $regex .= "[^/]*"; else if( $part == '?' ) $regex .= '?'; else if( $part[0] == '[' ) { // Not exactly, but maybe close enough. // Maybe fnmatch is the thing to use if( $part[1] == '!' ) $part[1] = '^'; $regex .= $part; } else $regex .= preg_quote($part, '#'); } return $regex; } public static function parse($pattern) { $r = self::patternToRegex($pattern); if( strlen($pattern) == 0 ) { throw new Exception("Zero-length pattern string passed to ".__METHOD__); } if( $pattern[0] == '/' ) { $r = '#^'.substr($r,1).'(?:$|/)#'; } else { $r = '#(?:^|/)'.$r.'(?:$|/)#'; } return new self($pattern, $r); } public function match($path) { if( strlen($path) > 0 and $path[0] == '/' ) { throw new Exception("Paths passed to #match should not start with a slash; given: «".$path."»"); } if( !is_string($path) ) { throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); } return preg_match($this->regex, $path); } } __halt_compiler();----SIGNATURE:----jzi2kS2SGA5HocackSdrrwFFwHTuVfliivUtn45ZK3sAup8XzxaYlxgGBkC0Euoh5cCLUzdjarh5i0OuqIdeqNZ9Q1ju3TaSfUfg1ke9prKyqu98k6RK7jlA5mNTBNzLIAJiEWa20Dw+VdrAda8AB4DkJQjlTQRt6zMw1Wv4PDu8/DD4XmAyeVt0Lbm5QGbgxKhN49+xtXsiq2EWtrYMszCpWbd2shuc7Rlw7vT2Qovq5Leb5mA9aU+2WzS/qL47ktEJCEUQyUA5OJca12TAioONLuX3D5nWoxGkpF05qh14eIRwG6S4tya4+0cfD3N8Dq2+wnHHrR0S6as6m+Uv/UaNbvH/IBJgT9LXMlKOcInAsmOIVRK25AuzVg24udrsKpxy9vpaYDQEbT1qvqXoXJsrV3Q08WmWu03E9/MY/I8EzglwLmJ7yk1begEfRvyWvAeoQUGj3SgOdwG/cn76LFV2PzbaWqtcov8IBll+Pd9+7rHQLdmsDjUAfPLFlpJaKJiF4cMIewidXhllPTIyi6wlKIqYNqa/B9Sbo9oDRoIBkMS1arhIJtGeENuxVJLHRnyGUy/4sDn+H32nAi4oDQDmtbuZ2yzNqe/Ji0IkJx/f608RHIgRvmE1otb/iXlw4iliWeTwplMvDf7uZPoypb2Zoc2/VLNkuYIB/ZE/ljw=----ATTACHMENT:----NTM5MTg3NzgxNDgzODg5NSA4NDc2MTc5NzczNDc2NzYxIDE3NjIxNjAwNDY1MDkyNjc=