Skip to content

Commit

Permalink
Version 1.5.3
Browse files Browse the repository at this point in the history
* Fix: Caption may not display under certain circumstances (Caption Erin)
* Fix: Images not grouped when "separate by post" option is activated (Logical Ross)
  • Loading branch information
archetyped committed Mar 29, 2011
1 parent c4c80fb commit 79b4632
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
12 changes: 7 additions & 5 deletions js/dev/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ Lightbox = {
var inner = $(imageLink).find('img').first();
if ( $(inner).length )
caption = $(inner).attr('title') || $(inner).attr('alt');
if ( !caption && imageLink.text().length )
caption = imageLink.text();
else if ( this.options.captionSrc )
caption = imageLink.attr('href');
else
if ( !caption ) {
if ( imageLink.text().length )
caption = imageLink.text();
else if ( this.options.captionSrc )
caption = imageLink.attr('href');
}
if ( !caption )
caption = '';
}
return caption;
Expand Down
6 changes: 3 additions & 3 deletions js/lib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Simple Lightbox
Plugin URI: http://archetyped.com/tools/simple-lightbox/
Description: Customizable Lightbox for Wordpress
Version: 1.5.2
Version: 1.5.3
Author: Archetyped
Author URI: http://archetyped.com
*/
Expand Down
38 changes: 27 additions & 11 deletions model.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ class SLB_Lightbox extends SLB_Base {

/*-** Properties **-*/

/**
* Version number
* @var string
*/
var $version = '1.5.3';

/**
* Themes
* @var array
Expand Down Expand Up @@ -366,7 +372,7 @@ function init_default_themes() {
*/
function activate_post_links($content) {
//Check option
if ( ! is_feed() && $this->is_enabled() && $this->get_option_value('activate_links') && $this->get_option_value('group_links') ) {
if ( ! is_feed() && $this->is_enabled() && $this->get_option_value('activate_links') ) {
//Scan for links
$matches = array();
if ( preg_match_all("/\<a[^\>]*href=[^\s]+\.(?:jp[e]*g|gif|png).*?\>/i", $content, $matches) ) {
Expand All @@ -378,17 +384,28 @@ function activate_post_links($content) {
$rel = '';
if ( strpos(strtolower($link_new), ' rel=') !== false && preg_match("/\s+rel=(?:\"|')(.*?)(?:\"|')(\s|\>)/i", $link_new, $rel) ) {
//Check if lightbox is already set in rel attribute
$link_new = str_replace($rel[0], $rel[2], $link_new);
$rel = $rel[1];
}

if ( strpos($rel, 'lightbox') === false) {
//Add rel attribute to link
$rel .= ' ' . ( ( $this->get_option_value('group_post') ) ? 'lightbox[' . $this->add_prefix($post->ID) . ']' : 'lightbox' );
$link_new = '<a rel="' . $rel . '"' . substr($link_new,2);
//Insert modified link
$content = str_replace($link, $link_new, $content);
if ( !empty($rel) )
continue;

//Add rel attribute to link
$lb = 'lightbox';
$group = '';
//Check if links should be grouped
if ( $this->get_option_value('group_links') ) {
$group = $this->get_prefix();
//Check if groups should be separated by post
if ( $this->get_option_value('group_post') )
$group = $this->add_prefix($post->ID);
}
if ( !empty($group) )
$lb .= '[' . $group . ']';
$rel = $lb;
$link_new = '<a rel="' . $rel . '"' . substr($link_new,2);
//Insert modified link
$content = str_replace($link, $link_new, $content);
}
}
}
Expand All @@ -401,8 +418,8 @@ function activate_post_links($content) {
function enqueue_files() {
if ( ! $this->is_enabled() )
return;
wp_enqueue_script($this->add_prefix('lib'), $this->util->get_file_url('js/lib.js'), array('jquery'));
wp_enqueue_style($this->add_prefix('lightbox_css'), $this->get_theme_style());
wp_enqueue_script($this->add_prefix('lib'), $this->util->get_file_url('js/lib.js'), array('jquery'), $this->version);
wp_enqueue_style($this->add_prefix('lightbox_css'), $this->get_theme_style(), array(), $this->version);
}

/**
Expand Down Expand Up @@ -658,7 +675,6 @@ function admin_field_default($args = array()) {
* @param array $args Arguments set in admin_settings
*/
function admin_field_theme($args = array()) {
global $cnr_debug;
//Get option data
$option = $this->get_option($args['opt']);

Expand Down

0 comments on commit 79b4632

Please sign in to comment.