| 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 'Header.php'; |
| 10 |
require_once 'Pagination.php'; |
| 11 |
|
| 12 |
class Photo_List implements Printable { |
| 13 |
public array $photos = []; |
| 14 |
|
| 15 |
public string $title_position = 'tooltip'; |
| 16 |
public array $row_constraints = []; |
| 17 |
public string $parent = 'stream'; |
| 18 |
public string $indent = "\t"; |
| 19 |
public array $short_code = []; |
| 20 |
|
| 21 |
/** |
| 22 |
* @var Pagination $pagination |
| 23 |
*/ |
| 24 |
public Pagination $pagination; |
| 25 |
|
| 26 |
public function __construct(array $short_code) { |
| 27 |
$this->short_code = $short_code; |
| 28 |
$this->pagination = new Pagination(); |
| 29 |
} |
| 30 |
|
| 31 |
private function custom_sort(Base $module) { |
| 32 |
$this->photos = apply_filters('photonic_custom_sort_photos', $this->photos, $module->provider); |
| 33 |
} |
| 34 |
|
| 35 |
public function html(Base $module, Core_Layout $layout, bool $print = false): string { |
| 36 |
$ret = ''; |
| 37 |
|
| 38 |
$this->custom_sort($module); |
| 39 |
|
| 40 |
if (is_a($layout, 'Photonic_Plugin\Layouts\Level_One_Gallery')) { |
| 41 |
$ret = $layout->generate_level_1_gallery($this, $this->short_code, $module); |
| 42 |
} |
| 43 |
|
| 44 |
if ($print) { |
| 45 |
echo wp_kses($ret, Photonic::$safe_tags); |
| 46 |
} |
| 47 |
return wp_kses($ret, Photonic::$safe_tags); |
| 48 |
} |
| 49 |
} |
| 50 |
|