NextGEN Gallery – WordPress Gallery Plugin - Version 1.5.4

Version Description

  • 14.06.2010 =
  • Bugfix : No resize of smaller images
  • Bugfix : Compat issues for Post Thumbnails under WP3.0
  • Bugfix : Esc_URL in Media RSS
Download this release

Release Info

Developer alexrabe
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 1.5.4
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.4

admin/functions.php CHANGED
@@ -596,8 +596,15 @@ class nggAdmin{
596
  nggAdmin::rotate_image( $pic_id );
597
 
598
  // Autoresize image if required
599
- if ($ngg->options['imgAutoResize'])
600
- nggAdmin::resize_image( $pic_id );
 
 
 
 
 
 
 
601
 
602
  // action hook for post process after the image is added to the database
603
  $image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
596
  nggAdmin::rotate_image( $pic_id );
597
 
598
  // Autoresize image if required
599
+ if ($ngg->options['imgAutoResize']) {
600
+ $imagetmp = nggdb::find_image( $pic_id );
601
+ $sizetmp = @getimagesize ( $imagetmp->imagePath );
602
+ $widthtmp = $ngg->options['imgWidth'];
603
+ $heighttmp = $ngg->options['imgHeight'];
604
+ if (($sizetmp[0] > $widthtmp && $widthtmp) || ($sizetmp[1] > $heighttmp && $heighttmp)) {
605
+ nggAdmin::resize_image( $pic_id );
606
+ }
607
+ }
608
 
609
  // action hook for post process after the image is added to the database
610
  $image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
changelog.txt CHANGED
@@ -1,6 +1,11 @@
1
  NextGEN Gallery
2
  by Alex Rabe & NextGEN DEV Team
3
 
 
 
 
 
 
4
  = V1.5.3 - 11.04.2010 =
5
  * New : Adding pagination to footer
6
  * Changed : Perpare new filter to replace slideshow
1
  NextGEN Gallery
2
  by Alex Rabe & NextGEN DEV Team
3
 
4
+ = V1.5.4 - 14.06.2010 =
5
+ * Bugfix : No resize of smaller images
6
+ * Bugfix : Compat issues for Post Thumbnails under WP3.0
7
+ * Bugfix : Esc_URL in Media RSS
8
+
9
  = V1.5.3 - 11.04.2010 =
10
  * New : Adding pagination to footer
11
  * Changed : Perpare new filter to replace slideshow
lib/media-rss.php CHANGED
@@ -210,10 +210,10 @@ class nggMediaRss {
210
  $out .= $indent . "\t<title><![CDATA[" . nggGallery::i18n($title) . "]]></title>\n";
211
  $out .= $indent . "\t<description><![CDATA[" . nggGallery::i18n($desc) . "]]></description>\n";
212
  $out .= $indent . "\t<link><![CDATA[" . $image->get_permalink() . "]]></link>\n";
213
- $out .= $indent . "\t<media:content url='" . $image->imageURL . "' medium='image' />\n";
214
  $out .= $indent . "\t<media:title><![CDATA[" . nggGallery::i18n($title) . "]]></media:title>\n";
215
  $out .= $indent . "\t<media:description><![CDATA[" . nggGallery::i18n($desc) . "]]></media:description>\n";
216
- $out .= $indent . "\t<media:thumbnail url='" . $image->thumbURL . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
217
  $out .= $indent . "\t<media:keywords><![CDATA[" . nggGallery::i18n($tag_names) . "]]></media:keywords>\n";
218
  $out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . get_option("siteurl") . ")]]></media:copyright>\n";
219
  $out .= $indent . "</item>\n";
210
  $out .= $indent . "\t<title><![CDATA[" . nggGallery::i18n($title) . "]]></title>\n";
211
  $out .= $indent . "\t<description><![CDATA[" . nggGallery::i18n($desc) . "]]></description>\n";
212
  $out .= $indent . "\t<link><![CDATA[" . $image->get_permalink() . "]]></link>\n";
213
+ $out .= $indent . "\t<media:content url='" . esc_url($image->imageURL) . "' medium='image' />\n";
214
  $out .= $indent . "\t<media:title><![CDATA[" . nggGallery::i18n($title) . "]]></media:title>\n";
215
  $out .= $indent . "\t<media:description><![CDATA[" . nggGallery::i18n($desc) . "]]></media:description>\n";
216
+ $out .= $indent . "\t<media:thumbnail url='" . esc_url($image->thumbURL) . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
217
  $out .= $indent . "\t<media:keywords><![CDATA[" . nggGallery::i18n($tag_names) . "]]></media:keywords>\n";
218
  $out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . get_option("siteurl") . ")]]></media:copyright>\n";
219
  $out .= $indent . "</item>\n";
lib/post-thumbnail.php CHANGED
@@ -6,7 +6,7 @@
6
  * @package NextGEN Gallery
7
  * @author Alex Rabe
8
  * @copyright 2010
9
- * @version 1.0.0
10
  * @access internal
11
  */
12
  class nggPostThumbnail {
@@ -134,26 +134,30 @@ class nggPostThumbnail {
134
  */
135
  function ajax_set_post_thumbnail() {
136
 
 
 
137
  // check for correct capability
138
  if ( !is_user_logged_in() )
139
  die( '-1' );
140
 
141
- $post_id = intval( $_POST['post_id'] );
142
- if ( !current_user_can( 'edit_post', $post_id ) )
 
 
143
  die( '-1' );
144
 
145
  $thumbnail_id = intval( $_POST['thumbnail_id'] );
146
 
147
  // delete the image
148
  if ( $thumbnail_id == '-1' ) {
149
- delete_post_meta( $post_id, '_thumbnail_id' );
150
  die( $this->_wp_post_thumbnail_html() );
151
  }
152
 
153
  // for NGG we look for the image id
154
  if ( $thumbnail_id && nggdb::find_image($thumbnail_id) ) {
155
  // to know that we have a NGG image we add "ngg-" before the id
156
- update_post_meta( $post_id, '_thumbnail_id', 'ngg-' . $thumbnail_id );
157
  die( $this->_wp_post_thumbnail_html( $thumbnail_id ) );
158
  }
159
  die( '0' );
@@ -168,11 +172,12 @@ class nggPostThumbnail {
168
  */
169
  function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
170
 
171
- global $_wp_additional_image_sizes;
172
 
173
- $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
174
-
175
- $image = nggdb::find_image($thumbnail_id);
 
176
  $img_src = false;
177
 
178
  // get the options
@@ -195,8 +200,9 @@ class nggPostThumbnail {
195
  $thumbnail_html = '<img width="266" src="'. $img_src . '" alt="'.$image->alttext.'" title="'.$image->alttext.'" />';
196
 
197
  if ( !empty( $thumbnail_html ) ) {
198
- $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
199
- $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
 
200
  }
201
  }
202
 
6
  * @package NextGEN Gallery
7
  * @author Alex Rabe
8
  * @copyright 2010
9
+ * @version 1.0.1
10
  * @access internal
11
  */
12
  class nggPostThumbnail {
134
  */
135
  function ajax_set_post_thumbnail() {
136
 
137
+ global $post_ID;
138
+
139
  // check for correct capability
140
  if ( !is_user_logged_in() )
141
  die( '-1' );
142
 
143
+ // get the post id as global variable, otherwise the ajax_nonce failed later
144
+ $post_ID = intval( $_POST['post_id'] );
145
+
146
+ if ( !current_user_can( 'edit_post', $post_ID ) )
147
  die( '-1' );
148
 
149
  $thumbnail_id = intval( $_POST['thumbnail_id'] );
150
 
151
  // delete the image
152
  if ( $thumbnail_id == '-1' ) {
153
+ delete_post_meta( $post_ID, '_thumbnail_id' );
154
  die( $this->_wp_post_thumbnail_html() );
155
  }
156
 
157
  // for NGG we look for the image id
158
  if ( $thumbnail_id && nggdb::find_image($thumbnail_id) ) {
159
  // to know that we have a NGG image we add "ngg-" before the id
160
+ update_post_meta( $post_ID, '_thumbnail_id', 'ngg-' . $thumbnail_id );
161
  die( $this->_wp_post_thumbnail_html( $thumbnail_id ) );
162
  }
163
  die( '0' );
172
  */
173
  function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
174
 
175
+ global $_wp_additional_image_sizes, $post_ID;
176
 
177
+ $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
178
+ $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
179
+
180
+ $image = nggdb::find_image($thumbnail_id);
181
  $img_src = false;
182
 
183
  // get the options
200
  $thumbnail_html = '<img width="266" src="'. $img_src . '" alt="'.$image->alttext.'" title="'.$image->alttext.'" />';
201
 
202
  if ( !empty( $thumbnail_html ) ) {
203
+ $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_ID" );
204
+ $content = sprintf($set_thumbnail_link, $thumbnail_html);
205
+ $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
206
  }
207
  }
208
 
nggallery.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: NextGEN Gallery
4
  Plugin URI: http://alexrabe.de/?page_id=80
5
  Description: A NextGENeration Photo gallery for the Web 2.0.
6
  Author: Alex Rabe
7
- Version: 1.5.3
8
 
9
  Author URI: http://alexrabe.de/
10
 
@@ -44,7 +44,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
44
  if (!class_exists('nggLoader')) {
45
  class nggLoader {
46
 
47
- var $version = '1.5.3';
48
  var $dbversion = '1.5.0';
49
  var $minium_WP = '2.9';
50
  var $minium_WPMU = '2.9';
4
  Plugin URI: http://alexrabe.de/?page_id=80
5
  Description: A NextGENeration Photo gallery for the Web 2.0.
6
  Author: Alex Rabe
7
+ Version: 1.5.4
8
 
9
  Author URI: http://alexrabe.de/
10
 
44
  if (!class_exists('nggLoader')) {
45
  class nggLoader {
46
 
47
+ var $version = '1.5.4';
48
  var $dbversion = '1.5.0';
49
  var $minium_WP = '2.9';
50
  var $minium_WPMU = '2.9';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Alex Rabe
3
  Donate link: http://alexrabe.de/donation/
4
  Tags: photos,flash,slideshow,images,gallery,media,admin,post,photo-albums,pictures,widgets,photo,picture,image,nextgen-gallery,nextgen gallery
5
  Requires at least: 2.9
6
- Tested up to: 2.9.2
7
  Stable tag: trunk
8
 
9
  NextGEN Gallery is a full integrated Image Gallery plugin for WordPress with a Flash slideshow option.
@@ -141,6 +141,11 @@ To show the most recent added mages : **[recent max=x ]**
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
144
  = V1.5.3 - 11.04.2010 =
145
  * New : Adding pagination to footer
146
  * Changed : Perpare new filter to replace slideshow
3
  Donate link: http://alexrabe.de/donation/
4
  Tags: photos,flash,slideshow,images,gallery,media,admin,post,photo-albums,pictures,widgets,photo,picture,image,nextgen-gallery,nextgen gallery
5
  Requires at least: 2.9
6
+ Tested up to: 3.0
7
  Stable tag: trunk
8
 
9
  NextGEN Gallery is a full integrated Image Gallery plugin for WordPress with a Flash slideshow option.
141
 
142
  == Changelog ==
143
 
144
+ = V1.5.4 - 14.06.2010 =
145
+ * Bugfix : No resize of smaller images
146
+ * Bugfix : Compat issues for Post Thumbnails under WP3.0
147
+ * Bugfix : Esc_URL in Media RSS
148
+
149
  = V1.5.3 - 11.04.2010 =
150
  * New : Adding pagination to footer
151
  * Changed : Perpare new filter to replace slideshow
xml/json.php CHANGED
@@ -53,7 +53,7 @@ class nggAPI {
53
 
54
  // Enable the JSON API when you add define('NGG_JSON_ENABLE',true); in the wp-config.php file
55
  if ( !defined('NGG_JSON_ENABLED') )
56
- wp_die('JSON API not enabled. Add <strong>define(\'NGG_JSON_ENABLE\', true);</strong> to your wp-config.php file');
57
 
58
  if ( !function_exists('json_encode') )
59
  wp_die('Json_encode not available. You need to use PHP 5.2');
53
 
54
  // Enable the JSON API when you add define('NGG_JSON_ENABLE',true); in the wp-config.php file
55
  if ( !defined('NGG_JSON_ENABLED') )
56
+ wp_die('JSON API not enabled. Add <strong>define(\'NGG_JSON_ENABLED\', true);</strong> to your wp-config.php file');
57
 
58
  if ( !function_exists('json_encode') )
59
  wp_die('Json_encode not available. You need to use PHP 5.2');