getVal( 'isbn' ); } $isbn = preg_replace( '/[^0-9X]/', '', $isbn ); $bsl = new BookSourceList( $isbn ); $bsl->show(); } /** * * @package MediaWiki * @subpackage SpecialPage */ class BookSourceList { var $mIsbn; function BookSourceList( $isbn ) { $this->mIsbn = $isbn; } function show() { global $wgOut; $wgOut->setPagetitle( wfMsg( "booksources" ) ); if( empty( $this->mIsbn ) ) { $this->askForm(); } else { $this->showList(); } } function showList() { global $wgOut, $wgUser, $wgContLang; $fname = "BookSourceList::showList()"; # First, see if we have a custom list setup in # [[Wikipedia:Book sources]] or equivalent. $bstitle = Title::makeTitleSafe( NS_PROJECT, wfMsg( "booksources" ) ); $bsarticle = new Article( $bstitle ); $bstext = $bsarticle->getContent( false ); if( $bstext ) { $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext ); $wgOut->addWikiText( $bstext ); return; } # Otherwise, use the list of links in the default Language.php file. $s = wfMsg( "booksourcetext" ) . "\n"; $wgOut->addHTML( $s ); } function askForm() { global $wgOut, $wgLang, $wgTitle; $fname = "BookSourceList::askForm()"; $action = $wgTitle->escapeLocalUrl(); $isbn = htmlspecialchars( wfMsg( "isbn" ) ); $go = htmlspecialchars( wfMsg( "go" ) ); $out = "
$isbn:
"; $wgOut->addHTML( $out ); } } ?>