class-gallery-api.php
4 months ago
class-gallery-base.php
3 months ago
class-gallery-config.php
4 months ago
class-gallery-design.php
4 months ago
class-gallery-field-provider.php
4 months ago
class-gallery-images.php
4 months ago
class-gallery-lightbox.php
4 months ago
class-gallery-misc.php
4 months ago
class-gallery-paging.php
4 months ago
trait-gallery-ajax.php
3 months ago
trait-gallery-duplicate.php
4 months ago
trait-gallery-image-methods.php
3 months ago
trait-gallery-preview.php
4 months ago
trait-gallery-sanitize.php
4 months ago
class-gallery-lightbox.php
100 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Responsive Lightbox Gallery Lightbox Settings |
| 4 | * |
| 5 | * Handles gallery lightbox options. |
| 6 | * |
| 7 | * @package Responsive_Lightbox |
| 8 | */ |
| 9 | |
| 10 | // exit if accessed directly |
| 11 | if ( ! defined( 'ABSPATH' ) ) |
| 12 | exit; |
| 13 | |
| 14 | /** |
| 15 | * Responsive_Lightbox_Gallery_Lightbox class. |
| 16 | * |
| 17 | * Gallery lightbox tab - implements lightbox settings. |
| 18 | * |
| 19 | * @class Responsive_Lightbox_Gallery_Lightbox |
| 20 | */ |
| 21 | class Responsive_Lightbox_Gallery_Lightbox extends Responsive_Lightbox_Gallery_Base { |
| 22 | |
| 23 | /** |
| 24 | * Tab key identifier. |
| 25 | * |
| 26 | * @var string |
| 27 | */ |
| 28 | const TAB_KEY = 'lightbox'; |
| 29 | |
| 30 | /** |
| 31 | * Get tab data for rendering. |
| 32 | * |
| 33 | * @param string $menu_item Optional menu item (unused for this tab). |
| 34 | * @return array Tab data. |
| 35 | */ |
| 36 | public function get_tab_data( $menu_item = '' ) { |
| 37 | $rl = Responsive_Lightbox(); |
| 38 | |
| 39 | // use sizes as keys and values |
| 40 | $sizes = array_combine( array_keys( $rl->galleries->get_data( 'sizes' ) ), array_keys( $rl->galleries->get_data( 'sizes' ) ) ); |
| 41 | |
| 42 | // add default, custom and full image size |
| 43 | $sizes['full'] = __( 'Full size', 'responsive-lightbox' ); |
| 44 | $sizes['global'] = __( 'Global', 'responsive-lightbox' ); |
| 45 | $sizes['rl_custom_size'] = __( 'Custom size', 'responsive-lightbox' ); |
| 46 | |
| 47 | // merge titles |
| 48 | $merged_titles = array( 'global' => __( 'Global', 'responsive-lightbox' ) ) + $rl->settings->get_data( 'image_titles' ); |
| 49 | |
| 50 | return [ |
| 51 | 'tab_key' => self::TAB_KEY, |
| 52 | 'options' => [ |
| 53 | 'lightbox_enable' => [ |
| 54 | 'title' => __( 'Enable Lightbox', 'responsive-lightbox' ), |
| 55 | 'type' => 'boolean', |
| 56 | 'label' => __( 'Enable lightbox effect for the gallery.', 'responsive-lightbox' ), |
| 57 | 'default' => true |
| 58 | ], |
| 59 | 'lightbox_image_size' => [ |
| 60 | 'title' => __( 'Image Size', 'responsive-lightbox' ), |
| 61 | 'type' => 'select', |
| 62 | 'description' => __( 'Select image size for gallery lightbox.', 'responsive-lightbox' ), |
| 63 | 'default' => 'global', |
| 64 | 'options' => $sizes |
| 65 | ], |
| 66 | 'lightbox_custom_size' => [ |
| 67 | 'title' => __( 'Custom Size', 'responsive-lightbox' ), |
| 68 | 'type' => 'multiple', |
| 69 | 'description' => __( 'Choose the custom image size for gallery lightbox (used if Custom Image size is selected).', 'responsive-lightbox' ), |
| 70 | 'fields' => [ |
| 71 | 'lightbox_custom_size_width' => [ |
| 72 | 'type' => 'number', |
| 73 | 'append' => __( 'width in px', 'responsive-lightbox' ), |
| 74 | 'default' => (int) get_option( 'large_size_w' ) |
| 75 | ], |
| 76 | 'lightbox_custom_size_height' => [ |
| 77 | 'type' => 'number', |
| 78 | 'append' => __( 'height in px', 'responsive-lightbox' ), |
| 79 | 'default' => (int) get_option( 'large_size_h' ) |
| 80 | ] |
| 81 | ] |
| 82 | ], |
| 83 | 'lightbox_image_title' => [ |
| 84 | 'title' => __( 'Image Title', 'responsive-lightbox' ), |
| 85 | 'type' => 'select', |
| 86 | 'description' => __( 'Select image title for gallery lightbox.', 'responsive-lightbox' ), |
| 87 | 'default' => 'global', |
| 88 | 'options' => $merged_titles |
| 89 | ], |
| 90 | 'lightbox_image_caption' => [ |
| 91 | 'title' => __( 'Image Caption', 'responsive-lightbox' ), |
| 92 | 'type' => 'select', |
| 93 | 'description' => __( 'Select image caption for gallery lightbox (used if supported by selected lightbox effect).', 'responsive-lightbox' ), |
| 94 | 'default' => 'global', |
| 95 | 'options' => $merged_titles |
| 96 | ] |
| 97 | ] |
| 98 | ]; |
| 99 | } |
| 100 | } |