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