| 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 |
/** |
| 10 |
* Class Single_Photo |
| 11 |
* Represents a standalone photo in Photonic. This can be displayed currently by Flickr, Instagram and Zenfolio. The photo shows up |
| 12 |
* as a full-width image and caption, along with a header if available. The photo can be linked to the source. |
| 13 |
* This is a "Printable" element - it may be returned in the <code>get_gallery_images</code> for the corresponding platform. |
| 14 |
* |
| 15 |
* @package Photonic_Plugin\Components |
| 16 |
*/ |
| 17 |
class Single_Photo implements Printable { |
| 18 |
public $src = ''; |
| 19 |
public $href = ''; |
| 20 |
public $title = ''; |
| 21 |
public $caption = ''; |
| 22 |
|
| 23 |
/** |
| 24 |
* Single_Photo constructor. |
| 25 |
* |
| 26 |
* @param string $src |
| 27 |
* @param string $href |
| 28 |
* @param string $title |
| 29 |
* @param string $caption |
| 30 |
*/ |
| 31 |
public function __construct($src, $href, $title, $caption) { |
| 32 |
$this->src = $src; |
| 33 |
$this->href = $href; |
| 34 |
$this->title = $title; |
| 35 |
$this->caption = $caption; |
| 36 |
} |
| 37 |
|
| 38 |
public function html(Base $module, ?Core_Layout $layout = null, $print = false): string { |
| 39 |
$ret = $layout->generate_single_photo_markup($this, $module); |
| 40 |
if ($print) { |
| 41 |
echo wp_kses($ret, Photonic::$safe_tags); |
| 42 |
} |
| 43 |
return wp_kses($ret, Photonic::$safe_tags); |
| 44 |
} |
| 45 |
} |
| 46 |
|