PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.33
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.33
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 / Collection.php

Collection.php in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.33, at Components/Collection.php

65 lines 1.5 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 class Collection implements Printable {
10 /**
11 * @var Header|null $header
12 */
13 public ?Header $header = null;
14
15 /**
16 * @var Album_List|null $album_list
17 */
18 public ?Album_List $album_list = null;
19
20 /**
21 * @var array
22 */
23 public array $collections = [];
24
25 public string $indent = '';
26 public bool $strip_top_level = false; // Specifically for Flickr, when you do lazy loading
27
28 /**
29 * {@inheritDoc} - a Collection
30 */
31 public function html(Base $module, Core_Layout $layout, $print = false): string {
32 $start = empty($this->strip_top_level) ? $this->indent . "<div class='photonic-tree'>\n" : '';
33 $out = $start;
34
35 if (!empty($this->header)) {
36 $out .= $this->header->html($module, $layout);
37 }
38
39 if (!empty($this->album_list)) {
40 $out .= $this->album_list->html($module, $layout);
41 }
42
43 if (!empty($this->collections)) {
44 /** @var Printable|string $collection */
45 foreach ($this->collections as $collection) {
46 if (is_a($collection, 'Photonic_Plugin\Components\Printable')) {
47 $out .= $collection->html($module, $layout);
48 }
49 else {
50 $out .= $collection;
51 }
52 }
53 }
54
55 if ($out !== $start && !$this->strip_top_level) {
56 $out .= $this->indent . "</div>\n";
57 }
58
59 if ($print) {
60 echo wp_kses($out, Photonic::$safe_tags);
61 }
62 return wp_kses($out, Photonic::$safe_tags);
63 }
64 }
65