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