1

Topic: BBCode Limit?

I have aded 2 custom BBCodes to my PARSER.PHP file making to total amount of BBCodes to 10, but when i add anyone i get this error:

Warning: Compilation failed: nothing to repeat at offset 10 in c:\program files\app serv\www\include\parser.php on line 227
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------

Re: BBCode Limit?

What's on your line 227 then?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: BBCode Limit?

Line 227

$message = preg_replace($pattern, $replace, $message);

---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------

4

Re: BBCode Limit?

Line 220 - 230

'<table style="filter:(glowcolor=$1, strength=4)">$2</table>',
                    '<table style="filter:flipH">$1</table>');




    // This thing takes a while! smile
    $message = preg_replace($pattern, $replace, $message);

    if (strpos($message, 'quote') !== false)
    {

---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------

Re: BBCode Limit?

The error message means there's something wrong with your regex patterns. Could you post them as well?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

6

Re: BBCode Limit?

I cant post it cuz i get an error (The BBCode syntax in the message is incorrect. Missing one or more end tags for

.) so i've uploaded it in a TXT file here.

---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------

Re: BBCode Limit?

I mean the source code. The additions to the code you did to add the new BBCodes.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

8

Re: BBCode Limit?

I just added:

'#\[google\](.*?)\[/google\]#',

Then i added:

'<a href="http://www.google.com/search?=$1" target="_blank"><img src="./images/google.gif" border="0"></a>',


Is that what you mean?

---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------

Re: BBCode Limit?

You said you added 2 custom BBCodes?

Could you post the $pattern and replace $replace arrays? I mean the source code for them.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

10

Re: BBCode Limit?

erm... im still not sure what you mean so heres the $pattern section...

$pattern = array('#\[b\](.*?)\[/b\]#s',
                    '#\[i\](.*?)\[/i\]#s',
                    '#\[u\](.*?)\[/u\]#s',
                    '#\[url\](.*?)\[/url\]#e',
                    '#\[url=(.*?)\](.*?)\[/url\]#e',
                    '#\[email\](.*?)\[/email\]#',
                    '#\[email=(.*?)\](.*?)\[/email\]#',
                    '#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
                    '#\[google\](.*?)\[/google\]#',
                    '#\[glow=(.*?)\](.*?)\[/glow\]#',
                    '#\[fliph\](*.?)\[/fliph\]#');

... and heres the $replace code block...

$replace = array('<strong>$1</strong>',
                    '<em>$1</em>',
                    '<u>$1</u>',
                    'truncate_url(\'$1\')',
                    'truncate_url(\'$1\', \'$2\')',
                    '<a href="mailto:$1">$1</a>',
                    '<a href="mailto:$1">$2</a>',
                    '<span style="color:$1">$2</span>',
                    '<a href="http://www.google.com/search?=$1" target="_blank"><img src="./images/google.gif" border="0"></a>',
                    '<table style="filter:(glowcolor=$1, strength=4)">$2</table>',
                    '<table style="filter:flipH">$1</table>');

... Hope thats it.. if not i'll upload the "include/parser.php" file.

---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------
---------> PLEASE REMEMBER I GOT THE FIRST EVER POST OF PUNBB 1.1! <---------

Posts: 10

Pages 1

You must login or register to post a reply

PunBB Forums → PunBB 1.2 discussion → BBCode Limit?