summaryrefslogtreecommitdiff
path: root/include/controls_compat.php
blob: d1c2c12b523459c728ead614e7fd41b74feab32f (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php


function stylesheet_tag($filename, $attributes = []) {

	$attributes_str = \Controls\attributes_to_string(
		array_merge(
			[
				"href" => "$filename?" . filemtime($filename),
				"rel" => "stylesheet",
				"type" => "text/css",
				"data-orig-href" => $filename
			],
			$attributes));

	return "<link $attributes_str/>\n";
}

function javascript_tag($filename, $attributes = []) {
	$attributes_str = \Controls\attributes_to_string(
		array_merge(
			[
				"src" => "$filename?" . filemtime($filename),
				"type" => "text/javascript",
				"charset" => "utf-8"
			],
			$attributes));

	return "<script $attributes_str></script>\n";
}

function format_warning($msg, $id = "") {
	return "<div class=\"alert\" id=\"$id\">$msg</div>";
}

function format_notice($msg, $id = "") {
	return "<div class=\"alert alert-info\" id=\"$id\">$msg</div>";
}

function format_error($msg, $id = "") {
	return "<div class=\"alert alert-danger\" id=\"$id\">$msg</div>";
}

function print_notice($msg) {
	return print format_notice($msg);
}

function print_warning($msg) {
	return print format_warning($msg);
}

function print_error($msg) {
	return print format_error($msg);
}