'.__('Settings', 'wp-jquery-lightbox').''; array_unshift($links, $settings_link); } return $links; } function jqlb_add_admin_footer(){ //shows some plugin info in the footer of the config screen. $plugin_data = get_plugin_data(__FILE__); printf('%1$s by %2$s
', $plugin_data['Title'].' '.$plugin_data['Version'], $plugin_data['Author']); } function jqlb_register_settings(){ register_setting( 'jqlb-settings-group', 'jqlb_automate', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_showTitle', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_useAltForTitle', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_showCaption', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_showNumbers', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_comments', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_resize_on_demand', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_showDownload', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_navbarOnTop', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_margin_size', 'floatval'); register_setting( 'jqlb-settings-group', 'jqlb_mobile_margin_size', 'floatval'); register_setting( 'jqlb-settings-group', 'jqlb_resize_speed', 'jqlb_pos_intval'); register_setting( 'jqlb-settings-group', 'jqlb_slideshow_speed', 'jqlb_pos_intval'); register_setting( 'jqlb-settings-group', 'jqlb_use_theme_styles', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_enqueue_in_footer', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_pinchzoom', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_borderSize', 'jqlb_pos_intval'); register_setting( 'jqlb-settings-group', 'jqlb_borderColor', 'sanitize_text_field'); register_setting( 'jqlb-settings-group', 'jqlb_overlayColor', 'sanitize_text_field'); register_setting( 'jqlb-settings-group', 'jqlb_overlayOpacity', 'floatval'); register_setting( 'jqlb-settings-group', 'jqlb_boxShadow', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_newNavStyle', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_fixedNav', 'jqlb_bool_intval'); register_setting( 'jqlb-settings-group', 'jqlb_navArrowColor', 'sanitize_text_field'); register_setting( 'jqlb-settings-group', 'jqlb_navBackgroundColor', 'sanitize_text_field'); register_setting( 'jqlb-settings-group', 'jqlb_showInfoBar', 'jqlb_bool_intval'); add_option('jqlb_showTitle', 1); add_option('jqlb_useAltForTitle', 1); add_option('jqlb_showCaption', 1); add_option('jqlb_showNumbers', 1); add_option('jqlb_automate', 1); //default is to auto-lightbox. add_option('jqlb_comments', 1); add_option('jqlb_resize_on_demand', 1); add_option('jqlb_showDownload', 0); add_option('jqlb_navbarOnTop', 0); add_option('jqlb_margin_size', 40); add_option('jqlb_mobile_margin_size', 10); add_option('jqlb_resize_speed', 400); add_option('jqlb_slideshow_speed', 4000); add_option('jqlb_use_theme_styles', 0); add_option('jqlb_enqueue_in_footer', 1); add_option('jqlb_pinchzoom', 1); add_option('jqlb_borderSize', 6); add_option('jqlb_borderColor', '#fff'); add_option('jqlb_overlayColor', '#fff'); add_option('jqlb_overlayOpacity', '0.7'); add_option('jqlb_boxShadow', 1); add_option('jqlb_newNavStyle', 1); add_option('jqlb_navArrowColor', '#000000'); add_option('jqlb_navBackgroundColor', 'rgba(255,255,255,.7'); add_option('jqlb_fixedNav', 1); add_option('jqlb_showInfoBar', 0); } function jqlb_register_menu_item() { add_options_page('jQuery Lightbox Options', 'jQuery Lightbox', 'manage_options', 'jquery-lightbox-options', 'jqlb_options_panel'); } function jqlb_get_locale(){ //$lang_locales and ICL_LANGUAGE_CODE are defined in the WPML plugin (http://wpml.org/) global $lang_locales; if (defined('ICL_LANGUAGE_CODE') && isset($lang_locales[ICL_LANGUAGE_CODE])){ $locale = $lang_locales[ICL_LANGUAGE_CODE]; } else { $locale = get_locale(); } return $locale; } function jqlb_css(){ if(is_admin() || is_feed()){return;} $locale = jqlb_get_locale(); $fileName = "lightbox.min.{$locale}.css"; $haveThemeCss = false; if(get_option('jqlb_use_theme_styles') == 1){ // courtesy of Vincent Weber $pathTheme = get_stylesheet_directory() ."/{$fileName}"; //look for CSS in theme's style folder first if(false === ($haveThemeCss = is_readable($pathTheme))) { $fileName = 'lightbox.min.css'; $pathTheme = get_stylesheet_directory() ."/{$fileName}"; $haveThemeCss = is_readable($pathTheme); } } if($haveThemeCss == false){ $path = plugin_dir_path(__FILE__)."styles/{$fileName}"; if(!is_readable($path)) { $fileName = 'lightbox.min.css'; } } $uri = ( $haveThemeCss ) ? get_stylesheet_directory_uri().'/'.$fileName : plugin_dir_url(__FILE__).'styles/'.$fileName; wp_enqueue_style('jquery.lightbox.min.css', $uri, false, JQLB_VERSION ); wp_enqueue_style('jqlb-overrides', plugin_dir_url(__FILE__).'styles/overrides.css', false, JQLB_VERSION ); // Add inline styles for new nav arrow styling // Needed to apply styles to :before pseudo-selectors $nav_arrow_color = get_option('jqlb_navArrowColor'); $nav_background_color = get_option('jqlb_navBackgroundColor'); $border_width = get_option('jqlb_borderSize'); $has_box_shadow = get_option('jqlb_boxShadow'); $has_info_bar = get_option('jqlb_showInfoBar'); $image_box_shadow = $has_box_shadow ? '0 0 4px 2px rgba(0,0,0,.2)' : ''; $infobar_box_shadow = ($has_box_shadow && $has_info_bar) ? '0 -4px 0 0 #fff, 0 0 4px 2px rgba(0,0,0,.1);' : ''; $custom_css = " #outerImageContainer { box-shadow: {$image_box_shadow}; } #imageContainer{ padding: {$border_width}px; } #imageDataContainer { box-shadow: {$infobar_box_shadow}; } #prevArrow, #nextArrow{ background-color: {$nav_background_color}; color: {$nav_arrow_color}; }"; wp_add_inline_style( 'jqlb-overrides', $custom_css ); } function jqlb_js() { if(is_admin() || is_feed()){return;} $enqueInFooter = get_option('jqlb_enqueue_in_footer') ? true : false; wp_enqueue_script('jquery', '', array(), false, $enqueInFooter); wp_enqueue_script('wp-jquery-lightbox-swipe', plugins_url(JQLB_TOUCH_SCRIPT, __FILE__), Array('jquery'), JQLB_VERSION, $enqueInFooter); if ( get_option( 'jqlb_pinchzoom' ) === '1' ) { wp_enqueue_script('wp-jquery-lightbox-panzoom', plugins_url(JQLB_PANZOOM_SCRIPT, __FILE__), Array('jquery'), JQLB_VERSION, $enqueInFooter); wp_enqueue_script('wp-jquery-lightbox', plugins_url(JQLB_SCRIPT, __FILE__), Array('jquery', 'wp-jquery-lightbox-panzoom'), time(), $enqueInFooter); } else { wp_enqueue_script('wp-jquery-lightbox', plugins_url(JQLB_SCRIPT, __FILE__), Array('jquery'), time(), $enqueInFooter); } wp_localize_script('wp-jquery-lightbox', 'JQLBSettings', array( 'showTitle' => get_option('jqlb_showTitle'), 'useAltForTitle' => get_option('jqlb_useAltForTitle'), 'showCaption' => get_option('jqlb_showCaption'), 'showNumbers' => get_option('jqlb_showNumbers'), 'fitToScreen' => get_option('jqlb_resize_on_demand'), 'resizeSpeed' => get_option('jqlb_resize_speed'), 'showDownload' => get_option('jqlb_showDownload'), 'navbarOnTop' => get_option('jqlb_navbarOnTop'), 'marginSize' => get_option('jqlb_margin_size'), 'mobileMarginSize' => get_option('jqlb_mobile_margin_size'), 'slideshowSpeed' => get_option('jqlb_slideshow_speed'), 'allowPinchZoom' => get_option('jqlb_pinchzoom'), 'borderSize' => get_option('jqlb_borderSize'), 'borderColor' => get_option('jqlb_borderColor'), 'overlayColor' => get_option('jqlb_overlayColor'), 'overlayOpacity' => get_option('jqlb_overlayOpacity'), 'newNavStyle' => get_option('jqlb_newNavStyle'), 'fixedNav' => get_option('jqlb_fixedNav'), 'showInfoBar' => get_option('jqlb_showInfoBar'), /* translation */ 'prevLinkTitle' => __('previous image', 'wp-jquery-lightbox'), 'nextLinkTitle' => __('next image', 'wp-jquery-lightbox'), 'closeTitle' => __('close image gallery', 'wp-jquery-lightbox'), 'image' => __('Image ', 'wp-jquery-lightbox'), 'of' => __(' of ', 'wp-jquery-lightbox'), 'download' => __('Download', 'wp-jquery-lightbox'), 'pause' => __('(Pause Slideshow)', 'wp-jquery-lightbox'), 'play' => __('(Play Slideshow)', 'wp-jquery-lightbox') )); } function jqlb_lightbox_comment($comment){ $comment = str_replace('rel=\'external nofollow\'','', $comment); $comment = str_replace('rel=\'nofollow\'','', $comment); $comment = str_replace('rel="external nofollow"','', $comment); $comment = str_replace('rel="nofollow"','', $comment); return jqlb_autoexpand_rel_wlightbox($comment); } function jqlb_autoexpand_rel_wlightbox($content) { if(get_option('jqlb_automate') == 1){ global $post; $id = isset($post->ID) ? $post->ID : -1; $content = jqlb_do_regexp($content, $id); } return $content; } function jqlb_apply_lightbox($content, $id = -1){ if(!isset($id) || $id === -1){ $id = time().rand(0, 32768); } return jqlb_do_regexp($content, $id); } //Matt's version to support multiple rel values //https://wordpress.org/support/topic/fix-for-auto-lightboxing-links-that-contain-rel-attributes-already?replies=12 function jqlb_do_regexp_multirel($content, $id){ $id = esc_attr($id); $a_tag_img_regex = "/(]+href=['\"][^>]+\\.(?:bmp|gif|jpg|jpeg|png|webp)[^>]+)>/i"; if (preg_match_all($a_tag_img_regex, $content, $a_tag_matches, PREG_SET_ORDER)) { foreach ($a_tag_matches as $a_tag) { $new_a_tag = $a_tag[0]; $rel_regex = "/(rel=['\"])(?![^>]*?(?:lightbox|nolb|nobox))([^'\"]+)(['\"])/i"; $new_a_tag = preg_replace($rel_regex, '$1lightbox['.$id.'] $2$3', $new_a_tag); $no_rel_regex = "/(]*?rel=['\"].+)[^>]+href=['\"][^>]+\\.(?:bmp|gif|jpg|jpeg|png|webp)[^>]+)>/i"; $new_a_tag = preg_replace($no_rel_regex, '$1 rel="lightbox['.$id.']">', $new_a_tag); if ($new_a_tag != $a_tag[0]) $content = str_replace($a_tag[0], $new_a_tag, $content); } } return $content; } /* automatically insert rel="lightbox[nameofpost]" to every image with no manual work. if there are already rel="lightbox[something]" attributes, they are not clobbered. Michael Tyson, you are a regular expressions god! - http://atastypixel.com */ function jqlb_do_regexp($content, $id){ $id = esc_attr($id); $content = preg_replace('/\s+rel="attachment wp-att-[0-9]+"/i', '', $content); //remove WP 4.4 garbage $pattern = "/(]*?rel=['\"]lightbox.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png|webp)(\?\S{0,}){0,1}['\"][^\>]*)>/i"; $replacement = '$1 rel="lightbox['.$id.']">'; return preg_replace($pattern, $replacement, $content); } //this filter runs when adding images to a post in the WP 4.4 editor //removing the garbage rel before they're saved to the database. function jqlb_remove_rel($content, $id){ return preg_replace('/\s+rel="attachment wp-att-[0-9]+"/i', '', $content); } function jqlb_filter_groups($html, $attr) {//runs on the post_gallery filter. global $jqlb_group; if(empty($attr['group'])){ $jqlb_group = -1; remove_filter('wp_get_attachment_link','jqlb_lightbox_gallery_links',10,1); }else{ $jqlb_group = $attr['group']; add_filter('wp_get_attachment_link','jqlb_lightbox_gallery_links',10,1); } return ''; } function jqlb_lightbox_gallery_links($html){ //honors our custom group-attribute of the gallery shortcode. global $jqlb_group; if(!isset($jqlb_group) || $jqlb_group == -1){return $html;} return str_replace('

jQuery Lightbox

/>
/>
/>
/>
/>
/>
/>
/>
/>
/>
/>
/>
/>
/>
/>
/>

The documentation files are missing! Try downloading and re-installing this plugin.

'; } echo $text; ?>