web-base/core/Elements/Script.class.php

29 lines
697 B
PHP
Raw Normal View History

2020-02-09 23:02:19 +01:00
<?php
namespace Elements;
2020-04-04 01:15:59 +02:00
class Script extends StaticView {
2020-02-09 23:02:19 +01:00
const MIME_TEXT_JAVASCRIPT = "text/javascript";
2020-04-04 01:15:59 +02:00
const CORE = "/js/script.js";
const JQUERY = "/js/jquery.min.js";
const INSTALL = "/js/install.js";
2020-04-03 22:10:21 +02:00
const BOOTSTRAP = "/js/bootstrap.bundle.min.js";
2020-07-01 22:13:50 +02:00
const ACCOUNT = "/js/account.js";
2020-02-09 23:02:19 +01:00
2020-04-03 15:56:04 +02:00
private string $type;
private string $content;
2020-04-03 17:39:58 +02:00
private string $src;
2020-02-09 23:02:19 +01:00
function __construct($type, $src, $content = "") {
2020-04-03 17:39:58 +02:00
$this->src = $src;
2020-02-09 23:02:19 +01:00
$this->type = $type;
$this->content = $content;
}
function getCode() {
2020-04-03 17:39:58 +02:00
$src = (empty($this->src) ? "" : " src=\"$this->src\"");
return "<script type=\"$this->type\"$src>$this->content</script>";
2020-02-09 23:02:19 +01:00
}
2020-04-03 15:56:04 +02:00
}