| 1 |
<?php |
| 2 |
namespace Photonic_Plugin\Layouts\Features; |
| 3 |
|
| 4 |
use Photonic_Plugin\Core\Photonic; |
| 5 |
use Photonic_Plugin\Lightboxes\Colorbox; |
| 6 |
use Photonic_Plugin\Lightboxes\Fancybox; |
| 7 |
use Photonic_Plugin\Lightboxes\Fancybox2; |
| 8 |
use Photonic_Plugin\Lightboxes\Fancybox3; |
| 9 |
use Photonic_Plugin\Lightboxes\Featherlight; |
| 10 |
use Photonic_Plugin\Lightboxes\Image_Lightbox; |
| 11 |
use Photonic_Plugin\Lightboxes\Lightbox; |
| 12 |
use Photonic_Plugin\Lightboxes\Lightcase; |
| 13 |
use Photonic_Plugin\Lightboxes\Lightgallery; |
| 14 |
use Photonic_Plugin\Lightboxes\Magnific; |
| 15 |
use Photonic_Plugin\Lightboxes\None; |
| 16 |
use Photonic_Plugin\Lightboxes\PhotoSwipe; |
| 17 |
use Photonic_Plugin\Lightboxes\PrettyPhoto; |
| 18 |
use Photonic_Plugin\Lightboxes\Strip; |
| 19 |
use Photonic_Plugin\Lightboxes\Swipebox; |
| 20 |
use Photonic_Plugin\Lightboxes\Thickbox; |
| 21 |
|
| 22 |
trait Can_Use_Lightbox { |
| 23 |
/** |
| 24 |
* @return Lightbox |
| 25 |
*/ |
| 26 |
public static function get_lightbox() { |
| 27 |
$map = [ |
| 28 |
'colorbox' => 'Colorbox.php', |
| 29 |
'fancybox' => 'Fancybox.php', |
| 30 |
'fancybox2' => 'Fancybox2.php', |
| 31 |
'fancybox3' => 'Fancybox3.php', |
| 32 |
'featherlight' => 'Featherlight.php', |
| 33 |
'imagelightbox' => 'Image_Lightbox.php', |
| 34 |
'lightcase' => 'Lightcase.php', |
| 35 |
'lightgallery' => 'Lightgallery.php', |
| 36 |
'magnific' => 'Magnific.php', |
| 37 |
'photoswipe' => 'PhotoSwipe.php', |
| 38 |
'prettyphoto' => 'PrettyPhoto.php', |
| 39 |
'swipebox' => 'Swipebox.php', |
| 40 |
'strip' => 'Strip.php', |
| 41 |
'thickbox' => 'Thickbox.php', |
| 42 |
'none' => 'None.php', |
| 43 |
]; |
| 44 |
$library = Photonic::$library; |
| 45 |
require_once(PHOTONIC_PATH.'/Lightboxes/'.$map[$library]); |
| 46 |
if ($library == 'colorbox') { |
| 47 |
$lightbox = Colorbox::get_instance(); |
| 48 |
} |
| 49 |
else if ($library == 'fancybox') { |
| 50 |
$lightbox = Fancybox::get_instance(); |
| 51 |
} |
| 52 |
else if ($library == 'fancybox2') { |
| 53 |
$lightbox = Fancybox2::get_instance(); |
| 54 |
} |
| 55 |
else if ($library == 'fancybox3') { |
| 56 |
$lightbox = Fancybox3::get_instance(); |
| 57 |
} |
| 58 |
else if ($library == 'featherlight') { |
| 59 |
$lightbox = Featherlight::get_instance(); |
| 60 |
} |
| 61 |
else if ($library == 'imagelightbox') { |
| 62 |
$lightbox = Image_Lightbox::get_instance(); |
| 63 |
} |
| 64 |
else if ($library == 'lightcase') { |
| 65 |
$lightbox = Lightcase::get_instance(); |
| 66 |
} |
| 67 |
else if ($library == 'lightgallery') { |
| 68 |
$lightbox = Lightgallery::get_instance(); |
| 69 |
} |
| 70 |
else if ($library == 'magnific') { |
| 71 |
$lightbox = Magnific::get_instance(); |
| 72 |
} |
| 73 |
else if ($library == 'photoswipe') { |
| 74 |
$lightbox = PhotoSwipe::get_instance(); |
| 75 |
} |
| 76 |
else if ($library == 'prettyphoto') { |
| 77 |
$lightbox = PrettyPhoto::get_instance(); |
| 78 |
} |
| 79 |
else if ($library == 'swipebox') { |
| 80 |
$lightbox = Swipebox::get_instance(); |
| 81 |
} |
| 82 |
else if ($library == 'strip') { |
| 83 |
$lightbox = Strip::get_instance(); |
| 84 |
} |
| 85 |
else if ($library == 'thickbox') { |
| 86 |
$lightbox = Thickbox::get_instance(); |
| 87 |
} |
| 88 |
else { |
| 89 |
$lightbox = None::get_instance(); |
| 90 |
} |
| 91 |
return $lightbox; |
| 92 |
} |
| 93 |
} |