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

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

47 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 Lightcase extends Lightbox {
10 protected function __construct() {
11 $this->library = 'lightcase';
12 parent::__construct();
13 }
14
15 /**
16 * @param $rel_id
17 * @param Base $module
18 * @return array
19 */
20 public function get_gallery_attributes($rel_id, Base $module): array {
21 global $photonic_slideshow_mode;
22 return [
23 'class' => $this->class,
24 'rel' => ['lightbox-photonic-' . $module->provider . '-stream-' . (empty($rel_id) ? $module->gallery_index : $rel_id)],
25 'specific' => [
26 'data-rel' => 'lightcase:lightbox-photonic-' . $module->provider . '-stream-' . (empty($rel_id) ? $module->gallery_index : $rel_id) . ((isset($photonic_slideshow_mode) && 'on' === $photonic_slideshow_mode) ? ':slideshow' : '')
27 ],
28 ];
29 }
30
31 public function get_photo_attributes(array $photo_data, Base $module): array {
32 $out = parent::get_photo_attributes($photo_data, $module);
33 if ('google' === $module->provider) {
34 if (empty($photo_data['video'])) {
35 $out['data-lc-options'] = esc_attr('{"type": "image"}');
36 }
37 else {
38 $out['data-lc-options'] = esc_attr('{"type": "video"}');
39 }
40 }
41 elseif ('flickr' === $module->provider && !empty($photo_data['video'])) {
42 $out['data-html5-href'] = $photo_data['video'];
43 }
44 return $out;
45 }
46 }
47