From da99000fe8c7f75fde010f065385e02e3ef313ea Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Fri, 3 May 2013 11:21:08 +0200 Subject: [PATCH] Translation of semantics now working --- h5p.classes.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index e792732..43a70fc 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -455,11 +455,14 @@ class H5PValidator { if (is_dir($languagePath)) { $languageFiles = scandir($languagePath); foreach ($languageFiles as $languageFile) { - if (preg_match('/^(-?[a-z]+){1,7}\.json$/i', $file) === 0) { + if (in_array($languageFile, array('.', '..'))) { + continue; + } + if (preg_match('/^(-?[a-z]+){1,7}\.json$/i', $languageFile) === 0) { $this->h5pF->setErrorMessage($this->h5pF->t('Invalid language file %file in library %library', array('%file' => $languageFile, '%library' => $file))); return FALSE; } - $languageJson = $this->getJsonData($languageFile, TRUE); + $languageJson = $this->getJsonData($languagePath . DIRECTORY_SEPARATOR . $languageFile, TRUE); if ($languageJson === FALSE) { $this->h5pF->setErrorMessage($this->h5pF->t('Invalid language file %languageFile has been included in the library %name', array('%languageFile' => $languageFile, '%name' => $file))); return FALSE;