PluginProbe ʕ •ᴥ•ʔ
Responsive Lightbox & Gallery / 2.1
Responsive Lightbox & Gallery v2.1
2.7.8 trunk 1.0.0 1.0.1 1.0.1.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4.0 1.4.0.1 1.4.1 1.4.11 1.4.12 1.4.13 1.4.14 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3.1 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7
responsive-lightbox / includes / class-settings.php
responsive-lightbox / includes Last commit date
class-fast-image.php 7 years ago class-folders-walker.php 7 years ago class-folders.php 7 years ago class-frontend.php 7 years ago class-galleries.php 7 years ago class-settings.php 7 years ago class-tour.php 7 years ago class-welcome.php 7 years ago class-widgets.php 7 years ago functions.php 7 years ago
class-settings.php
2427 lines
1 <?php
2 // exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) )
4 exit;
5
6 new Responsive_Lightbox_Settings();
7
8 /**
9 * Responsive Lightbox settings class.
10 *
11 * @class Responsive_Lightbox_Settings
12 */
13 class Responsive_Lightbox_Settings {
14
15 public $settings = array();
16 public $tabs = array();
17 public $scripts = array();
18
19 public function __construct() {
20
21 // set instance
22 Responsive_Lightbox()->settings = $this;
23
24 // actions
25 add_action( 'admin_init', array( $this, 'register_settings' ) );
26 add_action( 'admin_menu', array( $this, 'admin_menu_options' ) );
27 add_action( 'after_setup_theme', array( $this, 'load_defaults' ) );
28 add_action( 'init', array( $this, 'init_builder' ) );
29 }
30
31 /**
32 * Initialize additional stuff for builder.
33 *
34 * @return void
35 */
36 public function init_builder() {
37 // add categories
38 if ( Responsive_Lightbox()->options['builder']['gallery_builder'] && Responsive_Lightbox()->options['builder']['categories'] && Responsive_Lightbox()->options['builder']['archives'] ) {
39 $terms = get_terms( array( 'taxonomy' => 'rl_category', 'hide_empty' => false ) );
40
41 if ( ! empty( $terms ) ) {
42 foreach ( $terms as $term ) {
43 $this->settings['builder']['fields']['archives_category']['options'][$term->slug] = $term->name;
44 }
45 }
46 }
47
48 // flush rewrite rules if needed
49 if ( isset( $_GET['flush_rules'] ) )
50 flush_rewrite_rules();
51 }
52
53 /**
54 * Load default settings.
55 *
56 * @return void
57 */
58 public function load_defaults() {
59 $this->scripts = apply_filters( 'rl_settings_scripts', array(
60 'swipebox' => array(
61 'name' => __( 'SwipeBox', 'responsive-lightbox' ),
62 'animations' => array(
63 'css' => __( 'CSS', 'responsive-lightbox' ),
64 'jquery' => __( 'jQuery', 'responsive-lightbox' )
65 ),
66 'supports' => array( 'title' )
67 ),
68 'prettyphoto' => array(
69 'name' => __( 'prettyPhoto', 'responsive-lightbox' ),
70 'animation_speeds' => array(
71 'slow' => __( 'slow', 'responsive-lightbox' ),
72 'normal' => __( 'normal', 'responsive-lightbox' ),
73 'fast' => __( 'fast', 'responsive-lightbox' )
74 ),
75 'themes' => array(
76 'pp_default' => __( 'default', 'responsive-lightbox' ),
77 'light_rounded' => __( 'light rounded', 'responsive-lightbox' ),
78 'dark_rounded' => __( 'dark rounded', 'responsive-lightbox' ),
79 'light_square' => __( 'light square', 'responsive-lightbox' ),
80 'dark_square' => __( 'dark square', 'responsive-lightbox' ),
81 'facebook' => __( 'facebook', 'responsive-lightbox' )
82 ),
83 'wmodes' => array(
84 'window' => __( 'window', 'responsive-lightbox' ),
85 'transparent' => __( 'transparent', 'responsive-lightbox' ),
86 'opaque' => __( 'opaque', 'responsive-lightbox' ),
87 'direct' => __( 'direct', 'responsive-lightbox' ),
88 'gpu' => __( 'gpu', 'responsive-lightbox' )
89 ),
90 'supports' => array( 'inline', 'iframe', 'ajax', 'title', 'caption' )
91 ),
92 'fancybox' => array(
93 'name' => __( 'FancyBox', 'responsive-lightbox' ),
94 'transitions' => array(
95 'elastic' => __( 'elastic', 'responsive-lightbox' ),
96 'fade' => __( 'fade', 'responsive-lightbox' ),
97 'none' => __( 'none', 'responsive-lightbox' )
98 ),
99 'scrollings' => array(
100 'auto' => __( 'auto', 'responsive-lightbox' ),
101 'yes' => __( 'yes', 'responsive-lightbox' ),
102 'no' => __( 'no', 'responsive-lightbox' )
103 ),
104 'easings' => array(
105 'swing' => __( 'swing', 'responsive-lightbox' ),
106 'linear' => __( 'linear', 'responsive-lightbox' )
107 ),
108 'positions' => array(
109 'outside' => __( 'outside', 'responsive-lightbox' ),
110 'inside' => __( 'inside', 'responsive-lightbox' ),
111 'over' => __( 'over', 'responsive-lightbox' )
112 ),
113 'supports' => array( 'inline', 'iframe', 'ajax', 'title' )
114 ),
115 'nivo' => array(
116 'name' => __( 'Nivo Lightbox', 'responsive-lightbox' ),
117 'effects' => array(
118 'fade' => __( 'fade', 'responsive-lightbox' ),
119 'fadeScale' => __( 'fade scale', 'responsive-lightbox' ),
120 'slideLeft' => __( 'slide left', 'responsive-lightbox' ),
121 'slideRight' => __( 'slide right', 'responsive-lightbox' ),
122 'slideUp' => __( 'slide up', 'responsive-lightbox' ),
123 'slideDown' => __( 'slide down', 'responsive-lightbox' ),
124 'fall' => __( 'fall', 'responsive-lightbox' )
125 ),
126 'supports' => array( 'inline', 'iframe', 'ajax', 'title' )
127 ),
128 'imagelightbox' => array(
129 'name' => __( 'Image Lightbox', 'responsive-lightbox' ),
130 'supports' => array()
131 ),
132 'tosrus' => array(
133 'name' => __( 'TosRUs', 'responsive-lightbox' ),
134 'supports' => array( 'inline', 'title' )
135 ),
136 'featherlight' => array(
137 'name' => __( 'Featherlight', 'responsive-lightbox' ),
138 'supports' => array( 'inline', 'iframe', 'ajax' )
139 ),
140 'magnific' => array(
141 'name' => __( 'Magnific Popup', 'responsive-lightbox' ),
142 'supports' => array( 'inline', 'iframe', 'ajax', 'title', 'caption' )
143 )
144 ) );
145
146 $this->image_titles = array(
147 'default' => __( 'None', 'responsive-lightbox' ),
148 'title' => __( 'Image Title', 'responsive-lightbox' ),
149 'caption' => __( 'Image Caption', 'responsive-lightbox' ),
150 'alt' => __( 'Image Alt Text', 'responsive-lightbox' ),
151 'description' => __( 'Image Description', 'responsive-lightbox' )
152 );
153
154 $this->image_icons = array(
155 '0' => __( 'none', 'responsive-lightbox' ),
156 '1' => '',
157 '2' => '',
158 '3' => '',
159 '4' => '',
160 '5' => '',
161 '6' => '',
162 '7' => '',
163 '8' => '',
164 '9' => '',
165 '10' => ''
166 );
167
168 // get scripts
169 foreach ( $this->scripts as $key => $value ) {
170 $scripts[$key] = $value['name'];
171 }
172
173 // get image sizes
174 $sizes = apply_filters( 'image_size_names_choose', array(
175 'thumbnail' => __( 'Thumbnail', 'responsive-lightbox' ),
176 'medium' => __( 'Medium', 'responsive-lightbox' ),
177 'large' => __( 'Large', 'responsive-lightbox' ),
178 'full' => __( 'Full Size', 'responsive-lightbox' ),
179 ) );
180
181 // prepare galeries
182 $galleries = $builder_galleries = wp_parse_args( apply_filters( 'rl_gallery_types', array() ), Responsive_Lightbox()->gallery_types );
183
184 unset( $builder_galleries['default'] );
185
186 $this->settings = array(
187 'settings' => array(
188 'option_group' => 'responsive_lightbox_settings',
189 'option_name' => 'responsive_lightbox_settings',
190 'sections' => array(
191 'responsive_lightbox_settings' => array(
192 'title' => __( 'General settings', 'responsive-lightbox' )
193 )
194 ),
195 'prefix' => 'rl',
196 'fields' => array(
197 'tour' => array(
198 'title' => __( 'Introduction Tour', 'responsive-lightbox' ),
199 'section' => 'responsive_lightbox_settings',
200 'type' => 'button',
201 'label' => __( 'Start Tour', 'responsive-lightbox' ),
202 'description' => __( 'Take this tour to quickly learn about the use of this plugin.', 'responsive-lightbox' )
203 ),
204 'script' => array(
205 'title' => __( 'Default lightbox', 'responsive-lightbox' ),
206 'section' => 'responsive_lightbox_settings',
207 'type' => 'radio',
208 'label' => '',
209 'description' => sprintf(__( 'Select your preferred ligthbox effect script or get our <a href="%s">premium extensions</a>.', 'responsive-lightbox' ), wp_nonce_url( add_query_arg( array( 'action' => 'rl-hide-notice' ), admin_url( 'admin.php?page=responsive-lightbox-addons' ) ), 'rl_action', 'rl_nonce' ) ),
210 'options' => $scripts
211 ),
212 'selector' => array(
213 'title' => __( 'Selector', 'responsive-lightbox' ),
214 'section' => 'responsive_lightbox_settings',
215 'type' => 'text',
216 'description' => __( 'Enter the rel selector lightbox effect will be applied to.', 'responsive-lightbox' )
217 ),
218 'image_links' => array(
219 'title' => __( 'Images', 'responsive-lightbox' ),
220 'section' => 'responsive_lightbox_settings',
221 'type' => 'boolean',
222 'label' => __( 'Enable lightbox for WordPress image links.', 'responsive-lightbox' )
223 ),
224 'image_title' => array(
225 'title' => __( 'Single image title', 'responsive-lightbox' ),
226 'section' => 'responsive_lightbox_settings',
227 'type' => 'select',
228 'description' => __( 'Select title for single images.', 'responsive-lightbox' ),
229 'options' => $this->image_titles
230 ),
231 'image_caption' => array(
232 'title' => __( 'Single image caption', 'responsive-lightbox' ),
233 'section' => 'responsive_lightbox_settings',
234 'type' => 'select',
235 'description' => __( 'Select caption for single images (if supported by selected lightbox and/or gallery).', 'responsive-lightbox' ),
236 'options' => $this->image_titles
237 ),
238 'images_as_gallery' => array(
239 'title' => __( 'Single images as gallery', 'responsive-lightbox' ),
240 'section' => 'responsive_lightbox_settings',
241 'type' => 'boolean',
242 'label' => __( 'Display single post images as a gallery.', 'responsive-lightbox' )
243 ),
244 'galleries' => array(
245 'title' => __( 'Galleries', 'responsive-lightbox' ),
246 'section' => 'responsive_lightbox_settings',
247 'type' => 'boolean',
248 'label' => __( 'Enable lightbox for WordPress image galleries.', 'responsive-lightbox' )
249 ),
250 'default_gallery' => array(
251 'title' => __( 'WordPress gallery', 'responsive-lightbox' ),
252 'section' => 'responsive_lightbox_settings',
253 'type' => 'radio',
254 'description' => __( 'Select your preferred default WordPress gallery style.', 'responsive-lightbox' ),
255 'options' => $galleries
256 ),
257 'builder_gallery' => array(
258 'title' => __( 'Builder gallery', 'responsive-lightbox' ),
259 'section' => 'responsive_lightbox_settings',
260 'type' => 'radio',
261 'description' => __( 'Select your preferred default builder gallery style.', 'responsive-lightbox' ),
262 'options' => $builder_galleries
263 ),
264 'default_woocommerce_gallery' => array(
265 'title' => __( 'WooCommerce gallery', 'responsive-lightbox' ),
266 'section' => 'responsive_lightbox_settings',
267 'type' => 'radio',
268 'disabled' => ! class_exists( 'WooCommerce' ),
269 'description' => __( 'Select your preferred gallery style for WooCommerce product gallery.', 'responsive-lightbox' ),
270 'options' => $galleries
271 ),
272 'gallery_image_size' => array(
273 'title' => __( 'Gallery image size', 'responsive-lightbox' ),
274 'section' => 'responsive_lightbox_settings',
275 'type' => 'select',
276 'description' => __( 'Select image size for gallery image links.', 'responsive-lightbox' ),
277 'options' => $sizes
278 ),
279 'gallery_image_title' => array(
280 'title' => __( 'Gallery image title', 'responsive-lightbox' ),
281 'section' => 'responsive_lightbox_settings',
282 'type' => 'select',
283 'description' => __( 'Select title for the gallery images.', 'responsive-lightbox' ),
284 'options' => $this->image_titles
285 ),
286 'gallery_image_caption' => array(
287 'title' => __( 'Gallery image caption', 'responsive-lightbox' ),
288 'section' => 'responsive_lightbox_settings',
289 'type' => 'select',
290 'description' => __( 'Select caption for the gallery images (if supported by selected lightbox and/or gallery).', 'responsive-lightbox' ),
291 'options' => $this->image_titles
292 ),
293 'videos' => array(
294 'title' => __( 'Videos', 'responsive-lightbox' ),
295 'section' => 'responsive_lightbox_settings',
296 'type' => 'boolean',
297 'label' => __( 'Enable lightbox for YouTube and Vimeo video links.', 'responsive-lightbox' )
298 ),
299 'widgets' => array(
300 'title' => __( 'Widgets', 'responsive-lightbox' ),
301 'section' => 'responsive_lightbox_settings',
302 'type' => 'boolean',
303 'label' => __( 'Enable lightbox for widgets content.', 'responsive-lightbox' )
304 ),
305 'comments' => array(
306 'title' => __( 'Comments', 'responsive-lightbox' ),
307 'section' => 'responsive_lightbox_settings',
308 'type' => 'boolean',
309 'label' => __( 'Enable lightbox for comments content.', 'responsive-lightbox' )
310 ),
311 'force_custom_gallery' => array(
312 'title' => __( 'Force lightbox', 'responsive-lightbox' ),
313 'section' => 'responsive_lightbox_settings',
314 'type' => 'boolean',
315 'label' => __( 'Try to force lightbox for custom WP gallery replacements, like Jetpack or Visual Composer galleries.', 'responsive-lightbox' )
316 ),
317 'woocommerce_gallery_lightbox' => array(
318 'title' => __( 'WooCommerce lightbox', 'responsive-lightbox' ),
319 'section' => 'responsive_lightbox_settings',
320 'type' => 'boolean',
321 'label' => __( 'Replace WooCommerce product gallery lightbox.', 'responsive-lightbox' ),
322 'disabled' => ! class_exists( 'WooCommerce' )
323 ),
324 'enable_custom_events' => array(
325 'title' => __( 'Custom events', 'responsive-lightbox' ),
326 'section' => 'responsive_lightbox_settings',
327 'type' => 'multiple',
328 'fields' => array(
329 'enable_custom_events' => array(
330 'type' => 'boolean',
331 'label' => __( 'Enable triggering lightbox on custom jQuery events.', 'responsive-lightbox' )
332 ),
333 'custom_events' => array(
334 'type' => 'text',
335 'description' => __( 'Enter a space separated list of events.', 'responsive-lightbox' )
336 )
337 )
338 ),
339 'loading_place' => array(
340 'title' => __( 'Loading place', 'responsive-lightbox' ),
341 'section' => 'responsive_lightbox_settings',
342 'type' => 'radio',
343 'description' => __( 'Select where all the lightbox scripts should be placed.', 'responsive-lightbox' ),
344 'options' => array(
345 'header' => __( 'Header', 'responsive-lightbox' ),
346 'footer' => __( 'Footer', 'responsive-lightbox' )
347 )
348 ),
349 'conditional_loading' => array(
350 'title' => __( 'Conditional loading', 'responsive-lightbox' ),
351 'section' => 'responsive_lightbox_settings',
352 'type' => 'boolean',
353 'label' => __( 'Enable to load scripts and styles only on pages that have images or galleries in post content.', 'responsive-lightbox' )
354 ),
355 'deactivation_delete' => array(
356 'title' => __( 'Delete data', 'responsive-lightbox' ),
357 'section' => 'responsive_lightbox_settings',
358 'type' => 'boolean',
359 'label' => __( 'Delete all plugin settings on deactivation.', 'responsive-lightbox' )
360 )
361 )
362 ),
363 'builder' => array(
364 'option_group' => 'responsive_lightbox_builder',
365 'option_name' => 'responsive_lightbox_builder',
366 'sections' => array(
367 'responsive_lightbox_builder' => array(
368 'title' => __( 'Gallery Builder Settings', 'responsive-lightbox' )
369 )
370 ),
371 'prefix' => 'rl',
372 'fields' => array(
373 'gallery_builder' => array(
374 'title' => __( 'Gallery Builder', 'responsive-lightbox' ),
375 'section' => 'responsive_lightbox_builder',
376 'type' => 'boolean',
377 'label' => __( 'Enable advanced gallery builder.', 'responsive-lightbox' )
378 ),
379 'categories' => array(
380 'title' => __( 'Categories', 'responsive-lightbox' ),
381 'section' => 'responsive_lightbox_builder',
382 'type' => 'boolean',
383 'label' => __( 'Enable Gallery Categories.', 'responsive-lightbox' ),
384 'description' => __( 'Enable if you want to use Gallery Categories.', 'responsive-lightbox' )
385 ),
386 'tags' => array(
387 'title' => __( 'Tags', 'responsive-lightbox' ),
388 'section' => 'responsive_lightbox_builder',
389 'type' => 'boolean',
390 'label' => __( 'Enable Gallery Tags.', 'responsive-lightbox' ),
391 'description' => __( 'Enable if you want to use Gallery Tags.', 'responsive-lightbox' )
392 ),
393 'permalink' => array(
394 'title' => __( 'Gallery Permalink', 'responsive-lightbox' ),
395 'section' => 'responsive_lightbox_builder',
396 'type' => 'text',
397 'description' => '<code>' . site_url() . '/<strong>' . untrailingslashit( esc_html( Responsive_Lightbox()->options['builder']['permalink'] ) ) . '</strong>/</code><br />' . __( 'Enter gallery page slug.', 'responsive-lightbox' )
398 ),
399 'permalink_categories' => array(
400 'title' => __( 'Categories Permalink', 'responsive-lightbox' ),
401 'section' => 'responsive_lightbox_builder',
402 'type' => 'text',
403 'description' => '<code>' . site_url() . '/<strong>' . untrailingslashit( esc_html( Responsive_Lightbox()->options['builder']['permalink_categories'] ) ) . '</strong>/</code><br />' . __( 'Enter gallery categories archive page slug.', 'responsive-lightbox' )
404 ),
405 'permalink_tags' => array(
406 'title' => __( 'Tags Permalink', 'responsive-lightbox' ),
407 'section' => 'responsive_lightbox_builder',
408 'type' => 'text',
409 'description' => '<code>' . site_url() . '/<strong>' . untrailingslashit( esc_html( Responsive_Lightbox()->options['builder']['permalink_tags'] ) ) . '</strong>/</code><br />' . __( 'Enter gallery tags archive page slug.', 'responsive-lightbox' )
410 ),
411 'archives' => array(
412 'title' => __( 'Archives', 'responsive-lightbox' ),
413 'section' => 'responsive_lightbox_builder',
414 'type' => 'boolean',
415 'label' => __( 'Enable gallery archives.', 'responsive-lightbox' )
416 ),
417 'archives_category' => array(
418 'title' => __( 'Archives category', 'responsive-lightbox' ),
419 'section' => 'responsive_lightbox_builder',
420 'type' => 'select',
421 'description' => __( 'Select category for gallery archives.', 'responsive-lightbox' ),
422 'options' => array(
423 'all' => __( 'All', 'responsive-lightbox' )
424 )
425 )
426 )
427 ),
428 'folders' => array(
429 'option_group' => 'responsive_lightbox_folders',
430 'option_name' => 'responsive_lightbox_folders',
431 'sections' => array(
432 'responsive_lightbox_folders' => array(
433 'title' => __( 'Folders Settings', 'responsive-lightbox' )
434 )
435 ),
436 'prefix' => 'rl',
437 'fields' => array(
438 'active' => array(
439 'title' => __( 'Folders', 'responsive-lightbox' ),
440 'section' => 'responsive_lightbox_folders',
441 'type' => 'boolean',
442 'label' => __( 'Enable media folders.', 'responsive-lightbox' )
443 ),
444 'media_taxonomy' => array(
445 'title' => __( 'Folders taxonomy', 'responsive-lightbox' ),
446 'section' => 'responsive_lightbox_folders',
447 'type' => 'select',
448 'description' => __( 'Select taxonomy for the media folders.', 'responsive-lightbox' ) . '<br />' . __( 'If you have ever used custom taxonomies for your attachments you may try to use them as folders. <a id="rl_folders_load_old_taxonomies" href="#">Click here to load them</a>, then select your preferred taxonomy from the dropdown.', 'responsive-lightbox' ),
449 'after_field' => '<span class="spinner"></span>',
450 'options' => array( Responsive_Lightbox()->options['folders']['media_taxonomy'] => Responsive_Lightbox()->options['folders']['media_taxonomy'] . ' (' . __( 'Folders', 'responsive-lightbox' ) . ')' )
451 ),
452 'show_in_menu' => array(
453 'title' => __( 'Show in menu', 'responsive-lightbox' ),
454 'section' => 'responsive_lightbox_folders',
455 'type' => 'boolean',
456 'label' => __( 'Enable to show the taxonomy in the admin menu.', 'responsive-lightbox' )
457 ),
458 'folders_removal' => array(
459 'title' => __( 'Subfolder removal', 'responsive-lightbox' ),
460 'section' => 'responsive_lightbox_folders',
461 'type' => 'boolean',
462 'label' => __( 'Select to remove subfolders when parent folder is deleted.', 'responsive-lightbox' )
463 ),
464 /*
465 'jstree_style' => array(
466 'title' => __( 'Tree style', 'responsive-lightbox' ),
467 'section' => 'responsive_lightbox_folders',
468 'type' => 'select',
469 'description' => __( 'Select the folder\'s tree style.', 'responsive-lightbox' ),
470 'options' => array(
471 'default' => __( 'Default', 'responsive-lightbox' ),
472 'default-dark' => __( 'Dark', 'responsive-lightbox' ),
473 'gray' => __( 'Gray', 'responsive-lightbox' ),
474 'modern' => __( 'Modern', 'responsive-lightbox' )
475 )
476 ),*/
477 'jstree_wholerow' => array(
478 'title' => __( 'Whole row', 'responsive-lightbox' ),
479 'section' => 'responsive_lightbox_folders',
480 'type' => 'boolean',
481 'label' => __( 'Enable to highlight folder\'s row as a clickable area.', 'responsive-lightbox' )
482 )
483 )
484 ),
485 'configuration' => array(
486 'option_group' => 'responsive_lightbox_configuration',
487 'option_name' => 'responsive_lightbox_configuration',
488 'sections' => array(
489 'responsive_lightbox_configuration' => array(
490 'title' => sprintf( __( '%s settings', 'responsive-lightbox' ), ( isset( $this->scripts[Responsive_Lightbox()->options['settings']['script']]['name'] ) ? $this->scripts[Responsive_Lightbox()->options['settings']['script']]['name'] : $this->scripts[Responsive_Lightbox()->defaults['settings']['script']]['name'] ) )
491 ),
492 ),
493 'prefix' => 'rl',
494 'fields' => array(
495 )
496 ),
497 'basicgrid_gallery' => array(
498 'option_group' => 'responsive_lightbox_basicgrid_gallery',
499 'option_name' => 'responsive_lightbox_basicgrid_gallery',
500 'sections' => array(
501 'responsive_lightbox_basicgrid_gallery' => array(
502 'title' => __( 'Basic Grid Gallery settings', 'responsive-lightbox' )
503 )
504 ),
505 'prefix' => 'rl',
506 'fields' => array(
507 'screen_size_columns' => array(
508 'title' => __( 'Screen sizes', 'responsive-lightbox' ),
509 'section' => 'responsive_lightbox_basicgrid_gallery',
510 'type' => 'multiple',
511 'description' => __( 'Number of columns in a gallery depending on the device screen size. (if greater than 0 overrides the Columns option)', 'responsive-lightbox' ),
512 'fields' => array(
513 'columns_lg' => array(
514 'type' => 'number',
515 'min' => 0,
516 'max' => 6,
517 'append' => __( 'large devices / desktops (&ge;1200px)', 'responsive-lightbox' )
518 ),
519 'columns_md' => array(
520 'type' => 'number',
521 'min' => 0,
522 'max' => 6,
523 'append' => __( 'medium devices / desktops (&ge;992px)', 'responsive-lightbox' )
524 ),
525 'columns_sm' => array(
526 'type' => 'number',
527 'min' => 0,
528 'max' => 6,
529 'append' => __( 'small devices / tablets (&ge;768px)', 'responsive-lightbox' )
530 ),
531 'columns_xs' => array(
532 'type' => 'number',
533 'min' => 0,
534 'max' => 6,
535 'append' => __( 'extra small devices / phones (<768px)', 'responsive-lightbox' )
536 )
537 ),
538 ),
539 'gutter' => array(
540 'title' => __( 'Gutter', 'responsive-lightbox' ),
541 'section' => 'responsive_lightbox_basicgrid_gallery',
542 'type' => 'number',
543 'min' => 0,
544 'description' => __( 'Set the pixel width between the columns and rows.', 'responsive-lightbox' ),
545 'append' => 'px'
546 ),
547 'force_height' => array(
548 'title' => __( 'Force height', 'responsive-lightbox' ),
549 'section' => 'responsive_lightbox_basicgrid_gallery',
550 'type' => 'boolean',
551 'label' => __( 'Enable to force the thumbnail row height.', 'responsive-lightbox' )
552 ),
553 'row_height' => array(
554 'title' => __( 'Row height', 'responsive-lightbox' ),
555 'section' => 'responsive_lightbox_basicgrid_gallery',
556 'type' => 'number',
557 'min' => 50,
558 'description' => __( 'Enter the thumbnail row height in pixels (used if Force height is enabled). Defaults to 150px.', 'responsive-lightbox' ),
559 'append' => 'px'
560 )
561 )
562 ),
563 'basicslider_gallery' => array(
564 'option_group' => 'responsive_lightbox_basicslider_gallery',
565 'option_name' => 'responsive_lightbox_basicslider_gallery',
566 'sections' => array(
567 'responsive_lightbox_basicslider_gallery' => array(
568 'title' => __( 'Basic Slider Gallery settings', 'responsive-lightbox' )
569 )
570 ),
571 'prefix' => 'rl',
572 'fields' => array(
573 'adaptive_height' => array(
574 'title' => __( 'Adaptive Height', 'responsive-lightbox' ),
575 'section' => 'responsive_lightbox_basicslider_gallery',
576 'type' => 'boolean',
577 'label' => __( 'The slider height should change on the fly according to the current slide.', 'responsive-lightbox' )
578 ),
579 'loop' => array(
580 'title' => __( 'Loop', 'responsive-lightbox' ),
581 'section' => 'responsive_lightbox_basicslider_gallery',
582 'type' => 'boolean',
583 'label' => __( 'Whether the slider should loop (i.e. the first slide goes to the last, the last slide goes to the first).', 'responsive-lightbox' )
584 ),
585 'captions' => array(
586 'title' => __( 'Captions Position', 'responsive-lightbox' ),
587 'section' => 'responsive_lightbox_basicslider_gallery',
588 'type' => 'select',
589 'description' => __( 'Specifies the position of captions or no captions at all.', 'responsive-lightbox' ),
590 'options' => array(
591 'none' => __( 'None', 'responsive-lightbox' ),
592 'overlay' => __( 'Overlay', 'responsive-lightbox' ),
593 'below' => __( 'Below', 'responsive-lightbox' )
594 )
595 ),
596 'init_single' => array(
597 'title' => __( 'Single Image Slider', 'responsive-lightbox' ),
598 'section' => 'responsive_lightbox_basicslider_gallery',
599 'type' => 'boolean',
600 'label' => __( 'Whether the slider should initialize even if there is only one slide element.', 'responsive-lightbox' )
601 ),
602 'responsive' => array(
603 'title' => __( 'Responsive', 'responsive-lightbox' ),
604 'section' => 'responsive_lightbox_basicslider_gallery',
605 'type' => 'boolean',
606 'label' => __( 'Whether the slider should be responsive.', 'responsive-lightbox' )
607 ),
608 'preload' => array(
609 'title' => __( 'Preload', 'responsive-lightbox' ),
610 'section' => 'responsive_lightbox_basicslider_gallery',
611 'type' => 'select',
612 'description' => __( 'Elements that are preloaded before slider shows.', 'responsive-lightbox' ),
613 'options' => array(
614 'all' => __( 'All', 'responsive-lightbox' ),
615 'visible' => __( 'Only visible', 'responsive-lightbox' )
616 )
617 ),
618 'pager' => array(
619 'title' => __( 'Pager', 'responsive-lightbox' ),
620 'section' => 'responsive_lightbox_basicslider_gallery',
621 'type' => 'boolean',
622 'label' => __( 'Whether the slider should have a pager.', 'responsive-lightbox' )
623 ),
624 'controls' => array(
625 'title' => __( 'Controls', 'responsive-lightbox' ),
626 'section' => 'responsive_lightbox_basicslider_gallery',
627 'type' => 'boolean',
628 'label' => __( 'Whether the slider should have controls (next, previous arrows).', 'responsive-lightbox' )
629 ),
630 'hide_on_end' => array(
631 'title' => __( 'Hide Controls on End', 'responsive-lightbox' ),
632 'section' => 'responsive_lightbox_basicslider_gallery',
633 'type' => 'boolean',
634 'label' => __( 'Hide the previous or next control when it reaches the first or last slide respectively.', 'responsive-lightbox' )
635 ),
636 'slide_margin' => array(
637 'title' => __( 'Slide Margin', 'responsive-lightbox' ),
638 'section' => 'responsive_lightbox_basicslider_gallery',
639 'type' => 'number',
640 'min' => 0,
641 'description' => __( 'The spacing between slides.', 'responsive-lightbox' ),
642 'append' => '%'
643 ),
644 'transition' => array(
645 'title' => __( 'Transition', 'responsive-lightbox' ),
646 'section' => 'responsive_lightbox_basicslider_gallery',
647 'type' => 'select',
648 'description' => __( 'Transition type to use, or no transitions.', 'responsive-lightbox' ),
649 'options' => array(
650 'none' => __( 'None', 'responsive-lightbox' ),
651 'fade' => __( 'Fade', 'responsive-lightbox' ),
652 'horizontal' => __( 'Horizontal', 'responsive-lightbox' ),
653 'vertical' => __( 'Vertical', 'responsive-lightbox' ),
654 'kenburns' => __( 'Ken Burns', 'responsive-lightbox' )
655 )
656 ),
657 'kenburns_zoom' => array(
658 'title' => __( 'Ken Burns Zoom', 'responsive-lightbox' ),
659 'section' => 'responsive_lightbox_basicslider_gallery',
660 'type' => 'number',
661 'min' => 0,
662 'description' => __( 'Max zoom level use for the Ken Burns transition.', 'responsive-lightbox' ),
663 'append' => '%'
664 ),
665 'speed' => array(
666 'title' => __( 'Transition Speed', 'responsive-lightbox' ),
667 'section' => 'responsive_lightbox_basicslider_gallery',
668 'type' => 'number',
669 'min' => 0,
670 'description' => __( 'The time the transition takes to complete.', 'responsive-lightbox' ),
671 'append' => 'ms'
672 ),
673 'easing' => array(
674 'title' => __( 'Easing Effect', 'responsive-lightbox' ),
675 'section' => 'responsive_lightbox_basicslider_gallery',
676 'type' => 'select',
677 'description' => __( 'The easing effect to use for the selected transition.', 'responsive-lightbox' ),
678 'options' => array(
679 'linear' => 'linear',
680 'swing' => 'swing',
681 'easeInQuad' => 'easeInQuad',
682 'easeOutQuad' => 'easeOutQuad',
683 'easeInOutQuad' => 'easeInOutQuad',
684 'easeInCubic' => 'easeInCubic',
685 'easeOutCubic' => 'easeOutCubic',
686 'easeInOutCubic' => 'easeInOutCubic',
687 'easeInQuart' => 'easeInQuart',
688 'easeOutQuart' => 'easeOutQuart',
689 'easeInOutQuart' => 'easeInOutQuart',
690 'easeInQuint' => 'easeInQuint',
691 'easeOutQuint' => 'easeOutQuint',
692 'easeInOutQuint' => 'easeInOutQuint',
693 'easeInExpo' => 'easeInExpo',
694 'easeOutExpo' => 'easeOutExpo',
695 'easeInOutExpo' => 'easeInOutExpo',
696 'easeInSine' => 'easeInSine',
697 'easeOutSine' => 'easeOutSine',
698 'easeInOutSine' => 'easeInOutSine',
699 'easeInCirc' => 'easeInCirc',
700 'easeOutCirc' => 'easeOutCirc',
701 'easeInOutCirc' => 'easeInOutCirc',
702 'easeInElastic' => 'easeInElastic',
703 'easeOutElastic' => 'easeOutElastic',
704 'easeInOutElastic' => 'easeInOutElastic',
705 'easeInBack' => 'easeInBack',
706 'easeOutBack' => 'easeOutBack',
707 'easeInOutBack' => 'easeInOutBack',
708 'easeInBounce' => 'easeInBounce',
709 'easeOutBounce' => 'easeOutBounce',
710 'easeInOutBounce' => 'easeInOutBounce'
711 )
712 ),
713 'continuous' => array(
714 'title' => __( 'Continuous', 'responsive-lightbox' ),
715 'section' => 'responsive_lightbox_basicslider_gallery',
716 'type' => 'boolean',
717 'label' => __( 'Whether the slider should run continuously (seamless transition between the first and last slides).', 'responsive-lightbox' )
718 ),
719 'use_css' => array(
720 'title' => __( 'Use CSS', 'responsive-lightbox' ),
721 'section' => 'responsive_lightbox_basicslider_gallery',
722 'type' => 'boolean',
723 'label' => __( 'Whether the slider should use CSS transitions. If the user\'s browser doesn\'t support CSS transitions the slider will fallback to jQuery.', 'responsive-lightbox' )
724 ),
725 'slideshow' => array(
726 'title' => __( 'Slideshow', 'responsive-lightbox' ),
727 'section' => 'responsive_lightbox_basicslider_gallery',
728 'type' => 'boolean',
729 'label' => __( 'Whether the slider should run automatically on load.', 'responsive-lightbox' )
730 ),
731 'slideshow_direction' => array(
732 'title' => __( 'Slideshow Direction', 'responsive-lightbox' ),
733 'section' => 'responsive_lightbox_basicslider_gallery',
734 'type' => 'select',
735 'description' => __( 'Which direction the slider should move in if in slideshow mode.', 'responsive-lightbox' ),
736 'options' => array(
737 'next' => __( 'Next', 'responsive-lightbox' ),
738 'prev' => __( 'Previous', 'responsive-lightbox' )
739 )
740 ),
741 'slideshow_hover' => array(
742 'title' => __( 'Slideshow Hover', 'responsive-lightbox' ),
743 'section' => 'responsive_lightbox_basicslider_gallery',
744 'type' => 'boolean',
745 'label' => __( 'Whether the slideshow should pause automatically on hover.', 'responsive-lightbox' )
746 ),
747 'slideshow_hover_delay' => array(
748 'title' => __( 'Slideshow Hover Delay', 'responsive-lightbox' ),
749 'section' => 'responsive_lightbox_basicslider_gallery',
750 'type' => 'number',
751 'min' => 0,
752 'description' => __( 'The delay (if any) before the slider resumes automatically after hover.', 'responsive-lightbox' ),
753 'append' => 'ms'
754 ),
755 'slideshow_delay' => array(
756 'title' => __( 'Slideshow Delay', 'responsive-lightbox' ),
757 'section' => 'responsive_lightbox_basicslider_gallery',
758 'type' => 'number',
759 'min' => 0,
760 'description' => __( 'The delay (if any) before the slider runs automatically on load.', 'responsive-lightbox' ),
761 'append' => 'ms'
762 ),
763 'slideshow_pause' => array(
764 'title' => __( 'Slideshow Pause', 'responsive-lightbox' ),
765 'section' => 'responsive_lightbox_basicslider_gallery',
766 'type' => 'number',
767 'min' => 0,
768 'description' => __( 'The time a slide lasts.', 'responsive-lightbox' ),
769 'append' => 'ms'
770 )
771 )
772 ),
773 'basicmasonry_gallery' => array(
774 'option_group' => 'responsive_lightbox_basicmasonry_gallery',
775 'option_name' => 'responsive_lightbox_basicmasonry_gallery',
776 'sections' => array(
777 'responsive_lightbox_basicmasonry_gallery' => array(
778 'title' => __( 'Basic Masonry Gallery settings', 'responsive-lightbox' )
779 )
780 ),
781 'prefix' => 'rl',
782 'fields' => array(
783 'screen_size_columns' => array(
784 'title' => __( 'Screen sizes', 'responsive-lightbox' ),
785 'section' => 'responsive_lightbox_basicmasonry_gallery',
786 'type' => 'multiple',
787 'description' => __( 'Number of columns in a gallery depending on the device screen size. (if greater than 0 overrides the Columns option)', 'responsive-lightbox' ),
788 'fields' => array(
789 'columns_lg' => array(
790 'type' => 'number',
791 'min' => 0,
792 'max' => 6,
793 'default' => 4,
794 'append' => __( 'large devices / desktops (&ge;1200px)', 'responsive-lightbox' )
795 ),
796 'columns_md' => array(
797 'type' => 'number',
798 'min' => 0,
799 'max' => 6,
800 'default' => 3,
801 'append' => __( 'medium devices / desktops (&ge;992px)', 'responsive-lightbox' )
802 ),
803 'columns_sm' => array(
804 'type' => 'number',
805 'min' => 0,
806 'max' => 6,
807 'default' => 2,
808 'append' => __( 'small devices / tablets (&ge;768px)', 'responsive-lightbox' )
809 ),
810 'columns_xs' => array(
811 'type' => 'number',
812 'min' => 0,
813 'max' => 6,
814 'default' => 2,
815 'append' => __( 'extra small devices / phones (<768px)', 'responsive-lightbox' )
816 )
817 ),
818 ),
819 'gutter' => array(
820 'title' => __( 'Gutter', 'responsive-lightbox' ),
821 'section' => 'responsive_lightbox_basicmasonry_gallery',
822 'type' => 'number',
823 'description' => __( 'Horizontal space between gallery items.', 'responsive-lightbox' ),
824 'append' => 'px'
825 ),
826 'margin' => array(
827 'title' => __( 'Margin', 'responsive-lightbox' ),
828 'section' => 'responsive_lightbox_basicmasonry_gallery',
829 'type' => 'number',
830 'description' => __( 'Vertical space between gallery items.', 'responsive-lightbox' ),
831 'append' => 'px'
832 ),
833 'origin_left' => array(
834 'title' => __( 'Origin Left', 'responsive-lightbox' ),
835 'section' => 'responsive_lightbox_basicmasonry_gallery',
836 'type' => 'boolean',
837 'label' => __( 'Enable left-to-right layouts.', 'responsive-lightbox' ),
838 'description' => __( 'Controls the horizontal flow of the layout. By default, item elements start positioning at the left. Uncheck it for right-to-left layouts.', 'responsive-lightbox' )
839 ),
840 'origin_top' => array(
841 'title' => __( 'Origin Top', 'responsive-lightbox' ),
842 'section' => 'responsive_lightbox_basicmasonry_gallery',
843 'type' => 'boolean',
844 'label' => __( 'Enable top-to-bottom layouts.', 'responsive-lightbox' ),
845 'description' => __( 'Controls the vetical flow of the layout. By default, item elements start positioning at the top. Uncheck it for bottom-up layouts.', 'responsive-lightbox' )
846 )
847 )
848 )
849 );
850
851 $this->tabs = apply_filters( 'rl_settings_tabs', array(
852 'settings' => array(
853 'name' => __( 'General', 'responsive-lightbox' ),
854 'key' => 'responsive_lightbox_settings',
855 'submit' => 'save_rl_settings',
856 'reset' => 'reset_rl_settings'
857 ),
858 'configuration' => array(
859 'name' => __( 'Lightboxes', 'responsive-lightbox' ),
860 'key' => 'responsive_lightbox_configuration',
861 'submit' => 'save_' . $this->settings['configuration']['prefix'] . '_configuration',
862 'reset' => 'reset_' . $this->settings['configuration']['prefix'] . '_configuration',
863 'sections' => $scripts,
864 'default_section' => Responsive_Lightbox()->options['settings']['script']
865 ),
866 'basicgrid_gallery' => array(
867 'name' => __( 'Basic Grid', 'responsive-lightbox' ),
868 'key' => 'responsive_lightbox_basicgrid_gallery',
869 'submit' => 'save_rl_basicgrid_gallery',
870 'reset' => 'reset_rl_basicgrid_gallery'
871 ),
872 'basicslider_gallery' => array(
873 'name' => __( 'Basic Slider', 'responsive-lightbox' ),
874 'key' => 'responsive_lightbox_basiclider_gallery',
875 'submit' => 'save_rl_basiclider_gallery',
876 'reset' => 'reset_rl_basiclider_gallery'
877 ),
878 'basicmasonry_gallery' => array(
879 'name' => __( 'Basic Masonry', 'responsive-lightbox' ),
880 'key' => 'responsive_lightbox_basicmasonry_gallery',
881 'submit' => 'save_rl_basicmasonry_gallery',
882 'reset' => 'reset_rl_basicmasonry_gallery'
883 )
884 ) );
885
886 $tabs_copy = $this->tabs;
887 $tab_key = '';
888 $section_key = '';
889
890 // set current tab and section
891 if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
892 global $pagenow;
893
894 // check settings page
895 if ( $pagenow === 'options.php' || ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && preg_match( '/^responsive-lightbox-(' . implode( '|', array_keys( $this->tabs + array( 'gallery' => '', 'addons' => '' ) ) ) . ')$/', $_GET['page'], $tabs ) === 1 ) ) {
896 $tab_key = isset( $tabs[1] ) ? $tabs[1] : 'settings';
897 $section_key = isset( $_REQUEST['section'] ) ? esc_attr( $_REQUEST['section'] ) : ( ! empty( $this->tabs[$tab_key]['default_section'] ) ? $this->tabs[$tab_key]['default_section'] : '' );
898 }
899 }
900
901 // get default gallery types
902 $gallery_types = Responsive_Lightbox()->gallery_types;
903
904 // remove default gallery
905 unset( $gallery_types['default'] );
906
907 // get available galleries
908 $gallery_types = apply_filters( 'rl_gallery_types', $gallery_types );
909
910 if ( $gallery_types ) {
911 foreach ( $gallery_types as $key => $name ) {
912 unset( $gallery_types[$key] );
913
914 $gallery_types[$key . '_gallery'] = $name;
915 }
916 }
917
918 // backward compatibility, remove from tabs
919 $gallery_tabs = array_intersect( array_keys( $this->tabs ), array_keys( $gallery_types ) );
920 $galleries = array();
921
922 if ( ! empty( $gallery_tabs ) ) {
923 // unset tabs if exist
924 foreach ( $gallery_tabs as $gallery_tab ) {
925 $galleries[$gallery_tab] = $this->tabs[$gallery_tab];
926
927 unset( $this->tabs[$gallery_tab] );
928 }
929
930 foreach ( $galleries as $key => $gallery ) {
931 $gallery_sections[$key] = $gallery['name'];
932 }
933
934 if ( $tab_key == 'gallery' )
935 $section_key = isset( $_REQUEST['section'] ) ? esc_attr( $_REQUEST['section'] ) : ( in_array( Responsive_Lightbox()->options['settings']['default_gallery'] . '_gallery', array_keys( $gallery_sections ) ) ? Responsive_Lightbox()->options['settings']['default_gallery'] . '_gallery' : key( $gallery_sections ) );
936
937 $this->tabs['gallery'] = array(
938 'name' => __( 'Galleries', 'responsive-lightbox' ),
939 'key' => 'responsive_lightbox_' . $section_key,
940 'submit' => array_key_exists( $section_key, $tabs_copy ) ? $tabs_copy[$section_key]['submit'] : 'save_' . $section_key . '_configuration',
941 'reset' => array_key_exists( $section_key, $tabs_copy ) ? $tabs_copy[$section_key]['reset'] : 'reset_rl_' . $section_key,
942 'sections' => $gallery_sections,
943 'default_section' => $section_key
944 );
945 }
946
947 $this->tabs['builder'] = array(
948 'name' => __( 'Builder', 'responsive-lightbox' ),
949 'key' => 'responsive_lightbox_builder',
950 'submit' => 'save_rl_builder',
951 'reset' => 'reset_rl_builder'
952 );
953
954 $this->tabs['folders'] = array(
955 'name' => __( 'Folders', 'responsive-lightbox' ),
956 'key' => 'responsive_lightbox_folders',
957 'submit' => 'save_rl_folders',
958 'reset' => 'reset_rl_folders'
959 );
960
961 // push licenses just before the addons
962 if ( isset( $this->tabs['seo_images'] ) ) {
963 $seo = $this->tabs['seo_images'];
964
965 unset( $this->tabs['seo_images'] );
966
967 $this->tabs['seo_images'] = $seo;
968 }
969
970 // push licenses just before the addons
971 if ( isset( $this->tabs['licenses'] ) ) {
972 unset( $this->tabs['licenses'] );
973
974 $this->tabs['licenses'] = array(
975 'name' => __( 'Licenses', 'responsive-lightbox' ),
976 'key' => 'responsive_lightbox_licenses',
977 'submit' => 'save_rl_licenses',
978 'reset' => 'reset_rl_licenses'
979 );
980 }
981
982 $this->tabs['addons'] = array(
983 'name' => __( 'Add-ons', 'responsive-lightbox' ),
984 'key' => 'responsive_lightbox_configuration',
985 'callback' => array( $this, 'addons_tab_cb' )
986 );
987
988 if ( ! empty( $this->tabs[$tab_key]['sections'] ) && isset( $this->tabs[$tab_key]['sections'][$section_key] ) ) {
989 $this->settings[$tab_key]['sections']['responsive_lightbox_' . $tab_key]['title'] = sprintf( __( '%s settings', 'responsive-lightbox' ), $this->tabs[$tab_key]['sections'][$section_key] );
990 }
991
992 switch ( ! empty( $section_key ) ? $section_key : Responsive_Lightbox()->options['settings']['script'] ) {
993 case 'swipebox':
994 $this->settings['configuration']['prefix'] = 'rl_sb';
995 $this->settings['configuration']['fields'] = array(
996 'animation' => array(
997 'title' => __( 'Animation type', 'responsive-lightbox' ),
998 'section' => 'responsive_lightbox_configuration',
999 'type' => 'radio',
1000 'label' => '',
1001 'description' => __( 'Select a method of applying a lightbox effect.', 'responsive-lightbox' ),
1002 'options' => $this->scripts['swipebox']['animations'],
1003 'parent' => 'swipebox'
1004 ),
1005 'force_png_icons' => array(
1006 'title' => __( 'Force PNG icons', 'responsive-lightbox' ),
1007 'section' => 'responsive_lightbox_configuration',
1008 'type' => 'boolean',
1009 'label' => __( 'Enable this if you\'re having problems with navigation icons not visible on some devices.', 'responsive-lightbox' ),
1010 'parent' => 'swipebox'
1011 ),
1012 'hide_close_mobile' => array(
1013 'title' => __( 'Hide close on mobile', 'responsive-lightbox' ),
1014 'section' => 'responsive_lightbox_configuration',
1015 'type' => 'boolean',
1016 'label' => __( 'Hide the close button on mobile devices.', 'responsive-lightbox' ),
1017 'parent' => 'swipebox'
1018 ),
1019 'remove_bars_mobile' => array(
1020 'title' => __( 'Remove bars on mobile', 'responsive-lightbox' ),
1021 'section' => 'responsive_lightbox_configuration',
1022 'type' => 'boolean',
1023 'label' => __( 'Hide the top and bottom bars on mobile devices.', 'responsive-lightbox' ),
1024 'parent' => 'swipebox'
1025 ),
1026 'hide_bars' => array(
1027 'title' => __( 'Top and bottom bars', 'responsive-lightbox' ),
1028 'section' => 'responsive_lightbox_configuration',
1029 'type' => 'multiple',
1030 'fields' => array(
1031 'hide_bars' => array(
1032 'type' => 'boolean',
1033 'label' => __( 'Hide top and bottom bars after a period of time.', 'responsive-lightbox' ),
1034 'parent' => 'swipebox'
1035 ),
1036 'hide_bars_delay' => array(
1037 'type' => 'number',
1038 'description' => __( 'Enter the time after which the top and bottom bars will be hidden (when hiding is enabled).', 'responsive-lightbox' ),
1039 'append' => 'ms',
1040 'parent' => 'swipebox'
1041 )
1042 )
1043 ),
1044 'video_max_width' => array(
1045 'title' => __( 'Video max width', 'responsive-lightbox' ),
1046 'section' => 'responsive_lightbox_configuration',
1047 'type' => 'number',
1048 'description' => __( 'Enter the max video width in a lightbox.', 'responsive-lightbox' ),
1049 'append' => 'px',
1050 'parent' => 'swipebox'
1051 ),
1052 'loop_at_end' => array(
1053 'title' => __( 'Loop at end', 'responsive-lightbox' ),
1054 'section' => 'responsive_lightbox_configuration',
1055 'type' => 'boolean',
1056 'label' => __( 'True will return to the first image after the last image is reached.', 'responsive-lightbox' ),
1057 'parent' => 'swipebox'
1058 ),
1059 );
1060 break;
1061
1062 case 'prettyphoto':
1063 $this->settings['configuration']['prefix'] = 'rl_pp';
1064 $this->settings['configuration']['fields'] = array(
1065 'animation_speed' => array(
1066 'title' => __( 'Animation speed', 'responsive-lightbox' ),
1067 'section' => 'responsive_lightbox_configuration',
1068 'type' => 'radio',
1069 'label' => '',
1070 'description' => __( 'Select animation speed for lightbox effect.', 'responsive-lightbox' ),
1071 'options' => $this->scripts['prettyphoto']['animation_speeds'],
1072 'parent' => 'prettyphoto'
1073 ),
1074 'slideshow' => array(
1075 'title' => __( 'Slideshow', 'responsive-lightbox' ),
1076 'section' => 'responsive_lightbox_configuration',
1077 'type' => 'multiple',
1078 'fields' => array(
1079 'slideshow' => array(
1080 'type' => 'boolean',
1081 'label' => __( 'Display images as slideshow', 'responsive-lightbox' ),
1082 'parent' => 'prettyphoto'
1083 ),
1084 'slideshow_delay' => array(
1085 'type' => 'number',
1086 'description' => __( 'Enter time (in miliseconds).', 'responsive-lightbox' ),
1087 'append' => 'ms',
1088 'parent' => 'prettyphoto'
1089 )
1090 )
1091 ),
1092 'slideshow_autoplay' => array(
1093 'title' => __( 'Slideshow autoplay', 'responsive-lightbox' ),
1094 'section' => 'responsive_lightbox_configuration',
1095 'type' => 'boolean',
1096 'label' => __( 'Automatically start slideshow.', 'responsive-lightbox' ),
1097 'parent' => 'prettyphoto'
1098 ),
1099 'opacity' => array(
1100 'title' => __( 'Opacity', 'responsive-lightbox' ),
1101 'section' => 'responsive_lightbox_configuration',
1102 'type' => 'range',
1103 'description' => __( 'Value between 0 and 100, 100 for no opacity.', 'responsive-lightbox' ),
1104 'min' => 0,
1105 'max' => 100,
1106 'parent' => 'prettyphoto'
1107 ),
1108 'show_title' => array(
1109 'title' => __( 'Show title', 'responsive-lightbox' ),
1110 'section' => 'responsive_lightbox_configuration',
1111 'type' => 'boolean',
1112 'label' => __( 'Display image title.', 'responsive-lightbox' ),
1113 'parent' => 'prettyphoto'
1114 ),
1115 'allow_resize' => array(
1116 'title' => __( 'Allow resize big images', 'responsive-lightbox' ),
1117 'section' => 'responsive_lightbox_configuration',
1118 'type' => 'boolean',
1119 'label' => __( 'Resize the photos bigger than viewport.', 'responsive-lightbox' ),
1120 'parent' => 'prettyphoto'
1121 ),
1122 'allow_expand' => array(
1123 'title' => __( 'Allow expand', 'responsive-lightbox' ),
1124 'section' => 'responsive_lightbox_configuration',
1125 'type' => 'boolean',
1126 'label' => __( 'Allow expanding images.', 'responsive-lightbox' ),
1127 'parent' => 'prettyphoto'
1128 ),
1129 'width' => array(
1130 'title' => __( 'Video width', 'responsive-lightbox' ),
1131 'section' => 'responsive_lightbox_configuration',
1132 'type' => 'number',
1133 'append' => 'px',
1134 'parent' => 'prettyphoto'
1135 ),
1136 'height' => array(
1137 'title' => __( 'Video height', 'responsive-lightbox' ),
1138 'section' => 'responsive_lightbox_configuration',
1139 'type' => 'number',
1140 'append' => 'px',
1141 'parent' => 'prettyphoto'
1142 ),
1143 'theme' => array(
1144 'title' => __( 'Theme', 'responsive-lightbox' ),
1145 'section' => 'responsive_lightbox_configuration',
1146 'type' => 'radio',
1147 'description' => __( 'Select the theme for lightbox effect.', 'responsive-lightbox' ),
1148 'options' => $this->scripts['prettyphoto']['themes'],
1149 'parent' => 'prettyphoto'
1150 ),
1151 'horizontal_padding' => array(
1152 'title' => __( 'Horizontal padding', 'responsive-lightbox' ),
1153 'section' => 'responsive_lightbox_configuration',
1154 'type' => 'number',
1155 'append' => 'px',
1156 'parent' => 'prettyphoto'
1157 ),
1158 'hide_flash' => array(
1159 'title' => __( 'Hide Flash', 'responsive-lightbox' ),
1160 'section' => 'responsive_lightbox_configuration',
1161 'type' => 'boolean',
1162 'label' => __( 'Hide all the flash objects on a page. Enable this if flash appears over prettyPhoto.', 'responsive-lightbox' ),
1163 'parent' => 'prettyphoto'
1164 ),
1165 'wmode' => array(
1166 'title' => __( 'Flash Window Mode (wmode)', 'responsive-lightbox' ),
1167 'section' => 'responsive_lightbox_configuration',
1168 'type' => 'radio',
1169 'description' => __( 'Select flash window mode.', 'responsive-lightbox' ),
1170 'options' => $this->scripts['prettyphoto']['wmodes'],
1171 'parent' => 'prettyphoto'
1172 ),
1173 'video_autoplay' => array(
1174 'title' => __( 'Video autoplay', 'responsive-lightbox' ),
1175 'section' => 'responsive_lightbox_configuration',
1176 'type' => 'boolean',
1177 'label' => __( 'Automatically start videos.', 'responsive-lightbox' ),
1178 'parent' => 'prettyphoto'
1179 ),
1180 'modal' => array(
1181 'title' => __( 'Modal', 'responsive-lightbox' ),
1182 'section' => 'responsive_lightbox_configuration',
1183 'type' => 'boolean',
1184 'label' => __( 'If set to true, only the close button will close the window.', 'responsive-lightbox' ),
1185 'parent' => 'prettyphoto'
1186 ),
1187 'deeplinking' => array(
1188 'title' => __( 'Deeplinking', 'responsive-lightbox' ),
1189 'section' => 'responsive_lightbox_configuration',
1190 'type' => 'boolean',
1191 'label' => __( 'Allow prettyPhoto to update the url to enable deeplinking.', 'responsive-lightbox' ),
1192 'parent' => 'prettyphoto'
1193 ),
1194 'overlay_gallery' => array(
1195 'title' => __( 'Overlay gallery', 'responsive-lightbox' ),
1196 'section' => 'responsive_lightbox_configuration',
1197 'type' => 'boolean',
1198 'label' => __( 'If enabled, a gallery will overlay the fullscreen image on mouse over.', 'responsive-lightbox' ),
1199 'parent' => 'prettyphoto'
1200 ),
1201 'keyboard_shortcuts' => array(
1202 'title' => __( 'Keyboard shortcuts', 'responsive-lightbox' ),
1203 'section' => 'responsive_lightbox_configuration',
1204 'type' => 'boolean',
1205 'label' => __( 'Set to false if you open forms inside prettyPhoto.', 'responsive-lightbox' ),
1206 'parent' => 'prettyphoto'
1207 ),
1208 'social' => array(
1209 'title' => __( 'Social (Twitter, Facebook)', 'responsive-lightbox' ),
1210 'section' => 'responsive_lightbox_configuration',
1211 'type' => 'boolean',
1212 'label' => __( 'Display links to Facebook and Twitter.', 'responsive-lightbox' ),
1213 'parent' => 'prettyphoto'
1214 ),
1215 );
1216 break;
1217
1218 case 'fancybox':
1219 $this->settings['configuration']['prefix'] = 'rl_fb';
1220 $this->settings['configuration']['fields'] = array(
1221 'modal' => array(
1222 'title' => __( 'Modal', 'responsive-lightbox' ),
1223 'section' => 'responsive_lightbox_configuration',
1224 'type' => 'boolean',
1225 'label' => __( 'When true, "overlayShow" is set to true and "hideOnOverlayClick", "hideOnContentClick", "enableEscapeButton", "showCloseButton" are set to false.', 'responsive-lightbox' ),
1226 'parent' => 'fancybox'
1227 ),
1228 'show_overlay' => array(
1229 'title' => __( 'Show overlay', 'responsive-lightbox' ),
1230 'section' => 'responsive_lightbox_configuration',
1231 'type' => 'boolean',
1232 'label' => __( 'Toggle overlay.', 'responsive-lightbox' ),
1233 'parent' => 'fancybox'
1234 ),
1235 'show_close_button' => array(
1236 'title' => __( 'Show close button', 'responsive-lightbox' ),
1237 'section' => 'responsive_lightbox_configuration',
1238 'type' => 'boolean',
1239 'label' => __( 'Toggle close button.', 'responsive-lightbox' ),
1240 'parent' => 'fancybox'
1241 ),
1242 'enable_escape_button' => array(
1243 'title' => __( 'Enable escape button', 'responsive-lightbox' ),
1244 'section' => 'responsive_lightbox_configuration',
1245 'type' => 'boolean',
1246 'label' => __( 'Toggle if pressing Esc button closes lightbox.', 'responsive-lightbox' ),
1247 'parent' => 'fancybox'
1248 ),
1249 'hide_on_overlay_click' => array(
1250 'title' => __( 'Hide on overlay click', 'responsive-lightbox' ),
1251 'section' => 'responsive_lightbox_configuration',
1252 'type' => 'boolean',
1253 'label' => __( 'Toggle if clicking the overlay should close FancyBox.', 'responsive-lightbox' ),
1254 'parent' => 'fancybox'
1255 ),
1256 'hide_on_content_click' => array(
1257 'title' => __( 'Hide on content click', 'responsive-lightbox' ),
1258 'section' => 'responsive_lightbox_configuration',
1259 'type' => 'boolean',
1260 'label' => __( 'Toggle if clicking the content should close FancyBox.', 'responsive-lightbox' ),
1261 'parent' => 'fancybox'
1262 ),
1263 'cyclic' => array(
1264 'title' => __( 'Cyclic', 'responsive-lightbox' ),
1265 'section' => 'responsive_lightbox_configuration',
1266 'type' => 'boolean',
1267 'label' => __( 'When true, galleries will be cyclic, allowing you to keep pressing next/back.', 'responsive-lightbox' ),
1268 'parent' => 'fancybox'
1269 ),
1270 'show_nav_arrows' => array(
1271 'title' => __( 'Show nav arrows', 'responsive-lightbox' ),
1272 'section' => 'responsive_lightbox_configuration',
1273 'type' => 'boolean',
1274 'label' => __( 'Toggle navigation arrows.', 'responsive-lightbox' ),
1275 'parent' => 'fancybox'
1276 ),
1277 'auto_scale' => array(
1278 'title' => __( 'Auto scale', 'responsive-lightbox' ),
1279 'section' => 'responsive_lightbox_configuration',
1280 'type' => 'boolean',
1281 'label' => __( 'If true, FancyBox is scaled to fit in viewport.', 'responsive-lightbox' ),
1282 'parent' => 'fancybox'
1283 ),
1284 'scrolling' => array(
1285 'title' => __( 'Scrolling (in/out)', 'responsive-lightbox' ),
1286 'section' => 'responsive_lightbox_configuration',
1287 'type' => 'radio',
1288 'description' => __( 'Set the overflow CSS property to create or hide scrollbars.', 'responsive-lightbox' ),
1289 'options' => $this->scripts['fancybox']['scrollings'],
1290 'parent' => 'fancybox'
1291 ),
1292 'center_on_scroll' => array(
1293 'title' => __( 'Center on scroll', 'responsive-lightbox' ),
1294 'section' => 'responsive_lightbox_configuration',
1295 'type' => 'boolean',
1296 'label' => __( 'When true, FancyBox is centered while scrolling page.', 'responsive-lightbox' ),
1297 'parent' => 'fancybox'
1298 ),
1299 'opacity' => array(
1300 'title' => __( 'Opacity', 'responsive-lightbox' ),
1301 'section' => 'responsive_lightbox_configuration',
1302 'type' => 'boolean',
1303 'label' => __( 'When true, transparency of content is changed for elastic transitions.', 'responsive-lightbox' ),
1304 'parent' => 'fancybox'
1305 ),
1306 'overlay_opacity' => array(
1307 'title' => __( 'Overlay opacity', 'responsive-lightbox' ),
1308 'section' => 'responsive_lightbox_configuration',
1309 'type' => 'range',
1310 'description' => __( 'Opacity of the overlay.', 'responsive-lightbox' ),
1311 'min' => 0,
1312 'max' => 100,
1313 'parent' => 'fancybox'
1314 ),
1315 'overlay_color' => array(
1316 'title' => __( 'Overlay color', 'responsive-lightbox' ),
1317 'section' => 'responsive_lightbox_configuration',
1318 'type' => 'color_picker',
1319 'label' => __( 'Color of the overlay.', 'responsive-lightbox' ),
1320 'parent' => 'fancybox'
1321 ),
1322 'title_show' => array(
1323 'title' => __( 'Title show', 'responsive-lightbox' ),
1324 'section' => 'responsive_lightbox_configuration',
1325 'type' => 'boolean',
1326 'label' => __( 'Toggle title.', 'responsive-lightbox' ),
1327 'parent' => 'fancybox'
1328 ),
1329 'title_position' => array(
1330 'title' => __( 'Title position', 'responsive-lightbox' ),
1331 'section' => 'responsive_lightbox_configuration',
1332 'type' => 'radio',
1333 'description' => __( 'The position of title.', 'responsive-lightbox' ),
1334 'options' => $this->scripts['fancybox']['positions'],
1335 'parent' => 'fancybox'
1336 ),
1337 'transitions' => array(
1338 'title' => __( 'Transition (in/out)', 'responsive-lightbox' ),
1339 'section' => 'responsive_lightbox_configuration',
1340 'type' => 'radio',
1341 'description' => __( 'The transition type.', 'responsive-lightbox' ),
1342 'options' => $this->scripts['fancybox']['transitions'],
1343 'parent' => 'fancybox'
1344 ),
1345 'easings' => array(
1346 'title' => __( 'Easings (in/out)', 'responsive-lightbox' ),
1347 'section' => 'responsive_lightbox_configuration',
1348 'type' => 'radio',
1349 'description' => __( 'Easing used for elastic animations.', 'responsive-lightbox' ),
1350 'options' => $this->scripts['fancybox']['easings'],
1351 'parent' => 'fancybox'
1352 ),
1353 'speeds' => array(
1354 'title' => __( 'Speed (in/out)', 'responsive-lightbox' ),
1355 'section' => 'responsive_lightbox_configuration',
1356 'type' => 'number',
1357 'description' => __( 'Speed of the fade and elastic transitions, in milliseconds.', 'responsive-lightbox' ),
1358 'append' => 'ms',
1359 'parent' => 'fancybox'
1360 ),
1361 'change_speed' => array(
1362 'title' => __( 'Change speed', 'responsive-lightbox' ),
1363 'section' => 'responsive_lightbox_configuration',
1364 'type' => 'number',
1365 'description' => __( 'Speed of resizing when changing gallery items, in milliseconds.', 'responsive-lightbox' ),
1366 'append' => 'ms',
1367 'parent' => 'fancybox'
1368 ),
1369 'change_fade' => array(
1370 'title' => __( 'Change fade', 'responsive-lightbox' ),
1371 'section' => 'responsive_lightbox_configuration',
1372 'type' => 'number',
1373 'description' => __( 'Speed of the content fading while changing gallery items.', 'responsive-lightbox' ),
1374 'append' => 'ms',
1375 'parent' => 'fancybox'
1376 ),
1377 'padding' => array(
1378 'title' => __( 'Padding', 'responsive-lightbox' ),
1379 'section' => 'responsive_lightbox_configuration',
1380 'type' => 'number',
1381 'description' => __( 'Space between FancyBox wrapper and content.', 'responsive-lightbox' ),
1382 'append' => 'px',
1383 'parent' => 'fancybox'
1384 ),
1385 'margin' => array(
1386 'title' => __( 'Margin', 'responsive-lightbox' ),
1387 'section' => 'responsive_lightbox_configuration',
1388 'type' => 'number',
1389 'description' => __( 'Space between viewport and FancyBox wrapper.', 'responsive-lightbox' ),
1390 'append' => 'px',
1391 'parent' => 'fancybox'
1392 ),
1393 'video_width' => array(
1394 'title' => __( 'Video width', 'responsive-lightbox' ),
1395 'section' => 'responsive_lightbox_configuration',
1396 'type' => 'number',
1397 'description' => __( 'Width of the video.', 'responsive-lightbox' ),
1398 'append' => 'px',
1399 'parent' => 'fancybox'
1400 ),
1401 'video_height' => array(
1402 'title' => __( 'Video height', 'responsive-lightbox' ),
1403 'section' => 'responsive_lightbox_configuration',
1404 'type' => 'number',
1405 'description' => __( 'Height of the video.', 'responsive-lightbox' ),
1406 'append' => 'px',
1407 'parent' => 'fancybox'
1408 ),
1409 );
1410 break;
1411
1412 case 'nivo':
1413 $this->settings['configuration']['prefix'] = 'rl_nv';
1414 $this->settings['configuration']['fields'] = array(
1415 'effect' => array(
1416 'title' => __( 'Effect', 'responsive-lightbox' ),
1417 'section' => 'responsive_lightbox_configuration',
1418 'type' => 'radio',
1419 'description' => __( 'The effect to use when showing the lightbox.', 'responsive-lightbox' ),
1420 'options' => $this->scripts['nivo']['effects'],
1421 'parent' => 'nivo'
1422 ),
1423 'keyboard_nav' => array(
1424 'title' => __( 'Keyboard navigation', 'responsive-lightbox' ),
1425 'section' => 'responsive_lightbox_configuration',
1426 'type' => 'boolean',
1427 'label' => __( 'Enable keyboard navigation (left/right/escape).', 'responsive-lightbox' ),
1428 'parent' => 'nivo'
1429 ),
1430 'click_overlay_to_close' => array(
1431 'title' => __( 'Click overlay to close', 'responsive-lightbox' ),
1432 'section' => 'responsive_lightbox_configuration',
1433 'type' => 'boolean',
1434 'label' => __( 'Enable to close lightbox on overlay click.', 'responsive-lightbox' ),
1435 'parent' => 'nivo'
1436 ),
1437 'error_message' => array(
1438 'title' => __( 'Error message', 'responsive-lightbox' ),
1439 'section' => 'responsive_lightbox_configuration',
1440 'type' => 'text',
1441 'class' => 'large-text',
1442 'label' => __( 'Error message if the content cannot be loaded.', 'responsive-lightbox' ),
1443 'parent' => 'nivo'
1444 ),
1445 );
1446 break;
1447
1448 case 'imagelightbox':
1449 $this->settings['configuration']['prefix'] = 'rl_il';
1450 $this->settings['configuration']['fields'] = array(
1451 'animation_speed' => array(
1452 'title' => __( 'Animation speed', 'responsive-lightbox' ),
1453 'section' => 'responsive_lightbox_configuration',
1454 'type' => 'number',
1455 'description' => __( 'Animation speed.', 'responsive-lightbox' ),
1456 'append' => 'ms',
1457 'parent' => 'imagelightbox'
1458 ),
1459 'preload_next' => array(
1460 'title' => __( 'Preload next image', 'responsive-lightbox' ),
1461 'section' => 'responsive_lightbox_configuration',
1462 'type' => 'boolean',
1463 'label' => __( 'Silently preload the next image.', 'responsive-lightbox' ),
1464 'parent' => 'imagelightbox'
1465 ),
1466 'enable_keyboard' => array(
1467 'title' => __( 'Enable keyboard keys', 'responsive-lightbox' ),
1468 'section' => 'responsive_lightbox_configuration',
1469 'type' => 'boolean',
1470 'label' => __( 'Enable keyboard shortcuts (arrows Left/Right and Esc).', 'responsive-lightbox' ),
1471 'parent' => 'imagelightbox'
1472 ),
1473 'quit_on_end' => array(
1474 'title' => __( 'Quit after last image', 'responsive-lightbox' ),
1475 'section' => 'responsive_lightbox_configuration',
1476 'type' => 'boolean',
1477 'label' => __( 'Quit after viewing the last image.', 'responsive-lightbox' ),
1478 'parent' => 'imagelightbox'
1479 ),
1480 'quit_on_image_click' => array(
1481 'title' => __( 'Quit on image click', 'responsive-lightbox' ),
1482 'section' => 'responsive_lightbox_configuration',
1483 'type' => 'boolean',
1484 'label' => __( 'Quit when the viewed image is clicked.', 'responsive-lightbox' ),
1485 'parent' => 'imagelightbox'
1486 ),
1487 'quit_on_document_click' => array(
1488 'title' => __( 'Quit on anything click', 'responsive-lightbox' ),
1489 'section' => 'responsive_lightbox_configuration',
1490 'type' => 'boolean',
1491 'label' => __( 'Quit when anything but the viewed image is clicked.', 'responsive-lightbox' ),
1492 'parent' => 'imagelightbox'
1493 ),
1494 );
1495 break;
1496
1497 case 'tosrus':
1498 $this->settings['configuration']['prefix'] = 'rl_tr';
1499 $this->settings['configuration']['fields'] = array(
1500 'effect' => array(
1501 'title' => __( 'Transition effect', 'responsive-lightbox' ),
1502 'section' => 'responsive_lightbox_configuration',
1503 'type' => 'radio',
1504 'description' => __( 'What effect to use for the transition.', 'responsive-lightbox' ),
1505 'options' => array(
1506 'slide' => __( 'slide', 'responsive-lightbox' ),
1507 'fade' => __( 'fade', 'responsive-lightbox' )
1508 ),
1509 'parent' => 'tosrus'
1510 ),
1511 'infinite' => array(
1512 'title' => __( 'Infinite loop', 'responsive-lightbox' ),
1513 'section' => 'responsive_lightbox_configuration',
1514 'type' => 'boolean',
1515 'label' => __( 'Whether or not to slide back to the first slide when the last has been reached.', 'responsive-lightbox' ),
1516 'parent' => 'tosrus'
1517 ),
1518 'keys' => array(
1519 'title' => __( 'Keyboard navigation', 'responsive-lightbox' ),
1520 'section' => 'responsive_lightbox_configuration',
1521 'type' => 'boolean',
1522 'label' => __( 'Enable keyboard navigation (left/right/escape).', 'responsive-lightbox' ),
1523 'parent' => 'tosrus'
1524 ),
1525 'autoplay' => array(
1526 'title' => __( 'Autoplay', 'responsive-lightbox' ),
1527 'section' => 'responsive_lightbox_configuration',
1528 'type' => 'multiple',
1529 'fields' => array(
1530 'autoplay' => array(
1531 'type' => 'boolean',
1532 'label' => __( 'Automatically start slideshow.', 'responsive-lightbox' ),
1533 'parent' => 'tosrus'
1534 ),
1535 'timeout' => array(
1536 'type' => 'number',
1537 'description' => __( 'The timeout between sliding to the next slide in milliseconds.', 'responsive-lightbox' ),
1538 'append' => 'ms',
1539 'parent' => 'tosrus'
1540 )
1541 )
1542 ),
1543 'pause_on_hover' => array(
1544 'title' => __( 'Pause on hover', 'responsive-lightbox' ),
1545 'section' => 'responsive_lightbox_configuration',
1546 'type' => 'boolean',
1547 'label' => __( 'Whether or not to pause on hover.', 'responsive-lightbox' ),
1548 'parent' => 'tosrus'
1549 ),
1550 'pagination' => array(
1551 'title' => __( 'Pagination', 'responsive-lightbox' ),
1552 'section' => 'responsive_lightbox_configuration',
1553 'type' => 'multiple',
1554 'fields' => array(
1555 'pagination' => array(
1556 'type' => 'boolean',
1557 'label' => __( 'Whether or not to add a pagination.', 'responsive-lightbox' ),
1558 'parent' => 'tosrus'
1559 ),
1560 'pagination_type' => array(
1561 'type' => 'radio',
1562 'description' => __( 'What type of pagination to use.', 'responsive-lightbox' ),
1563 'options' => array(
1564 'bullets' => __( 'Bullets', 'responsive-lightbox' ),
1565 'thumbnails' => __( 'Thumbnails', 'responsive-lightbox' )
1566 ),
1567 'parent' => 'tosrus'
1568 )
1569 )
1570 ),
1571 'close_on_click' => array(
1572 'title' => __( 'Overlay close', 'responsive-lightbox' ),
1573 'section' => 'responsive_lightbox_configuration',
1574 'type' => 'boolean',
1575 'label' => __( 'Enable to close lightbox on overlay click.', 'responsive-lightbox' ),
1576 'parent' => 'tosrus'
1577 )
1578 );
1579 break;
1580
1581 case 'featherlight':
1582 $this->settings['configuration']['prefix'] = 'rl_fl';
1583 $this->settings['configuration']['fields'] = array(
1584 'open_speed' => array(
1585 'title' => __( 'Opening speed', 'responsive-lightbox' ),
1586 'section' => 'responsive_lightbox_configuration',
1587 'type' => 'number',
1588 'description' => __( 'Duration of opening animation.', 'responsive-lightbox' ),
1589 'append' => 'ms',
1590 'parent' => 'featherlight'
1591 ),
1592 'close_speed' => array(
1593 'title' => __( 'Closing speed', 'responsive-lightbox' ),
1594 'section' => 'responsive_lightbox_configuration',
1595 'type' => 'number',
1596 'description' => __( 'Duration of closing animation.', 'responsive-lightbox' ),
1597 'append' => 'ms',
1598 'parent' => 'featherlight'
1599 ),
1600 'close_on_click' => array(
1601 'title' => __( 'Close on click', 'responsive-lightbox' ),
1602 'section' => 'responsive_lightbox_configuration',
1603 'type' => 'radio',
1604 'label' => __( 'Select how to close lightbox.', 'responsive-lightbox' ),
1605 'options' => array(
1606 'background' => __( 'background', 'responsive-lightbox' ),
1607 'anywhere' => __( 'anywhere', 'responsive-lightbox' ),
1608 'false' => __( 'false', 'responsive-lightbox' )
1609 ),
1610 'parent' => 'featherlight'
1611 ),
1612 'close_on_esc' => array(
1613 'title' => __( 'Close on Esc', 'responsive-lightbox' ),
1614 'section' => 'responsive_lightbox_configuration',
1615 'type' => 'boolean',
1616 'label' => __( 'Toggle if pressing Esc button closes lightbox.', 'responsive-lightbox' ),
1617 'parent' => 'featherlight'
1618 ),
1619 'gallery_fade_in' => array(
1620 'title' => __( 'Gallery fade in', 'responsive-lightbox' ),
1621 'section' => 'responsive_lightbox_configuration',
1622 'type' => 'number',
1623 'description' => __( 'Animation speed when image is loaded.', 'responsive-lightbox' ),
1624 'append' => 'ms',
1625 'parent' => 'featherlight'
1626 ),
1627 'gallery_fade_out' => array(
1628 'title' => __( 'Gallery fade out', 'responsive-lightbox' ),
1629 'section' => 'responsive_lightbox_configuration',
1630 'type' => 'number',
1631 'description' => __( 'Animation speed before image is loaded.', 'responsive-lightbox' ),
1632 'append' => 'ms',
1633 'parent' => 'featherlight'
1634 )
1635 );
1636 break;
1637
1638 case 'magnific':
1639 $this->settings['configuration']['prefix'] = 'rl_mp';
1640 $this->settings['configuration']['fields'] = array(
1641 'disable_on' => array(
1642 'title' => __( 'Disable on', 'responsive-lightbox' ),
1643 'section' => 'responsive_lightbox_configuration',
1644 'type' => 'number',
1645 'description' => __( 'If window width is less than the number in this option lightbox will not be opened and the default behavior of the element will be triggered. Set to 0 to disable behavior.', 'responsive-lightbox' ),
1646 'append' => 'px',
1647 'parent' => 'magnific'
1648 ),
1649 'mid_click' => array(
1650 'title' => __( 'Middle click', 'responsive-lightbox' ),
1651 'section' => 'responsive_lightbox_configuration',
1652 'type' => 'boolean',
1653 'label' => __( 'If option enabled, lightbox is opened if the user clicked on the middle mouse button, or click with Command/Ctrl key.', 'responsive-lightbox' ),
1654 'parent' => 'magnific'
1655 ),
1656 'preloader' => array(
1657 'title' => __( 'Preloader', 'responsive-lightbox' ),
1658 'section' => 'responsive_lightbox_configuration',
1659 'type' => 'boolean',
1660 'label' => __( 'If option enabled, it\'s always present in DOM only text inside of it changes.', 'responsive-lightbox' ),
1661 'parent' => 'magnific'
1662 ),
1663 'close_on_content_click' => array(
1664 'title' => __( 'Close on content click', 'responsive-lightbox' ),
1665 'section' => 'responsive_lightbox_configuration',
1666 'type' => 'boolean',
1667 'label' => __( 'Close popup when user clicks on content of it. It\'s recommended to enable this option when you have only image in popup.', 'responsive-lightbox' ),
1668 'parent' => 'magnific'
1669 ),
1670 'close_on_background_click' => array(
1671 'title' => __( 'Close on background click', 'responsive-lightbox' ),
1672 'section' => 'responsive_lightbox_configuration',
1673 'type' => 'boolean',
1674 'label' => __( 'Close the popup when user clicks on the dark overlay.', 'responsive-lightbox' ),
1675 'parent' => 'magnific'
1676 ),
1677 'close_button_inside' => array(
1678 'title' => __( 'Close button inside', 'responsive-lightbox' ),
1679 'section' => 'responsive_lightbox_configuration',
1680 'type' => 'boolean',
1681 'label' => __( 'If enabled, Magnific Popup will put close button inside content of popup.', 'responsive-lightbox' ),
1682 'parent' => 'magnific'
1683 ),
1684 'show_close_button' => array(
1685 'title' => __( 'Show close button', 'responsive-lightbox' ),
1686 'section' => 'responsive_lightbox_configuration',
1687 'type' => 'boolean',
1688 'label' => __( 'Controls whether the close button will be displayed or not.', 'responsive-lightbox' ),
1689 'parent' => 'magnific'
1690 ),
1691 'enable_escape_key' => array(
1692 'title' => __( 'Enable escape key', 'responsive-lightbox' ),
1693 'section' => 'responsive_lightbox_configuration',
1694 'type' => 'boolean',
1695 'label' => __( 'Controls whether pressing the escape key will dismiss the active popup or not.', 'responsive-lightbox' ),
1696 'parent' => 'magnific'
1697 ),
1698 'align_top' => array(
1699 'title' => __( 'Align top', 'responsive-lightbox' ),
1700 'section' => 'responsive_lightbox_configuration',
1701 'type' => 'boolean',
1702 'label' => __( 'If set to true popup is aligned to top instead of to center.', 'responsive-lightbox' ),
1703 'parent' => 'magnific'
1704 ),
1705 'fixed_content_position' => array(
1706 'title' => __( 'Content position type', 'responsive-lightbox' ),
1707 'section' => 'responsive_lightbox_configuration',
1708 'type' => 'select',
1709 'description' => __( 'Popup content position. If set to "auto" popup will automatically disable this option when browser doesn\'t support fixed position properly.', 'responsive-lightbox' ),
1710 'options' => array(
1711 'auto' => __( 'Auto', 'responsive-lightbox' ),
1712 'true' => __( 'Fixed', 'responsive-lightbox' ),
1713 'false' => __( 'Absolute', 'responsive-lightbox' )
1714 ),
1715 'parent' => 'magnific'
1716 ),
1717 'fixed_background_position' => array(
1718 'title' => __( 'Fixed background position', 'responsive-lightbox' ),
1719 'section' => 'responsive_lightbox_configuration',
1720 'type' => 'select',
1721 'description' => __( 'Dark transluscent overlay content position.', 'responsive-lightbox' ),
1722 'options' => array(
1723 'auto' => __( 'Auto', 'responsive-lightbox' ),
1724 'true' => __( 'Fixed', 'responsive-lightbox' ),
1725 'false' => __( 'Absolute', 'responsive-lightbox' )
1726 ),
1727 'parent' => 'magnific'
1728 ),
1729 'auto_focus_last' => array(
1730 'title' => __( 'Auto focus last', 'responsive-lightbox' ),
1731 'section' => 'responsive_lightbox_configuration',
1732 'type' => 'boolean',
1733 'label' => __( 'If set to true last focused element before popup showup will be focused after popup close.', 'responsive-lightbox' ),
1734 'parent' => 'magnific'
1735 )
1736 );
1737 break;
1738
1739 default:
1740 $this->settings['configuration'] = apply_filters( 'rl_settings_' . ( ! empty( $section_key ) ? $section_key : Responsive_Lightbox()->options['settings']['script'] ) . '_script_configuration', $this->settings['configuration'] );
1741 }
1742
1743 if ( isset( $this->tabs[$tab_key]['submit'], $this->tabs[$tab_key]['reset'] ) && ! empty( $this->settings[$tab_key]['prefix'] ) ) {
1744 $this->tabs[$tab_key]['submit'] = 'save_' . $this->settings[$tab_key]['prefix'] . '_' . $tab_key;
1745 $this->tabs[$tab_key]['reset'] = 'reset_' . $this->settings[$tab_key]['prefix'] . '_' . $tab_key;
1746 }
1747 }
1748
1749 /**
1750 * Register options page
1751 *
1752 * @return void
1753 */
1754 public function admin_menu_options() {
1755 add_menu_page( __( 'General', 'responsive-lightbox' ), __( 'Lightbox', 'responsive-lightbox' ), apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ), 'responsive-lightbox-settings', '', 'dashicons-format-image', '57.1' );
1756
1757 $capability = apply_filters( 'rl_lightbox_settings_capability', 'manage_options' );
1758
1759 foreach ( $this->tabs as $key => $options ) {
1760 add_submenu_page( 'responsive-lightbox-settings', $options['name'], $options['name'], $capability, 'responsive-lightbox-' . $key , array( $this, 'options_page' ) );
1761 }
1762 }
1763
1764 /**
1765 * Render options page
1766 *
1767 * @return void
1768 */
1769 public function options_page() {
1770 // check settings page
1771 if ( isset( $_GET['page'] ) && preg_match( '/^responsive-lightbox-(' . implode( '|', array_keys( $this->tabs ) ) . ')$/', $_GET['page'], $tabs ) !== 1 )
1772 return;
1773
1774 $tab_key = isset( $tabs[1] ) ? $tabs[1] : 'settings';
1775 $section_key = isset( $_GET['section'] ) ? esc_attr( $_GET['section'] ) : ( ! empty( $this->tabs[$tab_key]['default_section'] ) ? $this->tabs[$tab_key]['default_section'] : '' );
1776
1777 echo '
1778 <div class="wrap">
1779 <h2>' . __( 'Responsive Lightbox & Gallery', 'responsive-lightbox' ) . ' - ' . $this->tabs[$tab_key]['name'] . '</h2>';
1780
1781 settings_errors();
1782
1783 echo '
1784 <h2 class="nav-tab-wrapper">';
1785
1786 foreach ( $this->tabs as $key => $options ) {
1787 echo '
1788 <a class="nav-tab ' . ( $tab_key == $key ? 'nav-tab-active' : '' ) . '" href="' . esc_url( admin_url( 'admin.php?page=responsive-lightbox-' . $key ) ) . '">' . $options['name'] . '</a>';
1789 }
1790
1791 echo '
1792 </h2>
1793 <div class="responsive-lightbox-settings">
1794
1795 <div class="df-credits">
1796 <h3 class="hndle">' . __( 'Responsive Lightbox & Gallery', 'responsive-lightbox' ) . ' ' . Responsive_Lightbox()->defaults['version'] . '</h3>
1797 <div class="inside">
1798 <h4 class="inner">' . __( 'Need support?', 'responsive-lightbox' ) . '</h4>
1799 <p class="inner">' . sprintf( __( 'If you are having problems with this plugin, please browse it\'s <a href="%s" target="_blank">Documentation</a> or talk about them in the <a href="%s" target="_blank">Support forum</a>', 'responsive-lightbox' ), 'https://www.dfactory.eu/docs/responsive-lightbox/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=docs', 'https://www.dfactory.eu/support/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=support' ) . '</p>
1800 <hr />
1801 <h4 class="inner">' . __( 'Do you like this plugin?', 'responsive-lightbox' ) . '</h4>
1802 <p class="inner">' . sprintf( __( '<a href="%s" target="_blank">Rate it 5</a> on WordPress.org', 'responsive-lightbox' ), 'https://wordpress.org/support/plugin/responsive-lightbox/reviews/?filter=5' ) . '<br />' .
1803 sprintf( __( 'Blog about it & link to the <a href="%s" target="_blank">plugin page</a>.', 'responsive-lightbox' ), 'https://dfactory.eu/plugins/responsive-lightbox/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=blog-about' ) . '<br />' .
1804 sprintf( __( 'Check out our other <a href="%s" target="_blank">WordPress plugins</a>.', 'responsive-lightbox' ), 'https://dfactory.eu/plugins/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=other-plugins' ) . '
1805 </p>
1806 <hr />
1807 <p class="df-link inner">Created by <a href="http://www.dfactory.eu/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . RESPONSIVE_LIGHTBOX_URL . '/images/logo-dfactory.png' . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
1808 </div>
1809 </div>
1810
1811 <form action="options.php" method="post">';
1812
1813 // views
1814 if ( ! empty( $this->tabs[$tab_key]['sections'] ) ) {
1815 $views = $this->tabs[$tab_key]['sections'];
1816
1817 echo '<ul class="subsubsub">';
1818
1819 foreach ( $views as $key => $name ) {
1820 $view = '<a href="' . esc_url( admin_url( 'admin.php?page=responsive-lightbox-' . $tab_key . '&section=' . $key ) ) . '" class="' . ( $key == $section_key ? 'current' : '' ) . '">' . $name . '</a>';
1821 $views[$key] = "\t<li class='$key'>$view";
1822 }
1823
1824 echo implode( " |</li>\n", $views ) . "</li>\n";
1825 echo '</ul><input type="hidden" name="section" value="' . $section_key . '" /><br class="clear">';
1826 }
1827
1828 // tab content callback
1829 if ( ! empty( $this->tabs[$tab_key]['callback'] ) )
1830 call_user_func( $this->tabs[$tab_key]['callback'] );
1831 else {
1832 wp_nonce_field( 'update-options' );
1833
1834 settings_fields( $this->tabs[$tab_key]['key'] );
1835 do_settings_sections( $this->tabs[$tab_key]['key'] );
1836
1837 if ( $tab_key === 'builder' )
1838 echo '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( add_query_arg( 'flush_rules', 1, $_SERVER['REQUEST_URI'] ) ) ) . '" />';
1839 }
1840
1841 if ( ! empty( $this->tabs[$tab_key]['submit'] ) || ! empty( $this->tabs[$tab_key]['reset'] ) ) {
1842 echo '<p class="submit">';
1843
1844 if ( ! empty( $this->tabs[$tab_key]['submit'] ) ) {
1845 submit_button( '', array( 'primary', 'save-' . $tab_key ), $this->tabs[$tab_key]['submit'], false );
1846 echo ' ';
1847 }
1848
1849 if ( ! empty( $this->tabs[$tab_key]['reset'] ) )
1850 submit_button( __( 'Reset to defaults', 'responsive-lightbox' ), array( 'secondary', 'reset-' . $tab_key ), $this->tabs[$tab_key]['reset'], false );
1851
1852 echo '</p>';
1853 }
1854
1855 echo '
1856 </form>
1857 </div>
1858 <div class="clear"></div>
1859 </div>';
1860 }
1861
1862 /**
1863 * Render settings function
1864 *
1865 * @return void
1866 */
1867 public function register_settings() {
1868 foreach ( $this->settings as $setting_id => $setting ) {
1869 // set key
1870 $setting_key = $setting_id;
1871 $setting_id = 'responsive_lightbox_' . $setting_id;
1872
1873 // register setting
1874 register_setting(
1875 esc_attr( $setting_id ),
1876 ! empty( $setting['option_name'] ) ? esc_attr( $setting['option_name'] ) : $setting_id,
1877 ! empty( $setting['callback'] ) ? $setting['callback'] : array( $this, 'validate_settings' )
1878 );
1879
1880 // register sections
1881 if ( ! empty( $setting['sections'] ) && is_array( $setting['sections'] ) ) {
1882 foreach ( $setting['sections'] as $section_id => $section ) {
1883 add_settings_section(
1884 esc_attr( $section_id ),
1885 ! empty( $section['title'] ) ? esc_html( $section['title'] ) : '',
1886 ! empty( $section['callback'] ) ? $section['callback'] : '',
1887 ! empty( $section['page'] ) ? esc_attr( $section['page'] ) : $section_id
1888 );
1889 }
1890 }
1891
1892 // register fields
1893 if ( ! empty( $setting['fields'] ) && is_array( $setting['fields'] ) ) {
1894 foreach ( $setting['fields'] as $field_id => $field ) {
1895 // prefix field id?
1896 $field_key = $field_id;
1897 $field_id = ( ! empty( $setting['prefix'] ) ? $setting['prefix'] . '_' : '' ) . $field_id;
1898
1899 // field args
1900 $args = array(
1901 'id' => ! empty( $field['id'] ) ? $field['id'] : $field_id,
1902 'class' => ! empty( $field['class'] ) ? $field['class'] : '',
1903 'name' => $setting['option_name'] . ( ! empty( $field['parent'] ) ? '[' . $field['parent'] . ']' : '' ) . '[' . $field_key . ']',
1904 'type' => ! empty( $field['type'] ) ? $field['type'] : 'text',
1905 'label' => ! empty( $field['label'] ) ? $field['label'] : '',
1906 'description' => ! empty( $field['description'] ) ? $field['description'] : '',
1907 'disabled' => isset( $field['disabled'] ) ? (bool) $field['disabled'] : false,
1908 'append' => ! empty( $field['append'] ) ? esc_html( $field['append'] ) : '',
1909 'prepend' => ! empty( $field['prepend'] ) ? esc_html( $field['prepend'] ) : '',
1910 'min' => ! empty( $field['min'] ) ? (int) $field['min'] : '',
1911 'max' => ! empty( $field['max'] ) ? (int) $field['max'] : '',
1912 'options' => ! empty( $field['options'] ) ? $field['options'] : '',
1913 'fields' => ! empty( $field['fields'] ) ? $field['fields'] : '',
1914 'after_field' => ! empty( $field['after_field'] ) ? $field['after_field'] : '',
1915 'default' => $field['type'] === 'multiple' ? '' : ( $this->sanitize_field( ! empty( $field['parent'] ) ? Responsive_Lightbox()->defaults[$setting_key][$field['parent']][$field_key] : Responsive_Lightbox()->defaults[$setting_key][$field_key], $field['type'] ) ),
1916 'value' => $field['type'] === 'multiple' ? '' : ( $this->sanitize_field( ! empty( $field['parent'] ) ? Responsive_Lightbox()->options[$setting_key][$field['parent']][$field_key] : ( isset( Responsive_Lightbox()->options[$setting_key][$field_key] ) ? Responsive_Lightbox()->options[$setting_key][$field_key] : Responsive_Lightbox()->defaults[$setting_key][$field_key] ), $field['type'] ) ),
1917 'label_for' => $field_id,
1918 'callback' => ! empty( $field['callback'] ) ? $field['callback'] : '',
1919 'return' => false
1920 );
1921
1922 if ( $args['type'] === 'multiple' ) {
1923 foreach ( $args['fields'] as $subfield_id => $subfield ) {
1924 $args['fields'][$subfield_id] = wp_parse_args( $subfield, array(
1925 'id' => $field_id . '-' . $subfield_id,
1926 'class' => ! empty( $subfield['class'] ) ? $subfield['class'] : '',
1927 'name' => $setting['option_name'] . ( ! empty( $subfield['parent'] ) ? '[' . $subfield['parent'] . ']' : '' ) . '[' . $subfield_id . ']',
1928 'default' => $this->sanitize_field( ! empty( $subfield['parent'] ) ? Responsive_Lightbox()->defaults[$setting_key][$subfield['parent']][$subfield_id] : Responsive_Lightbox()->defaults[$setting_key][$subfield_id], $subfield['type'] ),
1929 'value' => $this->sanitize_field( ! empty( $subfield['parent'] ) ? Responsive_Lightbox()->options[$setting_key][$subfield['parent']][$subfield_id] : Responsive_Lightbox()->options[$setting_key][$subfield_id], $subfield['type'] ),
1930 'return' => true
1931 ) );
1932 }
1933 }
1934
1935 add_settings_field(
1936 esc_attr( $field_id ),
1937 ! empty( $field['title'] ) ? esc_html( $field['title'] ) : '',
1938 array( $this, 'render_field' ),
1939 ! empty( $field['page'] ) ? esc_attr( $field['page'] ) : $setting_id,
1940 ! empty( $field['section'] ) ? esc_attr( $field['section'] ) : '',
1941 $args
1942 );
1943 }
1944 }
1945 }
1946
1947 // licenses
1948 $extensions = apply_filters( 'rl_settings_licenses', array() );
1949
1950 if ( $extensions ) {
1951 // register setting
1952 register_setting(
1953 'responsive_lightbox_licenses',
1954 'responsive_lightbox_licenses',
1955 array( $this, 'validate_licenses' )
1956 );
1957
1958 add_settings_section(
1959 'responsive_lightbox_licenses',
1960 __( 'Licenses', 'responsive-lightbox' ),
1961 array( $this, 'licenses_section_cb' ),
1962 'responsive_lightbox_licenses'
1963 );
1964
1965 foreach ( $extensions as $id => $extension ) {
1966 add_settings_field(
1967 esc_attr( $id ),
1968 $extension['name'],
1969 array( $this, 'license_field_cb' ),
1970 'responsive_lightbox_licenses',
1971 'responsive_lightbox_licenses',
1972 $extension
1973 );
1974 }
1975 }
1976 }
1977
1978 /**
1979 * Render settings field function
1980 *
1981 * @param array $args
1982 * @return mixed
1983 */
1984 public function render_field( $args ) {
1985 if ( empty( $args ) || ! is_array( $args ) )
1986 return;
1987
1988 $html = '';
1989
1990 switch ( $args['type'] ) {
1991 case 'boolean':
1992 $html .= '<label class="cb-checkbox"><input id="' . $args['id'] . '" type="checkbox" name="' . $args['name'] . '" value="1" ' . checked( (bool) $args['value'], true, false ) . ( isset( $args['disabled'] ) && $args['disabled'] == true ? ' disabled="disabled"' : '' ) . ' />' . $args['label'] . '</label>';
1993 break;
1994
1995 case 'radio':
1996 foreach ( $args['options'] as $key => $name ) {
1997 $html .= '<label class="cb-radio"><input id="' . $args['id'] . '-' . $key . '" type="radio" name="' . $args['name'] . '" value="' . $key . '" ' . checked( $key, $args['value'], false ) . ( isset( $args['disabled'] ) && $args['disabled'] == true ? ' disabled="disabled"' : '' ) . ' />' . $name . '</label> ';
1998 }
1999 break;
2000
2001 case 'checkbox':
2002 foreach ( $args['options'] as $key => $name ) {
2003 $html .= '<label class="cb-checkbox"><input id="' . $args['id'] . '-' . $key . '" type="checkbox" name="' . $args['name'] . '[' . $key . ']" value="1" ' . checked( in_array( $key, $args['value'] ), true, false ) . ( isset( $args['disabled'] ) && $args['disabled'] == true ? ' disabled="disabled"' : '' ) . ' />' . $name . '</label> ';
2004 }
2005 break;
2006
2007 case 'select':
2008 $html .= '<select id="' . $args['id'] . '" name="' . $args['name'] . '" value="' . $args['value'] . '" />';
2009
2010 foreach ( $args['options'] as $key => $name ) {
2011 $html .= '<option value="' . $key . '" ' . selected( $args['value'], $key, false ) . '>' . $name . '</option>';
2012 }
2013
2014 $html .= '</select>';
2015 break;
2016
2017 case 'multiple':
2018 $html .= '<fieldset>';
2019
2020 if ( $args['fields'] ) {
2021 $count = 1;
2022 $count_fields = count( $args['fields'] );
2023
2024 foreach ( $args['fields'] as $subfield_id => $subfield_args ) {
2025 $html .= $this->render_field( $subfield_args ) . ( $count < $count_fields ? '<br />' : '' );
2026 $count++;
2027 }
2028 }
2029
2030 $html .= '</fieldset>';
2031 break;
2032
2033 case 'range':
2034 $html .= '<input id="' . $args['id'] . '" type="range" name="' . $args['name'] . '" value="' . $args['value'] . '" min="' . $args['min'] . '" max="' . $args['max'] . '" oninput="this.form.' . $args['id'] . '_range.value=this.value" />';
2035 $html .= '<output name="' . $args['id'] . '_range">' . (int) $args['value'] . '</output>';
2036 break;
2037
2038 case 'color_picker':
2039 $html .= '<input id="' . $args['id'] . '" class="color-picker" type="text" value="' . $args['value'] . '" name="' . $args['name'] . '" data-default-color="' . $args['default'] . '" />';
2040 break;
2041
2042 case 'number':
2043 $html .= ( ! empty( $args['prepend'] ) ? '<span>' . $args['prepend'] . '</span> ' : '' );
2044 $html .= '<input id="' . $args['id'] . '" type="text" value="' . $args['value'] . '" name="' . $args['name'] . '" />';
2045 $html .= ( ! empty( $args['append'] ) ? ' <span>' . $args['append'] . '</span>' : '' );
2046 break;
2047
2048 case 'button':
2049 $html .= ( ! empty( $args['prepend'] ) ? '<span>' . $args['prepend'] . '</span> ' : '' );
2050 $html .= '<a href="' . esc_url( admin_url( 'admin.php?page=responsive-lightbox-tour' ) ) . '" id="' . $args['id'] . '" class="button button-secondary">' . esc_html( $args['label'] ) . '</a>';
2051 $html .= ( ! empty( $args['append'] ) ? ' <span>' . $args['append'] . '</spbuilderan>' : '' );
2052 break;
2053
2054 case 'custom':
2055 $html .= call_user_func( $args['callback'], $args );
2056 break;
2057
2058 case 'text':
2059 default :
2060 $html .= ( ! empty( $args['prepend'] ) ? '<span>' . $args['prepend'] . '</span> ' : '' );
2061 $html .= '<input id="' . $args['id'] . '" class="' . $args['class'] . '" type="text" value="' . $args['value'] . '" name="' . $args['name'] . '" />';
2062 $html .= ( ! empty( $args['append'] ) ? ' <span>' . $args['append'] . '</span>' : '' );
2063 }
2064
2065 if ( ! empty ( $args['after_field'] ) )
2066 $html .= $args['after_field'];
2067
2068 if ( ! empty ( $args['description'] ) )
2069 $html .= '<p class="description">' . $args['description'] . '</p>';
2070
2071 if ( ! empty( $args['return'] ) )
2072 return $html;
2073 else
2074 echo $html;
2075 }
2076
2077 /**
2078 * Sanitize field function
2079 *
2080 * @param mixed
2081 * @param string
2082 * @return mixed
2083 */
2084 public function sanitize_field( $value = null, $type = '', $args = array() ) {
2085 if ( is_null( $value ) )
2086 return null;
2087
2088 switch ( $type ) {
2089 case 'button':
2090 case 'boolean':
2091 $value = empty( $value ) ? false : true;
2092 break;
2093
2094 case 'checkbox':
2095 $value = is_array( $value ) && ! empty( $value ) ? array_map( 'sanitize_text_field', $value ) : array();
2096 break;
2097
2098 case 'radio':
2099 $value = is_array( $value ) ? false : sanitize_text_field( $value );
2100 break;
2101
2102 case 'textarea':
2103 case 'wysiwyg':
2104 $value = wp_kses_post( $value );
2105 break;
2106
2107 case 'color_picker':
2108 $value = ! $value || '#' == $value ? '' : esc_attr( $value );
2109 break;
2110
2111 case 'number':
2112 $value = (int) $value;
2113
2114 // is value lower than?
2115 if ( isset( $args['min'] ) && $value < $args['min'] )
2116 $value = $args['min'];
2117
2118 // is value greater than?
2119 if ( isset( $args['max'] ) && $value > $args['max'] )
2120 $value = $args['max'];
2121 break;
2122
2123 case 'custom':
2124 // do nothing
2125 break;
2126
2127 case 'text':
2128 case 'select':
2129 default:
2130 $value = is_array( $value ) ? array_map( 'sanitize_text_field', $value ) : sanitize_text_field( $value );
2131 break;
2132 }
2133
2134 return stripslashes_deep( $value );
2135 }
2136
2137 /**
2138 * Validate settings function
2139 *
2140 * @param array $input
2141 * @return array
2142 */
2143 public function validate_settings( $input ) {
2144 // check cap
2145 if ( ! current_user_can( apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ) ) )
2146 return $input;
2147
2148 if ( isset( $_POST['responsive_lightbox_settings']['tour'] ) ) {
2149
2150 }
2151
2152 // check page
2153 if ( ! isset( $_POST['option_page'] ) || ! ( $option_page = esc_attr( $_POST['option_page'] ) ) )
2154 return $input;
2155
2156 foreach ( $this->settings as $id => $setting ) {
2157 $key = array_search( $option_page, $setting );
2158
2159 if ( $key ) {
2160 // set key
2161 $setting_id = $id;
2162 break;
2163 }
2164 }
2165
2166 // check setting id
2167 if ( ! $setting_id )
2168 return $input;
2169
2170 // save settings
2171 if ( isset( $_POST['save' . '_' . $this->settings[$setting_id]['prefix'] . '_' . $setting_id] ) ) {
2172 if ( $this->settings[$setting_id]['fields'] ) {
2173 foreach ( $this->settings[$setting_id]['fields'] as $field_id => $field ) {
2174 if ( $field['type'] === 'multiple' ) {
2175 if ( $field['fields'] ) {
2176 foreach ( $field['fields'] as $subfield_id => $subfield ) {
2177 // if subfield has parent
2178 if ( ! empty( $this->settings[$setting_id]['fields'][$field_id]['fields'][$subfield_id]['parent'] ) ) {
2179 $field_parent = $this->settings[$setting_id]['fields'][$field_id]['fields'][$subfield_id]['parent'];
2180
2181 $input[$field_parent][$subfield_id] = isset( $input[$field_parent][$subfield_id] ) ? $this->sanitize_field( $input[$field_parent][$subfield_id], $subfield['type'] ) : ( $subfield['type'] === 'boolean' ? false : Responsive_Lightbox()->defaults[$setting_id][$field_parent][$subfield_id] );
2182 } else {
2183 $input[$subfield_id] = isset( $input[$subfield_id] ) ? $this->sanitize_field( $input[$subfield_id], $subfield['type'] ) : ( $subfield['type'] === 'boolean' ? false : Responsive_Lightbox()->defaults[$setting_id][$field_id][$subfield_id] );
2184 }
2185 }
2186 }
2187 } else {
2188 // if field has parent
2189 if ( ! empty( $this->settings[$setting_id]['fields'][$field_id]['parent'] ) ) {
2190 $field_parent = $this->settings[$setting_id]['fields'][$field_id]['parent'];
2191
2192 $input[$field_parent][$field_id] = isset( $input[$field_parent][$field_id] ) ? ( $field['type'] === 'checkbox' ? array_keys( $this->sanitize_field( $input[$field_parent][$field_id], $field['type'] ) ) : $this->sanitize_field( $input[$field_parent][$field_id], $field['type'] ) ) : ( in_array( $field['type'], array( 'boolean', 'checkbox' ) ) ? false : Responsive_Lightbox()->defaults[$setting_id][$field_parent][$field_id] );
2193 } else {
2194 $input[$field_id] = isset( $input[$field_id] ) ? ( $field['type'] === 'checkbox' ? array_keys( $this->sanitize_field( $input[$field_id], $field['type'] ) ) : $this->sanitize_field( $input[$field_id], $field['type'] ) ) : ( in_array( $field['type'], array( 'boolean', 'checkbox' ) ) ? false : Responsive_Lightbox()->defaults[$setting_id][$field_id] );
2195 }
2196 }
2197 }
2198 }
2199
2200 if ( $setting_id === 'settings' ) {
2201 // merge scripts settings
2202 $input = array_merge( Responsive_Lightbox()->options['settings'], $input );
2203 }
2204
2205 if ( $setting_id === 'configuration' ) {
2206 // merge scripts settings
2207 $input = array_merge( Responsive_Lightbox()->options['configuration'], $input );
2208 }
2209 } elseif ( isset( $_POST['reset' . '_' . $this->settings[$setting_id]['prefix'] . '_' . $setting_id] ) ) {
2210 if ( $setting_id === 'configuration' ) {
2211 $script = key( $input );
2212
2213 // merge scripts settings
2214 $input[$script] = Responsive_Lightbox()->defaults['configuration'][$script];
2215 $input = array_merge( Responsive_Lightbox()->options['configuration'], $input );
2216 } elseif ( $setting_id === 'settings' ) {
2217 $input = Responsive_Lightbox()->defaults[$setting_id];
2218 $input['update_version'] = Responsive_Lightbox()->options['settings']['update_version'];
2219 $input['update_notice'] = Responsive_Lightbox()->options['settings']['update_notice'];
2220 } else
2221 $input = Responsive_Lightbox()->defaults[$setting_id];
2222
2223 add_settings_error( 'reset_' . $this->settings[$setting_id]['prefix'] . '_' . $setting_id, 'settings_restored', __( 'Settings restored to defaults.', 'responsive-lightbox' ), 'updated' );
2224 }
2225
2226 return $input;
2227 }
2228
2229 /**
2230 * Add-ons tab callback
2231 *
2232 * @return mixed
2233 */
2234 private function addons_tab_cb() {
2235 ?>
2236 <h3><?php _e( 'Add-ons / Extensions', 'responsive-lightbox' ); ?></h3>
2237 <p class="description"><?php _e( 'Enhance your website with these beautiful, easy to use extensions, designed with Responsive Lightbox & Gallery integration in mind.', 'responsive-lightbox' ); ?></p>
2238 <br />
2239 <?php
2240 if ( ( $cache = get_transient( 'responsive_lightbox_addons_feed' ) ) === false ) {
2241 $url = 'https://dfactory.eu/?feed=addons&product=responsive-lightbox';
2242
2243 $feed = wp_remote_get( esc_url_raw( $url ), array( 'sslverify' => false ) );
2244
2245 if ( ! is_wp_error( $feed ) ) {
2246 if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 )
2247 $cache = wp_remote_retrieve_body( $feed );
2248 } else
2249 $cache = '<div class="error"><p>' . __( 'There was an error retrieving the extensions list from the server. Please try again later.', 'responsive-lightbox' ) . '</div>';
2250 }
2251
2252 echo $cache;
2253 }
2254
2255 /**
2256 * Licenses section callback.
2257 *
2258 * @return mixed
2259 */
2260 public function licenses_section_cb() {
2261 ?><p class="description"><?php _e( 'A list of licenses for your Responsive Lightbox & Gallery extensions.', 'responsive-lightbox' ); ?></p><?php
2262 }
2263
2264 /**
2265 * License field callback.
2266 *
2267 * @return mixed
2268 */
2269 public function license_field_cb( $args ) {
2270 $licenses = get_option( 'responsive_lightbox_licenses' );
2271 $license = ! empty( $licenses ) && isset( $licenses[$args['id']]['license'] ) ? esc_attr( $licenses[$args['id']]['license'] ) : '';
2272 $status = ! empty( $licenses ) && ! empty( $licenses[$args['id']]['status'] ) ? true : false;
2273 ?>
2274 <fieldset class="rl_license rl_license-<?php echo esc_attr( $args['id'] ); ?>">
2275 <input type="text" class="regular-text" name="responsive_lightbox_licenses[<?php echo esc_attr( $args['id'] ); ?>][license]" value="<?php echo $license; ?>"><span class="dashicons <?php echo ! empty( $status ) ? 'dashicons-yes' : 'dashicons-no'; ?>"></span>
2276 <p class="description"><?php printf( __( 'Enter your license key to activate %s extension and enable automatic upgrade notices.', 'responsive-lightbox' ), $args['name'] ); ?></p>
2277 </fieldset>
2278 <?php
2279 }
2280
2281 /**
2282 * Validate licenses function.
2283 *
2284 * @param array $input
2285 * @return array
2286 */
2287 public function validate_licenses( $input ) {
2288 // check cap
2289 if ( ! current_user_can( apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ) ) )
2290 return $input;
2291
2292 // check page
2293 if ( ! isset( $_POST['option_page'] ) || ! ( $option_page = esc_attr( $_POST['option_page'] ) ) )
2294 return $input;
2295
2296 // check data
2297 if ( ! isset( $_POST['responsive_lightbox_licenses'] ) || ! is_array( $_POST['responsive_lightbox_licenses'] ))
2298 return $input;
2299
2300 $extensions = apply_filters( 'rl_settings_licenses', array() );
2301
2302 if ( empty( $extensions ) )
2303 return $input;
2304
2305 // save settings
2306 if ( isset( $_POST['save_rl_licenses'] ) ) {
2307 $licenses = get_option( 'responsive_lightbox_licenses' );
2308 $statuses = array( 'updated' => 0, 'error' => 0 );
2309
2310 foreach ( $extensions as $extension ) {
2311 if ( ! isset( $_POST['responsive_lightbox_licenses'][$extension['id']] ) )
2312 continue;
2313
2314 $license = preg_replace('/[^a-zA-Z0-9]/', '', $_POST['responsive_lightbox_licenses'][$extension['id']]['license'] );
2315 $status = ! empty( $licenses ) && ! empty( $licenses[$extension['id']]['status'] ) ? true : false;
2316
2317 // request data
2318 $request_args = array(
2319 'action' => 'activate_license',
2320 'license' => trim( $license ),
2321 'item_name' => $extension['item_name']
2322 );
2323
2324 // request
2325 $response = $this->license_request( $request_args );
2326
2327 // validate request
2328 if ( is_wp_error( $response ) ) {
2329 $input[$extension['id']['status']] = false;
2330 $statuses['error']++;
2331 } else {
2332 // decode the license data
2333 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
2334
2335 // assign the data
2336 if ( $license_data->license == 'valid' ) {
2337 $input[$extension['id']]['status'] = true;
2338
2339 if ( $status === false )
2340 $statuses['updated']++;
2341 } else {
2342 $input[$extension['id']]['status'] = false;
2343 $statuses['error']++;
2344 }
2345 }
2346 }
2347
2348 // success notice
2349 if ( $statuses['updated'] > 0 )
2350 add_settings_error( 'rl_licenses_settings', 'license_activated', sprintf( _n( '%s license successfully activated.', '%s licenses successfully activated.', (int) $statuses['updated'], 'responsive-lightbox' ), (int) $statuses['updated'] ), 'updated' );
2351
2352 // failed notice
2353 if ( $statuses['error'] > 0 )
2354 add_settings_error( 'rl_licenses_settings', 'license_activation_failed', sprintf( _n( '%s license activation failed.', '%s licenses activation failed.', (int) $statuses['error'], 'responsive-lightbox' ), (int) $statuses['error'] ), 'error' );
2355 } elseif ( isset( $_POST['reset_rl_licenses'] ) ) {
2356 $licenses = get_option( 'responsive_lightbox_licenses' );
2357 $statuses = array( 'updated' => 0, 'error' => 0 );
2358
2359 foreach ( $extensions as $extension ) {
2360 $license = ! empty( $licenses ) && isset( $licenses[$extension['id']]['license'] ) ? $licenses[$extension['id']]['license'] : '';
2361 $status = ! empty( $licenses ) && ! empty( $licenses[$extension['id']]['status'] ) ? true : false;
2362
2363 if ( $status === true || ( $status === false && ! empty( $license ) ) ) {
2364 // request data
2365 $request_args = array(
2366 'action' => 'deactivate_license',
2367 'license' => trim( $license ),
2368 'item_name' => $extension['item_name']
2369 );
2370
2371 // request
2372 $response = $this->license_request( $request_args );
2373
2374 // validate request
2375 if ( is_wp_error( $response ) )
2376 $statuses['error']++;
2377 else {
2378 // decode the license data
2379 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
2380
2381 // assign the data
2382 if ( $license_data->license == 'deactivated' ) {
2383 $input[$extension['id']]['license'] = '';
2384 $input[$extension['id']]['status'] = false;
2385 $statuses['updated']++;
2386 } else
2387 $statuses['error']++;
2388 }
2389 }
2390 }
2391
2392 // success notice
2393 if ( $statuses['updated'] > 0 )
2394 add_settings_error( 'rl_licenses_settings', 'license_deactivated', sprintf( _n( '%s license successfully deactivated.', '%s licenses successfully deactivated.', (int) $statuses['updated'], 'responsive-lightbox' ), (int) $statuses['updated'] ), 'updated' );
2395
2396 // failed notice
2397 if ( $statuses['error'] > 0 )
2398 add_settings_error( 'rl_licenses_settings', 'license_deactivation_failed', sprintf( _n( '%s license deactivation failed.', '%s licenses deactivation failed.', (int) $statuses['error'], 'responsive-lightbox' ), (int) $statuses['error'] ), 'error' );
2399 }
2400
2401 return $input;
2402 }
2403
2404 /**
2405 * License request function.
2406 *
2407 * @param array $args
2408 * @return mixed
2409 */
2410 private function license_request( $args ) {
2411 // data to send in our API request
2412 $api_params = array(
2413 'edd_action' => $args['action'],
2414 'license' => $args['license'],
2415 'item_name' => urlencode( $args['item_name'] ),
2416 // 'item_id' => $args['item_id'],
2417 'url' => home_url(),
2418 'timeout' => 60,
2419 'sslverify' => false
2420 );
2421
2422 // call the custom API.
2423 $response = wp_remote_get( add_query_arg( $api_params, 'http://dfactory.eu' ) );
2424
2425 return $response;
2426 }
2427 }