14
14
*/
15
15
class Settings
16
16
{
17
+ /** Available Zip library classes */
18
+ const PCLZIP = 'PhpOffice \\PhpWord \\Shared \\ZipArchive ' ;
19
+ const ZIPARCHIVE = 'ZipArchive ' ;
20
+
17
21
/**
18
22
* Compatibility option for XMLWriter
19
23
*
20
24
* @var boolean
21
25
*/
22
26
private static $ _xmlWriterCompatibility = true ;
23
27
28
+ /**
29
+ * Name of the class used for Zip file management
30
+ * e.g.
31
+ * ZipArchive
32
+ *
33
+ * @var string
34
+ */
35
+ private static $ _zipClass = self ::ZIPARCHIVE ;
36
+
24
37
/**
25
38
* Set the compatibility option used by the XMLWriter
26
39
*
@@ -45,4 +58,34 @@ public static function getCompatibility()
45
58
{
46
59
return self ::$ _xmlWriterCompatibility ;
47
60
}
61
+
62
+ /**
63
+ * Set the Zip handler Class that PHPWord should use for Zip file management (PCLZip or ZipArchive)
64
+ *
65
+ * @param string $zipClass The Zip handler class that PHPWord should use for Zip file management
66
+ * e.g. Settings::PCLZip or Settings::ZipArchive
67
+ * @return boolean Success or failure
68
+ */
69
+ public static function setZipClass ($ zipClass )
70
+ {
71
+ if (($ zipClass === self ::PCLZIP ) ||
72
+ ($ zipClass === self ::ZIPARCHIVE )) {
73
+ self ::$ _zipClass = $ zipClass ;
74
+ return true ;
75
+ }
76
+ return false ;
77
+ } // function setZipClass()
78
+
79
+ /**
80
+ * Return the name of the Zip handler Class that PHPWord is configured to use (PCLZip or ZipArchive)
81
+ * or Zip file management
82
+ *
83
+ * @return string Name of the Zip handler Class that PHPWord is configured to use
84
+ * for Zip file management
85
+ * e.g. Settings::PCLZip or Settings::ZipArchive
86
+ */
87
+ public static function getZipClass ()
88
+ {
89
+ return self ::$ _zipClass ;
90
+ } // function getZipClass()
48
91
}
0 commit comments