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

Source for file parser.php

Documentation is available at parser.php

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

Documentation generated on Mon, 11 Mar 2019 14:50:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.