3 # ISBNs in wiki pages will create links to this page, with
4 # the ISBN passed in via the query string.
6 function wfSpecialBooksources()
8 $isbn = $_REQUEST["isbn"];
10 $bsl = new BookSourceList( $isbn );
14 class BookSourceList
{
18 function BookSourceList( $isbn )
25 global $wgOut, $wgUser, $wgLang;
26 global $ip, $wpBlockAddress, $wpBlockReason;
28 $wgOut->setPagetitle( wfMsg( "booksources" ) );
29 $wgOut->addWikiText( wfMsg( "booksourcetext" ) );
31 # If ISBN is blank, just show a list of links to the
32 # home page of the various book sites. Otherwise, show
33 # a list of links directly to the book.
36 $bs = $wgLang->getBookstoreList() ;
37 $bsn = array_keys ( $bs ) ;
38 foreach ( $bsn as $name ) {
40 if ( ! $this->mIsbn
) {
41 $adr = explode ( ":" , $adr , 2 ) ;
42 $adr = explode ( "/" , $adr[1] ) ;
44 while ( $a == "" ) $a = array_shift ( $adr ) ;
47 $adr = str_replace ( "$1" , $this->mIsbn
, $adr ) ;
49 $s .= "<li><a href=\"{$adr}\">{$name}</a></li>\n" ;
53 $wgOut->addHTML( $s );