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