Skip to content

Commit abf36b6

Browse files
committed
Fix direction for FileListValidator.php
1 parent b1e4668 commit abf36b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Phpbb/TranslationValidator/Validator/FileListValidator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,21 @@ public function validate()
137137
$sourceFiles[] = $this->sourceLanguagePath . 'LICENSE';
138138
$sourceFiles = array_unique($sourceFiles);
139139

140-
// Get $lang['direction'] of translation to allow additional rtl-files for rtl-translations
141-
$filePath = $this->originPath . '/' . $this->originLanguagePath . 'common.php';
140+
// Get extra->direction from composer.json to allow additional rtl-files for rtl-translations
141+
$filePath = $this->originPath . '/' . $this->originLanguagePath . 'composer.json';
142142

143+
// Safe mode for safe execution on a server
143144
if ($this->safeMode)
144145
{
145-
$lang = ValidatorRunner::langParser($filePath);
146+
$jsonContent = self::langParser($filePath);
146147
}
147-
148148
else
149149
{
150-
include($filePath);
150+
$fileContents = (string) file_get_contents($filePath);
151+
$jsonContent = json_decode($fileContents, true);
151152
}
152153

153-
$this->direction = $lang['DIRECTION'];
154+
$this->direction = $jsonContent['extra']['direction'];
154155
// Throw error, if invalid direction is used
155156
if (!in_array($this->direction, array('rtl', 'ltr')))
156157
{
@@ -159,7 +160,6 @@ public function validate()
159160

160161
$originFiles = $this->getFileList($this->originPath);
161162

162-
$missingSubsilver2Files = $availableSubsilver2Files = array();
163163
$validFiles = array();
164164
foreach ($sourceFiles as $sourceFile)
165165
{

0 commit comments

Comments
 (0)