*/ // must be run within Dokuwiki if (!defined('DOKU_INC')) die(); //constants if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); class helper_plugin_authorlist extends DokuWiki_Plugin { protected $authors = array(); // Contributors-Array (loginname => fullname) // ID for the page, the authors should be diesplayed. Not implemented yet, you can't choose another // page, can only handle the current rendered page. But maybe later. protected $pageID; protected $output; protected $displaystyle; // loginname/fullname or both protected $displayaslist; // List or everything in one line? protected $tooltip; // none, username or fullname. protected $linkto; // can be none, userpage, eMail protected $showheading; // We want a heading? protected $showcreator; // show Creator separat // Can't be set using ~~AUTHORS~~ only via adminmenu protected $creatortext; // template for the creatortext (contains %CREATOR% and %DATE% as wildcard) protected $intro; // text before authorlist. protected $userpageid; // Template for the pageID of the userhomepages (contains %USER% as wildcard for the loginname) // Some state variables private $cssClass; // classes author, authoruserpage, authoremail are possible depending on the displaystyle. private $openTag; //
  • or private $closeTag; //
  • or private $printempty; // Print everything even if the authorlist is empty private $creatorisauthor; // creator in the authorlist. /** * Constructor gets default preferences (calling setOptions(...)) */ public function __construct() { global $INFO; // This options can only set using the admin menu. Because you can use html-Syntax for this options. $this->creatortext = $this->getConf('creatortext'); $this->intro = $this->getConf('intro'); $this->userpageid = $this->getConf('userpageid'); $this->linkto = $this->getConf('linkto'); $this->showheading = $this->getConf('showheading'); $this->setOptions($INFO['id'] , null); // set default options } /** * Set the options. * * @param $pageID String The page the authorlist should be displayed for. (Not implemented yet, only the current rendered page will be handled) * @param $data Array Optionsarray (option => value) */ public function setOptions($pageID, $data){ $this->output=''; $this->pageID = $pageID; $options = array('displayaslist','displaystyle','tooltip','showcreator','printempty', 'creatorisauthor');// possible options foreach($options as $option){ if(isset($data[$option])){ $this->$option = $data[$option]; }else{ $this->$option = $this->getConf($option); } } // find right css-class (author, authoeruserpage, authoremail -> see *.css), sets state variables $this->cssClass $this->findCssClass(); // sets state variables $this->openTag, This->closeTag $this->findOpenAndCloseTags(); } /** * Renders the heading */ public function renderHeading(){ // heading? if($this->showheading) $this->output .= "

    ".strip_tags($this->getConf('heading'))."

    ".DOKU_LF; return true; } /** * Starts to render the authorlist: Creatortext,
    and maybe