From: Michael J. Rubinsky Date: Mon, 19 Jul 2010 15:33:43 +0000 (-0400) Subject: PHP5-ify application blocks X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=fabc7e43b5dc1d9e651f5a343eb49266e46a0b63;p=horde.git PHP5-ify application blocks --- diff --git a/agora/lib/Block/forums.php b/agora/lib/Block/forums.php index e6c97a2b6..3fee37d53 100644 --- a/agora/lib/Block/forums.php +++ b/agora/lib/Block/forums.php @@ -17,16 +17,21 @@ $block_name = _("Forums"); * @author Jan Schneider * @package Horde_Block */ -class Horde_Block_agora_forums extends Horde_Block { +class Horde_Block_agora_forums extends Horde_Block +{ - var $_app = 'agora'; + protected $_app = 'agora'; - function _title() + protected function _title() { - return Horde::link(Horde::applicationUrl('forums.php', true)) . _("Forums") . ''; + return Horde::applicationUrl('forums.php', true)->link() . _("Formus") . ''; } - function _params() + /** + * + * @return array + */ + protected function _params() { /* Display the last X number of threads. */ $forum_display = array(); @@ -38,7 +43,7 @@ class Horde_Block_agora_forums extends Horde_Block { return array('forum_display' => $forum_display); } - function _content() + protected function _content() { global $registry; @@ -89,4 +94,5 @@ class Horde_Block_agora_forums extends Horde_Block { return $view->render('block/forums.html.php'); } + } diff --git a/agora/lib/Block/thread.php b/agora/lib/Block/thread.php index 52d5e8912..03af430d1 100644 --- a/agora/lib/Block/thread.php +++ b/agora/lib/Block/thread.php @@ -16,11 +16,19 @@ $block_name = _("Single Thread"); * @author Marko Djukic * @package Horde_Block */ -class Horde_Block_agora_thread extends Horde_Block { - - var $_app = 'agora'; - - function _params() +class Horde_Block_agora_thread extends Horde_Block +{ + /** + * + * @var string + */ + protected $_app = 'agora'; + + /** + * + * @return array + */ + protected function _params() { $forumOb = &Agora_Messages::singleton(); $forums_list = $forumOb->getForums(0, true, 'forum_name', 0, true); @@ -43,11 +51,20 @@ class Horde_Block_agora_thread extends Horde_Block { return array('thread_id' => $threads); } + /** + * + * @return string + */ function _title() { return _("Single Thread"); } + /** + * + * @return string + * @throws Horde_Block_Exception + */ function _content() { /* Return empty if we don't have a thread set. */ @@ -61,7 +78,7 @@ class Horde_Block_agora_thread extends Horde_Block { /* Check if valid thread, otherwise show forum list. */ if ($messages instanceof PEAR_Error || empty($messages)) { - return PEAR::raiseError(_("Unable to fetch selected thread.")); + throw new Horde_Block_Exception(_("Unable to fetch selected thread.")); } /* Get the sorting. */ @@ -85,4 +102,5 @@ class Horde_Block_agora_thread extends Horde_Block { return $view->render('block/thread.html.php'); } + } diff --git a/agora/lib/Block/threads.php b/agora/lib/Block/threads.php index e07558f44..0fdae313f 100644 --- a/agora/lib/Block/threads.php +++ b/agora/lib/Block/threads.php @@ -17,22 +17,22 @@ $block_name = _("Threads"); * @author Jan Schneider * @package Horde_Block */ -class Horde_Block_agora_threads extends Horde_Block { - +class Horde_Block_agora_threads extends Horde_Block +{ /** * @var array */ - var $_threads = array(); + private $_threads = array(); /** * @var string */ - var $_app = 'agora'; + protected $_app = 'agora'; /** * @return array */ - function _params() + protected function _params() { $forums = Agora_Messages::singleton(); @@ -58,7 +58,7 @@ class Horde_Block_agora_threads extends Horde_Block { /** * @return string */ - function _title() + protected function _title() { if (!isset($this->_params['forum_id'])) { return _("Threads"); @@ -76,23 +76,25 @@ class Horde_Block_agora_threads extends Horde_Block { if (!empty($scope)) { $url = Horde_Util::addParameter($url, 'scope', $scope); } + return Horde::link(Agora::setAgoraId($this->_params['forum_id'], null, $url)) . $title . ''; } /** * @return string + * @throws Horde_Block_Exception */ - function _content() + protected function _content() { if (!isset($this->_params['forum_id'])) { - return _("No forum selected"); + throw new Horde_Block_Exception(_("No forum selected")); } if (empty($this->_threads)) { $this->_threads = &Agora_Messages::singleton('agora', $this->_params['forum_id']); if ($this->_threads instanceof PEAR_Error) { - return PEAR::raiseError(_("Unable to fetch threads for selected forum.")); + throw new Horde_Block_Exception(_("Unable to fetch threads for selected forum.")); } } @@ -121,4 +123,5 @@ class Horde_Block_agora_threads extends Horde_Block { return $view->render('block/threads.html.php'); } + } diff --git a/ansel/lib/Block/cloud.php b/ansel/lib/Block/cloud.php index cec6253d5..676bf3af3 100644 --- a/ansel/lib/Block/cloud.php +++ b/ansel/lib/Block/cloud.php @@ -13,11 +13,19 @@ $block_name = _("Tag Cloud"); * @author Michael Rubinsky * @package Horde_Block */ -class Horde_Block_ansel_cloud extends Horde_Block { +class Horde_Block_ansel_cloud extends Horde_Block +{ + /** + * + * @var string + */ + protected $_app = 'ansel'; - var $_app = 'ansel'; - - function _params() + /** + * + * @return array + */ + protected function _params() { $params = array('count' => array( 'name' => _("Number of tags to display"), @@ -26,12 +34,21 @@ class Horde_Block_ansel_cloud extends Horde_Block { return $params; } - function _title() + /** + * + * @return string + */ + protected function _title() { return _("Tag Cloud"); } - function _content() + /** + * + * @global Horde_Registry $registry + * @return string + */ + protected function _content() { global $registry; diff --git a/ansel/lib/Block/gallery.php b/ansel/lib/Block/gallery.php index eab51a0d1..7294f69db 100644 --- a/ansel/lib/Block/gallery.php +++ b/ansel/lib/Block/gallery.php @@ -17,10 +17,23 @@ $block_name = _("Gallery"); */ class Horde_Block_ansel_gallery extends Horde_Block { - var $_app = 'ansel'; - var $_gallery = null; - - function _params() + /** + * + * @var string + */ + protected $_app = 'ansel'; + + /** + * + * @var Ansel_Gallery + */ + private $_gallery = null; + + /** + * + * @return array + */ + protected function _params() { $params = array('gallery' => array( 'name' => _("Gallery"), @@ -35,6 +48,7 @@ class Horde_Block_ansel_gallery extends Horde_Block 'name' => _("Use a lightbox to view photos"), 'type' => 'checkbox', 'default' => true)); + $storage = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope(); if ($storage->countGalleries($GLOBALS['registry']->getAuth(), Horde_Perms::READ) < $GLOBALS['conf']['gallery']['listlimit']) { foreach ($storage->listGalleries() as $gal) { @@ -45,7 +59,11 @@ class Horde_Block_ansel_gallery extends Horde_Block return $params; } - function _title() + /** + * + * @return string + */ + protected function _title() { try { $gallery = $this->_getGallery(); @@ -67,12 +85,17 @@ class Horde_Block_ansel_gallery extends Horde_Block 'gallery' => $gallery->id, 'slug' => $gallery->get('slug')), true); + return $viewurl->link() . @htmlspecialchars($name, ENT_COMPAT, $GLOBALS['registry']->getCharset()) . ''; - } - function _content() + + /** + * + * @return string + */ + protected function _content() { try { $gallery = $this->_getGallery(); @@ -107,7 +130,12 @@ class Horde_Block_ansel_gallery extends Horde_Block return $html . ''; } - function _getGallery($retry = false) + /** + * + * @param boolean $retry + * @return Ansel_Gallery + */ + private function _getGallery($retry = false) { // Make sure we haven't already selected a gallery. if ($this->_gallery instanceof Ansel_Gallery) { diff --git a/ansel/lib/Block/my_galleries.php b/ansel/lib/Block/my_galleries.php index e612bfb3c..be3e6e77b 100644 --- a/ansel/lib/Block/my_galleries.php +++ b/ansel/lib/Block/my_galleries.php @@ -13,11 +13,19 @@ $block_name = _("My Galleries"); * @author Michael Rubinsky * @package Horde_Block */ -class Horde_Block_ansel_my_galleries extends Horde_Block { - - var $_app = 'ansel'; +class Horde_Block_ansel_my_galleries extends Horde_Block +{ + /** + * + * @var string + */ + protected $_app = 'ansel'; - function _params() + /** + * + * @return array + */ + protected function _params() { $params = array('limit' => array( 'name' => _("Maximum number of galleries"), @@ -26,7 +34,11 @@ class Horde_Block_ansel_my_galleries extends Horde_Block { return $params; } - function _title() + /** + * + * @return string + */ + protected function _title() { return Ansel::getUrlFor('view', array('groupby' => 'owner', @@ -35,9 +47,14 @@ class Horde_Block_ansel_my_galleries extends Horde_Block { . _("My Galleries") . ''; } - function _content() + /** + * + * @return string + */ + protected function _content() { Horde::addScriptFile('tooltips.js', 'horde'); + /* Get the top level galleries */ try { $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage') diff --git a/ansel/lib/Block/random_photo.php b/ansel/lib/Block/random_photo.php index e4a1afe2f..50e8c2205 100644 --- a/ansel/lib/Block/random_photo.php +++ b/ansel/lib/Block/random_photo.php @@ -15,18 +15,34 @@ $block_name = _("Random photo"); * @author Ben Chavet * @package Horde_Block */ -class Horde_Block_ansel_random_photo extends Horde_Block { +class Horde_Block_ansel_random_photo extends Horde_Block +{ + /** + * + * @var string + */ + protected $_app = 'ansel'; - var $_app = 'ansel'; + /** + * + * @var boolean + */ + public $updateable = true; - var $updateable = true; - - function _title() + /** + * + * @return string + */ + protected function _title() { return _("Random photo"); } - function _content() + /** + * + * @return string + */ + protected function _content() { $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRandomGallery(); if (!$gallery) { @@ -47,6 +63,7 @@ class Horde_Block_ansel_random_photo extends Horde_Block { } else { $img = Horde::img('thumb-error.png'); } + return $viewurl->link(array('title' => _("View Photo"))) . $img . ''; } diff --git a/ansel/lib/Block/recent_comments.php b/ansel/lib/Block/recent_comments.php index c263442be..58d76db7a 100644 --- a/ansel/lib/Block/recent_comments.php +++ b/ansel/lib/Block/recent_comments.php @@ -18,11 +18,22 @@ if ($GLOBALS['registry']->images->hasComments() && */ class Horde_Block_ansel_recent_comments extends Horde_Block { + /** + * @var string + */ + protected $_app = 'ansel'; + + /** + * + * @var Ansel_Gallery + */ + private $_gallery = null; - var $_app = 'ansel'; - var $_gallery = null; - - function _params() + /** + * + * @return array + */ + protected function _params() { $params = array('gallery' => array( 'name' => _("Gallery"), @@ -39,7 +50,11 @@ class Horde_Block_ansel_recent_comments extends Horde_Block return $params; } - function _title() + /** + * + * @return string + */ + protected function _title() { if ($this->_params['gallery'] != 'all') { try { @@ -67,7 +82,12 @@ class Horde_Block_ansel_recent_comments extends Horde_Block return sprintf(_("Recent Comments In %s"), $viewurl->link() . $name . ''); } - function _content() + /** + * + * @global Horde_Registry $registry + * @return string + */ + protected function _content() { global $registry; @@ -130,7 +150,13 @@ class Horde_Block_ansel_recent_comments extends Horde_Block return $html; } - function _getGallery() + /** + * + * @return Ansel_Gallery + * @throws Horde_Exception_NotFound + * @throws Horde_Exception_PermissionDenied + */ + private function _getGallery() { // Make sure we haven't already selected a gallery. if ($this->_gallery instanceof Ansel_Gallery) { @@ -146,7 +172,7 @@ class Horde_Block_ansel_recent_comments extends Horde_Block } if (empty($this->_gallery)) { - throw new Horde_Exception_NotFount(_("Gallery does not exist.")); + throw new Horde_Exception_NotFound(_("Gallery does not exist.")); } elseif (!$this->_gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(_("Access denied viewing this gallery.")); } @@ -165,7 +191,7 @@ class Horde_Block_ansel_recent_comments extends Horde_Block * @param string $index The index that contains the numerical value * to sort by. */ - function _asortbyindex ($sortarray, $index) { + private function _asortbyindex ($sortarray, $index) { $lastindex = count ($sortarray) - 1; for ($subindex = 0; $subindex < $lastindex; $subindex++) { $lastiteration = $lastindex - $subindex; diff --git a/ansel/lib/Block/recent_faces.php b/ansel/lib/Block/recent_faces.php index 9552accd4..7dad7dae9 100644 --- a/ansel/lib/Block/recent_faces.php +++ b/ansel/lib/Block/recent_faces.php @@ -17,9 +17,15 @@ if (!empty($GLOBALS['conf']['faces']['driver'])) { */ class Horde_Block_ansel_recent_faces extends Horde_Block { - var $_app = 'ansel'; + /** + * @var string + */ + protected $_app = 'ansel'; - function _params() + /** + * @return array + */ + protected function _params() { return array('limit' => array( 'name' => _("Maximum number of faces"), @@ -27,12 +33,20 @@ class Horde_Block_ansel_recent_faces extends Horde_Block 'default' => 10)); } - function _title() + /** + * + * @return string + */ + protected function _title() { return _("Recent faces"); } - function _content() + /** + * + * @return string + */ + protected function _content() { $faces = $GLOBALS['injector']->getInstance('Ansel_Faces'); $results = $faces->allFaces(0, $this->_params['limit']); diff --git a/ansel/lib/Block/recently_added.php b/ansel/lib/Block/recently_added.php index 6f3d4419c..00b2a6d13 100644 --- a/ansel/lib/Block/recently_added.php +++ b/ansel/lib/Block/recently_added.php @@ -15,10 +15,23 @@ $block_name = _("Recently Added Photos"); */ class Horde_Block_ansel_recently_added extends Horde_Block { - var $_app = 'ansel'; - var $_gallery = null; - - function _params() + /** + * + * @var string + */ + protected $_app = 'ansel'; + + /** + * + * @var Ansel_Gallery + */ + private $_gallery = null; + + /** + * + * @return array + */ + protected function _params() { $params = array('gallery' => array( 'name' => _("Gallery"), @@ -42,7 +55,11 @@ class Horde_Block_ansel_recently_added extends Horde_Block return $params; } - function _title() + /** + * + * @return string + */ + protected function _title() { if ($this->_params['gallery'] != 'all') { try { @@ -67,10 +84,15 @@ class Horde_Block_ansel_recently_added extends Horde_Block $viewurl = Ansel::getUrlFor('view', array('view' => 'List'), true); $name = _("All Galleries"); } + return sprintf(_("Recently Added Photos From %s"), $viewurl->link() . $name . ''); } - function _content() + /** + * + * @return string + */ + protected function _content() { if ($this->_params['gallery'] == 'all') { $galleries = array(); @@ -80,8 +102,7 @@ class Horde_Block_ansel_recently_added extends Horde_Block $galleries = $this->_params['gallery']; } - // Retrieve the images, but protect against very large values for - // limit. + // Retrieve the images, but protect against very large values for limit. try { $results = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getRecentImages( $galleries, min($this->_params['limit'], 100)); @@ -156,12 +177,16 @@ HEADER; ENT_COMPAT, $GLOBALS['registry']->getCharset()) . '' . $galleryLink . ''; } - $html .= ''; + return $html; } - function _getGallery() + /** + * + * @return Ansel_Gallery + */ + private function _getGallery() { /* Make sure we haven't already selected a gallery. */ if ($this->_gallery instanceof Ansel_Gallery) { diff --git a/ansel/lib/Block/recently_added_geodata.php b/ansel/lib/Block/recently_added_geodata.php index 8cd6b43e8..66d33ff61 100644 --- a/ansel/lib/Block/recently_added_geodata.php +++ b/ansel/lib/Block/recently_added_geodata.php @@ -13,12 +13,24 @@ $block_name = _("Recently Geotagged"); * @author Michael Rubinsky * @package Horde_Block */ -class Horde_Block_ansel_recently_added_geodata extends Horde_Block { - - var $_app = 'ansel'; - var $_gallery = null; - - function _params() +class Horde_Block_ansel_recently_added_geodata extends Horde_Block +{ + /** + * @var string + */ + protected $_app = 'ansel'; + + /** + * + * @var Ansel_Gallery + */ + private $_gallery = null; + + /** + * + * @return array + */ + protected function _params() { $params = array('gallery' => array( 'name' => _("Gallery"), @@ -46,7 +58,11 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { return $params; } - function _title() + /** + * + * @return string + */ + protected function _title() { Horde::addScriptFile('http://maps.google.com/maps?file=api&v=2&sensor=false&key=' . $GLOBALS['conf']['api']['googlemaps'], 'ansel', array('external' => true)); Horde::addScriptFile('http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/1.1/src/markermanager.js', 'ansel', array('external' => true)); @@ -73,10 +89,15 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { $viewurl = Ansel::getUrlFor('view', array('view' => 'List'), true); $name = _("All Galleries"); } + return sprintf(_("Recently Geotagged Photos From %s"), $viewurl->link() . $name . ''); } - function _content() + /** + * + * @return string + */ + protected function _content() { if ($this->_params['gallery'] == 'all') { $galleries = array(); @@ -134,10 +155,15 @@ class Horde_Block_ansel_recently_added_geodata extends Horde_Block { Event.observe(window, "load", function() {doMap(pageImages);}); EOT; + return $html; } - function _getGallery() + /** + * + * @return Ansel_Gallery + */ + protected function _getGallery() { if ($this->_gallery instanceof Ansel_Gallery) { return $this->_gallery; diff --git a/gollem/lib/Block/tree_menu.php b/gollem/lib/Block/tree_menu.php index 80f92be3d..5f73266a1 100644 --- a/gollem/lib/Block/tree_menu.php +++ b/gollem/lib/Block/tree_menu.php @@ -14,11 +14,11 @@ $block_type = 'tree'; * @author Michael Slusarz * @package Gollem */ -class Horde_Block_gollem_tree_menu extends Horde_Block { +class Horde_Block_gollem_tree_menu extends Horde_Block +{ + protected $_app = 'gollem'; - var $_app = 'gollem'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { // TODO return; diff --git a/hermes/lib/Block/tree_menu.php b/hermes/lib/Block/tree_menu.php index cbfc207de..98e5bc4aa 100644 --- a/hermes/lib/Block/tree_menu.php +++ b/hermes/lib/Block/tree_menu.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_hermes_tree_menu extends Horde_Block { +class Horde_Block_hermes_tree_menu extends Horde_Block +{ + protected $_app = 'hermes'; - var $_app = 'hermes'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { $tree->addNode($parent . '__add', $parent, diff --git a/hermes/lib/Block/tree_stopwatch.php b/hermes/lib/Block/tree_stopwatch.php index dc9509978..85a57893e 100644 --- a/hermes/lib/Block/tree_stopwatch.php +++ b/hermes/lib/Block/tree_stopwatch.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_hermes_tree_stopwatch extends Horde_Block { +class Horde_Block_hermes_tree_stopwatch extends Horde_Block +{ + protected $_app = 'hermes'; - var $_app = 'hermes'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { global $registry, $prefs; diff --git a/horde/lib/Block/account.php b/horde/lib/Block/account.php index 6d10df4ba..db4069640 100644 --- a/horde/lib/Block/account.php +++ b/horde/lib/Block/account.php @@ -12,16 +12,17 @@ $block_name = _("Account Information"); * @author Jan Schneider * @package Horde_Block */ -class Horde_Block_Horde_account extends Horde_Block { +class Horde_Block_Horde_account extends Horde_Block +{ - var $_app = 'horde'; + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("My Account Information"); } @@ -31,7 +32,7 @@ class Horde_Block_Horde_account extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $registry, $conf; @@ -105,17 +106,19 @@ class Horde_Block_Horde_account extends Horde_Block { if ($registry->get('status', 'forwards') != 'inactive' && $registry->hasMethod('summary', 'forwards')) { - $summary = $registry->callByPackage('forwards', 'summary'); - if (!is_a($summary, 'PEAR_Error')) { + try { + $summary = $registry->callByPackage('forwards', 'summary'); $output .= '
' . $summary . "\n"; - } + } catch (Exception $e) {} } + if ($registry->get('status', 'vacation') != 'inactive' && $registry->hasMethod('summary', 'vacation')) { - $summary = $registry->callByPackage('vacation', 'summary'); - if (!is_a($summary, 'PEAR_Error')) { + + try { + $summary = $registry->callByPackage('vacation', 'summary'); $output .= '
' . $summary . "\n"; - } + } catch (Exception $e) {} } return $output; diff --git a/horde/lib/Block/cloud.php b/horde/lib/Block/cloud.php index 6f564b3d6..d99156035 100644 --- a/horde/lib/Block/cloud.php +++ b/horde/lib/Block/cloud.php @@ -6,24 +6,19 @@ $block_name = _("Tag Cloud"); * @author Michael J. Rubinsky * @package Horde_Block */ -class Horde_Block_Horde_cloud extends Horde_Block { - - /** - * Whether this block has changing content. - */ - var $updateable = false; - +class Horde_Block_Horde_cloud extends Horde_Block +{ /** * @var string */ - var $_app = 'horde'; + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Tag Cloud"); } @@ -33,7 +28,7 @@ class Horde_Block_Horde_cloud extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { Horde::addScriptFile('prototype.js', 'horde'); @@ -54,7 +49,11 @@ class Horde_Block_Horde_cloud extends Horde_Block { . '
'; } - function _getTags() + /** + * + * @return array + */ + private function _getTags() { $results = array(); foreach ($GLOBALS['registry']->listAPIs() as $api) { @@ -65,6 +64,7 @@ class Horde_Block_Horde_cloud extends Horde_Block { } } } + return $results; } diff --git a/horde/lib/Block/fb_stream.php b/horde/lib/Block/fb_stream.php index b13dd9318..156fd1422 100644 --- a/horde/lib/Block/fb_stream.php +++ b/horde/lib/Block/fb_stream.php @@ -13,19 +13,19 @@ if (!empty($GLOBALS['conf']['facebook']['enabled'])) { * @author Michael J. Rubinsky * @package Horde_Block */ -class Horde_Block_Horde_fb_stream extends Horde_Block { - +class Horde_Block_Horde_fb_stream extends Horde_Block +{ /** * Whether this block has changing content. * * Set this to false, since we handle the updates via AJAX on our own. */ - var $updateable = false; + public $updateable = false; /** * @var string */ - var $_app = 'horde'; + protected $_app = 'horde'; /** * @var Horde_Service_Facebook @@ -62,7 +62,7 @@ class Horde_Block_Horde_fb_stream extends Horde_Block { * * @return array */ - function _params() + protected function _params() { $filters = array(); @@ -100,7 +100,7 @@ class Horde_Block_Horde_fb_stream extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { return Horde::externalUrl('http://facebook.com', true) . _("My Facebook Stream") . ''; } @@ -110,7 +110,7 @@ class Horde_Block_Horde_fb_stream extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { $instance = md5(mt_rand()); $csslink = $GLOBALS['registry']->get('themesuri', 'horde') . '/facebook.css'; diff --git a/horde/lib/Block/feed.php b/horde/lib/Block/feed.php index d9cbcebd0..55bf5988d 100644 --- a/horde/lib/Block/feed.php +++ b/horde/lib/Block/feed.php @@ -5,13 +5,13 @@ $block_name = _("Syndicated Feed"); /** * @package Horde_Block */ -class Horde_Block_Horde_feed extends Horde_Block { +class Horde_Block_Horde_feed extends Horde_Block +{ + protected $_app = 'horde'; - var $_app = 'horde'; + private $_feed = null; - var $_feed = null; - - function _params() + protected function _params() { return array('uri' => array('type' => 'text', 'name' => _("Feed Address")), @@ -31,7 +31,7 @@ class Horde_Block_Horde_feed extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { $this->_read(); if (is_a($this->_feed, 'Horde_Feed_Base')) { @@ -46,7 +46,7 @@ class Horde_Block_Horde_feed extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { $this->_read(); if (is_a($this->_feed, 'Horde_Feed_Base')) { @@ -74,7 +74,7 @@ class Horde_Block_Horde_feed extends Horde_Block { } } - function _read() + private function _read() { if (empty($this->_params['uri'])) { return; diff --git a/horde/lib/Block/fortune.php b/horde/lib/Block/fortune.php index 01b3b4dca..ec8a40e94 100644 --- a/horde/lib/Block/fortune.php +++ b/horde/lib/Block/fortune.php @@ -9,26 +9,26 @@ if (isset($GLOBALS['conf']['fortune']['exec_path']) && /** * @package Horde_Block */ -class Horde_Block_Horde_fortune extends Horde_Block { - +class Horde_Block_Horde_fortune extends Horde_Block +{ /** * Whether this block has changing content. */ - var $updateable = true; + public $updateable = true; - var $_app = 'horde'; + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Fortune"); } - function _params() + protected function _params() { global $conf; @@ -113,7 +113,7 @@ class Horde_Block_Horde_fortune extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $conf; diff --git a/horde/lib/Block/google.php b/horde/lib/Block/google.php index 055b9baf2..fddeaf89f 100644 --- a/horde/lib/Block/google.php +++ b/horde/lib/Block/google.php @@ -5,16 +5,16 @@ $block_name = _("Google Search"); /** * @package Horde_Block */ -class Horde_Block_Horde_google extends Horde_Block { - - var $_app = 'horde'; +class Horde_Block_Horde_google extends Horde_Block +{ + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Google Search"); } @@ -24,13 +24,13 @@ class Horde_Block_Horde_google extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { if (empty($GLOBALS['conf']['api']['googlesearch'])) { return '

' . _("Google search is not enabled.") . '

'; } - ob_start(); + Horde::startBuffer(); ?>
...
@@ -60,7 +60,7 @@ GSearch.setOnLoadCallback(GoogleSearchSetup); //]]> array('type' => 'text', 'name' => _("URL"), @@ -30,14 +34,15 @@ class Horde_Block_Horde_iframe extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { global $registry; $title = !empty($this->_params['title']) ? $this->_params['title'] : $this->_params['iframe']; - return htmlspecialchars($title) . - Horde::link($this->_params['iframe'], _("Open in a new window"), '', '_blank') . - Horde::img('external.png', '', array('style' => 'vertical-align:middle;padding-left:.3em')) . ''; + $url = new Horde_Url(Horde::externalUrl($this->_params['iframe'])); + + return htmlspecialchars($title) . $url->link(array('target' => '_blank')) + . Horde::img('external.png', '', array('style' => 'vertical-align:middle;padding-left:.3em')) . ''; } /** @@ -45,7 +50,7 @@ class Horde_Block_Horde_iframe extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $browser; diff --git a/horde/lib/Block/metar.php b/horde/lib/Block/metar.php index baadcdeae..f6f2012c8 100644 --- a/horde/lib/Block/metar.php +++ b/horde/lib/Block/metar.php @@ -12,26 +12,26 @@ if ((@include_once 'Services/Weather.php') && * * @package Horde_Block */ -class Horde_Block_Horde_metar extends Horde_Block { - +class Horde_Block_Horde_metar extends Horde_Block +{ /** * Whether this block has changing content. */ - var $updateable = true; + public $updateable = true; - var $_app = 'horde'; + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Current Weather"); } - function _params() + protected function _params() { if (!class_exists('Services_Weather')) { Horde::logMessage('The metar block will not work without Services_Weather from PEAR. Run pear install Services_Weather.', 'ERR'); @@ -88,12 +88,12 @@ class Horde_Block_Horde_metar extends Horde_Block { } } - function _row($label, $content) + private function _row($label, $content) { return '
' . $label . ': ' . $content; } - function _sameRow($label, $content) + private function _sameRow($label, $content) { return ' ' . $label . ': ' . $content; } @@ -103,22 +103,22 @@ class Horde_Block_Horde_metar extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { if (!@include_once 'Services/Weather.php') { Horde::logMessage('The metar block will not work without Services_Weather from PEAR. Run pear install Services_Weather.', 'ERR'); - return _("Metar block not available. Details have been logged for the administrator."); + throw new Horde_Block_Exception(_("Metar block not available. Details have been logged for the administrator.")); } global $conf; static $metarLocs; if (!isset($conf['sql'])) { - return _("A database backend is required for this block."); + throw new Horde_Block_Exception(_("A database backend is required for this block.")); } if (empty($this->_params['location'])) { - return _("No location is set."); + throw new Horde_Block_Exception(_("No location is set.")); } if (!is_array($metarLocs)) { diff --git a/horde/lib/Block/moon.php b/horde/lib/Block/moon.php index 6f5929623..bc8da6a27 100644 --- a/horde/lib/Block/moon.php +++ b/horde/lib/Block/moon.php @@ -5,16 +5,16 @@ $block_name = _("Moon Phases"); /** * @package Horde_Block */ -class Horde_Block_Horde_moon extends Horde_Block { +class Horde_Block_Horde_moon extends Horde_Block +{ + protected $_app = 'horde'; - var $_app = 'horde'; - - function _title() + protected function _title() { return _("Moon Phases"); } - function _params() + protected function _params() { return array( 'phase' => array( @@ -32,7 +32,7 @@ class Horde_Block_Horde_moon extends Horde_Block { ); } - function _content() + protected function _content() { $phases = $this->_calculateMoonPhases(date('Y')); $now = time(); @@ -106,7 +106,7 @@ class Horde_Block_Horde_moon extends Horde_Block { * * @return array The moon phases. */ - function _calculateMoonPhases($Y) + private function _calculateMoonPhases($Y) { $R1 = 3.14159265 / 180; $U = false; @@ -188,7 +188,7 @@ class Horde_Block_Horde_moon extends Horde_Block { * * @return string m/d/Y */ - function _jdtogregorian($julian) + private function _jdtogregorian($julian) { if (function_exists('jdtogregorian')) { return jdtogregorian($julian); diff --git a/horde/lib/Block/sunrise.php b/horde/lib/Block/sunrise.php index aa0844179..aaf2e145f 100644 --- a/horde/lib/Block/sunrise.php +++ b/horde/lib/Block/sunrise.php @@ -5,16 +5,16 @@ $block_name = _("Sunrise/Sunset"); /** * @package Horde_Block */ -class Horde_Block_Horde_sunrise extends Horde_Block { +class Horde_Block_Horde_sunrise extends Horde_Block +{ + protected $_app = 'horde'; - var $_app = 'horde'; - - function _title() + protected function _title() { return _("Sunrise/Sunset"); } - function _params() + protected function _params() { $params = array('location' => array('type' => 'mlenum', 'name' => _("Location"), @@ -32,10 +32,10 @@ class Horde_Block_Horde_sunrise extends Horde_Block { return $params; } - function _content() + protected function _content() { if (empty($this->_params['location'])) { - return _("No location is set."); + throw new Horde_Block_Exception(_("No location is set.")); } // Set the timezone variable, if available. @@ -70,7 +70,7 @@ class Horde_Block_Horde_sunrise extends Horde_Block { /** * http://www.zend.com/codex.php?id=135&single=1 */ - function _calculateSunset($date, $latitude, $longitude, $sunset = true, $timezone) + private function _calculateSunset($date, $latitude, $longitude, $sunset = true, $timezone) { $yday = date('z', $date); $mon = date('n', $date); diff --git a/horde/lib/Block/time.php b/horde/lib/Block/time.php index be544f269..0cebee427 100644 --- a/horde/lib/Block/time.php +++ b/horde/lib/Block/time.php @@ -5,19 +5,19 @@ $block_name = _("Current Time"); /** * @package Horde_Block */ -class Horde_Block_Horde_time extends Horde_Block { - +class Horde_Block_Horde_time extends Horde_Block +{ /** * Whether this block has changing content. */ - var $updateable = true; + public $updateable = true; /** * @var string */ - var $_app = 'horde'; + protected $_app = 'horde'; - function _params() + protected function _params() { return array('time' => array('type' => 'enum', 'name' => _("Time format"), @@ -31,7 +31,7 @@ class Horde_Block_Horde_time extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { return _("Current Time"); } @@ -41,7 +41,7 @@ class Horde_Block_Horde_time extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { if (empty($this->_params['time'])) { $this->_params['time'] = '24-hour'; diff --git a/horde/lib/Block/twitter_timeline.php b/horde/lib/Block/twitter_timeline.php index b6322bb41..d4512c60a 100644 --- a/horde/lib/Block/twitter_timeline.php +++ b/horde/lib/Block/twitter_timeline.php @@ -30,33 +30,33 @@ class Horde_Block_Horde_twitter_timeline extends Horde_Block * handle the updates via AJAX on our own. * */ - var $updateable = false; + public $updateable = false; /** * * @ Horde_Service_Twitter */ - var $_twitter; + private $_twitter; /** * Twitter profile information returned from verify_credentials * * @var Object */ - var $_profile; + private $_profile; /** * * @var string */ - var $_app = 'horde'; + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { try { $twitter = $this->_getTwitterObject(); @@ -80,7 +80,7 @@ class Horde_Block_Horde_twitter_timeline extends Horde_Block /** */ - function _params() + protected function _params() { return array( 'height' => array( @@ -99,7 +99,7 @@ class Horde_Block_Horde_twitter_timeline extends Horde_Block * * @return string The content */ - function _content() + protected function _content() { global $conf; @@ -107,7 +107,7 @@ class Horde_Block_Horde_twitter_timeline extends Horde_Block try { $twitter = $this->_getTwitterObject(); } catch (Horde_Exception $e) { - return sprintf(_("There was an error contacting Twitter: %s"), $e->getMessage()); + throw new Horde_Block_Exception(sprintf(_("There was an error contacting Twitter: %s"), $e->getMessage())); } /* Get a unique ID in case we have multiple Twitter blocks. */ diff --git a/horde/lib/Block/vatid.php b/horde/lib/Block/vatid.php index 6a1a23c6a..fc5be38dc 100644 --- a/horde/lib/Block/vatid.php +++ b/horde/lib/Block/vatid.php @@ -5,16 +5,16 @@ $block_name = _("EU VAT identification"); /** * @package Horde_Block */ -class Horde_Block_Horde_vatid extends Horde_Block { - - var $_app = 'horde'; +class Horde_Block_Horde_vatid extends Horde_Block +{ + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("VAT id number verification"); } @@ -24,7 +24,7 @@ class Horde_Block_Horde_vatid extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { $vatid = str_replace(' ', '', Horde_Util::getFormData('vatid', '')); $block_name = 'block_' . $this->_row . '_' . $this->_col; @@ -108,7 +108,7 @@ class Horde_Block_Horde_vatid extends Horde_Block { return $html; } - function _error($text) + private function _error($text) { return '' . $text . ''; } diff --git a/horde/lib/Block/weatherdotcom.php b/horde/lib/Block/weatherdotcom.php index 10d0c6ab5..7c36d03f6 100644 --- a/horde/lib/Block/weatherdotcom.php +++ b/horde/lib/Block/weatherdotcom.php @@ -13,21 +13,21 @@ if (!empty($GLOBALS['conf']['weatherdotcom']['partner_id']) && * * @package Horde_Block */ -class Horde_Block_Horde_weatherdotcom extends Horde_Block { - +class Horde_Block_Horde_weatherdotcom extends Horde_Block +{ /** * Whether this block has changing content. */ - var $updateable = true; + public $updateable = true; - var $_app = 'horde'; + protected $_app = 'horde'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Weather Forecast"); } @@ -37,7 +37,7 @@ class Horde_Block_Horde_weatherdotcom extends Horde_Block { * * @return array An array containing the parameters. */ - function _params() + protected function _params() { if (!(@include_once 'Services/Weather.php') || !(@include_once 'Cache.php') || @@ -97,13 +97,13 @@ class Horde_Block_Horde_weatherdotcom extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { if (!(@include_once 'Services/Weather.php') || !(@include_once 'Cache.php') || !ini_get('allow_url_fopen')) { Horde::logMessage('The weather.com block will not work without the PEARServices_Weather and Cache packages, and allow_url_fopen enabled. Run pear install Services_Weather Cache, and ensure that allow_url_fopen_wrappers is enabled in php.ini.', 'ERR'); - return _("The weather.com block is not available."); + throw new Horde_Block_Exception(_("The weather.com block is not available.")); } global $conf, $prefs; diff --git a/ingo/lib/Block/overview.php b/ingo/lib/Block/overview.php index 44037a243..8dfe73210 100644 --- a/ingo/lib/Block/overview.php +++ b/ingo/lib/Block/overview.php @@ -12,18 +12,18 @@ $block_name = _("Overview"); * @author Oliver Kuhl * @package Horde_Block */ -class Horde_Block_ingo_overview extends Horde_Block { - - var $_app = 'ingo'; +class Horde_Block_ingo_overview extends Horde_Block +{ + protected $_app = 'ingo'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { - return Horde::link(Horde::url($GLOBALS['registry']->getInitialPage(), true)) . $GLOBALS['registry']->get('name') . ''; + return Horde::url($GLOBALS['registry']->getInitialPage(), true)->link() . $GLOBALS['registry']->get('name') . ''; } /** @@ -31,7 +31,7 @@ class Horde_Block_ingo_overview extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { /* Get list of filters */ $filters = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_FILTERS); @@ -51,7 +51,7 @@ class Horde_Block_ingo_overview extends Horde_Block { $html .= $html_pre . Horde::img('vacation.png', _("Vacation")) . '' . - Horde::link(Horde::applicationUrl('vacation.php'), _("Edit")) . + Horde::applicationUrl('vacation.php')->link(array('title' => _("Edit"))) . _("Vacation") . ' ' . $active . $html_post; } break; @@ -60,7 +60,7 @@ class Horde_Block_ingo_overview extends Horde_Block { if (in_array(Ingo_Storage::ACTION_FORWARD, $_SESSION['ingo']['script_categories'])) { $html .= $html_pre . Horde::img('forward.png', _("Forward")) . '' . - Horde::link(Horde::applicationUrl('forward.php'), _("Edit")) . + Horde::applicationUrl('forward.php')->link(array('title' => _("Edit"))) . _("Forward") . ' ' . $active; $data = unserialize($GLOBALS['prefs']->getValue('forward')); if (!empty($data['a'])) { @@ -75,7 +75,7 @@ class Horde_Block_ingo_overview extends Horde_Block { $html .= $html_pre . Horde::img('whitelist.png', _("Whitelist")) . '' . - Horde::link(Horde::applicationUrl('whitelist.php'), _("Edit")) . + Horde::applicationUrl('whitelist.php')->link(array('title' => _("Edit"))) . _("Whitelist") . ' ' . $active . $html_post; } break; @@ -85,7 +85,7 @@ class Horde_Block_ingo_overview extends Horde_Block { $html .= $html_pre . Horde::img('blacklist.png', _("Blacklist")) . '' . - Horde::link(Horde::applicationUrl('blacklist.php'), _("Edit")) . + Horde::applicationUrl('blacklist.php')->link(array('title' => _("Edit"))) . _("Blacklist") . ' ' . $active . $html_post; } break; @@ -95,7 +95,7 @@ class Horde_Block_ingo_overview extends Horde_Block { $html .= $html_pre . Horde::img('spam.png', _("Spam Filter")) . '' . - Horde::link(Horde::applicationUrl('spam.php'), _("Edit")) . + Horde::applicationUrl('spam.php')->link(array('title' => _("Edit"))) . _("Spam Filter") . ' ' . $active . $html_post; } break; diff --git a/kronolith/lib/Block/month.php b/kronolith/lib/Block/month.php index 2df419146..62aa9b1a7 100644 --- a/kronolith/lib/Block/month.php +++ b/kronolith/lib/Block/month.php @@ -8,12 +8,12 @@ $block_name = _("This Month"); * * @package Horde_Block */ -class Horde_Block_Kronolith_month extends Horde_Block { +class Horde_Block_Kronolith_month extends Horde_Block +{ + protected $_app = 'kronolith'; + private $_share = null; - var $_app = 'kronolith'; - var $_share = null; - - function _params() + protected function _params() { $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', @@ -37,6 +37,7 @@ class Horde_Block_Kronolith_month extends Horde_Block { } } } + return $params; } @@ -45,7 +46,7 @@ class Horde_Block_Kronolith_month extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { $title = _("All Calendars"); $url = Horde::url($GLOBALS['registry']->getInitialPage(), true); @@ -73,7 +74,7 @@ class Horde_Block_Kronolith_month extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $prefs; @@ -83,7 +84,7 @@ class Horde_Block_Kronolith_month extends Horde_Block { try { $this->_share = $GLOBALS['kronolith_shares']->getShare($this->_params['calendar']); } catch (Exception $e) { - return _(sprintf("There was an error accessing the calendar: %s", $e->getMessage())); + throw new Horde_Block_Exception(_(sprintf("There was an error accessing the calendar: %s", $e->getMessage()))); } } if (!$this->_share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::SHOW)) { diff --git a/kronolith/lib/Block/monthlist.php b/kronolith/lib/Block/monthlist.php index 36db981d2..acbb93cec 100644 --- a/kronolith/lib/Block/monthlist.php +++ b/kronolith/lib/Block/monthlist.php @@ -8,11 +8,11 @@ $block_name = _("Upcoming Events"); * * @package Horde_Block */ -class Horde_Block_Kronolith_monthlist extends Horde_Block { +class Horde_Block_Kronolith_monthlist extends Horde_Block +{ + protected $_app = 'kronolith'; - var $_app = 'kronolith'; - - function _params() + protected function _params() { $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', @@ -53,7 +53,7 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { $url = Horde::url($GLOBALS['registry']->getInitialPage(), true); if (isset($this->_params['calendar']) && @@ -68,7 +68,7 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $registry, $prefs; diff --git a/kronolith/lib/Block/prevmonthlist.php b/kronolith/lib/Block/prevmonthlist.php index 1e18a8d89..2261e4c7e 100644 --- a/kronolith/lib/Block/prevmonthlist.php +++ b/kronolith/lib/Block/prevmonthlist.php @@ -8,11 +8,11 @@ $block_name = _("Prior Events"); * * @package Horde_Block */ -class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { +class Horde_Block_Kronolith_prevmonthlist extends Horde_Block +{ + protected $_app = 'kronolith'; - var $_app = 'kronolith'; - - function _params() + protected function _params() { $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', @@ -41,13 +41,14 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { $url = Horde::url($GLOBALS['registry']->getInitialPage(), true); if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') { $url->add('display_cal', $this->_params['calendar']); } + return $url->link() . _("Prior Events") . ''; } @@ -56,7 +57,7 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $registry, $prefs; diff --git a/kronolith/lib/Block/summary.php b/kronolith/lib/Block/summary.php index b982c0866..224bb03a7 100644 --- a/kronolith/lib/Block/summary.php +++ b/kronolith/lib/Block/summary.php @@ -8,11 +8,11 @@ $block_name = _("Calendar Summary"); * * @package Horde_Block */ -class Horde_Block_Kronolith_summary extends Horde_Block { +class Horde_Block_Kronolith_summary extends Horde_Block +{ + protected $_app = 'kronolith'; - var $_app = 'kronolith'; - - function __construct($params = array(), $row = null, $col = null) + protected function __construct($params = array(), $row = null, $col = null) { parent::__construct($params, $row, $col); if (!isset($this->_params['days'])) { @@ -20,7 +20,7 @@ class Horde_Block_Kronolith_summary extends Horde_Block { } } - function _params() + protected function _params() { $params = array('calendar' => array('name' => _("Calendar"), 'type' => 'enum', @@ -72,7 +72,7 @@ class Horde_Block_Kronolith_summary extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { $url = Horde::url($GLOBALS['registry']->getInitialPage(), true); if (isset($this->_params['calendar']) && diff --git a/kronolith/lib/Block/tree_alarms.php b/kronolith/lib/Block/tree_alarms.php index f4c0dea12..e3ea9e5a0 100644 --- a/kronolith/lib/Block/tree_alarms.php +++ b/kronolith/lib/Block/tree_alarms.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_kronolith_tree_alarms extends Horde_Block { +class Horde_Block_kronolith_tree_alarms extends Horde_Block +{ + protected $_app = 'kronolith'; - var $_app = 'kronolith'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { $horde_alarm = $GLOBALS['injector']->getInstance('Horde_Alarm'); diff --git a/kronolith/lib/Block/tree_menu.php b/kronolith/lib/Block/tree_menu.php index f6bf6d5b3..b8cff440e 100644 --- a/kronolith/lib/Block/tree_menu.php +++ b/kronolith/lib/Block/tree_menu.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_kronolith_tree_menu extends Horde_Block { +class Horde_Block_kronolith_tree_menu extends Horde_Block +{ + protected $_app = 'kronolith'; - var $_app = 'kronolith'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { global $registry; diff --git a/mnemo/lib/Block/note.php b/mnemo/lib/Block/note.php index 4c1ff4488..6ee76e539 100644 --- a/mnemo/lib/Block/note.php +++ b/mnemo/lib/Block/note.php @@ -29,6 +29,7 @@ class Horde_Block_Mnemo_note extends Horde_Block ), 'note_name' => array( 'type' => 'hidden', + 'name' => 'note_name' ), ); } @@ -41,7 +42,6 @@ class Horde_Block_Mnemo_note extends Horde_Block protected function _content() { $memo = $this->_getNote(); - $html = '
'; $body = Horde_Text_Filter::filter($memo['body'], 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'class' => null)); try { diff --git a/mnemo/lib/Block/summary.php b/mnemo/lib/Block/summary.php index f9fd7f78a..d71f16965 100644 --- a/mnemo/lib/Block/summary.php +++ b/mnemo/lib/Block/summary.php @@ -5,27 +5,26 @@ $block_name = _("Notes Summary"); /** * Implementation of Horde_Block api to show notes summary. * - * $Horde: mnemo/lib/Block/summary.php,v 1.39 2009/12/04 17:42:25 jan Exp $ * * @package Horde_Block */ -class Horde_Block_Mnemo_summary extends Horde_Block { +class Horde_Block_Mnemo_summary extends Horde_Block +{ + protected $_app = 'mnemo'; - var $_app = 'mnemo'; - - function _title() + protected function _title() { global $registry; $label = !empty($this->_params['block_title']) ? $this->_params['block_title'] : $registry->get('name'); - return Horde::link(Horde::applicationUrl($registry->getInitialPage(), - true)) + + return Horde::link(Horde::applicationUrl($registry->getInitialPage(), true)) . htmlspecialchars($label) . ''; } - function _params() + protected function _params() { $cManager = new Horde_Prefs_CategoryManager(); $categories = array(); @@ -48,7 +47,7 @@ class Horde_Block_Mnemo_summary extends Horde_Block { 'values' => $categories)); } - function _content() + protected function _content() { global $registry, $prefs; @@ -110,6 +109,7 @@ class Horde_Block_Mnemo_summary extends Horde_Block { if (!$memos) { return '

' . _("No notes to display") . '

'; } + return 'add('actionID', 'add_memo'); - $icondir = (string)Horde_Themes::img(); + $icondir = (string)Horde_Themes::img(); $tree->addNode($parent . '__new', $parent, @@ -29,11 +28,13 @@ class Horde_Block_mnemo_tree_menu extends Horde_Block { 'url' => $add)); foreach (Mnemo::listNotepads() as $name => $notepad) { - if ($notepad->get('owner') != $GLOBALS['registry']->getAuth() && - !empty($GLOBALS['conf']['share']['hidden']) && - !in_array($notepad->getName(), $GLOBALS['display_notepads'])) { - continue; - } + if ($notepad->get('owner') != $GLOBALS['registry']->getAuth() && + !empty($GLOBALS['conf']['share']['hidden']) && + !in_array($notepad->getName(), $GLOBALS['display_notepads'])) { + + continue; + } + $tree->addNode($parent . $name . '__new', $parent . '__new', sprintf(_("in %s"), $notepad->get('name')), diff --git a/nag/lib/Block/summary.php b/nag/lib/Block/summary.php index c8d707dfb..3631ae7dd 100644 --- a/nag/lib/Block/summary.php +++ b/nag/lib/Block/summary.php @@ -5,23 +5,23 @@ $block_name = _("Tasks Summary"); /** * @package Horde_Block */ -class Horde_Block_nag_summary extends Horde_Block { +class Horde_Block_nag_summary extends Horde_Block +{ + protected $_app = 'nag'; - var $_app = 'nag'; - - function _title() + protected function _title() { global $registry; $label = !empty($this->_params['block_title']) ? $this->_params['block_title'] : $registry->get('name'); - return Horde::link(Horde::applicationUrl($registry->getInitialPage(), - true)) + + return Horde::applicationUrl($registry->getInitialPage(), true)->link() . htmlspecialchars($label) . ''; } - function _params() + protected function _params() { $cManager = new Horde_Prefs_CategoryManager(); $categories = array(); @@ -88,7 +88,7 @@ class Horde_Block_nag_summary extends Horde_Block { 'values' => $categories)); } - function _content() + protected function _content() { global $registry, $prefs; diff --git a/nag/lib/Block/tree_alarms.php b/nag/lib/Block/tree_alarms.php index ffe4cb219..740f6501c 100644 --- a/nag/lib/Block/tree_alarms.php +++ b/nag/lib/Block/tree_alarms.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_nag_tree_alarms extends Horde_Block { +class Horde_Block_nag_tree_alarms extends Horde_Block +{ + protected$_app = 'nag'; - var $_app = 'nag'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { $horde_alarm = $GLOBALS['injector']->getInstance('Horde_Alarm'); diff --git a/nag/lib/Block/tree_menu.php b/nag/lib/Block/tree_menu.php index 5bd1737e6..ced9c5569 100644 --- a/nag/lib/Block/tree_menu.php +++ b/nag/lib/Block/tree_menu.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_nag_tree_menu extends Horde_Block { +class Horde_Block_nag_tree_menu extends Horde_Block +{ + protected $_app = 'nag'; - var $_app = 'nag'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { global $registry; diff --git a/trean/lib/Block/bookmarks.php b/trean/lib/Block/bookmarks.php index 85564d2be..10cbc916e 100644 --- a/trean/lib/Block/bookmarks.php +++ b/trean/lib/Block/bookmarks.php @@ -5,9 +5,7 @@ $block_name = _("Bookmarks"); /** * Implementation of Horde_Block api to show bookmarks. * - * $Horde: trean/lib/Block/bookmarks.php,v 1.39 2009-11-29 15:51:42 chuck Exp $ - * - * Copyright 2004-2009 The Horde Project (http://www.horde.org/) + * Copyright 2004-2010 The Horde Project (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. @@ -16,12 +14,12 @@ $block_name = _("Bookmarks"); * @since Trean 1.0 * @package Horde_Block */ -class Horde_Block_Trean_bookmarks extends Horde_Block { - - var $_app = 'trean'; - var $_folder = null; +class Horde_Block_Trean_bookmarks extends Horde_Block +{ + protected $_app = 'trean'; + private $_folder = null; - function _params() + protected function _params() { require_once dirname(__FILE__) . '/../base.php'; @@ -68,7 +66,7 @@ class Horde_Block_Trean_bookmarks extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { global $registry; @@ -82,7 +80,7 @@ class Horde_Block_Trean_bookmarks extends Horde_Block { } } - return Horde::link(Horde::url($registry->getInitialPage(), true)) . $name . ''; + return Horde::url($registry->getInitialPage(), true)->link() . $name . ''; } /** @@ -90,7 +88,7 @@ class Horde_Block_Trean_bookmarks extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { require_once dirname(__FILE__) . '/../base.php'; require_once TREAN_TEMPLATES . '/star_rating_helper.php'; @@ -131,7 +129,7 @@ class Horde_Block_Trean_bookmarks extends Horde_Block { return $html; } - function _getFolder() + private function _getFolder() { require_once dirname(__FILE__) . '/../base.php'; diff --git a/trean/lib/Block/highestrated.php b/trean/lib/Block/highestrated.php index 961683a8a..511e3db4f 100644 --- a/trean/lib/Block/highestrated.php +++ b/trean/lib/Block/highestrated.php @@ -5,9 +5,7 @@ $block_name = _("Highest-rated Bookmarks"); /** * Implementation of Horde_Block api to show the highest-rated bookmarks. * - * $Horde: trean/lib/Block/highestrated.php,v 1.4 2009/01/06 18:02:13 jan Exp $ - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) + * Copyright 2007-2010 The Horde Project (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. @@ -15,14 +13,14 @@ $block_name = _("Highest-rated Bookmarks"); * @author Chuck Hagenbuch * @package Horde_Block */ -class Horde_Block_Trean_highestrated extends Horde_Block { - - var $_app = 'trean'; +class Horde_Block_Trean_highestrated extends Horde_Block +{ + protected $_app = 'trean'; /** * Block configuration. */ - function _params() + protected function _params() { return array('rows' => array('name' => _("Number of bookmarks to show"), 'type' => 'enum', @@ -43,10 +41,9 @@ class Horde_Block_Trean_highestrated extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { - global $registry; - return Horde::link(Horde::url($registry->getInitialPage(), true)) . _("Highest-rated Bookmarks") . ''; + return Horde::url($GLOBALS['registry']->getInitialPage(), true)->link() . _("Highest-rated Bookmarks") . ''; } /** @@ -54,7 +51,7 @@ class Horde_Block_Trean_highestrated extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { require_once dirname(__FILE__) . '/../base.php'; require_once TREAN_TEMPLATES . '/star_rating_helper.php'; diff --git a/trean/lib/Block/mostclicked.php b/trean/lib/Block/mostclicked.php index ca8ab0a69..95caad561 100644 --- a/trean/lib/Block/mostclicked.php +++ b/trean/lib/Block/mostclicked.php @@ -5,9 +5,7 @@ $block_name = _("Most-clicked Bookmarks"); /** * Implementation of Horde_Block api to show the most-clicked bookmarks. * - * $Horde: trean/lib/Block/mostclicked.php,v 1.4 2009/01/06 18:02:13 jan Exp $ - * - * Copyright 2007-2009 The Horde Project (http://www.horde.org/) + * Copyright 2007-2010 The Horde Project (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. @@ -15,14 +13,14 @@ $block_name = _("Most-clicked Bookmarks"); * @author Chuck Hagenbuch * @package Horde_Block */ -class Horde_Block_Trean_mostclicked extends Horde_Block { - - var $_app = 'trean'; +class Horde_Block_Trean_mostclicked extends Horde_Block +{ + protected $_app = 'trean'; /** * Block configuration. */ - function _params() + protected function _params() { return array('rows' => array('name' => _("Number of bookmarks to show"), 'type' => 'enum', @@ -43,10 +41,9 @@ class Horde_Block_Trean_mostclicked extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { - global $registry; - return Horde::link(Horde::url($registry->getInitialPage(), true)) . _("Most-clicked Bookmarks") . ''; + return Horde::url($GLOBALS['registry']->getInitialPage(), true)->link() . _("Most-clicked Bookmarks") . ''; } /** @@ -54,7 +51,7 @@ class Horde_Block_Trean_mostclicked extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { require_once dirname(__FILE__) . '/../base.php'; require_once TREAN_TEMPLATES . '/star_rating_helper.php'; diff --git a/trean/lib/Block/tree_menu.php b/trean/lib/Block/tree_menu.php index d76e7ac13..f3a40470d 100644 --- a/trean/lib/Block/tree_menu.php +++ b/trean/lib/Block/tree_menu.php @@ -4,13 +4,12 @@ $block_name = _("Menu List"); $block_type = 'tree'; /** - * $Horde: trean/lib/Block/tree_menu.php,v 1.9 2009/12/22 03:44:05 mrubinsk Exp $ */ -class Horde_Block_trean_tree_menu extends Horde_Block { +class Horde_Block_trean_tree_menu extends Horde_Block +{ + protected $_app = 'trean'; - var $_app = 'trean'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { global $registry; diff --git a/turba/lib/Block/minisearch.php b/turba/lib/Block/minisearch.php index 32ca38c37..7a105332a 100644 --- a/turba/lib/Block/minisearch.php +++ b/turba/lib/Block/minisearch.php @@ -8,19 +8,18 @@ $block_name = _("Contact Search"); * * @package Horde_Block */ -class Horde_Block_turba_minisearch extends Horde_Block { - - var $_app = 'turba'; +class Horde_Block_turba_minisearch extends Horde_Block +{ + protected $_app = 'turba'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { - return Horde::link(Horde::url($GLOBALS['registry']->getInitialPage(), - true)) + return Horde::url($GLOBALS['registry']->getInitialPage(), true)->link() . _("Contact Search") . ''; } @@ -29,7 +28,7 @@ class Horde_Block_turba_minisearch extends Horde_Block { * * @return string The block content. */ - function _content() + protected function _content() { if ($GLOBALS['browser']->hasFeature('iframes')) { Horde::addScriptFile('prototype.js', 'horde'); diff --git a/turba/lib/Block/tree_menu.php b/turba/lib/Block/tree_menu.php index 6e526a29a..0b123787f 100644 --- a/turba/lib/Block/tree_menu.php +++ b/turba/lib/Block/tree_menu.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_turba_tree_menu extends Horde_Block { +class Horde_Block_turba_tree_menu extends Horde_Block +{ + protected $_app = 'turba'; - var $_app = 'turba'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { global $registry; diff --git a/whups/lib/Block/myqueries.php b/whups/lib/Block/myqueries.php index a5a54a7e2..25d6d9cd2 100644 --- a/whups/lib/Block/myqueries.php +++ b/whups/lib/Block/myqueries.php @@ -8,16 +8,16 @@ $block_name = _("My Queries"); * * @package Horde_Block */ -class Horde_Block_Whups_myqueries extends Horde_Block { - - var $_app = 'whups'; +class Horde_Block_Whups_myqueries extends Horde_Block +{ + protected $_app = 'whups'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("My Queries"); } @@ -27,7 +27,7 @@ class Horde_Block_Whups_myqueries extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { require_once WHUPS_BASE . '/lib/Query.php'; diff --git a/whups/lib/Block/myrequests.php b/whups/lib/Block/myrequests.php index f1b64ef68..16e148fb0 100644 --- a/whups/lib/Block/myrequests.php +++ b/whups/lib/Block/myrequests.php @@ -8,16 +8,16 @@ $block_name = _("My Requests"); * * @package Horde_Block */ -class Horde_Block_Whups_myrequests extends Horde_Block { - - var $_app = 'whups'; +class Horde_Block_Whups_myrequests extends Horde_Block +{ + protected $_app = 'whups'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("My Requests"); } @@ -27,7 +27,7 @@ class Horde_Block_Whups_myrequests extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $whups_driver, $prefs; @@ -63,6 +63,7 @@ class Horde_Block_Whups_myrequests extends Horde_Block { } Horde::addScriptFile('tables.js', 'horde', true); + return '' . $html . '
'; } diff --git a/whups/lib/Block/mytickets.php b/whups/lib/Block/mytickets.php index 40deb1e2f..0e3327a41 100644 --- a/whups/lib/Block/mytickets.php +++ b/whups/lib/Block/mytickets.php @@ -8,16 +8,16 @@ $block_name = _("My Tickets"); * * @package Horde_Block */ -class Horde_Block_Whups_mytickets extends Horde_Block { - - var $_app = 'whups'; +class Horde_Block_Whups_mytickets extends Horde_Block +{ + protected $_app = 'whups'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("My Tickets"); } @@ -27,7 +27,7 @@ class Horde_Block_Whups_mytickets extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $whups_driver, $prefs; @@ -62,6 +62,7 @@ class Horde_Block_Whups_mytickets extends Horde_Block { } Horde::addScriptFile('tables.js', 'horde', true); + return '' . $html . '
'; } diff --git a/whups/lib/Block/query.php b/whups/lib/Block/query.php index fa64bf7b5..e560d09cd 100644 --- a/whups/lib/Block/query.php +++ b/whups/lib/Block/query.php @@ -8,11 +8,11 @@ $block_name = _("Query Results"); * * @package Horde_Block */ -class Horde_Block_Whups_query extends Horde_Block { +class Horde_Block_Whups_query extends Horde_Block +{ + protected $_app = 'whups'; - var $_app = 'whups'; - - function _params() + protected function _params() { require_once WHUPS_BASE . '/lib/Query.php'; @@ -37,12 +37,13 @@ class Horde_Block_Whups_query extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { if (($query = $this->_getQuery()) && $query->name) { return Horde::link(Whups::urlFor('query', empty($query->slug) ? array('id' => $query->id) : array('slug' => $query->slug))) . htmlspecialchars($query->name) . ''; } + return _("Query Results"); } @@ -51,7 +52,7 @@ class Horde_Block_Whups_query extends Horde_Block { * * @return string The content. */ - function _content() + protected function _content() { global $whups_driver, $prefs; @@ -83,10 +84,11 @@ class Horde_Block_Whups_query extends Horde_Block { } Horde::addScriptFile('tables.js', 'horde', true); + return '' . $html . '
'; } - function _getQuery() + private function _getQuery() { if (empty($this->_params['query'])) { return false; diff --git a/whups/lib/Block/queuecontents.php b/whups/lib/Block/queuecontents.php index 6f3261c17..c8d76dc5a 100644 --- a/whups/lib/Block/queuecontents.php +++ b/whups/lib/Block/queuecontents.php @@ -7,11 +7,11 @@ $block_name = _("Queue Contents"); * * @package Horde_Block */ -class Horde_Block_Whups_queuecontents extends Horde_Block { +class Horde_Block_Whups_queuecontents extends Horde_Block +{ + protected $_app = 'whups'; - var $_app = 'whups'; - - function _params() + protected function _params() { global $whups_driver; @@ -38,7 +38,7 @@ class Horde_Block_Whups_queuecontents extends Horde_Block { * * @return string The title text. */ - function _title() + protected function _title() { if ($queue = $this->_getQueue()) { return sprintf(_("Open Tickets in %s"), htmlspecialchars($queue['name'])); @@ -51,7 +51,7 @@ class Horde_Block_Whups_queuecontents extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $whups_driver, $prefs; @@ -88,10 +88,11 @@ class Horde_Block_Whups_queuecontents extends Horde_Block { } Horde::addScriptFile('tables.js', 'horde', true); + return '' . $html . '
'; } - function _getQueue() + private function _getQueue() { global $whups_driver; @@ -105,6 +106,7 @@ class Horde_Block_Whups_queuecontents extends Horde_Block { if (is_a($queue, 'PEAR_Error')) { return false; } + return $queue; } diff --git a/whups/lib/Block/queuesummary.php b/whups/lib/Block/queuesummary.php index 11b05a9ce..3bbeeb656 100644 --- a/whups/lib/Block/queuesummary.php +++ b/whups/lib/Block/queuesummary.php @@ -8,16 +8,16 @@ $block_name = _("Queue Summary"); * * @package Horde_Block */ -class Horde_Block_Whups_queuesummary extends Horde_Block { - - var $_app = 'whups'; +class Horde_Block_Whups_queuesummary extends Horde_Block +{ + protected $_app = 'whups'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Queue Summary"); } @@ -27,7 +27,7 @@ class Horde_Block_Whups_queuesummary extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $whups_driver; @@ -54,6 +54,7 @@ class Horde_Block_Whups_queuesummary extends Horde_Block { } Horde::addScriptFile('tables.js', 'horde', true); + return '' . $html . '
'; } diff --git a/whups/lib/Block/tree_menu.php b/whups/lib/Block/tree_menu.php index 33dca7b83..b82096e0a 100644 --- a/whups/lib/Block/tree_menu.php +++ b/whups/lib/Block/tree_menu.php @@ -6,11 +6,11 @@ $block_type = 'tree'; /** * @package Horde_Block */ -class Horde_Block_whups_tree_menu extends Horde_Block { +class Horde_Block_whups_tree_menu extends Horde_Block +{ + protected $_app = 'whups'; - var $_app = 'whups'; - - function _buildTree(&$tree, $indent = 0, $parent = null) + protected function _buildTree(&$tree, $indent = 0, $parent = null) { global $registry; diff --git a/whups/lib/Block/unassigned.php b/whups/lib/Block/unassigned.php index cbf55b9a3..d3a9ada11 100644 --- a/whups/lib/Block/unassigned.php +++ b/whups/lib/Block/unassigned.php @@ -8,16 +8,16 @@ $block_name = _("Unassigned Tickets"); * * @package Horde_Block */ -class Horde_Block_Whups_unassigned extends Horde_Block { - - var $_app = 'whups'; +class Horde_Block_Whups_unassigned extends Horde_Block +{ + protected $_app = 'whups'; /** * The title to go in this block. * * @return string The title text. */ - function _title() + protected function _title() { return _("Unassigned Tickets"); } @@ -27,7 +27,7 @@ class Horde_Block_Whups_unassigned extends Horde_Block { * * @return string The content */ - function _content() + protected function _content() { global $whups_driver, $prefs; @@ -62,6 +62,7 @@ class Horde_Block_Whups_unassigned extends Horde_Block { } Horde::addScriptFile('tables.js', 'horde', true); + return '' . $html . '
'; } diff --git a/wicked/lib/Block/page.php b/wicked/lib/Block/page.php index a6d078ba2..676833b61 100644 --- a/wicked/lib/Block/page.php +++ b/wicked/lib/Block/page.php @@ -13,23 +13,23 @@ $block_name = _("Wiki page"); * @author Jason Felice * @package Horde_Block */ -class Horde_Block_Wicked_page extends Horde_Block { +class Horde_Block_Wicked_page extends Horde_Block +{ + protected $_app = 'wicked'; - var $_app = 'wicked'; - - function _title() + protected function _title() { $page = Page::getPage($this->_params['page']); return htmlspecialchars($page->pageName()); } - function _content() + protected function _content() { $page = Page::getPage($this->_params['page']); return $page->render(WICKED_MODE_BLOCK); } - function _params() + protected function _params() { return array('page' => array('type' => 'text', 'name' => _("Name of wiki page to display"),