cvs: pear /File_Archive package.xml /File_Archive/Archive/Predicate MIME.php
| From: | Vincent Lascaux | Date: | Mon, 21 Feb 2005 17:51:47 +0000 |
| Subject: | cvs: pear /File_Archive package.xml /File_Archive/Archive/Predicate MIME.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-29628@lists.php.net to get a copy of this message | ||
vincentlascaux Mon Feb 21 12:51:47 2005 EDT
Added files:
/pear/File_Archive/Archive/Predicate MIME.php
/pear/File_Archive package.xml
Log:
+ Add a MIME predicat (keep only the files with a given MIME list)
+ Add package.xml (try)
http://cvs.php.net/co.php/pear/File_Archive/Archive/Predicate/MIME.php?r=1.1&p=1
Index: pear/File_Archive/Archive/Predicate/MIME.php
+++ pear/File_Archive/Archive/Predicate/MIME.php
<?
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Keep only the files that have a specific MIME type
*
* PHP versions 4 and 5
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA
*
* @category File Formats
* @package File_Archive
* @author Vincent Lascaux <vincentlascaux@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version CVS: $Id: MIME.php,v 1.1 2005/02/21 17:51:45 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
*/
require_once "File/Archive/Predicate.php";
require_once "MIME/Type.php";
/**
* Keep only the files that have a specific MIME type
*
* @see File_Archive_Predicate File_Archive_Reader_Filter
*/
class File_Archive_Predicate_MIME extends File_Archive_Predicate
{
var $mimes;
/**
* @param $extensions array or comma separated string of allowed extensions
*/
function File_Archive_Predicate_MIME($mimes)
{
if(is_string($mimes)) {
$this->mimes = explode(",",$mimes);
} else {
$this->mimes = $mimes;
}
}
/**
* @see File_Archive_Predicate::isTrue
*/
function isTrue(&$source)
{
foreach($mimes as $mime)
{
if(MIME_Type::isWildcard($mime)) {
$result = MIME_Type::wildcardMatch($mime, $source->getMIME());
} else {
$result = ($mime == $source->getMIME());
}
if($result !== false) {
return $result;
}
}
return false;
}
}
?>
http://cvs.php.net/co.php/pear/File_Archive/package.xml?r=1.1&p=1
Index: pear/File_Archive/package.xml
+++ pear/File_Archive/package.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<package version="1.0">
<name>File_Archive</name>
<summary>
File_Archive will let you manipulate easily the tar, gz and zip files
</summary>
<description>
File_Archive will let you manipulate easily the tar, gz and zip files.
This library is strongly object oriented. It makes it very easy to use, writing simple code, yet
the library is very powerfull.
File_Archive is made of two objects : readers and writers. Are currently implemented readers from
file, directory, tar, gz archives or database. You can write to file(s), mail, tar, gz or zip
archives.
</description>
<license>LGPL</license>
<maintainers>
<maintainer>
<user>VincentLascaux</user>
<name>Vincent Lascaux</name>
<email>vincent.lascaux@centraliens.net</email>
<role>lead</role>
</maintainer>
</maintainers>
<release>
<version>0.1.0</version>
<date>2005-02-20</date>
<state>alpha</state>
<notes>First release of File_Archive</notes>
<filelist>
<dir name="File" role="php">
<file>Archive.php</file>
<dir name="Archive" role="php">
<file>Predicate.php</file>
<file>Reader.php</file>
<file>Writer.php</file>
<dir name="Predicate" role="php">
<file>And.php</file>
<file>Custom.php</file>
<file>Ereg.php</file>
<file>Eregi.php</file>
<file>Extension.php</file>
<file>False.php</file>
<file>MaxDepth.php</file>
<file>MinSize.php</file>
<file>MinTime.php</file>
<file>Not.php</file>
<file>Or.php</file>
<file>True.php</file>
</dir>
<dir name="Reader" role="php">
<file>Archive.php</file>
<file>ChangeName.php</file>
<file>Concat.php</file>
<file>Directory.php</file>
<file>File.php</file>
<file>Filter.php</file>
<file>Gzip.php</file>
<file>Memory.php</file>
<file>MimeList.php</file>
<file>Multi.php</file>
<file>Relay.php</file>
<file>Tar.php</file>
<file>Uncompress.php</file>
<file>Zip.php</file>
</dir>
<dir name="Writer" role="php">
<file>Archive.php</file>
<file>Files.php</file>
<file>Gzip.php</file>
<file>Mail.php</file>
<file>Memory.php</file>
<file>MemoryArchive.php</file>
<file>Multi.php</file>
<file>Output.php</file>
<file>Tar.php</file>
<file>Zip.php</file>
</dir>
</dir>
<dir name="tests" role="test">
<file name="test.php"/>
</dir>
</dir>
</filelist>
<deps>
<dep type="php" rel="ge" version="4.3.0" />
<dep type="pkg" rel="has">MIME_Type</dep>
<dep type="pkg" rel="has"
optional="yes">Mail_Mime</dep>
<dep type="pkg" rel="has" optional="yes">Mail</dep>
</deps>
</release>
</package>