Well actually, since I didn't want people to have to mess with installing the Pear libraries and include paths and whatever, I went through the Pear BBCode library and got rid of all that stuff (it didn't do much to begin with anyway), ripped out the plugin filter framework, and included the whole thing with the bbcode extension. It hadn't been updated since 2004, so I figured there wasn't much risk involved in modifying it.
If you happen to be a Regular Expression Mastah, you can make the syntax pretty much anything you want. The tag definition is pretty straightforward, and there is a preparse function that runs a bunch of regexes for situations when the HTML syntax doesn't match the bbcode tag for tag.
I'm strongly considering adding a postparse function to make changes to the HTML after it's been parsed (necessary for the Youtube tag among others). Alternately, you can just do that in the default.php file after the parsed string is returned.
Well, php tries to use /usr/local/share/pear/BBCodeParser.php and not extensions/BetterBBCode/BBCodeParser.php. Because in my case with my initial setting, it fails to open it I have a white page instead of the forum.
"PHP Warning: main() [< a href='function.main'>function.main]: open_basedir restriction in effect. File(/usr/local/share/pear/BBCodeParser.php) is not within the allowed path(s): (/var/www/) in /var/www/htdocs/extensions/BetterBBCode/default.php on line 11..."
"PHP Fatal error: main() [< a href='function.require'>function.require]: Failed opening required 'BBCodeParser.php' (include_path='.:/usr/local/share/pear') in /var/www/htdocs/extensions/BetterBBCode/default.php on line 11..."
Edit 'default.php' to point to the correct BBCodeParser.php?
I just did that, still finding problems. Colour picker, fonts don't work, along with some other things.
I've noticed a stange thing with the extension, when you put [*] in the middle of a post, it goes totally crazy. Basically treating everything after the [*] as a new post. For instance, when you post this: "Just a test to see what happens. [*] This will be bumped down to a "new post"" then reply with just anything you get this: http://i21.photobucket.com/albums/b267/bjrn/betterbbcode.png
I'm trying to make a [thumb] addition to this, but I think I'm making the extension explode
Basically, you put [thumb] around an image url and it resizes it and gives a link to the full size. Its really handy when you have users posting a lot of say game screenshots and it doesn't break the whole forum.
This is the code I was trying 'thumb' => array( 'htmlopen' => 'a',
'allowed' => 'none^img',
'attributes' => array('url' => 'href=%2$s%1$s%2$s', 't' => 'target=%2$s%1$s%2$s'),
'htmlopen' => 'img',
'htmlclose' => '',
'allowed' => 'none',
'attributes' => array('img' => 'src=%2$s%1$s%2$s', 'w' => 'width=320', 'h' => 'height=240'),
'htmlclose' => 'a'),
Does it look like it makes sense?
It seems to not work, and I'm not sure if its the extension or my server but makes the page somewhat unresponsive.
Also, are there any fixes for the [url] tag? If a user say just does [url]test.com[/url] the link will end up being in reality like 'http://yourdomain.com/forum/test.com instead of just test.com
Any progress on this extension? I can confirm this [list] bug. It occured here at inkscape.forum.de
Has it been fixed? Maybe our admin just installed an older version. Was it updated recently?
Yesterday run into the [list] bug. Today looked at the code.
To bergamot: I strongly suggest you to not use ".*" and ".+" constructions in regular espressions. Please replace them with ".*?" and ".+?" wherever applicable.
To everybody else:
replace text in file "extensions/BetterBBCode/BBCodeParser.php at position 248 (in version 1.0),
instead of:
$pattern = array( "!".$oe."\*".$ce."(.*)!i",
"!".$oe."list".$ce."(.+)".$oe."/list".$ce."!isU");
it sould look like (notice added "?" signs):
$pattern = array( "!".$oe."\*".$ce."(.*?)!i",
"!".$oe."list".$ce."(.+?)".$oe."/list".$ce."!isU");
Bergamot, have you tried this?
http://lussumo.com/addons/index.php?PostBackAction=AddOn&AddOnID=157
I figure since you're the resident BBCode expert... :P
um, Aggtaa... those ? will break the regex. You see that "!isU" in there? the U is for ungreedy, which is exactly what adding ? after * or + does. if the ungreedy modifier is on, then ? makes those .* and .+ greedy instead. bad news.
but the ungreediness modifier is already in the regex, which means that the meaning of *? is reversed. instead of being ungreedy, that quantifier will now be greedy unless you take out the U.
I've been playing with the BBCode parser & BBinsert bar and they seem to both work great except for the list bug.
I personally changed my list items from [*] to [item] partially due to the * discussion above and partially for better readability -- my forum will have lo-tech people using it.
Any hopes of a bug fix or should we make a go of it ourselves?
Why hasn't the list bug been fixed? I thought BBCode is a good way to make users who come from vb, phpbb, invision, ... feel more comfortable with vanilla. Don't you think so? Or what syntax do you support within your vanilla boards? Text and html only?
Seriously, why is Bergamot not saying a few words? I thought this is the official support thread for the BetterBBCode extension. At least the ReadMe.txt states so. I'm really interested in getting this list bug fixed.
Can we expect an update to BetterBBCode extension anytime soon? Or is this extension not supported anymore?
I'd be interested in this one being fixed. I don't suppose someone with m4d c0d1nG sK1llz could post a patch that we could at least apply manually? Pretty please
Comments
If you set open_basedir, it need to include the path to Pear in it.
If you happen to be a Regular Expression Mastah, you can make the syntax pretty much anything you want. The tag definition is pretty straightforward, and there is a preparse function that runs a bunch of regexes for situations when the HTML syntax doesn't match the bbcode tag for tag.
I'm strongly considering adding a postparse function to make changes to the HTML after it's been parsed (necessary for the Youtube tag among others). Alternately, you can just do that in the default.php file after the parsed string is returned.
Because in my case with my initial setting, it fails to open it I have a white page instead of the forum.
then reply with just anything you get this: http://i21.photobucket.com/albums/b267/bjrn/betterbbcode.png
And a feature request, with "normal" BBCode (in phpBB), you can do things like this:
[quote="[url=http://www.example.com/an_article_about_bbcode.html]Bob[/url]"]You can do all sorts of crazy things with BBCode.[/quote]
Which would show up as
Bob wrote: I don't know how hard this would be to make, but I'd like to see this (if possible).
I'm trying to make a [thumb] addition to this, but I think I'm making the extension explode
Basically, you put [thumb] around an image url and it resizes it and gives a link to the full size. Its really handy when you have users posting a lot of say game screenshots and it doesn't break the whole forum.
This is the code I was trying
'thumb' => array( 'htmlopen' => 'a', 'allowed' => 'none^img', 'attributes' => array('url' => 'href=%2$s%1$s%2$s', 't' => 'target=%2$s%1$s%2$s'), 'htmlopen' => 'img', 'htmlclose' => '', 'allowed' => 'none', 'attributes' => array('img' => 'src=%2$s%1$s%2$s', 'w' => 'width=320', 'h' => 'height=240'), 'htmlclose' => 'a'),Does it look like it makes sense?
It seems to not work, and I'm not sure if its the extension or my server but makes the page somewhat unresponsive.
Also, are there any fixes for the [url] tag? If a user say just does [url]test.com[/url] the link will end up being in reality like 'http://yourdomain.com/forum/test.com instead of just test.com
those ? will break the regex. You see that "!isU" in there? the U is for ungreedy, which is exactly what adding ? after * or + does. if the ungreedy modifier is on, then ? makes those .* and .+ greedy instead. bad news.
at least i'm pretty sure that's how U works
Why hasn't the list bug been fixed? I thought BBCode is a good way to make users who come from vb, phpbb, invision, ... feel more comfortable with vanilla. Don't you think so? Or what syntax do you support within your vanilla boards? Text and html only?
At least the ReadMe.txt states so. I'm really interested in getting this list bug fixed.
Can we expect an update to BetterBBCode extension anytime soon? Or is this extension not supported anymore?
Cheers
Inkscape
Correction: I see he logged in on Nov 3rd.
OK, I'd love to see this changed (I'd like bbcode much better than HTML)