https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113673

Revision: 113673
Author:   wikinaut
Date:     2012-03-12 21:46:36 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
adds rss feed icons to the links in the navigation bar

Modified Paths:
--------------
    trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php
    trunk/extensions/WikiArticleFeeds/WikiArticleFeeds_body.php

Modified: trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php
===================================================================
--- trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php      2012-03-12 
21:46:26 UTC (rev 113672)
+++ trunk/extensions/WikiArticleFeeds/WikiArticleFeeds.php      2012-03-12 
21:46:36 UTC (rev 113673)
@@ -4,7 +4,7 @@
  * @author Jim R. Wilson, Thomas Gries
  * @maintainer Thomas Gries
  *
- * @version 0.701
+ * @version 0.703
  * @copyright Copyright (C) 2007 Jim R. Wilson
  * @copyright Copyright (C) 2012 Thomas Gries
  * @license The MIT License - 
http://www.opensource.org/licenses/mit-license.php
@@ -56,6 +56,7 @@
  *
  * Versions
  *
+ * 0.703   adds the feed icon to the bottom of the toolbox in Monobook or 
like-minded skins.
  * 0.701   version string constant renamed to make it wiki-unique
  * 0.700   rewritten into a four-file version with class
  *         auto-discovery rss feedlinks come with the page title in it
@@ -123,7 +124,7 @@
        die( "This is not a valid entry point.\n" );
 }
 
-define( 'EXTENSION_WIKIARTICLEFEEDS_VERSION', '0.701 20120223' );
+define( 'EXTENSION_WIKIARTICLEFEEDS_VERSION', '0.703 20120312' );
 
 # Bring in supporting classes
 require_once( "$IP/includes/Feed.php" );

Modified: trunk/extensions/WikiArticleFeeds/WikiArticleFeeds_body.php
===================================================================
--- trunk/extensions/WikiArticleFeeds/WikiArticleFeeds_body.php 2012-03-12 
21:46:26 UTC (rev 113672)
+++ trunk/extensions/WikiArticleFeeds/WikiArticleFeeds_body.php 2012-03-12 
21:46:36 UTC (rev 113673)
@@ -107,19 +107,19 @@
        }
 
        /**
-       * Add additional attributes to links to User- or User_talk pages.
-       * These are used later in wfGenerateWikiFeed to determine signatures 
with timestamps
-       * for attributing author and timestamp values to the feed item.
+       * Add additional attributes to links to User- or User_talk pages 
+       * It does this for all links on all pages 
+       * (even when we need this only for pages which generate a feed)
        *
-       * Currently this method works only if the user page exists.
+       * Attributes are used later in wfGenerateWikiFeed to determine 
signatures with timestamps
+       * for attributing author and timestamp values to the feed item from the 
signatures.
        */
        # https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd
-       static function wfWikiArticleFeedsAddSignatureMarker( $skin, $title, 
$options, $text, &$attribs, $ret ) {
-               global $wgWikiFeedPresent;
-               // wfDebug( "wfWikiArticleFeedsAddSignatureMarker: Text:". 
$title->getText() . " Namespace:".$title->getNamespace(). " exists:". 
$title->exists() . "\n" );
-               if ( $title->getNamespace() == NS_USER) {
+       static function wfWikiArticleFeedsAddSignatureMarker( $skin, Title 
$target, array $options, $text, array &$attribs, $ret ) {
+
+               if ( $target->getNamespace() == NS_USER) {
                        $attribs['userpage-link'] = 'true';
-               } elseif ( $title->getNamespace() == NS_USER_TALK ) {
+               } elseif ( $target->getNamespace() == NS_USER_TALK ) {
                        $attribs['usertalkpage-link'] = 'true';
                }
                return true;
@@ -132,7 +132,7 @@
        * @param QuickTemplate $template Instance of MonoBookTemplate or other 
QuickTemplate
        */
        static function wfWikiArticleFeedsToolboxLinks( $template ) {
-               global $wgServer, $wgScript, $wgWikiFeedPresent;
+               global $wgServer, $wgScript, $wgStylePath, $wgWikiFeedPresent;
 
                # Short-circuit if there are no Feeds present
                if ( !$wgWikiFeedPresent ) {
@@ -151,6 +151,7 @@
                }
 
                $result = '<li id="feedlinks">';
+               $feedIcon = $wgServer . $wgStylePath . 
"/common/images/feed-icon.png";
 
                # Test for feedBurner presence
                $burned = false;
@@ -166,6 +167,7 @@
                                        $result .=
                                        '<span id="feed-' . htmlspecialchars( 
$feed ) . '">' .
                                        '<a href="http://feeds.feedburner.com/' 
. urlencode( $feedBurnerName ) . '?format=xml">' .
+                                       '<img style="margin-right:2px;" src="' 
. $feedIcon . '" border=0>' .
                                        htmlspecialchars( $name ) . 
'</a>&#160;</span>';
                                }
                                $burned = true;
@@ -181,6 +183,7 @@
                                $result .=
                                '<span id="feed-' . htmlspecialchars( $feed ) . 
'">' .
                                '<a href="' . htmlspecialchars( $baseUrl . 
$feed ) . '">' .
+                               '<img style="margin-right:2px;" src="' . 
$feedIcon . '" border=0>' .
                                htmlspecialchars( $name ) . '</a>&#160;</span>';
                        }
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to