WordPress at Your Fingertips
function is not described

ftp_base::glob_pattern_match() public WP 1.0

{} It's a method of the class: ftp_base{}

No Hooks.

Return

null. Nothing.

Usage

$ftp_base = new ftp_base();
$ftp_base->glob_pattern_match( $pattern, $string );
$pattern (required)
-
$string (required)
-

Code of ftp_base::glob_pattern_match() WP 5.8.2

function glob_pattern_match($pattern,$string) {
	$out=null;
	$chunks=explode(';',$pattern);
	foreach($chunks as $pattern) {
		$escape=array('$','^','.','{','}','(',')','[',']','|');
		while(strpos($pattern,'**')!==false)
			$pattern=str_replace('**','*',$pattern);
		foreach($escape as $probe)
			$pattern=str_replace($probe,"\\$probe",$pattern);
		$pattern=str_replace('?*','*',
			str_replace('*?','*',
				str_replace('*',".*",
					str_replace('?','.{1,1}',$pattern))));
		$out[]=$pattern;
	}
	if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string));
	else {
		foreach($out as $tester)
			if($this->my_regexp("^$tester$",$string)) return true;
	}
	return false;
}