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 / Components / Album_List.php

Album_List.php in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.36, at Components/Album_List.php

75 lines 1.9 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\Components;
4
5 use Photonic_Plugin\Core\Photonic;
6 use Photonic_Plugin\Layouts\Core_Layout;
7 use Photonic_Plugin\Platforms\Base;
8
9 require_once 'Pagination.php';
10
11 class Album_List implements Printable {
12 public array $albums = [];
13
14 public string $title_position;
15 public array $row_constraints = [];
16 public string $indent = '';
17 public array $short_code = [];
18
19 /**
20 * @var Pagination $pagination
21 */
22 public Pagination $pagination;
23
24 public string $type = '';
25 public string $singular_type = '';
26 public $level_1_count_display;
27 public bool $album_opens_gallery = false;
28
29 public array $gallery_attributes = [];
30
31 public function __construct(array $short_code) {
32 $this->pagination = new Pagination();
33 $this->short_code = $short_code;
34
35 $this->gallery_attributes['photo-count'] = empty($short_code['photo_count']) ? $short_code['count'] : $short_code['photo_count'];
36
37 $data = [
38 'photo-more' => 'photo_more',
39 'overlay-size' => 'overlay_size',
40 'overlay-crop' => 'overlay_crop',
41 'overlay-video-size' => 'overlay_video_size',
42 'thumb-size' => 'thumb_size',
43 ];
44
45 foreach ($data as $attr => $value) {
46 if (isset($short_code[$value])) {
47 $this->gallery_attributes[$attr] = $short_code[$value];
48 }
49 }
50 }
51
52 private function custom_sort(Base $module) {
53 $this->albums = apply_filters('photonic_custom_sort_albums', $this->albums, $module->provider);
54 }
55
56 /**
57 * {@inheritDoc}
58 */
59 public function html(Base $module, Core_Layout $layout, bool $print = false): string {
60 $ret = '';
61
62 $this->custom_sort($module);
63
64 if (is_a($layout, 'Photonic_Plugin\Layouts\Level_Two_Gallery')) {
65 $ret = $layout->generate_level_2_gallery($this, $this->short_code, $module);
66 }
67
68 if ($print) {
69 echo wp_kses($ret, Photonic::$safe_tags);
70 }
71
72 return wp_kses($ret, Photonic::$safe_tags);
73 }
74 }
75