fix for bug 149: Special:Recentchanges: Link that adds &from= to URL discards &limit...
[mediawiki.git] / extensions / UnicodeConverter.php
blob1012889cb9d50ec7f1777b1f8add0b42eafc19e5
1 <?php
3 # This is a simple example of a special page module
4 # Given a string in UTF-8, it converts it to HTML entities suitable for
5 # an ISO 8859-1 web page.
7 $wgExtensionFunctions[] = "wfUnicodeConverter";
9 function wfUnicodeConverter() {
11 require_once( "includes/SpecialPage.php" );
13 class UnicodeConverter extends SpecialPage
15 function UnicodeConverter() {
16 SpecialPage::SpecialPage("UnicodeConverter");
19 function execute( $par ) {
20 global $wgRequest, $wgOut, $wgTitle;
22 $this->setHeaders();
24 $q = $wgRequest->getText( 'q' );
25 $encQ = htmlspecialchars( $q );
26 $action = $wgTitle->escapeLocalUrl();
27 $ok = htmlspecialchars( wfMsg( "ok" ) );
29 $wgOut->addHTML( <<<END
30 <form name="ucf" method="post" action="$action">
31 <textarea rows="15" cols="80" name="q">$encQ</textarea><br />
32 <input type="submit" name="submit" value="$ok" /><br /><br />
33 </form>
34 END
37 if ( !is_null( $q ) ) {
38 $html = wfUtf8ToHTML( htmlspecialchars( $q ) );
39 $wgOut->addHTML( "\n\n\n" . nl2br( $html ) . "\n<hr />\n" .
40 nl2br( htmlspecialchars( $html ) ) . "\n\n" );
45 global $wgMessageCache;
46 SpecialPage::addPage( new UnicodeConverter );
47 $wgMessageCache->addMessage( "unicodeconverter", "Unicode Converter" );
49 } # End of extension function