r91047 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91046‎ | r91047 | r91048 >
Date:02:30, 29 June 2011
Author:kbrown
Status:ok (Comments)
Tags:
Comment:
add install instructions, add sql file with format of tables, add basics of special page, fix $link in rewriteLinks to use the proper HTML functions instead of direct HTML
Modified paths:
  • /trunk/extensions/ArchiveLinks/ArchiveLinks.alias.php (added) (history)
  • /trunk/extensions/ArchiveLinks/ArchiveLinks.class.php (modified) (history)
  • /trunk/extensions/ArchiveLinks/ArchiveLinks.i18n.php (modified) (history)
  • /trunk/extensions/ArchiveLinks/ArchiveLinks.php (modified) (history)
  • /trunk/extensions/ArchiveLinks/SetupTables.sql (added) (history)
  • /trunk/extensions/ArchiveLinks/SpecialArchiveBlacklist.php (added) (history)

Diff [purge]

Index: trunk/extensions/ArchiveLinks/ArchiveLinks.alias.php
@@ -0,0 +1,6 @@
 2+<?php
 3+/**
 4+ * Alias file to allow different languages to have a localized special page title.
 5+ */
 6+
 7+$aliases = array ();
\ No newline at end of file
Property changes on: trunk/extensions/ArchiveLinks/ArchiveLinks.alias.php
___________________________________________________________________
Added: svn:eol-style
18 + native
Index: trunk/extensions/ArchiveLinks/SpecialArchiveBlacklist.php
@@ -0,0 +1,29 @@
 2+<?php
 3+if ( !defined( 'MEDIAWIKI' ) ) {
 4+ echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
 5+ die( 1 );
 6+}
 7+
 8+class SpecialArchiveBlacklist extends SpecialPage {
 9+ function __construct() {
 10+ parent::__construct( 'ArchiveBlacklist' );
 11+
 12+ }
 13+
 14+ public function execute ( $par ) {
 15+ global $wgOut;
 16+ $this->setHeaders();
 17+ $this->outputHeader();
 18+
 19+ $wgOut->addWikiText( wfMsg( 'archivelinks-archive-blacklist-desc' ) );
 20+
 21+ $wgOut->addHTML(
 22+ HTML::openElement('form', array( 'method' => 'get', 'action' => '')) .
 23+ HTML::openElement('fieldset') .
 24+ HTML::element( 'legend', null, wfMsg( 'ArchiveBlacklist') ) .
 25+ HTML::hidden( 'title', SpecialPage::getTitleFor( 'ArchiveBlacklist' )->getPrefixedText() ) .
 26+ HTML::input( 'Blacklist' ) .
 27+ HTML::closeElement('fieldset') .
 28+ HTML::closeElement('form'));
 29+ }
 30+}
\ No newline at end of file
Property changes on: trunk/extensions/ArchiveLinks/SpecialArchiveBlacklist.php
___________________________________________________________________
Added: svn:eol-style
131 + native
Index: trunk/extensions/ArchiveLinks/ArchiveLinks.i18n.php
@@ -7,5 +7,7 @@
88
99 //English
1010 $messages['en'] = array (
11 - 'archive-links-cache-title' => '[cache]',
 11+ 'archivelinks-cache-title' => '[cache]',
 12+ 'ArchiveBlacklist' => 'Archive Blacklist',
 13+ 'archivelinks-archive-blacklist-desc' => 'This page allows you to blacklist or whitelist URLs for the ArchiveLinks extension.',
1214 );
\ No newline at end of file
Index: trunk/extensions/ArchiveLinks/ArchiveLinks.php
@@ -14,12 +14,16 @@
1515 $path = dirname( __FILE__ );
1616
1717 $wgExtensionMessagesFiles['ArchiveLinks'] = "$path/ArchiveLinks.i18n.php";
 18+$wgExtensionMessagesFiles['ArchiveBlacklist'] = "$path/ArchiveLinks.i18n.php";
1819
1920 $wgAutoloadClasses['ArchiveLinks'] = "$path/ArchiveLinks.class.php";
 21+$wgAutoloadClasses['SpecialArchiveBlacklist'] = "$path/SpecialArchiveBlacklist.php";
2022
2123 $wgHooks['ArticleSaveComplete'][] = 'ArchiveLinks::queueExternalLinks';
2224 $wgHooks['LinkerMakeExternalLink'][] = 'ArchiveLinks::rewriteLinks';
2325
 26+$wgSpecialPages['ArchiveBlacklist'] = 'SpecialArchiveBlacklist';
 27+
2428 $wgArchiveLinksConfig = array (
2529 'archive_service' => 'wikiwix',
2630 'use_multiple_archives' => false,
Index: trunk/extensions/ArchiveLinks/SetupTables.sql
Property changes on: trunk/extensions/ArchiveLinks/SetupTables.sql
___________________________________________________________________
Added: svn:eol-style
2731 + native
Index: trunk/extensions/ArchiveLinks/ArchiveLinks.class.php
@@ -76,9 +76,15 @@
7777
7878 }
7979 }
80 - //Note to self: need to fix this to use Html.php instead of direct html
81 - $link = "<a rel=\"nofollow\" class=\"{$attributes['class']}\" href=\"{$url}\">{$text}</a>&#160;<sup><small><a href=\""
82 - . "{$link_to_archive}\">" . wfMsg( 'archive-links-cache-title' ) . '</a></small></sup>&#160;';
 80+
 81+ $link = HTML::element('a', array ( 'rel' => 'nofollow', 'class' => $attributes['class'], 'href' => $url ), $text )
 82+ . HTML::openElement('sup')
 83+ . HTML::openElement('small')
 84+ . '&#160;'
 85+ . HTML::element('a', array ( 'href' => $link_to_archive ), wfMsg( 'archivelinks-cache-title') )
 86+ . HTML::closeElement('small')
 87+ . HTML::closeElement('sup');
 88+
8389 return false;
8490 } else {
8591 return true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r91319* follow up on r91317 to readd spider.php and setuptables.sql with the correc...kbrown22:57, 1 July 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:22, 29 June 2011

Looking better already :)

This is better as $wgOut->addWikiMsg( 'message-name' );

+ $wgOut->addWikiText( wfMsg( 'archivelinks-archive-blacklist-desc' ) );
#Comment by NeilK (talk | contribs)   18:14, 1 July 2011

SetupTables.sql is empty!

Status & tagging log