r80165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80164‎ | r80165 | r80166 >
Date:13:52, 13 January 2011
Author:ialex
Status:deferred
Tags:
Comment:
Per Jack Phoenix, follow-up r80095:
* use addExtensionStyle() and addScriptFile()
* added braces per coding conventions

Also added back the ArticleFromTitle hook that I commented out
Modified paths:
  • /trunk/extensions/TalkHere/TalkHere.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TalkHere/TalkHere.php
@@ -35,7 +35,7 @@
3636 $wgAutoloadClasses['TalkHereEditTarget'] = $dir . 'TalkHereArticle.php';
3737
3838 $wgHooks['BeforePageDisplay'][] = 'wfTalkHereBeforePageDisplay';
39 -#$wgHooks['ArticleFromTitle'][] = 'wfTalkHereArticleFromTitle';
 39+$wgHooks['ArticleFromTitle'][] = 'wfTalkHereArticleFromTitle';
4040 $wgHooks['CustomEditor'][] = 'wfTalkHereCustomEditor';
4141 $wgHooks['EditPage::showEditForm:fields'][] = 'wfTalkHereShowEditFormFields';
4242
@@ -44,18 +44,11 @@
4545 function wfTalkHereBeforePageDisplay( $out, $skin ) {
4646 global $wgScriptPath, $wgJsMimeType, $wgUseAjax;
4747
48 - $out->addLink(
49 - array(
50 - 'rel' => 'stylesheet',
51 - 'type' => 'text/css',
52 - 'href' => $wgScriptPath . '/extensions/TalkHere/TalkHere.css'
53 - )
54 - );
 48+ $out->addExtensionStyle( $wgScriptPath . '/extensions/TalkHere/TalkHere.css' );
5549
56 - if ( $wgUseAjax ) $out->addScript(
57 - "<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}/extensions/TalkHere/TalkHere.js\">" .
58 - "</script>\n"
59 - );
 50+ if ( $wgUseAjax ) {
 51+ $out->addScriptFile( $wgScriptPath . '/extensions/TalkHere/TalkHere.js' );
 52+ }
6053
6154 return true;
6255 }
@@ -63,7 +56,9 @@
6457 function wfTalkHereArticleFromTitle( &$title, &$article ) {
6558 global $wgRequest, $wgTalkHereNamespaces;
6659
67 - if (isset($title->noTalkHere)) return true; //stop recursion
 60+ if ( isset( $title->noTalkHere ) ) {
 61+ return true; //stop recursion
 62+ }
6863
6964 $action = $wgRequest->getVal( 'action' );
7065 $oldid = $wgRequest->getVal( 'oldid' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80095* Use BeforePageDisplay hook to add css and js...ialex16:16, 12 January 2011

Status & tagging log