2014-03-13 00:17:48 -06:00
|
|
|
<?php
|
|
|
|
|
/**
|
2014-03-26 16:33:20 +07:00
|
|
|
* PHPWord
|
2014-03-13 00:17:48 -06:00
|
|
|
*
|
2014-03-27 23:55:06 +07:00
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
2014-03-13 00:17:48 -06:00
|
|
|
*/
|
|
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
namespace PhpOffice\PhpWord;
|
|
|
|
|
|
2014-03-24 00:26:10 +07:00
|
|
|
/**
|
|
|
|
|
* Settings
|
|
|
|
|
*/
|
2014-03-22 10:06:08 +04:00
|
|
|
class Settings
|
2014-03-13 20:58:24 +07:00
|
|
|
{
|
2014-03-16 11:57:48 -06:00
|
|
|
/** Available Zip library classes */
|
2014-03-28 19:41:33 +07:00
|
|
|
const PCLZIP = 'PhpOffice\\PhpWord\\Shared\\ZipArchive';
|
2014-03-16 11:57:48 -06:00
|
|
|
const ZIPARCHIVE = 'ZipArchive';
|
|
|
|
|
|
2014-03-13 00:17:48 -06:00
|
|
|
/**
|
|
|
|
|
* Compatibility option for XMLWriter
|
|
|
|
|
*
|
|
|
|
|
* @var boolean
|
|
|
|
|
*/
|
2014-04-05 00:57:50 +07:00
|
|
|
private static $xmlWriterCompatibility = true;
|
2014-03-13 00:17:48 -06:00
|
|
|
|
2014-03-16 11:57:48 -06:00
|
|
|
/**
|
|
|
|
|
* Name of the class used for Zip file management
|
|
|
|
|
* e.g.
|
|
|
|
|
* ZipArchive
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2014-04-05 00:57:50 +07:00
|
|
|
private static $zipClass = self::ZIPARCHIVE;
|
2014-03-16 11:57:48 -06:00
|
|
|
|
2014-03-13 00:17:48 -06:00
|
|
|
/**
|
|
|
|
|
* Set the compatibility option used by the XMLWriter
|
|
|
|
|
*
|
|
|
|
|
* @param boolean $compatibility This sets the setIndent and setIndentString for better compatibility
|
|
|
|
|
* @return boolean Success or failure
|
|
|
|
|
*/
|
2014-03-13 20:58:24 +07:00
|
|
|
public static function setCompatibility($compatibility)
|
|
|
|
|
{
|
2014-03-13 00:17:48 -06:00
|
|
|
if (is_bool($compatibility)) {
|
2014-04-05 00:57:50 +07:00
|
|
|
self::$xmlWriterCompatibility = $compatibility;
|
2014-03-13 20:58:24 +07:00
|
|
|
return true;
|
2014-03-13 00:17:48 -06:00
|
|
|
}
|
2014-03-13 20:58:24 +07:00
|
|
|
return false;
|
2014-03-15 09:27:48 -04:00
|
|
|
}
|
2014-03-13 00:17:48 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the compatibility option used by the XMLWriter
|
|
|
|
|
*
|
|
|
|
|
* @return boolean Compatibility
|
|
|
|
|
*/
|
2014-03-13 20:58:24 +07:00
|
|
|
public static function getCompatibility()
|
|
|
|
|
{
|
2014-04-05 00:57:50 +07:00
|
|
|
return self::$xmlWriterCompatibility;
|
2014-03-15 09:27:48 -04:00
|
|
|
}
|
2014-03-16 11:57:48 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the Zip handler Class that PHPWord should use for Zip file management (PCLZip or ZipArchive)
|
|
|
|
|
*
|
|
|
|
|
* @param string $zipClass The Zip handler class that PHPWord should use for Zip file management
|
2014-03-28 19:41:33 +07:00
|
|
|
* e.g. Settings::PCLZip or Settings::ZipArchive
|
2014-03-16 11:57:48 -06:00
|
|
|
* @return boolean Success or failure
|
|
|
|
|
*/
|
|
|
|
|
public static function setZipClass($zipClass)
|
|
|
|
|
{
|
|
|
|
|
if (($zipClass === self::PCLZIP) ||
|
|
|
|
|
($zipClass === self::ZIPARCHIVE)) {
|
2014-04-05 00:57:50 +07:00
|
|
|
self::$zipClass = $zipClass;
|
2014-03-28 19:41:33 +07:00
|
|
|
return true;
|
2014-03-16 11:57:48 -06:00
|
|
|
}
|
2014-03-28 19:41:33 +07:00
|
|
|
return false;
|
2014-03-16 11:57:48 -06:00
|
|
|
} // function setZipClass()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the name of the Zip handler Class that PHPWord is configured to use (PCLZip or ZipArchive)
|
|
|
|
|
* or Zip file management
|
|
|
|
|
*
|
|
|
|
|
* @return string Name of the Zip handler Class that PHPWord is configured to use
|
|
|
|
|
* for Zip file management
|
2014-03-28 19:41:33 +07:00
|
|
|
* e.g. Settings::PCLZip or Settings::ZipArchive
|
2014-03-16 11:57:48 -06:00
|
|
|
*/
|
|
|
|
|
public static function getZipClass()
|
|
|
|
|
{
|
2014-04-05 00:57:50 +07:00
|
|
|
return self::$zipClass;
|
2014-03-16 11:57:48 -06:00
|
|
|
} // function getZipClass()
|
2014-03-23 17:37:26 +07:00
|
|
|
}
|