equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 |
2 |
3 /* |
3 /* |
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
5 * Version 1.1.6 (Caoineag beta 1) |
5 * Copyright (C) 2006-2009 Dan Fuhry |
6 * Copyright (C) 2006-2008 Dan Fuhry |
|
7 * |
6 * |
8 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
7 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
9 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
8 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
10 * |
9 * |
11 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
24 'externalnotext' => '<a href="\\1" onclick="window.open(this.href); return false;">\\1</a>' |
23 'externalnotext' => '<a href="\\1" onclick="window.open(this.href); return false;">\\1</a>' |
25 ); |
24 ); |
26 |
25 |
27 public function heading($text, $pieces) |
26 public function heading($text, $pieces) |
28 { |
27 { |
29 static $tocid = -1; |
|
30 foreach ( $pieces as $i => $piece ) |
28 foreach ( $pieces as $i => $piece ) |
31 { |
29 { |
32 $tocid++; |
30 $tocid = sanitize_page_id(trim($piece['text'])); |
33 $tag = '<h' . $piece['level'] . ' id="toc' . $tocid . '">'; |
31 $tag = '<h' . $piece['level'] . ' id="head:' . $tocid . '">'; |
34 $tag .= trim($piece['text']); |
32 $tag .= trim($piece['text']); |
35 $tag .= '</h' . $piece['level'] . '>'; |
33 $tag .= '</h' . $piece['level'] . '>'; |
36 |
34 |
37 $text = str_replace(Carpenter::generate_token($i), $tag, $text); |
35 $text = str_replace(Carpenter::generate_token($i), $tag, $text); |
38 } |
36 } |