2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Author: Xavier Noguer <xnoguer@php.net> |
17 // | Based on OLE::Storage_Lite by Kawai, Takanori |
18 // +----------------------------------------------------------------------+
23 require_once ('OLE/PPS.php');
26 * Class for creating File PPS's for OLE containers
28 * @author Xavier Noguer <xnoguer@php.net>
29 * @category Structures
32 class OLE_PPS_File
extends OLE_PPS
35 * The temporary dir for storing the OLE file
44 * @param string $name The name of the file (in Unicode)
47 function OLE_PPS_File($name)
64 * Sets the temp dir used for storing the OLE file
67 * @param string $dir The dir to be used as temp dir
68 * @return true if given dir is valid, false otherwise
70 function setTempDir($dir)
73 $this->_tmp_dir
= $dir;
80 * Initialization method. Has to be called right after OLE_PPS_File().
83 * @return mixed true on success. PEAR_Error on failure
87 $this->_tmp_filename
= tempnam($this->_tmp_dir
, "OLE_PPS_File");
88 $fh = @fopen
($this->_tmp_filename
, "w+b");
90 return $this->raiseError("Can't create temporary file");
92 $this->_PPS_FILE
= $fh;
93 if ($this->_PPS_FILE
) {
94 fseek($this->_PPS_FILE
, 0);
102 * @param string $data The data to append
104 function append($data)
106 if ($this->_PPS_FILE
) {
107 fwrite($this->_PPS_FILE
, $data);
110 $this->_data
.= $data;