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

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

34 lines 1.1 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 'Grid_Anchor.php';
10
11 class Grid_Image implements Printable {
12 public string $alt = '';
13 public string $src_attr = 'src';
14 public string $src = '';
15 public array $classes = [];
16 public array $dimensions = [];
17 public string $lazy_load;
18
19 public function html(Base $module, Core_Layout $layout, $print = false): string { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
20 $img_dim = '';
21 if (!empty($this->dimensions) && !empty($this->dimensions['w']) && !empty($this->dimensions['h'])) {
22 $img_dim = " width='{$this->dimensions['w']}' height='{$this->dimensions['h']}'";
23 }
24 $alt = esc_attr($this->alt);
25 $classes = esc_attr(implode(' ', $this->classes));
26
27 $ret = "<img alt='$alt' class='$classes' {$this->src_attr}='" . esc_url($this->src) . "' loading='{$this->lazy_load}' $img_dim />";
28 if ($print) {
29 echo wp_kses($ret, Photonic::$safe_tags);
30 }
31 return wp_kses($ret, Photonic::$safe_tags);
32 }
33 }
34