Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class CachedSandBoxParser
- {
- protected
- $sandboxparser = null;
- protected
- $cache = array();
- public function __construct(SandBoxParser $sandboxparser){
- $this->sandboxparser = $sandboxparser;
- }
- public function convertWikiText($wikiText, $wgTitle = ''){
- $key = sha1($wikiText . $wgTitle);
- if( ! array_key_exists($key, $this->cache)){
- $content = $this->sandboxparser->convertWikiText($wikiText, $wgTitle);
- $this->cache[$key] = $content;
- }
- return $this->cache[$key];
- }
- }
Add Comment
Please, Sign In to add comment