X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialBooksources.php;h=fe90a4f90c5c1a37c9b48254aa4f26f5dbf2a58a;hb=207a47a1fe50f51e999e28e1796c083e46860a15;hp=7028fdcb840156fe79d26ef5af491b0c3964b5ca;hpb=3e7326dc6a2697e1ffcabda86d128314f514c8c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index 7028fdcb84..fe90a4f90c 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -34,9 +34,6 @@ class SpecialBookSources extends SpecialPage { */ private $isbn = ''; - /** - * Constructor - */ public function __construct() { parent::__construct( 'Booksources' ); } @@ -49,9 +46,9 @@ class SpecialBookSources extends SpecialPage { public function execute( $isbn ) { $this->setHeaders(); $this->outputHeader(); - $this->isbn = self::cleanIsbn( $isbn ? $isbn : $this->getRequest()->getText( 'isbn' ) ); + $this->isbn = self::cleanIsbn( $isbn ?: $this->getRequest()->getText( 'isbn' ) ); $this->getOutput()->addHTML( $this->makeForm() ); - if ( strlen( $this->isbn ) > 0 ) { + if ( $this->isbn !== '' ) { if ( !self::isValidISBN( $this->isbn ) ) { $this->getOutput()->wrapWikiMsg( "
\n$1\n
", @@ -63,7 +60,8 @@ class SpecialBookSources extends SpecialPage { } /** - * Returns whether a given ISBN (10 or 13) is valid. True indicates validity. + * Return whether a given ISBN (10 or 13) is valid. + * * @param string $isbn ISBN passed for check * @return bool */ @@ -124,10 +122,10 @@ class SpecialBookSources extends SpecialPage { $form = Html::openElement( 'fieldset' ) . "\n"; $form .= Html::element( 'legend', - array(), + [], $this->msg( 'booksources-search-legend' )->text() ) . "\n"; - $form .= Html::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) . "\n"; + $form .= Html::openElement( 'form', [ 'method' => 'get', 'action' => wfScript() ] ) . "\n"; $form .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . "\n"; $form .= '

' . Xml::inputLabel( $this->msg( 'booksources-isbn' )->text(), @@ -135,12 +133,12 @@ class SpecialBookSources extends SpecialPage { 'isbn', 20, $this->isbn, - array( 'autofocus' => '', 'class' => 'mw-ui-input-inline' ) + [ 'autofocus' => '', 'class' => 'mw-ui-input-inline' ] ); $form .= ' ' . Html::submitButton( $this->msg( 'booksources-search' )->text(), - array(), array( 'mw-ui-progressive' ) + [], [ 'mw-ui-progressive' ] ) . "

\n"; $form .= Html::closeElement( 'form' ) . "\n"; @@ -154,14 +152,14 @@ class SpecialBookSources extends SpecialPage { * format and output them * * @throws MWException - * @return string + * @return bool */ private function showList() { global $wgContLang; # Hook to allow extensions to insert additional HTML, # e.g. for API-interacting plugins and so on - Hooks::run( 'BookInformation', array( $this->isbn, $this->getOutput() ) ); + Hooks::run( 'BookInformation', [ $this->isbn, $this->getOutput() ] ); # Check for a local page such as Project:Book_sources and use that if available $page = $this->msg( 'booksources' )->inContentLanguage()->text(); @@ -171,7 +169,7 @@ class SpecialBookSources extends SpecialPage { $content = $rev->getContent(); if ( $content instanceof TextContent ) { - //XXX: in the future, this could be stored as structured data, defining a list of book sources + // XXX: in the future, this could be stored as structured data, defining a list of book sources $text = $content->getNativeData(); $this->getOutput()->addWikiText( str_replace( 'MAGICNUMBER', $this->isbn, $text ) ); @@ -204,8 +202,9 @@ class SpecialBookSources extends SpecialPage { private function makeListItem( $label, $url ) { $url = str_replace( '$1', $this->isbn, $url ); - return Html::rawElement( 'li', array(), - Html::element( 'a', array( 'href' => $url, 'class' => 'external' ), $label ) ); + return Html::rawElement( 'li', [], + Html::element( 'a', [ 'href' => $url, 'class' => 'external' ], $label ) + ); } protected function getGroupName() {