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