Skip to content
Snippets Groups Projects
  • Andreas Gohr's avatar
    b8595a66
    separated TOC from page · b8595a66
    Andreas Gohr authored
    This patch introduces a tpl_toc() function which can be used to freely place
    the Table of Contents in a template. When used, tpl_content should be called
    with a parameter of false to supress the automatic TOC placement.
    
    Note: if tpl_toc() us run *before* tpl_content(), TOCs will not work in the
    preview. A work around is to run tpl_content() in a output buffer first.
    
    This patch also adds a getTOC() function for admin plugins which allows plugin
    authors to put create their own TOC which will be placed correctly in the
    template. A convenience function html_mktocitem() is available.
    
    The config manager was adjusted to make ue of this new feature, but some bugs
    might remain.
    
    darcs-hash:20070805132405-7ad00-77d2c3cdf66cc62b2d408cc6580f938636a109af.gz
    b8595a66
    History
    separated TOC from page
    Andreas Gohr authored
    This patch introduces a tpl_toc() function which can be used to freely place
    the Table of Contents in a template. When used, tpl_content should be called
    with a parameter of false to supress the automatic TOC placement.
    
    Note: if tpl_toc() us run *before* tpl_content(), TOCs will not work in the
    preview. A work around is to run tpl_content() in a output buffer first.
    
    This patch also adds a getTOC() function for admin plugins which allows plugin
    authors to put create their own TOC which will be placed correctly in the
    template. A convenience function html_mktocitem() is available.
    
    The config manager was adjusted to make ue of this new feature, but some bugs
    might remain.
    
    darcs-hash:20070805132405-7ad00-77d2c3cdf66cc62b2d408cc6580f938636a109af.gz
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
admin.php 1.14 KiB
<?php
/**
 * Admin Plugin Prototype
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Christopher Smith <chris@jalakai.co.uk>
 */
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_INC.'inc/plugin.php');

/**
 * All DokuWiki plugins to extend the admin function
 * need to inherit from this class
 */
class DokuWiki_Admin_Plugin extends DokuWiki_Plugin {

    function getMenuText($language) {
        $menutext = $this->getLang('menu');
        if (!$menutext) {
            $info = $this->getInfo();
            $menutext = $info['name'].' ...';
        }
        return $menutext;
    }

    function getMenuSort() {
        return 1000;
    }

    function handle() {
        trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING);
    }

    function html() {
        trigger_error('html() not implemented in '.get_class($this), E_USER_WARNING);
    }

    function forAdminOnly() {
        return true;
    }

    function getTOC(){
        return array();
    }
}
//Setup VIM: ex: et ts=4 enc=utf-8 :