Lightbox Gallery - Version 0.2.5

Version Description

Download this release

Release Info

Developer Hiroaki Miyashita
Plugin Icon wp plugin Lightbox Gallery
Version 0.2.5
Comparing to
See all releases

Code changes from version 0.2.4 to 0.2.5

Files changed (3) hide show
  1. js/jquery.lightbox.js +12 -9
  2. lightbox-gallery.php +38 -36
  3. readme.txt +1 -1
js/jquery.lightbox.js CHANGED
@@ -81,16 +81,19 @@
81
  } else {
82
  // Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references
83
  for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
84
- if( i > 0 ) {
85
- if( !(jQueryMatchedObj[i-1].getAttribute('href') != jQueryMatchedObj[i].getAttribute('href') && jQuery(jQueryMatchedObj[i-1]).parent().parent().children().children().attr('href') == jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('href'))) {
86
- if( settings.captionPosition == 'gallery' ) var position = jQuery(jQueryMatchedObj[i]).parent().next().html();
87
- else var position = jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('title');
88
- settings.imageArray.push(new Array(jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('href'),position));
89
- }
90
  } else {
91
- if( settings.captionPosition == 'gallery' ) var position = jQuery(jQueryMatchedObj[i]).parent().next().html();
92
- else var position = jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('title');
93
- settings.imageArray.push(new Array(jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('href'),position));
 
 
 
 
 
 
94
  }
95
  }
96
  }
81
  } else {
82
  // Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references
83
  for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
84
+ if( settings.captionPosition != 'gallery' ) {
85
+ var position = jQueryMatchedObj[i].getAttribute('title');
86
+ settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),position));
 
 
 
87
  } else {
88
+ if( i > 1 ) {
89
+ if( !(jQueryMatchedObj[i-1].getAttribute('href') != jQueryMatchedObj[i].getAttribute('href') && jQuery(jQueryMatchedObj[i-1]).parent().parent().children().children().attr('href') == jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('href'))) {
90
+ var position = jQuery(jQueryMatchedObj[i]).parent().next().html();
91
+ settings.imageArray.push(new Array(jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('href'),position));
92
+ }
93
+ } else {
94
+ var position = jQuery(jQueryMatchedObj[i]).parent().next().html();
95
+ settings.imageArray.push(new Array(jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr('href'),position));
96
+ }
97
  }
98
  }
99
  }
lightbox-gallery.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Lightbox Gallery
4
  Plugin URI: http://wordpressgogo.com/development/lightbox-gallery.html
5
  Description: Changes to the lightbox view in galleries.
6
  Author: Hiroaki Miyashita
7
- Version: 0.2.4
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
@@ -99,48 +99,50 @@ function lightbox_gallery($attr) {
99
  <div class='gallery {$class}'>");
100
 
101
  foreach ( $attachments as $id => $attachment ) {
102
- $thumbnail_link = wp_get_attachment_image_src($attachment->ID, $size, false);
103
- $lightbox_link = wp_get_attachment_image_src($attachment->ID, $lightboxsize, false);
104
- trim($attachment->post_content);
105
- trim($attachment->post_excerpt);
 
106
 
107
- if($meta == "true") {
108
- $imagedata = wp_get_attachment_metadata($attachment->ID);
109
- unset($metadata);
110
- if($imagedata['image_meta']['camera'])
111
- $metadata .= __('camera', 'lightbox-gallery') . ": ". $imagedata['image_meta']['camera'] . " ";
112
- if($imagedata['image_meta']['aperture'])
113
- $metadata .= __('aperture', 'lightbox-gallery') . ": F". $imagedata['image_meta']['aperture'] . " ";
114
- if($imagedata['image_meta']['focal_length'])
115
- $metadata .= __('focal_length', 'lightbox-gallery') . ": ". $imagedata['image_meta']['focal_length'] . "mm ";
116
- if($imagedata['image_meta']['iso'])
117
- $metadata .= __('ISO', 'lightbox-gallery') . ": ". $imagedata['image_meta']['iso'] . " ";
118
- if($imagedata['image_meta']['shutter_speed']) {
119
- if($imagedata['image_meta']['shutter_speed']<1) $speed = "1/". round(1/$imagedata['image_meta']['shutter_speed']);
120
- else $speed = $imagedata['image_meta']['shutter_speed'];
121
- $metadata .= __('shutter_speed', 'lightbox-gallery') . ": " . $speed . " ";
 
 
 
122
  }
123
- if($imagedata['image_meta']['created_timestamp'])
124
- $metadata .= __('created_timestamp', 'lightbox-gallery') . ": ". date('Y:m:d H:i:s', $imagedata['image_meta']['created_timestamp']);
125
- }
126
 
127
- $output .= "<{$itemtag} class='gallery-item'>";
128
- $output .= "
129
  <{$icontag} class='gallery-icon'>
130
  <a href='{$lightbox_link[0]}' title='{$attachment->post_excerpt}'";
131
- if ( $nofollow == "true" ) $output .= " rel='nofollow'";
132
- $output .= "><img src='{$thumbnail_link[0]}' width='{$thumbnail_link[1]}' height='{$thumbnail_link[2]}' alt='{$attachment->post_excerpt}' /></a>
133
  </{$icontag}>";
134
- if ( $captiontag && (trim($attachment->post_excerpt) || trim($attachment->post_content) || $metadata) ) {
135
- $output .= "<{$captiontag} class='gallery-caption'>";
136
- if($attachment->post_excerpt) $output .= $attachment->post_excerpt . "<br />\n";
137
- if($attachment->post_content) $output .= $attachment->post_content . "<br />\n";
138
- if($metadata) $output .= $metadata;
139
- $output .= "</{$captiontag}>";
 
 
 
 
140
  }
141
- $output .= "</{$itemtag}>";
142
- if ( $columns > 0 && ++$i % $columns == 0 )
143
- $output .= '<div style="clear: both"></div>';
144
  }
145
 
146
  $output .= '
4
  Plugin URI: http://wordpressgogo.com/development/lightbox-gallery.html
5
  Description: Changes to the lightbox view in galleries.
6
  Author: Hiroaki Miyashita
7
+ Version: 0.2.5
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
99
  <div class='gallery {$class}'>");
100
 
101
  foreach ( $attachments as $id => $attachment ) {
102
+ if ( $attachment->post_type == 'attachment' ) {
103
+ $thumbnail_link = wp_get_attachment_image_src($attachment->ID, $size, false);
104
+ $lightbox_link = wp_get_attachment_image_src($attachment->ID, $lightboxsize, false);
105
+ trim($attachment->post_content);
106
+ trim($attachment->post_excerpt);
107
 
108
+ if($meta == "true") {
109
+ $imagedata = wp_get_attachment_metadata($attachment->ID);
110
+ unset($metadata);
111
+ if($imagedata['image_meta']['camera'])
112
+ $metadata .= __('camera', 'lightbox-gallery') . ": ". $imagedata['image_meta']['camera'] . " ";
113
+ if($imagedata['image_meta']['aperture'])
114
+ $metadata .= __('aperture', 'lightbox-gallery') . ": F". $imagedata['image_meta']['aperture'] . " ";
115
+ if($imagedata['image_meta']['focal_length'])
116
+ $metadata .= __('focal_length', 'lightbox-gallery') . ": ". $imagedata['image_meta']['focal_length'] . "mm ";
117
+ if($imagedata['image_meta']['iso'])
118
+ $metadata .= __('ISO', 'lightbox-gallery') . ": ". $imagedata['image_meta']['iso'] . " ";
119
+ if($imagedata['image_meta']['shutter_speed']) {
120
+ if($imagedata['image_meta']['shutter_speed']<1) $speed = "1/". round(1/$imagedata['image_meta']['shutter_speed']);
121
+ else $speed = $imagedata['image_meta']['shutter_speed'];
122
+ $metadata .= __('shutter_speed', 'lightbox-gallery') . ": " . $speed . " ";
123
+ }
124
+ if($imagedata['image_meta']['created_timestamp'])
125
+ $metadata .= __('created_timestamp', 'lightbox-gallery') . ": ". date('Y:m:d H:i:s', $imagedata['image_meta']['created_timestamp']);
126
  }
 
 
 
127
 
128
+ $output .= "<{$itemtag} class='gallery-item'>";
129
+ $output .= "
130
  <{$icontag} class='gallery-icon'>
131
  <a href='{$lightbox_link[0]}' title='{$attachment->post_excerpt}'";
132
+ if ( $nofollow == "true" ) $output .= " rel='nofollow'";
133
+ $output .= "><img src='{$thumbnail_link[0]}' width='{$thumbnail_link[1]}' height='{$thumbnail_link[2]}' alt='{$attachment->post_excerpt}' /></a>
134
  </{$icontag}>";
135
+ if ( $captiontag && (trim($attachment->post_excerpt) || trim($attachment->post_content) || $metadata) ) {
136
+ $output .= "<{$captiontag} class='gallery-caption'>";
137
+ if($attachment->post_excerpt) $output .= $attachment->post_excerpt . "<br />\n";
138
+ if($attachment->post_content) $output .= $attachment->post_content . "<br />\n";
139
+ if($metadata) $output .= $metadata;
140
+ $output .= "</{$captiontag}>";
141
+ }
142
+ $output .= "</{$itemtag}>";
143
+ if ( $columns > 0 && ++$i % $columns == 0 )
144
+ $output .= '<div style="clear: both"></div>';
145
  }
 
 
 
146
  }
147
 
148
  $output .= '
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpressgogo.com/development/lightbox-gallery.html
4
  Tags: lightbox, gallery, image, images, album, photo
5
  Requires at least: 2.5
6
  Tested up to: 2.6.1
7
- Stable tag: 0.2.4
8
 
9
  This plugin changes the view of galleries to the lightbox.
10
 
4
  Tags: lightbox, gallery, image, images, album, photo
5
  Requires at least: 2.5
6
  Tested up to: 2.6.1
7
+ Stable tag: 0.2.5
8
 
9
  This plugin changes the view of galleries to the lightbox.
10