1: <?php
2: /**
3: * Class that extends the base Highlightquotes class to allow toggling of
4: * quoteblocks via javascript.
5: *
6: * CSS class names "toggleQuoteHide" and "toggleQuoteShow" are used to style
7: * toggle text.
8: *
9: * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
10: *
11: * See the enclosed file COPYING for license information (LGPL). If you
12: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
13: *
14: * @author Michael Slusarz <slusarz@horde.org>
15: * @category Horde
16: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
17: * @package Core
18: */
19: class Horde_Core_Text_Filter_Highlightquotes extends Horde_Text_Filter_Highlightquotes
20: {
21: /**
22: * @param array $params Additional Parameters to base driver:
23: * <pre>
24: * 'noJS' - (boolean) Don't add javascript toggle code.
25: * DEFAULT: false
26: * </pre>
27: */
28: public function __construct(array $params = array())
29: {
30: if (empty($params['noJS'])) {
31: Horde::addScriptFile('effects.js', 'horde');
32: Horde::addScriptFile('toggle_quotes.js', 'horde');
33: }
34:
35: parent::__construct($params);
36: }
37:
38: /**
39: * Add HTML code at the beginning of a large block of quoted lines.
40: *
41: * @param array $lines Lines.
42: * @param integer $qcount Number of lines in quoted level.
43: *
44: * @return string HTML code.
45: */
46: protected function _beginLargeBlock($lines, $qcount)
47: {
48: return (($this->_params['citeblock']) ? '<br />' : '') .
49: '<div class="toggleQuoteParent">' .
50: '<span class="widget toggleQuoteShow"' . ($this->_params['hideBlocks'] ? '' : ' style="display:none"') . '>' . htmlspecialchars(sprintf(Horde_Core_Translation::t("[Show Quoted Text - %d lines]"), $qcount)) . '</span>' .
51: '<span class="widget toggleQuoteHide"' . ($this->_params['hideBlocks'] ? ' style="display:none"' : '') . '>' . htmlspecialchars(Horde_Core_Translation::t("[Hide Quoted Text]")) . '</span>';
52: }
53:
54: /**
55: * Add HTML code at the end of a large block of quoted lines.
56: *
57: * @param array $lines Lines.
58: * @param integer $qcount Number of lines in quoted level.
59: *
60: * @return string HTML code.
61: */
62: protected function _endLargeBlock($lines, $qcount)
63: {
64: return '</div>';
65: }
66:
67: }
68: