| Conditions | 4 | 
| Paths | 2 | 
| Total Lines | 460 | 
| Code Lines | 360 | 
| 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-preview' => 'class' | ||
| 206 | ) | ||
| 207 | ); | ||
| 208 | |||
| 209 | $fields[] = array( | ||
| 210 | 'id' => 'loaded_effect', | ||
| 211 | 'title' => __( 'Loaded Effect', 'foogallery' ), | ||
| 212 | 'desc' => __( 'The animation effect used to display the thumbnail, once it has loaded.', 'foogallery' ), | ||
| 213 | 'section' => __( 'Appearance', 'foogallery' ), | ||
| 214 | 'default' => 'fg-loaded-fade-in', | ||
| 215 | 'type' => 'select', | ||
| 216 | 'choices' => apply_filters( | ||
| 217 | 'foogallery_gallery_template_common_thumbnail_fields_loaded_effect_choices', array( | ||
| 218 | '' => __( 'None', 'foogallery' ), | ||
| 219 | 'fg-loaded-fade-in' => __( 'Fade In', 'foogallery' ), | ||
| 220 | ) | ||
| 221 | ), | ||
| 222 | 'row_data' => array( | ||
| 223 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 224 | 'data-foogallery-preview' => 'class' | ||
| 225 | ) | ||
| 226 | ); | ||
| 227 | //endregion | ||
| 228 | |||
| 229 | //region Hover Effects Fields | ||
| 230 | $fields[] = array( | ||
| 231 | 'id' => 'hover_effect_help', | ||
| 232 | 'title' => __( 'Hover Effect Help', 'foogallery' ), | ||
| 233 | 'desc' => __( 'A preset provides a stylish and pre-defined look & feel for when you hover over the thumbnails.', 'foogallery' ), | ||
| 234 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 235 | 'type' => 'help', | ||
| 236 | 'row_data' => array( | ||
| 237 | 'data-foogallery-hidden' => true, | ||
| 238 | ) | ||
| 239 | ); | ||
| 240 | |||
| 241 | $fields[] = array( | ||
| 242 | 'id' => 'hover_effect_preset', | ||
| 243 | 'title' => __( 'Preset', 'foogallery' ), | ||
| 244 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 245 | 'default' => 'fg-custom', | ||
| 246 | 'type' => 'radio', | ||
| 247 | 'choices' => apply_filters( | ||
| 248 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_choices', array( | ||
| 249 | '' => __( 'None', 'foogallery' ), | ||
| 250 | 'fg-custom' => __( 'Custom', 'foogallery' ), | ||
| 251 | ) | ||
| 252 | ), | ||
| 253 | 'spacer' => '<span class="spacer"></span>', | ||
| 254 | 'desc' => __( 'A preset styling that is used for the captions. If you want to define your own custom captions, then choose Custom.', 'foogallery' ), | ||
| 255 | 'row_data' => array( | ||
| 256 | 'data-foogallery-hidden' => true, | ||
| 257 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 258 | 'data-foogallery-value-selector' => 'input:checked', | ||
| 259 | 'data-foogallery-preview' => 'class' | ||
| 260 | ) | ||
| 261 | ); | ||
| 262 | |||
| 263 | $fields[] = array( | ||
| 264 | 'id' => 'hover_effect_preset_size', | ||
| 265 | 'title' => __( 'Preset Size', 'foogallery' ), | ||
| 266 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 267 | 'default' => 'fg-preset-small', | ||
| 268 | 'spacer' => '<span class="spacer"></span>', | ||
| 269 | 'type' => 'radio', | ||
| 270 | 'choices' => apply_filters( | ||
| 271 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_preset_size_choices', array( | ||
| 272 | 'fg-preset-small' => __( 'Small', 'foogallery' ), | ||
| 273 | 'fg-preset-medium' => __( 'Medium', 'foogallery' ), | ||
| 274 | 'fg-preset-large' => __( 'Large', 'foogallery' ), | ||
| 275 | ) | ||
| 276 | ), | ||
| 277 | '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' ), | ||
| 278 | 'row_data' => array( | ||
| 279 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 280 | 'data-foogallery-hidden' => true, | ||
| 281 | 'data-foogallery-show-when-field' => 'hover_effect_preset', | ||
| 282 | 'data-foogallery-show-when-field-operator' => 'indexOf', | ||
| 283 | 'data-foogallery-show-when-field-value' => 'fg-preset', | ||
| 284 | 'data-foogallery-preview' => 'class' | ||
| 285 | ) | ||
| 286 | ); | ||
| 287 | |||
| 288 | $fields[] = array( | ||
| 289 | 'id' => 'hover_effect_color', | ||
| 290 | 'title' => __( 'Color Effect', 'foogallery' ), | ||
| 291 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 292 | 'default' => '', | ||
| 293 | 'spacer' => '<span class="spacer"></span>', | ||
| 294 | 'type' => 'radio', | ||
| 295 | 'choices' => apply_filters( | ||
| 296 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_color_choices', array( | ||
| 297 | '' => __( 'None', 'foogallery' ), | ||
| 298 | 'fg-hover-colorize' => __( 'Colorize', 'foogallery' ), | ||
| 299 | 'fg-hover-grayscale' => __( 'Greyscale', 'foogallery' ), | ||
| 300 | ) | ||
| 301 | ), | ||
| 302 | 'desc' => __( 'Choose an color effect that is applied when you hover over a thumbnail.', 'foogallery' ), | ||
| 303 | 'row_data' => array( | ||
| 304 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 305 | 'data-foogallery-hidden' => true, | ||
| 306 | 'data-foogallery-show-when-field' => 'hover_effect_preset', | ||
| 307 | 'data-foogallery-show-when-field-value' => 'fg-custom', | ||
| 308 | 'data-foogallery-preview' => 'class' | ||
| 309 | ) | ||
| 310 | ); | ||
| 311 | |||
| 312 | $fields[] = array( | ||
| 313 | 'id' => 'hover_effect_scale', | ||
| 314 | 'title' => __( 'Scaling Effect', 'foogallery' ), | ||
| 315 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 316 | 'default' => '', | ||
| 317 | 'spacer' => '<span class="spacer"></span>', | ||
| 318 | 'type' => 'radio', | ||
| 319 | 'choices' => apply_filters( | ||
| 320 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_scale_choices', array( | ||
| 321 | '' => __( 'None', 'foogallery' ), | ||
| 322 | 'fg-hover-scale' => __( 'Scaled', 'foogallery' ), | ||
| 323 | ) | ||
| 324 | ), | ||
| 325 | 'desc' => __( 'Apply a slight scaling effect when hovering over a thumbnail.', 'foogallery' ), | ||
| 326 | 'row_data' => array( | ||
| 327 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 328 | 'data-foogallery-hidden' => true, | ||
| 329 | 'data-foogallery-show-when-field' => 'hover_effect_preset', | ||
| 330 | 'data-foogallery-show-when-field-value' => 'fg-custom', | ||
| 331 | 'data-foogallery-preview' => 'class' | ||
| 332 | ) | ||
| 333 | ); | ||
| 334 | |||
| 335 | $fields[] = array( | ||
| 336 | 'id' => 'hover_effect_caption_visibility', | ||
| 337 | 'title' => __( 'Caption Visibility', 'foogallery' ), | ||
| 338 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 339 | 'default' => 'fg-caption-hover', | ||
| 340 | 'spacer' => '<span class="spacer"></span>', | ||
| 341 | 'type' => 'radio', | ||
| 342 | 'choices' => apply_filters( | ||
| 343 | 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_caption_visibility_choices', array( | ||
| 344 | '' => __( 'None', 'foogallery' ), | ||
| 345 | 'fg-caption-hover' => __( 'On Hover', 'foogallery' ), | ||
| 346 | 'fg-caption-always' => __( 'Always Visible', 'foogallery' ), | ||
| 347 | ) | ||
| 348 | ), | ||
| 349 | 'desc' => __( 'Choose how the captions will be displayed.', 'foogallery' ), | ||
| 350 | 'row_data' => array( | ||
| 351 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 352 | 'data-foogallery-hidden' => true, | ||
| 353 | 'data-foogallery-show-when-field' => 'hover_effect_preset', | ||
| 354 | 'data-foogallery-show-when-field-value' => 'fg-custom', | ||
| 355 | 'data-foogallery-preview' => 'class' | ||
| 356 | ) | ||
| 357 | ); | ||
| 358 | |||
| 359 | $fields[] = array( | ||
| 360 | 'id' => 'hover_effect_transition', | ||
| 361 | 'title' => __( 'Transition', 'foogallery' ), | ||
| 362 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 363 | 'default' => 'fg-hover-fade', | ||
| 364 | 'type' => 'select', | ||
| 365 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_transition_choices', array( | ||
| 366 | 'fg-hover-instant' => __( 'Instant', 'foogallery' ), | ||
| 367 | 'fg-hover-fade' => __( 'Fade', 'foogallery' ), | ||
| 368 | 'fg-hover-slide-up' => __( 'Slide Up', 'foogallery' ), | ||
| 369 | 'fg-hover-slide-down' => __( 'Slide Down', 'foogallery' ), | ||
| 370 | 'fg-hover-slide-left' => __( 'Slide Left', 'foogallery' ), | ||
| 371 | 'fg-hover-slide-right' => __( 'Slide Right', 'foogallery' ), | ||
| 372 | 'fg-hover-push' => __( 'Push', 'foogallery' ) ) | ||
| 373 | ), | ||
| 374 | 'desc' => __( 'Choose what effect is used to show the caption when you hover over a thumbnail', 'foogallery' ), | ||
| 375 | 'row_data' => array( | ||
| 376 | 'data-foogallery-change-selector' => 'select', | ||
| 377 | 'data-foogallery-hidden' => true, | ||
| 378 | 'data-foogallery-show-when-field' => 'hover_effect_preset', | ||
| 379 | 'data-foogallery-show-when-field-value' => 'fg-custom', | ||
| 380 | 'data-foogallery-preview' => 'class' | ||
| 381 | ) | ||
| 382 | ); | ||
| 383 | |||
| 384 | $fields[] = array( | ||
| 385 | 'id' => 'hover_effect_icon', | ||
| 386 | 'title' => __( 'Icon', 'foogallery' ), | ||
| 387 | 'desc' => __( 'Choose which icon is shown with the caption when you hover over a thumbnail', 'foogallery' ), | ||
| 388 | 'section' => __( 'Hover Effects', 'foogallery' ), | ||
| 389 | 'type' => 'htmlicon', | ||
| 390 | 'default' => 'fg-hover-zoom', | ||
| 391 | 'choices' => apply_filters( 'foogallery_gallery_template_common_thumbnail_fields_hover_effect_icon_choices', array( | ||
| 392 | '' => array( 'label' => __( 'None', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon"></div>' ), | ||
| 393 | 'fg-hover-zoom' => array( 'label' => __( 'Zoom', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom"></div>' ), | ||
| 394 | 'fg-hover-zoom2' => array( 'label' => __( 'Zoom 2', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom2"></div>' ), | ||
| 395 | 'fg-hover-zoom3' => array( 'label' => __( 'Zoom 3', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-zoom3"></div>' ), | ||
| 396 | 'fg-hover-plus' => array( 'label' => __( 'Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-plus"></div>' ), | ||
| 397 | 'fg-hover-circle-plus' => array( 'label' => __( 'Circle Plus', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-circle-plus"></div>' ), | ||
| 398 | 'fg-hover-eye' => array( 'label' => __( 'Eye', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-eye"></div>' ), | ||
| 399 | 'fg-hover-external' => array( 'label' => __( 'External', 'foogallery' ), 'html' => '<div class="foogallery-setting-caption_icon fg-hover-external"></div>' ), ) | ||
| 400 | ), | ||
| 401 | 'row_data' => array( | ||
| 402 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 403 | 'data-foogallery-hidden' => true, | ||
| 404 | 'data-foogallery-show-when-field' => 'hover_effect_preset', | ||
| 405 | 'data-foogallery-show-when-field-value' => 'fg-custom', | ||
| 406 | 'data-foogallery-preview' => 'class' | ||
| 407 | ) | ||
| 408 | ); | ||
| 409 | //endregion Hover Effects Fields | ||
| 410 | |||
| 411 | //region Caption Fields | ||
| 412 | $fields[] = array( | ||
| 413 | 'id' => 'captions_help', | ||
| 414 | 'title' => __( 'Captions Help', 'foogallery' ), | ||
| 415 | 'desc' => __( 'You can change when captions are shown using the "Hover Effects -> Caption Visibility" setting .', 'foogallery' ), | ||
| 416 | 'section' => __( 'Captions', 'foogallery' ), | ||
| 417 | 'type' => 'help' | ||
| 418 | ); | ||
| 419 | |||
| 420 | $settings_link = sprintf( '<a target="blank" href="%s">%s</a>', foogallery_admin_settings_url(), __( 'settings', 'foogallery' ) ); | ||
| 421 | |||
| 422 | $fields[] = array( | ||
| 423 | 'id' => 'caption_title_source', | ||
| 424 | 'title' => __( 'Title', 'foogallery' ), | ||
| 425 | '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' ), | ||
| 426 | 'section' => __( 'Captions', 'foogallery' ), | ||
| 427 | 'type' => 'radio', | ||
| 428 | 'default' => '', | ||
| 429 | 'choices' => array( | ||
| 430 | 'none' => __( 'None', 'foogallery' ), | ||
| 431 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), | ||
| 432 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), | ||
| 433 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), | ||
| 434 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), | ||
| 435 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), | ||
| 436 | ), | ||
| 437 | 'row_data' => array( | ||
| 438 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 439 | 'data-foogallery-preview' => 'shortcode' | ||
| 440 | ) | ||
| 441 | ); | ||
| 442 | |||
| 443 | $fields[] = array( | ||
| 444 | 'id' => 'caption_desc_source', | ||
| 445 | 'title' => __( 'Description', 'foogallery' ), | ||
| 446 | 'desc' => __( 'Decide where captions descriptions are pulled from. By default, the general settings are used, but it can be overridden per gallery', 'foogallery' ), | ||
| 447 | 'section' => __( 'Captions', 'foogallery' ), | ||
| 448 | 'type' => 'radio', | ||
| 449 | 'default' => '', | ||
| 450 | 'choices' => array( | ||
| 451 | 'none' => __( 'None', 'foogallery' ), | ||
| 452 | '' => sprintf( __( 'Default (as per %s)', 'foogallery' ), $settings_link ), | ||
| 453 | 'title' => foogallery_get_attachment_field_friendly_name( 'title' ), | ||
| 454 | 'caption' => foogallery_get_attachment_field_friendly_name( 'caption' ), | ||
| 455 | 'alt' => foogallery_get_attachment_field_friendly_name( 'alt' ), | ||
| 456 | 'desc' => foogallery_get_attachment_field_friendly_name( 'desc' ), | ||
| 457 | ), | ||
| 458 | 'row_data' => array( | ||
| 459 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 460 | 'data-foogallery-preview' => 'shortcode' | ||
| 461 | ) | ||
| 462 | ); | ||
| 463 | |||
| 464 | $fields[] = array( | ||
| 465 | 'id' => 'captions_limit_length', | ||
| 466 | 'title' => __( 'Limit Caption Length', 'foogallery' ), | ||
| 467 | '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' ), | ||
| 468 | 'section' => __( 'Captions', 'foogallery' ), | ||
| 469 | 'default' => '', | ||
| 470 | 'type' => 'radio', | ||
| 471 | 'spacer' => '<span class="spacer"></span>', | ||
| 472 | 'choices' => array( | ||
| 473 | '' => __( 'No', 'foogallery' ), | ||
| 474 | 'yes' => __( 'Yes', 'foogallery' ), | ||
| 475 | ), | ||
| 476 | 'row_data'=> array( | ||
| 477 | 'data-foogallery-change-selector' => 'input:radio', | ||
| 478 | 'data-foogallery-preview' => 'shortcode', | ||
| 479 | 'data-foogallery-value-selector' => 'input:checked', | ||
| 480 | ) | ||
| 481 | ); | ||
| 482 | |||
| 483 | $fields[] = array( | ||
| 484 | 'id' => 'caption_title_length', | ||
| 485 | 'title' => __( 'Max Title Length', 'foogallery' ), | ||
| 486 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery '), | ||
| 487 | 'section' => __( 'Captions', 'foogallery' ), | ||
| 488 | 'type' => 'number', | ||
| 489 | 'class' => 'small-text', | ||
| 490 | 'default' => 0, | ||
| 491 | 'step' => '1', | ||
| 492 | 'min' => '0', | ||
| 493 | 'row_data' => array( | ||
| 494 | 'data-foogallery-change-selector' => 'input', | ||
| 495 | 'data-foogallery-hidden' => true, | ||
| 496 | 'data-foogallery-show-when-field' => 'captions_limit_length', | ||
| 497 | 'data-foogallery-show-when-field-value' => 'yes', | ||
| 498 | 'data-foogallery-preview' => 'shortcode' | ||
| 499 | ) | ||
| 500 | ); | ||
| 501 | |||
| 502 | $fields[] = array( | ||
| 503 | 'id' => 'caption_desc_length', | ||
| 504 | 'title' => __( 'Max Desc Length', 'foogallery' ), | ||
| 505 | 'desc' => __( 'A max length of zero will not apply a limit.', 'foogallery '), | ||
| 506 | 'section' => __( 'Captions', 'foogallery' ), | ||
| 507 | 'type' => 'number', | ||
| 508 | 'class' => 'small-text', | ||
| 509 | 'default' => 0, | ||
| 510 | 'step' => '1', | ||
| 511 | 'min' => '0', | ||
| 512 | 'row_data' => array( | ||
| 513 | 'data-foogallery-change-selector' => 'input', | ||
| 514 | 'data-foogallery-hidden' => true, | ||
| 515 | 'data-foogallery-show-when-field' => 'captions_limit_length', | ||
| 516 | 'data-foogallery-show-when-field-value' => 'yes', | ||
| 517 | 'data-foogallery-preview' => 'shortcode' | ||
| 518 | ) | ||
| 519 | ); | ||
| 520 | //endregion | ||
| 521 | |||
| 522 | } | ||
| 523 | return $fields; | ||
| 524 | } | ||
| 525 | |||
| 674 | } | 
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.