Index: trunk/extensions/PlayerStatsGrabber/PlayerStatsGrabber_body.php |
— | — | @@ -4,24 +4,26 @@ |
5 | 5 | |
6 | 6 | class SpecialPlayerStatsGrabber extends SpecialPage { |
7 | 7 | var $action = ''; |
| 8 | + |
8 | 9 | function SpecialPlayerStatsGrabber() { |
9 | 10 | SpecialPage::SpecialPage( "PlayerStatsGrabber" ); |
10 | 11 | wfLoadExtensionMessages( 'PlayerStatsGrabber' ); |
11 | 12 | } |
| 13 | + |
12 | 14 | // used for page title |
13 | 15 | function getDescription() { |
14 | 16 | switch( $this->req_param ) { |
15 | 17 | case 'Survey': |
16 | 18 | return wfMsg( 'ps_take_video_survey' ); |
17 | | - break; |
| 19 | + |
18 | 20 | case '': |
19 | 21 | default: |
20 | 22 | return wfMsg( 'playerstatsgrabber' ); |
21 | | - break; |
22 | 23 | } |
23 | 24 | } |
| 25 | + |
24 | 26 | function execute( $par ) { |
25 | | - global $wgRequest, $wgOut; |
| 27 | + global $wgRequest; |
26 | 28 | $this->req_param = $par; |
27 | 29 | // print $wgRequest->getText( 'param' ); |
28 | 30 | // set the header: |
— | — | @@ -32,8 +34,10 @@ |
33 | 35 | case 'Survey': |
34 | 36 | // check if |
35 | 37 | $this->do_survey_forum(); |
36 | | - break; |
37 | | - case '':default: |
| 38 | + break; |
| 39 | + |
| 40 | + case '': |
| 41 | + default: |
38 | 42 | if ( $wgRequest->getVal( 'action' ) == 'submit' ) { |
39 | 43 | $this->do_submit_survey(); |
40 | 44 | } else if ( $wgRequest->getVal( 'action' ) == 'survey' ) { |
— | — | @@ -44,12 +48,14 @@ |
45 | 49 | break; |
46 | 50 | } |
47 | 51 | } |
| 52 | + |
48 | 53 | function do_stats_page() { |
49 | | - global $wgOut, $wgRequest; |
| 54 | + global $wgOut; |
50 | 55 | $wgOut->addWikiText( wfMsg( 'ps_stats_welcome_link' ) ); |
51 | 56 | } |
| 57 | + |
52 | 58 | function do_survey_forum() { |
53 | | - global $wgOut, $psEmbedAry, $wgTitle, $wgUser, $wgEnableParserCache, $wgParser, $wgScript; |
| 59 | + global $wgOut, $psEmbedAry, $wgTitle, $wgUser, $wgParser, $wgProxyKey; |
54 | 60 | $wgOut->addHTML ( wfMsg( 'ps_survey_description' ) ); |
55 | 61 | |
56 | 62 | // select the embed ary element: |
— | — | @@ -65,6 +71,7 @@ |
66 | 72 | break; |
67 | 73 | } |
68 | 74 | } |
| 75 | + |
69 | 76 | $embed_code = ''; |
70 | 77 | if ( isset( $embed['html_code'] ) ) { |
71 | 78 | // run the stats (if not internal oggPlay) |
— | — | @@ -157,6 +164,7 @@ |
158 | 165 | </tr> |
159 | 166 | </table>' ); |
160 | 167 | } |
| 168 | + |
161 | 169 | function do_submit_player_log() { |
162 | 170 | global $wgRequest, $psLogEveryPlayRequestPerUser; |
163 | 171 | // do the insert into the userPlayerStats table: |
— | — | @@ -167,9 +175,9 @@ |
168 | 176 | 'user_hash' => $wgRequest->getVal( 'uh' ), |
169 | 177 | 'file_url' => $wgRequest->getVal( 'purl' ), |
170 | 178 | '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' ), |
174 | 182 | 'flash_version' => $wgRequest->getVal( 'fv' ), |
175 | 183 | 'java_version' => $wgRequest->getVal( 'jv' ), |
176 | 184 | 'html5_video_enabled' => in_array( 'videoElement', $cs ), |
— | — | @@ -193,17 +201,18 @@ |
194 | 202 | $dbw->commit(); |
195 | 203 | } |
196 | 204 | header( 'Content-Type: text/javascript' ); |
197 | | - if( $wgRequest->getVal( 'cb' )!=null ){ |
| 205 | + if ( $wgRequest->getVal( 'cb' ) != null ) { |
198 | 206 | return htmlspecialchars( $wgRequest->getVal( 'cb' ) ) . '(' . PhpArrayToJsObject_Recurse( |
199 | 207 | array( |
200 | 208 | 'cb_inx' => htmlspecialchars( $wgRequest->getVal( 'cb_inx' ) ), |
201 | 209 | 'id' => htmlspecialchars( $insert_id ) |
202 | 210 | ) |
203 | 211 | ) . ');'; |
204 | | - }else{ |
| 212 | + } else { |
205 | 213 | return htmlspecialchars ( $insert_id ); |
206 | 214 | } |
207 | 215 | } |
| 216 | + |
208 | 217 | function do_submit_survey() { |
209 | 218 | global $wgRequest, $wgOut, $wgUser, $psAllowMultipleSurveysPerUser; |
210 | 219 | // print_r($wgRequest); |
— | — | @@ -256,18 +265,19 @@ |
257 | 266 | $wgOut->addHTML( wfMsg( 'ps_thanks' ) ); |
258 | 267 | } |
259 | 268 | } |
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 = '' ) { |
262 | 272 | global $wgOut, $wgScriptPath, $wgUser , $wgProxyKey; |
263 | 273 | $scriptPath = OggHandler::getMyScriptPath(); |
264 | 274 | // include the javascript and do the stats |
265 | 275 | $jsUserHash = sha1( $wgUser->getName() . $wgProxyKey ); |
266 | 276 | $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> |
269 | 279 | <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 ) . '; |
272 | 282 | wgOggPlayer.doStats(); |
273 | 283 | </script>' |
274 | 284 | ); |
Index: trunk/extensions/PlayerStatsGrabber/README |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | ==Install== |
5 | 5 | |
6 | | -add to local seettings: |
| 6 | +add to local settings: |
7 | 7 | require( "$IP/extensions/PlayerStatsGrabber/PlayerStatsGrabber.php" ); |
8 | 8 | |
9 | 9 | upload sample_barney.ogg (the survey site should include oggHandler) |