NextGEN Gallery – WordPress Gallery Plugin - Version 2.0.40

Version Description

  • 11.26.2013 =
  • NEW: Added the ability to apply lightbox effects to non-NGG images
  • NEW: Added NGG_HIDE_STRICT_ERRORS constant. Define and set to TRUE to hide strict errors
  • NEW: Added NEXTGEN_GALLERY_IMPORT_ROOT constant. Define and set to TRUE to browse from a custom directory
  • NEW: Added NGG_DEBUG constant. Define and set to TRUE to display helpful messages for debugging
  • NEW: Each custom table record will have an associated custom post record for expansion
  • NEW: Display helpful error messages when there's a problem uploading images
  • NEW: Add data-(src|thumbnail|image-id|title|description) attribute to gallery image anchors
  • NEW: Variant support for displayed gallery sources. Random images is limited to 5 variations
  • Fixed: Excessive creation of transients for random galleries
  • Fixed: Many issues prohibiting the ability to upload images
  • Fixed: Compatibility with NextGEN Gallery Export Plugin for Adobe Lightroom (thanks Vladimir!)
  • Fixed: Sorting in the Attach to Post interface
  • Fixed: HTML allowed in gallery/album descriptions
  • Fixed: Requests for galleries within albums that have numeric names are broken
  • Fixed: Call to a non-member function get() on WP_Query
  • Fixed: Ability to sort by Image ID in the Attach to Post interface
  • Fixed: Isolate the Attach to Post from implicit third-party script inclusion
  • Fixed: Check for the existance of thumbnails when generating urls, and if missing, generate new ones
  • Fixed: Compatibility with NextGEN Facebook OpenGraph+ plugin
  • Fixed: Various XML-RPC issues
  • Fixed: Widgets stylesheet not included
  • Fixed: Issue with color not being pre-selected when previewing Watermark
  • Fixed: E_NOTICE emitted when cleaning up cached image files
  • Fixed: E_NOTICE emitted when viewing display type settings
  • Fixed: Typo adjusting pcre.backtrack_limit for shortcodes
  • Fixed: Content within the tabs of the Attach to Post interface cut-off
  • Fixed: Routing problem which would cause conflicts with different display types on the same page
  • Fixed: Broken Dynamic CSS links on GoDaddy
  • Fixed: Ability to use HTML in gallery/album descriptions
  • Fixed: Sub-album requests conflicting with paginated galleries on the same page
  • Merged: Pull request from andreasE (https://bitbucket.org/photocrati/nextgen-gallery/pull-request/6/)
Download this release

Release Info

Developer photocrati
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 2.0.40
Comparing to
See all releases

Code changes from version 2.0.33 to 2.0.40

Files changed (162) hide show
  1. changelog.txt +33 -0
  2. nggallery.php +109 -9
  3. non_pope/class.nextgen_style_manager.php +4 -2
  4. pope/lib/class.base_module.php +1 -1
  5. pope/lib/class.base_product.php +2 -2
  6. pope/lib/class.component_factory.php +2 -2
  7. pope/lib/class.extensibleobject.php +42 -4
  8. products/photocrati_nextgen/modules/ajax/class.ajax_controller.php +3 -1
  9. products/photocrati_nextgen/modules/ajax/module.ajax.php +3 -3
  10. products/photocrati_nextgen/modules/attach_to_post/adapter.attach_to_post_ajax.php +3 -3
  11. products/photocrati_nextgen/modules/attach_to_post/adapter.gallery_storage_frame_event.php +14 -6
  12. products/photocrati_nextgen/modules/attach_to_post/class.attach_controller.php +81 -4
  13. products/photocrati_nextgen/modules/attach_to_post/mixin.attach_to_post_display_tab.php +3 -1
  14. products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php +8 -7
  15. products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.js +19 -21
  16. products/photocrati_nextgen/modules/attach_to_post/static/iframely.js +44 -14
  17. products/photocrati_nextgen/modules/attach_to_post/templates/display_tab_js.php +21 -1
  18. products/photocrati_nextgen/modules/cache/class.cache.php +2 -2
  19. products/photocrati_nextgen/modules/cache/module.cache.php +1 -1
  20. products/photocrati_nextgen/modules/datamapper/class.custompost_datamapper_driver.php +11 -11
  21. products/photocrati_nextgen/modules/datamapper/class.customtable_datamapper_driver.php +45 -56
  22. products/photocrati_nextgen/modules/datamapper/class.datamapper_driver_base.php +117 -8
  23. products/photocrati_nextgen/modules/datamapper/class.datamapper_model.php +8 -10
  24. products/photocrati_nextgen/modules/datamapper/module.datamapper.php +2 -1
  25. products/photocrati_nextgen/modules/dynamic_stylesheet/class.dynamic_stylesheet_controller.php +1 -1
  26. products/photocrati_nextgen/modules/dynamic_thumbnails/adapter.dynamic_thumbnails_storage_driver.php +9 -2
  27. products/photocrati_nextgen/modules/dynamic_thumbnails/module.dynamic_thumbnails.php +1 -1
  28. products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php +1 -1
  29. products/photocrati_nextgen/modules/fs/class.fs.php +2 -2
  30. products/photocrati_nextgen/modules/lightbox/adapter.lightbox_factory.php +4 -4
  31. products/photocrati_nextgen/modules/lightbox/class.lightbox_library.php +12 -1
  32. products/photocrati_nextgen/modules/lightbox/module.lightbox.php +149 -1
  33. products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js +3 -1
  34. products/photocrati_nextgen/modules/lightbox/static/highslide/nextgen_highslide_init.js +29 -21
  35. products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/nextgen_lightbox_init.js +3 -1
  36. products/photocrati_nextgen/modules/lightbox/static/lightbox_context.js +27 -0
  37. products/photocrati_nextgen/modules/lightbox/static/shutter/nextgen_shutter.js +3 -0
  38. products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.js +4 -1
  39. products/photocrati_nextgen/modules/lightbox/static/thickbox/nextgen_thickbox_init.js +5 -0
  40. products/photocrati_nextgen/modules/mediarss/class.mediarss_controller.php +2 -2
  41. products/photocrati_nextgen/modules/mediarss/module.mediarss.php +1 -1
  42. products/photocrati_nextgen/modules/mediarss/templates/mediarss_feed.php +6 -6
  43. products/photocrati_nextgen/modules/mediarss/templates/playlist_feed.php +3 -3
  44. products/photocrati_nextgen/modules/mvc/template_helper.php +14 -1
  45. products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php +21 -17
  46. products/photocrati_nextgen/modules/nextgen_addgallery_page/module.nextgen_addgallery_page.php +1 -1
  47. products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_folder.php +2 -3
  48. products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php +45 -23
  49. products/photocrati_nextgen/modules/nextgen_admin/class.form.php +18 -14
  50. products/photocrati_nextgen/modules/nextgen_admin/class.nextgen_admin_page_controller.php +11 -0
  51. products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php +2 -2
  52. products/photocrati_nextgen/modules/nextgen_admin/templates/field_generator/nextgen_settings_field_color.php +1 -2
  53. products/photocrati_nextgen/modules/nextgen_admin/templates/nextgen_admin_page.php +1 -1
  54. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_controller.php +18 -11
  55. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_mapper.php +1 -1
  56. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_routes.php +10 -9
  57. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_compact_album_form.php +4 -0
  58. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_extended_album_form.php +4 -0
  59. products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php +20 -16
  60. products/photocrati_nextgen/modules/nextgen_basic_album/static/nextgen_basic_album.css +37 -12
  61. products/photocrati_nextgen/modules/nextgen_basic_album/templates/compact.php +13 -6
  62. products/photocrati_nextgen/modules/nextgen_basic_album/templates/extended.php +3 -3
  63. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.ajax_pagination_actions.php +1 -5
  64. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_mapper.php +7 -5
  65. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_routes.php +7 -7
  66. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_controller.php +1 -1
  67. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_form.php +4 -0
  68. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnail_form.php +4 -0
  69. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnails_controller.php +6 -6
  70. products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php +21 -17
  71. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/ajax_pagination.js +5 -1
  72. products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/slideshow/index.php +2 -2
  73. products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php +8 -4
  74. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_mapper.php +1 -1
  75. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_routes.php +2 -2
  76. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/hook.nextgen_basic_imagebrowser_alt_urls.php +1 -1
  77. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php +14 -13
  78. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/templates/nextgen_basic_imagebrowser.php +7 -3
  79. products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php +1 -1
  80. products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_mapper.php +1 -1
  81. products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php +14 -13
  82. products/photocrati_nextgen/modules/nextgen_basic_singlepic/templates/nextgen_basic_singlepic.php +7 -3
  83. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_form.php +1 -0
  84. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_mapper.php +1 -1
  85. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_routes.php +2 -2
  86. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/class.taxonomy_controller.php +11 -1
  87. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php +16 -14
  88. products/photocrati_nextgen/modules/nextgen_basic_templates/adapter.nextgen_basic_template_form.php +4 -0
  89. products/photocrati_nextgen/modules/nextgen_basic_templates/class.legacy_template_locator.php +1 -1
  90. products/photocrati_nextgen/modules/nextgen_data/adapter.nextgen_data_factory.php +10 -5
  91. products/photocrati_nextgen/modules/nextgen_data/class.album.php +10 -9
  92. products/photocrati_nextgen/modules/nextgen_data/class.album_mapper.php +21 -48
  93. products/photocrati_nextgen/modules/nextgen_data/class.gallery.php +9 -7
  94. products/photocrati_nextgen/modules/nextgen_data/class.gallery_mapper.php +15 -22
  95. products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php +46 -25
  96. products/photocrati_nextgen/modules/nextgen_data/class.image.php +3 -2
  97. products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.php +25 -41
  98. products/photocrati_nextgen/modules/nextgen_data/class.image_wrapper.php +14 -3
  99. products/photocrati_nextgen/modules/nextgen_data/class.nextgen_data_installer.php +5 -1
  100. products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php +30 -19
  101. products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_thumbnail.php +2 -2
  102. products/photocrati_nextgen/modules/nextgen_data/mixin.nextgen_table_extras.php +195 -0
  103. products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php +20 -1
  104. products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.gallery_display_factory.php +6 -6
  105. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type.php +2 -2
  106. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_controller.php +7 -3
  107. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_mapper.php +3 -3
  108. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php +52 -37
  109. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_mapper.php +2 -2
  110. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_renderer.php +72 -39
  111. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_source.php +2 -2
  112. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_source_mapper.php +4 -2
  113. products/photocrati_nextgen/modules/nextgen_gallery_display/class.gallery_display_installer.php +3 -1
  114. products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php +53 -6
  115. products/photocrati_nextgen/modules/nextgen_other_options/adapter.lightbox_manager_form.php +7 -1
  116. products/photocrati_nextgen/modules/nextgen_other_options/adapter.miscellaneous_form.php +1 -0
  117. products/photocrati_nextgen/modules/nextgen_other_options/module.nextgen_other_options.php +1 -1
  118. products/photocrati_nextgen/modules/nextgen_other_options/templates/lightbox_library_tab.php +20 -2
  119. products/photocrati_nextgen/modules/nextgen_pagination/mixin.nextgen_basic_pagination.php +19 -1
  120. products/photocrati_nextgen/modules/nextgen_settings/class.nextgen_settings_installer.php +1 -0
  121. products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php +1 -1
  122. products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php +108 -78
  123. products/photocrati_nextgen/modules/ngglegacy/admin/album.php +78 -69
  124. products/photocrati_nextgen/modules/ngglegacy/admin/edit-thumbnail.php +3 -3
  125. products/photocrati_nextgen/modules/ngglegacy/admin/functions.php +1 -1
  126. products/photocrati_nextgen/modules/ngglegacy/admin/install.php +8 -53
  127. products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js +2 -2
  128. products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php +4 -4
  129. products/photocrati_nextgen/modules/ngglegacy/admin/manage-sort.php +3 -3
  130. products/photocrati_nextgen/modules/ngglegacy/admin/manage.php +15 -5
  131. products/photocrati_nextgen/modules/ngglegacy/admin/media-upload.php +1 -1
  132. products/photocrati_nextgen/modules/ngglegacy/admin/overview.php +8 -7
  133. products/photocrati_nextgen/modules/ngglegacy/admin/rotate.php +1 -1
  134. products/photocrati_nextgen/modules/ngglegacy/class.ngglegacy_installer.php +91 -1
  135. products/photocrati_nextgen/modules/ngglegacy/lib/media-rss.php +2 -2
  136. products/photocrati_nextgen/modules/ngglegacy/lib/ngg-db.php +3 -3
  137. products/photocrati_nextgen/modules/ngglegacy/lib/post-thumbnail.php +2 -2
  138. products/photocrati_nextgen/modules/ngglegacy/lib/shortcodes.php +1 -1
  139. products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php +1 -1
  140. products/photocrati_nextgen/modules/ngglegacy/nggallery.php +3 -97
  141. products/photocrati_nextgen/modules/ngglegacy/view/album-compact.php +15 -3
  142. products/photocrati_nextgen/modules/ngglegacy/view/album-extend.php +3 -3
  143. products/photocrati_nextgen/modules/ngglegacy/view/gallery-caption.php +11 -4
  144. products/photocrati_nextgen/modules/ngglegacy/view/gallery-carousel.php +7 -7
  145. products/photocrati_nextgen/modules/ngglegacy/view/gallery.php +11 -4
  146. products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser-caption.php +3 -3
  147. products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser-exif.php +2 -2
  148. products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser.php +4 -4
  149. products/photocrati_nextgen/modules/ngglegacy/view/singlepic.php +11 -6
  150. products/photocrati_nextgen/modules/router/class.routing_app.php +14 -9
  151. products/photocrati_nextgen/modules/security/class.wordpress_security_manager.php +13 -0
  152. products/photocrati_nextgen/modules/security/module.security.php +5 -1
  153. products/photocrati_nextgen/modules/widget/class.widget.php +0 -6
  154. products/photocrati_nextgen/modules/widget/class.widget_gallery.php +38 -60
  155. products/photocrati_nextgen/modules/widget/class.widget_slideshow.php +7 -2
  156. products/photocrati_nextgen/modules/widget/module.widget.php +1 -1
  157. products/photocrati_nextgen/modules/widget/templates/display_gallery.php +2 -2
  158. products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php +17 -17
  159. products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_routing_app.php +17 -3
  160. products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php +1 -1
  161. products/photocrati_nextgen/product.photocrati_nextgen.php +8 -8
  162. readme.txt +36 -3
changelog.txt CHANGED
@@ -1,6 +1,39 @@
1
  NextGEN Gallery
2
  by Photocrati Media
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  = V2.0.33 - 10.21.2013 =
5
  * NEW: Requests /ngg_tag/[tagname] will create a displayed gallery
6
  * NEW: Option added to "Import Gallery" tab to use original images
1
  NextGEN Gallery
2
  by Photocrati Media
3
 
4
+ = V2.0.40 - 11.26.2013 =
5
+ * NEW: Added the ability to apply lightbox effects to non-NGG images
6
+ * NEW: Added NGG_HIDE_STRICT_ERRORS constant. Define and set to TRUE to hide strict errors
7
+ * NEW: Added NEXTGEN_GALLERY_IMPORT_ROOT constant. Define and set to TRUE to browse from a custom directory
8
+ * NEW: Added NGG_DEBUG constant. Define and set to TRUE to display helpful messages for debugging
9
+ * NEW: Each custom table record will have an associated custom post record for expansion
10
+ * NEW: Display helpful error messages when there's a problem uploading images
11
+ * NEW: Add data-(src|thumbnail|image-id|title|description) attribute to gallery image anchors
12
+ * NEW: Variant support for displayed gallery sources. Random images is limited to 5 variations
13
+ * Fixed: Excessive creation of transients for random galleries
14
+ * Fixed: Many issues prohibiting the ability to upload images
15
+ * Fixed: Compatibility with NextGEN Gallery Export Plugin for Adobe Lightroom (thanks Vladimir!)
16
+ * Fixed: Sorting in the Attach to Post interface
17
+ * Fixed: HTML allowed in gallery/album descriptions
18
+ * Fixed: Requests for galleries within albums that have numeric names are broken
19
+ * Fixed: Call to a non-member function get() on WP_Query
20
+ * Fixed: Ability to sort by Image ID in the Attach to Post interface
21
+ * Fixed: Isolate the Attach to Post from implicit third-party script inclusion
22
+ * Fixed: Check for the existance of thumbnails when generating urls, and if missing, generate new ones
23
+ * Fixed: Compatibility with NextGEN Facebook OpenGraph+ plugin
24
+ * Fixed: Various XML-RPC issues
25
+ * Fixed: Widgets stylesheet not included
26
+ * Fixed: Issue with color not being pre-selected when previewing Watermark
27
+ * Fixed: E_NOTICE emitted when cleaning up cached image files
28
+ * Fixed: E_NOTICE emitted when viewing display type settings
29
+ * Fixed: Typo adjusting pcre.backtrack_limit for shortcodes
30
+ * Fixed: Content within the tabs of the Attach to Post interface cut-off
31
+ * Fixed: Routing problem which would cause conflicts with different display types on the same page
32
+ * Fixed: Broken Dynamic CSS links on GoDaddy
33
+ * Fixed: Ability to use HTML in gallery/album descriptions
34
+ * Fixed: Sub-album requests conflicting with paginated galleries on the same page
35
+ * Merged: Pull request from andreasE (https://bitbucket.org/photocrati/nextgen-gallery/pull-request/6/)
36
+
37
  = V2.0.33 - 10.21.2013 =
38
  * NEW: Requests /ngg_tag/[tagname] will create a displayed gallery
39
  * NEW: Option added to "Import Gallery" tab to use original images
nggallery.php CHANGED
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
4
  /**
5
  * Plugin Name: NextGEN Gallery by Photocrati
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 7 million downloads.
7
- * Version: 2.0.33
8
  * Author: Photocrati Media
9
  * Plugin URI: http://www.nextgen-gallery.com
10
  * Author URI: http://www.photocrati.com
@@ -12,6 +12,49 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
12
  */
13
 
14
  if (!class_exists('E_Clean_Exit')) { class E_Clean_Exit extends RuntimeException {} }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  /**
17
  * NextGEN Gallery is built on top of the Photocrati Pope Framework:
@@ -33,7 +76,7 @@ class C_NextGEN_Bootstrap
33
  var $_registry = NULL;
34
  var $_settings_option_name = 'ngg_options';
35
  var $_pope_loaded = FALSE;
36
- static $debug = WP_DEBUG;
37
 
38
  static function shutdown($exception=NULL)
39
  {
@@ -52,7 +95,7 @@ class C_NextGEN_Bootstrap
52
  $klass = get_class($exception);
53
  echo "<h1>{$klass} thrown</h1>";
54
  echo "<p>{$exception->getMessage()}</p>";
55
- if (self::$debug OR (defined('NEXTGEN_GALLERY_DEBUG') AND NEXTGEN_GALLERY_DEBUG == TRUE)) {
56
  echo "<h3>Where:</h3>";
57
  echo "<p>On line <strong>{$exception->getLine()}</strong> of <strong>{$exception->getFile()}</strong></p>";
58
  echo "<h3>Trace:</h3>";
@@ -65,6 +108,31 @@ class C_NextGEN_Bootstrap
65
  }
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  function __construct()
69
  {
70
  // Boostrap
@@ -83,11 +151,12 @@ class C_NextGEN_Bootstrap
83
  include_once('non_pope/class.photocrati_cache.php');
84
  C_Photocrati_Cache::get_instance();
85
  C_Photocrati_Cache::get_instance('displayed_galleries');
86
- C_Photocrati_Cache::$enabled = TRUE;
 
87
 
88
  if (isset($_REQUEST['ngg_flush'])) {
89
  C_Photocrati_Cache::flush('all');
90
- $_SERVER['QUERY_STRING'] = str_replace('ngg_flush=1', '', $_SERVER['QUERY_STRING']);
91
  }
92
  elseif (isset($_REQUEST['ngg_force_update'])) {
93
  C_Photocrati_Cache::$do_not_lookup = TRUE;
@@ -96,7 +165,7 @@ class C_NextGEN_Bootstrap
96
  }
97
  elseif (isset($_REQUEST['ngg_flush_expired'])) {
98
  C_Photocrati_Cache::flush('all', TRUE);
99
- $_SERVER['QUERY_STRING'] = str_replace('ngg_flush_expired=1', '', $_SERVER['QUERY_STRING']);
100
  }
101
 
102
  // Load Settings Manager
@@ -204,10 +273,10 @@ class C_NextGEN_Bootstrap
204
  }
205
 
206
  // Update modules
207
- add_action('init', array(&$this, 'update'), PHP_INT_MAX);
208
 
209
  // Start the plugin!
210
- add_action('init', array(&$this, 'route'), PHP_INT_MAX);
211
  }
212
 
213
  function delete_expired_transients()
@@ -333,7 +402,38 @@ class C_NextGEN_Bootstrap
333
  define('NEXTGEN_GALLERY_MODULE_URL', path_join(NEXTGEN_GALLERY_PRODUCT_URL, 'photocrati_nextgen/modules'));
334
  define('NEXTGEN_GALLERY_PLUGIN_CLASS', path_join(NEXTGEN_GALLERY_PLUGIN_DIR, 'module.NEXTGEN_GALLERY_PLUGIN.php'));
335
  define('NEXTGEN_GALLERY_PLUGIN_STARTED_AT', microtime());
336
- define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.33');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  }
338
 
339
 
4
  /**
5
  * Plugin Name: NextGEN Gallery by Photocrati
6
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 7 million downloads.
7
+ * Version: 2.0.40
8
  * Author: Photocrati Media
9
  * Plugin URI: http://www.nextgen-gallery.com
10
  * Author URI: http://www.photocrati.com
12
  */
13
 
14
  if (!class_exists('E_Clean_Exit')) { class E_Clean_Exit extends RuntimeException {} }
15
+ if (!class_exists('E_NggErrorException')) { class E_NggErrorException extends RuntimeException {} }
16
+
17
+ // This is a temporary function to replace the use of WP's esc_url which strips spaces away from URLs
18
+ if (!function_exists('nextgen_esc_url')) {
19
+ function nextgen_esc_url( $url, $protocols = null, $_context = 'display' ) {
20
+ $original_url = $url;
21
+
22
+ if ( '' == $url )
23
+ return $url;
24
+ $url = preg_replace('|[^a-z0-9 \\-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
25
+ $strip = array('%0d', '%0a', '%0D', '%0A');
26
+ $url = _deep_replace($strip, $url);
27
+ $url = str_replace(';//', '://', $url);
28
+ /* If the URL doesn't appear to contain a scheme, we
29
+ * presume it needs http:// appended (unless a relative
30
+ * link starting with /, # or ? or a php file).
31
+ */
32
+
33
+ if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
34
+ ! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
35
+ $url = 'http://' . $url;
36
+
37
+ // Replace ampersands and single quotes only when displaying.
38
+ if ( 'display' == $_context ) {
39
+ $url = wp_kses_normalize_entities( $url );
40
+ $url = str_replace( ' ', '%20', $url );
41
+ $url = str_replace( '&amp;', '&#038;', $url );
42
+ $url = str_replace( "'", '&#039;', $url );
43
+ }
44
+
45
+ if ( '/' === $url[0] ) {
46
+ $good_protocol_url = $url;
47
+ } else {
48
+ if ( ! is_array( $protocols ) )
49
+ $protocols = wp_allowed_protocols();
50
+ $good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
51
+ if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
52
+ return '';
53
+ }
54
+
55
+ return apply_filters('clean_url', $good_protocol_url, $original_url, $_context);
56
+ }
57
+ }
58
 
59
  /**
60
  * NextGEN Gallery is built on top of the Photocrati Pope Framework:
76
  var $_registry = NULL;
77
  var $_settings_option_name = 'ngg_options';
78
  var $_pope_loaded = FALSE;
79
+ static $debug = FALSE;
80
 
81
  static function shutdown($exception=NULL)
82
  {
95
  $klass = get_class($exception);
96
  echo "<h1>{$klass} thrown</h1>";
97
  echo "<p>{$exception->getMessage()}</p>";
98
+ if (self::$debug OR (defined('NGG_DEBUG') AND NGG_DEBUG == TRUE)) {
99
  echo "<h3>Where:</h3>";
100
  echo "<p>On line <strong>{$exception->getLine()}</strong> of <strong>{$exception->getFile()}</strong></p>";
101
  echo "<h3>Trace:</h3>";
108
  }
109
  }
110
 
111
+ static function get_backtrace($objects=FALSE, $remove_dynamic_calls=TRUE)
112
+ {
113
+ $trace = debug_backtrace($objects);
114
+ if ($remove_dynamic_calls) {
115
+ $skip_methods = array(
116
+ '_exec_cached_method',
117
+ '__call',
118
+ 'get_method_property',
119
+ 'set_method_property',
120
+ 'call_method'
121
+ );
122
+ foreach ($trace as $key => &$value) {
123
+ if (isset($value['class']) && isset($value['function'])) {
124
+ if ($value['class'] == 'ReflectionMethod' && $value['function'] == 'invokeArgs')
125
+ unset($trace[$key]);
126
+
127
+ else if ($value['class'] == 'ExtensibleObject' && in_array($value['function'], $skip_methods))
128
+ unset($trace[$key]);
129
+ }
130
+ }
131
+ }
132
+
133
+ return $trace;
134
+ }
135
+
136
  function __construct()
137
  {
138
  // Boostrap
151
  include_once('non_pope/class.photocrati_cache.php');
152
  C_Photocrati_Cache::get_instance();
153
  C_Photocrati_Cache::get_instance('displayed_galleries');
154
+ C_Photocrati_Cache::get_instance('displayed_gallery_rendering');
155
+ C_Photocrati_Cache::$enabled = PHOTOCRATI_CACHE;
156
 
157
  if (isset($_REQUEST['ngg_flush'])) {
158
  C_Photocrati_Cache::flush('all');
159
+ die("Flushed all caches");
160
  }
161
  elseif (isset($_REQUEST['ngg_force_update'])) {
162
  C_Photocrati_Cache::$do_not_lookup = TRUE;
165
  }
166
  elseif (isset($_REQUEST['ngg_flush_expired'])) {
167
  C_Photocrati_Cache::flush('all', TRUE);
168
+ die("Flushed all expired items from the cache");
169
  }
170
 
171
  // Load Settings Manager
273
  }
274
 
275
  // Update modules
276
+ add_action('init', array(&$this, 'update'), PHP_INT_MAX-1);
277
 
278
  // Start the plugin!
279
+ add_action('init', array(&$this, 'route'), 11);
280
  }
281
 
282
  function delete_expired_transients()
402
  define('NEXTGEN_GALLERY_MODULE_URL', path_join(NEXTGEN_GALLERY_PRODUCT_URL, 'photocrati_nextgen/modules'));
403
  define('NEXTGEN_GALLERY_PLUGIN_CLASS', path_join(NEXTGEN_GALLERY_PLUGIN_DIR, 'module.NEXTGEN_GALLERY_PLUGIN.php'));
404
  define('NEXTGEN_GALLERY_PLUGIN_STARTED_AT', microtime());
405
+ define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.40');
406
+
407
+ if (!defined('NGG_HIDE_STRICT_ERRORS')) {
408
+ define('NGG_HIDE_STRICT_ERRORS', TRUE);
409
+ }
410
+
411
+ // Should we display E_STRICT errors?
412
+ if (NGG_HIDE_STRICT_ERRORS) {
413
+ $level = error_reporting();
414
+ if ($level != 0) error_reporting($level & ~E_STRICT);
415
+ }
416
+
417
+ // Should we display NGG debugging information?
418
+ if (!defined('NGG_DEBUG')) {
419
+ define('NGG_DEBUG', FALSE);
420
+ }
421
+ self::$debug = NGG_DEBUG;
422
+
423
+ // User definable constants
424
+ if (!defined('NEXTGEN_GALLERY_IMPORT_ROOT')) {
425
+ $path = WP_CONTENT_DIR;
426
+ if (is_multisite()) {
427
+ $uploads = wp_upload_dir();
428
+ $path = $uploads['path'];
429
+ }
430
+ define('NEXTGEN_GALLERY_IMPORT_ROOT', $path);
431
+ }
432
+
433
+ // Should the Photocrati cache be enabled
434
+ if (!defined('PHOTOCRATI_CACHE')) {
435
+ define('PHOTOCRATI_CACHE', TRUE);
436
+ }
437
  }
438
 
439
 
non_pope/class.nextgen_style_manager.php CHANGED
@@ -202,11 +202,13 @@ class C_NextGen_Style_Manager
202
  }
203
 
204
 
205
- function find_all_stylesheets()
206
  {
207
  $retval = array();
 
 
208
 
209
- foreach (array_reverse($this->directories) as $dir) {
210
  $path = implode(DIRECTORY_SEPARATOR, array(
211
  untrailingslashit($dir),
212
  '*.css'
202
  }
203
 
204
 
205
+ function find_all_stylesheets($dir = FALSE)
206
  {
207
  $retval = array();
208
+ if (!$dir)
209
+ $dir = $this->directories;
210
 
211
+ foreach (array_reverse($dir) as $dir) {
212
  $path = implode(DIRECTORY_SEPARATOR, array(
213
  untrailingslashit($dir),
214
  '*.css'
pope/lib/class.base_module.php CHANGED
@@ -33,7 +33,7 @@ abstract class C_Base_Module extends C_Component
33
  /**
34
  * Defines the module
35
  */
36
- function define($id, $name, $description='', $version='', $uri='', $author='', $author_uri='', $context=FALSE)
37
  {
38
  parent::define($context);
39
  $this->implement('I_Pope_Module');
33
  /**
34
  * Defines the module
35
  */
36
+ function define($id='pope-module', $name='Pope Module', $description='', $version='', $uri='', $author='', $author_uri='', $context=FALSE)
37
  {
38
  parent::define($context);
39
  $this->implement('I_Pope_Module');
pope/lib/class.base_product.php CHANGED
@@ -12,9 +12,9 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
12
  */
13
  abstract class C_Base_Product extends C_Base_Module
14
  {
15
- function define($id, $name, $description='', $version='', $uri='', $author='', $author_uri='')
16
  {
17
- parent::define($id, $name, $description, $version, $uri, $author, $author_uri);
18
 
19
  $this->get_registry()->add_product($this->module_id, $this);
20
  }
12
  */
13
  abstract class C_Base_Product extends C_Base_Module
14
  {
15
+ function define($id='pope-product', $name='Pope Product', $description='', $version='', $uri='', $author='', $author_uri='', $context=FALSE)
16
  {
17
+ parent::define($id, $name, $description, $version, $uri, $author, $author_uri, $context);
18
 
19
  $this->get_registry()->add_product($this->module_id, $this);
20
  }
pope/lib/class.component_factory.php CHANGED
@@ -7,9 +7,9 @@ class C_Component_Factory extends C_Component
7
  {
8
  static $_instances = array();
9
 
10
- function define()
11
  {
12
- parent::define();
13
  $this->implement('I_Component_Factory');
14
  }
15
 
7
  {
8
  static $_instances = array();
9
 
10
+ function define($context=FALSE)
11
  {
12
+ parent::define($context);
13
  $this->implement('I_Component_Factory');
14
  }
15
 
pope/lib/class.extensibleobject.php CHANGED
@@ -750,7 +750,7 @@ class ExtensibleObject extends PopeHelpers
750
  */
751
  function __call($method, $args)
752
  {
753
- $this->clear_method_properties($method, $args);
754
 
755
  // Run pre hooks?
756
  if ($this->are_pre_hooks_enabled($method) && $this->get_method_property($method, self::METHOD_PROPERTY_RUN_PRE_HOOKS)) {
@@ -833,7 +833,10 @@ class ExtensibleObject extends PopeHelpers
833
  }
834
  }
835
 
836
- return $this->get_method_property($method, self::METHOD_PROPERTY_RETURN_VALUE);
 
 
 
837
  }
838
 
839
 
@@ -1181,7 +1184,7 @@ class ExtensibleObject extends PopeHelpers
1181
  * before every method call (before pre-hooks)
1182
  * @param string $method
1183
  */
1184
- function clear_method_properties($method, $args=array())
1185
  {
1186
  $this->_method_properties[$method] = array(
1187
  'run' => TRUE,
@@ -1191,6 +1194,35 @@ class ExtensibleObject extends PopeHelpers
1191
  );
1192
  }
1193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194
 
1195
  /**
1196
  * Returns TRUE if the ExtensibleObject has decided to implement a
@@ -1291,6 +1323,9 @@ class Mixin extends PopeHelpers
1291
  $backtrace = debug_backtrace();
1292
  $klass = get_class($backtrace[0]['object']);
1293
 
 
 
 
1294
  // Perform the routine described above...
1295
  $this->object->disable_pre_hooks($method);
1296
  $this->object->disable_post_hooks($method);
@@ -1308,6 +1343,9 @@ class Mixin extends PopeHelpers
1308
  $this->object->enable_post_hooks($method);
1309
  $this->object->enable_mixin($method, $klass);
1310
 
 
 
 
1311
  return $retval;
1312
  }
1313
 
@@ -1366,7 +1404,7 @@ class Hook extends Mixin
1366
  * Provides an alias for call_anchor, as there's no parent
1367
  * to call in the context of a hook.
1368
  */
1369
- function call_parent()
1370
  {
1371
  $args = func_get_args();
1372
  return call_user_func_array(
750
  */
751
  function __call($method, $args)
752
  {
753
+ $this->reset_method_properties($method, $args);
754
 
755
  // Run pre hooks?
756
  if ($this->are_pre_hooks_enabled($method) && $this->get_method_property($method, self::METHOD_PROPERTY_RUN_PRE_HOOKS)) {
833
  }
834
  }
835
 
836
+ // Get return value, clear all method properties, and then return
837
+ $retval = $this->get_method_property($method, self::METHOD_PROPERTY_RETURN_VALUE);
838
+ $this->remove_method_properties($method);
839
+ return $retval;
840
  }
841
 
842
 
1184
  * before every method call (before pre-hooks)
1185
  * @param string $method
1186
  */
1187
+ function reset_method_properties($method, $args=array())
1188
  {
1189
  $this->_method_properties[$method] = array(
1190
  'run' => TRUE,
1194
  );
1195
  }
1196
 
1197
+ /**
1198
+ * Removes the cache of the method properties
1199
+ * @param $method
1200
+ */
1201
+ function remove_method_properties($method)
1202
+ {
1203
+ unset($this->_method_properties[$method]);
1204
+ }
1205
+
1206
+ /**
1207
+ * Gets all method properties
1208
+ * @return array
1209
+ */
1210
+ function get_method_properties($method)
1211
+ {
1212
+ return $this->_method_properties[$method];
1213
+ }
1214
+
1215
+ /**
1216
+ * Sets all method properties
1217
+ * @param $method
1218
+ * @param $props
1219
+ */
1220
+ function set_method_properties($method, $props)
1221
+ {
1222
+ foreach ($props as $key => $value) {
1223
+ $this->set_method_property($method, $key, $value);
1224
+ }
1225
+ }
1226
 
1227
  /**
1228
  * Returns TRUE if the ExtensibleObject has decided to implement a
1323
  $backtrace = debug_backtrace();
1324
  $klass = get_class($backtrace[0]['object']);
1325
 
1326
+ // Get the method properties. We'll store this afterwards.
1327
+ $props = $this->object->get_method_properties($method);
1328
+
1329
  // Perform the routine described above...
1330
  $this->object->disable_pre_hooks($method);
1331
  $this->object->disable_post_hooks($method);
1343
  $this->object->enable_post_hooks($method);
1344
  $this->object->enable_mixin($method, $klass);
1345
 
1346
+ // Re-set all method properties
1347
+ $this->object->set_method_properties($method, $props);
1348
+
1349
  return $retval;
1350
  }
1351
 
1404
  * Provides an alias for call_anchor, as there's no parent
1405
  * to call in the context of a hook.
1406
  */
1407
+ function call_parent($method)
1408
  {
1409
  $args = func_get_args();
1410
  return call_user_func_array(
products/photocrati_nextgen/modules/ajax/class.ajax_controller.php CHANGED
@@ -31,7 +31,9 @@ class C_Ajax_Controller extends C_MVC_Controller
31
  $retval = array('error' => 'Not a valid AJAX action');
32
 
33
  // Flush the buffer
34
- ob_end_clean();
 
 
35
 
36
  // Return the JSON to the browser
37
  echo json_encode($retval);
31
  $retval = array('error' => 'Not a valid AJAX action');
32
 
33
  // Flush the buffer
34
+ while (ob_get_level() > 0) {
35
+ ob_end_clean();
36
+ }
37
 
38
  // Return the JSON to the browser
39
  echo json_encode($retval);
products/photocrati_nextgen/modules/ajax/module.ajax.php CHANGED
@@ -14,7 +14,7 @@ class M_Ajax extends C_Base_Module
14
  'photocrati-ajax',
15
  'AJAX',
16
  'Provides AJAX functionality',
17
- '0.4',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
@@ -47,7 +47,7 @@ class M_Ajax extends C_Base_Module
47
  */
48
  function _register_hooks()
49
  {
50
- add_action('init', array(&$this, 'enqueue_scripts'));
51
  }
52
 
53
 
@@ -68,7 +68,7 @@ class M_Ajax extends C_Base_Module
68
  $vars = array(
69
  'url' => $router->get_url($settings->ajax_slug, FALSE),
70
  'wp_site_url' => $home_url,
71
- 'wp_site_static_url' => str_replace('/index.php', '', $site_url)
72
  );
73
  wp_localize_script('photocrati_ajax', 'photocrati_ajax', $vars);
74
  }
14
  'photocrati-ajax',
15
  'AJAX',
16
  'Provides AJAX functionality',
17
+ '0.5',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
47
  */
48
  function _register_hooks()
49
  {
50
+ add_action('init', array(&$this, 'enqueue_scripts'), 9);
51
  }
52
 
53
 
68
  $vars = array(
69
  'url' => $router->get_url($settings->ajax_slug, FALSE),
70
  'wp_site_url' => $home_url,
71
+ 'wp_site_static_url' => str_replace('/index.php', '', str_replace('/index.php', '', $site_url))
72
  );
73
  wp_localize_script('photocrati_ajax', 'photocrati_ajax', $vars);
74
  }
products/photocrati_nextgen/modules/attach_to_post/adapter.attach_to_post_ajax.php CHANGED
@@ -167,7 +167,7 @@ class A_Attach_To_Post_Ajax extends Mixin
167
  }
168
 
169
  // Get the thumbnail
170
- $entity->thumb_url = $storage->get_image_url($image, 'thumb');
171
  $entity->thumb_html = $storage->get_image_html($image, 'thumb');
172
  $entity->max_width = $settings->thumbwidth;
173
  $entity->max_height = $settings->thumbheight;
@@ -189,7 +189,7 @@ class A_Attach_To_Post_Ajax extends Mixin
189
  $mapper = $this->object->get_registry()->get_utility('I_Displayed_Gallery_Mapper');
190
 
191
  // Do we have fields to work with?
192
- if ($this->object->validate_ajax_request(true) && ($params = $this->object->param('displayed_gallery'))) {
193
 
194
  // Existing displayed gallery ?
195
  if (($id = $this->object->param('id'))) {
@@ -200,7 +200,7 @@ class A_Attach_To_Post_Ajax extends Mixin
200
  }
201
  else {
202
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
203
- $displayed_gallery = $factory->create('displayed_gallery', $mapper, $params);
204
  }
205
 
206
  // Save the changes
167
  }
168
 
169
  // Get the thumbnail
170
+ $entity->thumb_url = $storage->get_image_url($image, 'thumb', TRUE);
171
  $entity->thumb_html = $storage->get_image_html($image, 'thumb');
172
  $entity->max_width = $settings->thumbwidth;
173
  $entity->max_height = $settings->thumbheight;
189
  $mapper = $this->object->get_registry()->get_utility('I_Displayed_Gallery_Mapper');
190
 
191
  // Do we have fields to work with?
192
+ if ($this->object->validate_ajax_request(true) && ($params = json_decode($this->object->param('displayed_gallery')))) {
193
 
194
  // Existing displayed gallery ?
195
  if (($id = $this->object->param('id'))) {
200
  }
201
  else {
202
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
203
+ $displayed_gallery = $factory->create('displayed_gallery', $params, $mapper);
204
  }
205
 
206
  // Save the changes
products/photocrati_nextgen/modules/attach_to_post/adapter.gallery_storage_frame_event.php CHANGED
@@ -29,11 +29,19 @@ class A_Gallery_Storage_Frame_Event extends Mixin
29
  $storage->get_thumb_url($image)
30
  );
31
 
32
- $events->add_event(
33
- array(
34
- 'event' => 'thumbnail_modified',
35
- 'image' => $image,
36
- )
37
- );
 
 
 
 
 
 
 
 
38
  }
39
  }
29
  $storage->get_thumb_url($image)
30
  );
31
 
32
+ if (is_admin()) {
33
+
34
+ $event = new stdClass();
35
+ $event->pid = $image->{$image->id_field};
36
+ $event->id_field = $image->id_field;
37
+ $event->thumb_url = $image->thumb_url;
38
+
39
+ $events->add_event(
40
+ array(
41
+ 'event' => 'thumbnail_modified',
42
+ 'image' => $event,
43
+ )
44
+ );
45
+ }
46
  }
47
  }
products/photocrati_nextgen/modules/attach_to_post/class.attach_controller.php CHANGED
@@ -4,6 +4,8 @@ class C_Attach_Controller extends C_NextGen_Admin_Page_Controller
4
  {
5
  static $_instances = array();
6
  var $_displayed_gallery;
 
 
7
 
8
  static function &get_instance($context)
9
  {
@@ -28,6 +30,56 @@ class C_Attach_Controller extends C_NextGen_Admin_Page_Controller
28
  {
29
  parent::initialize();
30
  $this->_load_displayed_gallery();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
  }
33
 
@@ -40,26 +92,37 @@ class Mixin_Attach_To_Post extends Mixin
40
  $this->object->_displayed_gallery = $mapper->create();
41
  }
42
  }
 
 
 
 
 
43
 
44
  function enqueue_backend_resources()
45
  {
46
  $this->call_parent('enqueue_backend_resources');
47
-
48
  // Enqueue frame event publishing
49
  wp_enqueue_script('frame_event_publisher');
 
50
 
51
  // Enqueue JQuery UI libraries
52
  wp_enqueue_script('jquery-ui-tabs');
53
  wp_enqueue_script('jquery-ui-sortable');
54
- wp_enqueue_script('jquery-ui-tooltip');
55
  wp_enqueue_script('ngg_tabs', $this->get_static_url('photocrati-attach_to_post#ngg_tabs.js'));
 
 
 
 
56
 
57
  // Ensure select2
58
  wp_enqueue_style('select2');
59
  wp_enqueue_script('select2');
 
60
 
61
  // Ensure that the Photocrati AJAX library is loaded
62
  wp_enqueue_script('photocrati_ajax');
 
63
 
64
  // Enqueue logic for the Attach to Post interface as a whole
65
  wp_enqueue_script(
@@ -68,9 +131,11 @@ class Mixin_Attach_To_Post extends Mixin
68
  wp_enqueue_style(
69
  'ngg_attach_to_post', $this->get_static_url('photocrati-attach_to_post#attach_to_post.css')
70
  );
 
71
 
72
  // Enqueue backbone.js library, required by the Attach to Post display tab
73
  wp_enqueue_script('backbone'); // provided by WP
 
74
 
75
  // Ensure underscore sting, a helper utility
76
  wp_enqueue_script(
@@ -79,6 +144,7 @@ class Mixin_Attach_To_Post extends Mixin
79
  array('underscore'),
80
  '2.3.0'
81
  );
 
82
 
83
  // Enqueue the backbone app for the display tab
84
  $settings = C_NextGen_Settings::get_instance();
@@ -98,6 +164,15 @@ class Mixin_Attach_To_Post extends Mixin
98
  'ngg_displayed_gallery_preview_url',
99
  $settings->gallery_preview_url
100
  );
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
  /**
@@ -106,7 +181,9 @@ class Mixin_Attach_To_Post extends Mixin
106
  function index_action($return=FALSE)
107
  {
108
  if ($this->object->_displayed_gallery->is_new()) $this->object->expires("+2 hour");
109
-
 
 
110
  // Enqueue resources
111
  return $this->object->render_view('photocrati-attach_to_post#attach_to_post', array(
112
  'page_title' => $this->object->_get_page_title(),
@@ -232,7 +309,7 @@ class Mixin_Attach_To_Post extends Mixin
232
  function _render_ngg_page_in_frame($page, $tab_id = null)
233
  {
234
  $frame_url = admin_url("/admin.php?page={$page}&attach_to_post");
235
- $frame_url = esc_url($frame_url);
236
 
237
  if ($tab_id) {
238
  $tab_id = " id='ngg-iframe-{$tab_id}'";
4
  {
5
  static $_instances = array();
6
  var $_displayed_gallery;
7
+ var $_marked_scripts;
8
+ var $_is_rendering;
9
 
10
  static function &get_instance($context)
11
  {
30
  {
31
  parent::initialize();
32
  $this->_load_displayed_gallery();
33
+
34
+ $this->_marked_scripts = array();
35
+
36
+ if (did_action('wp_print_scripts')) {
37
+ $this->_handle_scripts();
38
+ }
39
+ else {
40
+ add_action('wp_print_scripts', array($this, '_handle_scripts'), 9999);
41
+ }
42
+ }
43
+
44
+ function _handle_scripts()
45
+ {
46
+ if (is_admin() && $this->_is_rendering)
47
+ {
48
+ global $wp_scripts;
49
+
50
+ $queue = $wp_scripts->queue;
51
+ $marked = $this->_marked_scripts;
52
+
53
+ foreach ($marked as $tag => $value) {
54
+ $this->_handle_script($tag, $queue);
55
+ }
56
+
57
+ foreach ($queue as $extra) {
58
+ wp_dequeue_script($extra);
59
+ }
60
+ }
61
+ }
62
+
63
+ function _handle_script($tag, &$queue)
64
+ {
65
+ global $wp_scripts;
66
+
67
+ $registered = $wp_scripts->registered;
68
+
69
+ $idx = array_search($tag, $queue);
70
+ if ($idx !== false) {
71
+ unset($queue[$idx]);
72
+ }
73
+
74
+ if (isset($registered[$tag])) {
75
+ $script = $registered[$tag];
76
+
77
+ if ($script->deps) {
78
+ foreach ($script->deps as $dep) {
79
+ $this->_handle_script($dep, $queue);
80
+ }
81
+ }
82
+ }
83
  }
84
  }
85
 
92
  $this->object->_displayed_gallery = $mapper->create();
93
  }
94
  }
95
+
96
+ function mark_script($script_tag)
97
+ {
98
+ $this->object->_marked_scripts[$script_tag] = true;
99
+ }
100
 
101
  function enqueue_backend_resources()
102
  {
103
  $this->call_parent('enqueue_backend_resources');
 
104
  // Enqueue frame event publishing
105
  wp_enqueue_script('frame_event_publisher');
106
+ $this->object->mark_script('frame_event_publisher');
107
 
108
  // Enqueue JQuery UI libraries
109
  wp_enqueue_script('jquery-ui-tabs');
110
  wp_enqueue_script('jquery-ui-sortable');
111
+ wp_enqueue_script('jquery-ui-tooltip');
112
  wp_enqueue_script('ngg_tabs', $this->get_static_url('photocrati-attach_to_post#ngg_tabs.js'));
113
+ $this->object->mark_script('jquery-ui-tabs');
114
+ $this->object->mark_script('jquery-ui-sortable');
115
+ $this->object->mark_script('jquery-ui-tooltip');
116
+ $this->object->mark_script('ngg_tabs');
117
 
118
  // Ensure select2
119
  wp_enqueue_style('select2');
120
  wp_enqueue_script('select2');
121
+ $this->object->mark_script('select2');
122
 
123
  // Ensure that the Photocrati AJAX library is loaded
124
  wp_enqueue_script('photocrati_ajax');
125
+ $this->object->mark_script('photocrati_ajax');
126
 
127
  // Enqueue logic for the Attach to Post interface as a whole
128
  wp_enqueue_script(
131
  wp_enqueue_style(
132
  'ngg_attach_to_post', $this->get_static_url('photocrati-attach_to_post#attach_to_post.css')
133
  );
134
+ $this->object->mark_script('ngg_attach_to_post');
135
 
136
  // Enqueue backbone.js library, required by the Attach to Post display tab
137
  wp_enqueue_script('backbone'); // provided by WP
138
+ $this->object->mark_script('backbone');
139
 
140
  // Ensure underscore sting, a helper utility
141
  wp_enqueue_script(
144
  array('underscore'),
145
  '2.3.0'
146
  );
147
+ $this->object->mark_script('underscore.string');
148
 
149
  // Enqueue the backbone app for the display tab
150
  $settings = C_NextGen_Settings::get_instance();
164
  'ngg_displayed_gallery_preview_url',
165
  $settings->gallery_preview_url
166
  );
167
+ $this->object->mark_script('ngg_display_tab');
168
+
169
+ // TODO: for now mark Pro scripts to ensure they are enqueued properly, remove this after Pro upgrade with tagging added
170
+ $display_types = array('photocrati-nextgen_pro_slideshow', 'photocrati-nextgen_pro_horizontal_filmstrip', 'photocrati-nextgen_pro_thumbnail_grid', 'photocrati-nextgen_pro_blog_gallery', 'photocrati-nextgen_pro_film');
171
+ foreach ($display_types as $display_type) {
172
+ $this->object->mark_script($display_type . '-js');
173
+ }
174
+
175
+ $this->object->mark_script('nextgen_pro_albums_settings_script');
176
  }
177
 
178
  /**
181
  function index_action($return=FALSE)
182
  {
183
  if ($this->object->_displayed_gallery->is_new()) $this->object->expires("+2 hour");
184
+
185
+ $this->object->_is_rendering = true;
186
+
187
  // Enqueue resources
188
  return $this->object->render_view('photocrati-attach_to_post#attach_to_post', array(
189
  'page_title' => $this->object->_get_page_title(),
309
  function _render_ngg_page_in_frame($page, $tab_id = null)
310
  {
311
  $frame_url = admin_url("/admin.php?page={$page}&attach_to_post");
312
+ $frame_url = nextgen_esc_url($frame_url);
313
 
314
  if ($tab_id) {
315
  $tab_id = " id='ngg-iframe-{$tab_id}'";
products/photocrati_nextgen/modules/attach_to_post/mixin.attach_to_post_display_tab.php CHANGED
@@ -24,6 +24,7 @@ class Mixin_Attach_To_Post_Display_Tab extends Mixin
24
  $context = 'attach_to_post';
25
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper', $context);
26
  $album_mapper = $this->get_registry()->get_utility('I_Album_Mapper', $context);
 
27
  $display_type_mapper= $this->get_registry()->get_utility('I_Display_Type_Mapper', $context);
28
  $source_mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Source_Mapper', $context);
29
  $security = $this->get_registry()->get_utility('I_Security_Manager');
@@ -53,7 +54,8 @@ class Mixin_Attach_To_Post_Display_Tab extends Mixin
53
  'albums' => json_encode($album_mapper->find_all()),
54
  'tags' => json_encode($tags),
55
  'display_types' => json_encode($display_types),
56
- 'sec_token' => $security->get_request_token('nextgen_edit_displayed_gallery')->get_json()
 
57
  ), $return);
58
 
59
  return $output;
24
  $context = 'attach_to_post';
25
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper', $context);
26
  $album_mapper = $this->get_registry()->get_utility('I_Album_Mapper', $context);
27
+ $image_mapper = $this->get_registry()->get_utility('I_Image_Mapper', $context);
28
  $display_type_mapper= $this->get_registry()->get_utility('I_Display_Type_Mapper', $context);
29
  $source_mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Source_Mapper', $context);
30
  $security = $this->get_registry()->get_utility('I_Security_Manager');
54
  'albums' => json_encode($album_mapper->find_all()),
55
  'tags' => json_encode($tags),
56
  'display_types' => json_encode($display_types),
57
+ 'sec_token' => $security->get_request_token('nextgen_edit_displayed_gallery')->get_json(),
58
+ 'image_primary_key' => $image_mapper->get_primary_key_column()
59
  ), $return);
60
 
61
  return $output;
products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php CHANGED
@@ -23,7 +23,7 @@ class M_Attach_To_Post extends C_Base_Module
23
  'photocrati-attach_to_post',
24
  'Attach To Post',
25
  'Provides the "Attach to Post" interface for displaying galleries and albums',
26
- '0.7',
27
  'http://www.nextgen-gallery.com',
28
  'Photocrati Media',
29
  'http://www.photocrati.com',
@@ -303,12 +303,13 @@ class M_Attach_To_Post extends C_Base_Module
303
  function new_gallery_event($gallery_id)
304
  {
305
  $gallery = $this->get_registry()->get_utility('I_Gallery_Mapper')->find($gallery_id);
306
-
307
- $this->_get_frame_event_publisher()->add_event(array(
308
- 'event' => 'new_gallery',
309
- 'gallery_id'=> intval($gallery_id),
310
- 'gallery_title' => $gallery->title
311
- ));
 
312
  }
313
 
314
  /**
23
  'photocrati-attach_to_post',
24
  'Attach To Post',
25
  'Provides the "Attach to Post" interface for displaying galleries and albums',
26
+ '0.8',
27
  'http://www.nextgen-gallery.com',
28
  'Photocrati Media',
29
  'http://www.photocrati.com',
303
  function new_gallery_event($gallery_id)
304
  {
305
  $gallery = $this->get_registry()->get_utility('I_Gallery_Mapper')->find($gallery_id);
306
+ if ($gallery) {
307
+ $this->_get_frame_event_publisher()->add_event(array(
308
+ 'event' => 'new_gallery',
309
+ 'gallery_id'=> intval($gallery_id),
310
+ 'gallery_title' => $gallery->title
311
+ ));
312
+ }
313
  }
314
 
315
  /**
products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.js CHANGED
@@ -6,35 +6,33 @@ function close_attach_to_post_window()
6
 
7
  // Adjusts the height of a frame on the page, and then executes
8
  // the specified callback
9
- function adjust_height_for_frame(frame, callback)
10
  {
11
  // Adjust height of the frame
12
- var $frame = jQuery(frame);
13
- var new_height = $frame.contents().find('#wpbody').height();
14
- var parent_height = jQuery(parent.document).height();
 
15
  var current_height = $frame.height();
16
 
17
- // If the height is less than the parent window height, then use
18
- // the parent window height instead
19
  if (new_height < parent_height) new_height = parent_height;
20
 
21
- // If the height has changed, then use the new height
22
- if (current_height != new_height) {
23
- var frame_id = $frame.attr('id');
24
-
25
- $frame.height(new_height);
26
-
27
- if (frame_id && frame_id.indexOf('ngg-iframe-') == 0) {
28
- var tab_id = frame_id.substr(11);
29
-
30
- if (tab_id) {
31
- jQuery('#' + tab_id).height(new_height);
32
- }
33
- }
34
- }
35
 
36
  if (callback != undefined)
37
- return callback.call(frame, new_height);
38
  else
39
  return true;
40
  }
6
 
7
  // Adjusts the height of a frame on the page, and then executes
8
  // the specified callback
9
+ function adjust_height_for_frame(parent_window, current_window, callback)
10
  {
11
  // Adjust height of the frame
12
+ var $frame = jQuery(current_window.frameElement);
13
+ var new_height = $frame.contents().height()/3;
14
+ var new_height_body = $frame.contents().find('#wpbody').height();
15
+ var parent_height = jQuery(parent_window.document).height();
16
  var current_height = $frame.height();
17
 
18
+ if (new_height < new_height_body) new_height = new_height_body;
 
19
  if (new_height < parent_height) new_height = parent_height;
20
 
21
+ if (current_height < new_height) {
22
+ $frame.height(new_height);
23
+
24
+ var frame_id = $frame.attr('id');
25
+ if (frame_id && frame_id.indexOf('ngg-iframe-') == 0) {
26
+ var tab_id = frame_id.substr(11);
27
+
28
+ if (tab_id) {
29
+ jQuery('#' + tab_id).height(new_height);
30
+ }
31
+ }
32
+ }
 
 
33
 
34
  if (callback != undefined)
35
+ return callback(parent_window, current_window, new_height);
36
  else
37
  return true;
38
  }
products/photocrati_nextgen/modules/attach_to_post/static/iframely.js CHANGED
@@ -1,7 +1,6 @@
1
  if (window.frameElement) {
2
  document.getElementsByTagName('html')[0].id = 'iframely';
3
  jQuery(function($){
4
- // Concentrate only on the content of the page
5
  $('#wpwrap').html($('#wpbody').html($('#wpbody-content').html($('#ngg_page_content'))));
6
 
7
  // We need to ensure that any POST operation includes the "attach_to_post"
@@ -9,7 +8,7 @@ if (window.frameElement) {
9
  $('form').each(function(){
10
  $(this).append("<input type='hidden' name='attach_to_post' value='1'/>");
11
  });
12
-
13
  var parent = window.parent;
14
 
15
  if (parent == null || typeof(parent.adjust_height_for_frame) == "undefined") {
@@ -17,17 +16,48 @@ if (window.frameElement) {
17
  parent = window;
18
  }
19
  }
20
-
21
- if (typeof(parent.adjust_height_for_frame) != "undefined") {
22
- // Adjust the height of the frame
23
- parent.adjust_height_for_frame(window.frameElement, function(){
24
- $('#iframely').css({
25
- position: 'static',
26
- visibility: 'visible'
27
- }).animate({
28
- opacity: 1.0
29
- });
30
- });
31
- }
 
 
 
 
 
 
 
 
 
32
  });
33
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  if (window.frameElement) {
2
  document.getElementsByTagName('html')[0].id = 'iframely';
3
  jQuery(function($){
 
4
  $('#wpwrap').html($('#wpbody').html($('#wpbody-content').html($('#ngg_page_content'))));
5
 
6
  // We need to ensure that any POST operation includes the "attach_to_post"
8
  $('form').each(function(){
9
  $(this).append("<input type='hidden' name='attach_to_post' value='1'/>");
10
  });
11
+
12
  var parent = window.parent;
13
 
14
  if (parent == null || typeof(parent.adjust_height_for_frame) == "undefined") {
16
  parent = window;
17
  }
18
  }
19
+
20
+ // Adjust the height of the frame
21
+ var recursive_check = true;
22
+ if (recursive_check) {
23
+ if (typeof(parent.adjust_height_for_frame) != "undefined") {
24
+ parent.adjust_height_for_frame(parent, window, iframely_callback);
25
+ }
26
+ }
27
+ else {
28
+ if (typeof(parent.adjust_height_for_frame) != "undefined") {
29
+ // Adjust the height of the frame
30
+ parent.adjust_height_for_frame(parent, window, function(){
31
+ $('#iframely').css({
32
+ position: 'static',
33
+ visibility: 'visible'
34
+ }).animate({
35
+ opacity: 1.0
36
+ });
37
+ });
38
+ }
39
+ }
40
  });
41
  }
42
+
43
+ function iframely_callback(parent_window, current_window, new_height)
44
+ {
45
+ var $current_window = jQuery(current_window);
46
+
47
+ if (typeof($current_window.data('iframely')) == 'undefined') $current_window.data('iframely', {attempts: 1});
48
+ var iframely = $current_window.data('iframely');
49
+
50
+ // After we've attempted to resize the frame 3 times, give up
51
+ if (iframely.attempts == 3) {
52
+ jQuery('#iframely').css({
53
+ position: 'static',
54
+ visibility: 'visible'
55
+ }).animate({ opacity: 1.0 });
56
+ }
57
+ else {
58
+ iframely.attempts += 1;
59
+ setTimeout(function(){
60
+ parent_window.adjust_height_for_frame(parent_window, current_window, iframely_callback);
61
+ }, 400);
62
+ }
63
+ }
products/photocrati_nextgen/modules/attach_to_post/templates/display_tab_js.php CHANGED
@@ -808,6 +808,9 @@ jQuery(function($){
808
  this.entities.remove(model, {silent: true});
809
  this.entities.add(model, {at: model.changed.sortorder, silent: true});
810
  this.displayed_gallery.set('sortorder', this.entities.entity_ids());
 
 
 
811
  this.displayed_gallery.set('order_by', 'sortorder');
812
  }, this);
813
 
@@ -1014,6 +1017,8 @@ jQuery(function($){
1014
  }
1015
  ]);
1016
  this.sortdirection_options.on('change:selected', this.sortdirection_changed, this);
 
 
1017
  },
1018
 
1019
  populate_sorting_fields: function(){
@@ -1054,6 +1059,15 @@ jQuery(function($){
1054
  this.sortorder_options.push(this.create_sortorder_option('galdesc', 'Description'));
1055
  },
1056
 
 
 
 
 
 
 
 
 
 
1057
  sortoption_changed: function(model){
1058
  this.sortorder_options.each(function(item){
1059
  item.set('selected', model.get('value') == item.get('value') ? true : false, {silent: true});
@@ -1162,10 +1176,15 @@ jQuery(function($){
1162
  this[key] = value;
1163
  }, this);
1164
  this.model.on('change', this.render, this);
 
 
 
1165
  this.id = this.model.get('id_field')+'_'+this.model.entity_id()
1166
  },
1167
 
1168
  item_dropped: function(e, index){
 
 
1169
  this.model.set('sortorder', index);
1170
  },
1171
 
@@ -1375,7 +1394,7 @@ jQuery(function($){
1375
  var request = <?php echo $sec_token?>;
1376
  request = _.extend(request, {
1377
  action: 'save_displayed_gallery',
1378
- displayed_gallery: this.displayed_gallery.toJSON()
1379
  });
1380
 
1381
  var self = this;
@@ -1476,6 +1495,7 @@ jQuery(function($){
1476
  this.display_type_order_step = <?php echo NEXTGEN_DISPLAY_PRIORITY_STEP; ?>;
1477
  this.entities = new Ngg.DisplayTab.Models.Entity_Collection();
1478
  this.entities.extra_data.displayed_gallery = this.displayed_gallery;
 
1479
 
1480
  // Pre-select current displayed gallery values
1481
  if (this.displayed_gallery.get('source')) {
808
  this.entities.remove(model, {silent: true});
809
  this.entities.add(model, {at: model.changed.sortorder, silent: true});
810
  this.displayed_gallery.set('sortorder', this.entities.entity_ids());
811
+ if (typeof(console) != 'undefined' && typeof(console.log) != 'undefined') {
812
+ console.log(this.entities.entity_ids());
813
+ }
814
  this.displayed_gallery.set('order_by', 'sortorder');
815
  }, this);
816
 
1017
  }
1018
  ]);
1019
  this.sortdirection_options.on('change:selected', this.sortdirection_changed, this);
1020
+ this.displayed_gallery.on('change:order_by', this.displayed_gallery_order_changed, this);
1021
+ this.displayed_gallery.on('change.order_direction', this.displayed_gallery_order_dir_changed, this);
1022
  },
1023
 
1024
  populate_sorting_fields: function(){
1059
  this.sortorder_options.push(this.create_sortorder_option('galdesc', 'Description'));
1060
  },
1061
 
1062
+ displayed_gallery_order_changed: function(e){
1063
+ this.sortorder_options.findWhere({value: e.get('order_by')}).set('selected', true);
1064
+ },
1065
+
1066
+
1067
+ displayed_gallery_order_dir_changed: function(e){
1068
+ this.sortdirection_options.findWhere({value: e.get('order_direction')}).set('selected', true);
1069
+ },
1070
+
1071
  sortoption_changed: function(model){
1072
  this.sortorder_options.each(function(item){
1073
  item.set('selected', model.get('value') == item.get('value') ? true : false, {silent: true});
1176
  this[key] = value;
1177
  }, this);
1178
  this.model.on('change', this.render, this);
1179
+ if (this.model.get('sortorder') == 0) {
1180
+ this.model.set('sortorder', -1, {silent: true});
1181
+ }
1182
  this.id = this.model.get('id_field')+'_'+this.model.entity_id()
1183
  },
1184
 
1185
  item_dropped: function(e, index){
1186
+ Ngg.DisplayTab.instance.displayed_gallery.set('order_by', 'sortorder');
1187
+ //Ngg.DisplayTab.instance.displayed_gallery.set('order_direction', 'ASC');
1188
  this.model.set('sortorder', index);
1189
  },
1190
 
1394
  var request = <?php echo $sec_token?>;
1395
  request = _.extend(request, {
1396
  action: 'save_displayed_gallery',
1397
+ displayed_gallery: JSON.stringify(this.displayed_gallery.toJSON())
1398
  });
1399
 
1400
  var self = this;
1495
  this.display_type_order_step = <?php echo NEXTGEN_DISPLAY_PRIORITY_STEP; ?>;
1496
  this.entities = new Ngg.DisplayTab.Models.Entity_Collection();
1497
  this.entities.extra_data.displayed_gallery = this.displayed_gallery;
1498
+ this.image_key = "<?php echo $image_primary_key ?>";
1499
 
1500
  // Pre-select current displayed gallery values
1501
  if (this.displayed_gallery.get('source')) {
products/photocrati_nextgen/modules/cache/class.cache.php CHANGED
@@ -59,10 +59,10 @@ class Mixin_Cache extends Mixin
59
 
60
  foreach ($iterator as $file) {
61
  if ($file->isFile() || $file->isLink()) {
62
- unlink($file->getPathname());
63
  }
64
  elseif ($file->isDir() && !$file->isDot() && $recursive) {
65
- rmdir($file->getPathname());
66
  }
67
  }
68
  }
59
 
60
  foreach ($iterator as $file) {
61
  if ($file->isFile() || $file->isLink()) {
62
+ @unlink($file->getPathname());
63
  }
64
  elseif ($file->isDir() && !$file->isDot() && $recursive) {
65
+ @rmdir($file->getPathname());
66
  }
67
  }
68
  }
products/photocrati_nextgen/modules/cache/module.cache.php CHANGED
@@ -15,7 +15,7 @@ class M_Cache extends C_Base_Module
15
  'photocrati-cache',
16
  'Cache',
17
  'Handles clearing of NextGen caches',
18
- '0.1',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
15
  'photocrati-cache',
16
  'Cache',
17
  'Handles clearing of NextGen caches',
18
+ '0.2',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/datamapper/class.custompost_datamapper_driver.php CHANGED
@@ -30,6 +30,7 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
30
  'is_select' => TRUE,
31
  'is_delete' => FALSE
32
  );
 
33
  return $this->object;
34
  }
35
 
@@ -252,7 +253,6 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
252
  */
253
  function convert_post_to_entity($post, $model=FALSE)
254
  {
255
-
256
  $entity = new stdClass();
257
  foreach ($post as $key => $value) {
258
  if ($key == 'post_content') {
@@ -335,7 +335,14 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
335
  /* @var $wpdb wpdb */
336
  global $wpdb;
337
  if (!is_array($omit)) $omit = array($omit);
 
 
 
 
 
338
  $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE post_id = %s", $post_id));
 
 
339
  $sql_parts = array();
340
  foreach($entity as $key => $value) {
341
  if (in_array($key, $omit)) continue;
@@ -427,10 +434,7 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
427
  $query->query_vars = $this->object->_query_args;
428
  add_action('pre_get_posts', array(&$this, 'set_query_args'), PHP_INT_MAX-1, 1);
429
  foreach ($query->get_posts() as $row) {
430
- $row = $this->object->convert_post_to_entity($this->scrub_result($row), $model);
431
- if (!$model)
432
- $row->id_field = $this->object->get_primary_key_column();
433
- $retval[] = $row;
434
  }
435
  remove_action('pre_get_posts', array(&$this, 'set_query_args'), PHP_INT_MAX-1, 1);
436
 
@@ -522,17 +526,13 @@ class C_CustomPost_DataMapper_Driver extends C_DataMapper_Driver_Base
522
 
523
  function define($object_name, $context=FALSE)
524
  {
 
 
525
  parent::define($object_name, $context);
526
  $this->add_mixin('Mixin_CustomPost_DataMapper_Driver');
527
  $this->implement('I_CustomPost_DataMapper');
528
  }
529
 
530
- function initialize($object_name)
531
- {
532
- if (strlen($object_name) > 20) throw new Exception("The custom post name can be no longer than 20 characters long");
533
- parent::initialize($object_name);
534
- }
535
-
536
 
537
  /**
538
  * Gets the name of the table
30
  'is_select' => TRUE,
31
  'is_delete' => FALSE
32
  );
33
+
34
  return $this->object;
35
  }
36
 
253
  */
254
  function convert_post_to_entity($post, $model=FALSE)
255
  {
 
256
  $entity = new stdClass();
257
  foreach ($post as $key => $value) {
258
  if ($key == 'post_content') {
335
  /* @var $wpdb wpdb */
336
  global $wpdb;
337
  if (!is_array($omit)) $omit = array($omit);
338
+
339
+ // By default, we omit creating meta values for columns in the posts table
340
+ $omit = array_merge($omit, $this->object->_table_columns);
341
+
342
+ // Delete the existing meta values
343
  $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE post_id = %s", $post_id));
344
+
345
+ // Create query for new meta values
346
  $sql_parts = array();
347
  foreach($entity as $key => $value) {
348
  if (in_array($key, $omit)) continue;
434
  $query->query_vars = $this->object->_query_args;
435
  add_action('pre_get_posts', array(&$this, 'set_query_args'), PHP_INT_MAX-1, 1);
436
  foreach ($query->get_posts() as $row) {
437
+ $retval[] = $this->object->convert_post_to_entity($this->scrub_result($row), $model);
 
 
 
438
  }
439
  remove_action('pre_get_posts', array(&$this, 'set_query_args'), PHP_INT_MAX-1, 1);
440
 
526
 
527
  function define($object_name, $context=FALSE)
528
  {
529
+ if (strlen($object_name) > 20) throw new Exception("The custom post name can be no longer than 20 characters long");
530
+
531
  parent::define($object_name, $context);
532
  $this->add_mixin('Mixin_CustomPost_DataMapper_Driver');
533
  $this->implement('I_CustomPost_DataMapper');
534
  }
535
 
 
 
 
 
 
 
536
 
537
  /**
538
  * Gets the name of the table
products/photocrati_nextgen/modules/datamapper/class.customtable_datamapper_driver.php CHANGED
@@ -18,10 +18,11 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
18
  * specify DB columns
19
  * @param string $fields
20
  */
21
- function select($fields='*')
22
  {
23
  // Create a fresh slate
24
  $this->object->_init();
 
25
  $this->object->_select_clause = "SELECT {$fields}";
26
 
27
  return $this->object;
@@ -182,8 +183,8 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
182
  if ($where_clauses) $sql[] = 'WHERE '.implode(' AND ', $where_clauses);
183
 
184
  if ($this->object->is_select_statement()) {
185
- if ($this->object->_order_clauses) $sql[] = 'ORDER BY '.implode(', ', $this->object->_order_clauses);
186
  if ($this->object->_group_by_columns) $sql[] = 'GROUP BY '.implode(', ', $this->object->_group_by_columns);
 
187
  if ($this->object->_limit_clause) $sql[] = $this->object->_limit_clause;
188
  }
189
  return implode(' ', $sql);
@@ -206,8 +207,9 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
206
  // If we have a SQL statement to execute, then heck, execute it!
207
  if ($sql)
208
  {
209
- if ($this->object->debug)
210
- var_dump($sql);
 
211
 
212
  $this->_wpdb()->query($sql);
213
 
@@ -220,11 +222,19 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
220
  $retval = $this->_wpdb()->last_result;
221
  }
222
  else {
 
223
  foreach ($this->_wpdb()->last_result as $row) {
224
- $retval[] = $this->_convert_to_entity($this->scrub_result($row));
 
 
 
 
225
  }
226
  }
227
  }
 
 
 
228
  }
229
 
230
  return $retval;
@@ -240,7 +250,7 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
240
 
241
  unset($entity->id_field);
242
  $primary_key = $this->object->get_primary_key_column();
243
- if (isset($entity->$primary_key)) {
244
  if($this->object->_update($entity)) $retval = intval($entity->$primary_key);
245
  }
246
  else {
@@ -359,68 +369,48 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
359
  return $retval;
360
  }
361
 
362
-
363
- /**
364
- * Looks up using SQL the columns existing in the database
365
- */
366
- function lookup_columns()
367
  {
368
- $this->object->_columns = array();
369
- $sql = "SHOW COLUMNS FROM `{$this->object->get_table_name()}`";
370
- foreach ($this->object->run_query($sql, TRUE) as $row) {
371
- $this->object->_columns[] = $row->Field;
372
  }
373
- return $this->object->_columns;
374
  }
375
 
376
- /**
377
- * Determines whether a column is present for the table
378
- * @param string $column_name
379
- * @return string
380
- */
381
- function has_column($column_name)
382
  {
383
- if (empty($this->object->_columns)) $this->object->lookup_columns();
384
- return array_search($column_name, $this->object->_columns);
385
  }
386
 
387
  /**
388
- * Defines a column for this table
389
- * @param string $column_name
390
- * @param string $datatype
391
  */
392
- function define_column($column_name, $datatype)
393
  {
394
- $this->object->_defined_columns[$column_name] = $datatype;
395
- }
396
-
397
- function add_column($column_name, $datatype=FALSE)
398
- {
399
- // If no datatype was specified, perhaps the column was already defined
400
- if (!$datatype && isset($this->object->_defined_columns[$column_name])) {
401
- $datatype = $this->object->_defined_columns[$column_name];
402
  }
403
 
404
- // Ensure that we have a datatype before continuing...
405
- if ($datatype) {
406
- $sql = "ALTER TABLE `{$this->get_table_name()}` ADD COLUMN ``{$column_name}` {$datatype}";
407
- $this->object->run_query($sql);
408
- }
409
 
410
- $this->object->lookup_columns();
411
- }
 
 
 
 
412
 
413
- /**
414
- * Migrates the schema of the database
415
- */
416
- function migrate()
417
- {
418
- if (empty($this->object->_columns)) $this->object->lookup_columns();
419
- foreach ($this->object->_columns as $column_name) {
420
- if (!$this->object->has_column($column_name)) {
421
- $this->object->add_column($column_name);
422
  }
423
  }
 
 
424
  }
425
 
426
 
@@ -446,21 +436,20 @@ class C_CustomTable_DataMapper_Driver extends C_DataMapper_Driver_Base
446
  var $_limit_clause = '';
447
  var $_select_clause = '';
448
  var $_delete_clause = '';
449
- var $_columns = array();
450
- var $_defined_columns = array();
451
 
452
  function define($object_name, $context=FALSE)
453
  {
454
- parent::define($context);
455
  $this->add_mixin('C_CustomTable_DataMapper_Driver_Mixin');
456
  $this->implement('I_CustomTable_DataMapper');
457
  }
458
 
459
- function initialize($object_name)
460
  {
461
  parent::initialize($object_name);
462
  if (!isset($this->_primary_key_column))
463
  $this->_primary_key_column = $this->_lookup_primary_key_column();
 
464
  }
465
 
466
  /**
18
  * specify DB columns
19
  * @param string $fields
20
  */
21
+ function select($fields=NULL)
22
  {
23
  // Create a fresh slate
24
  $this->object->_init();
25
+ if (!$fields OR $fields == '*') $fields = $this->get_table_name().'.*';
26
  $this->object->_select_clause = "SELECT {$fields}";
27
 
28
  return $this->object;
183
  if ($where_clauses) $sql[] = 'WHERE '.implode(' AND ', $where_clauses);
184
 
185
  if ($this->object->is_select_statement()) {
 
186
  if ($this->object->_group_by_columns) $sql[] = 'GROUP BY '.implode(', ', $this->object->_group_by_columns);
187
+ if ($this->object->_order_clauses) $sql[] = 'ORDER BY '.implode(', ', $this->object->_order_clauses);
188
  if ($this->object->_limit_clause) $sql[] = $this->object->_limit_clause;
189
  }
190
  return implode(' ', $sql);
207
  // If we have a SQL statement to execute, then heck, execute it!
208
  if ($sql)
209
  {
210
+ if ($this->object->debug) {
211
+ var_dump($sql);
212
+ }
213
 
214
  $this->_wpdb()->query($sql);
215
 
222
  $retval = $this->_wpdb()->last_result;
223
  }
224
  else {
225
+ $id_field = $this->get_primary_key_column();
226
  foreach ($this->_wpdb()->last_result as $row) {
227
+ if ($row) {
228
+ if (isset($row->$id_field)) {
229
+ $retval[] = $this->object->_convert_to_entity($this->scrub_result($row));
230
+ }
231
+ }
232
  }
233
  }
234
  }
235
+ elseif ($this->object->debug) {
236
+ var_dump("No entities returned from query");
237
+ }
238
  }
239
 
240
  return $retval;
250
 
251
  unset($entity->id_field);
252
  $primary_key = $this->object->get_primary_key_column();
253
+ if (isset($entity->$primary_key) && $entity->$primary_key > 0) {
254
  if($this->object->_update($entity)) $retval = intval($entity->$primary_key);
255
  }
256
  else {
369
  return $retval;
370
  }
371
 
372
+ function _add_column($column_name, $datatype, $default_value=NULL)
 
 
 
 
373
  {
374
+ $sql = "ALTER TABLE `{$this->get_table_name()}` ADD COLUMN `{$column_name}` {$datatype}";
375
+ if ($default_value) {
376
+ if (is_string($default_value)) $default_value = str_replace("'", "\\'", $default_value);
377
+ $sql .= " NOT NULL DEFAULT " . (is_string($default_value) ? "'{$default_value}" : "{$default_value}");
378
  }
379
+ $this->object->_wpdb()->query($sql);
380
  }
381
 
382
+ function _remove_column($column_name)
 
 
 
 
 
383
  {
384
+ $sql = "ALTER TABLE `{$this->get_table_name()}` DROP COLUMN `{$column_name}`";
385
+ $this->object->_wpdb()->query($sql);
386
  }
387
 
388
  /**
389
+ * Migrates the schema of the database
 
 
390
  */
391
+ function migrate($lookup=TRUE)
392
  {
393
+ if (!$this->object->_columns) {
394
+ throw new E_ColumnsNotDefinedException("Columns not defined for {$this->get_table_name()}");
 
 
 
 
 
 
395
  }
396
 
397
+ if ($lookup) $this->lookup_columns();
 
 
 
 
398
 
399
+ // Add any missing columns
400
+ foreach ($this->object->_columns as $key => $properties) {
401
+ if (!in_array($key, $this->object->_table_columns)) {
402
+ $this->object->_add_column($key, $properties['type'], $properties['default_value']);
403
+ }
404
+ }
405
 
406
+ // Remove any columns not defined
407
+ foreach ($this->object->_table_columns as $key) {
408
+ if (!isset($this->object->_columns[$key])) {
409
+ //$this->object->_remove_column($key);
 
 
 
 
 
410
  }
411
  }
412
+
413
+ $this->object->lookup_columns();
414
  }
415
 
416
 
436
  var $_limit_clause = '';
437
  var $_select_clause = '';
438
  var $_delete_clause = '';
 
 
439
 
440
  function define($object_name, $context=FALSE)
441
  {
442
+ parent::define($object_name, $context);
443
  $this->add_mixin('C_CustomTable_DataMapper_Driver_Mixin');
444
  $this->implement('I_CustomTable_DataMapper');
445
  }
446
 
447
+ function initialize($object_name=FALSE)
448
  {
449
  parent::initialize($object_name);
450
  if (!isset($this->_primary_key_column))
451
  $this->_primary_key_column = $this->_lookup_primary_key_column();
452
+ $this->migrate(FALSE);
453
  }
454
 
455
  /**
products/photocrati_nextgen/modules/datamapper/class.datamapper_driver_base.php CHANGED
@@ -3,7 +3,13 @@
3
  /**
4
  * Thrown when an entity does not exist
5
  */
6
- class E_EntityNotFoundException extends RuntimeException
 
 
 
 
 
 
7
  {
8
 
9
  }
@@ -13,7 +19,7 @@ class E_EntityNotFoundException extends RuntimeException
13
  * array which is not yet supported due to a problem with references and the
14
  * call_user_func_array() function.
15
  */
16
- class E_InvalidEntityException extends RuntimeException
17
  {
18
  function __construct($message_or_previous=FALSE, $code=0, $previous=NULL)
19
  {
@@ -56,6 +62,24 @@ class Mixin_DataMapper_Driver_Base extends Mixin
56
  );
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  /**
60
  * Serializes the data
61
  * @param mixed $value
@@ -76,6 +100,7 @@ class Mixin_DataMapper_Driver_Base extends Mixin
76
  function unserialize($value)
77
  {
78
  $retval = NULL;
 
79
  if (is_string($value))
80
  {
81
  $retval = stripcslashes($value);
@@ -343,9 +368,12 @@ class Mixin_DataMapper_Driver_Base extends Mixin
343
  // Add name of the id_field to the entity, and convert
344
  // the ID to an integer
345
  $stdObject->id_field = $key = $this->object->get_primary_key_column();
346
- if (isset($stdObject->$key)) {
347
- $stdObject->$key = (int) $stdObject->$key;
348
- }
 
 
 
349
 
350
  // Set defaults for this entity
351
  $this->object->set_defaults($stdObject);
@@ -386,7 +414,7 @@ class Mixin_DataMapper_Driver_Base extends Mixin
386
  $entity = new stdClass;
387
  foreach ($properties as $k=>$v) $entity->$k = $v;
388
  }
389
- return $factory->create($this->object->get_model_factory_method(), $this->object, $entity, $context);
390
  }
391
 
392
 
@@ -529,24 +557,79 @@ class Mixin_DataMapper_Driver_Base extends Mixin
529
  return stripslashes($result);
530
  }
531
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
  }
533
 
534
  class C_DataMapper_Driver_Base extends C_Component
535
  {
536
  var $_object_name;
537
  var $_model_factory_method = FALSE;
 
 
 
538
 
539
  function define($object_name, $context=FALSE)
540
  {
541
  parent::define($context);
542
  $this->add_mixin('Mixin_DataMapper_Driver_Base');
543
  $this->implement('I_DataMapper_Driver');
 
 
 
 
 
544
  }
545
 
546
- function initialize($object_name)
547
  {
548
  parent::initialize();
549
- $this->_object_name = $object_name;
550
  }
551
 
552
  /**
@@ -569,6 +652,32 @@ class C_DataMapper_Driver_Base extends C_Component
569
  return $table_prefix.$this->_object_name;
570
  }
571
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  /**
573
  * Sets the name of the factory method used to create a model for this entity
574
  * @param string $method_name
3
  /**
4
  * Thrown when an entity does not exist
5
  */
6
+ class E_EntityNotFoundException extends E_NggErrorException
7
+ {
8
+
9
+ }
10
+
11
+
12
+ class E_ColumnsNotDefinedException extends E_NggErrorException
13
  {
14
 
15
  }
19
  * array which is not yet supported due to a problem with references and the
20
  * call_user_func_array() function.
21
  */
22
+ class E_InvalidEntityException extends E_NggErrorException
23
  {
24
  function __construct($message_or_previous=FALSE, $code=0, $previous=NULL)
25
  {
62
  );
63
  }
64
 
65
+ /**
66
+ * Notes that a particular columns is serialized, and should be unserialized when converted to an entity
67
+ * @param $column
68
+ */
69
+ function add_serialized_column($column)
70
+ {
71
+ $this->object->_serialized_columns[] = $column;
72
+ }
73
+
74
+ function unserialize_columns($object)
75
+ {
76
+ foreach ($this->object->_serialized_columns as $column) {
77
+ if (isset($object->$column) && is_string($object->$column)) {
78
+ $object->$column = $this->unserialize($object->$column);
79
+ }
80
+ }
81
+ }
82
+
83
  /**
84
  * Serializes the data
85
  * @param mixed $value
100
  function unserialize($value)
101
  {
102
  $retval = NULL;
103
+
104
  if (is_string($value))
105
  {
106
  $retval = stripcslashes($value);
368
  // Add name of the id_field to the entity, and convert
369
  // the ID to an integer
370
  $stdObject->id_field = $key = $this->object->get_primary_key_column();
371
+
372
+ // Cast columns to their appropriate data type
373
+ $this->cast_columns($stdObject);
374
+
375
+ // Unserialize columns
376
+ $this->unserialize_columns($stdObject);
377
 
378
  // Set defaults for this entity
379
  $this->object->set_defaults($stdObject);
414
  $entity = new stdClass;
415
  foreach ($properties as $k=>$v) $entity->$k = $v;
416
  }
417
+ return $factory->create($this->object->get_model_factory_method(), $entity, $this->object, $context);
418
  }
419
 
420
 
557
  return stripslashes($result);
558
  }
559
  }
560
+
561
+ function define_column($name, $type, $default_value=NULL)
562
+ {
563
+ $this->object->_columns[$name] = array(
564
+ 'type' => $type,
565
+ 'default_value' => $default_value
566
+ );
567
+ }
568
+
569
+ function has_defined_column($name)
570
+ {
571
+ $columns = $this->object->_columns;
572
+ return isset($columns[$name]);
573
+ }
574
+
575
+ function cast_columns($entity)
576
+ {
577
+ foreach ($this->object->_columns as $key => $properties) {
578
+ $value = isset($entity->$key) ? $entity->$key : NULL;
579
+ $default_value = $properties['default_value'];
580
+ if ($value && $value != $default_value) {
581
+ $column_type = $this->object->_columns[$key]['type'];
582
+ if (preg_match("/varchar|text/i", $column_type)) {
583
+ if (!is_array($value) && !is_object($value))
584
+ $entity->$key = strval($value);
585
+ }
586
+ else if (preg_match("/decimal|numeric|double/i", $column_type)) {
587
+ $entity->$key = doubleval($value);
588
+ }
589
+ else if (preg_match("/float/i", $column_type)) {
590
+ $entity->$key = floatval($value);
591
+ }
592
+ else if (preg_match("/int/i", $column_type)) {
593
+ $entity->$key = intval($value);
594
+ }
595
+ else if (preg_match("/bool/i", $column_type)) {
596
+ $entity->$key = ($value ? TRUE : FALSE);
597
+ }
598
+ }
599
+
600
+ // Add property and default value
601
+ else {
602
+ $entity->$key = $default_value;
603
+ }
604
+ }
605
+ return $entity;
606
+ }
607
  }
608
 
609
  class C_DataMapper_Driver_Base extends C_Component
610
  {
611
  var $_object_name;
612
  var $_model_factory_method = FALSE;
613
+ var $_columns = array();
614
+ var $_table_columns = array();
615
+ var $_serialized_columns = array();
616
 
617
  function define($object_name, $context=FALSE)
618
  {
619
  parent::define($context);
620
  $this->add_mixin('Mixin_DataMapper_Driver_Base');
621
  $this->implement('I_DataMapper_Driver');
622
+ $this->_object_name = $object_name;
623
+
624
+ if ($this->has_method('define_columns')) {
625
+ $this->define_columns();
626
+ }
627
  }
628
 
629
+ function initialize()
630
  {
631
  parent::initialize();
632
+ $this->lookup_columns();
633
  }
634
 
635
  /**
652
  return $table_prefix.$this->_object_name;
653
  }
654
 
655
+
656
+ /**
657
+ * Looks up using SQL the columns existing in the database
658
+ */
659
+ function lookup_columns()
660
+ {
661
+ global $wpdb;
662
+ $this->_table_columns = array();
663
+ $sql = "SHOW COLUMNS FROM `{$this->get_table_name()}`";
664
+ foreach ($wpdb->get_results($sql) as $row) {
665
+ $this->_table_columns[] = $row->Field;
666
+ }
667
+ return $this->_table_columns;
668
+ }
669
+
670
+ /**
671
+ * Determines whether a column is present for the table
672
+ * @param string $column_name
673
+ * @return string
674
+ */
675
+ function has_column($column_name)
676
+ {
677
+ if (empty($this->object->_table_columns)) $this->object->lookup_columns();
678
+ return array_search($column_name, $this->object->_table_columns) !== FALSE;
679
+ }
680
+
681
  /**
682
  * Sets the name of the factory method used to create a model for this entity
683
  * @param string $method_name
products/photocrati_nextgen/modules/datamapper/class.datamapper_model.php CHANGED
@@ -8,7 +8,7 @@ class C_DataMapper_Model extends C_Component
8
  /**
9
  * Define the model
10
  */
11
- function define($mapper, $properties, $context=FALSE)
12
  {
13
  parent::define($context);
14
  $this->add_mixin('Mixin_Validation');
@@ -23,7 +23,7 @@ class C_DataMapper_Model extends C_Component
23
  * @param array|stdClass $properties
24
  * @param string $context
25
  */
26
- function initialize($mapper, $properties=FALSE)
27
  {
28
  $this->_mapper = $mapper;
29
  $this->_stdObject = $properties ? (object)$properties : new stdClass();
@@ -105,7 +105,7 @@ class C_DataMapper_Model extends C_Component
105
  */
106
  function destroy()
107
  {
108
- $this->get_mapper()->destroy($this->_stdObject);
109
  }
110
 
111
 
@@ -121,16 +121,14 @@ class C_DataMapper_Model extends C_Component
121
  /**
122
  * Gets/sets the primary key
123
  */
124
- function id()
125
  {
126
  $key = $this->get_mapper()->get_primary_key_column();
127
- $args = func_get_args();
128
- if ($args) {
129
- return $this->__set($key, $args[0]);
130
- }
131
- else {
132
- return $this->__get($key);
133
  }
 
134
  }
135
  }
136
 
8
  /**
9
  * Define the model
10
  */
11
+ function define($mapper=NULL, $properties=array(), $context=FALSE)
12
  {
13
  parent::define($context);
14
  $this->add_mixin('Mixin_Validation');
23
  * @param array|stdClass $properties
24
  * @param string $context
25
  */
26
+ function initialize($mapper=NULL, $properties=FALSE)
27
  {
28
  $this->_mapper = $mapper;
29
  $this->_stdObject = $properties ? (object)$properties : new stdClass();
105
  */
106
  function destroy()
107
  {
108
+ return $this->get_mapper()->destroy($this->_stdObject);
109
  }
110
 
111
 
121
  /**
122
  * Gets/sets the primary key
123
  */
124
+ function id($value=NULL)
125
  {
126
  $key = $this->get_mapper()->get_primary_key_column();
127
+ if ($value) {
128
+ $this->__set($key, $value);
129
+
 
 
 
130
  }
131
+ return $this->__get($key);
132
  }
133
  }
134
 
products/photocrati_nextgen/modules/datamapper/module.datamapper.php CHANGED
@@ -14,7 +14,7 @@ class M_DataMapper extends C_Base_Module
14
  'photocrati-datamapper',
15
  'DataMapper',
16
  'Provides a database abstraction layer following the DataMapper pattern',
17
- '0.3',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
@@ -49,6 +49,7 @@ class M_DataMapper extends C_Base_Module
49
  function set_custom_wp_query($sql, &$wp_query)
50
  {
51
  if ($wp_query->get('datamapper')) {
 
52
  // Set the custom query
53
  if (($custom_sql = $wp_query->get('custom_sql'))) {
54
  $sql = $custom_sql;
14
  'photocrati-datamapper',
15
  'DataMapper',
16
  'Provides a database abstraction layer following the DataMapper pattern',
17
+ '0.4',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
49
  function set_custom_wp_query($sql, &$wp_query)
50
  {
51
  if ($wp_query->get('datamapper')) {
52
+
53
  // Set the custom query
54
  if (($custom_sql = $wp_query->get('custom_sql'))) {
55
  $sql = $custom_sql;
products/photocrati_nextgen/modules/dynamic_stylesheet/class.dynamic_stylesheet_controller.php CHANGED
@@ -76,7 +76,7 @@ class Mixin_Dynamic_Stylesheet_Instance_Methods extends Mixin
76
  $data = $this->object->encode($data);
77
  wp_enqueue_style(
78
  'dyncss-' . $index . $data . '@dynamic',
79
- $this->object->get_router()->get_url("/{$this->object->_app}", FALSE) . "/{$index}/{$data}"
80
  );
81
  }
82
  }
76
  $data = $this->object->encode($data);
77
  wp_enqueue_style(
78
  'dyncss-' . $index . $data . '@dynamic',
79
+ $this->object->get_router()->get_url("/{$this->object->_app}", FALSE) . "?index={$index}&data={$data}"
80
  );
81
  }
82
  }
products/photocrati_nextgen/modules/dynamic_thumbnails/adapter.dynamic_thumbnails_storage_driver.php CHANGED
@@ -45,7 +45,7 @@ class A_Dynamic_Thumbnails_Storage_Driver extends Mixin
45
  return $retval;
46
  }
47
 
48
- function get_image_url($image, $size='full')
49
  {
50
  $retval = NULL;
51
  $dynthumbs = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
@@ -61,7 +61,14 @@ class A_Dynamic_Thumbnails_Storage_Driver extends Mixin
61
  }
62
 
63
  if ($retval == null) {
64
- $retval = $this->call_parent('get_image_url', $image, $size);
 
 
 
 
 
 
 
65
  }
66
 
67
  return $retval;
45
  return $retval;
46
  }
47
 
48
+ function get_image_url($image, $size='full', $check_existance=FALSE)
49
  {
50
  $retval = NULL;
51
  $dynthumbs = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
61
  }
62
 
63
  if ($retval == null) {
64
+ $retval = $this->call_parent('get_image_url', $image, $size, $check_existance);
65
+ }
66
+
67
+ // Try generating the thumbnail
68
+ if ($retval == null) {
69
+ $params = array('watermark' => false, 'reflection' => false, 'crop' => true);
70
+ $result = $this->generate_thumbnail($image, $params);
71
+ if ($result) $retval = $this->call_parent('get_image_url', $image, $size, $check_existance);
72
  }
73
 
74
  return $retval;
products/photocrati_nextgen/modules/dynamic_thumbnails/module.dynamic_thumbnails.php CHANGED
@@ -13,7 +13,7 @@ class M_Dynamic_Thumbnails extends C_Base_Module
13
  'photocrati-dynamic_thumbnails',
14
  'Dynamic Thumbnails',
15
  'Adds support for dynamic thumbnails',
16
- '0.3',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
13
  'photocrati-dynamic_thumbnails',
14
  'Dynamic Thumbnails',
15
  'Adds support for dynamic thumbnails',
16
+ '0.4',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php CHANGED
@@ -15,7 +15,7 @@ class M_Frame_Communication extends C_Base_Module
15
  'photocrati-frame_communication',
16
  'Frame/iFrame Inter-Communication',
17
  'Provides a means for HTML frames to share server-side events with each other',
18
- '0.2',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com',
15
  'photocrati-frame_communication',
16
  'Frame/iFrame Inter-Communication',
17
  'Provides a means for HTML frames to share server-side events with each other',
18
+ '0.3',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com',
products/photocrati_nextgen/modules/fs/class.fs.php CHANGED
@@ -362,7 +362,7 @@ class Mixin_Fs_Instance_Methods extends Mixin
362
  */
363
  function set_document_root($value)
364
  {
365
- // Even for windows hosts we force '/' as the path separator
366
- return $this->_document_root = untrailingslashit(str_replace('\\', '/', $value));
367
  }
368
  }
362
  */
363
  function set_document_root($value)
364
  {
365
+ // IMPORTANT: Even for Windows, we construct the path to be C:/Windows instead of C:\Windows
366
+ return ($this->_document_root = str_replace("\\", '/', rtrim($value, "/\\")));
367
  }
368
  }
products/photocrati_nextgen/modules/lightbox/adapter.lightbox_factory.php CHANGED
@@ -2,13 +2,13 @@
2
 
3
  class A_Lightbox_Factory extends Mixin
4
  {
5
- function lightbox_library($mapper=FALSE, $properties=array(), $context=FALSE)
6
  {
7
- return new C_Lightbox_Library($mapper, $properties, $context);
8
  }
9
 
10
- function lightbox($mapper=FALSE, $properties=array(), $context=FALSE)
11
  {
12
- return $this->object->lightbox_library($mapper, $properties, $context);
13
  }
14
  }
2
 
3
  class A_Lightbox_Factory extends Mixin
4
  {
5
+ function lightbox_library($properties=array(), $mapper=FALSE, $context=FALSE)
6
  {
7
+ return new C_Lightbox_Library($properties, $mapper, $context);
8
  }
9
 
10
+ function lightbox($properties=array(), $mapper=FALSE, $context=FALSE)
11
  {
12
+ return $this->object->lightbox_library($properties, $mapper, $context);
13
  }
14
  }
products/photocrati_nextgen/modules/lightbox/class.lightbox_library.php CHANGED
@@ -11,12 +11,23 @@
11
  */
12
  class C_Lightbox_Library extends C_DataMapper_Model
13
  {
14
- function define($mapper, $properties, $context=FALSE)
15
  {
16
  parent::define($mapper, $properties, $context);
17
  $this->add_mixin('Mixin_Lightbox_Library_Validation');
18
  $this->implement('I_Lightbox_Library');
19
  }
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
  class Mixin_Lightbox_Library_Validation extends Mixin
11
  */
12
  class C_Lightbox_Library extends C_DataMapper_Model
13
  {
14
+ function define($properties=array(), $mapper=FALSE, $context=FALSE)
15
  {
16
  parent::define($mapper, $properties, $context);
17
  $this->add_mixin('Mixin_Lightbox_Library_Validation');
18
  $this->implement('I_Lightbox_Library');
19
  }
20
+
21
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
22
+ {
23
+ // Get the mapper is not specified
24
+ if (!$mapper) {
25
+ $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
26
+ }
27
+
28
+ // Initialize
29
+ parent::initialize($mapper, $properties);
30
+ }
31
  }
32
 
33
  class Mixin_Lightbox_Library_Validation extends Mixin
products/photocrati_nextgen/modules/lightbox/module.lightbox.php CHANGED
@@ -12,13 +12,15 @@ define('NEXTGEN_LIGHTBOX_ADVANCED_OPTIONS_SLUG', 'ngg_lightbox_advanced_options'
12
 
13
  class M_Lightbox extends C_Base_Module
14
  {
 
 
15
  function define()
16
  {
17
  parent::define(
18
  'photocrati-lightbox',
19
  'Lightbox',
20
  _("Provides integration with JQuery's lightbox plugin"),
21
- '0.4',
22
  'http://leandrovieira.com/projects/jquery/lightbox/',
23
  'Photocrati Media',
24
  'http://www.photocrati.com'
@@ -64,6 +66,152 @@ class M_Lightbox extends C_Base_Module
64
  // Provides an installer for lightbox libraries
65
  $this->get_registry()->add_adapter('I_Installer', 'A_Lightbox_Installer');
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  function get_type_list()
69
  {
12
 
13
  class M_Lightbox extends C_Base_Module
14
  {
15
+ var $_registered_lightboxes;
16
+
17
  function define()
18
  {
19
  parent::define(
20
  'photocrati-lightbox',
21
  'Lightbox',
22
  _("Provides integration with JQuery's lightbox plugin"),
23
+ '0.5',
24
  'http://leandrovieira.com/projects/jquery/lightbox/',
25
  'Photocrati Media',
26
  'http://www.photocrati.com'
66
  // Provides an installer for lightbox libraries
67
  $this->get_registry()->add_adapter('I_Installer', 'A_Lightbox_Installer');
68
  }
69
+
70
+ /**
71
+ * Registers hooks for the WordPress framework
72
+ */
73
+ function _register_hooks()
74
+ {
75
+ add_action('wp_enqueue_scripts', array($this, '_register_resources'));
76
+ add_action('wp_footer', array($this, '_enqueue_resources'), 3);
77
+ add_action('init', array(&$this, '_register_custom_post_type'));
78
+ }
79
+
80
+ /**
81
+ * Registers the custom post type saved for lightbox libraries
82
+ */
83
+ function _register_custom_post_type()
84
+ {
85
+ register_post_type('lightbox_library', array(
86
+ 'label' => 'Lightbox Library',
87
+ 'publicly_queryable' => FALSE,
88
+ 'exclude_from_search' => TRUE,
89
+ ));
90
+ }
91
+
92
+ /**
93
+ * Registers our static settings resources so the ATP module can find them later
94
+ */
95
+ function _register_resources()
96
+ {
97
+ $router = $this->get_registry()->get_utility('I_Router');
98
+ $settings = C_NextGen_Settings::get_instance();
99
+ $thumbEffectContext = isset($settings->thumbEffectContext) ? $settings->thumbEffectContext : '';
100
+
101
+ wp_register_script(
102
+ 'nextgen_lightbox_context',
103
+ $router->get_static_url('photocrati-lightbox#lightbox_context.js')
104
+ );
105
+ wp_enqueue_script('nextgen_lightbox_context');
106
+
107
+ if ($thumbEffectContext != null && $thumbEffectContext != 'nextgen_images') {
108
+ $mapper = $this->object->get_registry()->get_utility('I_Lightbox_Library_Mapper');
109
+ $library = $mapper->find_by_name($settings->thumbEffect);
110
+
111
+ // Make the path to the static resources available for libraries
112
+ // Shutter-Reloaded in particular depends on this
113
+ $this->_add_script_data(
114
+ 'ngg_common',
115
+ 'nextgen_lightbox_settings',
116
+ array('static_path' => $this->get_registry()->get_utility('I_Fs')->find_static_abspath('', 'photocrati-lightbox'), 'context' => $thumbEffectContext),
117
+ TRUE,
118
+ true
119
+ );
120
+
121
+ global $wp_scripts;
122
+
123
+ $i=0;
124
+ foreach (explode("\n", $library->scripts) as $script) {
125
+ wp_register_script(
126
+
127
+ $library->name.'-'.$i,
128
+ $script, array('ngg_common')
129
+ );
130
+ $this->_registered_lightboxes[] = $library->name.'-'.$i;
131
+ if ($i == 0 AND isset($library->values)) {
132
+ foreach ($library->values as $name => $value) {
133
+ $this->_add_script_data(
134
+ $library->name . '-0',
135
+ $name,
136
+ $value,
137
+ FALSE
138
+ );
139
+ }
140
+ }
141
+ $i+=1;
142
+ }
143
+ $i=0;
144
+ foreach (explode("\n", $library->css_stylesheets) as $style) {
145
+ wp_enqueue_style(
146
+ $library->name.'-'.$i,
147
+ $style
148
+ );
149
+ $i+=1;
150
+ }
151
+ }
152
+ }
153
+
154
+ function _enqueue_resources()
155
+ {
156
+ foreach (((array)$this->_registered_lightboxes) as $library) {
157
+ wp_enqueue_script($library);
158
+ }
159
+ }
160
+
161
+ /**
162
+ * Adds data to the DOM which is then accessible by a script -- borrowed from display type controller class
163
+ * @param string $handle
164
+ * @param string $object_name
165
+ * @param mixed $object_value
166
+ * @param bool $define
167
+ */
168
+ function _add_script_data($handle, $object_name, $object_value, $define=TRUE, $override=FALSE)
169
+ {
170
+ $retval = FALSE;
171
+
172
+ // wp_localize_script allows you to add data to the DOM, associated
173
+ // with a particular script. You can even call wp_localize_script
174
+ // multiple times to add multiple objects to the DOM. However, there
175
+ // are a few problems with wp_localize_script:
176
+ //
177
+ // - If you call it with the same object_name more than once, you're
178
+ // overwritting the first call.
179
+ // - You cannot namespace your objects due to the "var" keyword always
180
+ // - being used.
181
+ //
182
+ // To circumvent the above issues, we're going to use the WP_Scripts
183
+ // object to workaround the above issues
184
+ global $wp_scripts;
185
+
186
+ // Has the script been registered or enqueued yet?
187
+ if (isset($wp_scripts->registered[$handle])) {
188
+
189
+ // Get the associated data with this script
190
+ $script = &$wp_scripts->registered[$handle];
191
+ $data = isset($script->extra['data']) ? $script->extra['data'] : '';
192
+
193
+ // Construct the addition
194
+ $addition = $define ? "\nvar {$object_name} = " . json_encode($object_value) . ';' :
195
+ "\n{$object_name} = " . json_encode($object_value) . ';';
196
+
197
+ // Add the addition
198
+ if ($override) {
199
+ $data .= $addition;
200
+ $retval = TRUE;
201
+ }
202
+ else if (strpos($data, $object_name) === FALSE) {
203
+ $data .= $addition;
204
+ $retval = TRUE;
205
+ }
206
+
207
+ $script->extra['data'] = $data;
208
+
209
+ unset($script);
210
+ }
211
+
212
+ return $retval;
213
+ }
214
+
215
 
216
  function get_type_list()
217
  {
products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js CHANGED
@@ -1,6 +1,8 @@
1
  jQuery(function($) {
2
  var nextgen_fancybox_init = function() {
3
- $(".ngg-fancybox").fancybox({
 
 
4
  titlePosition: 'inside',
5
  // Needed for twenty eleven
6
  onComplete: function() {
1
  jQuery(function($) {
2
  var nextgen_fancybox_init = function() {
3
+ var selector = nextgen_lightbox_filter_selector($, $(".ngg-fancybox"));
4
+
5
+ selector.fancybox({
6
  titlePosition: 'inside',
7
  // Needed for twenty eleven
8
  onComplete: function() {
products/photocrati_nextgen/modules/lightbox/static/highslide/nextgen_highslide_init.js CHANGED
@@ -1,15 +1,15 @@
1
  // Apply default settings
2
  var galleryOptions = {
3
- align: 'center',
4
- dimmingOpacity: 0.8,
5
- fadeInOut: true,
6
- marginBottom: 80,
7
- marginLeft: 100,
8
- numberPosition: 'caption',
9
- slideshowGroup: 'gallery',
10
- transitions: ['expand', 'crossfade'],
11
- wrapperClassName: 'dark borderless floating-caption',
12
- graphicsDir: nextgen_highslide_graphics_dir + '/'
13
  };
14
 
15
  hs.align = galleryOptions['align'];
@@ -23,15 +23,23 @@ hs.showCredits = galleryOptions['showCredits'];
23
  hs.graphicsDir = galleryOptions['graphicsDir'];
24
  hs.wrapperClassName = galleryOptions['wrapperClassName'];
25
 
26
- // Enable slideshows
27
- hs.addSlideshow({
28
- fixedControls: true,
29
- interval: 5000,
30
- overlayOptions: {
31
- hideOnMouseOut: true,
32
- opacity: .6,
33
- position: 'top center'
34
- },
35
- repeat: true,
36
- useControls: true
 
 
 
 
 
 
 
 
37
  });
1
  // Apply default settings
2
  var galleryOptions = {
3
+ align: 'center',
4
+ dimmingOpacity: 0.8,
5
+ fadeInOut: true,
6
+ marginBottom: 80,
7
+ marginLeft: 100,
8
+ numberPosition: 'caption',
9
+ slideshowGroup: 'gallery',
10
+ transitions: ['expand', 'crossfade'],
11
+ wrapperClassName: 'dark borderless floating-caption',
12
+ graphicsDir: nextgen_highslide_graphics_dir + '/'
13
  };
14
 
15
  hs.align = galleryOptions['align'];
23
  hs.graphicsDir = galleryOptions['graphicsDir'];
24
  hs.wrapperClassName = galleryOptions['wrapperClassName'];
25
 
26
+ jQuery(function($) {
27
+ var selector = nextgen_lightbox_filter_selector($, $([]));
28
+ selector.addClass('highslide');
29
+ selector.click(function () { return hs.expand(this) });
30
+
31
+ hs.updateAnchors();
32
+
33
+ // Enable slideshows
34
+ hs.addSlideshow({
35
+ fixedControls: true,
36
+ interval: 5000,
37
+ overlayOptions: {
38
+ hideOnMouseOut: true,
39
+ opacity: .6,
40
+ position: 'top center'
41
+ },
42
+ repeat: true,
43
+ useControls: true
44
+ });
45
  });
products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/nextgen_lightbox_init.js CHANGED
@@ -46,7 +46,9 @@ jQuery(function($) {
46
  });
47
 
48
  var nextgen_jquery_lightbox_init = function() {
49
- $('.ngg_lightbox').lightBox({
 
 
50
  imageLoading: nextgen_lightbox_loading_img_url,
51
  imageBtnClose: nextgen_lightbox_close_btn_url,
52
  imageBtnPrev: nextgen_lightbox_btn_prev_url,
46
  });
47
 
48
  var nextgen_jquery_lightbox_init = function() {
49
+ var selector = nextgen_lightbox_filter_selector($, $(".ngg_lightbox"));
50
+
51
+ selector.lightBox({
52
  imageLoading: nextgen_lightbox_loading_img_url,
53
  imageBtnClose: nextgen_lightbox_close_btn_url,
54
  imageBtnPrev: nextgen_lightbox_btn_prev_url,
products/photocrati_nextgen/modules/lightbox/static/lightbox_context.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function nextgen_lightbox_filter_selector($, selector)
2
+ {
3
+ if (nextgen_lightbox_settings && nextgen_lightbox_settings.context) {
4
+ var context = nextgen_lightbox_settings.context;
5
+
6
+ if (context == 'all_images') {
7
+ selector = selector.add($('a > img').parent());
8
+ }
9
+ else if (context == 'all_images_direct') {
10
+ selector = selector.add($('a[href] > img').parent()
11
+ .filter(function() {
12
+ var href = $(this).attr('href').toLowerCase();
13
+ var ext = href.substring(href.length - 3);
14
+ var ext2 = href.substring(href.length - 4);
15
+
16
+ return (ext == 'jpg' || ext == 'gif' || ext == 'png' || ext2 == 'tiff' || ext2 == 'jpeg');
17
+ }));
18
+ }
19
+ else if (context == 'nextgen_and_wp_images') {
20
+ selector = selector.add($('a > img[class*="wp-image-"]').parent());
21
+ }
22
+
23
+ selector = selector.not('.gallery_link');
24
+ }
25
+
26
+ return selector;
27
+ }
products/photocrati_nextgen/modules/lightbox/static/shutter/nextgen_shutter.js CHANGED
@@ -1,5 +1,8 @@
1
  jQuery(function($){
2
  var callback = function(){
 
 
 
3
  var shutterLinks = {}, shutterSets = {}; shutterReloaded.init();
4
  };
5
  $(this).bind('refreshed', callback);
1
  jQuery(function($){
2
  var callback = function(){
3
+ var selector = nextgen_lightbox_filter_selector($, $([]));
4
+ selector.addClass('shutterset');
5
+
6
  var shutterLinks = {}, shutterSets = {}; shutterReloaded.init();
7
  };
8
  $(this).bind('refreshed', callback);
products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.js CHANGED
@@ -1,5 +1,8 @@
1
  jQuery(function($){
2
  var callback = function(){
 
 
 
3
  var shutterLinks = {}, shutterSets = {}; shutterReloaded.Init();
4
  };
5
  $(this).bind('refreshed', callback);
@@ -10,4 +13,4 @@ jQuery(function($){
10
  else return;
11
 
12
  callback();
13
- });
1
  jQuery(function($){
2
  var callback = function(){
3
+ var selector = nextgen_lightbox_filter_selector($, $([]));
4
+ selector.addClass('shutterset');
5
+
6
  var shutterLinks = {}, shutterSets = {}; shutterReloaded.Init();
7
  };
8
  $(this).bind('refreshed', callback);
13
  else return;
14
 
15
  callback();
16
+ });
products/photocrati_nextgen/modules/lightbox/static/thickbox/nextgen_thickbox_init.js CHANGED
@@ -8,3 +8,8 @@ var thickboxL10n = {
8
  close: 'Close',
9
  noiframes: 'This feature requires inline frames. You have iframes disabled or your browser does not support them.'
10
  };
 
 
 
 
 
8
  close: 'Close',
9
  noiframes: 'This feature requires inline frames. You have iframes disabled or your browser does not support them.'
10
  };
11
+
12
+ jQuery(function($) {
13
+ var selector = nextgen_lightbox_filter_selector($, $([]));
14
+ selector.addClass('thickbox');
15
+ });
products/photocrati_nextgen/modules/mediarss/class.mediarss_controller.php CHANGED
@@ -50,7 +50,7 @@ class Mixin_MediaRSS_Controller extends Mixin
50
  {
51
  // retrieve by transient id
52
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
53
- $displayed_gallery = $factory->create('displayed_gallery', $mapper);
54
  $displayed_gallery->apply_transient($transient_id);
55
  }
56
  elseif (($params = $this->object->param('params')))
@@ -58,7 +58,7 @@ class Mixin_MediaRSS_Controller extends Mixin
58
  // Create the displayed gallery based on the URL parameters
59
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
60
  $displayed_gallery = $factory->create(
61
- 'displayed_gallery', $mapper, json_decode($params)
62
  );
63
  }
64
 
50
  {
51
  // retrieve by transient id
52
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
53
+ $displayed_gallery = $factory->create('displayed_gallery', NULL, $mapper);
54
  $displayed_gallery->apply_transient($transient_id);
55
  }
56
  elseif (($params = $this->object->param('params')))
58
  // Create the displayed gallery based on the URL parameters
59
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
60
  $displayed_gallery = $factory->create(
61
+ 'displayed_gallery', json_decode($params), $mapper
62
  );
63
  }
64
 
products/photocrati_nextgen/modules/mediarss/module.mediarss.php CHANGED
@@ -13,7 +13,7 @@ class M_MediaRss extends C_Base_Module
13
  'photocrati-mediarss',
14
  'MediaRss',
15
  'Generates MediaRSS feeds of image collections',
16
- '0.1',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
13
  'photocrati-mediarss',
14
  'MediaRss',
15
  'Generates MediaRSS feeds of image collections',
16
+ '0.2',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/mediarss/templates/mediarss_feed.php CHANGED
@@ -4,11 +4,11 @@
4
  <generator><![CDATA[<?php echo_h($generator)?>]]></generator>
5
  <title><?php echo_h($feed_title) ?></title>
6
  <description><?php echo_h($feed_description) ?></description>
7
- <link><![CDATA[<?php echo esc_url($feed_link)?>]]></link>
8
  <?php foreach($images as $image): ?>
9
  <?php
10
- $image_url = $storage->get_image_url($image);
11
- $thumb_url = $storage->get_thumb_url($image);
12
  $thumb_size = $storage->get_thumb_dimensions($image);
13
  $width = $thumb_size['width'];
14
  $height = $thumb_size['height'];
@@ -16,14 +16,14 @@
16
  <item>
17
  <title><![CDATA[<?php echo_h($image->alttext)?>]]></title>
18
  <description><![CDATA[<?php echo_h($image->description)?>]]></description>
19
- <link><![CDATA[<?php echo esc_url($image_url)?>]]></link>
20
  <guid>image-id:<?php echo_h($image->id_field)?></guid>
21
- <media:content url="<?php echo esc_url($image_url)?>" medium="image" />
22
  <media:title><![CDATA[<?php echo_h($image->alttext)?>]]></media:title>
23
  <?php if (isset($description)): ?>
24
  <media:description><![CDDATA[<?php echo_h($image->description)?>]]></media:description>
25
  <?php endif ?>
26
- <media:thumbnail width="<?php echo esc_attr($width)?>" height="<?php echo esc_attr($height)?>" url="<?php echo esc_url($thumb_url) ?>"/>
27
  <?php if (isset($tagnames)): ?>
28
  <media:keywords><![CDATA[<?php echo_h($tagnames)?>]]></media:keywords>
29
  <?php endif ?>
4
  <generator><![CDATA[<?php echo_h($generator)?>]]></generator>
5
  <title><?php echo_h($feed_title) ?></title>
6
  <description><?php echo_h($feed_description) ?></description>
7
+ <link><![CDATA[<?php echo nextgen_esc_url($feed_link)?>]]></link>
8
  <?php foreach($images as $image): ?>
9
  <?php
10
+ $image_url = $storage->get_image_url($image, 'full', TRUE);
11
+ $thumb_url = $storage->get_thumb_url($image, TRUE);
12
  $thumb_size = $storage->get_thumb_dimensions($image);
13
  $width = $thumb_size['width'];
14
  $height = $thumb_size['height'];
16
  <item>
17
  <title><![CDATA[<?php echo_h($image->alttext)?>]]></title>
18
  <description><![CDATA[<?php echo_h($image->description)?>]]></description>
19
+ <link><![CDATA[<?php echo nextgen_esc_url($image_url)?>]]></link>
20
  <guid>image-id:<?php echo_h($image->id_field)?></guid>
21
+ <media:content url="<?php echo nextgen_esc_url($image_url)?>" medium="image" />
22
  <media:title><![CDATA[<?php echo_h($image->alttext)?>]]></media:title>
23
  <?php if (isset($description)): ?>
24
  <media:description><![CDDATA[<?php echo_h($image->description)?>]]></media:description>
25
  <?php endif ?>
26
+ <media:thumbnail width="<?php echo esc_attr($width)?>" height="<?php echo esc_attr($height)?>" url="<?php echo nextgen_esc_url($thumb_url) ?>"/>
27
  <?php if (isset($tagnames)): ?>
28
  <media:keywords><![CDATA[<?php echo_h($tagnames)?>]]></media:keywords>
29
  <?php endif ?>
products/photocrati_nextgen/modules/mediarss/templates/playlist_feed.php CHANGED
@@ -2,8 +2,8 @@
2
  <trackList>
3
  <?php foreach($images as $image): ?>
4
  <?php
5
- $image_url = $storage->get_image_url($image);
6
- $thumb_url = $storage->get_thumb_url($image);
7
  $thumb_size = $storage->get_thumb_dimensions($image);
8
  $width = $thumb_size['width'];
9
  $height = $thumb_size['height'];
@@ -18,7 +18,7 @@
18
  ?>
19
  <track>
20
  <title><![CDATA[<?php echo_h($image_title)?>]]></title>
21
- <location><![CDATA[<?php echo esc_url($image_url)?>]]></location>
22
  </track>
23
  <?php endforeach ?>
24
  </trackList>
2
  <trackList>
3
  <?php foreach($images as $image): ?>
4
  <?php
5
+ $image_url = $storage->get_image_url($image, 'full', TRUE);
6
+ $thumb_url = $storage->get_thumb_url($image, TRUE);
7
  $thumb_size = $storage->get_thumb_dimensions($image);
8
  $width = $thumb_size['width'];
9
  $height = $thumb_size['height'];
18
  ?>
19
  <track>
20
  <title><![CDATA[<?php echo_h($image_title)?>]]></title>
21
+ <location><![CDATA[<?php echo nextgen_esc_url($image_url)?>]]></location>
22
  </track>
23
  <?php endforeach ?>
24
  </trackList>
products/photocrati_nextgen/modules/mvc/template_helper.php CHANGED
@@ -23,4 +23,17 @@ if (strpos($_SERVER['REQUEST_URI'], 'adminer') === FALSE) {
23
  echo h($str);
24
  }
25
  }
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  echo h($str);
24
  }
25
  }
26
+
27
+ if (!function_exists('echo_safe_html')) {
28
+ function echo_safe_html($html, $extra_tags = null)
29
+ {
30
+ $tags = array('<a>', '<abbr>', '<acronym>', '<address>', '<b>', '<base>', '<basefont>', '<big>', '<blockquote>', '<br>', '<br/>', '<caption>', '<center>', '<cite>', '<code>', '<col>', '<colgroup>', '<dd>', '<del>', '<dfn>', '<dir>', '<div>', '<dl>', '<dt>', '<em>', '<fieldset>', '<font>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<hr>', '<i>', '<ins>', '<label>', '<legend>', '<li>', '<menu>', '<noframes>', '<noscript>', '<ol>', '<optgroup>', '<option>', '<p>', '<pre>', '<q>', '<s>', '<samp>', '<select>', '<small>', '<span>', '<strike>', '<strong>', '<sub>', '<sup>', '<table>', '<tbody>', '<td>', '<tfoot>', '<th>', '<thead>', '<tr>', '<tt>', '<u>', '<ul>');
31
+
32
+ $html = preg_replace('/\\s+on\\w+=(["\']).*?\\1/i', '', $html);
33
+ $html = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $html);
34
+ $html = strip_tags($html, implode('', $tags));
35
+
36
+ echo $html;
37
+ }
38
+ }
39
+ }
products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php CHANGED
@@ -58,7 +58,7 @@ class A_NextGen_AddGallery_Ajax extends Mixin
58
  $error = TRUE;
59
  }
60
  }
61
- catch (E_InsufficientWriteAccessException $ex) {
62
  $retval['error'] = $ex->getMessage();
63
  $error = TRUE;
64
  }
@@ -68,13 +68,13 @@ class A_NextGen_AddGallery_Ajax extends Mixin
68
  $error = TRUE;
69
  }
70
  }
71
- }
72
- else {
73
- $retval['error'] = "No permissions to upload images. Try refreshing the page.";
74
  $error = TRUE;
75
- }
76
 
77
- if ($error) header('HTTP/1.1 400 Bad Request');
78
  else $retval['gallery_name'] = esc_html($gallery_name);
79
 
80
  return $retval;
@@ -90,7 +90,7 @@ class A_NextGen_AddGallery_Ajax extends Mixin
90
  {
91
  if (($dir = urldecode($this->param('dir')))) {
92
  $fs = $this->get_registry()->get_utility('I_Fs');
93
- $root = path_join($fs->get_document_root(), 'wp-content');
94
 
95
  $browse_path = $fs->join_paths($root, $dir);
96
  if (@file_exists($browse_path)) {
@@ -100,7 +100,7 @@ class A_NextGen_AddGallery_Ajax extends Mixin
100
  $html[] = "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
101
  foreach( $files as $file ) {
102
  $file_path = path_join($browse_path, $file);
103
- $rel_file_path = str_replace(WP_CONTENT_DIR, '', $file_path);
104
  if(@file_exists($file_path) && $file != '.' && $file != '..' && is_dir($file_path) ) {
105
  $html[] = "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($rel_file_path) . "/\">" . htmlentities($file) . "</a></li>";
106
  }
@@ -118,7 +118,7 @@ class A_NextGen_AddGallery_Ajax extends Mixin
118
  }
119
  }
120
  else {
121
- $retval['error'] = "No permissions to browse folders. Try refreshing the page.";
122
  }
123
 
124
  return $retval;
@@ -132,23 +132,27 @@ class A_NextGen_AddGallery_Ajax extends Mixin
132
  if ($this->validate_ajax_request('nextgen_upload_image'))
133
  {
134
  if (($folder = $this->param('folder'))) {
135
- $storage = $this->get_registry()->get_utility('I_Gallery_Storage');
136
- $fs = $this->get_registry()->get_utility('I_Fs');
137
  try {
138
- $keep_files = $this->param('keep_location') == 'on';
139
- $retval = $storage->import_gallery_from_fs($fs->join_paths($fs->get_document_root(), 'wp-content', $folder), false, !$keep_files);
140
  if (!$retval) $retval = array('error' => "Could not import folder. No images found.");
141
  }
142
- catch (Exception $ex) {
143
- $retval['error'] = $ex->getMessage();
144
- }
 
 
 
 
145
  }
146
  else {
147
  $retval['error'] = "No folder specified";
148
  }
149
  }
150
  else {
151
- $retval['error'] = "No permissions to import folders. Try refreshing the page.";
152
  }
153
 
154
  return $retval;
58
  $error = TRUE;
59
  }
60
  }
61
+ catch (E_NggErrorException $ex) {
62
  $retval['error'] = $ex->getMessage();
63
  $error = TRUE;
64
  }
68
  $error = TRUE;
69
  }
70
  }
71
+ }
72
+ else {
73
+ $retval['error'] = "No permissions to upload images. Try refreshing the page or ensuring that your user account has sufficient roles/privileges.";
74
  $error = TRUE;
75
+ }
76
 
77
+ if ($error) return $retval;
78
  else $retval['gallery_name'] = esc_html($gallery_name);
79
 
80
  return $retval;
90
  {
91
  if (($dir = urldecode($this->param('dir')))) {
92
  $fs = $this->get_registry()->get_utility('I_Fs');
93
+ $root = NEXTGEN_GALLERY_IMPORT_ROOT;
94
 
95
  $browse_path = $fs->join_paths($root, $dir);
96
  if (@file_exists($browse_path)) {
100
  $html[] = "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
101
  foreach( $files as $file ) {
102
  $file_path = path_join($browse_path, $file);
103
+ $rel_file_path = str_replace($root, '', $file_path);
104
  if(@file_exists($file_path) && $file != '.' && $file != '..' && is_dir($file_path) ) {
105
  $html[] = "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($rel_file_path) . "/\">" . htmlentities($file) . "</a></li>";
106
  }
118
  }
119
  }
120
  else {
121
+ $retval['error'] = "No permissions to browse folders. Try refreshing the page or ensuring that your user account has sufficient roles/privileges.";
122
  }
123
 
124
  return $retval;
132
  if ($this->validate_ajax_request('nextgen_upload_image'))
133
  {
134
  if (($folder = $this->param('folder'))) {
135
+ $storage = C_Gallery_Storage::get_instance();
136
+ $fs = C_Fs::get_instance();
137
  try {
138
+ $keep_files = $this->param('keep_location') == 'on';
139
+ $retval = $storage->import_gallery_from_fs($fs->join_paths(NEXTGEN_GALLERY_IMPORT_ROOT, $folder), false, !$keep_files);
140
  if (!$retval) $retval = array('error' => "Could not import folder. No images found.");
141
  }
142
+ catch (E_NggErrorException $ex) {
143
+ $retval['error'] = $ex->getMessage();
144
+ }
145
+ catch (Exception $ex) {
146
+ $retval['error'] = "An unexpected error occured.";
147
+ $retval['error_details'] = $ex->getMessage();
148
+ }
149
  }
150
  else {
151
  $retval['error'] = "No folder specified";
152
  }
153
  }
154
  else {
155
+ $retval['error'] = "No permissions to import folders. Try refreshing the page or ensuring that your user account has sufficient roles/privileges.";
156
  }
157
 
158
  return $retval;
products/photocrati_nextgen/modules/nextgen_addgallery_page/module.nextgen_addgallery_page.php CHANGED
@@ -15,7 +15,7 @@ class M_NextGen_AddGallery_Page extends C_Base_Module
15
  'photocrati-nextgen_addgallery_page',
16
  'NextGEN Add Gallery Page',
17
  'Provides admin page for adding a gallery and uploading images',
18
- '0.2',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
15
  'photocrati-nextgen_addgallery_page',
16
  'NextGEN Add Gallery Page',
17
  'Provides admin page for adding a gallery and uploading images',
18
+ '0.3',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_folder.php CHANGED
@@ -50,13 +50,12 @@
50
  $.post(photocrati_ajax.url, post_params, function(response){
51
  if (typeof(response) != 'object') response = JSON.parse(response);
52
  if (typeof(response.error) == 'string') {
53
- progress_bar.set("Error occurred");
54
- alert(response.error);
55
  }
56
  else {
57
  progress_bar.set('Done! Successfully imported '+response.image_ids.length+' images.');
58
  }
59
- progress_bar.close();
60
  });
61
  })
62
  });
50
  $.post(photocrati_ajax.url, post_params, function(response){
51
  if (typeof(response) != 'object') response = JSON.parse(response);
52
  if (typeof(response.error) == 'string') {
53
+ progress_bar.set(response.error);
 
54
  }
55
  else {
56
  progress_bar.set('Done! Successfully imported '+response.image_ids.length+' images.');
57
  }
58
+ progress_bar.close(2000);
59
  });
60
  })
61
  });
products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php CHANGED
@@ -159,11 +159,21 @@
159
 
160
  // Display message/notification
161
  if (up.state == plupload.STOPPED) {
162
- $.gritter.add({
163
- title: "Upload complete",
164
- text: msg,
165
- sticky: true
166
- });
 
 
 
 
 
 
 
 
 
 
167
  setTimeout(function(){
168
  reinit_plupload(up);
169
  }, 3000);
@@ -187,28 +197,40 @@
187
  return;
188
  }
189
  }
190
- window.uploaded_image_ids = window.uploaded_image_ids.concat(response.image_ids);
191
- up.settings.url = window.set_plupload_url(response.gallery_id, $gallery_name.val());
192
-
193
- // If we created a new gallery, ensure it's now in the drop-down list, and select it
194
- if ($gallery_id.find('option[value="'+response.gallery_id+'"]').length == 0) {
195
- var option = $('<option/>').attr('value', response.gallery_id).text(response.gallery_name);
196
- $gallery_id.append(option);
197
- $gallery_id.val(response.gallery_id);
198
- option.attr('selected', 'selected');
199
- }
200
-
201
- // our Frame-Event-Publisher hooks onto the jQuery ajaxComplete action which plupload
202
- // of course does not honor. Tie them together here..
203
- if (window.Frame_Event_Publisher) {
204
- $.post(photocrati_ajax.url, {'action': 'cookie_dump'}, function(){
205
- window.Frame_Event_Publisher.find_parent(window).broadcast();
206
  });
207
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  },
209
 
210
  Error: function(up, args){
211
- if (typeof(window.console) != 'undefined') console.log(args);
 
 
212
  }
213
  };
214
  $("#uploader").pluploadQueue(plupload_options);
159
 
160
  // Display message/notification
161
  if (up.state == plupload.STOPPED) {
162
+ if (typeof(up.error_msg) != 'undefined') {
163
+ $.gritter.add({
164
+ title: up.error_msg,
165
+ text: msg,
166
+ sticky: true
167
+ });
168
+ }
169
+ else {
170
+ $.gritter.add({
171
+ title: "Upload complete",
172
+ text: msg,
173
+ sticky: true
174
+ });
175
+ }
176
+
177
  setTimeout(function(){
178
  reinit_plupload(up);
179
  }, 3000);
197
  return;
198
  }
199
  }
200
+ if(typeof(response.error) != 'undefined') {
201
+ up.trigger('Error', {
202
+ code: plupload.IO_ERROR,
203
+ msg: response.error,
204
+ details: response,
205
+ file: file
 
 
 
 
 
 
 
 
 
 
206
  });
207
+ }
208
+ else {
209
+ window.uploaded_image_ids = window.uploaded_image_ids.concat(response.image_ids);
210
+ up.settings.url = window.set_plupload_url(response.gallery_id, $gallery_name.val());
211
+
212
+ // If we created a new gallery, ensure it's now in the drop-down list, and select it
213
+ if ($gallery_id.find('option[value="'+response.gallery_id+'"]').length == 0) {
214
+ var option = $('<option/>').attr('value', response.gallery_id).text(response.gallery_name);
215
+ $gallery_id.append(option);
216
+ $gallery_id.val(response.gallery_id);
217
+ option.attr('selected', 'selected');
218
+ }
219
+
220
+ // our Frame-Event-Publisher hooks onto the jQuery ajaxComplete action which plupload
221
+ // of course does not honor. Tie them together here..
222
+ if (window.Frame_Event_Publisher) {
223
+ $.post(photocrati_ajax.url, {'action': 'cookie_dump'}, function(){
224
+ window.Frame_Event_Publisher.find_parent(window).broadcast();
225
+ });
226
+ }
227
+ }
228
  },
229
 
230
  Error: function(up, args){
231
+ if (typeof(up.error_msg) == 'undefined') {
232
+ up.error_msg = args.msg;
233
+ }{}
234
  }
235
  };
236
  $("#uploader").pluploadQueue(plupload_options);
products/photocrati_nextgen/modules/nextgen_admin/class.form.php CHANGED
@@ -223,11 +223,13 @@ class Mixin_Form_Field_Generators extends Mixin
223
 
224
  function _render_thumbnail_override_settings_field($display_type)
225
  {
 
 
226
  $override_field = $this->_render_radio_field(
227
  $display_type,
228
  'override_thumbnail_settings',
229
  'Override thumbnail settings',
230
- $display_type->settings['override_thumbnail_settings'],
231
  "This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails. To change the size of existing thumbnails please visit 'Manage Galleries' and choose 'Create new thumbnails' for all images in the gallery."
232
  );
233
 
@@ -237,9 +239,9 @@ class Mixin_Form_Field_Generators extends Mixin
237
  'display_type_name' => $display_type->name,
238
  'name' => 'thumbnail_dimensions',
239
  'label'=> _('Thumbnail dimensions'),
240
- 'thumbnail_width' => $display_type->settings['thumbnail_width'],
241
- 'thumbnail_height'=> $display_type->settings['thumbnail_height'],
242
- 'hidden' => empty($display_type->settings['override_thumbnail_settings']) ? 'hidden' : '',
243
  'text' => ''
244
  ),
245
  TRUE
@@ -252,27 +254,27 @@ class Mixin_Form_Field_Generators extends Mixin
252
  'thumbnail_quality',
253
  'Thumbnail quality',
254
  $qualities,
255
- $display_type->settings['thumbnail_quality'],
256
  '',
257
- empty($display_type->settings['override_thumbnail_settings']) ? TRUE : FALSE
258
  );
259
 
260
  $crop_field = $this->_render_radio_field(
261
  $display_type,
262
  'thumbnail_crop',
263
  'Thumbnail crop',
264
- $display_type->settings['thumbnail_crop'],
265
  '',
266
- empty($display_type->settings['override_thumbnail_settings']) ? TRUE : FALSE
267
  );
268
 
269
  $watermark_field = $this->_render_radio_field(
270
  $display_type,
271
  'thumbnail_watermark',
272
  'Thumbnail watermark',
273
- $display_type->settings['thumbnail_watermark'],
274
  '',
275
- empty($display_type->settings['override_thumbnail_settings']) ? TRUE : FALSE
276
  );
277
 
278
  $everything = $override_field . $dimensions_field . $quality_field . $crop_field . $watermark_field;
@@ -289,11 +291,13 @@ class Mixin_Form_Field_Generators extends Mixin
289
  */
290
  function _render_image_override_settings_field($display_type)
291
  {
 
 
292
  $override_field = $this->_render_radio_field(
293
  $display_type,
294
  'override_image_settings',
295
  'Override image settings',
296
- $display_type->settings['override_image_settings'],
297
  'Overriding the image settings will create an additional set of images'
298
  );
299
 
@@ -306,7 +310,7 @@ class Mixin_Form_Field_Generators extends Mixin
306
  $qualities,
307
  $display_type->settings['image_quality'],
308
  '',
309
- empty($display_type->settings['override_image_settings']) ? TRUE : FALSE
310
  );
311
 
312
  $crop_field = $this->_render_radio_field(
@@ -315,7 +319,7 @@ class Mixin_Form_Field_Generators extends Mixin
315
  'Image crop',
316
  $display_type->settings['image_crop'],
317
  '',
318
- empty($display_type->settings['override_image_settings']) ? TRUE : FALSE
319
  );
320
 
321
  $watermark_field = $this->_render_radio_field(
@@ -324,7 +328,7 @@ class Mixin_Form_Field_Generators extends Mixin
324
  'Image watermark',
325
  $display_type->settings['image_watermark'],
326
  '',
327
- empty($display_type->settings['override_image_settings']) ? TRUE : FALSE
328
  );
329
 
330
  $everything = $override_field . $quality_field . $crop_field . $watermark_field;
223
 
224
  function _render_thumbnail_override_settings_field($display_type)
225
  {
226
+ $hidden = !(isset($display_type->settings['override_thumbnail_settings']) ? $display_type->settings['override_thumbnail_settings'] : FALSE);
227
+
228
  $override_field = $this->_render_radio_field(
229
  $display_type,
230
  'override_thumbnail_settings',
231
  'Override thumbnail settings',
232
+ isset($display_type->settings['override_thumbnail_settings']) ? $display_type->settings['override_thumbnail_settings'] : FALSE,
233
  "This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails. To change the size of existing thumbnails please visit 'Manage Galleries' and choose 'Create new thumbnails' for all images in the gallery."
234
  );
235
 
239
  'display_type_name' => $display_type->name,
240
  'name' => 'thumbnail_dimensions',
241
  'label'=> _('Thumbnail dimensions'),
242
+ 'thumbnail_width' => isset($display_type->settings['thumbnail_width']) ? $display_type->settings['thumbnail_width'] : 0,
243
+ 'thumbnail_height'=> isset($display_type->settings['thumbnail_height']) ? $display_type->settings['thumbnail_height'] : 0,
244
+ 'hidden' => $hidden ? 'hidden' : '',
245
  'text' => ''
246
  ),
247
  TRUE
254
  'thumbnail_quality',
255
  'Thumbnail quality',
256
  $qualities,
257
+ isset($display_type->settings['thumbnail_quality']) ? $display_type->settings['thumbnail_quality'] : 100,
258
  '',
259
+ $hidden
260
  );
261
 
262
  $crop_field = $this->_render_radio_field(
263
  $display_type,
264
  'thumbnail_crop',
265
  'Thumbnail crop',
266
+ isset($display_type->settings['thumbnail_crop']) ? $display_type->settings['thumbnail_crop'] : FALSE,
267
  '',
268
+ $hidden
269
  );
270
 
271
  $watermark_field = $this->_render_radio_field(
272
  $display_type,
273
  'thumbnail_watermark',
274
  'Thumbnail watermark',
275
+ isset($display_type->settings['thumbnail_watermark']) ? $display_type->settings['thumbnail_watermark'] : FALSE,
276
  '',
277
+ $hidden
278
  );
279
 
280
  $everything = $override_field . $dimensions_field . $quality_field . $crop_field . $watermark_field;
291
  */
292
  function _render_image_override_settings_field($display_type)
293
  {
294
+ $hidden = !(isset($display_type->settings['override_image_settings']) ? $display_type->settings['override_image_settings'] : FALSE);
295
+
296
  $override_field = $this->_render_radio_field(
297
  $display_type,
298
  'override_image_settings',
299
  'Override image settings',
300
+ isset($display_type->settings['override_image_settings']) ? $display_type->settings['override_image_settings'] : 0,
301
  'Overriding the image settings will create an additional set of images'
302
  );
303
 
310
  $qualities,
311
  $display_type->settings['image_quality'],
312
  '',
313
+ $hidden
314
  );
315
 
316
  $crop_field = $this->_render_radio_field(
319
  'Image crop',
320
  $display_type->settings['image_crop'],
321
  '',
322
+ $hidden
323
  );
324
 
325
  $watermark_field = $this->_render_radio_field(
328
  'Image watermark',
329
  $display_type->settings['image_watermark'],
330
  '',
331
+ $hidden
332
  );
333
 
334
  $everything = $override_field . $quality_field . $crop_field . $watermark_field;
products/photocrati_nextgen/modules/nextgen_admin/class.nextgen_admin_page_controller.php CHANGED
@@ -82,6 +82,8 @@ class Mixin_NextGen_Admin_Page_Instance_Methods extends Mixin
82
  */
83
  function enqueue_backend_resources()
84
  {
 
 
85
  wp_enqueue_script('jquery');
86
  $this->object->enqueue_jquery_ui_theme();
87
  wp_enqueue_script('jquery-ui-accordion');
@@ -114,6 +116,15 @@ class Mixin_NextGen_Admin_Page_Instance_Methods extends Mixin
114
  // Ensure select2
115
  wp_enqueue_style('select2');
116
  wp_enqueue_script('select2');
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  function enqueue_jquery_ui_theme()
82
  */
83
  function enqueue_backend_resources()
84
  {
85
+ $atp = $this->object->get_registry()->get_utility('I_Attach_To_Post_Controller');
86
+
87
  wp_enqueue_script('jquery');
88
  $this->object->enqueue_jquery_ui_theme();
89
  wp_enqueue_script('jquery-ui-accordion');
116
  // Ensure select2
117
  wp_enqueue_style('select2');
118
  wp_enqueue_script('select2');
119
+
120
+ if ($atp != null) {
121
+ $atp->mark_script('jquery-ui-accordion');
122
+ $atp->mark_script('nextgen_display_settings_page_placeholder_stub');
123
+ $atp->mark_script('iris');
124
+ $atp->mark_script('wp-color-picker');
125
+ $atp->mark_script('nextgen_admin_page');
126
+ $atp->mark_script('select2');
127
+ }
128
  }
129
 
130
  function enqueue_jquery_ui_theme()
products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php CHANGED
@@ -19,7 +19,7 @@ class M_NextGen_Admin extends C_Base_Module
19
  'photocrati-nextgen_admin',
20
  'NextGEN Administration',
21
  'Provides a framework for adding Administration pages',
22
- '0.4',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
@@ -92,7 +92,7 @@ class M_NextGen_Admin extends C_Base_Module
92
  function _register_hooks()
93
  {
94
  // Register scripts
95
- add_action('init', array(&$this, 'register_scripts'));
96
 
97
  // Provides menu options for managing NextGEN Settings
98
  add_action('admin_menu', array(&$this, 'add_menu_pages'), 999);
19
  'photocrati-nextgen_admin',
20
  'NextGEN Administration',
21
  'Provides a framework for adding Administration pages',
22
+ '0.5',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
92
  function _register_hooks()
93
  {
94
  // Register scripts
95
+ add_action('init', array(&$this, 'register_scripts'), 9);
96
 
97
  // Provides menu options for managing NextGEN Settings
98
  add_action('admin_menu', array(&$this, 'add_menu_pages'), 999);
products/photocrati_nextgen/modules/nextgen_admin/templates/field_generator/nextgen_settings_field_color.php CHANGED
@@ -11,7 +11,6 @@
11
  id='<?php print esc_attr("{$display_type_name}_{$name}"); ?>'
12
  name='<?php print esc_attr("{$display_type_name}[{$name}]"); ?>'
13
  class='<?php print esc_attr("{$display_type_name}_{$name}"); ?> nextgen_settings_field_colorpicker'
14
- value='<?php print esc_attr($value); ?>'
15
- data-default-color='<?php print esc_attr($value); ?>'/>
16
  </td>
17
  </tr>
11
  id='<?php print esc_attr("{$display_type_name}_{$name}"); ?>'
12
  name='<?php print esc_attr("{$display_type_name}[{$name}]"); ?>'
13
  class='<?php print esc_attr("{$display_type_name}_{$name}"); ?> nextgen_settings_field_colorpicker'
14
+ value='<?php print esc_attr($value); ?>'/>
 
15
  </td>
16
  </tr>
products/photocrati_nextgen/modules/nextgen_admin/templates/nextgen_admin_page.php CHANGED
@@ -10,7 +10,7 @@
10
  <p><?php echo_h($success);?></p>
11
  </div>
12
  <?php endif ?>
13
- <form method="POST" action="<?php echo esc_url($_SERVER['REQUEST_URI'])?>">
14
  <?php if (isset($form_header)): ?>
15
  <?php echo $form_header."\n"; ?>
16
  <?php endif ?>
10
  <p><?php echo_h($success);?></p>
11
  </div>
12
  <?php endif ?>
13
+ <form method="POST" action="<?php echo nextgen_esc_url($_SERVER['REQUEST_URI'])?>">
14
  <?php if (isset($form_header)): ?>
15
  <?php echo $form_header."\n"; ?>
16
  <?php endif ?>
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_controller.php CHANGED
@@ -27,19 +27,21 @@ class A_NextGen_Basic_Album_Controller extends Mixin
27
  // /nggallery/album--id/gallery--id
28
 
29
  // Are we to display a gallery?
30
- if (($gallery = $this->param('gallery')))
31
  {
32
  // basic albums only support one per post
33
  if (isset($GLOBALS['nggShowGallery']))
34
  return;
35
  $GLOBALS['nggShowGallery'] = TRUE;
36
 
37
- if (!is_numeric($gallery))
38
- {
39
- $mapper = $this->object->get_registry()->get_utility('I_Gallery_Mapper');
40
- $result = reset($mapper->select()->where(array('slug = %s', $gallery))->limit(1)->run_query());
41
- $gallery = $result->{$result->id_field};
42
- }
 
 
43
 
44
  $renderer = $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
45
  return $renderer->display_images(
@@ -106,6 +108,7 @@ class A_NextGen_Basic_Album_Controller extends Mixin
106
  else {
107
  $params = $display_settings;
108
  $albums = $this->prepare_legacy_album_params($displayed_gallery->get_entity(), array('entities' => $entities));;
 
109
  $params['galleries'] = $albums['galleries'];
110
  $params['displayed_gallery'] = $displayed_gallery;
111
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
@@ -173,6 +176,9 @@ class A_NextGen_Basic_Album_Controller extends Mixin
173
  );
174
  }
175
 
 
 
 
176
  // Transform entities
177
  $params['galleries'] = $params['entities'];
178
  unset($params['entities']);
@@ -185,7 +191,7 @@ class A_NextGen_Basic_Album_Controller extends Mixin
185
  {
186
  if (($image = $image_mapper->find(intval($gallery->previewpic))))
187
  {
188
- $gallery->previewurl = $storage->get_image_url($image, $image_gen->get_size_name($image_gen_params));
189
  $gallery->previewname = $gallery->name;
190
  }
191
  }
@@ -209,9 +215,10 @@ class A_NextGen_Basic_Album_Controller extends Mixin
209
  // Otherwise, if it's a gallery then it will look like
210
  // /nggallery/album--slug/gallery--slug
211
  else {
212
- if ($gallery->pageid > 0)
213
- $gallery->pagelink = get_post_permalink($gallery->pageid);
214
- else {
 
215
  $pagelink = $this->object->get_routed_url(TRUE);
216
  $parent_album = $this->object->get_parent_album_for($gallery->$id_field);
217
  if ($parent_album) {
27
  // /nggallery/album--id/gallery--id
28
 
29
  // Are we to display a gallery?
30
+ if (($gallery = $gallery_slug = $this->param('gallery')))
31
  {
32
  // basic albums only support one per post
33
  if (isset($GLOBALS['nggShowGallery']))
34
  return;
35
  $GLOBALS['nggShowGallery'] = TRUE;
36
 
37
+ // Try finding the gallery by slug first. If nothing is found, we assume that
38
+ // the user passed in a gallery id instead
39
+ $mapper = $this->object->get_registry()->get_utility('I_Gallery_Mapper');
40
+ $result = reset($mapper->select()->where(array('slug = %s', $gallery))->limit(1)->run_query());
41
+ if ($result) {
42
+ $gallery = $result->{$result->id_field};
43
+ }
44
+
45
 
46
  $renderer = $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
47
  return $renderer->display_images(
108
  else {
109
  $params = $display_settings;
110
  $albums = $this->prepare_legacy_album_params($displayed_gallery->get_entity(), array('entities' => $entities));;
111
+ $params['image_gen_params'] = $albums['image_gen_params'];
112
  $params['galleries'] = $albums['galleries'];
113
  $params['displayed_gallery'] = $displayed_gallery;
114
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
176
  );
177
  }
178
 
179
+ // so user templates can know how big the images are expected to be
180
+ $params['image_gen_params'] = $image_gen_params;
181
+
182
  // Transform entities
183
  $params['galleries'] = $params['entities'];
184
  unset($params['entities']);
191
  {
192
  if (($image = $image_mapper->find(intval($gallery->previewpic))))
193
  {
194
+ $gallery->previewurl = $storage->get_image_url($image, $image_gen->get_size_name($image_gen_params), TRUE);
195
  $gallery->previewname = $gallery->name;
196
  }
197
  }
215
  // Otherwise, if it's a gallery then it will look like
216
  // /nggallery/album--slug/gallery--slug
217
  else {
218
+ if ($gallery->pageid > 0) {
219
+ $gallery->pagelink = @get_post_permalink($gallery->pageid);
220
+ }
221
+ if (empty($gallery->pagelink)) {
222
  $pagelink = $this->object->get_routed_url(TRUE);
223
  $parent_album = $this->object->get_parent_album_for($gallery->$id_field);
224
  if ($parent_album) {
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_mapper.php CHANGED
@@ -21,7 +21,7 @@ class Hook_NextGen_Basic_Album_Defaults extends Hook
21
  {
22
  function set_defaults($entity)
23
  {
24
- if (in_array($entity->name, array(
25
  NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM,
26
  NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM))) {
27
 
21
  {
22
  function set_defaults($entity)
23
  {
24
+ if (isset($entity->name) && in_array($entity->name, array(
25
  NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM,
26
  NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM))) {
27
 
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_routes.php CHANGED
@@ -22,20 +22,21 @@ class A_NextGen_Basic_Album_Routes extends Mixin
22
  // Get router
23
  $router = $this->get_registry()->get_utility('I_Router');
24
  $app = $router->get_routed_app();
25
- $slug = C_NextGen_Settings::get_instance()->router_param_slug;
26
 
27
  // If we're viewing an album, rewrite the urls
28
- $regex = "/photocrati-nextgen_basic_\w+_album/";
29
  if (preg_match($regex, $display_type)) {
30
- $app->rewrite("{$slug}/pid--{*}", "{$slug}/pid--{1}", FALSE, TRUE); // avoid conflicts with imagebrowser
31
- $app->rewrite("{$slug}/{\\w}", "{$slug}/album--{1}");
32
- $app->rewrite("{$slug}/{\\w}/{\\w}", "{$slug}/album--{1}/gallery--{2}");
33
- $app->rewrite("{$slug}/{\\w}/{\\w}/{\\w}{*}", "{$slug}/album--{1}/gallery--{2}/{3}{4}");
 
34
  }
35
  elseif (preg_match($regex, $original_display_type)) {
36
- $app->rewrite("{$slug}/album--{\\w}", "{$slug}/{1}");
37
- $app->rewrite("{$slug}/album--{\\w}/gallery--{\\w}", "{$slug}/{1}/{2}");
38
- $app->rewrite("{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{$slug}/{1}/{2}/{3}");
39
  }
40
 
41
  // Perform rewrites
22
  // Get router
23
  $router = $this->get_registry()->get_utility('I_Router');
24
  $app = $router->get_routed_app();
25
+ $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug;
26
 
27
  // If we're viewing an album, rewrite the urls
28
+ $regex = "/photocrati-nextgen_basic_\\w+_album/";
29
  if (preg_match($regex, $display_type)) {
30
+ $app->rewrite("{*}{$slug}/page/{\\d}{*}", "{1}{$slug}/page--{2}{3}", FALSE, TRUE);
31
+ $app->rewrite("{*}{$slug}/pid--{*}", "{1}{$slug}/pid--{2}", FALSE, TRUE); // avoid conflicts with imagebrowser
32
+ $app->rewrite("{*}{$slug}/{\\w}", "{1}{$slug}/album--{2}");
33
+ $app->rewrite("{*}{$slug}/{\\w}/{\\w}", "{1}{$slug}/album--{2}/gallery--{3}");
34
+ $app->rewrite("{*}{$slug}/{\\w}/{\\w}/{\\w}{*}", "{1}{$slug}/album--{2}/gallery--{3}/{4}{5}");
35
  }
36
  elseif (preg_match($regex, $original_display_type)) {
37
+ $app->rewrite("{*}{$slug}/album--{\\w}", "{1}{$slug}/{2}");
38
+ $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}", "{1}{$slug}/{2}/{3}");
39
+ $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{1}{$slug}/{2}/{3}/{4}");
40
  }
41
 
42
  // Perform rewrites
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_compact_album_form.php CHANGED
@@ -27,5 +27,9 @@ class A_NextGen_Basic_Compact_Album_Form extends Mixin_NextGen_Basic_Album_Form
27
  $this->object->get_static_url('photocrati-nextgen_basic_album#compact_settings.js'),
28
  array('jquery.nextgen_radio_toggle')
29
  );
 
 
 
 
30
  }
31
  }
27
  $this->object->get_static_url('photocrati-nextgen_basic_album#compact_settings.js'),
28
  array('jquery.nextgen_radio_toggle')
29
  );
30
+
31
+
32
+ if ($atp != null) {
33
+ $atp->mark_script('nextgen_basic_compact_albums_settings_script');
34
  }
35
  }
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_extended_album_form.php CHANGED
@@ -27,5 +27,9 @@ class A_NextGen_Basic_Extended_Album_Form extends Mixin_NextGen_Basic_Album_Form
27
  $this->object->get_static_url('photocrati-nextgen_basic_album#extended_settings.js'),
28
  array('jquery.nextgen_radio_toggle')
29
  );
 
 
 
 
30
  }
31
  }
27
  $this->object->get_static_url('photocrati-nextgen_basic_album#extended_settings.js'),
28
  array('jquery.nextgen_radio_toggle')
29
  );
30
+
31
+
32
+ if ($atp != null) {
33
+ $atp->mark_script('nextgen_basic_extended_albums_settings_script');
34
  }
35
  }
products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php CHANGED
@@ -18,7 +18,7 @@ class M_NextGen_Basic_Album extends C_Base_Module
18
  'photocrati-nextgen_basic_album',
19
  'NextGEN Basic Album',
20
  "Provides support for NextGEN's Basic Album",
21
- '0.4',
22
  'http://nextgen-gallery.com',
23
  'Photocrati Media',
24
  'http://www.photocrati.com'
@@ -60,17 +60,19 @@ class M_NextGen_Basic_Album extends C_Base_Module
60
  'A_NextGen_Basic_Album_Routes'
61
  );
62
 
63
- // Add a display settings form for each display type
64
- $this->get_registry()->add_adapter(
65
- 'I_Form',
66
- 'A_NextGen_Basic_Compact_Album_Form',
67
- NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM
68
- );
69
- $this->get_registry()->add_adapter(
70
- 'I_Form',
71
- 'A_NextGen_Basic_Extended_Album_Form',
72
- NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM
73
- );
 
 
74
 
75
  // Creates special parameter segments
76
  $this->get_registry()->add_adapter(
@@ -78,10 +80,12 @@ class M_NextGen_Basic_Album extends C_Base_Module
78
  'A_NextGen_Basic_Album_Urls'
79
  );
80
 
81
- $this->get_registry()->add_adapter(
82
- 'I_Form_Manager',
83
- 'A_NextGen_Basic_Album_Forms'
84
- );
 
 
85
  }
86
 
87
  function _register_hooks()
18
  'photocrati-nextgen_basic_album',
19
  'NextGEN Basic Album',
20
  "Provides support for NextGEN's Basic Album",
21
+ '0.5',
22
  'http://nextgen-gallery.com',
23
  'Photocrati Media',
24
  'http://www.photocrati.com'
60
  'A_NextGen_Basic_Album_Routes'
61
  );
62
 
63
+ if (is_admin()) {
64
+ // Add a display settings form for each display type
65
+ $this->get_registry()->add_adapter(
66
+ 'I_Form',
67
+ 'A_NextGen_Basic_Compact_Album_Form',
68
+ NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM
69
+ );
70
+ $this->get_registry()->add_adapter(
71
+ 'I_Form',
72
+ 'A_NextGen_Basic_Extended_Album_Form',
73
+ NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM
74
+ );
75
+ }
76
 
77
  // Creates special parameter segments
78
  $this->get_registry()->add_adapter(
80
  'A_NextGen_Basic_Album_Urls'
81
  );
82
 
83
+ if (is_admin()) {
84
+ $this->get_registry()->add_adapter(
85
+ 'I_Form_Manager',
86
+ 'A_NextGen_Basic_Album_Forms'
87
+ );
88
+ }
89
  }
90
 
91
  function _register_hooks()
products/photocrati_nextgen/modules/nextgen_basic_album/static/nextgen_basic_album.css CHANGED
@@ -49,36 +49,61 @@
49
 
50
  .ngg-album-compact {
51
  float: left;
52
- height: 180px;
53
- padding: 0 6px 4px 0 !important;
54
  margin: 0px !important;
55
  text-align: left;
56
- width: 120px;
 
 
 
57
  }
58
 
59
  .ngg-album-compactbox {
60
- background: transparent url(albumset.gif) no-repeat scroll 0%;
61
- height: 88px;
62
- margin: 0pt 0pt 6px !important;
63
- padding: 8px 0pt 0pt 8px !important;
64
- width: 120px;
65
  box-sizing: border-box;
66
  -moz-box-sizing: border-box;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
 
69
  .ngg-album-compactbox .Thumb {
70
  margin: 0px !important;
71
  padding: 0px 0 0 0 !important;
72
- width: 91px;
73
- height: 68px;
74
- border: none;
75
  }
76
 
77
  .ngg-album-compact h4 {
78
  font-size: 15px;
79
  font-weight: bold;
80
- width: 110px;
81
  margin: 0;
 
82
  }
83
 
84
  .ngg-album-compact h4 .ngg-album-desc {
49
 
50
  .ngg-album-compact {
51
  float: left;
52
+ padding: 0 12px 4px 0 !important;
 
53
  margin: 0px !important;
54
  text-align: left;
55
+ }
56
+
57
+ .ngg-album-compact a {
58
+ border: none;
59
  }
60
 
61
  .ngg-album-compactbox {
62
+ margin: 0 !important;
63
+ padding: 8px !important;
 
 
 
64
  box-sizing: border-box;
65
  -moz-box-sizing: border-box;
66
+ position: relative;
67
+ border: 1px solid gray;
68
+ border-radius: 6px;
69
+ z-index: 1;
70
+ }
71
+
72
+ .ngg-album-compactbox:before {
73
+ content: ' ';
74
+ position: absolute;
75
+ top: 0;
76
+ left: 0;
77
+ right: 0;
78
+ bottom: -7px;
79
+ border-bottom: 1px solid gray;
80
+ border-radius: 6px;
81
+ z-index: -1;
82
+ }
83
+
84
+ .ngg-album-compactbox:after {
85
+ content: ' ';
86
+ position: absolute;
87
+ top: 0;
88
+ left: 0;
89
+ right: 0;
90
+ bottom: -4px;
91
+ border-bottom: 1px solid gray;
92
+ border-radius: 6px;
93
+ z-index: -1;
94
  }
95
 
96
  .ngg-album-compactbox .Thumb {
97
  margin: 0px !important;
98
  padding: 0px 0 0 0 !important;
99
+ border: 1px solid black !important;
 
 
100
  }
101
 
102
  .ngg-album-compact h4 {
103
  font-size: 15px;
104
  font-weight: bold;
 
105
  margin: 0;
106
+ margin-top: 10px;
107
  }
108
 
109
  .ngg-album-compact h4 .ngg-album-desc {
products/photocrati_nextgen/modules/nextgen_basic_album/templates/compact.php CHANGED
@@ -4,18 +4,25 @@
4
  <div class="ngg-album-compact">
5
  <div class="ngg-album-compactbox">
6
  <div class="ngg-album-link">
7
- <a class="Link" href="<?php echo $gallery->pagelink; ?>">
8
  <img class="Thumb"
9
- alt="<?php echo $gallery->title; ?>"
10
- src="<?php echo $gallery->previewurl; ?>"/>
11
  </a>
12
  </div>
13
  </div>
 
 
 
 
 
14
  <h4>
15
  <a class="ngg-album-desc"
16
- title="<?php echo $gallery->title; ?>"
17
- href="<?php echo $gallery->pagelink; ?>"
18
- ><?php echo $gallery->title; ?></a>
 
 
19
  </h4>
20
  <?php if (isset($gallery->counter) && $gallery->counter > 0) { ?>
21
  <p><strong><?php echo $gallery->counter; ?></strong>&nbsp;<?php _e('Photos', 'nggallery'); ?></p>
4
  <div class="ngg-album-compact">
5
  <div class="ngg-album-compactbox">
6
  <div class="ngg-album-link">
7
+ <a class="Link gallery_link" href="<?php echo nextgen_esc_url($gallery->pagelink); ?>">
8
  <img class="Thumb"
9
+ alt="<?php echo esc_attr($gallery->title); ?>"
10
+ src="<?php echo nextgen_esc_url($gallery->previewurl); ?>"/>
11
  </a>
12
  </div>
13
  </div>
14
+ <?php if (!empty($image_gen_params)) {
15
+ $max_width = 'style="max-width: ' . ($image_gen_params['width'] + 20) . 'px"';
16
+ } else {
17
+ $max_width = '';
18
+ } ?>
19
  <h4>
20
  <a class="ngg-album-desc"
21
+ title="<?php echo esc_attr($gallery->title); ?>"
22
+ href="<?php echo nextgen_esc_url($gallery->pagelink); ?>"
23
+ <?php echo $max_width; ?>>
24
+ <?php echo_safe_html($gallery->title); ?>
25
+ </a>
26
  </h4>
27
  <?php if (isset($gallery->counter) && $gallery->counter > 0) { ?>
28
  <p><strong><?php echo $gallery->counter; ?></strong>&nbsp;<?php _e('Photos', 'nggallery'); ?></p>
products/photocrati_nextgen/modules/nextgen_basic_album/templates/extended.php CHANGED
@@ -3,14 +3,14 @@
3
  <?php foreach ($galleries as $gallery) { ?>
4
  <div class="ngg-album">
5
  <div class="ngg-albumtitle">
6
- <a href="<?php echo $gallery->pagelink; ?>"><?php echo $gallery->title; ?></a>
7
  </div>
8
  <div class="ngg-albumcontent">
9
  <div class="ngg-thumbnail">
10
- <a href="<?php echo $gallery->pagelink; ?>"><img class="Thumb" alt="<?php echo $gallery->title; ?>" src="<?php echo $gallery->previewurl; ?>"/></a>
11
  </div>
12
  <div class="ngg-description">
13
- <p><?php echo $gallery->galdesc; ?></p>
14
  <?php if (isset($gallery->counter) && $gallery->counter > 0) { ?>
15
  <p><strong><?php echo $gallery->counter; ?></strong>&nbsp;<?php _e('Photos', 'nggallery'); ?></p>
16
  <?php } ?>
3
  <?php foreach ($galleries as $gallery) { ?>
4
  <div class="ngg-album">
5
  <div class="ngg-albumtitle">
6
+ <a href="<?php echo nextgen_esc_url($gallery->pagelink); ?>"><?php echo_safe_html($gallery->title); ?></a>
7
  </div>
8
  <div class="ngg-albumcontent">
9
  <div class="ngg-thumbnail">
10
+ <a class="gallery_link" href="<?php echo nextgen_esc_url($gallery->pagelink); ?>"><img class="Thumb" alt="<?php echo esc_attr($gallery->title); ?>" src="<?php echo nextgen_esc_url($gallery->previewurl); ?>"/></a>
11
  </div>
12
  <div class="ngg-description">
13
+ <p><?php echo_safe_html($gallery->galdesc); ?></p>
14
  <?php if (isset($gallery->counter) && $gallery->counter > 0) { ?>
15
  <p><strong><?php echo $gallery->counter; ?></strong>&nbsp;<?php _e('Photos', 'nggallery'); ?></p>
16
  <?php } ?>
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.ajax_pagination_actions.php CHANGED
@@ -11,14 +11,10 @@ class A_Ajax_Pagination_Actions extends Mixin
11
  {
12
  // retrieve by transient id
13
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
14
- $displayed_gallery = $factory->create('displayed_gallery', $mapper);
15
  $displayed_gallery->apply_transient($id);
16
  $displayed_gallery->transient_id = $id;
17
 
18
- // Prevent future "show slideshow" links from using the AJAX request URI
19
- if ($displayed_gallery->display_settings['ajax_pagination'])
20
- $displayed_gallery->display_settings['slideshow_link_origin'] = $_SERVER['HTTP_REFERER'];
21
-
22
  // render the displayed gallery
23
  $this->renderer = $this->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
24
  $retval['html'] = $this->renderer->render($displayed_gallery, TRUE);
11
  {
12
  // retrieve by transient id
13
  $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
14
+ $displayed_gallery = $factory->create('displayed_gallery', NULL, $mapper);
15
  $displayed_gallery->apply_transient($id);
16
  $displayed_gallery->transient_id = $id;
17
 
 
 
 
 
18
  // render the displayed gallery
19
  $this->renderer = $this->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
20
  $retval['html'] = $this->renderer->render($displayed_gallery, TRUE);
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_mapper.php CHANGED
@@ -19,11 +19,13 @@ class Hook_NextGen_Basic_Gallery_Defaults extends Hook
19
  {
20
  function set_defaults($entity)
21
  {
22
- if ($entity->name == NEXTGEN_GALLERY_BASIC_SLIDESHOW)
23
- $this->set_slideshow_defaults($entity);
24
-
25
- else if ($entity->name == NEXTGEN_GALLERY_BASIC_THUMBNAILS)
26
- $this->set_thumbnail_defaults($entity);
 
 
27
  }
28
 
29
  function set_slideshow_defaults($entity)
19
  {
20
  function set_defaults($entity)
21
  {
22
+ if (isset($entity->name)) {
23
+ if ($entity->name == NEXTGEN_GALLERY_BASIC_SLIDESHOW)
24
+ $this->set_slideshow_defaults($entity);
25
+
26
+ else if ($entity->name == NEXTGEN_GALLERY_BASIC_THUMBNAILS)
27
+ $this->set_thumbnail_defaults($entity);
28
+ }
29
  }
30
 
31
  function set_slideshow_defaults($entity)
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_routes.php CHANGED
@@ -14,12 +14,12 @@ class A_NextGen_Basic_Gallery_Routes extends Mixin
14
 
15
  function add_nextgen_basic_gallery_routes()
16
  {
17
- $slug = C_NextGen_Settings::get_instance()->router_param_slug;
18
- $this->object->rewrite("{$slug}{*}/image/{*}", "{$slug}{1}/pid--{2}");
19
- $this->object->rewrite("{$slug}{*}/slideshow/{*}", "{$slug}{1}/show--" . NEXTGEN_GALLERY_BASIC_SLIDESHOW . "{2}");
20
- $this->object->rewrite("{$slug}{*}/thumbnails/{*}", "{$slug}{1}/show--". NEXTGEN_GALLERY_BASIC_THUMBNAILS . "{2}");
21
- $this->object->rewrite("{$slug}{*}/show--slide/{*}", "{$slug}{1}/show--" . NEXTGEN_GALLERY_BASIC_SLIDESHOW . "/{2}");
22
- $this->object->rewrite("{$slug}{*}/show--gallery/{*}", "{$slug}{1}/show--" . NEXTGEN_GALLERY_BASIC_THUMBNAILS . "/{2}");
23
- $this->object->rewrite("{$slug}{*}/page/{\\d}{*}", "{$slug}{1}/page--{2}{3}");
24
  }
25
  }
14
 
15
  function add_nextgen_basic_gallery_routes()
16
  {
17
+ $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug;
18
+ $this->object->rewrite("{*}{$slug}{*}/image/{*}", "{1}{$slug}{2}/pid--{3}");
19
+ $this->object->rewrite("{*}{$slug}{*}/slideshow/{*}", "{1}{$slug}{2}/show--" . NEXTGEN_GALLERY_BASIC_SLIDESHOW . "{3}");
20
+ $this->object->rewrite("{*}{$slug}{*}/thumbnails/{*}", "{1}{$slug}{2}/show--". NEXTGEN_GALLERY_BASIC_THUMBNAILS . "{3}");
21
+ $this->object->rewrite("{*}{$slug}{*}/show--slide/{*}", "{1}{$slug}{2}/show--" . NEXTGEN_GALLERY_BASIC_SLIDESHOW . "/{3}");
22
+ $this->object->rewrite("{*}{$slug}{*}/show--gallery/{*}", "{1}{$slug}{2}/show--" . NEXTGEN_GALLERY_BASIC_THUMBNAILS . "/{3}");
23
+ $this->object->rewrite("{*}{$slug}{*}/page/{\\d}{*}", "{1}{$slug}{2}/page--{3}{4}");
24
  }
25
  }
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_controller.php CHANGED
@@ -53,7 +53,7 @@ class A_NextGen_Basic_Slideshow_Controller extends Mixin_NextGen_Basic_Gallery_C
53
  );
54
  }
55
 
56
- $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
57
 
58
  $retval = $this->object->render_partial('photocrati-nextgen_basic_gallery#slideshow/index', $params, $return);
59
  }
53
  );
54
  }
55
 
56
+ $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
57
 
58
  $retval = $this->object->render_partial('photocrati-nextgen_basic_gallery#slideshow/index', $params, $return);
59
  }
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_form.php CHANGED
@@ -17,6 +17,10 @@ class A_NextGen_Basic_Slideshow_Form extends Mixin_Display_Type_Form
17
  $this->get_static_url('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow_settings.js'),
18
  array('jquery.nextgen_radio_toggle')
19
  );
 
 
 
 
20
  }
21
 
22
  /**
17
  $this->get_static_url('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow_settings.js'),
18
  array('jquery.nextgen_radio_toggle')
19
  );
20
+
21
+
22
+ if ($atp != null) {
23
+ $atp->mark_script('nextgen_basic_slideshow_settings-js');
24
  }
25
 
26
  /**
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnail_form.php CHANGED
@@ -23,6 +23,10 @@ class A_NextGen_Basic_Thumbnail_Form extends Mixin_Display_Type_Form
23
  $this->object->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails_settings.js'),
24
  array('jquery.nextgen_radio_toggle')
25
  );
 
 
 
 
26
  }
27
 
28
  /**
23
  $this->object->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails_settings.js'),
24
  array('jquery.nextgen_radio_toggle')
25
  );
26
+
27
+
28
+ if ($atp != null) {
29
+ $atp->mark_script('nextgen_basic_thumbnails_settings');
30
  }
31
 
32
  /**
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnails_controller.php CHANGED
@@ -19,12 +19,12 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
19
  function index_action($displayed_gallery, $return=FALSE)
20
  {
21
  $display_settings = $displayed_gallery->display_settings;
22
-
 
 
23
  // If these options are on we must use the transient_id to identify the gallery
24
  if ($display_settings['show_piclens_link'] || $display_settings['ajax_pagination'])
25
- $gallery_id = $displayed_gallery->transient_id;
26
- else
27
- $gallery_id = $displayed_gallery->id();
28
 
29
  if (!$display_settings['disable_pagination'])
30
  $current_page = (int)$this->param('page', $gallery_id, 1);
@@ -117,9 +117,9 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
117
  // Generate a slideshow link
118
  $slideshow_link = '';
119
  if ($display_settings['show_slideshow_link'])
120
- {
121
  // origin_url is necessary for ajax operations. slideshow_link_origin will NOT always exist.
122
- $origin_url = (empty($display_settings['slideshow_link_origin']) ? FALSE : $display_settings['slideshow_link_origin']);
123
  $slideshow_link = $this->object->get_url_for_alternate_display_type(
124
  $displayed_gallery, NEXTGEN_GALLERY_BASIC_SLIDESHOW, $origin_url
125
  );
19
  function index_action($displayed_gallery, $return=FALSE)
20
  {
21
  $display_settings = $displayed_gallery->display_settings;
22
+ $gallery_id = $displayed_gallery->id();
23
+ $transient_id = $displayed_gallery->transient_id;
24
+
25
  // If these options are on we must use the transient_id to identify the gallery
26
  if ($display_settings['show_piclens_link'] || $display_settings['ajax_pagination'])
27
+ $gallery_id = $transient_id;
 
 
28
 
29
  if (!$display_settings['disable_pagination'])
30
  $current_page = (int)$this->param('page', $gallery_id, 1);
117
  // Generate a slideshow link
118
  $slideshow_link = '';
119
  if ($display_settings['show_slideshow_link'])
120
+ {
121
  // origin_url is necessary for ajax operations. slideshow_link_origin will NOT always exist.
122
+ $origin_url = $this->object->param('ajax_pagination_referrer');
123
  $slideshow_link = $this->object->get_url_for_alternate_display_type(
124
  $displayed_gallery, NEXTGEN_GALLERY_BASIC_SLIDESHOW, $origin_url
125
  );
products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php CHANGED
@@ -25,7 +25,7 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
25
  'photocrati-nextgen_basic_gallery',
26
  'NextGEN Basic Gallery',
27
  "Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
28
- '0.6',
29
  'http://www.nextgen-gallery.com',
30
  'Photocrati Media',
31
  'http://www.photocrati.com'
@@ -57,17 +57,19 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
57
 
58
  function _register_adapters()
59
  {
60
- // Provides the display type forms
61
- $this->get_registry()->add_adapter(
62
- 'I_Form',
63
- 'A_NextGen_Basic_Slideshow_Form',
64
- NEXTGEN_GALLERY_BASIC_SLIDESHOW
65
- );
66
- $this->get_registry()->add_adapter(
67
- 'I_Form',
68
- 'A_NextGen_Basic_Thumbnail_Form',
69
- NEXTGEN_GALLERY_BASIC_THUMBNAILS
70
- );
 
 
71
 
72
  // Provides the controllers for the display types
73
  $this->get_registry()->add_adapter(
@@ -112,11 +114,13 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
112
  'A_Ajax_Pagination_Actions'
113
  );
114
 
115
- // Adds the settings forms
116
- $this->get_registry()->add_adapter(
117
- 'I_Form_Manager',
118
- 'A_NextGen_Basic_Gallery_Forms'
119
- );
 
 
120
  }
121
 
122
  function _register_hooks()
25
  'photocrati-nextgen_basic_gallery',
26
  'NextGEN Basic Gallery',
27
  "Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
28
+ '0.7',
29
  'http://www.nextgen-gallery.com',
30
  'Photocrati Media',
31
  'http://www.photocrati.com'
57
 
58
  function _register_adapters()
59
  {
60
+ if (is_admin()) {
61
+ // Provides the display type forms
62
+ $this->get_registry()->add_adapter(
63
+ 'I_Form',
64
+ 'A_NextGen_Basic_Slideshow_Form',
65
+ NEXTGEN_GALLERY_BASIC_SLIDESHOW
66
+ );
67
+ $this->get_registry()->add_adapter(
68
+ 'I_Form',
69
+ 'A_NextGen_Basic_Thumbnail_Form',
70
+ NEXTGEN_GALLERY_BASIC_THUMBNAILS
71
+ );
72
+ }
73
 
74
  // Provides the controllers for the display types
75
  $this->get_registry()->add_adapter(
114
  'A_Ajax_Pagination_Actions'
115
  );
116
 
117
+ if (is_admin()) {
118
+ // Adds the settings forms
119
+ $this->get_registry()->add_adapter(
120
+ 'I_Form_Manager',
121
+ 'A_NextGen_Basic_Gallery_Forms'
122
+ );
123
+ }
124
  }
125
 
126
  function _register_hooks()
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/ajax_pagination.js CHANGED
@@ -8,10 +8,14 @@ jQuery(function($){
8
  init: function(){
9
  var self = this;
10
  jQuery('body').on('click', 'a.page-numbers, a.prev, a.next', function(e){
11
- e.preventDefault();
12
  var $this = $(this);
13
  var $gallery = $this.parents('.ngg-galleryoverview:first');
14
  var gallery_id= $gallery.attr('id').replace('ngg-gallery-','').replace(/-\d+$/, '');
 
 
 
 
 
15
 
16
  self.toggle_busy(true);
17
 
8
  init: function(){
9
  var self = this;
10
  jQuery('body').on('click', 'a.page-numbers, a.prev, a.next', function(e){
 
11
  var $this = $(this);
12
  var $gallery = $this.parents('.ngg-galleryoverview:first');
13
  var gallery_id= $gallery.attr('id').replace('ngg-gallery-','').replace(/-\d+$/, '');
14
+
15
+ if ($gallery.hasClass('ngg-ajax-pagination-none'))
16
+ return;
17
+
18
+ e.preventDefault();
19
 
20
  self.toggle_busy(true);
21
 
products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/slideshow/index.php CHANGED
@@ -143,7 +143,7 @@
143
  <img data-image-id='<?php echo esc_attr($image->pid); ?>'
144
  title="<?php echo esc_attr($image->description)?>"
145
  alt="<?php echo esc_attr($image->alttext)?>"
146
- src="<?php echo esc_attr($storage->get_image_url($image))?>"
147
  width="<?php echo esc_attr($image_size['width'])?>"
148
  height="<?php echo esc_attr($image_size['height'])?>"
149
  />
@@ -171,7 +171,7 @@
171
  <div
172
  class="ngg-galleryoverview ngg-slideshow"
173
  id="<?php echo_h($anchor)?>"
174
- data-placeholder="<?php echo esc_url($placeholder)?>"
175
  style="max-width:<?php echo_h($gallery_width) ?>px; max-height:<?php echo_h($gallery_height) ?>px;">
176
 
177
  <div
143
  <img data-image-id='<?php echo esc_attr($image->pid); ?>'
144
  title="<?php echo esc_attr($image->description)?>"
145
  alt="<?php echo esc_attr($image->alttext)?>"
146
+ src="<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE))?>"
147
  width="<?php echo esc_attr($image_size['width'])?>"
148
  height="<?php echo esc_attr($image_size['height'])?>"
149
  />
171
  <div
172
  class="ngg-galleryoverview ngg-slideshow"
173
  id="<?php echo_h($anchor)?>"
174
+ data-placeholder="<?php echo nextgen_esc_url($placeholder)?>"
175
  style="max-width:<?php echo_h($gallery_width) ?>px; max-height:<?php echo_h($gallery_height) ?>px;">
176
 
177
  <div
products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php CHANGED
@@ -4,7 +4,7 @@ $this->start_element('nextgen_gallery.gallery_container', 'container', $displaye
4
 
5
  ?>
6
  <div
7
- class="ngg-galleryoverview"
8
  id="ngg-gallery-<?php echo_h($displayed_gallery_id)?>-<?php echo_h($current_page)?>">
9
 
10
  <?php if (!empty($slideshow_link)): ?>
@@ -50,14 +50,18 @@ $this->start_element('nextgen_gallery.gallery_container', 'container', $displaye
50
 
51
  ?>
52
  <div class="ngg-gallery-thumbnail">
53
- <a href="<?php echo esc_attr($storage->get_image_url($image))?>"
54
  title="<?php echo esc_attr($image->description)?>"
55
- data-image-id='<?php echo esc_attr($image->pid); ?>'
 
 
 
 
56
  <?php echo $effect_code ?>>
57
  <img
58
  title="<?php echo esc_attr($image->alttext)?>"
59
  alt="<?php echo esc_attr($image->alttext)?>"
60
- src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name))?>"
61
  width="<?php echo esc_attr($thumb_size['width'])?>"
62
  height="<?php echo esc_attr($thumb_size['height'])?>"
63
  style="max-width:none;"
4
 
5
  ?>
6
  <div
7
+ class="ngg-galleryoverview<?php if (!intval($ajax_pagination)) echo ' ngg-ajax-pagination-none'; ?>"
8
  id="ngg-gallery-<?php echo_h($displayed_gallery_id)?>-<?php echo_h($current_page)?>">
9
 
10
  <?php if (!empty($slideshow_link)): ?>
50
 
51
  ?>
52
  <div class="ngg-gallery-thumbnail">
53
+ <a href="<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE))?>"
54
  title="<?php echo esc_attr($image->description)?>"
55
+ data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
56
+ data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
57
+ data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
58
+ data-title="<?php echo esc_attr($image->alttext); ?>"
59
+ data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
60
  <?php echo $effect_code ?>>
61
  <img
62
  title="<?php echo esc_attr($image->alttext)?>"
63
  alt="<?php echo esc_attr($image->alttext)?>"
64
+ src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
65
  width="<?php echo esc_attr($thumb_size['width'])?>"
66
  height="<?php echo esc_attr($thumb_size['height'])?>"
67
  style="max-width:none;"
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_mapper.php CHANGED
@@ -23,7 +23,7 @@ class Hook_NextGen_Basic_ImageBrowser_Defaults extends Hook
23
  {
24
  function set_defaults($entity)
25
  {
26
- if ($entity->name == NEXTGEN_GALLERY_NEXTGEN_BASIC_IMAGEBROWSER)
27
  {
28
  $this->object->_set_default_value($entity, 'settings', 'template', '');
29
 
23
  {
24
  function set_defaults($entity)
25
  {
26
+ if (isset($entity->name) && $entity->name == NEXTGEN_GALLERY_NEXTGEN_BASIC_IMAGEBROWSER)
27
  {
28
  $this->object->_set_default_value($entity, 'settings', 'template', '');
29
 
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_routes.php CHANGED
@@ -14,7 +14,7 @@ class A_NextGen_Basic_ImageBrowser_Routes extends Mixin
14
 
15
  function _add_nextgen_basic_imagebrowser_routes()
16
  {
17
- $slug = C_NextGen_Settings::get_instance()->router_param_slug;
18
- $this->object->rewrite("{$slug}{*}/image/{\\w}", "{$slug}{1}/pid--{2}");
19
  }
20
  }
14
 
15
  function _add_nextgen_basic_imagebrowser_routes()
16
  {
17
+ $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug;
18
+ $this->object->rewrite("{*}{$slug}{*}/image/{\\w}", "{1}{$slug}{2}/pid--{3}");
19
  }
20
  }
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/hook.nextgen_basic_imagebrowser_alt_urls.php CHANGED
@@ -9,7 +9,7 @@ class Hook_NextGen_Basic_Imagebrowser_Alt_URLs extends Hook {
9
  * @param string $size
10
  * @return null
11
  */
12
- function get_image_url($image, $size='full')
13
  {
14
  // Get the method to be returned
15
  $retval = $this->object->get_method_property(
9
  * @param string $size
10
  * @return null
11
  */
12
+ function get_image_url($image, $size='full', $check_existance=FALSE)
13
  {
14
  // Get the method to be returned
15
  $retval = $this->object->get_method_property(
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php CHANGED
@@ -19,7 +19,7 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
19
  'photocrati-nextgen_basic_imagebrowser',
20
  'NextGEN Basic ImageBrowser',
21
  'Provides the NextGEN Basic ImageBrowser Display Type',
22
- '0.4',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
@@ -59,18 +59,19 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
59
  'I_Routing_App', 'A_NextGen_Basic_ImageBrowser_Urls'
60
  );
61
 
62
- // Provide the imagebrowser form
63
- $this->get_registry()->add_adapter(
64
- 'I_Form',
65
- 'A_NextGen_Basic_ImageBrowser_Form',
66
- $this->module_id
67
- );
68
-
69
- // Provides the setting forms
70
- $this->get_registry()->add_adapter(
71
- 'I_Form_Manager',
72
- 'A_NextGen_Basic_ImageBrowser_Forms'
73
- );
 
74
  }
75
 
76
  function _register_hooks()
19
  'photocrati-nextgen_basic_imagebrowser',
20
  'NextGEN Basic ImageBrowser',
21
  'Provides the NextGEN Basic ImageBrowser Display Type',
22
+ '0.5',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
59
  'I_Routing_App', 'A_NextGen_Basic_ImageBrowser_Urls'
60
  );
61
 
62
+ if (is_admin()) {
63
+ // Provide the imagebrowser form
64
+ $this->get_registry()->add_adapter(
65
+ 'I_Form',
66
+ 'A_NextGen_Basic_ImageBrowser_Form',
67
+ $this->module_id
68
+ );
69
+ // Provides the setting forms
70
+ $this->get_registry()->add_adapter(
71
+ 'I_Form_Manager',
72
+ 'A_NextGen_Basic_ImageBrowser_Forms'
73
+ );
74
+ }
75
  }
76
 
77
  function _register_hooks()
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/templates/nextgen_basic_imagebrowser.php CHANGED
@@ -14,13 +14,17 @@
14
  $this->include_template('photocrati-nextgen_gallery_display#image/before', $template_params);
15
 
16
  ?>
17
- <a href='<?php echo esc_attr($storage->get_image_url($image)); ?>'
18
  title='<?php echo esc_attr($image->description); ?>'
19
- data-image-id='<?php echo esc_attr($image->pid); ?>'
 
 
 
 
20
  <?php echo $effect_code ?>>
21
  <img title='<?php echo esc_attr($image->alttext); ?>'
22
  alt='<?php echo esc_attr($image->alttext); ?>'
23
- src='<?php echo esc_attr($storage->get_image_url($image)); ?>'/>
24
  </a>
25
  <?php
26
 
14
  $this->include_template('photocrati-nextgen_gallery_display#image/before', $template_params);
15
 
16
  ?>
17
+ <a href='<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE)); ?>'
18
  title='<?php echo esc_attr($image->description); ?>'
19
+ data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
20
+ data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
21
+ data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
22
+ data-title="<?php echo esc_attr($image->alttext); ?>"
23
+ data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
24
  <?php echo $effect_code ?>>
25
  <img title='<?php echo esc_attr($image->alttext); ?>'
26
  alt='<?php echo esc_attr($image->alttext); ?>'
27
+ src='<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE)); ?>'/>
28
  </a>
29
  <?php
30
 
products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php CHANGED
@@ -40,7 +40,7 @@ class A_NextGen_Basic_Singlepic_Controller extends Mixin
40
  $effect_code = '';
41
  }
42
  else {
43
- $display_settings['link'] = $storage->get_image_url($image);
44
  $target = '_self';
45
  $effect_code = $this->object->get_effect_code($displayed_gallery);
46
  }
40
  $effect_code = '';
41
  }
42
  else {
43
+ $display_settings['link'] = $storage->get_image_url($image, 'full', TRUE);
44
  $target = '_self';
45
  $effect_code = $this->object->get_effect_code($displayed_gallery);
46
  }
products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_mapper.php CHANGED
@@ -58,7 +58,7 @@ class A_NextGen_Basic_SinglePic_Mapper extends Mixin
58
  */
59
  function _set_singlepic_defaults($entity)
60
  {
61
- if ($entity->name == NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME) {
62
  $this->object->_set_default_value($entity, 'settings', 'width', '');
63
  $this->object->_set_default_value($entity, 'settings', 'height', '');
64
  $this->object->_set_default_value($entity, 'settings', 'mode', '');
58
  */
59
  function _set_singlepic_defaults($entity)
60
  {
61
+ if (isset($entity->name) && $entity->name == NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME) {
62
  $this->object->_set_default_value($entity, 'settings', 'width', '');
63
  $this->object->_set_default_value($entity, 'settings', 'height', '');
64
  $this->object->_set_default_value($entity, 'settings', 'mode', '');
products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php CHANGED
@@ -17,7 +17,7 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
17
  NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME,
18
  'NextGen Basic Singlepic',
19
  'Provides a singlepic gallery for NextGEN Gallery',
20
- '0.4',
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
@@ -43,18 +43,19 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
43
  'A_NextGen_Basic_Singlepic_Mapper'
44
  );
45
 
46
- // Provides the display settings form for the SinglePic display type
47
- $this->get_registry()->add_adapter(
48
- 'I_Form',
49
- 'A_NextGen_Basic_SinglePic_Form',
50
- $this->module_id
51
- );
52
-
53
- // Adds the setting forms
54
- $this->get_registry()->add_adapter(
55
- 'I_Form_Manager',
56
- 'A_NextGen_Basic_SinglePic_Forms'
57
- );
 
58
  }
59
 
60
  function _register_hooks()
17
  NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME,
18
  'NextGen Basic Singlepic',
19
  'Provides a singlepic gallery for NextGEN Gallery',
20
+ '0.5',
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
43
  'A_NextGen_Basic_Singlepic_Mapper'
44
  );
45
 
46
+ if (is_admin()) {
47
+ // Provides the display settings form for the SinglePic display type
48
+ $this->get_registry()->add_adapter(
49
+ 'I_Form',
50
+ 'A_NextGen_Basic_SinglePic_Form',
51
+ $this->module_id
52
+ );
53
+ // Adds the setting forms
54
+ $this->get_registry()->add_adapter(
55
+ 'I_Form_Manager',
56
+ 'A_NextGen_Basic_SinglePic_Forms'
57
+ );
58
+ }
59
  }
60
 
61
  function _register_hooks()
products/photocrati_nextgen/modules/nextgen_basic_singlepic/templates/nextgen_basic_singlepic.php CHANGED
@@ -64,10 +64,14 @@
64
  ?>
65
  <a href="<?php echo esc_attr($settings['link']); ?>"
66
  title="<?php echo esc_attr($image->description)?>"
67
- data-image-id='<?php echo esc_attr($image->pid); ?>'
 
 
 
 
68
  target='<?php echo esc_attr($target); ?>'
69
- <?php echo $effect_code ?>>
70
- <img class="ngg-singlepic"
71
  src="<?php echo $thumbnail_url; ?>"
72
  alt="<?php echo esc_attr($image->alttext); ?>"
73
  title="<?php echo esc_attr($image->alttext); ?>"
64
  ?>
65
  <a href="<?php echo esc_attr($settings['link']); ?>"
66
  title="<?php echo esc_attr($image->description)?>"
67
+ data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
68
+ data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
69
+ data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
70
+ data-title="<?php echo esc_attr($image->alttext); ?>"
71
+ data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
72
  target='<?php echo esc_attr($target); ?>'
73
+ <?php echo $effect_code ?>>
74
+ <img class="ngg-singlepic"
75
  src="<?php echo $thumbnail_url; ?>"
76
  alt="<?php echo esc_attr($image->alttext); ?>"
77
  title="<?php echo esc_attr($image->alttext); ?>"
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_form.php CHANGED
@@ -25,6 +25,7 @@ class A_NextGen_Basic_Tagcloud_Form extends Mixin_Display_Type_Form
25
  $mapper = $this->object->get_registry()->get_utility('I_Display_Type_Mapper');
26
  $display_types = $mapper->find_all();
27
  foreach ($display_types as $dt) {
 
28
  if (in_array($dt->name, $skip_types)) continue;
29
  $types[$dt->name] = str_replace('NextGEN Basic ', '', $dt->title);
30
  }
25
  $mapper = $this->object->get_registry()->get_utility('I_Display_Type_Mapper');
26
  $display_types = $mapper->find_all();
27
  foreach ($display_types as $dt) {
28
+ if (!isset($dt->name)) die(var_dump($dt));
29
  if (in_array($dt->name, $skip_types)) continue;
30
  $types[$dt->name] = str_replace('NextGEN Basic ', '', $dt->title);
31
  }
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_mapper.php CHANGED
@@ -16,7 +16,7 @@ class Hook_NextGen_Basic_TagCloud_Defaults extends Hook
16
  {
17
  function set_defaults($entity)
18
  {
19
- if ($entity->name == NEXTGEN_BASIC_TAG_CLOUD_MODULE_NAME) {
20
  $this->object->_set_default_value(
21
  $entity,
22
  'settings',
16
  {
17
  function set_defaults($entity)
18
  {
19
+ if (isset($entity->name) && $entity->name == NEXTGEN_BASIC_TAG_CLOUD_MODULE_NAME) {
20
  $this->object->_set_default_value(
21
  $entity,
22
  'settings',
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_routes.php CHANGED
@@ -14,7 +14,7 @@ class A_NextGen_Basic_TagCloud_Routes extends Mixin
14
 
15
  function _add_nextgen_basic_tagcloud_routes()
16
  {
17
- $slug = C_NextGen_Settings::get_instance()->router_param_slug;
18
- $this->object->rewrite("{$slug}{*}/tags/{\\w}{*}", "{$slug}{1}/gallerytag--{2}{3}");
19
  }
20
  }
14
 
15
  function _add_nextgen_basic_tagcloud_routes()
16
  {
17
+ $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug;
18
+ $this->object->rewrite("{*}{$slug}{*}/tags/{\\w}{*}", "{1}{$slug}{2}/gallerytag--{3}{4}");
19
  }
20
  }
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/class.taxonomy_controller.php CHANGED
@@ -54,10 +54,16 @@ class C_Taxonomy_Controller extends C_MVC_Controller
54
  * @param $posts Wordpress post objects
55
  * @return array Wordpress post objects
56
  */
57
- function detect_ngg_tag($posts)
58
  {
59
  global $wp;
60
  global $wp_query;
 
 
 
 
 
 
61
 
62
  // This appears to be necessary for multisite installations, but I can't imagine why. More hackery..
63
  $tag = (get_query_var('ngg_tag') ? get_query_var('ngg_tag') : get_query_var('name'));
@@ -91,6 +97,10 @@ class C_Taxonomy_Controller extends C_MVC_Controller
91
  unset($wp_query->query['error']);
92
  $wp_query->query_vars['error'] = '';
93
  }
 
 
 
 
94
 
95
  return $posts;
96
  }
54
  * @param $posts Wordpress post objects
55
  * @return array Wordpress post objects
56
  */
57
+ function detect_ngg_tag($posts, $wp_query_local)
58
  {
59
  global $wp;
60
  global $wp_query;
61
+ $wp_query_orig = false;
62
+
63
+ if ($wp_query_local != null && $wp_query_local != $wp_query) {
64
+ $wp_query_orig = $wp_query;
65
+ $wp_query = $wp_query_local;
66
+ }
67
 
68
  // This appears to be necessary for multisite installations, but I can't imagine why. More hackery..
69
  $tag = (get_query_var('ngg_tag') ? get_query_var('ngg_tag') : get_query_var('name'));
97
  unset($wp_query->query['error']);
98
  $wp_query->query_vars['error'] = '';
99
  }
100
+
101
+ if ($wp_query_orig !== false) {
102
+ $wp_query = $wp_query_orig;
103
+ }
104
 
105
  return $posts;
106
  }
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php CHANGED
@@ -17,7 +17,7 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
17
  NEXTGEN_BASIC_TAG_CLOUD_MODULE_NAME,
18
  'NextGen Basic Tagcloud',
19
  'Provides a tagcloud for NextGEN Gallery',
20
- '0.4',
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
@@ -65,18 +65,19 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
65
  'A_NextGen_Basic_TagCloud_Urls'
66
  );
67
 
68
- // Adds a display settings form
69
- $this->get_registry()->add_adapter(
70
- 'I_Form',
71
- 'A_NextGen_Basic_TagCloud_Form',
72
- $this->module_id
73
- );
74
-
75
- // Provides the forms for the settings
76
- $this->get_registry()->add_adapter(
77
- 'I_Form_Manager',
78
- 'A_NextGen_Basic_TagCloud_Forms'
79
- );
 
80
  }
81
 
82
  function _register_hooks()
@@ -88,7 +89,8 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
88
  array(
89
  $this->get_registry()->get_utility('I_Taxonomy_Controller'),
90
  'detect_ngg_tag'),
91
- -10
 
92
  );
93
  }
94
 
17
  NEXTGEN_BASIC_TAG_CLOUD_MODULE_NAME,
18
  'NextGen Basic Tagcloud',
19
  'Provides a tagcloud for NextGEN Gallery',
20
+ '0.5',
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
65
  'A_NextGen_Basic_TagCloud_Urls'
66
  );
67
 
68
+ if (is_admin()) {
69
+ // Adds a display settings form
70
+ $this->get_registry()->add_adapter(
71
+ 'I_Form',
72
+ 'A_NextGen_Basic_TagCloud_Form',
73
+ $this->module_id
74
+ );
75
+ // Provides the forms for the settings
76
+ $this->get_registry()->add_adapter(
77
+ 'I_Form_Manager',
78
+ 'A_NextGen_Basic_TagCloud_Forms'
79
+ );
80
+ }
81
  }
82
 
83
  function _register_hooks()
89
  array(
90
  $this->get_registry()->get_utility('I_Taxonomy_Controller'),
91
  'detect_ngg_tag'),
92
+ -10,
93
+ 2
94
  );
95
  }
96
 
products/photocrati_nextgen/modules/nextgen_basic_templates/adapter.nextgen_basic_template_form.php CHANGED
@@ -210,5 +210,9 @@ class A_NextGen_Basic_Template_Form extends Mixin
210
  $this->module_version,
211
  TRUE
212
  );
 
 
 
 
213
  }
214
  }
210
  $this->module_version,
211
  TRUE
212
  );
213
+
214
+
215
+ if ($atp != null) {
216
+ $atp->mark_script('ngg_template_settings');
217
  }
218
  }
products/photocrati_nextgen/modules/nextgen_basic_templates/class.legacy_template_locator.php CHANGED
@@ -91,7 +91,7 @@ class Mixin_Legacy_Template_Locator extends Mixin
91
  }
92
  elseif (is_string($prefix))
93
  {
94
- $regex_iterator = new RegexIterator($iterator, "#(.*)/{$prefix}\-?.*\.php$#i", RecursiveRegexIterator::GET_MATCH);
95
  }
96
  else {
97
  $regex_iterator = new RegexIterator($iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
91
  }
92
  elseif (is_string($prefix))
93
  {
94
+ $regex_iterator = new RegexIterator($iterator, "#(.*)[/\\\]{$prefix}\-?.*\.php$#i", RecursiveRegexIterator::GET_MATCH);
95
  }
96
  else {
97
  $regex_iterator = new RegexIterator($iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
products/photocrati_nextgen/modules/nextgen_data/adapter.nextgen_data_factory.php CHANGED
@@ -2,27 +2,27 @@
2
 
3
  class A_NextGen_Data_Factory extends Mixin
4
  {
5
- function gallery($mapper=FALSE, $properties=array(), $context=FALSE)
6
  {
7
  return new C_Gallery($properties, $mapper, $context);
8
  }
9
 
10
 
11
- function gallery_image($mapper=FALSE, $properties=array(), $context=FALSE)
12
  {
13
  return new C_Image($properties, $mapper, $context);
14
  }
15
 
16
 
17
- function image($mapper=FALSE, $properties=array(), $context=FALSE)
18
  {
19
  return new C_Image($properties, $mapper, $context);
20
  }
21
 
22
 
23
- function album($mapper=FALSE, $properties=array(), $context=FALSE)
24
  {
25
- return new C_Album($mapper, $properties, $context);
26
  }
27
 
28
 
@@ -43,6 +43,11 @@ class A_NextGen_Data_Factory extends Mixin
43
  return new C_Gallery_Storage($context);
44
  }
45
 
 
 
 
 
 
46
 
47
  function gallerystorage($context=FALSE)
48
  {
2
 
3
  class A_NextGen_Data_Factory extends Mixin
4
  {
5
+ function gallery($properties=array(), $mapper=FALSE, $context=FALSE)
6
  {
7
  return new C_Gallery($properties, $mapper, $context);
8
  }
9
 
10
 
11
+ function gallery_image($properties=array(), $mapper=FALSE, $context=FALSE)
12
  {
13
  return new C_Image($properties, $mapper, $context);
14
  }
15
 
16
 
17
+ function image($properties=array(), $mapper=FALSE, $context=FALSE)
18
  {
19
  return new C_Image($properties, $mapper, $context);
20
  }
21
 
22
 
23
+ function album($properties=array(), $mapper=FALSE, $context=FALSE)
24
  {
25
+ return new C_Album($properties, $mapper, $context);
26
  }
27
 
28
 
43
  return new C_Gallery_Storage($context);
44
  }
45
 
46
+ function extra_fields($properties=array(), $mapper=FALSE, $context=FALSE)
47
+ {
48
+ return new C_Datamapper_Model($mapper, $properties, $context);
49
+ }
50
+
51
 
52
  function gallerystorage($context=FALSE)
53
  {
products/photocrati_nextgen/modules/nextgen_data/class.album.php CHANGED
@@ -5,7 +5,7 @@ class C_Album extends C_DataMapper_Model
5
  var $_mapper_interface = 'I_Album_Mapper';
6
 
7
 
8
- function define($mapper=FALSE, $properties=FALSE, $context=FALSE)
9
  {
10
  parent::define($mapper, $properties, $context);
11
  $this->add_mixin('Mixin_NextGen_Album_Instance_Methods');
@@ -18,16 +18,17 @@ class C_Album extends C_DataMapper_Model
18
  * @param bool|\C_DataMapper|\FALSE $mapper
19
  * @param array $properties
20
  */
21
- function initialize($mapper=FALSE, $properties=array()) {
 
22
 
23
- // Get the mapper is not specified
24
- if (!$mapper) {
25
- $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
26
- }
27
 
28
- // Initialize
29
- parent::initialize($mapper, $properties);
30
- }
31
  }
32
 
33
  /**
5
  var $_mapper_interface = 'I_Album_Mapper';
6
 
7
 
8
+ function define($properties=array(), $mapper=FALSE, $context=FALSE)
9
  {
10
  parent::define($mapper, $properties, $context);
11
  $this->add_mixin('Mixin_NextGen_Album_Instance_Methods');
18
  * @param bool|\C_DataMapper|\FALSE $mapper
19
  * @param array $properties
20
  */
21
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
22
+ {
23
 
24
+ // Get the mapper is not specified
25
+ if (!$mapper) {
26
+ $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
27
+ }
28
 
29
+ // Initialize
30
+ parent::initialize($mapper, $properties);
31
+ }
32
  }
33
 
34
  /**
products/photocrati_nextgen/modules/nextgen_data/class.album_mapper.php CHANGED
@@ -4,30 +4,37 @@ class C_Album_Mapper extends C_CustomTable_DataMapper_Driver
4
  {
5
  static $_instances = array();
6
 
7
- function define($context=FALSE)
8
  {
 
 
 
 
 
 
9
  if (!is_array($context)) $context = array($context);
10
  array_push($context, 'album');
11
-
12
  $this->_primary_key_column = 'id';
13
 
 
14
  parent::define('ngg_album', $context);
 
15
  $this->add_mixin('Mixin_Album_Mapper');
16
  $this->implement('I_Album_Mapper');
17
  $this->set_model_factory_method('album');
18
- $this->add_post_hook(
19
- '_convert_to_entity',
20
- 'Unserialize Galleries',
21
- 'Hook_Unserialize_Album_Galleries',
22
- 'unserialize_galleries'
23
- );
24
- }
25
 
26
- function initialize()
27
- {
28
- parent::initialize('ngg_album');
29
- }
 
 
 
 
30
 
 
 
 
31
 
32
  /**
33
  * Returns an instance of the album datamapper
@@ -44,19 +51,6 @@ class C_Album_Mapper extends C_CustomTable_DataMapper_Driver
44
  }
45
  }
46
 
47
- /**
48
- * NextGEN stores all gallery ids for the album in a property called sortorder
49
- */
50
- class Hook_Unserialize_Album_Galleries extends Hook
51
- {
52
- function unserialize_galleries($entity)
53
- {
54
- if (isset($entity->sortorder) && is_string($entity->sortorder)) {
55
- $entity->sortorder = $this->object->unserialize($entity->sortorder);
56
- }
57
- }
58
- }
59
-
60
 
61
  /**
62
  * Provides album-specific methods for the datamapper
@@ -73,32 +67,11 @@ class Mixin_Album_Mapper extends Mixin
73
  return $entity->name;
74
  }
75
 
76
- /**
77
- * Override the save method to avoid trying to save the 'exclude' property
78
- * to the database, which will fail since the column doesn't exist in the
79
- * database.
80
- * TODO: This is just a workaround and should be removed when we implement
81
- * https://www.wrike.com/open.htm?id=8250095
82
- * @param stdClass|C_DataMapper_Model $entity
83
- * @return boolean
84
- */
85
- function _convert_to_table_data($entity)
86
- {
87
- $exclude = $entity->exclude;
88
- $new_sortorder = property_exists($entity, 'new_sortorder') ? $entity->new_sortorder : NULL;
89
- unset($entity->exclude);
90
- unset($entity->new_sortorder);
91
- $retval = $this->call_parent('_convert_to_table_data', $entity);
92
- $entity->exclude = $exclude;
93
- if ($new_sortorder) $entity->new_sortorder = $new_sortorder;
94
- return $retval;
95
- }
96
-
97
  function _save_entity($entity)
98
  {
99
  $retval = $this->call_parent('_save_entity', $entity);
100
  if ($retval) {
101
- C_Photocrati_Cache::flush();
102
  }
103
  return $retval;
104
  }
4
  {
5
  static $_instances = array();
6
 
7
+ function initialize($object_name=FALSE)
8
  {
9
+ parent::initialize('ngg_album');
10
+ }
11
+
12
+ function define($context=FALSE, $not_used=FALSE)
13
+ {
14
+ // Define the context
15
  if (!is_array($context)) $context = array($context);
16
  array_push($context, 'album');
 
17
  $this->_primary_key_column = 'id';
18
 
19
+ // Define the mapper
20
  parent::define('ngg_album', $context);
21
+ $this->add_mixin('Mixin_NextGen_Table_Extras');
22
  $this->add_mixin('Mixin_Album_Mapper');
23
  $this->implement('I_Album_Mapper');
24
  $this->set_model_factory_method('album');
 
 
 
 
 
 
 
25
 
26
+ // Define the columns
27
+ $this->define_column('id', 'BIGINT', 0);
28
+ $this->define_column('name', 'VARCHAR(255)');
29
+ $this->define_column('slug', 'VARCHAR(255');
30
+ $this->define_column('previewpic', 'BIGINT', 0);
31
+ $this->define_column('albumdesc', 'TEXT');
32
+ $this->define_column('sortorder', 'TEXT');
33
+ $this->define_column('pageid', 'BIGINT', 0);
34
 
35
+ // Mark the columns which should be unserialized
36
+ $this->add_serialized_column('sortorder');
37
+ }
38
 
39
  /**
40
  * Returns an instance of the album datamapper
51
  }
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  /**
56
  * Provides album-specific methods for the datamapper
67
  return $entity->name;
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  function _save_entity($entity)
71
  {
72
  $retval = $this->call_parent('_save_entity', $entity);
73
  if ($retval) {
74
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
75
  }
76
  return $retval;
77
  }
products/photocrati_nextgen/modules/nextgen_data/class.gallery.php CHANGED
@@ -8,22 +8,22 @@ class Mixin_NextGen_Gallery_Validation
8
  function validation()
9
  {
10
  // If a title is present, we can auto-populate some other properties
11
- if (isset($this->object->title)) {
12
 
13
  // If no name is present, use the title to generate one
14
- if (!isset($this->object->name)) {
15
  $this->object->name = sanitize_file_name( sanitize_title($this->object->title));
16
  $this->object->name = apply_filters('ngg_gallery_name', $this->object->name);
17
  }
18
 
19
  // If no slug is set, use the title to generate one
20
- if (!isset($this->object->slug)) {
21
  $this->object->slug = nggdb::get_unique_slug( sanitize_title($this->object->title), 'gallery' );
22
  }
23
  }
24
 
25
  // Set what will be the path to the gallery
26
- if (empty($this->object->path))
27
  {
28
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
29
  $this->object->path = $storage->get_upload_relpath($this->object);
@@ -50,7 +50,7 @@ class C_Gallery extends C_DataMapper_Model
50
  * Defines the interfaces and methods (through extensions and hooks)
51
  * that this class provides
52
  */
53
- function define($properties, $mapper, $context=FALSE)
54
  {
55
  parent::define($mapper, $properties, $context);
56
  $this->add_mixin('Mixin_NextGen_Gallery_Validation');
@@ -63,19 +63,21 @@ class C_Gallery extends C_DataMapper_Model
63
  * @param C_DataMapper $mapper
64
  * @param string $context
65
  */
66
- function initialize($properties = FALSE, $mapper=FALSE)
67
  {
68
 
69
  // Get the mapper is not specified
70
  if (!$mapper) {
71
  $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
72
  }
 
 
73
  parent::initialize($mapper, $properties);
74
  }
75
 
76
  function get_images()
77
  {
78
  $mapper = C_Image_Mapper::get_instance();
79
- return $mapper->find_all(array('galleryid = %d', $this->gid));
80
  }
81
  }
8
  function validation()
9
  {
10
  // If a title is present, we can auto-populate some other properties
11
+ if (($this->object->title)) {
12
 
13
  // If no name is present, use the title to generate one
14
+ if (!($this->object->name)) {
15
  $this->object->name = sanitize_file_name( sanitize_title($this->object->title));
16
  $this->object->name = apply_filters('ngg_gallery_name', $this->object->name);
17
  }
18
 
19
  // If no slug is set, use the title to generate one
20
+ if (!($this->object->slug)) {
21
  $this->object->slug = nggdb::get_unique_slug( sanitize_title($this->object->title), 'gallery' );
22
  }
23
  }
24
 
25
  // Set what will be the path to the gallery
26
+ if (!($this->object->path))
27
  {
28
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
29
  $this->object->path = $storage->get_upload_relpath($this->object);
50
  * Defines the interfaces and methods (through extensions and hooks)
51
  * that this class provides
52
  */
53
+ function define($properties, $mapper=FALSE, $context=FALSE)
54
  {
55
  parent::define($mapper, $properties, $context);
56
  $this->add_mixin('Mixin_NextGen_Gallery_Validation');
63
  * @param C_DataMapper $mapper
64
  * @param string $context
65
  */
66
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
67
  {
68
 
69
  // Get the mapper is not specified
70
  if (!$mapper) {
71
  $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
72
  }
73
+
74
+ // Initialize
75
  parent::initialize($mapper, $properties);
76
  }
77
 
78
  function get_images()
79
  {
80
  $mapper = C_Image_Mapper::get_instance();
81
+ return $mapper->select()->where(array('galleryid = %d', $this->gid))->order_by('sortorder')->run_query();
82
  }
83
  }
products/photocrati_nextgen/modules/nextgen_data/class.gallery_mapper.php CHANGED
@@ -11,7 +11,7 @@ class C_Gallery_Mapper extends C_CustomTable_DataMapper_Driver
11
  * Define the object
12
  * @param string $context
13
  */
14
- function define($context=FALSE)
15
  {
16
  // Add 'gallery' context
17
  if (!is_array($context)) $context = array($context);
@@ -22,11 +22,22 @@ class C_Gallery_Mapper extends C_CustomTable_DataMapper_Driver
22
  // Continue defining the object
23
  parent::define('ngg_gallery', $context);
24
  $this->set_model_factory_method('gallery');
 
25
  $this->add_mixin('Mixin_Gallery_Mapper');
26
  $this->implement('I_Gallery_Mapper');
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
- function initialize()
30
  {
31
  parent::initialize('ngg_gallery');
32
  }
@@ -57,24 +68,6 @@ class Mixin_Gallery_Mapper extends Mixin
57
  return $entity->title;
58
  }
59
 
60
- /**
61
- * Override the save method to avoid trying to save the 'new_sortorder' property
62
- * to the database, which will fail since the column doesn't exist in the
63
- * database.
64
- * TODO: This is just a workaround and should be removed when we implement
65
- * https://www.wrike.com/open.htm?id=8250095
66
- * @param stdClass|C_DataMapper_Model $entity
67
- * @return boolean
68
- */
69
- function _convert_to_table_data($entity)
70
- {
71
- $new_sortorder = property_exists($entity, 'new_sortorder') ? $entity->new_sortorder : NULL;
72
- unset($entity->new_sortorder);
73
- $retval = $this->call_parent('_convert_to_table_data', $entity);
74
- if ($new_sortorder) $entity->new_sortorder = $new_sortorder;
75
- return $retval;
76
- }
77
-
78
 
79
  function _save_entity($entity)
80
  {
@@ -82,7 +75,7 @@ class Mixin_Gallery_Mapper extends Mixin
82
 
83
  if ($retval) {
84
  do_action('ngg_created_new_gallery', $entity->{$entity->id_field});
85
- C_Photocrati_Cache::flush();
86
  }
87
 
88
  return $retval;
@@ -91,7 +84,7 @@ class Mixin_Gallery_Mapper extends Mixin
91
  function destroy($image)
92
  {
93
  $retval = $this->call_parent('destroy',$image);
94
- C_Photocrati_Cache::flush();
95
  return $retval;
96
  }
97
 
11
  * Define the object
12
  * @param string $context
13
  */
14
+ function define($context=FALSE, $not_used=FALSE)
15
  {
16
  // Add 'gallery' context
17
  if (!is_array($context)) $context = array($context);
22
  // Continue defining the object
23
  parent::define('ngg_gallery', $context);
24
  $this->set_model_factory_method('gallery');
25
+ $this->add_mixin('Mixin_NextGen_Table_Extras');
26
  $this->add_mixin('Mixin_Gallery_Mapper');
27
  $this->implement('I_Gallery_Mapper');
28
+
29
+ // Define the columns
30
+ $this->define_column('gid', 'BIGINT', 0);
31
+ $this->define_column('name', 'VARCHAR(255)');
32
+ $this->define_column('slug', 'VARCHAR(255');
33
+ $this->define_column('path', 'TEXT');
34
+ $this->define_column('title', 'TEXT');
35
+ $this->define_column('pageid', 'INT', 0);
36
+ $this->define_column('previewpic', 'INT', 0);
37
+ $this->define_column('author', 'INT', 0);
38
  }
39
 
40
+ function initialize($object_name=FALSE)
41
  {
42
  parent::initialize('ngg_gallery');
43
  }
68
  return $entity->title;
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  function _save_entity($entity)
73
  {
75
 
76
  if ($retval) {
77
  do_action('ngg_created_new_gallery', $entity->{$entity->id_field});
78
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
79
  }
80
 
81
  return $retval;
84
  function destroy($image)
85
  {
86
  $retval = $this->call_parent('destroy',$image);
87
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
88
  return $retval;
89
  }
90
 
products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class E_UploadException extends RuntimeException
4
  {
5
  function __construct($message='', $code=NULL, $previous=NULL)
6
  {
@@ -9,17 +9,20 @@ class E_UploadException extends RuntimeException
9
  }
10
  }
11
 
12
- class E_InsufficientWriteAccessException extends RuntimeException
13
  {
14
  function __construct($message=FALSE, $filename=NULL, $code=NULL, $previous=NULL)
15
  {
16
  if (!$message) $message = "Could not write to file. Please check filesystem permissions.";
17
  if ($filename) $message .= " Filename: {$filename}";
18
- parent::__construct($message, $code, $previous);
 
 
 
19
  }
20
  }
21
 
22
- class E_NoSpaceAvailableException extends RuntimeException
23
  {
24
  function __construct($message='', $code=NULL, $previous=NULL)
25
  {
@@ -27,6 +30,16 @@ class E_NoSpaceAvailableException extends RuntimeException
27
  parent::__construct($message, $code, $previous);
28
  }
29
  }
 
 
 
 
 
 
 
 
 
 
30
 
31
  class Mixin_GalleryStorage_Driver_Base extends Mixin
32
  {
@@ -255,9 +268,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
255
  * @param int|stdClass|C_Image $image
256
  * @return string
257
  */
258
- function get_full_url($image)
259
  {
260
- return $this->object->get_image_url($image, 'full');
261
  }
262
 
263
  /**
@@ -374,9 +387,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
374
  * An alias for get_full_abspath()
375
  * @param int|object $image
376
  */
377
- function get_original_abspath($image)
378
  {
379
- return $this->object->get_image_abspath($image, 'full');
380
  }
381
 
382
  /**
@@ -404,9 +417,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
404
  * @param int|stdClass|C_Image $image
405
  * @return string
406
  */
407
- function get_original_url($image)
408
  {
409
- return $this->object->get_image_url($image, 'full');
410
  }
411
 
412
  /**
@@ -487,6 +500,19 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
487
  return $retval;
488
  }
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
 
491
  /**
492
  * Uploads base64 file to a gallery
@@ -504,12 +530,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
504
  $retval = NULL;
505
  if (($gallery_id = $this->object->_get_gallery_id($gallery))) {
506
 
507
- // Ensure that there is capacity available
508
- require_once(ABSPATH . 'wp-admin/includes/ms.php');
509
- if ( (is_multisite()) && nggWPMU::wpmu_enable_function('wpmuQuotaCheck')) {
510
- if (upload_is_user_over_quota(FALSE)) {
511
- throw new E_NoSpaceAvailableException();
512
- }
513
  }
514
 
515
  // Get path information. The use of get_upload_abspath() might
@@ -559,7 +582,6 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
559
  if (($image_id = $this->object->_image_mapper->save($image))) {
560
  try {
561
  // Try writing the image
562
- if (!@file_exists($upload_dir)) wp_mkdir_p($upload_dir);
563
  $fp = fopen($abs_filename, 'w');
564
  fwrite($fp, $data);
565
  fclose($fp);
@@ -605,6 +627,12 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
605
  array($image->$image_key)
606
  );
607
  }
 
 
 
 
 
 
608
  catch(Exception $ex) {
609
  throw new E_InsufficientWriteAccessException(
610
  FALSE, $abs_filename, FALSE, $ex
@@ -1130,6 +1158,7 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
1130
  $crop_frame = isset($params['crop_frame']) ? $params['crop_frame'] : NULL;
1131
  $destpath = NULL;
1132
  $thumbnail = NULL;
 
1133
 
1134
  // Do this before anything else can modify the original -- $detailed_size
1135
  // may hold IPTC metadata we need to write to our clone
@@ -1308,14 +1337,6 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
1308
  }
1309
 
1310
  $thumbnail->save($destpath, $quality);
1311
-
1312
- // IF the original contained IPTC metadata we should attempt to copy it
1313
- if (isset($detailed_size['APP13'])) {
1314
- $metadata = iptcembed($detailed_size['APP13'], $destpath);
1315
- $fp = fopen($destpath, 'wb');
1316
- fwrite($fp, $metadata);
1317
- fclose($fp);
1318
- }
1319
  }
1320
  }
1321
 
1
  <?php
2
 
3
+ class E_UploadException extends E_NggErrorException
4
  {
5
  function __construct($message='', $code=NULL, $previous=NULL)
6
  {
9
  }
10
  }
11
 
12
+ class E_InsufficientWriteAccessException extends E_NggErrorException
13
  {
14
  function __construct($message=FALSE, $filename=NULL, $code=NULL, $previous=NULL)
15
  {
16
  if (!$message) $message = "Could not write to file. Please check filesystem permissions.";
17
  if ($filename) $message .= " Filename: {$filename}";
18
+ if (PHP_VERSION_ID >= 50300)
19
+ parent::__construct($message, $code, $previous);
20
+ else
21
+ parent::__construct($message, $code);
22
  }
23
  }
24
 
25
+ class E_NoSpaceAvailableException extends E_NggErrorException
26
  {
27
  function __construct($message='', $code=NULL, $previous=NULL)
28
  {
30
  parent::__construct($message, $code, $previous);
31
  }
32
  }
33
+
34
+ class E_No_Image_Library_Exception extends E_NggErrorException
35
+ {
36
+ function __construct($message='', $code=NULL, $previous=NULL)
37
+ {
38
+ if (!$message) $message = "The site does not support the GD Image library. Please ask your hosting provider to enable it.";
39
+ parent::__construct($message, $code, $previous);
40
+ }
41
+ }
42
+
43
 
44
  class Mixin_GalleryStorage_Driver_Base extends Mixin
45
  {
268
  * @param int|stdClass|C_Image $image
269
  * @return string
270
  */
271
+ function get_full_url($image, $check_existance=FALSE)
272
  {
273
+ return $this->object->get_image_url($image, 'full', $check_existance);
274
  }
275
 
276
  /**
387
  * An alias for get_full_abspath()
388
  * @param int|object $image
389
  */
390
+ function get_original_abspath($image, $check_existance=FALSE)
391
  {
392
+ return $this->object->get_image_abspath($image, 'full', $check_existance);
393
  }
394
 
395
  /**
417
  * @param int|stdClass|C_Image $image
418
  * @return string
419
  */
420
+ function get_original_url($image, $check_existance=FALSE)
421
  {
422
+ return $this->object->get_image_url($image, 'full', $check_existance);
423
  }
424
 
425
  /**
500
  return $retval;
501
  }
502
 
503
+ function is_current_user_over_quota()
504
+ {
505
+ $retval = FALSE;
506
+ $settings = C_NextGen_Settings::get_instance();
507
+
508
+ if ((is_multisite()) && $settings->get('wpmuQuotaCheck')) {
509
+ require_once(ABSPATH . 'wp-admin/includes/ms.php');
510
+ $retval = upload_is_user_over_quota(FALSE);
511
+ }
512
+
513
+ return $retval;
514
+ }
515
+
516
 
517
  /**
518
  * Uploads base64 file to a gallery
530
  $retval = NULL;
531
  if (($gallery_id = $this->object->_get_gallery_id($gallery))) {
532
 
533
+ if ($this->object->is_current_user_over_quota()) {
534
+ $message = sprintf(__('Sorry, you have used your space allocation. Please delete some files to upload more files.', 'nggallery'));
535
+ throw new E_NoSpaceAvailableException($message);
 
 
 
536
  }
537
 
538
  // Get path information. The use of get_upload_abspath() might
582
  if (($image_id = $this->object->_image_mapper->save($image))) {
583
  try {
584
  // Try writing the image
 
585
  $fp = fopen($abs_filename, 'w');
586
  fwrite($fp, $data);
587
  fclose($fp);
627
  array($image->$image_key)
628
  );
629
  }
630
+ catch(E_No_Image_Library_Exception $ex) {
631
+ throw $ex;
632
+ }
633
+ catch(E_Clean_Exit $ex) {
634
+ // pass
635
+ }
636
  catch(Exception $ex) {
637
  throw new E_InsufficientWriteAccessException(
638
  FALSE, $abs_filename, FALSE, $ex
1158
  $crop_frame = isset($params['crop_frame']) ? $params['crop_frame'] : NULL;
1159
  $destpath = NULL;
1160
  $thumbnail = NULL;
1161
+ $quality = 100;
1162
 
1163
  // Do this before anything else can modify the original -- $detailed_size
1164
  // may hold IPTC metadata we need to write to our clone
1337
  }
1338
 
1339
  $thumbnail->save($destpath, $quality);
 
 
 
 
 
 
 
 
1340
  }
1341
  }
1342
 
products/photocrati_nextgen/modules/nextgen_data/class.image.php CHANGED
@@ -21,7 +21,7 @@ class C_Image extends C_DataMapper_Model
21
  {
22
  var $_mapper_interface = 'I_Image_Mapper';
23
 
24
- function define($properties=FALSE, $mapper=FALSE, $context=FALSE)
25
  {
26
  parent::define($mapper, $properties, $context);
27
  $this->add_mixin('Mixin_NextGen_Gallery_Image_Validation');
@@ -34,7 +34,8 @@ class C_Image extends C_DataMapper_Model
34
  * @param C_DataMapper $mapper
35
  * @param string $context
36
  */
37
- function initialize($properties = FALSE, $mapper=FALSE, $context=FALSE) {
 
38
 
39
  // Get the mapper is not specified
40
  if (!$mapper) {
21
  {
22
  var $_mapper_interface = 'I_Image_Mapper';
23
 
24
+ function define($properties=array(), $mapper=FALSE, $context=FALSE)
25
  {
26
  parent::define($mapper, $properties, $context);
27
  $this->add_mixin('Mixin_NextGen_Gallery_Image_Validation');
34
  * @param C_DataMapper $mapper
35
  * @param string $context
36
  */
37
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
38
+ {
39
 
40
  // Get the mapper is not specified
41
  if (!$mapper) {
products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.php CHANGED
@@ -8,27 +8,38 @@ class C_Image_Mapper extends C_CustomTable_DataMapper_Driver
8
  * Defines the gallery image mapper
9
  * @param type $context
10
  */
11
- function define($context=FALSE)
12
  {
13
  // Add 'attachment' context
14
  if (!is_array($context)) $context = array($context);
15
  array_push($context, 'attachment');
16
 
17
- $this->primary_key_column = 'pid';
18
-
19
  parent::define('ngg_pictures', $context);
 
20
  $this->add_mixin('Mixin_Gallery_Image_Mapper');
21
- $this->add_post_hook(
22
- '_convert_to_entity',
23
- 'Unserialize Metadata',
24
- 'Hook_Unserialize_Image_Metadata',
25
- 'unserialize_metadata'
26
- );
27
  $this->implement('I_Image_Mapper');
28
  $this->set_model_factory_method('image');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
 
31
- function initialize()
32
  {
33
  parent::initialize('ngg_pictures');
34
  }
@@ -55,24 +66,6 @@ class Mixin_Gallery_Image_Mapper extends Mixin
55
  return $retval;
56
  }
57
 
58
- /**
59
- * Override the save method to avoid trying to save the 'new_sortorder' property
60
- * to the database, which will fail since the column doesn't exist in the
61
- * database.
62
- * TODO: This is just a workaround and should be removed when we implement
63
- * https://www.wrike.com/open.htm?id=8250095
64
- * @param stdClass|C_DataMapper_Model $entity
65
- * @return boolean
66
- */
67
- function _convert_to_table_data($entity)
68
- {
69
- $new_sortorder = property_exists($entity, 'new_sortorder') ? $entity->new_sortorder : NULL;
70
- unset($entity->new_sortorder);
71
- $retval = $this->call_parent('_convert_to_table_data', $entity);
72
- if ($new_sortorder) $entity->new_sortorder = $new_sortorder;
73
- return $retval;
74
- }
75
-
76
 
77
  function _save_entity($entity)
78
  {
@@ -84,7 +77,7 @@ class Mixin_Gallery_Image_Mapper extends Mixin
84
  if (!isset($entity->meta_data['saved'])) {
85
  nggAdmin::import_MetaData($image_id);
86
  }
87
- C_Photocrati_Cache::flush();
88
  }
89
  return $retval;
90
  }
@@ -159,18 +152,9 @@ class Mixin_Gallery_Image_Mapper extends Mixin
159
  // Ensure that the exclude parameter is an integer or boolean-evaluated
160
  // value
161
  if (is_string($entity->exclude)) $entity->exclude = intval($entity->exclude);
162
- }
163
- }
164
 
165
- /**
166
- * Unserializes the metadata when fetched from the database
167
- */
168
- class Hook_Unserialize_Image_Metadata extends Hook
169
- {
170
- function unserialize_metadata($entity)
171
- {
172
- if (isset($entity->meta_data) && is_string($entity->meta_data)) {
173
- $entity->meta_data = $this->object->unserialize($entity->meta_data);
174
- }
175
  }
176
  }
8
  * Defines the gallery image mapper
9
  * @param type $context
10
  */
11
+ function define($context=FALSE, $not_used=FALSE)
12
  {
13
  // Add 'attachment' context
14
  if (!is_array($context)) $context = array($context);
15
  array_push($context, 'attachment');
16
 
17
+ // Define the mapper
18
+ $this->_primary_key_column = 'pid';
19
  parent::define('ngg_pictures', $context);
20
+ $this->add_mixin('Mixin_NextGen_Table_Extras');
21
  $this->add_mixin('Mixin_Gallery_Image_Mapper');
 
 
 
 
 
 
22
  $this->implement('I_Image_Mapper');
23
  $this->set_model_factory_method('image');
24
+
25
+ // Define the columns
26
+ $this->define_column('pid', 'BIGINT', 0);
27
+ $this->define_column('image_slug', 'VARCHAR(255)');
28
+ $this->define_column('post_id', 'BIGINT', 0);
29
+ $this->define_column('galleryid', 'BIGINT', 0);
30
+ $this->define_column('filename', 'VARCHAR(255)');
31
+ $this->define_column('description', 'TEXT');
32
+ $this->define_column('alttext', 'TEXT');
33
+ $this->define_column('imagedate', 'DATETIME');
34
+ $this->define_column('exclude', 'INT', 0);
35
+ $this->define_column('sortorder', 'BIGINT', 0);
36
+ $this->define_column('meta_data', 'TEXT');
37
+
38
+ // Mark the columns which should be unserialized
39
+ $this->add_serialized_column('meta_data');
40
  }
41
 
42
+ function initialize($object_name=FALSE)
43
  {
44
  parent::initialize('ngg_pictures');
45
  }
66
  return $retval;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  function _save_entity($entity)
71
  {
77
  if (!isset($entity->meta_data['saved'])) {
78
  nggAdmin::import_MetaData($image_id);
79
  }
80
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
81
  }
82
  return $retval;
83
  }
152
  // Ensure that the exclude parameter is an integer or boolean-evaluated
153
  // value
154
  if (is_string($entity->exclude)) $entity->exclude = intval($entity->exclude);
 
 
155
 
156
+ // Trim alttext and description
157
+ $entity->description = trim($entity->description);
158
+ $entity->alttext = trim($entity->alttext);
 
 
 
 
 
 
 
159
  }
160
  }
products/photocrati_nextgen/modules/nextgen_data/class.image_wrapper.php CHANGED
@@ -274,8 +274,13 @@ class C_Image_Wrapper
274
  $this->_orig_image->meta_data
275
  );
276
  }
277
- $w = $this->_orig_image->meta_data['thumbnail']['width'];
278
- $h = $this->_orig_image->meta_data['thumbnail']['height'];
 
 
 
 
 
279
  return "width='{$w}' height='{$h}'";
280
 
281
  case 'slug':
@@ -422,7 +427,13 @@ class C_Image_Wrapper
422
 
423
  $retval = apply_filters('ngg_get_thumbcode', $retval, $this);
424
 
425
- $retval .= ' data-image-id="' . $this->__get('id') . '"';
 
 
 
 
 
 
426
 
427
  $this->_cache['thumbcode'] = $retval;
428
  return $retval;
274
  $this->_orig_image->meta_data
275
  );
276
  }
277
+ if (!isset($this->_orig_image->meta_data['thumbnail'])) {
278
+ $storage = $this->get_storage();
279
+ $storage->generate_thumbnail($this->_orig_image);
280
+ }
281
+ $w = $this->_orig_image->meta_data['thumbnail']['width'];
282
+ $h = $this->_orig_image->meta_data['thumbnail']['height'];
283
+
284
  return "width='{$w}' height='{$h}'";
285
 
286
  case 'slug':
427
 
428
  $retval = apply_filters('ngg_get_thumbcode', $retval, $this);
429
 
430
+ // ensure some additional data- fields are added; provides Pro-Lightbox compatibility
431
+ $retval .= ' data-image-id="' . $this->__get('id') . '"';
432
+ $retval .= ' data-src="' . $this->__get('imageURL') . '"';
433
+ $retval .= ' data-thumbnail="' . $this->__get('thumbnailURL') . '"';
434
+ $retval .= ' data-image-id="' . $this->__get('pid') . '"';
435
+ $retval .= ' data-title="' . $this->__get('alttext') . '"';
436
+ $retval .= ' data-description="' . $this->__get('description') . '"';
437
 
438
  $this->_cache['thumbcode'] = $retval;
439
  return $retval;
products/photocrati_nextgen/modules/nextgen_data/class.nextgen_data_installer.php CHANGED
@@ -1,12 +1,16 @@
1
  <?php
2
 
3
- class C_NextGen_Data_Installer
4
  {
5
  function get_registry()
6
  {
7
  return C_Component_Registry::get_instance();
8
  }
9
 
 
 
 
 
10
  function uninstall($hard = FALSE)
11
  {
12
  if ($hard) {
1
  <?php
2
 
3
+ class C_NextGen_Data_Installer extends C_NggLegacy_Installer
4
  {
5
  function get_registry()
6
  {
7
  return C_Component_Registry::get_instance();
8
  }
9
 
10
+ function install()
11
+ {
12
+ }
13
+
14
  function uninstall($hard = FALSE)
15
  {
16
  if ($hard) {
products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php CHANGED
@@ -161,16 +161,33 @@ class Mixin_NggLegacy_GalleryStorage_Driver extends Mixin
161
  * @param string $size
162
  * @returns array
163
  */
164
- function get_image_url($image, $size='full')
165
  {
166
- $fs = $this->get_registry()->get_utility('I_Fs');
167
- $router = $this->get_registry()->get_utility('I_Router');
168
- $request_uri = str_replace(
169
- trailingslashit($fs->get_document_root()),
170
- '',
171
- $this->object->get_image_abspath($image, $size)
172
- );
173
- return $router->remove_url_segment('/index.php', $router->get_url($request_uri, FALSE, TRUE));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
 
176
  /**
@@ -638,16 +655,10 @@ class Mixin_NggLegacy_GalleryStorage_Driver extends Mixin
638
  }
639
 
640
  foreach ($images as $image) {
641
-
642
- // Ensure that there is capacity available
643
- if ((is_multisite()) && $settings->get('wpmuQuotaCheck'))
644
- {
645
- require_once(ABSPATH . 'wp-admin/includes/ms.php');
646
- if (upload_is_user_over_quota(FALSE)) {
647
- $message .= sprintf(__('Sorry, you have used your space allocation. Please delete some files to upload more files.', 'nggallery'));
648
- throw new E_NoSpaceAvailableException();
649
- }
650
- }
651
 
652
  // Copy the db entry
653
  if (is_numeric($image))
161
  * @param string $size
162
  * @returns array
163
  */
164
+ function get_image_url($image, $size='full', $check_existance=FALSE)
165
  {
166
+ $retval = NULL;
167
+ $fs = $this->get_registry()->get_utility('I_Fs');
168
+ $router = $this->get_registry()->get_utility('I_Router');
169
+ $abspath = $this->object->get_image_abspath($image, $size, $check_existance);
170
+ if ($abspath) {
171
+ $doc_root = $fs->get_document_root();
172
+
173
+ if ($doc_root != null) {
174
+ $doc_root = trailingslashit($doc_root);
175
+ }
176
+
177
+ $request_uri = str_replace(
178
+ $doc_root,
179
+ '',
180
+ $abspath
181
+ );
182
+
183
+ if ($request_uri != null && $request_uri[0] != '/') {
184
+ $request_uri = '/' . $request_uri;
185
+ }
186
+
187
+ $retval = $router->remove_url_segment('/index.php', $router->get_url($request_uri, FALSE, TRUE));
188
+ }
189
+
190
+ return $retval;
191
  }
192
 
193
  /**
655
  }
656
 
657
  foreach ($images as $image) {
658
+ if ($this->object->is_current_user_over_quota()) {
659
+ $message = sprintf(__('Sorry, you have used your space allocation. Please delete some files to upload more files.', 'nggallery'));
660
+ throw new E_NoSpaceAvailableException($message);
661
+ }
 
 
 
 
 
 
662
 
663
  // Copy the db entry
664
  if (is_numeric($image))
products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_thumbnail.php CHANGED
@@ -117,7 +117,7 @@ class C_NggLegacy_Thumbnail {
117
  if(!function_exists("gd_info")) {
118
  echo 'You do not have the GD Library installed. This class requires the GD library to function properly.' . "\n";
119
  echo 'visit http://us2.php.net/manual/en/ref.image.php for more information';
120
- C_NextGEN_Bootstrap::shutdown();
121
  }
122
  //initialize variables
123
  $this->errmsg = '';
@@ -161,7 +161,7 @@ class C_NggLegacy_Thumbnail {
161
  }
162
 
163
  // increase memory-limit if possible, GD needs this for large images
164
- // @ini_set('memory_limit', '128M');
165
 
166
  if($this->error == false) {
167
  // Check memory consumption if file exists
117
  if(!function_exists("gd_info")) {
118
  echo 'You do not have the GD Library installed. This class requires the GD library to function properly.' . "\n";
119
  echo 'visit http://us2.php.net/manual/en/ref.image.php for more information';
120
+ throw new E_No_Image_Library_Exception();
121
  }
122
  //initialize variables
123
  $this->errmsg = '';
161
  }
162
 
163
  // increase memory-limit if possible, GD needs this for large images
164
+ @ini_set('memory_limit', '512M');
165
 
166
  if($this->error == false) {
167
  // Check memory consumption if file exists
products/photocrati_nextgen/modules/nextgen_data/mixin.nextgen_table_extras.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mixin_NextGen_Table_Extras extends Mixin
4
+ {
5
+ const CUSTOM_POST_NAME = __CLASS__;
6
+
7
+ function initialize()
8
+ {
9
+ // Each record in a NextGEN Gallery table has an associated custom post in the wp_posts table
10
+ $this->object->_custom_post_mapper = new C_CustomPost_DataMapper_Driver($this->object->get_object_name());
11
+ $this->object->_custom_post_mapper->set_model_factory_method('extra_fields');
12
+ }
13
+
14
+ /**
15
+ * Defines a column for the mapper
16
+ * @param $name
17
+ * @param $data_type
18
+ * @param null $default_value
19
+ * @param bool $extra
20
+ */
21
+ function define_column($name, $data_type, $default_value=NULL, $extra=FALSE)
22
+ {
23
+ $this->call_parent('define_column', $name, $data_type, $default_value);
24
+ if ($extra) {
25
+ $this->object->_columns[$name]['extra'] = TRUE;
26
+ }
27
+ else $this->object->_columns[$name]['extra'] = FALSE;
28
+ }
29
+
30
+ /**
31
+ * Gets a list of all the extra columns defined for this table
32
+ * @return array
33
+ */
34
+ function get_extra_columns()
35
+ {
36
+ $retval = array();
37
+
38
+ foreach ($this->object->_columns as $key => $properties) {
39
+ if ($properties['extra']) $retval[] = $key;
40
+ }
41
+
42
+ return $retval;
43
+ }
44
+
45
+ /**
46
+ * Adds a column to the database
47
+ * @param $column_name
48
+ * @param $datatype
49
+ * @param null $default_value
50
+ */
51
+ function _add_column($column_name, $datatype, $default_value=NULL)
52
+ {
53
+ $skip = FALSE;
54
+ if (isset($this->object->_columns[$column_name]) and $this->object->_columns[$column_name]['extra']) {
55
+ $skip = TRUE;
56
+ }
57
+ if (!$skip) $this->call_parent('_add_column', $column_name, $datatype, $default_value);
58
+ }
59
+
60
+ function create_custom_post_entity($entity)
61
+ {
62
+ $custom_post_entity = new stdClass;
63
+
64
+ // If the custom post entity already exists then it needs
65
+ // an ID
66
+ if (isset($entity->custom_post_id)) $custom_post_entity->ID = $entity->custom_post_id;
67
+
68
+ // If a property isn't a column for the table, then
69
+ // it belongs to the custom post record
70
+ foreach (get_object_vars($entity) as $key => $value) {
71
+ if (!$this->object->has_column($key)) {
72
+ unset($entity->$key);
73
+ if ($this->object->has_defined_column($key) && $key != $this->object->get_primary_key_column())
74
+ $custom_post_entity->$key = $value;
75
+ }
76
+ }
77
+
78
+ // Used to help find these type of records
79
+ $custom_post_entity->post_name = self::CUSTOM_POST_NAME;
80
+
81
+ return $custom_post_entity;
82
+ }
83
+
84
+ /**
85
+ * Gets the name of the WordPress option that holds the ID of the associated custom post ID record
86
+ * @param $entity
87
+ * @return string
88
+ */
89
+ function _get_option_name($entity)
90
+ {
91
+ $primary_key = $this->object->get_primary_key_column();
92
+ return $this->get_table_name().'_'.$entity->$primary_key;
93
+ }
94
+
95
+ /**
96
+ * Creates a new record in the custom table, as well as a custom post record
97
+ * @param $entity
98
+ */
99
+ function _create($entity)
100
+ {
101
+ $retval = FALSE;
102
+ $custom_post_entity = $this->create_custom_post_entity($entity);
103
+
104
+ // Try persisting the custom post type record first
105
+ if (($custom_post_id = $this->object->_custom_post_mapper->save($custom_post_entity))) {
106
+
107
+ // Try saving the custom table record. If that fails, then destroy the previously
108
+ // created custom post type record
109
+ if (!($retval = $this->call_parent('_create', $entity))) {
110
+ $this->object->_custom_post_mapper->destroy($custom_post_id);
111
+ }
112
+
113
+ // Add the custom post id property
114
+ else {
115
+ $option_name = $this->_get_option_name($entity);
116
+ update_option($option_name, $custom_post_id);
117
+ $entity->custom_post_id = $custom_post_id;
118
+ }
119
+ }
120
+
121
+ return $retval;
122
+ }
123
+
124
+ // Updates a custom table record and it's associated custom post type record in the database
125
+ function _update($entity)
126
+ {
127
+ $retval = FALSE;
128
+ $custom_post_entity = $this->create_custom_post_entity($entity);
129
+ $custom_post_id = $this->object->_custom_post_mapper->save($custom_post_entity);
130
+ $retval = $this->call_parent('_update', $entity);
131
+ $entity->custom_post_id = $custom_post_id;
132
+ update_option($this->_get_option_name($entity), $custom_post_id);
133
+ foreach ($this->get_extra_columns() as $key) {
134
+ if (isset($custom_post_entity->$key)) $entity->$key = $custom_post_entity->$key;
135
+ }
136
+
137
+ return $retval;
138
+ }
139
+
140
+ function destroy($entity)
141
+ {
142
+ if (isset($entity->custom_post_id)) {
143
+ wp_delete_post($entity->custom_post_id, TRUE);
144
+ delete_option($this->_get_option_name($entity));
145
+ }
146
+
147
+ return $this->call_parent('destroy', $entity);
148
+ }
149
+
150
+ /**
151
+ * Gets the generated query
152
+ */
153
+ function get_generated_query()
154
+ {
155
+ // Add extras column
156
+ if ($this->object->is_select_statement()) {
157
+ global $wpdb;
158
+ $table_name = $this->object->get_table_name();
159
+ $primary_key = "{$table_name}.{$this->object->get_primary_key_column()}";
160
+ $this->object->group_by($primary_key);
161
+ $sql = $this->call_parent('get_generated_query');
162
+ $from = 'FROM `'.$this->object->get_table_name().'`';
163
+ $sql = str_replace('FROM', ", `{$wpdb->options}`.`option_value` AS 'custom_post_id', GROUP_CONCAT(CONCAT_WS('@@', meta_key, meta_value)) AS 'extras' FROM", $sql);
164
+ $sql = str_replace($from, "{$from} LEFT OUTER JOIN `{$wpdb->options}` ON `{$wpdb->options}`.option_name = CONCAT('{$table_name}_', {$primary_key}) LEFT OUTER JOIN `{$wpdb->postmeta}` ON `{$wpdb->postmeta}`.`post_id` = `{$wpdb->options}`.`option_value` ", $sql);
165
+ }
166
+ else $sql = $this->call_parent('get_generated_query');
167
+
168
+ return $sql;
169
+ }
170
+
171
+ function _convert_to_entity($entity)
172
+ {
173
+ // Add extra columns to entity
174
+ if (isset($entity->extras)) {
175
+ $extras = $entity->extras;
176
+ unset($entity->extras);
177
+ foreach (explode(',', $extras) as $extra) {
178
+ if ($extra) {
179
+ list($key, $value) = explode('@@', $extra);
180
+ if ($this->object->has_defined_column($key) && !isset($entity->key)) $entity->$key = $value;
181
+ }
182
+ }
183
+ }
184
+
185
+ // Cast custom_post_id as integer
186
+ if (isset($entity->custom_post_id)) {
187
+ $entity->custom_post_id = intval($entity->custom_post_id);
188
+ }
189
+ else $entity->custom_post_id = 0;
190
+
191
+ $retval = $this->call_parent('_convert_to_entity', $entity);
192
+
193
+ return $entity;
194
+ }
195
+ }
products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php CHANGED
@@ -15,7 +15,7 @@ class M_NextGen_Data extends C_Base_Module
15
  'photocrati-nextgen-data',
16
  'NextGEN Data Tier',
17
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
18
- '0.3',
19
  'http://www.photocrati.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
@@ -61,6 +61,7 @@ class M_NextGen_Data extends C_Base_Module
61
  'C_Image_Wrapper' => 'class.image_wrapper.php',
62
  'C_Image_Wrapper_Collection' => 'class.image_wrapper_collection.php',
63
  'C_Nextgen_Metadata' => 'class.nextgen_metadata.php',
 
64
  'C_Ngglegacy_Gallerystorage_Driver' => 'class.ngglegacy_gallerystorage_driver.php',
65
  'C_Ngglegacy_Thumbnail' => 'class.ngglegacy_thumbnail.php',
66
  'C_Wordpress_Gallerystorage_Driver' => 'class.wordpress_gallerystorage_driver.php',
@@ -80,8 +81,26 @@ class M_NextGen_Data extends C_Base_Module
80
 
81
  function _register_hooks()
82
  {
 
83
  add_filter('posts_orderby', array($this, 'wp_query_order_by'), 10, 2);
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  function wp_query_order_by($order_by, $wp_query)
87
  {
15
  'photocrati-nextgen-data',
16
  'NextGEN Data Tier',
17
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
18
+ '0.4',
19
  'http://www.photocrati.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
61
  'C_Image_Wrapper' => 'class.image_wrapper.php',
62
  'C_Image_Wrapper_Collection' => 'class.image_wrapper_collection.php',
63
  'C_Nextgen_Metadata' => 'class.nextgen_metadata.php',
64
+ 'Mixin_NextGen_Table_Extras' => 'mixin.nextgen_table_extras.php',
65
  'C_Ngglegacy_Gallerystorage_Driver' => 'class.ngglegacy_gallerystorage_driver.php',
66
  'C_Ngglegacy_Thumbnail' => 'class.ngglegacy_thumbnail.php',
67
  'C_Wordpress_Gallerystorage_Driver' => 'class.wordpress_gallerystorage_driver.php',
81
 
82
  function _register_hooks()
83
  {
84
+ add_action('init', array(&$this, 'register_custom_post_types'));
85
  add_filter('posts_orderby', array($this, 'wp_query_order_by'), 10, 2);
86
  }
87
+
88
+ function register_custom_post_types()
89
+ {
90
+ $types = array(
91
+ 'ngg_album' => 'NextGEN Gallery - Album',
92
+ 'ngg_gallery' => 'NexTGEN Gallery - Gallery',
93
+ 'ngg_pictures' => 'NextGEN Gallery - Image',
94
+ );
95
+
96
+ foreach ($types as $type => $label) {
97
+ register_post_type($type, array(
98
+ 'label' => $label,
99
+ 'publicly_queryable' => FALSE,
100
+ 'exclude_from_search' => TRUE,
101
+ ));
102
+ }
103
+ }
104
 
105
  function wp_query_order_by($order_by, $wp_query)
106
  {
products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.gallery_display_factory.php CHANGED
@@ -8,9 +8,9 @@ class A_Gallery_Display_Factory extends Mixin
8
  * @param array|stdClass|C_DataMapper_Model $properties
9
  * @param string|array|FALSE $context
10
  */
11
- function display_type($mapper=FALSE, $properties=array(), $context=FALSE)
12
  {
13
- return new C_Display_Type($mapper, $properties, $context);
14
  }
15
 
16
  /**
@@ -19,9 +19,9 @@ class A_Gallery_Display_Factory extends Mixin
19
  * @param array|stdClass|C_DataMapper_Model $properties
20
  * @param string|array|FALSE $context
21
  */
22
- function displayed_gallery($mapper=FALSE, $properties=array(), $context=FALSE)
23
  {
24
- return new C_Displayed_Gallery($mapper, $properties, $context);
25
  }
26
 
27
  /**
@@ -31,8 +31,8 @@ class A_Gallery_Display_Factory extends Mixin
31
  * @param string|array|FALSE $context
32
  * @return C_Displayed_Gallery_Source
33
  */
34
- function displayed_gallery_source($mapper=FALSE, $properties=array(), $context=FALSE)
35
  {
36
- return new C_Displayed_Gallery_Source($mapper, $properties, $context);
37
  }
38
  }
8
  * @param array|stdClass|C_DataMapper_Model $properties
9
  * @param string|array|FALSE $context
10
  */
11
+ function display_type($properties=array(), $mapper=FALSE, $context=FALSE)
12
  {
13
+ return new C_Display_Type($properties, $mapper, $context);
14
  }
15
 
16
  /**
19
  * @param array|stdClass|C_DataMapper_Model $properties
20
  * @param string|array|FALSE $context
21
  */
22
+ function displayed_gallery($properties=array(), $mapper=FALSE, $context=FALSE)
23
  {
24
+ return new C_Displayed_Gallery($properties, $mapper, $context);
25
  }
26
 
27
  /**
31
  * @param string|array|FALSE $context
32
  * @return C_Displayed_Gallery_Source
33
  */
34
+ function displayed_gallery_source($properties=array(), $mapper=FALSE, $context=FALSE)
35
  {
36
+ return new C_Displayed_Gallery_Source($properties, $mapper, $context);
37
  }
38
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type.php CHANGED
@@ -13,7 +13,7 @@ class C_Display_Type extends C_DataMapper_Model
13
  {
14
  var $_mapper_interface = 'I_Display_Type_Mapper';
15
 
16
- function define($mapper, $properties, $context=FALSE)
17
  {
18
  parent::define($mapper, $properties, $context);
19
  $this->add_mixin('Mixin_Display_Type_Validation');
@@ -27,7 +27,7 @@ class C_Display_Type extends C_DataMapper_Model
27
  * @param array|stdClass|C_Display_Type $properties
28
  * @param FALSE|string|array $context
29
  */
30
- function initialize($mapper=FALSE, $properties=array())
31
  {
32
  // If no mapper was specified, then get the mapper
33
  if (!$mapper) $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
13
  {
14
  var $_mapper_interface = 'I_Display_Type_Mapper';
15
 
16
+ function define($properties=array(), $mapper=FALSE, $context=FALSE)
17
  {
18
  parent::define($mapper, $properties, $context);
19
  $this->add_mixin('Mixin_Display_Type_Validation');
27
  * @param array|stdClass|C_Display_Type $properties
28
  * @param FALSE|string|array $context
29
  */
30
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
31
  {
32
  // If no mapper was specified, then get the mapper
33
  if (!$mapper) $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_controller.php CHANGED
@@ -7,6 +7,7 @@
7
  class C_Display_Type_Controller extends C_MVC_Controller
8
  {
9
  static $_instances = array();
 
10
 
11
  function define($context=FALSE)
12
  {
@@ -69,15 +70,16 @@ class Mixin_Display_Type_Controller extends Mixin
69
  $settings = C_NextGen_Settings::get_instance();
70
  $mapper = $this->object->get_registry()->get_utility('I_Lightbox_Library_Mapper');
71
  $library = $mapper->find_by_name($settings->thumbEffect);
 
72
 
73
  // Make the path to the static resources available for libraries
74
  // Shutter-Reloaded in particular depends on this
75
  $this->object->_add_script_data(
76
  'ngg_common',
77
  'nextgen_lightbox_settings',
78
- array('static_path' => $this->object->get_static_relpath('', 'photocrati-lightbox')),
79
  TRUE,
80
- FALSE
81
  );
82
 
83
  {
@@ -243,7 +245,7 @@ class Mixin_Display_Type_Controller extends Mixin
243
 
244
  // Get the associated data with this script
245
  $script = &$wp_scripts->registered[$handle];
246
- $data = &$script->extra['data'];
247
 
248
  // Construct the addition
249
  $addition = $define ? "\nvar {$object_name} = " . json_encode($object_value) . ';' :
@@ -260,6 +262,8 @@ class Mixin_Display_Type_Controller extends Mixin
260
  }
261
 
262
  $script->extra['data'] = $data;
 
 
263
  }
264
 
265
  return $retval;
7
  class C_Display_Type_Controller extends C_MVC_Controller
8
  {
9
  static $_instances = array();
10
+ var $cachable = TRUE;
11
 
12
  function define($context=FALSE)
13
  {
70
  $settings = C_NextGen_Settings::get_instance();
71
  $mapper = $this->object->get_registry()->get_utility('I_Lightbox_Library_Mapper');
72
  $library = $mapper->find_by_name($settings->thumbEffect);
73
+ $thumbEffectContext = isset($settings->thumbEffectContext) ? $settings->thumbEffectContext : '';
74
 
75
  // Make the path to the static resources available for libraries
76
  // Shutter-Reloaded in particular depends on this
77
  $this->object->_add_script_data(
78
  'ngg_common',
79
  'nextgen_lightbox_settings',
80
+ array('static_path' => $this->object->get_static_relpath('', 'photocrati-lightbox'), 'context' => $thumbEffectContext),
81
  TRUE,
82
+ true
83
  );
84
 
85
  {
245
 
246
  // Get the associated data with this script
247
  $script = &$wp_scripts->registered[$handle];
248
+ $data = isset($script->extra['data']) ? $script->extra['data'] : '';
249
 
250
  // Construct the addition
251
  $addition = $define ? "\nvar {$object_name} = " . json_encode($object_value) . ';' :
262
  }
263
 
264
  $script->extra['data'] = $data;
265
+
266
+ unset($script);
267
  }
268
 
269
  return $retval;
products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_mapper.php CHANGED
@@ -7,7 +7,7 @@ class C_Display_Type_Mapper extends C_CustomPost_DataMapper_Driver
7
  {
8
  public static $_instances = array();
9
 
10
- function define($context=FALSE)
11
  {
12
  $object_name = 'display_type';
13
 
@@ -15,7 +15,7 @@ class C_Display_Type_Mapper extends C_CustomPost_DataMapper_Driver
15
  // This allows us to adapt the driver itself, if required
16
  if (!is_array($context)) $context = array($context);
17
  array_push($context, $object_name);
18
- parent::define(NULL, $context);
19
 
20
  $this->add_mixin('Mixin_Display_Type_Mapper');
21
  $this->implement('I_Display_Type_Mapper');
@@ -75,7 +75,7 @@ class Mixin_Display_Type_Mapper extends Mixin
75
  $retval = NULL;
76
  foreach ($this->object->find_all($model) as $display_type) {
77
  foreach ($find_entity_types as $entity_type) {
78
- if (in_array($entity_type, $display_type->entity_types)) {
79
  $retval[] = $display_type;
80
  break;
81
  }
7
  {
8
  public static $_instances = array();
9
 
10
+ function define($context=FALSE, $not_used=FALSE)
11
  {
12
  $object_name = 'display_type';
13
 
15
  // This allows us to adapt the driver itself, if required
16
  if (!is_array($context)) $context = array($context);
17
  array_push($context, $object_name);
18
+ parent::define($object_name, $context);
19
 
20
  $this->add_mixin('Mixin_Display_Type_Mapper');
21
  $this->implement('I_Display_Type_Mapper');
75
  $retval = NULL;
76
  foreach ($this->object->find_all($model) as $display_type) {
77
  foreach ($find_entity_types as $entity_type) {
78
+ if (isset($display_type->entity_types) && in_array($entity_type, $display_type->entity_types)) {
79
  $retval[] = $display_type;
80
  break;
81
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php CHANGED
@@ -17,7 +17,7 @@ class C_Displayed_Gallery extends C_DataMapper_Model
17
  {
18
  var $_mapper_interface = 'I_Displayed_Gallery_Mapper';
19
 
20
- function define($mapper=FALSE, $properties=FALSE, $context=FALSE)
21
  {
22
  parent::define($mapper, $properties, $context);
23
  $this->add_mixin('Mixin_Displayed_Gallery_Validation');
@@ -33,10 +33,12 @@ class C_Displayed_Gallery extends C_DataMapper_Model
33
  * @param array|stdClass|C_Displayed_Gallery $properties
34
  * @param FALSE|string|array $context
35
  */
36
- function initialize($mapper=FALSE, $properties=array())
37
  {
38
  if (!$mapper) $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
39
  parent::initialize($mapper, $properties);
 
 
40
  }
41
  }
42
 
@@ -90,6 +92,28 @@ class Mixin_Displayed_Gallery_Validation extends Mixin
90
 
91
  class Mixin_Displayed_Gallery_Queries extends Mixin
92
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  function get_entities($limit=FALSE, $offset=FALSE, $id_only=FALSE, $returns='included')
94
  {
95
  $retval = array();
@@ -134,7 +158,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
134
  // Find a way to minimalize or segment
135
  $mapper = $this->get_registry()->get_utility('I_Image_Mapper');
136
  $image_key = $mapper->get_primary_key_column();
137
- $select = $id_only ? $image_key : '*';
138
  $sort_direction = $this->object->order_direction;
139
  $sort_by = $this->object->order_by;
140
 
@@ -320,7 +344,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
320
  }
321
 
322
  // Apply a sorting order
323
- if ($sort_by) $mapper->order_by($sort_by, $sort_direction);
324
 
325
  // Apply a limit
326
  if ($limit) {
@@ -328,7 +352,9 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
328
  else $mapper->limit($limit);
329
  }
330
 
331
- return $mapper->run_query();
 
 
332
  }
333
 
334
  /**
@@ -350,7 +376,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
350
  $album_key = $album_mapper->get_primary_key_column();
351
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
352
  $gallery_key = $gallery_mapper->get_primary_key_column();
353
- $select = $id_only ? $album_key.", sortorder" : '*';
354
  $retval = array();
355
 
356
  // If no exclusions are specified, are entity_ids are specified,
@@ -405,8 +431,8 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
405
  // always take precedence
406
  $included_ids = $this->object->entity_ids;
407
  foreach ($this->object->exclusions as $excluded_id) {
408
- if (($index = array_search($excluded_id, $included_entity_ids)) !== FALSE) {
409
- unset($included_entity_ids[$index]);
410
  }
411
  }
412
  $excluded_ids = array_diff($entity_ids, $included_ids);
@@ -484,8 +510,8 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
484
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
485
  $image_mapper = $this->object->get_registry()->get_utility('I_Image_Mapper');
486
  $gallery_key = $gallery_mapper->get_primary_key_column();
487
- $album_select = ($id_only ? $album_key : '*').", 1 AS is_album, 0 AS is_gallery, name AS title, albumdesc AS galdesc";
488
- $gallery_select = ($id_only ? $gallery_key : '*').", 1 AS is_gallery, 0 AS is_album";
489
 
490
  // Modify the sort order of the entities
491
  if ($this->object->sortorder) {
@@ -820,9 +846,13 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
820
  */
821
  function get_source()
822
  {
 
823
  $sources = $this->object->_get_source_map();
824
- $mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Source_Mapper');
825
- $retval = $mapper->find_by_name($sources[$this->object->source], TRUE);
 
 
 
826
  return $retval;
827
  }
828
 
@@ -873,35 +903,15 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
873
  */
874
  function to_transient()
875
  {
876
- // TODO: put this someplace more appropriate
877
- // If the source is random do a separate image id lookup and fill those values into the gallery entity_ids
878
- // This is necessary for compat w/Pro Lightbox so it can retrieve (through it's iframe request) the same images
879
- // the viewer was previously looking at.
880
- if (in_array($this->object->source, array('random', 'random_images')) && empty($this->object->entity_ids))
881
- {
882
- global $wpdb;
883
-
884
- $image_ids = array();
885
- $limit = (!empty($this->object->display_settings['images_per_page']) ? $this->object->display_settings['images_per_page'] : $this->object->maximum_entity_count);
886
-
887
- $sql = "SELECT `pid` FROM `{$wpdb->nggpictures}` WHERE `exclude` = 0";
888
- if (!empty($this->object->exclusions))
889
- $sql .= sprintf(" AND `pid` NOT IN (%s)", implode(',', $this->object->exclusions));
890
- $sql .= " ORDER BY RAND() LIMIT {$limit}";
891
-
892
- foreach ($wpdb->get_results($sql, ARRAY_N) as $res) {
893
- $image_ids[] = reset($res);
894
- }
895
-
896
- $this->object->entity_ids = $image_ids;
897
- }
898
-
899
  $group = 'displayed_galleries';
900
  $key = C_Photocrati_Cache::generate_key($this->object->get_entity(), $group);
901
  if (is_null(C_Photocrati_Cache::get($key, NULL, $group))) {
902
  C_Photocrati_Cache::set($key, $this->object->get_entity(), $group, 1800);
903
  }
904
 
 
 
 
905
  return $key;
906
  }
907
 
@@ -910,11 +920,16 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
910
  * Applies the values of a transient to this object
911
  * @param string $transient_id
912
  */
913
- function apply_transient($transient_id)
914
  {
915
  $retval = FALSE;
916
- if (($transient = C_Photocrati_Cache::get($transient_id, FALSE, 'displayed_galleries'))) {
 
 
 
917
  $this->object->_stdObject = $transient;
 
 
918
  $retval = TRUE;
919
  }
920
 
17
  {
18
  var $_mapper_interface = 'I_Displayed_Gallery_Mapper';
19
 
20
+ function define($properties=array(), $mapper=FALSE, $context=FALSE)
21
  {
22
  parent::define($mapper, $properties, $context);
23
  $this->add_mixin('Mixin_Displayed_Gallery_Validation');
33
  * @param array|stdClass|C_Displayed_Gallery $properties
34
  * @param FALSE|string|array $context
35
  */
36
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
37
  {
38
  if (!$mapper) $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
39
  parent::initialize($mapper, $properties);
40
+
41
+ $this->select_random_variation();
42
  }
43
  }
44
 
92
 
93
  class Mixin_Displayed_Gallery_Queries extends Mixin
94
  {
95
+ function select_random_variation()
96
+ {
97
+ $retval = FALSE;
98
+
99
+ $source_obj = $this->object->get_source();
100
+ if ($source_obj && $source_obj->has_variations) {
101
+ $max = 0;
102
+ if (!defined('NGG_MAX_VARIATIONS')) {
103
+ $settings = C_Photocrati_Global_Settings_Manager::get_instance();
104
+ $max = $settings->get('max_variations', 5);
105
+ define('NGG_MAX_VARIATIONS', $max);
106
+ }
107
+ else $max = NGG_MAX_VARIATIONS;
108
+
109
+ $this->object->variation = floor(rand(1, $max));
110
+
111
+ $retval = $this->object->variation;
112
+ }
113
+
114
+ return $retval;
115
+ }
116
+
117
  function get_entities($limit=FALSE, $offset=FALSE, $id_only=FALSE, $returns='included')
118
  {
119
  $retval = array();
158
  // Find a way to minimalize or segment
159
  $mapper = $this->get_registry()->get_utility('I_Image_Mapper');
160
  $image_key = $mapper->get_primary_key_column();
161
+ $select = $id_only ? $image_key : $mapper->get_table_name().'.*';
162
  $sort_direction = $this->object->order_direction;
163
  $sort_by = $this->object->order_by;
164
 
344
  }
345
 
346
  // Apply a sorting order
347
+ if ($sort_by) $mapper->order_by($sort_by, $sort_direction);
348
 
349
  // Apply a limit
350
  if ($limit) {
352
  else $mapper->limit($limit);
353
  }
354
 
355
+ $results = $mapper->run_query();
356
+
357
+ return $results;
358
  }
359
 
360
  /**
376
  $album_key = $album_mapper->get_primary_key_column();
377
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
378
  $gallery_key = $gallery_mapper->get_primary_key_column();
379
+ $select = $id_only ? $album_key.", sortorder" : $album_mapper->get_table_name().'.*';
380
  $retval = array();
381
 
382
  // If no exclusions are specified, are entity_ids are specified,
431
  // always take precedence
432
  $included_ids = $this->object->entity_ids;
433
  foreach ($this->object->exclusions as $excluded_id) {
434
+ if (($index = array_search($excluded_id, $included_ids)) !== FALSE) {
435
+ unset($included_ids[$index]);
436
  }
437
  }
438
  $excluded_ids = array_diff($entity_ids, $included_ids);
510
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
511
  $image_mapper = $this->object->get_registry()->get_utility('I_Image_Mapper');
512
  $gallery_key = $gallery_mapper->get_primary_key_column();
513
+ $album_select = ($id_only ? $album_key : $album_mapper->get_table_name().'.*').", 1 AS is_album, 0 AS is_gallery, name AS title, albumdesc AS galdesc";
514
+ $gallery_select = ($id_only ? $gallery_key : $gallery_mapper->get_table_name().'.*').", 1 AS is_gallery, 0 AS is_album";
515
 
516
  // Modify the sort order of the entities
517
  if ($this->object->sortorder) {
846
  */
847
  function get_source()
848
  {
849
+ $retval = NULL;
850
  $sources = $this->object->_get_source_map();
851
+ if (isset($sources[$this->object->source])) {
852
+ $mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Source_Mapper');
853
+ $retval = $mapper->find_by_name($sources[$this->object->source], TRUE);
854
+ }
855
+
856
  return $retval;
857
  }
858
 
903
  */
904
  function to_transient()
905
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
906
  $group = 'displayed_galleries';
907
  $key = C_Photocrati_Cache::generate_key($this->object->get_entity(), $group);
908
  if (is_null(C_Photocrati_Cache::get($key, NULL, $group))) {
909
  C_Photocrati_Cache::set($key, $this->object->get_entity(), $group, 1800);
910
  }
911
 
912
+ $this->object->transient_id = $key;
913
+ if (!$this->object->id()) $this->object->id($key);
914
+
915
  return $key;
916
  }
917
 
920
  * Applies the values of a transient to this object
921
  * @param string $transient_id
922
  */
923
+ function apply_transient($transient_id=NULL)
924
  {
925
  $retval = FALSE;
926
+
927
+ if (!$transient_id && isset($this->object->transient_id)) $transient_id = $this->object->transient_id;
928
+
929
+ if ($transient_id && ($transient = C_Photocrati_Cache::get($transient_id, FALSE, 'displayed_galleries'))) {
930
  $this->object->_stdObject = $transient;
931
+ $this->object->transient_id = $transient_id;
932
+ if (!$this->object->id()) $this->object->id($transient_id);
933
  $retval = TRUE;
934
  }
935
 
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_mapper.php CHANGED
@@ -4,9 +4,9 @@ class C_Displayed_Gallery_Mapper extends C_CustomPost_DataMapper_Driver
4
  {
5
  static $_instances = array();
6
 
7
- function define($context=FALSE)
8
  {
9
- parent::define(NULL, array($context, 'display_gallery'));
10
  $this->add_mixin('Mixin_Displayed_Gallery_Defaults');
11
  $this->implement('I_Displayed_Gallery_Mapper');
12
  $this->set_model_factory_method('displayed_gallery');
4
  {
5
  static $_instances = array();
6
 
7
+ function define($context=FALSE, $not_used=FALSE)
8
  {
9
+ parent::define('displayed_gallery', array($context, 'displayed_gallery', 'display_gallery'));
10
  $this->add_mixin('Mixin_Displayed_Gallery_Defaults');
11
  $this->implement('I_Displayed_Gallery_Mapper');
12
  $this->set_model_factory_method('displayed_gallery');
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_renderer.php CHANGED
@@ -95,7 +95,7 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
95
 
96
  // Configure the arguments
97
  $defaults = array(
98
- 'id' => NULL,
99
  'source' => '',
100
  'container_ids' => array(),
101
  'gallery_ids' => array(),
@@ -186,7 +186,7 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
186
 
187
  // Create the displayed gallery
188
  $factory = $this->get_registry()->get_utility('I_Component_Factory');
189
- $displayed_gallery = $factory->create('displayed_gallery', $mapper, $args);
190
 
191
  unset($factory);
192
  }
@@ -198,7 +198,6 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
198
  // Set a temporary id
199
  $displayed_gallery->id($displayed_gallery->to_transient());
200
 
201
-
202
  // Display!
203
  return $this->object->render($displayed_gallery, TRUE, $mode);
204
  }
@@ -215,6 +214,26 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
215
  return $retval;
216
  }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
  /**
220
  * Renders a displayed gallery on the frontend
@@ -222,44 +241,58 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
222
  */
223
  function render($displayed_gallery, $return=FALSE, $mode = null)
224
  {
 
 
 
 
225
  // Simply throwing our rendered gallery into a feed will most likely not work correctly.
226
  // The MediaRSS option in NextGEN is available as an alternative.
227
  if(is_feed())
228
  return '';
229
 
230
- if ($mode == null)
231
- {
232
- $mode = 'normal';
233
- }
234
 
235
  // Save the displayed gallery as a transient if it hasn't already. Allows for ajax operations
236
  // to add or modify the gallery without losing a retrievable ID
237
- if (empty($displayed_gallery->transient_id))
238
- $displayed_gallery->transient_id = $displayed_gallery->to_transient();
 
239
 
240
  // Get the display type controller
241
  $controller = $this->get_registry()->get_utility(
242
  'I_Display_Type_Controller', $displayed_gallery->display_type
243
  );
244
 
245
- // Enqueue any necessary static resources
246
- $controller->enqueue_frontend_resources($displayed_gallery);
247
-
248
  // Get routing info
249
  $router = $url = C_Router::get_instance();
250
  $url = $router->get_url($router->get_request_uri(), TRUE);
251
 
252
  // Should we lookup in cache?
253
- $lookup = TRUE;
254
- if ($displayed_gallery->source == 'random_images') $lookup = FALSE;
255
- elseif (is_array($displayed_gallery->container_ids) && in_array('All', $displayed_gallery->container_ids)) $lookup = FALSE;
256
  elseif ($displayed_gallery->source == 'albums' && ($controller->param('gallery')) OR $controller->param('album')) $lookup = FALSE;
257
- elseif (!$controller->cachable) $lookup = FALSE;
 
 
 
 
258
 
259
  // Try cache lookup, if we're to do so
260
  $key = null;
261
  $html = FALSE;
262
  if ($lookup) {
 
 
 
 
 
 
 
 
 
 
263
  // Some settings affect display types
264
  $settings = C_NextGen_Settings::get_instance();
265
  $key_params = apply_filters('ngg_displayed_gallery_cache_params', array(
@@ -276,43 +309,43 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
276
  ));
277
 
278
  // Try getting the rendered HTML from the cache
279
- $key = C_Photocrati_Cache::generate_key($key_params);
280
- $html = C_Photocrati_Cache::get($key, FALSE);
 
 
 
 
 
281
 
282
  // TODO: This is hack. We need to figure out a more uniform way of detecting dynamic image urls
283
- if (strpos($html, C_Photocrati_Settings_Manager::get_instance()->dynamic_thumbnail_slug) !== FALSE) {
284
  $html = FALSE; // forces the cache to be re-generated
285
  }
286
  }
 
 
 
 
 
 
287
 
288
  // If a cached version doesn't exist, then create the cache
289
  if (!$html) {
 
 
 
290
  $current_mode = $controller->get_render_mode();
291
  $controller->set_render_mode($mode);
292
  $html = $controller->index_action($displayed_gallery, TRUE);
293
- if ($key != null)
294
- C_Photocrati_Cache::set($key, $html);
295
  $controller->set_render_mode($current_mode);
296
-
297
- // Compress the html to avoid wpautop problems
298
- $html = $this->compress_html($html);
299
  }
300
 
301
- if (!$return) echo $html;
302
 
303
- return $html;
304
- }
305
 
306
- /**
307
- * Removes any un-nessessary whitespace from the HTML
308
- * @param string $html
309
- * @return string
310
- */
311
- function compress_html($html)
312
- {
313
- $html = preg_replace("/>\\s+/", ">", $html);
314
- $html = preg_replace("/\\s+</", "<", $html);
315
- $html = preg_replace("/<!--(?:(?!-->).)*-->/m", "", $html);
316
- return $html;
317
- }
318
  }
95
 
96
  // Configure the arguments
97
  $defaults = array(
98
+ 'id' => NULL,
99
  'source' => '',
100
  'container_ids' => array(),
101
  'gallery_ids' => array(),
186
 
187
  // Create the displayed gallery
188
  $factory = $this->get_registry()->get_utility('I_Component_Factory');
189
+ $displayed_gallery = $factory->create('displayed_gallery', $args, $mapper);
190
 
191
  unset($factory);
192
  }
198
  // Set a temporary id
199
  $displayed_gallery->id($displayed_gallery->to_transient());
200
 
 
201
  // Display!
202
  return $this->object->render($displayed_gallery, TRUE, $mode);
203
  }
214
  return $retval;
215
  }
216
 
217
+ function debug_msg($msg, $print_r=FALSE)
218
+ {
219
+ $retval = '';
220
+
221
+ if (C_NextGEN_Bootstrap::$debug) {
222
+ ob_start();
223
+ if ($print_r) {
224
+ echo '<pre>';
225
+ print_r($msg);
226
+ echo '</pre>';
227
+ }
228
+ else
229
+ var_dump($msg);
230
+
231
+ $retval = ob_get_clean();
232
+ }
233
+
234
+ return $retval;
235
+ }
236
+
237
 
238
  /**
239
  * Renders a displayed gallery on the frontend
241
  */
242
  function render($displayed_gallery, $return=FALSE, $mode = null)
243
  {
244
+ $retval = '';
245
+ $lookup = TRUE;
246
+ $cache = C_Photocrati_Cache::get_instance('displayed_gallery_rendering');
247
+
248
  // Simply throwing our rendered gallery into a feed will most likely not work correctly.
249
  // The MediaRSS option in NextGEN is available as an alternative.
250
  if(is_feed())
251
  return '';
252
 
253
+ if ($mode == null)
254
+ {
255
+ $mode = 'normal';
256
+ }
257
 
258
  // Save the displayed gallery as a transient if it hasn't already. Allows for ajax operations
259
  // to add or modify the gallery without losing a retrievable ID
260
+ if (!$displayed_gallery->apply_transient()) {
261
+ $displayed_gallery->to_transient();
262
+ }
263
 
264
  // Get the display type controller
265
  $controller = $this->get_registry()->get_utility(
266
  'I_Display_Type_Controller', $displayed_gallery->display_type
267
  );
268
 
 
 
 
269
  // Get routing info
270
  $router = $url = C_Router::get_instance();
271
  $url = $router->get_url($router->get_request_uri(), TRUE);
272
 
273
  // Should we lookup in cache?
274
+ if (is_array($displayed_gallery->container_ids) && in_array('All', $displayed_gallery->container_ids)) $lookup = FALSE;
 
 
275
  elseif ($displayed_gallery->source == 'albums' && ($controller->param('gallery')) OR $controller->param('album')) $lookup = FALSE;
276
+ elseif ($controller->param('show')) $lookup = FALSE;
277
+ elseif ($controller->cachable === FALSE) $lookup = FALSE;
278
+
279
+ // Enqueue any necessary static resources
280
+ $controller->enqueue_frontend_resources($displayed_gallery);
281
 
282
  // Try cache lookup, if we're to do so
283
  $key = null;
284
  $html = FALSE;
285
  if ($lookup) {
286
+
287
+ // The display type may need to output some things
288
+ // even when serving from the cache
289
+ if ($controller->has_method('cache_action')) {
290
+ $retval = $controller->cache_action($displayed_gallery);
291
+ }
292
+
293
+ // Output debug message
294
+ $retval .= $this->debug_msg("Lookup!");
295
+
296
  // Some settings affect display types
297
  $settings = C_NextGen_Settings::get_instance();
298
  $key_params = apply_filters('ngg_displayed_gallery_cache_params', array(
309
  ));
310
 
311
  // Try getting the rendered HTML from the cache
312
+ $key = $cache->generate_key($key_params);
313
+ $html = $cache->lookup($key, FALSE);
314
+
315
+ // Output debug messages
316
+ if ($html) $retval .= $this->debug_msg("HIT!");
317
+ else $retval .= $this->debug_msg("MISS!");
318
+
319
 
320
  // TODO: This is hack. We need to figure out a more uniform way of detecting dynamic image urls
321
+ if (strpos($html, C_Photocrati_Settings_Manager::get_instance()->dynamic_thumbnail_slug.'/') !== FALSE) {
322
  $html = FALSE; // forces the cache to be re-generated
323
  }
324
  }
325
+ else $retval .= $this->debug_msg("Not looking up in cache as per rules");
326
+
327
+ // If we're displaying a variant, I want to know it
328
+ if (isset($displayed_gallery->variation) && is_numeric($displayed_gallery->variation) && $displayed_gallery->variation > 0) {
329
+ $retval .= $this->debug_msg("Using variation #{$displayed_gallery->variation}!");
330
+ }
331
 
332
  // If a cached version doesn't exist, then create the cache
333
  if (!$html) {
334
+
335
+ $retval .= $this->debug_msg("Rendering displayed gallery");
336
+
337
  $current_mode = $controller->get_render_mode();
338
  $controller->set_render_mode($mode);
339
  $html = $controller->index_action($displayed_gallery, TRUE);
340
+ if ($key != null) $cache->update($key, $html);
 
341
  $controller->set_render_mode($current_mode);
 
 
 
342
  }
343
 
344
+ $retval .= $html;
345
 
 
 
346
 
347
+ if (!$return) echo $retval;
348
+
349
+ return $retval;
350
+ }
 
 
 
 
 
 
 
 
351
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_source.php CHANGED
@@ -9,7 +9,7 @@ class C_Displayed_Gallery_Source extends C_DataMapper_Model
9
  {
10
  var $_mapper_interface = 'I_Displayed_Gallery_Source_Mapper';
11
 
12
- function define($mapper, $properties, $context=FALSE)
13
  {
14
  parent::define($mapper, $properties, $context);
15
  $this->add_mixin('Mixin_Displayed_Gallery_Source');
@@ -22,7 +22,7 @@ class C_Displayed_Gallery_Source extends C_DataMapper_Model
22
  * @param type $mapper
23
  * @param type $properties
24
  */
25
- function initialize($mapper=FALSE, $properties=array())
26
  {
27
  // If no mapper was specified, then get the mapper
28
  if (!$mapper) $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
9
  {
10
  var $_mapper_interface = 'I_Displayed_Gallery_Source_Mapper';
11
 
12
+ function define($properties=array(), $mapper=FALSE, $context=FALSE)
13
  {
14
  parent::define($mapper, $properties, $context);
15
  $this->add_mixin('Mixin_Displayed_Gallery_Source');
22
  * @param type $mapper
23
  * @param type $properties
24
  */
25
+ function initialize($properties=array(), $mapper=FALSE, $context=FALSE)
26
  {
27
  // If no mapper was specified, then get the mapper
28
  if (!$mapper) $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_source_mapper.php CHANGED
@@ -25,7 +25,7 @@ class C_Displayed_Gallery_Source_Mapper extends C_CustomPost_DataMapper_Driver
25
  * Define the mapper
26
  * @param string|array|bool $context
27
  */
28
- function define($context=FALSE)
29
  {
30
  $object_name = 'gal_display_source';
31
 
@@ -35,7 +35,7 @@ class C_Displayed_Gallery_Source_Mapper extends C_CustomPost_DataMapper_Driver
35
  array_push($context, $object_name);
36
 
37
  // Define the driver
38
- parent::define(NULL, $context);
39
 
40
  // Add the mixin of instance methods
41
  $this->add_mixin('Mixin_Displayed_Gallery_Source_Mapper');
@@ -85,5 +85,7 @@ class Mixin_Displayed_Gallery_Source_Mapper extends Mixin
85
  function set_defaults($entity)
86
  {
87
  if (!isset($entity->aliases)) $entity->aliases = array();
 
 
88
  }
89
  }
25
  * Define the mapper
26
  * @param string|array|bool $context
27
  */
28
+ function define($context=FALSE, $not_used=FALSE)
29
  {
30
  $object_name = 'gal_display_source';
31
 
35
  array_push($context, $object_name);
36
 
37
  // Define the driver
38
+ parent::define($object_name, $context);
39
 
40
  // Add the mixin of instance methods
41
  $this->add_mixin('Mixin_Displayed_Gallery_Source_Mapper');
85
  function set_defaults($entity)
86
  {
87
  if (!isset($entity->aliases)) $entity->aliases = array();
88
+ $this->object->_set_default_value($entity, 'has_variations', FALSE);
89
+ $this->object->_set_default_value($entity, 'variation', 0);
90
  }
91
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.gallery_display_installer.php CHANGED
@@ -94,7 +94,8 @@ class C_Gallery_Display_Installer
94
  $this->install_displayed_gallery_source('random_images', array(
95
  'title' => 'Random Images',
96
  'returns' => array('image'),
97
- 'aliases' => array('random', 'random_image')
 
98
  ));
99
 
100
  $this->install_displayed_gallery_source('recent_images', array(
@@ -121,6 +122,7 @@ class C_Gallery_Display_Installer
121
  // Flush displayed gallery cache
122
  C_Photocrati_Cache::flush();
123
  C_Photocrati_Cache::flush('displayed_galleries');
 
124
 
125
  $this->uninstall_display_types();
126
  $this->uninstall_displayed_gallery_sources();
94
  $this->install_displayed_gallery_source('random_images', array(
95
  'title' => 'Random Images',
96
  'returns' => array('image'),
97
+ 'aliases' => array('random', 'random_image'),
98
+ 'has_variations' => TRUE
99
  ));
100
 
101
  $this->install_displayed_gallery_source('recent_images', array(
122
  // Flush displayed gallery cache
123
  C_Photocrati_Cache::flush();
124
  C_Photocrati_Cache::flush('displayed_galleries');
125
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
126
 
127
  $this->uninstall_display_types();
128
  $this->uninstall_displayed_gallery_sources();
products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php CHANGED
@@ -19,7 +19,7 @@ class M_Gallery_Display extends C_Base_Module
19
  'photocrati-nextgen_gallery_display',
20
  'Gallery Display',
21
  'Provides the ability to display gallery of images',
22
- '0.3',
23
  'http://www.photocrati.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
@@ -82,10 +82,12 @@ class M_Gallery_Display extends C_Base_Module
82
  'I_Component_Factory', 'A_Gallery_Display_Factory'
83
  );
84
 
85
- $this->get_registry()->add_adapter(
86
- 'I_Page_Manager',
87
- 'A_Display_Settings_Page'
88
- );
 
 
89
 
90
  $this->_get_registry()->add_adapter(
91
  'I_Ajax_Controller',
@@ -105,6 +107,37 @@ class M_Gallery_Display extends C_Base_Module
105
  add_action('init', array(&$this, '_register_resources'));
106
  add_action('admin_bar_menu', array(&$this, 'add_admin_bar_menu'), 100);
107
  add_filter('the_content', array($this, '_render_related_images'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  function _render_related_string()
@@ -199,7 +232,21 @@ class M_Gallery_Display extends C_Base_Module
199
  */
200
  function _register_resources()
201
  {
202
- $router = $this->get_registry()->get_utility('I_Router');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  wp_register_script(
205
  'nextgen_gallery_display_settings',
19
  'photocrati-nextgen_gallery_display',
20
  'Gallery Display',
21
  'Provides the ability to display gallery of images',
22
+ '0.7',
23
  'http://www.photocrati.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
82
  'I_Component_Factory', 'A_Gallery_Display_Factory'
83
  );
84
 
85
+ if (is_admin()) {
86
+ $this->get_registry()->add_adapter(
87
+ 'I_Page_Manager',
88
+ 'A_Display_Settings_Page'
89
+ );
90
+ }
91
 
92
  $this->_get_registry()->add_adapter(
93
  'I_Ajax_Controller',
107
  add_action('init', array(&$this, '_register_resources'));
108
  add_action('admin_bar_menu', array(&$this, 'add_admin_bar_menu'), 100);
109
  add_filter('the_content', array($this, '_render_related_images'));
110
+ add_action('wp_enqueue_scripts', array(&$this, 'no_resources_mode'), PHP_INT_MAX-1);
111
+ add_filter('run_ngg_resource_manager', array(&$this, 'no_resources_mode'));
112
+ }
113
+
114
+
115
+ function no_resources_mode($valid_request=TRUE)
116
+ {
117
+ if (isset($_REQUEST['ngg_no_resources'])) {
118
+ global $wp_scripts, $wp_styles;
119
+
120
+ // Don't enqueue any stylesheets
121
+ if ($wp_scripts)
122
+ $wp_scripts->queue = $wp_styles->queue = array();
123
+
124
+ // Don't do any actions that we don't have to
125
+ // remove_all_actions('wp_loaded');
126
+ // remove_all_actions('get_header');
127
+ // remove_all_actions('wp_head');
128
+ // remove_all_actions('get_search_form');
129
+ // remove_all_actions('loop_end');
130
+ // remove_all_actions('pre_get_comments');
131
+ // remove_all_actions('wp_meta');
132
+ // remove_all_actions('get_footer');
133
+ // remove_all_actions('wp_footer');
134
+ // remove_all_actions('wp_print_footer_scripts');
135
+
136
+ // Don't run the resource manager
137
+ $valid_request = FALSE;
138
+ }
139
+
140
+ return $valid_request;
141
  }
142
 
143
  function _render_related_string()
232
  */
233
  function _register_resources()
234
  {
235
+ // Register custom post types for compatibility
236
+ $types = array(
237
+ 'displayed_gallery' => 'NextGEN Gallery - Displayed Gallery',
238
+ 'display_type' => 'NextGEN Gallery - Display Type',
239
+ 'gal_display_source' => 'NextGEN Gallery - Displayed Gallery Source'
240
+ );
241
+ foreach ($types as $type => $label) {
242
+ register_post_type($type, array(
243
+ 'label' => $label,
244
+ 'publicly_queryable' => FALSE,
245
+ 'exclude_from_search' => TRUE,
246
+ ));
247
+ }
248
+
249
+ $router = $this->get_registry()->get_utility('I_Router');
250
 
251
  wp_register_script(
252
  'nextgen_gallery_display_settings',
products/photocrati_nextgen/modules/nextgen_other_options/adapter.lightbox_manager_form.php CHANGED
@@ -40,7 +40,8 @@ class A_Lightbox_Manager_Form extends Mixin
40
  'id_field' => $mapper->get_primary_key_column(),
41
  'selected' => $this->object->get_model()->thumbEffect,
42
  'sub_fields' => $sub_fields,
43
- 'adv_fields' => $advanced_fields
 
44
  ),
45
  TRUE
46
  );
@@ -94,5 +95,10 @@ class A_Lightbox_Manager_Form extends Mixin
94
  }
95
  }
96
  }
 
 
 
 
 
97
  }
98
  }
40
  'id_field' => $mapper->get_primary_key_column(),
41
  'selected' => $this->object->get_model()->thumbEffect,
42
  'sub_fields' => $sub_fields,
43
+ 'adv_fields' => $advanced_fields,
44
+ 'lightbox_global' => $this->object->get_model()->thumbEffectContext,
45
  ),
46
  TRUE
47
  );
95
  }
96
  }
97
  }
98
+
99
+ if (($thumbEffectContext = $this->object->param('thumbEffectContext'))) {
100
+ $settings->thumbEffectContext = $thumbEffectContext;
101
+ $settings->save();
102
+ }
103
  }
104
  }
products/photocrati_nextgen/modules/nextgen_other_options/adapter.miscellaneous_form.php CHANGED
@@ -54,6 +54,7 @@ class A_Miscellaneous_Form extends Mixin
54
  $cache->flush_galleries();
55
  C_Photocrati_Cache::flush();
56
  C_Photocrati_Cache::flush('displayed_galleries');
 
57
  }
58
 
59
  function save_action()
54
  $cache->flush_galleries();
55
  C_Photocrati_Cache::flush();
56
  C_Photocrati_Cache::flush('displayed_galleries');
57
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
58
  }
59
 
60
  function save_action()
products/photocrati_nextgen/modules/nextgen_other_options/module.nextgen_other_options.php CHANGED
@@ -16,7 +16,7 @@ class M_NextGen_Other_Options extends C_Base_Module
16
  'photocrati-nextgen_other_options',
17
  'Other Options',
18
  'NextGEN Gallery Others Options Page',
19
- '0.4',
20
  'http://www.nextgen-gallery.com',
21
  'Photocrati Media',
22
  'http://www.photocrati.com'
16
  'photocrati-nextgen_other_options',
17
  'Other Options',
18
  'NextGEN Gallery Others Options Page',
19
+ '0.5',
20
  'http://www.nextgen-gallery.com',
21
  'Photocrati Media',
22
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/nextgen_other_options/templates/lightbox_library_tab.php CHANGED
@@ -44,6 +44,24 @@
44
  <?php echo $form; ?>
45
  </tbody>
46
  <?php } ?>
47
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  </tbody>
49
- </table>
44
  <?php echo $form; ?>
45
  </tbody>
46
  <?php } ?>
47
+ <tr>
48
+ <td>&nbsp;
49
+ </td>
50
+ <td>&nbsp;
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <td class="column1">
55
+ <label for="lightbox_global"><?php esc_html_e('What must the lightbox be applied to?', 'nggallery')?></label>
56
+ </td>
57
+ <td>
58
+ <select name="thumbEffectContext" id="lightbox_global">
59
+ <option value="nextgen_images" <?php selected('nextgen_images', $lightbox_global, TRUE)?>><?php esc_html_e('Only apply to NextGEN images', 'nggallery'); ?></option>
60
+ <option value="nextgen_and_wp_images" <?php selected('nextgen_and_wp_images', $lightbox_global, TRUE)?>><?php esc_html_e('Only apply to NextGEN and WordPress images', 'nggallery'); ?></option>
61
+ <option value="all_images" <?php selected('all_images', $lightbox_global, TRUE)?>><?php esc_html_e('Try to apply to all images', 'nggallery'); ?></option>
62
+ <option value="all_images_direct" <?php selected('all_images_direct', $lightbox_global, TRUE)?>><?php esc_html_e('Try to apply to all images that link to image files', 'nggallery'); ?></option>
63
+ </select>
64
+ </td>
65
+ </tr>
66
  </tbody>
67
+ </table>
products/photocrati_nextgen/modules/nextgen_pagination/mixin.nextgen_basic_pagination.php CHANGED
@@ -20,8 +20,26 @@ class Mixin_NextGen_Basic_Pagination extends Mixin
20
  $next_symbol = apply_filters('ngg_next_symbol', '&#9658;');
21
 
22
  if (empty($current_url))
 
23
  $current_url = $this->object->get_routed_url(TRUE);
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  $return = array('prev' => '', 'next' => '', 'output' => '');
26
 
27
  if ($maxElement <= 0)
@@ -75,4 +93,4 @@ class Mixin_NextGen_Basic_Pagination extends Mixin
75
 
76
  return $return;
77
  }
78
- }
20
  $next_symbol = apply_filters('ngg_next_symbol', '&#9658;');
21
 
22
  if (empty($current_url))
23
+ {
24
  $current_url = $this->object->get_routed_url(TRUE);
25
 
26
+ if (is_archive())
27
+ {
28
+ $id = get_the_ID();
29
+
30
+ if ($id == null)
31
+ {
32
+ global $post;
33
+ $id = $post ? $post->ID : null;
34
+ }
35
+
36
+ if ($id != null && in_the_loop())
37
+ {
38
+ $current_url = get_permalink($id);
39
+ }
40
+ }
41
+ }
42
+
43
  $return = array('prev' => '', 'next' => '', 'output' => '');
44
 
45
  if ($maxElement <= 0)
93
 
94
  return $return;
95
  }
96
+ }
products/photocrati_nextgen/modules/nextgen_settings/class.nextgen_settings_installer.php CHANGED
@@ -71,6 +71,7 @@ class C_NextGen_Settings_Installer
71
  // Thumbnail Effect
72
  'thumbEffect' => 'fancybox', // select effect
73
  'thumbCode' => 'class="ngg-fancybox" rel="%GALLERY_NAME%"',
 
74
 
75
  // Watermark settings
76
  'wmPos' => 'botRight', // Postion
71
  // Thumbnail Effect
72
  'thumbEffect' => 'fancybox', // select effect
73
  'thumbCode' => 'class="ngg-fancybox" rel="%GALLERY_NAME%"',
74
+ 'thumbEffectContext' => 'nextgen_images', // select effect
75
 
76
  // Watermark settings
77
  'wmPos' => 'botRight', // Postion
products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php CHANGED
@@ -17,7 +17,7 @@ class M_NextGen_Settings extends C_Base_Module
17
  'photocrati-nextgen_settings',
18
  'NextGEN Gallery Settings',
19
  'Provides central management for NextGEN Gallery settings',
20
- '0.2',
21
  'http://www.nextgen-gallery.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
17
  'photocrati-nextgen_settings',
18
  'NextGEN Gallery Settings',
19
  'Provides central management for NextGEN Gallery settings',
20
+ '0.3',
21
  'http://www.nextgen-gallery.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php CHANGED
@@ -13,7 +13,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
13
  'photocrati-nextgen_xmlrpc',
14
  'NextGEN Gallery XML-RPC',
15
  'Provides an XML-RPC API for NextGEN Gallery',
16
- '0.1',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
@@ -66,7 +66,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
66
  * @param $password
67
  * @return bool|WP_Error|WP_User
68
  */
69
- function login($username, $password, $blog_id=1)
70
  {
71
  $retval = FALSE;
72
 
@@ -80,7 +80,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
80
  return $retval;
81
  }
82
 
83
- function can_manage_gallery($gallery_id_or_obj, $check_upload_capability=FALSE)
84
  {
85
  $retval = FALSE;
86
 
@@ -90,20 +90,45 @@ class M_NextGen_XmlRpc extends C_Base_Module
90
  $gallery_mapper = C_Gallery_Mapper::get_instance();
91
  $gallery = $gallery_mapper->find($gallery_id_or_obj);
92
  }
 
93
 
94
- $security = $this->get_registry()->get_utility('I_Security_Manager');
95
- $actor = $security->get_current_actor();
96
- if ($actor->get_entity_id() == $gallery->author) $retval = TRUE;
97
- elseif ($actor->is_allowed('nextgen_edit_gallery_unowned')) $retval = TRUE;
 
98
 
99
- // Optionally, check if the user can upload to this gallery
100
- if ($retval && $check_upload_capability) {
101
- $retval = $actor->is_allowed('nextgen_upload_image');
 
102
  }
103
 
104
  return $retval;
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  /**
108
  * Returns a single image object
109
  * @param $args (blog_id, username, password, pid)
@@ -117,7 +142,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
117
  $image_id = intval($args[3]);
118
 
119
  // Authenticate the user
120
- if ($this->login($username, $password, $blog_id)) {
121
 
122
  // Try to find the image
123
  $image_mapper = C_Image_Mapper::get_instance();
@@ -128,10 +153,10 @@ class M_NextGen_XmlRpc extends C_Base_Module
128
  if (($gallery = $gallery_mapper->find($image->galleryid))) {
129
 
130
  // Does the user have sufficient capabilities?
131
- if ($this->can_manage_gallery($gallery)) {
132
  $storage = C_Gallery_Storage::get_instance();
133
- $image->imageURL = $storage->get_image_url($image);
134
- $image->thumbURL = $storage->get_thumb_url($image);
135
  $image->imagePath = $storage->get_image_abspath($image);
136
  $image->thumbPath = $storage->get_thumb_abspath($image);
137
  $retval = $return_model ? $image : $image->get_entity();
@@ -168,14 +193,14 @@ class M_NextGen_XmlRpc extends C_Base_Module
168
  $gallery_id = intval($args[3]);
169
 
170
  // Authenticate the user
171
- if ($this->login($username, $password, $blog_id)) {
172
 
173
  // Try to find the gallery
174
  $mapper = C_Gallery_Mapper::get_instance();
175
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
176
 
177
  // Does the user have sufficient capabilities?
178
- if ($this->can_manage_gallery($gallery)) {
179
  $retval = $gallery->get_images();
180
  }
181
  else {
@@ -215,14 +240,14 @@ class M_NextGen_XmlRpc extends C_Base_Module
215
  $gallery_id = isset($data['gallery_id']) ? $data['gallery_id'] : $data['gallery'];
216
 
217
  // Authenticate the user
218
- if ($this->login($username, $password, $blog_id)) {
219
 
220
  // Try to find the gallery
221
  $mapper = C_Gallery_Mapper::get_instance();
222
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
223
 
224
  // Does the user have sufficient capabilities?
225
- if ($this->can_manage_gallery($gallery, TRUE)) {
226
 
227
  // Upload the image
228
  $storage = C_Gallery_Storage::get_instance();
@@ -274,6 +299,11 @@ class M_NextGen_XmlRpc extends C_Base_Module
274
  $retval->$key = $value;
275
  }
276
 
 
 
 
 
 
277
  $retval = $retval->save();
278
  }
279
 
@@ -306,7 +336,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
306
  $title = strval($args[3]);
307
 
308
  // Authenticate the user
309
- if ($this->login($username, $password, $blog_id)) {
310
 
311
  $security = $this->get_registry()->get_utility('I_Security_Manager');
312
  if ($security->is_allowed('nextgen_edit_gallery')) {
@@ -336,21 +366,28 @@ class M_NextGen_XmlRpc extends C_Base_Module
336
  $gallery_id = intval($args[3]);
337
  $name = strval($args[4]);
338
  $title = strval($args[5]);
339
- $image_id = intval($args[6]);
340
- $properties = isset($args[7]) ? (array) $args[7] : array();
 
341
 
342
  // Authenticate the user
343
- if ($this->login($username, $password, $blog_id)) {
344
 
345
  $mapper = C_Gallery_Mapper::get_instance();
346
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
347
- if ($this->can_manage_gallery($gallery)) {
348
  $gallery->name = $name;
349
  $gallery->title = $title;
 
350
  $gallery->previewpic = $image_id;
351
  foreach ($properties as $key => $value) {
352
  $gallery->$key = $value;
353
  }
 
 
 
 
 
354
  $retval = $gallery->save();
355
  }
356
  else $retval = new IXR_Error(403, "You don't have permission to modify this gallery");
@@ -361,6 +398,36 @@ class M_NextGen_XmlRpc extends C_Base_Module
361
  return $retval;
362
  }
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  /**
365
  * Gets a single gallery instance
366
  * @param $args (blog_id, username, password, gallery_id)
@@ -374,12 +441,14 @@ class M_NextGen_XmlRpc extends C_Base_Module
374
  $gallery_id = intval($args[3]);
375
 
376
  // Authenticate the user
377
- if ($this->login($username, $password, $blog_id)) {
378
  $mapper = C_Gallery_Mapper::get_instance();
379
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
380
- if ($this->can_manage_gallery($gallery)) {
 
381
  $retval = $return_model ? $gallery : $gallery->get_entity();
382
  }
 
383
  }
384
  else $retval = FALSE;
385
  }
@@ -412,14 +481,14 @@ class M_NextGen_XmlRpc extends C_Base_Module
412
  $blog_id = intval($args[0]);
413
  $username = strval($args[1]);
414
  $password = strval($args[2]);
415
- $title = intval($args[3]);
416
  $previewpic = isset($args[4]) ? intval($args[4]): 0;
417
  $desc = isset($args[5]) ? strval($args[5]) : '';
418
  $sortorder = isset($args[6]) ? $args[6] : '';
419
  $page_id = isset($args[7]) ? intval($args[7]) : 0;
420
 
421
  // Authenticate the user
422
- if ($this->login($username, $password, $blog_id)) {
423
 
424
  // Is request allowed?
425
  $security = $this->get_registry()->get_utility('I_Security_Manager');
@@ -431,7 +500,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
431
  'previewpic' => $previewpic,
432
  'albumdesc' => $desc,
433
  'sortorder' => $sortorder,
434
- 'page_id' => $page_id
435
  ));
436
 
437
  if ($album->save()) $retval = $album->id();
@@ -456,7 +525,7 @@ class M_NextGen_XmlRpc extends C_Base_Module
456
  $password = strval($args[2]);
457
 
458
  // Authenticate the user
459
- if ($this->login($username, $password, $blog_id)) {
460
 
461
  // Are we allowed?
462
  $security = $this->get_registry()->get_utility('I_Security_Manager');
@@ -496,21 +565,23 @@ class M_NextGen_XmlRpc extends C_Base_Module
496
  $album_id = intval($args[3]);
497
 
498
  // Authenticate the user
499
- if ($this->login($username, $password, $blog_id)) {
500
 
501
  // Are we allowed?
502
  $security = $this->get_registry()->get_utility('I_Security_Manager');
503
  if ($security->is_allowed('nextgen_edit_album')) {
504
  $mapper = C_Album_Mapper::get_instance();
505
- $album = $mapper->find($album_id, TRUE);
 
 
 
 
 
506
 
507
- // Vladimir's Lightroom plugins requires the 'id' to be a string
508
- // Ask if he can accept integers as well. Currently, integers break
509
- // his plugin
510
- $album->id = (string) $album->id;
511
- $album->galleries = $album->sortorder;
512
 
513
- $retval = $return_model ? $album : $album->get_entity();
514
  }
515
  else $retval = new IXR_Error(403, "Sorry, you must be able to manage albums");
516
  }
@@ -556,47 +627,6 @@ class M_NextGen_XmlRpc extends C_Base_Module
556
 
557
  return $retval;
558
  }
559
-
560
-
561
- /**
562
- * Returns all galleries
563
- * @param $args (blog_id, username, password)
564
- */
565
- function get_galleries($args)
566
- {
567
- $retval = new IXR_Error(403, 'Invalid username or password');
568
- $blog_id = intval($args[0]);
569
- $username = strval($args[1]);
570
- $password = strval($args[2]);
571
-
572
- // Authenticate the user
573
- if ($this->login($username, $password, $blog_id)) {
574
-
575
- // Do we have permission?
576
- $security = $this->get_registry()->get_utility('I_Security_Manager');
577
- if ($security->is_allowed('nextgen_edit_gallery')) {
578
- $mapper = C_Gallery_Mapper::get_instance();
579
- $image_mapper = C_Image_Mapper::get_instance();
580
- $storage = C_Gallery_Storage::get_instance();
581
- $retval = array();
582
- foreach ($mapper->find_all() as $gallery) {
583
- // Vladimir's Lightroom plugins requires the 'id' to be a string
584
- // Ask if he can accept integers as well. Currently, integers break
585
- // his plugin
586
- $gallery->gid = (string) $gallery->gid;
587
-
588
- // Set other gallery properties
589
- $image_counter = array_pop($image_mapper->select('COUNT(*) as counter')->where(array("galleryid = %d", $gallery->gid))->run_query());
590
- $gallery->counter = $image_counter->counter;
591
- $gallery->abspath = $storage->get_gallery_abspath($gallery);
592
- $retval[$gallery->{$gallery->id_field}] = (array)$gallery;
593
- }
594
- }
595
- else $retval = new IXR_Error( 401, __( 'Sorry, you must be able to manage galleries' ) );
596
- }
597
-
598
- return $retval;
599
- }
600
  }
601
 
602
  new M_NextGen_XmlRpc;
13
  'photocrati-nextgen_xmlrpc',
14
  'NextGEN Gallery XML-RPC',
15
  'Provides an XML-RPC API for NextGEN Gallery',
16
+ '0.2',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
66
  * @param $password
67
  * @return bool|WP_Error|WP_User
68
  */
69
+ function _login($username, $password, $blog_id=1)
70
  {
71
  $retval = FALSE;
72
 
80
  return $retval;
81
  }
82
 
83
+ function _can_manage_gallery($gallery_id_or_obj, $check_upload_capability=FALSE)
84
  {
85
  $retval = FALSE;
86
 
90
  $gallery_mapper = C_Gallery_Mapper::get_instance();
91
  $gallery = $gallery_mapper->find($gallery_id_or_obj);
92
  }
93
+ else $gallery = $gallery_id_or_obj;
94
 
95
+ if ($gallery) {
96
+ $security = $this->get_registry()->get_utility('I_Security_Manager');
97
+ $actor = $security->get_current_actor();
98
+ if ($actor->get_entity_id() == $gallery->author) $retval = TRUE;
99
+ elseif ($actor->is_allowed('nextgen_edit_gallery_unowned')) $retval = TRUE;
100
 
101
+ // Optionally, check if the user can upload to this gallery
102
+ if ($retval && $check_upload_capability) {
103
+ $retval = $actor->is_allowed('nextgen_upload_image');
104
+ }
105
  }
106
 
107
  return $retval;
108
  }
109
 
110
+ function _add_gallery_properties($gallery)
111
+ {
112
+ if (is_object($gallery)) {
113
+
114
+ $image_mapper = C_Image_Mapper::get_instance();
115
+ $storage = C_Gallery_Storage::get_instance();
116
+
117
+ // Vladimir's Lightroom plugins requires the 'id' to be a string
118
+ // Ask if he can accept integers as well. Currently, integers break
119
+ // his plugin
120
+ $gallery->gid = (string) $gallery->gid;
121
+
122
+ // Set other gallery properties
123
+ $image_counter = array_pop($image_mapper->select('DISTINCT COUNT(*) as counter')->where(array("galleryid = %d", $gallery->gid))->run_query(FALSE, TRUE));
124
+ $gallery->counter = $image_counter->counter;
125
+ $gallery->abspath = $storage->get_gallery_abspath($gallery);
126
+ }
127
+ else return FALSE;
128
+
129
+ return TRUE;
130
+ }
131
+
132
  /**
133
  * Returns a single image object
134
  * @param $args (blog_id, username, password, pid)
142
  $image_id = intval($args[3]);
143
 
144
  // Authenticate the user
145
+ if ($this->_login($username, $password, $blog_id)) {
146
 
147
  // Try to find the image
148
  $image_mapper = C_Image_Mapper::get_instance();
153
  if (($gallery = $gallery_mapper->find($image->galleryid))) {
154
 
155
  // Does the user have sufficient capabilities?
156
+ if ($this->_can_manage_gallery($gallery)) {
157
  $storage = C_Gallery_Storage::get_instance();
158
+ $image->imageURL = $storage->get_image_url($image,'full', TRUE);
159
+ $image->thumbURL = $storage->get_thumb_url($image, TRUE);
160
  $image->imagePath = $storage->get_image_abspath($image);
161
  $image->thumbPath = $storage->get_thumb_abspath($image);
162
  $retval = $return_model ? $image : $image->get_entity();
193
  $gallery_id = intval($args[3]);
194
 
195
  // Authenticate the user
196
+ if ($this->_login($username, $password, $blog_id)) {
197
 
198
  // Try to find the gallery
199
  $mapper = C_Gallery_Mapper::get_instance();
200
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
201
 
202
  // Does the user have sufficient capabilities?
203
+ if ($this->_can_manage_gallery($gallery)) {
204
  $retval = $gallery->get_images();
205
  }
206
  else {
240
  $gallery_id = isset($data['gallery_id']) ? $data['gallery_id'] : $data['gallery'];
241
 
242
  // Authenticate the user
243
+ if ($this->_login($username, $password, $blog_id)) {
244
 
245
  // Try to find the gallery
246
  $mapper = C_Gallery_Mapper::get_instance();
247
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
248
 
249
  // Does the user have sufficient capabilities?
250
+ if ($this->_can_manage_gallery($gallery, TRUE)) {
251
 
252
  // Upload the image
253
  $storage = C_Gallery_Storage::get_instance();
299
  $retval->$key = $value;
300
  }
301
 
302
+ // Unset any dynamic properties not part of the schema
303
+ foreach (array('imageURL', 'thumbURL', 'imagePath', 'thumbPath') as $key) {
304
+ unset($retval->$key);
305
+ }
306
+
307
  $retval = $retval->save();
308
  }
309
 
336
  $title = strval($args[3]);
337
 
338
  // Authenticate the user
339
+ if ($this->_login($username, $password, $blog_id)) {
340
 
341
  $security = $this->get_registry()->get_utility('I_Security_Manager');
342
  if ($security->is_allowed('nextgen_edit_gallery')) {
366
  $gallery_id = intval($args[3]);
367
  $name = strval($args[4]);
368
  $title = strval($args[5]);
369
+ $galdesc = strval($args[6]);
370
+ $image_id = intval($args[7]);
371
+ $properties = isset($args[8]) ? (array) $args[7] : array();
372
 
373
  // Authenticate the user
374
+ if ($this->_login($username, $password, $blog_id)) {
375
 
376
  $mapper = C_Gallery_Mapper::get_instance();
377
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
378
+ if ($this->_can_manage_gallery($gallery)) {
379
  $gallery->name = $name;
380
  $gallery->title = $title;
381
+ $gallery->galdesc = $galdesc;
382
  $gallery->previewpic = $image_id;
383
  foreach ($properties as $key => $value) {
384
  $gallery->$key = $value;
385
  }
386
+
387
+ // Unset dynamic properties not part of the schema
388
+ unset($gallery->counter);
389
+ unset($gallery->abspath);
390
+
391
  $retval = $gallery->save();
392
  }
393
  else $retval = new IXR_Error(403, "You don't have permission to modify this gallery");
398
  return $retval;
399
  }
400
 
401
+ /**
402
+ * Returns all galleries
403
+ * @param $args (blog_id, username, password)
404
+ */
405
+ function get_galleries($args)
406
+ {
407
+ $retval = new IXR_Error(403, 'Invalid username or password');
408
+ $blog_id = intval($args[0]);
409
+ $username = strval($args[1]);
410
+ $password = strval($args[2]);
411
+
412
+ // Authenticate the user
413
+ if ($this->_login($username, $password, $blog_id)) {
414
+
415
+ // Do we have permission?
416
+ $security = $this->get_registry()->get_utility('I_Security_Manager');
417
+ if ($security->is_allowed('nextgen_edit_gallery')) {
418
+ $mapper = C_Gallery_Mapper::get_instance();
419
+ $retval = array();
420
+ foreach ($mapper->find_all() as $gallery) {
421
+ $this->_add_gallery_properties($gallery);
422
+ $retval[$gallery->{$gallery->id_field}] = (array)$gallery;
423
+ }
424
+ }
425
+ else $retval = new IXR_Error( 401, __( 'Sorry, you must be able to manage galleries' ) );
426
+ }
427
+
428
+ return $retval;
429
+ }
430
+
431
  /**
432
  * Gets a single gallery instance
433
  * @param $args (blog_id, username, password, gallery_id)
441
  $gallery_id = intval($args[3]);
442
 
443
  // Authenticate the user
444
+ if ($this->_login($username, $password, $blog_id)) {
445
  $mapper = C_Gallery_Mapper::get_instance();
446
  if (($gallery = $mapper->find($gallery_id, TRUE))) {
447
+ if ($this->_can_manage_gallery($gallery)) {
448
+ $this->_add_gallery_properties($gallery);
449
  $retval = $return_model ? $gallery : $gallery->get_entity();
450
  }
451
+ else $retval = new IXR_Error(403, "Sorry, but you don't have permission to manage gallery #{$gallery->gid}");
452
  }
453
  else $retval = FALSE;
454
  }
481
  $blog_id = intval($args[0]);
482
  $username = strval($args[1]);
483
  $password = strval($args[2]);
484
+ $title = strval($args[3]);
485
  $previewpic = isset($args[4]) ? intval($args[4]): 0;
486
  $desc = isset($args[5]) ? strval($args[5]) : '';
487
  $sortorder = isset($args[6]) ? $args[6] : '';
488
  $page_id = isset($args[7]) ? intval($args[7]) : 0;
489
 
490
  // Authenticate the user
491
+ if ($this->_login($username, $password, $blog_id)) {
492
 
493
  // Is request allowed?
494
  $security = $this->get_registry()->get_utility('I_Security_Manager');
500
  'previewpic' => $previewpic,
501
  'albumdesc' => $desc,
502
  'sortorder' => $sortorder,
503
+ 'pageid' => $page_id
504
  ));
505
 
506
  if ($album->save()) $retval = $album->id();
525
  $password = strval($args[2]);
526
 
527
  // Authenticate the user
528
+ if ($this->_login($username, $password, $blog_id)) {
529
 
530
  // Are we allowed?
531
  $security = $this->get_registry()->get_utility('I_Security_Manager');
565
  $album_id = intval($args[3]);
566
 
567
  // Authenticate the user
568
+ if ($this->_login($username, $password, $blog_id)) {
569
 
570
  // Are we allowed?
571
  $security = $this->get_registry()->get_utility('I_Security_Manager');
572
  if ($security->is_allowed('nextgen_edit_album')) {
573
  $mapper = C_Album_Mapper::get_instance();
574
+ if (($album = $mapper->find($album_id, TRUE))) {
575
+ // Vladimir's Lightroom plugins requires the 'id' to be a string
576
+ // Ask if he can accept integers as well. Currently, integers break
577
+ // his plugin
578
+ $album->id = (string) $album->id;
579
+ $album->galleries = $album->sortorder;
580
 
581
+ $retval = $return_model ? $album : $album->get_entity();
582
+ }
583
+ else $retval = FALSE;
 
 
584
 
 
585
  }
586
  else $retval = new IXR_Error(403, "Sorry, you must be able to manage albums");
587
  }
627
 
628
  return $retval;
629
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  }
631
 
632
  new M_NextGen_XmlRpc;
products/photocrati_nextgen/modules/ngglegacy/admin/album.php CHANGED
@@ -70,19 +70,6 @@ class nggManageAlbum {
70
  return $this->_registry;
71
  }
72
 
73
- /**
74
- * Gets the album mapper
75
- * @return C_Album_Mapper
76
- */
77
- function get_album_mapper()
78
- {
79
- if (!isset($this->_album_mapper)) {
80
- $this->_album_mapper = $this->get_registry()->get_utility('I_Album_Mapper');
81
- }
82
-
83
- return $this->_album_mapper;
84
- }
85
-
86
  /**
87
  * Init the album output
88
  *
@@ -92,9 +79,6 @@ class nggManageAlbum {
92
  }
93
 
94
  function controller() {
95
- global $nggdb;
96
-
97
- $this->currentID = isset($_REQUEST['act_album']) ? (int) $_REQUEST['act_album'] : 0 ;
98
 
99
  if (isset ($_POST['update']) || isset( $_POST['delete'] ) || isset( $_POST['add'] ) )
100
  $this->processor();
@@ -103,12 +87,43 @@ class nggManageAlbum {
103
  $this->update_album();
104
 
105
  // get first all galleries & albums
106
- $this->albums = $nggdb->find_all_album();
107
- $this->galleries = $nggdb->find_all_galleries();
 
 
 
 
 
 
 
108
  $this->num_albums = count( $this->albums );
109
  $this->num_galleries = count( $this->galleries );
 
110
  $this->output();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
 
112
  }
113
 
114
  /**
@@ -119,27 +134,23 @@ class nggManageAlbum {
119
  */
120
  function _set_album_preview_pic($album)
121
  {
122
- $set_previewpic = FALSE;
123
- $sortorder = $album->sortorder;
124
 
125
  while(!$album->previewpic) {
126
  // If the album is missing a preview pic, set one!
127
- if (($first_entity = array_shift($sortorder))) {
128
 
129
  // Is the first entity a gallery or album
130
  if (substr($first_entity, 0, 1) == 'a') {
131
- $subalbum = $this->get_album_mapper()->find(substr($first_entity, 1));
132
  if ($subalbum->previewpic) {
133
  $album->previewpic = $subalbum->previewpic;
134
- $set_previewpic = TRUE;
135
  }
136
  }
137
  else {
138
- $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
139
- $gallery = $gallery_mapper->find($first_entity);
140
- if ($gallery->previewpic) {
141
  $album->previewpic = $gallery->previewpic;
142
- $set_previewpic = TRUE;
143
  }
144
  }
145
  }
@@ -162,23 +173,23 @@ class nggManageAlbum {
162
 
163
  $album = new stdClass();
164
  $album->name = $_POST['newalbum'];
165
- $result = $this->get_album_mapper()->save($album);
166
- $this->currentID = $album->{$album->id_field};
167
- if (!$this->currentID) $this->currentID = 0;
168
-
169
- //hook for other plugins
170
- do_action('ngg_add_album', $this->currentID);
171
-
172
- if ($result)
173
- nggGallery::show_message(__('Update Successfully','nggallery'));
174
  }
175
 
176
- if ( isset($_POST['update']) && ($this->currentID > 0) ) {
177
 
178
  $gid = array();
179
 
180
  // Get the current album being updated
181
- $album = $this->get_album_mapper()->find($this->currentID);
182
 
183
  // Get the list of galleries/sub-albums to be added to this album
184
  parse_str($_REQUEST['sortorder']);
@@ -190,7 +201,7 @@ class nggManageAlbum {
190
  $this->_set_album_preview_pic($album);
191
 
192
  // Save the changes
193
- $this->get_album_mapper()->save($album);
194
 
195
  //hook for other plugins
196
  do_action('ngg_update_album_sortorder', $this->currentID);
@@ -204,34 +215,36 @@ class nggManageAlbum {
204
  if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
205
  wp_die(__('Cheatin&#8217; uh?'));
206
 
207
- $result = nggdb::delete_album( $this->currentID );
208
 
209
- //hook for other plugins
210
- do_action('ngg_delete_album', $this->currentID);
 
211
 
212
- // jump back to main selection
213
- $this->currentID = 0;
214
 
215
- if ($result)
216
  nggGallery::show_message(__('Album deleted','nggallery'));
 
 
217
  }
218
 
219
  }
220
 
221
  function update_album() {
222
- global $wpdb, $nggdb;
223
 
224
  check_admin_referer('ngg_thickbox_form');
225
 
226
  if (!nggGallery::current_user_can( 'NextGEN Edit album settings' ))
227
  wp_die(__('Cheatin&#8217; uh?'));
228
 
229
- $album = $this->get_album_mapper()->find($this->currentID, TRUE);
 
230
  $album->name = stripslashes($_POST['album_name']);
231
  $album->albumdesc = stripslashes($_POST['album_desc']);
232
  $album->previewpic = (int)$_POST['previewpic'];
233
  $album->pageid = (int)$_POST['pageid'];
234
- $result = $album->save();
235
 
236
  //hook for other plugin to update the fields
237
  do_action('ngg_update_album', $this->currentID, $_POST);
@@ -244,11 +257,12 @@ class nggManageAlbum {
244
 
245
  global $wpdb, $nggdb;
246
 
247
- $this->currentID = isset($_REQUEST['act_album']) ? (int) $_REQUEST['act_album'] : 0 ;
248
 
249
  //TODO:Code MUST be optimized, how to flag a used gallery better ?
250
  $used_list = $this->get_used_galleries();
251
 
 
252
  ?>
253
 
254
  <script type="text/javascript">
@@ -398,14 +412,14 @@ function showDialog() {
398
  <option value="0" ><?php esc_html_e('No album selected', 'nggallery') ?></option>
399
  <?php
400
  if( is_array($this->albums) ) {
401
- foreach($this->albums as $album) {
402
- $selected = ($this->currentID == $album->id) ? 'selected="selected" ' : '';
403
- echo '<option value="' . $album->id . '" ' . $selected . '>' . $album->id . ' - ' . esc_attr( $album->name ) . '</option>'."\n";
404
  }
405
  }
406
  ?>
407
  </select>
408
- <?php if ($this->currentID > 0){ ?>
409
  <input class="button-primary" type="submit" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>"/>
410
  <?php if(nggGallery::current_user_can( 'NextGEN Edit album settings' )) { ?>
411
  <input class="button-secondary" type="submit" name="showThickbox" value="<?php esc_attr_e( 'Edit album', 'nggallery'); ?>" onclick="showDialog(); return false;" />
@@ -447,8 +461,8 @@ function showDialog() {
447
  <div id="albumContainer" class="widget-holder">
448
  <?php
449
  if( is_array( $this->albums ) ) {
450
- foreach($this->albums as $album) {
451
- $this->get_container('a' . $album->id);
452
  }
453
  }
454
  ?>
@@ -465,7 +479,7 @@ function showDialog() {
465
 
466
  if( is_array( $this->galleries ) ) {
467
  //get the array of galleries
468
- $sort_array = $this->currentID > 0 ? (array) $this->albums[$this->currentID]->galleries : array() ;
469
  foreach($this->galleries as $gallery) {
470
  if (!in_array($gallery->gid, $sort_array)) {
471
  if (in_array($gallery->gid,$used_list))
@@ -481,17 +495,13 @@ function showDialog() {
481
 
482
  <!-- /#target-album -->
483
  <div class="widget target-album widget-left">
484
-
485
- <?php
486
- if ($this->currentID > 0){
487
- $album = $this->albums[$this->currentID];
488
- ?>
489
  <div class="widget-top">
490
  <h3><?php esc_html_e('Album ID', 'nggallery'); ?> <?php echo $album->id . ' : ' . esc_html( $album->name ); ?> </h3>
491
  </div>
492
  <div id="galleryContainer" class="widget-holder target">
493
  <?php
494
- $sort_array = (array) $this->albums[$this->currentID]->galleries;
495
  foreach($sort_array as $galleryid) {
496
  $this->get_container($galleryid, false);
497
  }
@@ -512,7 +522,7 @@ function showDialog() {
512
  </div><!-- /#container -->
513
  </div><!-- /#wrap -->
514
 
515
- <?php if ($this->currentID > 0) : ?>
516
  <!-- #editalbum -->
517
  <div id="editalbum" style="display: none;" >
518
  <form id="form-edit-album" method="POST" accept-charset="utf-8">
@@ -601,7 +611,7 @@ function showDialog() {
601
  // if the id started with a 'a', then it's a sub album
602
  if (substr( $id, 0, 1) == 'a') {
603
 
604
- if ( !$album = $this->albums[ substr( $id, 1) ] )
605
  return;
606
 
607
  $obj['id'] = $album->id;
@@ -620,7 +630,7 @@ function showDialog() {
620
  $image = $nggdb->find_image( $album->previewpic );
621
  if ($image) $thumbURL = @add_query_arg('timestamp', time(), $image->thumbURL);
622
  }
623
- $preview_image = $thumbURL ? '<div class="inlinepicture"><img rel="'.$album->previewpic.'" src="' . esc_url( $thumbURL ). '" /></div>' : '';
624
  }
625
 
626
  // this indicates that we have a album container
@@ -647,7 +657,7 @@ function showDialog() {
647
  $image = $nggdb->find_image( $gallery->previewpic );
648
  $thumbURL = @add_query_arg('timestamp', time(), $image->thumbURL);
649
  }
650
- $preview_image = ( !is_null($thumbURL) ) ? '<div class="inlinepicture"><img rel="'.$gallery->previewpic.'" src="' . esc_url( $thumbURL ). '" /></div>' : '';
651
  }
652
 
653
  $prefix = '';
@@ -683,9 +693,8 @@ function showDialog() {
683
  $used = array();
684
 
685
  if ($this->albums) {
686
- foreach($this->albums as $key => $value) {
687
- $sort_array = $this->albums[$key]->galleries;
688
- foreach($sort_array as $galleryid) {
689
  if (!in_array($galleryid, $used))
690
  $used[] = $galleryid;
691
  }
70
  return $this->_registry;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Init the album output
75
  *
79
  }
80
 
81
  function controller() {
 
 
 
82
 
83
  if (isset ($_POST['update']) || isset( $_POST['delete'] ) || isset( $_POST['add'] ) )
84
  $this->processor();
87
  $this->update_album();
88
 
89
  // get first all galleries & albums
90
+ $this->albums = array();
91
+ foreach (C_Album_Mapper::get_instance()->find_all() as $album) {
92
+ $this->albums[$album->{$album->id_field}] = $album;
93
+ }
94
+
95
+ $this->galleries = array();
96
+ foreach (C_Gallery_Mapper::get_instance()->find_all() as $gallery) {
97
+ $this->galleries[$gallery->{$gallery->id_field}] = $gallery;
98
+ }
99
  $this->num_albums = count( $this->albums );
100
  $this->num_galleries = count( $this->galleries );
101
+
102
  $this->output();
103
+ }
104
+
105
+ function _get_album($id)
106
+ {
107
+ $retval = NULL;
108
+
109
+ if (isset($this->albums[$id])) {
110
+ $retval = $this->albums[$id];
111
+ }
112
+ else $retval = C_Album_Mapper::get_instance()->find($id);
113
+
114
+ return $retval;
115
+ }
116
+
117
+ function _get_gallery($id)
118
+ {
119
+ $retval = NULL;
120
+
121
+ if (isset($this->galleries[$id])) {
122
+ $retval = $this->galleries[$id];
123
+ }
124
+ else $retval = C_Gallery_Mapper::get_instance()->find($id);
125
 
126
+ return $retval;
127
  }
128
 
129
  /**
134
  */
135
  function _set_album_preview_pic($album)
136
  {
137
+ $sortorder = array_merge($album->sortorder);
 
138
 
139
  while(!$album->previewpic) {
140
  // If the album is missing a preview pic, set one!
141
+ if (($first_entity = array_pop($sortorder))) {
142
 
143
  // Is the first entity a gallery or album
144
  if (substr($first_entity, 0, 1) == 'a') {
145
+ $subalbum = $this->_get_album(substr($first_entity, 1));
146
  if ($subalbum->previewpic) {
147
  $album->previewpic = $subalbum->previewpic;
 
148
  }
149
  }
150
  else {
151
+ $gallery = $this->_get_gallery($first_entity);
152
+ if ($gallery && $gallery->previewpic) {
 
153
  $album->previewpic = $gallery->previewpic;
 
154
  }
155
  }
156
  }
173
 
174
  $album = new stdClass();
175
  $album->name = $_POST['newalbum'];
176
+ if (C_Album_Mapper::get_instance()->save($album)) {
177
+ $this->currentID = $_REQUEST['act_album'] = $album->{$album->id_field};
178
+ $this->albums[$this->currentID] = $album;
179
+ do_action('ngg_add_album', $this->currentID);
180
+ nggGallery::show_message(__('Update Successfully','nggallery'));
181
+ }
182
+ else {
183
+ $this->currentID = $_REQUEST['act_album'] = 0;
184
+ }
185
  }
186
 
187
+ else if ( isset($_POST['update']) && isset($_REQUEST['act_album']) && $this->currentID = intval($_REQUEST['act_album']) ) {
188
 
189
  $gid = array();
190
 
191
  // Get the current album being updated
192
+ $album = $this->_get_album($this->currentID);
193
 
194
  // Get the list of galleries/sub-albums to be added to this album
195
  parse_str($_REQUEST['sortorder']);
201
  $this->_set_album_preview_pic($album);
202
 
203
  // Save the changes
204
+ C_Album_Mapper::get_instance()->save($album);
205
 
206
  //hook for other plugins
207
  do_action('ngg_update_album_sortorder', $this->currentID);
215
  if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
216
  wp_die(__('Cheatin&#8217; uh?'));
217
 
218
+ $this->currentID = $_REQUEST['act_album'];
219
 
220
+ if (C_Album_Mapper::get_instance()->destroy($this->currentID)) {
221
+ //hook for other plugins
222
+ do_action('ngg_delete_album', $this->currentID);
223
 
224
+ // jump back to main selection
225
+ $this->currentID = $_REQUEST['act_album'] = 0;
226
 
 
227
  nggGallery::show_message(__('Album deleted','nggallery'));
228
+ }
229
+
230
  }
231
 
232
  }
233
 
234
  function update_album() {
 
235
 
236
  check_admin_referer('ngg_thickbox_form');
237
 
238
  if (!nggGallery::current_user_can( 'NextGEN Edit album settings' ))
239
  wp_die(__('Cheatin&#8217; uh?'));
240
 
241
+ $this->currentID = $_REQUEST['act_album'];
242
+ $album = $this->_get_album($this->currentID);
243
  $album->name = stripslashes($_POST['album_name']);
244
  $album->albumdesc = stripslashes($_POST['album_desc']);
245
  $album->previewpic = (int)$_POST['previewpic'];
246
  $album->pageid = (int)$_POST['pageid'];
247
+ $result = C_Album_Mapper::get_instance()->save($album);
248
 
249
  //hook for other plugin to update the fields
250
  do_action('ngg_update_album', $this->currentID, $_POST);
257
 
258
  global $wpdb, $nggdb;
259
 
260
+ if (isset($_REQUEST['act_album'])) $this->currentID = intval($_REQUEST['act_album']);
261
 
262
  //TODO:Code MUST be optimized, how to flag a used gallery better ?
263
  $used_list = $this->get_used_galleries();
264
 
265
+ $album = $this->_get_album($this->currentID);
266
  ?>
267
 
268
  <script type="text/javascript">
412
  <option value="0" ><?php esc_html_e('No album selected', 'nggallery') ?></option>
413
  <?php
414
  if( is_array($this->albums) ) {
415
+ foreach($this->albums as $a) {
416
+ $selected = ($this->currentID == $a->id) ? 'selected="selected" ' : '';
417
+ echo '<option value="' . $a->id . '" ' . $selected . '>' . $a->id . ' - ' . esc_attr( $a->name ) . '</option>'."\n";
418
  }
419
  }
420
  ?>
421
  </select>
422
+ <?php if ($album && $this->currentID){ ?>
423
  <input class="button-primary" type="submit" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>"/>
424
  <?php if(nggGallery::current_user_can( 'NextGEN Edit album settings' )) { ?>
425
  <input class="button-secondary" type="submit" name="showThickbox" value="<?php esc_attr_e( 'Edit album', 'nggallery'); ?>" onclick="showDialog(); return false;" />
461
  <div id="albumContainer" class="widget-holder">
462
  <?php
463
  if( is_array( $this->albums ) ) {
464
+ foreach($this->albums as $a) {
465
+ $this->get_container('a' . $a->id);
466
  }
467
  }
468
  ?>
479
 
480
  if( is_array( $this->galleries ) ) {
481
  //get the array of galleries
482
+ $sort_array = $album ? $album->sortorder : array();
483
  foreach($this->galleries as $gallery) {
484
  if (!in_array($gallery->gid, $sort_array)) {
485
  if (in_array($gallery->gid,$used_list))
495
 
496
  <!-- /#target-album -->
497
  <div class="widget target-album widget-left">
498
+ <?php if ($album && $this->currentID){ ?>
 
 
 
 
499
  <div class="widget-top">
500
  <h3><?php esc_html_e('Album ID', 'nggallery'); ?> <?php echo $album->id . ' : ' . esc_html( $album->name ); ?> </h3>
501
  </div>
502
  <div id="galleryContainer" class="widget-holder target">
503
  <?php
504
+ $sort_array = $album->sortorder;
505
  foreach($sort_array as $galleryid) {
506
  $this->get_container($galleryid, false);
507
  }
522
  </div><!-- /#container -->
523
  </div><!-- /#wrap -->
524
 
525
+ <?php if ($album && $this->currentID): ?>
526
  <!-- #editalbum -->
527
  <div id="editalbum" style="display: none;" >
528
  <form id="form-edit-album" method="POST" accept-charset="utf-8">
611
  // if the id started with a 'a', then it's a sub album
612
  if (substr( $id, 0, 1) == 'a') {
613
 
614
+ if ( !$album = $this->_get_album(substr( $id, 1)))
615
  return;
616
 
617
  $obj['id'] = $album->id;
630
  $image = $nggdb->find_image( $album->previewpic );
631
  if ($image) $thumbURL = @add_query_arg('timestamp', time(), $image->thumbURL);
632
  }
633
+ $preview_image = $thumbURL ? '<div class="inlinepicture"><img rel="'.$album->previewpic.'" src="' . nextgen_esc_url( $thumbURL ). '" /></div>' : '';
634
  }
635
 
636
  // this indicates that we have a album container
657
  $image = $nggdb->find_image( $gallery->previewpic );
658
  $thumbURL = @add_query_arg('timestamp', time(), $image->thumbURL);
659
  }
660
+ $preview_image = ( !is_null($thumbURL) ) ? '<div class="inlinepicture"><img rel="'.$gallery->previewpic.'" src="' . nextgen_esc_url( $thumbURL ). '" /></div>' : '';
661
  }
662
 
663
  $prefix = '';
693
  $used = array();
694
 
695
  if ($this->albums) {
696
+ foreach($this->albums as $album) {
697
+ foreach($album->sortorder as $galleryid) {
 
698
  if (!in_array($galleryid, $used))
699
  $used[] = $galleryid;
700
  }
products/photocrati_nextgen/modules/ngglegacy/admin/edit-thumbnail.php CHANGED
@@ -145,7 +145,7 @@ if ($thumbnail_crop_frame != null)
145
  <table width="98%" align="center" style="border:1px solid #DADADA">
146
  <tr>
147
  <td rowspan="3" valign="middle" align="center" width="350" style="background-color:#DADADA;">
148
- <img src="<?php echo esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
149
  </td>
150
  <td width="300" style="background-color : #DADADA;">
151
  <small style="margin-left:6px; display:block;"><?php esc_html_e('Select the area for the thumbnail from the picture on the left.', 'nggallery'); ?></small>
@@ -154,10 +154,10 @@ if ($thumbnail_crop_frame != null)
154
  <tr>
155
  <td align="center" width="300" height="320">
156
  <div id="previewNewThumb" style="display:none;width:<?php echo $WidthHtmlPrev; ?>px;height:<?php echo $HeightHtmlPrev; ?>px;overflow:hidden; margin-left:5px;">
157
- <img src="<?php echo esc_url( $preview_image ); ?>" id="imageToEditPreview" />
158
  </div>
159
  <div id="actualThumb">
160
- <img src="<?php echo esc_url( $picture->thumbURL ); ?>?<?php echo time()?>" />
161
  </div>
162
  </td>
163
  </tr>
145
  <table width="98%" align="center" style="border:1px solid #DADADA">
146
  <tr>
147
  <td rowspan="3" valign="middle" align="center" width="350" style="background-color:#DADADA;">
148
+ <img src="<?php echo nextgen_esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
149
  </td>
150
  <td width="300" style="background-color : #DADADA;">
151
  <small style="margin-left:6px; display:block;"><?php esc_html_e('Select the area for the thumbnail from the picture on the left.', 'nggallery'); ?></small>
154
  <tr>
155
  <td align="center" width="300" height="320">
156
  <div id="previewNewThumb" style="display:none;width:<?php echo $WidthHtmlPrev; ?>px;height:<?php echo $HeightHtmlPrev; ?>px;overflow:hidden; margin-left:5px;">
157
+ <img src="<?php echo nextgen_esc_url( $preview_image ); ?>" id="imageToEditPreview" />
158
  </div>
159
  <div id="actualThumb">
160
+ <img src="<?php echo nextgen_esc_url( $picture->thumbURL ); ?>?<?php echo time()?>" />
161
  </div>
162
  </td>
163
  </tr>
products/photocrati_nextgen/modules/ngglegacy/admin/functions.php CHANGED
@@ -578,7 +578,7 @@ class nggAdmin{
578
  * @param array|int $imagesIds
579
  * @return string result code
580
  */
581
- function import_MetaData($imagesIds) {
582
 
583
  global $wpdb;
584
 
578
  * @param array|int $imagesIds
579
  * @return string result code
580
  */
581
+ static function import_MetaData($imagesIds) {
582
 
583
  global $wpdb;
584
 
products/photocrati_nextgen/modules/ngglegacy/admin/install.php CHANGED
@@ -8,7 +8,8 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
8
  * @access internal
9
  * @return void
10
  */
11
- function nggallery_install () {
 
12
 
13
  global $wpdb , $wp_roles, $wp_version;
14
 
@@ -35,19 +36,6 @@ function nggallery_install () {
35
  $role->add_cap('NextGEN Change options');
36
  $role->add_cap('NextGEN Attach Interface');
37
 
38
- // upgrade function changed in WordPress 2.3
39
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
40
-
41
- // add charset & collate like wp core
42
- $charset_collate = '';
43
-
44
- if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
45
- if ( ! empty($wpdb->charset) )
46
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
47
- if ( ! empty($wpdb->collate) )
48
- $charset_collate .= " COLLATE $wpdb->collate";
49
- }
50
-
51
  $nggpictures = $wpdb->prefix . 'ngg_pictures';
52
  $nggallery = $wpdb->prefix . 'ngg_gallery';
53
  $nggalbum = $wpdb->prefix . 'ngg_album';
@@ -67,8 +55,8 @@ function nggallery_install () {
67
  meta_data LONGTEXT,
68
  PRIMARY KEY (pid),
69
  KEY post_id (post_id)
70
- ) $charset_collate;";
71
- dbDelta($sql);
72
 
73
  // Create gallery table
74
  $sql = "CREATE TABLE " . $nggallery . " (
@@ -82,8 +70,8 @@ function nggallery_install () {
82
  previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
83
  author BIGINT(20) DEFAULT '0' NOT NULL ,
84
  PRIMARY KEY (gid)
85
- ) $charset_collate;";
86
- dbDelta($sql);
87
 
88
  // Create albums table
89
  $sql = "CREATE TABLE " . $nggalbum . " (
@@ -95,8 +83,8 @@ function nggallery_install () {
95
  sortorder LONGTEXT NOT NULL,
96
  pageid BIGINT(20) DEFAULT '0' NOT NULL,
97
  PRIMARY KEY (id)
98
- ) $charset_collate;";
99
- dbDelta($sql);
100
 
101
  // check one table again, to be sure
102
  if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
@@ -129,36 +117,3 @@ function ngg_remove_capability($capability){
129
  }
130
 
131
  }
132
-
133
- /**
134
- * Uninstall all settings and tables
135
- * Called via Setup and register_unstall hook
136
- *
137
- * @access internal
138
- * @return void
139
- */
140
- function nggallery_uninstall() {
141
- global $wpdb;
142
-
143
- // TODO don't remove data on uninstall
144
- // first remove all tables
145
- # $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_pictures");
146
- # $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_gallery");
147
- # $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_album");
148
-
149
- // then remove all options
150
- delete_option( 'ngg_options' );
151
- delete_option( 'ngg_db_version' );
152
- delete_option( 'ngg_update_exists' );
153
- delete_option( 'ngg_next_update' );
154
-
155
- // now remove the capability
156
- ngg_remove_capability("NextGEN Gallery overview");
157
- ngg_remove_capability("NextGEN Use TinyMCE");
158
- ngg_remove_capability("NextGEN Upload images");
159
- ngg_remove_capability("NextGEN Manage gallery");
160
- ngg_remove_capability("NextGEN Edit album");
161
- ngg_remove_capability("NextGEN Change style");
162
- ngg_remove_capability("NextGEN Change options");
163
- ngg_remove_capability("NextGEN Attach Interface");
164
- }
8
  * @access internal
9
  * @return void
10
  */
11
+ function nggallery_install($installer)
12
+ {
13
 
14
  global $wpdb , $wp_roles, $wp_version;
15
 
36
  $role->add_cap('NextGEN Change options');
37
  $role->add_cap('NextGEN Attach Interface');
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  $nggpictures = $wpdb->prefix . 'ngg_pictures';
40
  $nggallery = $wpdb->prefix . 'ngg_gallery';
41
  $nggalbum = $wpdb->prefix . 'ngg_album';
55
  meta_data LONGTEXT,
56
  PRIMARY KEY (pid),
57
  KEY post_id (post_id)
58
+ );";
59
+ $installer->upgrade_schema($sql);
60
 
61
  // Create gallery table
62
  $sql = "CREATE TABLE " . $nggallery . " (
70
  previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
71
  author BIGINT(20) DEFAULT '0' NOT NULL ,
72
  PRIMARY KEY (gid)
73
+ )";
74
+ $installer->upgrade_schema($sql);
75
 
76
  // Create albums table
77
  $sql = "CREATE TABLE " . $nggalbum . " (
83
  sortorder LONGTEXT NOT NULL,
84
  pageid BIGINT(20) DEFAULT '0' NOT NULL,
85
  PRIMARY KEY (id)
86
+ )";
87
+ $installer->upgrade_schema($sql);
88
 
89
  // check one table again, to be sure
90
  if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
117
  }
118
 
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js CHANGED
@@ -26,7 +26,7 @@ nggAjax = {
26
  url: s.url,
27
  data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
28
  cache: false,
29
- timeout: 10000,
30
  success: function(msg){
31
  switch ( parseInt(msg) ) {
32
  case -1:
@@ -73,7 +73,7 @@ nggAjax = {
73
  data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
74
  dataType: "json",
75
  cache: false,
76
- timeout: 10000,
77
  success: function(msg){
78
  // join the array
79
  imageIDS = imageIDS.concat(msg);
26
  url: s.url,
27
  data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
28
  cache: false,
29
+ timeout: 30000,
30
  success: function(msg){
31
  switch ( parseInt(msg) ) {
32
  case -1:
73
  data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
74
  dataType: "json",
75
  cache: false,
76
+ timeout: 30000,
77
  success: function(msg){
78
  // join the array
79
  imageIDS = imageIDS.concat(msg);
products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php CHANGED
@@ -470,7 +470,7 @@ if($picturelist) {
470
  $attributes = 'class="title column-filename column-title"' . $style;
471
  ?>
472
  <td <?php echo $attributes ?>>
473
- <strong><a href="<?php echo esc_url( $picture->imageURL ); ?>" class="thickbox" title="<?php echo esc_attr ($picture->filename); ?>">
474
  <?php echo ( empty($picture->alttext) ) ? esc_html( $picture->filename ) : esc_html( stripslashes(nggGallery::i18n($picture->alttext)) ); ?>
475
  </a></strong>
476
  <br /><?php echo $date; ?>
@@ -481,7 +481,7 @@ if($picturelist) {
481
  <p>
482
  <?php
483
  $actions = array();
484
- $actions['view'] = '<a class="shutter" href="' . esc_url( $picture->imageURL ) . '" title="' . esc_attr( sprintf(__('View "%s"'), sanitize_title ($picture->filename) )) . '">' . __('View', 'nggallery') . '</a>';
485
  $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data','nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
486
  $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail','nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
487
  $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate','nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
@@ -506,8 +506,8 @@ if($picturelist) {
506
  case 'thumbnail' :
507
  $attributes = 'class="id column-thumbnail media-icon"' . $style;
508
  ?>
509
- <td <?php echo $attributes ?>><a href="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->imageURL) ); ?>" class="shutter" title="<?php echo $picture->filename ?>">
510
- <img class="thumb" src="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->thumbURL) ); ?>" id="thumb<?php echo $pid ?>" />
511
  </a>
512
  </td>
513
  <?php
470
  $attributes = 'class="title column-filename column-title"' . $style;
471
  ?>
472
  <td <?php echo $attributes ?>>
473
+ <strong><a href="<?php echo nextgen_esc_url( $picture->imageURL ); ?>" class="thickbox" title="<?php echo esc_attr ($picture->filename); ?>">
474
  <?php echo ( empty($picture->alttext) ) ? esc_html( $picture->filename ) : esc_html( stripslashes(nggGallery::i18n($picture->alttext)) ); ?>
475
  </a></strong>
476
  <br /><?php echo $date; ?>
481
  <p>
482
  <?php
483
  $actions = array();
484
+ $actions['view'] = '<a class="shutter" href="' . nextgen_esc_url( $picture->imageURL ) . '" title="' . esc_attr( sprintf(__('View "%s"'), sanitize_title ($picture->filename) )) . '">' . __('View', 'nggallery') . '</a>';
485
  $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data','nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
486
  $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail','nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
487
  $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate','nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
506
  case 'thumbnail' :
507
  $attributes = 'class="id column-thumbnail media-icon"' . $style;
508
  ?>
509
+ <td <?php echo $attributes ?>><a href="<?php echo nextgen_esc_url ( add_query_arg('i', mt_rand(), $picture->imageURL) ); ?>" class="shutter" title="<?php echo $picture->filename ?>">
510
+ <img class="thumb" src="<?php echo nextgen_esc_url ( add_query_arg('i', mt_rand(), $picture->thumbURL) ); ?>" id="thumb<?php echo $pid ?>" />
511
  </a>
512
  </td>
513
  <?php
products/photocrati_nextgen/modules/ngglegacy/admin/manage-sort.php CHANGED
@@ -28,7 +28,7 @@ function nggallery_sortorder($galleryID = 0){
28
  $sortindex++;
29
  }
30
 
31
- C_Photocrati_Cache::flush();
32
 
33
  do_action('ngg_gallery_sort', $galleryID);
34
 
@@ -101,7 +101,7 @@ function nggallery_sortorder($galleryID = 0){
101
  <input class="button-primary action" type="submit" name="updateSortorder" onclick="saveImageOrder()" value="<?php _e('Update Sort Order', 'nggallery') ?>" />
102
  </div>
103
  <div class="alignright actions">
104
- <a href="<?php echo esc_url( $back_url ); ?>" class="button"><?php _e('Back to gallery', 'nggallery'); ?></a>
105
  </div>
106
  </div>
107
  <input name="sortorder" type="hidden" />
@@ -123,7 +123,7 @@ function nggallery_sortorder($galleryID = 0){
123
  foreach($picturelist as $picture) {
124
  ?>
125
  <div class="imageBox" id="pid-<?php echo $picture->pid ?>">
126
- <div class="imageBox_theImage" style="background-image:url('<?php echo esc_url( $picture->thumbURL ); ?>')"></div>
127
  <div class="imageBox_label"><span><?php echo esc_html( stripslashes($picture->alttext) ); ?></span></div>
128
  </div>
129
  <?php
28
  $sortindex++;
29
  }
30
 
31
+ C_Photocrati_Cache::flush('displayed_gallery_rendering');
32
 
33
  do_action('ngg_gallery_sort', $galleryID);
34
 
101
  <input class="button-primary action" type="submit" name="updateSortorder" onclick="saveImageOrder()" value="<?php _e('Update Sort Order', 'nggallery') ?>" />
102
  </div>
103
  <div class="alignright actions">
104
+ <a href="<?php echo nextgen_esc_url( $back_url ); ?>" class="button"><?php _e('Back to gallery', 'nggallery'); ?></a>
105
  </div>
106
  </div>
107
  <input name="sortorder" type="hidden" />
123
  foreach($picturelist as $picture) {
124
  ?>
125
  <div class="imageBox" id="pid-<?php echo $picture->pid ?>">
126
+ <div class="imageBox_theImage" style="background-image:url('<?php echo nextgen_esc_url( $picture->thumbURL ); ?>')"></div>
127
  <div class="imageBox_label"><span><?php echo esc_html( stripslashes($picture->alttext) ); ?></span></div>
128
  </div>
129
  <?php
products/photocrati_nextgen/modules/ngglegacy/admin/manage.php CHANGED
@@ -78,7 +78,7 @@ class nggManageGallery {
78
  @unlink($image->imagePath . '_backup' );
79
  }
80
  $mapper = C_Image_Mapper::get_instance();
81
- $mapper->destroy($this->pid);
82
  do_action('ngg_delete_picture', $this->pid);
83
 
84
  if ($result)
@@ -376,6 +376,16 @@ class nggManageGallery {
376
  check_admin_referer('ngg_updategallery');
377
 
378
  if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' ) && !isset ($_GET['s']) ) {
 
 
 
 
 
 
 
 
 
 
379
 
380
  if ( nggGallery::current_user_can( 'NextGEN Edit gallery title' )) {
381
  // don't forget to update the slug
@@ -606,14 +616,14 @@ class nggManageGallery {
606
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
607
  'first-page' . $disable_first,
608
  esc_attr__( 'Go to the first page' ),
609
- esc_url( remove_query_arg( 'paged', $current_url ) ),
610
  '&laquo;'
611
  );
612
 
613
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
614
  'prev-page' . $disable_first,
615
  esc_attr__( 'Go to the previous page' ),
616
- esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
617
  '&lsaquo;'
618
  );
619
 
@@ -633,14 +643,14 @@ class nggManageGallery {
633
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
634
  'next-page' . $disable_last,
635
  esc_attr__( 'Go to the next page' ),
636
- esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
637
  '&rsaquo;'
638
  );
639
 
640
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
641
  'last-page' . $disable_last,
642
  esc_attr__( 'Go to the last page' ),
643
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
644
  '&raquo;'
645
  );
646
 
78
  @unlink($image->imagePath . '_backup' );
79
  }
80
  $mapper = C_Image_Mapper::get_instance();
81
+ $result = $mapper->destroy($this->pid);
82
  do_action('ngg_delete_picture', $this->pid);
83
 
84
  if ($result)
376
  check_admin_referer('ngg_updategallery');
377
 
378
  if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' ) && !isset ($_GET['s']) ) {
379
+ $tags = array('<a>', '<abbr>', '<acronym>', '<address>', '<b>', '<base>', '<basefont>', '<big>', '<blockquote>', '<br>', '<br/>', '<caption>', '<center>', '<cite>', '<code>', '<col>', '<colgroup>', '<dd>', '<del>', '<dfn>', '<dir>', '<div>', '<dl>', '<dt>', '<em>', '<fieldset>', '<font>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<hr>', '<i>', '<ins>', '<label>', '<legend>', '<li>', '<menu>', '<noframes>', '<noscript>', '<ol>', '<optgroup>', '<option>', '<p>', '<pre>', '<q>', '<s>', '<samp>', '<select>', '<small>', '<span>', '<strike>', '<strong>', '<sub>', '<sup>', '<table>', '<tbody>', '<td>', '<tfoot>', '<th>', '<thead>', '<tr>', '<tt>', '<u>', '<ul>');
380
+ $fields = array('title', 'gallerydesc');
381
+
382
+ foreach ($fields as $field) {
383
+ $html = $_POST[$field];
384
+ $html = preg_replace('/\\s+on\\w+=(["\']).*?\\1/i', '', $html);
385
+ $html = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $html);
386
+ $html = strip_tags($html, implode('', $tags));
387
+ $_POST[$field] = $html;
388
+ }
389
 
390
  if ( nggGallery::current_user_can( 'NextGEN Edit gallery title' )) {
391
  // don't forget to update the slug
616
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
617
  'first-page' . $disable_first,
618
  esc_attr__( 'Go to the first page' ),
619
+ nextgen_esc_url( remove_query_arg( 'paged', $current_url ) ),
620
  '&laquo;'
621
  );
622
 
623
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
624
  'prev-page' . $disable_first,
625
  esc_attr__( 'Go to the previous page' ),
626
+ nextgen_esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
627
  '&lsaquo;'
628
  );
629
 
643
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
644
  'next-page' . $disable_last,
645
  esc_attr__( 'Go to the next page' ),
646
+ nextgen_esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
647
  '&rsaquo;'
648
  );
649
 
650
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
651
  'last-page' . $disable_last,
652
  esc_attr__( 'Go to the last page' ),
653
+ nextgen_esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
654
  '&raquo;'
655
  );
656
 
products/photocrati_nextgen/modules/ngglegacy/admin/media-upload.php CHANGED
@@ -41,7 +41,7 @@ function media_upload_nextgen() {
41
  $args = array(
42
  'display_type' => NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME
43
  );
44
- $displayed_gallery = $factory->create('displayed_gallery', $mapper, $args);
45
  $width = $displayed_gallery->display_settings['width'];
46
  $height = $displayed_gallery->display_settings['height'];
47
 
41
  $args = array(
42
  'display_type' => NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME
43
  );
44
+ $displayed_gallery = $factory->create('displayed_gallery', $args, $mapper);
45
  $width = $displayed_gallery->display_settings['width'];
46
  $height = $displayed_gallery->display_settings['height'];
47
 
products/photocrati_nextgen/modules/ngglegacy/admin/overview.php CHANGED
@@ -235,7 +235,7 @@ function ngg_overview_news(){
235
  $link = $item->get_link();
236
  while ( stristr($link, 'http') != $link )
237
  $link = substr($link, 1);
238
- $link = esc_url(strip_tags($link));
239
  $title = esc_attr(strip_tags($item->get_title()));
240
  if ( empty($title) )
241
  $title = __('Untitled');
@@ -345,7 +345,7 @@ function ngg_dashboard_quota() {
345
  <div class="table table_content musubtable">
346
  <table>
347
  <tr class="first">
348
- <td class="first b b-posts"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>' ), esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $quota ); ?></td>
349
  <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
350
  </tr>
351
  </table>
@@ -353,7 +353,7 @@ function ngg_dashboard_quota() {
353
  <div class="table table_discussion musubtable">
354
  <table>
355
  <tr class="first">
356
- <td class="b b-comments"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>' ), esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $used, $percentused ); ?></td>
357
  <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
358
  </tr>
359
  </table>
@@ -385,7 +385,7 @@ function ngg_widget_locale() {
385
  ?>
386
  <p class="hint"><?php _e('Translation file successful updated. Please reload page.', 'nggallery'); ?></p>
387
  <p class="textright">
388
- <a class="button" href="<?php echo esc_url(strip_tags($overview_url)); ?>"><?php _e('Reload page', 'nggallery'); ?></a>
389
  </p>
390
  <?php
391
  } else {
@@ -416,7 +416,7 @@ function ngg_locale() {
416
  if ( !is_wp_error($locale->response) && $locale->response['response']['code'] == '200') {
417
  ?>
418
  <p class="textright">
419
- <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Update', 'nggallery'); ?></a>
420
  </p>
421
  <?php
422
  }
@@ -427,7 +427,7 @@ function ngg_locale() {
427
  ?>
428
  <p><strong>Download now your language file !</strong></p>
429
  <p class="textright">
430
- <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Download', 'nggallery'); ?></a>
431
  </p>
432
  <?php
433
  }
@@ -496,7 +496,8 @@ function ngg_get_serverinfo() {
496
  if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'nggallery');
497
  else $allow_url_fopen = __('Off', 'nggallery');
498
  // Get PHP Max Upload Size
499
- if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
 
500
  else $upload_max = __('N/A', 'nggallery');
501
  // Get PHP Output buffer Size
502
  if(ini_get('pcre.backtrack_limit')) $backtrack_limit = ini_get('pcre.backtrack_limit');
235
  $link = $item->get_link();
236
  while ( stristr($link, 'http') != $link )
237
  $link = substr($link, 1);
238
+ $link = nextgen_esc_url(strip_tags($link));
239
  $title = esc_attr(strip_tags($item->get_title()));
240
  if ( empty($title) )
241
  $title = __('Untitled');
345
  <div class="table table_content musubtable">
346
  <table>
347
  <tr class="first">
348
+ <td class="first b b-posts"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>' ), nextgen_esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $quota ); ?></td>
349
  <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
350
  </tr>
351
  </table>
353
  <div class="table table_discussion musubtable">
354
  <table>
355
  <tr class="first">
356
+ <td class="b b-comments"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>' ), nextgen_esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $used, $percentused ); ?></td>
357
  <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
358
  </tr>
359
  </table>
385
  ?>
386
  <p class="hint"><?php _e('Translation file successful updated. Please reload page.', 'nggallery'); ?></p>
387
  <p class="textright">
388
+ <a class="button" href="<?php echo nextgen_esc_url(strip_tags($overview_url)); ?>"><?php _e('Reload page', 'nggallery'); ?></a>
389
  </p>
390
  <?php
391
  } else {
416
  if ( !is_wp_error($locale->response) && $locale->response['response']['code'] == '200') {
417
  ?>
418
  <p class="textright">
419
+ <a class="button" href="<?php echo nextgen_esc_url( strip_tags($update_url) ); ?>"><?php _e('Update', 'nggallery'); ?></a>
420
  </p>
421
  <?php
422
  }
427
  ?>
428
  <p><strong>Download now your language file !</strong></p>
429
  <p class="textright">
430
+ <a class="button" href="<?php echo nextgen_esc_url( strip_tags($update_url) ); ?>"><?php _e('Download', 'nggallery'); ?></a>
431
  </p>
432
  <?php
433
  }
496
  if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'nggallery');
497
  else $allow_url_fopen = __('Off', 'nggallery');
498
  // Get PHP Max Upload Size
499
+ if (function_exists('wp_max_upload_size')) $upload_max = strval(round( (int) wp_max_upload_size() / (1024 * 1024) )) . 'M';
500
+ else if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
501
  else $upload_max = __('N/A', 'nggallery');
502
  // Get PHP Output buffer Size
503
  if(ini_get('pcre.backtrack_limit')) $backtrack_limit = ini_get('pcre.backtrack_limit');
products/photocrati_nextgen/modules/ngglegacy/admin/rotate.php CHANGED
@@ -79,7 +79,7 @@ $preview_image = trailingslashit( home_url() ) . 'index.php?callback=image&amp;
79
  <table width="98%" align="center" style="border:1px solid #DADADA">
80
  <tr style="height : 360px;">
81
  <td valign="middle" align="center" style="background-color:#DADADA; width : 370px;">
82
- <img src="<?php echo esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
83
  </td>
84
  <td>
85
  <input type="radio" name="ra" value="cw" /><?php esc_html_e('90&deg; clockwise', 'nggallery'); ?><br />
79
  <table width="98%" align="center" style="border:1px solid #DADADA">
80
  <tr style="height : 360px;">
81
  <td valign="middle" align="center" style="background-color:#DADADA; width : 370px;">
82
+ <img src="<?php echo nextgen_esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
83
  </td>
84
  <td>
85
  <input type="radio" name="ra" value="cw" /><?php esc_html_e('90&deg; clockwise', 'nggallery'); ?><br />
products/photocrati_nextgen/modules/ngglegacy/class.ngglegacy_installer.php CHANGED
@@ -4,13 +4,103 @@ class C_NggLegacy_Installer
4
  {
5
  function install()
6
  {
 
7
  include_once('admin/install.php');
8
- nggallery_install();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
10
 
11
  function uninstall($hard=FALSE)
12
  {
13
  delete_option('ngg_init_check');
14
  delete_option('ngg_update_exists');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
  }
4
  {
5
  function install()
6
  {
7
+ global $wpdb;
8
  include_once('admin/install.php');
9
+
10
+ $this->remove_transients();
11
+
12
+ if (is_multisite()) {
13
+ $network=isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:"";
14
+ $activate=isset($_GET['action'])?$_GET['action']:"";
15
+ $isNetwork=($network=='/wp-admin/network/plugins.php')?true:false;
16
+ $isActivation=($activate=='deactivate')?false:true;
17
+
18
+ if ($isNetwork and $isActivation){
19
+ $old_blog = $wpdb->blogid;
20
+ $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs", NULL));
21
+ foreach ($blogids as $blog_id) {
22
+ switch_to_blog($blog_id);
23
+ nggallery_install($this);
24
+ }
25
+ switch_to_blog($old_blog);
26
+ return;
27
+ }
28
+ }
29
+ // remove the update message
30
+ delete_option( 'ngg_update_exists' );
31
+ nggallery_install($this);
32
  }
33
 
34
  function uninstall($hard=FALSE)
35
  {
36
  delete_option('ngg_init_check');
37
  delete_option('ngg_update_exists');
38
+ delete_option( 'ngg_options' );
39
+ delete_option( 'ngg_db_version' );
40
+ delete_option( 'ngg_update_exists' );
41
+ delete_option( 'ngg_next_update' );
42
+
43
+ // now remove the capability
44
+ ngg_remove_capability("NextGEN Gallery overview");
45
+ ngg_remove_capability("NextGEN Use TinyMCE");
46
+ ngg_remove_capability("NextGEN Upload images");
47
+ ngg_remove_capability("NextGEN Manage gallery");
48
+ ngg_remove_capability("NextGEN Edit album");
49
+ ngg_remove_capability("NextGEN Change style");
50
+ ngg_remove_capability("NextGEN Change options");
51
+ ngg_remove_capability("NextGEN Attach Interface");
52
+
53
+ $this->remove_transients();
54
+ }
55
+
56
+ function remove_transients()
57
+ {
58
+ global $wpdb, $_wp_using_ext_object_cache;
59
+
60
+ // Fetch all transients
61
+ $query = "
62
+ SELECT option_name FROM {$wpdb->options}
63
+ WHERE option_name LIKE '%ngg_request%'
64
+ ";
65
+ $transient_names = $wpdb->get_col($query);;
66
+
67
+ // Delete all transients in the database
68
+ $query = "
69
+ DELETE FROM {$wpdb->options}
70
+ WHERE option_name LIKE '%ngg_request%'
71
+ ";
72
+ $wpdb->query($query);
73
+
74
+ // If using an external caching mechanism, delete the cached items
75
+ if ($_wp_using_ext_object_cache) {
76
+ foreach ($transient_names as $transient) {
77
+ wp_cache_delete($transient, 'transient');
78
+ wp_cache_delete(substr($transient, 11), 'transient');
79
+ }
80
+ }
81
+ }
82
+
83
+ function upgrade_schema($sql)
84
+ {
85
+ global $wpdb;
86
+
87
+ // upgrade function changed in WordPress 2.3
88
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
89
+
90
+ // add charset & collate like wp core
91
+ $charset_collate = '';
92
+
93
+ if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
94
+ if ( ! empty($wpdb->charset) )
95
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
96
+ if ( ! empty($wpdb->collate) )
97
+ $charset_collate .= " COLLATE $wpdb->collate";
98
+ }
99
+
100
+ // Add charset to table creation query
101
+ $sql = str_replace($charset_collate, '', str_replace(';', '', $sql));
102
+
103
+ // Execute the query
104
+ dbDelta($sql. ' '. $charset_collate. ';');
105
  }
106
  }
products/photocrati_nextgen/modules/ngglegacy/lib/media-rss.php CHANGED
@@ -221,10 +221,10 @@ class nggMediaRss {
221
  $out .= $indent . "\t<description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></description>\n";
222
  $out .= $indent . "\t<link><![CDATA[" . $image->get_permalink() . "]]></link>\n";
223
  $out .= $indent . "\t<guid>image-id:" . $image->pid . "</guid>\n";
224
- $out .= $indent . "\t<media:content url='" . esc_url($image->imageURL) . "' medium='image' />\n";
225
  $out .= $indent . "\t<media:title><![CDATA[" . nggGallery::i18n($title, 'pic_' . $image->pid . '_alttext') . "]]></media:title>\n";
226
  $out .= $indent . "\t<media:description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></media:description>\n";
227
- $out .= $indent . "\t<media:thumbnail url='" . esc_url($image->thumbURL) . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
228
  $out .= $indent . "\t<media:keywords><![CDATA[" . nggGallery::i18n($tag_names) . "]]></media:keywords>\n";
229
  $out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . site_url() . ")]]></media:copyright>\n";
230
  $out .= $indent . "</item>\n";
221
  $out .= $indent . "\t<description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></description>\n";
222
  $out .= $indent . "\t<link><![CDATA[" . $image->get_permalink() . "]]></link>\n";
223
  $out .= $indent . "\t<guid>image-id:" . $image->pid . "</guid>\n";
224
+ $out .= $indent . "\t<media:content url='" . nextgen_esc_url($image->imageURL) . "' medium='image' />\n";
225
  $out .= $indent . "\t<media:title><![CDATA[" . nggGallery::i18n($title, 'pic_' . $image->pid . '_alttext') . "]]></media:title>\n";
226
  $out .= $indent . "\t<media:description><![CDATA[" . nggGallery::i18n($desc, 'pic_' . $image->pid . '_description') . "]]></media:description>\n";
227
+ $out .= $indent . "\t<media:thumbnail url='" . nextgen_esc_url($image->thumbURL) . "' width='" . $thumbwidth . "' height='" . $thumbheight . "' />\n";
228
  $out .= $indent . "\t<media:keywords><![CDATA[" . nggGallery::i18n($tag_names) . "]]></media:keywords>\n";
229
  $out .= $indent . "\t<media:copyright><![CDATA[Copyright (c) " . get_option("blogname") . " (" . site_url() . ")]]></media:copyright>\n";
230
  $out .= $indent . "</item>\n";
products/photocrati_nextgen/modules/ngglegacy/lib/ngg-db.php CHANGED
@@ -540,7 +540,7 @@ class nggdb {
540
  * @param int|string The image ID or Slug
541
  * @return object A nggImage object representing the image (false if not found)
542
  */
543
- function find_image( $id ) {
544
  global $wpdb;
545
 
546
  if( is_numeric($id) ) {
@@ -1040,7 +1040,7 @@ class nggdb {
1040
  * @param array $values An array with existing or new values
1041
  * @return bool result of query
1042
  */
1043
- function update_image_meta( $id, $new_values ) {
1044
  global $wpdb;
1045
 
1046
  // XXX nggdb is used statically, cannot inherit from Ngg_Serializable
@@ -1070,7 +1070,7 @@ class nggdb {
1070
  * @param int (optional) $id of the object, so that it's not checked against itself
1071
  * @return string unique slug for the object, based on $slug (with a -1, -2, etc. suffix)
1072
  */
1073
- function get_unique_slug( $slug, $type, $id = 0 ) {
1074
 
1075
  global $wpdb;
1076
 
540
  * @param int|string The image ID or Slug
541
  * @return object A nggImage object representing the image (false if not found)
542
  */
543
+ static function find_image( $id ) {
544
  global $wpdb;
545
 
546
  if( is_numeric($id) ) {
1040
  * @param array $values An array with existing or new values
1041
  * @return bool result of query
1042
  */
1043
+ static function update_image_meta( $id, $new_values ) {
1044
  global $wpdb;
1045
 
1046
  // XXX nggdb is used statically, cannot inherit from Ngg_Serializable
1070
  * @param int (optional) $id of the object, so that it's not checked against itself
1071
  * @return string unique slug for the object, based on $slug (with a -1, -2, etc. suffix)
1072
  */
1073
+ static function get_unique_slug( $slug, $type, $id = 0 ) {
1074
 
1075
  global $wpdb;
1076
 
products/photocrati_nextgen/modules/ngglegacy/lib/post-thumbnail.php CHANGED
@@ -65,7 +65,7 @@ class nggPostThumbnail {
65
  $iframe_src = add_query_arg('chromeless', '1', $iframe_src);
66
  $iframe_src = add_query_arg('TB_iframe', '1', $iframe_src);
67
 
68
- $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set NextGEN featured image' ) . '" href="' . esc_url( $iframe_src ) . '" id="set-ngg-post-thumbnail" class="thickbox">%s</a></p>';
69
 
70
  $content .= sprintf($set_thumbnail_link, esc_html__( 'Set NextGEN featured image' ));
71
  }
@@ -325,7 +325,7 @@ class nggPostThumbnail {
325
 
326
  global $_wp_additional_image_sizes, $post_ID;
327
 
328
- $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>';
329
  $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
330
 
331
  $image = nggdb::find_image($thumbnail_id);
65
  $iframe_src = add_query_arg('chromeless', '1', $iframe_src);
66
  $iframe_src = add_query_arg('TB_iframe', '1', $iframe_src);
67
 
68
+ $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set NextGEN featured image' ) . '" href="' . nextgen_esc_url( $iframe_src ) . '" id="set-ngg-post-thumbnail" class="thickbox">%s</a></p>';
69
 
70
  $content .= sprintf($set_thumbnail_link, esc_html__( 'Set NextGEN featured image' ));
71
  }
325
 
326
  global $_wp_additional_image_sizes, $post_ID;
327
 
328
+ $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . nextgen_esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
329
  $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
330
 
331
  $image = nggdb::find_image($thumbnail_id);
products/photocrati_nextgen/modules/ngglegacy/lib/shortcodes.php CHANGED
@@ -15,7 +15,7 @@ class NextGEN_shortcodes {
15
 
16
  // Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
17
  $pcre_limit = 500000;
18
- if ((int)ini_get('pcre.backtrack_ limit') < $pcre_limit) {
19
  @ini_set('pcre.backtrack_limit', $pcre_limit);
20
  }
21
 
15
 
16
  // Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
17
  $pcre_limit = 500000;
18
+ if ((int)ini_get('pcre.backtrack_limit') < $pcre_limit) {
19
  @ini_set('pcre.backtrack_limit', $pcre_limit);
20
  }
21
 
products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php CHANGED
@@ -24,7 +24,7 @@ class M_NggLegacy extends C_Base_Module
24
  'photocrati-nextgen-legacy',
25
  'NextGEN Legacy',
26
  'Embeds the original version of NextGEN 1.9.3 by Alex Rabe',
27
- '0.2',
28
  'http://www.nextgen-gallery.com',
29
  'Photocrati Media',
30
  'http://www.photocrati.com'
24
  'photocrati-nextgen-legacy',
25
  'NextGEN Legacy',
26
  'Embeds the original version of NextGEN 1.9.3 by Alex Rabe',
27
+ '0.3',
28
  'http://www.nextgen-gallery.com',
29
  'Photocrati Media',
30
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/ngglegacy/nggallery.php CHANGED
@@ -11,7 +11,7 @@ if (!class_exists('nggLoader')) {
11
 
12
  var $version = NEXTGEN_GALLERY_PLUGIN_VERSION;
13
  var $dbversion = '1.8.1';
14
- var $minimum_WP = '3.6';
15
  var $donators = 'http://www.nextgen-gallery.com/donators.php';
16
  var $options = '';
17
  var $manage_page;
@@ -36,13 +36,6 @@ if (!class_exists('nggLoader')) {
36
  $this->load_dependencies();
37
  $this->start_rewrite_module();
38
 
39
- // Init options & tables during activation & deregister init option
40
- register_activation_hook( $this->plugin_name, array(&$this, 'activate') );
41
- register_deactivation_hook( $this->plugin_name, array(&$this, 'deactivate') );
42
-
43
- // Register a uninstall hook to remove all tables & option automatic
44
- register_uninstall_hook( $this->plugin_name, array(__CLASS__, 'uninstall') );
45
-
46
  // Start this plugin once all other plugins are fully loaded
47
  add_action( 'plugins_loaded', array(&$this, 'start_plugin') );
48
 
@@ -314,99 +307,12 @@ if (!class_exists('nggLoader')) {
314
  if (is_plugin_active_for_network( $this->plugin_name )) {
315
  $current_blog = $wpdb->blogid;
316
  switch_to_blog($blog_id);
317
- nggallery_install();
 
318
  switch_to_blog($current_blog);
319
  }
320
  }
321
 
322
- /**
323
- * Removes all transients created by NextGEN. Called during activation
324
- * and deactivation routines
325
- */
326
- static function remove_transients()
327
- {
328
- global $wpdb, $_wp_using_ext_object_cache;
329
-
330
- // Fetch all transients
331
- $query = "
332
- SELECT option_name FROM {$wpdb->options}
333
- WHERE option_name LIKE '%ngg_request%'
334
- ";
335
- $transient_names = $wpdb->get_col($query);;
336
-
337
- // Delete all transients in the database
338
- $query = "
339
- DELETE FROM {$wpdb->options}
340
- WHERE option_name LIKE '%ngg_request%'
341
- ";
342
- $wpdb->query($query);
343
-
344
- // If using an external caching mechanism, delete the cached items
345
- if ($_wp_using_ext_object_cache) {
346
- foreach ($transient_names as $transient) {
347
- wp_cache_delete($transient, 'transient');
348
- wp_cache_delete(substr($transient, 11), 'transient');
349
- }
350
- }
351
- }
352
-
353
- function activate() {
354
- global $wpdb;
355
- //Starting from version 1.8.0 it's works only with PHP5.2
356
- if (version_compare(PHP_VERSION, '5.2.0', '<')) {
357
- deactivate_plugins($this->plugin_name); // Deactivate ourself
358
- wp_die("Sorry, but you can't run this plugin, it requires PHP 5.2 or higher.");
359
- return;
360
- }
361
-
362
- // Clean up transients
363
- self::remove_transients();
364
-
365
- include_once (dirname (__FILE__) . '/admin/install.php');
366
-
367
- if (is_multisite()) {
368
- $network=isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:"";
369
- $activate=isset($_GET['action'])?$_GET['action']:"";
370
- $isNetwork=($network=='/wp-admin/network/plugins.php')?true:false;
371
- $isActivation=($activate=='deactivate')?false:true;
372
-
373
- if ($isNetwork and $isActivation){
374
- $old_blog = $wpdb->blogid;
375
- $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs", NULL));
376
- foreach ($blogids as $blog_id) {
377
- switch_to_blog($blog_id);
378
- nggallery_install();
379
- }
380
- switch_to_blog($old_blog);
381
- return;
382
- }
383
- }
384
-
385
- // check for tables
386
- nggallery_install();
387
- // remove the update message
388
- delete_option( 'ngg_update_exists' );
389
-
390
- }
391
-
392
- function deactivate() {
393
-
394
- // remove & reset the init check option
395
- delete_option( 'ngg_init_check' );
396
- delete_option( 'ngg_update_exists' );
397
-
398
- // Clean up transients
399
- self::remove_transients();
400
- }
401
-
402
- function uninstall() {
403
- // Clean up transients
404
- self::remove_transients();
405
-
406
- include_once (dirname (__FILE__) . '/admin/install.php');
407
- nggallery_uninstall();
408
- }
409
-
410
  function disable_upgrade($option){
411
 
412
  // PHP5.2 is required for NGG V1.4.0
11
 
12
  var $version = NEXTGEN_GALLERY_PLUGIN_VERSION;
13
  var $dbversion = '1.8.1';
14
+ var $minimum_WP = '3.6.1';
15
  var $donators = 'http://www.nextgen-gallery.com/donators.php';
16
  var $options = '';
17
  var $manage_page;
36
  $this->load_dependencies();
37
  $this->start_rewrite_module();
38
 
 
 
 
 
 
 
 
39
  // Start this plugin once all other plugins are fully loaded
40
  add_action( 'plugins_loaded', array(&$this, 'start_plugin') );
41
 
307
  if (is_plugin_active_for_network( $this->plugin_name )) {
308
  $current_blog = $wpdb->blogid;
309
  switch_to_blog($blog_id);
310
+ $installer = new C_NggLegacy_Installer;
311
+ nggallery_install($installer);
312
  switch_to_blog($current_blog);
313
  }
314
  }
315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  function disable_upgrade($option){
317
 
318
  // PHP5.2 is required for NGG V1.4.0
products/photocrati_nextgen/modules/ngglegacy/view/album-compact.php CHANGED
@@ -22,12 +22,24 @@ Follow variables are useable :
22
  <div class="ngg-album-compact">
23
  <div class="ngg-album-compactbox">
24
  <div class="ngg-album-link">
25
- <a class="Link" href="<?php echo $gallery->pagelink ?>">
26
- <img class="Thumb" alt="<?php echo $gallery->title ?>" src="<?php echo $gallery->previewurl ?>"/>
27
  </a>
28
  </div>
29
  </div>
30
- <h4><a class="ngg-album-desc" title="<?php echo $gallery->title ?>" href="<?php echo $gallery->pagelink ?>" ><?php echo $gallery->title ?></a></h4>
 
 
 
 
 
 
 
 
 
 
 
 
31
  <?php if (@$gallery->counter > 0) : ?>
32
  <p><strong><?php echo $gallery->counter ?></strong>&nbsp;<?php _e('Photos', 'nggallery') ?></p>
33
  <?php endif; ?>
22
  <div class="ngg-album-compact">
23
  <div class="ngg-album-compactbox">
24
  <div class="ngg-album-link">
25
+ <a class="Link" href="<?php echo nextgen_esc_url($gallery->pagelink) ?>">
26
+ <img class="Thumb" alt="<?php echo esc_attr($gallery->title) ?>" src="<?php echo nextgen_esc_url($gallery->previewurl) ?>"/>
27
  </a>
28
  </div>
29
  </div>
30
+ <?php if (!empty($image_gen_params)) {
31
+ $max_width = 'style="max-width: ' . ($image_gen_params['width'] + 20) . 'px"';
32
+ } else {
33
+ $max_width = '';
34
+ } ?>
35
+ <h4>
36
+ <a class="ngg-album-desc"
37
+ title="<?php echo esc_attr($gallery->title) ?>"
38
+ href="<?php echo nextgen_esc_url($gallery->pagelink) ?>"
39
+ <?php echo $max_width; ?>>
40
+ <?php echo $gallery->title ?>
41
+ </a>
42
+ </h4>
43
  <?php if (@$gallery->counter > 0) : ?>
44
  <p><strong><?php echo $gallery->counter ?></strong>&nbsp;<?php _e('Photos', 'nggallery') ?></p>
45
  <?php endif; ?>
products/photocrati_nextgen/modules/ngglegacy/view/album-extend.php CHANGED
@@ -19,10 +19,10 @@ Follow variables are useable :
19
  <?php foreach ($galleries as $gallery) : ?>
20
 
21
  <div class="ngg-album">
22
- <div class="ngg-albumtitle"><a href="<?php echo $gallery->pagelink ?>"><?php echo $gallery->title ?></a></div>
23
  <div class="ngg-albumcontent">
24
  <div class="ngg-thumbnail">
25
- <a href="<?php echo $gallery->pagelink ?>"><img class="Thumb" alt="<?php echo $gallery->title ?>" src="<?php echo $gallery->previewurl ?>"/></a>
26
  </div>
27
  <div class="ngg-description">
28
  <p><?php echo $gallery->galdesc ?></p>
@@ -40,4 +40,4 @@ Follow variables are useable :
40
 
41
  </div>
42
 
43
- <?php endif; ?>
19
  <?php foreach ($galleries as $gallery) : ?>
20
 
21
  <div class="ngg-album">
22
+ <div class="ngg-albumtitle"><a href="<?php echo nextgen_esc_url($gallery->pagelink) ?>"><?php echo $gallery->title ?></a></div>
23
  <div class="ngg-albumcontent">
24
  <div class="ngg-thumbnail">
25
+ <a href="<?php echo nextgen_esc_url($gallery->pagelink) ?>"><img class="Thumb" alt="<?php echo esc_attr($gallery->title) ?>" src="<?php echo nextgen_esc_url($gallery->previewurl) ?>"/></a>
26
  </div>
27
  <div class="ngg-description">
28
  <p><?php echo $gallery->galdesc ?></p>
40
 
41
  </div>
42
 
43
+ <?php endif; ?>
products/photocrati_nextgen/modules/ngglegacy/view/gallery-caption.php CHANGED
@@ -19,7 +19,7 @@ Follow variables are useable :
19
  <?php if ($gallery->show_slideshow) { ?>
20
  <!-- Slideshow link -->
21
  <div class="slideshowlink">
22
- <a class="slideshowlink" href="<?php echo $gallery->slideshow_link ?>">
23
  <?php echo $gallery->slideshow_link_text ?>
24
  </a>
25
  </div>
@@ -28,7 +28,7 @@ Follow variables are useable :
28
  <?php if ($gallery->show_piclens) { ?>
29
  <!-- Piclense link -->
30
  <div class="piclenselink">
31
- <a class="piclenselink" href="<?php echo $gallery->piclens_link ?>">
32
  <?php _e('[View with PicLens]','nggallery'); ?>
33
  </a>
34
  </div>
@@ -40,9 +40,16 @@ Follow variables are useable :
40
 
41
  <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
42
  <div class="ngg-gallery-thumbnail" >
43
- <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
 
 
 
 
 
 
 
44
  <?php if ( !$image->hidden ) { ?>
45
- <img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
46
  <?php } ?>
47
  </a>
48
  <span><?php echo $image->caption ?></span>
19
  <?php if ($gallery->show_slideshow) { ?>
20
  <!-- Slideshow link -->
21
  <div class="slideshowlink">
22
+ <a class="slideshowlink" href="<?php echo nextgen_esc_url($gallery->slideshow_link) ?>">
23
  <?php echo $gallery->slideshow_link_text ?>
24
  </a>
25
  </div>
28
  <?php if ($gallery->show_piclens) { ?>
29
  <!-- Piclense link -->
30
  <div class="piclenselink">
31
+ <a class="piclenselink" href="<?php echo nextgen_esc_url($gallery->piclens_link) ?>">
32
  <?php _e('[View with PicLens]','nggallery'); ?>
33
  </a>
34
  </div>
40
 
41
  <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
42
  <div class="ngg-gallery-thumbnail" >
43
+ <a href="<?php echo nextgen_esc_url($image->imageURL) ?>"
44
+ title="<?php echo esc_attr($image->description) ?>"
45
+ data-src="<?php echo nextgen_esc_url($image->imageURL) ?>"
46
+ data-thumbnail="<?php echo nextgen_esc_url($image->thumbnailURL); ?>"
47
+ data-image-id="<?php echo esc_attr($image->pid); ?>"
48
+ data-title="<?php echo esc_attr($image->alttext); ?>"
49
+ data-description="<?php echo esc_attr($image->description); ?>"
50
+ <?php echo $image->thumbcode ?> >
51
  <?php if ( !$image->hidden ) { ?>
52
+ <img title="<?php echo esc_attr($image->alttext) ?>" alt="<?php echo esc_attr($image->alttext) ?>" src="<?php echo nextgen_esc_url($image->thumbnailURL) ?>" <?php echo $image->size ?> />
53
  <?php } ?>
54
  </a>
55
  <span><?php echo $image->caption ?></span>
products/photocrati_nextgen/modules/ngglegacy/view/gallery-carousel.php CHANGED
@@ -19,14 +19,14 @@ Follow variables are useable :
19
 
20
  <div class="ngg-galleryoverview">
21
 
22
- <div class="pic"><img title="<?php echo $current->alttext ?>" alt="<?php echo $current->alttext ?>" src="<?php echo $current->url; ?>" /></div>
23
 
24
  <ul class="ngg-gallery-list">
25
 
26
  <!-- PREV LINK -->
27
  <?php if ($prev) : ?>
28
  <li class="ngg-prev">
29
- <a class="prev" href="<?php echo $prev ?>">&#9668;</a>
30
  </li>
31
  <?php endif; ?>
32
 
@@ -34,9 +34,9 @@ Follow variables are useable :
34
  <?php foreach ( $images as $image ) : ?>
35
  <?php if ( $image->hidden ) continue; ?>
36
 
37
- <li id="ngg-image-<?php echo $image->pid ?>" class="ngg-thumbnail-list <?php if ($image->pid == $current->pid) echo 'selected' ?>" >
38
- <a href="<?php echo $image->pidlink ?>" title="<?php echo $image->description ?>" >
39
- <img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
40
  </a>
41
  </li>
42
 
@@ -45,7 +45,7 @@ Follow variables are useable :
45
  <!-- NEXT LINK -->
46
  <?php if ($next) : ?>
47
  <li class="ngg-next">
48
- <a class="next" href="<?php echo $next ?>">&#9658;</a>
49
  </li>
50
  <?php endif; ?>
51
 
@@ -53,4 +53,4 @@ Follow variables are useable :
53
 
54
  </div>
55
 
56
- <?php endif; ?>
19
 
20
  <div class="ngg-galleryoverview">
21
 
22
+ <div class="pic"><img title="<?php echo esc_attr($current->alttext) ?>" alt="<?php echo esc_attr($current->alttext) ?>" src="<?php echo nextgen_esc_url($current->url); ?>" /></div>
23
 
24
  <ul class="ngg-gallery-list">
25
 
26
  <!-- PREV LINK -->
27
  <?php if ($prev) : ?>
28
  <li class="ngg-prev">
29
+ <a class="prev" href="<?php echo nextgen_esc_url($prev) ?>">&#9668;</a>
30
  </li>
31
  <?php endif; ?>
32
 
34
  <?php foreach ( $images as $image ) : ?>
35
  <?php if ( $image->hidden ) continue; ?>
36
 
37
+ <li id="ngg-image-<?php echo esc_attr($image->pid) ?>" class="ngg-thumbnail-list <?php if ($image->pid == $current->pid) echo 'selected' ?>" >
38
+ <a href="<?php echo nextgen_esc_url($image->pidlink) ?>" title="<?php echo esc_attr($image->description) ?>" >
39
+ <img title="<?php echo esc_attr($image->alttext) ?>" alt="<?php echo esc_attr($image->alttext) ?>" src="<?php echo nextgen_esc_url($image->thumbnailURL) ?>" <?php echo $image->size ?> />
40
  </a>
41
  </li>
42
 
45
  <!-- NEXT LINK -->
46
  <?php if ($next) : ?>
47
  <li class="ngg-next">
48
+ <a class="next" href="<?php echo nextgen_esc_url($next) ?>">&#9658;</a>
49
  </li>
50
  <?php endif; ?>
51
 
53
 
54
  </div>
55
 
56
+ <?php endif; ?>
products/photocrati_nextgen/modules/ngglegacy/view/gallery.php CHANGED
@@ -19,7 +19,7 @@ Follow variables are useable :
19
  <?php if ($gallery->show_slideshow) { ?>
20
  <!-- Slideshow link -->
21
  <div class="slideshowlink">
22
- <a class="slideshowlink" href="<?php echo $gallery->slideshow_link ?>">
23
  <?php echo $gallery->slideshow_link_text ?>
24
  </a>
25
  </div>
@@ -28,7 +28,7 @@ Follow variables are useable :
28
  <?php if ($gallery->show_piclens) { ?>
29
  <!-- Piclense link -->
30
  <div class="piclenselink">
31
- <a class="piclenselink" href="<?php echo $gallery->piclens_link ?>">
32
  <?php _e('[View with PicLens]','nggallery'); ?>
33
  </a>
34
  </div>
@@ -40,9 +40,16 @@ Follow variables are useable :
40
 
41
  <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
42
  <div class="ngg-gallery-thumbnail" >
43
- <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
 
 
 
 
 
 
 
44
  <?php if ( !$image->hidden ) { ?>
45
- <img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
46
  <?php } ?>
47
  </a>
48
  </div>
19
  <?php if ($gallery->show_slideshow) { ?>
20
  <!-- Slideshow link -->
21
  <div class="slideshowlink">
22
+ <a class="slideshowlink" href="<?php echo nextgen_esc_url($gallery->slideshow_link) ?>">
23
  <?php echo $gallery->slideshow_link_text ?>
24
  </a>
25
  </div>
28
  <?php if ($gallery->show_piclens) { ?>
29
  <!-- Piclense link -->
30
  <div class="piclenselink">
31
+ <a class="piclenselink" href="<?php echo nextgen_esc_url($gallery->piclens_link) ?>">
32
  <?php _e('[View with PicLens]','nggallery'); ?>
33
  </a>
34
  </div>
40
 
41
  <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
42
  <div class="ngg-gallery-thumbnail" >
43
+ <a href="<?php echo nextgen_esc_url($image->imageURL) ?>"
44
+ title="<?php echo esc_attr($image->description) ?>"
45
+ data-src="<?php echo nextgen_esc_url($image->imageURL); ?>"
46
+ data-thumbnail="<?php echo nextgen_esc_url($image->thumbnailURL); ?>"
47
+ data-image-id="<?php echo esc_attr($image->pid); ?>"
48
+ data-title="<?php echo esc_attr($image->alttext); ?>"
49
+ data-description="<?php echo esc_attr($image->description); ?>"
50
+ <?php echo $image->thumbcode ?> >
51
  <?php if ( !$image->hidden ) { ?>
52
+ <img title="<?php echo esc_attr($image->alttext) ?>" alt="<?php echo esc_attr($image->alttext) ?>" src="<?php echo nextgen_esc_url($image->thumbnailURL) ?>" <?php echo $image->size ?> />
53
  <?php } ?>
54
  </a>
55
  </div>
products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser-caption.php CHANGED
@@ -23,10 +23,10 @@ Follow variables are useable :
23
  <div class="pic"><?php echo $image->href_link ?></div>
24
  <div class="ngg-imagebrowser-nav">
25
  <div class="back">
26
- <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo $image->previous_image_link ?>">&#9668; <?php _e('Back', 'nggallery') ?></a>
27
  </div>
28
  <div class="next">
29
- <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo $image->next_image_link ?>"><?php _e('Next', 'nggallery') ?> &#9658;</a>
30
  </div>
31
  <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div>
32
  <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
@@ -34,4 +34,4 @@ Follow variables are useable :
34
 
35
  </div>
36
 
37
- <?php endif; ?>
23
  <div class="pic"><?php echo $image->href_link ?></div>
24
  <div class="ngg-imagebrowser-nav">
25
  <div class="back">
26
+ <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo nextgen_esc_url($image->previous_image_link) ?>">&#9668; <?php _e('Back', 'nggallery') ?></a>
27
  </div>
28
  <div class="next">
29
+ <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo nextgen_esc_url($image->next_image_link) ?>"><?php _e('Next', 'nggallery') ?> &#9658;</a>
30
  </div>
31
  <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div>
32
  <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
34
 
35
  </div>
36
 
37
+ <?php endif; ?>
products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser-exif.php CHANGED
@@ -27,10 +27,10 @@ Please note : A Image resize or watermarking operation will remove all meta info
27
  <div class="pic"><?php echo $image->href_link ?></div>
28
  <div class="ngg-imagebrowser-nav">
29
  <div class="back">
30
- <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo $image->previous_image_link ?>">&#9668; <?php _e('Back', 'nggallery') ?></a>
31
  </div>
32
  <div class="next">
33
- <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo $image->next_image_link ?>"><?php _e('Next', 'nggallery') ?> &#9658;</a>
34
  </div>
35
  <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div>
36
  <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
27
  <div class="pic"><?php echo $image->href_link ?></div>
28
  <div class="ngg-imagebrowser-nav">
29
  <div class="back">
30
+ <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo nextgen_esc_url($image->previous_image_link) ?>">&#9668; <?php _e('Back', 'nggallery') ?></a>
31
  </div>
32
  <div class="next">
33
+ <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo nextgen_esc_url($image->next_image_link) ?>"><?php _e('Next', 'nggallery') ?> &#9658;</a>
34
  </div>
35
  <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div>
36
  <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser.php CHANGED
@@ -20,13 +20,13 @@ Follow variables are useable :
20
 
21
  <h3><?php echo $image->alttext ?></h3>
22
 
23
- <div class="pic"><?php echo $image->href_link ?></div>
24
  <div class="ngg-imagebrowser-nav">
25
  <div class="back">
26
- <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo $image->previous_image_link ?>">&#9668; <?php _e('Back', 'nggallery') ?></a>
27
  </div>
28
  <div class="next">
29
- <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo $image->next_image_link ?>"><?php _e('Next', 'nggallery') ?> &#9658;</a>
30
  </div>
31
  <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div>
32
  <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
@@ -34,4 +34,4 @@ Follow variables are useable :
34
 
35
  </div>
36
 
37
- <?php endif; ?>
20
 
21
  <h3><?php echo $image->alttext ?></h3>
22
 
23
+ <div class="pic"><?php echo nextgen_esc_url($image->href_link) ?></div>
24
  <div class="ngg-imagebrowser-nav">
25
  <div class="back">
26
+ <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo nextgen_esc_url($image->previous_image_link) ?>">&#9668; <?php _e('Back', 'nggallery') ?></a>
27
  </div>
28
  <div class="next">
29
+ <a class="ngg-browser-next" id="ngg-next-<?php echo $image->next_pid ?>" href="<?php echo nextgen_esc_url($image->next_image_link) ?>"><?php _e('Next', 'nggallery') ?> &#9658;</a>
30
  </div>
31
  <div class="counter"><?php _e('Picture', 'nggallery') ?> <?php echo $image->number ?> <?php _e('of', 'nggallery')?> <?php echo $image->total ?></div>
32
  <div class="ngg-imagebrowser-desc"><p><?php echo $image->description ?></p></div>
34
 
35
  </div>
36
 
37
+ <?php endif; ?>
products/photocrati_nextgen/modules/ngglegacy/view/singlepic.php CHANGED
@@ -18,14 +18,19 @@ Please note : A Image resize or watermarking operation will remove all meta info
18
  **/
19
  ?>
20
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($image)) : ?>
21
- <a href="<?php echo $image->imageURL; ?>"
22
- title="<?php echo $image->linktitle; ?>"
 
 
 
 
 
23
  <?php if(!empty($target)) { ?>target="<?php echo esc_attr($target); ?>"<?php } ?>
24
  <?php echo $image->thumbcode; ?>>
25
  <img class="<?php echo $image->classname; ?>"
26
- src="<?php echo $image->thumbnailURL; ?>"
27
- alt="<?php echo $image->alttext; ?>"
28
- title="<?php echo $image->alttext; ?>"/>
29
  </a>
30
  <?php if (!empty ($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?>
31
- <?php endif; ?>
18
  **/
19
  ?>
20
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($image)) : ?>
21
+ <a href="<?php echo nextgen_esc_url($image->imageURL); ?>"
22
+ title="<?php echo esc_attr($image->linktitle); ?>"
23
+ data-src="<?php echo nextgen_esc_url($image->imageURL); ?>"
24
+ data-thumbnail="<?php echo nextgen_esc_url($image->thumbnailURL); ?>"
25
+ data-image-id="<?php echo esc_attr($image->pid); ?>"
26
+ data-title="<?php echo esc_attr($image->alttext); ?>"
27
+ data-description="<?php echo esc_attr($image->description); ?>"
28
  <?php if(!empty($target)) { ?>target="<?php echo esc_attr($target); ?>"<?php } ?>
29
  <?php echo $image->thumbcode; ?>>
30
  <img class="<?php echo $image->classname; ?>"
31
+ src="<?php echo nextgen_esc_url($image->thumbnailURL); ?>"
32
+ alt="<?php echo esc_attr($image->alttext); ?>"
33
+ title="<?php echo esc_attr($image->alttext); ?>"/>
34
  </a>
35
  <?php if (!empty ($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?>
36
+ <?php endif; ?>
products/photocrati_nextgen/modules/router/class.routing_app.php CHANGED
@@ -168,6 +168,7 @@ class Mixin_Routing_App extends Mixin
168
  function do_rewrites($request_uri=FALSE)
169
  {
170
  $redirect = FALSE;
 
171
 
172
  // Get the request uri if not provided
173
  if (!$request_uri) $request_uri = $this->object->get_app_request_uri();
@@ -178,7 +179,7 @@ class Mixin_Routing_App extends Mixin
178
 
179
  // Process each rewrite rule
180
  // start rewriting urls
181
- foreach ($this->object->_rewrite_patterns as $pattern => $details) {
182
 
183
  // Remove this pattern from future processing for this request
184
  unset($this->object->_rewrite_patterns[$pattern]);
@@ -189,9 +190,8 @@ class Mixin_Routing_App extends Mixin
189
  foreach ($matches as $index => $match) {
190
  if ($index == 0) {
191
  $request_uri = str_replace($match, $details['dst'], $request_uri);
192
- continue;
193
  }
194
- $request_uri = str_replace(
195
  "{{$index}}", $match, $request_uri
196
  );
197
  }
@@ -204,7 +204,10 @@ class Mixin_Routing_App extends Mixin
204
  }
205
 
206
  // Stop processing rewrite patterns?
207
- if ($details['stop']) break;
 
 
 
208
  }
209
  }
210
 
@@ -233,6 +236,8 @@ class Mixin_Routing_App extends Mixin
233
 
234
  }
235
  }
 
 
236
  }
237
 
238
  // Cache all known data about the application request
@@ -564,7 +569,7 @@ class Mixin_Routing_App extends Mixin
564
  $param_slug = $settings->router_param_slug ? preg_quote($settings->router_param_slug, '#') : FALSE;
565
 
566
  // Is the parameter already part of the request? If so, modify that
567
- // parmaeter
568
  if (($segment = $this->object->get_parameter_segment($key, $id, $url))) {
569
  extract($segment);
570
 
@@ -613,7 +618,7 @@ class Mixin_Routing_App extends Mixin
613
  {
614
  $settings = $this->object->_settings;
615
  $param_slug = $settings->router_param_slug;
616
-
617
  $uri = $this->object->get_app_request_uri();
618
  $parts = array($uri);
619
  if ($param_slug && strpos($uri, $param_slug) === FALSE) $parts[] = $param_slug;
@@ -697,7 +702,7 @@ class Mixin_Routing_App extends Mixin
697
  return array(
698
  'querystring' => $this->object->get_formatted_querystring(),
699
  'request_uri' => $this->object->get_app_request_uri(),
700
- 'postdata' => $this->object->get_postdata()
701
  );
702
  }
703
 
@@ -796,13 +801,13 @@ class C_Routing_App extends C_Component
796
  $this->add_mixin('Mixin_Routing_App');
797
  $this->implement('I_Routing_App');
798
  }
799
-
800
  function initialize()
801
  {
802
  parent::initialize();
803
  $this->_settings = $this->object->get_routing_settings();
804
  }
805
-
806
  function get_routing_settings()
807
  {
808
  $settings = C_NextGen_Settings::get_instance();
168
  function do_rewrites($request_uri=FALSE)
169
  {
170
  $redirect = FALSE;
171
+ static $stop_processing = FALSE;
172
 
173
  // Get the request uri if not provided
174
  if (!$request_uri) $request_uri = $this->object->get_app_request_uri();
179
 
180
  // Process each rewrite rule
181
  // start rewriting urls
182
+ if (!$stop_processing) foreach ($this->object->_rewrite_patterns as $pattern => $details) {
183
 
184
  // Remove this pattern from future processing for this request
185
  unset($this->object->_rewrite_patterns[$pattern]);
190
  foreach ($matches as $index => $match) {
191
  if ($index == 0) {
192
  $request_uri = str_replace($match, $details['dst'], $request_uri);
 
193
  }
194
+ if ($index > 0) $request_uri = str_replace(
195
  "{{$index}}", $match, $request_uri
196
  );
197
  }
204
  }
205
 
206
  // Stop processing rewrite patterns?
207
+ if ($details['stop']) {
208
+ $stop_processing = TRUE;
209
+
210
+ }
211
  }
212
  }
213
 
236
 
237
  }
238
  }
239
+
240
+ if ($stop_processing) break;
241
  }
242
 
243
  // Cache all known data about the application request
569
  $param_slug = $settings->router_param_slug ? preg_quote($settings->router_param_slug, '#') : FALSE;
570
 
571
  // Is the parameter already part of the request? If so, modify that
572
+ // parameter
573
  if (($segment = $this->object->get_parameter_segment($key, $id, $url))) {
574
  extract($segment);
575
 
618
  {
619
  $settings = $this->object->_settings;
620
  $param_slug = $settings->router_param_slug;
621
+
622
  $uri = $this->object->get_app_request_uri();
623
  $parts = array($uri);
624
  if ($param_slug && strpos($uri, $param_slug) === FALSE) $parts[] = $param_slug;
702
  return array(
703
  'querystring' => $this->object->get_formatted_querystring(),
704
  'request_uri' => $this->object->get_app_request_uri(),
705
+ //'postdata' => $this->object->get_postdata()
706
  );
707
  }
708
 
801
  $this->add_mixin('Mixin_Routing_App');
802
  $this->implement('I_Routing_App');
803
  }
804
+
805
  function initialize()
806
  {
807
  parent::initialize();
808
  $this->_settings = $this->object->get_routing_settings();
809
  }
810
+
811
  function get_routing_settings()
812
  {
813
  $settings = C_NextGen_Settings::get_instance();
products/photocrati_nextgen/modules/security/class.wordpress_security_manager.php CHANGED
@@ -59,6 +59,19 @@ class Mixin_WordPress_Security_Manager extends Mixin
59
 
60
  function get_current_actor()
61
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  return $this->object->get_actor(get_current_user_id(), 'user');
63
  }
64
 
59
 
60
  function get_current_actor()
61
  {
62
+ // If the current_user has an id of 0, then perhaps something went wrong
63
+ // with trying to parse the cookie. In that case, we'll force WordPress to try
64
+ // again
65
+ global $current_user;
66
+ if ($current_user->ID == 0) {
67
+ if (isset($GLOBALS['HTTP_COOKIE_VARS']) && isset($GLOBALS['_COOKIE']))
68
+ $current_user = NULL;
69
+ foreach ($GLOBALS['HTTP_COOKIE_VARS'] as $key => $value)
70
+ if (!isset($_COOKIE[$key])) {
71
+ $_COOKIE[$key] = $value;
72
+ }
73
+ }
74
+
75
  return $this->object->get_actor(get_current_user_id(), 'user');
76
  }
77
 
products/photocrati_nextgen/modules/security/module.security.php CHANGED
@@ -14,11 +14,15 @@ class M_Security extends C_Base_Module
14
  'photocrati-security',
15
  'Security',
16
  'Provides utilities to check for credentials and security',
17
- '0.1',
18
  'http://www.nextgen-gallery.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
21
  );
 
 
 
 
22
  }
23
 
24
  function _register_adapters()
14
  'photocrati-security',
15
  'Security',
16
  'Provides utilities to check for credentials and security',
17
+ '0.2',
18
  'http://www.nextgen-gallery.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
21
  );
22
+
23
+ if (isset($GLOBALS['_COOKIE_NG_COPY'])) {
24
+ $_COOKIE = $GLOBALS['_COOKIE_NG_COPY'];
25
+ }
26
  }
27
 
28
  function _register_adapters()
products/photocrati_nextgen/modules/widget/class.widget.php CHANGED
@@ -30,8 +30,6 @@ class Mixin_Widget extends Mixin
30
  */
31
  function echo_widget_random($number, $width = '75', $height = '50', $exclude = 'all', $list = '', $show = 'thumbnail')
32
  {
33
- wp_enqueue_style('nextgen_widgets_style', $this->get_static_url('photocrati-widget#widgets.css'));
34
- wp_enqueue_style('nextgen_basic_thumbnails_style', $this->get_static_url('nextgen_basic_thumbnails#nextgen_basic_thumbnails.css'));
35
  $options = array(
36
  'title' => FALSE,
37
  'items' => $number,
@@ -54,8 +52,6 @@ class Mixin_Widget extends Mixin
54
  */
55
  function echo_widget_recent($number, $width = '75', $height = '50', $exclude = 'all', $list = '', $show = 'thumbnail')
56
  {
57
- wp_enqueue_style('nextgen_widgets_style', $this->get_static_url('photocrati-widget#widgets.css'));
58
- wp_enqueue_style('nextgen_basic_thumbnails_style', $this->get_static_url('nextgen_basic_thumbnails#nextgen_basic_thumbnails.css'));
59
  $options = array(
60
  'title' => FALSE,
61
  'items' => $number,
@@ -81,8 +77,6 @@ class Mixin_Widget extends Mixin
81
  */
82
  function echo_widget_slideshow($galleryID, $width = '', $height = '')
83
  {
84
- wp_enqueue_style('nextgen_widgets_style', $this->get_static_url('widget#widgets.css'));
85
- wp_enqueue_style('nextgen_basic_slideshow_style', $this->get_static_url('nextgen_basic_slideshow#nextgen_basic_slideshow.css'));
86
  $widget = new C_Widget_Slideshow();
87
  $widget->render_slideshow($galleryID, $width, $height);
88
  }
30
  */
31
  function echo_widget_random($number, $width = '75', $height = '50', $exclude = 'all', $list = '', $show = 'thumbnail')
32
  {
 
 
33
  $options = array(
34
  'title' => FALSE,
35
  'items' => $number,
52
  */
53
  function echo_widget_recent($number, $width = '75', $height = '50', $exclude = 'all', $list = '', $show = 'thumbnail')
54
  {
 
 
55
  $options = array(
56
  'title' => FALSE,
57
  'items' => $number,
77
  */
78
  function echo_widget_slideshow($galleryID, $width = '', $height = '')
79
  {
 
 
80
  $widget = new C_Widget_Slideshow();
81
  $widget->render_slideshow($galleryID, $width, $height);
82
  }
products/photocrati_nextgen/modules/widget/class.widget_gallery.php CHANGED
@@ -85,60 +85,24 @@ class C_Widget_Gallery extends WP_Widget
85
 
86
  function widget($args, $instance)
87
  {
 
 
 
 
88
  // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
89
  $before_widget = NULL;
90
- $before_title = NULL;
91
- $after_widget = NULL;
92
- $after_title = NULL;
93
- $widget_id = NULL;
94
-
95
- global $wpdb;
96
-
97
  extract($args);
 
98
  $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
99
 
100
- $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
101
- $factory = C_Component_Registry::get_instance()->get_utility('I_Component_Factory');
102
- $mapper = C_Component_Registry::get_instance()->get_utility('I_Image_Mapper');
103
  $view = $factory->create('mvc_view', '');
104
 
105
- // To prevent huge db scans and/or the loading of every image available: we first retrieve X image
106
- // ids and then create a gallery using the results for the image_ids parameter
107
- $image_ids = array();
108
-
109
- $sql = "SELECT `pid` FROM `{$wpdb->nggpictures}` WHERE `exclude` = 0";
110
-
111
- // possibly filter images not from certain galleries
112
- if ($instance['exclude'] == 'allow')
113
- $sql .= sprintf(" AND `galleryid` IN (%s)", $instance['list']);
114
-
115
- // possibly filter images from certain galleries
116
- if ($instance['exclude'] == 'denied')
117
- $sql .= sprintf(" AND `galleryid` NOT IN (%s)", $instance['list']);
118
-
119
- if ($instance['type'] == 'random')
120
- $sql .= ' ORDER BY RAND()';
121
- else if ($instance['type'] == 'recent')
122
- $sql .= ' ORDER BY `imagedate` DESC';
123
-
124
- $sql .= " LIMIT {$instance['items']}";
125
-
126
- foreach ($wpdb->get_results($sql, ARRAY_N) as $res) {
127
- $image_ids[] = reset($res);
128
- }
129
- $image_ids = implode(',', $image_ids);
130
-
131
- if ($instance['type'] == 'random')
132
- {
133
- $order_by = 'rand()';
134
- $order_direction = 'DESC';
135
- }
136
- else if ($instance['type'] == 'recent')
137
- {
138
- $order_by = $mapper->get_primary_key_column();
139
- $order_direction = 'DESC';
140
- }
141
-
142
  // IE8 webslice support if needed
143
  if ($instance['webslice'])
144
  {
@@ -147,22 +111,16 @@ class C_Widget_Gallery extends WP_Widget
147
  $after_widget = '</div>' . $after_widget;
148
  }
149
 
150
- // 'Original' was the value used in 1.9x; so alias original => 'full'
151
- if ($instance['show'] == 'original')
152
- $show = 'full';
153
- else
154
- $show = 'thumb';
155
-
156
- echo $renderer->display_images(array(
157
- 'source' => 'galleries',
158
- 'order_by' => $order_by,
159
- 'order_direction' => $order_direction,
160
- 'image_ids' => $image_ids,
161
  'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS,
162
  'images_per_page' => $instance['items'],
163
  'maximum_entity_count' => $instance['items'],
164
  'template' => $view->get_template_abspath('photocrati-widget#display_gallery'),
165
- 'image_type' => $show,
166
  'show_all_in_lightbox' => FALSE,
167
  'show_slideshow_link' => FALSE,
168
  'disable_pagination' => TRUE,
@@ -178,6 +136,26 @@ class C_Widget_Gallery extends WP_Widget
178
  'widget_setting_height' => $instance['height'],
179
  'widget_setting_show_setting' => $instance['show'],
180
  'widget_setting_widget_id' => $widget_id
181
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
183
  }
85
 
86
  function widget($args, $instance)
87
  {
88
+ $router = C_Router::get_instance();
89
+ wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'));
90
+ wp_enqueue_style('nextgen_basic_thumbnails_style', $router->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails.css'));
91
+
92
  // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
93
  $before_widget = NULL;
94
+ $before_title = NULL;
95
+ $after_widget = NULL;
96
+ $after_title = NULL;
97
+ $widget_id = NULL;
 
 
 
98
  extract($args);
99
+
100
  $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
101
 
102
+ $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
103
+ $factory = C_Component_Registry::get_instance()->get_utility('I_Component_Factory');
 
104
  $view = $factory->create('mvc_view', '');
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  // IE8 webslice support if needed
107
  if ($instance['webslice'])
108
  {
111
  $after_widget = '</div>' . $after_widget;
112
  }
113
 
114
+ $source = ($instance['type'] == 'random' ? 'random_images' : 'recent');
115
+
116
+ $params = array(
117
+ 'slug' => 'widget-' . $args['widget_id'],
118
+ 'source' => $source,
 
 
 
 
 
 
119
  'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS,
120
  'images_per_page' => $instance['items'],
121
  'maximum_entity_count' => $instance['items'],
122
  'template' => $view->get_template_abspath('photocrati-widget#display_gallery'),
123
+ 'image_type' => $instance['show'] == 'original' ? 'full' : 'thumb',
124
  'show_all_in_lightbox' => FALSE,
125
  'show_slideshow_link' => FALSE,
126
  'disable_pagination' => TRUE,
136
  'widget_setting_height' => $instance['height'],
137
  'widget_setting_show_setting' => $instance['show'],
138
  'widget_setting_widget_id' => $widget_id
139
+ );
140
+
141
+ switch ($instance['exclude']) {
142
+ case 'all':
143
+ break;
144
+ case 'denied':
145
+ $mapper = C_Component_Registry::get_instance()->get_utility('I_Gallery_Mapper');
146
+ $gallery_ids = array();
147
+ $list = explode(',', $instance['list']);
148
+ foreach ($mapper->find_all() as $gallery) {
149
+ if (!in_array($gallery->{$gallery->id_field}, $list))
150
+ $gallery_ids[] = $gallery->{$gallery->id_field};
151
+ }
152
+ $params['container_ids'] = implode(',', $gallery_ids);
153
+ break;
154
+ case 'allow':
155
+ $params['container_ids'] = $instance['list'];
156
+ break;
157
+ }
158
+
159
+ echo $renderer->display_images($params);
160
  }
161
  }
products/photocrati_nextgen/modules/widget/class.widget_slideshow.php CHANGED
@@ -58,6 +58,10 @@ class C_Widget_Slideshow extends WP_Widget
58
 
59
  function widget($args, $instance)
60
  {
 
 
 
 
61
  // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
62
  $before_widget = NULL;
63
  $before_title = NULL;
@@ -71,7 +75,7 @@ class C_Widget_Slideshow extends WP_Widget
71
 
72
  $title = apply_filters('widget_title', empty($instance['title']) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base);
73
 
74
- $out = $this->render_slideshow($instance['galleryid'], $instance['width'], $instance['height']);
75
 
76
  $parent->render_partial(
77
  'photocrati-widget#display_slideshow',
@@ -89,7 +93,7 @@ class C_Widget_Slideshow extends WP_Widget
89
  );
90
  }
91
 
92
- function render_slideshow($galleryID, $irWidth = '', $irHeight = '')
93
  {
94
  $registry = C_Component_Registry::get_instance();
95
  $renderer = $registry->get_utility('I_Displayed_Gallery_Renderer');
@@ -100,6 +104,7 @@ class C_Widget_Slideshow extends WP_Widget
100
  'gallery_width' => $irWidth,
101
  'gallery_height' => $irHeight,
102
  'source' => 'galleries',
 
103
  'entity_types' => array('image'),
104
  'show_thumbnail_link' => FALSE,
105
  'ngg_triggers_display' => 'never'
58
 
59
  function widget($args, $instance)
60
  {
61
+ $router = C_Router::get_instance();
62
+ wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'));
63
+ wp_enqueue_style('nextgen_basic_slideshow_style', $router->get_static_url('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow.css'));
64
+
65
  // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
66
  $before_widget = NULL;
67
  $before_title = NULL;
75
 
76
  $title = apply_filters('widget_title', empty($instance['title']) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base);
77
 
78
+ $out = $this->render_slideshow($instance['galleryid'], $instance['width'], $instance['height'], $args);
79
 
80
  $parent->render_partial(
81
  'photocrati-widget#display_slideshow',
93
  );
94
  }
95
 
96
+ function render_slideshow($galleryID, $irWidth = '', $irHeight = '', $args)
97
  {
98
  $registry = C_Component_Registry::get_instance();
99
  $renderer = $registry->get_utility('I_Displayed_Gallery_Renderer');
104
  'gallery_width' => $irWidth,
105
  'gallery_height' => $irHeight,
106
  'source' => 'galleries',
107
+ 'slug' => 'widget-' . $args['widget_id'],
108
  'entity_types' => array('image'),
109
  'show_thumbnail_link' => FALSE,
110
  'ngg_triggers_display' => 'never'
products/photocrati_nextgen/modules/widget/module.widget.php CHANGED
@@ -15,7 +15,7 @@ class M_Widget extends C_Base_Module
15
  'photocrati-widget',
16
  'Widget',
17
  'Handles clearing of NextGen Widgets',
18
- '0.2',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
15
  'photocrati-widget',
16
  'Widget',
17
  'Handles clearing of NextGen Widgets',
18
+ '0.3',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/widget/templates/display_gallery.php CHANGED
@@ -13,13 +13,13 @@ echo $settings['widget_setting_before_widget']
13
  <?php // keep the following a/img on the same line ?>
14
  <div class="ngg-widget entry-content">
15
  <?php foreach ($images as $image) { ?>
16
- <a href="<?php echo esc_attr($storage->get_image_url($image))?>"
17
  title="<?php echo esc_attr($image->description)?>"
18
  data-image-id='<?php echo esc_attr($image->pid); ?>'
19
  <?php echo $effect_code ?>
20
  ><img title="<?php echo esc_attr($image->alttext)?>"
21
  alt="<?php echo esc_attr($image->alttext)?>"
22
- src="<?php echo esc_attr($storage->get_image_url($image, $settings['image_type'])); ?>"
23
  width="<?php echo esc_attr($settings['image_width']); ?>"
24
  height="<?php echo esc_attr($settings['image_height']); ?>"
25
  /></a>
13
  <?php // keep the following a/img on the same line ?>
14
  <div class="ngg-widget entry-content">
15
  <?php foreach ($images as $image) { ?>
16
+ <a href="<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE))?>"
17
  title="<?php echo esc_attr($image->description)?>"
18
  data-image-id='<?php echo esc_attr($image->pid); ?>'
19
  <?php echo $effect_code ?>
20
  ><img title="<?php echo esc_attr($image->alttext)?>"
21
  alt="<?php echo esc_attr($image->alttext)?>"
22
+ src="<?php echo esc_attr($storage->get_image_url($image, $settings['image_type'], TRUE)); ?>"
23
  width="<?php echo esc_attr($settings['image_width']); ?>"
24
  height="<?php echo esc_attr($settings['image_height']); ?>"
25
  /></a>
products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php CHANGED
@@ -56,6 +56,18 @@ class A_WordPress_Router extends Mixin
56
  return $retval;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  function get_base_url($site_url = FALSE)
61
  {
@@ -63,32 +75,20 @@ class A_WordPress_Router extends Mixin
63
  if ($site_url)
64
  {
65
  if (!$this->_site_url) {
66
- $this->_site_url = site_url();
67
- $pattern = get_option('permalink_structure');
68
- if (!$pattern OR strpos($pattern, '/index.php') !== FALSE) {
69
- $this->_site_url = $this->object->join_paths(
70
- $this->_site_url, '/index.php'
71
- );
72
- }
73
  }
74
  $retval = $this->_site_url;
75
  }
76
  else {
77
  if (!$this->_home_url) {
78
- $this->_home_url = home_url();
79
- $pattern = get_option('permalink_structure');
80
- if (!$pattern OR strpos($pattern, '/index.php') !== FALSE) {
81
- $this->_home_url = $this->object->join_paths(
82
- $this->_home_url, '/index.php'
83
- );
84
- }
85
  }
86
  $retval = $this->_home_url;
87
  }
88
 
89
- if ($this->object->is_https()) {
90
- $retval = preg_replace('/^http:\\/\\//i', 'https://', $retval, 1);
91
- }
92
 
93
  return $retval;
94
  }
56
  return $retval;
57
  }
58
 
59
+ function _add_index_dot_php_to_url($url)
60
+ {
61
+ if (strpos($url, '/index.php') === FALSE) {
62
+ $pattern = get_option('permalink_structure');
63
+ if (!$pattern OR strpos($pattern, '/index.php') !== FALSE) {
64
+ $url = $this->object->join_paths($url, '/index.php');
65
+ }
66
+ }
67
+
68
+ return $url;
69
+ }
70
+
71
 
72
  function get_base_url($site_url = FALSE)
73
  {
75
  if ($site_url)
76
  {
77
  if (!$this->_site_url) {
78
+ $this->_site_url = $this->_add_index_dot_php_to_url(site_url());
 
 
 
 
 
 
79
  }
80
  $retval = $this->_site_url;
81
  }
82
  else {
83
  if (!$this->_home_url) {
84
+ $this->_home_url = $this->_add_index_dot_php_to_url(home_url());
 
 
 
 
 
 
85
  }
86
  $retval = $this->_home_url;
87
  }
88
 
89
+ if ($this->object->is_https()) {
90
+ $retval = preg_replace('/^http:\\/\\//i', 'https://', $retval, 1);
91
+ }
92
 
93
  return $retval;
94
  }
products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_routing_app.php CHANGED
@@ -4,9 +4,18 @@ class A_WordPress_Routing_App extends Mixin
4
  {
5
  function remove_parameter($key, $id=NULL, $url=FALSE)
6
  {
7
- $generated_url = $this->call_parent('remove_parameter', $key, $id, $url);
8
 
9
- if ($this->is_postname_required_in_url()) {
 
 
 
 
 
 
 
 
 
10
  $generated_url = $this->object->add_post_permalink_to_url($generated_url);
11
  }
12
 
@@ -16,9 +25,14 @@ class A_WordPress_Routing_App extends Mixin
16
  function is_postname_required_in_url()
17
  {
18
  global $wp_query;
19
- return !$wp_query->is_single() && in_the_loop();
20
  }
21
 
 
 
 
 
 
22
  function parse_url($url)
23
  {
24
  $parts = parse_url($url);
4
  {
5
  function remove_parameter($key, $id=NULL, $url=FALSE)
6
  {
7
+ $generated_url = '';
8
 
9
+ if ($this->is_blog_page()) {
10
+ if (preg_match("#(/{$this->object->_settings->router_param_slug}/.*)#", $url, $match)) {
11
+ $generated_url = home_url($match[1]);
12
+ }
13
+ else $generated_url = home_url();
14
+ }
15
+ else
16
+ $generated_url = $this->call_parent('remove_parameter', $key, $id, $url);
17
+
18
+ if ($this->is_postname_required_in_url() && $generated_url) {
19
  $generated_url = $this->object->add_post_permalink_to_url($generated_url);
20
  }
21
 
25
  function is_postname_required_in_url()
26
  {
27
  global $wp_query;
28
+ return (!$wp_query->is_single() && in_the_loop()) OR $this->is_blog_page();
29
  }
30
 
31
+ function is_blog_page()
32
+ {
33
+ return is_home() OR is_archive();
34
+ }
35
+
36
  function parse_url($url)
37
  {
38
  $parts = parse_url($url);
products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php CHANGED
@@ -14,7 +14,7 @@ class M_WordPress_Routing extends C_Base_Module
14
  'photocrati-wordpress_routing',
15
  'WordPress Routing',
16
  "Integrates the MVC module's routing implementation with WordPress",
17
- '0.2',
18
  'http://www.nextgen-gallery.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
14
  'photocrati-wordpress_routing',
15
  'WordPress Routing',
16
  "Integrates the MVC module's routing implementation with WordPress",
17
+ '0.3',
18
  'http://www.nextgen-gallery.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
products/photocrati_nextgen/product.photocrati_nextgen.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
  /***
4
- {
5
- Product: photocrati-nextgen
6
- }
7
- ***/
8
 
9
  define('NEXTGEN_GALLERY_CHANGE_OPTIONS_CAP', 'NextGEN Manage gallery');
10
 
@@ -17,7 +17,7 @@ class P_Photocrati_NextGen extends C_Base_Product
17
  'photocrati-wordpress_routing',
18
  'photocrati-security',
19
  'photocrati-lzw',
20
- 'photocrati-nextgen_settings',
21
  'photocrati-mvc',
22
  'photocrati-ajax',
23
  'photocrati-dynamic_stylesheet',
@@ -44,7 +44,7 @@ class P_Photocrati_NextGen extends C_Base_Product
44
  'photocrati-nextgen_basic_tagcloud',
45
  'photocrati-nextgen_basic_album',
46
  'photocrati-widget',
47
- 'photocrati-third_party_compat',
48
  'photocrati-nextgen_xmlrpc'
49
  );
50
 
@@ -54,7 +54,7 @@ class P_Photocrati_NextGen extends C_Base_Product
54
  'photocrati-nextgen',
55
  'Photocrati NextGEN',
56
  'Photocrati NextGEN',
57
- '2.0.33',
58
  'http://www.nextgen-gallery.com',
59
  'Photocrati Media',
60
  'http://www.photocrati.com'
@@ -71,4 +71,4 @@ class P_Photocrati_NextGen extends C_Base_Product
71
  }
72
  }
73
 
74
- new P_Photocrati_NextGen();
1
  <?php
2
 
3
  /***
4
+ {
5
+ Product: photocrati-nextgen
6
+ }
7
+ ***/
8
 
9
  define('NEXTGEN_GALLERY_CHANGE_OPTIONS_CAP', 'NextGEN Manage gallery');
10
 
17
  'photocrati-wordpress_routing',
18
  'photocrati-security',
19
  'photocrati-lzw',
20
+ 'photocrati-nextgen_settings',
21
  'photocrati-mvc',
22
  'photocrati-ajax',
23
  'photocrati-dynamic_stylesheet',
44
  'photocrati-nextgen_basic_tagcloud',
45
  'photocrati-nextgen_basic_album',
46
  'photocrati-widget',
47
+ 'photocrati-third_party_compat',
48
  'photocrati-nextgen_xmlrpc'
49
  );
50
 
54
  'photocrati-nextgen',
55
  'Photocrati NextGEN',
56
  'Photocrati NextGEN',
57
+ '2.0.40',
58
  'http://www.nextgen-gallery.com',
59
  'Photocrati Media',
60
  'http://www.photocrati.com'
71
  }
72
  }
73
 
74
+ new P_Photocrati_NextGen();
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === NextGEN Gallery ===
2
  Contributors: photocrati
3
  Tags:gallery,image,images,photo,photos,picture,pictures,slideshow,flash,media,thumbnails,photo-albums,nextgen-gallery,nextgen
4
- Requires at least: 3.6
5
- Tested up to: 3.6
6
  Stable tag: trunk
7
  License: GPLv2
8
 
@@ -112,7 +112,7 @@ If you do want to work with shortcodes, we've also introduce a new, more powerfu
112
 
113
  **<a href="http://www.nextgen-gallery.com/nextgen-gallery-shortcodes">Learn About NextGEN Gallery 2.0 Shortcodes</a>**
114
 
115
- Legacy shortcodes? For reference, we're also maintaining documentation on NextGEN Legacy shortcakes used in NextGEN 1.9.x and earlier. <a href="http://www.nextgen-gallery.com/shortcodes">See more on Legacy shortcakes</a>.
116
 
117
  For more information, feel free to visit the official website for the NextGEN Gallery <a href="http://www.nextgen-gallery.com" target="_blank">WordPress Gallery Plugin</a>.
118
 
@@ -199,6 +199,39 @@ For more information, feel free to visit the official website for the NextGEN Ga
199
 
200
  == Changelog ==
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  = V2.0.33 - 10.21.2013 =
203
  * NEW: Requests /ngg_tag/[tagname] will create a displayed gallery
204
  * NEW: Option added to "Import Gallery" tab to use original images
1
  === NextGEN Gallery ===
2
  Contributors: photocrati
3
  Tags:gallery,image,images,photo,photos,picture,pictures,slideshow,flash,media,thumbnails,photo-albums,nextgen-gallery,nextgen
4
+ Requires at least: 3.6.1
5
+ Tested up to: 3.7.1
6
  Stable tag: trunk
7
  License: GPLv2
8
 
112
 
113
  **<a href="http://www.nextgen-gallery.com/nextgen-gallery-shortcodes">Learn About NextGEN Gallery 2.0 Shortcodes</a>**
114
 
115
+ Legacy shortcodes? For reference, we're also maintaining documentation on NextGEN Legacy shortcodes used in NextGEN 1.9.x and earlier. <a href="http://www.nextgen-gallery.com/shortcodes">See more on Legacy shortcodes</a>.
116
 
117
  For more information, feel free to visit the official website for the NextGEN Gallery <a href="http://www.nextgen-gallery.com" target="_blank">WordPress Gallery Plugin</a>.
118
 
199
 
200
  == Changelog ==
201
 
202
+ = V2.0.40 - 11.26.2013 =
203
+ * NEW: Added the ability to apply lightbox effects to non-NGG images
204
+ * NEW: Added NGG_HIDE_STRICT_ERRORS constant. Define and set to TRUE to hide strict errors
205
+ * NEW: Added NEXTGEN_GALLERY_IMPORT_ROOT constant. Define and set to TRUE to browse from a custom directory
206
+ * NEW: Added NGG_DEBUG constant. Define and set to TRUE to display helpful messages for debugging
207
+ * NEW: Each custom table record will have an associated custom post record for expansion
208
+ * NEW: Display helpful error messages when there's a problem uploading images
209
+ * NEW: Add data-(src|thumbnail|image-id|title|description) attribute to gallery image anchors
210
+ * NEW: Variant support for displayed gallery sources. Random images is limited to 5 variations
211
+ * Fixed: Excessive creation of transients for random galleries
212
+ * Fixed: Many issues prohibiting the ability to upload images
213
+ * Fixed: Compatibility with NextGEN Gallery Export Plugin for Adobe Lightroom (thanks Vladimir!)
214
+ * Fixed: Sorting in the Attach to Post interface
215
+ * Fixed: HTML allowed in gallery/album descriptions
216
+ * Fixed: Requests for galleries within albums that have numeric names are broken
217
+ * Fixed: Call to a non-member function get() on WP_Query
218
+ * Fixed: Ability to sort by Image ID in the Attach to Post interface
219
+ * Fixed: Isolate the Attach to Post from implicit third-party script inclusion
220
+ * Fixed: Check for the existance of thumbnails when generating urls, and if missing, generate new ones
221
+ * Fixed: Compatibility with NextGEN Facebook OpenGraph+ plugin
222
+ * Fixed: Various XML-RPC issues
223
+ * Fixed: Widgets stylesheet not included
224
+ * Fixed: Issue with color not being pre-selected when previewing Watermark
225
+ * Fixed: E_NOTICE emitted when cleaning up cached image files
226
+ * Fixed: E_NOTICE emitted when viewing display type settings
227
+ * Fixed: Typo adjusting pcre.backtrack_limit for shortcodes
228
+ * Fixed: Content within the tabs of the Attach to Post interface cut-off
229
+ * Fixed: Routing problem which would cause conflicts with different display types on the same page
230
+ * Fixed: Broken Dynamic CSS links on GoDaddy
231
+ * Fixed: Ability to use HTML in gallery/album descriptions
232
+ * Fixed: Sub-album requests conflicting with paginated galleries on the same page
233
+ * Merged: Pull request from andreasE (https://bitbucket.org/photocrati/nextgen-gallery/pull-request/6/)
234
+
235
  = V2.0.33 - 10.21.2013 =
236
  * NEW: Requests /ngg_tag/[tagname] will create a displayed gallery
237
  * NEW: Option added to "Import Gallery" tab to use original images