| Conditions | 4 |
| Paths | 2 |
| Total Lines | 462 |
| Code Lines | 362 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 65 | function add_common_fields( $fields, $template ) { |
||
|
|
|||
| 66 | //check if the template supports the common fields |
||
| 67 | if ( $template && array_key_exists( 'common_fields_support', $template ) && true === $template['common_fields_support'] ) { |
||
| 68 | |||
| 69 | //region Appearance Fields |
||
| 70 | $fields[] = array( |
||
| 71 | 'id' => 'theme_custom_help', |
||
| 72 | 'title' => __( 'Theme Help', 'foogallery' ), |
||
| 73 | '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' ), |
||
| 74 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 75 | 'type' => 'help', |
||
| 76 | 'row_data' => array( |
||
| 77 | 'data-foogallery-hidden' => true, |
||
| 78 | 'data-foogallery-show-when-field' => 'theme', |
||
| 79 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
| 80 | ) |
||
| 81 | ); |
||
| 82 | |||
| 83 | $fields[] = array( |
||
| 84 | 'id' => 'theme', |
||
| 85 | 'title' => __( 'Theme', 'foogallery' ), |
||
| 86 | 'desc' => __( 'The overall appearance of the items in the gallery, affecting the border, background, font and shadow colors.', 'foogallery' ), |
||
| 87 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 88 | 'type' => 'radio', |
||
| 89 | 'default' => 'fg-light', |
||
| 90 | 'spacer' => '<span class="spacer"></span>', |
||
| 91 | 'choices' => array( |
||
| 92 | 'fg-light' => __( 'Light', 'foogallery' ), |
||
| 93 | 'fg-dark' => __( 'Dark', 'foogallery' ), |
||
| 94 | 'fg-custom' => __( 'Custom', 'foogallery' ) |
||
| 95 | ), |
||
| 96 | 'row_data' => array( |
||
| 97 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 98 | 'data-foogallery-value-selector' => 'input:checked', |
||
| 99 | 'data-foogallery-preview' => 'class' |
||
| 100 | ) |
||
| 101 | ); |
||
| 102 | |||
| 103 | $fields[] = array( |
||
| 104 | 'id' => 'border_size', |
||
| 105 | 'title' => __( 'Border Size', 'foogallery' ), |
||
| 106 | 'desc' => __( 'The border size applied to each thumbnail', 'foogallery' ), |
||
| 107 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 108 | 'type' => 'radio', |
||
| 109 | 'spacer' => '<span class="spacer"></span>', |
||
| 110 | 'default' => 'fg-border-thin', |
||
| 111 | 'choices' => array( |
||
| 112 | '' => __( 'None', 'foogallery' ), |
||
| 113 | 'fg-border-thin' => __( 'Thin', 'foogallery' ), |
||
| 114 | 'fg-border-medium' => __( 'Medium', 'foogallery' ), |
||
| 115 | 'fg-border-thick' => __( 'Thick', 'foogallery' ), |
||
| 116 | ), |
||
| 117 | 'row_data' => array( |
||
| 118 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 119 | 'data-foogallery-preview' => 'class' |
||
| 120 | ) |
||
| 121 | ); |
||
| 122 | |||
| 123 | $fields[] = array( |
||
| 124 | 'id' => 'rounded_corners', |
||
| 125 | 'title' => __( 'Rounded Corners', 'foogallery' ), |
||
| 126 | 'desc' => __( 'The border radius, or rounded corners applied to each thumbnail', 'foogallery' ), |
||
| 127 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 128 | 'type' => 'radio', |
||
| 129 | 'spacer' => '<span class="spacer"></span>', |
||
| 130 | 'default' => '', |
||
| 131 | 'choices' => array( |
||
| 132 | '' => __( 'None', 'foogallery' ), |
||
| 133 | 'fg-round-small' => __( 'Small', 'foogallery' ), |
||
| 134 | 'fg-round-medium' => __( 'Medium', 'foogallery' ), |
||
| 135 | 'fg-round-large' => __( 'Large', 'foogallery' ), |
||
| 136 | 'fg-round-full' => __( 'Full', 'foogallery' ), |
||
| 137 | ), |
||
| 138 | 'row_data' => array( |
||
| 139 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 140 | 'data-foogallery-preview' => 'class' |
||
| 141 | ) |
||
| 142 | ); |
||
| 143 | |||
| 144 | $fields[] = array( |
||
| 145 | 'id' => 'drop_shadow', |
||
| 146 | 'title' => __( 'Drop Shadow', 'foogallery' ), |
||
| 147 | 'desc' => __( 'The outer or drop shadow applied to each thumbnail', 'foogallery' ), |
||
| 148 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 149 | 'type' => 'radio', |
||
| 150 | 'spacer' => '<span class="spacer"></span>', |
||
| 151 | 'default' => 'fg-shadow-outline', |
||
| 152 | 'choices' => array( |
||
| 153 | '' => __( 'None', 'foogallery' ), |
||
| 154 | 'fg-shadow-outline' => __( 'Outline', 'foogallery' ), |
||
| 155 | 'fg-shadow-small' => __( 'Small', 'foogallery' ), |
||
| 156 | 'fg-shadow-medium' => __( 'Medium', 'foogallery' ), |
||
| 157 | 'fg-shadow-large' => __( 'Large', 'foogallery' ), |
||
| 158 | ), |
||
| 159 | 'row_data' => array( |
||
| 160 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 161 | 'data-foogallery-preview' => 'class' |
||
| 162 | ) |
||
| 163 | ); |
||
| 164 | |||
| 165 | $fields[] = array( |
||
| 166 | 'id' => 'inner_shadow', |
||
| 167 | 'title' => __( 'Inner Shadow', 'foogallery' ), |
||
| 168 | 'desc' => __( 'The inner shadow applied to each thumbnail', 'foogallery' ), |
||
| 169 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 170 | 'type' => 'radio', |
||
| 171 | 'spacer' => '<span class="spacer"></span>', |
||
| 172 | 'default' => '', |
||
| 173 | 'choices' => array( |
||
| 174 | '' => __( 'None', 'foogallery' ), |
||
| 175 | 'fg-shadow-inset-small' => __( 'Small', 'foogallery' ), |
||
| 176 | 'fg-shadow-inset-medium' => __( 'Medium', 'foogallery' ), |
||
| 177 | 'fg-shadow-inset-large' => __( 'Large', 'foogallery' ), |
||
| 178 | ), |
||
| 179 | 'row_data' => array( |
||
| 180 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 181 | 'data-foogallery-preview' => 'class' |
||
| 182 | ) |
||
| 183 | ); |
||
| 184 | |||
| 185 | $fields[] = array( |
||
| 186 | 'id' => 'loading_icon', |
||
| 187 | 'title' => __( 'Loading Icon', 'foogallery' ), |
||
| 188 | 'desc' => __( 'An animated loading icon can be shown while the thumbnails are busy loading.', 'foogallery' ), |
||
| 189 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 190 | 'default' => 'fg-loading-default', |
||
| 191 | 'type' => 'htmlicon', |
||
| 192 | 'choices' => apply_filters( |
||
| 193 | 'foogallery_gallery_template_common_thumbnail_fields_loading_icon_choices', array( |
||
| 194 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon"></div>' ), |
||
| 195 | 'fg-loading-default' => array( 'label' => __( 'Default', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-default"><div class="fg-loader"></div></div>' ), |
||
| 196 | 'fg-loading-bars' => array( 'label' => __( 'Bars', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-bars"><div class="fg-loader"></div></div>' ), |
||
| 197 | 'fg-loading-dots' => array( 'label' => __( 'Dots', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-dots"><div class="fg-loader"></div></div>' ), |
||
| 198 | 'fg-loading-partial' => array( 'label' => __( 'Partial', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-partial"><div class="fg-loader"></div></div>' ), |
||
| 199 | 'fg-loading-pulse' => array( 'label' => __( 'Pulse', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-pulse"><div class="fg-loader"></div></div>' ), |
||
| 200 | 'fg-loading-trail' => array( 'label' => __( 'Trail', 'foogallery' ), 'html' => '<div class="foogallery-setting-loading_icon fg-loading-trail"><div class="fg-loader"></div></div>' ), |
||
| 201 | ) |
||
| 202 | ), |
||
| 203 | 'row_data' => array( |
||
| 204 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 205 | 'data-foogallery-value-selector' => 'input:checked', |
||
| 206 | 'data-foogallery-preview' => 'class' |
||
| 207 | ) |
||
| 208 | ); |
||
| 209 | |||
| 210 | $fields[] = array( |
||
| 211 | 'id' => 'loaded_effect', |
||
| 212 | 'title' => __( 'Loaded Effect', 'foogallery' ), |
||
| 213 | 'desc' => __( 'The animation effect used to display the thumbnail, once it has loaded.', 'foogallery' ), |
||
| 214 | 'section' => __( 'Appearance', 'foogallery' ), |
||
| 215 | 'default' => 'fg-loaded-fade-in', |
||
| 216 | 'type' => 'select', |
||
| 217 | 'choices' => apply_filters( |
||
| 218 | 'foogallery_gallery_template_common_thumbnail_fields_loaded_effect_choices', array( |
||
| 219 | '' => __( 'None', 'foogallery' ), |
||
| 220 | 'fg-loaded-fade-in' => __( 'Fade In', 'foogallery' ), |
||
| 221 | ) |
||
| 222 | ), |
||
| 223 | 'row_data' => array( |
||
| 224 | 'data-foogallery-change-selector' => 'select', |
||
| 225 | 'data-foogallery-value-selector' => 'select option:selected', |
||
| 226 | 'data-foogallery-preview' => 'class' |
||
| 227 | ) |
||
| 228 | ); |
||
| 229 | //endregion |
||
| 230 | |||
| 231 | //region Hover Effects Fields |
||
| 232 | $fields[] = array( |
||
| 233 | 'id' => 'hover_effect_help', |
||
| 234 | 'title' => __( 'Hover Effect Help', 'foogallery' ), |
||
| 235 | 'desc' => __( 'A preset provides a stylish and pre-defined look & feel for when you hover over the thumbnails.', 'foogallery' ), |
||
| 236 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 237 | 'type' => 'help', |
||
| 238 | 'row_data' => array( |
||
| 239 | 'data-foogallery-hidden' => true, |
||
| 240 | ) |
||
| 241 | ); |
||
| 242 | |||
| 243 | $fields[] = array( |
||
| 244 | 'id' => 'hover_effect_preset', |
||
| 245 | 'title' => __( 'Preset', 'foogallery' ), |
||
| 246 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 247 | 'default' => 'fg-custom', |
||
| 248 | 'type' => 'radio', |
||
| 249 | 'choices' => apply_filters( |
||
| 250 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array( |
||
| 251 | '' => __( 'None', 'foogallery' ), |
||
| 252 | 'fg-custom' => __( 'Custom', 'foogallery' ), |
||
| 253 | ) |
||
| 254 | ), |
||
| 255 | 'spacer' => '<span class="spacer"></span>', |
||
| 256 | 'desc' => __( 'A preset styling that is used for the captions. If you want to define your own custom captions, then choose Custom.', 'foogallery' ), |
||
| 257 | 'row_data' => array( |
||
| 258 | 'data-foogallery-hidden' => true, |
||
| 259 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 260 | 'data-foogallery-value-selector' => 'input:checked', |
||
| 261 | 'data-foogallery-preview' => 'class' |
||
| 262 | ) |
||
| 263 | ); |
||
| 264 | |||
| 265 | $fields[] = array( |
||
| 266 | 'id' => 'hover_effect_preset_size', |
||
| 267 | 'title' => __( 'Preset Size', 'foogallery' ), |
||
| 268 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 269 | 'default' => 'fg-preset-small', |
||
| 270 | 'spacer' => '<span class="spacer"></span>', |
||
| 271 | 'type' => 'radio', |
||
| 272 | 'choices' => apply_filters( |
||
| 273 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_size_choices', array( |
||
| 274 | 'fg-preset-small' => __( 'Small', 'foogallery' ), |
||
| 275 | 'fg-preset-medium' => __( 'Medium', 'foogallery' ), |
||
| 276 | 'fg-preset-large' => __( 'Large', 'foogallery' ), |
||
| 277 | ) |
||
| 278 | ), |
||
| 279 | 'desc' => __( 'Choose an appropriate size for the preset caption 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' ), |
||
| 280 | 'row_data' => array( |
||
| 281 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 282 | 'data-foogallery-hidden' => true, |
||
| 283 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
| 284 | 'data-foogallery-show-when-field-operator' => 'indexOf', |
||
| 285 | 'data-foogallery-show-when-field-value' => 'fg-preset', |
||
| 286 | 'data-foogallery-preview' => 'class' |
||
| 287 | ) |
||
| 288 | ); |
||
| 289 | |||
| 290 | $fields[] = array( |
||
| 291 | 'id' => 'hover_effect_color', |
||
| 292 | 'title' => __( 'Color Effect', 'foogallery' ), |
||
| 293 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 294 | 'default' => '', |
||
| 295 | 'spacer' => '<span class="spacer"></span>', |
||
| 296 | 'type' => 'radio', |
||
| 297 | 'choices' => apply_filters( |
||
| 298 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_color_choices', array( |
||
| 299 | '' => __( 'None', 'foogallery' ), |
||
| 300 | 'fg-hover-colorize' => __( 'Colorize', 'foogallery' ), |
||
| 301 | 'fg-hover-grayscale' => __( 'Greyscale', 'foogallery' ), |
||
| 302 | ) |
||
| 303 | ), |
||
| 304 | 'desc' => __( 'Choose an color effect that is applied when you hover over a thumbnail.', 'foogallery' ), |
||
| 305 | 'row_data' => array( |
||
| 306 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 307 | 'data-foogallery-hidden' => true, |
||
| 308 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
| 309 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
| 310 | 'data-foogallery-preview' => 'class' |
||
| 311 | ) |
||
| 312 | ); |
||
| 313 | |||
| 314 | $fields[] = array( |
||
| 315 | 'id' => 'hover_effect_scale', |
||
| 316 | 'title' => __( 'Scaling Effect', 'foogallery' ), |
||
| 317 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 318 | 'default' => '', |
||
| 319 | 'spacer' => '<span class="spacer"></span>', |
||
| 320 | 'type' => 'radio', |
||
| 321 | 'choices' => apply_filters( |
||
| 322 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_scale_choices', array( |
||
| 323 | '' => __( 'None', 'foogallery' ), |
||
| 324 | 'fg-hover-scale' => __( 'Scaled', 'foogallery' ), |
||
| 325 | ) |
||
| 326 | ), |
||
| 327 | 'desc' => __( 'Apply a slight scaling effect when hovering over a thumbnail.', 'foogallery' ), |
||
| 328 | 'row_data' => array( |
||
| 329 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 330 | 'data-foogallery-hidden' => true, |
||
| 331 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
| 332 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
| 333 | 'data-foogallery-preview' => 'class' |
||
| 334 | ) |
||
| 335 | ); |
||
| 336 | |||
| 337 | $fields[] = array( |
||
| 338 | 'id' => 'hover_effect_caption_visibility', |
||
| 339 | 'title' => __( 'Caption Visibility', 'foogallery' ), |
||
| 340 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 341 | 'default' => 'fg-caption-hover', |
||
| 342 | 'spacer' => '<span class="spacer"></span>', |
||
| 343 | 'type' => 'radio', |
||
| 344 | 'choices' => apply_filters( |
||
| 345 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_caption_visibility_choices', array( |
||
| 346 | '' => __( 'None', 'foogallery' ), |
||
| 347 | 'fg-caption-hover' => __( 'On Hover', 'foogallery' ), |
||
| 348 | 'fg-caption-always' => __( 'Always Visible', 'foogallery' ), |
||
| 349 | ) |
||
| 350 | ), |
||
| 351 | 'desc' => __( 'Choose how the captions will be displayed.', 'foogallery' ), |
||
| 352 | 'row_data' => array( |
||
| 353 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 354 | 'data-foogallery-hidden' => true, |
||
| 355 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
| 356 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
| 357 | 'data-foogallery-preview' => 'class' |
||
| 358 | ) |
||
| 359 | ); |
||
| 360 | |||
| 361 | $fields[] = array( |
||
| 362 | 'id' => 'hover_effect_transition', |
||
| 363 | 'title' => __( 'Transition', 'foogallery' ), |
||
| 364 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 365 | 'default' => 'fg-hover-fade', |
||
| 366 | 'type' => 'select', |
||
| 367 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_transition_choices', array( |
||
| 368 | 'fg-hover-instant' => __( 'Instant', 'foogallery' ), |
||
| 369 | 'fg-hover-fade' => __( 'Fade', 'foogallery' ), |
||
| 370 | 'fg-hover-slide-up' => __( 'Slide Up', 'foogallery' ), |
||
| 371 | 'fg-hover-slide-down' => __( 'Slide Down', 'foogallery' ), |
||
| 372 | 'fg-hover-slide-left' => __( 'Slide Left', 'foogallery' ), |
||
| 373 | 'fg-hover-slide-right' => __( 'Slide Right', 'foogallery' ), |
||
| 374 | 'fg-hover-push' => __( 'Push', 'foogallery' ) ) |
||
| 375 | ), |
||
| 376 | 'desc' => __( 'Choose what effect is used to show the caption when you hover over a thumbnail', 'foogallery' ), |
||
| 377 | 'row_data' => array( |
||
| 378 | 'data-foogallery-change-selector' => 'select', |
||
| 379 | 'data-foogallery-hidden' => true, |
||
| 380 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
| 381 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
| 382 | 'data-foogallery-preview' => 'class' |
||
| 383 | ) |
||
| 384 | ); |
||
| 385 | |||
| 386 | $fields[] = array( |
||
| 387 | 'id' => 'hover_effect_icon', |
||
| 388 | 'title' => __( 'Icon', 'foogallery' ), |
||
| 389 | 'desc' => __( 'Choose which icon is shown with the caption when you hover over a thumbnail', 'foogallery' ), |
||
| 390 | 'section' => __( 'Hover Effects', 'foogallery' ), |
||
| 391 | 'type' => 'htmlicon', |
||
| 392 | 'default' => 'fg-hover-zoom', |
||
| 393 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_icon_choices', array( |
||
| 394 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon"></div>' ), |
||
| 395 | 'fg-hover-zoom' => array( 'label' => __( 'Zoom', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom"></div>' ), |
||
| 396 | 'fg-hover-zoom2' => array( 'label' => __( 'Zoom 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom2"></div>' ), |
||
| 397 | 'fg-hover-zoom3' => array( 'label' => __( 'Zoom 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom3"></div>' ), |
||
| 398 | 'fg-hover-plus' => array( 'label' => __( 'Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus"></div>' ), |
||
| 399 | 'fg-hover-circle-plus' => array( 'label' => __( 'Circle Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-circle-plus"></div>' ), |
||
| 400 | 'fg-hover-eye' => array( 'label' => __( 'Eye', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-eye"></div>' ), |
||
| 401 | 'fg-hover-external' => array( 'label' => __( 'External', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-external"></div>' ), ) |
||
| 402 | ), |
||
| 403 | 'row_data' => array( |
||
| 404 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 405 | 'data-foogallery-hidden' => true, |
||
| 406 | 'data-foogallery-show-when-field' => 'hover_effect_preset', |
||
| 407 | 'data-foogallery-show-when-field-value' => 'fg-custom', |
||
| 408 | 'data-foogallery-preview' => 'class' |
||
| 409 | ) |
||
| 410 | ); |
||
| 411 | //endregion Hover Effects Fields |
||
| 412 | |||
| 413 | //region Caption Fields |
||
| 414 | $fields[] = array( |
||
| 415 | 'id' => 'captions_help', |
||
| 416 | 'title' => __( 'Captions Help', 'foogallery' ), |
||
| 417 | 'desc' => __( 'You can change when captions are shown using the "Hover Effects -> Caption Visibility" setting .', 'foogallery' ), |
||
| 418 | 'section' => __( 'Captions', 'foogallery' ), |
||
| 419 | 'type' => 'help' |
||
| 420 | ); |
||
| 421 | |||
| 422 | $settings_link = sprintf( '<a target="blank" href="%s">%s</a>', foogallery_admin_settings_url(), __( 'settings', 'foogallery' ) ); |
||
| 423 | |||
| 424 | $fields[] = array( |
||
| 425 | 'id' => 'caption_title_source', |
||
| 426 | 'title' => __( 'Title', 'foogallery' ), |
||
| 427 | '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' ), |
||
| 428 | 'section' => __( 'Captions', 'foogallery' ), |
||
| 429 | 'type' => 'radio', |
||
| 430 | 'default' => '', |
||
| 431 | 'choices' => array( |
||
| 432 | 'none' => __( 'None', 'foogallery' ), |
||
| 433 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), |
||
| 434 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), |
||
| 435 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), |
||
| 436 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), |
||
| 437 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), |
||
| 438 | ), |
||
| 439 | 'row_data' => array( |
||
| 440 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 441 | 'data-foogallery-preview' => 'shortcode' |
||
| 442 | ) |
||
| 443 | ); |
||
| 444 | |||
| 445 | $fields[] = array( |
||
| 446 | 'id' => 'caption_desc_source', |
||
| 447 | 'title' => __( 'Description', 'foogallery' ), |
||
| 448 | 'desc' => __( 'Decide where captions descriptions are pulled from. By default, the general settings are used, but it can be overridden per gallery', 'foogallery' ), |
||
| 449 | 'section' => __( 'Captions', 'foogallery' ), |
||
| 450 | 'type' => 'radio', |
||
| 451 | 'default' => '', |
||
| 452 | 'choices' => array( |
||
| 453 | 'none' => __( 'None', 'foogallery' ), |
||
| 454 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), |
||
| 455 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), |
||
| 456 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), |
||
| 457 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), |
||
| 458 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), |
||
| 459 | ), |
||
| 460 | 'row_data' => array( |
||
| 461 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 462 | 'data-foogallery-preview' => 'shortcode' |
||
| 463 | ) |
||
| 464 | ); |
||
| 465 | |||
| 466 | $fields[] = array( |
||
| 467 | 'id' => 'captions_limit_length', |
||
| 468 | 'title' => __( 'Limit Caption Length', 'foogallery' ), |
||
| 469 | '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' ), |
||
| 470 | 'section' => __( 'Captions', 'foogallery' ), |
||
| 471 | 'default' => '', |
||
| 472 | 'type' => 'radio', |
||
| 473 | 'spacer' => '<span class="spacer"></span>', |
||
| 474 | 'choices' => array( |
||
| 475 | '' => __( 'No', 'foogallery' ), |
||
| 476 | 'yes' => __( 'Yes', 'foogallery' ), |
||
| 477 | ), |
||
| 478 | 'row_data'=> array( |
||
| 479 | 'data-foogallery-change-selector' => 'input:radio', |
||
| 480 | 'data-foogallery-preview' => 'shortcode', |
||
| 481 | 'data-foogallery-value-selector' => 'input:checked', |
||
| 482 | ) |
||
| 483 | ); |
||
| 484 | |||
| 485 | $fields[] = array( |
||
| 486 | 'id' => 'caption_title_length', |
||
| 487 | 'title' => __( 'Max Title Length', 'foogallery' ), |
||
| 488 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery '), |
||
| 489 | 'section' => __( 'Captions', 'foogallery' ), |
||
| 490 | 'type' => 'number', |
||
| 491 | 'class' => 'small-text', |
||
| 492 | 'default' => 0, |
||
| 493 | 'step' => '1', |
||
| 494 | 'min' => '0', |
||
| 495 | 'row_data' => array( |
||
| 496 | 'data-foogallery-change-selector' => 'input', |
||
| 497 | 'data-foogallery-hidden' => true, |
||
| 498 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
||
| 499 | 'data-foogallery-show-when-field-value' => 'yes', |
||
| 500 | 'data-foogallery-preview' => 'shortcode' |
||
| 501 | ) |
||
| 502 | ); |
||
| 503 | |||
| 504 | $fields[] = array( |
||
| 505 | 'id' => 'caption_desc_length', |
||
| 506 | 'title' => __( 'Max Desc Length', 'foogallery' ), |
||
| 507 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery '), |
||
| 508 | 'section' => __( 'Captions', 'foogallery' ), |
||
| 509 | 'type' => 'number', |
||
| 510 | 'class' => 'small-text', |
||
| 511 | 'default' => 0, |
||
| 512 | 'step' => '1', |
||
| 513 | 'min' => '0', |
||
| 514 | 'row_data' => array( |
||
| 515 | 'data-foogallery-change-selector' => 'input', |
||
| 516 | 'data-foogallery-hidden' => true, |
||
| 517 | 'data-foogallery-show-when-field' => 'captions_limit_length', |
||
| 518 | 'data-foogallery-show-when-field-value' => 'yes', |
||
| 519 | 'data-foogallery-preview' => 'shortcode' |
||
| 520 | ) |
||
| 521 | ); |
||
| 522 | //endregion |
||
| 523 | |||
| 524 | } |
||
| 525 | return $fields; |
||
| 526 | } |
||
| 527 | |||
| 680 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.