diff options
Diffstat (limited to 'lib/Minz/View.php')
| -rw-r--r-- | lib/Minz/View.php | 60 |
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, |
