From 44e2616175fcf5c6b81a5de52d14acf98d577c5d Mon Sep 17 00:00:00 2001 From: bastianonm Date: Sun, 20 Oct 2013 13:42:35 +0000 Subject: [PATCH] Fix: NextGen Gallery 1.9 compatibility --- readme.txt | 4 +++- wp-gpx-maps.php | 2 +- wp-gpx-maps_utils_nggallery.php | 38 ++++++++++++++++++--------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/readme.txt b/readme.txt index 7c379cf..35fc98c 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence Requires at least: 2.0.0 Tested up to: 3.6.1 -Stable tag: 1.2.0 +Stable tag: 1.2.1 Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. @@ -176,6 +176,8 @@ Yes! 1. Altitude & Speed & Hearth rate == Changelog == += 1.2.1 = +* Fix: NextGen Gallery 1.9 compatibility = 1.2.0 = * NextGen Gallery 2 support * NextGen Gallery Pro support diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index bcde295..f3ef485 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -3,7 +3,7 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.devfarm.it/ Description: Draws a gpx track with altitude graph -Version: 1.2.0 +Version: 1.2.1 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ */ diff --git a/wp-gpx-maps_utils_nggallery.php b/wp-gpx-maps_utils_nggallery.php index b86a030..3a5c9f0 100644 --- a/wp-gpx-maps_utils_nggallery.php +++ b/wp-gpx-maps_utils_nggallery.php @@ -71,29 +71,33 @@ /* START FIX NEXT GEN GALLERY 2.x */ - $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer'); - $params['gallery_ids'] = $ngGalleries; - $params['image_ids'] = $ngImages; - $params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS; - $params['images_per_page'] = 999; - // also add js references to get the gallery working - $dummy = $renderer->display_images($params, $inner_content); - -/* START FIX NEXT GEN GALLERY PRO */ - - if (preg_match("/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m)) + if ( class_exists("C_Component_Registry") ) { - $galid = $m[1]; - if ($galid) + + $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer'); + $params['gallery_ids'] = $ngGalleries; + $params['image_ids'] = $ngImages; + $params['display_type'] = NEXTGEN_GALLERY_BASIC_THUMBNAILS; + $params['images_per_page'] = 999; + // also add js references to get the gallery working + $dummy = $renderer->display_images($params, $inner_content); + + /* START FIX NEXT GEN GALLERY PRO */ + + if (preg_match("/data-nplmodal-gallery-id=[\"'](.*?)[\"']/", $dummy, $m)) { - for($i = 0; $i < count($result); ++$i) + $galid = $m[1]; + if ($galid) { - $result[$i]["data"] = str_replace("%PRO_LIGHTBOX_GALLERY_ID%", $galid, $result[$i]["data"]); + for($i = 0; $i < count($result); ++$i) + { + $result[$i]["data"] = str_replace("%PRO_LIGHTBOX_GALLERY_ID%", $galid, $result[$i]["data"]); + } } } + + /* END FIX NEXT GEN GALLERY PRO */ } - -/* END FIX NEXT GEN GALLERY PRO */ /* END FIX NEXT GEN GALLERY 2.x */