BBCodeLibrary

The bbPress BBCodeLibrary class.

Defined (1)

The class is defined in the following location(s).

/includes/admin/parser.php  
  1. class BBCodeLibrary { 
  2. var $default_smileys = Array( 
  3. ':)' => 'smile.gif', ':-)' => 'smile.gif',  
  4. '=)' => 'smile.gif', '=-)' => 'smile.gif',  
  5. ':(' => 'frown.gif', ':-(' => 'frown.gif',  
  6. '=(' => 'frown.gif', '=-(' => 'frown.gif',  
  7. ':D' => 'bigsmile.gif', ':-D' => 'bigsmile.gif',  
  8. '=D' => 'bigsmile.gif', '=-D' => 'bigsmile.gif',  
  9. '>:('=> 'angry.gif', '>:-('=> 'angry.gif',  
  10. '>=('=> 'angry.gif', '>=-('=> 'angry.gif',  
  11. 'D:' => 'angry.gif', 'D-:' => 'angry.gif',  
  12. 'D=' => 'angry.gif', 'D-=' => 'angry.gif',  
  13. '>:)'=> 'evil.gif', '>:-)'=> 'evil.gif',  
  14. '>=)'=> 'evil.gif', '>=-)'=> 'evil.gif',  
  15. '>:D'=> 'evil.gif', '>:-D'=> 'evil.gif',  
  16. '>=D'=> 'evil.gif', '>=-D'=> 'evil.gif',  
  17. '>;)'=> 'sneaky.gif', '>;-)'=> 'sneaky.gif',  
  18. '>;D'=> 'sneaky.gif', '>;-D'=> 'sneaky.gif',  
  19. 'O:)' => 'saint.gif', 'O:-)' => 'saint.gif',  
  20. 'O=)' => 'saint.gif', 'O=-)' => 'saint.gif',  
  21. ':O' => 'surprise.gif', ':-O' => 'surprise.gif',  
  22. '=O' => 'surprise.gif', '=-O' => 'surprise.gif',  
  23. ':?' => 'confuse.gif', ':-?' => 'confuse.gif',  
  24. '=?' => 'confuse.gif', '=-?' => 'confuse.gif',  
  25. ':s' => 'worry.gif', ':-S' => 'worry.gif',  
  26. '=s' => 'worry.gif', '=-S' => 'worry.gif',  
  27. ':|' => 'neutral.gif', ':-|' => 'neutral.gif',  
  28. '=|' => 'neutral.gif', '=-|' => 'neutral.gif',  
  29. ':I' => 'neutral.gif', ':-I' => 'neutral.gif',  
  30. '=I' => 'neutral.gif', '=-I' => 'neutral.gif',  
  31. ':/' => 'irritated.gif', ':-/' => 'irritated.gif',  
  32. '=/' => 'irritated.gif', '=-/' => 'irritated.gif',  
  33. ':\\' => 'irritated.gif', ':-\\' => 'irritated.gif',  
  34. '=\\' => 'irritated.gif', '=-\\' => 'irritated.gif',  
  35. ':P' => 'tongue.gif', ':-P' => 'tongue.gif',  
  36. '=P' => 'tongue.gif', '=-P' => 'tongue.gif',  
  37. 'X-P' => 'tongue.gif',  
  38. '8)' => 'bigeyes.gif', '8-)' => 'bigeyes.gif',  
  39. 'B)' => 'cool.gif', 'B-)' => 'cool.gif',  
  40. ';)' => 'wink.gif', ';-)' => 'wink.gif',  
  41. ';D' => 'bigwink.gif', ';-D' => 'bigwink.gif',  
  42. '^_^'=> 'anime.gif', '^^;' => 'sweatdrop.gif',  
  43. '>_>'=> 'lookright.gif', '>.>' => 'lookright.gif',  
  44. '<_<'=> 'lookleft.gif', '<.<' => 'lookleft.gif',  
  45. 'XD' => 'laugh.gif', 'X-D' => 'laugh.gif',  
  46. ';D' => 'bigwink.gif', ';-D' => 'bigwink.gif',  
  47. ':3' => 'smile3.gif', ':-3' => 'smile3.gif',  
  48. '=3' => 'smile3.gif', '=-3' => 'smile3.gif',  
  49. ';3' => 'wink3.gif', ';-3' => 'wink3.gif',  
  50. '<g>' => 'teeth.gif', '<G>' => 'teeth.gif',  
  51. 'o.O' => 'boggle.gif', 'O.o' => 'boggle.gif',  
  52. ':blue:' => 'blue.gif',  
  53. ':zzz:' => 'sleepy.gif',  
  54. '<3' => 'heart.gif',  
  55. ':star:' => 'star.gif',  
  56. ); 
  57. var $default_tag_rules = Array( 
  58. 'b' => Array( 
  59. 'simple_start' => "<b>",  
  60. 'simple_end' => "</b>",  
  61. 'class' => 'inline',  
  62. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  63. 'plain_start' => "<b>",  
  64. 'plain_end' => "</b>",  
  65. ),  
  66. 'i' => Array( 
  67. 'simple_start' => "<i>",  
  68. 'simple_end' => "</i>",  
  69. 'class' => 'inline',  
  70. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  71. 'plain_start' => "<i>",  
  72. 'plain_end' => "</i>",  
  73. ),  
  74. 'u' => Array( 
  75. 'simple_start' => "<u>",  
  76. 'simple_end' => "</u>",  
  77. 'class' => 'inline',  
  78. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  79. 'plain_start' => "<u>",  
  80. 'plain_end' => "</u>",  
  81. ),  
  82. 's' => Array( 
  83. 'simple_start' => "<strike>",  
  84. 'simple_end' => "</strike>",  
  85. 'class' => 'inline',  
  86. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  87. 'plain_start' => "<i>",  
  88. 'plain_end' => "</i>",  
  89. ),  
  90. 'font' => Array( 
  91. 'mode' => BBCODE_MODE_LIBRARY,  
  92. 'allow' => Array('_default' => '/^[a-zA-Z0-9._ -]+$/'),  
  93. 'method' => 'DoFont',  
  94. 'class' => 'inline',  
  95. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  96. ),  
  97. 'color' => Array( 
  98. 'mode' => BBCODE_MODE_ENHANCED,  
  99. 'allow' => Array('_default' => '/^#?[a-zA-Z0-9._ -]+$/'),  
  100. 'template' => '<span style="color:{$_default/tw}">{$_content/v}</span>',  
  101. 'class' => 'inline',  
  102. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  103. ),  
  104. 'size' => Array( 
  105. 'mode' => BBCODE_MODE_LIBRARY,  
  106. 'allow' => Array('_default' => '/^[0-9.]+$/D'),  
  107. 'method' => 'DoSize',  
  108. 'class' => 'inline',  
  109. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  110. ),  
  111. 'sup' => Array( 
  112. 'simple_start' => "<sup>",  
  113. 'simple_end' => "</sup>",  
  114. 'class' => 'inline',  
  115. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  116. ),  
  117. 'sub' => Array( 
  118. 'simple_start' => "<sub>",  
  119. 'simple_end' => "</sub>",  
  120. 'class' => 'inline',  
  121. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  122. ),  
  123. 'spoiler' => Array( 
  124. 'simple_start' => "<span class=\"bbcode_spoiler\">",  
  125. 'simple_end' => "</span>",  
  126. 'class' => 'inline',  
  127. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  128. ),  
  129. 'acronym' => Array( 
  130. 'mode' => BBCODE_MODE_ENHANCED,  
  131. 'template' => '<span class="bbcode_acronym" title="{$_default/e}">{$_content/v}</span>',  
  132. 'class' => 'inline',  
  133. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  134. ),  
  135. 'url' => Array( 
  136. 'mode' => BBCODE_MODE_LIBRARY,  
  137. 'method' => 'DoURL',  
  138. 'class' => 'link',  
  139. 'allow_in' => Array('listitem', 'block', 'columns', 'inline'),  
  140. 'content' => BBCODE_REQUIRED,  
  141. 'plain_start' => "<a href=\"{\$link}\">",  
  142. 'plain_end' => "</a>",  
  143. 'plain_content' => Array('_content', '_default'),  
  144. 'plain_link' => Array('_default', '_content'),  
  145. ),  
  146. 'email' => Array( 
  147. 'mode' => BBCODE_MODE_LIBRARY,  
  148. 'method' => 'DoEmail',  
  149. 'class' => 'link',  
  150. 'allow_in' => Array('listitem', 'block', 'columns', 'inline'),  
  151. 'content' => BBCODE_REQUIRED,  
  152. 'plain_start' => "<a href=\"mailto:{\$link}\">",  
  153. 'plain_end' => "</a>",  
  154. 'plain_content' => Array('_content', '_default'),  
  155. 'plain_link' => Array('_default', '_content'),  
  156. ),  
  157. 'wiki' => Array( 
  158. 'mode' => BBCODE_MODE_LIBRARY,  
  159. 'method' => "DoWiki",  
  160. 'class' => 'link',  
  161. 'allow_in' => Array('listitem', 'block', 'columns', 'inline'),  
  162. 'end_tag' => BBCODE_PROHIBIT,  
  163. 'content' => BBCODE_PROHIBIT,  
  164. 'plain_start' => "<b>[",  
  165. 'plain_end' => "]</b>",  
  166. 'plain_content' => Array('title', '_default'),  
  167. 'plain_link' => Array('_default', '_content'),  
  168. ),  
  169. 'img' => Array( 
  170. 'mode' => BBCODE_MODE_LIBRARY,  
  171. 'method' => "DoImage",  
  172. 'class' => 'image',  
  173. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  174. 'end_tag' => BBCODE_REQUIRED,  
  175. 'content' => BBCODE_REQUIRED,  
  176. 'plain_start' => "[image]",  
  177. 'plain_content' => Array(),  
  178. ),  
  179. 'rule' => Array( 
  180. 'mode' => BBCODE_MODE_LIBRARY,  
  181. 'method' => "DoRule",  
  182. 'class' => 'block',  
  183. 'allow_in' => Array('listitem', 'block', 'columns'),  
  184. 'end_tag' => BBCODE_PROHIBIT,  
  185. 'content' => BBCODE_PROHIBIT,  
  186. 'before_tag' => "sns",  
  187. 'after_tag' => "sns",  
  188. 'plain_start' => "\n-----\n",  
  189. 'plain_end' => "",  
  190. 'plain_content' => Array(),  
  191. ),  
  192. 'br' => Array( 
  193. 'mode' => BBCODE_MODE_SIMPLE,  
  194. 'simple_start' => "<br />\n",  
  195. 'simple_end' => "",  
  196. 'class' => 'inline',  
  197. 'allow_in' => Array('listitem', 'block', 'columns', 'inline', 'link'),  
  198. 'end_tag' => BBCODE_PROHIBIT,  
  199. 'content' => BBCODE_PROHIBIT,  
  200. 'before_tag' => "s",  
  201. 'after_tag' => "s",  
  202. 'plain_start' => "\n",  
  203. 'plain_end' => "",  
  204. 'plain_content' => Array(),  
  205. ),  
  206. 'left' => Array( 
  207. 'simple_start' => "\n<div class=\"bbcode_left\" style=\"text-align:left\">\n",  
  208. 'simple_end' => "\n</div>\n",  
  209. 'allow_in' => Array('listitem', 'block', 'columns'),  
  210. 'before_tag' => "sns",  
  211. 'after_tag' => "sns",  
  212. 'before_endtag' => "sns",  
  213. 'after_endtag' => "sns",  
  214. 'plain_start' => "\n",  
  215. 'plain_end' => "\n",  
  216. ),  
  217. 'right' => Array( 
  218. 'simple_start' => "\n<div class=\"bbcode_right\" style=\"text-align:right\">\n",  
  219. 'simple_end' => "\n</div>\n",  
  220. 'allow_in' => Array('listitem', 'block', 'columns'),  
  221. 'before_tag' => "sns",  
  222. 'after_tag' => "sns",  
  223. 'before_endtag' => "sns",  
  224. 'after_endtag' => "sns",  
  225. 'plain_start' => "\n",  
  226. 'plain_end' => "\n",  
  227. ),  
  228. 'center' => Array( 
  229. 'simple_start' => "\n<div class=\"bbcode_center\" style=\"text-align:center\">\n",  
  230. 'simple_end' => "\n</div>\n",  
  231. 'allow_in' => Array('listitem', 'block', 'columns'),  
  232. 'before_tag' => "sns",  
  233. 'after_tag' => "sns",  
  234. 'before_endtag' => "sns",  
  235. 'after_endtag' => "sns",  
  236. 'plain_start' => "\n",  
  237. 'plain_end' => "\n",  
  238. ),  
  239. 'indent' => Array( 
  240. 'simple_start' => "\n<div class=\"bbcode_indent\" style=\"margin-left:4em\">\n",  
  241. 'simple_end' => "\n</div>\n",  
  242. 'allow_in' => Array('listitem', 'block', 'columns'),  
  243. 'before_tag' => "sns",  
  244. 'after_tag' => "sns",  
  245. 'before_endtag' => "sns",  
  246. 'after_endtag' => "sns",  
  247. 'plain_start' => "\n",  
  248. 'plain_end' => "\n",  
  249. ),  
  250. 'columns' => Array( 
  251. 'simple_start' => "\n<table class=\"bbcode_columns\"><tbody><tr><td class=\"bbcode_column bbcode_firstcolumn\">\n",  
  252. 'simple_end' => "\n</td></tr></tbody></table>\n",  
  253. 'class' => 'columns',  
  254. 'allow_in' => Array('listitem', 'block', 'columns'),  
  255. 'end_tag' => BBCODE_REQUIRED,  
  256. 'content' => BBCODE_REQUIRED,  
  257. 'before_tag' => "sns",  
  258. 'after_tag' => "sns",  
  259. 'before_endtag' => "sns",  
  260. 'after_endtag' => "sns",  
  261. 'plain_start' => "\n",  
  262. 'plain_end' => "\n",  
  263. ),  
  264. 'nextcol' => Array( 
  265. 'simple_start' => "\n</td><td class=\"bbcode_column\">\n",  
  266. 'class' => 'nextcol',  
  267. 'allow_in' => Array('columns'),  
  268. 'end_tag' => BBCODE_PROHIBIT,  
  269. 'content' => BBCODE_PROHIBIT,  
  270. 'before_tag' => "sns",  
  271. 'after_tag' => "sns",  
  272. 'before_endtag' => "sns",  
  273. 'after_endtag' => "sns",  
  274. 'plain_start' => "\n",  
  275. 'plain_end' => "",  
  276. ),  
  277. 'code' => Array( 
  278. 'mode' => BBCODE_MODE_ENHANCED,  
  279. 'template' => "\n<div class=\"bbcode_code\">\n<div class=\"bbcode_code_head\">Code:</div>\n<div class=\"bbcode_code_body\" style=\"white-space:pre\">{\$_content/v}</div>\n</div>\n",  
  280. 'class' => 'code',  
  281. 'allow_in' => Array('listitem', 'block', 'columns'),  
  282. 'content' => BBCODE_VERBATIM,  
  283. 'before_tag' => "sns",  
  284. 'after_tag' => "sn",  
  285. 'before_endtag' => "sn",  
  286. 'after_endtag' => "sns",  
  287. 'plain_start' => "\n<b>Code:</b>\n",  
  288. 'plain_end' => "\n",  
  289. ),  
  290. 'quote' => Array( 
  291. 'mode' => BBCODE_MODE_LIBRARY,  
  292. 'method' => "DoQuote",  
  293. 'allow_in' => Array('listitem', 'block', 'columns'),  
  294. 'before_tag' => "sns",  
  295. 'after_tag' => "sns",  
  296. 'before_endtag' => "sns",  
  297. 'after_endtag' => "sns",  
  298. 'plain_start' => "\n<b>Quote:</b>\n",  
  299. 'plain_end' => "\n",  
  300. ),  
  301. 'list' => Array( 
  302. 'mode' => BBCODE_MODE_LIBRARY,  
  303. 'method' => 'DoList',  
  304. 'class' => 'list',  
  305. 'allow_in' => Array('listitem', 'block', 'columns'),  
  306. 'before_tag' => "sns",  
  307. 'after_tag' => "sns",  
  308. 'before_endtag' => "sns",  
  309. 'after_endtag' => "sns",  
  310. 'plain_start' => "\n",  
  311. 'plain_end' => "\n",  
  312. ),  
  313. '*' => Array( 
  314. 'simple_start' => "<li>",  
  315. 'simple_end' => "</li>\n",  
  316. 'class' => 'listitem',  
  317. 'allow_in' => Array('list'),  
  318. 'end_tag' => BBCODE_OPTIONAL,  
  319. 'before_tag' => "s",  
  320. 'after_tag' => "s",  
  321. 'before_endtag' => "sns",  
  322. 'after_endtag' => "sns",  
  323. 'plain_start' => "\n * ",  
  324. 'plain_end' => "\n",  
  325. ),  
  326. ); 
  327. function DoURL($bbcode, $action, $name, $default, $params, $content) { 
  328. if ($action == BBCODE_CHECK) return true; 
  329. $url = is_string($default) ? $default : $bbcode->UnHTMLEncode(strip_tags($content)); 
  330. if ($bbcode->IsValidURL($url)) { 
  331. if ($bbcode->debug) 
  332. print "ISVALIDURL<br />"; 
  333. if ($bbcode->url_targetable !== false && isset($params['target'])) 
  334. $target = " target=\"" . htmlspecialchars($params['target']) . "\""; 
  335. else $target = ""; 
  336. if ($bbcode->url_target !== false) 
  337. if (!($bbcode->url_targetable == 'override' && isset($params['target']))) 
  338. $target = " target=\"" . htmlspecialchars($bbcode->url_target) . "\""; 
  339. return '<a href="' . htmlspecialchars($url) . '" class="bbcode_url"' . $target . '>' . $content . '</a>'; 
  340. else return htmlspecialchars($params['_tag']) . $content . htmlspecialchars($params['_endtag']); 
  341. function DoEmail($bbcode, $action, $name, $default, $params, $content) { 
  342. if ($action == BBCODE_CHECK) return true; 
  343. $email = is_string($default) ? $default : $bbcode->UnHTMLEncode(strip_tags($content)); 
  344. if ($bbcode->IsValidEmail($email)) 
  345. return '<a href="mailto:' . htmlspecialchars($email) . '" class="bbcode_email">' . $content . '</a>'; 
  346. else return htmlspecialchars($params['_tag']) . $content . htmlspecialchars($params['_endtag']); 
  347. function DoSize($bbcode, $action, $name, $default, $params, $content) { 
  348. switch ($default) { 
  349. case '0': $size = '.5em'; break; 
  350. case '1': $size = '.67em'; break; 
  351. case '2': $size = '.83em'; break; 
  352. default: 
  353. case '3': $size = '1.0em'; break; 
  354. case '4': $size = '1.17em'; break; 
  355. case '5': $size = '1.5em'; break; 
  356. case '6': $size = '2.0em'; break; 
  357. case '7': $size = '2.5em'; break; 
  358. return "<span style=\"font-size:$size\">$content</span>"; 
  359. function DoFont($bbcode, $action, $name, $default, $params, $content) { 
  360. $fonts = explode(", ", $default); 
  361. $result = ""; 
  362. $special_fonts = Array( 
  363. 'serif' => 'serif',  
  364. 'sans-serif' => 'sans-serif',  
  365. 'sans serif' => 'sans-serif',  
  366. 'sansserif' => 'sans-serif',  
  367. 'sans' => 'sans-serif',  
  368. 'cursive' => 'cursive',  
  369. 'fantasy' => 'fantasy',  
  370. 'monospace' => 'monospace',  
  371. 'mono' => 'monospace',  
  372. ); 
  373. foreach ($fonts as $font) { 
  374. $font = trim($font); 
  375. if (isset($special_fonts[$font])) { 
  376. if (strlen($result) > 0) $result .= ", "; 
  377. $result .= $special_fonts[$font]; 
  378. else if (strlen($font) > 0) { 
  379. if (strlen($result) > 0) $result .= ", "; 
  380. $result .= "'$font'"; 
  381. return "<span style=\"font-family:$result\">$content</span>"; 
  382. function DoWiki($bbcode, $action, $name, $default, $params, $content) { 
  383. $name = $bbcode->Wikify($default); 
  384. if ($action == BBCODE_CHECK) 
  385. return strlen($name) > 0; 
  386. $title = trim(@$params['title']); 
  387. if (strlen($title) <= 0) $title = trim($default); 
  388. return "<a href=\"{$bbcode->wiki_url}$name\" class=\"bbcode_wiki\">" 
  389. . htmlspecialchars($title) . "</a>"; 
  390. function DoImage($bbcode, $action, $name, $default, $params, $content) { 
  391. if ($action == BBCODE_CHECK) return true; 
  392. $content = trim($bbcode->UnHTMLEncode(strip_tags($content))); 
  393. if (preg_match("/\\.(?:gif|jpeg|jpg|jpe|png)$/", $content)) { 
  394. if (preg_match("/^[a-zA-Z0-9_][^:]+$/", $content)) { 
  395. if (!preg_match("/(?:\\/\\.\\.\\/)|(?:^\\.\\.\\/)|(?:^\\/)/", $content)) { 
  396. $info = @getimagesize("{$bbcode->local_img_dir}/{$content}"); 
  397. if ($info[2] == IMAGETYPE_GIF || $info[2] == IMAGETYPE_JPEG || $info[2] == IMAGETYPE_PNG) { 
  398. return "<img src=\"" 
  399. . htmlspecialchars("{$bbcode->local_img_url}/{$content}") . "\" alt=\"" 
  400. . htmlspecialchars(basename($content)) . "\" width=\"" 
  401. . htmlspecialchars($info[0]) . "\" height=\"" 
  402. . htmlspecialchars($info[1]) . "\" class=\"bbcode_img\" />"; 
  403. else if ($bbcode->IsValidURL($content, false)) { 
  404. return "<img src=\"" . htmlspecialchars($content) . "\" alt=\"" 
  405. . htmlspecialchars(basename($content)) . "\" class=\"bbcode_img\" />"; 
  406. return htmlspecialchars($params['_tag']) . htmlspecialchars($content) . htmlspecialchars($params['_endtag']); 
  407. function DoRule($bbcode, $action, $name, $default, $params, $content) { 
  408. if ($action == BBCODE_CHECK) return true; 
  409. else return $bbcode->rule_html; 
  410. function DoQuote($bbcode, $action, $name, $default, $params, $content) { 
  411. if ($action == BBCODE_CHECK) return true; 
  412. if (isset($params['name'])) { 
  413. $title = htmlspecialchars(trim($params['name'])) . " wrote"; 
  414. if (isset($params['date'])) 
  415. $title .= " on " . htmlspecialchars(trim($params['date'])); 
  416. $title .= ":"; 
  417. if (isset($params['url'])) { 
  418. $url = trim($params['url']); 
  419. if ($bbcode->IsValidURL($url)) 
  420. $title = "<a href=\"" . htmlspecialchars($params['url']) . "\">" . $title . "</a>"; 
  421. else if (!is_string($default)) 
  422. $title = "Quote:"; 
  423. else $title = htmlspecialchars(trim($default)) . " wrote:"; 
  424. return "\n<div class=\"bbcode_quote\">\n<div class=\"bbcode_quote_head\">" 
  425. . $title . "</div>\n<div class=\"bbcode_quote_body\">" 
  426. . $content . "</div>\n</div>\n"; 
  427. function DoList($bbcode, $action, $name, $default, $params, $content) { 
  428. $list_styles = Array( 
  429. '1' => 'decimal',  
  430. '01' => 'decimal-leading-zero',  
  431. 'i' => 'lower-roman',  
  432. 'I' => 'upper-roman',  
  433. 'a' => 'lower-alpha',  
  434. 'A' => 'upper-alpha',  
  435. ); 
  436. $ci_list_styles = Array( 
  437. 'circle' => 'circle',  
  438. 'disc' => 'disc',  
  439. 'square' => 'square',  
  440. 'greek' => 'lower-greek',  
  441. 'armenian' => 'armenian',  
  442. 'georgian' => 'georgian',  
  443. ); 
  444. $ul_types = Array( 
  445. 'circle' => 'circle',  
  446. 'disc' => 'disc',  
  447. 'square' => 'square',  
  448. ); 
  449. $default = trim($default); 
  450. if ($action == BBCODE_CHECK) { 
  451. if (!is_string($default) || strlen($default) == "") return true; 
  452. else if (isset($list_styles[$default])) return true; 
  453. else if (isset($ci_list_styles[strtolower($default)])) return true; 
  454. else return false; 
  455. if (!is_string($default) || strlen($default) == "") { 
  456. $elem = 'ul'; 
  457. $type = ''; 
  458. else if ($default == '1') { 
  459. $elem = 'ol'; 
  460. $type = ''; 
  461. else if (isset($list_styles[$default])) { 
  462. $elem = 'ol'; 
  463. $type = $list_styles[$default]; 
  464. else { 
  465. $default = strtolower($default); 
  466. if (isset($ul_types[$default])) { 
  467. $elem = 'ul'; 
  468. $type = $ul_types[$default]; 
  469. else if (isset($ci_list_styles[$default])) { 
  470. $elem = 'ol'; 
  471. $type = $ci_list_styles[$default]; 
  472. if (strlen($type)) 
  473. return "\n<$elem class=\"bbcode_list\" style=\"list-style-type:$type\">\n$content</$elem>\n"; 
  474. else return "\n<$elem class=\"bbcode_list\">\n$content</$elem>\n";