| Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
| — | — | @@ -8,6 +8,11 @@ |
| 9 | 9 | |
| 10 | 10 | class ArticleFeedbackv5Hooks { |
| 11 | 11 | |
| | 12 | + /** |
| | 13 | + * Resource loader modules |
| | 14 | + * |
| | 15 | + * @var array |
| | 16 | + */ |
| 12 | 17 | protected static $modules = array( |
| 13 | 18 | 'ext.articleFeedbackv5.startup' => array( |
| 14 | 19 | 'scripts' => 'ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js', |
| — | — | @@ -181,6 +186,8 @@ |
| 182 | 187 | |
| 183 | 188 | /** |
| 184 | 189 | * BeforePageDisplay hook |
| | 190 | + * @param $out OutputPage |
| | 191 | + * @return bool |
| 185 | 192 | */ |
| 186 | 193 | public static function beforePageDisplay( $out ) { |
| 187 | 194 | $out->addModules( 'ext.articleFeedbackv5.startup' ); |
| — | — | @@ -189,6 +196,8 @@ |
| 190 | 197 | |
| 191 | 198 | /** |
| 192 | 199 | * ResourceLoaderRegisterModules hook |
| | 200 | + * @param $resourceLoader ResourceLoader |
| | 201 | + * @return bool |
| 193 | 202 | */ |
| 194 | 203 | public static function resourceLoaderRegisterModules( &$resourceLoader ) { |
| 195 | 204 | global $wgExtensionAssetsPath, |
| — | — | @@ -228,6 +237,8 @@ |
| 229 | 238 | |
| 230 | 239 | /** |
| 231 | 240 | * ResourceLoaderGetConfigVars hook |
| | 241 | + * @param $vars array |
| | 242 | + * @return bool |
| 232 | 243 | */ |
| 233 | 244 | public static function resourceLoaderGetConfigVars( &$vars ) { |
| 234 | 245 | global $wgArticleFeedbackv5SMaxage, |
| — | — | @@ -265,6 +276,7 @@ |
| 266 | 277 | * Add the preference in the user preferences with the GetPreferences hook. |
| 267 | 278 | * @param $user User |
| 268 | 279 | * @param $preferences |
| | 280 | + * @return bool |
| 269 | 281 | */ |
| 270 | 282 | public static function getPreferences( $user, &$preferences ) { |
| 271 | 283 | // need to check for existing key, if deployed simultaneously with AFTv4 |
| — | — | @@ -282,16 +294,18 @@ |
| 283 | 295 | * Pushes the tracking fields into the edit page |
| 284 | 296 | * |
| 285 | 297 | * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::showEditForm:fields |
| | 298 | + * @param $editPage EditPage |
| | 299 | + * @param $output OutputPage |
| | 300 | + * @return bool |
| 286 | 301 | */ |
| 287 | 302 | 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' ); |
| 289 | 309 | |
| 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 | | - |
| 296 | 310 | $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_click_tracking', $tracking ); |
| 297 | 311 | $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_bucket_id', $bucketId ); |
| 298 | 312 | $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_cta_id', $ctaId ); |
| — | — | @@ -305,6 +319,8 @@ |
| 306 | 320 | * Tracks edit attempts |
| 307 | 321 | * |
| 308 | 322 | * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::attemptSave |
| | 323 | + * @param $editpage EditPage |
| | 324 | + * @return bool |
| 309 | 325 | */ |
| 310 | 326 | public static function trackEditAttempt( $editpage ) { |
| 311 | 327 | self::trackEvent( 'edit_attempt', $editpage->getArticle()->getTitle() ); // EditPage::getTitle() doesn't exist in 1.18wmf1 |
| — | — | @@ -315,6 +331,18 @@ |
| 316 | 332 | * Tracks successful edits |
| 317 | 333 | * |
| 318 | 334 | * @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 |
| 319 | 347 | */ |
| 320 | 348 | public static function trackEditSuccess( &$article, &$user, $text, |
| 321 | 349 | $summary, $minoredit, $watchthis, $sectionanchor, &$flags, |
| — | — | @@ -327,6 +355,8 @@ |
| 328 | 356 | * Internal use: Tracks an event |
| 329 | 357 | * |
| 330 | 358 | * @param $event string the event name |
| | 359 | + * @param $title Title |
| | 360 | + * @return |
| 331 | 361 | */ |
| 332 | 362 | private static function trackEvent( $event, $title ) { |
| 333 | 363 | global $wgRequest, $wgArticleFeedbackv5Tracking; |