ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
OLE_File.php
Go to the documentation of this file.
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
4 // | PHP Version 4 |
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 // +----------------------------------------------------------------------+
19 //
20 // $Id: OLE_File.php 21503 2009-09-07 07:33:14Z hschottm $
21 
22 
24 if (!defined('PHPEXCEL_ROOT')) {
28  define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../');
29 }
30 
31 require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_PPS.php';
32 
41  {
46  public $_tmp_dir;
47 
55  public function __construct($name)
56  {
57  $this->_tmp_dir = '';
59  null,
60  $name,
62  null,
63  null,
64  null,
65  null,
66  null,
67  '',
68  array());
69  }
70 
78  public function setTempDir($dir)
79  {
80  if (is_dir($dir)) {
81  $this->_tmp_dir = $dir;
82  return true;
83  }
84  return false;
85  }
86 
93  public function init()
94  {
95  $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File");
96  $fh = fopen($this->_tmp_filename, "w+b");
97  if ($fh === false) {
98  throw new Exception("Can't create temporary file");
99  }
100  $this->_PPS_FILE = $fh;
101  if ($this->_PPS_FILE) {
102  fseek($this->_PPS_FILE, 0);
103  }
104  return true;
105  }
106 
113  public function append($data)
114  {
115  if ($this->_PPS_FILE) {
116  fwrite($this->_PPS_FILE, $data);
117  } else {
118  $this->_data .= $data;
119  }
120  }
121 
126  public function getStream()
127  {
128  $this->ole->getStream($this);
129  }
130 }