Index: trunk/extensions/Cite/SpecialCite.i18n.php |
— | — | @@ -8,12 +8,13 @@ |
9 | 9 | $messages = array(); |
10 | 10 | |
11 | 11 | $messages['en'] = array( |
12 | | - 'cite_article_desc' => 'Adds a [[Special:Cite|citation]] special page and toolbox link', |
13 | | - 'cite_article_link' => 'Cite this page', |
14 | | - 'cite' => 'Cite', |
15 | | - 'cite_page' => 'Page:', |
16 | | - 'cite_submit' => 'Cite', |
17 | | - 'cite_text' => '', # Do not translate this |
| 12 | + 'cite_article_desc' => 'Adds a [[Special:Cite|citation]] special page and toolbox link', |
| 13 | + 'cite_article_link' => 'Cite this page', |
| 14 | + 'cite_article_link_title' => 'Information how to cite this page', |
| 15 | + 'cite' => 'Cite', |
| 16 | + 'cite_page' => 'Page:', |
| 17 | + 'cite_submit' => 'Cite', |
| 18 | + 'cite_text' => '', # Do not translate this |
18 | 19 | ); |
19 | 20 | |
20 | 21 | /** Message documentation (Message documentation) |
Index: trunk/extensions/Cite/SpecialCite.php |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | * @link http://www.mediawiki.org/wiki/Extension:Cite/Special:Cite.php Documentation |
11 | 11 | * |
12 | 12 | * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
| 13 | + * @author Ireas <ireas@rkrahl.de> |
13 | 14 | * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason |
14 | 15 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
15 | 16 | */ |
— | — | @@ -16,7 +17,7 @@ |
17 | 18 | $wgExtensionCredits['specialpage'][] = array( |
18 | 19 | 'path' => __FILE__, |
19 | 20 | 'name' => 'Cite', |
20 | | - 'author' => 'Ævar Arnfjörð Bjarmason', |
| 21 | + 'author' => 'Ævar Arnfjörð Bjarmason, Ireas', |
21 | 22 | 'description' => 'adds a [[Special:Cite|citation]] special page & toolbox link', // kept for b/c |
22 | 23 | 'descriptionmsg' => 'cite_article_desc', |
23 | 24 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Cite/Special:Cite.php' |
— | — | @@ -35,27 +36,35 @@ |
36 | 37 | |
37 | 38 | function wfSpecialCiteNav( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { |
38 | 39 | wfLoadExtensionMessages( 'SpecialCite' ); |
39 | | - if ( $skintemplate->mTitle->isContentPage() && $revid !== 0 ) |
| 40 | + // check whether we’re in the right namespace, the $revid has the correct type and is not empty |
| 41 | + // (what would mean that the current page doesn’t exist) |
| 42 | + if ( $skintemplate->mTitle->isContentPage() && $revid !== 0 && !empty( $revid ) ) |
40 | 43 | $nav_urls['cite'] = array( |
41 | | - 'text' => wfMsg( 'cite_article_link' ), |
42 | | - 'href' => $skintemplate->makeSpecialUrl( 'Cite', "page=" . wfUrlencode( "{$skintemplate->thispage}" ) . "&id=$revid" ) |
| 44 | + 'args' => "page=" . wfUrlencode( "{$skintemplate->thispage}" ) . "&id=$revid" |
43 | 45 | ); |
44 | 46 | |
45 | 47 | return true; |
46 | 48 | } |
47 | 49 | |
| 50 | +/** |
| 51 | + * call the function that adds the cite link in the toolbar |
| 52 | + */ |
48 | 53 | function wfSpecialCiteToolbox( &$skin ) { |
49 | | - wfLoadExtensionMessages( 'SpecialCite' ); |
50 | | - if ( isset( $skin->data['nav_urls']['cite'] ) ) |
51 | | - if ( $skin->data['nav_urls']['cite']['href'] == '' ) { |
52 | | - ?><li id="t-iscite"><?php echo $skin->msg( 'cite_article_link' ); ?></li><?php |
53 | | - } else { |
54 | | - ?><li id="t-cite"><?php |
55 | | - ?><a href="<?php echo htmlspecialchars( $skin->data['nav_urls']['cite']['href'] ) ?>"><?php |
56 | | - echo $skin->msg( 'cite_article_link' ); |
57 | | - ?></a><?php |
58 | | - ?></li><?php |
59 | | - } |
| 54 | + if ( isset( $skin->data['nav_urls']['cite'] ) ) { |
| 55 | + wfLoadExtensionMessages( 'SpecialCite' ); |
| 56 | + echo Xml::tags( |
| 57 | + 'li', |
| 58 | + array( 'id' => 't-cite' ), |
| 59 | + $skin->skin->link( |
| 60 | + SpecialPage::getTitleFor( 'Cite' ), |
| 61 | + wfMsg( 'cite_article_link' ), |
| 62 | + array( |
| 63 | + 'title' => wfMsg( 'cite_article_link_title' ) |
| 64 | + ), |
| 65 | + $skin->data['nav_urls']['cite']['args'] |
| 66 | + ) |
| 67 | + ); |
| 68 | + } |
60 | 69 | |
61 | 70 | return true; |
62 | 71 | } |