diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-22 15:54:21 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-22 15:54:21 +0200 |
commit | 2a903582505fbd54a9a2138bcddc116c5e35bfbe (patch) | |
tree | 74d8fba63939d14b44121cc33769f46be6c4b647 /templates/7.php | |
parent | ff4abd968f1baddd1255b9aa4d4945a003d276cc (diff) |
version bump
Diffstat (limited to 'templates/7.php')
-rw-r--r-- | templates/7.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/templates/7.php b/templates/7.php new file mode 100644 index 000000000..06c73b277 --- /dev/null +++ b/templates/7.php @@ -0,0 +1,54 @@ +<?php +/** + * Backports for <7.0.3 + */ + +/** + * Shortcut for adding scripts to a page + * @param string $app the appname + * @param string|string[] $file the filename, + * if an array is given it will add all scripts + */ +function script($app, $file) { + if(is_array($file)) { + foreach($file as $f) { + OC_Util::addScript($app, $f); + } + } else { + OC_Util::addScript($app, $file); + } +} + +/** + * Shortcut for adding styles to a page + * @param string $app the appname + * @param string|string[] $file the filename, + * if an array is given it will add all styles + */ +function style($app, $file) { + if(is_array($file)) { + foreach($file as $f) { + OC_Util::addStyle($app, $f); + } + } else { + OC_Util::addStyle($app, $file); + } +} + +/** + * Shortcut for HTML imports + * @param string $app the appname + * @param string|string[] $file the path relative to the app's component folder, + * if an array is given it will add all components + */ +function component($app, $file) { + if(is_array($file)) { + foreach($file as $f) { + $url = link_to($app, 'component/' . $f . '.html'); + OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); + } + } else { + $url = link_to($app, 'component/' . $file . '.html'); + OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); + } +}
\ No newline at end of file |