Sorry about that, wasn't really paying attention.
Originally Posted by doubledee
1. This mostly depends on the site and what it's for. For instance, CodingForums is important to have the CODE, ICODE, and PHP tags simply due to the fact that its for programming and syntax highlighting is a big help in assisting others. The main tags I'd consider would be for the following styling:
- Bold, Italicized, and underlining; Perhaps strike-through, subscript, and superscript
- URL hot-linking
- Image embedding
- Different font sizes
These are just a few things that would be helpful and can all be accomplished in a different way.
3. As for making them, I've never done it before but I have played with SimpleMachine's BBC settings to create a few custom tags just to try it out. My bet would be that
preg_replace() would be the best function to use. You could start with creating basic mods, such as bold. For example:
That's just a small demonstration, you can add more to the list and the more you do the more complicated it could be. I'm sure you could find a small set of premade BBC online. If you want it to match your site's template more you can simply just replace it with extra html code and such around it.
$patterns = array();
$replacements = array();
$text = '[u]This[/u] is a [b]user\'s[/b] [i]input[/i].';
#### Start patterns and replacements ####
$patterns = '/\[b\]([\w\W]*)\[\/b\]/';
$replacements = '<b>$1</b>';
$patterns = '/\[i\]([\w\W]*)\[\/i\]/';
$replacements = '<i>$1</i>';
$patterns = '/\[u\]([\w\W]*)\[\/u\]/';
$replacements = '<u>$1</u>';
$new_text = preg_replace($patterns, $replacements, $text);
echo $new_text; //Should print '<u>This</u> is a <b>user\'s</b> <i>input</i>.'
Now of course there is a way to combine bold, italics, and underline into one regex, but then you wouldn't be able to turn only one on and off without either making a long switch of cases or modifying the code to include it or not so keeping it separate won't be that bad either. You could also just to a
str_replace() of the data, but then you run into an issue if a user doesn't include both parts (unclosed tags, etc.)