Location: PHPKode > scripts > RC4PHP class > rc4php-class/rc4php_functions.php
<?PHP
/**
*
* RC4PHP :  Raul's Classes For PHP <http://rc4php.sourceforge.net/>
* Copyright (c) 2006, Raul IONESCU
*                     Bucharest, ROMANIA
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @package      RC4PHP
* @copyright 	Copyright (c) 2006, Raul IONESCU.
* @author 	Raul IONESCU <hide@address.com>
* @license      http://www.opensource.org/licenses/mit-license.php The MIT License
* @version 	0.6.3 (development)
* @category 	Misc functions
* @access 	public
*
* PHP versions 5.1 or greater
*/
//////////////////////////////////////////////////////////////////
if (!function_exists('fnmatch')) 
{
/**
* @author soywiz <hide@address.com>
*/
function fnmatch($pattern, $string) 
{
for ($op=0,$npattern='',$n = 0,$l=strlen($pattern);$n<$l;$n++)
	{
	 switch ($c=$pattern[$n]) 
	 	{
			case '\\':
				$npattern .= '\\' . @$pattern[++$n];
				break;

			case '.': 
			case '+': 
			case '^': 
			case '$': 
			case '(': 
			case ')': 
			case '{': 
			case '}': 
			case '=': 
			case '!': 
			case '<': 
			case '>': 
			case '|':
				$npattern .= '\\' . $c;
				break;

			case '?': 
			case '*':
				$npattern .= '.' . $c;
				break;
			
			case '[': 
			case ']': 
			default:
				$npattern .= $c;
				if ($c == '[') {$op++;} else if ($c == ']') {if ($op == 0) return false; $op--; }
				break;
		}
	}
if($op != 0) return false;
return preg_match('/' . $npattern . '/i', $string);
}
}
//////////////////////////////////////////////////////////////////
?>
Return current item: RC4PHP class