1 (edited by colak 2016-02-02 07:25)

Topic: add html tags on BBCode

I am trying to add a couple of html tags to the BBCode. Based on previous versions of punBB I created the manifest.xml file below but the tags do not seem to be parsing and they still appear in their square brackets in the posts. Does anyone have an idea as to what I am doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
 * BBCode [del][/del] extension for PunBB forum
 * A new BBcode tag to del text.
 *
 * @author NeMe - http://www.neme.org
 * @license GPL - http://www.gnu.org/copyleft/gpl.html
 * @package pun_bbcode_del
 */
-->

<extension engine="1.0">
<id>pun_bbcode_del</id>
<title>BBCode [del][/del]</title>
<version>0.1</version>
<description>BBcode tags to delete out text, insert text and add horizontal rules.</description>
<author>NeMe - http://www.neme.org</author>
<minversion>1.3</minversion>
<maxtestedon>2</maxtestedon>

<hooks>
<hook id="ps_start"><![CDATA[

// tag handling function
function handle_del_tag($inputText) {
return '<del>'.$inputText.'</del>';
}

]]></hook>

<hook id="ps_preparse_tags_start"><![CDATA[

// add our tag to the list
$tags[] = 'del';
$tags_opened[] = 'del';
$tags_closed[] = 'del';
$tags_inline[] = 'del';
$tags_trim[] = 'del';

]]></hook>


<hook id="ps_do_bbcode_replace">

<![CDATA[

$pattern[] = '#\[hr /\]#i';
$replace[] = '</p><hr/><p>';
// add pattern to catch [del]blahblah[/del]
$pattern[] = '#\[del\](.*?)\[/del\]#se';
$replace[] = 'handle_del_tag(\'$1\')';

]]></hook>
</hooks>
</extension>

ps. This is the error I get: Warning: preg_replace_callback() [function.preg-replace-callback]: Modifier /e cannot be used with replacement callback in /path/to/my/forum/include/parser.php on line 811

forum, Art, Architecture

Did you visit the textpattern forum?

2 (edited by PanBB.Ru 2016-02-24 10:59)

Re: add html tags on BBCode

You only need to do two tags ? See how it's done in this http://punbb.informer.com/forums/topic/ … -reply-pm/

PS:
Modifier /e cannot be used with replacement callback.
See manual:
http://php.net/manual/en/reference.pcre … ifiers.php