Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
 
4
/**
5
 * Evaluates to true if the index is in a given array of indexes
6
 * The array has the indexes in key (so you may want to call
7
 * array_flip if your array has indexes as value)
8
 *
9
 * PHP versions 4 and 5
10
 *
11
 * This library is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU Lesser General Public
13
 * License as published by the Free Software Foundation; either
14
 * version 2.1 of the License, or (at your option) any later version.
15
 *
16
 * This library is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19
 * Lesser General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Lesser General Public
22
 * License along with this library; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA
24
 *
25
 * @category   File Formats
26
 * @package    File_Archive
27
 * @author     Vincent Lascaux <vincentlascaux@php.net>
28
 * @copyright  1997-2005 The PHP Group
29
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL
30
 * @version    CVS: $Id: Index.php,v 1.1 2005/05/30 19:44:53 vincentlascaux Exp $
31
 * @link       http://pear.php.net/package/File_Archive
32
 */
33
 
34
require_once "File/Archive/Predicate.php";
35
 
36
/**
37
 * Evaluates to true if the index is in a given array of indexes
38
 * The array has the indexes in key (so you may want to call
39
 * array_flip if your array has indexes as value)
40
 */
41
class File_Archive_Predicate_Index extends File_Archive_Predicate
42
{
43
    var $indexes;
44
    var $pos = 0;
45
 
46
    /**
47
     * @param $extensions array or comma separated string of allowed extensions
48
     */
49
    function File_Archive_Predicate_Index($indexes)
50
    {
51
        $this->indexes = $indexes;
52
    }
53
    /**
54
     * @see File_Archive_Predicate::isTrue()
55
     */
56
    function isTrue(&$source)
57
    {
58
        return isset($this->indexes[$this->pos++]);
59
    }
60
}
61
 
62
?>