diff --git a/app/number_translations/app_defaults.php b/app/number_translations/app_defaults.php index 5c2ecab04c..3f0d128ccb 100644 --- a/app/number_translations/app_defaults.php +++ b/app/number_translations/app_defaults.php @@ -32,16 +32,17 @@ if ($num_rows == 0) { //get the array of xml files - $xml_list = glob($_SERVER["PROJECT_ROOT"] . "/*/*/resources/switch/conf/number_translation/*.xml"); - - //number_translation class + $dir = dirname(__DIR__, 2) . "/app/number_translations/resources/switch/conf/number_translation"; + //number_translation class $number_translation = new number_translations; //process the xml files + $xml_list = array_diff(scandir($dir), array('..', '.')); foreach ($xml_list as $xml_file) { //get and parse the xml - $number_translation->xml = file_get_contents($xml_file); - $number_translation->import(); + $file_content = file_get_contents($dir . '/' . $xml_file); + $number_translation->getxml($file_content); + $number_translation->import(); } //check for existing configuration diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php index d1ef8afc69..1053e9dd70 100644 --- a/app/number_translations/resources/classes/number_translations.php +++ b/app/number_translations/resources/classes/number_translations.php @@ -86,6 +86,16 @@ class number_translations { $parameters['number_translation_name'] = $name; return $this->database->select($sql, $parameters, 'column') != 0 ? true : false; } + + /** + * + * Load properly private property xml + * @param string $file_content content of template files. + */ + public function getxml($file_content) { + $this->xml = $file_content; + return $this->xml; + } /** * Imports a number translation from either XML or JSON format.