plugins/code-for-comments: CommentsBBCode_code.jplug.php

File CommentsBBCode_code.jplug.php, 1.1 KB (added by driehle, 2 years ago)
Line 
1<?php
2/**
3 * @name:        CommentsBBCode_code <http://jeenaparadies.net/webdesign/jlog/doc/index.php?n=Plugins.CommentsBBCodeCode>
4 * @author:      Jeena Paradies <jlog@jeenaparadies.net>
5 * @version:     1.0
6 * @date:        2005-01-11
7 */
8
9class CommentsBBCode_code extends JlogPlugin {
10
11    function hook_bbccomments() {
12    global $bbcomments;
13
14        $bbcomments->addCode ('code', 'simple_replace', null, array('start_tag' => '<pre class="code">',
15                              'end_tag' => "</pre>\n"), 'pre', array('block'), array('inline', 'link'));
16
17        $bbcomments->addParser ('pre', 'htmlspecialchars');
18        $bbcomments->setCodeFlag ('code', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
19
20        return $bbcomments;
21    }
22
23    function hook_commentForm($form) {
24        return "
25        <script type='text/javascript'>
26         addLoadEvent(
27          function () {
28           if(jlog_bbcode_br || (typeof(jlog_admin) != 'undefined'))
29            if (jlog_bbcode_br.insertBefore)
30             jlog_bbcode_do_button('Code', '[code]', '[/code]');
31          }
32         );
33        </script>" . $form;
34    }
35}
36?>