29 if ($this->config ==
null)
31 if (!isset(self::$configs[$this->
path]))
34 $file =
new File(
"$this->path/deps.php");
36 if ($file->isExists())
38 $this->config = include($file->getPath());
39 if (!is_array($this->config))
58 if (defined(
"JN_DEV_RELOAD"))
65 if (!empty(static::$modificationDates[$fullyQualifiedName]))
67 return static::$modificationDates[$fullyQualifiedName];
72 $file =
new File(
"{$this->path}/{$this->baseFileName}.js");
73 if ($file->isExists())
78 $langDirectory =
new Directory(
"{$this->path}/lang/");
79 if ($langDirectory->isExists())
81 $langs = $langDirectory->getChildren();
84 if (
$lang->isDirectory())
96 $value =
count($marks) === 1 ? $marks[0] : md5(implode(
"/", $marks));
98 static::$modificationDates[$fullyQualifiedName] = $value;
105 return "$this->namespace:$this->name";
113 return static::$dependencies[$fullyQualifiedName];
118 $relativePath = str_replace(Application::getDocumentRoot(),
"",
"{$this->path}/");
120 return Path::normalize($relativePath);
125 $relativePath = $this->
getPath() .
"/{$this->baseFileName}.js";
127 return Path::normalize($relativePath);
134 return $langPhrases ?: [];
142 if (is_array($config))
144 if (array_keys($config) !== range(0,
count($config) - 1))
146 if (array_key_exists(
'extensions', $config))
148 $list = $config[
'extensions'];
158 foreach ($list as $ext)
160 $result[] = Base::expandDependency($ext);
176 if (isset($config[
"bundle"]))
178 $list = array_map(
function ($file) {
179 $path = Path::normalize($this->
path .
"/$file");
180 if (Path::getExtension(
$path) !==
"js")
186 }, $config[
"bundle"]);
196 if (is_array($config))
198 if (array_keys($config) !== range(0,
count($config) - 1))
200 if (isset($config[
'components']))
202 if (is_array($config[
'components']))
204 return $config[
'components'];
223 private static function expandDependency($ext):
array
228 if (!is_string($ext))
233 if (isset(self::$expandedDependencies[$ext]))
235 return self::$expandedDependencies[$ext];
238 $findChildren =
false;
239 $relativeExtDir = $ext;
241 if (mb_strpos($ext,
"*") === (mb_strlen($ext) - 1))
243 $relativeExtDir = str_replace([
"/*",
"*"],
"", $ext);
244 $findChildren =
true;
256 if ($entry->isDirectory())
258 $toAdd = $entry->getChildren();
259 $extensionFile =
new File($entry->getPath() .
'/extension.js');
260 if ($extensionFile->isExists())
262 $result[] = $extensionFile->getPath();
276 if ($rootExtension->isExists())
281 self::$expandedDependencies[$ext] =
$result;
289 if (!empty($langPhrases))
291 $jsonLangMessages =
Utils::jsonEncode($langPhrases, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
294BX.message($jsonLangMessages);
static loadLanguageFile($file, $language=null, $normalize=true)
if(!defined('SITE_ID')) $lang