1<?php 2/** 3 * DokuWiki Plugin miniblog 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr <andi@splitbrain.org> (upstream) 7 * @author lainme <lainme993@gmail.com> 8 */ 9 10// must be run within Dokuwiki 11if (!defined('DOKU_INC')) die(); 12 13class syntax_plugin_miniblog_comment extends DokuWiki_Syntax_Plugin { 14 public function getType() { 15 return 'substition'; 16 } 17 18 public function getSort() { 19 return 380; 20 } 21 22 public function getPType() { 23 return 'block'; 24 } 25 26 public function connectTo($mode) { 27 $this->Lexer->addSpecialPattern('~~DISQUS~~', $mode, 'plugin_miniblog_comment'); 28 } 29 30 public function handle($match, $state, $pos, Doku_Handler $handler){ 31 return array(); 32 } 33 34 public function render($mode, Doku_Renderer $renderer, $data) { 35 global $ID; 36 global $INFO; 37 38 if ($mode != 'xhtml') return false; 39 40 $source = 'embed.js'; 41 $option = array( 42 'disqus_shortname' => $this->getConf('shortname'), 43 'disqus_title' => addslashes($INFO['meta']['title']), 44 'disqus_url' => wl($ID, '', true), 45 'disqus_identifier' => $ID, 46 ); 47 48 $renderer->doc .= '<div id="disqus_thread"></div>'; 49 $renderer->doc .= plugin_load('helper', 'miniblog_comment')->comment_script($source, $option); 50 51 return true; 52 } 53} 54