Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class SandBoxParser
- {
- protected
- $parser = null;
- public function __construct(Parser $parser){
- $this->parser = $parser;
- }
- public function convertWikiText($wikiText, $wgTitle = ''){
- return $this->parser->parse($wikiText, $wgTitle);
- }
- }
- class Parser
- {
- protected
- $options = null;
- public function __construct(ParserOptions $options){
- $this->options = $options;
- }
- public function parse($wikiText, $wgTitle){
- return '';
- }
- }
- class ParserOptions
- {
- public static function initialiseFromUser($wgUser){
- $options = new ParserOptions;
- return $options;
- }
- }
- $parser = new Parser(ParserOptions::initialiseFromUser($wgUser));
- $sandbox = new SandBoxParser($parser);
- $content = $sandbox->convertWikiText('text', 'title');
Add Comment
Please, Sign In to add comment