aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/View.php
diff options
context:
space:
mode:
authorGravatar maTh <math-home@web.de> 2022-11-22 08:18:52 +0100
committerGravatar GitHub <noreply@github.com> 2022-11-22 08:18:52 +0100
commit18a4ade32f01fe615674efc864eb01ca826ce65e (patch)
tree9d83a9a92ac81d15b6f32288a2265946bb381858 /lib/Minz/View.php
parent88ef6174c0e60121128afc99c49e501f8a0a4451 (diff)
Improved: Minz Framework. Byebye Internet Explorer and its Conditional comments (#4651)
* Update View.php * Update lib/Minz/View.php * Update lib/Minz/View.php * Update lib/Minz/View.php Co-authored-by: Frans de Jonge <fransdejonge@gmail.com> * Update lib/Minz/View.php * Update lib/Minz/View.php * Update lib/Minz/View.php * Update lib/Minz/View.php * Update lib/Minz/View.php * Update lib/Minz/View.php * Update lib/Minz/View.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Diffstat (limited to 'lib/Minz/View.php')
-rw-r--r--lib/Minz/View.php60
1 files changed, 33 insertions, 27 deletions
diff --git a/lib/Minz/View.php b/lib/Minz/View.php
index 8faeb9078..459ef1e23 100644
--- a/lib/Minz/View.php
+++ b/lib/Minz/View.php
@@ -202,36 +202,38 @@ class Minz_View {
$styles = '';
foreach(self::$styles as $style) {
- $cond = $style['cond'];
- if ($cond) {
- $styles .= '<!--[if ' . $cond . ']>';
- }
-
$styles .= '<link rel="stylesheet" ' .
($style['media'] === 'all' ? '' : 'media="' . $style['media'] . '" ') .
'href="' . $style['url'] . '" />';
- if ($cond) {
- $styles .= '<![endif]-->';
- }
-
$styles .= "\n";
}
return $styles;
}
- public static function prependStyle ($url, $media = 'all', $cond = false) {
+ /**
+ * Prepends a <link> element referencing stylesheet.
+ *
+ * @param string $url
+ * @param string $media
+ * @param bool $cond Conditional comment for IE, now deprecated and ignored
+ */
+ public static function prependStyle($url, $media = 'all', $cond = false) {
array_unshift (self::$styles, array (
'url' => $url,
'media' => $media,
- 'cond' => $cond
));
}
- public static function appendStyle ($url, $media = 'all', $cond = false) {
+ /**
+ * Append a `<link>` element referencing stylesheet.
+ * @param string $url
+ * @param string $media
+ * @param bool $cond Conditional comment for IE, now deprecated and ignored
+ */
+ public static function appendStyle($url, $media = 'all', $cond = false) {
self::$styles[] = array (
'url' => $url,
'media' => $media,
- 'cond' => $cond
);
}
@@ -242,11 +244,6 @@ class Minz_View {
$scripts = '';
foreach (self::$scripts as $script) {
- $cond = $script['cond'];
- if ($cond) {
- $scripts .= '<!--[if ' . $cond . ']>';
- }
-
$scripts .= '<script src="' . $script['url'] . '"';
if (!empty($script['id'])) {
$scripts .= ' id="' . $script['id'] . '"';
@@ -258,29 +255,38 @@ class Minz_View {
$scripts .= ' async="async"';
}
$scripts .= '></script>';
-
- if ($cond) {
- $scripts .= '<![endif]-->';
- }
-
$scripts .= "\n";
}
return $scripts;
}
- public static function prependScript ($url, $cond = false, $defer = true, $async = true, $id = '') {
+ /**
+ * Prepend a `<script>` element.
+ * @param string $url
+ * @param bool $cond Conditional comment for IE, now deprecated and ignored
+ * @param bool $defer Use `defer` flag
+ * @param bool $async Use `async` flag
+ * @param string $id Add a script `id` attribute
+ */
+ public static function prependScript($url, $cond = false, $defer = true, $async = true, $id = '') {
array_unshift(self::$scripts, array (
'url' => $url,
- 'cond' => $cond,
'defer' => $defer,
'async' => $async,
'id' => $id,
));
}
- public static function appendScript ($url, $cond = false, $defer = true, $async = true, $id = '') {
+/**
+ * Append a `<script>` element.
+ * @param string $url
+ * @param bool $cond Conditional comment for IE, now deprecated and ignored
+ * @param bool $defer Use `defer` flag
+ * @param bool $async Use `async` flag
+ * @param string $id Add a script `id` attribute
+ */
+ public static function appendScript($url, $cond = false, $defer = true, $async = true, $id = '') {
self::$scripts[] = array (
'url' => $url,
- 'cond' => $cond,
'defer' => $defer,
'async' => $async,
'id' => $id,