Subversion Repositories eFlore/Applications.cel

Rev

Rev 2388 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2388 jpm 1
<?php
2
/**
3
 * PHPExcel
4
 *
5
 * Copyright (c) 2006 - 2013 PHPExcel
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
 *
21
 * @category   PHPExcel
22
 * @package    PHPExcel_Settings
23
 * @copyright  Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
24
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
 * @version    ##VERSION##, ##DATE##
26
 */
27
 
28
/** PHPExcel root directory */
29
if (!defined('PHPEXCEL_ROOT')) {
30
    /**
31
     * @ignore
32
     */
33
    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
34
    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
35
}
36
 
37
 
38
class PHPExcel_Settings
39
{
40
    /**    constants */
41
    /**    Available Zip library classes */
42
    const PCLZIP        = 'PHPExcel_Shared_ZipArchive';
43
    const ZIPARCHIVE    = 'ZipArchive';
44
 
45
    /**    Optional Chart Rendering libraries */
46
    const CHART_RENDERER_JPGRAPH    = 'jpgraph';
47
 
48
    /**    Optional PDF Rendering libraries */
49
    const PDF_RENDERER_TCPDF		= 'tcPDF';
50
    const PDF_RENDERER_DOMPDF		= 'DomPDF';
51
    const PDF_RENDERER_MPDF 		= 'mPDF';
52
 
53
 
54
    private static $_chartRenderers = array(
55
        self::CHART_RENDERER_JPGRAPH,
56
    );
57
 
58
    private static $_pdfRenderers = array(
59
        self::PDF_RENDERER_TCPDF,
60
        self::PDF_RENDERER_DOMPDF,
61
        self::PDF_RENDERER_MPDF,
62
    );
63
 
64
 
65
    /**
66
     * Name of the class used for Zip file management
67
     *	e.g.
68
     *		ZipArchive
69
     *
70
     * @var string
71
     */
72
    private static $_zipClass    = self::ZIPARCHIVE;
73
 
74
 
75
    /**
76
     * Name of the external Library used for rendering charts
77
     *	e.g.
78
     *		jpgraph
79
     *
80
     * @var string
81
     */
82
    private static $_chartRendererName = NULL;
83
 
84
    /**
85
     * Directory Path to the external Library used for rendering charts
86
     *
87
     * @var string
88
     */
89
    private static $_chartRendererPath = NULL;
90
 
91
 
92
    /**
93
     * Name of the external Library used for rendering PDF files
94
     *	e.g.
95
     * 		mPDF
96
     *
97
     * @var string
98
     */
99
    private static $_pdfRendererName = NULL;
100
 
101
    /**
102
     * Directory Path to the external Library used for rendering PDF files
103
     *
104
     * @var string
105
     */
106
    private static $_pdfRendererPath = NULL;
107
 
108
 
109
    /**
110
     * Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive)
111
     *
112
     * @param string $zipClass	The Zip handler class that PHPExcel should use for Zip file management
113
     * 	 e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
114
     * @return	boolean	Success or failure
115
     */
116
    public static function setZipClass($zipClass)
117
    {
118
        if (($zipClass === self::PCLZIP) ||
119
            ($zipClass === self::ZIPARCHIVE)) {
120
            self::$_zipClass = $zipClass;
121
            return TRUE;
122
        }
123
        return FALSE;
124
    } // function setZipClass()
125
 
126
 
127
    /**
128
     * Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive)
129
     *	or Zip file management
130
     *
131
     * @return string Name of the Zip handler Class that PHPExcel is configured to use
132
     *	for Zip file management
133
     *	e.g. PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
134
     */
135
    public static function getZipClass()
136
    {
137
        return self::$_zipClass;
138
    } // function getZipClass()
139
 
140
 
141
    /**
142
     * Return the name of the method that is currently configured for cell cacheing
143
     *
144
     * @return string Name of the cacheing method
145
     */
146
    public static function getCacheStorageMethod()
147
    {
148
        return PHPExcel_CachedObjectStorageFactory::getCacheStorageMethod();
149
    } // function getCacheStorageMethod()
150
 
151
 
152
    /**
153
     * Return the name of the class that is currently being used for cell cacheing
154
     *
155
     * @return string Name of the class currently being used for cacheing
156
     */
157
    public static function getCacheStorageClass()
158
    {
159
        return PHPExcel_CachedObjectStorageFactory::getCacheStorageClass();
160
    } // function getCacheStorageClass()
161
 
162
 
163
    /**
164
     * Set the method that should be used for cell cacheing
165
     *
166
     * @param string $method Name of the cacheing method
167
     * @param array $arguments Optional configuration arguments for the cacheing method
168
     * @return boolean Success or failure
169
     */
170
    public static function setCacheStorageMethod(
171
    	$method = PHPExcel_CachedObjectStorageFactory::cache_in_memory,
172
      $arguments = array()
173
    )
174
    {
175
        return PHPExcel_CachedObjectStorageFactory::initialize($method, $arguments);
176
    } // function setCacheStorageMethod()
177
 
178
 
179
    /**
180
     * Set the locale code to use for formula translations and any special formatting
181
     *
182
     * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk")
183
     * @return boolean Success or failure
184
     */
185
    public static function setLocale($locale='en_us')
186
    {
187
        return PHPExcel_Calculation::getInstance()->setLocale($locale);
188
    } // function setLocale()
189
 
190
 
191
    /**
192
     * Set details of the external library that PHPExcel should use for rendering charts
193
     *
194
     * @param string $libraryName	Internal reference name of the library
195
     *	e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
196
     * @param string $libraryBaseDir Directory path to the library's base folder
197
     *
198
     * @return	boolean	Success or failure
199
     */
200
    public static function setChartRenderer($libraryName, $libraryBaseDir)
201
    {
202
        if (!self::setChartRendererName($libraryName))
203
            return FALSE;
204
        return self::setChartRendererPath($libraryBaseDir);
205
    } // function setChartRenderer()
206
 
207
 
208
    /**
209
     * Identify to PHPExcel the external library to use for rendering charts
210
     *
211
     * @param string $libraryName	Internal reference name of the library
212
     *	e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
213
     *
214
     * @return	boolean	Success or failure
215
     */
216
    public static function setChartRendererName($libraryName)
217
    {
218
        if (!in_array($libraryName,self::$_chartRenderers)) {
219
            return FALSE;
220
        }
221
 
222
        self::$_chartRendererName = $libraryName;
223
 
224
        return TRUE;
225
    } // function setChartRendererName()
226
 
227
 
228
    /**
229
     * Tell PHPExcel where to find the external library to use for rendering charts
230
     *
231
     * @param string $libraryBaseDir	Directory path to the library's base folder
232
     * @return	boolean	Success or failure
233
     */
234
    public static function setChartRendererPath($libraryBaseDir)
235
    {
236
        if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
237
            return FALSE;
238
        }
239
        self::$_chartRendererPath = $libraryBaseDir;
240
 
241
        return TRUE;
242
    } // function setChartRendererPath()
243
 
244
 
245
    /**
246
     * Return the Chart Rendering Library that PHPExcel is currently configured to use (e.g. jpgraph)
247
     *
248
     * @return string|NULL Internal reference name of the Chart Rendering Library that PHPExcel is
249
     *	currently configured to use
250
     *	e.g. PHPExcel_Settings::CHART_RENDERER_JPGRAPH
251
     */
252
    public static function getChartRendererName()
253
    {
254
        return self::$_chartRendererName;
255
    } // function getChartRendererName()
256
 
257
 
258
    /**
259
     * Return the directory path to the Chart Rendering Library that PHPExcel is currently configured to use
260
     *
261
     * @return string|NULL Directory Path to the Chart Rendering Library that PHPExcel is
262
     * 	currently configured to use
263
     */
264
    public static function getChartRendererPath()
265
    {
266
        return self::$_chartRendererPath;
267
    } // function getChartRendererPath()
268
 
269
 
270
    /**
271
     * Set details of the external library that PHPExcel should use for rendering PDF files
272
     *
273
     * @param string $libraryName Internal reference name of the library
274
     * 	e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
275
     * 	PHPExcel_Settings::PDF_RENDERER_DOMPDF
276
     *  or PHPExcel_Settings::PDF_RENDERER_MPDF
277
     * @param string $libraryBaseDir Directory path to the library's base folder
278
     *
279
     * @return boolean Success or failure
280
     */
281
    public static function setPdfRenderer($libraryName, $libraryBaseDir)
282
    {
283
        if (!self::setPdfRendererName($libraryName))
284
            return FALSE;
285
        return self::setPdfRendererPath($libraryBaseDir);
286
    } // function setPdfRenderer()
287
 
288
 
289
    /**
290
     * Identify to PHPExcel the external library to use for rendering PDF files
291
     *
292
     * @param string $libraryName Internal reference name of the library
293
     * 	e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
294
     *	PHPExcel_Settings::PDF_RENDERER_DOMPDF
295
     * 	or PHPExcel_Settings::PDF_RENDERER_MPDF
296
     *
297
     * @return boolean Success or failure
298
     */
299
    public static function setPdfRendererName($libraryName)
300
    {
301
        if (!in_array($libraryName,self::$_pdfRenderers)) {
302
            return FALSE;
303
        }
304
 
305
        self::$_pdfRendererName = $libraryName;
306
 
307
        return TRUE;
308
    } // function setPdfRendererName()
309
 
310
 
311
    /**
312
     * Tell PHPExcel where to find the external library to use for rendering PDF files
313
     *
314
     * @param string $libraryBaseDir Directory path to the library's base folder
315
     * @return boolean Success or failure
316
     */
317
    public static function setPdfRendererPath($libraryBaseDir)
318
    {
319
        if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
320
            return FALSE;
321
        }
322
        self::$_pdfRendererPath = $libraryBaseDir;
323
 
324
        return TRUE;
325
    } // function setPdfRendererPath()
326
 
327
 
328
    /**
329
     * Return the PDF Rendering Library that PHPExcel is currently configured to use (e.g. dompdf)
330
     *
331
     * @return string|NULL Internal reference name of the PDF Rendering Library that PHPExcel is
332
     * 	currently configured to use
333
     *  e.g. PHPExcel_Settings::PDF_RENDERER_TCPDF,
334
     *  PHPExcel_Settings::PDF_RENDERER_DOMPDF
335
     *  or PHPExcel_Settings::PDF_RENDERER_MPDF
336
     */
337
    public static function getPdfRendererName()
338
    {
339
        return self::$_pdfRendererName;
340
    } // function getPdfRendererName()
341
 
342
 
343
    /**
344
     * Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use
345
     *
346
     * @return string|NULL Directory Path to the PDF Rendering Library that PHPExcel is
347
     *		currently configured to use
348
     */
349
    public static function getPdfRendererPath()
350
    {
351
        return self::$_pdfRendererPath;
352
    } // function getPdfRendererPath()
353
 
354
}