Add Horde::addInlineJsVars().
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 3 Sep 2010 23:18:36 +0000 (17:18 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 6 Sep 2010 20:31:14 +0000 (14:31 -0600)
framework/Core/lib/Horde.php
framework/Core/package.xml

index 9763fd1..17c7cc3 100644 (file)
@@ -1768,11 +1768,13 @@ HTML;
     /**
      * Add inline javascript variable definitions to the output buffer.
      *
-     * @param array $data  Keys are the variable names, values are the data to
-     *                     JSON encode.  If the key begins with a '-', the
-     *                     data will be added to the output as-is.
+     * @param array $data   Keys are the variable names, values are the data
+     *                      to JSON encode.  If the key begins with a '-', the
+     *                      data will be added to the output as-is.
+     * @param boolean $ret  If true, will return the list of variable
+     *                      definitions instead of outputting to page.
      */
-    static public function addInlineJsVars($data)
+    static public function addInlineJsVars($data, $ret = false)
     {
         $charset = $GLOBALS['registry']->getCharset();
         $out = array();
@@ -1787,7 +1789,11 @@ HTML;
             $out[] = $key . '=' . $val;
         }
 
-        self::addInlineScript($out);
+        if ($ret) {
+            return $out;
+        } else {
+            self::addInlineScript($out);
+        }
     }
 
     /**
index 6ba9af0..ed7a0d4 100644 (file)
@@ -34,7 +34,8 @@ Application Framework.</description>
   <api>beta</api>
  </stability>
  <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Remove Horde::nocacheUrl() and Horde::url() (Ticket #9160).
+ <notes>* Add Horde::addInlineJsVars().
+ * Remove Horde::nocacheUrl() and Horde::url() (Ticket #9160).
  * Absorb horde/Ui package.
  * Absorb horde/Ajax package.
  * Import application auth driver from horde/Auth.