From: Michael M Slusarz Date: Tue, 13 Apr 2010 18:47:40 +0000 (-0600) Subject: Add Horde::startBuffer(), Horde::endBuffer(), and Horde::contentSent() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3559335be56b6872fa873b5faacb2ecf1c135d20;p=horde.git Add Horde::startBuffer(), Horde::endBuffer(), and Horde::contentSent() Remove Horde_Util::bufferOutput(). Its usefulness has always been debatable since it ran in a different scope from the location that called it (so including/requiring files would not pick up any local variables from the calling location). --- diff --git a/agora/ban.php b/agora/ban.php index ecb9e2b84..b8336bf29 100644 --- a/agora/ban.php +++ b/agora/ban.php @@ -61,8 +61,15 @@ $form->addVariable(_("User"), 'user', 'text', true); $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, null, 'ban.php', 'post'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$form->renderActive(null, null, 'ban.php', 'post'); +$view->formbox = Horde::endBuffer(); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->banned = $banned; $view->forum = $forums->getForum(); diff --git a/agora/deleteforum.php b/agora/deleteforum.php index e796b116b..60da3d8b0 100644 --- a/agora/deleteforum.php +++ b/agora/deleteforum.php @@ -74,8 +74,14 @@ if ($form->validate()) { /* Set up template variables. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->main = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'deleteforum.php', 'post'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer() +$form->renderActive(null, $vars, 'deleteforum.php', 'post'); +$view->main = Horde::endBuffer(); + +Horde::startBuffer() +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); require AGORA_TEMPLATES . '/common-header.inc'; echo $view->render('main.html.php'); diff --git a/agora/editforum.php b/agora/editforum.php index 7ee0e2081..877a5161a 100644 --- a/agora/editforum.php +++ b/agora/editforum.php @@ -60,8 +60,14 @@ if ($forum_id) { /* Set up template variables. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->main = Horde_Util::bufferOutput(array($form, 'renderActive'), null, null, 'editforum.php', 'post'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$form->renderActive(null, null, 'editforum.php', 'post'); +$view->main = Horde::endBuffer(); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); require AGORA_TEMPLATES . '/common-header.inc'; echo $view->render('main.html.php'); diff --git a/agora/forums.php b/agora/forums.php index f9113fa90..934aaf7a4 100644 --- a/agora/forums.php +++ b/agora/forums.php @@ -58,7 +58,11 @@ $view = new Agora_View(); $view->col_headers = $col_headers; $view->forums_list = $forums_list; $view->menu = Agora::getMenu('string'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->actions = empty($actions) ? null : $actions; /* Set up pager. */ diff --git a/agora/lib/Api.php b/agora/lib/Api.php index efafe4e8e..a5406c373 100644 --- a/agora/lib/Api.php +++ b/agora/lib/Api.php @@ -443,7 +443,10 @@ class Agora_Api extends Horde_Registry_Api $messages = &Agora_Messages::singleton($scope, $params['forum_id']); if ($messages instanceof PEAR_Error) { $queue->push(_("Could not post the message: ") . $messages->getMessage(), 'horde.error'); - return Horde_Util::bufferOutput(array($queue, 'notify'), array('listeners' => 'status')); + + Horde::startBuffer(); + $queue->notify(array('listeners' => 'status')); + return Horde::endBuffer(); } /* Check post permissions. */ @@ -500,7 +503,10 @@ class Agora_Api extends Horde_Registry_Api $queue->push(_("Message posted."), 'horde.success'); $count = $messages->countMessages(); $registry->callByPackage($scope, $callback, array($forum_name, 'messages', $count)); - return Horde_Util::bufferOutput(array($queue, 'notify'), array('listeners' => 'status')); + + Horde::startBuffer(); + $queue->notify(array('listeners' => 'status')); + return Horde::endBuffer(); } } @@ -521,7 +527,9 @@ class Agora_Api extends Horde_Registry_Api $url = Horde::selfUrl(true, false, true); } - return Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, $url, 'post', null, false); + Horde::startBuffer(); + $form->renderActive(null, $vars, $url, 'post', null, false); + return Horde::endBuffer(); } /** @@ -608,10 +616,15 @@ class Agora_Api extends Horde_Registry_Api } else { $queue->push(_("Message not deleted."), 'horde.message'); } - return Horde_Util::bufferOutput(array($queue, 'notify'), array('listeners' => 'status')); + + Horde::startBuffer(); + $queue->notify(array('listeners' => 'status')); + return Horde::endBuffer(); } - return Horde_Util::bufferOutput(array($form, 'renderActive'), null, null, null, 'post', null, false); + Horde::startBuffer(); + $form->renderActive(null, null, null, 'post', null, false); + return Horde::endBuffer(); } /** diff --git a/agora/messages/abuse.php b/agora/messages/abuse.php index 5c4bb7691..c989a6982 100644 --- a/agora/messages/abuse.php +++ b/agora/messages/abuse.php @@ -87,8 +87,15 @@ if ($form->validate()) { /* Set up template data. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'abuse.php', 'post'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'abuse.php', 'post'); +$view->formbox = Horde::endBuffer(); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->message_subject = $message['message_subject']; $view->message_author = $message['message_author']; $view->message_date = strftime($prefs->getValue('date_format'), $message['message_timestamp']); diff --git a/agora/messages/delete.php b/agora/messages/delete.php index 9985b5900..014cdd067 100644 --- a/agora/messages/delete.php +++ b/agora/messages/delete.php @@ -77,8 +77,14 @@ $view->message_author = $message['message_author']; $view->message_date = $messages->dateFormat($message['message_timestamp']); $view->message_body = Agora_Messages::formatBody($message['body']); $view->menu = Agora::getMenu('string'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'delete.php', 'post'); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'delete.php', 'post'); +$view->formbox = Horde::endBuffer(); require AGORA_TEMPLATES . '/common-header.inc'; echo $view->render('messages/form.html.php'); diff --git a/agora/messages/edit.php b/agora/messages/edit.php index 39bc68099..464781158 100644 --- a/agora/messages/edit.php +++ b/agora/messages/edit.php @@ -115,8 +115,14 @@ if ($message_parent_id) { $view->replying = $message_parent_id; $view->menu = Agora::getMenu('string'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'edit.php', 'post'); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'edit.php', 'post'); +$view->formbox = Horde::endBuffer(); require AGORA_TEMPLATES . '/common-header.inc'; echo $view->render('messages/edit.html.php'); diff --git a/agora/messages/index.php b/agora/messages/index.php index 16d63bba6..3f042a45c 100644 --- a/agora/messages/index.php +++ b/agora/messages/index.php @@ -185,7 +185,11 @@ default: /* Set up the main template tags. */ $view->menu = Agora::getMenu('string'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->actions = $actions; $view->threads = $threads; $view->rss = Horde_Util::addParameter(Horde::applicationUrl('rss/messages.php', true, -1), array('scope' => $scope, 'message_id' => $message_id, 'forum_id' => $forum_id)); @@ -207,7 +211,9 @@ if (!$messages->hasPermission(Horde_Perms::EDIT)) { $vars->set('message_subject', $reply['message_subject']); $vars->set('message_body_old', $reply['body']); $form = $messages->getForm($vars, sprintf(_("Post a Reply to \"%s\""), $reply['message_subject'])); - $view->form = Horde_Util::bufferOutput(array($form, 'renderActive'), null, null, 'edit.php', 'post', null, false); + Horde::startBuffer(); + $form->renderActive(null, null, 'edit.php', 'post', null, false); + $view->form = Horde::endBuffer(); } Horde::addScriptFile('hideable.js', 'horde', true); diff --git a/agora/messages/lock.php b/agora/messages/lock.php index 9cc818d5a..ab8322743 100644 --- a/agora/messages/lock.php +++ b/agora/messages/lock.php @@ -69,8 +69,15 @@ if ($form->validate()) { /* Set up template data. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'lock.php', 'post'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'lock.php', 'post'); +$view->formbox = Horde::endBuffer(); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->message_subject = $message['message_subject']; $view->message_author = $message['message_author']; $view->message_date = strftime($prefs->getValue('date_format'), $message['message_timestamp']); diff --git a/agora/messages/merge.php b/agora/messages/merge.php index 4cf98d3f1..bbe125d8d 100644 --- a/agora/messages/merge.php +++ b/agora/messages/merge.php @@ -81,7 +81,11 @@ if ($form->validate()) { /* Template object. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->main = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'merge.php', 'post'); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'merge.php', 'post'); +$view->main = Horde::endBuffer(); + $view->message_subject = $message['message_subject']; $view->message_author = $message['message_author']; $view->message_body = Agora_Messages::formatBody($message['body']); diff --git a/agora/messages/move.php b/agora/messages/move.php index 12427c8f9..4daf3f5d0 100644 --- a/agora/messages/move.php +++ b/agora/messages/move.php @@ -67,7 +67,11 @@ if ($form->validate()) { /* Template object. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'move.php', 'post'); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'move.php', 'post'); +$view->formbox = Horde::endBuffer(); + $view->message_subject = $message['message_subject']; $view->message_author = $message['message_author']; $view->message_body = Agora_Messages::formatBody($message['body']); diff --git a/agora/messages/split.php b/agora/messages/split.php index 9fc0457df..a0d7752b3 100644 --- a/agora/messages/split.php +++ b/agora/messages/split.php @@ -63,7 +63,11 @@ if ($form->validate()) { /* Template object. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'split.php', 'post'); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'split.php', 'post'); +$view->formbox = Horde::endBuffer(); + $view->message_subject = $message['message_subject']; $view->message_author = $message['message_author']; $view->message_body = Agora_Messages::formatBody($message['body']); diff --git a/agora/moderate.php b/agora/moderate.php index 8344c1f0e..4d2f27589 100644 --- a/agora/moderate.php +++ b/agora/moderate.php @@ -64,7 +64,10 @@ $view->col_headers = $col_headers; $view->messages = $messages_list; $view->buttons = array(_("Approve"), _("Delete")); $view->session_tag = Horde_Util::formInput(); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); /* Set up pager. */ $vars = Horde_Variables::getDefaultVariables(); diff --git a/agora/moderators.php b/agora/moderators.php index ef753eeee..f56d9f215 100644 --- a/agora/moderators.php +++ b/agora/moderators.php @@ -81,8 +81,15 @@ if ($messages->countForums() > 50) { /* Set up template data. */ $view = new Agora_View(); $view->menu = Agora::getMenu('string'); -$view->formbox = Horde_Util::bufferOutput(array($form, 'renderActive'), null, null, 'moderators.php', 'post'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$form->renderActive(null, null, 'moderators.php', 'post'); +$view->formbox = Horde::endBuffer(); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->forums = $forums_list; Horde::addScriptFile('stripe.js', 'horde', true); diff --git a/agora/search.php b/agora/search.php index 18f84397b..9cce5d7d1 100644 --- a/agora/search.php +++ b/agora/search.php @@ -62,8 +62,14 @@ if ($form->isSubmitted() || $thread_page != null) { } $view->menu = Agora::getMenu('string'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); -$view->searchForm = Horde_Util::bufferOutput(array($form, 'renderActive'), null, $vars, 'search.php', 'get'); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + +Horde::startBuffer(); +$form->renderActive(null, $vars, 'search.php', 'get'); +$view->searchForm = Horde::endBuffer(); $title = _("Search Forums"); require AGORA_TEMPLATES . '/common-header.inc'; diff --git a/agora/threads.php b/agora/threads.php index d760dea47..acdbe2880 100644 --- a/agora/threads.php +++ b/agora/threads.php @@ -64,7 +64,11 @@ $view->forum_name = sprintf(_("Threads in %s"), $forum_array['forum_name']); $view->forum_description = Agora_Messages::formatBody($forum_array['forum_description']); $view->actions = $threads->getThreadActions(); $view->menu = Agora::getMenu('string'); -$view->notify = Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$view->notify = Horde::endBuffer(); + $view->rss = Horde_Util::addParameter(Horde::applicationUrl('rss/threads.php', true, -1), array('scope' => $scope, 'forum_id' => $forum_id)); /* Set up pager. */ diff --git a/babel/edit.php b/babel/edit.php index 73c534ba3..fa824fb4c 100644 --- a/babel/edit.php +++ b/babel/edit.php @@ -43,7 +43,10 @@ if ($app) { /* Set up the template fields. */ $template->set('menu', Babel::getMenu()->render()); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status'))); +$template->set('notify', Horde::endBuffer()); /* Create upload form */ $form = new Horde_Form($vars, _("Edit Translation"), $show); @@ -53,15 +56,15 @@ if ($app && Horde_Util::getFormData('submitbutton') == _("Save")) { if ($form->validate($vars, false)) { $form->getInfo($vars, $form_values); - + foreach($meta_params as $k => $v) { if ($val = Horde_Util::getFormData($k)) { $po->meta[$k] = $val; } } - + $po->save($pofile); - + if (Horde_Util::getFormData('url') == 'view') { $url = Horde::applicationUrl('view.php'); $url = Horde_Util::addParameter($url, array('module' => $app)); @@ -80,10 +83,10 @@ if (!$app) { $form->setButtons(_("Save")); $form->addHidden('', 'module', 'text', false); $vars->set('module', $app); - + $form->addHidden('', 'url', 'text', false); $vars->set('url', Horde_Util::getFormData('url')); - + foreach($meta_params as $k => $v) { $form->addVariable($k, $k, 'text', false, false); if (isset($po->meta[$k]) && !empty($po->meta[$k])) { diff --git a/babel/lib/base.php b/babel/lib/base.php index ccb657f5f..bd0623151 100644 --- a/babel/lib/base.php +++ b/babel/lib/base.php @@ -79,7 +79,11 @@ if (($lang = Horde_Util::getFormData('display_language')) !== null) { /* Set up the template fields. */ $template->set('menu', Babel::getMenu()->render()); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); + $template->set('lang', Babel::displayLanguage()); $fmenu = Babel::LanguageSelection(); diff --git a/babel/view.php b/babel/view.php index 3aad9edff..f73231694 100644 --- a/babel/view.php +++ b/babel/view.php @@ -143,7 +143,10 @@ if ($f_save && $cstring) { /* Set up the template fields. */ $template->set('menu', Babel::getMenu()->render()); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); /* Create upload form */ $form = new Horde_Form($vars, _("View Translation"), $show); diff --git a/framework/Ajax/lib/Horde/Ajax/Application/Base.php b/framework/Ajax/lib/Horde/Ajax/Application/Base.php index 342111665..89988ad25 100644 --- a/framework/Ajax/lib/Horde/Ajax/Application/Base.php +++ b/framework/Ajax/lib/Horde/Ajax/Application/Base.php @@ -153,7 +153,9 @@ abstract class Horde_Ajax_Application_Base $chunk = basename(Horde_Util::getPost('chunk')); $result = new stdClass; if (!empty($chunk)) { - $result->chunk = Horde_Util::bufferOutput('include', $GLOBALS['registry']->get('templates', $this->_app) . '/chunks/' . $chunk . '.php'); + Horde::startBuffer(); + include $GLOBALS['registry']->get('templates', $this->_app) . '/chunks/' . $chunk . '.php'; + $result->chunk = Horde::endBuffer(); } return $result; diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index f1f505edf..cda3dd4bf 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -57,6 +57,20 @@ class Horde static protected $_inlineScript = array(); /** + * The current buffer level. + * + * @var integer + */ + static protected $_bufferLevel = 0; + + /** + * Has content been sent at the base buffer level? + * + * @var boolean + */ + static protected $_contentSent = false; + + /** * Shortcut to logging method. * * @see Horde_Core_Log_Logger @@ -1956,4 +1970,43 @@ HTML; return 'Horde.popup(' . self::escapeJson($params, array('urlencode' => !empty($options['urlencode']))) . ');'; } + /** + * Start buffering output. + */ + static public function startBuffer() + { + if (!self::$_bufferLevel) { + self::$_contentSent = self::contentSent(); + } + + ++self::$_bufferLevel; + ob_start(); + } + + /** + * End buffering output. + * + * @return string The buffered output. + */ + static public function endBuffer() + { + if (self::$_bufferLevel) { + --self::$_bufferLevel; + return ob_get_clean(); + } + + return ''; + } + + /** + * Has any content been sent to the browser? + * + * @return boolean True if content has been sent. + */ + static public function contentSent() + { + return ((self::$_bufferLevel && self::$_contentSent) || + (!self::$_bufferLevel && (ob_get_length() || headers_sent()))); + } + } diff --git a/framework/Core/lib/Horde/Core/Prefs/Ui.php b/framework/Core/lib/Horde/Core/Prefs/Ui.php index f9d8cad3e..57861c546 100644 --- a/framework/Core/lib/Horde/Core/Prefs/Ui.php +++ b/framework/Core/lib/Horde/Core/Prefs/Ui.php @@ -375,7 +375,7 @@ class Horde_Core_Prefs_Ui /* Need to buffer output - it is possible that 'special' types can * do things like add javascript to the page output. This should all * be combined and served in the page HEAD. */ - ob_start(); + Horde::startBuffer(); if ($this->group) { if ($identities) { @@ -512,7 +512,7 @@ class Horde_Core_Prefs_Ui echo $t->fetch($h_templates . '/prefs/overview.html'); } - $content = ob_get_clean(); + $content = Horde::endBuffer(); $title = _("User Options"); diff --git a/framework/Core/lib/Horde/Script/Files.php b/framework/Core/lib/Horde/Script/Files.php index ef7110c35..dc629803b 100644 --- a/framework/Core/lib/Horde/Script/Files.php +++ b/framework/Core/lib/Horde/Script/Files.php @@ -42,7 +42,7 @@ class Horde_Script_Files public function add($file, $app = null, $direct = false, $full = false) { if (($this->_add($file, $app, $direct, $full) === false) || - (!ob_get_length() && !headers_sent())) { + !Horde::contentSent()) { return; } diff --git a/framework/Image/lib/Horde/Image/Gd.php b/framework/Image/lib/Horde/Image/Gd.php index a5cee5bfc..bcc5f8a9d 100644 --- a/framework/Image/lib/Horde/Image/Gd.php +++ b/framework/Image/lib/Horde/Image/Gd.php @@ -86,7 +86,9 @@ class Horde_Image_Gd extends Horde_Image_Base return ''; } - return Horde_Util::bufferOutput('image' . $this->_type, $this->_im); + ob_start(); + call_user_func('image' . $this->_type, $this->_im); + return ob_get_clean(); } /** diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Css.php b/framework/Mime/lib/Horde/Mime/Viewer/Css.php index e7f6a14c9..859ced961 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Css.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Css.php @@ -72,9 +72,11 @@ class Horde_Mime_Viewer_Css extends Horde_Mime_Viewer_Source // Need Horde headers for CSS tags. reset($ret); - $ret[key($ret)]['data'] = Horde_Util::bufferOutput('require', $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc') . - $ret[key($ret)]['data'] . - Horde_Util::bufferOutput('require', $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'); + Horde::startBuffer(); + require $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc'; + echo $ret[key($ret)]['data']; + require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'; + $ret[key($ret)]['data'] = Horde::endBuffer(); return $ret; } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Php.php b/framework/Mime/lib/Horde/Mime/Viewer/Php.php index 44b52f219..a53825f63 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Php.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Php.php @@ -36,9 +36,11 @@ class Horde_Mime_Viewer_Php extends Horde_Mime_Viewer_Source // Need Horde headers for CSS tags. reset($ret); - $ret[key($ret)]['data'] = Horde_Util::bufferOutput('require', $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc') . - $ret[key($ret)]['data'] . - Horde_Util::bufferOutput('require', $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'); + Horde::startBuffer(); + require $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc'; + echo $ret[key($ret)]['data']; + require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'; + $ret[key($ret)]['data'] = Horde::endBuffer(); return $ret; } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php b/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php index d67b0aa09..c765b44ae 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Srchighlite.php @@ -38,9 +38,11 @@ class Horde_Mime_Viewer_Srchighlite extends Horde_Mime_Viewer_Source // Need Horde headers for CSS tags. reset($ret); - $ret[key($ret)]['data'] = Horde_Util::bufferOutput('require', $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc') . - $ret[key($ret)]['data'] . - Horde_Util::bufferOutput('require', $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'); + Horde::startBuffer(); + require $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc'; + echo $ret[key($ret)]['data']; + require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'; + $ret[key($ret)]['data'] = Horde::endBuffer(); return $ret; } diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php b/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php index 8f636a5c7..ab2caf93b 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Vcard.php @@ -39,12 +39,16 @@ class Horde_Mime_Viewer_Vcard extends Horde_Mime_Viewer_Driver protected function _render() { $ret = $this->_renderInline(); + if (!empty($ret)) { reset($ret); - $ret[key($ret)]['data'] = Horde_Util::bufferOutput('include', $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc') . - $ret[key($ret)]['data'] . - Horde_Util::bufferOutput('include', $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'); + Horde::startBuffer(); + include $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc'; + echo $ret[key($ret)]['data']; + include $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'; + $ret[key($ret)]['data'] = Horde::endBuffer(); } + return $ret; } @@ -390,9 +394,12 @@ class Horde_Mime_Viewer_Vcard extends Horde_Mime_Viewer_Driver $html .= ''; + Horde::startBuffer(); + $notification->notify(array('listeners' => 'status'); + return array( $this->_mimepart->getMimeId() => array( - 'data' => Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status')) . $html, + 'data' => Horde::endBuffer() . $html, 'status' => array(), 'type' => 'text/html; charset=' . Horde_Nls::getCharset() ) diff --git a/framework/Util/lib/Horde/Util.php b/framework/Util/lib/Horde/Util.php index 6ed6848f4..69ad67919 100644 --- a/framework/Util/lib/Horde/Util.php +++ b/framework/Util/lib/Horde/Util.php @@ -101,69 +101,6 @@ class Horde_Util } /** - * Buffers the output from a function call, like readfile() or - * highlight_string(), that prints the output directly, so that instead it - * can be returned as a string and used. - * - * @param string $function The function to run. - * @param mixed $arg1 First argument to $function(). - * @param mixed $arg2 Second argument to $function(). - * @param mixed $arg... ... - * @param mixed $argN Nth argument to $function(). - * - * @return string The output of the function. - */ - static public function bufferOutput() - { - if (func_num_args() == 0) { - return false; - } - - $include = false; - $args = func_get_args(); - $function = array_shift($args); - - if (is_array($function)) { - if (!is_callable($function)) { - return false; - } - } elseif (($function == 'include') || - ($function == 'include_once') || - ($function == 'require') || - ($function == 'require_once')) { - $include = true; - } elseif (!function_exists($function)) { - return false; - } - - ob_start(); - if ($include) { - $file = implode(',', $args); - switch ($function) { - case 'include': - include $file; - break; - - case 'include_once': - include_once $file; - break; - - case 'require': - require $file; - break; - - case 'require_once': - require_once $file; - break; - } - } else { - call_user_func_array($function, $args); - } - - return ob_get_clean(); - } - - /** * Checks to see if a value has been set by the script and not by GET, * POST, or cookie input. The value being checked MUST be in the global * scope. diff --git a/framework/Util/package.xml b/framework/Util/package.xml index b4baf04cb..07c84b1a2 100644 --- a/framework/Util/package.xml +++ b/framework/Util/package.xml @@ -29,7 +29,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> beta LGPL - * Removed Horde_Util::uriB64Encode() and Horde_Util::uriB64Decode(). + * Removed Horde_Util::bufferOutput(). + * Removed Horde_Util::uriB64Encode() and Horde_Util::uriB64Decode(). * Removed Horde_Util::strftime2date() and Horde_Util::date2strftime(). * Removed Horde_Util::closeWindowJs() and Horde_Util::nocacheUrl(). * Added Horde_String::convertToUtf8(). diff --git a/horde/admin/setup/config.php b/horde/admin/setup/config.php index 67043c1fd..a919ec61c 100644 --- a/horde/admin/setup/config.php +++ b/horde/admin/setup/config.php @@ -92,7 +92,10 @@ require HORDE_TEMPLATES . '/admin/menu.inc'; /* Render the configuration form. */ $renderer = $form->getRenderer(); $renderer->setAttrColumnWidth('50%'); -$template->set('form', Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'config.php', 'post')); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'config.php', 'post'); +$template->set('form', Horde::endBuffer()); echo $template->fetch(HORDE_TEMPLATES . '/admin/setup/config.html'); require HORDE_TEMPLATES . '/common-footer.inc'; diff --git a/horde/admin/setup/index.php b/horde/admin/setup/index.php index 0947dc9b2..3cb88da68 100644 --- a/horde/admin/setup/index.php +++ b/horde/admin/setup/index.php @@ -221,7 +221,9 @@ if (!empty($_SESSION['_config'])) { } } /* Render the form. */ - $ftpform = Horde_Util::bufferOutput(array($ftpform, 'renderActive'), new Horde_Form_Renderer(), $vars, 'index.php', 'post'); + Horde::startBuffer(); + $ftpform->renderActive(new Horde_Form_Renderer(), $vars, 'index.php', 'post'); + $ftpform = Horde::endBuffer(); } if (file_exists(Horde::getTempDir() . '/horde_setup_upgrade.php')) { diff --git a/horde/lib/Block/cloud.php b/horde/lib/Block/cloud.php index 67298943f..6f564b3d6 100644 --- a/horde/lib/Block/cloud.php +++ b/horde/lib/Block/cloud.php @@ -44,7 +44,10 @@ class Horde_Block_Horde_cloud extends Horde_Block { 'doSearch(\'' . $tag['tag_name'] . '\');'); } - return Horde_Util::bufferOutput('include', HORDE_TEMPLATES . '/block/cloud.inc') + Horde::startBuffer(); + include HORDE_TEMPLATES . '/block/cloud.inc'; + + return Horde::endBuffer() . '
 ' . Horde::img('loading.gif', '', array('style' => 'display:none;', 'id' => 'cloudloadingimg')) . '
' . $cloud->buildHTML() diff --git a/horde/services/help/index.php b/horde/services/help/index.php index 514745226..b7ee3a62b 100644 --- a/horde/services/help/index.php +++ b/horde/services/help/index.php @@ -140,8 +140,10 @@ case 'sidebar': $renderer = new Horde_Form_Renderer(); $renderer->setAttrColumnWidth('50%'); - $contents = Horde_Util::bufferOutput(array($searchForm, 'renderActive'), $renderer, $vars, $sidebar_url->copy()->setRaw(true), 'post') . - '
'; + + Horde::startBuffer(); + $searchForm->renderActive($renderer, $vars, $sidebar_url->copy()->setRaw(true), 'post'); + $contents = Horde::endBuffer() . '
'; $keywords = $vars->get('keyword'); if (!empty($keywords)) { diff --git a/horde/services/logintasks.php b/horde/services/logintasks.php index ea2d6c995..e0317a558 100644 --- a/horde/services/logintasks.php +++ b/horde/services/logintasks.php @@ -81,7 +81,10 @@ foreach ($tasklist as $key => $ob) { $template->setOption('gettext', true); $template->set('tasks', $display_tasks, true); $template->set('logintasks_url', htmlspecialchars($tasks->getLoginTasksUrl())); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); $bodyId = 'services_logintasks'; require HORDE_TEMPLATES . '/common-header.inc'; diff --git a/hylax/compose.php b/hylax/compose.php index 5d399f861..82218feb7 100644 --- a/hylax/compose.php +++ b/hylax/compose.php @@ -49,7 +49,10 @@ $form->addVariable(_("Comment"), 'comment', 'longtext', false, false, null, arra $template = $injector->createInstance('Horde_Template'); $template->set('form', ''); $template->set('menu', Hylax::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require HYLAX_TEMPLATES . '/common-header.inc'; echo $template->fetch(HYLAX_TEMPLATES . '/compose/compose.html'); diff --git a/hylax/folder.php b/hylax/folder.php index da28c04e6..7d228e61a 100644 --- a/hylax/folder.php +++ b/hylax/folder.php @@ -94,7 +94,10 @@ if ($folder == 'archive') { $template->set('folder', $folder_list, true); $template->set('actions', $actions); $template->set('menu', Hylax::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require HYLAX_TEMPLATES . '/common-header.inc'; echo $template->fetch(HYLAX_TEMPLATES . '/folder/folder.html'); diff --git a/hylax/lib/Image.php b/hylax/lib/Image.php index 049d068bb..b6a5d4a01 100644 --- a/hylax/lib/Image.php +++ b/hylax/lib/Image.php @@ -36,7 +36,9 @@ class Hylax_Image { function getDimensions() { $tmp_file = Horde_Util::getTempFile('fax', true, '/tmp'); - Horde::logMessage('Created temp file:' . Horde_Util::bufferOutput('var_dump', $tmp_file) . ':', 'DEBUG'); + Horde::startBuffer(); + var_dump($tmp_file); + Horde::logMessage('Created temp file:' . Horde::endBuffer() . ':', 'DEBUG'); $fp = fopen($tmp_file, 'w'); fwrite($fp, $this->_data); fclose($fp); diff --git a/hylax/send.php b/hylax/send.php index bb2f5af3b..7ea2b8d10 100644 --- a/hylax/send.php +++ b/hylax/send.php @@ -59,14 +59,20 @@ $pages = Hylax::getPages($fax_id, $fax['fax_pages']); /* Render the form. */ require_once 'Horde/Form/Renderer.php'; $renderer = new Horde_Form_Renderer(); -$send_form = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'send.php', 'post'); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'send.php', 'post'); +$send_form = Horde::endBuffer(); /* Set up template. */ $template = $injector->createInstance('Horde_Template'); $template->set('form', $send_form); $template->set('pages', $pages); $template->set('menu', $menu->getMenu()); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require HYLAX_TEMPLATES . '/common-header.inc'; echo $template->fetch(HYLAX_TEMPLATES . '/fax/fax.html'); diff --git a/hylax/summary.php b/hylax/summary.php index 728053710..ac4678e46 100644 --- a/hylax/summary.php +++ b/hylax/summary.php @@ -30,7 +30,10 @@ $template->set('out_faxes', $hylax->gateway->numFaxesOut()); $template->set('inbox', $fmt_inbox, true); $template->set('outbox', $fmt_outbox, true); $template->set('menu', Hylax::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require HYLAX_TEMPLATES . '/common-header.inc'; echo $template->fetch(HYLAX_TEMPLATES . '/summary/summary.html'); diff --git a/hylax/view.php b/hylax/view.php index eb9ac5857..1619f22d3 100644 --- a/hylax/view.php +++ b/hylax/view.php @@ -42,7 +42,10 @@ $template = $injector->createInstance('Horde_Template'); $template->set('form', ''); $template->set('pages', $pages); $template->set('menu', Hylax::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require HYLAX_TEMPLATES . '/common-header.inc'; echo $template->fetch(HYLAX_TEMPLATES . '/fax/fax.html'); diff --git a/imp/compose.php b/imp/compose.php index 38949612a..5eb816043 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -695,10 +695,13 @@ $t->set('allow_compose', !$compose_disable); if ($redirect) { /* Prepare the redirect template. */ $t->set('cacheid', $composeCacheID); - $t->set('status', Horde_Util::bufferOutput(array('IMP', 'status'))); $t->set('title', htmlspecialchars($title)); $t->set('token', Horde::getRequestToken('imp.compose')); + Horde::startBuffer(); + IMP::status(); + $t->set('status', Horde::endBuffer()); + if ($registry->hasMethod('contacts/search')) { $t->set('has_search', true); $t->set('abook', Horde::link('#', _("Address Book"), 'widget', null, 'window.open(\'' . Horde::applicationUrl('contacts.php')->add(array('formname' => 'redirect', 'to_only' => 1)) . '\', \'contacts\', \'toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=550,height=300,left=100,top=100\'); return false;') . Horde::img('addressbook_browse.png') . '
' . _("Address Book") . ''); @@ -1013,7 +1016,10 @@ if ($redirect) { } } - $t->set('status', Horde_Util::bufferOutput(array('IMP', 'status'))); + Horde::startBuffer(); + IMP::status(); + $t->set('status', Horde::endBuffer()); + $template_output = $t->fetch(IMP_TEMPLATES . '/imp/compose/compose.html'); } diff --git a/imp/lib/Block/summary.php b/imp/lib/Block/summary.php index 8d7ee8131..33c74e1b1 100644 --- a/imp/lib/Block/summary.php +++ b/imp/lib/Block/summary.php @@ -39,7 +39,9 @@ class Horde_Block_imp_summary extends Horde_Block $html = ''; /* Quota info, if available. */ - $quota_msg = Horde_Util::bufferOutput(array('IMP', 'quota')); + Horde::startBuffer(); + IMP::quota(); + $quota_msg = Horde::endBuffer(); if (!empty($quota_msg)) { $html .= ''; } @@ -56,8 +58,10 @@ class Horde_Block_imp_summary extends Horde_Block if (!empty($newmsgs) && ($GLOBALS['prefs']->getValue('nav_audio') || $GLOBALS['prefs']->getValue('nav_popup'))) { - $html .= Horde_Util::bufferOutput(IMP::newmailAlerts($newmsgs)) . - Horde_Util::bufferOutput(array($GLOBALS['notification'], 'notify'), array('listeners' => 'audio')); + Horde::startBuffer(); + IMP::newmailAlerts($newmsgs); + $GLOBALS['notification']->notify(array('listeners' => 'audio')); + $html .= Horde::endBuffer(); } return $html . $html_out . '
' . $quota_msg . '
'; diff --git a/imp/lib/Mime/Viewer/Html.php b/imp/lib/Mime/Viewer/Html.php index 051ec7adc..c2882a67b 100644 --- a/imp/lib/Mime/Viewer/Html.php +++ b/imp/lib/Mime/Viewer/Html.php @@ -119,9 +119,10 @@ class IMP_Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Html if ($_SESSION['imp']['view'] != 'mimp') { $uid = 'htmldata_' . uniqid(mt_rand()); + Horde::addScriptFile('imp.js', 'imp'); + $data['js'] = array('IMP.iframeInject("' . $uid . '", ' . Horde_Serialize::serialize($data['data'], Horde_Serialize::JSON, $this->_mimepart->getCharset()) . ')'); - $data['data'] = '
' . _("Loading...") . '
' . - Horde_Util::bufferOutput(array('Horde', 'addScriptFile'), 'imp.js', 'imp'); + $data['data'] = '
' . _("Loading...") . '
'; $data['type'] = 'text/html; charset=UTF-8'; } diff --git a/imp/lib/Mime/Viewer/Itip.php b/imp/lib/Mime/Viewer/Itip.php index f1fa2668f..29e73bcbc 100644 --- a/imp/lib/Mime/Viewer/Itip.php +++ b/imp/lib/Mime/Viewer/Itip.php @@ -37,9 +37,12 @@ class IMP_Horde_Mime_Viewer_Itip extends Horde_Mime_Viewer_Driver $ret = $this->_renderInline(true); if (!empty($ret)) { reset($ret); - $ret[key($ret)]['data'] = Horde_Util::bufferOutput('include', $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc') . - $ret[key($ret)]['data'] . - Horde_Util::bufferOutput('include', $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'); + Horde::startBuffer(); + include $GLOBALS['registry']->get('templates', 'horde') . '/common-header.inc'; + echo $ret[key($ret)]['data']; + include $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc'; + + $ret[key($ret)]['data'] = Horde::endBuffer(); } return $ret; } diff --git a/imp/lib/Test.php b/imp/lib/Test.php index 28b71151f..98fc48182 100644 --- a/imp/lib/Test.php +++ b/imp/lib/Test.php @@ -93,7 +93,10 @@ class IMP_Test extends Horde_Test $self_url = Horde::selfUrl()->add('app', 'imp'); - return $ret . Horde_Util::bufferOutput('require', IMP_TEMPLATES . '/test/mailserver.inc'); + Horde::startBuffer(); + require IMP_TEMPLATES . '/test/mailserver.inc'; + + return $ret . Horde::endBuffer(); } /** diff --git a/imp/view.php b/imp/view.php index c63de4dec..5c9fd5c3f 100644 --- a/imp/view.php +++ b/imp/view.php @@ -245,7 +245,9 @@ case 'print_attach': $t->set('headers', $headers); if (!$browser->isBrowser('mozilla')) { - $t->set('css', Horde_Util::bufferOutput(array('Horde_Themes', 'includeStylesheetFiles'))); + Horde::startBuffer(); + Horde_Themes::includeStylesheetFiles(); + $t->set('css', Horde::endBuffer()); echo $t->fetch(IMP_TEMPLATES . '/print/headers.html'); break; } diff --git a/turba/lib/Block/minisearch.php b/turba/lib/Block/minisearch.php index 192855f72..32ca38c37 100644 --- a/turba/lib/Block/minisearch.php +++ b/turba/lib/Block/minisearch.php @@ -33,9 +33,9 @@ class Horde_Block_turba_minisearch extends Horde_Block { { if ($GLOBALS['browser']->hasFeature('iframes')) { Horde::addScriptFile('prototype.js', 'horde'); - return Horde_Util::bufferOutput( - 'include', - TURBA_TEMPLATES . '/block/minisearch.inc'); + Horde::startBuffer(); + include TURBA_TEMPLATES . '/block/minisearch.inc'; + return Horde::endBuffer(); } else { return '' . _("A browser that supports iframes is required") . ''; diff --git a/turba/lib/Test.php b/turba/lib/Test.php index ff11b82c2..0fe96ed2b 100644 --- a/turba/lib/Test.php +++ b/turba/lib/Test.php @@ -91,7 +91,10 @@ class Turba_Test extends Horde_Test $self_url = Horde::selfUrl()->add('app', 'turba'); - return $ret . Horde_Util::bufferOutput('require', TURBA_TEMPLATES . '/test/ldapserver.inc'); + Horde::startBuffer(); + require TURBA_TEMPLATES . '/test/ldapserver.inc'; + + return $ret . Horde::endBuffer(); } /** diff --git a/turba/lib/tests/BrowsePageTest.php b/turba/lib/tests/BrowsePageTest.php index 7a32e5346..9cc507af8 100644 --- a/turba/lib/tests/BrowsePageTest.php +++ b/turba/lib/tests/BrowsePageTest.php @@ -60,7 +60,11 @@ class Turba_BrowsePageTest extends Turba_TestBase { $this->_pageParams['registry']->pushApp('turba', array('check_perms' => false)); $this->fakeAuth(); $page = new Turba_BrowsePage($this->_pageParams); - $this->_output = Horde_Util::bufferOutput(array($page, 'run')); + + Horde::startBuffer(); + $page->run(); + $this->_output = Horde::endBuffer(); + if ($push_result) { $this->_pageParams['registry']->popApp(); } diff --git a/turba/lib/tests/ViewBrowseTest.php b/turba/lib/tests/ViewBrowseTest.php index 44608720f..3e04f1390 100644 --- a/turba/lib/tests/ViewBrowseTest.php +++ b/turba/lib/tests/ViewBrowseTest.php @@ -61,7 +61,11 @@ class Turba_ViewBrowseTest extends Turba_TestBase { $this->_pageParams['registry']->pushApp('turba', array('check_perms' => false)); $this->fakeAuth(); $page = new Turba_View_Browse($this->_pageParams); - $this->_output = Horde_Util::bufferOutput(array($page, 'run')); + + Horde::startBuffer(); + $page->run(); + $this->_output = Horde::endBuffer(); + if ($push_result) { $this->_pageParams['registry']->popApp(); } diff --git a/vilma/domains/delete.php b/vilma/domains/delete.php index 5c3196ca9..999f35f88 100644 --- a/vilma/domains/delete.php +++ b/vilma/domains/delete.php @@ -44,11 +44,17 @@ if ($vars->get('submitbutton') == _("Delete")) { /* Render the form. */ require_once 'Horde/Form/Renderer.php'; $renderer = new Horde_Form_Renderer(); -$main = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'delete.php', 'post'); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'delete.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/domains/edit.php b/vilma/domains/edit.php index 5ebc5e790..36b7b220a 100644 --- a/vilma/domains/edit.php +++ b/vilma/domains/edit.php @@ -39,12 +39,18 @@ if ($form->validate($vars)) { /* Render the form. */ require_once 'Horde/Form/Renderer.php'; -$renderer = &new Horde_Form_Renderer(); -$main = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'edit.php', 'post'); +$renderer = new Horde_Form_Renderer(); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'edit.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/domains/index.php b/vilma/domains/index.php index 7e8997aad..5ace93388 100644 --- a/vilma/domains/index.php +++ b/vilma/domains/index.php @@ -36,7 +36,10 @@ foreach ($domains as $id => $domain) { /* Set up the template fields. */ $template->set('domains', $domains, true); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); /* Set up the field list. */ $images = array('delete' => Horde::img('delete.png', _("Delete Domain")), diff --git a/vilma/users/delete.php b/vilma/users/delete.php index c45cf421e..08720ec8e 100644 --- a/vilma/users/delete.php +++ b/vilma/users/delete.php @@ -175,11 +175,17 @@ if ($vars->get('submitbutton') == _("Delete")) { /* Render the form. */ require_once 'Horde/Form/Renderer.php'; $renderer = &new Horde_Form_Renderer(); -$main = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'delete.php', 'post'); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'delete.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/users/edit.php b/vilma/users/edit.php index 4ce6fd9ef..03056c9c5 100644 --- a/vilma/users/edit.php +++ b/vilma/users/edit.php @@ -100,11 +100,16 @@ if ($form->validate($vars)) { require_once 'Horde/Form/Renderer.php'; $renderer = &new Horde_Form_Renderer(); -$main = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'edit.php', 'post'); +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'edit.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/users/editAlias.php b/vilma/users/editAlias.php index e6adccdb3..784e7fa31 100644 --- a/vilma/users/editAlias.php +++ b/vilma/users/editAlias.php @@ -104,11 +104,16 @@ if (!$vars->exists('mode') || $vars->getExists('retry')) { require_once 'Horde/Form/Renderer.php'; $renderer = &new Horde_Form_Renderer(); -$main = Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'editAlias.php', 'post'); +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'editAlias.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/users/editForward.php b/vilma/users/editForward.php index c8040723a..57afa2301 100644 --- a/vilma/users/editForward.php +++ b/vilma/users/editForward.php @@ -101,11 +101,16 @@ if (!$vars->exists('mode') || $vars->getExists('retry')) { require_once 'Horde/Form/Renderer.php'; $renderer = &new Horde_Form_Renderer(); -$main = Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'editForward.php', 'post'); +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'editForward.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/users/index.php b/vilma/users/index.php index 53181ebfe..dde6d1dd4 100644 --- a/vilma/users/index.php +++ b/vilma/users/index.php @@ -126,7 +126,11 @@ $template->set('addresses', $addresses, true); $template->set('maxusers', $maxusers, true); $template->set('menu', Vilma::getMenu('string')); $template->set('tabs', $tabs->render()); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); + $template->set('pager', $pager->render()); /* Set up the field list. */ diff --git a/vilma/virtuals/delete.php b/vilma/virtuals/delete.php index 79482bbe4..0634ff53b 100644 --- a/vilma/virtuals/delete.php +++ b/vilma/virtuals/delete.php @@ -56,11 +56,17 @@ if ($vars->get('submitbutton') == _("Delete")) { /* Render the form. */ require_once 'Horde/Form/Renderer.php'; $renderer = &new Horde_Form_Renderer(); -$main = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'delete.php', 'post'); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'delete.php', 'post'); +$main = Horde::endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/virtuals/edit.php b/vilma/virtuals/edit.php index 26e951d41..5495081d9 100644 --- a/vilma/virtuals/edit.php +++ b/vilma/virtuals/edit.php @@ -83,11 +83,17 @@ if ($form->validate($vars)) { /* Render the form. */ require_once 'Horde/Form/Renderer.php'; $renderer = new Horde_Form_Renderer(); -$main = Horde_Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'edit.php', 'post'); + +Horde::startBuffer(); +$form->renderActive($renderer, $vars, 'edit.php', 'post'); +$main = Horde:endBuffer(); $template->set('main', $main); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); require VILMA_TEMPLATES . '/common-header.inc'; echo $template->fetch(VILMA_TEMPLATES . '/main/main.html'); diff --git a/vilma/virtuals/index.php b/vilma/virtuals/index.php index f06caa182..a3b635b89 100644 --- a/vilma/virtuals/index.php +++ b/vilma/virtuals/index.php @@ -55,7 +55,10 @@ $images = array('delete' => Horde::img('delete.png', _("Delete User")), $template->set('images', $images); $template->set('menu', Vilma::getMenu('string')); -$template->set('notify', Horde_Util::bufferOutput(array($notification, 'notify'), array('listeners' => 'status'))); + +Horde::startBuffer(); +$notification->notify(array('listeners' => 'status')); +$template->set('notify', Horde::endBuffer()); /* Render the page. */ require VILMA_TEMPLATES . '/common-header.inc'; diff --git a/whups/lib/Block/myqueries.php b/whups/lib/Block/myqueries.php index 12f3e3bff..0ce899ed6 100644 --- a/whups/lib/Block/myqueries.php +++ b/whups/lib/Block/myqueries.php @@ -39,7 +39,9 @@ class Horde_Block_Whups_myqueries extends Horde_Block { $myqueries = Whups_View::factory('SavedQueries', array('results' => $queries)); - $html = Horde_Util::bufferOutput(array($myqueries, 'html'), false); + Horde::startBuffer(); + $myqueries->html(false); + $html = Horde::endBuffer(); if ($html) { return $html; } diff --git a/wicked/lib/Page/SyncPages.php b/wicked/lib/Page/SyncPages.php index c2665dd4a..1e625ca9f 100644 --- a/wicked/lib/Page/SyncPages.php +++ b/wicked/lib/Page/SyncPages.php @@ -306,7 +306,9 @@ class SyncPages extends Page { } } - return Horde_Util::bufferOutput(array($form, 'renderActive'), null, null, null, 'get'); + Horde::startBuffer(); + $form->renderActive(null, null, null, 'get'); + return Horde::endBuffer(); } /**