forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.php
More file actions
31 lines (29 loc) · 1.29 KB
/
js.php
File metadata and controls
31 lines (29 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<script defer src="/js/dist/main.min.js?<?= JS_LATEST_UPDATE ?>"></script>
<script defer src="/js/vendor/alpine-3.12.0.min.js?<?= JS_LATEST_UPDATE ?>"></script>
<script>
document.documentElement.classList.replace('no-js', 'js');
document.addEventListener('alpine:init', () => {
Alpine.store('globals', {
USER_PREFIX: '<?= $user_plain ?>_',
UNLIMITED: '<?= _("Unlimited") ?>',
NOTIFICATIONS_EMPTY: '<?= _("No notifications") ?>',
NOTIFICATIONS_DELETE_ALL: '<?= _("Delete all notifications") ?>',
CONFIRM_LEAVE_PAGE: '<?= _("LEAVE_PAGE_CONFIRMATION") ?>',
ERROR_MESSAGE: '<?= !empty($_SESSION['error_msg']) ? htmlentities($_SESSION['error_msg']) : '' ?>',
BLACKLIST: '<?= _("BLACKLIST") ?>',
IPVERSE: '<?= _("IPVERSE") ?>'
});
})
</script>
<?php if (!empty($_SESSION['error_msg'])) unset($_SESSION['error_msg']); ?>
<?php
$customScriptDirectory = new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts");
foreach ($customScriptDirectory as $customScript) {
$extension = $customScript->getExtension();
if ($extension === "js") {
$customScriptPath = "/js/custom_scripts/" . rawurlencode($customScript->getBasename());
echo '<script defer src="' . $customScriptPath . '"></script>';
} elseif ($extension === "php") {
require_once $customScript->getPathname();
}
} ?>