nggFunctions

The XML Google Maps nggFunctions class.

Defined (1)

The class is defined in the following location(s).

/xmlgooglemaps_helper.php  
  1. class nggFunctions { 
  2.  
  3. function isNggInstalled() { 
  4. foreach (get_option('active_plugins') as $plugin) { 
  5. if (strpos($plugin, "nggallery.php") !== false) { 
  6. return true; 
  7. return false; 
  8.  
  9. function getNggPics($galleries, $pics) { 
  10. global $wpdb; 
  11. include_once dirname(__FILE__).'/xmlgooglemaps_exif.php'; 
  12. $ret = array(); 
  13. $pictures = array(); 
  14. foreach ($galleries as $gallery) { 
  15. $gallery = $wpdb->escape($gallery); 
  16. $pictures = array_merge($pictures, $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid=tt.galleryid WHERE t.gid = '$gallery' AND tt.exclude != 1")); 
  17.  
  18. foreach ($pics as $pic) { 
  19. $pic = $wpdb->escape($pic); 
  20. $pictures = array_merge($pictures , $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid=tt.galleryid WHERE tt.pid = '$pic' AND tt.exclude != 1")); 
  21. foreach ($pictures as $picrow) { 
  22. $item = array(); 
  23. $thumb = $this->get_thumbnail_addition($picrow->path); 
  24. $item["path"] = get_option('siteurl')."/".$picrow->path."/".$picrow->filename; 
  25. $item["abspath"] = WINABSPATH."/".$picrow->path."/".$picrow->filename; 
  26. $item["thumbpath"] = get_option('siteurl')."/".$picrow->path.$thumb.$picrow->filename; 
  27. $item["description"] = html_entity_decode(stripslashes($picrow->description)); 
  28. $item["title"] = html_entity_decode(stripslashes($picrow->alttext)); 
  29. $item["galtitle"] = $picrow->title; 
  30. $item["galdescription"] = html_entity_decode(stripslashes($picrow->galdesc)); 
  31. $exif = new exif($item["abspath"]); 
  32. if ($exif->isValid) { 
  33. $item["gpslat"] = $exif->getGPSLatitude(); 
  34. $item["gpslon"] = $exif->getGPSLongitude(); 
  35. $item["creation"] = $exif->getCreationDateTime(); 
  36. if (($item["gpslat"] != 0) || ($item["gpslon"] != 0)) { 
  37. $ret[] = $item; 
  38. return $ret; 
  39.  
  40. function get_thumbnail_addition($gallerypath) { 
  41. $gallerypath = WINABSPATH.$gallerypath; 
  42.  
  43. if (!file_exists($gallerypath)) 
  44. return FALSE; 
  45.  
  46. if (is_dir($gallerypath."/thumbs")) { 
  47. $thumbFolder = "/thumbs/"; 
  48. $thumbPrefix = "thumbs_"; 
  49. return $thumbFolder.$thumbPrefix; 
  50. // old mygallery check 
  51. if (is_dir($gallerypath."/tumbs")) { 
  52. $thumbFolder = "/tumbs/"; 
  53. $thumbPrefix = "tmb_"; 
  54. return $thumbFolder.$thumbPrefix; 
  55.  
  56. if (is_admin()) { 
  57. if (!is_dir($gallerypath."/thumbs")) { 
  58. if ( !wp_mkdir_p($gallerypath."/thumbs") ) 
  59. return ""; 
  60. $thumbFolder = "/thumbs/"; 
  61. $thumbPrefix = "thumbs_"; 
  62. return $thumbFolder.$thumbPrefix; 
  63. return "";