MediaWiki REL1_33
CiteThisPageHooks.php
Go to the documentation of this file.
1<?php
2
4
13 &$skintemplate, &$nav_urls, &$oldid, &$revid
14 ) {
15 // check whether we’re in the right namespace, the $revid has the correct type and is not empty
16 // (which would mean that the current page doesn’t exist)
17 $title = $skintemplate->getTitle();
18 if ( self::shouldAddLink( $title ) && $revid !== 0 && !empty( $revid ) ) {
19 $nav_urls['citethispage'] = [
20 'text' => $skintemplate->msg( 'citethispage-link' )->text(),
21 'href' => SpecialPage::getTitleFor( 'CiteThisPage' )
22 ->getLocalURL( [ 'page' => $title->getPrefixedDBkey(), 'id' => $revid ] ),
23 'id' => 't-cite',
24 # Used message keys: 'tooltip-citethispage', 'accesskey-citethispage'
25 'single-id' => 'citethispage',
26 ];
27 }
28
29 return true;
30 }
31
40 private static function shouldAddLink( Title $title ) {
42
43 return $title->isContentPage() ||
44 (
45 isset( $wgCiteThisPageAdditionalNamespaces[$title->getNamespace()] ) &&
46 $wgCiteThisPageAdditionalNamespaces[$title->getNamespace()]
47 );
48 }
49
55 public static function onBaseTemplateToolbox( BaseTemplate $baseTemplate, array &$toolbox ) {
56 if ( isset( $baseTemplate->data['nav_urls']['citethispage'] ) ) {
57 $toolbox['citethispage'] = $baseTemplate->data['nav_urls']['citethispage'];
58 }
59
60 return true;
61 }
62}
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 and(2) offer you this license which gives you legal permission to copy
New base template for a skin's template extended from QuickTemplate this class features helper method...
static onBaseTemplateToolbox(BaseTemplate $baseTemplate, array &$toolbox)
static shouldAddLink(Title $title)
Checks, if the "cite this page" link should be added.
static onSkinTemplateBuildNavUrlsNav_urlsAfterPermalink(&$skintemplate, &$nav_urls, &$oldid, &$revid)
Represents a title within MediaWiki.
Definition Title.php:40
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))