NextCellent Gallery – NextGEN Legacy - Version 1.9.23

Version Description

  • 24/09/2014 =

What's in it for you?

  • Fix for missing gallery stylesheets

VERY IMPORTANT: Read ON!

NextCellent Gallery provides backward compatibility for older NextGEN until version 1.9.13 .

  • this plugin will gracefully deactivate if detects NextGEN is working (any version) to avoid compatibility issues.

  • Please remember to READ THE FAQ!!! Issues for failing to read the FAQ will be IGNORED!!!

  • If you like it, please spread the word and rate it accordingly. I guess a lot of annoyed users can take advantage of NextCellent. Thank you!

  • WE APPRECIATE YOUR FEEDBACK. Be our voice and comment it!!!!

Download this release

Release Info

Developer WPReady
Plugin Icon NextCellent Gallery – NextGEN Legacy
Version 1.9.23
Comparing to
See all releases

Code changes from version 1.9.22 to 1.9.23

Files changed (6) hide show
  1. admin/admin.php +8 -0
  2. admin/upgrade.php +92 -0
  3. lib/core.php +32 -14
  4. lib/rewrite.php +3 -1
  5. nggallery.php +8 -4
  6. readme.txt +5 -12
admin/admin.php CHANGED
@@ -198,6 +198,14 @@ class nggAdminPanel{
198
  function show_menu() {
199
 
200
  global $ngg;
 
 
 
 
 
 
 
 
201
 
202
  // Set installation date
203
  if( empty($ngg->options['installDate']) ) {
198
  function show_menu() {
199
 
200
  global $ngg;
201
+
202
+ // check for upgrade and show upgrade screen
203
+ if( get_option( 'ngg_db_version' ) != NGG_DBVERSION ) {
204
+ include_once ( dirname (__FILE__) . '/functions.php' );
205
+ include_once ( dirname (__FILE__) . '/upgrade.php' );
206
+ nggallery_upgrade_page();
207
+ return;
208
+ }
209
 
210
  // Set installation date
211
  if( empty($ngg->options['installDate']) ) {
admin/upgrade.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ngg_upgrade() - update routine for older version
4
+ *
5
+ * @return Success message
6
+ */
7
+ function ngg_upgrade() {
8
+
9
+ global $wpdb, $user_ID, $nggRewrite;
10
+
11
+ // get the current user ID
12
+ get_currentuserinfo();
13
+
14
+ // in multisite environment the pointer $wpdb->nggpictures need to be set again
15
+ $wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
16
+ $wpdb->nggallery = $wpdb->prefix . 'ngg_gallery';
17
+ $wpdb->nggalbum = $wpdb->prefix . 'ngg_album';
18
+
19
+ // Be sure that the tables exist, avoid case sensitive : http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
20
+ if( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->nggpictures'" ) ) {
21
+
22
+ echo __('Upgrading database…', 'nggallery');
23
+ $wpdb->show_errors();
24
+
25
+ $installed_ver = get_option( 'ngg_db_version' );
26
+
27
+ // v1.8.1 -> v1.8.2
28
+ if (version_compare($installed_ver, '1.8.2', '<')) {
29
+ //get options
30
+ $ngg_options = get_option('ngg_options');
31
+
32
+ //update them
33
+ $ngg_options['CSSfile'] = NGGALLERY_ABSPATH . 'css/nggallery.css';
34
+
35
+ //save them
36
+ update_option('ngg_options', $ngg_options);
37
+ }
38
+
39
+ // update the database version
40
+ update_option( "ngg_db_version", NGG_DBVERSION );
41
+ echo '<span class="dashicons dashicons-yes"></span><br />';
42
+
43
+ // better to flush rewrite rules after upgrades
44
+ $nggRewrite->flush();
45
+ return;
46
+ }
47
+
48
+ echo __('Could not find NextCellent Gallery database tables, upgrade failed!', 'nggallery');
49
+
50
+ return;
51
+ }
52
+
53
+ /**
54
+ * nggallery_upgrade_page() - This page shows up , when the database version doesn't fit the script NGG_DBVERSION constant.
55
+ *
56
+ * @return Upgrade Message
57
+ */
58
+ function nggallery_upgrade_page() {
59
+
60
+ $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
61
+
62
+ if ( isset($_GET['upgrade']) && $_GET['upgrade'] == 'now') {
63
+ nggallery_start_upgrade($filepath);
64
+ return;
65
+ }
66
+ ?>
67
+ <div class="wrap">
68
+ <h2><?php _e('Upgrade NextCellent Gallery', 'nggallery') ;?></h2>
69
+ <p><?php _e('You\'re upgrading from an older version. To enable the newest features, we sometimes need to do a database upgrade.', 'nggallery'); ?></p>
70
+ <p class="description"><span style="margin-right:5px;" class="dashicons dashicons-info"></span><?php _e('Normally you should be able to downgrade without any problems, but if you really want to play safe, you should make a backup of your database.', 'nggallery') ;?></p>
71
+ <br /><a class="button button-primary" href="<?php echo $filepath;?>&amp;upgrade=now"><?php _e('Start upgrade now', 'nggallery'); ?></a>
72
+ </div>
73
+ <?php
74
+ }
75
+
76
+ /**
77
+ * nggallery_start_upgrade() - Proceed the upgrade routine
78
+ *
79
+ * @param mixed $filepath
80
+ * @return void
81
+ */
82
+ function nggallery_start_upgrade($filepath) {
83
+ ?>
84
+ <div class="wrap">
85
+ <h2><?php _e('Upgrade NextCellent Gallery', 'nggallery') ;?></h2>
86
+ <p><?php ngg_upgrade();?></p>
87
+ <p class="finished"><?php _e('Upgrade complete.', 'nggallery') ;?></p>
88
+ <br /><a class="finished button button-primary" href="<?php echo $filepath;?>"><?php _e('Continue to NextCellent', 'nggallery'); ?></a>
89
+ </div>
90
+ <?php
91
+ }
92
+ ?>
lib/core.php CHANGED
@@ -321,22 +321,40 @@ class nggGallery {
321
 
322
  }
323
 
324
- /**
325
- * Look for the stylesheet in the theme folder
326
- *
327
- * @return string path to stylesheet
328
- */
329
- static function get_theme_css_file() {
330
 
331
- // allow other plugins to include a custom stylesheet
332
- $stylesheet = apply_filters( 'ngg_load_stylesheet', false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
 
334
- if ( $stylesheet !== false )
335
- return ( $stylesheet );
336
- elseif ( file_exists (get_stylesheet_directory() . '/nggallery.css') )
337
- return get_stylesheet_directory_uri() . '/nggallery.css';
338
- else
339
- return false;
 
 
 
 
 
 
 
340
  }
341
 
342
  /**
321
 
322
  }
323
 
 
 
 
 
 
 
324
 
325
+ /**
326
+ * Find where is the gallery stylesheet located.
327
+ *
328
+ * Combines several techniques to find out where is the current
329
+ * gallery stylesheet located.
330
+ * 20140924: Simplification & Documentation
331
+ * 20140924: included
332
+ *
333
+ * @since 1.9.13
334
+ * @access static
335
+ *
336
+ * @see (none)
337
+ * @link Filter List http://wpgetready.com/wiki/nextcellent-plugin/nextcellent-filter-list/
338
+ * @global type $varname Short description.
339
+ *
340
+ * @param (none)
341
+ *
342
+ * @return bool|mixed|string|void
343
+ */
344
 
345
+ static function get_theme_css_file() {
346
+ //Allow to include a custom stylesheet, return stylesheet uri
347
+ $stylesheet = apply_filters( 'ngg_load_stylesheet', false );
348
+ //Is there a stylsheet customization?
349
+ if ( $stylesheet !== false ) {
350
+ return ($stylesheet); //Yes, return it
351
+ }
352
+ //No filter customization. Is the user putting a custom stylesheet on his/her theme?
353
+ if ( file_exists (get_stylesheet_directory() . '/nggallery.css') ) {
354
+ return get_stylesheet_directory_uri() . '/nggallery.css'; //Yes, return uri to the custom style
355
+ }
356
+ //No filter and no custom style. Bye bye
357
+ return false;
358
  }
359
 
360
  /**
lib/rewrite.php CHANGED
@@ -87,7 +87,9 @@ class nggRewrite {
87
 
88
  //TODO: Watch out for ticket http://trac.wordpress.org/ticket/6627
89
  if ($wp_rewrite->using_permalinks() && $this->options['usePermalinks'] ) {
90
- $post = &get_post(get_the_ID());
 
 
91
 
92
  // If the album is not set before get it from the wp_query ($_GET)
93
  if ( !isset ($args['album'] ) )
87
 
88
  //TODO: Watch out for ticket http://trac.wordpress.org/ticket/6627
89
  if ($wp_rewrite->using_permalinks() && $this->options['usePermalinks'] ) {
90
+
91
+ $gID = get_the_ID();
92
+ $post = get_post($gID);
93
 
94
  // If the album is not set before get it from the wp_query ($_GET)
95
  if ( !isset ($args['album'] ) )
nggallery.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.wpgetready.com/nextcellent-gallery
5
  Description: A Photo Gallery for WordPress providing NextGEN legacy compatibility from version 1.9.13
6
  Author: WPGReady based on Alex Rabe & PhotoCrati work.
7
  Author URI: http://www.wpgetready.com
8
- Version: 1.9.22
9
 
10
  Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
11
  Copyright (c) 2012 Photocrati Media
@@ -52,8 +52,8 @@ if (!class_exists('nggLoader')) {
52
  */
53
  class nggLoader {
54
 
55
- var $version = '1.9.22';
56
- var $dbversion = '1.8.1';
57
  var $minimum_WP = '3.5';
58
  var $options = '';
59
  var $manage_page;
@@ -413,7 +413,11 @@ if (!class_exists('nggLoader')) {
413
 
414
  function load_styles() {
415
 
416
- // check first the theme folder for a nggallery.css
 
 
 
 
417
  if ( $css_file = nggGallery::get_theme_css_file() ) {
418
  wp_enqueue_style('NextGEN', $css_file , false, '1.0.0', 'screen');
419
  } elseif ($this->options['activateCSS']) {
5
  Description: A Photo Gallery for WordPress providing NextGEN legacy compatibility from version 1.9.13
6
  Author: WPGReady based on Alex Rabe & PhotoCrati work.
7
  Author URI: http://www.wpgetready.com
8
+ Version: 1.9.23
9
 
10
  Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
11
  Copyright (c) 2012 Photocrati Media
52
  */
53
  class nggLoader {
54
 
55
+ var $version = '1.9.23';
56
+ var $dbversion = '1.8.2';
57
  var $minimum_WP = '3.5';
58
  var $options = '';
59
  var $manage_page;
413
 
414
  function load_styles() {
415
 
416
+ //Notice stylesheet selection has this priority:
417
+ //1-sytlesheet loaded from filter ngg_load_stylesheet
418
+ //2-nggalery.css on folder's current theme
419
+ //3-active stylesheet defined on styles.
420
+
421
  if ( $css_file = nggGallery::get_theme_css_file() ) {
422
  wp_enqueue_style('NextGEN', $css_file , false, '1.0.0', 'screen');
423
  } elseif ($this->options['activateCSS']) {
readme.txt CHANGED
@@ -8,21 +8,11 @@ License: GPLv2
8
 
9
  == Description ==
10
 
11
- = 1.9.22 - 22/09/2014 =
12
 
13
  What's in it for you?
14
 
15
- * Tested up to WordPress 4.0.
16
- * Javascript validation before uploading. (credits to Niko Strijbol)
17
- * Fixed issue with style tabs. (credits to Niko Strijbol)
18
- * Fix: Correction on overview.php in order to make the files translatable. (credits to Balázs Németh)
19
- * Hungarian translation added. (credits to Balázs Németh)
20
- * Additional added from previous version: improved TinyMCE window. (credits to Niko Strijbol)
21
- * Re-added missed translated files.
22
- * Rewrote the style management. (credits to Niko Strijbol)
23
- * Fixed AJAX in the TinyMCE window. (credits to Niko Strijbol)
24
- * Fixed readme.txt.
25
- * A typo was preventing the slideshow from functioning correctly when the dimensions are changed. (credits to Niko Strijbol)
26
 
27
  VERY IMPORTANT: Read ON!
28
  -----------------------
@@ -332,6 +322,9 @@ Yes, since we use Javascript rather than flash, NextCellent Gallery is compatibl
332
 
333
  == Changelog ==
334
 
 
 
 
335
  = 1.9.22 - 22/09/2014 =
336
  * Tested up to WordPress 4.0.
337
  * Javascript validation before uploading. (credits to Niko Strijbol)
8
 
9
  == Description ==
10
 
11
+ = 1.9.23 - 24/09/2014 =
12
 
13
  What's in it for you?
14
 
15
+ * Fix for missing gallery stylesheets
 
 
 
 
 
 
 
 
 
 
16
 
17
  VERY IMPORTANT: Read ON!
18
  -----------------------
322
 
323
  == Changelog ==
324
 
325
+ = 1.9.23 - 24/09/2014 =
326
+ * Fix for missing gallery stylesheets
327
+
328
  = 1.9.22 - 22/09/2014 =
329
  * Tested up to WordPress 4.0.
330
  * Javascript validation before uploading. (credits to Niko Strijbol)