| @@ -1,10 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace Photonic_Plugin\Lightboxes; |
| 3 | 4 | |
| 4 | -use Photonic_Plugin\Modules\Core; | |
| 5 | +use Photonic_Plugin\Platforms\Base; | |
| 5 | 6 | |
| 6 | -require_once('Lightbox.php'); | |
| 7 | +require_once 'Lightbox.php'; | |
| 7 | 8 | |
| 8 | 9 | class Lightcase extends Lightbox { |
| 9 | 10 | protected function __construct() { |
| 10 | 11 | $this->library = 'lightcase'; |
| @@ -12,33 +13,34 @@ | ||
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | 16 | * @param $rel_id |
| 16 | - * @param Core $module | |
| 17 | + * @param Base $module | |
| 17 | 18 | * @return array |
| 18 | 19 | */ |
| 19 | - function get_gallery_attributes($rel_id, $module) { | |
| 20 | + public function get_gallery_attributes($rel_id, Base $module): array { | |
| 20 | 21 | global $photonic_slideshow_mode; |
| 21 | 22 | return [ |
| 22 | - 'class' => $this->class, | |
| 23 | - 'rel' => ['lightbox-photonic-'.$module->provider.'-stream-'.(empty($rel_id) ? $module->gallery_index : $rel_id)], | |
| 23 | + 'class' => $this->class, | |
| 24 | + 'rel' => ['lightbox-photonic-' . $module->provider . '-stream-' . (empty($rel_id) ? $module->gallery_index : $rel_id)], | |
| 24 | 25 | 'specific' => [ |
| 25 | - 'data-rel' => ['lightcase:lightbox-photonic-'.$module->provider.'-stream-'.(empty($rel_id) ? $module->gallery_index : $rel_id).((isset($photonic_slideshow_mode) && $photonic_slideshow_mode == 'on') ? ':slideshow' : '')] | |
| 26 | + 'data-rel' => 'lightcase:lightbox-photonic-' . $module->provider . '-stream-' . (empty($rel_id) ? $module->gallery_index : $rel_id) . ((isset($photonic_slideshow_mode) && 'on' === $photonic_slideshow_mode) ? ':slideshow' : '') | |
| 26 | 27 | ], |
| 27 | 28 | ]; |
| 28 | 29 | } |
| 29 | 30 | |
| 30 | - function get_photo_attributes($photo_data, $module) { | |
| 31 | - if ($module->provider == 'google') { | |
| 31 | + public function get_photo_attributes(array $photo_data, Base $module): array { | |
| 32 | + $out = parent::get_photo_attributes($photo_data, $module); | |
| 33 | + if ('google' === $module->provider) { | |
| 32 | 34 | if (empty($photo_data['video'])) { |
| 33 | - return " data-lc-options='{\"type\": \"image\"}' "; | |
| 35 | + $out['data-lc-options'] = esc_attr('{"type": "image"}'); | |
| 34 | 36 | } |
| 35 | 37 | else { |
| 36 | - return " data-lc-options='{\"type\": \"video\"}' "; | |
| 38 | + $out['data-lc-options'] = esc_attr('{"type": "video"}'); | |
| 37 | 39 | } |
| 38 | 40 | } |
| 39 | - else if ($module->provider == 'flickr') { | |
| 40 | - return !empty($photo_data['video']) ? ' data-html5-href="'.$photo_data['video'].'" ': ''; | |
| 41 | + elseif ('flickr' === $module->provider && !empty($photo_data['video'])) { | |
| 42 | + $out['data-html5-href'] = $photo_data['video']; | |
| 41 | 43 | } |
| 42 | - return ''; | |
| 44 | + return $out; | |
| 43 | 45 | } |
| 44 | -} | |
| 46 | +} | |