r69903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69902‎ | r69903 | r69904 >
Date:20:29, 25 July 2010
Author:platonides
Status:ok
Tags:
Comment:
Add missing global $wgProxyKey, remove unused ones, stylize.
Modified paths:
  • /trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber_body.php (modified) (history)
  • /trunk/extensions/PlayerStatsGrabber/README (modified) (history)

Diff [purge]

Index: trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber_body.php
@@ -4,24 +4,26 @@
55
66 class SpecialPlayerStatsGrabber extends SpecialPage {
77 var $action = '';
 8+
89 function SpecialPlayerStatsGrabber() {
910 SpecialPage::SpecialPage( "PlayerStatsGrabber" );
1011 wfLoadExtensionMessages( 'PlayerStatsGrabber' );
1112 }
 13+
1214 // used for page title
1315 function getDescription() {
1416 switch( $this->req_param ) {
1517 case 'Survey':
1618 return wfMsg( 'ps_take_video_survey' );
17 - break;
 19+
1820 case '':
1921 default:
2022 return wfMsg( 'playerstatsgrabber' );
21 - break;
2223 }
2324 }
 25+
2426 function execute( $par ) {
25 - global $wgRequest, $wgOut;
 27+ global $wgRequest;
2628 $this->req_param = $par;
2729 // print $wgRequest->getText( 'param' );
2830 // set the header:
@@ -32,8 +34,10 @@
3335 case 'Survey':
3436 // check if
3537 $this->do_survey_forum();
36 - break;
37 - case '':default:
 38+ break;
 39+
 40+ case '':
 41+ default:
3842 if ( $wgRequest->getVal( 'action' ) == 'submit' ) {
3943 $this->do_submit_survey();
4044 } else if ( $wgRequest->getVal( 'action' ) == 'survey' ) {
@@ -44,12 +48,14 @@
4549 break;
4650 }
4751 }
 52+
4853 function do_stats_page() {
49 - global $wgOut, $wgRequest;
 54+ global $wgOut;
5055 $wgOut->addWikiText( wfMsg( 'ps_stats_welcome_link' ) );
5156 }
 57+
5258 function do_survey_forum() {
53 - global $wgOut, $psEmbedAry, $wgTitle, $wgUser, $wgEnableParserCache, $wgParser, $wgScript;
 59+ global $wgOut, $psEmbedAry, $wgTitle, $wgUser, $wgParser, $wgProxyKey;
5460 $wgOut->addHTML ( wfMsg( 'ps_survey_description' ) );
5561
5662 // select the embed ary element:
@@ -65,6 +71,7 @@
6672 break;
6773 }
6874 }
 75+
6976 $embed_code = '';
7077 if ( isset( $embed['html_code'] ) ) {
7178 // run the stats (if not internal oggPlay)
@@ -157,6 +164,7 @@
158165 </tr>
159166 </table>' );
160167 }
 168+
161169 function do_submit_player_log() {
162170 global $wgRequest, $psLogEveryPlayRequestPerUser;
163171 // do the insert into the userPlayerStats table:
@@ -167,9 +175,9 @@
168176 'user_hash' => $wgRequest->getVal( 'uh' ),
169177 'file_url' => $wgRequest->getVal( 'purl' ),
170178 'b_user_agent' => $wgRequest->getVal( 'b_user_agent' ),
171 - //'b_name' => $wgRequest->getVal( 'b_name' ),
172 - //'b_version' => $wgRequest->getVal( 'b_version' ),
173 - //'b_os' => $wgRequest->getVal( 'b_os' ),
 179+ // 'b_name' => $wgRequest->getVal( 'b_name' ),
 180+ // 'b_version' => $wgRequest->getVal( 'b_version' ),
 181+ // 'b_os' => $wgRequest->getVal( 'b_os' ),
174182 'flash_version' => $wgRequest->getVal( 'fv' ),
175183 'java_version' => $wgRequest->getVal( 'jv' ),
176184 'html5_video_enabled' => in_array( 'videoElement', $cs ),
@@ -193,17 +201,18 @@
194202 $dbw->commit();
195203 }
196204 header( 'Content-Type: text/javascript' );
197 - if( $wgRequest->getVal( 'cb' )!=null ){
 205+ if ( $wgRequest->getVal( 'cb' ) != null ) {
198206 return htmlspecialchars( $wgRequest->getVal( 'cb' ) ) . '(' . PhpArrayToJsObject_Recurse(
199207 array(
200208 'cb_inx' => htmlspecialchars( $wgRequest->getVal( 'cb_inx' ) ),
201209 'id' => htmlspecialchars( $insert_id )
202210 )
203211 ) . ');';
204 - }else{
 212+ } else {
205213 return htmlspecialchars ( $insert_id );
206214 }
207215 }
 216+
208217 function do_submit_survey() {
209218 global $wgRequest, $wgOut, $wgUser, $psAllowMultipleSurveysPerUser;
210219 // print_r($wgRequest);
@@ -256,18 +265,19 @@
257266 $wgOut->addHTML( wfMsg( 'ps_thanks' ) );
258267 }
259268 }
260 - /* to run the stats in cases where we are not using oggHanndler to play*/
261 - function runJS_Stats( $vid_url='' ) {
 269+
 270+ /* to run the stats in cases where we are not using oggHanndler to play */
 271+ function runJS_Stats( $vid_url = '' ) {
262272 global $wgOut, $wgScriptPath, $wgUser , $wgProxyKey;
263273 $scriptPath = OggHandler::getMyScriptPath();
264274 // include the javascript and do the stats
265275 $jsUserHash = sha1( $wgUser->getName() . $wgProxyKey );
266276 $wgOut->addHTML( '
267 - <script type="text/javascript" src="'. htmlspecialchars( $scriptPath ) .'/OggPlayer.js"></script>
268 - <script type="text/javascript" src="'. htmlspecialchars( $wgScriptPath ) . '/extensions/PlayerStatsGrabber/playerStats.js"></script>
 277+ <script type="text/javascript" src="' . htmlspecialchars( $scriptPath ) . '/OggPlayer.js"></script>
 278+ <script type="text/javascript" src="' . htmlspecialchars( $wgScriptPath ) . '/extensions/PlayerStatsGrabber/playerStats.js"></script>
269279 <script type="text/javascript">
270 - wgOggPlayer.userHash = '. Xml::encodeJsVar( $jsUserHash ) .';
271 - wgOggPlayer.videoUrl='. Xml::encodeJsVar( $vid_url ) . ';
 280+ wgOggPlayer.userHash = ' . Xml::encodeJsVar( $jsUserHash ) . ';
 281+ wgOggPlayer.videoUrl=' . Xml::encodeJsVar( $vid_url ) . ';
272282 wgOggPlayer.doStats();
273283 </script>'
274284 );
Index: trunk/extensions/PlayerStatsGrabber/README
@@ -2,7 +2,7 @@
33
44 ==Install==
55
6 -add to local seettings:
 6+add to local settings:
77 require( "$IP/extensions/PlayerStatsGrabber/PlayerStatsGrabber.php" );
88
99 upload sample_barney.ogg (the survey site should include oggHandler)

Status & tagging log