HTML_BBCodeParser
[ class tree: HTML_BBCodeParser ] [ index: HTML_BBCodeParser ] [ all elements ]

Source for file parser.php

Documentation is available at parser.php

  1. <?php
  2.  
  3. /* adjust include_path to include PEAR */
  4. ini_set('include_path'ini_get('include_path').':/usr/share/pear');
  5.  
  6. /* all your errors are belong to us */
  7.  
  8. /* require PEAR and the parser */
  9. require_once('PEAR.php');
  10. require_once('HTML/BBCodeParser.php');
  11.  
  12. /* get options from the ini file */
  13. $config parse_ini_file('BBCodeParser.ini'true);
  14. $options &PEAR::getStaticProperty('HTML_BBCodeParser''_options');
  15. $options $config['HTML_BBCodeParser'];
  16. unset($options);
  17.  
  18. /* do yer stuff! */
  19. $parser = new HTML_BBCodeParser();
  20. $parser->setText(@$_GET['string']);
  21. $parser->parse();
  22. $parsed $parser->getParsed();
  23.  
  24. ?>
  25. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  26. <html>
  27. <head>
  28. <title>HTML_BBCodeParser (by Stijn de Reede)</title>
  29. </head>
  30. <body>
  31. <form method='get' action='parser.php'>
  32. <table border='1' cellpadding='5' cellspacing='0'>
  33. <tr><td valign='top'>
  34. input:<br/>
  35. <textarea cols='45' rows='10' name='string'><?php echo @$_GET['string']?></textarea><br/>
  36. <td valign='top'>
  37. ouput:<br/>
  38. <textarea cols='45' rows='10'><?php echo htmlentities($parsedENT_QUOTES)?></textarea><br/>
  39. </tr>
  40. <tr><td valign='top' colspan='2' align='center'>
  41. <input type='submit' value='          parse          '><br/>
  42. </tr>
  43. <tr><td valign='top' colspan='2'>
  44. <?php echo $parsed?>
  45. </tr>
  46. <tr>
  47. <td colspan='2'>
  48. possible codes:
  49. <pre>
  50. [b]bold[/b]
  51. [i]italic[/i]
  52. [u]underline[/u]
  53. [s]strike[/s]
  54. [sub]subscript[/sub]
  55. [sup]superscript[/sup]
  56.  
  57. [color=blue]blue text[/color]
  58. [size=18]the size of this text is 18pt[/size]
  59. [font=arial]different font type[/font]
  60. [align=right]yes, you're right, this isn't on the left[/align]
  61. he said: [quote=http://www.server.org/quote.html]i'm tony montana[/quote]
  62. [code]x + y = 6;[/code]
  63.  
  64. http://www.server.org
  65. [url]http://www.server.org[/url]
  66. [url=http://www.server.org]server[/url]
  67. [url=http://www.server.org t=new]server[/url]
  68.  
  69. guest@anonymous.org
  70. [email]guest@anonymous.org[/email]
  71. [email=guest@anonymous.org]mail me[/email]
  72.  
  73. [img]http://www.server.org/image.jpg[/img]
  74. [img w=100 h=200]http://www.server.org/image.jpg[/img]
  75.  
  76. [ulist]
  77. [*]unordered item 1
  78. [*]unordered item 2
  79. [/ulist]
  80. [list]
  81. [*]unordered item 1
  82. [*]unordered item 2
  83. [/list]
  84.  
  85. [list=1]
  86. [*]ordered item 1
  87. [*]ordered item 2
  88. [/list]
  89. [list=i]
  90. [*]ordered item 1 type i
  91. [li=4]ordered item 4 type i[/li]
  92. [/list]
  93. [list=I]
  94. [*]ordered item 1 type I
  95. [/list]
  96. [list=a s=5]
  97. [li]ordered item 5 type a[/li]
  98. [*]ordered item 6 type a
  99. [/list]
  100. [list=A]
  101. [li]ordered item 1 type A[/li]
  102. [li=12]ordered item 12 type A[/li]
  103. [/list]
  104.  
  105. [list=A s=3]
  106. [li]ordered item 1, nested list:
  107.     [list=I]
  108.     [li]nested item 1[/li]
  109.     [li]nested item 2[/li]
  110.     [/list][/li]
  111. [li]ordered item 2[/li]
  112. [/list]
  113. </pre>
  114. </tr>
  115. </table>
  116. </form>
  117. </html>

Documentation generated on Mon, 11 Mar 2019 15:51:29 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.