]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add args parameter to linkTo(Absolute) function, to append the args automaticly
authorBart Visscher <bartv@thisnet.nl>
Mon, 3 Sep 2012 16:13:45 +0000 (18:13 +0200)
committerBart Visscher <bartv@thisnet.nl>
Mon, 3 Sep 2012 19:51:32 +0000 (21:51 +0200)
lib/helper.php
lib/public/util.php
lib/template.php

index 3cf464dfa7bf617f97a5f4fdb6bea888b5f51863..ea43304da5fbe91c26e1444f96d8eeca7181ba4b 100644 (file)
@@ -32,11 +32,12 @@ class OC_Helper {
         * @brief Creates an url
         * @param $app app
         * @param $file file
+        * @param $args array with param=>value, will be appended to the returned url
         * @returns the url
         *
         * Returns a url to the given app and file.
         */
-       public static function linkTo( $app, $file ){
+       public static function linkTo( $app, $file, $args = array() ){
                if( $app != '' ){
                        $app_path = OC_App::getAppPath($app);
                        // Check if the app is in the app folder
@@ -61,6 +62,10 @@ class OC_Helper {
                        }
                }
 
+               foreach($args as $k => $v) {
+                       $urlLinkTo .= '&'.$k.'='.$v;
+               }
+
                return $urlLinkTo;
        }
 
@@ -68,12 +73,13 @@ class OC_Helper {
         * @brief Creates an absolute url
         * @param $app app
         * @param $file file
+        * @param $args array with param=>value, will be appended to the returned url
         * @returns the url
         *
         * Returns a absolute url to the given app and file.
         */
-       public static function linkToAbsolute( $app, $file ) {
-               $urlLinkTo = self::linkTo( $app, $file );
+       public static function linkToAbsolute( $app, $file, $args = array() ) {
+               $urlLinkTo = self::linkTo( $app, $file, $args );
                return self::makeURLAbsolute($urlLinkTo);
        }
 
index 6ad578441e2a163ee2a59c874afa6793cb09c1c7..cc05e6d535f6b768653a0cf92c0691d4ffb56a3b 100644 (file)
@@ -124,12 +124,13 @@ class Util {
         * @brief Creates an absolute url
         * @param $app app
         * @param $file file
+        * @param $args array with param=>value, will be appended to the returned url
         * @returns the url
         *
         * Returns a absolute url to the given app and file.
         */
-       public static function linkToAbsolute( $app, $file ) {
-               return(\OC_Helper::linkToAbsolute( $app, $file ));
+       public static function linkToAbsolute( $app, $file, $args = array() ) {
+               return(\OC_Helper::linkToAbsolute( $app, $file, $args ));
        }
 
 
@@ -160,12 +161,13 @@ class Util {
        * @brief Creates an url
        * @param $app app
        * @param $file file
+       * @param $args array with param=>value, will be appended to the returned url
        * @returns the url
        *
        * Returns a url to the given app and file.
        */
-       public static function linkTo( $app, $file ){
-               return(\OC_Helper::linkTo( $app, $file ));
+       public static function linkTo( $app, $file, $args = array() ){
+               return(\OC_Helper::linkTo( $app, $file, $args ));
        }
 
        /**
index fa8d4192615e72d76318aae53c00d4f4187600af..2359bd50c469f5e254726def6ddd1396064a1033 100644 (file)
  * @brief make OC_Helper::linkTo available as a simple function
  * @param $app app
  * @param $file file
+ * @param $args array with param=>value, will be appended to the returned url
  * @returns link to the file
  *
  * For further information have a look at OC_Helper::linkTo
  */
-function link_to( $app, $file ){
-       return OC_Helper::linkTo( $app, $file );
+function link_to( $app, $file, $args = array() ){
+       return OC_Helper::linkTo( $app, $file, $args );
 }
 
 /**