From 07676cd28faa94d69fea043163bbbeb4082a4142 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 3 Sep 2010 17:18:36 -0600 Subject: [PATCH] Add Horde::addInlineJsVars(). --- framework/Core/lib/Horde.php | 16 +++++++++++----- framework/Core/package.xml | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) 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. -- 2.11.0