abilities
2 months ago
admin
2 months ago
compatibility
2 months ago
extensions
2 months ago
foopluginbase
2 months ago
public
2 months ago
thumbs
2 months ago
asset-manifest.php
2 months ago
class-attachment-filters.php
2 months ago
class-command-palette.php
2 months ago
class-foogallery-animated-gif-support.php
2 months ago
class-foogallery-attachment-custom-class.php
2 months ago
class-foogallery-attachment-filename.php
2 months ago
class-foogallery-attachment-type.php
2 months ago
class-foogallery-attachment.php
2 months ago
class-foogallery-cache.php
2 months ago
class-foogallery-common-fields.php
2 months ago
class-foogallery-crop-position.php
2 months ago
class-foogallery-datasource-media_library.php
2 months ago
class-foogallery-debug.php
2 months ago
class-foogallery-delayed-runtime-loader.php
2 months ago
class-foogallery-extensions-compatibility.php
2 months ago
class-foogallery-force-https.php
2 months ago
class-foogallery-lazyload.php
2 months ago
class-foogallery-license-constant-handler.php
2 months ago
class-foogallery-lightbox.php
2 months ago
class-foogallery-paging.php
2 months ago
class-foogallery-password-protect.php
2 months ago
class-foogallery-sitemaps.php
2 months ago
class-foogallery-widget.php
2 months ago
class-foogallery.php
2 months ago
class-gallery-advanced-settings.php
2 months ago
class-il8n.php
2 months ago
class-override-thumbnail.php
2 months ago
class-posttypes.php
2 months ago
class-previews.php
2 months ago
class-retina.php
2 months ago
class-thumbnail-dimensions.php
2 months ago
class-thumbnails.php
2 months ago
class-version-check.php
2 months ago
constants.php
2 months ago
functions.php
2 months ago
includes.php
2 months ago
index.php
2 months ago
render-functions.php
2 months ago
class-foogallery-lightbox.php
1280 lines
| 1 | <?php |
| 2 | /** |
| 3 | * FooGallery Lightbox class |
| 4 | * |
| 5 | * @package FooGallery |
| 6 | */ |
| 7 | |
| 8 | if ( ! class_exists( 'FooGallery_Lightbox' ) ) { |
| 9 | |
| 10 | /** |
| 11 | * FooGallery Lightbox class |
| 12 | */ |
| 13 | class FooGallery_Lightbox { |
| 14 | /** |
| 15 | * Constructor method. |
| 16 | * Initializes the FooGallery Lightbox class and adds necessary filters. |
| 17 | */ |
| 18 | public function __construct() { |
| 19 | // add lightbox custom fields. |
| 20 | add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'lightbox_custom_fields' ), 10, 2 ); |
| 21 | |
| 22 | // add the data options needed for lightbox. |
| 23 | add_filter( 'foogallery_build_container_data_options', array( $this, 'add_data_options' ), 10, 3 ); |
| 24 | |
| 25 | // set the settings icon for lightbox. |
| 26 | add_filter( 'foogallery_gallery_settings_metabox_section_icon', array( $this, 'add_section_icons' ) ); |
| 27 | |
| 28 | // add the FooGallery lightbox option. |
| 29 | add_filter( 'foogallery_gallery_template_field_lightboxes', array( $this, 'add_lightbox' ) ); |
| 30 | |
| 31 | // alter the default lightbox to be FooGallery Lightbox. |
| 32 | add_filter( 'foogallery_alter_gallery_template_field', array( $this, 'make_foogallery_default_lightbox' ), 99, 2 ); |
| 33 | |
| 34 | // add specific lightbox data attribute to the container div. |
| 35 | add_filter( 'foogallery_build_container_attributes', array( $this, 'add_lightbox_data_attributes' ), 10, 2 ); |
| 36 | |
| 37 | // remove PRO lightbox option from albums. |
| 38 | add_filter( 'foogallery_alter_gallery_template_field', array( $this, 'alter_gallery_template_field' ), 999, 2 ); |
| 39 | |
| 40 | // cater for different captions sources. |
| 41 | add_filter( 'foogallery_attachment_html_link_attributes', array( $this, 'add_caption_attributes' ), 10, 3 ); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Handle custom captions for the lightbox |
| 46 | * |
| 47 | * @param array $attr The HTML attributes for the attachment link. |
| 48 | * @param array $args An array of arguments. |
| 49 | * @param object $foogallery_attachment The FooGallery attachment object. |
| 50 | * |
| 51 | * @return array The modified HTML attributes. |
| 52 | */ |
| 53 | public function add_caption_attributes( $attr, $args, $foogallery_attachment ) { |
| 54 | global $current_foogallery; |
| 55 | |
| 56 | if ( ! property_exists( $current_foogallery, 'lightbox' ) ) { |
| 57 | // TODO : rather use foogallery_current_gallery_check_template_has_supported_feature. |
| 58 | $template = foogallery_get_gallery_template( $current_foogallery->gallery_template ); |
| 59 | $lightbox = foogallery_gallery_template_setting_lightbox(); |
| 60 | if ( $template && isset( $template['panel_support'] ) && $template['panel_support'] ) { |
| 61 | $lightbox = 'foogallery'; |
| 62 | } |
| 63 | $current_foogallery->lightbox = $lightbox; |
| 64 | } |
| 65 | |
| 66 | // check if lightbox set to foogallery. |
| 67 | if ( 'foogallery' === $current_foogallery->lightbox ) { |
| 68 | |
| 69 | // check lightbox caption source. |
| 70 | $source = foogallery_gallery_template_setting( 'lightbox_caption_override', '' ); |
| 71 | |
| 72 | if ( 'override' === $source ) { |
| 73 | $caption_title_source = foogallery_gallery_template_setting( 'lightbox_caption_override_title', '' ); |
| 74 | if ( '' === $caption_title_source ) { |
| 75 | if ( array_key_exists( 'data-caption-title', $attr ) ) { |
| 76 | $attr['data-lightbox-title'] = $attr['data-caption-title']; |
| 77 | } |
| 78 | } else if ( 'none' === $caption_title_source ) { |
| 79 | $attr['data-lightbox-title'] = ''; |
| 80 | } else { |
| 81 | $attr['data-lightbox-title'] = foogallery_get_caption_by_source( $foogallery_attachment, $caption_title_source, 'title' ); |
| 82 | } |
| 83 | |
| 84 | $caption_desc_source = foogallery_gallery_template_setting( 'lightbox_caption_override_desc', '' ); |
| 85 | if ( '' === $caption_desc_source ) { |
| 86 | if ( array_key_exists( 'data-caption-desc', $attr ) ) { |
| 87 | $attr['data-lightbox-description'] = $attr['data-caption-desc']; |
| 88 | } |
| 89 | } else if ( 'none' === $caption_desc_source ) { |
| 90 | $attr['data-lightbox-description'] = ''; |
| 91 | } else { |
| 92 | $attr['data-lightbox-description'] = foogallery_get_caption_by_source( $foogallery_attachment, $caption_desc_source, 'description' ); |
| 93 | } |
| 94 | } else if ( 'custom' === $source ) { |
| 95 | |
| 96 | $template = foogallery_gallery_template_setting( 'lightbox_caption_custom_template', '' ); |
| 97 | if ( ! empty( $template ) ) { |
| 98 | $attr['data-lightbox-description'] = FooGallery_Pro_Advanced_Captions::build_custom_caption( $template, $foogallery_attachment ); |
| 99 | } |
| 100 | } else if ( '' === $source ) { |
| 101 | // if same as thumbnails, then check if custom captions was set. |
| 102 | if ( isset( $foogallery_attachment->custom_captions ) && $foogallery_attachment->custom_captions ) { |
| 103 | $attr['data-lightbox-title'] = ''; |
| 104 | $attr['data-lightbox-description'] = $foogallery_attachment->caption_desc; |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // Make sure the captions are sanitized!! |
| 110 | if ( isset( $attr['data-lightbox-title'] ) ) { |
| 111 | $attr['data-lightbox-title'] = foogallery_sanitize_full( $attr['data-lightbox-title'] ); |
| 112 | } |
| 113 | |
| 114 | if ( isset( $attr['data-lightbox-description'] ) ) { |
| 115 | $attr['data-lightbox-description'] = foogallery_sanitize_full( $attr['data-lightbox-description'] ); |
| 116 | } |
| 117 | |
| 118 | return $attr; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * Add fields to all galleries. |
| 123 | * |
| 124 | * @param $fields |
| 125 | * @param $template |
| 126 | * |
| 127 | * @return mixed |
| 128 | * @uses "foogallery_override_gallery_template_fields" |
| 129 | * |
| 130 | */ |
| 131 | public function lightbox_custom_fields( $fields, $template ) { |
| 132 | $use_lightbox = true; |
| 133 | if ( $template && array_key_exists( 'panel_support', $template ) && true === $template['panel_support'] ) { |
| 134 | $use_lightbox = false; |
| 135 | } |
| 136 | |
| 137 | $section = $use_lightbox ? __( 'Lightbox', 'foogallery' ) : __( 'Panel', 'foogallery' ); |
| 138 | |
| 139 | if ( $use_lightbox ) { |
| 140 | if ( foogallery_admin_fields_has_field( $fields, 'thumbnail_link' ) && |
| 141 | foogallery_admin_fields_has_field( $fields, 'lightbox' ) && |
| 142 | !foogallery_admin_fields_has_field( $fields, 'lightbox_warning' ) ) { |
| 143 | |
| 144 | $warning_field = array( |
| 145 | array( |
| 146 | 'id' => 'lightbox_warning', |
| 147 | 'title' => __('Your Lightbox Will Not Work!', 'foogallery'), |
| 148 | 'desc' => __('No lightbox will be shown, because under the General tab, you have set the Thumbnail Link to "Not linked".', 'foogallery'), |
| 149 | 'section' => __( 'Lightbox', 'foogallery' ), |
| 150 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 151 | 'type' => 'help', |
| 152 | 'row_data' => array( |
| 153 | 'data-foogallery-hidden' => true, |
| 154 | 'data-foogallery-show-when-field' => 'thumbnail_link', |
| 155 | 'data-foogallery-show-when-field-operator' => '===', |
| 156 | 'data-foogallery-show-when-field-value' => 'none', |
| 157 | ), |
| 158 | ) |
| 159 | ); |
| 160 | |
| 161 | $index = foogallery_admin_fields_find_index_of_field( $fields, 'lightbox' ); |
| 162 | |
| 163 | array_splice( $fields, $index, 0, $warning_field ); |
| 164 | } |
| 165 | |
| 166 | $field[] = array( |
| 167 | 'id' => 'lightbox_promo', |
| 168 | 'title' => __('Your Gallery Needs A Lightbox!', 'foogallery'), |
| 169 | 'desc' => __('Website visitors prefer a gallery with a lightbox. A lightbox allows you to showcase your images, as well as improve navigation between images in your gallery.', 'foogallery'), |
| 170 | 'section' => $section, |
| 171 | 'subsection' => array('lightbox-general' => __('General', 'foogallery')), |
| 172 | 'type' => 'help', |
| 173 | 'row_data' => array( |
| 174 | 'data-foogallery-hidden' => true, |
| 175 | 'data-foogallery-show-when-field' => 'lightbox', |
| 176 | 'data-foogallery-show-when-field-operator' => '===', |
| 177 | 'data-foogallery-show-when-field-value' => 'none', |
| 178 | ), |
| 179 | ); |
| 180 | } |
| 181 | |
| 182 | $field[] = array( |
| 183 | 'id' => 'lightbox_theme', |
| 184 | 'title' => __( 'Theme', 'foogallery' ), |
| 185 | 'desc' => __( 'The overall appearance including background and button color. By default it will inherit from Appearance -> Theme', 'foogallery' ), |
| 186 | 'section' => $section, |
| 187 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 188 | 'type' => 'radio', |
| 189 | 'default' => '', |
| 190 | 'choices' => apply_filters( |
| 191 | 'foogallery_gallery_template_lightbox_theme_choices', |
| 192 | array( |
| 193 | '' => __( 'Inherit', 'foogallery' ), |
| 194 | 'fg-light' => __( 'Light', 'foogallery' ), |
| 195 | 'fg-dark' => __( 'Dark', 'foogallery' ), |
| 196 | 'fg-custom' => __( 'Custom', 'foogallery' ), |
| 197 | ) |
| 198 | ), |
| 199 | 'row_data' => array( |
| 200 | 'data-foogallery-change-selector' => 'input', |
| 201 | 'data-foogallery-preview' => 'shortcode', |
| 202 | 'data-foogallery-value-selector' => 'input:checked', |
| 203 | 'data-foogallery-hidden' => true, |
| 204 | 'data-foogallery-show-when-field' => 'lightbox', |
| 205 | 'data-foogallery-show-when-field-operator' => '===', |
| 206 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 207 | ) |
| 208 | ); |
| 209 | |
| 210 | if ( $use_lightbox ) { |
| 211 | $field[] = array( |
| 212 | 'id' => 'lightbox_help_controls', |
| 213 | 'title' => __( 'Lightbox Control Settings', 'foogallery' ), |
| 214 | 'desc' => __( 'The Lightbox Controls are the action buttons that are shown within the lightbox, e.g. the Close button or the Navigation buttons', 'foogallery' ), |
| 215 | 'section' => $section, |
| 216 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 217 | 'type' => 'help', |
| 218 | 'row_data' => array( |
| 219 | 'data-foogallery-hidden' => true, |
| 220 | 'data-foogallery-show-when-field' => 'lightbox', |
| 221 | 'data-foogallery-show-when-field-operator' => '===', |
| 222 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 223 | ), |
| 224 | ); |
| 225 | } |
| 226 | |
| 227 | $field[] = array( |
| 228 | 'id' => 'lightbox_button_theme', |
| 229 | 'title' => __( 'Control Color', 'foogallery' ), |
| 230 | 'desc' => __( 'You can override the button controls color. By default it will inherit from the theme.', 'foogallery' ), |
| 231 | 'section' => $section, |
| 232 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 233 | 'type' => 'radio', |
| 234 | 'default' => '', |
| 235 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_button_theme_choices', array( |
| 236 | '' => __( 'Same As Theme', 'foogallery' ), |
| 237 | 'custom' => __( 'Custom Color', 'foogallery' ), |
| 238 | ) ), |
| 239 | 'row_data'=> array( |
| 240 | 'data-foogallery-change-selector' => 'input', |
| 241 | 'data-foogallery-preview' => 'shortcode', |
| 242 | 'data-foogallery-value-selector' => 'input:checked', |
| 243 | 'data-foogallery-hidden' => true, |
| 244 | 'data-foogallery-show-when-field' => 'lightbox', |
| 245 | 'data-foogallery-show-when-field-operator' => '===', |
| 246 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 247 | ), |
| 248 | ); |
| 249 | |
| 250 | $field[] = array( |
| 251 | 'id' => 'lightbox_custom_button_theme', |
| 252 | 'title' => __( 'Custom Control Color', 'foogallery' ), |
| 253 | 'desc' => __( 'You can override the button controls color by selecting a color.', 'foogallery' ), |
| 254 | 'section' => $section, |
| 255 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 256 | 'spacer' => '<span class="spacer"></span>', |
| 257 | 'type' => 'htmlicon', |
| 258 | 'default' => 'fg-button-light', |
| 259 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_custom_button_theme_choices', array( |
| 260 | 'fg-button-light' => array( 'label' => __( 'Light', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-light"></div>' ), |
| 261 | 'fg-button-dark' => array( 'label' => __( 'Dark', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-dark"></div>' ), |
| 262 | 'fg-button-blue' => array( 'label' => __( 'Blue', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-blue"></div>' ), |
| 263 | 'fg-button-purple' => array( 'label' => __( 'Purple', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-purple"></div>' ), |
| 264 | 'fg-button-green' => array( 'label' => __( 'Green', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-green"></div>' ), |
| 265 | 'fg-button-red' => array( 'label' => __( 'Red', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-red"></div>' ), |
| 266 | 'fg-button-orange' => array( 'label' => __( 'Orange', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-orange"></div>' ), |
| 267 | ) ), |
| 268 | 'row_data'=> array( |
| 269 | 'data-foogallery-change-selector' => 'input', |
| 270 | 'data-foogallery-preview' => 'shortcode', |
| 271 | 'data-foogallery-value-selector' => 'input:checked', |
| 272 | 'data-foogallery-hidden' => true, |
| 273 | 'data-foogallery-show-when-field' => 'lightbox_button_theme', |
| 274 | 'data-foogallery-show-when-field-operator' => '===', |
| 275 | 'data-foogallery-show-when-field-value' => 'custom', |
| 276 | ), |
| 277 | ); |
| 278 | |
| 279 | $field[] = array( |
| 280 | 'id' => 'lightbox_button_highlight', |
| 281 | 'title' => __( 'Control Hover Color', 'foogallery' ), |
| 282 | 'desc' => __( 'You can override the button controls hover color. By default it will inherit from the theme.', 'foogallery' ), |
| 283 | 'section' => $section, |
| 284 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 285 | 'type' => 'radio', |
| 286 | 'default' => '', |
| 287 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_button_highlight_choices', array( |
| 288 | '' => __( 'Same As Theme', 'foogallery' ), |
| 289 | 'custom' => __( 'Custom Color', 'foogallery' ), |
| 290 | ) ), |
| 291 | 'row_data'=> array( |
| 292 | 'data-foogallery-change-selector' => 'input', |
| 293 | 'data-foogallery-preview' => 'shortcode', |
| 294 | 'data-foogallery-value-selector' => 'input:checked', |
| 295 | 'data-foogallery-hidden' => true, |
| 296 | 'data-foogallery-show-when-field' => 'lightbox', |
| 297 | 'data-foogallery-show-when-field-operator' => '===', |
| 298 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 299 | ), |
| 300 | ); |
| 301 | |
| 302 | $field[] = array( |
| 303 | 'id' => 'lightbox_custom_button_highlight', |
| 304 | 'title' => __( 'Custom Control Hover Color', 'foogallery' ), |
| 305 | 'desc' => __( 'You can override the button controls hover color by selecting a color.', 'foogallery' ), |
| 306 | 'section' => $section, |
| 307 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 308 | 'spacer' => '<span class="spacer"></span>', |
| 309 | 'type' => 'htmlicon', |
| 310 | 'default' => 'fg-highlight-light', |
| 311 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_custom_button_highlight_choices', array( |
| 312 | 'fg-highlight-light' => array( 'label' => __( 'Light', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-light"></div>' ), |
| 313 | 'fg-highlight-dark' => array( 'label' => __( 'Dark', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-dark"></div>' ), |
| 314 | 'fg-highlight-blue' => array( 'label' => __( 'Blue', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-blue"></div>' ), |
| 315 | 'fg-highlight-purple' => array( 'label' => __( 'Purple', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-purple"></div>' ), |
| 316 | 'fg-highlight-green' => array( 'label' => __( 'Green', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-green"></div>' ), |
| 317 | 'fg-highlight-red' => array( 'label' => __( 'Red', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-red"></div>' ), |
| 318 | 'fg-highlight-orange' => array( 'label' => __( 'Orange', 'foogallery' ), 'html' => '<div class="foogallery-setting-panel_theme fg-orange"></div>' ), |
| 319 | ) ), |
| 320 | 'row_data'=> array( |
| 321 | 'data-foogallery-change-selector' => 'input', |
| 322 | 'data-foogallery-preview' => 'shortcode', |
| 323 | 'data-foogallery-value-selector' => 'input:checked', |
| 324 | 'data-foogallery-hidden' => true, |
| 325 | 'data-foogallery-show-when-field' => 'lightbox_button_highlight', |
| 326 | 'data-foogallery-show-when-field-operator' => '===', |
| 327 | 'data-foogallery-show-when-field-value' => 'custom', |
| 328 | ) |
| 329 | ); |
| 330 | |
| 331 | $hide_thumbs_by_default = false; |
| 332 | //only hide the thumbs by default if we are using the Grid PRO template |
| 333 | if ( $template && array_key_exists('slug', $template) && $template['slug'] === 'foogridpro' ) { |
| 334 | $hide_thumbs_by_default = true; |
| 335 | } |
| 336 | |
| 337 | if ( $use_lightbox ) { |
| 338 | $field[] = array( |
| 339 | 'id' => 'lightbox_help_thumbnails', |
| 340 | 'title' => __( 'Thumbnail Strip Settings', 'foogallery' ), |
| 341 | 'desc' => __( 'The below settings will control the thumbnail strip that is shown within the lightbox.', 'foogallery' ), |
| 342 | 'section' => $section, |
| 343 | 'subsection' => array( 'lightbox-thumbnails' => __( 'Thumbnails', 'foogallery' ) ), |
| 344 | 'type' => 'help', |
| 345 | 'row_data' => array( |
| 346 | 'data-foogallery-hidden' => true, |
| 347 | 'data-foogallery-show-when-field' => 'lightbox', |
| 348 | 'data-foogallery-show-when-field-operator' => '===', |
| 349 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 350 | ), |
| 351 | ); |
| 352 | } |
| 353 | |
| 354 | $field[] = array( |
| 355 | 'id' => 'lightbox_thumbs', |
| 356 | 'title' => __( 'Thumbnail Strip', 'foogallery' ), |
| 357 | 'desc' => __( 'You can change the position of the thumbnails, or hide them completely.', 'foogallery' ), |
| 358 | 'section' => $section, |
| 359 | 'subsection' => array( 'lightbox-thumbnails' => __( 'Thumbnails', 'foogallery' ) ), |
| 360 | 'type' => 'radio', |
| 361 | 'default' => $hide_thumbs_by_default ? 'none' : 'bottom', |
| 362 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_choices', array( |
| 363 | 'bottom' => __( 'Bottom', 'foogallery' ), |
| 364 | 'top' => __( 'Top', 'foogallery' ), |
| 365 | 'left' => __( 'Left', 'foogallery' ), |
| 366 | 'right' => __( 'Right', 'foogallery' ), |
| 367 | 'none' => __( 'Hidden', 'foogallery' ), |
| 368 | ) ), |
| 369 | 'row_data' => array( |
| 370 | 'data-foogallery-change-selector' => 'input:radio', |
| 371 | 'data-foogallery-preview' => 'shortcode', |
| 372 | 'data-foogallery-value-selector' => 'input:checked', |
| 373 | 'data-foogallery-hidden' => true, |
| 374 | 'data-foogallery-show-when-field' => 'lightbox', |
| 375 | 'data-foogallery-show-when-field-operator' => '===', |
| 376 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 377 | ) |
| 378 | ); |
| 379 | |
| 380 | $field[] = array( |
| 381 | 'id' => 'lightbox_thumbs_captions', |
| 382 | 'title' => __( 'Thumbnail Strip Captions', 'foogallery' ), |
| 383 | 'desc' => __( 'Whether or not the thumbnail strip should contain captions.', 'foogallery' ), |
| 384 | 'section' => $section, |
| 385 | 'subsection' => array( 'lightbox-thumbnails' => __( 'Thumbnails', 'foogallery' ) ), |
| 386 | 'type' => 'radio', |
| 387 | 'default' => 'no', |
| 388 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_captions_choices', array( |
| 389 | 'yes' => __( 'Show Captions', 'foogallery' ), |
| 390 | 'no' => __( 'No Captions', 'foogallery' ), |
| 391 | ) ), |
| 392 | 'row_data'=> array( |
| 393 | 'data-foogallery-hidden' => true, |
| 394 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 395 | 'data-foogallery-show-when-field-operator' => '!==', |
| 396 | 'data-foogallery-show-when-field-value' => 'none', |
| 397 | 'data-foogallery-change-selector' => 'input:radio', |
| 398 | 'data-foogallery-preview' => 'shortcode', |
| 399 | 'data-foogallery-value-selector' => 'input:checked', |
| 400 | ) |
| 401 | ); |
| 402 | |
| 403 | $field[] = array( |
| 404 | 'id' => 'lightbox_thumbs_captions_alignment', |
| 405 | 'title' => __( 'Thumbnail Caption Alignment', 'foogallery' ), |
| 406 | 'section' => $section, |
| 407 | 'subsection' => array( 'lightbox-thumbnails' => __( 'Thumbnails', 'foogallery' ) ), |
| 408 | 'type' => 'radio', |
| 409 | 'default' => 'default', |
| 410 | 'choices' => array( |
| 411 | 'default' => __( 'Default', 'foogallery' ), |
| 412 | 'left' => __( 'Left', 'foogallery' ), |
| 413 | 'center' => __( 'Center', 'foogallery' ), |
| 414 | 'right' => __( 'Right', 'foogallery' ), |
| 415 | 'justify' => __( 'Justify', 'foogallery' ), |
| 416 | ), |
| 417 | 'row_data' => array( |
| 418 | 'data-foogallery-change-selector' => 'input:radio', |
| 419 | 'data-foogallery-preview' => 'shortcode', |
| 420 | 'data-foogallery-hidden' => true, |
| 421 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 422 | 'data-foogallery-show-when-field-operator' => '!==', |
| 423 | 'data-foogallery-show-when-field-value' => 'none', |
| 424 | ) |
| 425 | ); |
| 426 | |
| 427 | $field[] = array( |
| 428 | 'id' => 'lightbox_thumbs_bestfit', |
| 429 | 'title' => __( 'Thumbnails Best Fit', 'foogallery' ), |
| 430 | 'desc' => __( 'Adjust the size of the displayed thumbnails so that they fill the entire space within the strip.', 'foogallery' ), |
| 431 | 'section' => $section, |
| 432 | 'subsection' => array( 'lightbox-thumbnails' => __( 'Thumbnails', 'foogallery' ) ), |
| 433 | 'type' => 'radio', |
| 434 | 'default' => '', |
| 435 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_bestfit_choices', array( |
| 436 | '' => __( 'Default', 'foogallery' ), |
| 437 | 'yes' => __( 'Best Fit', 'foogallery' ), |
| 438 | ) ), |
| 439 | 'row_data'=> array( |
| 440 | 'data-foogallery-hidden' => true, |
| 441 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 442 | 'data-foogallery-show-when-field-operator' => '!==', |
| 443 | 'data-foogallery-show-when-field-value' => 'none', |
| 444 | 'data-foogallery-change-selector' => 'input:radio', |
| 445 | 'data-foogallery-preview' => 'shortcode', |
| 446 | 'data-foogallery-value-selector' => 'input:checked', |
| 447 | ) |
| 448 | ); |
| 449 | |
| 450 | $field[] = array( |
| 451 | 'id' => 'lightbox_thumbs_size', |
| 452 | 'title' => __( 'Thumbnail Size', 'foogallery' ), |
| 453 | 'desc' => __( 'Adjust the size of the thumbnail image to display as either small (square) or large (landscape).', 'foogallery' ), |
| 454 | 'section' => $section, |
| 455 | 'subsection' => array( 'lightbox-thumbnails' => __( 'Thumbnails', 'foogallery' ) ), |
| 456 | 'type' => 'radio', |
| 457 | 'default' => '', |
| 458 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_thumbs_size_choices', array( |
| 459 | '' => __( 'Normal', 'foogallery' ), |
| 460 | 'small' => __( 'Small (square)', 'foogallery' ), |
| 461 | ) ), |
| 462 | 'row_data'=> array( |
| 463 | 'data-foogallery-hidden' => true, |
| 464 | 'data-foogallery-show-when-field' => 'lightbox_thumbs', |
| 465 | 'data-foogallery-show-when-field-operator' => '!==', |
| 466 | 'data-foogallery-show-when-field-value' => 'none', |
| 467 | 'data-foogallery-change-selector' => 'input:radio', |
| 468 | 'data-foogallery-preview' => 'shortcode', |
| 469 | 'data-foogallery-value-selector' => 'input:checked', |
| 470 | ) |
| 471 | ); |
| 472 | |
| 473 | $field[] = array( |
| 474 | 'id' => 'lightbox_transition', |
| 475 | 'title' => __( 'Transition', 'foogallery' ), |
| 476 | 'desc' => __( 'The transition to apply to the main content area when switching between items.', 'foogallery' ), |
| 477 | 'section' => $section, |
| 478 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 479 | 'type' => 'radio', |
| 480 | 'default' => 'fade', |
| 481 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_button_highlight_choices', array( |
| 482 | 'fade' => __( 'Fade', 'foogallery' ), |
| 483 | 'horizontal' => __( 'Horizontal', 'foogallery' ), |
| 484 | 'vertical' => __( 'Vertical', 'foogallery' ), |
| 485 | 'none' => __( 'None', 'foogallery' ) |
| 486 | ) ), |
| 487 | 'row_data'=> array( |
| 488 | 'data-foogallery-change-selector' => 'input', |
| 489 | 'data-foogallery-preview' => 'shortcode', |
| 490 | 'data-foogallery-value-selector' => 'input:checked', |
| 491 | 'data-foogallery-hidden' => true, |
| 492 | 'data-foogallery-show-when-field' => 'lightbox', |
| 493 | 'data-foogallery-show-when-field-operator' => '===', |
| 494 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 495 | ) |
| 496 | ); |
| 497 | |
| 498 | $field[] = array( |
| 499 | 'id' => 'lightbox_info_enabled', |
| 500 | 'title' => __( 'Captions Enabled', 'foogallery' ), |
| 501 | 'section' => $section, |
| 502 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 503 | 'type' => 'radio', |
| 504 | 'default' => '', |
| 505 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_info_enabled_choices', array( |
| 506 | 'disabled' => __( 'Disabled', 'foogallery' ), |
| 507 | '' => __( 'Enabled', 'foogallery' ), |
| 508 | 'hidden' => __( 'Enabled (but hidden initially)', 'foogallery' ), |
| 509 | ) ), |
| 510 | 'row_data'=> array( |
| 511 | 'data-foogallery-change-selector' => 'input:radio', |
| 512 | 'data-foogallery-preview' => 'shortcode', |
| 513 | 'data-foogallery-value-selector' => 'input:checked', |
| 514 | 'data-foogallery-hidden' => true, |
| 515 | 'data-foogallery-show-when-field' => 'lightbox', |
| 516 | 'data-foogallery-show-when-field-operator' => '===', |
| 517 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 518 | ) |
| 519 | ); |
| 520 | |
| 521 | $field[] = array( |
| 522 | 'id' => 'lightbox_info_position', |
| 523 | 'title' => __( 'Caption Position', 'foogallery' ), |
| 524 | 'desc' => __( 'The position of the captions within the lightbox.', 'foogallery' ), |
| 525 | 'section' => $section, |
| 526 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 527 | 'type' => 'radio', |
| 528 | 'default' => 'bottom', |
| 529 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_info_position_choices', array( |
| 530 | 'bottom' => __( 'Bottom', 'foogallery' ), |
| 531 | 'top' => __( 'Top', 'foogallery' ), |
| 532 | 'left' => __( 'Left', 'foogallery' ), |
| 533 | 'right' => __( 'Right', 'foogallery' ), |
| 534 | //'none' => __( 'Hidden', 'foogallery' ), |
| 535 | ) ), |
| 536 | 'row_data'=> array( |
| 537 | 'data-foogallery-change-selector' => 'input:radio', |
| 538 | 'data-foogallery-preview' => 'shortcode', |
| 539 | 'data-foogallery-value-selector' => 'input:checked', |
| 540 | 'data-foogallery-hidden' => true, |
| 541 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 542 | 'data-foogallery-show-when-field-operator' => '!==', |
| 543 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 544 | ) |
| 545 | ); |
| 546 | |
| 547 | $field[] = array( |
| 548 | 'id' => 'lightbox_info_alignment', |
| 549 | 'title' => __( 'Caption Text Alignment', 'foogallery' ), |
| 550 | 'desc' => __( 'Change the horizontal text alignment of the captions', 'foogallery' ), |
| 551 | 'section' => $section, |
| 552 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 553 | 'type' => 'radio', |
| 554 | 'default' => 'default', |
| 555 | 'choices' => array( |
| 556 | 'default' => __( 'Default', 'foogallery' ), |
| 557 | 'left' => __( 'Left', 'foogallery' ), |
| 558 | 'center' => __( 'Center', 'foogallery' ), |
| 559 | 'right' => __( 'Right', 'foogallery' ), |
| 560 | 'justify' => __( 'Justify', 'foogallery' ), |
| 561 | ), |
| 562 | 'row_data' => array( |
| 563 | 'data-foogallery-change-selector' => 'input:radio', |
| 564 | 'data-foogallery-preview' => 'shortcode', |
| 565 | 'data-foogallery-hidden' => true, |
| 566 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 567 | 'data-foogallery-show-when-field-operator' => '!==', |
| 568 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 569 | ) |
| 570 | ); |
| 571 | |
| 572 | $field[] = array( |
| 573 | 'id' => 'lightbox_info_overlay', |
| 574 | 'title' => __( 'Caption Display', 'foogallery' ), |
| 575 | 'desc' => __( 'Whether or not the caption is overlaid on top of the content, or is inline (outside of the content).', 'foogallery' ), |
| 576 | 'section' => $section, |
| 577 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 578 | 'type' => 'radio', |
| 579 | 'default' => 'yes', |
| 580 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_info_choices', array( |
| 581 | 'yes' => __( 'Overlay', 'foogallery' ), |
| 582 | 'no' => __( 'Inline', 'foogallery' ), |
| 583 | ) ), |
| 584 | 'row_data'=> array( |
| 585 | 'data-foogallery-change-selector' => 'input:radio', |
| 586 | 'data-foogallery-preview' => 'shortcode', |
| 587 | 'data-foogallery-value-selector' => 'input:checked', |
| 588 | 'data-foogallery-hidden' => true, |
| 589 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 590 | 'data-foogallery-show-when-field-operator' => '!==', |
| 591 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 592 | ) |
| 593 | ); |
| 594 | |
| 595 | $field[] = array( |
| 596 | 'id' => 'lightbox_info_autohide_mobile', |
| 597 | 'title' => __( 'Auto-hide on Mobile', 'foogallery' ), |
| 598 | 'desc' => __( 'Whether captions should automatically hide on mobile devices. When disabled, captions will remain visible on mobile.', 'foogallery' ), |
| 599 | 'section' => $section, |
| 600 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 601 | 'type' => 'radio', |
| 602 | 'default' => 'yes', |
| 603 | 'choices' => array( |
| 604 | 'yes' => __( 'Auto-hide (default)', 'foogallery' ), |
| 605 | 'no' => __( 'Always visible', 'foogallery' ), |
| 606 | ), |
| 607 | 'row_data'=> array( |
| 608 | 'data-foogallery-change-selector' => 'input:radio', |
| 609 | 'data-foogallery-preview' => 'shortcode', |
| 610 | 'data-foogallery-value-selector' => 'input:checked', |
| 611 | 'data-foogallery-hidden' => true, |
| 612 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 613 | 'data-foogallery-show-when-field-operator' => '!==', |
| 614 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 615 | ) |
| 616 | ); |
| 617 | |
| 618 | $field[] = array( |
| 619 | 'id' => 'lightbox_caption_override', |
| 620 | 'title' => __( 'Caption Source', 'foogallery' ), |
| 621 | 'desc' => __( 'The captions can be different to the thumbnail captions.', 'foogallery' ), |
| 622 | 'section' => $section, |
| 623 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 624 | 'type' => 'radio', |
| 625 | 'default' => '', |
| 626 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_caption_override_choices', array( |
| 627 | '' => __( 'Same As Thumbnail', 'foogallery' ), |
| 628 | 'override' => __( 'Override', 'foogallery' ), |
| 629 | 'custom' => __( 'Custom', 'foogallery' ), |
| 630 | ) ), |
| 631 | 'row_data'=> array( |
| 632 | 'data-foogallery-change-selector' => 'input:radio', |
| 633 | 'data-foogallery-preview' => 'shortcode', |
| 634 | 'data-foogallery-value-selector' => 'input:checked', |
| 635 | 'data-foogallery-hidden' => true, |
| 636 | 'data-foogallery-show-when-field' => 'lightbox_info_enabled', |
| 637 | 'data-foogallery-show-when-field-operator' => '!==', |
| 638 | 'data-foogallery-show-when-field-value' => 'disabled', |
| 639 | ) |
| 640 | ); |
| 641 | |
| 642 | $field[] = array( |
| 643 | 'id' => 'lightbox_caption_override_title', |
| 644 | 'title' => __( 'Override Caption Title', 'foogallery' ), |
| 645 | 'desc' => __( 'You can override the caption title to be different from the thumbnail caption title.', 'foogallery' ), |
| 646 | 'section' => $section, |
| 647 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 648 | 'type' => 'radio', |
| 649 | 'default' => '', |
| 650 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_caption_title_choices', array( |
| 651 | '' => __( 'Same As Thumbnail', 'foogallery' ), |
| 652 | 'title' => __( 'Attachment Title', 'foogallery' ), |
| 653 | 'caption' => __( 'Attachment Caption', 'foogallery' ), |
| 654 | 'alt' => __( 'Attachment Alt', 'foogallery' ), |
| 655 | 'desc' => __( 'Attachment Description', 'foogallery' ), |
| 656 | 'none' => __( 'None', 'foogallery' ), |
| 657 | ) ), |
| 658 | 'row_data'=> array( |
| 659 | 'data-foogallery-hidden' => true, |
| 660 | 'data-foogallery-show-when-field' => 'lightbox_caption_override', |
| 661 | 'data-foogallery-show-when-field-operator' => '===', |
| 662 | 'data-foogallery-show-when-field-value' => 'override', |
| 663 | 'data-foogallery-change-selector' => 'input:radio', |
| 664 | 'data-foogallery-preview' => 'shortcode', |
| 665 | 'data-foogallery-value-selector' => 'input:checked', |
| 666 | ) |
| 667 | ); |
| 668 | |
| 669 | $field[] = array( |
| 670 | 'id' => 'lightbox_caption_override_desc', |
| 671 | 'title' => __( 'Override Caption Desc.', 'foogallery' ), |
| 672 | 'desc' => __( 'You can override the caption description to be different from the thumbnail caption description.', 'foogallery' ), |
| 673 | 'section' => $section, |
| 674 | 'subsection' => array( 'lightbox-captions' => __( 'Captions', 'foogallery' ) ), |
| 675 | 'type' => 'radio', |
| 676 | 'default' => '', |
| 677 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_caption_title_choices', array( |
| 678 | '' => __( 'Same As Thumbnail', 'foogallery' ), |
| 679 | 'title' => __( 'Attachment Title', 'foogallery' ), |
| 680 | 'caption' => __( 'Attachment Caption', 'foogallery' ), |
| 681 | 'alt' => __( 'Attachment Alt', 'foogallery' ), |
| 682 | 'desc' => __( 'Attachment Description', 'foogallery' ), |
| 683 | 'none' => __( 'None', 'foogallery' ), |
| 684 | ) ), |
| 685 | 'row_data'=> array( |
| 686 | 'data-foogallery-hidden' => true, |
| 687 | 'data-foogallery-show-when-field' => 'lightbox_caption_override', |
| 688 | 'data-foogallery-show-when-field-operator' => '===', |
| 689 | 'data-foogallery-show-when-field-value' => 'override', |
| 690 | 'data-foogallery-change-selector' => 'input:radio', |
| 691 | 'data-foogallery-preview' => 'shortcode', |
| 692 | 'data-foogallery-value-selector' => 'input:checked', |
| 693 | ) |
| 694 | ); |
| 695 | |
| 696 | $field[] = array( |
| 697 | 'id' => 'lightbox_auto_progress', |
| 698 | 'title' => __( 'Auto Progress', 'foogallery' ), |
| 699 | 'desc' => __( 'Auto progress to the next item after a specified time.', 'foogallery' ), |
| 700 | 'section' => $section, |
| 701 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 702 | 'type' => 'radio', |
| 703 | 'default' => 'no', |
| 704 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_auto_progress_choices', array( |
| 705 | 'yes' => __( 'Yes', 'foogallery' ), |
| 706 | 'no' => __( 'No', 'foogallery' ), |
| 707 | ) ), |
| 708 | 'row_data'=> array( |
| 709 | 'data-foogallery-change-selector' => 'input:radio', |
| 710 | 'data-foogallery-preview' => 'shortcode', |
| 711 | 'data-foogallery-value-selector' => 'input:checked', |
| 712 | 'data-foogallery-hidden' => true, |
| 713 | 'data-foogallery-show-when-field' => 'lightbox', |
| 714 | 'data-foogallery-show-when-field-operator' => '===', |
| 715 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 716 | ) |
| 717 | ); |
| 718 | |
| 719 | $field[] = array( |
| 720 | 'id' => 'lightbox_auto_progress_seconds', |
| 721 | 'title' => __( 'Auto Progress Seconds', 'foogallery' ), |
| 722 | 'desc' => __( 'The time in seconds to display content before auto progressing to the next item.', 'foogallery' ), |
| 723 | 'section' => $section, |
| 724 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 725 | 'type' => 'number', |
| 726 | 'default' => '10', |
| 727 | 'row_data'=> array( |
| 728 | 'data-foogallery-hidden' => true, |
| 729 | 'data-foogallery-show-when-field' => 'lightbox_auto_progress', |
| 730 | 'data-foogallery-show-when-field-operator' => '===', |
| 731 | 'data-foogallery-show-when-field-value' => 'yes', |
| 732 | 'data-foogallery-change-selector' => 'input:radio', |
| 733 | 'data-foogallery-preview' => 'shortcode', |
| 734 | 'data-foogallery-value-selector' => 'input:checked', |
| 735 | ) |
| 736 | ); |
| 737 | |
| 738 | $field[] = array( |
| 739 | 'id' => 'lightbox_auto_progress_start', |
| 740 | 'title' => __( 'Auto Progress Start', 'foogallery' ), |
| 741 | 'desc' => __( 'If the auto-progress will automatically start or not.', 'foogallery' ), |
| 742 | 'section' => $section, |
| 743 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 744 | 'type' => 'radio', |
| 745 | 'choices' => array( |
| 746 | 'yes' => __( 'Yes', 'foogallery' ), |
| 747 | 'no' => __( 'No', 'foogallery' ), |
| 748 | ), |
| 749 | 'default' => 'yes', |
| 750 | 'row_data'=> array( |
| 751 | 'data-foogallery-hidden' => true, |
| 752 | 'data-foogallery-show-when-field' => 'lightbox_auto_progress', |
| 753 | 'data-foogallery-show-when-field-operator' => '===', |
| 754 | 'data-foogallery-show-when-field-value' => 'yes', |
| 755 | 'data-foogallery-change-selector' => 'input:radio', |
| 756 | 'data-foogallery-preview' => 'shortcode', |
| 757 | 'data-foogallery-value-selector' => 'input:checked', |
| 758 | ) |
| 759 | ); |
| 760 | |
| 761 | $field[] = array( |
| 762 | 'id' => 'lightbox_auto_progress_button', |
| 763 | 'title' => __( 'Auto Progress Button', 'foogallery' ), |
| 764 | 'desc' => __( 'Show or hide the auto progress control button. Hiding the button does not stop auto progress.', 'foogallery' ), |
| 765 | 'section' => $section, |
| 766 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 767 | 'type' => 'radio', |
| 768 | 'choices' => array( |
| 769 | 'yes' => __( 'Shown', 'foogallery' ), |
| 770 | 'no' => __( 'Hidden', 'foogallery' ), |
| 771 | ), |
| 772 | 'default' => 'yes', |
| 773 | 'row_data'=> array( |
| 774 | 'data-foogallery-hidden' => true, |
| 775 | 'data-foogallery-show-when-field' => 'lightbox_auto_progress', |
| 776 | 'data-foogallery-show-when-field-operator' => '===', |
| 777 | 'data-foogallery-show-when-field-value' => 'yes', |
| 778 | 'data-foogallery-change-selector' => 'input:radio', |
| 779 | 'data-foogallery-preview' => 'shortcode', |
| 780 | 'data-foogallery-value-selector' => 'input:checked', |
| 781 | ) |
| 782 | ); |
| 783 | |
| 784 | $field[] = array( |
| 785 | 'id' => 'lightbox_fit_media', |
| 786 | 'title' => __( 'Fit Media', 'foogallery' ), |
| 787 | 'desc' => __( 'Whether or not to force images to fill the content area. Aspect ratios are maintained, the image is simply scaled so it covers the entire available area.', 'foogallery' ), |
| 788 | 'section' => $section, |
| 789 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 790 | 'type' => 'radio', |
| 791 | 'default' => 'no', |
| 792 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_fit_media_choices', array( |
| 793 | 'yes' => __( 'Yes', 'foogallery' ), |
| 794 | 'no' => __( 'No', 'foogallery' ), |
| 795 | ) ), |
| 796 | 'row_data'=> array( |
| 797 | 'data-foogallery-change-selector' => 'input:radio', |
| 798 | 'data-foogallery-preview' => 'shortcode', |
| 799 | 'data-foogallery-value-selector' => 'input:checked', |
| 800 | 'data-foogallery-hidden' => true, |
| 801 | 'data-foogallery-show-when-field' => 'lightbox', |
| 802 | 'data-foogallery-show-when-field-operator' => '===', |
| 803 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 804 | ) |
| 805 | ); |
| 806 | |
| 807 | $field[] = array( |
| 808 | 'id' => 'lightbox_no_scrollbars', |
| 809 | 'title' => __( 'Scroll Bars', 'foogallery' ), |
| 810 | 'desc' => __( 'Whether or not to hide the page scrollbars when maximizing.', 'foogallery' ), |
| 811 | 'section' => $section, |
| 812 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 813 | 'type' => 'radio', |
| 814 | 'default' => 'no', |
| 815 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_no_scrollbars_choices', array( |
| 816 | 'yes' => __( 'Default', 'foogallery' ), |
| 817 | 'no' => __( 'Hidden', 'foogallery' ), |
| 818 | ) ), |
| 819 | 'row_data'=> array( |
| 820 | 'data-foogallery-change-selector' => 'input:radio', |
| 821 | 'data-foogallery-preview' => 'shortcode', |
| 822 | 'data-foogallery-value-selector' => 'input:checked', |
| 823 | 'data-foogallery-hidden' => true, |
| 824 | 'data-foogallery-show-when-field' => 'lightbox', |
| 825 | 'data-foogallery-show-when-field-operator' => '===', |
| 826 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 827 | ) |
| 828 | ); |
| 829 | |
| 830 | $field[] = array( |
| 831 | 'id' => 'lightbox_mobile_layout', |
| 832 | 'title' => __( 'Mobile Layout', 'foogallery' ), |
| 833 | 'desc' => __( 'Which layout to use for the lightbox when on mobile.', 'foogallery' ), |
| 834 | 'section' => $section, |
| 835 | 'subsection' => array( 'lightbox-general' => __( 'General', 'foogallery' ) ), |
| 836 | 'type' => 'radio', |
| 837 | 'class' => 'foogallery-radios-stacked', |
| 838 | 'default' => '', |
| 839 | 'choices' => array( |
| 840 | '' => __( 'Mobile Optimized Layout', 'foogallery' ), |
| 841 | 'no' => __( 'Same As Desktop', 'foogallery' ), |
| 842 | ), |
| 843 | 'row_data'=> array( |
| 844 | 'data-foogallery-change-selector' => 'input:radio', |
| 845 | 'data-foogallery-preview' => 'shortcode', |
| 846 | 'data-foogallery-value-selector' => 'input:checked', |
| 847 | 'data-foogallery-hidden' => true, |
| 848 | 'data-foogallery-show-when-field' => 'lightbox', |
| 849 | 'data-foogallery-show-when-field-operator' => '===', |
| 850 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 851 | ) |
| 852 | ); |
| 853 | |
| 854 | $field[] = array( |
| 855 | 'id' => 'lightbox_buttons_display', |
| 856 | 'title' => __( 'Controls Display', 'foogallery' ), |
| 857 | 'desc' => __( 'Whether or not the control buttons are overlaid on top of the content, or are inline (outside of the content).', 'foogallery' ), |
| 858 | 'section' => $section, |
| 859 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 860 | 'type' => 'radio', |
| 861 | 'default' => 'no', |
| 862 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_buttons_display', array( |
| 863 | 'yes' => __( 'Overlay', 'foogallery' ), |
| 864 | 'no' => __( 'Inline', 'foogallery' ), |
| 865 | ) ), |
| 866 | 'row_data'=> array( |
| 867 | 'data-foogallery-change-selector' => 'input:radio', |
| 868 | 'data-foogallery-preview' => 'shortcode', |
| 869 | 'data-foogallery-value-selector' => 'input:checked', |
| 870 | 'data-foogallery-hidden' => true, |
| 871 | 'data-foogallery-show-when-field' => 'lightbox', |
| 872 | 'data-foogallery-show-when-field-operator' => '===', |
| 873 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 874 | ) |
| 875 | ); |
| 876 | |
| 877 | $field[] = array( |
| 878 | 'id' => 'lightbox_hover_buttons', |
| 879 | 'title' => __( 'Show Controls On Hover', 'foogallery' ), |
| 880 | 'desc' => __( 'Only show the control buttons when you hover the mouse over.', 'foogallery' ), |
| 881 | 'section' => $section, |
| 882 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 883 | 'type' => 'radio', |
| 884 | 'default' => 'no', |
| 885 | 'choices' => apply_filters( 'foogallery_gallery_template_lightbox_hover_buttons_choices', array( |
| 886 | 'yes' => __( 'Yes', 'foogallery' ), |
| 887 | 'no' => __( 'No', 'foogallery' ), |
| 888 | ) ), |
| 889 | 'row_data'=> array( |
| 890 | 'data-foogallery-change-selector' => 'input:radio', |
| 891 | 'data-foogallery-preview' => 'shortcode', |
| 892 | 'data-foogallery-value-selector' => 'input:checked', |
| 893 | 'data-foogallery-hidden' => true, |
| 894 | 'data-foogallery-show-when-field' => 'lightbox', |
| 895 | 'data-foogallery-show-when-field-operator' => '===', |
| 896 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 897 | ) |
| 898 | ); |
| 899 | |
| 900 | //Only show this setting for gallery templates that use the lightbox |
| 901 | $field[] = array( |
| 902 | 'id' => 'lightbox_show_fullscreen_button', |
| 903 | 'title' => __( 'Fullscreen Button', 'foogallery' ), |
| 904 | 'desc' => __( 'Whether of not to show the Fullscreen button', 'foogallery' ), |
| 905 | 'section' => $section, |
| 906 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 907 | 'type' => 'radio', |
| 908 | 'default' => $use_lightbox ? 'yes' : 'no', |
| 909 | 'choices' => array( |
| 910 | 'yes' => __( 'Shown', 'foogallery' ), |
| 911 | 'no' => __( 'Hidden', 'foogallery' ), |
| 912 | ), |
| 913 | 'row_data' => array( |
| 914 | 'data-foogallery-change-selector' => 'input:radio', |
| 915 | 'data-foogallery-preview' => 'shortcode', |
| 916 | 'data-foogallery-value-selector' => 'input:checked', |
| 917 | 'data-foogallery-hidden' => true, |
| 918 | 'data-foogallery-show-when-field' => 'lightbox', |
| 919 | 'data-foogallery-show-when-field-operator' => '===', |
| 920 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 921 | ) |
| 922 | ); |
| 923 | |
| 924 | //add this setting for gallery templates that use the panel, not lightbox |
| 925 | if ( !$use_lightbox ) { |
| 926 | $field[] = array( |
| 927 | 'id' => 'lightbox_show_maximize_button', |
| 928 | 'title' => __( 'Maximise Button', 'foogallery' ), |
| 929 | 'desc' => __( 'Whether of not to show the Maximise button', 'foogallery' ), |
| 930 | 'section' => $section, |
| 931 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 932 | 'type' => 'radio', |
| 933 | 'default' => 'yes', |
| 934 | 'choices' => array( |
| 935 | 'yes' => __( 'Shown', 'foogallery' ), |
| 936 | 'no' => __( 'Hidden', 'foogallery' ), |
| 937 | ), |
| 938 | 'row_data' => array( |
| 939 | 'data-foogallery-change-selector' => 'input:radio', |
| 940 | 'data-foogallery-preview' => 'shortcode', |
| 941 | 'data-foogallery-value-selector' => 'input:checked', |
| 942 | 'data-foogallery-hidden' => true, |
| 943 | 'data-foogallery-show-when-field' => 'lightbox', |
| 944 | 'data-foogallery-show-when-field-operator' => '===', |
| 945 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 946 | ) |
| 947 | ); |
| 948 | } |
| 949 | |
| 950 | $field[] = array( |
| 951 | 'id' => 'lightbox_show_caption_button', |
| 952 | 'title' => __( 'Caption Button', 'foogallery' ), |
| 953 | 'desc' => __( 'Whether of not to show the Caption button', 'foogallery' ), |
| 954 | 'section' => $section, |
| 955 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 956 | 'type' => 'radio', |
| 957 | 'default' => 'yes', |
| 958 | 'choices' => array( |
| 959 | 'yes' => __( 'Shown', 'foogallery' ), |
| 960 | 'no' => __( 'Hidden', 'foogallery' ), |
| 961 | ), |
| 962 | 'row_data' => array( |
| 963 | 'data-foogallery-change-selector' => 'input:radio', |
| 964 | 'data-foogallery-preview' => 'shortcode', |
| 965 | 'data-foogallery-value-selector' => 'input:checked', |
| 966 | 'data-foogallery-hidden' => true, |
| 967 | 'data-foogallery-show-when-field' => 'lightbox', |
| 968 | 'data-foogallery-show-when-field-operator' => '===', |
| 969 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 970 | ) |
| 971 | ); |
| 972 | |
| 973 | $field[] = array( |
| 974 | 'id' => 'lightbox_show_thumbstrip_button', |
| 975 | 'title' => __( 'Thumbnail Strip Button', 'foogallery' ), |
| 976 | 'desc' => __( 'Whether of not to show the thumbnail strip control button', 'foogallery' ), |
| 977 | 'section' => $section, |
| 978 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 979 | 'type' => 'radio', |
| 980 | 'default' => 'no', |
| 981 | 'choices' => array( |
| 982 | 'yes' => __( 'Shown', 'foogallery' ), |
| 983 | 'no' => __( 'Hidden', 'foogallery' ), |
| 984 | ), |
| 985 | 'row_data' => array( |
| 986 | 'data-foogallery-change-selector' => 'input:radio', |
| 987 | 'data-foogallery-preview' => 'shortcode', |
| 988 | 'data-foogallery-value-selector' => 'input:checked', |
| 989 | 'data-foogallery-hidden' => true, |
| 990 | 'data-foogallery-show-when-field' => 'lightbox', |
| 991 | 'data-foogallery-show-when-field-operator' => '===', |
| 992 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 993 | ) |
| 994 | ); |
| 995 | |
| 996 | $field[] = array( |
| 997 | 'id' => 'lightbox_show_download_button', |
| 998 | 'title' => __( 'Download Button', 'foogallery' ), |
| 999 | 'desc' => __( 'Whether of not to show the download button', 'foogallery' ), |
| 1000 | 'section' => $section, |
| 1001 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 1002 | 'type' => 'radio', |
| 1003 | 'default' => 'no', |
| 1004 | 'choices' => array( |
| 1005 | 'yes' => __( 'Shown', 'foogallery' ), |
| 1006 | 'no' => __( 'Hidden', 'foogallery' ), |
| 1007 | ), |
| 1008 | 'row_data' => array( |
| 1009 | 'data-foogallery-change-selector' => 'input:radio', |
| 1010 | 'data-foogallery-preview' => 'shortcode', |
| 1011 | 'data-foogallery-value-selector' => 'input:checked', |
| 1012 | 'data-foogallery-hidden' => true, |
| 1013 | 'data-foogallery-show-when-field' => 'lightbox', |
| 1014 | 'data-foogallery-show-when-field-operator' => '===', |
| 1015 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 1016 | ) |
| 1017 | ); |
| 1018 | |
| 1019 | $field[] = array( |
| 1020 | 'id' => 'lightbox_show_nav_buttons', |
| 1021 | 'title' => __( 'Prev/Next Buttons', 'foogallery' ), |
| 1022 | 'desc' => __( 'Whether of not to show the navigation (prev/next) buttons', 'foogallery' ), |
| 1023 | 'section' => $section, |
| 1024 | 'subsection' => array( 'lightbox-controls' => __( 'Controls', 'foogallery' ) ), |
| 1025 | 'type' => 'radio', |
| 1026 | 'default' => 'yes', |
| 1027 | 'choices' => array( |
| 1028 | 'yes' => __( 'Shown', 'foogallery' ), |
| 1029 | 'no' => __( 'Hidden', 'foogallery' ), |
| 1030 | ), |
| 1031 | 'row_data' => array( |
| 1032 | 'data-foogallery-change-selector' => 'input:radio', |
| 1033 | 'data-foogallery-preview' => 'shortcode', |
| 1034 | 'data-foogallery-value-selector' => 'input:checked', |
| 1035 | 'data-foogallery-hidden' => true, |
| 1036 | 'data-foogallery-show-when-field' => 'lightbox', |
| 1037 | 'data-foogallery-show-when-field-operator' => '===', |
| 1038 | 'data-foogallery-show-when-field-value' => 'foogallery', |
| 1039 | ) |
| 1040 | ); |
| 1041 | |
| 1042 | //find the index of the first Hover Effect field |
| 1043 | $index = foogallery_admin_fields_find_index_of_section( $fields, __( 'Hover Effects', 'foogallery' ) ); |
| 1044 | |
| 1045 | array_splice( $fields, $index, 0, $field ); |
| 1046 | |
| 1047 | return $fields; |
| 1048 | } |
| 1049 | |
| 1050 | /** |
| 1051 | * Add the required data options if needed |
| 1052 | * |
| 1053 | * @param $options |
| 1054 | * @param $gallery FooGallery |
| 1055 | * |
| 1056 | * @param $attributes array |
| 1057 | * |
| 1058 | * @return array |
| 1059 | */ |
| 1060 | function add_data_options($options, $gallery, $attributes) { |
| 1061 | $template = foogallery_get_gallery_template( $gallery->gallery_template ); |
| 1062 | if ( $template && array_key_exists( 'panel_support', $template ) && true === $template['panel_support'] ) { |
| 1063 | |
| 1064 | $options['template'] = $this->get_options_from_settings(); |
| 1065 | |
| 1066 | } |
| 1067 | |
| 1068 | $show_download_button = foogallery_gallery_template_setting( 'lightbox_show_download_button', false ); |
| 1069 | if ( false !== $show_download_button ) { |
| 1070 | $options['panel']['buttons']['download'] = ( 'yes' === $show_download_button ); |
| 1071 | } |
| 1072 | |
| 1073 | return $options; |
| 1074 | } |
| 1075 | |
| 1076 | /** |
| 1077 | * Returns the Dashicon that can be used in the settings tabs |
| 1078 | * |
| 1079 | * @param $section_slug |
| 1080 | * |
| 1081 | * @return string |
| 1082 | */ |
| 1083 | function add_section_icons( $section_slug ) { |
| 1084 | if ( 'lightbox' === $section_slug || 'panel' === $section_slug ) { |
| 1085 | return 'dashicons-grid-view'; |
| 1086 | } |
| 1087 | |
| 1088 | return $section_slug; |
| 1089 | } |
| 1090 | |
| 1091 | /** |
| 1092 | * Add the FooGallery Lightbox |
| 1093 | * @param $lightboxes |
| 1094 | * |
| 1095 | * @return mixed |
| 1096 | */ |
| 1097 | function add_lightbox($lightboxes) { |
| 1098 | $lightboxes['foogallery'] = foogallery_lightbox_name(); |
| 1099 | return $lightboxes; |
| 1100 | } |
| 1101 | |
| 1102 | /** |
| 1103 | * Change the default for lightbox |
| 1104 | * |
| 1105 | * @param $field |
| 1106 | * @param $gallery_template |
| 1107 | * @return mixed |
| 1108 | */ |
| 1109 | function make_foogallery_default_lightbox( $field, $gallery_template ) { |
| 1110 | if (isset($field['lightbox']) && true === $field['lightbox']) { |
| 1111 | $field['default'] = 'foogallery'; |
| 1112 | } |
| 1113 | |
| 1114 | return $field; |
| 1115 | } |
| 1116 | |
| 1117 | /** |
| 1118 | * Append the needed data attributes to the container div for the lightbox settings |
| 1119 | * |
| 1120 | * @param $attributes |
| 1121 | * @param $gallery |
| 1122 | * |
| 1123 | * @return array |
| 1124 | */ |
| 1125 | function add_lightbox_data_attributes( $attributes, $gallery ) { |
| 1126 | $template = foogallery_get_gallery_template( $gallery->gallery_template ); |
| 1127 | |
| 1128 | //only add the lightbox data attribute for the templates where a panel is used and not a lightbox |
| 1129 | if ( $template && !array_key_exists( 'panel_support', $template ) ) { |
| 1130 | |
| 1131 | $thumbnail_link = foogallery_gallery_template_setting( 'thumbnail_link', '' ); |
| 1132 | |
| 1133 | //check if lightbox set to foogallery |
| 1134 | if ( 'foogallery' === foogallery_gallery_template_setting_lightbox() && 'none' !== $thumbnail_link ) { |
| 1135 | |
| 1136 | $encoded_options = foogallery_json_encode( $this->get_options_from_settings() ); |
| 1137 | |
| 1138 | $attributes['data-foogallery-lightbox'] = $encoded_options; |
| 1139 | } |
| 1140 | } |
| 1141 | |
| 1142 | return $attributes; |
| 1143 | } |
| 1144 | |
| 1145 | /** |
| 1146 | * return the options for the lightbox/panel |
| 1147 | * |
| 1148 | * @return array |
| 1149 | */ |
| 1150 | private function get_options_from_settings() { |
| 1151 | global $current_foogallery_template; |
| 1152 | $options = array(); |
| 1153 | |
| 1154 | $hide_thumbs_by_default = false; |
| 1155 | //only hide the thumbs by default if we are using the Grid PRO template |
| 1156 | if ( $current_foogallery_template && 'foogridpro' === $current_foogallery_template ) { |
| 1157 | $hide_thumbs_by_default = true; |
| 1158 | } |
| 1159 | |
| 1160 | $theme = foogallery_gallery_template_setting( 'lightbox_theme', '' ); |
| 1161 | if ( !empty( $theme ) ) { |
| 1162 | $options['theme'] = $theme; |
| 1163 | } |
| 1164 | |
| 1165 | $button_theme = foogallery_gallery_template_setting( 'lightbox_button_theme', '' ); |
| 1166 | if ( !empty( $button_theme ) && 'custom' === $button_theme ) { |
| 1167 | $button_theme = foogallery_gallery_template_setting( 'lightbox_custom_button_theme', 'fg-button-light' ); |
| 1168 | $options['button'] = $button_theme; |
| 1169 | } |
| 1170 | |
| 1171 | $button_highlight = foogallery_gallery_template_setting( 'lightbox_button_highlight', '' ); |
| 1172 | if ( !empty( $button_highlight ) && 'custom' === $button_highlight ) { |
| 1173 | $button_highlight = foogallery_gallery_template_setting( 'lightbox_custom_button_highlight', 'fg-highlight-light' ); |
| 1174 | $options['highlight'] = $button_highlight; |
| 1175 | } |
| 1176 | |
| 1177 | $thumbs = foogallery_gallery_template_setting( 'lightbox_thumbs', $hide_thumbs_by_default ? 'none' : 'bottom' ); |
| 1178 | $options['thumbs'] = $thumbs; |
| 1179 | if ( 'none' !== $thumbs ) { |
| 1180 | $options['thumbsCaptions'] = foogallery_gallery_template_setting( 'lightbox_thumbs_captions', 'no' ) === 'yes'; |
| 1181 | $options['thumbsBestFit'] = foogallery_gallery_template_setting( 'lightbox_thumbs_bestfit', '' ) === 'yes'; |
| 1182 | $options['thumbsSmall'] = foogallery_gallery_template_setting( 'lightbox_thumbs_size', '' ) === 'small'; |
| 1183 | $options['thumbsCaptionsAlign'] = foogallery_gallery_template_setting( 'lightbox_thumbs_captions_alignment', 'default' ); |
| 1184 | } |
| 1185 | |
| 1186 | $info_enabled = foogallery_gallery_template_setting( 'lightbox_info_enabled', '' ); |
| 1187 | $info_position = foogallery_gallery_template_setting( 'lightbox_info_position', 'bottom' ); |
| 1188 | |
| 1189 | //check for legacy lightbox_info_position of 'none' or new lightbox_info_enabled setting |
| 1190 | if ( 'none' === $info_position || 'disabled' === $info_enabled ) { |
| 1191 | $options['info'] = false; |
| 1192 | } else { |
| 1193 | $options['info'] = $info_position; |
| 1194 | $options['infoVisible'] = 'hidden' !== $info_enabled; |
| 1195 | $options['infoOverlay'] = foogallery_gallery_template_setting( 'lightbox_info_overlay', 'yes' ) === 'yes'; |
| 1196 | } |
| 1197 | |
| 1198 | $options['infoAlign'] = foogallery_gallery_template_setting( 'lightbox_info_alignment', 'default' ); |
| 1199 | |
| 1200 | // Handle mobile caption auto-hide setting |
| 1201 | $mobile_autohide = foogallery_gallery_template_setting( 'lightbox_info_autohide_mobile', 'yes' ); |
| 1202 | if ( 'no' === $mobile_autohide ) { |
| 1203 | $options['infoAutoHide'] = false; |
| 1204 | } |
| 1205 | |
| 1206 | $options['transition'] = foogallery_gallery_template_setting( 'lightbox_transition', 'fade' ); |
| 1207 | |
| 1208 | $auto_progress = foogallery_gallery_template_setting( 'lightbox_auto_progress', 'no' ) === 'yes'; |
| 1209 | if ( $auto_progress ) { |
| 1210 | $options['autoProgress'] = intval( foogallery_gallery_template_setting( 'lightbox_auto_progress_seconds', '10' ) ); |
| 1211 | $options['autoProgressStart'] = foogallery_gallery_template_setting( 'lightbox_auto_progress_start', 'yes' ) === 'yes'; |
| 1212 | $options['autoProgressVisible'] = foogallery_gallery_template_setting( 'lightbox_auto_progress_button', 'yes' ) === 'yes'; |
| 1213 | } |
| 1214 | |
| 1215 | $options['hoverButtons'] = foogallery_gallery_template_setting( 'lightbox_hover_buttons', 'no' ) === 'yes'; |
| 1216 | $options['fitMedia'] = foogallery_gallery_template_setting( 'lightbox_fit_media', 'no' ) === 'yes'; |
| 1217 | $options['noScrollbars'] = foogallery_gallery_template_setting( 'lightbox_no_scrollbars', 'no' ) !== 'yes'; |
| 1218 | $options['preserveButtonSpace'] = foogallery_gallery_template_setting( 'lightbox_buttons_display', 'no' ) === 'no'; |
| 1219 | |
| 1220 | $no_mobile = foogallery_gallery_template_setting( 'lightbox_mobile_layout', '' ); |
| 1221 | if ( $no_mobile !== '' ) { |
| 1222 | $options['noMobile'] = true; |
| 1223 | } |
| 1224 | |
| 1225 | $show_fullscreen_button = foogallery_gallery_template_setting( 'lightbox_show_fullscreen_button', false ); |
| 1226 | if ( $show_fullscreen_button !== false ) { |
| 1227 | $options['buttons']['fullscreen'] = ($show_fullscreen_button === 'yes'); |
| 1228 | } |
| 1229 | |
| 1230 | $show_maximise_button = foogallery_gallery_template_setting( 'lightbox_show_maximize_button', false ); |
| 1231 | if ( $show_maximise_button !== false ) { |
| 1232 | $options['buttons']['maximize'] = ($show_maximise_button === 'yes'); |
| 1233 | } |
| 1234 | |
| 1235 | $show_caption_button = foogallery_gallery_template_setting( 'lightbox_show_caption_button', false ); |
| 1236 | if ( $show_caption_button !== false ) { |
| 1237 | $options['buttons']['info'] = ($show_caption_button === 'yes'); |
| 1238 | } |
| 1239 | |
| 1240 | $show_thumbstrip_button = foogallery_gallery_template_setting( 'lightbox_show_thumbstrip_button', false ); |
| 1241 | if ( $show_thumbstrip_button !== false ) { |
| 1242 | $options['buttons']['thumbs'] = ($show_thumbstrip_button === 'yes'); |
| 1243 | } |
| 1244 | |
| 1245 | $show_download_button = foogallery_gallery_template_setting( 'lightbox_show_download_button', false ); |
| 1246 | if ( $show_download_button !== false ) { |
| 1247 | $options['buttons']['download'] = ( $show_download_button === 'yes' ); |
| 1248 | } |
| 1249 | |
| 1250 | $show_nav_buttons = foogallery_gallery_template_setting( 'lightbox_show_nav_buttons', 'yes' ); |
| 1251 | if ( $show_nav_buttons !== 'yes' ) { |
| 1252 | $options['buttons']['prev'] = $options['buttons']['next'] = false; |
| 1253 | } |
| 1254 | |
| 1255 | $autoplay = foogallery_gallery_template_setting( 'video_autoplay', 'yes' ); |
| 1256 | if ( 'yes' === $autoplay ) { |
| 1257 | $options['video']['autoPlay'] = true; |
| 1258 | } |
| 1259 | |
| 1260 | return apply_filters( 'foogallery_lightbox_data_attributes', $options ); |
| 1261 | } |
| 1262 | |
| 1263 | /** |
| 1264 | * Override the lightbox field for albums only |
| 1265 | * |
| 1266 | * @param $field |
| 1267 | * @param $object |
| 1268 | */ |
| 1269 | function alter_gallery_template_field( $field, $object ) { |
| 1270 | if ( is_a( $object, 'FooGalleryAlbum' ) ) { |
| 1271 | if ( array_key_exists( 'lightbox', $field ) ) { |
| 1272 | unset( $field['choices']['foogallery'] ); |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | return $field; |
| 1277 | } |
| 1278 | } |
| 1279 | } |
| 1280 |