[Pkg-owncloud-commits] [owncloud] 52/258: more sugar for including lists of templates

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 8e89c51e8744ecbfc5e2afe59f030c5b5dce62a6
Author: Bernhard Posselt <dev at bernhard-posselt.com>
Date:   Tue Sep 9 15:47:42 2014 +0200

    more sugar for including lists of templates
---
 lib/private/template/functions.php | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php
index 8675209..b88ad45 100644
--- a/lib/private/template/functions.php
+++ b/lib/private/template/functions.php
@@ -26,29 +26,51 @@ function print_unescaped($string) {
 /**
  * Shortcut for adding scripts to a page
  * @param string $app the appname
- * @param string $file the filename
+ * @param string|string[] $file the filename,
+ * if an array is given it will add all scripts
  */
 function script($app, $file) {
-	OC_Util::addScript($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 $file the filename
+ * @param string|string[] $file the filename,
+ * if an array is given it will add all styles
  */
 function style($app, $file) {
-	OC_Util::addStyle($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 $file the path relative to the app's component folder
+ * @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) {
-	$url = link_to($app, 'component/' . $file . '.html');
-	OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
+	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));
+	}
 }
 
 /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list