PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 2.40
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v2.40
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 / Layouts / Slideshow.php

Slideshow.php in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 2.40, at Layouts/Slideshow.php

75 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Photonic_Plugin\Layouts;
3
4 require_once('Level_One_Gallery.php');
5
6 /**
7 * Generates the slideshow layout for level 1 objects. Level 2 cannot be displayed as slideshows.
8 */
9 class Slideshow extends Core_Layout implements Level_One_Gallery {
10 private static $instance = null;
11
12 public static function get_instance() {
13 if (self::$instance == null) {
14 self::$instance = new Slideshow();
15 }
16 return self::$instance;
17 }
18
19 function generate_level_1_gallery($photos, $options, $short_code, $module) {
20 global $photonic_wp_slide_adjustment, $photonic_wp_slide_align;
21 if (!is_array($photos) || empty($photos)) {
22 return '';
23 }
24
25 $data_attr = '';
26 foreach ($short_code as $key => $value) {
27 if (in_array($key, ['speed', 'timeout', 'fx', 'pause', 'layout', 'strip-style', 'controls', 'columns'])) {
28 $data_attr .= 'data-photonic-'.$key.'="'.esc_attr($value).'" ';
29 }
30 }
31
32 $style = empty($short_code['style']) ? (empty($short_code['layout']) ? '' : $short_code['layout']) : $short_code['style'];
33 $title_position = empty($short_code['title_position']) ? $options['title_position'] : $short_code['title_position'];
34 $ret = "<div class='photonic-slideshow {$style} title-display-{$title_position} fix'>\n";
35 $ret .= "\t<ul id='photonic-slideshow-{$module->gallery_index}' class='photonic-slideshow-content fix photonic-slideshow-$photonic_wp_slide_adjustment ".(!empty($photonic_wp_slide_align) ? 'photonic-slide-center' : '')."' $data_attr>\n";
36
37 foreach ( $photos as $photo ) {
38 $ret .= "\t\t<li class='photonic-slideshow-img' data-thumb='{$photo['thumbnail']}'>\n";
39 $title = esc_attr($photo['title']);
40 $description = esc_attr($photo['description']);
41 if ($short_code['caption'] == 'desc' || ($short_code['caption'] == 'title-desc' && empty($title)) || ($short_code['caption'] == 'desc-title' && !empty($description))) {
42 $title = $description;
43 }
44 else if (($short_code['caption'] == 'desc-title' && empty($title)) || $short_code['caption'] == 'none') {
45 $title = '';
46 }
47
48 if (!isset($photo['video'])) {
49 if ($title_position == 'tooltip') {
50 $tooltip = 'data-photonic-tooltip="'.esc_attr($title).'" ';
51 }
52 else {
53 $tooltip = '';
54 }
55 $ret .= "\t\t\t<img src='".$photo['main_image']."' alt='{$title}' title='".(($title_position == 'regular' || $title_position == 'tooltip') ? $title : '')."' $tooltip id='photonic-slideshow-{$module->gallery_index}-{$photo['id']}' />\n";
56 }
57 else {
58 $ret .="\t\t<video controls loop><source src='{$photo['video']}' type='video/mp4'><img src='{$photo['main_image']}' alt=''></video>";
59 }
60
61 $shown_title = '';
62 if (in_array($title_position, ['below', 'hover-slideup-show', 'hover-slidedown-show', 'slideup-stick']) && !empty($title)) {
63 $shown_title = "\t\t\t".'<div class="photonic-title-info">'."\n\t\t\t\t".'<div class="photonic-photo-title photonic-title">'.wp_specialchars_decode($title, ENT_QUOTES).'</div>'."\n\t\t\t".'</div>'."\n";
64 }
65
66 if (!empty($title)) {
67 $ret .= $shown_title;
68 }
69 $ret .= "\t\t</li>\n";
70 }
71 $ret .= "\t</ul>\n</div><!-- .photonic-slideshow-->\n";
72 return $ret;
73 }
74 }
75