hackerbase/dokuwiki/syntax.php

41 lines
1.2 KiB
PHP

<?php
/**
* Plugin HackerBase: Inserts SpaceAPI-based open/closed info
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Dominik Pantůček <dominik.pantucek@trustica.cz>
*/
// must be run within DokuWiki
if(!defined('DOKU_INC')) die();
require_once("common.php");
/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_hackerbase extends DokuWiki_Syntax_Plugin {
public function getType() { return 'substition'; }
public function getSort() { return 32; }
public function connectTo($mode) {
$this->Lexer->addSpecialPattern('\[BRMDOOR\]',$mode,'plugin_hackerbase');
}
public function handle($match, $state, $pos, Doku_Handler $handler) {
return array($match, $state, $pos);
}
public function render($mode, Doku_Renderer $renderer, $data) {
// $data is what the function handle return'ed.
if($mode == 'xhtml'){
$spaceapi_status_json = $this->getConf("spaceapijson");
$status = hackerbase_spaceapi_html_snippet($spaceapi_status_json);
$renderer->doc .= $status;
return true;
}
return false;
}
}