Update app_defaults.php
This commit is contained in:
parent
3b8309af11
commit
5c9658334c
|
|
@ -25,45 +25,53 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
//get the array of xml files
|
//add the variables to the database
|
||||||
|
$sql = "select count(*) from v_number_translations ";
|
||||||
|
$num_rows = $database->select($sql, null, 'column');
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
if ($num_rows == 0) {
|
||||||
|
//get the array of xml files
|
||||||
$xml_list = glob($_SERVER["PROJECT_ROOT"] . "/*/*/resources/switch/conf/number_translation/*.xml");
|
$xml_list = glob($_SERVER["PROJECT_ROOT"] . "/*/*/resources/switch/conf/number_translation/*.xml");
|
||||||
|
|
||||||
//number_translation class
|
//number_translation class
|
||||||
$number_translation = new number_translations;
|
$number_translation = new number_translations;
|
||||||
|
|
||||||
//process the xml files
|
//process the xml files
|
||||||
foreach ($xml_list as $xml_file) {
|
foreach ($xml_list as $xml_file) {
|
||||||
//get and parse the xml
|
//get and parse the xml
|
||||||
$number_translation->xml = file_get_contents($xml_file);
|
$number_translation->xml = file_get_contents($xml_file);
|
||||||
$number_translation->import();
|
$number_translation->import();
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for existing configuration
|
//check for existing configuration
|
||||||
if (!empty($setting->get('switch','conf')) && file_exists($setting->get('switch','conf')."/autoload_configs/translate.conf.xml")) {
|
if (!empty($setting->get('switch','conf')) && file_exists($setting->get('switch','conf')."/autoload_configs/translate.conf.xml")) {
|
||||||
//import existing data
|
//import existing data
|
||||||
$xml = file_get_contents($setting->get('switch','conf')."/autoload_configs/translate.conf.xml");
|
$xml = file_get_contents($setting->get('switch','conf')."/autoload_configs/translate.conf.xml");
|
||||||
|
|
||||||
//convert the xml string to an xml object
|
//convert the xml string to an xml object
|
||||||
$xml = simplexml_load_string($xml);
|
$xml = simplexml_load_string($xml);
|
||||||
|
|
||||||
//convert to json
|
//convert to json
|
||||||
$json = json_encode($xml);
|
$json = json_encode($xml);
|
||||||
|
|
||||||
//convert to an array
|
//convert to an array
|
||||||
$number_translations = json_decode($json, true);
|
$number_translations = json_decode($json, true);
|
||||||
if (array_key_exists('include', $number_translations)) {
|
if (array_key_exists('include', $number_translations)) {
|
||||||
$number_translations = $number_translations['include'];
|
$number_translations = $number_translations['include'];
|
||||||
}
|
}
|
||||||
if (!empty($number_translations['configuration']) && $number_translations['configuration']['@attributes']['autogenerated'] != 'true') {
|
if (!empty($number_translations['configuration']) && $number_translations['configuration']['@attributes']['autogenerated'] != 'true') {
|
||||||
foreach ($number_translations['configuration']['profiles']['profile'] as $profile) {
|
foreach ($number_translations['configuration']['profiles']['profile'] as $profile) {
|
||||||
$json = json_encode($profile);
|
$json = json_encode($profile);
|
||||||
$number_translation->display_type = $display_type;
|
$number_translation->display_type = $display_type;
|
||||||
$number_translation->json = $json;
|
$number_translation->json = $json;
|
||||||
$number_translation->import();
|
$number_translation->import();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue