| 1 |
<?php |
| 2 |
namespace Photonic_Plugin\Lightboxes; |
| 3 |
|
| 4 |
use Photonic_Plugin\Modules\Core; |
| 5 |
|
| 6 |
abstract class Lightbox { |
| 7 |
/** @var array */ |
| 8 |
var $class; |
| 9 |
|
| 10 |
var $supports_video; |
| 11 |
|
| 12 |
var $library; |
| 13 |
|
| 14 |
/** |
| 15 |
* Lightbox constructor. |
| 16 |
*/ |
| 17 |
protected function __construct() { |
| 18 |
require_once(PHOTONIC_PATH.'/Modules/Core.php'); |
| 19 |
$this->class = ['photonic-launch-gallery', 'launch-gallery-'.$this->library, $this->library]; |
| 20 |
} |
| 21 |
|
| 22 |
final public static function get_instance() { |
| 23 |
static $instances = array(); |
| 24 |
$called_class = get_called_class(); |
| 25 |
|
| 26 |
if (!isset($instances[$called_class])) { |
| 27 |
$instances[$called_class] = new $called_class(); |
| 28 |
} |
| 29 |
return $instances[$called_class]; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* @param $rel_id |
| 34 |
* @param Core $module |
| 35 |
* @return array |
| 36 |
*/ |
| 37 |
function get_gallery_attributes($rel_id, $module) { |
| 38 |
return [ |
| 39 |
'class' => $this->class, |
| 40 |
'rel' => ['lightbox-photonic-'.$module->provider.'-stream-'.(empty($rel_id) ? $module->gallery_index : $rel_id)], |
| 41 |
'specific' => [], |
| 42 |
]; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Some lightboxes require some additional attributes for individual photos. E.g. Lightgallery requires something to show the title etc. |
| 47 |
* This method returns such additional information. Not to be confused with <code>get_lightbox_attributes</code>, which |
| 48 |
* returns information for the gallery as a whole. |
| 49 |
* |
| 50 |
* @param $photo_data |
| 51 |
* @param Core $module |
| 52 |
* @return string |
| 53 |
*/ |
| 54 |
function get_photo_attributes($photo_data, $module) { |
| 55 |
return ''; |
| 56 |
} |
| 57 |
} |