getVal( 'issn' ); } $issn = preg_replace( '/[^0-9X]/', '', $issn ); $bsl = new PeriodicalSourceList( $issn ); $bsl->show(); } /** * * @package MediaWiki * @subpackage SpecialPage */ class PeriodicalSourceList { var $mIssn; function PeriodicalSourceList( $issn ) { $this->mIssn = $issn; } function show() { global $wgOut; $wgOut->setPagetitle( wfMsg( "periodicalsources" ) ); if( empty( $this->mIssn ) ) { $this->askForm(); } else { $this->showList(); } } function showList() { global $wgOut, $wgUser, $wgContLang; $fname = "PeriodicalSourceList::showList()"; # First, see if we have a custom list setup in # [[Wikipedia:Periodical sources]] or equivalent. $bstitle = Title::makeTitleSafe( NS_PROJECT, wfMsg( "periodicalsources" ) ); $dbr =& wfGetDB( DB_SLAVE ); $bstext = $dbr->selectField( 'cur', 'cur_text', $bstitle->curCond(), $fname ); if( $bstext ) { $bstext = str_replace( "MAGICNUMBER", $this->mIssn, $bstext ); $wgOut->addWikiText( $bstext ); return; } # Otherwise, use the list of links in the default Language.php file. $s = wfMsg( "periodicalsourcetext" ) . "\n"; $wgOut->addHTML( $s ); } function askForm() { global $wgOut, $wgLang, $wgTitle; $fname = "PeriodicalSourceList::askForm()"; $action = $wgTitle->escapeLocalUrl(); $issn = htmlspecialchars( wfMsg( "issn" ) ); $go = htmlspecialchars( wfMsg( "go" ) ); $out = "
$issn:
"; $wgOut->addHTML( $out ); } } ?>