PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.3.0
Gallery : FooGallery v3.3.0
3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / class-foogallery-no-javascript-fallback.php
foogallery / includes Last commit date
abilities 1 week ago admin 1 week ago compatibility 1 week ago extensions 1 week ago foopluginbase 1 week ago public 1 week ago thumbs 1 week ago asset-manifest.php 1 week ago class-attachment-filters.php 1 week ago class-command-palette.php 1 week ago class-foogallery-animated-gif-support.php 1 week ago class-foogallery-attachment-custom-class.php 1 week ago class-foogallery-attachment-filename.php 1 week ago class-foogallery-attachment-type.php 1 week ago class-foogallery-attachment.php 1 week ago class-foogallery-cache.php 1 week ago class-foogallery-common-fields.php 1 week ago class-foogallery-crop-position.php 1 week ago class-foogallery-datasource-media_library.php 1 week ago class-foogallery-debug.php 1 week ago class-foogallery-delayed-runtime-loader.php 1 week ago class-foogallery-extensions-compatibility.php 1 week ago class-foogallery-force-https.php 1 week ago class-foogallery-lazyload.php 1 week ago class-foogallery-license-constant-handler.php 1 week ago class-foogallery-lightbox.php 1 week ago class-foogallery-no-javascript-fallback.php 1 week ago class-foogallery-paging.php 1 week ago class-foogallery-password-protect.php 1 week ago class-foogallery-sitemaps.php 1 week ago class-foogallery-widget.php 1 week ago class-foogallery.php 1 week ago class-gallery-advanced-settings.php 1 week ago class-il8n.php 1 week ago class-override-thumbnail.php 1 week ago class-posttypes.php 1 week ago class-previews.php 1 week ago class-retina.php 1 week ago class-thumbnail-dimensions.php 1 week ago class-thumbnails.php 1 week ago class-version-check.php 1 week ago constants.php 1 week ago functions.php 1 week ago gallery-management-functions.php 1 week ago includes.php 1 week ago index.php 1 week ago render-functions.php 1 week ago
class-foogallery-no-javascript-fallback.php
75 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * Handles the no-JavaScript thumbnail fallback for gallery containers.
9 */
10 if ( ! class_exists( 'FooGallery_No_Javascript_Fallback' ) ) {
11
12 /**
13 * Class FooGallery_No_Javascript_Fallback
14 */
15 class FooGallery_No_Javascript_Fallback {
16
17 /**
18 * FooGallery_No_Javascript_Fallback constructor.
19 */
20 public function __construct() {
21 add_filter( 'foogallery_build_class_attribute', array( $this, 'add_container_class' ) );
22 add_filter( 'foogallery_admin_settings_override', array( $this, 'add_setting' ), 20 );
23 }
24
25 /**
26 * Add the no-JavaScript fallback class to the gallery container.
27 *
28 * @param array $classes The list of gallery container classes.
29 *
30 * @return array The gallery container classes.
31 */
32 public function add_container_class( $classes ) {
33 if ( 'on' !== foogallery_get_setting( 'disable_no_js_thumbnail_fallback' ) ) {
34 $classes[] = 'fg-no-js';
35 }
36
37 return $classes;
38 }
39
40 /**
41 * Add the global no-JavaScript thumbnail fallback setting.
42 *
43 * @param array $settings The global FooGallery settings configuration.
44 *
45 * @return array The global FooGallery settings configuration.
46 */
47 public function add_setting( $settings ) {
48 $fallback_setting = array(
49 'id' => 'disable_no_js_thumbnail_fallback',
50 'title' => __( 'Disable No-JavaScript Thumbnail Fallback', 'foogallery' ),
51 'desc' => __( 'Thumbnails normally remain visible if a gallery cannot start properly. Enable this setting to turn off that fallback. If a gallery fails to start, its thumbnails may remain hidden.', 'foogallery' ),
52 'type' => 'checkbox',
53 'tab' => 'advanced',
54 'section' => __( 'Gallery Loading & Compatibility', 'foogallery' ),
55 );
56
57 if ( ! isset( $settings['settings'] ) || ! is_array( $settings['settings'] ) ) {
58 $settings['settings'] = array();
59 }
60
61 foreach ( $settings['settings'] as $index => $setting ) {
62 if ( isset( $setting['tab'] ) && 'advanced' === $setting['tab'] ) {
63 array_splice( $settings['settings'], $index, 0, array( $fallback_setting ) );
64
65 return $settings;
66 }
67 }
68
69 $settings['settings'][] = $fallback_setting;
70
71 return $settings;
72 }
73 }
74 }
75