PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.36
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.36
3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 2.44 All 141 releases
photonic / Lightboxes / Featherlight.php

Featherlight.php in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.36, at Lightboxes/Featherlight.php

34 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Photonic_Plugin\Lightboxes;
4
5 use Photonic_Plugin\Platforms\Base;
6
7 require_once 'Lightbox.php';
8
9 class Featherlight extends Lightbox {
10 protected function __construct() {
11 $this->library = 'featherlight';
12 parent::__construct();
13 $this->class = ['photonic-lb', 'photonic-featherlight'];
14 }
15
16 public function get_photo_attributes(array $photo_data, Base $module): array {
17 $out = parent::get_photo_attributes($photo_data, $module);
18 $mime = (!empty($photo['mime']) ? $photo['mime'] : 'video/mp4');
19 if ('google' === $module->provider && empty($photo_data['video'])) {
20 $out['data-featherlight-type'] = 'image';
21 }
22 elseif ('google' === $module->provider && !empty($photo_data['video'])) {
23 $out['data-featherlight'] = esc_attr("<video class=\"photonic\" controls preload=\"none\"><source src=\"" . $photo_data['video'] . "\" type=\"" . $mime . "\">" . esc_html__('Your browser does not support HTML5 videos.', 'photonic') . "</video>");
24 $out['data-featherlight-type'] = 'html';
25 }
26 elseif (!empty($photo_data['video'])) {
27 $out['data-featherlight'] = esc_attr("<video class=\"photonic\" controls preload=\"none\"><source src=\"" . $photo_data['video'] . "\" type=\"" . $mime . "\">" . esc_html__('Your browser does not support HTML5 videos.', 'photonic') . "</video>");
28 $out['data-featherlight-type'] = 'video';
29 }
30
31 return $out;
32 }
33 }
34