Go to the documentation of this file.
43 parent::__construct(
'Booksources' );
56 if ( strlen( $this->isbn ) > 0 ) {
57 if ( !self::isValidISBN( $this->isbn ) ) {
58 $this->
getOutput()->wrapWikiMsg(
"<div class=\"error\">\n$1\n</div>",
'booksources-invalid-isbn' );
72 if ( strlen(
$isbn ) == 13 ) {
73 for ( $i = 0; $i < 12; $i++ ) {
77 $sum += 3 *
$isbn[$i];
81 $check = ( 10 - ( $sum % 10 ) ) % 10;
82 if ( $check ==
$isbn[12] ) {
85 } elseif ( strlen(
$isbn ) == 10 ) {
86 for ( $i = 0; $i < 9; $i++ ) {
87 $sum +=
$isbn[$i] * ( $i + 1 );
94 if ( $check ==
$isbn[9] ) {
109 return trim( preg_replace(
'![^0-9X]!',
'',
$isbn ) );
142 # Hook to allow extensions to insert additional HTML,
143 # e.g. for API-interacting plugins and so on
146 # Check for a local page such as Project:Book_sources and use that if available
147 $page = $this->
msg(
'booksources' )->inContentLanguage()->text();
151 $content =
$rev->getContent();
156 $text = $content->getNativeData();
157 $this->
getOutput()->addWikiText( str_replace(
'MAGICNUMBER', $this->isbn, $text ) );
161 throw new MWException(
"Unexpected content type for book sources: " . $content->getModel() );
165 # Fall back to the defaults given in the language file
166 $this->
getOutput()->addWikiMsg(
'booksources-text' );
169 foreach ( $items
as $label => $url ) {
185 $url = str_replace(
'$1', $this->isbn, $url );
getPageTitle( $subpage=false)
Get a self-referential title object.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
per default it will return the text for text based content
getOutput()
Get the OutputPage being used for this instance.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
execute( $isbn)
Show the special page.
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
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 content language as $wgContLang
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
$isbn
ISBN passed to the page, if any.
static closeElement( $element)
Returns "</$element>", except if $wgWellFormedXml is off, in which case it returns the empty string w...
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
showList()
Determine where to get the list of book sources from, format and output them.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static isValidISBN( $isbn)
Returns whether a given ISBN (10 or 13) is valid.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static inputLabel( $label, $name, $id, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field with a label.
when a variable name is used in a it is silently declared as a new masking the global
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
makeListItem( $label, $url)
Format a book source list item.
static newFromTitle( $title, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given title.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
__construct()
Constructor.
msg()
Wrapper around wfMessage that sets the current context.
Parent class for all special pages.
getRequest()
Get the WebRequest being used for this instance.
makeForm()
Generate a form to allow users to enter an ISBN.
Special page outputs information on sourcing a book with a particular ISBN The parser creates links t...
Content object implementation for representing flat text.
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
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
static cleanIsbn( $isbn)
Trim ISBN and remove characters which aren't required.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...