r107796 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107795‎ | r107796 | r107797 >
Date:04:26, 2 January 2012
Author:johnduhart
Status:ok
Tags:aft 
Comment:
ContextSource and docs
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -8,6 +8,11 @@
99
1010 class ArticleFeedbackv5Hooks {
1111
 12+ /**
 13+ * Resource loader modules
 14+ *
 15+ * @var array
 16+ */
1217 protected static $modules = array(
1318 'ext.articleFeedbackv5.startup' => array(
1419 'scripts' => 'ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js',
@@ -181,6 +186,8 @@
182187
183188 /**
184189 * BeforePageDisplay hook
 190+ * @param $out OutputPage
 191+ * @return bool
185192 */
186193 public static function beforePageDisplay( $out ) {
187194 $out->addModules( 'ext.articleFeedbackv5.startup' );
@@ -189,6 +196,8 @@
190197
191198 /**
192199 * ResourceLoaderRegisterModules hook
 200+ * @param $resourceLoader ResourceLoader
 201+ * @return bool
193202 */
194203 public static function resourceLoaderRegisterModules( &$resourceLoader ) {
195204 global $wgExtensionAssetsPath,
@@ -228,6 +237,8 @@
229238
230239 /**
231240 * ResourceLoaderGetConfigVars hook
 241+ * @param $vars array
 242+ * @return bool
232243 */
233244 public static function resourceLoaderGetConfigVars( &$vars ) {
234245 global $wgArticleFeedbackv5SMaxage,
@@ -265,6 +276,7 @@
266277 * Add the preference in the user preferences with the GetPreferences hook.
267278 * @param $user User
268279 * @param $preferences
 280+ * @return bool
269281 */
270282 public static function getPreferences( $user, &$preferences ) {
271283 // need to check for existing key, if deployed simultaneously with AFTv4
@@ -282,16 +294,18 @@
283295 * Pushes the tracking fields into the edit page
284296 *
285297 * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::showEditForm:fields
 298+ * @param $editPage EditPage
 299+ * @param $output OutputPage
 300+ * @return bool
286301 */
287302 public static function pushTrackingFieldsToEdit( $editPage, $output ) {
288 - global $wgRequest;
 303+ $request = $output->getRequest();
 304+ $tracking = $request->getVal( 'articleFeedbackv5_click_tracking' );
 305+ $bucketId = $request->getVal( 'articleFeedbackv5_bucket_id' );
 306+ $ctaId = $request->getVal( 'articleFeedbackv5_cta_id' );
 307+ $location = $request->getVal( 'articleFeedbackv5_location' );
 308+ $token = $request->getVal( 'articleFeedbackv5_ct_token' );
289309
290 - $tracking = $wgRequest->getVal( 'articleFeedbackv5_click_tracking' );
291 - $bucketId = $wgRequest->getVal( 'articleFeedbackv5_bucket_id' );
292 - $ctaId = $wgRequest->getVal( 'articleFeedbackv5_cta_id' );
293 - $location = $wgRequest->getVal( 'articleFeedbackv5_location' );
294 - $token = $wgRequest->getVal( 'articleFeedbackv5_ct_token' );
295 -
296310 $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_click_tracking', $tracking );
297311 $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_bucket_id', $bucketId );
298312 $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_cta_id', $ctaId );
@@ -305,6 +319,8 @@
306320 * Tracks edit attempts
307321 *
308322 * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::attemptSave
 323+ * @param $editpage EditPage
 324+ * @return bool
309325 */
310326 public static function trackEditAttempt( $editpage ) {
311327 self::trackEvent( 'edit_attempt', $editpage->getArticle()->getTitle() ); // EditPage::getTitle() doesn't exist in 1.18wmf1
@@ -315,6 +331,18 @@
316332 * Tracks successful edits
317333 *
318334 * @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleSaveComplete
 335+ * @param $article Article
 336+ * @param $user
 337+ * @param $text
 338+ * @param $summary
 339+ * @param $minoredit
 340+ * @param $watchthis
 341+ * @param $sectionanchor
 342+ * @param $flags
 343+ * @param $revision
 344+ * @param $status
 345+ * @param $baseRevId
 346+ * @return bool
319347 */
320348 public static function trackEditSuccess( &$article, &$user, $text,
321349 $summary, $minoredit, $watchthis, $sectionanchor, &$flags,
@@ -327,6 +355,8 @@
328356 * Internal use: Tracks an event
329357 *
330358 * @param $event string the event name
 359+ * @param $title Title
 360+ * @return
331361 */
332362 private static function trackEvent( $event, $title ) {
333363 global $wgRequest, $wgArticleFeedbackv5Tracking;

Status & tagging log