PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.37
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.37
3.37 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 All 142 releases
← All changes | Lightboxes/Fancybox3.php +48 -12 2.43 → 3.37 View file →
@@ -1,12 +1,21 @@
1 1 <?php
2 +
2 3 namespace Photonic_Plugin\Lightboxes;
3 4
4 -use Photonic_Plugin\Modules\Core;
5 +use Photonic_Plugin\Components\Photo;
6 +use Photonic_Plugin\Platforms\Base;
7 +use Photonic_Plugin\Lightboxes\Features\Show_Videos_Inline;
5 8
6 -require_once('Lightbox.php');
9 +require_once 'Lightbox.php';
10 +require_once 'Features/Show_Videos_Inline.php';
7 11
8 12 class Fancybox3 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 +
9 18 protected function __construct() {
10 19 $this->library = 'fancybox3';
11 20 parent::__construct();
12 21 }
@@ -12,24 +21,51 @@
12 21 }
13 22
14 23 /**
15 24 * @param $rel_id
16 - * @param Core $module
25 + * @param Base $module
17 26 * @return array
18 27 */
19 - function get_gallery_attributes($rel_id, $module) {
28 + public function get_gallery_attributes($rel_id, Base $module): array {
20 29 return [
21 - 'class' => $this->class = ['photonic-launch-gallery', 'launch-gallery-fancybox', 'fancybox'],
22 - 'rel' => ['lightbox-photonic-'.$module->provider.'-stream-'.(empty($rel_id) ? $module->gallery_index : $rel_id)],
30 + 'class' => $this->class = ['photonic-lb', 'photonic-fancybox', 'fancybox'],
31 + 'rel' => ['lightbox-photonic-' . $module->provider . '-stream-' . (empty($rel_id) ? $module->gallery_index : $rel_id)],
23 32 'specific' => [
24 - 'data-fancybox' => ['lightbox-photonic-'.$module->provider.'-stream-'.(empty($rel_id) ? $module->gallery_index : $rel_id)]
33 + 'data-fancybox' => 'lightbox-photonic-' . $module->provider . '-stream-' . (empty($rel_id) ? $module->gallery_index : $rel_id)
25 34 ],
26 35 ];
27 36 }
28 37
29 - function get_photo_attributes($photo_data, $module) {
30 - if (in_array($module->provider, ['google', 'flickr'])) {
31 - return !empty($photo_data['video']) ? ' data-html5-href="'.$photo_data['video'].'" ': '';
38 + public function get_photo_attributes(array $photo_data, Base $module): array {
39 + $out = parent::get_photo_attributes($photo_data, $module);
40 + if (in_array($module->provider, ['google', 'flickr'], true)) {
41 + if (!empty($photo_data['video'])) {
42 + $out['data-html5-href'] = $photo_data['video'];
43 + }
32 44 }
33 - return '';
45 + return $out;
34 46 }
35 -}
47 +
48 + /**
49 + * {@inheritDoc}
50 + */
51 + public function get_video_markup(Photo $photo, Base $module, string $indent): string {
52 + if (in_array($module->provider, ['flickr', 'google'], true)) {
53 + return $this->get_inline_video_markup($photo, $module, $indent);
54 + }
55 + else {
56 + return parent::get_video_markup($photo, $module, $indent);
57 + }
58 + }
59 +
60 + /**
61 + * {@inheritDoc}
62 + */
63 + public function get_grid_link(Photo $photo, array $short_code, Base $module): string {
64 + if (!empty($photo->video) && in_array($module->provider, ['flickr', 'google'], true)) {
65 + return $this->get_inline_video_grid_link($photo, $short_code, $module);
66 + }
67 + else {
68 + return parent::get_grid_link($photo, $short_code, $module);
69 + }
70 + }
71 +}