-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlib.php
More file actions
859 lines (758 loc) · 27.6 KB
/
Copy pathlib.php
File metadata and controls
859 lines (758 loc) · 27.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
<?php
/**
* Library of functions and constants for module mplayer
* For more information on the parameters used by JW FLV Player see documentation: http://developer.longtailvideo.com/trac/wiki/FlashVars
*
* @author Matt Bury - matbury@gmail.com - http://matbury.com/
* @version $Id: index.php,v 0.2 2009/02/21 matbury Exp $
* @licence http://www.gnu.org/copyleft/gpl.html GNU Public Licence
* @package mplayer
*/
require_once($CFG->dirroot.'/mod/mplayer/locallib.php');
/** Copyright (C) 2009 Matt Bury
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Given an object containing all the necessary data,
* (defined by the form in mod.html) this function
* will create a new instance and return the id number
* of the new instance.
*
* @param object $instance An object from the form in mod.html
* @return int The id of the newly inserted mplayer record
**/
function mplayer_add_instance($mplayer) {
global $DB;
$mplayer->timecreated = time();
// saves draft customization image files into definitive filearea
$instancefiles = mplayer_get_fileareas();
foreach ($instancefiles as $if) {
mplayer_save_draft_file($mplayer, $if);
}
$notes = $mplayer->notes;
$mplayer->notes = $notes['text'];
$mplayer->notesformat = $notes['format'];
return $DB->insert_record('mplayer', $mplayer);
}
/**
* Given an object containing all the necessary data,
* (defined by the form in mod.html) this function
* will update an existing instance with new data.
*
* @param object $instance An object from the form in mod.html
* @return boolean Success/Fail
**/
function mplayer_update_instance($mplayer) {
global $DB;
$mplayer->timemodified = time();
$mplayer->id = $mplayer->instance;
if (!empty($mplayer->playlistgroup['clearplaylist'])) {
mplayer_clear_area($mplayer, 'playlistfile');
} else {
$mplayer->playlistfile = $mplayer->playlistgroup['playlistfile'];
}
if (!empty($mplayer->configxmlgroup['clearconfigxml'])) {
mplayer_clear_area($mplayer, 'configxml');
} else {
$mplayer->configxml = $mplayer->configxmlgroup['configxml'];
}
// Saves draft customization image files into definitive filearea.
$instancefiles = mplayer_get_fileareas();
foreach ($instancefiles as $ci) {
mplayer_save_draft_file($mplayer, $ci);
}
$notes = $mplayer->notes;
$mplayer->notes = $notes['text'];
$mplayer->notesformat = $notes['format'];
return $DB->update_record('mplayer', $mplayer);
}
/**
* Given an ID of an instance of this module,
* this function will permanently delete the instance
* and any data that depends on it.
*
* @param int $id Id of the module instance
* @return boolean Success/Failure
*/
function mplayer_delete_instance($id) {
global $DB;
if (!$mplayer = $DB->get_record('mplayer', array('id' => "$id"))) {
return false;
}
$result = true;
if (!$cm = get_coursemodule_from_instance('mplayer', $mplayer->id)) {
return false;
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$fs = get_file_storage();
$fs->delete_area_files($context->id);
if (! $DB->delete_records("mplayer", array("id" => "$mplayer->id"))) {
$result = false;
}
return $result;
}
/**
* Return a small object with summary information about what a
* user has done with a given particular instance of this module
* Used for user activity reports.
* $return->time = the time they did it
* $return->info = a short text description
*
* @return null
* @todo Finish documenting this function
**/
function mplayer_user_outline($course, $user, $mod, $mplayer) {
$return->time = time();
$return->info = '';
return $return;
/*
if($logs = $DB->get_records_select("log", "userid = '$user->id' AND module = 'mplayer' AND action = 'view' AND info = '$mplayer->id'", "time ASC")) {
$numviews = count($logs);
$lastlog = array_pop($logs);
$result = new stdClass();
$result->info = get_string("numviews", "", $numviews);
$result->time = $lastlog->time;
return $result;
}
return NULL;
*/
}
/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
*
* @return boolean
* @todo Finish documenting this function
**/
function mplayer_user_complete($course, $user, $mod, $mplayer) {
return true;
}
/**
* Given a course and a time, this module should find recent activity
* that has occurred in mplayer activities and print it out.
* Return true if there was output, or false is there was none.
*
* @uses $CFG
* @return boolean
* @todo Finish documenting this function
*/
function mplayer_print_recent_activity($course, $isteacher, $timestart) {
global $CFG;
return false; // True if anything was printed, otherwise false
}
/**
*
*
* @uses $CFG
* @return array
*/
function mplayer_get_view_actions() {
return array('view');
}
/**
*
* @uses $CFG
* @return array
*/
function mplayer_get_post_actions() {
return array('update');
}
/**
* Function to be run periodically according to the moodle cron
* This function searches for things that need to be done, such
* as sending out mail, toggling flags etc.
*
* @uses $CFG
* @return boolean
* @todo Finish documenting this function
*/
function mplayer_cron() {
global $CFG;
return true;
}
/**
* Serves the files included in mplayer. Implements needed access control ;-)
*
* There are several situations in general where the files will be sent.
* 1) filearea = '',
*
* @param object $course
* @param object $cm
* @param object $context
* @param string $filearea
* @param array $args
* @param bool $forcedownload
* @return bool false if file not found, does not return if found - justsend the file
*/
function mplayer_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) {
global $CFG, $DB;
if ($filearea != 'playlistfile') {
require_login($course);
}
if ($context->contextlevel != CONTEXT_MODULE) {
return false;
}
$instancefiles = mplayer_get_fileareas();
if (!in_array($filearea, $instancefiles)) {
return false;
}
$itemid = (int)array_shift($args);
$fs = get_file_storage();
if ($filearea == 'mplayerfile' || $filearea == 'playlistthumb') {
// Case for fileareas possibly holding more than one file.
$relativepath = implode('/', $args);
$fullpath = "/$context->id/mod_mplayer/$filearea/0/$relativepath";
if ($file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) {
send_stored_file($file, 0, 0, $forcedownload);
}
} else {
if ($files = $fs->get_area_files($context->id, 'mod_mplayer', $filearea, $itemid, "sortorder, itemid, filepath, filename", false)) {
$file = array_pop($files);
// finally send the file.
send_stored_file($file, 0, 0, $forcedownload);
}
}
return false;
}
/**
* Must return an array of grades for a given instance of this module,
* indexed by user. It also returns a maximum allowed grade.
*
* Example:
* $return->grades = array of grades;
* $return->maxgrade = maximum allowed grade;
*
* return $return;
*
* @param int $mplayerid ID of an instance of this module
* @return mixed Null or object with an array of grades and with the maximum grade
*/
function mplayer_grades($mplayerid) {
return NULL;
}
/**
* Must return an array of user records (all data) who are participants
* for a given instance of mplayer. Must include every user involved
* in the instance, independient of his role (student, teacher, admin...)
* See other modules as example.
*
* @param int $mplayerid ID of an instance of this module
* @return mixed boolean/array of students
*/
function mplayer_get_participants($mplayerid) {
return false;
}
/**
* This function returns if a scale is being used by one mplayer
* it it has support for grading and scales. Commented code should be
* modified if necessary. See forum, glossary or journal modules
* as reference.
*
* @param int $mplayerid ID of an instance of this module
* @return mixed
* @todo Finish documenting this function
*/
function mplayer_scale_used($mplayerid, $scaleid) {
$return = false;
//$rec = get_record("mplayer","id","$mplayerid","scale","-$scaleid");
//
//if (!empty($rec) && !empty($scaleid)) {
// $return = true;
//}
return $return;
}
/**
* Checks if scale is being used by any instance of mplayer.
* This function was added in 1.9
*
* This is used to find out if scale used anywhere
* @param $scaleid int
* @return boolean True if the scale is used by any mplayer
*/
function mplayer_scale_used_anywhere($scaleid) {
global $DB;
if ($scaleid && $DB->record_exists('mplayer', array('grade' => -$scaleid))) {
return true;
} else {
return false;
}
}
/**
* Execute post-install custom actions for the module
* This function was added in 1.9
*
* @return boolean true if success, false on error
*/
function mplayer_install() {
return true;
}
/**
* Execute post-uninstall custom actions for the module
* This function was added in 1.9
*
* @return boolean true if success, false on error
*/
function mplayer_uninstall() {
return true;
}
/*
-------------------------------------------------------------------- view.php --------------------------------------------------------------------
*/
/**
* Set moodledata path in $mplayer object
*
* @param $mplayer
* @return $mplayer
*/
function mplayer_set_moodledata($mplayer) {
global $CFG, $COURSE;
$cm = get_coursemodule_from_instance('mplayer', $mplayer->id);
$context = context_module::instance($cm->id);
$mplayer->moodledata = $CFG->wwwroot.'/pluginfile.php/'.$context->id.'/mod_mplayer/';
return $mplayer;
}
/**
* Assign the correct path to the file parameter (media source) in $mplayer object
*
* @param obj $mplayer
* @return obj $mplayer
*/
function mplayer_set_type($mplayer) {
switch($mplayer->type) {
// Video, sound, image and xml (SMIL playlists) are all served from moodledata course directories.
case 'video':
$mplayer->prefix = $mplayer->moodledata;
//$mplayer->test_variable = 'case video';
break;
case 'sound':
$mplayer->prefix = $mplayer->moodledata;
//$mplayer->test_variable = 'case sound';
break;
case 'image':
$mplayer->prefix = $mplayer->moodledata;
//$mplayer->test_variable = 'case image';
break;
case 'xml':
$mplayer->type = ''; // JW FLV Player doesn't recognise 'xml' as a valid parameter
$mplayer->prefix = $mplayer->moodledata;
//$mplayer->test_variable = 'case playlist';
break;
case 'youtube':
$mplayer->prefix = '';
//$mplayer->test_variable = 'case youtube';
break;
case 'url':
$mplayer->type = ''; // JW FLV Player doesn't recognise 'url' as a valid parameter
$mplayer->prefix = '';
//$mplayer->test_variable = 'case url';
break;
case 'http':
$mplayer->prefix = '';
//$mplayer->test_variable = 'case http';
break;
case 'lighttpd':
$mplayer->prefix = '';
//$mplayer->test_variable = 'case lighttpd';
break;
case 'rtmp':
$mplayer->prefix = '';
//$mplayer->test_variable = 'case rtmp';
break;
default;
$mplayer->type = ''; // Prevent failures due to errant parameters getting passed in
$mplayer->prefix = '';
//$mplayer->test_variable = 'default';
}
return $mplayer;
}
/**
* Assign the correct path to the file parameter (media source) in $mplayer object
*
* @param $mplayer
* @return $mplayer
*/
function mplayer_set_paths(&$mplayer) {
global $CFG;
$fs = get_file_storage();
$cm = get_coursemodule_from_instance('mplayer', $mplayer->id);
$context = context_module::instance($cm->id);
// Check if there is a playlist.
if ($playlisturl = mplayer_get_file_url($mplayer, 'playlistfile', $context)) {
$mplayer->mplayerfile = '&file='.$playlisturl;
} else {
$mplayer->mplayerfile = '&file='.mplayer_get_file_url($mplayer, 'mplayerfile', $context);
}
// Set wwwroot.
$mplayer->wwwroot = $CFG->wwwroot;
// Only need to call time() function once
$mplayer_time = time();
// Check for type.
if ($mplayer->type != '') {
$mplayer->type = '&provider='.$mplayer->type; // parameter name has changed to provider
}
// Check for streamer.
if ($mplayer->streamer != '') {
$mplayer->streamer = '&streamer='.$mplayer->streamer;
}
// Check for playlist.
if ($mplayer->playlist == 'none') {
$mplayer->playlist = '';
$mplayer->playlistsize = '';
$mplayer->item = '';
$mplayer->mplayerrepeat = '';
$mplayer->shuffle = '';
} else {
$mplayer->playlist = '&playlist='.$mplayer->playlist;
// Repeat.
if($mplayer->mplayerrepeat != 'none') {
$mplayer->mplayerrepeat = '&repeat='.$mplayer->mplayerrepeat;
} else {
$mplayer->mplayerrepeat = '';
}
// Shuffle.
if ($mplayer->shuffle == 'true') {
$mplayer->shuffle = '&shuffle='.$mplayer->shuffle;
} else {
$mplayer->shuffle = '';
}
// Playlistsize.
if ($mplayer->playlistsize != '180')
{
$mplayer->playlistsize = '&playlistsize='.$mplayer->playlistsize;
} else {
$mplayer->playlistsize = '';
}
// Item.
if ($mplayer->item != '0') {
$mplayer->item = '&item='.$mplayer->item;
} else {
$mplayer->item = '';
}
}
// Check for configuration XML file URL.
if ($url = mplayer_get_file_url($mplayer, 'configxml', $context)) {
$mplayer->configxml = '$config='.$url.'?'.$mplayer_time;
}
// Check for skin.
if ($mplayer->skin != '') {
$mplayer->skin = '&skin='.$mplayer->wwwroot.'/mod/mplayer/skins/'.$mplayer->skin;
}
// Check for image.
$mplayer->image = '';
if ($url = mplayer_get_file_url($mplayer, 'image', $context)) {
$mplayer->image = '&image='.$url;
}
// Check for icons.
if ($mplayer->icons == 'false') {
$mplayer->icons = '&icons='.$mplayer->icons;
} else {
$mplayer->icons = '';
}
// Check for controlbar.
if ($mplayer->controlbar != 'bottom') {
$mplayer->controlbar = '&controlbar='.$mplayer->controlbar;
} else {
$mplayer->controlbar = '';
}
// Check for backcolor.
if ($mplayer->backcolor != '') {
$mplayer->backcolor = '&backcolor='.$mplayer->backcolor;
}
// Check for frontcolor.
if ($mplayer->frontcolor != '') {
$mplayer->frontcolor = '&frontcolor='.$mplayer->frontcolor;
}
// Check for lightcolor.
if ($mplayer->lightcolor != '') {
$mplayer->lightcolor = '&lightcolor='.$mplayer->lightcolor;
}
// Check for screencolor.
if ($mplayer->screencolor != '') {
$mplayer->screencolor = '&screencolor='.$mplayer->screencolor;
}
// Check for smoothing.
if ($mplayer->smoothing == 'false') {
$mplayer->smoothing = '&smoothing='.$mplayer->smoothing;
} else {
$mplayer->smoothing = '';
}
// Check for quality.
if ($mplayer->quality != 'best') {
$mplayer->quality = '&quality='.$mplayer->quality;
} else {
$mplayer->quality = '';
}
// Check for resizing.
if ($mplayer->resizing != '') {
$mplayer->resizing = '&resizing='.$mplayer->resizing;
}
// deprecated
$mplayer->resizing = '';
//// --------------------------------------------------------- BEHAVIOUR ---------------------------------------------------------
// Check for autostart.
if ($mplayer->autostart == 'true') {
$mplayer->autostart = '&autostart='.$mplayer->autostart;
} else {
$mplayer->autostart = '';
}
// Check for stretching.
if ($mplayer->stretching != 'uniform') {
$mplayer->stretching = '&stretching='.$mplayer->stretching;
} else {
$mplayer->stretching = '';
}
// Check for volume.
if ($mplayer->volume != '90') {
$mplayer->volume = '&volume='.$mplayer->volume;
} else {
$mplayer->volume = '';
}
// Check for mute.
if ($mplayer->mute == 'true') {
$mplayer->mute = '&mute='.$mplayer->mute;
} else {
$mplayer->mute = '';
}
// Check for mplayerstart.
if ($mplayer->mplayerstart != '0') {
$mplayer->mplayerstart = '&start='.$mplayer->mplayerstart;
} else {
$mplayer->mplayerstart = '';
}
// Check for bufferlength.
if ($mplayer->bufferlength != '1') {
$mplayer->bufferlength = '&bufferlength='.$mplayer->bufferlength;
} else {
$mplayer->bufferlength = '';
}
// Check for plugins.
if ($mplayer->plugins != '') {
$mplayer->plugins = '&plugins='.$mplayer->plugins;
} else {
$mplayer->plugins = '';
}
// Check for author - author is always present in FlashVars embed code and should start without the & symbol.
if ($mplayer->author != '') {
$mplayer->author = 'author='.$mplayer->author;
}
// Check for mplayerdate.
if ($mplayer->mplayerdate != '') {
$mplayer->mplayerdate = '&date='.$mplayer->mplayerdate;
}
// Check for title.
if ($mplayer->title != '') {
$mplayer->title = '&title='.$mplayer->title;
}
// Check for description.
if ($mplayer->description != '') {
$mplayer->description = '&description='.$mplayer->description;
}
// Check for tags.
if ($mplayer->tags != '') {
$mplayer->tags = '&tags='.$mplayer->tags;
}
//// --------------------------------------------------------- AUDIO DESCRIPTION ---------------------------------------------------------
// Check for audiodescriptionfile.
if ($url = mplayer_get_file_url($mplayer, 'audiodescriptionfile', $context)) {
$mplayer->audiodescriptionfile = '&audiodescription.file='.$url;
$mplayer->audiodescriptionstate = '&audiodescription.state='.$mplayer->audiodescriptionstate;
$mplayer->audiodescriptionvolume = '&audiodescription.volume='.$mplayer->audiodescriptionvolume;
// Add the audiodescription plugin.
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',audiodescription';
} else {
$mplayer->plugins = '&plugins=audiodescription';
}
} else {
$mplayer->audiodescriptionfile = '';
$mplayer->audiodescriptionstate = '';
$mplayer->audiodescriptionvolume = '';
}
// Check for captions.
if ($url = mplayer_get_file_url($mplayer, 'captionsfile', $context)) {
// There's a bug in the captions.back parameter so we'll compensate for that.
if ($mplayer->captionsback == 'true') {
$mplayer->captionsback = '&captions.back='.$mplayer->captionsback;
} else {
$mplayer->captionsback = '';
}
$mplayer->captionsfile = '&captions.file='.$url;
$mplayer->captionsfontsize = '&captions.fontsize='.$mplayer->captionsfontsize;
$mplayer->captionsstate = '&captions.state='.$mplayer->captionsstate; // this doesn't work
// Add captions plugin parameter.
if ($mplayer->plugins != '') {
$mplayer->plugins = '&plugins='.$mplayer->plugins.',captions';
} else {
$mplayer->plugins = '&plugins=captions';
}
} else {
$mplayer->captionsback = '';
$mplayer->captionsfile = '';
$mplayer->captionsfontsize = '';
$mplayer->captionsstate = '';
}
// As of 21/01/2010, there's a bug in the HD plugin that prevents switching
// between HD and normal when either of the files has downloaded completely
// Check for hdfile
if ($url = mplayer_get_file_url($mplayer, 'hdfile', $context)) {
$mplayer->hdbitrate = '&hd.bitrate='.$mplayer->hdbitrate;
$mplayer->hdfile = '&hd.file='.$url.'?'.$mplayer_time;
$mplayer->hdfullscreen = '&hd.fullscreen='.$mplayer->hdfullscreen;
$mplayer->hdstate = '&hd.state='.$mplayer->hdstate;
// Add hd plugin parameter.
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',hd';
} else {
$mplayer->plugins = '&plugins=hd';
}
} else {
$mplayer->hdbitrate = '';
$mplayer->hdfile = '';
$mplayer->hdfullscreen = '';
$mplayer->hdstate = '';
}
// Check for tracecall.
if ($mplayer->tracecall != '') {
$mplayer->tracecall = '&tracecall='.$mplayer->tracecall;
}
// Check for infobox.
if ($mplayer->infoboxposition != 'none') {
$mplayer->infoboxcolor = '&infobox.color='.$mplayer->infoboxcolor;
$mplayer->infoboxposition = '&infobox.position='.$mplayer->infoboxposition;
$mplayer->infoboxsize = '&infobox.size='.$mplayer->infoboxsize;
// Add infobox plugin parameter.
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',infobox';
} else {
$mplayer->plugins = '&plugins=infobox';
}
} else {
$mplayer->infoboxcolor = '';
$mplayer->infoboxposition = '';
$mplayer->infoboxsize = '';
}
// Check for livestream.
if ($url = mplayer_get_file_url($mplayer, 'livestreamfile', $context)) {
$mplayer->livestreamfile = '&livestream.file='.$url;
$imageurl = mplayer_get_file_url($mplayer, 'livestreamimage', $context);
$mplayer->livestreamimage = '&livestream.image='.$imageurl;
$mplayer->livestreaminterval = '&livestream.interval='.$mplayer->livestreaminterval;
$mplayer->livestreammessage = '&livestream.message='.$mplayer->livestreammessage;
$mplayer->livestreamstreamer = '&livestream.streamer='.$mplayer->livestreamstreamer;
$mplayer->livestreamtags = '&livestream.tags='.$mplayer->livestreamtags;
// Add livestream plugin parameter.
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',livestream';
} else {
$mplayer->plugins = '&plugins=livestream';
}
} else {
$mplayer->livestreamfile = '';
$mplayer->livestreamimage = '';
$mplayer->livestreaminterval = '';
$mplayer->livestreammessage = '';
$mplayer->livestreamstreamer = '';
$mplayer->livestreamtags = '';
}
// Check for logobox.
if ($url = mplayer_get_file_url($mplayer, 'logoboxfile', $context)) {
$mplayer->logoboxalign = '&logobox.align='.$mplayer->logoboxalign;
$mplayer->logoboxfile = '&logobox.file='.$url;
$mplayer->logoboxlink = '&logobox.link='.$mplayer->logoboxlink;
$mplayer->logoboxmargin = '&logobox.margin='.$mplayer->logoboxmargin;
$mplayer->logoboxposition = '&logobox.position='.$mplayer->logoboxposition;
// add logobox plugin parameter
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',logobox';
} else {
$mplayer->plugins = '&plugins=logobox';
}
} else {
$mplayer->logoboxalign = '';
$mplayer->logoboxfile = '';
$mplayer->logoboxlink = '';
$mplayer->logoboxmargin = '';
$mplayer->logoboxposition = '';
}
// Check for logo
if ($url = mplayer_get_file_url($mplayer, 'logofile', $context)) {
$mplayer->logofile = '&logo.file='.$url;
$mplayer->logolink = '&logo.link='.$mplayer->logolink;
$mplayer->logohide = '&logo.hide='.$mplayer->logohide;
$mplayer->logoposition = '&logo.position='.$mplayer->logoposition;
} else {
$mplayer->logofile = '';
$mplayer->logolink = '';
$mplayer->logohide = '';
$mplayer->logoposition = '';
}
// Check for metaviewer
if ($mplayer->metaviewerposition != '') {
$mplayer->metaviewerposition = '&metaviewer.position='.$mplayer->metaviewerposition;
$mplayer->metaviewersize = '&metaviewer.size='.$mplayer->metaviewersize;
// add metaviewer plugin parameter
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',metaviewer';
} else {
$mplayer->plugins = '&plugins=metaviewer';
}
} else {
$mplayer->metaviewerposition = '';
$mplayer->metaviewersize = '';
}
// Check for searchbar
if ($mplayer->searchbarposition != 'none') {
$mplayer->searchbarlabel = '&searchbar.label='.$mplayer->searchbarlabel;
$mplayer->searchbarposition = '&searchbar.position='.$mplayer->searchbarposition;
$mplayer->searchbarscript = '&searchbar.script='.$mplayer->searchbarscript;
if ($mplayer->searchbarcolor != '') {
$mplayer->searchbarcolor = '&searchbar.color='.$mplayer->searchbarcolor;
} else {
$mplayer->searchbarcolor = '';
}
// if playlist isn't set up, set up a default
if ($mplayer->playlist == '') {
$mplayer->playlist = '&playlist=right';
$mplayer->playlistsize = '&playlistsize=300';
$mplayer->item = '&item=0';
}
// add searchbar plugin parameter
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',searchbar';
} else {
$mplayer->plugins = '&plugins=searchbar';
}
} else {
$mplayer->searchbarcolor = '';
$mplayer->searchbarlabel = '';
$mplayer->searchbarposition = '';
$mplayer->searchbarscript = '';
}
// Check for snapshotscript
if ($mplayer->snapshotscript != 'none') {
$mplayer->snapshotbitmap = '&snapshot.bitmap='.$mplayer->snapshotbitmap;
$mplayer->snapshotscript = '&snapshot.script='.$mplayer->snapshotscript.'?id='.$mplayer->instance.'';
// add snapshot plugin parameter
if ($mplayer->plugins != '') {
$mplayer->plugins = $mplayer->plugins.',snapshot';
} else {
$mplayer->plugins = '&plugins=snapshot';
}
} else {
$mplayer->snapshotbitmap = '';
$mplayer->snapshotscript = '';
}
return $mplayer;
}