1<?php
2/**
3 * DokuWiki Plugin fblike (Syntax Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Scott <fbl@scotthewitt.co.uk>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) die();
11
12if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
13if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
14if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
15
16require_once DOKU_PLUGIN.'syntax.php';
17
18class syntax_plugin_fbsp_fbcomment extends DokuWiki_Syntax_Plugin {
19    function getType() {
20        return 'substition';
21    }
22
23    function getPType() {
24        return 'normal';
25    }
26
27    function getSort() {
28        return FIXME;
29    }
30
31
32    function connectTo($mode) {
33        $this->Lexer->addSpecialPattern('<fbc>',$mode,'plugin_fbsp_fbcomment');
34//        $this->Lexer->addEntryPattern('<FIXME>',$mode,'plugin_fbsp_fbcomment');
35    }
36
37//    function postConnect() {
38//        $this->Lexer->addExitPattern('</FIXME>','plugin_fbsp_fbcomment');
39//    }
40
41    function handle($match, $state, $pos, &$handler){
42        $data = array();
43
44        return $data;
45    }
46
47    function render($mode, &$renderer, $data) {
48        if($mode != 'xhtml') return false;
49			$renderer->doc .= "<html>
50<div id=\"fb-root\"></div>
51<script>
52  window.fbAsyncInit = function() {
53    FB.init({appId: 'your app id', status: true, cookie: true,
54             xfbml: true});
55  };
56  (function() {
57    var e = document.createElement('script'); e.async = true;
58    e.src = document.location.protocol +
59      '//connect.facebook.net/en_US/all.js';
60    document.getElementById('fb-root').appendChild(e);
61  }());
62  </script>
63<fb:comments></fb:comments>
64</html>";
65        return true;
66    }
67}
68
69// vim:ts=4:sw=4:et:enc=utf-8:
70?>