Topic: [request (debug help)] BBcode [center][/center]
[center]I saw a reference to this in another thread, but no explicit request.[/center]
I peeked at Neck's [video] extension and made liberal use of copy/paste to end up with the following code:
Update (Slavok's edit, plus my own):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<!--
/**
* BBCode [center][/center] extension for PunBB forum
* A new BBcode tag to center text.
*
* @author whatrevolution - http://www.honestlyillustrated.com
* @license GPL - http://www.gnu.org/copyleft/gpl.html
* @package pun_bbcode_center
*/
-->
<extension engine="1.0">
<id>bbcode_center</id>
<title>BBCode [center][/center]</title>
<version>0.1.1</version>
<description>A new BBcode tag to center text.</description>
<author>whatrevolution - http://www.honestlyillustrated.com</author>
<minversion>1.3</minversion>
<maxtestedon>1.3.1</maxtestedon>
<hooks>
<hook id="ps_start"><![CDATA[
// tag handling function
function handle_center_tag($inputText) {
return '<div style="text-align:center;">'.$inputText.'</div>';
}
]]></hook>
<hook id="ps_preparse_tags_start"><![CDATA[
// add our tag to the list
$tags[] = 'center';
$tags_opened[] = 'center';
$tags_closed[] = 'center';
// $tags_inline[] = 'center';
// $tags_trim[] = 'center';
]]></hook>
<hook id="ps_do_bbcode_replace"><![CDATA[
// add pattern to catch [center]blahblah[/center]
$pattern[] = '#\[center\](.*?)\[/center\]#se';
$replace[] = 'handle_center_tag(\'$1\')';
]]></hook>
</hooks>
</extension>