and Special:Mytalk
* Add special page for getting random page from category
* Add link on Special:Randomincategory to sidebar
+* Add ot=raw to Special:Allmessages
=== Bug fixes in 1.12 ===
wfProfileIn( __METHOD__ . '-output' );
if ( $ot == 'php' ) {
$navText .= makePhp( $messages );
- $wgOut->addHTML( 'PHP | <a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a><pre>' . htmlspecialchars( $navText ) . '</pre>' );
+ $wgOut->addHTML( 'PHP | <a href="' . $wgTitle->escapeLocalUrl( 'ot=html' ) . '">HTML</a> | <a href="' . $wgTitle->escapeLocalUrl( 'ot=raw' ) . '">Raw</a><pre>' . htmlspecialchars( $navText ) . '</pre>' );
+ } else if ( $ot == 'raw' ) {
+ $wgOut->disable();
+ echo makeRaw( $messages );
} else {
- $wgOut->addHTML( '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a> | HTML' );
+ $wgOut->addHTML( '<a href="' . $wgTitle->escapeLocalUrl( 'ot=php' ) . '">PHP</a> | HTML | <a href="' . $wgTitle->escapeLocalUrl( 'ot=raw' ) . '">Raw</a>' );
$wgOut->addWikiText( $navText );
$wgOut->addHTML( makeHTMLText( $messages ) );
}
wfProfileOut( __METHOD__ );
}
+function makeRaw( $messages ) {
+ global $wgLang;
+ $lang = $wgLang->getCode();
+ $txt = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
+ $txt .= "<messages lang=\"$lang\">\n";
+ foreach( $messages as $key => $m ) {
+ $txt .= "\t<message name=\"$key\">" . htmlspecialchars( "{$m['msg']}" ) . "</message>\n";
+ }
+ $txt .= "</messages>";
+ return $txt;
+}
+
/**
* Create the messages array, formatted in PHP to copy to language files.
* @param $messages Messages array.
}
$rnd = new RandomPageInCategory();
- $rnd->setCategory( $par );
+ if( !$rnd->setCategory( $par ) ) {
+ $wgOut->addHTML( RandomPageInCategory::getForm( $par ) );
+ return;
+ }
$title = $rnd->getRandomTitle();
}
public function setCategory ( $cat ) {
$category = Title::makeTitleSafe( NS_CATEGORY, $cat );
+ //Invalid title
+ if( !$category ) {
+ return false;
+ }
$this->category = $category->getDBKey();
+ return false;
}
/**