Settings.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2011 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 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version 1.7.6, 2011-02-27
  26. */
  27. /** PHPExcel root directory */
  28. if (!defined('PHPEXCEL_ROOT')) {
  29. /**
  30. * @ignore
  31. */
  32. define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
  33. require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
  34. }
  35. class PHPExcel_Settings
  36. {
  37. /** constants */
  38. const PCLZIP = 'PHPExcel_Shared_ZipArchive';
  39. const ZIPARCHIVE = 'ZipArchive';
  40. private static $_zipClass = self::ZIPARCHIVE;
  41. /**
  42. * Set the Zip Class to use (PCLZip or ZipArchive)
  43. *
  44. * @param string $zipClass PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
  45. * @return boolean Success or failure
  46. */
  47. public static function setZipClass($zipClass) {
  48. if (($zipClass == self::PCLZIP) ||
  49. ($zipClass == self::ZIPARCHIVE)) {
  50. self::$_zipClass = $zipClass;
  51. return True;
  52. }
  53. return False;
  54. } // function setZipClass()
  55. /**
  56. * Return the Zip Class to use (PCLZip or ZipArchive)
  57. *
  58. * @return string Zip Class to use - PHPExcel_Settings::PCLZip or PHPExcel_Settings::ZipArchive
  59. */
  60. public static function getZipClass() {
  61. return self::$_zipClass;
  62. } // function getZipClass()
  63. public static function getCacheStorageMethod() {
  64. return PHPExcel_CachedObjectStorageFactory::$_cacheStorageMethod;
  65. } // function getCacheStorageMethod()
  66. public static function getCacheStorageClass() {
  67. return PHPExcel_CachedObjectStorageFactory::$_cacheStorageClass;
  68. } // function getCacheStorageClass()
  69. public static function setCacheStorageMethod($method = PHPExcel_CachedObjectStorageFactory::cache_in_memory, $arguments = array()) {
  70. return PHPExcel_CachedObjectStorageFactory::initialize($method,$arguments);
  71. } // function setCacheStorageMethod()
  72. public static function setLocale($locale){
  73. return PHPExcel_Calculation::getInstance()->setLocale($locale);
  74. } // function setLocale()
  75. }