Writers (Previous) (Next) Archive modification

View this page in Last updated: Sun, 28 Sep 2008
English | French | Japanese | Plain HTML

Predicates

Predicates -- Filters

Introduction

File_Archive introduces the concept of filters to be able to select the files from a source. A filter is a particular reader that you can create with the File_Archive::filter() function. This function requires you to give a predicate. You can build this predicate using the File_Archive::pred* functions.

The standard logic predicates are:

  • predTrue(): always evaluates to true

  • predFalse(): always evaluates to false

  • predAnd($p1, $p2, ...): evaluates to $p1 && $p2 && ...

  • predOr($p1, $p2, ...): evaluates to $p1 || $p2 || ...

  • predNot($p): evaluates to !$p

Some other predicats will help you filtering the files:

  • predMinSize($size): keep only the files which size is >= $size (in bytes).

  • predMinTime($time): keep only the files that have been modified after $time (unix timestamp).

  • predMaxDepth($depth): keep only the files that have a public name with less than $depth directories.

  • predExtension($list): keep only the files with a given extension. $list is an array or a comma separated string of allowed extensions.

  • predEreg($ereg): keep only the files that have a public name that matches the given regular expression.

  • predEregi($ereg): same as predEreg(), but the test is case insensitive.

  • predMIME($mimes): Select files with a certain MIME type. You can pass an array of types or a string, and use wildcards.

Writers (Previous) (Next) Archive modification

Download Documentation Last updated: Sun, 28 Sep 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.