MediaWiki REL1_33
|
Base class for template-based skins. More...
Public Member Functions | |
formatLanguageName ( $name) | |
Format language name for use in sidebar interlanguage links list. | |
getLanguages () | |
Generates array of language links for the current page. | |
getPersonalToolsList () | |
Get the HTML for the p-personal list. | |
getStructuredPersonalTools () | |
Get personal tools for the user. | |
makeArticleUrlDetails ( $name, $urlaction='') | |
makePersonalToolsList ( $personalTools=null, $options=[]) | |
Get the HTML for the personal tools list. | |
makeTalkUrlDetails ( $name, $urlaction='') | |
outputPage (OutputPage $out=null) | |
initialize various variables and generate the template | |
printOrError ( $str) | |
Output the string, or print error message if it's an error object of the appropriate type. | |
setupTemplate ( $classname, $repository=false, $cache_dir=false) | |
Create the template engine object; we feed it a bunch of data and eventually it spits out some HTML. | |
tabAction ( $title, $message, $selected, $query='', $checkEdit=false) | |
Builds an array with tab definition. | |
useCombinedLoginLink () | |
Output a boolean indicating if buildPersonalUrls should output separate login and create account links or output a combined link By default we simply return a global config setting that affects most skins This is setup as a method so that like with $wgLogo and getLogo() a skin can override this setting and always output one or the other if it has a reason it can't output one of the two modes. | |
Public Member Functions inherited from Skin | |
__construct ( $skinname=null) | |
aboutLink () | |
Gets the link to the wiki's about page. | |
addToBodyAttributes ( $out, &$bodyAttrs) | |
This will be called by OutputPage::headElement when it is creating the "<body>" tag, skins can override it if they have a need to add in any body attributes or classes of their own. | |
addToSidebar (&$bar, $message) | |
Add content from a sidebar system message Currently only used for MediaWiki:Sidebar (but may be used by Extensions) | |
addToSidebarPlain (&$bar, $text) | |
Add content from plain text. | |
bottomScripts () | |
This gets called shortly before the "</body>" tag. | |
buildSidebar () | |
Build an array that represents the sidebar(s), the navigation bar among them. | |
disclaimerLink () | |
Gets the link to the wiki's general disclaimers page. | |
doEditSectionLink (Title $nt, $section, $tooltip, Language $lang) | |
Create a section edit link. | |
drawCategoryBrowser ( $tree) | |
Render the array as a series of links. | |
editUrlOptions () | |
Return URL options for the 'edit page' link. | |
escapeSearchLink () | |
footerLink ( $desc, $page) | |
Returns an HTML link for use in the footer. | |
getCategories () | |
getCategoryLinks () | |
getCopyright ( $type='detect') | |
getCopyrightIcon () | |
getDefaultModules () | |
Defines the ResourceLoader modules that should be added to the skin It is recommended that skins wishing to override call parent::getDefaultModules() and substitute out any modules they wish to change by using a key to look them up. | |
getHtmlElementAttributes () | |
Return values for <html> element. | |
getLogo () | |
URL to the logo. | |
getNewtalks () | |
Gets new talk page messages for the current user and returns an appropriate alert message (or an empty string if there are no messages) | |
getPageClasses ( $title) | |
TODO: document. | |
getPoweredBy () | |
Gets the powered by MediaWiki icon. | |
getRelevantTitle () | |
Return the "relevant" title. | |
getRelevantUser () | |
Return the "relevant" user. | |
getRevisionId () | |
Get the current revision ID. | |
getSearchLink () | |
getSiteNotice () | |
Get the site notice. | |
getSkinName () | |
getSkinStylePath ( $name) | |
Return a fully resolved style path URL to images or styles stored in the current skin's folder. | |
getUndeleteLink () | |
initPage (OutputPage $out) | |
isRevisionCurrent () | |
Whether the revision displayed is the latest revision of the page. | |
logoText ( $align='') | |
mainPageLink () | |
Gets the link to the wiki's main page. | |
makeFooterIcon ( $icon, $withImage='withImage') | |
Renders a $wgFooterIcons icon according to the method's arguments. | |
printSource () | |
Text with the permalink to the source page, usually shown on the footer of a printed page. | |
privacyLink () | |
Gets the link to the wiki's privacy policy page. | |
setRelevantTitle ( $t) | |
Set the "relevant" title. | |
setRelevantUser ( $u) | |
Set the "relevant" user. | |
setupSkinUserCss (OutputPage $out) | |
Hook point for adding style modules to OutputPage. | |
shouldPreloadLogo () | |
Whether the logo should be preloaded with an HTTP link header or not. | |
showEmailUser ( $id) | |
subPageSubtitle ( $out=null) | |
Public Member Functions inherited from ContextSource | |
canUseWikiPage () | |
Check whether a WikiPage object can be get with getWikiPage(). | |
exportSession () | |
Export the resolved user IP, HTTP headers, user ID, and session ID. | |
getConfig () | |
getContext () | |
Get the base IContextSource object. | |
getLanguage () | |
getOutput () | |
getRequest () | |
getSkin () | |
getStats () | |
getTiming () | |
getTitle () | |
getUser () | |
getWikiPage () | |
Get the WikiPage object. | |
msg ( $key) | |
Get a Message object with context set Parameters are the same as wfMessage() | |
setContext (IContextSource $context) | |
Public Attributes | |
$loggedin | |
string | $skinname = 'monobook' |
Name of our skin, it probably needs to be all lower case. | |
string | $template = QuickTemplate::class |
For QuickTemplate, the name of the subclass which will actually fill the template. | |
$thispage | |
$thisquery | |
$titletxt | |
$username | |
$userpage | |
$userpageUrlDetails | |
Public Attributes inherited from Skin | |
string | $stylename = null |
Stylesheets set to use. | |
Protected Member Functions | |
buildContentNavigationUrls () | |
a structured array of links usually used for the tabs in a skin | |
buildNavUrls () | |
build array of common navigation links | |
buildPersonalUrls () | |
build array of urls for personal toolbar | |
getNameSpaceKey () | |
Generate strings used for xml 'id' names. | |
prepareQuickTemplate () | |
initialize various variables and generate the template | |
setupTemplateForOutput () | |
wrapHTML ( $title, $html) | |
Wrap the body text with language information and identifiable element. | |
Protected Member Functions inherited from Skin | |
afterContentHook () | |
This runs a hook to allow extensions placing their stuff after content and article metadata (e.g. | |
generateDebugHTML () | |
Generate debug data HTML for displaying at the bottom of the main content area. | |
lastModified () | |
Get the timestamp of the latest revision, formatted in user language. | |
preloadExistence () | |
Preload the existence of three commonly-requested pages in a single query. | |
Private Member Functions | |
buildContentActionUrls ( $content_navigation) | |
an array of edit links by default used for the tabs | |
Additional Inherited Members | |
Static Public Member Functions inherited from Skin | |
static | checkTitle (&$title, $name) |
make sure we have some title to operate on | |
static | getAllowedSkins () |
Fetch the list of user-selectable skins in regards to $wgSkipSkins. | |
static | getDynamicStylesheetQuery () |
Get the query to generate a dynamic stylesheet. | |
static | getSkinNameMessages () |
Fetch the skinname messages for available skins. | |
static | getSkinNames () |
Fetch the set of available skins. | |
static | makeI18nUrl ( $name, $urlaction='') |
static | makeInternalOrExternalUrl ( $name) |
If url string starts with http, consider as external URL, else internal. | |
static | makeKnownUrlDetails ( $name, $urlaction='') |
Make URL details where the article exists (or at least it's convenient to think so) | |
static | makeMainPageUrl ( $urlaction='') |
static | makeNSUrl ( $name, $urlaction='', $namespace=NS_MAIN) |
this can be passed the NS number as defined in Language.php | |
static | makeSpecialUrl ( $name, $urlaction='', $proto=null) |
Make a URL for a Special Page using the given query and protocol. | |
static | makeSpecialUrlSubpage ( $name, $subpage, $urlaction='') |
static | makeUrl ( $name, $urlaction='') |
static | makeUrlDetails ( $name, $urlaction='') |
these return an array with the 'href' and boolean 'exists' | |
static | makeVariablesScript ( $data, $nonce=null) |
static | normalizeKey ( $key) |
Normalize a skin preference value to a form that can be loaded. | |
Protected Attributes inherited from Skin | |
$mRelevantTitle = null | |
$mRelevantUser = null | |
string null | $skinname = null |
Base class for template-based skins.
Template-filler skin base class Formerly generic PHPTal (http://phptal.sourceforge.net/) skin Based on Brion's smarty skin
Definition at line 38 of file SkinTemplate.php.
|
private |
an array of edit links by default used for the tabs
array | $content_navigation |
Definition at line 1231 of file SkinTemplate.php.
References $value, as, and wfDebug().
Referenced by prepareQuickTemplate().
|
protected |
a structured array of links usually used for the tabs in a skin
There are 4 standard sections namespaces: Used for namespace tabs like special, page, and talk namespaces views: Used for primary page views like read, edit, history actions: Used for most extra page actions like deletion, protection, etc... variants: Used to list the language variants for the page
Each section's value is a key/value array of links for that section. The links themselves have these common keys:
Views also have an extra key which can be used:
content_navigation using code also expects these ids to be present on the links, however these are usually automatically generated by SkinTemplate itself and are not necessary when using a hook. The only things these may matter to are people modifying content_navigation after it's initial creation:
Reimplemented in SkinApi.
Definition at line 894 of file SkinTemplate.php.
References $code, $link, $out, $params, $request, $section, $skinname, $title, $user, $wgDisableLangConversion, as, ContextSource\canUseWikiPage(), Skin\editUrlOptions(), false, ContextSource\getContext(), ContextSource\getOutput(), Skin\getRelevantTitle(), ContextSource\getRequest(), ContextSource\getTitle(), ContextSource\getUser(), ContextSource\getWikiPage(), Skin\isRevisionCurrent(), ContextSource\msg(), NS_MEDIAWIKI, ContextSource\setContext(), tabAction(), text, true, and wfMessageFallback().
Referenced by prepareQuickTemplate().
|
protected |
build array of common navigation links
Reimplemented in SkinApi.
Definition at line 1270 of file SkinTemplate.php.
References $out, $request, $user, $wgUploadNavigationUrl, ContextSource\getContext(), ContextSource\getOutput(), Skin\getRelevantUser(), ContextSource\getRequest(), Skin\getRevisionId(), ContextSource\getTitle(), ContextSource\getUser(), UploadBase\isAllowed(), UploadBase\isEnabled(), Skin\makeMainPageUrl(), Skin\makeSpecialUrl(), Skin\makeSpecialUrlSubpage(), ContextSource\msg(), NS_CATEGORY, SpecialPage\setContext(), Skin\showEmailUser(), and text.
Referenced by prepareQuickTemplate().
|
protected |
build array of urls for personal toolbar
Reimplemented in SkinApi.
Definition at line 601 of file SkinTemplate.php.
References $query, $request, $title, $username, false, ContextSource\getRequest(), ContextSource\getTitle(), ContextSource\getUser(), User\groupHasPermission(), Title\isSpecialPage(), list, Skin\makeSpecialUrl(), Skin\makeSpecialUrlSubpage(), makeTalkUrlDetails(), ContextSource\msg(), useCombinedLoginLink(), wfArrayToCgi(), and wfCgiToArray().
Referenced by getStructuredPersonalTools(), makePersonalToolsList(), and prepareQuickTemplate().
SkinTemplate::formatLanguageName | ( | $name | ) |
Format language name for use in sidebar interlanguage links list.
By default it is capitalized.
string | $name | Language name, e.g. "English" or "español" |
Definition at line 567 of file SkinTemplate.php.
References $name, and ContextSource\getLanguage().
Referenced by getLanguages().
SkinTemplate::getLanguages | ( | ) |
Generates array of language links for the current page.
Reimplemented in SkinApi.
Definition at line 79 of file SkinTemplate.php.
References $wgHideInterlanguageLinks, as, formatLanguageName(), ContextSource\getLanguage(), ContextSource\getOutput(), ContextSource\getTitle(), and wfMessage().
Referenced by prepareQuickTemplate().
|
protected |
Generate strings used for xml 'id' names.
Definition at line 1392 of file SkinTemplate.php.
References ContextSource\getTitle().
SkinTemplate::getPersonalToolsList | ( | ) |
Get the HTML for the p-personal list.
Definition at line 514 of file SkinTemplate.php.
References makePersonalToolsList().
SkinTemplate::getStructuredPersonalTools | ( | ) |
Get personal tools for the user.
Definition at line 552 of file SkinTemplate.php.
References buildPersonalUrls(), and setupTemplateForOutput().
SkinTemplate::makeArticleUrlDetails | ( | $name, | |
$urlaction = '' |
|||
) |
string | $name | |
string | $urlaction |
Definition at line 850 of file SkinTemplate.php.
References $name, $title, and Skin\checkTitle().
SkinTemplate::makePersonalToolsList | ( | $personalTools = null , |
|
$options = [] |
|||
) |
Get the HTML for the personal tools list.
array | null | $personalTools | |
array | $options |
Definition at line 527 of file SkinTemplate.php.
References $html, $options, as, buildPersonalUrls(), and setupTemplateForOutput().
Referenced by getPersonalToolsList().
SkinTemplate::makeTalkUrlDetails | ( | $name, | |
$urlaction = '' |
|||
) |
Definition at line 831 of file SkinTemplate.php.
References $name, $title, and Skin\checkTitle().
Referenced by buildPersonalUrls().
SkinTemplate::outputPage | ( | OutputPage | $out = null | ) |
initialize various variables and generate the template
OutputPage | null | $out |
Reimplemented from Skin.
Definition at line 214 of file SkinTemplate.php.
References $out, $res, ContextSource\getContext(), ContextSource\getOutput(), Skin\initPage(), prepareQuickTemplate(), printOrError(), ContextSource\setContext(), and wfDeprecated().
|
protected |
initialize various variables and generate the template
Definition at line 273 of file SkinTemplate.php.
References $link, $out, $request, $title, $wgArticlePath, $wgFooterIcons, $wgJsMimeType, $wgLogo, $wgMaxCredits, $wgMimeType, $wgScript, $wgScriptPath, $wgServer, $wgShowCreditsIfMax, $wgSitename, $wgStylePath, Skin\aboutLink(), Skin\afterContentHook(), as, Skin\bottomScripts(), buildContentActionUrls(), buildContentNavigationUrls(), buildNavUrls(), buildPersonalUrls(), Skin\buildSidebar(), Skin\disclaimerLink(), Skin\escapeSearchLink(), Skin\generateDebugHTML(), Skin\getCategories(), ContextSource\getContext(), Skin\getCopyright(), Skin\getCopyrightIcon(), ContextSource\getLanguage(), getLanguages(), Skin\getNewtalks(), ContextSource\getOutput(), Skin\getPoweredBy(), ContextSource\getRequest(), Skin\getSiteNotice(), ContextSource\getTitle(), Skin\getUndeleteLink(), ContextSource\getWikiPage(), Skin\lastModified(), Skin\logoText(), ContextSource\msg(), null, Skin\printSource(), Skin\privacyLink(), setupTemplateForOutput(), Skin\subPageSubtitle(), wfDebug(), wfReportTime(), and wrapHTML().
Referenced by outputPage().
SkinTemplate::printOrError | ( | $str | ) |
Output the string, or print error message if it's an error object of the appropriate type.
For the base class, assume strings all around.
string | $str |
Definition at line 579 of file SkinTemplate.php.
Referenced by outputPage().
SkinTemplate::setupTemplate | ( | $classname, | |
$repository = false , |
|||
$cache_dir = false |
|||
) |
Create the template engine object; we feed it a bunch of data and eventually it spits out some HTML.
Should have interface roughly equivalent to PHPTAL 0.7.
string | $classname | |
bool | string | $repository | Subdirectory where we keep template files |
bool | string | $cache_dir |
Definition at line 70 of file SkinTemplate.php.
References ContextSource\getConfig().
Referenced by setupTemplateForOutput().
|
protected |
Definition at line 177 of file SkinTemplate.php.
References $query, $request, $title, $user, ContextSource\getRequest(), ContextSource\getTitle(), ContextSource\getUser(), Skin\makeKnownUrlDetails(), Skin\makeUrlDetails(), setupTemplate(), and wfArrayToCgi().
Referenced by getStructuredPersonalTools(), makePersonalToolsList(), and prepareQuickTemplate().
SkinTemplate::tabAction | ( | $title, | |
$message, | |||
$selected, | |||
$query = '' , |
|||
$checkEdit = false |
|||
) |
Builds an array with tab definition.
Title | $title | Page Where the tab links to |
string | array | $message | Message key or an array of message keys (will fall back) |
bool | $selected | Display the tab as selected |
string | $query | Query string attached to tab URL |
bool | $checkEdit | Check if $title exists and mark with .new if one doesn't |
Definition at line 777 of file SkinTemplate.php.
References $query, $title, ContextSource\getContext(), true, and wfMessageFallback().
Referenced by buildContentNavigationUrls().
SkinTemplate::useCombinedLoginLink | ( | ) |
Output a boolean indicating if buildPersonalUrls should output separate login and create account links or output a combined link By default we simply return a global config setting that affects most skins This is setup as a method so that like with $wgLogo and getLogo() a skin can override this setting and always output one or the other if it has a reason it can't output one of the two modes.
Definition at line 592 of file SkinTemplate.php.
References $wgUseCombinedLoginLink.
Referenced by buildPersonalUrls().
|
protected |
Wrap the body text with language information and identifiable element.
Title | $title | |
string | $html | body text |
Definition at line 247 of file SkinTemplate.php.
References $html, $title, NS_FILE, and NS_SPECIAL.
Referenced by prepareQuickTemplate().
SkinTemplate::$loggedin |
Definition at line 55 of file SkinTemplate.php.
string SkinTemplate::$skinname = 'monobook' |
Name of our skin, it probably needs to be all lower case.
Child classes should override the default.
Definition at line 43 of file SkinTemplate.php.
Referenced by buildContentNavigationUrls().
string SkinTemplate::$template = QuickTemplate::class |
For QuickTemplate, the name of the subclass which will actually fill the template.
Child classes should override the default.
Definition at line 49 of file SkinTemplate.php.
SkinTemplate::$thispage |
Definition at line 51 of file SkinTemplate.php.
SkinTemplate::$thisquery |
Definition at line 54 of file SkinTemplate.php.
SkinTemplate::$titletxt |
Definition at line 52 of file SkinTemplate.php.
SkinTemplate::$username |
Definition at line 56 of file SkinTemplate.php.
Referenced by buildPersonalUrls().
SkinTemplate::$userpage |
Definition at line 53 of file SkinTemplate.php.
SkinTemplate::$userpageUrlDetails |
Definition at line 57 of file SkinTemplate.php.