Example #1
0
 function __construct($image, $options, $sizeDefault = 'imagesize')
 {
     if (is_null($options)) {
         $options = array();
     }
     if (is_string($options)) {
         $options = urldecodeMap($options);
     }
     static $uniq = 0;
     $uniq += 1;
     $this->uniq = 'player-' . $uniq . '-' . mt_rand(1, 100000);
     $this->options = $options;
     $this->image = $image;
     $this->title = $image->getTitle();
     $this->setType($image);
     $this->setSize(@$options['width'], @$options['height'], $sizeDefault);
 }
Example #2
0
 /**
  * Main execution function
  * @param $par Parameters passed to the page
  */
 public function execute($par)
 {
     global $wgOut, $wgRequest;
     $file = $wgRequest->getVal('playfile', $par);
     $options = $wgRequest->getVal('options', '');
     $options = urldecodeMap($options);
     $options['width'] = (int) $wgRequest->getVal('width', @$options['width']);
     $options['height'] = (int) $wgRequest->getVal('height', @$options['height']);
     $options['forcegeneric'] = @$options['forcegeneric'] || $wgRequest->getCheck('forcegeneric');
     $options['playersize'] = $wgRequest->getVal('playersize', @$options['playersize']);
     $title = $file ? Title::makeTitleSafe(NS_IMAGE, $file) : null;
     if ($title) {
         $this->showPlayer($title, $options);
     } else {
         $this->showForm();
     }
 }