芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/www/midiatech/lib/Widget/Audio.php
0 )?", * type="integer", * required=false * ), * @SWG\Parameter( * name="enableStat", * in="formData", * description="The option (On, Off, Inherit) to enable the collection of Widget Proof of Play statistics", * type="string", * required=false * ), * @SWG\Response( * response=201, * description="successful operation", * @SWG\Schema(ref="#/definitions/Widget"), * @SWG\Header( * header="Location", * description="Location of the new widget", * type="string" * ) * ) * ) */ public function edit() { // Set the properties specific to this module $this->setUseDuration($this->getSanitizer()->getCheckbox('useDuration')); $this->setDuration($this->getSanitizer()->getInt('duration', $this->getDuration())); $this->setOption('name', $this->getSanitizer()->getString('name')); $this->setOption('mute', $this->getSanitizer()->getCheckbox('mute')); $this->setOption('enableStat', $this->getSanitizer()->getString('enableStat')); // Only loop if the duration is > 0 if ($this->getUseDuration() == 0 || $this->getDuration() == 0) { $this->setDuration(0); $this->setOption('loop', 0); } else { $this->setOption('loop', $this->getSanitizer()->getCheckbox('loop')); } $this->saveWidget(); } /** * Override previewAsClient * @param float $width * @param float $height * @param int $scaleOverride * @return string */ public function previewAsClient($width, $height, $scaleOverride = 0) { return $this->previewIcon(); } /** * Determine duration * @param $fileName * @return int */ public function determineDuration($fileName = null) { // If we don't have a file name, then we use the default duration of 0 (end-detect) if ($fileName === null) return 0; $this->getLog()->debug('Determine Duration from %s', $fileName); $info = new \getID3(); $file = $info->analyze($fileName); return intval($this->getSanitizer()->getDouble('playtime_seconds', 0, $file)); } /** * Set default widget options */ public function setDefaultWidgetOptions() { parent::setDefaultWidgetOptions(); $this->setOption('mute', $this->getSetting('defaultMute', 0)); } /** * Get Resource * @param int $displayId * @return mixed */ public function getResource($displayId = 0) { $this->download(); } /** @inheritdoc */ public function isValid() { return self::$STATUS_PLAYER; } }