PluginProbe ʕ •ᴥ•ʔ
Responsive Lightbox & Gallery / 1.4.2
Responsive Lightbox & Gallery v1.4.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 / responsive-lightbox.php
responsive-lightbox Last commit date
assets 12 years ago css 12 years ago images 12 years ago js 12 years ago languages 12 years ago index.php 12 years ago readme.txt 12 years ago responsive-lightbox.php 12 years ago
responsive-lightbox.php
2319 lines
1 <?php
2 /*
3 Plugin Name: Responsive Lightbox
4 Description: Responsive Lightbox allows users to view larger versions of images and galleries in a lightbox (overlay) effect optimized for mobile devices.
5 Version: 1.4.2
6 Author: dFactory
7 Author URI: http://www.dfactory.eu/
8 Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
9 License: MIT License
10 License URI: http://opensource.org/licenses/MIT
11 Text Domain: responsive-lightbox
12 Domain Path: /languages
13
14 Responsive Lightbox
15 Copyright (C) 2013, Digital Factory - info@digitalfactory.pl
16
17 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24
25 class Responsive_Lightbox
26 {
27 private $defaults = array(
28 'settings' => array(
29 'script' => 'swipebox',
30 'selector' => 'lightbox',
31 'galleries' => true,
32 'videos' => true,
33 'image_links' => true,
34 'images_as_gallery' => false,
35 'deactivation_delete' => false,
36 'loading_place' => 'header',
37 'enable_custom_events' => false,
38 'custom_events' => 'ajaxComplete'
39 ),
40 'configuration' => array(
41 'prettyphoto' => array(
42 'animation_speed' => 'normal',
43 'slideshow' => false,
44 'slideshow_delay' => 5000,
45 'slideshow_autoplay' => false,
46 'opacity' => 75,
47 'show_title' => true,
48 'allow_resize' => true,
49 'allow_expand' => true,
50 'width' => 1080,
51 'height' => 720,
52 'separator' => '/',
53 'theme' => 'pp_default',
54 'horizontal_padding' => 20,
55 'hide_flash' => false,
56 'wmode' => 'opaque',
57 'video_autoplay' => false,
58 'modal' => false,
59 'deeplinking' => false,
60 'overlay_gallery' => true,
61 'keyboard_shortcuts' => true,
62 'social' => false
63 ),
64 'swipebox' => array(
65 'animation' => 'css',
66 'force_png_icons' => false,
67 'hide_bars' => true,
68 'hide_bars_delay' => 5000,
69 'video_max_width' => 1080
70 ),
71 'fancybox' => array(
72 'modal' => false,
73 'show_overlay' => true,
74 'show_close_button' => true,
75 'enable_escape_button' => true,
76 'hide_on_overlay_click' => true,
77 'hide_on_content_click' => false,
78 'cyclic' => false,
79 'show_nav_arrows' => true,
80 'auto_scale' => true,
81 'scrolling' => 'yes',
82 'center_on_scroll' => true,
83 'opacity' => true,
84 'overlay_opacity' => 70,
85 'overlay_color' => '#666',
86 'title_show' => true,
87 'title_position' => 'outside',
88 'transitions' => 'fade',
89 'easings' => 'swing',
90 'speeds' => 300,
91 'change_speed' => 300,
92 'change_fade' => 100,
93 'padding' => 5,
94 'margin' => 5,
95 'video_width' => 1080,
96 'video_height' => 720
97 ),
98 'nivo' => array(
99 'effect' => 'fade',
100 'keyboard_nav' => true,
101 'error_message' => 'The requested content cannot be loaded. Please try again later.'
102 ),
103 'imagelightbox' => array(
104 'animation_speed' => 250,
105 'preload_next' => true,
106 'enable_keyboard' => true,
107 'quit_on_end' => false,
108 'quit_on_image_click' => false,
109 'quit_on_document_click' => true
110 )
111 ),
112 'version' => '1.4.2'
113 );
114 private $scripts = array();
115 private $options = array();
116 private $tabs = array();
117 private $choices = array();
118 private $loading_places = array();
119 private $gallery_no = 0;
120
121
122 public function __construct()
123 {
124 register_activation_hook(__FILE__, array(&$this, 'multisite_activation'));
125 register_deactivation_hook(__FILE__, array(&$this, 'multisite_deactivation'));
126
127 //changes from older versions
128 $db_version = get_option('responsive_lightbox_version');
129
130 if(version_compare(($db_version === FALSE ? '1.0.0' : $db_version), '1.0.5', '<'))
131 {
132 if(($array = get_option('rl_settings')) !== FALSE)
133 {
134 update_option('responsive_lightbox_settings', $array);
135 delete_option('rl_settings');
136 }
137
138 if(($array = get_option('rl_configuration')) !== FALSE)
139 {
140 update_option('responsive_lightbox_configuration', $array);
141 delete_option('rl_configuration');
142 }
143 }
144
145 //update plugin version
146 update_option('responsive_lightbox_version', $this->defaults['version'], '', 'no');
147
148 $this->options['settings'] = array_merge($this->defaults['settings'], (($array = get_option('responsive_lightbox_settings')) === FALSE ? array() : $array));
149
150 //for multi arrays we have to merge them separately
151 $db_conf_opts = (($base = get_option('responsive_lightbox_configuration')) === FALSE ? array() : $base);
152
153 foreach($this->defaults['configuration'] as $script => $settings)
154 {
155 $this->options['configuration'][$script] = array_merge($settings, (isset($db_conf_opts[$script]) ? $db_conf_opts[$script] : array()));
156 }
157
158 //actions
159 add_action('plugins_loaded', array(&$this, 'load_textdomain'));
160 add_action('plugins_loaded', array(&$this, 'load_defaults'));
161 add_action('admin_init', array(&$this, 'register_settings'));
162 add_action('admin_menu', array(&$this, 'admin_menu_options'));
163 add_action('wp_enqueue_scripts', array(&$this, 'front_scripts_styles'));
164 add_action('admin_enqueue_scripts', array(&$this, 'admin_scripts_styles'));
165
166 //filters
167 add_filter('plugin_action_links', array(&$this, 'plugin_settings_link'), 10, 2);
168 add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
169 add_filter('post_gallery', array(&$this, 'gallery_attributes'), 1000);
170
171 if($this->options['settings']['galleries'] === TRUE)
172 add_filter('wp_get_attachment_link', array(&$this, 'add_gallery_lightbox_selector'), 1000, 6);
173
174 if($this->options['settings']['videos'] === TRUE)
175 add_filter('the_content', array(&$this, 'add_videos_lightbox_selector'));
176
177 if($this->options['settings']['image_links'] === TRUE || $this->options['settings']['images_as_gallery'] === TRUE)
178 add_filter('the_content', array(&$this, 'add_links_lightbox_selector'));
179 }
180
181
182 public function add_videos_lightbox_selector($content)
183 {
184 preg_match_all('/<a(.*?)href=(?:\'|")((?:(?:http|https):\/\/)?(?:www\.)?((youtube\.com\/watch\?v=[a-z0-9_\-]+)|(vimeo\.com\/[0-9]{8,})))(?:\'|")(.*?)>/i', $content, $links);
185
186 if(isset($links[0]))
187 {
188 foreach($links[0] as $id => $link)
189 {
190 if(preg_match('/<a.*?rel=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result) === 1)
191 {
192 if(isset($result[1]))
193 {
194 $new_rels = array();
195 $rels = explode(' ', $result[1]);
196
197 if(in_array($this->options['settings']['selector'], $rels, TRUE))
198 {
199 foreach($rels as $no => $rel)
200 {
201 if($rel !== $this->options['settings']['selector'])
202 $new_rels[] = $rel;
203 }
204
205 $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.(!empty($new_rel) ? simplode(' ', $new_rels).' ' : '').$this->options['settings']['selector'].'-video-'.$id.'"', $link), $content);
206 }
207 else
208 $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.($result[1] !== '' ? $result[1].' ' : '').$this->options['settings']['selector'].'-video-'.$id.'"', $link), $content);
209 }
210 }
211 else
212 $content = str_replace($link, '<a'.$links[1][$id].'href="'.$links[2][$id].'"'.$links[6][$id].' rel="'.$this->options['settings']['selector'].'-video-'.$id.'">', $content);
213 }
214 }
215
216 return $content;
217 }
218
219
220 public function add_links_lightbox_selector($content)
221 {
222 preg_match_all('/<a(.*?)href=(?:\'|")([^<]*?).(bmp|gif|jpeg|jpg|png)(?:\'|")(.*?)>/i', $content, $links);
223
224 if(isset($links[0]))
225 {
226 if($this->options['settings']['images_as_gallery'] === TRUE)
227 $rel_hash = '[gallery-'.wp_generate_password(4, FALSE, FALSE).']';
228
229 foreach($links[0] as $id => $link)
230 {
231 if(preg_match('/<a.*?rel=(?:\'|")(.*?)(?:\'|").*?>/', $link, $result) === 1)
232 {
233 if($this->options['settings']['images_as_gallery'] === TRUE)
234 {
235 $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.$this->options['settings']['selector'].$rel_hash.'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : ''), $link), $content);
236 }
237 else
238 {
239 if(isset($result[1]))
240 {
241 $new_rels = array();
242 $rels = explode(' ', $result[1]);
243
244 if(in_array($this->options['settings']['selector'], $rels, TRUE))
245 {
246 foreach($rels as $no => $rel)
247 {
248 if($rel !== $this->options['settings']['selector'])
249 $new_rels[] = $rel;
250 }
251
252 $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.(!empty($new_rels) ? implode(' ', $new_rels).' ' : '').$this->options['settings']['selector'].'-'.$id.'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : ''), $link), $content);
253 }
254 else
255 $content = str_replace($link, preg_replace('/rel=(?:\'|")(.*?)(?:\'|")/', 'rel="'.($result[1] !== '' ? $result[1].' ' : '').$this->options['settings']['selector'].'-'.$id.'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : ''), $link), $content);
256 }
257 }
258 }
259 else
260 $content = str_replace($link, '<a'.$links[1][$id].'href="'.$links[2][$id].'.'.$links[3][$id].'"'.$links[4][$id].' rel="'.$this->options['settings']['selector'].($this->options['settings']['images_as_gallery'] === TRUE ? $rel_hash : '-'.$id).'"'.($this->options['settings']['script'] === 'imagelightbox' ? ' data-imagelightbox="'.$id.'"' : '').'>', $content);
261 }
262 }
263
264 return $content;
265 }
266
267
268 public function gallery_attributes($style)
269 {
270 ++$this->gallery_no;
271
272 return $style;
273 }
274
275
276 public function add_gallery_lightbox_selector($link, $id, $size, $permalink, $icon, $text)
277 {
278 $link = (preg_match('/<a.*? rel=("|\').*?("|\')>/', $link) === 1 ? preg_replace('/(<a.*? rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 '.$this->options['settings']['selector'].'[gallery-'.$this->gallery_no.']'.'$2', $link) : preg_replace('/(<a.*?)>/', '$1 rel="'.$this->options['settings']['selector'].'[gallery-'.$this->gallery_no.']'.'">', $link));
279
280 return (preg_match('/<a.*? href=("|\').*?("|\')>/', $link) === 1 ? preg_replace('/(<a.*? href=(?:"|\')).*?((?:"|\').*?>)/', '$1'.wp_get_attachment_url($id).'$2', $link) : preg_replace('/(<a.*?)>/', '$1 href="'.wp_get_attachment_url($id).'">', $link));
281 }
282
283
284 public function load_defaults()
285 {
286 $this->scripts = array(
287 'prettyphoto' => array(
288 'name' => __('prettyPhoto', 'responsive-lightbox'),
289 'animation_speeds' => array(
290 'slow' => __('slow', 'responsive-lightbox'),
291 'normal' => __('normal', 'responsive-lightbox'),
292 'fast' => __('fast', 'responsive-lightbox')
293 ),
294 'themes' => array(
295 'pp_default' => __('default', 'responsive-lightbox'),
296 'light_rounded' => __('light rounded', 'responsive-lightbox'),
297 'dark_rounded' => __('dark rounded', 'responsive-lightbox'),
298 'light_square' => __('light square', 'responsive-lightbox'),
299 'dark_square' => __('dark square', 'responsive-lightbox'),
300 'facebook' => __('facebook', 'responsive-lightbox')
301 ),
302 'wmodes' => array(
303 'window' => __('window', 'responsive-lightbox'),
304 'transparent' => __('transparent', 'responsive-lightbox'),
305 'opaque' => __('opaque', 'responsive-lightbox'),
306 'direct' => __('direct', 'responsive-lightbox'),
307 'gpu' => __('gpu', 'responsive-lightbox')
308 )
309 ),
310 'swipebox' => array(
311 'name' => __('SwipeBox', 'responsive-lightbox'),
312 'animations' => array(
313 'css' => __('CSS', 'responsive-lightbox'),
314 'jquery' => __('jQuery', 'responsive-lightbox')
315 )
316 ),
317 'fancybox' => array(
318 'name' => __('FancyBox', 'responsive-lightbox'),
319 'transitions' => array(
320 'elastic' => __('elastic', 'responsive-lightbox'),
321 'fade' => __('fade', 'responsive-lightbox'),
322 'none' => __('none', 'responsive-lightbox')
323 ),
324 'scrollings' => array(
325 'auto' => __('auto', 'responsive-lightbox'),
326 'yes' => __('yes', 'responsive-lightbox'),
327 'no' => __('no', 'responsive-lightbox')
328 ),
329 'easings' => array(
330 'swing' => __('swing', 'responsive-lightbox'),
331 'linear' => __('linear', 'responsive-lightbox')
332 ),
333 'positions' => array(
334 'outside' => __('outside', 'responsive-lightbox'),
335 'inside' => __('inside', 'responsive-lightbox'),
336 'over' => __('over', 'responsive-lightbox')
337 )
338 ),
339 'nivo' => array(
340 'name' => __('Nivo Lightbox', 'responsive-lightbox'),
341 'effects' => array(
342 'fade' => __('fade', 'responsive-lightbox'),
343 'fadeScale' => __('fade scale', 'responsive-lightbox'),
344 'slideLeft' => __('slide left', 'responsive-lightbox'),
345 'slideRight' => __('slide right', 'responsive-lightbox'),
346 'slideUp' => __('slide up', 'responsive-lightbox'),
347 'slideDown' => __('slide down', 'responsive-lightbox'),
348 'fall' => __('fall', 'responsive-lightbox')
349 )
350 ),
351 'imagelightbox' => array(
352 'name' => __('Image Lightbox', 'responsive-lightbox')
353 )
354 );
355
356 $this->choices = array(
357 'yes' => __('Enable', 'responsive-lightbox'),
358 'no' => __('Disable', 'responsive-lightbox')
359 );
360
361 $this->loading_places = array(
362 'header' => __('Header', 'responsive-lightbox'),
363 'footer' => __('Footer', 'responsive-lightbox')
364 );
365
366 $this->tabs = array(
367 'general-settings' => array(
368 'name' => __('General settings', 'responsive-lightbox'),
369 'key' => 'responsive_lightbox_settings',
370 'submit' => 'save_rl_settings',
371 'reset' => 'reset_rl_settings',
372 ),
373 'configuration' => array(
374 'name' => __('Lightbox settings', 'responsive-lightbox'),
375 'key' => 'responsive_lightbox_configuration',
376 'submit' => 'save_rl_configuration',
377 'reset' => 'reset_rl_configuration'
378 )
379 );
380 }
381
382
383 public function multisite_activation($networkwide)
384 {
385 if(is_multisite() && $networkwide)
386 {
387 global $wpdb;
388
389 $activated_blogs = array();
390 $current_blog_id = $wpdb->blogid;
391 $blogs_ids = $wpdb->get_col($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs, ''));
392
393 foreach($blogs_ids as $blog_id)
394 {
395 switch_to_blog($blog_id);
396 $this->activate_single();
397 $activated_blogs[] = (int)$blog_id;
398 }
399
400 switch_to_blog($current_blog_id);
401 update_site_option('responsive_lightbox_activated_blogs', $activated_blogs, array());
402 }
403 else
404 $this->activate_single();
405 }
406
407
408 public function activate_single()
409 {
410 add_option('responsive_lightbox_settings', $this->defaults['settings'], '', 'no');
411 add_option('responsive_lightbox_configuration', $this->defaults['configuration'], '', 'no');
412 add_option('responsive_lightbox_version', $this->defaults['version'], '', 'no');
413 }
414
415
416 public function multisite_deactivation($networkwide)
417 {
418 if(is_multisite() && $networkwide)
419 {
420 global $wpdb;
421
422 $current_blog_id = $wpdb->blogid;
423 $blogs_ids = $wpdb->get_col($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs, ''));
424
425 if(($activated_blogs = get_site_option('responsive_lightbox_activated_blogs', FALSE, FALSE)) === FALSE)
426 $activated_blogs = array();
427
428 foreach($blogs_ids as $blog_id)
429 {
430 switch_to_blog($blog_id);
431 $this->deactivate_single(TRUE);
432
433 if(in_array((int)$blog_id, $activated_blogs, TRUE))
434 unset($activated_blogs[array_search($blog_id, $activated_blogs)]);
435 }
436
437 switch_to_blog($current_blog_id);
438 update_site_option('responsive_lightbox_activated_blogs', $activated_blogs);
439 }
440 else
441 $this->deactivate_single();
442 }
443
444
445 public function deactivate_single($multi = FALSE)
446 {
447 if($multi === TRUE)
448 {
449 $options = get_option('responsive_lightbox_settings');
450 $check = $options['deactivation_delete'];
451 }
452 else
453 $check = $this->options['settings']['deactivation_delete'];
454
455 if($check === TRUE)
456 {
457 delete_option('responsive_lightbox_settings');
458 delete_option('responsive_lightbox_configuration');
459 delete_option('responsive_lightbox_version');
460 }
461 }
462
463
464 public function register_settings()
465 {
466 register_setting('responsive_lightbox_settings', 'responsive_lightbox_settings', array(&$this, 'validate_options'));
467
468 //general settings
469 add_settings_section('responsive_lightbox_settings', __('General settings', 'responsive-lightbox'), '', 'responsive_lightbox_settings');
470 add_settings_field('rl_script', __('Lightbox script', 'responsive-lightbox'), array(&$this, 'rl_script'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
471 add_settings_field('rl_selector', __('Selector', 'responsive-lightbox'), array(&$this, 'rl_selector'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
472 add_settings_field('rl_galleries', __('Galleries', 'responsive-lightbox'), array(&$this, 'rl_galleries'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
473 add_settings_field('rl_videos', __('Video links', 'responsive-lightbox'), array(&$this, 'rl_videos'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
474 add_settings_field('rl_image_links', __('Image links', 'responsive-lightbox'), array(&$this, 'rl_image_links'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
475 add_settings_field('rl_images_as_gallery', __('Single images as gallery', 'responsive-lightbox'), array(&$this, 'rl_images_as_gallery'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
476 add_settings_field('rl_enable_custom_events', __('Custom events', 'responsive-lightbox'), array(&$this, 'rl_enable_custom_events'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
477 add_settings_field('rl_loading_place', __('Loading place', 'responsive-lightbox'), array(&$this, 'rl_loading_place'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
478 add_settings_field('rl_deactivation_delete', __('Deactivation', 'responsive-lightbox'), array(&$this, 'rl_deactivation_delete'), 'responsive_lightbox_settings', 'responsive_lightbox_settings');
479
480 //configuration
481 register_setting('responsive_lightbox_configuration', 'responsive_lightbox_configuration', array(&$this, 'validate_options'));
482 add_settings_section('responsive_lightbox_configuration', __('Lightbox settings', 'responsive-lightbox').': '.$this->scripts[$this->options['settings']['script']]['name'], '', 'responsive_lightbox_configuration');
483
484 if($this->options['settings']['script'] === 'swipebox')
485 {
486 add_settings_field('rl_sb_animation', __('Animation type', 'responsive-lightbox'), array(&$this, 'rl_sb_animation'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
487 add_settings_field('rl_sb_force_png_icons', __('Force PNG icons', 'responsive-lightbox'), array(&$this, 'rl_sb_force_png_icons'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
488 add_settings_field('rl_sb_hide_bars', __('Top and bottom bars', 'responsive-lightbox'), array(&$this, 'rl_sb_hide_bars'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
489 add_settings_field('rl_sb_video_max_width', __('Video max width', 'responsive-lightbox'), array(&$this, 'rl_sb_video_max_width'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
490 }
491 elseif($this->options['settings']['script'] === 'prettyphoto')
492 {
493 add_settings_field('rl_pp_animation_speed', __('Animation speed', 'responsive-lightbox'), array(&$this, 'rl_pp_animation_speed'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
494 add_settings_field('rl_pp_slideshow', __('Slideshow', 'responsive-lightbox'), array(&$this, 'rl_pp_slideshow'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
495 add_settings_field('rl_pp_slideshow_autoplay', __('Slideshow autoplay', 'responsive-lightbox'), array(&$this, 'rl_pp_slideshow_autoplay'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
496 add_settings_field('rl_pp_opacity', __('Opacity', 'responsive-lightbox'), array(&$this, 'rl_pp_opacity'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
497 add_settings_field('rl_pp_title', __('Show title', 'responsive-lightbox'), array(&$this, 'rl_pp_title'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
498 add_settings_field('rl_pp_allow_resize', __('Allow resize big images', 'responsive-lightbox'), array(&$this, 'rl_pp_allow_resize'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
499 add_settings_field('rl_pp_allow_expand', __('Allow expand', 'responsive-lightbox'), array(&$this, 'rl_pp_allow_expand'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
500 add_settings_field('rl_pp_width', __('Video width', 'responsive-lightbox'), array(&$this, 'rl_pp_width'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
501 add_settings_field('rl_pp_height', __('Video height', 'responsive-lightbox'), array(&$this, 'rl_pp_height'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
502 add_settings_field('rl_pp_theme', __('Theme', 'responsive-lightbox'), array(&$this, 'rl_pp_theme'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
503 add_settings_field('rl_pp_horizontal_padding', __('Horizontal padding', 'responsive-lightbox'), array(&$this, 'rl_pp_horizontal_padding'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
504 add_settings_field('rl_pp_hide_flash', __('Hide Flash', 'responsive-lightbox'), array(&$this, 'rl_pp_hide_flash'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
505 add_settings_field('rl_pp_wmode', __('Flash Window Mode (wmode)', 'responsive-lightbox'), array(&$this, 'rl_pp_wmode'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
506 add_settings_field('rl_pp_video_autoplay', __('Video autoplay', 'responsive-lightbox'), array(&$this, 'rl_pp_video_autoplay'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
507 add_settings_field('rl_pp_modal', __('Modal', 'responsive-lightbox'), array(&$this, 'rl_pp_modal'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
508 add_settings_field('rl_pp_deeplinking', __('Deeplinking', 'responsive-lightbox'), array(&$this, 'rl_pp_deeplinking'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
509 add_settings_field('rl_pp_overlay_gallery', __('Overlay gallery', 'responsive-lightbox'), array(&$this, 'rl_pp_overlay_gallery'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
510 add_settings_field('rl_pp_keyboard_shortcuts', __('Keyboard shortcuts', 'responsive-lightbox'), array(&$this, 'rl_pp_keyboard_shortcuts'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
511 add_settings_field('rl_pp_social', __('Social (Twitter, Facebook)', 'responsive-lightbox'), array(&$this, 'rl_pp_social'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
512 }
513 elseif($this->options['settings']['script'] === 'fancybox')
514 {
515 add_settings_field('rl_fb_modal', __('Modal', 'responsive-lightbox'), array(&$this, 'rl_fb_modal'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
516 add_settings_field('rl_fb_show_overlay', __('Show overlay', 'responsive-lightbox'), array(&$this, 'rl_fb_show_overlay'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
517 add_settings_field('rl_fb_show_close_button', __('Show close button', 'responsive-lightbox'), array(&$this, 'rl_fb_show_close_button'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
518 add_settings_field('rl_fb_enable_escape_button', __('Enable escape button', 'responsive-lightbox'), array(&$this, 'rl_fb_enable_escape_button'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
519 add_settings_field('rl_fb_hide_on_overlay_click', __('Hide on overlay click', 'responsive-lightbox'), array(&$this, 'rl_fb_hide_on_overlay_click'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
520 add_settings_field('rl_fb_hide_on_content_click', __('Hide on content click', 'responsive-lightbox'), array(&$this, 'rl_fb_hide_on_content_click'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
521 add_settings_field('rl_fb_cyclic', __('Cyclic', 'responsive-lightbox'), array(&$this, 'rl_fb_cyclic'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
522 add_settings_field('rl_fb_show_nav_arrows', __('Show nav arrows', 'responsive-lightbox'), array(&$this, 'rl_fb_show_nav_arrows'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
523 add_settings_field('rl_fb_auto_scale', __('Auto scale', 'responsive-lightbox'), array(&$this, 'rl_fb_auto_scale'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
524 add_settings_field('rl_fb_scrolling', __('Scrolling (in/out)', 'responsive-lightbox'), array(&$this, 'rl_fb_scrolling'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
525 add_settings_field('rl_fb_center_on_scroll', __('Center on scroll', 'responsive-lightbox'), array(&$this, 'rl_fb_center_on_scroll'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
526 add_settings_field('rl_fb_opacity', __('Opacity', 'responsive-lightbox'), array(&$this, 'rl_fb_opacity'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
527 add_settings_field('rl_fb_overlay_opacity', __('Overlay opacity', 'responsive-lightbox'), array(&$this, 'rl_fb_overlay_opacity'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
528 add_settings_field('rl_fb_overlay_color', __('Overlay color', 'responsive-lightbox'), array(&$this, 'rl_fb_overlay_color'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
529 add_settings_field('rl_fb_title_show', __('Title show', 'responsive-lightbox'), array(&$this, 'rl_fb_title_show'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
530 add_settings_field('rl_fb_title_position', __('Title position', 'responsive-lightbox'), array(&$this, 'rl_fb_title_position'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
531 add_settings_field('rl_fb_transitions', __('Transition (in/out)', 'responsive-lightbox'), array(&$this, 'rl_fb_transitions'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
532 add_settings_field('rl_fb_easings', __('Easings (in/out)', 'responsive-lightbox'), array(&$this, 'rl_fb_easings'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
533 add_settings_field('rl_fb_speeds', __('Speed (in/out)', 'responsive-lightbox'), array(&$this, 'rl_fb_speeds'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
534 add_settings_field('rl_fb_change_speed', __('Change speed', 'responsive-lightbox'), array(&$this, 'rl_fb_change_speed'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
535 add_settings_field('rl_fb_change_fade', __('Change fade', 'responsive-lightbox'), array(&$this, 'rl_fb_change_fade'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
536 add_settings_field('rl_fb_padding', __('Padding', 'responsive-lightbox'), array(&$this, 'rl_fb_padding'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
537 add_settings_field('rl_fb_margin', __('Margin', 'responsive-lightbox'), array(&$this, 'rl_fb_margin'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
538 add_settings_field('rl_fb_video_width', __('Video width', 'responsive-lightbox'), array(&$this, 'rl_fb_video_width'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
539 add_settings_field('rl_fb_video_height', __('Video height', 'responsive-lightbox'), array(&$this, 'rl_fb_video_height'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
540 }
541 elseif($this->options['settings']['script'] === 'nivo')
542 {
543 add_settings_field('rl_nv_effect', __('Effect', 'responsive-lightbox'), array(&$this, 'rl_nv_effect'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
544 add_settings_field('rl_nv_keyboard_nav', __('Keyboard navigation', 'responsive-lightbox'), array(&$this, 'rl_nv_keyboard_nav'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
545 add_settings_field('rl_nv_error_message', __('Error message', 'responsive-lightbox'), array(&$this, 'rl_nv_error_message'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
546 }
547 elseif($this->options['settings']['script'] === 'imagelightbox')
548 {
549 add_settings_field('rl_il_animation_speed', __('Animation speed', 'responsive-lightbox'), array(&$this, 'rl_il_animation_speed'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
550 add_settings_field('rl_il_preload_next', __('Preload next image', 'responsive-lightbox'), array(&$this, 'rl_il_preload_next'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
551 add_settings_field('rl_il_enable_keyboard', __('Enable keyboard keys', 'responsive-lightbox'), array(&$this, 'rl_il_enable_keyboard'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
552 add_settings_field('rl_il_quit_on_end', __('Quit after last image', 'responsive-lightbox'), array(&$this, 'rl_il_quit_on_end'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
553 add_settings_field('rl_il_quit_on_image_click', __('Quit when image is clicked', 'responsive-lightbox'), array(&$this, 'rl_il_quit_on_image_click'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
554 add_settings_field('rl_il_quit_on_document_click', __('Quit when anything but image is clicked', 'responsive-lightbox'), array(&$this, 'rl_il_quit_on_document_click'), 'responsive_lightbox_configuration', 'responsive_lightbox_configuration');
555 }
556 }
557
558
559 public function rl_script()
560 {
561 echo '
562 <div id="rl_script" class="wplikebtns">';
563
564 foreach($this->scripts as $val => $trans)
565 {
566 $val = esc_attr($val);
567
568 echo '
569 <input id="rl-script-'.$val.'" type="radio" name="responsive_lightbox_settings[script]" value="'.$val.'" '.checked($val, $this->options['settings']['script'], false).' />
570 <label for="rl-script-'.$val.'">'.esc_html($trans['name']).'</label>';
571 }
572
573 echo '
574 <p class="description">'.__('Select your preffered ligthbox effect script.', 'responsive-lightbox').'</p>
575 </div>';
576 }
577
578
579 public function rl_selector()
580 {
581 echo '
582 <div id="rl_selector">
583 <input type="text" value="'.esc_attr($this->options['settings']['selector']).'" name="responsive_lightbox_settings[selector]" />
584 <p class="description">'.__('Select to which rel selector lightbox effect will be applied to.', 'responsive-lightbox').'</p>
585 </div>';
586 }
587
588
589 public function rl_enable_custom_events()
590 {
591 echo '
592 <div id="rl_enable_custom_events" class="wplikebtns">';
593
594 foreach($this->choices as $val => $trans)
595 {
596 $val = esc_attr($val);
597
598 echo '
599 <input id="rl-enable-custom-events-'.$val.'" type="radio" name="responsive_lightbox_settings[enable_custom_events]" value="'.$val.'" '.checked(($val === 'yes' ? true : false), $this->options['settings']['enable_custom_events'], false).' />
600 <label for="rl-enable-custom-events-'.$val.'">'.esc_html($trans).'</label>';
601 }
602
603 echo '
604 <p class="description">'.__('Enable triggering lightbox on custom jquery events.', 'responsive-lightbox').'</p>
605 <div id="rl_custom_events"'.($this->options['settings']['enable_custom_events'] === false ? ' style="display: none;"' : '').'>
606 <input type="text" name="responsive_lightbox_settings[custom_events]" value="'.esc_attr($this->options['settings']['custom_events']).'" />
607 <p class="description">'.__('Enter a space separated list of events.', 'responsive-lightbox').'</p>
608 </div>
609 </div>';
610 }
611
612
613 public function rl_loading_place()
614 {
615 echo '
616 <div id="rl_loading_place" class="wplikebtns">';
617
618 foreach($this->loading_places as $val => $trans)
619 {
620 $val = esc_attr($val);
621
622 echo '
623 <input id="rl-loading-place-'.$val.'" type="radio" name="responsive_lightbox_settings[loading_place]" value="'.$val.'" '.checked($val, $this->options['settings']['loading_place'], false).' />
624 <label for="rl-loading-place-'.$val.'">'.esc_html($trans).'</label>';
625 }
626
627 echo '
628 <p class="description">'.__('Select where all the lightbox scripts should be placed.', 'responsive-lightbox').'</p>
629 </div>';
630 }
631
632
633 public function rl_galleries()
634 {
635 echo '
636 <div id="rl_galleries" class="wplikebtns">';
637
638 foreach($this->choices as $val => $trans)
639 {
640 echo '
641 <input id="rl-galleries-'.$val.'" type="radio" name="responsive_lightbox_settings[galleries]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['galleries'], FALSE).' />
642 <label for="rl-galleries-'.$val.'">'.$trans.'</label>';
643 }
644
645 echo '
646 <p class="description">'.__('Add lightbox to WordPress image galleries by default.', 'responsive-lightbox').'</p>
647 </div>';
648 }
649
650
651 public function rl_videos()
652 {
653 echo '
654 <div id="rl_videos" class="wplikebtns">';
655
656 foreach($this->choices as $val => $trans)
657 {
658 echo '
659 <input id="rl-videos-'.$val.'" type="radio" name="responsive_lightbox_settings[videos]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['videos'], FALSE).' />
660 <label for="rl-videos-'.$val.'">'.$trans.'</label>';
661 }
662
663 echo '
664 <p class="description">'.__('Add lightbox to YouTube and Vimeo video links by default.', 'responsive-lightbox').'</p>
665 </div>';
666 }
667
668
669 public function rl_image_links()
670 {
671 echo '
672 <div id="rl_image_links" class="wplikebtns">';
673
674 foreach($this->choices as $val => $trans)
675 {
676 echo '
677 <input id="rl-image-links-'.$val.'" type="radio" name="responsive_lightbox_settings[image_links]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['image_links'], FALSE).' />
678 <label for="rl-image-links-'.$val.'">'.$trans.'</label>';
679 }
680
681 echo '
682 <p class="description">'.__('Add lightbox to WordPress image links by default.', 'responsive-lightbox').'</p>
683 </div>';
684 }
685
686
687 public function rl_images_as_gallery()
688 {
689 echo '
690 <div id="rl_images_as_gallery" class="wplikebtns">';
691
692 foreach($this->choices as $val => $trans)
693 {
694 echo '
695 <input id="rl-images-as-gallery-'.$val.'" type="radio" name="responsive_lightbox_settings[images_as_gallery]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['images_as_gallery'], FALSE).' />
696 <label for="rl-images-as-gallery-'.$val.'">'.$trans.'</label>';
697 }
698
699 echo '
700 <p class="description">'.__('Display single post images as a gallery.', 'responsive-lightbox').'</p>
701 </div>';
702 }
703
704
705 public function rl_deactivation_delete()
706 {
707 echo '
708 <div id="rl_deactivation_delete" class="wplikebtns">';
709
710 foreach($this->choices as $val => $trans)
711 {
712 echo '
713 <input id="rl-deactivation-delete-'.$val.'" type="radio" name="responsive_lightbox_settings[deactivation_delete]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['settings']['deactivation_delete'], FALSE).' />
714 <label for="rl-deactivation-delete-'.$val.'">'.$trans.'</label>';
715 }
716
717 echo '
718 <p class="description">'.__('Delete settings on plugin deactivation.', 'responsive-lightbox').'</p>
719 </div>';
720 }
721
722
723 public function rl_sb_animation()
724 {
725 echo '
726 <div id="rl_sb_animation" class="wplikebtns">';
727
728 foreach($this->scripts['swipebox']['animations'] as $val => $trans)
729 {
730 echo '
731 <input id="rl-sb-animation-'.$val.'" type="radio" name="responsive_lightbox_configuration[swipebox][animation]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['swipebox']['animation'], FALSE).' />
732 <label for="rl-sb-animation-'.$val.'">'.$trans.'</label>';
733 }
734
735 echo '
736 <p class="description">'.__('Select a method of applying a lightbox effect.', 'responsive-lightbox').'</p>
737 </div>';
738 }
739
740
741 public function rl_sb_hide_bars()
742 {
743 echo '
744 <div id="rl_sb_hide_bars" class="wplikebtns">';
745
746 foreach($this->choices as $val => $trans)
747 {
748 echo '
749 <input id="rl-sb-hide-bars-'.$val.'" type="radio" name="responsive_lightbox_configuration[swipebox][hide_bars]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['swipebox']['hide_bars'], FALSE).' />
750 <label for="rl-sb-hide-bars-'.$val.'">'.$trans.'</label>';
751 }
752
753 echo '
754 <p class="description">'.__('Disable if you don\'t want to top and bottom bars to be hidden after a period of time.', 'responsive-lightbox').'</p>
755 <div id="rl_sb_hide_bars_delay"'.($this->options['configuration']['swipebox']['hide_bars'] === FALSE ? ' style="display: none;"' : '').'>
756 <input type="text" name="responsive_lightbox_configuration[swipebox][hide_bars_delay]" value="'.esc_attr($this->options['configuration']['swipebox']['hide_bars_delay']).'" /> <span>ms</span>
757 <p class="description">'.__('Enter the time after which the top and bottom bars will be hidden (when hiding is enabled).', 'responsive-lightbox').'</p>
758 </div>
759 </div>';
760 }
761
762
763 public function rl_sb_video_max_width()
764 {
765 echo '
766 <div id="rl_sb_video_max_width">
767 <input type="text" name="responsive_lightbox_configuration[swipebox][video_max_width]" value="'.esc_attr($this->options['configuration']['swipebox']['video_max_width']).'" /> <span>px</span>
768 <p class="description">'.__('Enter the max video width in a lightbox.', 'responsive-lightbox').'</p>
769 </div>';
770 }
771
772
773 public function rl_sb_force_png_icons()
774 {
775 echo '
776 <div id="rl_sb_force_png_icons" class="wplikebtns">';
777
778 foreach($this->choices as $val => $trans)
779 {
780 echo '
781 <input id="rl-sb-force-png-icons-'.$val.'" type="radio" name="responsive_lightbox_configuration[swipebox][force_png_icons]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['swipebox']['force_png_icons'], FALSE).' />
782 <label for="rl-sb-force-png-icons-'.$val.'">'.$trans.'</label>';
783 }
784
785 echo '
786 <p class="description">'.__('Enable this if you\'re having problems with navigation icons not visible on some devices.', 'responsive-lightbox').'</p>
787 </div>';
788 }
789
790
791 public function rl_pp_animation_speed()
792 {
793 echo '
794 <div id="rl_pp_animation_speed" class="wplikebtns">';
795
796 foreach($this->scripts['prettyphoto']['animation_speeds'] as $val => $trans)
797 {
798 echo '
799 <input id="rl-pp-animation-speed-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][animation_speed]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['prettyphoto']['animation_speed'], FALSE).' />
800 <label for="rl-pp-animation-speed-'.$val.'">'.$trans.'</label>';
801 }
802
803 echo '
804 <p class="description">'.__('Select animation speed for lightbox effect.', 'responsive-lightbox').'</p>
805 </div>';
806 }
807
808
809 public function rl_pp_slideshow()
810 {
811 echo '
812 <div id="rl_pp_slideshow" class="wplikebtns">';
813
814 foreach($this->choices as $val => $trans)
815 {
816 echo '
817 <input id="rl-pp-slideshow-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][slideshow]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['slideshow'], FALSE).' />
818 <label for="rl-pp-slideshow-'.$val.'">'.$trans.'</label>';
819 }
820
821 echo '
822 <p class="description">'.__('Display images as slideshow.', 'responsive-lightbox').'</p>
823 <div id="rl_pp_slideshow_delay"'.($this->options['configuration']['prettyphoto']['slideshow'] === FALSE ? ' style="display: none;"' : '').'>
824 <input type="text" name="responsive_lightbox_configuration[prettyphoto][slideshow_delay]" value="'.esc_attr($this->options['configuration']['prettyphoto']['slideshow_delay']).'" /> <span>ms</span>
825 <p class="description">'.__('Enter time (in miliseconds).', 'responsive-lightbox').'</p>
826 </div>
827 </div>';
828 }
829
830
831 public function rl_pp_slideshow_autoplay()
832 {
833 echo '
834 <div id="rl_pp_slideshow_autoplay" class="wplikebtns">';
835
836 foreach($this->choices as $val => $trans)
837 {
838 echo '
839 <input id="rl-pp-slideshow-autoplay-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][slideshow_autoplay]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['slideshow_autoplay'], FALSE).' />
840 <label for="rl-pp-slideshow-autoplay-'.$val.'">'.$trans.'</label>';
841 }
842
843 echo '
844 <p class="description">'.__('Automatically start slideshow.', 'responsive-lightbox').'</p>
845 </div>';
846 }
847
848
849 public function rl_pp_opacity()
850 {
851 echo '
852 <div id="rl_pp_opacity">
853 <input type="text" id="rl_pp_opacity_input" class="hide-if-js" name="responsive_lightbox_configuration[prettyphoto][opacity]" value="'.esc_attr($this->options['configuration']['prettyphoto']['opacity']).'" />
854 <div class="wplike-slider">
855 <span class="left hide-if-no-js">0</span><span class="middle" id="rl_pp_opacity_span" title="'.esc_attr($this->options['configuration']['prettyphoto']['opacity']).'"></span><span class="right hide-if-no-js">100</span>
856 </div>
857 <p class="description">'.__('Value between 0 and 100, 100 for no opacity.', 'responsive-lightbox').'</p>
858 </div>';
859 }
860
861
862 public function rl_pp_title()
863 {
864 echo '
865 <div id="rl_pp_title" class="wplikebtns">';
866
867 foreach($this->choices as $val => $trans)
868 {
869 echo '
870 <input id="rl-pp-show-title-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][show_title]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['show_title'], FALSE).' />
871 <label for="rl-pp-show-title-'.$val.'">'.$trans.'</label>';
872 }
873
874 echo '
875 <p class="description">'.__('Display image tiltle.', 'responsive-lightbox').'</p>
876 </div>';
877 }
878
879
880 public function rl_pp_allow_resize()
881 {
882 echo '
883 <div id="rl_pp_allow_resize" class="wplikebtns">';
884
885 foreach($this->choices as $val => $trans)
886 {
887 echo '
888 <input id="rl-pp-allow-resize-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][allow_resize]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['allow_resize'], FALSE).' />
889 <label for="rl-pp-allow-resize-'.$val.'">'.$trans.'</label>';
890 }
891
892 echo '
893 <p class="description">'.__('Resize the photos bigger than viewport.', 'responsive-lightbox').'</p>
894 </div>';
895 }
896
897
898 public function rl_pp_allow_expand()
899 {
900 echo '
901 <div id="rl_pp_allow_expand" class="wplikebtns">';
902
903 foreach($this->choices as $val => $trans)
904 {
905 echo '
906 <input id="rl-pp-allow-expand-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][allow_expand]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['allow_expand'], FALSE).' />
907 <label for="rl-pp-allow-expand-'.$val.'">'.$trans.'</label>';
908 }
909
910 echo '
911 <p class="description">'.__('Expands something.', 'responsive-lightbox').'</p>
912 </div>';
913 }
914
915
916 public function rl_pp_width()
917 {
918 echo '
919 <div id="rl_pp_width">
920 <input type="text" name="responsive_lightbox_configuration[prettyphoto][width]" value="'.esc_attr($this->options['configuration']['prettyphoto']['width']).'" /> <span>px</span>
921 <p class="description">'.__('in pixels', 'responsive-lightbox').'</p>
922 </div>';
923 }
924
925
926 public function rl_pp_height()
927 {
928 echo '
929 <div id="rl_pp_height">
930 <input type="text" name="responsive_lightbox_configuration[prettyphoto][height]" value="'.esc_attr($this->options['configuration']['prettyphoto']['height']).'" /> <span>px</span>
931 <p class="description">'.__('in pixels', 'responsive-lightbox').'</p>
932 </div>';
933 }
934
935
936 public function rl_pp_theme()
937 {
938 echo '
939 <div id="rl_pp_theme" class="wplikebtns">';
940
941 foreach($this->scripts['prettyphoto']['themes'] as $val => $trans)
942 {
943 echo '
944 <input id="rl-pp-theme-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][theme]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['prettyphoto']['theme'], FALSE).' />
945 <label for="rl-pp-theme-'.$val.'">'.$trans.'</label>';
946 }
947
948 echo '
949 <p class="description">'.__('Select theme for lightbox effect.', 'responsive-lightbox').'</p>
950 </div>';
951 }
952
953
954 public function rl_pp_horizontal_padding()
955 {
956 echo '
957 <div id="rl_pp_horizontal_padding">
958 <input type="text" name="responsive_lightbox_configuration[prettyphoto][horizontal_padding]" value="'.esc_attr($this->options['configuration']['prettyphoto']['horizontal_padding']).'" /> <span>px</span>
959 <p class="description">'.__('Horizontal padding (in pixels).', 'responsive-lightbox').'</p>
960 </div>';
961 }
962
963
964 public function rl_pp_hide_flash()
965 {
966 echo '
967 <div id="rl_pp_hide_flash" class="wplikebtns">';
968
969 foreach($this->choices as $val => $trans)
970 {
971 echo '
972 <input id="rl-pp-hide-flash-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][hide_flash]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['hide_flash'], FALSE).' />
973 <label for="rl-pp-hide-flash-'.$val.'">'.$trans.'</label>';
974 }
975
976 echo '
977 <p class="description">'.__('Hides all the flash object on a page. Enable this if flash appears over prettyPhoto.', 'responsive-lightbox').'</p>
978 </div>';
979 }
980
981
982 public function rl_pp_wmode()
983 {
984 echo '
985 <div id="rl_pp_wmode" class="wplikebtns">';
986
987 foreach($this->scripts['prettyphoto']['wmodes'] as $val => $trans)
988 {
989 echo '
990 <input id="rl-pp-wmode-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][wmode]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['prettyphoto']['wmode'], FALSE).' />
991 <label for="rl-pp-wmode-'.$val.'">'.$trans.'</label>';
992 }
993
994 echo '
995 <p class="description">'.__('Select flash window mode.', 'responsive-lightbox').'</p>
996 </div>';
997 }
998
999
1000 public function rl_pp_video_autoplay()
1001 {
1002 echo '
1003 <div id="rl_pp_video_autoplay" class="wplikebtns">';
1004
1005 foreach($this->choices as $val => $trans)
1006 {
1007 echo '
1008 <input id="rl-pp-video-autoplay-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][video_autoplay]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['video_autoplay'], FALSE).' />
1009 <label for="rl-pp-video-autoplay-'.$val.'">'.$trans.'</label>';
1010 }
1011
1012 echo '
1013 <p class="description">'.__('Automatically start videos.', 'responsive-lightbox').'</p>
1014 </div>';
1015 }
1016
1017
1018 public function rl_pp_modal()
1019 {
1020 echo '
1021 <div id="rl_pp_modal" class="wplikebtns">';
1022
1023 foreach($this->choices as $val => $trans)
1024 {
1025 echo '
1026 <input id="rl-pp-modal-close-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][modal]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['modal'], FALSE).' />
1027 <label for="rl-pp-modal-close-'.$val.'">'.$trans.'</label>';
1028 }
1029
1030 echo '
1031 <p class="description">'.__('If set to true, only the close button will close the window.', 'responsive-lightbox').'</p>
1032 </div>';
1033 }
1034
1035
1036 public function rl_pp_deeplinking()
1037 {
1038 echo '
1039 <div id="rl_pp_deeplinking" class="wplikebtns">';
1040
1041 foreach($this->choices as $val => $trans)
1042 {
1043 echo '
1044 <input id="rl-pp-deeplinking-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][deeplinking]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['deeplinking'], FALSE).' />
1045 <label for="rl-pp-deeplinking-'.$val.'">'.$trans.'</label>';
1046 }
1047
1048 echo '
1049 <p class="description">'.__('Allow prettyPhoto to update the url to enable deeplinking.', 'responsive-lightbox').'</p>
1050 </div>';
1051 }
1052
1053
1054 public function rl_pp_overlay_gallery()
1055 {
1056 echo '
1057 <div id="rl_pp_overlay_gallery" class="wplikebtns">';
1058
1059 foreach($this->choices as $val => $trans)
1060 {
1061 echo '
1062 <input id="rl-pp-overlay-gallery-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][overlay_gallery]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['overlay_gallery'], FALSE).' />
1063 <label for="rl-pp-overlay-gallery-'.$val.'">'.$trans.'</label>';
1064 }
1065
1066 echo '
1067 <p class="description">'.__('If enabled, a gallery will overlay the fullscreen image on mouse over.', 'responsive-lightbox').'</p>
1068 </div>';
1069 }
1070
1071
1072 public function rl_pp_keyboard_shortcuts()
1073 {
1074 echo '
1075 <div id="rl_pp_keyboard_shortcuts" class="wplikebtns">';
1076
1077 foreach($this->choices as $val => $trans)
1078 {
1079 echo '
1080 <input id="rl-pp-keyboard-shortcuts-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][keyboard_shortcuts]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['keyboard_shortcuts'], FALSE).' />
1081 <label for="rl-pp-keyboard-shortcuts-'.$val.'">'.$trans.'</label>';
1082 }
1083
1084 echo '
1085 <p class="description">'.__('Set to false if you open forms inside prettyPhoto.', 'responsive-lightbox').'</p>
1086 </div>';
1087 }
1088
1089
1090 public function rl_pp_social()
1091 {
1092 echo '
1093 <div id="rl_pp_social" class="wplikebtns">';
1094
1095 foreach($this->choices as $val => $trans)
1096 {
1097 echo '
1098 <input id="rl-pp-social-'.$val.'" type="radio" name="responsive_lightbox_configuration[prettyphoto][social]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['prettyphoto']['social'], FALSE).' />
1099 <label for="rl-pp-social-'.$val.'">'.$trans.'</label>';
1100 }
1101
1102 echo '
1103 <p class="description">'.__('Display links to Facebook and Twitter.', 'responsive-lightbox').'</p>
1104 </div>';
1105 }
1106
1107
1108 public function rl_fb_transitions()
1109 {
1110 echo '
1111 <div id="rl_fb_transition" class="wplikebtns">';
1112
1113 foreach($this->scripts['fancybox']['transitions'] as $val => $trans)
1114 {
1115 echo '
1116 <input id="rl-fb-transitions-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][transitions]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['fancybox']['transitions'], FALSE).' />
1117 <label for="rl-fb-transitions-'.$val.'">'.$trans.'</label>';
1118 }
1119
1120 echo '
1121 <p class="description">'.__('The transition type.', 'responsive-lightbox').'</p>
1122 </div>';
1123 }
1124
1125
1126 public function rl_fb_padding()
1127 {
1128 echo '
1129 <div id="rl_fb_padding">
1130 <input type="text" name="responsive_lightbox_configuration[fancybox][padding]" value="'.esc_attr($this->options['configuration']['fancybox']['padding']).'" /> <span>px</span>
1131 <p class="description">'.__('Space between FancyBox wrapper and content.', 'responsive-lightbox').'</p>
1132 </div>';
1133 }
1134
1135
1136 public function rl_fb_margin()
1137 {
1138 echo '
1139 <div id="rl_fb_margin">
1140 <input type="text" name="responsive_lightbox_configuration[fancybox][margin]" value="'.esc_attr($this->options['configuration']['fancybox']['margin']).'" /> <span>px</span>
1141 <p class="description">'.__('Space between viewport and FancyBox wrapper.', 'responsive-lightbox').'</p>
1142 </div>';
1143 }
1144
1145
1146 public function rl_fb_modal()
1147 {
1148 echo '
1149 <div id="rl_fb_modal" class="wplikebtns">';
1150
1151 foreach($this->choices as $val => $trans)
1152 {
1153 echo '
1154 <input id="rl-fb-modal-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][modal]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['modal'], FALSE).' />
1155 <label for="rl-fb-modal-'.$val.'">'.$trans.'</label>';
1156 }
1157
1158 echo '
1159 <p class="description">'.__('When true, "overlayShow" is set to TRUE and "hideOnOverlayClick", "hideOnContentClick", "enableEscapeButton", "showCloseButton" are set to FALSE.', 'responsive-lightbox').'</p>
1160 </div>';
1161 }
1162
1163
1164 public function rl_fb_show_overlay()
1165 {
1166 echo '
1167 <div id="rl_fb_show_overlay" class="wplikebtns">';
1168
1169 foreach($this->choices as $val => $trans)
1170 {
1171 echo '
1172 <input id="rl-fb-show-overlay-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][show_overlay]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['show_overlay'], FALSE).' '.disabled($this->options['configuration']['fancybox']['modal'], TRUE, FALSE).' />
1173 <label for="rl-fb-show-overlay-'.$val.'">'.$trans.'</label>';
1174 }
1175
1176 echo '
1177 <p class="description">'.__('Toggle overlay.', 'responsive-lightbox').'</p>
1178 </div>';
1179 }
1180
1181
1182 public function rl_fb_show_close_button()
1183 {
1184 echo '
1185 <div id="rl_fb_show_close_button" class="wplikebtns">';
1186
1187 foreach($this->choices as $val => $trans)
1188 {
1189 echo '
1190 <input id="rl-fb-show-close-button-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][show_close_button]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['show_close_button'], FALSE).' '.disabled($this->options['configuration']['fancybox']['modal'], TRUE, FALSE).' />
1191 <label for="rl-fb-show-close-button-'.$val.'">'.$trans.'</label>';
1192 }
1193
1194 echo '
1195 <p class="description">'.__('Toggle close button.', 'responsive-lightbox').'</p>
1196 </div>';
1197 }
1198
1199
1200 public function rl_fb_enable_escape_button()
1201 {
1202 echo '
1203 <div id="rl_fb_enable_escape_button" class="wplikebtns">';
1204
1205 foreach($this->choices as $val => $trans)
1206 {
1207 echo '
1208 <input id="rl-fb-enable-escape-button-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][enable_escape_button]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['enable_escape_button'], FALSE).' '.disabled($this->options['configuration']['fancybox']['modal'], TRUE, FALSE).' />
1209 <label for="rl-fb-enable-escape-button-'.$val.'">'.$trans.'</label>';
1210 }
1211
1212 echo '
1213 <p class="description">'.__('Toggle if pressing Esc button closes FancyBox.', 'responsive-lightbox').'</p>
1214 </div>';
1215 }
1216
1217
1218 public function rl_fb_hide_on_overlay_click()
1219 {
1220 echo '
1221 <div id="rl_fb_hide_on_overlay_click" class="wplikebtns">';
1222
1223 foreach($this->choices as $val => $trans)
1224 {
1225 echo '
1226 <input id="rl-fb-hide-on-overlay-click-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][hide_on_overlay_click]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['hide_on_overlay_click'], FALSE).' '.disabled($this->options['configuration']['fancybox']['modal'], TRUE, FALSE).' />
1227 <label for="rl-fb-hide-on-overlay-click-'.$val.'">'.$trans.'</label>';
1228 }
1229
1230 echo '
1231 <p class="description">'.__('Toggle if clicking the overlay should close FancyBox.', 'responsive-lightbox').'</p>
1232 </div>';
1233 }
1234
1235
1236 public function rl_fb_hide_on_content_click()
1237 {
1238 echo '
1239 <div id="rl_fb_hide_on_content_click" class="wplikebtns">';
1240
1241 foreach($this->choices as $val => $trans)
1242 {
1243 echo '
1244 <input id="rl-fb-hide-on-content-click-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][hide_on_content_click]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['hide_on_content_click'], FALSE).' '.disabled($this->options['configuration']['fancybox']['modal'], TRUE, FALSE).' />
1245 <label for="rl-fb-hide-on-content-click-'.$val.'">'.$trans.'</label>';
1246 }
1247
1248 echo '
1249 <p class="description">'.__('Toggle if clicking the content should close FancyBox.', 'responsive-lightbox').'</p>
1250 </div>';
1251 }
1252
1253
1254 public function rl_fb_cyclic()
1255 {
1256 echo '
1257 <div id="rl_fb_cyclic" class="wplikebtns">';
1258
1259 foreach($this->choices as $val => $trans)
1260 {
1261 echo '
1262 <input id="rl-fb-cyclic-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][cyclic]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['cyclic'], FALSE).' />
1263 <label for="rl-fb-cyclic-'.$val.'">'.$trans.'</label>';
1264 }
1265
1266 echo '
1267 <p class="description">'.__('When true, galleries will be cyclic, allowing you to keep pressing next/back.', 'responsive-lightbox').'</p>
1268 </div>';
1269 }
1270
1271
1272 public function rl_fb_show_nav_arrows()
1273 {
1274 echo '
1275 <div id="rl_fb_show_nav_arrows" class="wplikebtns">';
1276
1277 foreach($this->choices as $val => $trans)
1278 {
1279 echo '
1280 <input id="rl-fb-show-nav-arrows-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][show_nav_arrows]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['show_nav_arrows'], FALSE).' />
1281 <label for="rl-fb-show-nav-arrows-'.$val.'">'.$trans.'</label>';
1282 }
1283
1284 echo '
1285 <p class="description">'.__('Toggle navigation arrows.', 'responsive-lightbox').'</p>
1286 </div>';
1287 }
1288
1289
1290 public function rl_fb_auto_scale()
1291 {
1292 echo '
1293 <div id="rl_fb_auto_scale" class="wplikebtns">';
1294
1295 foreach($this->choices as $val => $trans)
1296 {
1297 echo '
1298 <input id="rl-fb-auto-scale-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][auto_scale]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['auto_scale'], FALSE).' />
1299 <label for="rl-fb-auto-scale-'.$val.'">'.$trans.'</label>';
1300 }
1301
1302 echo '
1303 <p class="description">'.__('If true, FancyBox is scaled to fit in viewport.', 'responsive-lightbox').'</p>
1304 </div>';
1305 }
1306
1307
1308 public function rl_fb_scrolling()
1309 {
1310 echo '
1311 <div id="rl_fb_scrolling" class="wplikebtns">';
1312
1313 foreach($this->scripts['fancybox']['scrollings'] as $val => $trans)
1314 {
1315 echo '
1316 <input id="rl-fb-scrolling-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][scrolling]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['fancybox']['scrolling'], FALSE).' />
1317 <label for="rl-fb-scrolling-'.$val.'">'.$trans.'</label>';
1318 }
1319
1320 echo '
1321 <p class="description">'.__('Set the overflow CSS property to create or hide scrollbars.', 'responsive-lightbox').'</p>
1322 </div>';
1323 }
1324
1325
1326 public function rl_fb_center_on_scroll()
1327 {
1328 echo '
1329 <div id="rl_fb_center_on_scroll" class="wplikebtns">';
1330
1331 foreach($this->choices as $val => $trans)
1332 {
1333 echo '
1334 <input id="rl-fb-center-on-scroll-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][center_on_scroll]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['center_on_scroll'], FALSE).' />
1335 <label for="rl-fb-center-on-scroll-'.$val.'">'.$trans.'</label>';
1336 }
1337
1338 echo '
1339 <p class="description">'.__('When true, FancyBox is centered while scrolling page.', 'responsive-lightbox').'</p>
1340 </div>';
1341 }
1342
1343
1344 public function rl_fb_opacity()
1345 {
1346 echo '
1347 <div id="rl_fb_opacity" class="wplikebtns">';
1348
1349 foreach($this->choices as $val => $trans)
1350 {
1351 echo '
1352 <input id="rl-fb-opacity-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][opacity]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['opacity'], FALSE).' />
1353 <label for="rl-fb-opacity-'.$val.'">'.$trans.'</label>';
1354 }
1355
1356 echo '
1357 <p class="description">'.__('When true, transparency of content is changed for elastic transitions.', 'responsive-lightbox').'</p>
1358 </div>';
1359 }
1360
1361
1362 public function rl_fb_overlay_opacity()
1363 {
1364 echo '
1365 <div id="rl_fb_overlay_opacity">
1366 <input type="text" id="rl_fb_overlay_opacity_input" class="hide-if-js" name="responsive_lightbox_configuration[fancybox][overlay_opacity]" value="'.esc_attr($this->options['configuration']['fancybox']['overlay_opacity']).'" />
1367 <div class="wplike-slider">
1368 <span class="left hide-if-no-js">0</span><span class="middle" id="rl_fb_overlay_opacity_span" title="'.esc_attr($this->options['configuration']['fancybox']['overlay_opacity']).'"></span><span class="right hide-if-no-js">100</span>
1369 </div>
1370 <p class="description">'.__('Opacity of the overlay.', 'responsive-lightbox').'</p>
1371 </div>';
1372 }
1373
1374
1375 public function rl_fb_overlay_color()
1376 {
1377 echo '
1378 <div id="rl_fb_overlay_color">
1379 <input type="text" value="'.esc_attr($this->options['configuration']['fancybox']['overlay_color']).'" id="rl_fb_overlay_color_input" name="responsive_lightbox_configuration[fancybox][overlay_color]" data-default-color="'.$this->defaults['configuration']['fancybox']['overlay_color'].'" />
1380 <p class="description">'.__('Color of the overlay.', 'responsive-lightbox').'</p>
1381 </div>';
1382 }
1383
1384
1385 public function rl_fb_title_show()
1386 {
1387 echo '
1388 <div id="rl_fb_title_show" class="wplikebtns">';
1389
1390 foreach($this->choices as $val => $trans)
1391 {
1392 echo '
1393 <input id="rl-fb-title-show-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][title_show]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['fancybox']['title_show'], FALSE).' />
1394 <label for="rl-fb-title-show-'.$val.'">'.$trans.'</label>';
1395 }
1396
1397 echo '
1398 <p class="description">'.__('Toggle title.', 'responsive-lightbox').'</p>
1399 </div>';
1400 }
1401
1402
1403 public function rl_fb_title_position()
1404 {
1405 echo '
1406 <div id="rl_fb_title_position" class="wplikebtns">';
1407
1408 foreach($this->scripts['fancybox']['positions'] as $val => $trans)
1409 {
1410 echo '
1411 <input id="rl-fb-title-position-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][title_position]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['fancybox']['title_position'], FALSE).' />
1412 <label for="rl-fb-title-position-'.$val.'">'.$trans.'</label>';
1413 }
1414
1415 echo '
1416 <p class="description">'.__('The position of title.', 'responsive-lightbox').'</p>
1417 </div>';
1418 }
1419
1420
1421 public function rl_fb_easings()
1422 {
1423 echo '
1424 <div id="rl_fb_easings" class="wplikebtns">';
1425
1426 foreach($this->scripts['fancybox']['easings'] as $val => $trans)
1427 {
1428 echo '
1429 <input id="rl-fb-easings-'.$val.'" type="radio" name="responsive_lightbox_configuration[fancybox][easings]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['fancybox']['easings'], FALSE).' />
1430 <label for="rl-fb-easings-'.$val.'">'.$trans.'</label>';
1431 }
1432
1433 echo '
1434 <p class="description">'.__('Easing used for elastic animations.', 'responsive-lightbox').'</p>
1435 </div>';
1436 }
1437
1438
1439 public function rl_fb_speeds()
1440 {
1441 echo '
1442 <div id="rl_fb_speeds">
1443 <input type="text" value="'.esc_attr($this->options['configuration']['fancybox']['speeds']).'" name="responsive_lightbox_configuration[fancybox][speeds]" /> <span>ms</span>
1444 <p class="description">'.__('Speed of the fade and elastic transitions, in milliseconds.', 'responsive-lightbox').'</p>
1445 </div>';
1446 }
1447
1448
1449 public function rl_fb_change_speed()
1450 {
1451 echo '
1452 <div id="rl_fb_change_speed">
1453 <input type="text" value="'.esc_attr($this->options['configuration']['fancybox']['change_speed']).'" name="responsive_lightbox_configuration[fancybox][change_speed]" /> <span>ms</span>
1454 <p class="description">'.__('Speed of resizing when changing gallery items, in milliseconds.', 'responsive-lightbox').'</p>
1455 </div>';
1456 }
1457
1458
1459 public function rl_fb_change_fade()
1460 {
1461 echo '
1462 <div id="rl_fb_change_fade">
1463 <input type="text" value="'.esc_attr($this->options['configuration']['fancybox']['change_fade']).'" name="responsive_lightbox_configuration[fancybox][change_fade]" /> <span>ms</span>
1464 <p class="description">'.__('Speed of the content fading while changing gallery items.', 'responsive-lightbox').'</p>
1465 </div>';
1466 }
1467
1468
1469 public function rl_fb_video_width()
1470 {
1471 echo '
1472 <div id="rl_fb_video_width">
1473 <input type="text" value="'.esc_attr($this->options['configuration']['fancybox']['video_width']).'" name="responsive_lightbox_configuration[fancybox][video_width]" /> <span>px</span>
1474 <p class="description">'.__('Width of the video.', 'responsive-lightbox').'</p>
1475 </div>';
1476 }
1477
1478
1479 public function rl_fb_video_height()
1480 {
1481 echo '
1482 <div id="rl_fb_video_height">
1483 <input type="text" value="'.esc_attr($this->options['configuration']['fancybox']['video_height']).'" name="responsive_lightbox_configuration[fancybox][video_height]" /> <span>px</span>
1484 <p class="description">'.__('Height of the video.', 'responsive-lightbox').'</p>
1485 </div>';
1486 }
1487
1488
1489 public function rl_nv_effect()
1490 {
1491 echo '
1492 <div id="rl_nv_effect" class="wplikebtns">';
1493
1494 foreach($this->scripts['nivo']['effects'] as $val => $trans)
1495 {
1496 echo '
1497 <input id="rl-nv-effect-'.$val.'" type="radio" name="responsive_lightbox_configuration[nivo][effect]" value="'.esc_attr($val).'" '.checked($val, $this->options['configuration']['nivo']['effect'], FALSE).' />
1498 <label for="rl-nv-effect-'.$val.'">'.$trans.'</label>';
1499 }
1500
1501 echo '
1502 <p class="description">'.__('The effect to use when showing the lightbox.', 'responsive-lightbox').'</p>
1503 </div>';
1504 }
1505
1506
1507 public function rl_nv_keyboard_nav()
1508 {
1509 echo '
1510 <div id="rl_nv_keyboard_nav" class="wplikebtns">';
1511
1512 foreach($this->choices as $val => $trans)
1513 {
1514 echo '
1515 <input id="rl-nv-keyboard-nav-'.$val.'" type="radio" name="responsive_lightbox_configuration[nivo][keyboard_nav]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['configuration']['nivo']['keyboard_nav'], FALSE).' />
1516 <label for="rl-nv-keyboard-nav-'.$val.'">'.$trans.'</label>';
1517 }
1518
1519 echo '
1520 <p class="description">'.__('Enable/Disable keyboard navigation (left/right/escape).', 'responsive-lightbox').'</p>
1521 </div>';
1522 }
1523
1524
1525 public function rl_nv_error_message()
1526 {
1527 echo '
1528 <div id="rl_nv_error_message">
1529 <input type="text" value="'.esc_attr($this->options['configuration']['nivo']['error_message']).'" name="responsive_lightbox_configuration[nivo][error_message]" />
1530 <p class="description">'.__('Error message if the content cannot be loaded.', 'responsive-lightbox').'</p>
1531 </div>';
1532 }
1533
1534
1535 public function rl_il_animation_speed()
1536 {
1537 echo '
1538 <div id="rl_il_animation_speed">
1539 <input type="text" value="'.esc_attr($this->options['configuration']['imagelightbox']['animation_speed']).'" name="responsive_lightbox_configuration[imagelightbox][animation_speed]" /> <span>ms</span>
1540 <p class="description">'.__('Animation speed.', 'responsive-lightbox').'</p>
1541 </div>';
1542 }
1543
1544
1545 public function rl_il_preload_next()
1546 {
1547 echo '
1548 <div id="rl_il_preload_next" class="wplikebtns">';
1549
1550 foreach($this->choices as $val => $trans)
1551 {
1552 echo '
1553 <input id="rl-il-preload-next-'.$val.'" type="radio" name="responsive_lightbox_configuration[imagelightbox][preload_next]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? true : false), $this->options['configuration']['imagelightbox']['preload_next'], false).' />
1554 <label for="rl-il-preload-next-'.$val.'">'.$trans.'</label>';
1555 }
1556
1557 echo '
1558 <p class="description">'.__('Silently preload the next image.', 'responsive-lightbox').'</p>
1559 </div>';
1560 }
1561
1562
1563 public function rl_il_enable_keyboard()
1564 {
1565 echo '
1566 <div id="rl_il_enable_keyboard" class="wplikebtns">';
1567
1568 foreach($this->choices as $val => $trans)
1569 {
1570 echo '
1571 <input id="rl-il-enable-keyboard-'.$val.'" type="radio" name="responsive_lightbox_configuration[imagelightbox][enable_keyboard]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? true : false), $this->options['configuration']['imagelightbox']['enable_keyboard'], false).' />
1572 <label for="rl-il-enable-keyboard-'.$val.'">'.$trans.'</label>';
1573 }
1574
1575 echo '
1576 <p class="description">'.__('Enable keyboard shortcuts (arrows Left/Right and Esc).', 'responsive-lightbox').'</p>
1577 </div>';
1578 }
1579
1580
1581 public function rl_il_quit_on_end()
1582 {
1583 echo '
1584 <div id="rl_il_quit_on_end" class="wplikebtns">';
1585
1586 foreach($this->choices as $val => $trans)
1587 {
1588 echo '
1589 <input id="rl-il-quit-on-end-'.$val.'" type="radio" name="responsive_lightbox_configuration[imagelightbox][quit_on_end]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? true : false), $this->options['configuration']['imagelightbox']['quit_on_end'], false).' />
1590 <label for="rl-il-quit-on-end-'.$val.'">'.$trans.'</label>';
1591 }
1592
1593 echo '
1594 <p class="description">'.__('Quit after viewing the last image.', 'responsive-lightbox').'</p>
1595 </div>';
1596 }
1597
1598
1599 public function rl_il_quit_on_image_click()
1600 {
1601 echo '
1602 <div id="rl_il_quit_on_image_click" class="wplikebtns">';
1603
1604 foreach($this->choices as $val => $trans)
1605 {
1606 echo '
1607 <input id="rl-il-quit-on-image-click-'.$val.'" type="radio" name="responsive_lightbox_configuration[imagelightbox][quit_on_image_click]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? true : false), $this->options['configuration']['imagelightbox']['quit_on_image_click'], false).' />
1608 <label for="rl-il-quit-on-image-click-'.$val.'">'.$trans.'</label>';
1609 }
1610
1611 echo '
1612 <p class="description">'.__('Quit when the viewed image is clicked.', 'responsive-lightbox').'</p>
1613 </div>';
1614 }
1615
1616
1617 public function rl_il_quit_on_document_click()
1618 {
1619 echo '
1620 <div id="rl_il_quit_on_document_click" class="wplikebtns">';
1621
1622 foreach($this->choices as $val => $trans)
1623 {
1624 echo '
1625 <input id="rl-il-quit-on-document-click-'.$val.'" type="radio" name="responsive_lightbox_configuration[imagelightbox][quit_on_document_click]" value="'.esc_attr($val).'" '.checked(($val === 'yes' ? true : false), $this->options['configuration']['imagelightbox']['quit_on_document_click'], false).' />
1626 <label for="rl-il-quit-on-document-click-'.$val.'">'.$trans.'</label>';
1627 }
1628
1629 echo '
1630 <p class="description">'.__('Quit when anything but the viewed image is clicked.', 'responsive-lightbox').'</p>
1631 </div>';
1632 }
1633
1634
1635 /**
1636 * Validates settings
1637 */
1638 public function validate_options($input)
1639 {
1640 if(isset($_POST['save_rl_settings']))
1641 {
1642 // script
1643 $input['script'] = (isset($input['script'], $this->scripts[$input['script']]) ? $input['script'] : $this->defaults['settings']['script']);
1644
1645 // selector
1646 $input['selector'] = sanitize_text_field(isset($input['selector']) && $input['selector'] !== '' ? $input['selector'] : $this->defaults['settings']['selector']);
1647
1648 // loading place
1649 $input['loading_place'] = (isset($input['loading_place'], $this->loading_places[$input['loading_place']]) ? $input['loading_place'] : $this->defaults['settings']['loading_place']);
1650
1651 // enable custom events
1652 $input['enable_custom_events'] = (isset($input['enable_custom_events'], $this->choices[$input['enable_custom_events']]) ? ($input['enable_custom_events'] === 'yes' ? true : false) : $this->defaults['settings']['enable_custom_events']);
1653
1654 // custom events
1655 if($input['enable_custom_events'] === true)
1656 {
1657 $input['custom_events'] = sanitize_text_field(isset($input['custom_events']) && $input['custom_events'] !== '' ? $input['custom_events'] : $this->defaults['settings']['custom_events']);
1658 }
1659
1660 // checkboxes
1661 $input['galleries'] = (isset($input['galleries'], $this->choices[$input['galleries']]) ? ($input['galleries'] === 'yes' ? true : false) : $this->defaults['settings']['galleries']);
1662 $input['videos'] = (isset($input['videos'], $this->choices[$input['videos']]) ? ($input['videos'] === 'yes' ? true : false) : $this->defaults['settings']['videos']);
1663 $input['image_links'] = (isset($input['image_links'], $this->choices[$input['image_links']]) ? ($input['image_links'] === 'yes' ? true : false) : $this->defaults['settings']['image_links']);
1664 $input['images_as_gallery'] = (isset($input['images_as_gallery'], $this->choices[$input['images_as_gallery']]) ? ($input['images_as_gallery'] === 'yes' ? true : false) : $this->defaults['settings']['images_as_gallery']);
1665 $input['deactivation_delete'] = (isset($input['deactivation_delete'], $this->choices[$input['deactivation_delete']]) ? ($input['deactivation_delete'] === 'yes' ? true : false) : $this->defaults['settings']['deactivation_delete']);
1666 }
1667 elseif(isset($_POST['save_rl_configuration']))
1668 {
1669 if($this->options['settings']['script'] === 'swipebox' && $_POST['script_r'] === 'swipebox')
1670 {
1671 //animation
1672 $input['swipebox']['animation'] = (isset($input['swipebox']['animation']) && in_array($input['swipebox']['animation'], array_keys($this->scripts['swipebox']['animations'])) ? $input['swipebox']['animation'] : $this->defaults['configuration']['swipebox']['animation']);
1673
1674 //force png icons
1675 $input['swipebox']['force_png_icons'] = (isset($input['swipebox']['force_png_icons']) && in_array($input['swipebox']['force_png_icons'], array_keys($this->choices)) ? ($input['swipebox']['force_png_icons'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['swipebox']['force_png_icons']);
1676
1677 //bars
1678 $input['swipebox']['hide_bars'] = (isset($input['swipebox']['hide_bars']) && in_array($input['swipebox']['hide_bars'], array_keys($this->choices)) ? ($input['swipebox']['hide_bars'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['swipebox']['hide_bars']);
1679 $input['swipebox']['hide_bars_delay'] = (int)($input['swipebox']['hide_bars_delay'] > 0 ? $input['swipebox']['hide_bars_delay'] : $this->defaults['configuration']['swipebox']['hide_bars_delay']);
1680
1681 //video width
1682 $input['swipebox']['video_max_width'] = (int)($input['swipebox']['video_max_width'] > 0 ? $input['swipebox']['video_max_width'] : $this->defaults['configuration']['swipebox']['video_max_width']);
1683 }
1684 elseif($this->options['settings']['script'] === 'prettyphoto' && $_POST['script_r'] === 'prettyphoto')
1685 {
1686 //animation speed
1687 $input['prettyphoto']['animation_speed'] = (isset($input['prettyphoto']['animation_speed']) && in_array($input['prettyphoto']['animation_speed'], array_keys($this->scripts['prettyphoto']['animation_speeds'])) ? $input['prettyphoto']['animation_speed'] : $this->defaults['configuration']['prettyphoto']['animation_speed']);
1688
1689 //slideshows
1690 $input['prettyphoto']['slideshow'] = (isset($input['prettyphoto']['slideshow']) && in_array($input['prettyphoto']['slideshow'], array_keys($this->choices)) ? ($input['prettyphoto']['slideshow'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['slideshow']);
1691 $input['prettyphoto']['slideshow_delay'] = (int)($input['prettyphoto']['slideshow_delay'] > 0 ? $input['prettyphoto']['slideshow_delay'] : $this->defaults['configuration']['prettyphoto']['slideshow_delay']);
1692 $input['prettyphoto']['slideshow_autoplay'] = (isset($input['prettyphoto']['slideshow_autoplay']) && in_array($input['prettyphoto']['slideshow_autoplay'], array_keys($this->choices)) ? ($input['prettyphoto']['slideshow_autoplay'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['slideshow_autoplay']);
1693
1694 //opacity
1695 $input['prettyphoto']['opacity'] = (int)$input['prettyphoto']['opacity'];
1696
1697 if($input['prettyphoto']['opacity'] < 0 || $input['prettyphoto']['opacity'] > 100)
1698 $input['prettyphoto']['opacity'] = $this->defaults['configuration']['prettyphoto']['opacity'];
1699
1700 //title
1701 $input['prettyphoto']['show_title'] = (isset($input['prettyphoto']['show_title']) && in_array($input['prettyphoto']['show_title'], array_keys($this->choices)) ? ($input['prettyphoto']['show_title'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['show_title']);
1702
1703 //resize
1704 $input['prettyphoto']['allow_resize'] = (isset($input['prettyphoto']['allow_resize']) && in_array($input['prettyphoto']['allow_resize'], array_keys($this->choices)) ? ($input['prettyphoto']['allow_resize'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['allow_resize']);
1705
1706 //expand
1707 $input['prettyphoto']['allow_expand'] = (isset($input['prettyphoto']['allow_expand']) && in_array($input['prettyphoto']['allow_expand'], array_keys($this->choices)) ? ($input['prettyphoto']['allow_expand'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['allow_expand']);
1708
1709 //dimensions
1710 $input['prettyphoto']['width'] = (int)($input['prettyphoto']['width'] > 0 ? $input['prettyphoto']['width'] : $this->defaults['configuration']['prettyphoto']['width']);
1711 $input['prettyphoto']['height'] = (int)($input['prettyphoto']['height'] > 0 ? $input['prettyphoto']['height'] : $this->defaults['configuration']['prettyphoto']['height']);
1712
1713 //separator
1714 $input['prettyphoto']['separator'] = sanitize_text_field(isset($input['prettyphoto']['separator']) && $input['prettyphoto']['separator'] !== '' ? $input['prettyphoto']['separator'] : $this->defaults['configuration']['prettyphoto']['separator']);
1715
1716 //theme
1717 $input['prettyphoto']['theme'] = (isset($input['prettyphoto']['theme']) && in_array($input['prettyphoto']['theme'], array_keys($this->scripts['prettyphoto']['themes'])) ? $input['prettyphoto']['theme'] : $this->defaults['configuration']['prettyphoto']['theme']);
1718
1719 //padding
1720 $input['prettyphoto']['horizontal_padding'] = (int)($input['prettyphoto']['horizontal_padding'] > 0 ? $input['prettyphoto']['horizontal_padding'] : $this->defaults['configuration']['prettyphoto']['horizontal_padding']);
1721
1722 //flash
1723 $input['prettyphoto']['hide_flash'] = (isset($input['prettyphoto']['hide_flash']) && in_array($input['prettyphoto']['hide_flash'], array_keys($this->choices)) ? ($input['prettyphoto']['hide_flash'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['hide_flash']);
1724 $input['prettyphoto']['wmode'] = (isset($input['prettyphoto']['wmode']) && in_array($input['prettyphoto']['wmode'], array_keys($this->scripts['prettyphoto']['wmodes'])) ? $input['prettyphoto']['wmode'] : $this->defaults['configuration']['prettyphoto']['wmode']);
1725
1726 //video autoplay
1727 $input['prettyphoto']['video_autoplay'] = (isset($input['prettyphoto']['video_autoplay']) && in_array($input['prettyphoto']['video_autoplay'], array_keys($this->choices)) ? ($input['prettyphoto']['video_autoplay'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['video_autoplay']);
1728
1729 //modal
1730 $input['prettyphoto']['modal'] = (isset($input['prettyphoto']['modal']) && in_array($input['prettyphoto']['modal'], array_keys($this->choices)) ? ($input['prettyphoto']['modal'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['modal']);
1731
1732 //deeplinking
1733 $input['prettyphoto']['deeplinking'] = (isset($input['prettyphoto']['deeplinking']) && in_array($input['prettyphoto']['deeplinking'], array_keys($this->choices)) ? ($input['prettyphoto']['deeplinking'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['deeplinking']);
1734
1735 //overlay gallery
1736 $input['prettyphoto']['overlay_gallery'] = (isset($input['prettyphoto']['overlay_gallery']) && in_array($input['prettyphoto']['overlay_gallery'], array_keys($this->choices)) ? ($input['prettyphoto']['overlay_gallery'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['overlay_gallery']);
1737
1738 //keyboard shortcuts
1739 $input['prettyphoto']['keyboard_shortcuts'] = (isset($input['prettyphoto']['keyboard_shortcuts']) && in_array($input['prettyphoto']['keyboard_shortcuts'], array_keys($this->choices)) ? ($input['prettyphoto']['keyboard_shortcuts'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['keyboard_shortcuts']);
1740
1741 //social
1742 $input['prettyphoto']['social'] = (isset($input['prettyphoto']['social']) && in_array($input['prettyphoto']['social'], array_keys($this->choices)) ? ($input['prettyphoto']['social'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['prettyphoto']['social']);
1743 }
1744 elseif($this->options['settings']['script'] === 'fancybox' && $_POST['script_r'] === 'fancybox')
1745 {
1746 //modal
1747 $input['fancybox']['modal'] = (isset($input['fancybox']['modal']) && in_array($input['fancybox']['modal'], array_keys($this->choices)) ? ($input['fancybox']['modal'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['modal']);
1748
1749 //show overlay
1750 $input['fancybox']['show_overlay'] = (isset($input['fancybox']['show_overlay']) && in_array($input['fancybox']['show_overlay'], array_keys($this->choices)) ? ($input['fancybox']['show_overlay'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['show_overlay']);
1751
1752 //show close button
1753 $input['fancybox']['show_close_button'] = (isset($input['fancybox']['show_close_button']) && in_array($input['fancybox']['show_close_button'], array_keys($this->choices)) ? ($input['fancybox']['show_close_button'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['show_close_button']);
1754
1755 //enable escape button
1756 $input['fancybox']['enable_escape_button'] = (isset($input['fancybox']['enable_escape_button']) && in_array($input['fancybox']['enable_escape_button'], array_keys($this->choices)) ? ($input['fancybox']['enable_escape_button'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['enable_escape_button']);
1757
1758 //hide on overlay click
1759 $input['fancybox']['hide_on_overlay_click'] = (isset($input['fancybox']['hide_on_overlay_click']) && in_array($input['fancybox']['hide_on_overlay_click'], array_keys($this->choices)) ? ($input['fancybox']['hide_on_overlay_click'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['hide_on_overlay_click']);
1760
1761 //hide on content click
1762 $input['fancybox']['hide_on_content_click'] = (isset($input['fancybox']['hide_on_content_click']) && in_array($input['fancybox']['hide_on_content_click'], array_keys($this->choices)) ? ($input['fancybox']['hide_on_content_click'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['hide_on_content_click']);
1763
1764 //cyclic
1765 $input['fancybox']['cyclic'] = (isset($input['fancybox']['cyclic']) && in_array($input['fancybox']['cyclic'], array_keys($this->choices)) ? ($input['fancybox']['cyclic'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['cyclic']);
1766
1767 //show nav arrows
1768 $input['fancybox']['show_nav_arrows'] = (isset($input['fancybox']['show_nav_arrows']) && in_array($input['fancybox']['show_nav_arrows'], array_keys($this->choices)) ? ($input['fancybox']['show_nav_arrows'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['show_nav_arrows']);
1769
1770 //auto scale
1771 $input['fancybox']['auto_scale'] = (isset($input['fancybox']['auto_scale']) && in_array($input['fancybox']['auto_scale'], array_keys($this->choices)) ? ($input['fancybox']['auto_scale'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['auto_scale']);
1772
1773 //scrolling
1774 $input['fancybox']['scrolling'] = (isset($input['fancybox']['scrolling']) && in_array($input['fancybox']['scrolling'], array_keys($this->scripts['fancybox']['scrollings'])) ? $input['fancybox']['scrolling'] : $this->defaults['configuration']['fancybox']['scrolling']);
1775
1776 //center on scroll
1777 $input['fancybox']['center_on_scroll'] = (isset($input['fancybox']['center_on_scroll']) && in_array($input['fancybox']['center_on_scroll'], array_keys($this->choices)) ? ($input['fancybox']['center_on_scroll'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['center_on_scroll']);
1778
1779 //opacity
1780 $input['fancybox']['opacity'] = (isset($input['fancybox']['opacity']) && in_array($input['fancybox']['opacity'], array_keys($this->choices)) ? ($input['fancybox']['opacity'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['opacity']);
1781
1782 //title_show
1783 $input['fancybox']['title_show'] = (isset($input['fancybox']['title_show']) && in_array($input['fancybox']['title_show'], array_keys($this->choices)) ? ($input['fancybox']['title_show'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['fancybox']['title_show']);
1784
1785 //overlay opacity
1786 $input['fancybox']['overlay_opacity'] = (int)$input['fancybox']['overlay_opacity'];
1787
1788 if($input['fancybox']['overlay_opacity'] < 0 || $input['fancybox']['overlay_opacity'] > 100)
1789 $input['fancybox']['overlay_opacity'] = $this->defaults['configuration']['fancybox']['overlay_opacity'];
1790
1791 //overlay color
1792 $input['fancybox']['overlay_color'] = sanitize_text_field($input['fancybox']['overlay_color']);
1793
1794 //title position
1795 $input['fancybox']['title_position'] = (isset($input['fancybox']['title_position']) && in_array($input['fancybox']['title_position'], array_keys($this->scripts['fancybox']['positions'])) ? $input['fancybox']['title_position'] : $this->defaults['configuration']['fancybox']['title_position']);
1796
1797 //transitions
1798 $input['fancybox']['transitions'] = (isset($input['fancybox']['transitions']) && in_array($input['fancybox']['transitions'], array_keys($this->scripts['fancybox']['transitions'])) ? $input['fancybox']['transitions'] : $this->defaults['configuration']['fancybox']['transitions']);
1799
1800 //easings
1801 $input['fancybox']['easings'] = (isset($input['fancybox']['easings']) && in_array($input['fancybox']['easings'], array_keys($this->scripts['fancybox']['easings'])) ? $input['fancybox']['easings'] : $this->defaults['configuration']['fancybox']['easings']);
1802
1803 //speeds
1804 $input['fancybox']['speeds'] = (int)($input['fancybox']['speeds'] > 0 ? $input['fancybox']['speeds'] : $this->defaults['configuration']['fancybox']['speeds']);
1805
1806 //change speed
1807 $input['fancybox']['change_speed'] = (int)($input['fancybox']['change_speed'] > 0 ? $input['fancybox']['change_speed'] : $this->defaults['configuration']['fancybox']['change_speed']);
1808
1809 //change fade
1810 $input['fancybox']['change_fade'] = (int)($input['fancybox']['change_fade'] > 0 ? $input['fancybox']['change_fade'] : $this->defaults['configuration']['fancybox']['change_fade']);
1811
1812 //padding
1813 $input['fancybox']['padding'] = (int)($input['fancybox']['padding'] > 0 ? $input['fancybox']['padding'] : $this->defaults['configuration']['fancybox']['padding']);
1814
1815 //margin
1816 $input['fancybox']['margin'] = (int)($input['fancybox']['margin'] > 0 ? $input['fancybox']['margin'] : $this->defaults['configuration']['fancybox']['margin']);
1817
1818 //video width
1819 $input['fancybox']['video_width'] = (int)($input['fancybox']['video_width'] > 0 ? $input['fancybox']['video_width'] : $this->defaults['configuration']['fancybox']['video_width']);
1820
1821 //video height
1822 $input['fancybox']['video_height'] = (int)($input['fancybox']['video_height'] > 0 ? $input['fancybox']['video_height'] : $this->defaults['configuration']['fancybox']['video_height']);
1823 }
1824 elseif($this->options['settings']['script'] === 'nivo' && $_POST['script_r'] === 'nivo')
1825 {
1826 //effect
1827 $input['nivo']['effect'] = (isset($input['nivo']['effect']) && in_array($input['nivo']['effect'], array_keys($this->scripts['nivo']['effects'])) ? $input['nivo']['effect'] : $this->defaults['configuration']['nivo']['effect']);
1828
1829 //keyboard navigation
1830 $input['nivo']['keyboard_nav'] = (isset($input['nivo']['keyboard_nav']) && in_array($input['nivo']['keyboard_nav'], array_keys($this->choices)) ? ($input['nivo']['keyboard_nav'] === 'yes' ? TRUE : FALSE) : $this->defaults['configuration']['nivo']['keyboard_nav']);
1831
1832 //error message
1833 $input['nivo']['error_message'] = sanitize_text_field($input['nivo']['error_message']);
1834 }
1835 elseif($this->options['settings']['script'] === 'imagelightbox' && $_POST['script_r'] === 'imagelightbox')
1836 {
1837 // animation speed
1838 $input['imagelightbox']['animation_speed'] = (int)$input['imagelightbox']['animation_speed'];
1839
1840 // preload next image
1841 $input['imagelightbox']['preload_next'] = (isset($input['imagelightbox']['preload_next'], $this->choices[$input['imagelightbox']['preload_next']]) ? ($input['imagelightbox']['preload_next'] === 'yes' ? true : false) : $this->defaults['configuration']['imagelightbox']['preload_next']);
1842
1843 // enable keyboard keys
1844 $input['imagelightbox']['enable_keyboard'] = (isset($input['imagelightbox']['enable_keyboard'], $this->choices[$input['imagelightbox']['enable_keyboard']]) ? ($input['imagelightbox']['enable_keyboard'] === 'yes' ? true : false) : $this->defaults['configuration']['imagelightbox']['enable_keyboard']);
1845
1846 // quit on last image
1847 $input['imagelightbox']['quit_on_end'] = (isset($input['imagelightbox']['quit_on_end'], $this->choices[$input['imagelightbox']['quit_on_end']]) ? ($input['imagelightbox']['quit_on_end'] === 'yes' ? true : false) : $this->defaults['configuration']['imagelightbox']['quit_on_end']);
1848
1849 // quit on image click
1850 $input['imagelightbox']['quit_on_image_click'] = (isset($input['imagelightbox']['quit_on_image_click'], $this->choices[$input['imagelightbox']['quit_on_image_click']]) ? ($input['imagelightbox']['quit_on_image_click'] === 'yes' ? true : false) : $this->defaults['configuration']['imagelightbox']['quit_on_image_click']);
1851
1852 // quit on document click
1853 $input['imagelightbox']['quit_on_document_click'] = (isset($input['imagelightbox']['quit_on_document_click'], $this->choices[$input['imagelightbox']['quit_on_document_click']]) ? ($input['imagelightbox']['quit_on_document_click'] === 'yes' ? true : false) : $this->defaults['configuration']['imagelightbox']['quit_on_document_click']);
1854 }
1855 else
1856 {
1857 //clear input to not change settings
1858 $input = array();
1859
1860 add_settings_error('save_script_settings', 'invalid_script_page', __('Changes were not saved because there was attempt to save settings of inactive script. The site has been reloaded to the proper script settings.', 'responsive-lightbox'), 'error');
1861 }
1862
1863 //we have to merge rest of the scripts settings
1864 $input = array_merge($this->options['configuration'], $input);
1865 }
1866 elseif(isset($_POST['reset_rl_settings']))
1867 {
1868 $input = $this->defaults['settings'];
1869
1870 add_settings_error('reset_general_settings', 'general_reset', __('Settings restored to defaults.', 'responsive-lightbox'), 'updated');
1871 }
1872 elseif(isset($_POST['reset_rl_configuration']))
1873 {
1874 if($this->options['settings']['script'] === 'swipebox' && $_POST['script_r'] === 'swipebox')
1875 {
1876 $input['swipebox'] = $this->defaults['configuration']['swipebox'];
1877
1878 add_settings_error('reset_swipebox_settings', 'swipebox_reset', __('Settings of SwipeBox script were restored to defaults.', 'responsive-lightbox'), 'updated');
1879 }
1880 elseif($this->options['settings']['script'] === 'prettyphoto' && $_POST['script_r'] === 'prettyphoto')
1881 {
1882 $input['prettyphoto'] = $this->defaults['configuration']['prettyphoto'];
1883
1884 add_settings_error('reset_prettyphoto_settings', 'prettyphoto_reset', __('Settings of prettyPhoto script were restored to defaults.', 'responsive-lightbox'), 'updated');
1885 }
1886 elseif($this->options['settings']['script'] === 'fancybox' && $_POST['script_r'] === 'fancybox')
1887 {
1888 $input['fancybox'] = $this->defaults['configuration']['fancybox'];
1889
1890 add_settings_error('reset_fancybox_settings', 'fancybox_reset', __('Settings of FancyBox script were restored to defaults.', 'responsive-lightbox'), 'updated');
1891 }
1892 elseif($this->options['settings']['script'] === 'nivo' && $_POST['script_r'] === 'nivo')
1893 {
1894 $input['nivo'] = $this->defaults['configuration']['nivo'];
1895
1896 add_settings_error('reset_nivo_settings', 'nivo_reset', __('Settings of Nivo script were restored to defaults.', 'responsive-lightbox'), 'updated');
1897 }
1898 else
1899 {
1900 add_settings_error('reset_script_settings', 'reset_invalid_script_page', __('Changes were not set to defaults because there was attempt to reset settings of inactive script. The site has been reloaded to the proper script settings.', 'responsive-lightbox'), 'error');
1901 }
1902
1903 //we have to merge rest of the scripts settings
1904 $input = array_merge($this->options['configuration'], $input);
1905 }
1906
1907 return $input;
1908 }
1909
1910
1911 public function admin_menu_options()
1912 {
1913 add_options_page(
1914 __('Responsive Lightbox', 'responsive-lightbox'),
1915 __('Responsive Lightbox', 'responsive-lightbox'),
1916 'manage_options',
1917 'responsive-lightbox',
1918 array(&$this, 'options_page')
1919 );
1920 }
1921
1922
1923 public function options_page()
1924 {
1925 $tab_key = (isset($_GET['tab']) ? $_GET['tab'] : 'general-settings');
1926
1927 echo '
1928 <div class="wrap">'.screen_icon().'
1929 <h2>'.__('Responsive Lightbox', 'responsive-lightbox').'</h2>
1930 <h2 class="nav-tab-wrapper">';
1931
1932 foreach($this->tabs as $key => $name)
1933 {
1934 echo '
1935 <a class="nav-tab '.($tab_key == $key ? 'nav-tab-active' : '').'" href="'.esc_url(admin_url('options-general.php?page=responsive-lightbox&tab='.$key)).'">'.$name['name'].'</a>';
1936 }
1937
1938 echo '
1939 </h2>
1940 <div class="responsive-lightbox-settings">
1941
1942 <div class="df-credits">
1943 <h3 class="hndle">'.__('Responsive Lightbox', 'responsive-lightbox').' '.$this->defaults['version'].'</h3>
1944 <div class="inside">
1945 <h4 class="inner">'.__('Need support?', 'responsive-lightbox').'</h4>
1946 <p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'responsive-lightbox').' <a href="http://www.dfactory.eu/support/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum', 'responsive-lightbox').'">'.__('Support forum', 'responsive-lightbox').'</a></p>
1947 <hr />
1948 <h4 class="inner">'.__('Do you like this plugin?', 'responsive-lightbox').'</h4>
1949 <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/responsive-lightbox" target="_blank" title="'.__('Rate it 5', 'responsive-lightbox').'">'.__('Rate it 5', 'responsive-lightbox').'</a> '.__('on WordPress.org', 'responsive-lightbox').'<br />'.
1950 __('Blog about it & link to the', 'responsive-lightbox').' <a href="http://www.dfactory.eu/plugins/responsive-lightbox/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'responsive-lightbox').'">'.__('plugin page', 'responsive-lightbox').'</a><br />'.
1951 __('Check out our other', 'responsive-lightbox').' <a href="http://www.dfactory.eu/?utm_source=responsive-lightbox-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'responsive-lightbox').'">'.__('WordPress plugins', 'responsive-lightbox').'</a>
1952 </p>
1953 <hr />
1954 <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="'.plugins_url('/images/logo-dfactory.png' , __FILE__ ).'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
1955 </div>
1956 </div>
1957
1958 <form action="options.php" method="post">
1959 <input type="hidden" name="script_r" value="'.esc_attr($this->options['settings']['script']).'" />';
1960
1961 wp_nonce_field('update-options');
1962 settings_fields($this->tabs[$tab_key]['key']);
1963 do_settings_sections($this->tabs[$tab_key]['key']);
1964
1965 echo '
1966 <p class="submit">';
1967
1968 submit_button('', 'primary', $this->tabs[$tab_key]['submit'], FALSE);
1969
1970 echo ' ';
1971 echo submit_button(__('Reset to defaults', 'responsive-lightbox'), 'secondary', $this->tabs[$tab_key]['reset'], FALSE);
1972
1973 echo '
1974 </p>
1975 </form>
1976 </div>
1977 <div class="clear"></div>
1978 </div>';
1979 }
1980
1981
1982 public function admin_scripts_styles($page)
1983 {
1984 if($page === 'settings_page_responsive-lightbox')
1985 {
1986 wp_register_script(
1987 'responsive-lightbox-admin',
1988 plugins_url('js/admin.js', __FILE__),
1989 array('jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-slider', 'wp-color-picker')
1990 );
1991
1992 wp_enqueue_script('responsive-lightbox-admin');
1993
1994 wp_localize_script(
1995 'responsive-lightbox-admin',
1996 'rlArgs',
1997 array(
1998 'resetSettingsToDefaults' => __('Are you sure you want to reset these settings to defaults?', 'responsive-lightbox'),
1999 'resetScriptToDefaults' => __('Are you sure you want to reset scripts settings to defaults?', 'responsive-lightbox'),
2000 'opacity_pp' => $this->options['configuration']['prettyphoto']['opacity'],
2001 'opacity_fb' => $this->options['configuration']['fancybox']['overlay_opacity']
2002 )
2003 );
2004
2005 wp_enqueue_style('wp-color-picker');
2006
2007 wp_register_style(
2008 'responsive-lightbox-admin',
2009 plugins_url('css/admin.css', __FILE__)
2010 );
2011
2012 wp_enqueue_style('responsive-lightbox-admin');
2013
2014 wp_register_style(
2015 'responsive-lightbox-wplike',
2016 plugins_url('css/wp-like-ui-theme.css', __FILE__)
2017 );
2018
2019 wp_enqueue_style('responsive-lightbox-wplike');
2020 }
2021 }
2022
2023
2024 public function front_scripts_styles()
2025 {
2026 $args = apply_filters('rl_lightbox_args', array(
2027 'script' => $this->options['settings']['script'],
2028 'selector' => $this->options['settings']['selector'],
2029 'custom_events' => ($this->options['settings']['enable_custom_events'] === TRUE ? ' '.$this->options['settings']['custom_events'] : ''),
2030 'activeGalleries' => $this->getBooleanValue($this->options['settings']['galleries'])
2031 ));
2032
2033 if($args['script'] === 'prettyphoto')
2034 {
2035 wp_register_script(
2036 'responsive-lightbox-prettyphoto',
2037 plugins_url('assets/prettyphoto/js/jquery.prettyPhoto.js', __FILE__),
2038 array('jquery'),
2039 '',
2040 ($this->options['settings']['loading_place'] === 'header' ? false : true)
2041 );
2042
2043 wp_enqueue_script('responsive-lightbox-prettyphoto');
2044
2045 wp_register_style(
2046 'responsive-lightbox-prettyphoto-front',
2047 plugins_url('assets/prettyphoto/css/prettyPhoto.css', __FILE__)
2048 );
2049
2050 wp_enqueue_style('responsive-lightbox-prettyphoto-front');
2051
2052 $args = array_merge(
2053 $args,
2054 array(
2055 'animationSpeed' => $this->options['configuration']['prettyphoto']['animation_speed'],
2056 'slideshow' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['slideshow']),
2057 'slideshowDelay' => $this->options['configuration']['prettyphoto']['slideshow_delay'],
2058 'slideshowAutoplay' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['slideshow_autoplay']),
2059 'opacity' => sprintf('%.2f', ($this->options['configuration']['prettyphoto']['opacity'] / 100)),
2060 'showTitle' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['show_title']),
2061 'allowResize' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['allow_resize']),
2062 'allowExpand' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['allow_expand']),
2063 'width' => $this->options['configuration']['prettyphoto']['width'],
2064 'height' => $this->options['configuration']['prettyphoto']['height'],
2065 'separator' => $this->options['configuration']['prettyphoto']['separator'],
2066 'theme' => $this->options['configuration']['prettyphoto']['theme'],
2067 'horizontalPadding' => $this->options['configuration']['prettyphoto']['horizontal_padding'],
2068 'hideFlash' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['hide_flash']),
2069 'wmode' => $this->options['configuration']['prettyphoto']['wmode'],
2070 'videoAutoplay' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['video_autoplay']),
2071 'modal' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['modal']),
2072 'deeplinking' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['deeplinking']),
2073 'overlayGallery' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['overlay_gallery']),
2074 'keyboardShortcuts' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['keyboard_shortcuts']),
2075 'social' => $this->getBooleanValue($this->options['configuration']['prettyphoto']['social'])
2076 )
2077 );
2078 }
2079 elseif($args['script'] === 'swipebox')
2080 {
2081 wp_register_script(
2082 'responsive-lightbox-swipebox',
2083 plugins_url('assets/swipebox/source/jquery.swipebox.min.js', __FILE__),
2084 array('jquery'),
2085 '',
2086 ($this->options['settings']['loading_place'] === 'header' ? false : true)
2087 );
2088
2089 wp_enqueue_script('responsive-lightbox-swipebox');
2090
2091 wp_register_style(
2092 'responsive-lightbox-swipebox-front',
2093 plugins_url('assets/swipebox/source/swipebox.css', __FILE__)
2094 );
2095
2096 wp_enqueue_style('responsive-lightbox-swipebox-front');
2097
2098 $args = array_merge(
2099 $args,
2100 array(
2101 'animation' => $this->getBooleanValue(($this->options['configuration']['swipebox']['animation'] === 'css' ? TRUE : FALSE)),
2102 'hideBars' => $this->getBooleanValue($this->options['configuration']['swipebox']['hide_bars']),
2103 'hideBarsDelay' => $this->options['configuration']['swipebox']['hide_bars_delay'],
2104 'videoMaxWidth' => $this->options['configuration']['swipebox']['video_max_width']
2105 )
2106 );
2107
2108 if($this->options['configuration']['swipebox']['force_png_icons'] === TRUE)
2109 {
2110 wp_add_inline_style(
2111 'responsive-lightbox-swipebox-front',
2112 '#swipebox-action #swipebox-prev, #swipebox-action #swipebox-next, #swipebox-action #swipebox-close { background-image: url('.plugins_url('assets/swipebox/source/img/icons.png' , __FILE__).') !important; }'
2113 );
2114 }
2115 }
2116 elseif($args['script'] === 'fancybox')
2117 {
2118 wp_register_script(
2119 'responsive-lightbox-fancybox',
2120 plugins_url('assets/fancybox/jquery.fancybox-1.3.4.js', __FILE__),
2121 array('jquery'),
2122 '',
2123 ($this->options['settings']['loading_place'] === 'header' ? false : true)
2124 );
2125
2126 wp_enqueue_script('responsive-lightbox-fancybox');
2127
2128 wp_register_style(
2129 'responsive-lightbox-fancybox-front',
2130 plugins_url('assets/fancybox/jquery.fancybox-1.3.4.css', __FILE__)
2131 );
2132
2133 wp_enqueue_style('responsive-lightbox-fancybox-front');
2134
2135 $args = array_merge(
2136 $args,
2137 array(
2138 'modal' => $this->getBooleanValue($this->options['configuration']['fancybox']['modal']),
2139 'showOverlay' => $this->getBooleanValue($this->options['configuration']['fancybox']['show_overlay']),
2140 'showCloseButton' => $this->getBooleanValue($this->options['configuration']['fancybox']['show_close_button']),
2141 'enableEscapeButton' => $this->getBooleanValue($this->options['configuration']['fancybox']['enable_escape_button']),
2142 'hideOnOverlayClick' => $this->getBooleanValue($this->options['configuration']['fancybox']['hide_on_overlay_click']),
2143 'hideOnContentClick' => $this->getBooleanValue($this->options['configuration']['fancybox']['hide_on_content_click']),
2144 'cyclic' => $this->getBooleanValue($this->options['configuration']['fancybox']['cyclic']),
2145 'showNavArrows' => $this->getBooleanValue($this->options['configuration']['fancybox']['show_nav_arrows']),
2146 'autoScale' => $this->getBooleanValue($this->options['configuration']['fancybox']['auto_scale']),
2147 'scrolling' => $this->options['configuration']['fancybox']['scrolling'],
2148 'centerOnScroll' => $this->getBooleanValue($this->options['configuration']['fancybox']['center_on_scroll']),
2149 'opacity' => $this->getBooleanValue($this->options['configuration']['fancybox']['opacity']),
2150 'overlayOpacity' => $this->options['configuration']['fancybox']['overlay_opacity'],
2151 'overlayColor' => $this->options['configuration']['fancybox']['overlay_color'],
2152 'titleShow' => $this->getBooleanValue($this->options['configuration']['fancybox']['title_show']),
2153 'titlePosition' => $this->options['configuration']['fancybox']['title_position'],
2154 'transitions' => $this->options['configuration']['fancybox']['transitions'],
2155 'easings' => $this->options['configuration']['fancybox']['easings'],
2156 'speeds' => $this->options['configuration']['fancybox']['speeds'],
2157 'changeSpeed' => $this->options['configuration']['fancybox']['change_speed'],
2158 'changeFade' => $this->options['configuration']['fancybox']['change_fade'],
2159 'padding' => $this->options['configuration']['fancybox']['padding'],
2160 'margin' => $this->options['configuration']['fancybox']['margin'],
2161 'videoWidth' => $this->options['configuration']['fancybox']['video_width'],
2162 'videoHeight' => $this->options['configuration']['fancybox']['video_height']
2163 )
2164 );
2165 }
2166 elseif($args['script'] === 'nivo')
2167 {
2168 wp_register_script(
2169 'responsive-lightbox-nivo',
2170 plugins_url('assets/nivo/nivo-lightbox.js', __FILE__),
2171 array('jquery'),
2172 '',
2173 ($this->options['settings']['loading_place'] === 'header' ? false : true)
2174 );
2175
2176 wp_enqueue_script('responsive-lightbox-nivo');
2177
2178 wp_register_style(
2179 'responsive-lightbox-nivo-front',
2180 plugins_url('assets/nivo/nivo-lightbox.css', __FILE__)
2181 );
2182
2183 wp_enqueue_style('responsive-lightbox-nivo-front');
2184
2185 wp_register_style(
2186 'responsive-lightbox-nivo-front-template',
2187 plugins_url('assets/nivo/themes/default/default.css', __FILE__)
2188 );
2189
2190 wp_enqueue_style('responsive-lightbox-nivo-front-template');
2191
2192 $args = array_merge(
2193 $args,
2194 array(
2195 'effect' => $this->options['configuration']['nivo']['effect'],
2196 'keyboardNav' => $this->getBooleanValue($this->options['configuration']['nivo']['keyboard_nav']),
2197 'errorMessage' => esc_attr($this->options['configuration']['nivo']['error_message'])
2198 )
2199 );
2200 }
2201 elseif($args['script'] === 'imagelightbox')
2202 {
2203 wp_register_script(
2204 'responsive-lightbox-imagelightbox',
2205 plugins_url('assets/imagelightbox/js/imagelightbox.min.js', __FILE__),
2206 array('jquery'),
2207 '',
2208 ($this->options['settings']['loading_place'] === 'header' ? false : true)
2209 );
2210
2211 wp_enqueue_script('responsive-lightbox-imagelightbox');
2212
2213 wp_register_style(
2214 'responsive-lightbox-imagelightbox-front',
2215 plugins_url('assets/imagelightbox/css/imagelightbox.css', __FILE__)
2216 );
2217
2218 wp_enqueue_style('responsive-lightbox-imagelightbox-front');
2219
2220 $args = array_merge(
2221 $args,
2222 array(
2223 'animationSpeed' => $this->options['configuration']['imagelightbox']['animation_speed'],
2224 'preloadNext' => $this->getBooleanValue($this->options['configuration']['imagelightbox']['preload_next']),
2225 'enableKeyboard' => $this->getBooleanValue($this->options['configuration']['imagelightbox']['enable_keyboard']),
2226 'quitOnEnd' => $this->getBooleanValue($this->options['configuration']['imagelightbox']['quit_on_end']),
2227 'quitOnImageClick' => $this->getBooleanValue($this->options['configuration']['imagelightbox']['quit_on_image_click']),
2228 'quitOnDocumentClick' => $this->getBooleanValue($this->options['configuration']['imagelightbox']['quit_on_document_click']),
2229 )
2230 );
2231 }
2232
2233 wp_register_script(
2234 'responsive-lightbox-front',
2235 plugins_url('js/front.js', __FILE__),
2236 array('jquery'),
2237 '',
2238 ($this->options['settings']['loading_place'] === 'header' ? false : true)
2239 );
2240
2241 wp_enqueue_script('responsive-lightbox-front');
2242
2243 wp_add_inline_style(
2244 'responsive-lightbox-swipebox',
2245 '#swipebox-action #swipebox-close, #swipebox-action #swipebox-prev, #swipebox-action #swipebox-next { background-image: url(\'assets/swipebox/source/img/icons.png\') !important; }'
2246 );
2247
2248 wp_localize_script(
2249 'responsive-lightbox-front',
2250 'rlArgs',
2251 $args
2252 );
2253 }
2254
2255
2256 /**
2257 *
2258 */
2259 private function getBooleanValue($option)
2260 {
2261 return ($option === TRUE ? 1 : 0);
2262 }
2263
2264
2265 /**
2266 * Loads textdomain
2267 */
2268 public function load_textdomain()
2269 {
2270 load_plugin_textdomain('responsive-lightbox', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
2271 }
2272
2273
2274 /**
2275 * Add links to Support Forum
2276 */
2277 public function plugin_extend_links($links, $file)
2278 {
2279 if(!current_user_can('install_plugins'))
2280 return $links;
2281
2282 $plugin = plugin_basename(__FILE__);
2283
2284 if($file == $plugin)
2285 {
2286 return array_merge(
2287 $links,
2288 array(sprintf('<a href="http://www.dfactory.eu/support/forum/responsive-lightbox/" target="_blank">%s</a>', __('Support', 'responsive-lightbox')))
2289 );
2290 }
2291
2292 return $links;
2293 }
2294
2295
2296 /**
2297 * Add links to Settings page
2298 */
2299 function plugin_settings_link($links, $file)
2300 {
2301 if(!is_admin() || !current_user_can('manage_options'))
2302 return $links;
2303
2304 static $plugin;
2305
2306 $plugin = plugin_basename(__FILE__);
2307
2308 if($file == $plugin)
2309 {
2310 $settings_link = sprintf('<a href="%s">%s</a>', admin_url('options-general.php').'?page=responsive-lightbox', __('Settings', 'responsive-lightbox'));
2311 array_unshift($links, $settings_link);
2312 }
2313
2314 return $links;
2315 }
2316 }
2317
2318 $responsive_lightbox = new Responsive_Lightbox();
2319 ?>