r113673 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113672‎ | r113673 | r113674 >
Date:21:46, 12 March 2012
Author:wikinaut
Status:new
Tags:
Comment:
adds rss feed icons to the links in the navigation bar
Modified paths:
  • /trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php (modified) (history)
  • /trunk/extensions/WikiArticleFeeds/WikiArticleFeeds_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiArticleFeeds/WikiArticleFeeds_body.php
@@ -107,19 +107,19 @@
108108 }
109109
110110 /**
111 - * Add additional attributes to links to User- or User_talk pages.
112 - * These are used later in wfGenerateWikiFeed to determine signatures with timestamps
113 - * for attributing author and timestamp values to the feed item.
 111+ * Add additional attributes to links to User- or User_talk pages
 112+ * It does this for all links on all pages
 113+ * (even when we need this only for pages which generate a feed)
114114 *
115 - * Currently this method works only if the user page exists.
 115+ * Attributes are used later in wfGenerateWikiFeed to determine signatures with timestamps
 116+ * for attributing author and timestamp values to the feed item from the signatures.
116117 */
117118 # https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd
118 - static function wfWikiArticleFeedsAddSignatureMarker( $skin, $title, $options, $text, &$attribs, $ret ) {
119 - global $wgWikiFeedPresent;
120 - // wfDebug( "wfWikiArticleFeedsAddSignatureMarker: Text:". $title->getText() . " Namespace:".$title->getNamespace(). " exists:". $title->exists() . "\n" );
121 - if ( $title->getNamespace() == NS_USER) {
 119+ static function wfWikiArticleFeedsAddSignatureMarker( $skin, Title $target, array $options, $text, array &$attribs, $ret ) {
 120+
 121+ if ( $target->getNamespace() == NS_USER) {
122122 $attribs['userpage-link'] = 'true';
123 - } elseif ( $title->getNamespace() == NS_USER_TALK ) {
 123+ } elseif ( $target->getNamespace() == NS_USER_TALK ) {
124124 $attribs['usertalkpage-link'] = 'true';
125125 }
126126 return true;
@@ -132,7 +132,7 @@
133133 * @param QuickTemplate $template Instance of MonoBookTemplate or other QuickTemplate
134134 */
135135 static function wfWikiArticleFeedsToolboxLinks( $template ) {
136 - global $wgServer, $wgScript, $wgWikiFeedPresent;
 136+ global $wgServer, $wgScript, $wgStylePath, $wgWikiFeedPresent;
137137
138138 # Short-circuit if there are no Feeds present
139139 if ( !$wgWikiFeedPresent ) {
@@ -151,6 +151,7 @@
152152 }
153153
154154 $result = '<li id="feedlinks">';
 155+ $feedIcon = $wgServer . $wgStylePath . "/common/images/feed-icon.png";
155156
156157 # Test for feedBurner presence
157158 $burned = false;
@@ -166,6 +167,7 @@
167168 $result .=
168169 '<span id="feed-' . htmlspecialchars( $feed ) . '">' .
169170 '<a href="http://feeds.feedburner.com/' . urlencode( $feedBurnerName ) . '?format=xml">' .
 171+ '<img style="margin-right:2px;" src="' . $feedIcon . '" border=0>' .
170172 htmlspecialchars( $name ) . '</a>&#160;</span>';
171173 }
172174 $burned = true;
@@ -181,6 +183,7 @@
182184 $result .=
183185 '<span id="feed-' . htmlspecialchars( $feed ) . '">' .
184186 '<a href="' . htmlspecialchars( $baseUrl . $feed ) . '">' .
 187+ '<img style="margin-right:2px;" src="' . $feedIcon . '" border=0>' .
185188 htmlspecialchars( $name ) . '</a>&#160;</span>';
186189 }
187190 }
Index: trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php
@@ -4,7 +4,7 @@
55 * @author Jim R. Wilson, Thomas Gries
66 * @maintainer Thomas Gries
77 *
8 - * @version 0.701
 8+ * @version 0.703
99 * @copyright Copyright (C) 2007 Jim R. Wilson
1010 * @copyright Copyright (C) 2012 Thomas Gries
1111 * @license The MIT License - http://www.opensource.org/licenses/mit-license.php
@@ -56,6 +56,7 @@
5757 *
5858 * Versions
5959 *
 60+ * 0.703 adds the feed icon to the bottom of the toolbox in Monobook or like-minded skins.
6061 * 0.701 version string constant renamed to make it wiki-unique
6162 * 0.700 rewritten into a four-file version with class
6263 * auto-discovery rss feedlinks come with the page title in it
@@ -123,7 +124,7 @@
124125 die( "This is not a valid entry point.\n" );
125126 }
126127
127 -define( 'EXTENSION_WIKIARTICLEFEEDS_VERSION', '0.701 20120223' );
 128+define( 'EXTENSION_WIKIARTICLEFEEDS_VERSION', '0.703 20120312' );
128129
129130 # Bring in supporting classes
130131 require_once( "$IP/includes/Feed.php" );

Status & tagging log