User:Bookofjude/Stripwiki/Stripwiki.php
Appearance
(Redirected from User:Bookofjude/Nowiki/Nowiki.php)
<?php if ( !defined( 'MEDIAWIKI' ) ) { die( 'This file is a MediaWiki extension, it is not a valid entry point' ); } /**#@+ * An extension which removes wikimarkup from $string. * * @package MediaWiki * @subpackage Extensions * * @link http://meta.wikimedia.org/wiki/Stripwiki/Stripwiki.php Documentation * * @author Jude Brown <bookofjude@livejournal.com> * @copyright Copyright 2006, Jude Brown * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ $wgExtensionFunctions[] = 'wfSetupStripwiki'; $wgExtensionCredits['parserhook'][] = array( 'name' => 'Stripwiki', 'version' => '0.2.0', 'author' => 'Jude Brown', 'description' => 'adds {{#stripwiki:}} function', 'url' => 'http://meta.wikimedia.org/wiki/User:Bookofjude/Stripwiki/Stripwiki.php' ); class ExtStripwiki { function StripwikiHook( &$parser, $string = '' ) { $search = array ('@\[\[@', '@\{\{@', '@\|.*\]\]@', '@\|.*\}\}@', '@\]\]@', '@\}\}@', '@\[.*\ @', '@\]@', '@\{\|.*\s@', '@\|[-]..*\s@', '@\|\}@', '@\|@', '@__.*__@', '@<![-]..*[-].>@', "@[']{2,}@" ); return preg_replace ( $search, '', $string ); } } function wfSetupStripwiki() { global $wgParser, $wgExtStripwiki; $wgExtStripwiki = new ExtStripwiki; $wgParser->setFunctionHook( 'Stripwiki', array( &$wgExtStripwiki, 'StripwikiHook' ) ); } ?>