r54306 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54305‎ | r54306 | r54307 >
Date:20:08, 3 August 2009
Author:dale
Status:deferred
Tags:
Comment:
* fixed some warnings and notices in sequence code
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php
@@ -29,15 +29,16 @@
3030 parent::setGroup( 'MvVideoFeed', 'mv_group' );
3131 }
3232 }
33 - function execute(){
 33+ function execute( $par ){
3434 $MvSpecialExport = new MV_SpecialExport( 'category' );
3535 }
3636 }
 37+
3738 class MvExportStream extends SpecialPage {
3839 function __construct() {
3940 parent::__construct( 'MvExportStream' );
4041 }
41 - function execute(){
 42+ function execute( $par ){
4243 $MvSpecialExport = new MV_SpecialExport( 'stream' );
4344 }
4445 }
@@ -48,7 +49,7 @@
4950 parent::setGroup( 'MvExportSequence', 'mv_group' );
5051 }
5152 }
52 - function execute() {
 53+ function execute( $par ) {
5354 global $wgRequest;
5455 // @@todo replace this ugly hack .. don't know how to get around the missing param atm:
5556 $tl = $wgRequest->getVal( 'title' );
@@ -68,7 +69,7 @@
6970 function __construct() {
7071 parent::__construct( 'MvExportSearch' );
7172 }
72 - function execute() {
 73+ function execute( $par ) {
7374 $MvSpecialExport = new MV_SpecialExport( 'search' );
7475 }
7576
@@ -77,7 +78,7 @@
7879 function __construct() {
7980 parent::__construct( 'MvExportAsk' );
8081 }
81 - function execute() {
 82+ function execute( $par ) {
8283 global $wgTitle;
8384 $MvSpecialExport = new MV_SpecialExport( 'ask' );
8485 }
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php
@@ -18,44 +18,44 @@
1919
2020 class MV_SequencePage extends Article {
2121 var $outMode = 'page';
22 - var $clips = array();
 22+ var $clips = array();
2323 var $mHLRD = ''; //raw text of high level resource description
2424 var $aHLRD = array(); //array representation of high level resource description
2525 function __construct( $title ) {
26 - global $wgRequest;
27 - return parent::__construct( $title );
 26+ global $wgRequest;
 27+ return parent::__construct( $title );
2828 }
2929 /*
3030 * returns the xml output of the sequence with all wiki-text templates/magic words swapped out
3131 * also resolves all image and media locations with absolute paths.
32 - *@param $partial_node_set 'full' (the full nodeset)
33 - * 'seq' (just seq elements)
 32+ *@param $partial_node_set 'full' (the full nodeset)
 33+ * 'seq' (just seq elements)
3434 * 'transition' (just transition elements)
3535 */
3636 function getSequenceSMIL( $partial_node_set='full' ){
37 - global $wgParser,$wgOut, $wgUser, $wgEnableParserCache;
38 - //temporally stop cache:
 37+ global $wgParser,$wgOut, $wgUser, $wgEnableParserCache;
 38+ //temporally stop cache:
3939 $wgEnableParserCache=false;
40 -
 40+
4141 if($wgEnableParserCache){
4242 $mvParserCache = & MV_ParserCache::singleton();
4343 $mvParserCache->addToKey( 'seq-xml' ); //differentiate the articles xml from article
4444 $parserOutput = $mvParserCache->get( $this, $wgUser );
4545 }
46 - if($parserOutput!=false)
 46+ if(isset($parserOutput) && $parserOutput != false)
4747 return $parserOutput->getText();
48 - //get the high level sequence description:
 48+ //get the high level sequence description:
4949 $this->getSequenceHLRD();
50 - $this->parseHLRD_DOM();
51 - //this is the heavy lifting of the getSequenceSMIL function:
 50+ $this->parseHLRD_DOM();
 51+ //this is the heavy lifting of the getSequenceSMIL function:
5252 $this->resolveHLRD_to_SMIL();
53 -
54 - //@@todo get parser Output Object (maybe cleaner way to do this?
55 - //maybe parser cache is not the right place to cache the sequence xml? )
56 - $parserOutput = $wgParser->parse('', $this->mTitle, ParserOptions::newFromUser( $wgUser ));
57 - //output header:
 53+
 54+ //@@todo get parser Output Object (maybe cleaner way to do this?
 55+ //maybe parser cache is not the right place to cache the sequence xml? )
 56+ $parserOutput = $wgParser->parse('', $this->mTitle, ParserOptions::newFromUser( $wgUser ));
 57+ //output header:
5858 $parserOutput->mText.=$this->smilDoc->saveXML();
59 -
 59+
6060 //save to cache if parser cache enabled:
6161 if($wgEnableParserCache)
6262 $mvParserCache->save( $parserOutput, $this, $wgUser );
@@ -63,25 +63,25 @@
6464 return $parserOutput->getText();
6565 }
6666 //DOM based parse:
67 - function parseHLRD_DOM(){
 67+ function parseHLRD_DOM(){
6868 $this->hlrdDoc = new DOMDocument();
69 - $this->hlrdDoc->loadXML($this->mHLRD);
 69+ $this->hlrdDoc->loadXML($this->mHLRD);
7070 }
7171 //go from High level resource description to smile doc
7272 function resolveHLRD_to_SMIL(){
7373 global $wgServer, $wgScript;
74 - //init smil skeleton:
 74+ //init smil skeleton:
7575 $this->smilDoc = new DOMDocument('1.0','UTF-8');
76 -
 76+
7777 $rootNode = $this->smilDoc->createElement('smil');
7878 $rootNode->setAttribute("xmlns", "http://www.w3.org/2001/SMIL20/Language");
79 -
80 - $headNode = $this->smilDoc->createElement('head');
 79+
 80+ $headNode = $this->smilDoc->createElement('head');
8181 //add meta data:
8282 $talkTitle = $this->mTitle->getTalkPage();
8383 $metaData = array(
84 - 'title' => $this->mTitle->getText(),
85 - 'interface_url' => str_replace('index.php', 'api.php', $wgServer . $wgScript), //api link (might be a better way to grab that)
 84+ 'title' => $this->mTitle->getText(),
 85+ 'interface_url' => str_replace('index.php', 'api.php', $wgServer . $wgScript), //api link (might be a better way to grab that)
8686 'linkback' => $this->mTitle->getFullURL(),
8787 'mTitle' => $this->mTitle->getPrefixedDBKey(),
8888 'mTalk' => $talkTitle->getPrefixedDBKey(),
@@ -98,71 +98,71 @@
9999 $titleNode->setAttribute("name", htmlentities('wikiDesc') );
100100 $f = $titleNode->ownerDocument->createDocumentFragment();
101101 $f->appendXML( "<![CDATA[\n".
102 - trim( $this->getPageContent() ).
 102+ trim( $this->getPageContent() ).
103103 "\n]]>");
104 - $titleNode->appendChild($f);
 104+ $titleNode->appendChild($f);
105105 $headNode->appendChild( $titleNode );
106 -
107 -
108 - //add resolved transitions to the head:
 106+
 107+
 108+ //add resolved transitions to the head:
109109 $tranNodeList = $this->hlrdDoc->getElementsByTagName('transition');
110110 foreach ($tranNodeList as $tranNode){
111 - //for now do a direct copy
 111+ //for now do a direct copy
112112 //(future we should do additional validation even though it should be validated on the way in)
113113 $node = $this->smilDoc->importNode($tranNode, true);
114114 $headNode->appendChild($node);
115 - }
 115+ }
116116 $rootNode->appendChild($headNode);
117 -
118 - //add the seq body:
 117+
 118+ //add the seq body:
119119 $bodyNode = $this->smilDoc->createElement('body');
120120 $seqNodeList = $this->hlrdDoc->getElementsByTagName('seq');
121121 foreach($seqNodeList as $seqNode){
122122 //import the top seq node:
123123 $topSeqNode = $this->smilDoc->importNode($seqNode, false);
124124 //get all the media references
125 - //@@todo also get the alias tags (video, audio, image ..etc)
 125+ //@@todo also get the alias tags (video, audio, image ..etc)
126126 $refNodeList = $seqNode->getElementsByTagName('ref');
127 - foreach($refNodeList as $refNode){
128 - //make sure its a valid ref node:
 127+ foreach($refNodeList as $refNode){
 128+ //make sure its a valid ref node:
129129 $refNode = $this->smilDoc->importNode( $this->resolveResourceNode($refNode), true );
130130 $topSeqNode->appendChild($refNode);
131131 }
132132 $bodyNode->appendChild($topSeqNode);
133133 }
134 - $rootNode->appendChild($bodyNode);
 134+ $rootNode->appendChild($bodyNode);
135135 //append the root node to the SMIL DOM:
136136 $this->smilDoc->appendChild($rootNode);
137 - //set to pretty format:
138 - $this->smilDoc->formatOutput = true;
 137+ //set to pretty format:
 138+ $this->smilDoc->formatOutput = true;
139139 }
140140 /*takes an input node returns a resolved node*/
141 - function resolveResourceNode(& $node){
 141+ function resolveResourceNode(& $node){
142142 global $wgUser,$wgParser;
143143 //print 'resolveResourceNode:' . $node->nodeName . " : " . $node->nodeValue . "\n";
144 -
145 - //don't process free flowing text
 144+
 145+ //don't process free flowing text
146146 //@@todo (we should probably throw it out)
147147 if($node instanceof DOMText)
148148 return $node;
149 -
 149+
150150 $nodeAttr = $node->attributes;
151151 $node_uri=false;
152 - if(!is_null($nodeAttr)){
 152+ if(!is_null($nodeAttr)){
153153 foreach($nodeAttr as $atrr){
154154 if($atrr->nodeName=='uri'){
155 - $node_uri = $atrr->nodeValue;
 155+ $node_uri = $atrr->nodeValue;
156156 }
157157 }
158 - }
159 -
 158+ }
 159+
160160 //if no resource uri is provided just parse inner html and return
161 - if(!$node_uri){
 161+ if(!$node_uri){
162162 $node->setAttribute('type','text/html');
163 - return $this->parseInnerWikiText($node);
 163+ return $this->parseInnerWikiText($node);
164164 }
165 -
166 - $uriTitle = Title::newFromDBkey($node_uri);
 165+
 166+ $uriTitle = Title::newFromDBkey($node_uri);
167167 //figure out if how we should parse innerHTML:
168168 switch( $uriTitle->getNamespace() ){
169169 case NS_MAIN:
@@ -170,53 +170,53 @@
171171 break;
172172 case MV_NS_SEQUENCE:
173173 //type sequence ..@@todo transclude the sequence into present sequence
174 - //@@todo we should
175 - //change the node type to "par" to group the sequence under a single element (helpfull for editor representation)
 174+ //@@todo we should
 175+ //change the node type to "par" to group the sequence under a single element (helpfull for editor representation)
176176 /*$parElm = $node->ownerDocument->createElement('par');
177 -
 177+
178178 $seqArticle = new MV_SequencePage( $uriTitle );
179179 $seqArticle->getSequenceSMIL();*/
180180 break;
181181 case MV_NS_STREAM:
182182 global $mvDefaultVideoQualityKey, $mvDefaultFlashQualityKey;
183183 //we could include relevant timed text and relevant different source types.
184 -
 184+
185185 //make sure the stream exists:
186186 $mvTitle = new MV_Title($uriTitle);
187 - if(!$mvTitle->doesStreamExist() ){
188 - $node->setAttribute('type','text/html');
 187+ if(!$mvTitle->doesStreamExist() ){
 188+ $node->setAttribute('type','text/html');
189189 $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found',$uriTitle->getText()));
190190 return $node;
191191 }
192 -
193 - //get urls for flash and ogg
194 -
 192+
 193+ //get urls for flash and ogg
 194+
195195 $stream_web_url = $mvTitle->getWebStreamURL( $mvDefaultVideoQualityKey );
196196 $flash_stream_url = $mvTitle->getWebStreamURL( $mvDefaultFlashQualityKey );
197 -
 197+
198198 if( !$stream_web_url && !$flash_stream_url ){
199 - $node->setAttribute('type','text/html');
 199+ $node->setAttribute('type','text/html');
200200 $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found',$uriTitle->getText()));
201201 return $node;
202202 }
203 -
204 - //by default set the ogg source
205 - //@@todo parse child nodes for stream request params?
206 -
207 - if( $stream_web_url ){
 203+
 204+ //by default set the ogg source
 205+ //@@todo parse child nodes for stream request params?
 206+
 207+ if( $stream_web_url ){
208208 $node->setAttribute('type', htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultVideoQualityKey ) ));
209209 $node->setAttribute('src', $stream_web_url );
210210 $node->setAttribute('poster', $mvTitle->getStreamImageURL() );
211 - }
 211+ }
212212 //add in flash as a fallback method:
213213 if( $flash_stream_url ){
214214 $f = $node->ownerDocument->createDocumentFragment();
215215 $f->appendXML( '<source type="' .
216216 htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultFlashQualityKey ) ) .
217217 '" src="' . $flash_stream_url . '"></source>' );
218 - $node->appendChild($f);
219 - }
220 -
 218+ $node->appendChild($f);
 219+ }
 220+
221221 break;
222222 case NS_TEMPLATE:
223223 //templates are of type text/html
@@ -229,8 +229,8 @@
230230 while ( $node->childNodes->length ){
231231 if( $node->firstChild->nodeName=='param' ){
232232 $param = & $node->firstChild;
233 - //make sure we have a name:
234 - if( $param->hasAttribute('name') ){
 233+ //make sure we have a name:
 234+ if( $param->hasAttribute('name') ){
235235 //we have parameters:
236236 $templateText.= "|\n";
237237 $templateText .= $param->getAttribute('name') . '=';
@@ -242,16 +242,16 @@
243243 //grab from inner html:
244244 $inerHTML ='';
245245 while ($param->childNodes->length){
246 - $inerHTML .= $param->ownerDocument->saveXML( $param->firstChild );
247 - $param->removeChild( $param->firstChild );
248 - }
 246+ $inerHTML .= $param->ownerDocument->saveXML( $param->firstChild );
 247+ $param->removeChild( $param->firstChild );
 248+ }
249249 $templateText .= $inerHTML;
250 - $paramVars[ $param->getAttribute('name') ] = $inerHTML;
251 - }
 250+ $paramVars[ $param->getAttribute('name') ] = $inerHTML;
 251+ }
252252 }
253253 $addedParamFlag=true;
254254 }
255 - $node->removeChild($node->firstChild);
 255+ $node->removeChild($node->firstChild);
256256 }
257257 //close up the template wikiText call:
258258 $templateText.=($addedParamFlag)?"\n}}":'}}';
@@ -264,9 +264,9 @@
265265 $phtml.='<param name="' . htmlentities($name) . '">' . htmlentities($val) . '</param>';
266266 }
267267 if($phtml!=''){
268 - $f = $node->ownerDocument->createDocumentFragment();
 268+ $f = $node->ownerDocument->createDocumentFragment();
269269 $f->appendXML( $phtml );
270 - $node->appendChild($f);
 270+ $node->appendChild($f);
271271 }
272272 break;
273273 case NS_IMAGE:
@@ -274,27 +274,27 @@
275275 //lookup the file/stream
276276 global $mvDefaultVideoPlaybackRes;
277277 list($width,$height)= explode('x',$mvDefaultVideoPlaybackRes);
278 - //@@todo more flexibility with image grabbing
279 -
280 - // (probably should be handled via "figure" namespace which could allow arbitrary crop, resize, overlay)
281 - $img = wfFindFile( $uriTitle );
 278+ //@@todo more flexibility with image grabbing
 279+
 280+ // (probably should be handled via "figure" namespace which could allow arbitrary crop, resize, overlay)
 281+ $img = wfFindFile( $uriTitle );
282282 if( !$img ){
283 - $node->setAttribute('type','text/html');
 283+ $node->setAttribute('type','text/html');
284284 $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found',$uriTitle->getText()));
285285 return $node;
286286 }
287 -
 287+
288288 //print "resource found set: " . $img->getMimeType();
289 - //set type attribute:
290 - //get a default wide media;
 289+ //set type attribute:
 290+ //get a default wide media;
291291 $thumbnail = $img->transform( array('width'=>$width) );
292292 if( $thumbnail->isError() ){
293293 $this->parseInnerWikiText( $node, $thumbnail->toHtml() );
294 - }else{
 294+ }else{
295295 $node->setAttribute( 'type', $img->getMimeType() );
296296 $node->setAttribute( 'src', $img->getURL() );
297 -
298 - //if type is ogg: (set dur and poster)
 297+
 298+ //if type is ogg: (set dur and poster)
299299 if( $img->getMimeType()=='application/ogg') {
300300 if( !$node->hasAttribute('dur') )
301301 $node->setAttribute('dur', $thumbnail->file->getLength() );
@@ -302,54 +302,54 @@
303303 $node->setAttribute('poster', $thumbnail->getURL() );
304304 }
305305 }
306 - }
307 - break;
 306+ }
 307+ break;
308308 default:
309 - $node->setAttribute('type','text/html');
310 - $this->parseInnerWikiText($node, wfMsg('mv_resource_not_supported',
 309+ $node->setAttribute('type','text/html');
 310+ $this->parseInnerWikiText($node, wfMsg('mv_resource_not_supported',
311311 $uriTitle->getNsText() . $uriTitle->getText()) );
312312 break;
313 - }
 313+ }
314314 return $node;
315315 }
316316 //@@todo in the future we could do normal XML validation
317317 function validateNodeAttributes( &$node ){
318 - //make sure only valid node Attributes per node name get through & htmlentities the values
 318+ //make sure only valid node Attributes per node name get through & htmlentities the values
319319 }
320320 /*
321 - * parse the inner node as wiki text
 321+ * parse the inner node as wiki text
322322 */
323323 function parseInnerWikiText( &$node, $innerWikiText=''){
324 - global $wgParser;
 324+ global $wgParser, $wgUser;
325325 //put all the child nodes into $innerWikiText
326 - if( $node->hasChildNodes() ){
 326+ if( $node->hasChildNodes() ){
327327 while ($node->childNodes->length){
328 - $innerWikiText.= $node->ownerDocument->saveXML($node->firstChild);
 328+ $innerWikiText.= $node->ownerDocument->saveXML($node->firstChild);
329329 $node->removeChild($node->firstChild);
330 - }
331 - }
332 - if(trim($innerWikiText)!=''){
 330+ }
 331+ }
 332+ if(trim($innerWikiText)!=''){
333333 $f = $node->ownerDocument->createDocumentFragment();
334 - $parserOutput = $wgParser->parse($innerWikiText ,$this->mTitle, ParserOptions::newFromUser( $wgUser ));
 334+ $parserOutput = $wgParser->parse($innerWikiText ,$this->mTitle, ParserOptions::newFromUser( $wgUser ));
335335 $f->appendXML( "<![CDATA[\n".
336 - $parserOutput->getText() .
337 - "\n]]>"
338 - );
339 - $node->appendChild($f);
 336+ $parserOutput->getText() .
 337+ "\n]]>"
 338+ );
 339+ $node->appendChild($f);
340340 }
341341 return $node;
342342 }
343343 function replaceInnerNodeText( &$node, $text){
344 - while ($node->childNodes->length){
 344+ while ($node->childNodes->length){
345345 $node->removeChild($node->firstChild);
346 - }
 346+ }
347347 $f = $node->ownerDocument->createDocumentFragment();
348 - $f->appendXML( "<![CDATA[\n".
 348+ $f->appendXML( "<![CDATA[\n".
349349 $text .
350 - "\n]]>" );
 350+ "\n]]>" );
351351 $node->appendChild($f);
352 - return $node;
353 - }
 352+ return $node;
 353+ }
354354 /*function getSmilXml(){
355355 $o= '<smil xmlns="http://www.w3.org/2001/SMIL20/Language">'."\n";
356356 $o.=$this->ary2xml($this->aHLRD, $baseIndent=1);
@@ -364,25 +364,25 @@
365365 */
366366 /*function resolveHLRD(){
367367 global $wgParser,$wgOut, $wgUser, $wgEnableParserCache;
368 -
 368+
369369 //collapse all tags that can have values
370 - for($i=0;$i<count($this->aHLRD);$i++){
 370+ for($i=0;$i<count($this->aHLRD);$i++){
371371 if(isset( $this->aHLRD[$i])){
372372 $tag = $this->aHLRD[$i];
373373 //print " on tag: $i " . print_r($tag, true) . "\n\n";
374 - //resolve import uri's ...
375 - //@@todo optimize to do all queries/lookups at once.
 374+ //resolve import uri's ...
 375+ //@@todo optimize to do all queries/lookups at once.
376376 if(isset($tag['attributes'])){
377377 if(isset($tag['attributes']['uri'])){
378 - //if resolved resource is done for current pass: continue
 378+ //if resolved resource is done for current pass: continue
379379 if( $this->resolveResource($i) )
380 - continue;
 380+ continue;
381381 }
382382 }
383 -
384 - //collapse & send child nodes to wiki parser
 383+
 384+ //collapse & send child nodes to wiki parser
385385 if( in_array($tag['tag'], array('ref','animation','audio','img','text','textstream','video') )){
386 - //valid tag.. scoop up all child nodes:
 386+ //valid tag.. scoop up all child nodes:
387387 if($tag['type'] == 'open'){
388388 $open_inx = $i+1;
389389 $cvalue = '';
@@ -391,36 +391,36 @@
392392 while( $i<count( $this->aHLRD ) ){
393393 if($tag['type'] == 'close' && $base_depth == $tag['level'] ){
394394 $close_inx = $i-1;
395 - break;
396 - }
 395+ break;
 396+ }
397397 $tag= $this->aHLRD[$i++];
398398 }
399 - //init val if not set:
 399+ //init val if not set:
400400 if(!isset($this->aHLRD[ $open_inx-1 ][ 'value' ]))
401 - $this->aHLRD[ $open_inx-1 ][ 'value' ]='';
402 -
 401+ $this->aHLRD[ $open_inx-1 ][ 'value' ]='';
 402+
403403 //swap in the wiki parsed innerHTML:
404404 $this->aHLRD[ $open_inx-1 ][ 'value' ].=
405405 $this->ary2xml(
406406 array_splice(
407407 $this->aHLRD, $open_inx, ($close_inx-$open_inx)
408 - )
409 - );
410 -
411 - $this->aHLRD[ $open_inx-1 ][ 'type' ] = 'complete';
412 - //remove the close index
 408+ )
 409+ );
 410+
 411+ $this->aHLRD[ $open_inx-1 ][ 'type' ] = 'complete';
 412+ //remove the close index
413413 if($this->aHLRD[$open_inx]['type']=='close')
414 - unset($this->aHLRD[$open_inx]);
 414+ unset($this->aHLRD[$open_inx]);
415415 //update the index (now that we have spliced the array ):
416 - $i= $open_inx-1; //(will ++ on next loop)
417 - }
418 - //$this->aHLRD[ $open_inx-1 ][ 'value' ] = $parserOutput->getText();
419 - }
 416+ $i= $open_inx-1; //(will ++ on next loop)
 417+ }
 418+ //$this->aHLRD[ $open_inx-1 ][ 'value' ] = $parserOutput->getText();
 419+ }
420420 }
421421 }
422 - //print_r($this->aHLRD);
 422+ //print_r($this->aHLRD);
423423 //now that inner xml has been parse and outputed parse innerValue of tag as wiki_text:
424 - for($i=0;$i<count($this->aHLRD);$i++){
 424+ for($i=0;$i<count($this->aHLRD);$i++){
425425 $parserOutput = $wgParser->parse($this->aHLRD[ $i ][ 'value' ] ,$this->mTitle, ParserOptions::newFromUser( $wgUser ));
426426 $this->aHLRD[ $i ][ 'value' ] = $parserOutput->getText();
427427 }
@@ -438,17 +438,17 @@
439439 $this->aHLRD[$i]['value']=wfMsg('mv_resource_not_found', htmlspecialchars($tag['attributes']['uri']) );
440440 $this->aHLRD[ $i ]['attributes']['type']='text/html';
441441 return false;
442 - }
443 - //print "f:getResourceArrayFromTitle";
 442+ }
 443+ //print "f:getResourceArrayFromTitle";
444444 switch( $uriTitle->getNamespace() ){
445445 case NS_MAIN:
446446 //top level ref includes of pages in the main namespace not supported
447447 break;
448 - case NS_TEMPLATE:
 448+ case NS_TEMPLATE:
449449 //grab all the template paramaters
450450 //ignore any tags other than root param values
451 - //print('on tag: ' .$i. ':' . print_r($tag, true));
452 - $paramAry = array();
 451+ //print('on tag: ' .$i. ':' . print_r($tag, true));
 452+ $paramAry = array();
453453 if($tag['type'] == 'open'){
454454 $open_inx = $i;
455455 $base_depth = $tag['level'];
@@ -456,57 +456,57 @@
457457 while( $i<count( $this->aHLRD ) ){
458458 if($tag['type'] == 'close' && $base_depth == $tag['level'] ){
459459 $close_inx = $i-1;
460 - break;
461 - }
462 - if($tag['tag']=='param'
 460+ break;
 461+ }
 462+ if($tag['tag']=='param'
463463 && isset( $tag['attributes'] )
464464 && isset( $tag['attributes']['name'] ) ){
465465 //set via innerHTML
466 - if( isset( $tag['value'] ) )
 466+ if( isset( $tag['value'] ) )
467467 $paramAry[ $tag['attributes']['name'] ] = $tag['value'];
468468 //or set via value attribute
469469 if(isset( $tag['attributes']['value'] ) )
470470 $paramAry[ $tag['attributes']['name'] ] = $tag['attributes']['value'];
471 -
 471+
472472 }
473 - $tag= $this->aHLRD[ $i++ ];
474 - }
 473+ $tag= $this->aHLRD[ $i++ ];
 474+ }
475475 //remove the striped children (that sounds bad)
476 - $tmp = array_splice($this->aHLRD, $open_inx, ($close_inx-$open_inx));
 476+ $tmp = array_splice($this->aHLRD, $open_inx, ($close_inx-$open_inx));
477477 //print "Removed: " . print_r($tmp, true);
478 - //restore the original tag:
 478+ //restore the original tag:
479479 $tag = $this->aHLRD[ $open_inx ];
480480 //restore the index:
481481 $i= $open_inx-1;
482 - }
 482+ }
483483 //print('NOW on tag: ' .$i. ':' . print_r($this->aHLRD[ $i ], true)); ;
484484 //$tag_pre_val=$tag['value'];
485 - //set up wiki_text value:
 485+ //set up wiki_text value:
486486 $this->aHLRD[ $i ]['value'] = '{{' . $uriTitle->getText();
487487 $nl='';
488488 foreach($paramAry as $name=>$val){
489489 $this->aHLRD[ $i ]['value'].= "\n| ". $name . ' = ' . $val;
490 - $nl="\n";
 490+ $nl="\n";
491491 }
492 - $this->aHLRD[ $i ]['value'].=$nl.'}}';
493 - $this->aHLRD[ $i ]['type']='complete';
494 - //set type attribute:
 492+ $this->aHLRD[ $i ]['value'].=$nl.'}}';
 493+ $this->aHLRD[ $i ]['type']='complete';
 494+ //set type attribute:
495495 $this->aHLRD[ $i ]['attributes']['type']='text/html';
496496 return true;
497497 break;
498498 case NS_IMAGE:
499499 global $mvDefaultVideoPlaybackRes;
500500 list($width,$height)= explode('x',$mvDefaultVideoPlaybackRes);
501 - //@@todo more flexiblity with image grabbing
502 -
503 - // (probably should be hanndled via "figure" namespace which could allow arbitary crop, resize, overlay)
504 - $img = wfFindFile( $uriTitle );
505 - //set type attribute:
 501+ //@@todo more flexiblity with image grabbing
 502+
 503+ // (probably should be hanndled via "figure" namespace which could allow arbitary crop, resize, overlay)
 504+ $img = wfFindFile( $uriTitle );
 505+ //set type attribute:
506506 $this->aHLRD[ $i ]['attributes']['type']=$img->getMimeType();
507 -
508 - //get a default width wide image;
 507+
 508+ //get a default width wide image;
509509 $thumbnail = $img->transform( array('width'=>$width) );
510 - //a direct link to media
 510+ //a direct link to media
511511 $this->aHLRD[ $i ]['attributes']['src']=$thumbnail->file->getURL();
512512 return true;
513513 break;
@@ -514,16 +514,16 @@
515515 //transclude a sequence
516516 break;
517517 case MV_NS_STREAM:
518 - //include a media stream expose links to multiple formats
519 - break;
 518+ //include a media stream expose links to multiple formats
 519+ break;
520520 }
521521 }*/
522 - /*function parseHLRD(){
523 - //init the storage array:
 522+ /*function parseHLRD(){
 523+ //init the storage array:
524524 $this->aHLRD = array();
525525 //temporarly parsed storage
526 - $tmpAry = array();
527 - //parse the xml:
 526+ $tmpAry = array();
 527+ //parse the xml:
528528 $xml_parser = xml_parser_create( 'UTF-8' ); // UTF-8 or ISO-8859-1
529529 xml_parser_set_option( $xml_parser, XML_OPTION_CASE_FOLDING, 0 );
530530 xml_parser_set_option( $xml_parser, XML_OPTION_SKIP_WHITE, 1 );
@@ -531,32 +531,32 @@
532532 throw new MWException( 'error: '.
533533 xml_error_string(xml_get_error_code($xml_parser)).
534534 ' at line '.
535 - xml_get_current_line_number($xml_parser)
536 - );
 535+ xml_get_current_line_number($xml_parser)
 536+ );
537537 }
538 - xml_parser_free($xml_parser);
539 -
 538+ xml_parser_free($xml_parser);
 539+
540540 //validate input with $mvHLRDTags definition
541541 //*Currently dissabled ~~unclear if we really need to do this~~~
542542 /*
543 - * defines approved HLRD (high level resource description) tag => attributes
544 - * would be nice to use a normal xml dtd (document type defenitions)
545 - * but kind of verbose for the time being while things are still under dev
 543+ * defines approved HLRD (high level resource description) tag => attributes
 544+ * would be nice to use a normal xml dtd (document type defenitions)
 545+ * but kind of verbose for the time being while things are still under dev
546546 */
547547 /*$mvHLRDTags = Array(
548548 'transition' => array(
549549 'id'=>1,
550 - 'fadeTo'=>1,
 550+ 'fadeTo'=>1,
551551 'fadeFrom'=>1),
552552 'seq' => array(
553 - 'id'=>1,
554 - 'dur'=>1,
 553+ 'id'=>1,
 554+ 'dur'=>1,
555555 'start'=>1,
556556 'uri'=>1,
557557 'value'=>1
558558 )
559559 );
560 - //set all the ref Media Object Elements
 560+ //set all the ref Media Object Elements
561561 //http://www.w3.org/TR/2008/CR-SMIL3-20080115/smil-extended-media-object.html#smilMediaNS-BasicMedia
562562 $mvHLRDTags['ref']=$mvHLRDTags['animation']=$mvHLRDTags['audio']=$mvHLRDTags['img']=$mvHLRDTags['text']=$mvHLRDTags['textstream']=$mvHLRDTags['video']=array(
563563 'id'=>1,
@@ -567,7 +567,7 @@
568568 'start'=>1,
569569 'end'=>1,
570570 'uri'=>1
571 - );
 571+ );
572572 $inx=0;
573573 print "parseHLRD:\n";
574574 print_r($mvHLRDTags);
@@ -577,14 +577,14 @@
578578 //if tag is valid set all the system parsed tag values:
579579 if(isset($mvHLRDTags[ $tag['tag'] ])){
580580 $this->aHLRD[$inx]=array(
581 - 'tag'=>$tag['tag'],
 581+ 'tag'=>$tag['tag'],
582582 'type'=>$tag['type'],
583583 'level'=>$tag['level']
584584 );
585585 foreach($tag['attributes'] as $aName => $aVal){
586586 if(isset($mvHLRDTags[ $tag['tag'] ][ $aName ]))
587587 $this->aHLRD[ $inx ][ 'attributes' ][ $aName ]=$aVal;
588 - }
 588+ }
589589 }
590590 $inx++;
591591 }
@@ -600,8 +600,8 @@
601601 if($tag['type']!='close'){
602602 if($tag['type']!='cdata')
603603 $o.='<'.$tag['tag'];
604 - if(isset($tag['attributes'])){
605 - //escape all attribute values:
 604+ if(isset($tag['attributes'])){
 605+ //escape all attribute values:
606606 foreach($tag['attributes'] as $attr=>$aval){
607607 $o.=' '.$attr.'="'.htmlspecialchars( $aval ).'"';
608608 }
@@ -613,10 +613,10 @@
614614 //close if complete and had value
615615 $o.=($tag['type']=='complete' && isset($tag['value']) )?
616616 "\n".$c_tab . '</' . $tag['tag'] . '>' . "\n" : '';
617 -
 617+
618618 }else{
619619 $o.='</'.$tag['tag'].'>'."\n";
620 - }
 620+ }
621621 }
622622 return $o;
623623 }*/
@@ -627,7 +627,7 @@
628628 global $wgParser,$wgOut;
629629 //valid playlist in-line-attributes:
630630 $mvInlineAttr = array('wClip', 'mvClip', 'title','linkback','desc','desc','image');
631 -
 631+
632632 //build a associative array of "clips"
633633 $seq_text = $this->getSequenceText();
634634
@@ -674,7 +674,7 @@
675675 if(!isset($clip['title']))$clip['title']='';
676676 if($clip['title']=='')
677677 $clip['title']=$streamTitle->getTitleDesc();
678 -
 678+
679679 if(!isset($clip['info']))$clip['info']='';
680680 if($clip['info']=='')
681681 $clip['info']=$wgStreamTitle->getFullURL();
@@ -712,14 +712,14 @@
713713 function doSeqReplace( &$input, &$argv, &$parser ) {
714714 global $wgTitle, $wgUser, $wgRequest, $markerList;
715715 $sk = $wgUser->getSkin();
716 -
 716+
717717 $options=array();
718718 $oldid = $wgRequest->getVal('oldid');
719719 if( $oldid != '')
720720 $options['oldid'] = $oldid;
721 -
722 - $seqPlayer = new MV_SequencePlayer( $wgTitle );
723 - $vidtag = '<div id="file" class="fullImageLink">';
 721+
 722+ $seqPlayer = new MV_SequencePlayer( $wgTitle );
 723+ $vidtag = '<div id="file" class="fullImageLink">';
724724 $vidtag.= $seqPlayer->getEmbedSeqHtml( $options );
725725 $vidtag .='</div><hr>';
726726
@@ -727,7 +727,7 @@
728728 $markerList[] = $vidtag;
729729 return $marker;
730730 }
731 - function getPageContent() {
 731+ function getPageContent() {
732732 $base_text = parent::getContent();
733733 // strip the sequence
734734 $seqClose = strpos( $base_text, '</' . SEQUENCE_TAG . '>' );
@@ -735,24 +735,24 @@
736736 return trim( substr( $base_text, $seqClose + strlen( '</' . SEQUENCE_TAG . '>' ) ) );
737737 }
738738 }
739 - //@@support static call if article is provided:
740 - function getSequenceHLRD($article=null) {
 739+ //@@support static call if article is provided:
 740+ function getSequenceHLRD($article=null) {
741741 // check if the current article exists:
742742 if ( $this->mTitle->exists() ) {
743743 $base_text = parent::getContent();
744744 $seqOpen = strpos( $base_text, '<' . SEQUENCE_TAG . '>' );
745745 $seqClose = strpos( $base_text, '</' . SEQUENCE_TAG . '>' );
746746 if ( $seqClose !== false ) {
747 - $this->mHLRD = trim( substr( $base_text, $seqOpen, $seqClose+strlen('</' . SEQUENCE_TAG . '>') ) );
 747+ $this->mHLRD = trim( substr( $base_text, $seqOpen, $seqClose+strlen('</' . SEQUENCE_TAG . '>') ) );
748748 }else{
749749 //@@todo error can't find sequence
750750 throw new MWException( 'missing sequence tag in sequence article' );
751751 }
752752 }else{
753 - //@@todo maybe we should output an empty sequence skeleton.
 753+ //@@todo maybe we should output an empty sequence skeleton.
754754 throw new MWException( ' missing sequence ' );
755755 }
756 - return '';
 756+ return '';
757757 }
758758 }
759759 ?>

Status & tagging log