abilities
4 weeks ago
admin
4 weeks ago
compatibility
4 weeks ago
extensions
4 weeks ago
foopluginbase
4 weeks ago
public
4 weeks ago
thumbs
4 weeks ago
asset-manifest.php
4 weeks ago
class-attachment-filters.php
4 weeks ago
class-command-palette.php
4 weeks ago
class-foogallery-animated-gif-support.php
4 weeks ago
class-foogallery-attachment-custom-class.php
4 weeks ago
class-foogallery-attachment-filename.php
4 weeks ago
class-foogallery-attachment-type.php
4 weeks ago
class-foogallery-attachment.php
4 weeks ago
class-foogallery-cache.php
4 weeks ago
class-foogallery-common-fields.php
4 weeks ago
class-foogallery-crop-position.php
4 weeks ago
class-foogallery-datasource-media_library.php
4 weeks ago
class-foogallery-debug.php
4 weeks ago
class-foogallery-delayed-runtime-loader.php
4 weeks ago
class-foogallery-extensions-compatibility.php
4 weeks ago
class-foogallery-force-https.php
4 weeks ago
class-foogallery-lazyload.php
4 weeks ago
class-foogallery-license-constant-handler.php
4 weeks ago
class-foogallery-lightbox.php
4 weeks ago
class-foogallery-paging.php
4 weeks ago
class-foogallery-password-protect.php
4 weeks ago
class-foogallery-sitemaps.php
4 weeks ago
class-foogallery-widget.php
4 weeks ago
class-foogallery.php
4 weeks ago
class-gallery-advanced-settings.php
4 weeks ago
class-il8n.php
4 weeks ago
class-override-thumbnail.php
4 weeks ago
class-posttypes.php
4 weeks ago
class-previews.php
4 weeks ago
class-retina.php
4 weeks ago
class-thumbnail-dimensions.php
4 weeks ago
class-thumbnails.php
4 weeks ago
class-version-check.php
4 weeks ago
constants.php
4 weeks ago
functions.php
4 weeks ago
gallery-management-functions.php
4 weeks ago
includes.php
4 weeks ago
index.php
4 weeks ago
render-functions.php
4 weeks ago
class-foogallery-common-fields.php
984 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * Adds all functionality related to the common gallery fields that are used in the default gallery templates |
| 9 | * Date: 12/09/2017 |
| 10 | */ |
| 11 | if ( ! class_exists( 'FooGallery_Common_Fields' ) ) { |
| 12 | |
| 13 | class FooGallery_Common_Fields { |
| 14 | |
| 15 | function __construct() { |
| 16 | //handle some default field types that all templates can reuse |
| 17 | add_filter( 'foogallery_alter_gallery_template_field', array( $this, 'alter_gallery_template_field' ), 10, 2 ); |
| 18 | |
| 19 | //build up class attributes |
| 20 | add_filter( 'foogallery_build_class_attribute', array( $this, 'add_common_fields_class_attributes' ), 10, 2 ); |
| 21 | |
| 22 | //add our common field data attribute |
| 23 | add_filter( 'foogallery_build_container_attributes', array( $this, 'add_common_fields_data_attribute' ), 10, 2 ); |
| 24 | |
| 25 | //add common data options |
| 26 | add_filter( 'foogallery_build_container_data_options', array( $this, 'add_caption_data_options' ), 10, 3 ); |
| 27 | |
| 28 | add_filter( 'foogallery_build_container_attributes', array( $this, 'add_common_fields_attributes' ), 10, 2 ); |
| 29 | |
| 30 | //add common fields to the templates that support it |
| 31 | add_filter( 'foogallery_override_gallery_template_fields', array( $this, 'add_common_fields' ), 10, 2 ); |
| 32 | |
| 33 | //check that we are no longer on pro and have previously used a preset or a loaded effect |
| 34 | add_filter( 'foogallery_render_gallery_template_field_value', array( $this, 'check_downgrade_values' ), 10, 4 ); |
| 35 | |
| 36 | //override settings for older versions |
| 37 | add_filter( 'foogallery_settings_override', array( $this, 'override_settings_for_older_versions' ), 10, 3 ); |
| 38 | |
| 39 | // handle aliases for common fields |
| 40 | add_filter( 'foogallery_gallery_template_argument_alias', array( $this, 'handle_aliases' ), 10, 2 ); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Handle aliases for common fields. |
| 45 | * |
| 46 | * @param string $key The key of the field. |
| 47 | * @param string $template The template slug. |
| 48 | * @return string |
| 49 | */ |
| 50 | function handle_aliases( $key, $template ) { |
| 51 | if ( 'caption_invert_color' === $key ) { |
| 52 | return 'hover_effect_theme'; |
| 53 | } else if ( 'hover_effect_caption_visibility' === $key ) { |
| 54 | return 'caption_visibility'; |
| 55 | } else if ( 'thumbnail_dimensions' === $key ) { |
| 56 | return 'thumbnail_size'; |
| 57 | } |
| 58 | return $key; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Alter the gallery template field. |
| 63 | * |
| 64 | * @param array $field The field array. |
| 65 | * @param object $gallery The gallery object. |
| 66 | * @return array |
| 67 | */ |
| 68 | function alter_gallery_template_field( $field, $gallery ) { |
| 69 | if ( $field ) { |
| 70 | |
| 71 | if ( isset( $field['type'] ) ) { |
| 72 | switch ( $field['type'] ) { |
| 73 | case 'thumb_link': |
| 74 | $field['type'] = 'radio'; |
| 75 | $field['class'] = 'foogallery-radios-stacked'; |
| 76 | $field['choices'] = foogallery_gallery_template_field_thumb_link_choices(); |
| 77 | if ( ! array_key_exists( 'desc', $field ) ) { |
| 78 | $field['desc'] = __( 'You can choose to link each thumbnail to the full size image, the image\'s attachment page, the parent post it was uploaded to, a custom URL, or you can choose to not link to anything.', 'foogallery' ); |
| 79 | } |
| 80 | if ( !isset( $field['row_data'] ) ) { |
| 81 | $field['row_data'] = array( |
| 82 | 'data-foogallery-change-selector' => 'input:radio', |
| 83 | 'data-foogallery-value-selector' => 'input:checked', |
| 84 | 'data-foogallery-preview' => 'shortcode', |
| 85 | ); |
| 86 | } |
| 87 | break; |
| 88 | case 'lightbox': |
| 89 | $field['lightbox'] = true; |
| 90 | $field['title'] = __( 'Lightbox', 'foogallery' ); |
| 91 | $field['type'] = 'select'; |
| 92 | $field['choices'] = foogallery_gallery_template_field_lightbox_choices(); |
| 93 | if ( !array_key_exists( 'desc', $field ) ) { |
| 94 | $field['desc'] = __( 'Choose which lightbox you want to use. The lightbox will generally only work if you set the thumbnail link to "Full Size Image".', 'foogallery' ); |
| 95 | } |
| 96 | if ( !array_key_exists( 'section', $field ) ) { |
| 97 | $field['section'] = __( 'Lightbox', 'foogallery' ); |
| 98 | } |
| 99 | $field['subsection'] = array( 'lightbox-general' => __( 'General', 'foogallery' ) ); |
| 100 | $field['default'] = 'foogallery'; |
| 101 | |
| 102 | if ( !isset( $field['row_data'] ) ) { |
| 103 | $field['row_data'] = array( |
| 104 | 'data-foogallery-change-selector' => 'select', |
| 105 | 'data-foogallery-value-selector' => 'select', |
| 106 | 'data-foogallery-preview' => 'shortcode', |
| 107 | ); |
| 108 | } |
| 109 | break; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | if ( isset($field['help']) && $field['help'] ) { |
| 114 | $field['type'] = 'help'; |
| 115 | } |
| 116 | } |
| 117 | return $field; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Add common fields to the gallery template if supported |
| 122 | * |
| 123 | * @param $fields |
| 124 | * @param $template |
| 125 | * |
| 126 | * @return array |
| 127 | */ |
| 128 | function add_common_fields( $fields, $template ) { |
| 129 | //check if the template supports the common fields |
| 130 | if ( $template && array_key_exists( 'common_fields_support', $template ) && true === $template['common_fields_support'] ) { |
| 131 | |
| 132 | //region Appearance Fields |
| 133 | $fields[] = array( |
| 134 | 'id' => 'theme_custom_help', |
| 135 | 'desc' => __( 'If you choose to use the Custom theme, then you will need to provide your own Custom CSS in order to style the gallery to suit your needs.', 'foogallery' ), |
| 136 | 'section' => __( 'Appearance', 'foogallery' ), |
| 137 | 'type' => 'help', |
| 138 | 'row_data' => array( |
| 139 | 'data-foogallery-hidden' => true, |
| 140 | 'data-foogallery-show-when-field' => 'theme', |
| 141 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
| 142 | ) |
| 143 | ); |
| 144 | |
| 145 | $fields[] = array( |
| 146 | 'id' => 'theme', |
| 147 | 'title' => __( 'Theme', 'foogallery' ), |
| 148 | 'desc' => __( 'The overall appearance of the items in the gallery, affecting the border, background, font and shadow colors.', 'foogallery' ), |
| 149 | 'section' => __( 'Appearance', 'foogallery' ), |
| 150 | 'type' => 'radio', |
| 151 | 'default' => 'fg-light', |
| 152 | 'choices' => array( |
| 153 | 'fg-light' => __( 'Light', 'foogallery' ), |
| 154 | 'fg-dark' => __( 'Dark', 'foogallery' ), |
| 155 | 'fg-custom' => __( 'Custom', 'foogallery' ) |
| 156 | ), |
| 157 | 'row_data' => array( |
| 158 | 'data-foogallery-change-selector' => 'input:radio', |
| 159 | 'data-foogallery-value-selector' => 'input:checked', |
| 160 | 'data-foogallery-preview' => 'shortcode' |
| 161 | ) |
| 162 | ); |
| 163 | |
| 164 | $fields[] = array( |
| 165 | 'id' => 'border_size', |
| 166 | 'title' => __( 'Border Size', 'foogallery' ), |
| 167 | 'desc' => __( 'The border size applied to each thumbnail', 'foogallery' ), |
| 168 | 'section' => __( 'Appearance', 'foogallery' ), |
| 169 | 'type' => 'radio', |
| 170 | 'default' => 'fg-border-thin', |
| 171 | 'choices' => array( |
| 172 | '' => __( 'None', 'foogallery' ), |
| 173 | 'fg-border-thin' => __( 'Thin', 'foogallery' ), |
| 174 | 'fg-border-medium' => __( 'Medium', 'foogallery' ), |
| 175 | 'fg-border-thick' => __( 'Thick', 'foogallery' ), |
| 176 | ), |
| 177 | 'row_data' => array( |
| 178 | 'data-foogallery-change-selector' => 'input:radio', |
| 179 | 'data-foogallery-preview' => 'shortcode' |
| 180 | ) |
| 181 | ); |
| 182 | |
| 183 | $fields[] = array( |
| 184 | 'id' => 'rounded_corners', |
| 185 | 'title' => __( 'Rounded Corners', 'foogallery' ), |
| 186 | 'desc' => __( 'The border radius, or rounded corners applied to each thumbnail', 'foogallery' ), |
| 187 | 'section' => __( 'Appearance', 'foogallery' ), |
| 188 | 'type' => 'radio', |
| 189 | 'default' => '', |
| 190 | 'choices' => array( |
| 191 | '' => __( 'None', 'foogallery' ), |
| 192 | 'fg-round-small' => __( 'Small', 'foogallery' ), |
| 193 | 'fg-round-medium' => __( 'Medium', 'foogallery' ), |
| 194 | 'fg-round-large' => __( 'Large', 'foogallery' ), |
| 195 | 'fg-round-full' => __( 'Full', 'foogallery' ), |
| 196 | ), |
| 197 | 'row_data' => array( |
| 198 | 'data-foogallery-change-selector' => 'input:radio', |
| 199 | 'data-foogallery-preview' => 'shortcode' |
| 200 | ) |
| 201 | ); |
| 202 | |
| 203 | $fields[] = array( |
| 204 | 'id' => 'drop_shadow', |
| 205 | 'title' => __( 'Drop Shadow', 'foogallery' ), |
| 206 | 'desc' => __( 'The outer or drop shadow applied to each thumbnail', 'foogallery' ), |
| 207 | 'section' => __( 'Appearance', 'foogallery' ), |
| 208 | 'type' => 'radio', |
| 209 | 'default' => 'fg-shadow-outline', |
| 210 | 'choices' => array( |
| 211 | '' => __( 'None', 'foogallery' ), |
| 212 | 'fg-shadow-outline' => __( 'Outline', 'foogallery' ), |
| 213 | 'fg-shadow-small' => __( 'Small', 'foogallery' ), |
| 214 | 'fg-shadow-medium' => __( 'Medium', 'foogallery' ), |
| 215 | 'fg-shadow-large' => __( 'Large', 'foogallery' ), |
| 216 | ), |
| 217 | 'row_data' => array( |
| 218 | 'data-foogallery-change-selector' => 'input:radio', |
| 219 | 'data-foogallery-preview' => 'shortcode' |
| 220 | ) |
| 221 | ); |
| 222 | |
| 223 | $fields[] = array( |
| 224 | 'id' => 'inner_shadow', |
| 225 | 'title' => __( 'Inner Shadow', 'foogallery' ), |
| 226 | 'desc' => __( 'The inner shadow applied to each thumbnail', 'foogallery' ), |
| 227 | 'section' => __( 'Appearance', 'foogallery' ), |
| 228 | 'type' => 'radio', |
| 229 | 'default' => '', |
| 230 | 'choices' => array( |
| 231 | '' => __( 'None', 'foogallery' ), |
| 232 | 'fg-shadow-inset-outline' => __( 'Outline', 'foogallery' ), |
| 233 | 'fg-shadow-inset-small' => __( 'Small', 'foogallery' ), |
| 234 | 'fg-shadow-inset-medium' => __( 'Medium', 'foogallery' ), |
| 235 | 'fg-shadow-inset-large' => __( 'Large', 'foogallery' ), |
| 236 | ), |
| 237 | 'row_data' => array( |
| 238 | 'data-foogallery-change-selector' => 'input:radio', |
| 239 | 'data-foogallery-preview' => 'shortcode' |
| 240 | ) |
| 241 | ); |
| 242 | |
| 243 | $fields[] = array( |
| 244 | 'id' => 'loading_icon', |
| 245 | 'title' => __( 'Loading Icon', 'foogallery' ), |
| 246 | 'desc' => __( 'An animated loading icon can be shown while the thumbnails are busy loading.', 'foogallery' ), |
| 247 | 'section' => __( 'Appearance', 'foogallery' ), |
| 248 | 'default' => 'fg-loading-default', |
| 249 | 'type' => 'htmlicon', |
| 250 | 'choices' => apply_filters( |
| 251 | 'foogallery_gallery_template_common_thumbnail_fields_loading_icon_choices', array( |
| 252 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon"></div>' ), |
| 253 | 'fg-loading-default' => array( 'label' => __( 'Default', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon foogallery fg-loading-default"><div class="fg-loading"><div class="fg-loader"></div></div></div>' ), |
| 254 | 'fg-loading-bars' => array( 'label' => __( 'Bars', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon foogallery fg-loading-bars"><div class="fg-loading"><div class="fg-loader"></div></div></div>' ), |
| 255 | 'fg-loading-dots' => array( 'label' => __( 'Dots', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon foogallery fg-loading-dots"><div class="fg-loading"><div class="fg-loader"></div></div></div>' ), |
| 256 | 'fg-loading-partial' => array( 'label' => __( 'Partial', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon foogallery fg-loading-partial"><div class="fg-loading"><div class="fg-loader"></div></div></div>' ), |
| 257 | 'fg-loading-pulse' => array( 'label' => __( 'Pulse', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon foogallery fg-loading-pulse"><div class="fg-loading"><div class="fg-loader"></div></div></div>' ), |
| 258 | 'fg-loading-trail' => array( 'label' => __( 'Trail', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon foogallery fg-loading-trail"><div class="fg-loading"><div class="fg-loader"></div></div></div>' ), |
| 259 | ) |
| 260 | ), |
| 261 | 'row_data' => array( |
| 262 | 'data-foogallery-change-selector' => 'input:radio', |
| 263 | 'data-foogallery-value-selector' => 'input:checked', |
| 264 | 'data-foogallery-preview' => 'shortcode' |
| 265 | ) |
| 266 | ); |
| 267 | |
| 268 | $fields[] = array( |
| 269 | 'id' => 'loaded_effect', |
| 270 | 'title' => __( 'Loaded Effect', 'foogallery' ), |
| 271 | 'desc' => __( 'The animation effect used to display the thumbnail, once it has loaded.', 'foogallery' ), |
| 272 | 'section' => __( 'Appearance', 'foogallery' ), |
| 273 | 'default' => 'fg-loaded-fade-in', |
| 274 | 'type' => 'radio', |
| 275 | 'choices' => apply_filters( |
| 276 | 'foogallery_gallery_template_common_thumbnail_fields_loaded_effect_choices', array( |
| 277 | '' => __( 'None', 'foogallery' ), |
| 278 | 'fg-loaded-fade-in' => __( 'Fade In', 'foogallery' ), |
| 279 | 'fg-loaded-slide-up' => __( 'Slide Up', 'foogallery' ), |
| 280 | 'fg-loaded-slide-down' => __( 'Slide Down', 'foogallery' ), |
| 281 | 'fg-loaded-slide-left' => __( 'Slide Left', 'foogallery' ), |
| 282 | 'fg-loaded-slide-right' => __( 'Slide Right', 'foogallery' ), |
| 283 | 'fg-loaded-scale-up' => __( 'Scale Up', 'foogallery' ), |
| 284 | 'fg-loaded-swing-down' => __( 'Swing Down', 'foogallery' ), |
| 285 | 'fg-loaded-drop' => __( 'Drop', 'foogallery' ), |
| 286 | 'fg-loaded-fly' => __( 'Fly', 'foogallery' ), |
| 287 | 'fg-loaded-flip' => __( 'Flip', 'foogallery' ), |
| 288 | ) |
| 289 | ), |
| 290 | 'row_data' => array( |
| 291 | 'data-foogallery-change-selector' => 'input:radio', |
| 292 | 'data-foogallery-value-selector' => 'input:checked', |
| 293 | 'data-foogallery-preview' => 'shortcode' |
| 294 | ), |
| 295 | 'class' => 'foogallery-radios-12em', |
| 296 | ); |
| 297 | //endregion |
| 298 | |
| 299 | //region Hover Effects Fields |
| 300 | $fields[] = array( |
| 301 | 'id' => 'hover_effect_type', |
| 302 | 'title' => __( 'Hover Effect Type', 'foogallery' ), |
| 303 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 304 | 'default' => 'normal', |
| 305 | 'type' => 'radio', |
| 306 | 'choices' => apply_filters( |
| 307 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_type_choices', array( |
| 308 | 'none' => array( |
| 309 | 'label' => __( 'None', 'foogallery' ), |
| 310 | 'tooltip' => __( 'No hover effect will be shown.', 'foogallery' ) |
| 311 | ), |
| 312 | 'normal' => array( |
| 313 | 'label' => __( 'Normal (icons, captions, color, scaling & transitions)', 'foogallery' ), |
| 314 | 'tooltip' => __( 'The standard hover effects with icons, captions, color, scaling & transitions', 'foogallery' ) |
| 315 | ), |
| 316 | 'preset' =>array( |
| 317 | 'label' => __( 'Presets (stylish, pre-defined look & feel)', 'foogallery' ), |
| 318 | 'tooltip' => __( 'A preset provides a stylish, pre-defined look & feel for the effect when you hover over the thumbnails.', 'foogallery' ) |
| 319 | ) |
| 320 | ) |
| 321 | ), |
| 322 | 'desc' => __( 'What type of hover effect do you want to show for your thumbnails?', 'foogallery' ), |
| 323 | 'row_data' => array( |
| 324 | 'data-foogallery-change-selector' => 'input:radio', |
| 325 | 'data-foogallery-value-selector' => 'input:checked', |
| 326 | 'data-foogallery-preview' => 'shortcode' |
| 327 | ), |
| 328 | 'class' => 'foogallery-radios-stacked' |
| 329 | ); |
| 330 | |
| 331 | $fields[] = array( |
| 332 | 'id' => 'hover_effect_preset', |
| 333 | 'title' => __( 'Preset', 'foogallery' ), |
| 334 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 335 | 'default' => 'fg-preset fg-brad', |
| 336 | 'type' => 'radio', |
| 337 | 'choices' => apply_filters( |
| 338 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array( |
| 339 | 'fg-preset fg-brad' => __( 'Default', 'foogallery' ), |
| 340 | ) |
| 341 | ), |
| 342 | 'desc' => __( 'A preset styling that is used for the hover effect.', 'foogallery' ), |
| 343 | 'row_data' => array( |
| 344 | 'data-foogallery-change-selector' => 'input:radio', |
| 345 | 'data-foogallery-value-selector' => 'input:checked', |
| 346 | 'data-foogallery-preview' => 'shortcode', |
| 347 | 'data-foogallery-hidden' => true, |
| 348 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 349 | 'data-foogallery-show-when-field-value' => 'preset', |
| 350 | ), |
| 351 | 'class' => 'foogallery-radios-12em', |
| 352 | ); |
| 353 | |
| 354 | $fields[] = array( |
| 355 | 'id' => 'hover_effect_preset_size', |
| 356 | 'title' => __( 'Preset Size', 'foogallery' ), |
| 357 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 358 | 'default' => 'fg-preset-small', |
| 359 | 'type' => 'radio', |
| 360 | 'choices' => apply_filters( |
| 361 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_size_choices', array( |
| 362 | 'fg-preset-small' => __( 'Small', 'foogallery' ), |
| 363 | 'fg-preset-medium' => __( 'Medium', 'foogallery' ), |
| 364 | 'fg-preset-large' => __( 'Large', 'foogallery' ), |
| 365 | ) |
| 366 | ), |
| 367 | 'desc' => __( 'Choose an appropriate size for the preset hover effects, based on the size of your thumbs. Choose small for thumbs 150-200 wide, medium for thumbs 200-400 wide, and large for thumbs over 400 wide.', 'foogallery' ), |
| 368 | 'row_data' => array( |
| 369 | 'data-foogallery-change-selector' => 'input:radio', |
| 370 | 'data-foogallery-hidden' => true, |
| 371 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 372 | 'data-foogallery-show-when-field-value' => 'preset', |
| 373 | 'data-foogallery-preview' => 'shortcode' |
| 374 | ) |
| 375 | ); |
| 376 | |
| 377 | $fields[] = array( |
| 378 | 'id' => 'caption_invert_color', |
| 379 | 'title' => __( 'Theme', 'foogallery' ), |
| 380 | 'desc' => __( 'Choose a color theme that will be used for the hover effect.', 'foogallery' ), |
| 381 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 382 | 'alias' => 'hover_effect_theme', |
| 383 | 'type' => 'radio', |
| 384 | 'default' => '', |
| 385 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_caption_invert_color_choices', array( |
| 386 | '' => array( |
| 387 | 'label' => __( 'Dark', 'foogallery' ), |
| 388 | 'tooltip' => __('A dark overlay with white text is shown on hover', 'foogallery'), |
| 389 | ), |
| 390 | 'fg-light-overlays' => array( |
| 391 | 'label' => __( 'Light', 'foogallery' ), |
| 392 | 'tooltip' => __('A white overlay with dark text is shown on hover', 'foogallery'), |
| 393 | ), |
| 394 | 'fg-transparent-overlays' => array( |
| 395 | 'label' => __( 'Transparent', 'foogallery' ), |
| 396 | 'tooltip' => __('A transparent overlay with white text is shown on hover', 'foogallery'), |
| 397 | ), |
| 398 | ) ), |
| 399 | 'row_data' => array( |
| 400 | 'data-foogallery-change-selector' => 'input:radio', |
| 401 | 'data-foogallery-hidden' => true, |
| 402 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 403 | 'data-foogallery-show-when-field-value' => 'normal', |
| 404 | 'data-foogallery-preview' => 'shortcode' |
| 405 | ) |
| 406 | ); |
| 407 | |
| 408 | $fields[] = array( |
| 409 | 'id' => 'hover_effect_color', |
| 410 | 'title' => __( 'Color Effect', 'foogallery' ), |
| 411 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 412 | 'default' => '', |
| 413 | 'type' => 'radio', |
| 414 | 'choices' => apply_filters( |
| 415 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_color_choices', array( |
| 416 | '' => __( 'None', 'foogallery' ), |
| 417 | 'fg-hover-colorize' => __( 'Colorize', 'foogallery' ), |
| 418 | 'fg-hover-grayscale' => __( 'Greyscale', 'foogallery' ), |
| 419 | ) |
| 420 | ), |
| 421 | 'desc' => __( 'Choose an color effect that is applied when you hover over a thumbnail.', 'foogallery' ), |
| 422 | 'row_data' => array( |
| 423 | 'data-foogallery-change-selector' => 'input:radio', |
| 424 | 'data-foogallery-hidden' => true, |
| 425 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 426 | 'data-foogallery-show-when-field-value' => 'normal', |
| 427 | 'data-foogallery-preview' => 'shortcode' |
| 428 | ) |
| 429 | ); |
| 430 | |
| 431 | $fields[] = array( |
| 432 | 'id' => 'hover_effect_scale', |
| 433 | 'title' => __( 'Scaling Effect', 'foogallery' ), |
| 434 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 435 | 'default' => '', |
| 436 | 'type' => 'radio', |
| 437 | 'choices' => apply_filters( |
| 438 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_scale_choices', array( |
| 439 | '' => __( 'None', 'foogallery' ), |
| 440 | 'fg-hover-scale' => __( 'Scaled', 'foogallery' ), |
| 441 | 'fg-hover-zoomed' => __( 'Zoomed', 'foogallery' ), |
| 442 | 'fg-hover-semi-zoomed' => __( 'Semi Zoomed', 'foogallery' ), |
| 443 | ) |
| 444 | ), |
| 445 | 'desc' => __( 'Apply a slight scaling effect when hovering over a thumbnail.', 'foogallery' ), |
| 446 | 'row_data' => array( |
| 447 | 'data-foogallery-change-selector' => 'input:radio', |
| 448 | 'data-foogallery-hidden' => true, |
| 449 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 450 | 'data-foogallery-show-when-field-value' => 'normal', |
| 451 | 'data-foogallery-preview' => 'shortcode' |
| 452 | ) |
| 453 | ); |
| 454 | |
| 455 | $fields[] = array( |
| 456 | 'id' => 'hover_effect_transition', |
| 457 | 'title' => __( 'Transition', 'foogallery' ), |
| 458 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 459 | 'default' => 'fg-hover-fade', |
| 460 | 'type' => 'radio', |
| 461 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_transition_choices', array( |
| 462 | 'fg-hover-instant' => __( 'Instant', 'foogallery' ), |
| 463 | 'fg-hover-fade' => __( 'Fade', 'foogallery' ), |
| 464 | 'fg-hover-slide-up' => __( 'Slide Up', 'foogallery' ), |
| 465 | 'fg-hover-slide-down' => __( 'Slide Down', 'foogallery' ), |
| 466 | 'fg-hover-slide-left' => __( 'Slide Left', 'foogallery' ), |
| 467 | 'fg-hover-slide-right' => __( 'Slide Right', 'foogallery' ), |
| 468 | 'fg-hover-push' => __( 'Push', 'foogallery' ) ) |
| 469 | ), |
| 470 | 'desc' => __( 'Choose what effect is used to show the caption when you hover over a thumbnail', 'foogallery' ), |
| 471 | 'row_data' => array( |
| 472 | 'data-foogallery-change-selector' => 'input:radio', |
| 473 | 'data-foogallery-value-selector' => 'input:checked', |
| 474 | 'data-foogallery-hidden' => true, |
| 475 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 476 | 'data-foogallery-show-when-field-value' => 'normal', |
| 477 | 'data-foogallery-preview' => 'shortcode' |
| 478 | ) |
| 479 | ); |
| 480 | |
| 481 | $fields[] = array( |
| 482 | 'id' => 'hover_effect_icon', |
| 483 | 'title' => __( 'Icon', 'foogallery' ), |
| 484 | 'desc' => __( 'Choose which icon is shown when you hover over a thumbnail', 'foogallery' ), |
| 485 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 486 | 'type' => 'htmlicon', |
| 487 | 'default' => 'fg-hover-zoom', |
| 488 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_icon_choices', array( |
| 489 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon"></div>' ), |
| 490 | 'fg-hover-zoom' => array( 'label' => __( 'Zoom', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom"></div>' ), |
| 491 | 'fg-hover-zoom2' => array( 'label' => __( 'Zoom 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom2"></div>' ), |
| 492 | 'fg-hover-zoom3' => array( 'label' => __( 'Zoom 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom3"></div>' ), |
| 493 | 'fg-hover-zoom4' => array( 'label' => __( 'Zoom 4', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom4"></div>' ), |
| 494 | 'fg-hover-zoom5' => array( 'label' => __( 'Zoom 5', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom5"></div>' ), |
| 495 | 'fg-hover-plus' => array( 'label' => __( 'Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus"></div>' ), |
| 496 | 'fg-hover-plus2' => array( 'label' => __( 'Plus 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus2"></div>' ), |
| 497 | 'fg-hover-plus3' => array( 'label' => __( 'Plus 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus3"></div>' ), |
| 498 | 'fg-hover-circle-plus' => array( 'label' => __( 'Circle Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-circle-plus"></div>' ), |
| 499 | 'fg-hover-circle-plus2'=> array( 'label' => __( 'Circle Plus 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-circle-plus2"></div>' ), |
| 500 | 'fg-hover-square-plus' => array( 'label' => __( 'Square Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-square-plus"></div>' ), |
| 501 | 'fg-hover-eye' => array( 'label' => __( 'Eye', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-eye"></div>' ), |
| 502 | 'fg-hover-external' => array( 'label' => __( 'External', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-external"></div>' ), |
| 503 | ) |
| 504 | ), |
| 505 | 'row_data' => array( |
| 506 | 'data-foogallery-change-selector' => 'input:radio', |
| 507 | 'data-foogallery-value-selector' => 'input:checked', |
| 508 | 'data-foogallery-hidden' => true, |
| 509 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 510 | 'data-foogallery-show-when-field-value' => 'normal', |
| 511 | 'data-foogallery-preview' => 'shortcode' |
| 512 | ) |
| 513 | ); |
| 514 | |
| 515 | $fields[] = array( |
| 516 | 'id' => 'hover_effect_icon_size', |
| 517 | 'title' => __( 'Icon Size', 'foogallery' ), |
| 518 | 'desc' => __( 'Choose the size of the icon that is displayed when you hover over a thumbnail.', 'foogallery' ), |
| 519 | 'section' => __( 'Hover Effects', 'foogallery' ), |
| 520 | 'type' => 'radio', |
| 521 | 'default' => '', |
| 522 | 'choices' => array( |
| 523 | '' => __( 'Default', 'foogallery' ), |
| 524 | '48' => __( '1.5x', 'foogallery' ), |
| 525 | '64' => __( '2x', 'foogallery' ), |
| 526 | '80' => __( '2.5x', 'foogallery' ), |
| 527 | '96' => __( '3x', 'foogallery' ), |
| 528 | ), |
| 529 | 'row_data' => array( |
| 530 | 'data-foogallery-change-selector' => 'input:radio', |
| 531 | 'data-foogallery-value-selector' => 'input:checked', |
| 532 | 'data-foogallery-hidden' => true, |
| 533 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 534 | 'data-foogallery-show-when-field-value' => 'normal', |
| 535 | 'data-foogallery-preview' => 'shortcode' |
| 536 | ) |
| 537 | ); |
| 538 | //endregion Hover Effects Fields |
| 539 | |
| 540 | //region Caption Fields |
| 541 | $fields[] = array( |
| 542 | 'id' => 'hover_effect_caption_visibility', |
| 543 | 'title' => __( 'Caption Visibility', 'foogallery' ), |
| 544 | 'section' => __( 'Captions', 'foogallery' ), |
| 545 | 'alias' => 'caption_visibility', |
| 546 | 'default' => 'fg-caption-hover', |
| 547 | 'type' => 'radio', |
| 548 | 'choices' => apply_filters( |
| 549 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_caption_visibility_choices', array( |
| 550 | '' => __( 'Not shown', 'foogallery' ), |
| 551 | 'fg-caption-hover' => __( 'On Hover', 'foogallery' ), |
| 552 | 'fg-caption-always' => __( 'Always Visible', 'foogallery' ), |
| 553 | ) |
| 554 | ), |
| 555 | 'desc' => __( 'Choose when the captions will be displayed.', 'foogallery' ), |
| 556 | 'row_data' => array( |
| 557 | 'data-foogallery-change-selector' => 'input:radio', |
| 558 | 'data-foogallery-hidden' => true, |
| 559 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 560 | 'data-foogallery-show-when-field-value' => 'normal', |
| 561 | 'data-foogallery-preview' => 'shortcode' |
| 562 | ) |
| 563 | ); |
| 564 | |
| 565 | $fields[] = array( |
| 566 | 'id' => 'caption_visibility_no_hover_effect', |
| 567 | 'title' => __( 'Caption Visibility', 'foogallery' ), |
| 568 | 'section' => __( 'Captions', 'foogallery' ), |
| 569 | 'default' => '', |
| 570 | 'type' => 'radio', |
| 571 | 'choices' => apply_filters( |
| 572 | 'foogallery_gallery_template_common_thumbnail_fields_caption_visibility_no_hover_effect_choices', array( |
| 573 | '' => __( 'Not shown', 'foogallery' ), |
| 574 | 'fg-caption-always' => __( 'Always Visible', 'foogallery' ), |
| 575 | ) |
| 576 | ), |
| 577 | 'desc' => __( 'Choose when the captions will be displayed.', 'foogallery' ), |
| 578 | 'row_data' => array( |
| 579 | 'data-foogallery-change-selector' => 'input:radio', |
| 580 | 'data-foogallery-hidden' => true, |
| 581 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 582 | 'data-foogallery-show-when-field-value' => 'none', |
| 583 | 'data-foogallery-preview' => 'shortcode' |
| 584 | ) |
| 585 | ); |
| 586 | |
| 587 | $fields[] = array( |
| 588 | 'id' => 'caption_color_no_hover_effect', |
| 589 | 'title' => __( 'Caption Theme', 'foogallery' ), |
| 590 | 'desc' => __( 'Choose the color theme for the captions.', 'foogallery' ), |
| 591 | 'section' => __( 'Captions', 'foogallery' ), |
| 592 | 'type' => 'radio', |
| 593 | 'default' => '', |
| 594 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_caption_color_no_hover_effect_choices', array( |
| 595 | '' => array( |
| 596 | 'label' => __( 'Dark', 'foogallery' ), |
| 597 | 'tooltip' => __('A dark overlay with white text is shown for the captions', 'foogallery'), |
| 598 | ), |
| 599 | 'fg-light-overlays' => array( |
| 600 | 'label' => __( 'Light', 'foogallery' ), |
| 601 | 'tooltip' => __('A white overlay with dark text is shown for the captions', 'foogallery'), |
| 602 | ), |
| 603 | 'fg-transparent-overlays' => array( |
| 604 | 'label' => __( 'Transparent', 'foogallery' ), |
| 605 | 'tooltip' => __('A transparent overlay with white text is shown for the captions', 'foogallery'), |
| 606 | ), |
| 607 | ) ), |
| 608 | 'row_data' => array( |
| 609 | 'data-foogallery-change-selector' => 'input:radio', |
| 610 | 'data-foogallery-hidden' => true, |
| 611 | 'data-foogallery-show-when-field' => 'hover_effect_type', |
| 612 | 'data-foogallery-show-when-field-value' => 'none', |
| 613 | 'data-foogallery-preview' => 'shortcode' |
| 614 | ) |
| 615 | ); |
| 616 | |
| 617 | $fields[] = array( |
| 618 | 'id' => 'caption_alignment', |
| 619 | 'title' => __( 'Caption Alignment', 'foogallery' ), |
| 620 | 'desc' => __( 'Change the horizontal alignment of the thumbnail captions', 'foogallery' ), |
| 621 | 'section' => __( 'Captions', 'foogallery' ), |
| 622 | 'type' => 'radio', |
| 623 | 'default' => '', |
| 624 | 'choices' => array( |
| 625 | '' => __( 'Default', 'foogallery' ), |
| 626 | 'fg-c-l' => __( 'Left', 'foogallery' ), |
| 627 | 'fg-c-c' => __( 'Center', 'foogallery' ), |
| 628 | 'fg-c-r' => __( 'Right', 'foogallery' ), |
| 629 | 'fg-c-j' => __( 'Justify', 'foogallery' ), |
| 630 | ), |
| 631 | 'row_data' => array( |
| 632 | 'data-foogallery-change-selector' => 'input:radio', |
| 633 | 'data-foogallery-preview' => 'shortcode' |
| 634 | ) |
| 635 | ); |
| 636 | |
| 637 | $settings_link = sprintf( '<a target="blank" href="%s">%s</a>', foogallery_admin_settings_url(), __( 'settings', 'foogallery' ) ); |
| 638 | |
| 639 | $fields[] = array( |
| 640 | 'id' => 'caption_title_source', |
| 641 | 'title' => __( 'Title', 'foogallery' ), |
| 642 | 'desc' => __( 'Decide where caption titles are pulled from. By default, what is saved under general settings will be used, but it can be overridden per gallery', 'foogallery' ), |
| 643 | 'section' => __( 'Captions', 'foogallery' ), |
| 644 | 'type' => 'radio', |
| 645 | 'class' => 'foogallery-radios-stacked', |
| 646 | 'default' => '', |
| 647 | 'choices' => array( |
| 648 | 'none' => __( 'None', 'foogallery' ), |
| 649 | /* translators: %s: Value inserted at runtime. */ |
| 650 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), |
| 651 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), |
| 652 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), |
| 653 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), |
| 654 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), |
| 655 | ), |
| 656 | 'row_data' => array( |
| 657 | 'data-foogallery-change-selector' => 'input:radio', |
| 658 | 'data-foogallery-preview' => 'shortcode' |
| 659 | ) |
| 660 | ); |
| 661 | |
| 662 | $fields[] = array( |
| 663 | 'id' => 'caption_desc_source', |
| 664 | 'title' => __( 'Description', 'foogallery' ), |
| 665 | 'desc' => __( 'Decide where captions descriptions are pulled from. By default, the general settings are used, but it can be overridden per gallery', 'foogallery' ), |
| 666 | 'section' => __( 'Captions', 'foogallery' ), |
| 667 | 'type' => 'radio', |
| 668 | 'class' => 'foogallery-radios-stacked', |
| 669 | 'default' => '', |
| 670 | 'choices' => array( |
| 671 | 'none' => __( 'None', 'foogallery' ), |
| 672 | /* translators: %s: Value inserted at runtime. */ |
| 673 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), |
| 674 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), |
| 675 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), |
| 676 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), |
| 677 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), |
| 678 | ), |
| 679 | 'row_data' => array( |
| 680 | 'data-foogallery-change-selector' => 'input:radio', |
| 681 | 'data-foogallery-preview' => 'shortcode' |
| 682 | ) |
| 683 | ); |
| 684 | |
| 685 | $fields[] = array( |
| 686 | 'id' => 'captions_limit_length', |
| 687 | 'title' => __( 'Limit Caption Length', 'foogallery' ), |
| 688 | 'desc' => __( 'You can limit the length of caption title and descriptions in the thumbnails. This will NOT limit the length of captions from within the lightbox.', 'foogallery' ), |
| 689 | 'section' => __( 'Captions', 'foogallery' ), |
| 690 | 'default' => 'clamp', |
| 691 | 'type' => 'radio', |
| 692 | 'class' => 'foogallery-radios-stacked', |
| 693 | 'choices' => array( |
| 694 | '' => __( 'No', 'foogallery' ), |
| 695 | 'yes' => array( |
| 696 | 'label' => __( 'Yes (by character length)', 'foogallery' ), |
| 697 | 'tooltip' => __( 'Limit the length of the caption title and description by character length.', 'foogallery' ), |
| 698 | ), |
| 699 | 'clamp' => array( |
| 700 | 'label' => __( 'Yes (by lines)', 'foogallery' ), |
| 701 | 'tooltip' => __( 'Limit the length of the caption title and description by the number of lines.', 'foogallery' ), |
| 702 | ) |
| 703 | ), |
| 704 | 'row_data'=> array( |
| 705 | 'data-foogallery-change-selector' => 'input:radio', |
| 706 | 'data-foogallery-preview' => 'shortcode', |
| 707 | 'data-foogallery-value-selector' => 'input:checked', |
| 708 | ) |
| 709 | ); |
| 710 | |
| 711 | $fields[] = array( |
| 712 | 'id' => 'caption_title_length', |
| 713 | 'title' => __( 'Max Title Length', 'foogallery' ), |
| 714 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery' ), |
| 715 | 'section' => __( 'Captions', 'foogallery' ), |
| 716 | 'type' => 'number', |
| 717 | 'class' => 'small-text', |
| 718 | 'default' => 0, |
| 719 | 'step' => '1', |
| 720 | 'min' => '0', |
| 721 | 'row_data' => array( |
| 722 | 'data-foogallery-change-selector' => 'input', |
| 723 | 'data-foogallery-hidden' => true, |
| 724 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
| 725 | 'data-foogallery-show-when-field-value' => 'yes', |
| 726 | 'data-foogallery-preview' => 'shortcode' |
| 727 | ) |
| 728 | ); |
| 729 | |
| 730 | $fields[] = array( |
| 731 | 'id' => 'caption_desc_length', |
| 732 | 'title' => __( 'Max Desc Length', 'foogallery' ), |
| 733 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery' ), |
| 734 | 'section' => __( 'Captions', 'foogallery' ), |
| 735 | 'type' => 'number', |
| 736 | 'class' => 'small-text', |
| 737 | 'default' => 0, |
| 738 | 'step' => '1', |
| 739 | 'min' => '0', |
| 740 | 'row_data' => array( |
| 741 | 'data-foogallery-change-selector' => 'input', |
| 742 | 'data-foogallery-hidden' => true, |
| 743 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
| 744 | 'data-foogallery-show-when-field-value' => 'yes', |
| 745 | 'data-foogallery-preview' => 'shortcode' |
| 746 | ) |
| 747 | ); |
| 748 | |
| 749 | $fields[] = array( |
| 750 | 'id' => 'caption_title_clamp', |
| 751 | 'title' => __( 'Max Title Lines', 'foogallery' ), |
| 752 | 'desc' => __( 'A max number of lines of text to display. A value of zero will not apply a limit.', 'foogallery' ), |
| 753 | 'section' => __( 'Captions', 'foogallery' ), |
| 754 | 'type' => 'number', |
| 755 | 'class' => 'small-text', |
| 756 | 'default' => 1, |
| 757 | 'step' => '1', |
| 758 | 'min' => '0', |
| 759 | 'row_data' => array( |
| 760 | 'data-foogallery-change-selector' => 'input', |
| 761 | 'data-foogallery-hidden' => true, |
| 762 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
| 763 | 'data-foogallery-show-when-field-value' => 'clamp', |
| 764 | 'data-foogallery-preview' => 'shortcode' |
| 765 | ) |
| 766 | ); |
| 767 | |
| 768 | $fields[] = array( |
| 769 | 'id' => 'caption_desc_clamp', |
| 770 | 'title' => __( 'Max Desc Lines', 'foogallery' ), |
| 771 | 'desc' => __( 'A max number of lines of text to display. A value of zero will not apply a limit.', 'foogallery' ), |
| 772 | 'section' => __( 'Captions', 'foogallery' ), |
| 773 | 'type' => 'number', |
| 774 | 'class' => 'small-text', |
| 775 | 'default' => 2, |
| 776 | 'step' => '1', |
| 777 | 'min' => '0', |
| 778 | 'row_data' => array( |
| 779 | 'data-foogallery-change-selector' => 'input', |
| 780 | 'data-foogallery-hidden' => true, |
| 781 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
| 782 | 'data-foogallery-show-when-field-value' => 'clamp', |
| 783 | 'data-foogallery-preview' => 'shortcode' |
| 784 | ) |
| 785 | ); |
| 786 | //endregion |
| 787 | |
| 788 | } |
| 789 | return $fields; |
| 790 | } |
| 791 | |
| 792 | /** |
| 793 | * Build up the gallery class attribute for the common fields |
| 794 | * |
| 795 | * @param $classes array |
| 796 | * @param $gallery FooGallery |
| 797 | * |
| 798 | * @return array |
| 799 | */ |
| 800 | function add_common_fields_class_attributes( $classes, $gallery ) { |
| 801 | if ( foogallery_current_gallery_check_template_has_supported_feature('common_fields_support' ) ) { |
| 802 | |
| 803 | //add the gallery template core class |
| 804 | $classes[] = 'fg-' . $gallery->gallery_template; |
| 805 | |
| 806 | //always add the fg-ready class, to avoid some javascript errors. |
| 807 | $classes[] = 'fg-ready'; |
| 808 | |
| 809 | //get some default classes from common gallery settings |
| 810 | $classes[] = foogallery_gallery_template_setting( 'theme', 'fg-light' ); |
| 811 | $classes[] = foogallery_gallery_template_setting( 'border_size', 'fg-border-thin' ); |
| 812 | $classes[] = foogallery_gallery_template_setting( 'rounded_corners', '' ); |
| 813 | $classes[] = foogallery_gallery_template_setting( 'drop_shadow', 'fg-shadow-outline' ); |
| 814 | $classes[] = foogallery_gallery_template_setting( 'inner_shadow', '' ); |
| 815 | $classes[] = foogallery_gallery_template_setting( 'loading_icon', 'fg-loading-default' ); |
| 816 | $classes[] = foogallery_gallery_template_setting( 'loaded_effect', 'fg-loaded-fade-in' ); |
| 817 | |
| 818 | $hover_effect_type = foogallery_gallery_template_setting( 'hover_effect_type', '' ); |
| 819 | |
| 820 | if ( 'normal' === $hover_effect_type ) { |
| 821 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_color', '' ); |
| 822 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_scale', '' ); |
| 823 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_caption_visibility', 'fg-caption-hover' ); |
| 824 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_transition', 'fg-hover-fade' ); |
| 825 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_icon', 'fg-hover-zoom' ); |
| 826 | $classes[] = foogallery_gallery_template_setting( 'caption_invert_color', '' ); |
| 827 | } else if ( 'none' === $hover_effect_type ) { |
| 828 | $classes[] = foogallery_gallery_template_setting( 'caption_visibility_no_hover_effect', '' ); |
| 829 | $classes[] = foogallery_gallery_template_setting( 'caption_color_no_hover_effect', '' ); |
| 830 | } else if ( 'preset' === $hover_effect_type ) { |
| 831 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_preset', 'fg-preset fg-brad' ); |
| 832 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_preset_size', 'fg-preset-small' ); |
| 833 | } |
| 834 | |
| 835 | $classes[] = foogallery_gallery_template_setting( 'caption_alignment', '' ); |
| 836 | |
| 837 | if ( 'preset' === foogallery_gallery_template_setting( 'hover_effect_type', '' ) ) { |
| 838 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_preset', 'fg-preset fg-brad' ); |
| 839 | $classes[] = foogallery_gallery_template_setting( 'hover_effect_preset_size', 'fg-preset-small' ); |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | return $classes; |
| 844 | } |
| 845 | |
| 846 | /** |
| 847 | * Add the required data options for captions |
| 848 | * |
| 849 | * @param $options |
| 850 | * @param $gallery FooGallery |
| 851 | * |
| 852 | * @param $attributes array |
| 853 | * |
| 854 | * @return array |
| 855 | */ |
| 856 | function add_caption_data_options($options, $gallery, $attributes) { |
| 857 | //check the template supports common fields |
| 858 | if ( foogallery_current_gallery_check_template_has_supported_feature('common_fields_support' ) ) { |
| 859 | |
| 860 | $caption_title = foogallery_gallery_template_setting( 'caption_title_source', '' ); |
| 861 | $caption_desc = foogallery_gallery_template_setting( 'caption_desc_source', '' ); |
| 862 | |
| 863 | $options['item']['showCaptionTitle'] = $caption_title !== 'none'; |
| 864 | $options['item']['showCaptionDescription'] = $caption_desc !== 'none'; |
| 865 | |
| 866 | $captions_limit_length = foogallery_gallery_template_setting( 'captions_limit_length', 'clamp' ); |
| 867 | |
| 868 | if ( 'yes' === $captions_limit_length ) { |
| 869 | $caption_title_length = foogallery_gallery_template_setting( 'caption_title_length', '0' ); |
| 870 | $caption_desc_length = foogallery_gallery_template_setting( 'caption_desc_length', '0' ); |
| 871 | $options['item']['maxCaptionLength'] = intval( $caption_title_length ); |
| 872 | $options['item']['maxDescriptionLength'] = intval( $caption_desc_length ); |
| 873 | } |
| 874 | } |
| 875 | return $options; |
| 876 | } |
| 877 | |
| 878 | function add_common_fields_attributes($attributes, $gallery) { |
| 879 | //check the template supports common fields |
| 880 | if ( foogallery_current_gallery_check_template_has_supported_feature('common_fields_support' ) ) { |
| 881 | $captions_limit_length = foogallery_gallery_template_setting( 'captions_limit_length', 'clamp' ); |
| 882 | |
| 883 | if ( 'clamp' === $captions_limit_length ) { |
| 884 | $caption_title_clamp = intval( foogallery_gallery_template_setting( 'caption_title_clamp', '0' ) ); |
| 885 | $caption_desc_clamp = intval( foogallery_gallery_template_setting( 'caption_desc_clamp', '0' ) ); |
| 886 | } else { |
| 887 | $caption_title_clamp = $caption_desc_clamp = 0; |
| 888 | } |
| 889 | $style = "--fg-title-line-clamp: {$caption_title_clamp}; --fg-description-line-clamp: {$caption_desc_clamp};"; |
| 890 | if ( empty( $attributes['style'] ) ) { |
| 891 | $attributes['style'] = $style; |
| 892 | } else { |
| 893 | $attributes['style'] .= $style; |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | return $attributes; |
| 898 | } |
| 899 | |
| 900 | /** |
| 901 | * Build up the gallery data attributes for the common fields |
| 902 | * |
| 903 | * @param $attributes array |
| 904 | * @param $gallery FooGallery |
| 905 | * |
| 906 | * @return array |
| 907 | */ |
| 908 | function add_common_fields_data_attribute( $attributes, $gallery ) { |
| 909 | //check the template supports common fields |
| 910 | if ( is_admin() && foogallery_current_gallery_check_template_has_supported_feature('common_fields_support' ) ) { |
| 911 | $attributes['data-fg-common-fields'] = true; |
| 912 | } |
| 913 | |
| 914 | $icon_size = intval( foogallery_gallery_template_setting( 'hover_effect_icon_size', '0' ) ); |
| 915 | if ( $icon_size > 0 ) { |
| 916 | $style = "--fg-icon-size: {$icon_size}px;"; |
| 917 | if ( empty($attributes['style']) ) { |
| 918 | $attributes['style'] = $style; |
| 919 | } else { |
| 920 | $attributes['style'] .= $style; |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | return $attributes; |
| 925 | } |
| 926 | |
| 927 | /*** |
| 928 | * Check if we have a value from PRO and change it if PRO is no longer active |
| 929 | * @param $value |
| 930 | * @param $field |
| 931 | * @param $gallery |
| 932 | * @param $template |
| 933 | * |
| 934 | * @return string |
| 935 | */ |
| 936 | function check_downgrade_values($value, $field, $gallery, $template) { |
| 937 | |
| 938 | if ( isset( $field['type'] ) ) { |
| 939 | if ( 'hover_effect_preset' === $field['id'] || 'loaded_effect' === $field['type'] ) { |
| 940 | if ( !array_key_exists( $value, $field['choices'] ) ) { |
| 941 | $value = $field['default']; |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | return $value; |
| 947 | } |
| 948 | |
| 949 | /** |
| 950 | * Override settings from older versions (pre v1.9.13) |
| 951 | * |
| 952 | * @param $settings |
| 953 | * @param $gallery_template |
| 954 | * @param $foogallery |
| 955 | * |
| 956 | * @return array |
| 957 | */ |
| 958 | function override_settings_for_older_versions( $settings, $gallery_template, $foogallery ) { |
| 959 | if ( is_array( $settings ) ) { |
| 960 | if ( ! array_key_exists( $gallery_template . '_hover_effect_type', $settings ) ) { |
| 961 | //we have no hover effect type |
| 962 | |
| 963 | if ( array_key_exists( $gallery_template . '_hover_effect_preset', $settings ) ) { |
| 964 | $hover_effect_preset = $settings[ $gallery_template . '_hover_effect_preset' ]; |
| 965 | |
| 966 | if ( 'fg-custom' === $hover_effect_preset ) { |
| 967 | $settings[ $gallery_template . '_hover_effect_type' ] = 'normal'; |
| 968 | } else if ( '' === $hover_effect_preset ) { |
| 969 | $settings[ $gallery_template . '_hover_effect_type' ] = 'none'; |
| 970 | } else if ( strpos( $hover_effect_preset, 'fg-preset' ) !== false ) { |
| 971 | $settings[ $gallery_template . '_hover_effect_type' ] = 'preset'; |
| 972 | } |
| 973 | } else { |
| 974 | //no hover effect type or hover effect preset set |
| 975 | $settings[ $gallery_template . '_hover_effect_type' ] = 'normal'; |
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | return $settings; |
| 981 | } |
| 982 | } |
| 983 | } |
| 984 |