summaryrefslogtreecommitdiffstats
path: root/admin/survey/export/libs/PHPPowerPoint/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/export/libs/PHPPowerPoint/Shared')
-rw-r--r--admin/survey/export/libs/PHPPowerPoint/Shared/Drawing.php109
-rw-r--r--admin/survey/export/libs/PHPPowerPoint/Shared/File.php98
-rw-r--r--admin/survey/export/libs/PHPPowerPoint/Shared/Font.php67
-rw-r--r--admin/survey/export/libs/PHPPowerPoint/Shared/String.php270
-rw-r--r--admin/survey/export/libs/PHPPowerPoint/Shared/XMLWriter.php141
-rw-r--r--admin/survey/export/libs/PHPPowerPoint/Shared/ZipStreamWrapper.php182
6 files changed, 867 insertions, 0 deletions
diff --git a/admin/survey/export/libs/PHPPowerPoint/Shared/Drawing.php b/admin/survey/export/libs/PHPPowerPoint/Shared/Drawing.php
new file mode 100644
index 0000000..e3727fc
--- /dev/null
+++ b/admin/survey/export/libs/PHPPowerPoint/Shared/Drawing.php
@@ -0,0 +1,109 @@
+<?php
+/**
+ * PHPPowerPoint
+ *
+ * Copyright (c) 2009 - 2010 PHPPowerPoint
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version 0.1.0, 2009-04-27
+ */
+
+
+/**
+ * PHPPowerPoint_Shared_Drawing
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ */
+class PHPPowerPoint_Shared_Drawing
+{
+ /**
+ * Convert pixels to EMU
+ *
+ * @param int $pValue Value in pixels
+ * @return int Value in EMU
+ */
+ public static function pixelsToEMU($pValue = 0) {
+ return round($pValue * 9525);
+ }
+
+ /**
+ * Convert EMU to pixels
+ *
+ * @param int $pValue Value in EMU
+ * @return int Value in pixels
+ */
+ public static function EMUToPixels($pValue = 0) {
+ if ($pValue != 0) {
+ return round($pValue / 9525);
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * Convert pixels to points
+ *
+ * @param int $pValue Value in pixels
+ * @return int Value in points
+ */
+ public static function pixelsToPoints($pValue = 0) {
+ return $pValue * 0.67777777;
+ }
+
+ /**
+ * Convert points width to pixels
+ *
+ * @param int $pValue Value in points
+ * @return int Value in pixels
+ */
+ public static function pointsToPixels($pValue = 0) {
+ if ($pValue != 0) {
+ return $pValue * 1.333333333;
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * Convert degrees to angle
+ *
+ * @param int $pValue Degrees
+ * @return int Angle
+ */
+ public static function degreesToAngle($pValue = 0) {
+ return (int)round($pValue * 60000);
+ }
+
+ /**
+ * Convert angle to degrees
+ *
+ * @param int $pValue Angle
+ * @return int Degrees
+ */
+ public static function angleToDegrees($pValue = 0) {
+ if ($pValue != 0) {
+ return round($pValue / 60000);
+ } else {
+ return 0;
+ }
+ }
+}
diff --git a/admin/survey/export/libs/PHPPowerPoint/Shared/File.php b/admin/survey/export/libs/PHPPowerPoint/Shared/File.php
new file mode 100644
index 0000000..c912a04
--- /dev/null
+++ b/admin/survey/export/libs/PHPPowerPoint/Shared/File.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * PHPPowerPoint
+ *
+ * Copyright (c) 2009 - 2010 PHPPowerPoint
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version 0.1.0, 2009-04-27
+ */
+
+
+/**
+ * PHPPowerPoint_Shared_File
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ */
+class PHPPowerPoint_Shared_File
+{
+ /**
+ * Verify if a file exists
+ *
+ * @param string $pFilename Filename
+ * @return bool
+ */
+ public static function file_exists($pFilename) {
+ // Sick construction, but it seems that
+ // file_exists returns strange values when
+ // doing the original file_exists on ZIP archives...
+ if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) {
+ // Open ZIP file and verify if the file exists
+ $zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
+ $archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
+
+ $zip = new ZipArchive();
+ if ($zip->open($zipFile) === true) {
+ $returnValue = ($zip->getFromName($archiveFile) !== false);
+ $zip->close();
+ return $returnValue;
+ } else {
+ return false;
+ }
+ } else {
+ // Regular file_exists
+ return file_exists($pFilename);
+ }
+ }
+
+ /**
+ * Returns canonicalized absolute pathname, also for ZIP archives
+ *
+ * @param string $pFilename
+ * @return string
+ */
+ public static function realpath($pFilename) {
+ // Returnvalue
+ $returnValue = '';
+
+ // Try using realpath()
+ $returnValue = realpath($pFilename);
+
+ // Found something?
+ if ($returnValue == '' || is_null($returnValue)) {
+ $pathArray = split('/' , $pFilename);
+ while(in_array('..', $pathArray) && $pathArray[0] != '..') {
+ for ($i = 0; $i < count($pathArray); ++$i) {
+ if ($pathArray[$i] == '..' && $i > 0) {
+ unset($pathArray[$i]);
+ unset($pathArray[$i - 1]);
+ break;
+ }
+ }
+ }
+ $returnValue = implode('/', $pathArray);
+ }
+
+ // Return
+ return $returnValue;
+ }
+}
diff --git a/admin/survey/export/libs/PHPPowerPoint/Shared/Font.php b/admin/survey/export/libs/PHPPowerPoint/Shared/Font.php
new file mode 100644
index 0000000..342146a
--- /dev/null
+++ b/admin/survey/export/libs/PHPPowerPoint/Shared/Font.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * PHPPowerPoint
+ *
+ * Copyright (c) 2009 - 2010 PHPPowerPoint
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version 0.1.0, 2009-04-27
+ */
+
+
+/**
+ * PHPPowerPoint_Shared_Font
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ */
+class PHPPowerPoint_Shared_Font
+{
+ /**
+ * Calculate an (approximate) pixel size, based on a font points size
+ *
+ * @param int $fontSizeInPoints Font size (in points)
+ * @return int Font size (in pixels)
+ */
+ public static function fontSizeToPixels($fontSizeInPoints = 12) {
+ return ((16 / 12) * $fontSizeInPoints);
+ }
+
+ /**
+ * Calculate an (approximate) pixel size, based on inch size
+ *
+ * @param int $sizeInInch Font size (in inch)
+ * @return int Size (in pixels)
+ */
+ public static function inchSizeToPixels($sizeInInch = 1) {
+ return ($sizeInInch * 96);
+ }
+
+ /**
+ * Calculate an (approximate) pixel size, based on centimeter size
+ *
+ * @param int $sizeInCm Font size (in centimeters)
+ * @return int Size (in pixels)
+ */
+ public static function centimeterSizeToPixels($sizeInCm = 1) {
+ return ($sizeInCm * 37.795275591);
+ }
+}
diff --git a/admin/survey/export/libs/PHPPowerPoint/Shared/String.php b/admin/survey/export/libs/PHPPowerPoint/Shared/String.php
new file mode 100644
index 0000000..0310056
--- /dev/null
+++ b/admin/survey/export/libs/PHPPowerPoint/Shared/String.php
@@ -0,0 +1,270 @@
+<?php
+/**
+ * PHPPowerPoint
+ *
+ * Copyright (c) 2009 - 2010 PHPPowerPoint
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version 0.1.0, 2009-04-27
+ */
+
+
+/**
+ * PHPPowerPoint_Shared_String
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ */
+class PHPPowerPoint_Shared_String
+{
+ /**
+ * Control characters array
+ *
+ * @var string[]
+ */
+ private static $_controlCharacters = array();
+
+ /**
+ * Is mbstring extension avalable?
+ *
+ * @var boolean
+ */
+ private static $_isMbstringEnabled;
+
+ /**
+ * Is iconv extension avalable?
+ *
+ * @var boolean
+ */
+ private static $_isIconvEnabled;
+
+ /**
+ * Build control characters array
+ */
+ private static function _buildControlCharacters() {
+ for ($i = 0; $i <= 19; ++$i) {
+ if ($i != 9 && $i != 10 && $i != 13) {
+ $find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_';
+ $replace = chr($i);
+ self::$_controlCharacters[$find] = $replace;
+ }
+ }
+ }
+
+ /**
+ * Get whether mbstring extension is available
+ *
+ * @return boolean
+ */
+ public static function getIsMbstringEnabled()
+ {
+ if (isset(self::$_isMbstringEnabled)) {
+ return self::$_isMbstringEnabled;
+ }
+
+ self::$_isMbstringEnabled = function_exists('mb_convert_encoding') ?
+ true : false;
+
+ return self::$_isMbstringEnabled;
+ }
+
+ /**
+ * Get whether iconv extension is available
+ *
+ * @return boolean
+ */
+ public static function getIsIconvEnabled()
+ {
+ if (isset(self::$_isIconvEnabled)) {
+ return self::$_isIconvEnabled;
+ }
+
+ self::$_isIconvEnabled = function_exists('iconv') ?
+ true : false;
+
+ return self::$_isIconvEnabled;
+ }
+
+ /**
+ * Convert from OpenXML escaped control character to PHP control character
+ *
+ * Excel 2007 team:
+ * ----------------
+ * That's correct, control characters are stored directly in the shared-strings table.
+ * We do encode characters that cannot be represented in XML using the following escape sequence:
+ * _xHHHH_ where H represents a hexadecimal character in the character's value...
+ * So you could end up with something like _x0008_ in a string (either in a cell value (<v>)
+ * element or in the shared string <t> element.
+ *
+ * @param string $value Value to unescape
+ * @return string
+ */
+ public static function ControlCharacterOOXML2PHP($value = '') {
+ if(empty(self::$_controlCharacters)) {
+ self::_buildControlCharacters();
+ }
+
+ return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
+ }
+
+ /**
+ * Convert from PHP control character to OpenXML escaped control character
+ *
+ * Excel 2007 team:
+ * ----------------
+ * That's correct, control characters are stored directly in the shared-strings table.
+ * We do encode characters that cannot be represented in XML using the following escape sequence:
+ * _xHHHH_ where H represents a hexadecimal character in the character's value...
+ * So you could end up with something like _x0008_ in a string (either in a cell value (<v>)
+ * element or in the shared string <t> element.
+ *
+ * @param string $value Value to escape
+ * @return string
+ */
+ public static function ControlCharacterPHP2OOXML($value = '') {
+ if(empty(self::$_controlCharacters)) {
+ self::_buildControlCharacters();
+ }
+
+ return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value );
+ }
+
+ /**
+ * Check if a string contains UTF8 data
+ *
+ * @param string $value
+ * @return boolean
+ */
+ public static function IsUTF8($value = '') {
+ return utf8_encode(utf8_decode($value)) === $value;
+ }
+
+ /**
+ * Formats a numeric value as a string for output in various output writers
+ *
+ * @param mixed $value
+ * @return string
+ */
+ public static function FormatNumber($value) {
+ return number_format($value, 2, '.', '');
+ }
+
+ /**
+ * Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length)
+ * Writes the string using uncompressed notation, no rich text, no Asian phonetics
+ * If mbstring extension is not available, ASCII is assumed, and compressed notation is used
+ * although this will give wrong results for non-ASCII strings
+ * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3
+ *
+ * @param string $value UTF-8 encoded string
+ * @return string
+ */
+ public static function UTF8toBIFF8UnicodeShort($value)
+ {
+ // character count
+ $ln = self::CountCharacters($value, 'UTF-8');
+
+ // option flags
+ $opt = (self::getIsMbstringEnabled() || self::getIsIconvEnabled()) ?
+ 0x0001 : 0x0000;
+
+ // characters
+ $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+
+ $data = pack('CC', $ln, $opt) . $chars;
+ return $data;
+ }
+
+ /**
+ * Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length)
+ * Writes the string using uncompressed notation, no rich text, no Asian phonetics
+ * If mbstring extension is not available, ASCII is assumed, and compressed notation is used
+ * although this will give wrong results for non-ASCII strings
+ * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3
+ *
+ * @param string $value UTF-8 encoded string
+ * @return string
+ */
+ public static function UTF8toBIFF8UnicodeLong($value)
+ {
+ // character count
+ $ln = self::CountCharacters($value, 'UTF-8');
+
+ // option flags
+ $opt = (self::getIsMbstringEnabled() || self::getIsIconvEnabled()) ?
+ 0x0001 : 0x0000;
+
+ // characters
+ $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+
+ $data = pack('vC', $ln, $opt) . $chars;
+ return $data;
+ }
+
+ /**
+ * Convert string from one encoding to another. First try mbstring, then iconv, or no convertion
+ *
+ * @param string $value
+ * @param string $to Encoding to convert to, e.g. 'UTF-8'
+ * @param string $from Encoding to convert from, e.g. 'UTF-16LE'
+ * @return string
+ */
+ public static function ConvertEncoding($value, $to, $from)
+ {
+ if (self::getIsMbstringEnabled()) {
+ $value = mb_convert_encoding($value, $to, $from);
+ return $value;
+ }
+
+ if (self::getIsIconvEnabled()) {
+ $value = iconv($from, $to, $value);
+ return $value;
+ }
+
+ // else, no conversion
+ return $value;
+ }
+
+ /**
+ * Get character count. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $value
+ * @param string $enc Encoding
+ * @return int Character count
+ */
+ public static function CountCharacters($value, $enc = 'UTF-8')
+ {
+ if (self::getIsMbstringEnabled()) {
+ $count = mb_strlen($value, $enc);
+ return $count;
+ }
+
+ if (self::getIsIconvEnabled()) {
+ $count = iconv_strlen($value, $enc);
+ return $count;
+ }
+
+ // else strlen
+ $count = strlen($value);
+ return $count;
+ }
+
+}
diff --git a/admin/survey/export/libs/PHPPowerPoint/Shared/XMLWriter.php b/admin/survey/export/libs/PHPPowerPoint/Shared/XMLWriter.php
new file mode 100644
index 0000000..da434a5
--- /dev/null
+++ b/admin/survey/export/libs/PHPPowerPoint/Shared/XMLWriter.php
@@ -0,0 +1,141 @@
+<?php
+/**
+ * PHPPowerPoint
+ *
+ * Copyright (c) 2009 - 2010 PHPPowerPoint
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version 0.1.0, 2009-04-27
+ */
+
+if (!defined('DATE_W3C')) {
+ define('DATE_W3C', 'Y-m-d\TH:i:sP');
+}
+
+/**
+ * PHPPowerPoint_Shared_XMLWriter
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ */
+class PHPPowerPoint_Shared_XMLWriter {
+ /** Temporary storage method */
+ const STORAGE_MEMORY = 1;
+ const STORAGE_DISK = 2;
+
+ /**
+ * Internal XMLWriter
+ *
+ * @var XMLWriter
+ */
+ private $_xmlWriter;
+
+ /**
+ * Temporary filename
+ *
+ * @var string
+ */
+ private $_tempFileName = '';
+
+ /**
+ * Create a new PHPPowerPoint_Shared_XMLWriter instance
+ *
+ * @param int $pTemporaryStorage Temporary storage location
+ * @param string $pTemporaryStorageFolder Temporary storage folder
+ */
+ public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './') {
+ // Create internal XMLWriter
+ $this->_xmlWriter = new XMLWriter();
+
+ // Open temporary storage
+ if ($pTemporaryStorage == self::STORAGE_MEMORY) {
+ $this->_xmlWriter->openMemory();
+ } else {
+ // Create temporary filename
+ $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
+
+ // Open storage
+ if ($this->_xmlWriter->openUri($this->_tempFileName) === false) {
+ // Fallback to memory...
+ $this->_xmlWriter->openMemory();
+ }
+ }
+
+ // Set default values
+ $this->_xmlWriter->setIndent(true);
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct() {
+ // Desctruct XMLWriter
+ unset($this->_xmlWriter);
+
+ // Unlink temporary files
+ if ($this->_tempFileName != '') {
+ @unlink($this->_tempFileName);
+ }
+ }
+
+ /**
+ * Get written data
+ *
+ * @return $data
+ */
+ public function getData() {
+ if ($this->_tempFileName == '') {
+ return $this->_xmlWriter->outputMemory(true);
+ } else {
+ $this->_xmlWriter->flush();
+ return file_get_contents($this->_tempFileName);
+ }
+ }
+
+ /**
+ * Catch function calls (and pass them to internal XMLWriter)
+ *
+ * @param unknown_type $function
+ * @param unknown_type $args
+ */
+ public function __call($function, $args) {
+ try {
+ @call_user_func_array(array($this->_xmlWriter, $function), $args);
+ } catch (Exception $ex) {
+ // Do nothing!
+ }
+ }
+
+ /**
+ * Fallback method for writeRaw, introduced in PHP 5.2
+ *
+ * @param string $text
+ * @return string
+ */
+ public function writeRaw($text)
+ {
+ if (isset($this->_xmlWriter) && is_object($this->_xmlWriter) && (method_exists($this->_xmlWriter, 'writeRaw'))) {
+ return $this->_xmlWriter->writeRaw($text);
+ }
+
+ return $this->text($text);
+ }
+}
diff --git a/admin/survey/export/libs/PHPPowerPoint/Shared/ZipStreamWrapper.php b/admin/survey/export/libs/PHPPowerPoint/Shared/ZipStreamWrapper.php
new file mode 100644
index 0000000..1d5a5f5
--- /dev/null
+++ b/admin/survey/export/libs/PHPPowerPoint/Shared/ZipStreamWrapper.php
@@ -0,0 +1,182 @@
+<?php
+/**
+ * PHPPowerPoint
+ *
+ * Copyright (c) 2009 - 2010 PHPPowerPoint
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version 0.1.0, 2009-04-27
+ */
+
+
+/** Register new zip wrapper */
+PHPPowerPoint_Shared_ZipStreamWrapper::register();
+
+
+/**
+ * PHPPowerPoint_Shared_ZipStreamWrapper
+ *
+ * @category PHPPowerPoint
+ * @package PHPPowerPoint_Shared
+ * @copyright Copyright (c) 2009 - 2010 PHPPowerPoint (http://www.codeplex.com/PHPPowerPoint)
+ */
+class PHPPowerPoint_Shared_ZipStreamWrapper {
+ /**
+ * Internal ZipAcrhive
+ *
+ * @var ZipAcrhive
+ */
+ private $_archive;
+
+ /**
+ * Filename in ZipAcrhive
+ *
+ * @var string
+ */
+ private $_fileNameInArchive = '';
+
+ /**
+ * Position in file
+ *
+ * @var int
+ */
+ private $_position = 0;
+
+ /**
+ * Data
+ *
+ * @var mixed
+ */
+ private $_data = '';
+
+ /**
+ * Register wrapper
+ */
+ public static function register() {
+ @stream_wrapper_unregister("zip");
+ @stream_wrapper_register("zip", __CLASS__);
+ }
+
+ /**
+ * Open stream
+ */
+ public function stream_open($path, $mode, $options, &$opened_path) {
+ // Check for mode
+ if ($mode{0} != 'r') {
+ throw new Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
+ }
+
+ // Parse URL
+ $url = @parse_url($path);
+
+ // Fix URL
+ if (!is_array($url)) {
+ $url['host'] = substr($path, strlen('zip://'));
+ $url['path'] = '';
+ }
+ if (strpos($url['host'], '#') !== false) {
+ if (!isset($url['fragment'])) {
+ $url['fragment'] = substr($url['host'], strpos($url['host'], '#') + 1) . $url['path'];
+ $url['host'] = substr($url['host'], 0, strpos($url['host'], '#'));
+ unset($url['path']);
+ }
+ } else {
+ $url['host'] = $url['host'] . $url['path'];
+ unset($url['path']);
+ }
+
+ // Open archive
+ $this->_archive = new ZipArchive();
+ $this->_archive->open($url['host']);
+
+ $this->_fileNameInArchive = $url['fragment'];
+ $this->_position = 0;
+ $this->_data = $this->_archive->getFromName( $this->_fileNameInArchive );
+
+ return true;
+ }
+
+ /**
+ * Stat stream
+ */
+ public function stream_stat() {
+ return $this->_archive->statName( $this->_fileNameInArchive );
+ }
+
+ /**
+ * Read stream
+ */
+ function stream_read($count) {
+ $ret = substr($this->_data, $this->_position, $count);
+ $this->_position += strlen($ret);
+ return $ret;
+ }
+
+ /**
+ * Tell stream
+ */
+ public function stream_tell() {
+ return $this->_position;
+ }
+
+ /**
+ * EOF stream
+ */
+ public function stream_eof() {
+ return $this->_position >= strlen($this->_data);
+ }
+
+ /**
+ * Seek stream
+ */
+ public function stream_seek($offset, $whence) {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($this->_data) && $offset >= 0) {
+ $this->_position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->_position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_END:
+ if (strlen($this->_data) + $offset >= 0) {
+ $this->_position = strlen($this->_data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ }
+}