ICode - An Accessible BBCode Alternitive - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Programming > PHP » ICode - An Accessible BBCode Alternitive


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-23-2006   #1 (permalink)
Jamie
Senior Member
 
Jamie's Avatar
 
Join Date: Jul 2006
Location: Swansea, Wales, UK
Age: 20
Posts: 239
Default ICode - An Accessible BBCode Alternitive

Another one for the Code Library: BBCode has been in common use on most forums for years, it is a way of allowing users to markup their posts witout using HTML. I have created a form of BBCode called ICCode, I created this version because I wanted to use BBCode not to markup users posts but to markup articles for a website

ICode includes the basic markup found in BBCode but also adds the sh tag for sub headings and the abbr tag for abbreviations. There are plans to add further tags later on. These additions make it far more accessible than traditional BBCode.


Code:
function ICode($str)
{
$str = htmlentities($str,ENT_NOQUOTES);
$simple_search = array(
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[p\](.*?)\[\/p\]/is',
'/\[sh\](.*?)\[\/sh\]/is',
'/\[list\](.*?)\[\/list\]/is',
'/\[item\](.*?)\[\/item\]/is',
'/\[img\=\"(.*?)\"\](.*?)\[\/img\]/is',
'/\[url\=\"(.*?)\"\](.*?)\[\/url\]/is',
'/\[abbr\=\"(.*?)\"\](.*?)\[\/abbr\]/is',
'/\[code\](.*?)\[\/code\]/is'
);

$simple_replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<u>$1</u>',
'<p>$1</p>',
'<h3>$1</h3>',
'<ul>$1</ul>',
'<li>$1</li>',
'<img src="$2" alt="$1"/>',
'<a href="$1">$2</a>',
'<abbr title="$1">$2</abbr>',
'<pre class="code">$1</pre>'
);

$str = preg_replace($simple_search,$simple_replace,$str);
return $str;
}
__________________
Jamie is offline   Reply With Quote


Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Building Accessible Sites Jamie Website Design 6 07-29-2006 02:07 PM


footer left
All times are GMT. The time now is 08:43 PM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

Car Credit | Xbox Mod Chip | Books | Mobile Phone | Credit Cards

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49