Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

Commit 979aa76

Browse files
author
Mark Baker
committed
Only load list of locale files for calculation engine if setLocale() is explicitly called
1 parent 420b344 commit 979aa76

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Classes/PHPExcel/Calculation.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,14 +1681,6 @@ class PHPExcel_Calculation {
16811681

16821682

16831683
private function __construct() {
1684-
$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
1685-
foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) {
1686-
$filename = substr($filename,strlen($localeFileDirectory)+1);
1687-
if ($filename != 'en') {
1688-
self::$_validLocaleLanguages[] = $filename;
1689-
}
1690-
}
1691-
16921684
$setPrecision = (PHP_INT_SIZE == 4) ? 12 : 16;
16931685
$this->_savedPrecision = ini_get('precision');
16941686
if ($this->_savedPrecision < $setPrecision) {
@@ -1703,6 +1695,16 @@ public function __destruct() {
17031695
}
17041696
}
17051697

1698+
private static function _loadLocales() {
1699+
$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';
1700+
foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) {
1701+
$filename = substr($filename,strlen($localeFileDirectory)+1);
1702+
if ($filename != 'en') {
1703+
self::$_validLocaleLanguages[] = $filename;
1704+
}
1705+
}
1706+
}
1707+
17061708
/**
17071709
* Get an instance of this class
17081710
*
@@ -1883,6 +1885,9 @@ public function setLocale($locale='en_us') {
18831885
list($language) = explode('_',$locale);
18841886
}
18851887

1888+
if (count(self::$_validLocaleLanguages) == 1)
1889+
self::_loadLocales();
1890+
18861891
// Test whether we have any language data for this language (any locale)
18871892
if (in_array($language,self::$_validLocaleLanguages)) {
18881893
// initialise language/locale settings

0 commit comments

Comments
 (0)