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