| 1 |
<?php |
| 2 |
|
| 3 |
namespace Photonic_Plugin\Layouts\Features; |
| 4 |
|
| 5 |
use Photonic_Plugin\Core\Photonic; |
| 6 |
use Photonic_Plugin\Lightboxes\BaguetteBox; |
| 7 |
use Photonic_Plugin\Lightboxes\BigPicture; |
| 8 |
use Photonic_Plugin\Lightboxes\Colorbox; |
| 9 |
use Photonic_Plugin\Lightboxes\Fancybox; |
| 10 |
use Photonic_Plugin\Lightboxes\Fancybox2; |
| 11 |
use Photonic_Plugin\Lightboxes\Fancybox3; |
| 12 |
use Photonic_Plugin\Lightboxes\Fancybox4; |
| 13 |
use Photonic_Plugin\Lightboxes\Featherlight; |
| 14 |
use Photonic_Plugin\Lightboxes\GLightbox; |
| 15 |
use Photonic_Plugin\Lightboxes\Image_Lightbox; |
| 16 |
use Photonic_Plugin\Lightboxes\Lightbox; |
| 17 |
use Photonic_Plugin\Lightboxes\Lightcase; |
| 18 |
use Photonic_Plugin\Lightboxes\Lightgallery; |
| 19 |
use Photonic_Plugin\Lightboxes\Magnific; |
| 20 |
use Photonic_Plugin\Lightboxes\None; |
| 21 |
use Photonic_Plugin\Lightboxes\PhotoSwipe; |
| 22 |
use Photonic_Plugin\Lightboxes\PhotoSwipe5; |
| 23 |
use Photonic_Plugin\Lightboxes\PrettyPhoto; |
| 24 |
use Photonic_Plugin\Lightboxes\Spotlight; |
| 25 |
use Photonic_Plugin\Lightboxes\Strip; |
| 26 |
use Photonic_Plugin\Lightboxes\Swipebox; |
| 27 |
use Photonic_Plugin\Lightboxes\Thickbox; |
| 28 |
use Photonic_Plugin\Lightboxes\VenoBox; |
| 29 |
|
| 30 |
trait Can_Use_Lightbox { |
| 31 |
/** |
| 32 |
* @return Lightbox |
| 33 |
*/ |
| 34 |
public static function get_lightbox(): Lightbox { |
| 35 |
$map = [ |
| 36 |
'baguettebox' => 'BaguetteBox.php', |
| 37 |
'bigpicture' => 'BigPicture.php', |
| 38 |
'colorbox' => 'Colorbox.php', |
| 39 |
'fancybox' => 'Fancybox.php', |
| 40 |
'fancybox2' => 'Fancybox2.php', |
| 41 |
'fancybox3' => 'Fancybox3.php', |
| 42 |
'fancybox4' => 'Fancybox4.php', |
| 43 |
'featherlight' => 'Featherlight.php', |
| 44 |
'glightbox' => 'GLightbox.php', |
| 45 |
'imagelightbox' => 'Image_Lightbox.php', |
| 46 |
'lightcase' => 'Lightcase.php', |
| 47 |
'lightgallery' => 'Lightgallery.php', |
| 48 |
'magnific' => 'Magnific.php', |
| 49 |
'photoswipe' => 'PhotoSwipe.php', |
| 50 |
'photoswipe5' => 'PhotoSwipe5.php', |
| 51 |
'prettyphoto' => 'PrettyPhoto.php', |
| 52 |
'spotlight' => 'Spotlight.php', |
| 53 |
'swipebox' => 'Swipebox.php', |
| 54 |
'strip' => 'Strip.php', |
| 55 |
'thickbox' => 'Thickbox.php', |
| 56 |
'venobox' => 'VenoBox.php', |
| 57 |
'none' => 'None.php', |
| 58 |
]; |
| 59 |
$library = Photonic::$library; |
| 60 |
require_once PHOTONIC_PATH . '/Lightboxes/' . $map[$library]; |
| 61 |
|
| 62 |
if ('baguettebox' === $library) { |
| 63 |
$lightbox = BaguetteBox::get_instance(); |
| 64 |
} |
| 65 |
elseif ('bigpicture' === $library) { |
| 66 |
$lightbox = BigPicture::get_instance(); |
| 67 |
} |
| 68 |
elseif ('colorbox' === $library) { |
| 69 |
$lightbox = Colorbox::get_instance(); |
| 70 |
} |
| 71 |
elseif ('fancybox' === $library) { |
| 72 |
$lightbox = Fancybox::get_instance(); |
| 73 |
} |
| 74 |
elseif ('fancybox2' === $library) { |
| 75 |
$lightbox = Fancybox2::get_instance(); |
| 76 |
} |
| 77 |
elseif ('fancybox3' === $library) { |
| 78 |
$lightbox = Fancybox3::get_instance(); |
| 79 |
} |
| 80 |
elseif ('fancybox4' === $library) { |
| 81 |
$lightbox = Fancybox4::get_instance(); |
| 82 |
} |
| 83 |
elseif ('featherlight' === $library) { |
| 84 |
$lightbox = Featherlight::get_instance(); |
| 85 |
} |
| 86 |
elseif ('glightbox' === $library) { |
| 87 |
$lightbox = GLightbox::get_instance(); |
| 88 |
} |
| 89 |
elseif ('imagelightbox' === $library) { |
| 90 |
$lightbox = Image_Lightbox::get_instance(); |
| 91 |
} |
| 92 |
elseif ('lightcase' === $library) { |
| 93 |
$lightbox = Lightcase::get_instance(); |
| 94 |
} |
| 95 |
elseif ('lightgallery' === $library) { |
| 96 |
$lightbox = Lightgallery::get_instance(); |
| 97 |
} |
| 98 |
elseif ('magnific' === $library) { |
| 99 |
$lightbox = Magnific::get_instance(); |
| 100 |
} |
| 101 |
elseif ('photoswipe' === $library) { |
| 102 |
$lightbox = PhotoSwipe::get_instance(); |
| 103 |
} |
| 104 |
elseif ('photoswipe5' === $library) { |
| 105 |
$lightbox = PhotoSwipe5::get_instance(); |
| 106 |
} |
| 107 |
elseif ('prettyphoto' === $library) { |
| 108 |
$lightbox = PrettyPhoto::get_instance(); |
| 109 |
} |
| 110 |
elseif ('spotlight' === $library) { |
| 111 |
$lightbox = Spotlight::get_instance(); |
| 112 |
} |
| 113 |
elseif ('swipebox' === $library) { |
| 114 |
$lightbox = Swipebox::get_instance(); |
| 115 |
} |
| 116 |
elseif ('strip' === $library) { |
| 117 |
$lightbox = Strip::get_instance(); |
| 118 |
} |
| 119 |
elseif ('thickbox' === $library) { |
| 120 |
$lightbox = Thickbox::get_instance(); |
| 121 |
} |
| 122 |
elseif ('venobox' === $library) { |
| 123 |
$lightbox = VenoBox::get_instance(); |
| 124 |
} |
| 125 |
else { |
| 126 |
$lightbox = None::get_instance(); |
| 127 |
} |
| 128 |
return $lightbox; |
| 129 |
} |
| 130 |
} |
| 131 |
|