summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-06-14 11:29:25 -0500
committerGitHub <noreply@github.com>2017-06-14 11:29:25 -0500
commit8eb955d5c6f77d93f2e0cb38e1795d79e4ec2782 (patch)
tree4219fefb3356238f438956cd326891cfe9b4634e /lib/private/legacy
parent07bfedb062f651ff061a9e7d39dba2c382fff6de (diff)
parent0d320fba4b2ff940975fc9fa415e2d20c6da961f (diff)
downloadnextcloud-server-8eb955d5c6f77d93f2e0cb38e1795d79e4ec2782.tar.gz
nextcloud-server-8eb955d5c6f77d93f2e0cb38e1795d79e4ec2782.zip
Merge pull request #4993 from michaelletzgus/emit_css-tags
Emit css tags
Diffstat (limited to 'lib/private/legacy')
-rw-r--r--lib/private/legacy/template/functions.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php
index 06eb512b54f..208d9fb3f9f 100644
--- a/lib/private/legacy/template/functions.php
+++ b/lib/private/legacy/template/functions.php
@@ -38,13 +38,43 @@ function p($string) {
print(\OCP\Util::sanitizeHTML($string));
}
+
+/**
+ * Prints a <link> tag for loading css
+ * @param string $href the source URL, ignored when empty
+ * @param string $opts, additional optional options
+*/
+function emit_css_tag($href, $opts = '') {
+ $s='<link rel="stylesheet"';
+ if (!empty($href)) {
+ $s.=' href="' . $href .'"';
+ }
+ if (!empty($opts)) {
+ $s.=' '.$opts;
+ }
+ print_unescaped($s.">\n");
+}
+
+/**
+ * Prints all tags for CSS loading
+ * @param hash $obj all the script information from template
+*/
+function emit_css_loading_tags($obj) {
+ foreach($obj['cssfiles'] as $css) {
+ emit_css_tag($css);
+ }
+ foreach($obj['printcssfiles'] as $css) {
+ emit_css_tag($css, 'media="print"');
+ }
+}
+
/**
* Prints a <script> tag with nonce and defer depending on config
* @param string $src the source URL, ignored when empty
* @param string $script_content the inline script content, ignored when empty
* @param bool $defer_flag deferred loading or not
*/
-function emit_script_tag($src, $script_content) {
+function emit_script_tag($src, $script_content='') {
$defer_str=' defer';
$s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"';
if (!empty($src)) {