ftp_base::glob()publicWP 1.0

Метод класса: ftp_base{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ftp_base = new ftp_base();
$ftp_base->glob( $pattern, $handle );
$pattern (обязательный)
-
$handle **
-
По умолчанию: NULL

Код ftp_base::glob() WP 6.5.2

function glob($pattern, $handle=NULL) {
	$path=$output=null;
	if(PHP_OS=='WIN32') $slash='\\';
	else $slash='/';
	$lastpos=strrpos($pattern,$slash);
	if(!($lastpos===false)) {
		$path=substr($pattern,0,-$lastpos-1);
		$pattern=substr($pattern,$lastpos);
	} else $path=getcwd();
	if(is_array($handle) and !empty($handle)) {
		foreach($handle as $dir) {
			if($this->glob_pattern_match($pattern,$dir))
			$output[]=$dir;
		}
	} else {
		$handle=@opendir($path);
		if($handle===false) return false;
		while($dir=readdir($handle)) {
			if($this->glob_pattern_match($pattern,$dir))
			$output[]=$dir;
		}
		closedir($handle);
	}
	if(is_array($output)) return $output;
	return false;
}