[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/misc/ -> glob.class.php (sommaire)

\defgroup Misc Miscellaneous classes that did not fit anywhere

Poids: 169 lignes (6 kb)
Inclus ou requis:0 fois
Référencé: 5 fois
Nécessite: 0 fichiers

Définit 1 class

Glob:: (4 méthodes):
  Glob()
  fnmatch()
  myGlob()
  myFnmatch()


Classe: Glob  - X-Ref

\ingroup Misc

Alternative implementation of the glob() function, since the latter is only
available in php versions 4.3 or higher and many many hosts have not updated
yet.
Original glob function: http://www.php.net/manual/en/function.glob.php.
Original fnmatch function: http://www.php.net/manual/en/function.fnmatch.php.

The class is capable of detecting the version of php and using the native (and probably
faster) version instead of the custom one.
Glob( $folder = ".", $pattern = "*", $flags = 0 )   X-Ref
This function checks wether we're running a version of php at least or newer than
4.3. If its newer, then we will use the native version of glob otherwise we will use
our own version. The order of the parameters is <b>not</b> the same as the native version
of glob, but they will be converted. The <i>flags</i> parameter is not used when
using the custom version of glob.

param: folder The folder where would like to search for files. This function is <b>not</b>
param: pattern The shell pattern that will match the files we are searching for.
param: flags This parameter is only used when using the native version of glob. For possible
return: Returns an array of the files that match the given pattern in the given

fnmatch( $pattern, $file )   X-Ref
Front-end function that does the same as the glob function above but this time with the fnmnatch version.
Checks the php version and if it is at least or greater than 4.3, then we will use
the native and faster version of fnmatch or otherwise we will fall back to using our
own custom version.

param: pattern The shell pattern.
param: file The filename we would like to match.
return: True if the file matches the pattern or false if not.

myGlob( $folder = ".", $pattern = "*" )   X-Ref
Our own implementation of the glob function for those sites which run a version
of php lower than 4.3. For more information on the function glob:
http://www.php.net/manual/en/function.glob.php

Returns an array with all the files and subdirs that match the given shell expression.
param: folder Where to start searching.
param: pattern A shell expression including wildcards '*' and '?' defining which
return: An array with the matching files and false if error.

myFnmatch( $pattern, $file )   X-Ref
Our own equivalent of fnmatch that is only available in php 4.3.x.

Based on a user-contributed code for the fnmatch php function here:
http://www.php.net/manual/en/function.fnmatch.php




Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics