r108080 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108079‎ | r108080 | r108081 >
Date:20:28, 4 January 2012
Author:bsitu
Status:ok
Tags:
Comment:
Add configuration to clicktracking links so that they can be set to on/off
Modified paths:
  • /trunk/extensions/MoodBar/include/MoodBarHTMLEmailNotification.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/include/MoodBarHTMLEmailNotification.php
@@ -240,20 +240,20 @@
241241 * @return array - the links to be tracked in email
242242 */
243243 protected function buildEmailLink() {
244 - $pageObject = array( 'feedbackPage' => SpecialPage::getTitleFor( 'FeedbackDashboard', $this->feedback ),
245 - 'editorTalkPage' => $this->editor->getTalkPage(),
246 - 'targetUserTalkPage' => $this->targetUser->getTalkPage() );
 244+ $pageObject = array( 'feedbackPage' => array( 'obj' => SpecialPage::getTitleFor( 'FeedbackDashboard', $this->feedback ), 'clicktracking' => false ),
 245+ 'editorTalkPage' => array( 'obj' => $this->editor->getTalkPage(), 'clicktracking' => false ),
 246+ 'targetUserTalkPage' => array( 'obj' => $this->targetUser->getTalkPage(), 'clicktracking' => true ) );
247247
248248 $links = array();
249249
250250 // if clickTracking is not enabled, return the full canonical url for email
251251 if ( !class_exists( 'ApiClickTracking' ) ) {
252252 foreach ( $pageObject as $key => $value ) {
253 - $links[$key.'Url'] = $value->getCanonicalURL();
 253+ $links[$key.'Url'] = $value['obj']->getCanonicalURL();
254254 }
255255 }
256256 else {
257 - global $wgServer, $wgScriptPath, $wgMoodBarConfig;
 257+ global $wgMoodBarConfig;
258258
259259 $token = wfGenerateToken();
260260 $eventid = 'ext.feedbackDashboard@' . $wgMoodBarConfig['bucketConfig']['version'] .
@@ -262,10 +262,15 @@
263263 $clickTrackingLink = wfAppendQuery( wfScript( 'api' ),
264264 array( 'action' => 'clicktracking', 'eventid' => $eventid, 'token' => $token ) );
265265
266 - foreach ( $pageObject as $key => $value ) {
267 - $links[$key.'Url'] = wfExpandUrl( wfAppendQuery( $clickTrackingLink,
268 - array( 'redirectto' => $value->getLinkURL(),
269 - 'namespacenumber' => $value->getNamespace() ) ), PROTO_CANONICAL );
 266+ foreach ( $pageObject as $key => $value ) {
 267+ if ( $value['clicktracking'] ) {
 268+ $links[$key.'Url'] = wfExpandUrl( wfAppendQuery( $clickTrackingLink,
 269+ array( 'redirectto' => $value['obj']->getLinkURL(),
 270+ 'namespacenumber' => $value['obj']->getNamespace() ) ), PROTO_CANONICAL );
 271+ }
 272+ else {
 273+ $links[$key.'Url'] = $value['obj']->getCanonicalURL();
 274+ }
270275 }
271276 }
272277

Status & tagging log