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