PluginProbe ʕ •ᴥ•ʔ
Slider, Gallery, and Carousel by MetaSlider – Image Slider, Video Slider / 3.108.0
Slider, Gallery, and Carousel by MetaSlider – Image Slider, Video Slider v3.108.0
3.109.0 3.27.10 3.27.11 3.27.12 3.27.13 3.27.14 3.27.2 3.27.3 3.27.4 3.27.5 3.27.6 3.27.7 3.27.8 3.27.9 3.27.9-beta.2 3.27.9-beta.3 3.28.0 3.28.1 3.28.2 3.28.3 3.29.0 3.29.1 3.3.1 3.3.2 3.3.3 3.3.4 3.3.4.1 3.3.5 3.3.6 3.3.7 3.30.0 3.30.1 3.31.0 3.32.0 3.33.0 3.34.0 3.35.0 3.36.0 3.37.0 3.4 3.4.1 3.4.2 3.4.3 3.40.0 3.5 3.5.1 3.50.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.5 3.6.6 3.6.7 3.6.8 3.60.0 3.60.1 3.61.0 3.62.0 3.7.0 3.7.1 3.7.2 3.70.0 3.70.1 3.70.2 3.8.0 3.8.1 3.80.0 3.9.0 3.9.1 3.90.0 3.90.1 3.91.0 3.92.0 3.92.1 3.93.0 3.94.0 3.95.0 3.96.0 3.97.0 3.98.0 3.99.0 3.107.0 3.108.0 3.11.0 3.11.1 3.12.1 3.13.0 3.13.1 3.14.0 3.15.0 3.15.1 3.15.2 3.15.3 3.16.0 3.16.1 3.16.2 3.16.4 3.17.0 3.17.1 3.17.2 3.17.3 3.17.4 3.17.5 3.17.6 3.18.0 3.18.1 3.18.2 3.18.3 3.18.4 3.18.5 3.18.6 3.18.7 3.18.8 3.18.9 3.19.0 3.19.1 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 3.21.0 3.22.0 3.22.1 3.23.0 3.23.1 3.23.2 3.23.3 3.23.4 3.23.5 3.24.0 3.25.0 3.25.1 3.25.2 3.26.0 3.27.0 3.27.1 trunk 1.0 1.0.1 1.1 1.2.1 1.3 2.0.2 2.1.6 2.2.2 2.3 2.4.2 2.5.1 2.6.3 2.7.2 2.8.1 2.9.1 3.0.1 3.1.1 3.10.0 3.10.1 3.10.2 3.10.3 3.100.0 3.100.1 3.101.0 3.102.0 3.103.0 3.104.0 3.105.0 3.106.0
ml-slider / admin / slideshows / Settings.php
ml-slider / admin / slideshows Last commit date
slides 11 months ago Image.php 3 months ago Settings.php 1 month ago Slideshows.php 1 month ago Themes.php 2 months ago bootstrap.php 3 years ago
Settings.php
203 lines
1 <?php
2
3 if (!defined('ABSPATH')) {
4 die('No direct access.');
5 }
6
7 /**
8 * Class to handle individual slideshow settings
9 */
10 class MetaSlider_Slideshow_Settings
11 {
12 /**
13 * Themes class
14 *
15 * @var object | bool
16 */
17 private $settings;
18
19 /**
20 * Constructor
21 *
22 * @param string|null $slideshow_id The settings object
23 */
24 public function __construct($slideshow_id = null)
25 {
26 $this->settings = get_post_meta($slideshow_id, 'ml-slider_settings', true);
27 }
28
29 /**
30 * Returns settings
31 *
32 * @return object
33 */
34 public function get_settings()
35 {
36 return $this->settings ? $this->settings : self::defaults();
37 }
38
39 /**
40 * Returns a single setting
41 *
42 * @param string $setting A single setting name
43 *
44 * @return mixed|WP_error The setting result or an error object
45 */
46 public function get_single($setting)
47 {
48 return isset($this->settings[$setting]) ? $this->settings[$setting] : new WP_Error('invalid_setting', 'The setting was not found', array('status' => 404));
49 }
50
51 /**
52 * Returns the default settings
53 *
54 * @return array
55 */
56 public static function defaults()
57 {
58 $defaults = array(
59 'title' => __('New Slideshow', 'ml-slider'),
60 'type' => 'flex',
61 'random' => false,
62 'cssClass' => '',
63 'printCss' => true,
64 'printJs' => true,
65 'width' => 700,
66 'height' => 300,
67 'spw' => 7,
68 'sph' => 5,
69 'delay' => 3000,
70 'sDelay' => 30,
71 'opacity' => 0.7,
72 'titleSpeed' => 500,
73 'effect' => 'slide',
74 'extra_effect' => 'none',
75 'navigation' => true,
76 'filmstrip_delay' => 7000,
77 'filmstrip_animationSpeed' => 600,
78 'links' => true,
79 'hoverPause' => true,
80 'theme' => 'none',
81 'direction' => 'horizontal',
82 'reverse' => false,
83 'keyboard' => true,
84 'touch' => true,
85 'animationSpeed' => 600,
86 'prevText' => __('Previous', 'ml-slider'),
87 'nextText' => __('Next', 'ml-slider'),
88 'slices' => 15,
89 'center' => false,
90 'smartCrop' => true,
91 'smartCropSource' => 'slideshow',
92 'imageWidth' => 400,
93 'imageHeight' => 400,
94 'cropMultiply' => 1,
95 'smoothHeight' => false,
96 'carouselMode' => false,
97 'infiniteLoop' => false,
98 'carouselMargin' => 5,
99 'minItems' => 2,
100 'maxItems' => 0,
101 'forceHeight' => false,
102 'firstSlideFadeIn' => false,
103 'easing' => 'linear',
104 'autoPlay' => true,
105 'loop' => 'continuously',
106 'thumb_width' => 150,
107 'thumb_height' => 100,
108 'responsive_thumbs' => true,
109 'thumb_min_width' => 100,
110 'thumb_layout' => 'grid',
111 'fullWidth' => true,
112 'forceFullWidth' => false,
113 'fullWidthTarget' => 'body',
114 'noConflict' => true,
115 'mobileArrows_smartphone' => false,
116 'mobileArrows_tablet' => false,
117 'mobileArrows_laptop' => false,
118 'mobileArrows_desktop' => false,
119 'mobileNavigation_smartphone' => false,
120 'mobileNavigation_tablet' => false,
121 'mobileNavigation_laptop' => false,
122 'mobileNavigation_desktop' => false,
123 'mobileCaption_smartphone' => false,
124 'mobileCaption_tablet' => false,
125 'mobileCaption_laptop' => false,
126 'mobileCaption_desktop' => false,
127 'mobileSlideshow_smartphone' => false,
128 'mobileSlideshow_tablet' => false,
129 'mobileSlideshow_laptop' => false,
130 'mobileSlideshow_desktop' => false,
131 'ariaLive' => true,
132 'ariaCurrent' => true,
133 'tabIndex' => true,
134 'pausePlay' => false,
135 'progressBar' => false,
136 'loading' => false,
137 'lazyLoad' => false,
138 'playText' => '',
139 'pauseText' => '',
140 'container' => false,
141 'container_background' => 'rgba(255,255,255,0)',
142 'containerPadding_top' => 10,
143 'containerPadding_right' => 10,
144 'containerPadding_bottom' => 10,
145 'containerPadding_left' => 10,
146 'containerMargin_top' => 10,
147 'containerMargin_bottom' => 30,
148 'navStep' => 1
149 );
150 $defaults = apply_filters('metaslider_default_parameters', $defaults);
151 $overrides = get_option('metaslider_default_settings');
152 return is_array($overrides) ? array_merge($defaults, $overrides) : $defaults;
153 }
154
155 /**
156 * Convert 'on' or 'off' to boolean values
157 *
158 * @since 3.92
159 *
160 * @param array $settings Slideshow settings
161 *
162 * @return array
163 */
164 public static function adjust_settings($settings)
165 {
166 // Convert submitted checkbox values from 'on' or 'off' to boolean values in string format (e.g. true becomes 'true')
167 $checkboxes = array('noConflict', 'fullWidth', 'forceFullWidth', 'hoverPause', 'reverse', 'printCss', 'printJs', 'smoothHeight', 'center', 'carouselMode', 'autoPlay', 'firstSlideFadeIn', 'responsive_thumbs', 'keyboard', 'touch', 'infiniteLoop', 'mobileArrows_smartphone', 'mobileArrows_tablet','mobileArrows_laptop', 'mobileArrows_desktop', 'mobileNavigation_smartphone', 'mobileNavigation_tablet', 'mobileNavigation_laptop', 'mobileNavigation_desktop', 'mobileCaption_smartphone', 'mobileCaption_tablet', 'mobileCaption_laptop', 'mobileCaption_desktop', 'mobileSlideshow_smartphone', 'mobileSlideshow_tablet', 'mobileSlideshow_laptop', 'mobileSlideshow_desktop', 'ariaLive', 'tabIndex', 'pausePlay', 'showPlayText', 'ariaCurrent', 'progressBar', 'loading', 'lazyLoad', 'forceHeight', 'lightbox', 'container');
168
169 foreach ($checkboxes as $checkbox) {
170 $settings[$checkbox] = (isset($settings[$checkbox]) && 'on' == $settings[$checkbox]) ? 'true' : 'false';
171 }
172
173 /* Convert submitted dropdown values from 'on' or 'off' to boolean values in string format (e.g. true becomes 'true') and sanitize the rest
174 * Reason is these settings have true/false + string options, so is better to handle all as strings
175 * Keep original value if is different to 'on' and 'off'.
176 * We include actual booleans in $map just in case. */
177 $dropdowns = array('effect', 'cropMultiply', 'direction', 'easing', 'links', 'navigation', 'smartCrop', 'random', 'loop', 'layer_scaling');
178
179 foreach ($dropdowns as $dropdown) {
180 if (isset($settings[$dropdown])) {
181 $map = array(
182 'on' => 'true',
183 'off' => 'false',
184 true => 'true',
185 false => 'false'
186 );
187 $settings[$dropdown] = $map[$settings[$dropdown]] ?? sanitize_text_field($settings[$dropdown]);
188 }
189 }
190
191 // Sanitize text fields
192 $texts = array('cssClass', 'nextText', 'prevText', 'playText', 'pauseText');
193
194 foreach ($texts as $text) {
195 if (isset($settings[$text])) {
196 $settings[$text] = sanitize_text_field($settings[$text]);
197 }
198 }
199
200 return $settings;
201 }
202 }
203