/usr/share/horde/wicked/lib/Text_Wiki/Render/Xhtml/Toc2.php is in php-horde-wicked 2.0.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | <?php
/**
* @package Wicked
*/
class Text_Wiki_Render_Xhtml_Toc2 extends Text_Wiki_Render
{
public $conf = array(
'css_list' => null,
'css_item' => null,
'title' => '<strong>Table of Contents</strong>',
'div_id' => 'toc',
);
protected $_last_level = null;
/**
* Renders a token into text matching the requested format.
*
* @access public
*
* @param array $options The "options" portion of the token (second
* element).
*
* @return string The text rendered from the token options.
*/
public function token($options)
{
// type, id, level, count, attr.
extract($options);
switch ($type) {
case 'list_start':
$GLOBALS['page_output']->addScriptFile('toc.js', 'wicked');
// Add the div, class, and id.
$html = '<div';
$css = $this->getConf('css_list');
if ($css) {
$html .= " class=\"$css\"";
}
$div_id = $this->getConf('div_id');
if ($div_id) {
$html .= " id=\"$div_id\"";
}
// Add the title, and done.
return $html . '>' . $this->getConf('title') . '<ol>';
case 'list_end':
$html = '';
while ($this->_last_level > 1) {
$html .= '</ol>';
--$this->_last_level;
}
return $html . "\n</li></ol></div>\n\n";
case 'item_start':
$html = '';
if ($this->_last_level !== null) {
if ($level > $this->_last_level) {
while ($level > $this->_last_level) {
$html .= '<ol>';
++$this->_last_level;
}
$html .= '<li';
} elseif ($level < $this->_last_level) {
while ($level < $this->_last_level) {
$html .= '</ol>';
--$this->_last_level;
}
$html .= '</li><li';
} else {
$html = '</li><li';
}
} else {
$html = '<li';
}
$this->_last_level = $level;
$css = $this->getConf('css_item');
if ($css) {
$html .= " class=\"$css\"";
}
return $html . "><a href=\"#$id\">";
case 'item_end':
return '</a>';
}
}
}
|