33 parent::__construct(
'Booksources' );
48 $isbn = $isbn ?: $this->
getRequest()->getText(
'isbn' );
49 $isbn = trim( $isbn );
54 if ( !self::isValidISBN( $isbn ) ) {
56 "<div class=\"error\">\n$1\n</div>",
57 'booksources-invalid-isbn'
74 if ( strlen( $isbn ) == 13 ) {
75 for ( $i = 0; $i < 12; $i++ ) {
76 if ( $isbn[$i] ===
'X' ) {
78 } elseif ( $i % 2 == 0 ) {
81 $sum += 3 * $isbn[$i];
85 $check = ( 10 - ( $sum % 10 ) ) % 10;
86 if ( (
string)$check === $isbn[12] ) {
89 } elseif ( strlen( $isbn ) == 10 ) {
90 for ( $i = 0; $i < 9; $i++ ) {
91 if ( $isbn[$i] ===
'X' ) {
94 $sum += $isbn[$i] * ( $i + 1 );
101 if ( (
string)$check === $isbn[9] ) {
116 return trim( preg_replace(
'![^0-9X]!',
'', $isbn ) );
129 'label-message' =>
'booksources-isbn',
138 HTMLForm::factory(
'ooui', $formDescriptor,
$context )
139 ->setWrapperLegendMsg(
'booksources-search-legend' )
140 ->setSubmitTextMsg(
'booksources-search' )
143 ->displayForm(
false );
160 # Hook to allow extensions to insert additional HTML,
161 # e.g. for API-interacting plugins and so on
162 Hooks::run(
'BookInformation', [ $isbn,
$out ] );
164 # Check for a local page such as Project:Book_sources and use that if available
165 $page = $this->
msg(
'booksources' )->inContentLanguage()->text();
167 if ( is_object( $title ) && $title->exists() ) {
168 $rev = Revision::newFromTitle( $title,
false, Revision::READ_NORMAL );
169 $content =
$rev->getContent();
174 $text = $content->getNativeData();
175 $out->addWikiText( str_replace(
'MAGICNUMBER', $isbn, $text ) );
179 throw new MWException(
"Unexpected content type for book sources: " . $content->getModel() );
183 # Fall back to the defaults given in the language file
184 $out->addWikiMsg(
'booksources-text' );
185 $out->addHTML(
'<ul>' );
187 foreach ( $items as $label => $url ) {
190 $out->addHTML(
'</ul>' );
204 $url = str_replace(
'$1', $isbn, $url );
206 return Html::rawElement(
'li', [],
207 Html::element(
'a', [
'href' => $url,
'class' =>
'external' ], $label )
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying
An IContextSource implementation which will inherit context from another source but allow individual ...
Special page outputs information on sourcing a book with a particular ISBN The parser creates links t...
static cleanIsbn( $isbn)
Trim ISBN and remove characters which aren't required.
buildForm( $isbn)
Generate a form to allow users to enter an ISBN.
static isValidISBN( $isbn)
Return whether a given ISBN (10 or 13) is valid.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $isbn)
Show the special page.
showList( $isbn)
Determine where to get the list of book sources from, format and output them.
makeListItem( $isbn, $label, $url)
Format a book source list item.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
Content object implementation for representing flat text.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev