Commit aee321c6 authored by damjan's avatar damjan

[BUGFIX] Using PHP 5.3 compatible arrays.

parent ddd1c98e
......@@ -26,7 +26,6 @@ namespace SGalinski\Lfeditor\Service;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use Exception;
use SGalinski\Lfeditor\Exceptions\LFException;
use SGalinski\Lfeditor\Utility\SgLib;
use SGalinski\Lfeditor\Utility\Typo3Lib;
......@@ -60,7 +59,7 @@ class FileBaseXLFService extends FileBaseService {
// convert all language values from utf-8 to the original charset
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, ['en']);
$this->localLang = Typo3Lib::utf8($this->localLang, FALSE, array('en'));
}
}
......@@ -105,10 +104,10 @@ class FileBaseXLFService extends FileBaseService {
* @return array
*/
public function resolveTranslationUnitsArrayIntoFlatArray(array $sourceData) {
$flatData = [];
$flatData = array();
if (isset($sourceData['trans-unit']['@attributes'])) {
$sourceData['trans-unit'] = [$sourceData['trans-unit']];
$sourceData['trans-unit'] = array($sourceData['trans-unit']);
}
foreach ((array) $sourceData['trans-unit'] as $data) {
......@@ -135,7 +134,7 @@ class FileBaseXLFService extends FileBaseService {
$localLang['en'] = $this->resolveTranslationUnitsArrayIntoFlatArray($localLang['en']);
// loop all languages
$originLang = [];
$originLang = array();
$languages = SgLib::getSystemLanguages();
foreach ($languages as $lang) {
$originLang[$lang] = $this->absFile;
......@@ -147,7 +146,7 @@ class FileBaseXLFService extends FileBaseService {
$lFile = $this->getLocalizedFile($localLang[$lang], $lang);
if ($this->checkLocalizedFile(basename($lFile), $lang)) {
$originLang[$lang] = $lFile;
$localLang[$lang] = [];
$localLang[$lang] = array();
if (!is_file($lFile)) {
continue;
......@@ -287,7 +286,7 @@ class FileBaseXLFService extends FileBaseService {
* @return array new xml array
*/
private function getLangContent($localLang) {
$content = [];
$content = array();
if (!is_array($localLang) || !count($localLang)) {
return $content;
}
......@@ -327,13 +326,13 @@ class FileBaseXLFService extends FileBaseService {
protected function prepareFileContents() {
// convert all language values to utf-8
if (!Typo3Lib::isTypo3BackendInUtf8Mode()) {
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, ['en']);
$this->localLang = Typo3Lib::utf8($this->localLang, TRUE, array('en'));
}
// prepare Content
$metaData = $this->prepareMeta();
$languages = SgLib::getSystemLanguages();
$languageFiles = [];
$languageFiles = array();
$enLanguage = $this->getLangContent($this->localLang['en']);
foreach ($languages as $lang) {
if ($lang === 'en') {
......@@ -342,10 +341,10 @@ class FileBaseXLFService extends FileBaseService {
if (is_array($this->localLang[$lang]) && count($this->localLang[$lang])) {
$file = $this->originLang[$lang];
$data = [
$data = array(
'header' => $metaData,
'data' => $this->getLangContent($this->localLang[$lang]),
];
);
$languageFiles[$file] .= $this->array2xml($data, $lang, $enLanguage);
}
}
......@@ -356,10 +355,10 @@ class FileBaseXLFService extends FileBaseService {
}
// prepare content for the main file
$data = [
$data = array(
'header' => $metaData,
'data' => $enLanguage,
];
);
$languageFiles[$this->absFile] = $this->array2xml($data, 'en', $enLanguage);
return $languageFiles;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment