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