* NextGen Gallery 2 support

* NextGen Gallery Pro support
This commit is contained in:
bastianonm 2013-10-18 17:28:44 +00:00
parent 8e8933658b
commit d2e558c079
4 changed files with 84 additions and 7 deletions

View File

@ -388,6 +388,40 @@ function _wpgpxmaps(params)
}); });
/*
// Nextgen Pro Lightbox FIX
var _xx = jQuery("#ngimages_" + targetId + " .nextgen_pro_lightbox");
if (_xx.length > 0)
{
var rnd1 = Math.random().toString(36).substring(7);
var rnd2 = Math.random().toString(36).substring(7);
//get first gallery without images
for (var _temp in galleries) {
var _gal = galleries[_temp];
if (_gal.source == "random_images" && _gal.wpgpxmaps != true )
{
_gal.source == "galleries";
_gal.wpgpxmaps = true;
_transient_id = _temp.replace("gallery_","")
_gal["entity_ids"] = [];
_gal["image_ids"] = [];
_gal["gallery_ids"] = [96];
for (var i=0;i<_xx.length;i++)
{
var __xx = jQuery(_xx[i]);
__xx.attr("data-nplmodal-gallery-id", _transient_id);
_gal["image_ids"].push(__xx.attr("data-image-id"));
}
break;
}
}
}
*/
if ( jQuery("#ngimages_" + targetId + " span").length > 0 ) if ( jQuery("#ngimages_" + targetId + " span").length > 0 )
{ {

View File

@ -4,8 +4,8 @@ Contributors: bastianonm
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8VHWLRW6JBTML
Tags: maps, gpx, gps, graph, chart, google maps, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence 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 Requires at least: 2.0.0
Tested up to: 3.5 Tested up to: 3.6.1
Stable tag: 1.1.46 Stable tag: 1.2.0
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map. Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -176,6 +176,9 @@ Yes!
1. Altitude & Speed & Hearth rate 1. Altitude & Speed & Hearth rate
== Changelog == == Changelog ==
= 1.2.0 =
* NextGen Gallery 2 support
* NextGen Gallery Pro support
= 1.1.46 = = 1.1.46 =
* Added meters/miles chart unit of measure * Added meters/miles chart unit of measure
* Added Russian translation, thanks to G.A.P * Added Russian translation, thanks to G.A.P

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps Plugin Name: WP-GPX-Maps
Plugin URI: http://www.devfarm.it/ Plugin URI: http://www.devfarm.it/
Description: Draws a gpx track with altitude graph Description: Draws a gpx track with altitude graph
Version: 1.1.46 Version: 1.2.0
Author: Bastianon Massimo Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/ Author URI: http://www.pedemontanadelgrappa.it/
*/ */
@ -500,6 +500,8 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
currentIcon : "'.$currentIcon.'", currentIcon : "'.$currentIcon.'",
waypointIcon : "'.$waypointIcon.'", waypointIcon : "'.$waypointIcon.'",
zoomOnScrollWheel : "'.$zoomOnScrollWheel.'", zoomOnScrollWheel : "'.$zoomOnScrollWheel.'",
ngGalleries : ['.$ngGalleries.'],
ngImages : ['.$ngImages.'],
pluginUrl : "'.plugins_url().'", pluginUrl : "'.plugins_url().'",
langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'", langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'",
currentPosition : "'.__("Current Position", "wp-gpx-maps").'", currentPosition : "'.__("Current Position", "wp-gpx-maps").'",

View File

@ -3,13 +3,20 @@
function isNGGalleryActive() { function isNGGalleryActive() {
if (!function_exists('is_plugin_active')) { if (!function_exists('is_plugin_active')) {
require_once(sitePath() . '/wp-admin/includes/plugin.php'); require_once(sitePath() . '/wp-admin/includes/plugin.php');
} }
return is_plugin_active("nextgen-gallery/nggallery.php"); return is_plugin_active("nextgen-gallery/nggallery.php");
} }
function isNGGalleryProActive() {
if (!function_exists('is_plugin_active')) {
require_once(sitePath() . '/wp-admin/includes/plugin.php');
}
return is_plugin_active("nextgen-gallery-pro/nggallery-pro.php");
}
function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error) function getNGGalleryImages($ngGalleries, $ngImages, $dt, $lat, $lon, $dtoffset, &$error)
{ {
$result = array(); $result = array();
$galids = explode(',', $ngGalleries); $galids = explode(',', $ngGalleries);
$imgids = explode(',', $ngImages); $imgids = explode(',', $ngImages);
@ -25,10 +32,12 @@
foreach ($imgids as $i) { foreach ($imgids as $i) {
array_push($pictures, nggdb::find_image($i)); array_push($pictures, nggdb::find_image($i));
} }
foreach ($pictures as $p) { foreach ($pictures as $p) {
$item = array(); $item = array();
$item["data"] = $p->thumbHTML; $item["data"] = $p->thumbHTML;
if (is_callable('exif_read_data')) if (is_callable('exif_read_data'))
{ {
$exif = @exif_read_data($p->imagePath); $exif = @exif_read_data($p->imagePath);
@ -57,7 +66,36 @@
{ {
$error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />"; $error .= "Sorry, <a href='http://php.net/manual/en/function.exif-read-data.php' target='_blank' >exif_read_data</a> function not found! check your hosting..<br />";
} }
} }
/* 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))
{
$galid = $m[1];
if ($galid)
{
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 2.x */
} catch (Exception $e) { } catch (Exception $e) {
$error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />'; $error .= 'Error When Retrieving NextGen Gallery galleries/images: $e <br />';