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 / Fancybox4.php

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

62 lines 1.7 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\Components\Photo;
6 use Photonic_Plugin\Platforms\Base;
7 use Photonic_Plugin\Lightboxes\Features\Show_Videos_Inline;
8
9 require_once 'Lightbox.php';
10 require_once 'Features/Show_Videos_Inline.php';
11
12 class Fancybox4 extends Lightbox {
13 use Show_Videos_Inline {
14 get_video_markup as get_inline_video_markup;
15 get_grid_link as get_inline_video_grid_link;
16 }
17
18 protected function __construct() {
19 $this->library = 'fancybox4';
20 parent::__construct();
21 $this->class = ['photonic-lb', 'photonic-fancybox', 'fancybox'];
22 }
23
24 public function get_photo_attributes(array $photo_data, Base $module): array {
25 $out = parent::get_photo_attributes($photo_data, $module);
26 if (!empty($photo_data['video'])) {
27 $out['data-type'] = 'html5video';
28 }
29
30 if (in_array($module->provider, ['google', 'flickr'], true)) {
31 if (!empty($photo_data['video'])) {
32 $out['data-html5-href'] = $photo_data['video'];
33 }
34 }
35 return $out;
36 }
37
38 /**
39 * {@inheritDoc}
40 */
41 public function get_video_markup(Photo $photo, Base $module, string $indent): string {
42 if (in_array($module->provider, ['flickr', 'google'], true)) {
43 return $this->get_inline_video_markup($photo, $module, $indent);
44 }
45 else {
46 return parent::get_video_markup($photo, $module, $indent);
47 }
48 }
49
50 /**
51 * {@inheritDoc}
52 */
53 public function get_grid_link(Photo $photo, array $short_code, Base $module): string {
54 if (!empty($photo->video) && in_array($module->provider, ['flickr', 'google'], true)) {
55 return $this->get_inline_video_grid_link($photo, $short_code, $module);
56 }
57 else {
58 return parent::get_grid_link($photo, $short_code, $module);
59 }
60 }
61 }
62