r57281 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57280‎ | r57281 | r57282 >
Date:09:41, 2 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads: Add a preference (on by default) as to whether or not to display custom user signatures on posts. If it is off, it will just use the default signature. An end to the signature wars :).
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/Hooks.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/i18n/Lqt.i18n.php
@@ -213,6 +213,7 @@
214214 'prefs-lqt' => 'Threaded discussion',
215215 'lqt-preference-display-depth' => 'Maximum reply depth to show:',
216216 'lqt-preference-display-count' => 'Maximum number of replies to show:',
 217+ 'lqt-preference-custom-signatures' => 'Show custom user signatures',
217218
218219 // E-mail notification
219220 'lqt-enotif-subject-reply' => '{{SITENAME}} discussion - Reply: $1',
Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -140,6 +140,7 @@
141141 $wgDefaultUserOptions['lqtnotifytalk'] = true;
142142 $wgDefaultUserOptions['lqtdisplaydepth'] = 3;
143143 $wgDefaultUserOptions['lqtdisplaycount'] = 10;
 144+$wgDefaultUserOptions['lqtcustomsignatures'] = true;
144145
145146 // API
146147 $wgAutoloadClasses['ApiQueryLQTThreads'] = "$dir/api/ApiQueryLQTThreads.php";
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -29,6 +29,7 @@
3030 static $stylesAndScriptsDone = false;
3131
3232 static $userSignatureCache = array();
 33+ static $boringSignatureCache = array();
3334
3435 function __construct( &$output, &$article, &$title, &$user, &$request ) {
3536 $this->article = $article;
@@ -1217,7 +1218,29 @@
12181219 $name = $user->getName();
12191220 $uid = $user->getId();
12201221 }
 1222+
 1223+ if ( $this->user->getOption( 'lqtcustomsignatures' ) ) {
 1224+ return $this->getUserSignature( $user, $uid, $name );
 1225+ } else {
 1226+ return $this->getBoringSignature( $user, $uid, $name );
 1227+ }
 1228+ }
 1229+
 1230+ function getBoringSignature( $user, $uid, $name ) {
 1231+ if ( isset( self::$boringSignatureCache[$name] ) ) {
 1232+ return self::$boringSignatureCache[$name];
 1233+ }
12211234
 1235+ $msg = ($uid > 0) ? 'signature' : 'signature-anon';
 1236+
 1237+ $sig = wfMsgExt( $msg, 'parseinline', array($name, $name) );
 1238+
 1239+ self::$boringSignatureCache[$name] = $sig;
 1240+
 1241+ return $sig;
 1242+ }
 1243+
 1244+ function getUserSignature( $user, $uid, $name ) {
12221245 if ( isset( self::$userSignatureCache[$name] ) ) {
12231246 return self::$userSignatureCache[$name];
12241247 }
Index: trunk/extensions/LiquidThreads/classes/Hooks.php
@@ -151,6 +151,14 @@
152152 global $wgEnableEmail;
153153 wfLoadExtensionMessages( 'LiquidThreads' );
154154
 155+ // Whether or not to show user signatures
 156+ $preferences['lqtcustomsignatures'] =
 157+ array(
 158+ 'type' => 'toggle',
 159+ 'label-message' => 'lqt-preference-custom-signatures',
 160+ 'section' => 'lqt',
 161+ );
 162+
155163 if ($wgEnableEmail) {
156164 $preferences['lqtnotifytalk'] =
157165 array(
@@ -176,7 +184,6 @@
177185 'section' => 'lqt',
178186 );
179187
180 - // Display depth and count
181188 $preferences['lqtdisplaycount'] =
182189 array(
183190 'type' => 'int',

Status & tagging log