equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 /* |
2 /* |
3 Plugin Name: Mediafier |
3 Plugin Name: Wikulator |
4 Plugin URI: http://enanocms.org/Mediafier |
4 Plugin URI: http://enanocms.org/plugin/wikulator |
5 Description: Several parser extensions that provide MediaWiki-like support for references, search highlighting, and a table of contents to Enano |
5 Description: Several parser extensions that provide MediaWiki-like support for references, search highlighting, and a table of contents to Enano |
6 Author: Dan Fuhry |
6 Author: Dan Fuhry |
7 Version: 0.1 beta 1 |
7 Version: 0.1 beta 1 |
8 Author URI: http://enanocms.org/ |
8 Author URI: http://enanocms.org/ |
9 */ |
9 */ |
69 $treenum = array_values($treenum); |
69 $treenum = array_values($treenum); |
70 if ( isset($treenum[count($treenum)-1]) ) |
70 if ( isset($treenum[count($treenum)-1]) ) |
71 $treenum[count($treenum)-1]++; |
71 $treenum[count($treenum)-1]++; |
72 if ( $i > 0 ) |
72 if ( $i > 0 ) |
73 $toc .= '</dd>'; |
73 $toc .= '</dd>'; |
74 $toc .= '<dd><a href="#toc' . $i . '">' . implode('.', $treenum) . ' ' . htmlspecialchars($matches[2][$i]) . '</a>'; |
74 if ( version_compare(enano_version(), '1.1.7', '>=') ) |
|
75 { |
|
76 $tocid = sanitize_page_id(trim($matches[2][$i])); |
|
77 $tocid = str_replace(array('[', ']'), '', $tocid); |
|
78 } |
|
79 else |
|
80 { |
|
81 $tocid = "$i"; |
|
82 } |
|
83 $toc .= '<dd><a href="#head:' . $tocid . '">' . implode('.', $treenum) . ' ' . htmlspecialchars($matches[2][$i]) . '</a>'; |
75 $prev = $head; |
84 $prev = $head; |
76 } |
85 } |
77 while ( $levels > 0 ) |
86 while ( $levels > 0 ) |
78 { |
87 { |
79 $toc .= '</dd></dl>'; |
88 $toc .= '</dd></dl>'; |