r53165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53164‎ | r53165 | r53166 >
Date:11:41, 13 July 2009
Author:minuteelectron
Status:deferred
Tags:
Comment:
* Add freenodeChat extension by Marco 27 (fork of Mibbit extension).
Modified paths:
  • /trunk/extensions/freenodeChat (added) (history)
  • /trunk/extensions/freenodeChat/freenodeChat.alias.php (added) (history)
  • /trunk/extensions/freenodeChat/freenodeChat.i18n.php (added) (history)
  • /trunk/extensions/freenodeChat/freenodeChat.php (added) (history)
  • /trunk/extensions/freenodeChat/freenodeChat_body.php (added) (history)

Diff [purge]

Index: trunk/extensions/freenodeChat/freenodeChat.alias.php
@@ -0,0 +1,17 @@
 2+<?php
 3+/**
 4+* Aliases for special pages
 5+*
 6+*/
 7+
 8+$aliases = array();
 9+
 10+/** English */
 11+$aliases['en'] = array(
 12+ 'FreenodeChat' => array( 'FreenodeChat' ),
 13+);
 14+
 15+/** Italiano */
 16+$aliases['it'] = array(
 17+ 'FreenodeChat' => array( 'FreenodeChat' ),
 18+);
Index: trunk/extensions/freenodeChat/freenodeChat_body.php
@@ -0,0 +1,43 @@
 2+<?php
 3+
 4+/**
 5+* Freenode Chat extension special page class.
 6+*/
 7+
 8+class FreenodeChat extends SpecialPage {
 9+
 10+ function __construct() {
 11+ SpecialPage::SpecialPage( 'FreenodeChat', 'freenode-chat' );
 12+ }
 13+
 14+ function execute( $par ) {
 15+ global $wgOut, $wgUser;
 16+ global $wgFreenodeChannel;
 17+
 18+ // Preperation.
 19+ wfLoadExtensionMessages( 'FreenodeChat' );
 20+ $this->setHeaders();
 21+
 22+ // Introduction message, explaining to users what this is etc.
 23+ $wgOut->addWikiMsg( 'freenode-chat-header' );
 24+
 25+ // Prepare query string to pass to widget.
 26+ $queryAssoc = array(
 27+ 'channels' => $wgFreenodeChannel
 28+ );
 29+
 30+ if ( $wgUser->IsLoggedIn() ) $queryAssoc[ 'nick' ] = str_replace( ' ', '_', $wgUser->getName() );
 31+
 32+ foreach ( $queryAssoc as $parameter => $value ) {
 33+ $query[] = $parameter . '=' . urlencode( $value );
 34+ }
 35+ $queryString = implode( '&', $query );
 36+
 37+ // Output widget.
 38+ $wgOut->addHTML( Xml::openElement( 'iframe', array(
 39+ 'width' => '1000',
 40+ 'height' => '500',
 41+ 'src' => 'http://webchat.freenode.net/?' . $queryString
 42+ ) ) . Xml::closeElement( 'iframe' ) );
 43+ }
 44+}
Index: trunk/extensions/freenodeChat/freenodeChat.i18n.php
@@ -0,0 +1,29 @@
 2+<?php
 3+/**
 4+* Internationalisation file for Freenode Chat extension.
 5+*
 6+*/
 7+
 8+$messages = array();
 9+
 10+/** English */
 11+$messages['en'] = array(
 12+ 'freenodechat' => 'Freenode Chat',
 13+ 'freenode-chat-desc' => 'Adds a [[Special:FreenodeChat|special page]] used to chat in real time with other wiki users (using freenode web IRC client)',
 14+ 'freenode-chat-header' => 'This special page allows you to collaborate in real time with other users of the wiki.
 15+To connect simply press the "Connect" button.
 16+If you are logged in your nickname will have been prefilled.
 17+Anonymous users has to insert a nickname of their choice in "Nickname" field.',
 18+ 'right-freenode-chat' => 'Allowed to use freenode chat',
 19+);
 20+
 21+/** Italian (Italiano) */
 22+$messages['it'] = array(
 23+ 'freenodechat' => 'Chat Freenode',
 24+ 'freenode-chat-desc' => 'Aggiunge una [[Special:FreenodeChat|pagina speciale]] usata per chattare in tempo reale con altri utenti wiki (usando il client web IRC di freenode)',
 25+ 'freenode-chat-header' => 'Questa pagina speciale ti permette di collaborare in tempo reale con altri utenti della wiki.
 26+Per connetterti premi semplicemente il pulsante "Connect".
 27+Se sei giàloggato il tuo nickname saràpreinserito.
 28+Gli utenti anonimi devono inserirne uno a loro scelta nel campo "Nickname"',
 29+ 'right-freenode-chat' => 'Autorizzato a usare la chat',
 30+);
Index: trunk/extensions/freenodeChat/freenodeChat.php
@@ -0,0 +1,42 @@
 2+<?php
 3+/**
 4+ * Freenode Chat
 5+ *
 6+ * Integrates the freenode web IRC client into a special page.
 7+ *
 8+ * @author Robert Leverington <robert@rhl.me.uk>
 9+ * @author Marco 27 <marco27.wiki@gmail.com>
 10+ * @copyright Copyright © 2008 - 2009 Robert Leverington.
 11+ * @copyright Copyright © 2009 Marco 27.
 12+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
 13+ */
 14+
 15+// If this is run directly from the web die as this is not a valid entry point.
 16+if ( !defined( 'MEDIAWIKI' ) ) die( 'Invalid entry point.' );
 17+
 18+// Extension credits.
 19+$wgExtensionCredits[ 'specialpage' ][] = array(
 20+ 'path' => __FILE__,
 21+ 'name' => 'Freenode Chat',
 22+ 'description' => 'Adds a special page used to chat in real time with other wiki users (using freenode web IRC client).',
 23+ 'descriptionmsg' => 'freenode-chat-desc',
 24+ 'version' => '0.1',
 25+ 'author' => array( 'Robert Leverington', 'Marco 27' )
 26+);
 27+
 28+$dir = dirname( __FILE__ ) . '/';
 29+
 30+// Register special page.
 31+$wgSpecialPages[ 'FreenodeChat' ] = 'FreenodeChat';
 32+$wgSpecialPageGroups[ 'FreenodeChat' ] = 'wiki';
 33+$wgAutoloadClasses[ 'FreenodeChat' ] = $dir . 'freenodeChat_body.php';
 34+
 35+// Extension messages.
 36+$wgExtensionMessagesFiles[ 'FreenodeChat' ] = $dir . 'freenodeChat.i18n.php';
 37+$wgExtensionAliasesFiles[ 'FreenodeChat' ] = $dir . 'freenodeChat.alias.php';
 38+
 39+// Permissions.
 40+$wgAvailableRights[] = 'freenode-chat';
 41+$wgGroupPermissions[ '*' ][ 'freenode-chat' ] = true;
 42+$wgGroupPermissions[ 'user' ][ 'freenode-chat' ] = true;
 43+$wgGroupPermissions[ 'sysop' ][ 'freenode-chat' ] = true;

Status & tagging log