Index: trunk/extensions/OggHandler/OggHandler.php |
— | — | @@ -25,8 +25,8 @@ |
26 | 26 | $wgExtensionCredits['media'][] = array( |
27 | 27 | 'name' => 'OggHandler', |
28 | 28 | 'author' => 'Tim Starling', |
29 | | - 'svn-date' => '$LastChangedDate$', |
30 | | - 'svn-revision' => '$LastChangedRevision$', |
| 29 | + 'svn-date' => '$LastChangedDate$', |
| 30 | + 'svn-revision' => '$LastChangedRevision$', |
31 | 31 | 'url' => 'http://www.mediawiki.org/wiki/Extension:OggHandler', |
32 | 32 | 'description' => 'Handler for Ogg Theora and Vorbis files, with JavaScript player.', |
33 | 33 | 'descriptionmsg' => 'ogg-desc', |
— | — | @@ -34,6 +34,11 @@ |
35 | 35 | |
36 | 36 | /******************* CONFIGURATION STARTS HERE **********************/ |
37 | 37 | |
| 38 | + |
| 39 | +//the absolute or relative path of the playerStatsCollector.js file |
| 40 | +$wgStatsCollection=false; |
| 41 | +//$wgPlayerStatsCollectionJs = $wgScriptPath . '/extensions/PlayerStatsGrabber/playerStats.js'; |
| 42 | + |
38 | 43 | // Location of the FFmpeg binary |
39 | 44 | $wgFFmpegLocation = 'ffmpeg'; |
40 | 45 | |
Index: trunk/extensions/OggHandler/OggHandler_body.php |
— | — | @@ -390,7 +390,7 @@ |
391 | 391 | } |
392 | 392 | |
393 | 393 | function setHeaders( $out ) { |
394 | | - global $wgOggScriptVersion, $wgCortadoJarFile, $wgServer; |
| 394 | + global $wgOggScriptVersion, $wgCortadoJarFile, $wgServer, $wgUser, $wgProxyKey, $wgPlayerStatsCollectionJs; |
395 | 395 | if ( $out->hasHeadItem( 'OggHandler' ) ) { |
396 | 396 | return; |
397 | 397 | } |
— | — | @@ -403,7 +403,9 @@ |
404 | 404 | 'ogg-player-totem', 'ogg-player-kaffeine', 'ogg-player-kmplayer', 'ogg-player-mplayerplug-in', |
405 | 405 | 'ogg-player-thumbnail', 'ogg-player-selected', 'ogg-use-player', 'ogg-more', 'ogg-download', |
406 | 406 | 'ogg-desc-link', 'ogg-dismiss', 'ogg-player-soundthumb', 'ogg-no-xiphqt' ); |
407 | | - $msgValues = array_map( 'wfMsg', $msgNames ); |
| 407 | + $msgValues = array_map( 'wfMsg', $msgNames ); |
| 408 | + |
| 409 | + |
408 | 410 | $jsMsgs = Xml::encodeJsVar( (object)array_combine( $msgNames, $msgValues ) ); |
409 | 411 | $cortadoUrl = $wgCortadoJarFile; |
410 | 412 | $scriptPath = self::getMyScriptPath(); |
— | — | @@ -413,7 +415,7 @@ |
414 | 416 | } |
415 | 417 | $encCortadoUrl = Xml::encodeJsVar( $cortadoUrl ); |
416 | 418 | $encExtPathUrl = Xml::encodeJsVar( $scriptPath ); |
417 | | - |
| 419 | + |
418 | 420 | $out->addHeadItem( 'OggHandler', <<<EOT |
419 | 421 | <script type="text/javascript" src="$scriptPath/OggPlayer.js?$wgOggScriptVersion"></script> |
420 | 422 | <script type="text/javascript"> |
— | — | @@ -430,8 +432,19 @@ |
431 | 433 | } |
432 | 434 | </style> |
433 | 435 | EOT |
434 | | - ); |
435 | | - |
| 436 | + ); |
| 437 | + //if collecting stats add relevant code: |
| 438 | + if($wgPlayerStatsCollectionJs){ |
| 439 | + $jsUserHash = sha1( $wgUser->getName() . $wgProxyKey); |
| 440 | + $enUserHash = Xml::encodeJsVar( $jsUserHash ); |
| 441 | + $out->addHeadItem('playerStatsCollection', <<<EOT |
| 442 | +<script type="text/javascript" src="$wgPlayerStatsCollectionJs"></script> |
| 443 | +<script type="text/javascript"> |
| 444 | +wgOggPlayer.userHash = $enUserHash; |
| 445 | +</script> |
| 446 | +EOT |
| 447 | +); |
| 448 | + } |
436 | 449 | } |
437 | 450 | |
438 | 451 | function parserTransformHook( $parser, $file ) { |