/** * Construct a proper <a href> html tag for opening media files in a modal box. * * @param string $mediaDL - access or download url * @param string $mediaPlay - media playback url * @param string $title - media file title * @param string $filename - media filename * @return string */ public static function chooseMediaAhrefRaw($mediaDL, $mediaPlay, $title, $filename) { $title = q($title); $filename = q($filename); $ahref = "<a href='{$mediaDL}' class='fileURL' target='_blank' title='" . q($title) . "'>" . $title . "</a>"; $class = ''; $extraParams = ''; if (self::isSupportedFile($filename)) { if (file_exists(ModalBoxHelper::getShadowboxDir())) { $class = 'shadowbox'; $extraParams = self::isSupportedImage($filename) ? "rel='shadowbox'" : "rel='shadowbox;width=" . ModalBoxHelper::getShadowboxWidth() . ";height=" . ModalBoxHelper::getShadowboxHeight() . ModalBoxHelper::getShadowboxPlayer($filename) . "'"; } else { if (file_exists(ModalBoxHelper::getFancybox2Dir())) { $class = self::isSupportedImage($filename) ? 'fancybox' : 'fancybox iframe'; } else { if (file_exists(ModalBoxHelper::getColorboxDir())) { $class = self::isSupportedImage($filename) ? 'colorbox' : 'colorboxframe'; } } } $ahref = "<a href='{$mediaPlay}' class='{$class} fileURL' {$extraParams} title='" . q($title) . "'>" . $title . "</a>"; if (self::isSupportedImage($filename)) { $ahref = "<a href='{$mediaDL}' class='{$class} fileURL' title=''" . q($title) . "'>" . $title . "</a>"; } } return $ahref; }