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
 * Writer wrapper that adds a directory to the written file
6
 *
7
 * PHP versions 4 and 5
8
 *
9
 * This library is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU Lesser General Public
11
 * License as published by the Free Software Foundation; either
12
 * version 2.1 of the License, or (at your option) any later version.
13
 *
14
 * This library is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 * Lesser General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public
20
 * License along with this library; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA
22
 *
23
 * @category   File Formats
24
 * @package    File_Archive
25
 * @author     Vincent Lascaux <vincentlascaux@php.net>
26
 * @copyright  1997-2005 The PHP Group
27
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL
28
 * @version    CVS: $Id: AddBaseName.php,v 1.2 2007/01/07 21:25:18 pfischer Exp $
29
 * @link       http://pear.php.net/package/File_Archive
30
 */
31
 
32
require_once "File/Archive/Writer.php";
33
 
34
/**
35
 * Writer wrapper that adds a directory to the written file
36
 */
37
class File_Archive_Writer_AddBaseName
38
{
39
    var $writer;
40
    var $baseName;
41
 
42
    function File_Archive_Writer_AddBaseName($baseName, &$writer)
43
    {
44
        if (substr($baseName, -1) == '/') {
45
            $this->baseName = $baseName;
46
        } else {
47
            $this->baseName = $baseName.'/';
48
        }
49
 
50
        $this->writer =& $writer;
51
    }
52
 
53
    /**
54
     * @see File_Archive_Writer::newFile()
55
     */
56
    function newFile($filename, $stat = array(), $mime = "application/octet-stream")
57
    {
58
        $this->writer->newFile($this->baseName.$filename, $stat, $mime);
59
    }
60
 
61
    /**
62
     * @see File_Archive_Writer::newFromTempFile()
63
     */
64
    function newFromTempFile($tmpfile, $filename, $stat = array(), $mime = "application/octet-stream")
65
    {
66
        $this->writer->newFromTempFile($tmpfile, $this->baseName.$filename, $stat, $mime);
67
    }
68
 
69
    /**
70
     * @see File_Archive_Writer::newFileNeedsMIME()
71
     */
72
    function newFileNeedsMIME()
73
    {
74
        return $this->writer->newFileNeedsMIME();
75
    }
76
 
77
    /**
78
     * @see File_Archive_Writer::writeData()
79
     */
80
    function writeData($data)
81
    {
82
        $this->writer->writeData($data);
83
    }
84
 
85
    /**
86
     * @see File_Archive_Writer::writeFile()
87
     */
88
    function writeFile($filename)
89
    {
90
        $this->writer->writeFile($filename);
91
    }
92
 
93
    /**
94
     * @see File_Archive_Writer::close()
95
     */
96
    function close()
97
    {
98
        $this->writer->close();
99
    }
100
}
101
 
102
?>