28 if ($this->config == null) {
30 $file =
new File(
"$this->path/deps.php");
32 if ($file->isExists())
34 $this->config = include($file->getPath());
35 if (!is_array($this->config)) {
46 if (defined(
"JN_DEV_RELOAD")) {
50 $fullyQualifiedName = $this->getFullyQualifiedName();
52 if (!empty(static::$modificationDates[$fullyQualifiedName]))
54 return static::$modificationDates[$fullyQualifiedName];
57 $file =
new File(
"{$this->path}/{$this->baseFileName}.js");
59 $langDirectory =
new Directory(
"{$this->path}/lang/");
60 if ($langDirectory->isExists())
62 $langs = $langDirectory->getChildren();
63 foreach ($langs as $lang)
65 if ($lang->isDirectory())
67 $langFile =
new File($lang->getPath().
"/{$this->baseFileName}.php");
73 $this->onBeforeModificationMarkerSave($marks);
74 if (count($marks) == 1)
80 $value = md5(implode(
"/", $marks));
83 static::$modificationDates[$fullyQualifiedName] = $value;
89 return
"$this->namespace:$this->name";
94 if (!isset(static::$dependencies[$this->name]))
96 static::$dependencies[$this->name] = array_values($this->resolveDependencies());
99 return static::$dependencies[$this->name];
105 return Path::normalize($relativePath);
110 $relativePath = $this->getPath() .
"/{$this->baseFileName}.js";
111 return Path::normalize($relativePath);
116 $langPhrases = Localization\Loc::loadLanguageFile(
"{$this->path}/{$this->baseFileName}.php");
117 return $langPhrases ?: [];
122 $config = $this->getConfig();
125 if (is_array($config))
127 if (array_keys($config) !== range(0, count($config) - 1))
129 if(array_key_exists(
'extensions', $config)) {
130 $list = $config[
'extensions'];
139 foreach ($list as $ext) {
140 $result[] = Base::expandDependency($ext);
145 $result = array_merge(...$result);
153 $config = $this->getConfig();
155 if (isset($config[
"bundle"])) {
156 $list = array_map(
function ($file) {
157 $path = Path::normalize($this->path.
"/$file");
158 if (Path::getExtension($path) !==
"js") {
162 }, $config[
"bundle"]);
170 $config = $this->getConfig();
172 if (is_array($config))
174 if (array_keys($config) !== range(0, count($config) - 1)) {
175 if (isset($config[
'components'])) {
176 if (is_array($config[
'components'])) {
177 return $config[
'components'];
196 private static function expandDependency($ext): array
201 if (!is_string($ext))
206 if ( isset(self::$expandedDependencies[$ext]))
208 return self::$expandedDependencies[$ext];
211 $findChildren =
false;
212 $relativeExtDir = $ext;
215 if(mb_strpos($ext,
"*") === (mb_strlen($ext) - 1))
217 $relativeExtDir = str_replace([
"/*",
"*"],
"", $ext);
218 $findChildren =
true;
221 $absolutePath = Manager::getExtensionPath($relativeExtDir);
222 if($findChildren && $absolutePath !=
null)
224 $dir =
new Directory($absolutePath);
225 $items = $dir->getChildren();
226 for ($i = 0, $l = count($items); $i < $l; $i++)
230 if ($entry->isDirectory())
232 $toAdd = $entry->getChildren();
233 $extensionFile =
new File($entry->getPath().
'/extension.js');
234 if($extensionFile->isExists())
236 $result[] = $extensionFile->getPath();
240 $items = array_merge($items, $toAdd);
244 $result = array_map(
function($path) use ($absolutePath, $relativeExtDir) {
245 return str_replace([$absolutePath,
"/extension.js"],[$relativeExtDir,
""], $path);
249 $rootExtension =
new File($absolutePath .
'/extension.js');
250 if($rootExtension->isExists())
252 $result[] = $relativeExtDir;
255 self::$expandedDependencies[$ext] = $result;
261 $langPhrases = $this->getLangMessages();
262 if (!empty($langPhrases))
264 $jsonLangMessages = Utils::jsonEncode($langPhrases, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
266BX.message($jsonLangMessages);
if(!function_exists(__NAMESPACE__.'\\___1034172934'))