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