Fixed phrases import from old system to the new one

This commit is contained in:
Paolo
2025-11-03 16:32:37 +01:00
parent 16ebbc324e
commit bc2fb32e3e
2 changed files with 7 additions and 127 deletions
+7 -4
View File
@@ -312,12 +312,15 @@ class PhrasesLib
// If an error occurred then exit
if ($line === false && !feof($srcFileHandle)) return false;
// Search for the end of the array
if (stristr($line, ');'))
// If the first phrase or the end of the array
if ($line == '$phrases = array();' || stristr($line, ');'))
{
$first_coma = ',';
if ($line == '$phrases = array();') $first_coma = '';
// If found then append the new phrase to the current line
// and replace the end of the array
$line = str_replace(');', ",\n".var_export($phrase, true)."\n".');', $line);
$line = str_replace(');', $first_coma."\n".var_export($phrase, true)."\n".');', $line);
}
// In any case copy the line to the temp file
@@ -345,7 +348,7 @@ class PhrasesLib
{
return !(file_put_contents(
$phrasesCategoryFile,
'<?php'."\n\n".'$phrases = array('."\n".');'
'<?php'."\n\n".'$phrases = array();'
) === false);
}