Guest User

Untitled

a guest
Nov 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2. class SandBoxParser
  3. {
  4. protected
  5. $parser = null;
  6.  
  7. public function __construct(Parser $parser){
  8. $this->parser = $parser;
  9. }
  10.  
  11. public function convertWikiText($wikiText, $wgTitle = ''){
  12. return $this->parser->parse($wikiText, $wgTitle);
  13. }
  14. }
  15.  
  16. class Parser
  17. {
  18. protected
  19. $options = null;
  20.  
  21. public function __construct(ParserOptions $options){
  22. $this->options = $options;
  23. }
  24.  
  25. public function parse($wikiText, $wgTitle){
  26. return '';
  27. }
  28. }
  29.  
  30. class ParserOptions
  31. {
  32. public static function initialiseFromUser($wgUser){
  33. $options = new ParserOptions;
  34. return $options;
  35. }
  36. }
  37.  
  38.  
  39. $parser = new Parser(ParserOptions::initialiseFromUser($wgUser));
  40. $sandbox = new SandBoxParser($parser);
  41. $content = $sandbox->convertWikiText('text', 'title');
Add Comment
Please, Sign In to add comment