From: Michael M Slusarz Date: Fri, 3 Sep 2010 23:18:36 +0000 (-0600) Subject: Add Horde::addInlineJsVars(). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=07676cd28faa94d69fea043163bbbeb4082a4142;p=horde.git Add Horde::addInlineJsVars(). --- diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 9763fd10c..17c7cc39a 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -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); + } } /** diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 6ba9af0f7..ed7a0d49d 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -34,7 +34,8 @@ Application Framework. beta LGPL - * Remove Horde::nocacheUrl() and Horde::url() (Ticket #9160). + * 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.