1 | <?php |
||
5 | class PPS |
||
6 | { |
||
7 | const PPS_TYPE_ROOT = 5; |
||
8 | const PPS_TYPE_FILE = 2; |
||
9 | const PPS_SIZE = 0x80; |
||
10 | const DATA_SIZE_SMALL = 0x1000; |
||
11 | const LONG_INT_SIZE = 4; |
||
12 | |||
13 | /** |
||
14 | * The PPS index |
||
15 | * @var integer |
||
16 | */ |
||
17 | protected $index; |
||
18 | |||
19 | /** |
||
20 | * The PPS name (in Unicode) |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $name; |
||
24 | |||
25 | /** |
||
26 | * The PPS type. Dir, Root or File |
||
27 | * @var integer |
||
28 | */ |
||
29 | protected $type; |
||
30 | |||
31 | /** |
||
32 | * The index of the previous PPS |
||
33 | * @var integer |
||
34 | */ |
||
35 | protected $prevPps; |
||
36 | |||
37 | /** |
||
38 | * The index of the next PPS |
||
39 | * @var integer |
||
40 | */ |
||
41 | protected $nextPps; |
||
42 | |||
43 | /** |
||
44 | * The index of it's first child if this is a Dir or Root PPS |
||
45 | * @var integer |
||
46 | */ |
||
47 | protected $dirPps; |
||
48 | |||
49 | /** |
||
50 | * A timestamp |
||
51 | * @var integer |
||
52 | */ |
||
53 | protected $timestamp; |
||
54 | |||
55 | /** |
||
56 | * Starting block (small or big) for this PPS's data inside the container |
||
57 | * @var integer |
||
58 | */ |
||
59 | protected $startBlock; |
||
60 | |||
61 | /** |
||
62 | * The PPS's data (only used if it's not using a temporary file) |
||
63 | * @var string |
||
64 | */ |
||
65 | protected $data; |
||
66 | |||
67 | /** |
||
68 | * Array of child PPS's (only used by Root and Dir PPS's) |
||
69 | * @var array |
||
70 | */ |
||
71 | protected $children = array(); |
||
72 | |||
73 | /** |
||
74 | * The constructor |
||
75 | * |
||
76 | * @param integer $index The PPS index |
||
77 | * @param string $name The PPS name |
||
78 | * @param integer $type The PPS type. Dir, Root or File |
||
79 | * @param integer $prev The index of the previous PPS |
||
80 | * @param integer $next The index of the next PPS |
||
81 | * @param integer $dir The index of it's first child if this is a Dir or Root PPS |
||
82 | * @param integer $timestamp A timestamp |
||
83 | * @param string $data The (usually binary) source data of the PPS |
||
84 | * @param PPS[] $children Array containing children PPS for this PPS |
||
85 | */ |
||
86 | public function __construct( |
||
111 | |||
112 | /** |
||
113 | * @return bool |
||
114 | */ |
||
115 | protected function hasData() |
||
119 | |||
120 | /** |
||
121 | * @return string |
||
122 | */ |
||
123 | public function getData() |
||
127 | |||
128 | /** |
||
129 | * Returns the amount of data saved for this PPS |
||
130 | * |
||
131 | * @return integer The amount of data (in bytes) |
||
132 | */ |
||
133 | protected function getSize() |
||
137 | |||
138 | /** |
||
139 | * Returns a string with the PPS's WK (What is a WK?) |
||
140 | * |
||
141 | * @return string The binary string |
||
142 | */ |
||
143 | public function getPpsWk() |
||
172 | |||
173 | /** |
||
174 | * Updates index and pointers to previous, next and children PPS's for this |
||
175 | * PPS. I don't think it'll work with Dir PPS's. |
||
176 | * |
||
177 | * @param PPS[] &$list Reference to the array of PPS's for the whole OLE container |
||
178 | * @param PPS[] $toSave |
||
179 | * @param $depth |
||
180 | * |
||
181 | * @return integer The index for this PPS |
||
182 | */ |
||
183 | public static function setPointers(&$list, $toSave, $depth = 0) |
||
217 | |||
218 | /** |
||
219 | * @return bool |
||
220 | */ |
||
221 | public function isFile() |
||
225 | |||
226 | /** |
||
227 | * @return bool |
||
228 | */ |
||
229 | public function isRoot() |
||
233 | |||
234 | /** |
||
235 | * @param int $startBlock |
||
236 | */ |
||
237 | public function setStartBlock($startBlock) |
||
241 | |||
242 | /** |
||
243 | * @return int |
||
244 | */ |
||
245 | public function getStartBlock() |
||
249 | |||
250 | /** |
||
251 | * @return array |
||
252 | */ |
||
253 | public function getChildren() |
||
257 | |||
258 | /** |
||
259 | * @param int $index |
||
260 | */ |
||
261 | public function setIndex($index) |
||
265 | |||
266 | /** |
||
267 | * @param int $prevPps |
||
268 | */ |
||
269 | public function setPrevPps($prevPps) |
||
273 | |||
274 | /** |
||
275 | * @param int $nextPps |
||
276 | */ |
||
277 | public function setNextPps($nextPps) |
||
281 | |||
282 | /** |
||
283 | * @param int $dirPps |
||
284 | */ |
||
285 | public function setDirPps($dirPps) |
||
289 | |||
290 | /** |
||
291 | * Append data to PPS |
||
292 | * |
||
293 | * @param string $data The data to append |
||
294 | */ |
||
295 | public function append($data) |
||
299 | } |
||
300 |