Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php |
— | — | @@ -29,15 +29,16 @@ |
30 | 30 | parent::setGroup( 'MvVideoFeed', 'mv_group' ); |
31 | 31 | } |
32 | 32 | } |
33 | | - function execute(){ |
| 33 | + function execute( $par ){ |
34 | 34 | $MvSpecialExport = new MV_SpecialExport( 'category' ); |
35 | 35 | } |
36 | 36 | } |
| 37 | + |
37 | 38 | class MvExportStream extends SpecialPage { |
38 | 39 | function __construct() { |
39 | 40 | parent::__construct( 'MvExportStream' ); |
40 | 41 | } |
41 | | - function execute(){ |
| 42 | + function execute( $par ){ |
42 | 43 | $MvSpecialExport = new MV_SpecialExport( 'stream' ); |
43 | 44 | } |
44 | 45 | } |
— | — | @@ -48,7 +49,7 @@ |
49 | 50 | parent::setGroup( 'MvExportSequence', 'mv_group' ); |
50 | 51 | } |
51 | 52 | } |
52 | | - function execute() { |
| 53 | + function execute( $par ) { |
53 | 54 | global $wgRequest; |
54 | 55 | // @@todo replace this ugly hack .. don't know how to get around the missing param atm: |
55 | 56 | $tl = $wgRequest->getVal( 'title' ); |
— | — | @@ -68,7 +69,7 @@ |
69 | 70 | function __construct() { |
70 | 71 | parent::__construct( 'MvExportSearch' ); |
71 | 72 | } |
72 | | - function execute() { |
| 73 | + function execute( $par ) { |
73 | 74 | $MvSpecialExport = new MV_SpecialExport( 'search' ); |
74 | 75 | } |
75 | 76 | |
— | — | @@ -77,7 +78,7 @@ |
78 | 79 | function __construct() { |
79 | 80 | parent::__construct( 'MvExportAsk' ); |
80 | 81 | } |
81 | | - function execute() { |
| 82 | + function execute( $par ) { |
82 | 83 | global $wgTitle; |
83 | 84 | $MvSpecialExport = new MV_SpecialExport( 'ask' ); |
84 | 85 | } |
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php |
— | — | @@ -18,44 +18,44 @@ |
19 | 19 | |
20 | 20 | class MV_SequencePage extends Article { |
21 | 21 | var $outMode = 'page'; |
22 | | - var $clips = array(); |
| 22 | + var $clips = array(); |
23 | 23 | var $mHLRD = ''; //raw text of high level resource description |
24 | 24 | var $aHLRD = array(); //array representation of high level resource description |
25 | 25 | function __construct( $title ) { |
26 | | - global $wgRequest; |
27 | | - return parent::__construct( $title ); |
| 26 | + global $wgRequest; |
| 27 | + return parent::__construct( $title ); |
28 | 28 | } |
29 | 29 | /* |
30 | 30 | * returns the xml output of the sequence with all wiki-text templates/magic words swapped out |
31 | 31 | * 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) |
34 | 34 | * 'transition' (just transition elements) |
35 | 35 | */ |
36 | 36 | 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: |
39 | 39 | $wgEnableParserCache=false; |
40 | | - |
| 40 | + |
41 | 41 | if($wgEnableParserCache){ |
42 | 42 | $mvParserCache = & MV_ParserCache::singleton(); |
43 | 43 | $mvParserCache->addToKey( 'seq-xml' ); //differentiate the articles xml from article |
44 | 44 | $parserOutput = $mvParserCache->get( $this, $wgUser ); |
45 | 45 | } |
46 | | - if($parserOutput!=false) |
| 46 | + if(isset($parserOutput) && $parserOutput != false) |
47 | 47 | return $parserOutput->getText(); |
48 | | - //get the high level sequence description: |
| 48 | + //get the high level sequence description: |
49 | 49 | $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: |
52 | 52 | $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: |
58 | 58 | $parserOutput->mText.=$this->smilDoc->saveXML(); |
59 | | - |
| 59 | + |
60 | 60 | //save to cache if parser cache enabled: |
61 | 61 | if($wgEnableParserCache) |
62 | 62 | $mvParserCache->save( $parserOutput, $this, $wgUser ); |
— | — | @@ -63,25 +63,25 @@ |
64 | 64 | return $parserOutput->getText(); |
65 | 65 | } |
66 | 66 | //DOM based parse: |
67 | | - function parseHLRD_DOM(){ |
| 67 | + function parseHLRD_DOM(){ |
68 | 68 | $this->hlrdDoc = new DOMDocument(); |
69 | | - $this->hlrdDoc->loadXML($this->mHLRD); |
| 69 | + $this->hlrdDoc->loadXML($this->mHLRD); |
70 | 70 | } |
71 | 71 | //go from High level resource description to smile doc |
72 | 72 | function resolveHLRD_to_SMIL(){ |
73 | 73 | global $wgServer, $wgScript; |
74 | | - //init smil skeleton: |
| 74 | + //init smil skeleton: |
75 | 75 | $this->smilDoc = new DOMDocument('1.0','UTF-8'); |
76 | | - |
| 76 | + |
77 | 77 | $rootNode = $this->smilDoc->createElement('smil'); |
78 | 78 | $rootNode->setAttribute("xmlns", "http://www.w3.org/2001/SMIL20/Language"); |
79 | | - |
80 | | - $headNode = $this->smilDoc->createElement('head'); |
| 79 | + |
| 80 | + $headNode = $this->smilDoc->createElement('head'); |
81 | 81 | //add meta data: |
82 | 82 | $talkTitle = $this->mTitle->getTalkPage(); |
83 | 83 | $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) |
86 | 86 | 'linkback' => $this->mTitle->getFullURL(), |
87 | 87 | 'mTitle' => $this->mTitle->getPrefixedDBKey(), |
88 | 88 | 'mTalk' => $talkTitle->getPrefixedDBKey(), |
— | — | @@ -98,71 +98,71 @@ |
99 | 99 | $titleNode->setAttribute("name", htmlentities('wikiDesc') ); |
100 | 100 | $f = $titleNode->ownerDocument->createDocumentFragment(); |
101 | 101 | $f->appendXML( "<![CDATA[\n". |
102 | | - trim( $this->getPageContent() ). |
| 102 | + trim( $this->getPageContent() ). |
103 | 103 | "\n]]>"); |
104 | | - $titleNode->appendChild($f); |
| 104 | + $titleNode->appendChild($f); |
105 | 105 | $headNode->appendChild( $titleNode ); |
106 | | - |
107 | | - |
108 | | - //add resolved transitions to the head: |
| 106 | + |
| 107 | + |
| 108 | + //add resolved transitions to the head: |
109 | 109 | $tranNodeList = $this->hlrdDoc->getElementsByTagName('transition'); |
110 | 110 | foreach ($tranNodeList as $tranNode){ |
111 | | - //for now do a direct copy |
| 111 | + //for now do a direct copy |
112 | 112 | //(future we should do additional validation even though it should be validated on the way in) |
113 | 113 | $node = $this->smilDoc->importNode($tranNode, true); |
114 | 114 | $headNode->appendChild($node); |
115 | | - } |
| 115 | + } |
116 | 116 | $rootNode->appendChild($headNode); |
117 | | - |
118 | | - //add the seq body: |
| 117 | + |
| 118 | + //add the seq body: |
119 | 119 | $bodyNode = $this->smilDoc->createElement('body'); |
120 | 120 | $seqNodeList = $this->hlrdDoc->getElementsByTagName('seq'); |
121 | 121 | foreach($seqNodeList as $seqNode){ |
122 | 122 | //import the top seq node: |
123 | 123 | $topSeqNode = $this->smilDoc->importNode($seqNode, false); |
124 | 124 | //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) |
126 | 126 | $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: |
129 | 129 | $refNode = $this->smilDoc->importNode( $this->resolveResourceNode($refNode), true ); |
130 | 130 | $topSeqNode->appendChild($refNode); |
131 | 131 | } |
132 | 132 | $bodyNode->appendChild($topSeqNode); |
133 | 133 | } |
134 | | - $rootNode->appendChild($bodyNode); |
| 134 | + $rootNode->appendChild($bodyNode); |
135 | 135 | //append the root node to the SMIL DOM: |
136 | 136 | $this->smilDoc->appendChild($rootNode); |
137 | | - //set to pretty format: |
138 | | - $this->smilDoc->formatOutput = true; |
| 137 | + //set to pretty format: |
| 138 | + $this->smilDoc->formatOutput = true; |
139 | 139 | } |
140 | 140 | /*takes an input node returns a resolved node*/ |
141 | | - function resolveResourceNode(& $node){ |
| 141 | + function resolveResourceNode(& $node){ |
142 | 142 | global $wgUser,$wgParser; |
143 | 143 | //print 'resolveResourceNode:' . $node->nodeName . " : " . $node->nodeValue . "\n"; |
144 | | - |
145 | | - //don't process free flowing text |
| 144 | + |
| 145 | + //don't process free flowing text |
146 | 146 | //@@todo (we should probably throw it out) |
147 | 147 | if($node instanceof DOMText) |
148 | 148 | return $node; |
149 | | - |
| 149 | + |
150 | 150 | $nodeAttr = $node->attributes; |
151 | 151 | $node_uri=false; |
152 | | - if(!is_null($nodeAttr)){ |
| 152 | + if(!is_null($nodeAttr)){ |
153 | 153 | foreach($nodeAttr as $atrr){ |
154 | 154 | if($atrr->nodeName=='uri'){ |
155 | | - $node_uri = $atrr->nodeValue; |
| 155 | + $node_uri = $atrr->nodeValue; |
156 | 156 | } |
157 | 157 | } |
158 | | - } |
159 | | - |
| 158 | + } |
| 159 | + |
160 | 160 | //if no resource uri is provided just parse inner html and return |
161 | | - if(!$node_uri){ |
| 161 | + if(!$node_uri){ |
162 | 162 | $node->setAttribute('type','text/html'); |
163 | | - return $this->parseInnerWikiText($node); |
| 163 | + return $this->parseInnerWikiText($node); |
164 | 164 | } |
165 | | - |
166 | | - $uriTitle = Title::newFromDBkey($node_uri); |
| 165 | + |
| 166 | + $uriTitle = Title::newFromDBkey($node_uri); |
167 | 167 | //figure out if how we should parse innerHTML: |
168 | 168 | switch( $uriTitle->getNamespace() ){ |
169 | 169 | case NS_MAIN: |
— | — | @@ -170,53 +170,53 @@ |
171 | 171 | break; |
172 | 172 | case MV_NS_SEQUENCE: |
173 | 173 | //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) |
176 | 176 | /*$parElm = $node->ownerDocument->createElement('par'); |
177 | | - |
| 177 | + |
178 | 178 | $seqArticle = new MV_SequencePage( $uriTitle ); |
179 | 179 | $seqArticle->getSequenceSMIL();*/ |
180 | 180 | break; |
181 | 181 | case MV_NS_STREAM: |
182 | 182 | global $mvDefaultVideoQualityKey, $mvDefaultFlashQualityKey; |
183 | 183 | //we could include relevant timed text and relevant different source types. |
184 | | - |
| 184 | + |
185 | 185 | //make sure the stream exists: |
186 | 186 | $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'); |
189 | 189 | $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found',$uriTitle->getText())); |
190 | 190 | return $node; |
191 | 191 | } |
192 | | - |
193 | | - //get urls for flash and ogg |
194 | | - |
| 192 | + |
| 193 | + //get urls for flash and ogg |
| 194 | + |
195 | 195 | $stream_web_url = $mvTitle->getWebStreamURL( $mvDefaultVideoQualityKey ); |
196 | 196 | $flash_stream_url = $mvTitle->getWebStreamURL( $mvDefaultFlashQualityKey ); |
197 | | - |
| 197 | + |
198 | 198 | if( !$stream_web_url && !$flash_stream_url ){ |
199 | | - $node->setAttribute('type','text/html'); |
| 199 | + $node->setAttribute('type','text/html'); |
200 | 200 | $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found',$uriTitle->getText())); |
201 | 201 | return $node; |
202 | 202 | } |
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 ){ |
208 | 208 | $node->setAttribute('type', htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultVideoQualityKey ) )); |
209 | 209 | $node->setAttribute('src', $stream_web_url ); |
210 | 210 | $node->setAttribute('poster', $mvTitle->getStreamImageURL() ); |
211 | | - } |
| 211 | + } |
212 | 212 | //add in flash as a fallback method: |
213 | 213 | if( $flash_stream_url ){ |
214 | 214 | $f = $node->ownerDocument->createDocumentFragment(); |
215 | 215 | $f->appendXML( '<source type="' . |
216 | 216 | htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultFlashQualityKey ) ) . |
217 | 217 | '" src="' . $flash_stream_url . '"></source>' ); |
218 | | - $node->appendChild($f); |
219 | | - } |
220 | | - |
| 218 | + $node->appendChild($f); |
| 219 | + } |
| 220 | + |
221 | 221 | break; |
222 | 222 | case NS_TEMPLATE: |
223 | 223 | //templates are of type text/html |
— | — | @@ -229,8 +229,8 @@ |
230 | 230 | while ( $node->childNodes->length ){ |
231 | 231 | if( $node->firstChild->nodeName=='param' ){ |
232 | 232 | $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') ){ |
235 | 235 | //we have parameters: |
236 | 236 | $templateText.= "|\n"; |
237 | 237 | $templateText .= $param->getAttribute('name') . '='; |
— | — | @@ -242,16 +242,16 @@ |
243 | 243 | //grab from inner html: |
244 | 244 | $inerHTML =''; |
245 | 245 | 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 | + } |
249 | 249 | $templateText .= $inerHTML; |
250 | | - $paramVars[ $param->getAttribute('name') ] = $inerHTML; |
251 | | - } |
| 250 | + $paramVars[ $param->getAttribute('name') ] = $inerHTML; |
| 251 | + } |
252 | 252 | } |
253 | 253 | $addedParamFlag=true; |
254 | 254 | } |
255 | | - $node->removeChild($node->firstChild); |
| 255 | + $node->removeChild($node->firstChild); |
256 | 256 | } |
257 | 257 | //close up the template wikiText call: |
258 | 258 | $templateText.=($addedParamFlag)?"\n}}":'}}'; |
— | — | @@ -264,9 +264,9 @@ |
265 | 265 | $phtml.='<param name="' . htmlentities($name) . '">' . htmlentities($val) . '</param>'; |
266 | 266 | } |
267 | 267 | if($phtml!=''){ |
268 | | - $f = $node->ownerDocument->createDocumentFragment(); |
| 268 | + $f = $node->ownerDocument->createDocumentFragment(); |
269 | 269 | $f->appendXML( $phtml ); |
270 | | - $node->appendChild($f); |
| 270 | + $node->appendChild($f); |
271 | 271 | } |
272 | 272 | break; |
273 | 273 | case NS_IMAGE: |
— | — | @@ -274,27 +274,27 @@ |
275 | 275 | //lookup the file/stream |
276 | 276 | global $mvDefaultVideoPlaybackRes; |
277 | 277 | 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 ); |
282 | 282 | if( !$img ){ |
283 | | - $node->setAttribute('type','text/html'); |
| 283 | + $node->setAttribute('type','text/html'); |
284 | 284 | $this->parseInnerWikiText($node, wfMsg('mv_resource_not_found',$uriTitle->getText())); |
285 | 285 | return $node; |
286 | 286 | } |
287 | | - |
| 287 | + |
288 | 288 | //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; |
291 | 291 | $thumbnail = $img->transform( array('width'=>$width) ); |
292 | 292 | if( $thumbnail->isError() ){ |
293 | 293 | $this->parseInnerWikiText( $node, $thumbnail->toHtml() ); |
294 | | - }else{ |
| 294 | + }else{ |
295 | 295 | $node->setAttribute( 'type', $img->getMimeType() ); |
296 | 296 | $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) |
299 | 299 | if( $img->getMimeType()=='application/ogg') { |
300 | 300 | if( !$node->hasAttribute('dur') ) |
301 | 301 | $node->setAttribute('dur', $thumbnail->file->getLength() ); |
— | — | @@ -302,54 +302,54 @@ |
303 | 303 | $node->setAttribute('poster', $thumbnail->getURL() ); |
304 | 304 | } |
305 | 305 | } |
306 | | - } |
307 | | - break; |
| 306 | + } |
| 307 | + break; |
308 | 308 | 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', |
311 | 311 | $uriTitle->getNsText() . $uriTitle->getText()) ); |
312 | 312 | break; |
313 | | - } |
| 313 | + } |
314 | 314 | return $node; |
315 | 315 | } |
316 | 316 | //@@todo in the future we could do normal XML validation |
317 | 317 | 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 |
319 | 319 | } |
320 | 320 | /* |
321 | | - * parse the inner node as wiki text |
| 321 | + * parse the inner node as wiki text |
322 | 322 | */ |
323 | 323 | function parseInnerWikiText( &$node, $innerWikiText=''){ |
324 | | - global $wgParser; |
| 324 | + global $wgParser, $wgUser; |
325 | 325 | //put all the child nodes into $innerWikiText |
326 | | - if( $node->hasChildNodes() ){ |
| 326 | + if( $node->hasChildNodes() ){ |
327 | 327 | while ($node->childNodes->length){ |
328 | | - $innerWikiText.= $node->ownerDocument->saveXML($node->firstChild); |
| 328 | + $innerWikiText.= $node->ownerDocument->saveXML($node->firstChild); |
329 | 329 | $node->removeChild($node->firstChild); |
330 | | - } |
331 | | - } |
332 | | - if(trim($innerWikiText)!=''){ |
| 330 | + } |
| 331 | + } |
| 332 | + if(trim($innerWikiText)!=''){ |
333 | 333 | $f = $node->ownerDocument->createDocumentFragment(); |
334 | | - $parserOutput = $wgParser->parse($innerWikiText ,$this->mTitle, ParserOptions::newFromUser( $wgUser )); |
| 334 | + $parserOutput = $wgParser->parse($innerWikiText ,$this->mTitle, ParserOptions::newFromUser( $wgUser )); |
335 | 335 | $f->appendXML( "<![CDATA[\n". |
336 | | - $parserOutput->getText() . |
337 | | - "\n]]>" |
338 | | - ); |
339 | | - $node->appendChild($f); |
| 336 | + $parserOutput->getText() . |
| 337 | + "\n]]>" |
| 338 | + ); |
| 339 | + $node->appendChild($f); |
340 | 340 | } |
341 | 341 | return $node; |
342 | 342 | } |
343 | 343 | function replaceInnerNodeText( &$node, $text){ |
344 | | - while ($node->childNodes->length){ |
| 344 | + while ($node->childNodes->length){ |
345 | 345 | $node->removeChild($node->firstChild); |
346 | | - } |
| 346 | + } |
347 | 347 | $f = $node->ownerDocument->createDocumentFragment(); |
348 | | - $f->appendXML( "<![CDATA[\n". |
| 348 | + $f->appendXML( "<![CDATA[\n". |
349 | 349 | $text . |
350 | | - "\n]]>" ); |
| 350 | + "\n]]>" ); |
351 | 351 | $node->appendChild($f); |
352 | | - return $node; |
353 | | - } |
| 352 | + return $node; |
| 353 | + } |
354 | 354 | /*function getSmilXml(){ |
355 | 355 | $o= '<smil xmlns="http://www.w3.org/2001/SMIL20/Language">'."\n"; |
356 | 356 | $o.=$this->ary2xml($this->aHLRD, $baseIndent=1); |
— | — | @@ -364,25 +364,25 @@ |
365 | 365 | */ |
366 | 366 | /*function resolveHLRD(){ |
367 | 367 | global $wgParser,$wgOut, $wgUser, $wgEnableParserCache; |
368 | | - |
| 368 | + |
369 | 369 | //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++){ |
371 | 371 | if(isset( $this->aHLRD[$i])){ |
372 | 372 | $tag = $this->aHLRD[$i]; |
373 | 373 | //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. |
376 | 376 | if(isset($tag['attributes'])){ |
377 | 377 | 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 |
379 | 379 | if( $this->resolveResource($i) ) |
380 | | - continue; |
| 380 | + continue; |
381 | 381 | } |
382 | 382 | } |
383 | | - |
384 | | - //collapse & send child nodes to wiki parser |
| 383 | + |
| 384 | + //collapse & send child nodes to wiki parser |
385 | 385 | 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: |
387 | 387 | if($tag['type'] == 'open'){ |
388 | 388 | $open_inx = $i+1; |
389 | 389 | $cvalue = ''; |
— | — | @@ -391,36 +391,36 @@ |
392 | 392 | while( $i<count( $this->aHLRD ) ){ |
393 | 393 | if($tag['type'] == 'close' && $base_depth == $tag['level'] ){ |
394 | 394 | $close_inx = $i-1; |
395 | | - break; |
396 | | - } |
| 395 | + break; |
| 396 | + } |
397 | 397 | $tag= $this->aHLRD[$i++]; |
398 | 398 | } |
399 | | - //init val if not set: |
| 399 | + //init val if not set: |
400 | 400 | if(!isset($this->aHLRD[ $open_inx-1 ][ 'value' ])) |
401 | | - $this->aHLRD[ $open_inx-1 ][ 'value' ]=''; |
402 | | - |
| 401 | + $this->aHLRD[ $open_inx-1 ][ 'value' ]=''; |
| 402 | + |
403 | 403 | //swap in the wiki parsed innerHTML: |
404 | 404 | $this->aHLRD[ $open_inx-1 ][ 'value' ].= |
405 | 405 | $this->ary2xml( |
406 | 406 | array_splice( |
407 | 407 | $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 |
413 | 413 | if($this->aHLRD[$open_inx]['type']=='close') |
414 | | - unset($this->aHLRD[$open_inx]); |
| 414 | + unset($this->aHLRD[$open_inx]); |
415 | 415 | //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 | + } |
420 | 420 | } |
421 | 421 | } |
422 | | - //print_r($this->aHLRD); |
| 422 | + //print_r($this->aHLRD); |
423 | 423 | //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++){ |
425 | 425 | $parserOutput = $wgParser->parse($this->aHLRD[ $i ][ 'value' ] ,$this->mTitle, ParserOptions::newFromUser( $wgUser )); |
426 | 426 | $this->aHLRD[ $i ][ 'value' ] = $parserOutput->getText(); |
427 | 427 | } |
— | — | @@ -438,17 +438,17 @@ |
439 | 439 | $this->aHLRD[$i]['value']=wfMsg('mv_resource_not_found', htmlspecialchars($tag['attributes']['uri']) ); |
440 | 440 | $this->aHLRD[ $i ]['attributes']['type']='text/html'; |
441 | 441 | return false; |
442 | | - } |
443 | | - //print "f:getResourceArrayFromTitle"; |
| 442 | + } |
| 443 | + //print "f:getResourceArrayFromTitle"; |
444 | 444 | switch( $uriTitle->getNamespace() ){ |
445 | 445 | case NS_MAIN: |
446 | 446 | //top level ref includes of pages in the main namespace not supported |
447 | 447 | break; |
448 | | - case NS_TEMPLATE: |
| 448 | + case NS_TEMPLATE: |
449 | 449 | //grab all the template paramaters |
450 | 450 | //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(); |
453 | 453 | if($tag['type'] == 'open'){ |
454 | 454 | $open_inx = $i; |
455 | 455 | $base_depth = $tag['level']; |
— | — | @@ -456,57 +456,57 @@ |
457 | 457 | while( $i<count( $this->aHLRD ) ){ |
458 | 458 | if($tag['type'] == 'close' && $base_depth == $tag['level'] ){ |
459 | 459 | $close_inx = $i-1; |
460 | | - break; |
461 | | - } |
462 | | - if($tag['tag']=='param' |
| 460 | + break; |
| 461 | + } |
| 462 | + if($tag['tag']=='param' |
463 | 463 | && isset( $tag['attributes'] ) |
464 | 464 | && isset( $tag['attributes']['name'] ) ){ |
465 | 465 | //set via innerHTML |
466 | | - if( isset( $tag['value'] ) ) |
| 466 | + if( isset( $tag['value'] ) ) |
467 | 467 | $paramAry[ $tag['attributes']['name'] ] = $tag['value']; |
468 | 468 | //or set via value attribute |
469 | 469 | if(isset( $tag['attributes']['value'] ) ) |
470 | 470 | $paramAry[ $tag['attributes']['name'] ] = $tag['attributes']['value']; |
471 | | - |
| 471 | + |
472 | 472 | } |
473 | | - $tag= $this->aHLRD[ $i++ ]; |
474 | | - } |
| 473 | + $tag= $this->aHLRD[ $i++ ]; |
| 474 | + } |
475 | 475 | //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)); |
477 | 477 | //print "Removed: " . print_r($tmp, true); |
478 | | - //restore the original tag: |
| 478 | + //restore the original tag: |
479 | 479 | $tag = $this->aHLRD[ $open_inx ]; |
480 | 480 | //restore the index: |
481 | 481 | $i= $open_inx-1; |
482 | | - } |
| 482 | + } |
483 | 483 | //print('NOW on tag: ' .$i. ':' . print_r($this->aHLRD[ $i ], true)); ; |
484 | 484 | //$tag_pre_val=$tag['value']; |
485 | | - //set up wiki_text value: |
| 485 | + //set up wiki_text value: |
486 | 486 | $this->aHLRD[ $i ]['value'] = '{{' . $uriTitle->getText(); |
487 | 487 | $nl=''; |
488 | 488 | foreach($paramAry as $name=>$val){ |
489 | 489 | $this->aHLRD[ $i ]['value'].= "\n| ". $name . ' = ' . $val; |
490 | | - $nl="\n"; |
| 490 | + $nl="\n"; |
491 | 491 | } |
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: |
495 | 495 | $this->aHLRD[ $i ]['attributes']['type']='text/html'; |
496 | 496 | return true; |
497 | 497 | break; |
498 | 498 | case NS_IMAGE: |
499 | 499 | global $mvDefaultVideoPlaybackRes; |
500 | 500 | 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: |
506 | 506 | $this->aHLRD[ $i ]['attributes']['type']=$img->getMimeType(); |
507 | | - |
508 | | - //get a default width wide image; |
| 507 | + |
| 508 | + //get a default width wide image; |
509 | 509 | $thumbnail = $img->transform( array('width'=>$width) ); |
510 | | - //a direct link to media |
| 510 | + //a direct link to media |
511 | 511 | $this->aHLRD[ $i ]['attributes']['src']=$thumbnail->file->getURL(); |
512 | 512 | return true; |
513 | 513 | break; |
— | — | @@ -514,16 +514,16 @@ |
515 | 515 | //transclude a sequence |
516 | 516 | break; |
517 | 517 | 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; |
520 | 520 | } |
521 | 521 | }*/ |
522 | | - /*function parseHLRD(){ |
523 | | - //init the storage array: |
| 522 | + /*function parseHLRD(){ |
| 523 | + //init the storage array: |
524 | 524 | $this->aHLRD = array(); |
525 | 525 | //temporarly parsed storage |
526 | | - $tmpAry = array(); |
527 | | - //parse the xml: |
| 526 | + $tmpAry = array(); |
| 527 | + //parse the xml: |
528 | 528 | $xml_parser = xml_parser_create( 'UTF-8' ); // UTF-8 or ISO-8859-1 |
529 | 529 | xml_parser_set_option( $xml_parser, XML_OPTION_CASE_FOLDING, 0 ); |
530 | 530 | xml_parser_set_option( $xml_parser, XML_OPTION_SKIP_WHITE, 1 ); |
— | — | @@ -531,32 +531,32 @@ |
532 | 532 | throw new MWException( 'error: '. |
533 | 533 | xml_error_string(xml_get_error_code($xml_parser)). |
534 | 534 | ' at line '. |
535 | | - xml_get_current_line_number($xml_parser) |
536 | | - ); |
| 535 | + xml_get_current_line_number($xml_parser) |
| 536 | + ); |
537 | 537 | } |
538 | | - xml_parser_free($xml_parser); |
539 | | - |
| 538 | + xml_parser_free($xml_parser); |
| 539 | + |
540 | 540 | //validate input with $mvHLRDTags definition |
541 | 541 | //*Currently dissabled ~~unclear if we really need to do this~~~ |
542 | 542 | /* |
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 |
546 | 546 | */ |
547 | 547 | /*$mvHLRDTags = Array( |
548 | 548 | 'transition' => array( |
549 | 549 | 'id'=>1, |
550 | | - 'fadeTo'=>1, |
| 550 | + 'fadeTo'=>1, |
551 | 551 | 'fadeFrom'=>1), |
552 | 552 | 'seq' => array( |
553 | | - 'id'=>1, |
554 | | - 'dur'=>1, |
| 553 | + 'id'=>1, |
| 554 | + 'dur'=>1, |
555 | 555 | 'start'=>1, |
556 | 556 | 'uri'=>1, |
557 | 557 | 'value'=>1 |
558 | 558 | ) |
559 | 559 | ); |
560 | | - //set all the ref Media Object Elements |
| 560 | + //set all the ref Media Object Elements |
561 | 561 | //http://www.w3.org/TR/2008/CR-SMIL3-20080115/smil-extended-media-object.html#smilMediaNS-BasicMedia |
562 | 562 | $mvHLRDTags['ref']=$mvHLRDTags['animation']=$mvHLRDTags['audio']=$mvHLRDTags['img']=$mvHLRDTags['text']=$mvHLRDTags['textstream']=$mvHLRDTags['video']=array( |
563 | 563 | 'id'=>1, |
— | — | @@ -567,7 +567,7 @@ |
568 | 568 | 'start'=>1, |
569 | 569 | 'end'=>1, |
570 | 570 | 'uri'=>1 |
571 | | - ); |
| 571 | + ); |
572 | 572 | $inx=0; |
573 | 573 | print "parseHLRD:\n"; |
574 | 574 | print_r($mvHLRDTags); |
— | — | @@ -577,14 +577,14 @@ |
578 | 578 | //if tag is valid set all the system parsed tag values: |
579 | 579 | if(isset($mvHLRDTags[ $tag['tag'] ])){ |
580 | 580 | $this->aHLRD[$inx]=array( |
581 | | - 'tag'=>$tag['tag'], |
| 581 | + 'tag'=>$tag['tag'], |
582 | 582 | 'type'=>$tag['type'], |
583 | 583 | 'level'=>$tag['level'] |
584 | 584 | ); |
585 | 585 | foreach($tag['attributes'] as $aName => $aVal){ |
586 | 586 | if(isset($mvHLRDTags[ $tag['tag'] ][ $aName ])) |
587 | 587 | $this->aHLRD[ $inx ][ 'attributes' ][ $aName ]=$aVal; |
588 | | - } |
| 588 | + } |
589 | 589 | } |
590 | 590 | $inx++; |
591 | 591 | } |
— | — | @@ -600,8 +600,8 @@ |
601 | 601 | if($tag['type']!='close'){ |
602 | 602 | if($tag['type']!='cdata') |
603 | 603 | $o.='<'.$tag['tag']; |
604 | | - if(isset($tag['attributes'])){ |
605 | | - //escape all attribute values: |
| 604 | + if(isset($tag['attributes'])){ |
| 605 | + //escape all attribute values: |
606 | 606 | foreach($tag['attributes'] as $attr=>$aval){ |
607 | 607 | $o.=' '.$attr.'="'.htmlspecialchars( $aval ).'"'; |
608 | 608 | } |
— | — | @@ -613,10 +613,10 @@ |
614 | 614 | //close if complete and had value |
615 | 615 | $o.=($tag['type']=='complete' && isset($tag['value']) )? |
616 | 616 | "\n".$c_tab . '</' . $tag['tag'] . '>' . "\n" : ''; |
617 | | - |
| 617 | + |
618 | 618 | }else{ |
619 | 619 | $o.='</'.$tag['tag'].'>'."\n"; |
620 | | - } |
| 620 | + } |
621 | 621 | } |
622 | 622 | return $o; |
623 | 623 | }*/ |
— | — | @@ -627,7 +627,7 @@ |
628 | 628 | global $wgParser,$wgOut; |
629 | 629 | //valid playlist in-line-attributes: |
630 | 630 | $mvInlineAttr = array('wClip', 'mvClip', 'title','linkback','desc','desc','image'); |
631 | | - |
| 631 | + |
632 | 632 | //build a associative array of "clips" |
633 | 633 | $seq_text = $this->getSequenceText(); |
634 | 634 | |
— | — | @@ -674,7 +674,7 @@ |
675 | 675 | if(!isset($clip['title']))$clip['title']=''; |
676 | 676 | if($clip['title']=='') |
677 | 677 | $clip['title']=$streamTitle->getTitleDesc(); |
678 | | - |
| 678 | + |
679 | 679 | if(!isset($clip['info']))$clip['info']=''; |
680 | 680 | if($clip['info']=='') |
681 | 681 | $clip['info']=$wgStreamTitle->getFullURL(); |
— | — | @@ -712,14 +712,14 @@ |
713 | 713 | function doSeqReplace( &$input, &$argv, &$parser ) { |
714 | 714 | global $wgTitle, $wgUser, $wgRequest, $markerList; |
715 | 715 | $sk = $wgUser->getSkin(); |
716 | | - |
| 716 | + |
717 | 717 | $options=array(); |
718 | 718 | $oldid = $wgRequest->getVal('oldid'); |
719 | 719 | if( $oldid != '') |
720 | 720 | $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">'; |
724 | 724 | $vidtag.= $seqPlayer->getEmbedSeqHtml( $options ); |
725 | 725 | $vidtag .='</div><hr>'; |
726 | 726 | |
— | — | @@ -727,7 +727,7 @@ |
728 | 728 | $markerList[] = $vidtag; |
729 | 729 | return $marker; |
730 | 730 | } |
731 | | - function getPageContent() { |
| 731 | + function getPageContent() { |
732 | 732 | $base_text = parent::getContent(); |
733 | 733 | // strip the sequence |
734 | 734 | $seqClose = strpos( $base_text, '</' . SEQUENCE_TAG . '>' ); |
— | — | @@ -735,24 +735,24 @@ |
736 | 736 | return trim( substr( $base_text, $seqClose + strlen( '</' . SEQUENCE_TAG . '>' ) ) ); |
737 | 737 | } |
738 | 738 | } |
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) { |
741 | 741 | // check if the current article exists: |
742 | 742 | if ( $this->mTitle->exists() ) { |
743 | 743 | $base_text = parent::getContent(); |
744 | 744 | $seqOpen = strpos( $base_text, '<' . SEQUENCE_TAG . '>' ); |
745 | 745 | $seqClose = strpos( $base_text, '</' . SEQUENCE_TAG . '>' ); |
746 | 746 | 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 . '>') ) ); |
748 | 748 | }else{ |
749 | 749 | //@@todo error can't find sequence |
750 | 750 | throw new MWException( 'missing sequence tag in sequence article' ); |
751 | 751 | } |
752 | 752 | }else{ |
753 | | - //@@todo maybe we should output an empty sequence skeleton. |
| 753 | + //@@todo maybe we should output an empty sequence skeleton. |
754 | 754 | throw new MWException( ' missing sequence ' ); |
755 | 755 | } |
756 | | - return ''; |
| 756 | + return ''; |
757 | 757 | } |
758 | 758 | } |
759 | 759 | ?> |