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