r56530 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56529‎ | r56530 | r56531 >
Date:15:45, 17 September 2009
Author:dale
Status:deferred
Tags:
Comment:
* added js2 check for metavid extension
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
@@ -1,10 +1,10 @@
22 <?
33 /**
4 - * Global functions and constants for Metavid MediaWiki.
5 - *
 4+ * Global functions and constants for Metavid MediaWiki.
 5+ *
66 * All Metavid Wiki code is Released Under the GPL2
77 * for more info visit http://metavid.org/wiki/Code
8 - *
 8+ *
99 */
1010 define( 'MV_VERSION', '1.0r47961' );
1111
@@ -13,9 +13,9 @@
1414 /**
1515 * Switch on Metavid MediaWiki. This function must be called in LocalSettings.php
1616 * its separated out to allow for overwriting semantic wiki hooks and functions
17 - * if semantic wiki is enabled for this wiki.
 17+ * if semantic wiki is enabled for this wiki.
1818 */
19 -
 19+
2020 // add language:
2121 $wgExtensionMessagesFiles['MetavidWiki'] = $mvgIP . '/languages/MV_Messages.php';
2222 require_once( $mvgIP . '/languages/MV_Language.php' );
@@ -29,150 +29,150 @@
3030 $wgSpecialPages['Search'] = 'MV_SpecialSearch';
3131 $wgAutoloadClasses['MV_SpecialSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php';
3232
 33+/**********************************************/
 34+/***** register autoLoad javascript Classes: */
 35+/**********************************************/
 36+$mv_jspath = 'extensions/MetavidWiki/skins/';
 37+
 38+$wgJSAutoloadClasses['mv_allpages'] = $mv_jspath . 'mv_allpages.js';
 39+$wgJSAutoloadClasses['mv_search'] = $mv_jspath . 'mv_search.js';
 40+$wgJSAutoloadClasses['mv_stream'] = $mv_jspath . 'mv_stream.js';
 41+
 42+
3343 function enableMetavid() {
3444 global $wgExtensionFunctions, $smwgNamespacesWithSemanticLinks;
3545 $wgExtensionFunctions[] = 'mvSetupExtension';
36 - // add in metavid namespace to semanticLinks array:
 46+ // add in metavid namespace to semanticLinks array:
3747 $smwgNamespacesWithSemanticLinks[MV_NS_STREAM] = true;
3848 $smwgNamespacesWithSemanticLinks[MV_NS_STREAM_TALK] = false;
3949 $smwgNamespacesWithSemanticLinks[MV_NS_SEQUENCE] = true;
4050 $smwgNamespacesWithSemanticLinks[MV_NS_SEQUENCE_TALK] = false;
4151 $smwgNamespacesWithSemanticLinks[MV_NS_MVD] = true;
4252 $smwgNamespacesWithSemanticLinks[MV_NS_MVD_TALK] = false;
43 -
 53+
4454 return true;
4555 }
4656 function mvSetupExtension() {
4757 global $mvVersion, $mvNamespace, $mvgIP, $wgHooks, $wgExtensionCredits, $mvMasterStore,
4858 $wgParser, $mvArticlePath, $mvgScriptPath, $wgServer, $wgExtensionFunctions, $markerList,$wgVersion,
49 - $wgAjaxExportList, $mvEnableAutoComplete, $mvEnableJSMVDrewrite,
 59+ $wgAjaxExportList, $mvEnableAutoComplete, $mvEnableJSMVDrewrite,
5060 $wgAutoloadClasses, $wgSpecialPages, $wgMediaHandlers, $wgJSAutoloadClasses,
5161 $wgAPIModules;
52 -
5362
 63+
5464 mvfInitMessages();
55 - //add the ALL page header
 65+ //add the ALL page header
5666 mvfAutoAllPageHeader();
57 -
 67+
5868 /********************************
59 - * Ajax Hooks
 69+ * Ajax Hooks
6070 *********************************/
6171 $wgAjaxExportList[] = 'mv_auto_complete_all';
6272 $wgAjaxExportList[] = 'mv_auto_complete_person';
63 -
64 -
 73+
 74+
6575 $wgAjaxExportList[] = 'mv_auto_complete_stream_name';
6676 $wgAjaxExportList[] = 'mv_helpers_auto_complete';
67 -
 77+
6878 $wgAjaxExportList[] = 'mv_disp_mvd';
69 -
 79+
7080 $wgAjaxExportList[] = 'mv_add_disp';
7181 $wgAjaxExportList[] = 'mv_remove_mvd';
7282 $wgAjaxExportList[] = 'mv_disp_remove_mvd';
73 -
 83+
7484 $wgAjaxExportList[] = 'mv_edit_disp';
7585 $wgAjaxExportList[] = 'mv_edit_preview';
76 - $wgAjaxExportList[] = 'mv_edit_submit';
77 -
 86+ $wgAjaxExportList[] = 'mv_edit_submit';
 87+
7888 //$wgAjaxExportList[] = 'mv_history_disp';
7989 $wgAjaxExportList[] = 'mv_adjust_disp';
8090 $wgAjaxExportList[] = 'mv_adjust_submit';
81 -
 91+
8292 //sequence interface exported functions
8393 $wgAjaxExportList[] = 'mv_edit_sequence_submit';
8494 $wgAjaxExportList[] = 'mv_seqtool_disp';
8595 $wgAjaxExportList[] = 'mv_seqtool_clipboard';
86 -
87 -
88 - // search interface exported functions:
 96+
 97+
 98+ // search interface exported functions:
8999 $wgAjaxExportList[] = 'mv_expand_wt';
90100 $wgAjaxExportList[] = 'mv_pl_wt';
91101 $wgAjaxExportList[] = 'mv_submit_remove';
92102 $wgAjaxExportList[] = 'mv_tool_disp';
93103 $wgAjaxExportList[] = 'mv_date_obj';
94 -
95 -
96 - // media serving
 104+
 105+
 106+ // media serving
97107 $wgAjaxExportList[] = 'mv_frame_server';
98 -
99 - /**********************************************/
100 - /***** register autoLoad javascript Classes: */
101 - /**********************************************/
102 - $mv_jspath = $mvgIP . '/skins/';
103 -
104 - $wgJSAutoloadClasses['mv_allpages'] = $mv_jspath . 'mv_allpages.js';
105 - $wgJSAutoloadClasses['mv_search'] = $mv_jspath . 'mv_search.js';
106 - $wgJSAutoloadClasses['mv_stream'] = $mv_jspath . 'mv_stream.js';
107108
108 -
109 -
 109+
110110 /**********************************************/
111111 /***** register autoLoad Classes: *****/
112112 /**********************************************/
113 - // setup autoload classes:
 113+ // setup autoload classes:
114114 $wgAutoloadClasses['MV_Overlay'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_Overlay.php';
115115 $wgAutoloadClasses['MV_Component'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_Component.php';
116 -
 116+
117117 $wgAutoloadClasses['MV_MetavidInterface'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_MetavidInterface.php';
118 -
 118+
119119 $wgAutoloadClasses['MV_SequencePlayer'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_SequencePlayer.php';
120120 $wgAutoloadClasses['MV_SequenceTools'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_SequenceTools.php';
121121 $wgAutoloadClasses['MV_EditSequencePage'] = dirname( __FILE__ ) . '/MV_EditSequencePage.php';
122 -
 122+
123123 $wgAutoloadClasses['MV_VideoPlayer'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_VideoPlayer.php';
124124 $wgAutoloadClasses['MV_Tools'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_Tools.php';
125125 $wgAutoloadClasses['MV_Navigator'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_Navigator.php';
126126 $wgAutoloadClasses['MV_EditPageAjax'] = dirname( __FILE__ ) . '/MV_MetavidInterface/MV_EditPageAjax.php';
127 -
 127+
128128 $wgAutoloadClasses['MV_CategoryPage'] = dirname( __FILE__ ) . '/articlepages/MV_CategoryPage.php';
129129 $wgAutoloadClasses['MV_SequencePage'] = dirname( __FILE__ ) . '/articlepages/MV_SequencePage.php';
130130 $wgAutoloadClasses['MV_StreamPage'] = dirname( __FILE__ ) . '/articlepages/MV_StreamPage.php';
131131 $wgAutoloadClasses['MV_EditDataPage'] = $wgAutoloadClasses['MV_DataPage'] = dirname( __FILE__ ) . '/articlepages/MV_DataPage.php';
132132 $wgAutoloadClasses['MV_EditStreamPage'] = dirname( __FILE__ ) . '/MV_EditStreamPage.php';
133 -
134 -
 133+
 134+
135135 $wgAutoloadClasses['MV_Title'] = dirname( __FILE__ ) . '/MV_Title.php';
136136 $wgAutoloadClasses['MV_Index'] = dirname( __FILE__ ) . '/MV_Index.php';
137137 $wgAutoloadClasses['MV_ImageGallery'] = dirname( __FILE__ ) . '/MV_ImageGallery.php';
138138 $wgAutoloadClasses['MV_Image'] = dirname( __FILE__ ) . '/MV_Image.php';
139139 $wgAutoloadClasses['MV_Stream'] = dirname( __FILE__ ) . '/MV_Stream.php';
140 - $wgAutoloadClasses['MV_StreamFile'] = dirname( __FILE__ ) . '/MV_StreamFile.php';
141 -
 140+ $wgAutoloadClasses['MV_StreamFile'] = dirname( __FILE__ ) . '/MV_StreamFile.php';
 141+
142142 $wgAutoloadClasses['MV_StreamImage'] = dirname( __FILE__ ) . '/MV_StreamImage.php';
143143 $wgAutoloadClasses['MV_ParserCache'] = dirname( __FILE__ ) . '/MV_ParserCache.php';
144144 $wgAutoloadClasses['MV_MagicWords'] = dirname( __FILE__ ) . '/MV_MagicWords.php';
145 -
 145+
146146 /**********************************************/
147147 /***** register special pages hooks *****/
148148 /**********************************************/
149149 $wgAutoloadClasses['MV_SpecialCRUDStream'] = dirname( __FILE__ ) . '/specials/MV_SpecialCRUDStream.php';
150150 $wgSpecialPages['Mv_Add_Stream'] = array( 'MV_SpecialCRUDStream' );
151 -
 151+
152152 $wgAutoloadClasses['MV_SpecialListStreams'] = dirname( __FILE__ ) . '/specials/MV_SpecialListStreams.php';
153 - $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' );
154 -
 153+ $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' );
 154+
155155 /* special export views */
156156 $wgAutoloadClasses['MV_SpecialExport'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
157 -
 157+
158158 $wgAutoloadClasses['MvVideoFeed'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
159159 $wgAutoloadClasses['MvExportStream'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
160160 $wgAutoloadClasses['MvExportSequence'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
161161 $wgAutoloadClasses['MvExportSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
162162 $wgAutoloadClasses['MvExportAsk'] = dirname( __FILE__ ) . '/specials/MV_SpecialExport.php';
163 -
 163+
164164 $wgSpecialPages['MvVideoFeed'] = array( 'MvVideoFeed' );
165165 $wgSpecialPages['MvExportStream'] = array( 'MvExportStream' );
166166 $wgSpecialPages['MvExportSequence'] = array( 'MvExportSequence' );
167167 $wgSpecialPages['MvExportSearch'] = array( 'MvExportSearch' );
168168 $wgSpecialPages['MvExportAsk'] = array( 'MvExportAsk' );
169 -
 169+
170170 $wgAutoloadClasses['MV_SpecialMediaSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php';
171171 $wgSpecialPages['Mv_List_Streams'] = array( 'MV_SpecialListStreams' );
172 -
 172+
173173 $wgAutoloadClasses['MediaSearch'] = dirname( __FILE__ ) . '/specials/MV_SpecialMediaSearch.php';
174174 $wgSpecialPages['MediaSearch'] = array( 'MediaSearch' );
175175 $wgSpecialPages['MV_SpecialSearch'] = array( 'MV_SpecialSearch' );
176 -
 176+
177177 $wgAutoloadClasses['MVAdmin'] = dirname( __FILE__ ) . '/specials/MV_SpecialMVAdmin.php';
178178 $wgSpecialPages['MVAdmin'] = array( 'MVAdmin' );
179179 // require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php');
@@ -188,20 +188,20 @@
189189 // $wgHooks['ArticleSave'][] = 'mvSaveHook';
190190 $wgHooks['ArticleSaveComplete'][] = 'mvSaveHook';
191191 $wgHooks['ArticleDelete'][] = 'mvDeleteHook';
192 - $wgHooks['ArticleFromTitle'][] = 'mvDoMvPage';
 192+ $wgHooks['ArticleFromTitle'][] = 'mvDoMvPage';
193193 $wgHooks['TitleMoveComplete'][] = 'mvMoveHook';
194194 $wgHooks['LinkEnd'][] = 'mvLinkEnd';
195195 $wgHooks['LinkBegin'][] = 'mvLinkBegin';
196 -
 196+
197197 $wgHooks['MakeGlobalVariablesScript'][] = 'mvGlobalJSVariables';
198 -
 198+
199199 //our move function handles calling SMW hook
200200 foreach($wgHooks['TitleMoveComplete'] as $k=>$f){
201201 if($f=='smwfMoveHook'){
202202 unset($wgHooks['TitleMoveComplete'][$k]);
203203 }
204204 }
205 -
 205+
206206 if (version_compare($wgVersion,'1.13','>')) {
207207 $wgHooks['SkinTemplateToolboxEnd'][] = 'mvAddToolBoxLinks'; // introduced only in 1.13
208208 } else {
@@ -209,7 +209,7 @@
210210 }
211211
212212
213 - // @@NOTE this hook is not avaliable by default in medaiwiki
 213+ // @@NOTE this hook is not avaliable by default in medaiwiki
214214 // to use this hook you should add this function to moveTo()
215215 // right after the local check in Title.php:
216216 /*
@@ -219,24 +219,24 @@
220220 }
221221 */
222222 $wgHooks['TitleisValidMove'][] = 'mvisValidMoveOperation';
223 -
 223+
224224 $wgHooks['ParserAfterTidy'][] = 'mvParserAfterTidy';
225 -
 225+
226226 $wgHooks['CustomEditor'][] = 'mvCustomEditor';
227227 $wgParser->setHook( SEQUENCE_TAG, 'mvSeqTag' );
228228
229229 $wgParser->setFunctionHook( 'mvData', 'mvMagicParserFunction_Render' );
230 -
231 -
 230+
 231+
232232 /*
233233 * OggHandler extension overrides
234234 * if the OggHandler is included remap the object for compatibility with metavid
235235 * MV_OggHandler.php handles all the re-mapping
236236 */
237 - if(isset($wgMediaHandlers['application/ogg'])){
 237+ if(isset($wgMediaHandlers['application/ogg'])){
238238 if($wgMediaHandlers['application/ogg'] == 'OggHandler'){
239239 $wgAutoloadClasses['mvOggHandler'] = dirname( __FILE__ ) . '/MV_OggHandler.php';
240 - $wgMediaHandlers['application/ogg']='mvOggHandler';
 240+ $wgMediaHandlers['application/ogg']='mvOggHandler';
241241 $wgParserOutputHooks['OggHandler'] = array( 'mvOggHandler', 'outputHook' );
242242 foreach($wgHooks['LanguageGetMagic'] as & $hook_function){
243243 if($hook_function=='OggHandler::registerMagicWords'){
@@ -253,15 +253,15 @@
254254 }
255255 }
256256
257 -
 257+
258258 /************************************
259 - * API extension (this may be integrated into semantic wiki at some point)
 259+ * API extension (this may be integrated into semantic wiki at some point)
260260 **************************************/
261 -
262 -
263 -
264 -
265 - // $wgHooks['BeforePageDisplay'][] = 'mvDoSpecialPage';
 261+
 262+
 263+
 264+
 265+ // $wgHooks['BeforePageDisplay'][] = 'mvDoSpecialPage';
266266 // $wgHooks['ArticleViewHeader'][] = 'mvArticleViewOpts';
267267 /**********************************************/
268268 /***** credits (see "Special:Version") *****/
@@ -279,13 +279,13 @@
280280 # Define a setup function
281281 # Add a hook to initialize the magic word
282282 $wgHooks['LanguageGetMagic'][] = 'mvMagicParserFunction_Magic';
283 -
 283+
284284 function mvMagicParserFunction_Magic( &$magicWords, $langCode ) {
285285 $magicWords['mvData'] = array( 0, 'mvData' );
286286 $magicWords['mvEmbed'] = array( 0, 'mvEmbed' );
287287 return true;
288288 }
289 -
 289+
290290 function mvMagicParserFunction_Render( &$parser ) {
291291 // gennerate arg_list array without parser param
292292 $arg_list = array_slice( func_get_args(), 1 );
@@ -297,25 +297,28 @@
298298 /***** Header modifications *****/
299299 /**********************************************/
300300 /**
301 - * header script to be added to all pages:
 301+ * header script to be added to all pages:
302302 * enables linkback and autocomplete for search
303303 */
304304 function mvfAutoAllPageHeader() {
305 - global $mvgScriptPath, $wgJsMimeType, $wgOut, $mvExtraHeader, $wgTitle, $mvgJSDebug, $wgEnableScriptLoader, $wgRequest;;
 305+ global $mvgScriptPath, $wgJsMimeType, $wgOut, $mvExtraHeader, $wgTitle;
 306+ global $mvgJSDebug, $wgEnableScriptLoader, $wgRequest, $wgEnableJS2system;
 307+
306308 $mvgScriptPath = htmlspecialchars( $mvgScriptPath );
307 - $wgJsMimeType = htmlspecialchars( $wgJsMimeType ) ;
308 - //set the unquie request value
309 - if( $mvgJSDebug ){
 309+ $wgJsMimeType = htmlspecialchars( $wgJsMimeType ) ;
 310+ //set the unquie request value
 311+ if( $mvgJSDebug ){
310312 $unique_req_param = time();
311313 }else{
312314 //@@todo should read form svn version file info
313315 $unique_req_param = MV_VERSION;
314316 }
315 -
316 - $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_allpages.js" );
317 - $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_search.js" );
318 -
319 -
 317+ if( $wgEnableJS2system ){
 318+ $wgOut->addScriptClass( "mv_allpages" );
 319+ $wgOut->addScriptClass( "mv_search" );
 320+ }
 321+
 322+
320323 $mvCssUrl = $mvgScriptPath . '/skins/mv_custom.css';
321324 $wgOut->addLink( array(
322325 'rel' => 'stylesheet',
@@ -323,13 +326,13 @@
324327 'media' => 'all',
325328 'href' => $mvCssUrl
326329 ) );
327 -
 330+
328331 $wgOut->addScript( $mvExtraHeader );
329332 }
330333 function mvAddPerNamespaceJS( &$title ){
331334 global $mvgScriptPath, $wgJsMimeType, $wgOut;
332335 if( $title->getNamespace() == MV_NS_STREAM )
333 - $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_stream.js" );
 336+ $wgOut->addScriptFile( "{$mvgScriptPath}/skins/mv_stream.js" );
334337 }
335338 function mvAddGlobalJSVariables( $values ){
336339 global $mvGlobalJSVariables;
@@ -337,9 +340,9 @@
338341 }
339342 function mvGlobalJSVariables( $vars ){
340343 global $mvGlobalJSVariables;
341 - $vars = array_merge($vars, $mvGlobalJSVariables);
 344+ $vars = array_merge($vars, $mvGlobalJSVariables);
342345 return true;
343 -}
 346+}
344347 /**
345348 * Init the additional namepsaces used by Metavid MediaWiki. The
346349 * parameter denotes the least unused even namespace ID that is
@@ -348,7 +351,7 @@
349352 function mvInitNamespaces() {
350353 global $mvNamespaceIndex, $wgExtraNamespaces, $wgNamespacesWithSubpages, $wgLanguageCode, $mvgContLang,
351354 $mvLastNamespaceIndex;
352 -
 355+
353356 if ( !isset( $mvNamespaceIndex ) ) {
354357 $mvNamespaceIndex = 100;
355358 }
@@ -360,15 +363,15 @@
361364 define( 'MV_NS_SEQUENCE_TALK', $mvNamespaceIndex + 3 );
362365 define( 'MV_NS_MVD', $mvNamespaceIndex + 4 );
363366 define( 'MV_NS_MVD_TALK', $mvNamespaceIndex + 5 );
364 -
 367+
365368 mvfInitContentLanguage( $wgLanguageCode );
366 -
 369+
367370 // print_r($mvgContLang);
368371 // print_r($mvgContLang->getNamespaces());
369372 // Register namespace identifiers
370373 if ( !is_array( $wgExtraNamespaces ) ) { $wgExtraNamespaces = array(); }
371374 $wgExtraNamespaces = $wgExtraNamespaces + $mvgContLang->getNamespaces();
372 - // update the mvLastNamespaceIndex for however many name spaces are established above:
 375+ // update the mvLastNamespaceIndex for however many name spaces are established above:
373376 $mvLastNamespaceIndex = $mvNamespaceIndex + 6;
374377 }
375378
@@ -463,13 +466,13 @@
464467 function mvOutputJSON( & $data ) {
465468 $fname = 'Mv_output_json_data';
466469 wfProfileIn( $fname );
467 -
 470+
468471 global $wgRequest;
469472
470473 // get callback index and wrap function:
471474 $callback_index = $wgRequest->getVal( 'cb_inx' );
472475 $wrap_function = $wgRequest->getVal( 'cb' );
473 -
 476+
474477 header( 'Content-Type: text/javascript' );
475478 if($callback_index!='' && $wrap_function!=''){
476479 $output = htmlspecialchars( $wrap_function ) . '(' . PhpArrayToJsObject_Recurse(
@@ -479,7 +482,7 @@
480483 )
481484 ) . ');';
482485 }else{
483 - //just produce a results var:
 486+ //just produce a results var:
484487 $output = php2jsObj( array('pay_load'=>$data) );
485488 }
486489 wfProfileOut( $fname );
@@ -538,21 +541,21 @@
539542 * Check if time is NTP based: hh:mm:ss.ms(fraction of a second)
540543 */
541544 function mvIsNtpTime( $time ) {
542 - // could alternatively do preg match: (too strict)
 545+ // could alternatively do preg match: (too strict)
543546 // preg_match('/[0-9]+:[0-9][0-9]:[0-9][0-9]/', $this->start_time, $matches);
544 - // if(count($matches)==0)
 547+ // if(count($matches)==0)
545548 $tp = split( ':', $time );
546549 if ( count( $tp ) >= 4 || count( $tp ) <= 2 )return false;
547550 list( $hours, $min, $sec ) = $tp;
548 - // min/sec should be no larger than 60
 551+ // min/sec should be no larger than 60
549552 if ( $min >= 60 || $sec >= 60 )return false;
550 - // @@TODO min & hour should not be a floating point number
 553+ // @@TODO min & hour should not be a floating point number
551554 if ( is_numeric( $hours ) && is_numeric( $min ) && is_numeric( $sec ) )
552555 return true;
553556 return false;
554557 }
555558 /*
556 - * simple array increment (supports up two 2 dim deep)
 559+ * simple array increment (supports up two 2 dim deep)
557560 * should be a cleaner way to write this... hmm...
558561 */
559562 function assoc_array_increment( &$ary ) {
@@ -577,16 +580,16 @@
578581 break;
579582 }
580583 }
581 -
 584+
582585 /*
583 - * takes ntp time of format hh:mm:ss and converts to seconds
 586+ * takes ntp time of format hh:mm:ss and converts to seconds
584587 */
585588 function npt2seconds( $str_time ) {
586 - $time_ary = explode( ':', $str_time );
 589+ $time_ary = explode( ':', $str_time );
587590 $hours = $min = $sec = 0;
588591 if ( count( $time_ary ) == 3 ) {
589592 $hours = (int) $time_ary[0];
590 - $min = (int) $time_ary[1];
 593+ $min = (int) $time_ary[1];
591594 $sec = (float) $time_ary[2];
592595 } else if ( count( $time_ary ) == 2 ) {
593596 $min = (int) $time_ary[0];
@@ -615,19 +618,19 @@
616619 $o='';
617620 if( $dur['days']!=0){
618621 $msg = ($singular)?'mv_days_singular':'mv_days';
619 - $o.= wfMsg($msg, intval( $dur['days']) );
 622+ $o.= wfMsg($msg, intval( $dur['days']) );
620623 }
621624 if( $dur['hours'] != 0 ){
622625 $msg = ($singular)?'mv_hours_singular':'mv_hours';
623626 $o.= wfMsg($msg, intval( $dur['hours']) );
624 - }
 627+ }
625628 if( $dur['minutes'] != 0 ){
626629 $msg = ($singular)?'mv_minutes_singular':'mv_minutes';
627630 $o.=($o!='')?' ':'';
628631 $o.= wfMsg($msg, intval( $dur['minutes']) );
629 - }
 632+ }
630633 if( ( $short == false || $o == '' ) && $dur['seconds'] ){
631 - $msg = ($singular)?'mv_seconds_singular':'mv_seconds';
 634+ $msg = ($singular)?'mv_seconds_singular':'mv_seconds';
632635 $o.=($o!='')?' ':'';
633636 $o.= wfMsg($msg, intval( $dur['seconds']) );
634637 }
@@ -675,10 +678,10 @@
676679 */
677680 function mvOutputSpecialPage( $title, & $page ) {
678681 global $wgOut, $wgTitle;
679 -
 682+
680683 // $wgTitle = SpecialPage::getTitleFor($title);
681684 $wgTitle->mNamespace = NS_SPECIAL;
682 -
 685+
683686 $wgOut->setPageTitle( $title );
684687 $wgOut->setHTMLTitle( $title );
685688 $wgOut->setArticleRelated( false );
@@ -686,9 +689,9 @@
687690
688691 $wgOut->addHTML( $page );
689692 $wgOut->returnToMain( false );
690 -
 693+
691694 $wgOut->output();
692 -
 695+
693696 exit();
694697 }
695698 function mvDoMetavidStreamPage( &$title, &$article ) {
@@ -696,14 +699,14 @@
697700 if ( $mvTitle->doesStreamExist() ) {
698701 // @@TODO check if we have /name corresponding to a view or
699702 // /ss:ss:ss or /ss:ss:ss/ee:ee:ee corresponding to a time request
700 - // force metavid to be special
 703+ // force metavid to be special
701704 // (@@todo clean up skin.php to enable better tab controls)
702705 // $title->mNamespace= NS_SPECIAL;
703706
704 - // add a hit to the digest if enabled:
 707+ // add a hit to the digest if enabled:
705708 // @@todo (maybe in the future use javascript to confirm they acutally "watched" the clip)
706709 global $mvEnableClipViewDigest, $wgRequest;
707 - // don't log views without end times (default stream view)
 710+ // don't log views without end times (default stream view)
708711 if ( $mvEnableClipViewDigest && $mvTitle->end_time != null && $wgRequest->getVal( 'tl' ) != '1' ) {
709712 $dbw =& wfGetDB( DB_WRITE );
710713 $dbw->insert( 'mv_clipview_digest', array(
@@ -727,18 +730,18 @@
728731 'start_time' => $start_time,
729732 'end_time' => $end_time
730733 ) );
731 - // print $dbw->lastQuery();
732 - // also update the mvd_page if directly requested:
 734+ // print $dbw->lastQuery();
 735+ // also update the mvd_page if directly requested:
733736 $dbw->update( 'mv_mvd_index', array( '`view_count`=`view_count`+1' ),
734737 array( 'stream_id' => $mvTitle->getStreamId(),
735738 'start_time' => $mvTitle->getStartTimeSeconds(),
736739 'end_time' => $mvTitle->getEndTimeSeconds()
737740 ) );
738 - // print $dbw->lastQuery();
 741+ // print $dbw->lastQuery();
739742 }
740 - // @@todo check if the requested title is already just the stream name:
 743+ // @@todo check if the requested title is already just the stream name:
741744 $streamTitle = Title::newFromText( $mvTitle->getStreamName(), MV_NS_STREAM );
742 - // print " new title: " . $streamTitle . "\n";
 745+ // print " new title: " . $streamTitle . "\n";
743746 $article = new MV_StreamPage( $streamTitle, $mvTitle );
744747 } else {
745748 mvMissingStreamPage( $mvTitle->stream_name );
@@ -750,22 +753,22 @@
751754 * @@todo cache this function
752755 */
753756 function mvGetMVStream( $stream_init ) {
754 - global $MVStreams;
 757+ global $MVStreams;
755758 // wfDebug('mv get stream: ' .$stream_name . "\n");
756759 if ( is_object( $stream_init ) ) {
757760 $stream_init = get_object_vars( $stream_init );
758761 } else if ( is_string( $stream_init ) ) {
759 - // if a string is passed in assume its the stream name:
 762+ // if a string is passed in assume its the stream name:
760763 $stream_init = array( 'name' => $stream_init );
761764 }
762765 if ( isset( $stream_init['name'] ) ) {
763766 $stream_name = $stream_init['name'];
764767 } else if ( isset( $stream_init['id'] ) ) {
765768 $stream_name = MV_Stream::getStreamNameFromId( $stream_init['id'] );
766 - } else {
 769+ } else {
767770 die('missing stream id or name'. $stream_init);
768771 }
769 - // @@todo cache in memcache)
 772+ // @@todo cache in memcache)
770773 if ( !isset( $MVStreams[$stream_name] ) ) {
771774 $MVStreams[$stream_name] = new MV_Stream( $stream_init );
772775 $MVStreams[$stream_name]->db_load_stream();
@@ -774,7 +777,7 @@
775778 }
776779
777780 function mvGetMVTitle() {
778 -
 781+
779782 }
780783 function mv_get_person_img( $person_name ) {
781784 $imgTitle = Title::makeTitle( NS_IMAGE, $person_name . '.jpg' );
@@ -784,7 +787,7 @@
785788 $img = wfLocalFile( $imgTitle );
786789 }
787790 } else {
788 - // @@todo add Missing person.jpg to install scripts
 791+ // @@todo add Missing person.jpg to install scripts
789792 $imgTitle = Title::makeTitle( NS_IMAGE, MV_MISSING_PERSON_IMG );
790793 $img = wfFindFile( $imgTitle );
791794 if ( !$img ) {

Status & tagging log