PDA

View Full Version : html to bbcode addon in making..


Michael.A
08-09-2010, 07:22 PM
most of my member they use html is there post (( <a href= , </a> ))
so i decided to make an add-on for this but i real dont know where shod i be looking

i need to know what hook name do i use?
and what php code do i run in post before its saves the post?

function make_bbcode($normal)
{
$samurl=str_replace(“<a href=”, “[url=", $normal);
$samurl=str_replace("</a>", "[/url]“, $samurl);
$samurl=str_replace(“>”, “]”, $samurl);
return($samurl);
}

kh99
08-09-2010, 08:37 PM
You could maybe use the hook 'bbcode_parse_start', and then the text would be in the variable $parsedtext (see includes/class_bbcode.php around line 360). There's also a variable $dohtml that says whether or not html is enabled in a specific area, so you could do this:

if (!$dohtml) {
$parsedtext = // do your replacement
}

so that if you ever *did* have html enabled, you wouldn't perform your replacement.

(BTW, I haven't tried this)