commit 6d7214f01e6bbad3346c988fd5dc09ca6da7e856
parent 5457572c69cdb18c653b8c2222a1fad0e37f8c2e
Author: markseu <mark2011@mayberg.se>
Date: Wed, 21 Oct 2020 12:11:06 +0200
Updated language detection
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/system/extensions/install.php b/system/extensions/install.php
@@ -2,7 +2,7 @@
// Install extension, https://github.com/datenstrom/yellow
class YellowInstall {
- const VERSION = "0.8.37";
+ const VERSION = "0.8.38";
const PRIORITY = "1";
public $yellow; // access to API
@@ -360,7 +360,7 @@ class YellowInstall {
// Return extensions required
public function getExtensionsRequired($fileData) {
$extensions = array();
- $languages = $this->detectBrowserLanguages("en, de, fr");
+ $languages = array();
foreach ($this->yellow->toolbox->getTextLines($fileData) as $line) {
if (preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches)) {
if (!empty($matches[1]) && !empty($matches[2]) && strposu($matches[1], "/")) {
@@ -369,12 +369,15 @@ class YellowInstall {
list($entry, $flags) = $this->yellow->toolbox->getTextList($matches[2], ",", 2);
$arguments = preg_split("/\s*,\s*/", $flags);
$language = array_pop($arguments);
- if (preg_match("/^(.*)\.php$/", basename($entry)) && in_array($language, $languages)) {
- array_push($extensions, $extension);
+ if (preg_match("/^(.*)\.php$/", basename($entry))) {
+ $languages[$language] = $extension;
}
}
}
}
+ foreach ($this->detectBrowserLanguages("en, de, fr") as $language) {
+ if (isset($languages[$language])) array_push($extensions, $languages[$language]);
+ }
return array_slice($extensions, 0, 3);
}
}