NextGEN Gallery – WordPress Gallery Plugin - Version 2.0.11

Version Description

  • 08.19.2013 =
  • NEW: Added "run_ngg_resource_manager" hook to by-pass our resource manager
  • Changed: Removed "Reset & Uninstall" tab, for now
  • Fixed: Compatibility with W3 Total Cache. Please flush cache after updating.
  • Fixed: Conflicts with Photocrati Theme Galleries
  • Fixed: Blank Attach to Post interface window
  • Fixed: Fixed ability to change Lightbox Effect settings
  • Fixed: Implemented techniques to ensure WP_Query variables aren't overwritten
  • Fixed: Enqueuing AJAX JS libraries twice in wp-admin
  • Fixed: Encoding issues
  • Fixed: PHP warnings caused by accessing unserialized data as array
  • Fixed: Fixed installer issues
Download this release

Release Info

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

Code changes from version 2.0.40 to 2.0.11

Files changed (226) hide show
  1. changelog.txt +0 -144
  2. nggallery.php +12 -133
  3. non_pope/class.nextgen_settings.php +7 -5
  4. non_pope/class.nextgen_shortcode_manager.php +0 -125
  5. non_pope/class.nextgen_style_manager.php +4 -15
  6. non_pope/class.photocrati_cache.php +12 -53
  7. non_pope/class.photocrati_installer.php +9 -91
  8. non_pope/class.photocrati_resource_manager.php +29 -55
  9. non_pope/class.photocrati_settings_manager.php +1 -1
  10. pope/lib/autoload.php +1 -1
  11. pope/lib/class.base_module.php +1 -1
  12. pope/lib/class.base_product.php +2 -2
  13. pope/lib/class.component_factory.php +2 -2
  14. pope/lib/class.extensibleobject.php +4 -42
  15. products/photocrati_nextgen/modules/ajax/class.ajax_controller.php +7 -7
  16. products/photocrati_nextgen/modules/ajax/class.ajax_installer.php +1 -1
  17. products/photocrati_nextgen/modules/ajax/module.ajax.php +5 -5
  18. products/photocrati_nextgen/modules/attach_to_post/adapter.attach_to_post_ajax.php +3 -3
  19. products/photocrati_nextgen/modules/attach_to_post/adapter.gallery_storage_frame_event.php +6 -14
  20. products/photocrati_nextgen/modules/attach_to_post/class.attach_controller.php +5 -82
  21. products/photocrati_nextgen/modules/attach_to_post/class.attach_to_post_installer.php +1 -1
  22. products/photocrati_nextgen/modules/attach_to_post/mixin.attach_to_post_display_tab.php +2 -10
  23. products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php +68 -52
  24. products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.js +21 -19
  25. products/photocrati_nextgen/modules/attach_to_post/static/iframely.js +10 -50
  26. products/photocrati_nextgen/modules/attach_to_post/templates/display_tab_js.php +3 -38
  27. products/photocrati_nextgen/modules/cache/class.cache.php +2 -2
  28. products/photocrati_nextgen/modules/cache/module.cache.php +1 -1
  29. products/photocrati_nextgen/modules/datamapper/class.custompost_datamapper_driver.php +11 -11
  30. products/photocrati_nextgen/modules/datamapper/class.customtable_datamapper_driver.php +56 -45
  31. products/photocrati_nextgen/modules/datamapper/class.datamapper_driver_base.php +12 -127
  32. products/photocrati_nextgen/modules/datamapper/class.datamapper_installer.php +1 -1
  33. products/photocrati_nextgen/modules/datamapper/class.datamapper_model.php +10 -8
  34. products/photocrati_nextgen/modules/datamapper/module.datamapper.php +13 -30
  35. products/photocrati_nextgen/modules/dynamic_stylesheet/class.dynamic_stylesheet_controller.php +2 -2
  36. products/photocrati_nextgen/modules/dynamic_stylesheet/class.dynamic_stylesheet_installer.php +1 -1
  37. products/photocrati_nextgen/modules/dynamic_thumbnails/adapter.dynamic_thumbnails_storage_driver.php +2 -9
  38. products/photocrati_nextgen/modules/dynamic_thumbnails/class.dynamic_thumbnails_installer.php +1 -1
  39. products/photocrati_nextgen/modules/dynamic_thumbnails/class.dynamic_thumbnails_manager.php +1 -1
  40. products/photocrati_nextgen/modules/dynamic_thumbnails/module.dynamic_thumbnails.php +1 -1
  41. products/photocrati_nextgen/modules/frame_communication/class.frame_communication_installer.php +1 -1
  42. products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php +2 -10
  43. products/photocrati_nextgen/modules/frame_communication/module.frame_communication.php +3 -5
  44. products/photocrati_nextgen/modules/fs/class.fs.php +4 -7
  45. products/photocrati_nextgen/modules/fs/module.fs.php +1 -1
  46. products/photocrati_nextgen/modules/lightbox/adapter.lightbox_factory.php +4 -4
  47. products/photocrati_nextgen/modules/lightbox/class.lightbox_installer.php +2 -2
  48. products/photocrati_nextgen/modules/lightbox/class.lightbox_library.php +1 -12
  49. products/photocrati_nextgen/modules/lightbox/module.lightbox.php +1 -149
  50. products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js +7 -13
  51. products/photocrati_nextgen/modules/lightbox/static/highslide/nextgen_highslide_init.js +20 -41
  52. products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/nextgen_lightbox_init.js +10 -20
  53. products/photocrati_nextgen/modules/lightbox/static/lightbox_context.js +0 -27
  54. products/photocrati_nextgen/modules/lightbox/static/shutter/nextgen_shutter.js +0 -3
  55. products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.js +1 -4
  56. products/photocrati_nextgen/modules/lightbox/static/thickbox/nextgen_thickbox_init.js +2 -7
  57. products/photocrati_nextgen/modules/mediarss/class.mediarss_controller.php +2 -2
  58. products/photocrati_nextgen/modules/mediarss/module.mediarss.php +1 -1
  59. products/photocrati_nextgen/modules/mediarss/templates/mediarss_feed.php +6 -6
  60. products/photocrati_nextgen/modules/mediarss/templates/playlist_feed.php +3 -3
  61. products/photocrati_nextgen/modules/mvc/adapter.mvc_fs.php +1 -1
  62. products/photocrati_nextgen/modules/mvc/class.mvc_installer.php +1 -1
  63. products/photocrati_nextgen/modules/mvc/class.mvc_view.php +1 -1
  64. products/photocrati_nextgen/modules/mvc/module.mvc.php +2 -2
  65. products/photocrati_nextgen/modules/mvc/template_helper.php +1 -14
  66. products/photocrati_nextgen/modules/mvc/templates/index.php +1 -1
  67. products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_ajax.php +17 -22
  68. products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_forms.php +9 -7
  69. products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php +4 -8
  70. products/photocrati_nextgen/modules/nextgen_addgallery_page/module.nextgen_addgallery_page.php +1 -1
  71. products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/import_folder.php +5 -6
  72. products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php +23 -45
  73. products/photocrati_nextgen/modules/nextgen_admin/class.form.php +14 -28
  74. products/photocrati_nextgen/modules/nextgen_admin/class.nextgen_admin_installer.php +1 -1
  75. products/photocrati_nextgen/modules/nextgen_admin/class.nextgen_admin_page_controller.php +1 -12
  76. products/photocrati_nextgen/modules/nextgen_admin/module.nextgen_admin.php +3 -3
  77. products/photocrati_nextgen/modules/nextgen_admin/templates/field_generator/nextgen_settings_field_color.php +2 -1
  78. products/photocrati_nextgen/modules/nextgen_admin/templates/nextgen_admin_page.php +1 -1
  79. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_controller.php +31 -67
  80. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_mapper.php +1 -13
  81. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_routes.php +9 -10
  82. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_compact_album_form.php +1 -27
  83. products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_extended_album_form.php +0 -26
  84. products/photocrati_nextgen/modules/nextgen_basic_album/mixin.nextgen_basic_album_form.php +1 -0
  85. products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php +18 -22
  86. products/photocrati_nextgen/modules/nextgen_basic_album/static/compact_settings.js +0 -7
  87. products/photocrati_nextgen/modules/nextgen_basic_album/static/extended_settings.js +0 -7
  88. products/photocrati_nextgen/modules/nextgen_basic_album/static/nextgen_basic_album.css +12 -37
  89. products/photocrati_nextgen/modules/nextgen_basic_album/templates/compact.php +6 -13
  90. products/photocrati_nextgen/modules/nextgen_basic_album/templates/extended.php +3 -3
  91. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.ajax_pagination_actions.php +1 -2
  92. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_mapper.php +6 -10
  93. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_routes.php +7 -7
  94. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_urls.php +1 -2
  95. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_controller.php +2 -3
  96. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_form.php +1 -5
  97. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnail_form.php +1 -17
  98. products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnails_controller.php +17 -42
  99. products/photocrati_nextgen/modules/nextgen_basic_gallery/hook.nextgen_basic_gallery_integration.php +3 -9
  100. products/photocrati_nextgen/modules/nextgen_basic_gallery/mixin.nextgen_basic_gallery_controller.php +2 -2
  101. products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php +24 -28
  102. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/slideshow/nextgen_basic_slideshow.css +1 -1
  103. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/slideshow/nextgen_basic_slideshow.js +0 -1
  104. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/ajax_pagination.js +2 -6
  105. products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.css +0 -2
  106. products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/slideshow/index.php +2 -2
  107. products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php +4 -8
  108. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_controller.php +3 -8
  109. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_form.php +1 -4
  110. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_mapper.php +1 -1
  111. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_routes.php +2 -2
  112. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/hook.nextgen_basic_imagebrowser_alt_urls.php +0 -45
  113. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php +15 -17
  114. products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/templates/nextgen_basic_imagebrowser.php +4 -17
  115. products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php +4 -34
  116. products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_mapper.php +1 -1
  117. products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php +14 -15
  118. products/photocrati_nextgen/modules/nextgen_basic_singlepic/templates/nextgen_basic_singlepic.php +3 -8
  119. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_form.php +0 -1
  120. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_mapper.php +1 -1
  121. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_routes.php +2 -2
  122. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_urls.php +1 -1
  123. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/class.taxonomy_controller.php +0 -127
  124. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/interface.taxonomy_controller.php +0 -8
  125. products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php +15 -31
  126. products/photocrati_nextgen/modules/nextgen_basic_templates/adapter.nextgen_basic_template_form.php +16 -23
  127. products/photocrati_nextgen/modules/nextgen_basic_templates/class.legacy_template_locator.php +2 -3
  128. products/photocrati_nextgen/modules/nextgen_basic_templates/module.nextgen_basic_templates.php +1 -1
  129. products/photocrati_nextgen/modules/nextgen_data/adapter.nextgen_data_factory.php +5 -10
  130. products/photocrati_nextgen/modules/nextgen_data/class.album.php +9 -10
  131. products/photocrati_nextgen/modules/nextgen_data/class.album_mapper.php +45 -21
  132. products/photocrati_nextgen/modules/nextgen_data/class.gallery.php +6 -15
  133. products/photocrati_nextgen/modules/nextgen_data/class.gallery_mapper.php +4 -15
  134. products/photocrati_nextgen/modules/nextgen_data/class.gallery_storage.php +1 -1
  135. products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php +32 -154
  136. products/photocrati_nextgen/modules/nextgen_data/class.image.php +2 -3
  137. products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.php +26 -30
  138. products/photocrati_nextgen/modules/nextgen_data/class.image_wrapper.php +23 -37
  139. products/photocrati_nextgen/modules/nextgen_data/class.nextgen_data_installer.php +1 -7
  140. products/photocrati_nextgen/modules/nextgen_data/class.nextgen_metadata.php +1 -1
  141. products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php +18 -30
  142. products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_thumbnail.php +2 -2
  143. products/photocrati_nextgen/modules/nextgen_data/mixin.nextgen_table_extras.php +0 -195
  144. products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php +1 -20
  145. products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.displayed_gallery_related_element.php +114 -0
  146. products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.gallery_display_ajax.php +0 -24
  147. products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.gallery_display_factory.php +6 -6
  148. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type.php +2 -2
  149. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_controller.php +3 -7
  150. products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_mapper.php +3 -3
  151. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery.php +54 -99
  152. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_mapper.php +2 -3
  153. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_renderer.php +41 -86
  154. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_source.php +2 -2
  155. products/photocrati_nextgen/modules/nextgen_gallery_display/class.displayed_gallery_source_mapper.php +2 -4
  156. products/photocrati_nextgen/modules/nextgen_gallery_display/class.gallery_display_installer.php +1 -3
  157. products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php +36 -150
  158. products/photocrati_nextgen/modules/nextgen_gallery_display/static/common.js +1 -85
  159. products/photocrati_nextgen/modules/nextgen_gallery_display/static/nextgen_gallery_related_images.css +0 -22
  160. products/photocrati_nextgen/modules/nextgen_other_options/adapter.image_options_form.php +25 -29
  161. products/photocrati_nextgen/modules/nextgen_other_options/adapter.lightbox_manager_form.php +1 -7
  162. products/photocrati_nextgen/modules/nextgen_other_options/adapter.miscellaneous_form.php +0 -1
  163. products/photocrati_nextgen/modules/nextgen_other_options/adapter.other_options_forms.php +2 -14
  164. products/photocrati_nextgen/modules/nextgen_other_options/adapter.reset_form.php +6 -24
  165. products/photocrati_nextgen/modules/nextgen_other_options/class.settings_model.php +1 -1
  166. products/photocrati_nextgen/modules/nextgen_other_options/module.nextgen_other_options.php +1 -1
  167. products/photocrati_nextgen/modules/nextgen_other_options/templates/image_options_tab.php +34 -47
  168. products/photocrati_nextgen/modules/nextgen_other_options/templates/lightbox_library_tab.php +2 -20
  169. products/photocrati_nextgen/modules/nextgen_other_options/templates/reset_tab.php +0 -2
  170. products/photocrati_nextgen/modules/nextgen_pagination/mixin.nextgen_basic_pagination.php +1 -19
  171. products/photocrati_nextgen/modules/nextgen_settings/class.nextgen_settings_installer.php +17 -47
  172. products/photocrati_nextgen/modules/nextgen_settings/module.nextgen_settings.php +1 -1
  173. products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php +0 -632
  174. products/photocrati_nextgen/modules/ngglegacy/admin/admin.php +2 -2
  175. products/photocrati_nextgen/modules/ngglegacy/admin/album.php +69 -78
  176. products/photocrati_nextgen/modules/ngglegacy/admin/edit-thumbnail.php +3 -3
  177. products/photocrati_nextgen/modules/ngglegacy/admin/functions.php +1 -1
  178. products/photocrati_nextgen/modules/ngglegacy/admin/install.php +53 -8
  179. products/photocrati_nextgen/modules/ngglegacy/admin/js/ngg.ajax.js +2 -2
  180. products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php +4 -4
  181. products/photocrati_nextgen/modules/ngglegacy/admin/manage-sort.php +3 -3
  182. products/photocrati_nextgen/modules/ngglegacy/admin/manage.php +5 -15
  183. products/photocrati_nextgen/modules/ngglegacy/admin/media-upload.php +6 -20
  184. products/photocrati_nextgen/modules/ngglegacy/admin/overview.php +292 -16
  185. products/photocrati_nextgen/modules/ngglegacy/admin/rotate.php +1 -1
  186. products/photocrati_nextgen/modules/ngglegacy/admin/wpmu.php +5 -5
  187. products/photocrati_nextgen/modules/ngglegacy/changelog.txt +718 -0
  188. products/photocrati_nextgen/modules/ngglegacy/class.ngglegacy_installer.php +1 -91
  189. products/photocrati_nextgen/modules/ngglegacy/lang/nggallery.pot +2 -2
  190. products/photocrati_nextgen/modules/ngglegacy/lib/media-rss.php +2 -2
  191. products/photocrati_nextgen/modules/ngglegacy/lib/meta.php +15 -29
  192. products/photocrati_nextgen/modules/ngglegacy/lib/ngg-db.php +3 -3
  193. products/photocrati_nextgen/modules/ngglegacy/lib/post-thumbnail.php +2 -2
  194. products/photocrati_nextgen/modules/ngglegacy/lib/shortcodes.php +2 -6
  195. products/photocrati_nextgen/modules/ngglegacy/lib/sitemap.php +5 -5
  196. products/photocrati_nextgen/modules/ngglegacy/lib/xmlrpc.php +882 -0
  197. products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php +1 -1
  198. products/photocrati_nextgen/modules/ngglegacy/nggallery.php +101 -5
  199. products/photocrati_nextgen/modules/ngglegacy/view/album-compact.php +3 -15
  200. products/photocrati_nextgen/modules/ngglegacy/view/album-extend.php +3 -3
  201. products/photocrati_nextgen/modules/ngglegacy/view/gallery-caption.php +4 -11
  202. products/photocrati_nextgen/modules/ngglegacy/view/gallery-carousel.php +7 -7
  203. products/photocrati_nextgen/modules/ngglegacy/view/gallery.php +4 -11
  204. products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser-caption.php +3 -3
  205. products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser-exif.php +2 -2
  206. products/photocrati_nextgen/modules/ngglegacy/view/imagebrowser.php +4 -4
  207. products/photocrati_nextgen/modules/ngglegacy/view/singlepic.php +4 -14
  208. products/photocrati_nextgen/modules/router/class.router.php +1 -5
  209. products/photocrati_nextgen/modules/router/class.router_installer.php +2 -2
  210. products/photocrati_nextgen/modules/router/class.routing_app.php +16 -20
  211. products/photocrati_nextgen/modules/router/mixin.url_manipulation.php +3 -10
  212. products/photocrati_nextgen/modules/router/module.router.php +1 -1
  213. products/photocrati_nextgen/modules/security/class.wordpress_security_actor.php +0 -13
  214. products/photocrati_nextgen/modules/security/class.wordpress_security_manager.php +0 -13
  215. products/photocrati_nextgen/modules/security/module.security.php +1 -5
  216. products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php +0 -117
  217. products/photocrati_nextgen/modules/widget/class.widget.php +6 -0
  218. products/photocrati_nextgen/modules/widget/class.widget_gallery.php +48 -64
  219. products/photocrati_nextgen/modules/widget/class.widget_slideshow.php +2 -7
  220. products/photocrati_nextgen/modules/widget/module.widget.php +1 -1
  221. products/photocrati_nextgen/modules/widget/templates/display_gallery.php +2 -2
  222. products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_router.php +15 -19
  223. products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_routing_app.php +3 -17
  224. products/photocrati_nextgen/modules/wordpress_routing/module.wordpress_routing.php +1 -1
  225. products/photocrati_nextgen/product.photocrati_nextgen.php +9 -11
  226. readme.txt +4 -147
changelog.txt CHANGED
@@ -1,150 +1,6 @@
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
40
- * Fixed: Links are broken on the ngg_tags-sitemap.xml file by WordPress SEO
41
- * Fixed: PHP notice: Attempt to assign property of non-object
42
- * Fixed: Undefined property warnings when using NextGEN Basic Thumbnails
43
- * Fixed: Detect if an applying a transient to a displayed gallery was successful
44
- * Fixed: Compatibility issues with BJ-Lazy-Load and Colorbox
45
- * Fixed: Pagination conflicts for multiple Imagebrowsers on the same page
46
- * Fixed: Ability to display previous exception with debug mode
47
- * Fixed: Tagclouds not working in multisite instances
48
- * Fixed: Load widgets.css when a widget is being used
49
- * Fixed: Installer should remove all instances of the component factory
50
- * Fixed: Widget settings interface not intuitive
51
- * Fixed: Inability to upload images in some Windows host environments
52
- * Fixed: Sorting images/galleries using the Attach To Post interface
53
- * Fixed: Fix detection of HTTPS (pull request by Leonhardt Wille)
54
- * Fixed: Compilation errors of regular expressions
55
- * Fixed: Pro galleries wouldn't display in environments using PHP 5.3.3 or less
56
- * Fixed: Scanning of router slug is now limited to the uri, not the url
57
- * Fixed: Show slideshow link isn't required for thumbnail/imagebrowser integration
58
- * Fixed: WordPress media-upload with 'singlepic' image size
59
- * Fixed: Use target=_blank when the link setting is provided for NextGEN Basic Singlepic
60
- * Fixed: Only display rendering errors if WP_DEBUG is enabled
61
-
62
-
63
- = V2.0.31 - 10.03.2013 =
64
- * NEW: Restored AJAX pagination for NextGEN Basic ImageBrowser display type
65
- * Fixed: Compatibility with WordPress Local SEO by Yoast
66
- * Fixed: Inability to upload images if image_slug field was missing in database
67
- * Fixed: Integration of NextGEN Basic Thumbnail and NextGEN Basic Slideshow display types
68
- * Fixed: Photocrati Resource Manager further adjusted to be third-party friendly
69
- * Fixed: Added the ability to find legacy templates in both the child/parent theme directories
70
- * Fixed: JavaScript errors in Attach to Post interface
71
- * Fixed: Router can handle port numbers in urls
72
- * Fixed: Carousel template was linking to NextGEN Basic ImageBrowser view
73
- * Fixed: SQL query generated for displayed galleries using tags as source
74
- * Fixed: 3rd party compat: raise & never lower pcre.backtrack_limit
75
-
76
- = V2.0.30 - 09.25.2013 =
77
- * NEW: Restored the ability to use imagebrowser display type instead of a lightbox effect
78
- * Changed: Displayed galleries are no longer rendered in RSS feeds
79
- * Changed: Removed "Plugin Check" widget from overview page
80
- * Fixed: Silence PHP warnings/errors in an output buffer for AJAX actions
81
- * Fixed: Compatibility issue with WordPress SEO and broken site maps (and large error_logs)
82
- * Fixed: Compatibility issue with AJAX Event Calendar (and possibly others)
83
- * Fixed: Adjusted Photocrati Resource Manager to be third-party friendly
84
- * Fixed: Fixed empty result set for displayed galleries selecting 'All' tags
85
- * Fixed: URL generation for imagebrowser pagination links
86
- * Fixed: Ensure that image meta is imported on creation
87
- * Fixed: Ensure that transients are removed when an external object cache is used
88
- * Fixed: Don't load pluggable.php. This will fix plugin conflicts
89
- * Fixed: In Attach to Post interface, galleries created in one tab weren't showing in another
90
- * Fixed: Don't output frame events cookie for XML-RPC requests
91
-
92
- = V2.0.27 - 09.18.2013 =
93
- * Fixed: Reduce performance impact of purging displayed gallery transients
94
-
95
- = V2.0.25 - 09.18.2013 =
96
- * Changed: Reverting to the 2.0.21 codebase, due to major performance issues in 2.0.23 and 2.0.24
97
-
98
- = V2.0.24 - 09.18.2013 =
99
- * WARNING: Broken release. Uses wp_clear_scheduled_hooks() to purge cron records
100
-
101
- = V2.0.23 - 09.12.2013 =
102
- * WARNING: Broken release. Major bug creates redundant cron jobs
103
- * NEW: WP-Cron job to periodically clean-up displayed gallery transients
104
- * NEW: Added "excluded_container_ids" as parameter for ngg_images shortcode
105
- * Fixed: Lightbox effect is honoured by all display types
106
- * Fixed: Highslide displays images from the correct displayed galleries
107
- * Fixed: Ensure that sub-albums display correctly when the word "album" is part of a slug
108
- * Fixed: Ensure that sub-albums display correctly when numerical slugs are used
109
- * Fixed: Related images heading only added when Related Images functionality is enabled
110
- * Fixed: PHP Warning about undefined index when viewing basic albums
111
- * Fixed: AJAX handling is third-party compatible
112
- * Fixed: Image date is no longer overwritten when an image is modified
113
- * Fixed: Fixed issue with displayed galleries using source='tags'
114
- * Fixed: Problem with transient cache not getting flushed properly from Other Options page
115
- * Fixed: Use correct gallery/transient ID when ajax pagination is used
116
-
117
- = V2.0.21 - 09.09.2013 =
118
- * NEW: Multisite support
119
- * Changed: Default image quality set to 100 for generated images
120
- * Changed: Removed dependence on simplehtmldom library
121
- * Fixed: Related images functionality works as it did in 1.9.x
122
- * Fixed: Don't compress inline JavaScript in post/page content
123
- * Fixed: Click-to-advance slideshow behavior for slideshows
124
- * Fixed: Security warnings from VaultPress
125
- * Fixed: View as Slideshow link works with AJAX pagination
126
- * Fixed: Broken links on Overview page
127
- * Fixed: Backup images option
128
- * Fixed: Stylesheet url generated correctly for Windows hosts
129
- * Fixed: Compatibility with NextGen Custom Fields plugin
130
- * Fixed: Compatibility with Adsense Explosion plugin
131
- * Fixed: Suppress wp_footer notices unless WP_DEBUG is set to TRUE
132
-
133
- = V2.0.17 - 08.30.2013 =
134
- Fixed: Match legacy behaviour when changing gallery path, i.e. don't move files
135
-
136
- = V2.0.14 - 08.27.2013 =
137
- * NEW: Added the ability to override thumbnail settings for NextGEN Basic Albums
138
- * NEW: Shortcode Manager API, which ensures that shortcodes are outputted as intended
139
- * Changed: Re-added the ability to select the original image size for widgets
140
- * Fixed: Ensure that stylesheet url returned is correct for Windows hosts
141
- * Fixed: Broken links and lightbox effects with AJAX pagination
142
- * Fixed: Try to ensure that third party plugins don't add content to our dynamic JS
143
- * Fixed: Improved reliability of iframely.js
144
- * Fixed: Ensure that urls are generated correctly in HTTPs environments
145
- * Fixed: Datamapper works correctly in environments where temporary tables aren't supported
146
- * Fixed: Fixed an issue with thickbox loading animation when home url differs from site url
147
-
148
  = V2.0.11 - 08.19.2013 =
149
  * NEW: Added "run_ngg_resource_manager" hook to by-pass our resource manager
150
  * Changed: Removed "Reset & Uninstall" tab, for now
1
  NextGEN Gallery
2
  by Photocrati Media
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  = V2.0.11 - 08.19.2013 =
5
  * NEW: Added "run_ngg_resource_manager" hook to by-pass our resource manager
6
  * Changed: Removed "Reset & Uninstall" tab, for now
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.40
8
  * Author: Photocrati Media
9
  * Plugin URI: http://www.nextgen-gallery.com
10
  * Author URI: http://www.photocrati.com
@@ -12,49 +12,6 @@ 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
- 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( '&', '&', $url );
42
- $url = str_replace( "'", ''', $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:
@@ -95,42 +52,15 @@ class C_NextGEN_Bootstrap
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>";
102
  echo "<pre>{$exception->getTraceAsString()}</pre>";
103
- if (method_exists($exception, 'getPrevious')) {
104
- if (($previous = $exception->getPrevious())) {
105
- self::print_exception($previous);
106
- }
107
- }
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()
@@ -147,26 +77,22 @@ class C_NextGEN_Bootstrap
147
 
148
  function _load_non_pope()
149
  {
 
 
 
150
  // Load caching component
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;
163
  C_Photocrati_Cache::$force_update = TRUE;
164
  $_SERVER['QUERY_STRING'] = str_replace('ngg_force_update=1', '', $_SERVER['QUERY_STRING']);
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
172
  include_once('non_pope/class.photocrati_settings_manager.php');
@@ -183,9 +109,6 @@ class C_NextGEN_Bootstrap
183
 
184
  // Load the style manager
185
  include_once('non_pope/class.nextgen_style_manager.php');
186
-
187
- // Load the shortcode manager
188
- include_once('non_pope/class.nextgen_shortcode_manager.php');
189
  }
190
 
191
  /**
@@ -266,22 +189,11 @@ class C_NextGEN_Bootstrap
266
  add_action('all_admin_notices', array(&$this, 'display_stylesheet_notice'));
267
  }
268
 
269
- // Delete displayed gallery transients periodically
270
- add_action('ngg_delete_expired_transients', array(&$this, 'delete_expired_transients'));
271
- if (!wp_next_scheduled('ngg_delete_expired_transients')) {
272
- wp_schedule_event(time(), 'hourly', 'ngg_delete_expired_transients');
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()
283
- {
284
- C_Photocrati_Cache::flush('displayed_galleries', TRUE);
285
  }
286
 
287
  /**
@@ -350,8 +262,6 @@ class C_NextGEN_Bootstrap
350
  function update()
351
  {
352
  $this->_load_pope();
353
-
354
- // Try updating all modules
355
  C_Photocrati_Installer::update();
356
  }
357
 
@@ -402,38 +312,7 @@ class C_NextGEN_Bootstrap
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
 
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.11
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
 
16
  /**
17
  * NextGEN Gallery is built on top of the Photocrati Pope Framework:
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>";
59
  echo "<pre>{$exception->getTraceAsString()}</pre>";
60
+ while (($previous = $exception->getPrevious())) {
61
+ self::print_exception($previous);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
  }
 
 
64
  }
65
 
66
  function __construct()
77
 
78
  function _load_non_pope()
79
  {
80
+ // Load WordPress pluggables for plugin compatibility
81
+ include_once(path_join(ABSPATH, 'wp-includes/pluggable.php'));
82
+
83
  // Load caching component
84
  include_once('non_pope/class.photocrati_cache.php');
85
+ C_Photocrati_Cache::$enabled = TRUE;
 
 
 
86
 
87
  if (isset($_REQUEST['ngg_flush'])) {
88
  C_Photocrati_Cache::flush('all');
89
+ $_SERVER['QUERY_STRING'] = str_replace('ngg_flush=1', '', $_SERVER['QUERY_STRING']);
90
  }
91
  elseif (isset($_REQUEST['ngg_force_update'])) {
92
  C_Photocrati_Cache::$do_not_lookup = TRUE;
93
  C_Photocrati_Cache::$force_update = TRUE;
94
  $_SERVER['QUERY_STRING'] = str_replace('ngg_force_update=1', '', $_SERVER['QUERY_STRING']);
95
  }
 
 
 
 
96
 
97
  // Load Settings Manager
98
  include_once('non_pope/class.photocrati_settings_manager.php');
109
 
110
  // Load the style manager
111
  include_once('non_pope/class.nextgen_style_manager.php');
 
 
 
112
  }
113
 
114
  /**
189
  add_action('all_admin_notices', array(&$this, 'display_stylesheet_notice'));
190
  }
191
 
 
 
 
 
 
 
192
  // Update modules
193
+ add_action('init', array(&$this, 'update'), PHP_INT_MAX);
194
 
195
  // Start the plugin!
196
+ add_action('init', array(&$this, 'route'), PHP_INT_MAX);
 
 
 
 
 
197
  }
198
 
199
  /**
262
  function update()
263
  {
264
  $this->_load_pope();
 
 
265
  C_Photocrati_Installer::update();
266
  }
267
 
312
  define('NEXTGEN_GALLERY_MODULE_URL', path_join(NEXTGEN_GALLERY_PRODUCT_URL, 'photocrati_nextgen/modules'));
313
  define('NEXTGEN_GALLERY_PLUGIN_CLASS', path_join(NEXTGEN_GALLERY_PLUGIN_DIR, 'module.NEXTGEN_GALLERY_PLUGIN.php'));
314
  define('NEXTGEN_GALLERY_PLUGIN_STARTED_AT', microtime());
315
+ define('NEXTGEN_GALLERY_PLUGIN_VERSION', '2.0.11');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  }
317
 
318
 
non_pope/class.nextgen_settings.php CHANGED
@@ -5,7 +5,7 @@ if (!class_exists('C_NextGen_Settings')) {
5
  class C_NextGen_Settings {
6
  static function get_instance()
7
  {
8
- return C_Photocrati_Settings_Manager::get_instance();
9
  }
10
 
11
  static function add_option_handler($klass, $options=array())
@@ -20,10 +20,12 @@ if (!class_exists('C_NextGen_Global_Settings')) {
20
  class C_NextGen_Global_Settings extends C_NextGen_Settings {
21
  static function get_instance()
22
  {
23
- if (is_multisite())
24
- return C_Photocrati_Global_Settings_Manager::get_instance();
25
- else
26
- return C_Photocrati_Settings_Manager::get_instance();
 
 
27
  }
28
  }
29
  }
5
  class C_NextGen_Settings {
6
  static function get_instance()
7
  {
8
+ return C_Photocrati_Settings_Manager::get_instance();
9
  }
10
 
11
  static function add_option_handler($klass, $options=array())
20
  class C_NextGen_Global_Settings extends C_NextGen_Settings {
21
  static function get_instance()
22
  {
23
+ if (is_multisite()) {
24
+ return C_Photocrati_Global_Settings_Manager::get_instance();
25
+ }
26
+ else {
27
+ return C_Photocrati_Settings_Manager::get_instance();
28
+ }
29
  }
30
  }
31
  }
non_pope/class.nextgen_shortcode_manager.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
-
3
- class C_NextGen_Shortcode_Manager
4
- {
5
- private static $_instance = NULL;
6
- private $_shortcodes = array();
7
-
8
- /**
9
- * Gets an instance of the class
10
- * @return C_NextGen_Shortcode_Manager
11
- */
12
- static function get_instance()
13
- {
14
- if (is_null(self::$_instance)) {
15
- $klass = get_class();
16
- self::$_instance = new $klass;
17
- }
18
- return self::$_instance;
19
- }
20
-
21
- /**
22
- * Adds a shortcode
23
- * @param $name
24
- * @param $callback
25
- */
26
- static function add($name, $callback)
27
- {
28
- $manager = self::get_instance();
29
- $manager->add_shortcode($name, $callback);
30
- }
31
-
32
- /**
33
- * Removes a previously added shortcode
34
- * @param $name
35
- */
36
- static function remove($name)
37
- {
38
- $manager = self::get_instance();
39
- $manager->remove_shortcode($name);
40
- }
41
-
42
- /**
43
- * Constructor
44
- */
45
- private function __construct()
46
- {
47
- add_filter('the_content', array(&$this, 'deactivate_all'), 1);
48
- add_filter('the_content', array(&$this, 'parse_content'), PHP_INT_MAX-1);
49
- }
50
-
51
- /**
52
- * Deactivates all shortcodes
53
- */
54
- function deactivate_all($content)
55
- {
56
- foreach (array_keys($this->_shortcodes) as $shortcode) {
57
- $this->deactivate($shortcode);
58
- }
59
-
60
- return $content;
61
- }
62
-
63
- /**
64
- * Activates all registered shortcodes
65
- */
66
- function activate_all()
67
- {
68
- foreach (array_keys($this->_shortcodes) as $shortcode) {
69
- $this->activate($shortcode);
70
- }
71
- }
72
-
73
- /**
74
- * Parses the content for shortcodes and returns the substituted content
75
- * @param $content
76
- * @return string
77
- */
78
- function parse_content($content)
79
- {
80
- $this->activate_all();
81
- return do_shortcode($content);
82
- }
83
-
84
- /**
85
- * Adds a shortcode
86
- * @param $name
87
- * @param $callback
88
- */
89
- function add_shortcode($name, $callback)
90
- {
91
- $this->_shortcodes[$name] = $callback;
92
- $this->activate($name);
93
- }
94
-
95
- /**
96
- * Activates a particular shortcode
97
- * @param $shortcode
98
- */
99
- function activate($shortcode)
100
- {
101
- if (isset($this->_shortcodes[$shortcode])) {
102
- add_shortcode($shortcode, $this->_shortcodes[$shortcode]);
103
- }
104
- }
105
-
106
- /**
107
- * Removes a shortcode
108
- * @param $name
109
- */
110
- function remove_shortcode($name)
111
- {
112
- unset($this->_shortcodes[$name]);
113
- $this->deactivate($name);
114
- }
115
-
116
- /**
117
- * De-activates a shortcode
118
- * @param $shortcode
119
- */
120
- function deactivate($shortcode)
121
- {
122
- if (isset($this->_shortcodes[$shortcode]))
123
- remove_shortcode($shortcode);
124
- }
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
non_pope/class.nextgen_style_manager.php CHANGED
@@ -147,14 +147,7 @@ class C_NextGen_Style_Manager
147
  */
148
  function get_selected_stylesheet()
149
  {
150
- $settings = C_NextGen_Settings::get_instance();
151
-
152
- // use the same css resource for all subsites when wpmuStyle=true
153
- if (!is_multisite() || (is_multisite() && $settings->get('wpmuStyle')))
154
- return $settings->get('CSSfile', 'nggallery.css');
155
- else
156
- return C_Nextgen_Global_Settings::get_instance()->get('wpmuCSSfile');
157
-
158
  }
159
 
160
  /**
@@ -192,23 +185,19 @@ class C_NextGen_Style_Manager
192
  {
193
  if (!$selected) $selected = $this->get_selected_stylesheet();
194
 
195
- $retval = str_replace(
196
  trailingslashit(ABSPATH),
197
  trailingslashit(site_url()),
198
  $this->find_selected_stylesheet_abspath($selected)
199
  );
200
-
201
- return str_replace('\\', '/', $retval);
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'
147
  */
148
  function get_selected_stylesheet()
149
  {
150
+ return C_NextGen_Settings::get_instance()->get('CSSfile', 'nggallery.css');
 
 
 
 
 
 
 
151
  }
152
 
153
  /**
185
  {
186
  if (!$selected) $selected = $this->get_selected_stylesheet();
187
 
188
+ return str_replace(
189
  trailingslashit(ABSPATH),
190
  trailingslashit(site_url()),
191
  $this->find_selected_stylesheet_abspath($selected)
192
  );
 
 
193
  }
194
 
195
 
196
+ function find_all_stylesheets()
197
  {
198
  $retval = array();
 
 
199
 
200
+ foreach (array_reverse($this->directories) as $dir) {
201
  $path = implode(DIRECTORY_SEPARATOR, array(
202
  untrailingslashit($dir),
203
  '*.css'
non_pope/class.photocrati_cache.php CHANGED
@@ -85,7 +85,7 @@ class C_Photocrati_Cache
85
  /**
86
  * Flush the entire cache
87
  */
88
- static function flush($group=NULL, $expired_only=FALSE)
89
  {
90
  $retval = 0;
91
 
@@ -94,77 +94,36 @@ class C_Photocrati_Cache
94
  // Delete all caches
95
  if ($group == 'all') {
96
  foreach (self::$_instances as $cache) {
97
- $retval += self::flush($cache->group, $expired_only);
98
  }
99
  }
100
 
101
  // Delete items from a single cache in particular
102
  else {
103
- $cache = self::get_instance($group);
104
-
105
- // Determine if the object cache is external, and not stored in the DB
106
- // If it's external, we have to delete each transient, one by one
107
- global $_wp_using_ext_object_cache, $wpdb;
108
- if ($_wp_using_ext_object_cache) {
109
- $keys = ($expired_only ? self::get_expired_key_list($group) : self::get_key_list($group));
110
- foreach ($keys as $key) $cache->delete($key, FALSE);
111
- $sql = $wpdb->prepare("DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", "%%{$cache->group}%%");
112
- if ($expired_only) $sql .= " AND option_value < ".time();
113
- $retval = $wpdb->query($sql);
114
  }
115
 
116
- // Transients are stored in the database
117
- else {
118
- $keys = ($expired_only ? self::get_expired_key_list($group) : self::get_key_list($group));
119
- if ($keys) {
120
- $all_keys = array();
121
- foreach ($keys as $value) {
122
- $all_keys[] = "'{$cache->group}{$value}'";
123
- $all_keys[] = "'_transient_timeout_{$value}'";
124
- $all_keys[] = "'_transient_{$value}'";
125
- }
126
- unset($keys);
127
- $all_keys = implode(',', $all_keys);
128
- $sql = "DELETE FROM {$wpdb->options} WHERE option_name IN (". $all_keys. ')';
129
- $retval = $wpdb->query($sql);
130
- }
131
- }
132
  }
133
  }
134
 
135
  return $retval;
136
  }
137
 
138
- static function get_key_list($group=NULL, $strip_group_name=TRUE, $expired_only=FALSE)
139
  {
140
  global $wpdb;
141
 
142
  $cache = self::get_instance($group);
143
-
144
- $sql = '';
145
- if ($strip_group_name) {
146
- $sql = $wpdb->prepare(
147
- "SELECT REPLACE(option_name, %s, '') FROM {$wpdb->options} WHERE option_name LIKE %s",
148
- $cache->group, '%'.$cache->group.'%'
149
- );
150
- }
151
- else {
152
- $sql = $wpdb->prepare(
153
- "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s",
154
- '%'.$cache->group.'%'
155
- );
156
- }
157
-
158
- if ($expired_only) $sql .= " AND option_value < ".time();
159
-
160
  return $wpdb->get_col($sql);
161
  }
162
 
163
- static function get_expired_key_list($group=NULL, $strip_group_name=TRUE)
164
- {
165
- return self::get_key_list($group, $strip_group_name, TRUE);
166
- }
167
-
168
 
169
  /**
170
  * Gets an item using a particular key
@@ -197,7 +156,7 @@ class C_Photocrati_Cache
197
  if (is_array($key)) $key = self::generate_key($key);
198
  if (self::$force_update OR $this->lookup($key, FALSE) === FALSE) {
199
  set_transient($key, $value, $ttl);
200
- update_option($this->group.$key, time()+$ttl);
201
  $retval = $key;
202
  }
203
  }
85
  /**
86
  * Flush the entire cache
87
  */
88
+ static function flush($group=NULL)
89
  {
90
  $retval = 0;
91
 
94
  // Delete all caches
95
  if ($group == 'all') {
96
  foreach (self::$_instances as $cache) {
97
+ $retval += self::flush($cache->group);
98
  }
99
  }
100
 
101
  // Delete items from a single cache in particular
102
  else {
103
+ foreach (self::get_key_list($group) as $key) {
104
+ self::delete($key, FALSE, $group);
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
+ // Delete list of cached items
108
+ global $wpdb;
109
+ $cache = self::get_instance($group);
110
+ $sql = $wpdb->prepare("DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", '%'.$cache->group.'%');
111
+ $retval = $wpdb->query($sql);
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
  }
114
 
115
  return $retval;
116
  }
117
 
118
+ static function get_key_list($group=NULL)
119
  {
120
  global $wpdb;
121
 
122
  $cache = self::get_instance($group);
123
+ $sql = $wpdb->prepare("SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s", '%'.$cache->group.'%');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  return $wpdb->get_col($sql);
125
  }
126
 
 
 
 
 
 
127
 
128
  /**
129
  * Gets an item using a particular key
156
  if (is_array($key)) $key = self::generate_key($key);
157
  if (self::$force_update OR $this->lookup($key, FALSE) === FALSE) {
158
  set_transient($key, $value, $ttl);
159
+ update_option($this->group.$key, 1);
160
  $retval = $key;
161
  }
162
  }
non_pope/class.photocrati_installer.php CHANGED
@@ -54,103 +54,40 @@ if (!class_exists('C_Photocrati_Installer'))
54
  if (method_exists($handler, 'uninstall')) return $handler->uninstall($hard);
55
 
56
  if ($hard) {
 
57
  C_NextGen_Settings::get_instance()->destroy();
58
- C_NextGen_Global_Settings::get_instance()->destroy();
59
  }
60
  }
61
 
62
  static function update($reset=FALSE)
63
  {
64
- $local_settings = C_NextGen_Settings::get_instance();
65
- $global_settings = C_NextGen_Global_Settings::get_instance();
 
 
66
 
67
- // This is a specific hack/work-around/fix and can probably be removed sometime after 2.0.20's release
68
- //
69
- // NextGen 2x was not multisite compatible until 2.0.18. Users that upgraded before this
70
- // will have nearly all of their settings stored globally (network wide) in wp_sitemeta. If
71
- // pope_module_list (which should always be a local setting) exists site-wide we wipe the current
72
- // global ngg_options and restore from defaults. This should only ever run once.
73
- if (is_multisite() && isset($global_settings->pope_module_list))
74
- {
75
- // Setting this to TRUE will wipe current settings for display types, but also
76
- // allows the display type installer to run correctly
77
- $reset = TRUE;
78
 
79
- $settings_installer = new C_NextGen_Settings_Installer();
80
- $global_defaults = $settings_installer->get_global_defaults();
81
-
82
- // Preserve the network options we honor by restoring them after calling $global_settings->reset()
83
- $global_settings_to_keep = array();
84
- foreach ($global_defaults as $key => $val) {
85
- $global_settings_to_keep[$key] = $global_settings->$key;
86
- }
87
-
88
- // Resets internal options to an empty array
89
- $global_settings->reset();
90
-
91
- // Restore the defaults, then our saved values. This must be done again later because
92
- // we've set $reset to TRUE.
93
- $settings_installer->install_global_settings();
94
- foreach ($global_settings_to_keep as $key => $val) {
95
- $global_settings->$key = $val;
96
- }
97
- }
98
-
99
- $last_module_list = $reset ? array() : $local_settings->get('pope_module_list', array());
100
- $current_module_list = self::_generate_module_info();
101
-
102
- if (count(($modules = array_diff($current_module_list, $last_module_list))) > 0)
103
- {
104
  // The cache should be flushed
105
  C_Photocrati_Cache::flush();
106
 
107
- // Remove all NGG created cron jobs
108
- self::refresh_cron();
109
-
110
  // Delete auto-update cache
111
  update_option('photocrati_auto_update_admin_update_list', null);
112
  update_option('photocrati_auto_update_admin_check_date', '');
113
 
114
- // Other Pope applications might be loaded, and therefore
115
- // all singletons should be destroyed, so that they can be
116
- // adapted as necessary. For now, we'll just assume that the factory
117
- // is the only singleton that will be used by other Pope applications
118
- C_Component_Factory::$_instances = array();
119
-
120
  foreach ($modules as $module_name) {
121
  if (($handler = self::get_handler_instance(array_shift(explode('|', $module_name))))) {
122
- if (method_exists($handler, 'install'))
123
- $handler->install($reset);
124
  }
125
  }
126
 
127
  // Update the module list
128
- $local_settings->set('pope_module_list', $current_module_list);
129
-
130
- // NOTE & TODO: if the above section that declares $global_settings_to_keep is removed this should also
131
- // Since a hard-reset of the settings was forced we must again re-apply our previously saved values
132
- if (isset($global_settings_to_keep)) {
133
- foreach ($global_settings_to_keep as $key => $val) {
134
- $global_settings->$key = $val;
135
- }
136
- }
137
 
138
  // Save any changes settings
139
  $global_settings->save();
140
  $local_settings->save();
141
- }
142
-
143
- // Another workaround to an issue caused by NextGen's lack of multisite compatibility. It's possible
144
- // the string substitation wasn't performed, so if a '%' symbol exists in gallerypath we reset it. It's
145
- // another db call, but again this should only ever run once.
146
- //
147
- // Remove this when removing the above reset-global-settings code
148
- if (strpos($local_settings->gallerypath, '%'))
149
- {
150
- $settings_installer = new C_NextGen_Settings_Installer();
151
- $local_settings->gallerypath = $settings_installer->gallerypath_replace($global_settings->gallerypath);
152
- $local_settings->save();
153
- }
154
  }
155
 
156
  static function _generate_module_info()
@@ -163,24 +100,5 @@ if (!class_exists('C_Photocrati_Installer'))
163
  }
164
  return $retval;
165
  }
166
-
167
- static function refresh_cron()
168
- {
169
- @ini_set('memory_limit', -1);
170
-
171
- // Remove all cron jobs created by NextGEN Gallery
172
- $cron = _get_cron_array();
173
- if (is_array($cron)) {
174
- foreach ($cron as $timestamp => $job) {
175
- if (is_array($job)) {
176
- unset($cron[$timestamp]['ngg_delete_expired_transients']);
177
- if (empty($cron[$timestamp])) {
178
- unset($cron[$timestamp]);
179
- }
180
- }
181
- }
182
- }
183
- _set_cron_array($cron);
184
- }
185
  }
186
  }
54
  if (method_exists($handler, 'uninstall')) return $handler->uninstall($hard);
55
 
56
  if ($hard) {
57
+ C_NextGen_Global_Settings::get_instance()->destroy();
58
  C_NextGen_Settings::get_instance()->destroy();
 
59
  }
60
  }
61
 
62
  static function update($reset=FALSE)
63
  {
64
+ $global_settings = C_NextGen_Global_Settings::get_instance();
65
+ $local_settings = C_NextGen_Settings::get_instance();
66
+ $last_module_list = $reset ? array() : $global_settings->get('pope_module_list', array());
67
+ $current_module_list = self::_generate_module_info();
68
 
69
+ if (count(($modules = array_diff($current_module_list, $last_module_list)))>0) {
 
 
 
 
 
 
 
 
 
 
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  // The cache should be flushed
72
  C_Photocrati_Cache::flush();
73
 
 
 
 
74
  // Delete auto-update cache
75
  update_option('photocrati_auto_update_admin_update_list', null);
76
  update_option('photocrati_auto_update_admin_check_date', '');
77
 
 
 
 
 
 
 
78
  foreach ($modules as $module_name) {
79
  if (($handler = self::get_handler_instance(array_shift(explode('|', $module_name))))) {
80
+ if (method_exists($handler, 'install')) $handler->install($reset);
 
81
  }
82
  }
83
 
84
  // Update the module list
85
+ $global_settings->set('pope_module_list', $current_module_list);
 
 
 
 
 
 
 
 
86
 
87
  // Save any changes settings
88
  $global_settings->save();
89
  $local_settings->save();
90
+ }
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
 
93
  static function _generate_module_info()
100
  }
101
  return $retval;
102
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
  }
non_pope/class.photocrati_resource_manager.php CHANGED
@@ -8,9 +8,8 @@ class C_Photocrati_Resource_Manager
8
  var $styles = '';
9
  var $scripts = '';
10
  var $other_output = '';
11
- var $wrote_footer = FALSE;
12
- var $run_shutdown = FALSE;
13
- var $valid_request = TRUE;
14
 
15
  /**
16
  * Start buffering all generated output. We'll then do two things with the buffer
@@ -19,35 +18,33 @@ class C_Photocrati_Resource_Manager
19
  */
20
  function __construct()
21
  {
22
- // Validate the request
23
- $this->validate_request();
24
 
25
- add_action('init',array(&$this, 'start_buffer'), 1);
 
 
 
 
 
 
26
  }
27
 
28
  /**
29
  * Determines if the resource manager should perform it's routines for this request
 
30
  * @return bool
31
  */
32
- function validate_request()
33
  {
34
- $retval = TRUE;
35
-
36
  if (is_admin()) {
37
  if (isset($_REQUEST['page']) && !preg_match("#^(ngg|nextgen)#", $_REQUEST['page'])) $retval = FALSE;
38
  }
39
 
40
  if (strpos($_SERVER['REQUEST_URI'], 'wp-admin/update') !== FALSE) $retval = FALSE;
41
- else if (isset($_GET['display_gallery_iframe'])) $retval = FALSE;
42
- else if (defined('WP_ADMIN') && WP_ADMIN && defined('DOING_AJAX') && DOING_AJAX) $retval = FALSE;
43
- else if (preg_match("/(js|css|xsl|xml|kml)$/", $_SERVER['REQUEST_URI'])) $retval = FALSE;
44
- elseif (preg_match("/\\.(\\w{3,4})$/", $_SERVER['REQUEST_URI'], $match)) {
45
- if (!in_array($match[1], array('htm', 'html', 'php'))) {
46
- $retval = FALSE;
47
- }
48
- }
49
 
50
- $this->valid_request = $retval;
51
  }
52
 
53
  /**
@@ -55,14 +52,8 @@ class C_Photocrati_Resource_Manager
55
  */
56
  function start_buffer()
57
  {
58
- if (apply_filters('run_ngg_resource_manager', $this->valid_request)) {
59
- ob_start(array(&$this, 'output_buffer_handler'));
60
- ob_start(array(&$this, 'get_buffer'));
61
-
62
- add_action('wp_print_footer_scripts', array(&$this, 'get_resources'), 1);
63
- add_action('admin_print_footer_scripts', array(&$this, 'get_resources'), 1);
64
- add_action('shutdown', array(&$this, 'shutdown'));
65
- }
66
  }
67
 
68
  /**
@@ -84,16 +75,6 @@ class C_Photocrati_Resource_Manager
84
  $this->wrote_footer = TRUE;
85
  }
86
 
87
- /**
88
- * Output the buffer after PHP execution has ended (but before shutdown)
89
- * @param $content
90
- * @return string
91
- */
92
- function output_buffer_handler($content)
93
- {
94
- return $this->output_buffer();
95
- }
96
-
97
  /**
98
  * Removes the closing </html> tag from the output buffer. We'll then write our own closing tag
99
  * in the shutdown function after running wp_print_footer_scripts()
@@ -111,20 +92,18 @@ class C_Photocrati_Resource_Manager
111
  */
112
  function move_resources()
113
  {
114
- if ($this->valid_request) {
115
- // Move stylesheets to head
116
- if ($this->styles) {
117
- $this->buffer = str_ireplace('</head>', $this->styles.'</head>', $this->buffer);
118
- }
119
 
120
- // Move the scripts to the bottom of the page
121
- if ($this->scripts) {
122
- $this->buffer = str_ireplace('</body>', $this->scripts.'</body>', $this->buffer);
123
- }
124
 
125
- if ($this->other_output) {
126
- $this->buffer = str_replace('</body>', $this->other_output.'</body>', $this->buffer);
127
- }
128
  }
129
  }
130
 
@@ -139,8 +118,8 @@ class C_Photocrati_Resource_Manager
139
 
140
  // If W3TC is installed and activated, we can't output the
141
  // scripts and manipulate the buffer, so we can only provide a warning
142
- if (defined('W3TC') && defined('WP_DEBUG') && WP_DEBUG) {
143
- if (defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', TRUE);
144
  if (!did_action('wp_footer')) {
145
  error_log("We're sorry, but your theme's page template didn't make a call to wp_footer(), which is required by NextGEN Gallery. Please add this call to your page templates.");
146
  }
@@ -149,11 +128,6 @@ class C_Photocrati_Resource_Manager
149
  }
150
  }
151
 
152
- // We don't want to manipulate the buffer if it doesn't contain HTML
153
- elseif (strpos($this->buffer, '</body>') === FALSE) {
154
- $this->valid_request = FALSE;
155
- }
156
-
157
  // The output_buffer() function has been called in the PHP shutdown callback
158
  // This will allow us to print the scripts ourselves and manipulate the buffer
159
  if ($in_shutdown === TRUE) {
8
  var $styles = '';
9
  var $scripts = '';
10
  var $other_output = '';
11
+ var $wrote_footer = FALSE;
12
+ var $run_shutdown = FALSE;
 
13
 
14
  /**
15
  * Start buffering all generated output. We'll then do two things with the buffer
18
  */
19
  function __construct()
20
  {
21
+ // Add default request exceptions
22
+ add_filter('run_ngg_resource_manager', array(&$this, 'is_valid_request'));
23
 
24
+ // Check if we should process this request
25
+ if (apply_filters('run_ngg_resource_manager', TRUE)) {
26
+ add_action('init',array(&$this, 'start_buffer'), 1);
27
+ add_action('wp_print_footer_scripts', array(&$this, 'get_resources'), 1);
28
+ add_action('admin_print_footer_scripts', array(&$this, 'get_resources'), 1);
29
+ add_action('shutdown', array(&$this, 'shutdown'));
30
+ }
31
  }
32
 
33
  /**
34
  * Determines if the resource manager should perform it's routines for this request
35
+ * @param $retval
36
  * @return bool
37
  */
38
+ function is_valid_request($retval)
39
  {
 
 
40
  if (is_admin()) {
41
  if (isset($_REQUEST['page']) && !preg_match("#^(ngg|nextgen)#", $_REQUEST['page'])) $retval = FALSE;
42
  }
43
 
44
  if (strpos($_SERVER['REQUEST_URI'], 'wp-admin/update') !== FALSE) $retval = FALSE;
45
+ else if (isset($_GET['display_gallery_iframe'])) $retval = FALSE;
 
 
 
 
 
 
 
46
 
47
+ return $retval;
48
  }
49
 
50
  /**
52
  */
53
  function start_buffer()
54
  {
55
+ ob_start(array(&$this, 'output_buffer'));
56
+ ob_start(array(&$this, 'get_buffer'));
 
 
 
 
 
 
57
  }
58
 
59
  /**
75
  $this->wrote_footer = TRUE;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * Removes the closing </html> tag from the output buffer. We'll then write our own closing tag
80
  * in the shutdown function after running wp_print_footer_scripts()
92
  */
93
  function move_resources()
94
  {
95
+ // Move stylesheets to head
96
+ if ($this->styles) {
97
+ $this->buffer = str_ireplace('</head>', $this->styles.'</head>', $this->buffer);
98
+ }
 
99
 
100
+ // Move the scripts to the bottom of the page
101
+ if ($this->scripts) {
102
+ $this->buffer = str_ireplace('</body>', $this->scripts.'</body>', $this->buffer);
103
+ }
104
 
105
+ if ($this->other_output) {
106
+ $this->buffer = str_replace('</body>', $this->other_output.'</body>', $this->buffer);
 
107
  }
108
  }
109
 
118
 
119
  // If W3TC is installed and activated, we can't output the
120
  // scripts and manipulate the buffer, so we can only provide a warning
121
+ if (defined('W3TC')) {
122
+ define('DONOTCACHEPAGE', TRUE);
123
  if (!did_action('wp_footer')) {
124
  error_log("We're sorry, but your theme's page template didn't make a call to wp_footer(), which is required by NextGEN Gallery. Please add this call to your page templates.");
125
  }
128
  }
129
  }
130
 
 
 
 
 
 
131
  // The output_buffer() function has been called in the PHP shutdown callback
132
  // This will allow us to print the scripts ourselves and manipulate the buffer
133
  if ($in_shutdown === TRUE) {
non_pope/class.photocrati_settings_manager.php CHANGED
@@ -41,7 +41,7 @@ if (!class_exists('C_Photocrati_Settings_Manager_Base')) {
41
  */
42
  protected function _get_option_handler($option_name, $method='get')
43
  {
44
- $retval = NULL;
45
 
46
  if (isset($this->_option_handlers[$option_name])) {
47
  if (!is_object($this->_option_handlers[$option_name])) {
41
  */
42
  protected function _get_option_handler($option_name, $method='get')
43
  {
44
+ $retval = NULL;;
45
 
46
  if (isset($this->_option_handlers[$option_name])) {
47
  if (!is_object($this->_option_handlers[$option_name])) {
pope/lib/autoload.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  if (!defined('POPE_VERSION')) {
4
- define('POPE_VERSION', '0.4');
5
  require_once('class.extensibleobject.php');
6
  require_once('interface.component.php');
7
  require_once('class.component.php');
1
  <?php
2
 
3
  if (!defined('POPE_VERSION')) {
4
+ define('POPE_VERSION', '0.1');
5
  require_once('class.extensibleobject.php');
6
  require_once('interface.component.php');
7
  require_once('class.component.php');
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='pope-module', $name='Pope Module', $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, $name, $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='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
  }
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
  }
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($context=FALSE)
11
  {
12
- parent::define($context);
13
  $this->implement('I_Component_Factory');
14
  }
15
 
7
  {
8
  static $_instances = array();
9
 
10
+ function define()
11
  {
12
+ parent::define();
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->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,10 +833,7 @@ class ExtensibleObject extends PopeHelpers
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,7 +1181,7 @@ class ExtensibleObject extends PopeHelpers
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,35 +1191,6 @@ class ExtensibleObject extends PopeHelpers
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,9 +1291,6 @@ class Mixin extends PopeHelpers
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,9 +1308,6 @@ class Mixin extends PopeHelpers
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,7 +1366,7 @@ class Hook extends Mixin
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(
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
  }
834
  }
835
 
836
+ return $this->get_method_property($method, self::METHOD_PROPERTY_RETURN_VALUE);
 
 
 
837
  }
838
 
839
 
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
  );
1192
  }
1193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194
 
1195
  /**
1196
  * Returns TRUE if the ExtensibleObject has decided to implement a
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
  $this->object->enable_post_hooks($method);
1309
  $this->object->enable_mixin($method, $klass);
1310
 
 
 
 
1311
  return $retval;
1312
  }
1313
 
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(
products/photocrati_nextgen/modules/ajax/class.ajax_controller.php CHANGED
@@ -12,8 +12,10 @@ class C_Ajax_Controller extends C_MVC_Controller
12
 
13
  function index_action()
14
  {
15
- // Start an output buffer to avoid displaying any PHP warnings/errors
16
- ob_start();
 
 
17
 
18
  // Inform the MVC framework what type of content we're returning
19
  $this->set_content_type('json');
@@ -30,13 +32,11 @@ class C_Ajax_Controller extends C_MVC_Controller
30
  if (!$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);
 
 
 
40
  }
41
 
42
  /**
12
 
13
  function index_action()
14
  {
15
+ $retval = FALSE;
16
+ $error_reporting = error_reporting(
17
+ E_CORE_ERROR|E_CORE_WARNING|E_COMPILE_ERROR|E_ERROR|E_PARSE|E_USER_ERROR|E_USER_WARNING|E_RECOVERABLE_ERROR
18
+ );
19
 
20
  // Inform the MVC framework what type of content we're returning
21
  $this->set_content_type('json');
32
  if (!$retval)
33
  $retval = array('error' => 'Not a valid AJAX action');
34
 
 
 
 
 
 
35
  // Return the JSON to the browser
36
  echo json_encode($retval);
37
+
38
+ // reset the reporting level
39
+ error_reporting($error_reporting);
40
  }
41
 
42
  /**
products/photocrati_nextgen/modules/ajax/class.ajax_installer.php CHANGED
@@ -5,7 +5,7 @@ class C_Ajax_Installer
5
  function install()
6
  {
7
  // Delete cached values. Needed for 2.0.7 and less
8
- $settings = C_NextGen_Settings::get_instance();
9
  $settings->delete('ajax_url');
10
  $settings->delete('ajax_slug');
11
  $settings->delete('ajax_js_url');
5
  function install()
6
  {
7
  // Delete cached values. Needed for 2.0.7 and less
8
+ $settings = C_NextGen_Global_Settings::get_instance();
9
  $settings->delete('ajax_url');
10
  $settings->delete('ajax_slug');
11
  $settings->delete('ajax_js_url');
products/photocrati_nextgen/modules/ajax/module.ajax.php CHANGED
@@ -14,14 +14,14 @@ class M_Ajax extends C_Base_Module
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'
21
  );
22
 
23
  include_once('class.ajax_option_handler.php');
24
- C_NextGen_Settings::add_option_handler('C_Ajax_Option_Handler', array(
25
  'ajax_slug',
26
  'ajax_url',
27
  'ajax_js_url'
@@ -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'), 9);
51
  }
52
 
53
 
@@ -56,7 +56,7 @@ class M_Ajax extends C_Base_Module
56
  */
57
  function enqueue_scripts()
58
  {
59
- $settings = C_NextGen_Settings::get_instance();
60
  $router = $this->get_registry()->get_utility('I_Router');
61
 
62
  $site_url = $router->get_base_url(TRUE);
@@ -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', '', 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.4',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
21
  );
22
 
23
  include_once('class.ajax_option_handler.php');
24
+ C_NextGen_Global_Settings::add_option_handler('C_Ajax_Option_Handler', array(
25
  'ajax_slug',
26
  'ajax_url',
27
  'ajax_js_url'
47
  */
48
  function _register_hooks()
49
  {
50
+ add_action('init', array(&$this, 'enqueue_scripts'));
51
  }
52
 
53
 
56
  */
57
  function enqueue_scripts()
58
  {
59
+ $settings = C_NextGen_Global_Settings::get_instance();
60
  $router = $this->get_registry()->get_utility('I_Router');
61
 
62
  $site_url = $router->get_base_url(TRUE);
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
  }
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', TRUE);
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 = json_decode($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', $params, $mapper);
204
  }
205
 
206
  // Save the changes
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
  $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
  }
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
products/photocrati_nextgen/modules/attach_to_post/adapter.gallery_storage_frame_event.php CHANGED
@@ -29,19 +29,11 @@ class A_Gallery_Storage_Frame_Event extends Mixin
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
  }
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
  }
products/photocrati_nextgen/modules/attach_to_post/class.attach_controller.php CHANGED
@@ -4,8 +4,6 @@ class C_Attach_Controller extends C_NextGen_Admin_Page_Controller
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,56 +28,6 @@ class C_Attach_Controller extends C_NextGen_Admin_Page_Controller
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,37 +40,26 @@ class Mixin_Attach_To_Post extends Mixin
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,11 +68,9 @@ class Mixin_Attach_To_Post extends Mixin
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,10 +79,9 @@ class Mixin_Attach_To_Post extends Mixin
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();
151
  $preview_url = $settings->gallery_preview_url;
152
  $display_tab_js_url = $settings->attach_to_post_display_tab_js_url;
153
  if ($this->object->_displayed_gallery->id()) {
@@ -164,15 +98,6 @@ class Mixin_Attach_To_Post extends Mixin
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,9 +106,7 @@ class Mixin_Attach_To_Post extends Mixin
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,7 +232,7 @@ class Mixin_Attach_To_Post extends Mixin
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}'";
4
  {
5
  static $_instances = array();
6
  var $_displayed_gallery;
 
 
7
 
8
  static function &get_instance($context)
9
  {
28
  {
29
  parent::initialize();
30
  $this->_load_displayed_gallery();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
  }
33
 
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
  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
  array('underscore'),
80
  '2.3.0'
81
  );
 
82
 
83
  // Enqueue the backbone app for the display tab
84
+ $settings = C_NextGen_Global_Settings::get_instance();
85
  $preview_url = $settings->gallery_preview_url;
86
  $display_tab_js_url = $settings->attach_to_post_display_tab_js_url;
87
  if ($this->object->_displayed_gallery->id()) {
98
  'ngg_displayed_gallery_preview_url',
99
  $settings->gallery_preview_url
100
  );
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
  /**
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
  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}'";
products/photocrati_nextgen/modules/attach_to_post/class.attach_to_post_installer.php CHANGED
@@ -5,7 +5,7 @@ class C_Attach_To_Post_Installer
5
  function install()
6
  {
7
  // Delete cached values. Needed for 2.0.7 and less
8
- $settings = C_NextGen_Settings::get_instance();
9
  $settings->delete('attach_to_post_url');
10
  $settings->delete('gallery_preview_url');
11
  $settings->delete('attach_to_post_display_tab_js_url');
5
  function install()
6
  {
7
  // Delete cached values. Needed for 2.0.7 and less
8
+ $settings = C_NextGen_Global_Settings::get_instance();
9
  $settings->delete('attach_to_post_url');
10
  $settings->delete('gallery_preview_url');
11
  $settings->delete('attach_to_post_display_tab_js_url');
products/photocrati_nextgen/modules/attach_to_post/mixin.attach_to_post_display_tab.php CHANGED
@@ -15,16 +15,11 @@ class Mixin_Attach_To_Post_Display_Tab extends Mixin
15
 
16
  // Ensure that JS is returned
17
  $this->object->set_content_type('javascript');
18
-
19
- while (ob_get_level() > 0) {
20
- ob_end_clean();
21
- }
22
 
23
  // Get all entities used by the display tab
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');
@@ -46,7 +41,7 @@ class Mixin_Attach_To_Post_Display_Tab extends Mixin
46
 
47
  usort($display_types, array($this->object, '_display_type_list_sort'));
48
 
49
- $output = $this->object->render_view('photocrati-attach_to_post#display_tab_js', array(
50
  'displayed_gallery' => json_encode($this->object->_displayed_gallery->get_entity()),
51
  'sources' => json_encode($source_mapper->select()->order_by('title')->run_query()),
52
  'gallery_primary_key' => $gallery_mapper->get_primary_key_column(),
@@ -54,11 +49,8 @@ class Mixin_Attach_To_Post_Display_Tab extends Mixin
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;
62
  }
63
 
64
  function _display_type_list_sort($type_1, $type_2)
15
 
16
  // Ensure that JS is returned
17
  $this->object->set_content_type('javascript');
 
 
 
 
18
 
19
  // Get all entities used by the display tab
20
  $context = 'attach_to_post';
21
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper', $context);
22
  $album_mapper = $this->get_registry()->get_utility('I_Album_Mapper', $context);
 
23
  $display_type_mapper= $this->get_registry()->get_utility('I_Display_Type_Mapper', $context);
24
  $source_mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Source_Mapper', $context);
25
  $security = $this->get_registry()->get_utility('I_Security_Manager');
41
 
42
  usort($display_types, array($this->object, '_display_type_list_sort'));
43
 
44
+ return $this->object->render_view('photocrati-attach_to_post#display_tab_js', array(
45
  'displayed_gallery' => json_encode($this->object->_displayed_gallery->get_entity()),
46
  'sources' => json_encode($source_mapper->select()->order_by('title')->run_query()),
47
  'gallery_primary_key' => $gallery_mapper->get_primary_key_column(),
49
  'albums' => json_encode($album_mapper->find_all()),
50
  'tags' => json_encode($tags),
51
  'display_types' => json_encode($display_types),
52
+ 'sec_token' => $security->get_request_token('nextgen_edit_displayed_gallery')->get_json()
 
53
  ), $return);
 
 
54
  }
55
 
56
  function _display_type_list_sort($type_1, $type_2)
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.8',
27
  'http://www.nextgen-gallery.com',
28
  'Photocrati Media',
29
  'http://www.photocrati.com',
@@ -31,7 +31,7 @@ class M_Attach_To_Post extends C_Base_Module
31
  );
32
 
33
  include_once('class.attach_to_post_option_handler.php');
34
- C_NextGen_Settings::add_option_handler('C_Attach_To_Post_Option_Handler', array(
35
  'attach_to_post_url',
36
  'gallery_preview_url',
37
  'attach_to_post_display_tab_js_url'
@@ -39,12 +39,6 @@ class M_Attach_To_Post extends C_Base_Module
39
 
40
  include_once('class.attach_to_post_installer.php');
41
  C_Photocrati_Installer::add_handler($this->module_id, 'C_Attach_To_Post_Installer');
42
-
43
- $uri = strtolower($_SERVER['REQUEST_URI']);
44
-
45
- if (strpos($uri, '/nextgen-attach_to_post') !== false) {
46
- define('WP_ADMIN', true);
47
- }
48
  }
49
 
50
  /**
@@ -136,42 +130,58 @@ class M_Attach_To_Post extends C_Base_Module
136
  */
137
  function substitute_placeholder_imgs($content)
138
  {
139
- // Get some utilities
140
- $mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Mapper');
141
- $router = $this->get_registry()->get_utility('I_Router');
142
-
143
- // To match ATP entries we compare the stored url against a generic path
144
- // We must check HTTP and HTTPS as well as permalink and non-permalink forms
145
- $preview_url = parse_url($router->join_paths(
146
- $router->remove_url_segment('index.php', $router->get_base_url()),
147
- '/nextgen-attach_to_post/preview'
148
- ));
149
- $preview_url = preg_quote($preview_url['host'] . $preview_url['path'], '#');
150
-
151
- $alt_preview_url = parse_url($router->join_paths(
152
- $router->remove_url_segment('index.php', $router->get_base_url()),
153
- 'index.php/nextgen-attach_to_post/preview'
154
- ));
155
- $alt_preview_url = preg_quote($alt_preview_url['host'] . $alt_preview_url['path'], '#');
156
-
157
- // The placeholder MUST have a gallery instance id
158
- if (preg_match_all("#<img.*http(s)?://({$preview_url}|{$alt_preview_url})/id--(\\d+).*\\/>#mi", $content, $matches, PREG_SET_ORDER)) {
159
- foreach ($matches as $match) {
160
- // Find the displayed gallery
161
- $displayed_gallery_id = $match[3];
162
- $displayed_gallery = $mapper->find($displayed_gallery_id, TRUE);
163
-
164
- // Get the content for the displayed gallery
165
- $retval = '<p>'._('Invalid Displayed Gallery').'</p>';
166
- if ($displayed_gallery) {
167
- $renderer = $this->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
168
- $retval = $renderer->render($displayed_gallery, TRUE);
169
- }
170
- $content = str_replace($match[0], $retval, $content);
171
- }
172
- }
173
-
174
- return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
 
177
  /**
@@ -184,6 +194,13 @@ class M_Attach_To_Post extends C_Base_Module
184
  // Enqueue resources needed at post/page level
185
  if (preg_match("/\/wp-admin\/(post|post-new)\.php$/", $_SERVER['SCRIPT_NAME'])) {
186
  $this->_enqueue_tinymce_resources();
 
 
 
 
 
 
 
187
  wp_enqueue_style(
188
  'ngg_attach_to_post_dialog', $router->get_static_url('photocrati-attach_to_post#attach_to_post_dialog.css')
189
  );
@@ -205,7 +222,7 @@ class M_Attach_To_Post extends C_Base_Module
205
  wp_localize_script(
206
  'media-editor',
207
  'nextgen_gallery_attach_to_post_url',
208
- C_NextGen_Settings::get_instance()->attach_to_post_url
209
  );
210
 
211
  // Registers our tinymce button and plugin for attaching galleries
@@ -303,13 +320,12 @@ 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
- 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
  /**
23
  'photocrati-attach_to_post',
24
  'Attach To Post',
25
  'Provides the "Attach to Post" interface for displaying galleries and albums',
26
+ '0.6',
27
  'http://www.nextgen-gallery.com',
28
  'Photocrati Media',
29
  'http://www.photocrati.com',
31
  );
32
 
33
  include_once('class.attach_to_post_option_handler.php');
34
+ C_NextGen_Global_Settings::add_option_handler('C_Attach_To_Post_Option_Handler', array(
35
  'attach_to_post_url',
36
  'gallery_preview_url',
37
  'attach_to_post_display_tab_js_url'
39
 
40
  include_once('class.attach_to_post_installer.php');
41
  C_Photocrati_Installer::add_handler($this->module_id, 'C_Attach_To_Post_Installer');
 
 
 
 
 
 
42
  }
43
 
44
  /**
130
  */
131
  function substitute_placeholder_imgs($content)
132
  {
133
+ // Load html into parser
134
+ $doc = new simple_html_dom();
135
+ if ($content) {
136
+ $doc->load($content);
137
+
138
+ // Find all placeholder images
139
+ $imgs = $doc->find("img[class='ngg_displayed_gallery']");
140
+ if ($imgs) {
141
+
142
+ // Get some utilities
143
+ $mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Mapper');
144
+ $router = $this->get_registry()->get_utility('I_Router');
145
+
146
+ // To match ATP entries we compare the stored url against a generic path
147
+ // We must check HTTP and HTTPS as well as permalink and non-permalink forms
148
+ $preview_url = parse_url($router->join_paths(
149
+ $router->remove_url_segment('index.php', $router->get_base_url()),
150
+ '/nextgen-attach_to_post/preview'
151
+ ));
152
+ $preview_url = preg_quote($preview_url['host'] . $preview_url['path'], '#');
153
+
154
+ $alt_preview_url = parse_url($router->join_paths(
155
+ $router->remove_url_segment('index.php', $router->get_base_url()),
156
+ 'index.php/nextgen-attach_to_post/preview'
157
+ ));
158
+ $alt_preview_url = preg_quote($alt_preview_url['host'] . $alt_preview_url['path'], '#');
159
+
160
+ // Substitute each image for the gallery type frontent content
161
+ foreach ($imgs as $img) {
162
+
163
+ // The placeholder MUST have a gallery instance id
164
+ if (preg_match("#http(s)?://({$preview_url}|{$alt_preview_url})/id--(\d+)#", $img->src, $match)) {
165
+
166
+ // Find the displayed gallery
167
+ $displayed_gallery_id = $match[3];
168
+ $displayed_gallery = $mapper->find($displayed_gallery_id, TRUE);
169
+
170
+ // Get the content for the displayed gallery
171
+ $content = '<p>'._('Invalid Displayed Gallery').'</p>';
172
+ if ($displayed_gallery) {
173
+ $renderer = $this->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
174
+ $content = $renderer->render($displayed_gallery, TRUE);
175
+ }
176
+
177
+ // Replace the placeholder with the displayed gallery content
178
+ $img->outertext = $content;
179
+ }
180
+ }
181
+ $content = (string)$doc->save();
182
+ }
183
+ return $content;
184
+ }
185
  }
186
 
187
  /**
194
  // Enqueue resources needed at post/page level
195
  if (preg_match("/\/wp-admin\/(post|post-new)\.php$/", $_SERVER['SCRIPT_NAME'])) {
196
  $this->_enqueue_tinymce_resources();
197
+
198
+ # wp_enqueue_style(
199
+ # 'ngg_custom_scrollbar', $this->get_static_url('jquery.mCustomScrollbar.css')
200
+ # );
201
+ # wp_enqueue_script(
202
+ # 'ngg_custom_scrollbar', $this->get_static_url('jquery.mCustomScrollbar.concat.min.js'), array('jquery')
203
+ # );
204
  wp_enqueue_style(
205
  'ngg_attach_to_post_dialog', $router->get_static_url('photocrati-attach_to_post#attach_to_post_dialog.css')
206
  );
222
  wp_localize_script(
223
  'media-editor',
224
  'nextgen_gallery_attach_to_post_url',
225
+ C_NextGen_Global_Settings::get_instance()->attach_to_post_url
226
  );
227
 
228
  // Registers our tinymce button and plugin for attaching galleries
320
  function new_gallery_event($gallery_id)
321
  {
322
  $gallery = $this->get_registry()->get_utility('I_Gallery_Mapper')->find($gallery_id);
323
+
324
+ $this->_get_frame_event_publisher()->add_event(array(
325
+ 'event' => 'new_gallery',
326
+ 'gallery_id'=> intval($gallery_id),
327
+ 'gallery_title' => $gallery->title
328
+ ));
 
329
  }
330
 
331
  /**
products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post.js CHANGED
@@ -6,33 +6,35 @@ 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(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
  }
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
  }
products/photocrati_nextgen/modules/attach_to_post/static/iframely.js CHANGED
@@ -1,6 +1,7 @@
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"
@@ -9,55 +10,14 @@ if (window.frameElement) {
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") {
15
- if (window != null && typeof(window.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
- }
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"
10
  $(this).append("<input type='hidden' name='attach_to_post' value='1'/>");
11
  });
12
 
13
+ // Adjust the height of the frame
14
+ parent.adjust_height_for_frame(window.frameElement, function(){
15
+ $('#iframely').css({
16
+ position: 'static',
17
+ visibility: 'visible'
18
+ }).animate({
19
+ opacity: 1.0
20
+ });
21
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  });
23
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/attach_to_post/templates/display_tab_js.php CHANGED
@@ -260,7 +260,7 @@ jQuery(function($){
260
  * A collection that can fetch it's entities from the server
261
  **/
262
  Ngg.Models.Remote_Collection = Ngg.Models.SelectableItems.extend({
263
- fetch_limit: 5000,
264
  in_progress: false,
265
  fetch_url: photocrati_ajax.url,
266
  action: '',
@@ -808,9 +808,6 @@ 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
- 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,8 +1014,6 @@ jQuery(function($){
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(){
@@ -1043,7 +1038,6 @@ jQuery(function($){
1043
 
1044
  fill_image_sortorder_options: function(){
1045
  this.sortorder_options.reset();
1046
- this.sortorder_options.push(this.create_sortorder_option('', 'None'));
1047
  this.sortorder_options.push(this.create_sortorder_option('sortorder', 'Custom'));
1048
  this.sortorder_options.push(this.create_sortorder_option(Ngg.DisplayTab.instance.image_key, 'Image ID'));
1049
  this.sortorder_options.push(this.create_sortorder_option('filename', 'Filename'));
@@ -1053,38 +1047,16 @@ jQuery(function($){
1053
 
1054
  fill_gallery_sortorder_options: function(){
1055
  this.sortorder_options.reset();
1056
- this.sortorder_options.push(this.create_sortorder_option('', 'None'));
1057
  this.sortorder_options.push(this.create_sortorder_option('sortorder' ,'Custom'));
1058
  this.sortorder_options.push(this.create_sortorder_option('name', 'Name'));
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});
1074
  });
1075
-
1076
- this.displayed_gallery.set('sortorder', []);
1077
-
1078
- var sort_by = model.get('value');
1079
-
1080
- // If "None" was selected, then clear the "sortorder" property
1081
- if (model.get('value').length == 0) {
1082
- sort_by = 'sortorder';
1083
- }
1084
-
1085
- // Change the "sort by" parameter
1086
- this.displayed_gallery.set('order_by', sort_by);
1087
-
1088
  this.entities.reset();
1089
  this.$el.find('a.sortorder').each(function(){
1090
  var $item = $(this);
@@ -1096,7 +1068,6 @@ jQuery(function($){
1096
  },
1097
 
1098
  sortdirection_changed: function(model){
1099
-
1100
  this.sortdirection_options.each(function(item){
1101
  item.set('selected', model.get('value') == item.get('value') ? true : false, {silent: true});
1102
  });
@@ -1176,15 +1147,10 @@ jQuery(function($){
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,7 +1360,7 @@ jQuery(function($){
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,7 +1461,6 @@ jQuery(function($){
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')) {
260
  * A collection that can fetch it's entities from the server
261
  **/
262
  Ngg.Models.Remote_Collection = Ngg.Models.SelectableItems.extend({
263
+ fetch_limit: 50,
264
  in_progress: false,
265
  fetch_url: photocrati_ajax.url,
266
  action: '',
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
  }
1015
  ]);
1016
  this.sortdirection_options.on('change:selected', this.sortdirection_changed, this);
 
 
1017
  },
1018
 
1019
  populate_sorting_fields: function(){
1038
 
1039
  fill_image_sortorder_options: function(){
1040
  this.sortorder_options.reset();
 
1041
  this.sortorder_options.push(this.create_sortorder_option('sortorder', 'Custom'));
1042
  this.sortorder_options.push(this.create_sortorder_option(Ngg.DisplayTab.instance.image_key, 'Image ID'));
1043
  this.sortorder_options.push(this.create_sortorder_option('filename', 'Filename'));
1047
 
1048
  fill_gallery_sortorder_options: function(){
1049
  this.sortorder_options.reset();
 
1050
  this.sortorder_options.push(this.create_sortorder_option('sortorder' ,'Custom'));
1051
  this.sortorder_options.push(this.create_sortorder_option('name', 'Name'));
1052
  this.sortorder_options.push(this.create_sortorder_option('galdesc', 'Description'));
1053
  },
1054
 
 
 
 
 
 
 
 
 
 
1055
  sortoption_changed: function(model){
1056
  this.sortorder_options.each(function(item){
1057
  item.set('selected', model.get('value') == item.get('value') ? true : false, {silent: true});
1058
  });
1059
+ this.displayed_gallery.set('order_by', model.get('value'));
 
 
 
 
 
 
 
 
 
 
 
 
1060
  this.entities.reset();
1061
  this.$el.find('a.sortorder').each(function(){
1062
  var $item = $(this);
1068
  },
1069
 
1070
  sortdirection_changed: function(model){
 
1071
  this.sortdirection_options.each(function(item){
1072
  item.set('selected', model.get('value') == item.get('value') ? true : false, {silent: true});
1073
  });
1147
  this[key] = value;
1148
  }, this);
1149
  this.model.on('change', this.render, this);
 
 
 
1150
  this.id = this.model.get('id_field')+'_'+this.model.entity_id()
1151
  },
1152
 
1153
  item_dropped: function(e, index){
 
 
1154
  this.model.set('sortorder', index);
1155
  },
1156
 
1360
  var request = <?php echo $sec_token?>;
1361
  request = _.extend(request, {
1362
  action: 'save_displayed_gallery',
1363
+ displayed_gallery: this.displayed_gallery.toJSON()
1364
  });
1365
 
1366
  var self = this;
1461
  this.display_type_order_step = <?php echo NEXTGEN_DISPLAY_PRIORITY_STEP; ?>;
1462
  this.entities = new Ngg.DisplayTab.Models.Entity_Collection();
1463
  this.entities.extra_data.displayed_gallery = this.displayed_gallery;
 
1464
 
1465
  // Pre-select current displayed gallery values
1466
  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.2',
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.1',
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,7 +30,6 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
30
  'is_select' => TRUE,
31
  'is_delete' => FALSE
32
  );
33
-
34
  return $this->object;
35
  }
36
 
@@ -253,6 +252,7 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
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,14 +335,7 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
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,7 +427,10 @@ class Mixin_CustomPost_DataMapper_Driver extends Mixin
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,13 +522,17 @@ class C_CustomPost_DataMapper_Driver extends C_DataMapper_Driver_Base
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
30
  'is_select' => TRUE,
31
  'is_delete' => FALSE
32
  );
 
33
  return $this->object;
34
  }
35
 
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
  /* @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
  $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
 
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
products/photocrati_nextgen/modules/datamapper/class.customtable_datamapper_driver.php CHANGED
@@ -18,11 +18,10 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
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,8 +182,8 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
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,9 +206,8 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
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,19 +220,11 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
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,7 +240,7 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
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,50 +359,70 @@ class C_CustomTable_DataMapper_Driver_Mixin extends Mixin
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
 
417
  function _init()
418
  {
@@ -436,20 +446,21 @@ class C_CustomTable_DataMapper_Driver extends C_DataMapper_Driver_Base
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
  /**
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
  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
  // 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
  $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
 
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
  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
 
427
  function _init()
428
  {
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
  /**
products/photocrati_nextgen/modules/datamapper/class.datamapper_driver_base.php CHANGED
@@ -3,13 +3,7 @@
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,7 +13,7 @@ class E_ColumnsNotDefinedException extends E_NggErrorException
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,24 +56,6 @@ class Mixin_DataMapper_Driver_Base extends Mixin
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,7 +76,6 @@ class Mixin_DataMapper_Driver_Base extends Mixin
100
  function unserialize($value)
101
  {
102
  $retval = NULL;
103
-
104
  if (is_string($value))
105
  {
106
  $retval = stripcslashes($value);
@@ -292,10 +267,9 @@ class Mixin_DataMapper_Driver_Base extends Mixin
292
  // A bind could be an array, used for the 'IN' operator
293
  // or a simple scalar value. We need to convert arrays
294
  // into scalar values
295
- if (is_object($bind))
296
- $bind = (array)$bind;
297
-
298
- if (is_array($bind) && !empty($bind)) {
299
  foreach ($bind as &$val) {
300
  if (!is_numeric($val)) {
301
  $val = '"'.addslashes($val).'"';
@@ -304,12 +278,7 @@ class Mixin_DataMapper_Driver_Base extends Mixin
304
  }
305
  $bind = implode(',', $bind);
306
  }
307
- else if (is_array($bind) && empty($bind)) {
308
- $bind = 'NULL';
309
- }
310
- else if(!is_numeric($bind)) {
311
- $numeric = FALSE;
312
- }
313
  }
314
  $condition = $wpdb->prepare($condition, $binds);
315
 
@@ -368,12 +337,9 @@ class Mixin_DataMapper_Driver_Base extends Mixin
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,7 +380,7 @@ class Mixin_DataMapper_Driver_Base extends Mixin
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,79 +523,24 @@ class Mixin_DataMapper_Driver_Base extends Mixin
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,32 +563,6 @@ class C_DataMapper_Driver_Base extends C_Component
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
3
  /**
4
  * Thrown when an entity does not exist
5
  */
6
+ class E_EntityNotFoundException extends RuntimeException
 
 
 
 
 
 
7
  {
8
 
9
  }
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
  );
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  /**
60
  * Serializes the data
61
  * @param mixed $value
76
  function unserialize($value)
77
  {
78
  $retval = NULL;
 
79
  if (is_string($value))
80
  {
81
  $retval = stripcslashes($value);
267
  // A bind could be an array, used for the 'IN' operator
268
  // or a simple scalar value. We need to convert arrays
269
  // into scalar values
270
+ if (is_object($bind)) $bind = (array)$bind;
271
+ if (is_array($bind)) {
272
+ if (empty($bind)) return FALSE;
 
273
  foreach ($bind as &$val) {
274
  if (!is_numeric($val)) {
275
  $val = '"'.addslashes($val).'"';
278
  }
279
  $bind = implode(',', $bind);
280
  }
281
+ elseif(!is_numeric($bind)) $numeric = FALSE;
 
 
 
 
 
282
  }
283
  $condition = $wpdb->prepare($condition, $binds);
284
 
337
  // Add name of the id_field to the entity, and convert
338
  // the ID to an integer
339
  $stdObject->id_field = $key = $this->object->get_primary_key_column();
340
+ if (isset($stdObject->$key)) {
341
+ $stdObject->$key = (int) $stdObject->$key;
342
+ }
 
 
 
343
 
344
  // Set defaults for this entity
345
  $this->object->set_defaults($stdObject);
380
  $entity = new stdClass;
381
  foreach ($properties as $k=>$v) $entity->$k = $v;
382
  }
383
+ return $factory->create($this->object->get_model_factory_method(), $this->object, $entity, $context);
384
  }
385
 
386
 
523
  return stripslashes($result);
524
  }
525
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  }
527
 
528
  class C_DataMapper_Driver_Base extends C_Component
529
  {
530
  var $_object_name;
531
  var $_model_factory_method = FALSE;
 
 
 
532
 
533
  function define($object_name, $context=FALSE)
534
  {
535
  parent::define($context);
536
  $this->add_mixin('Mixin_DataMapper_Driver_Base');
537
  $this->implement('I_DataMapper_Driver');
 
 
 
 
 
538
  }
539
 
540
+ function initialize($object_name)
541
  {
542
  parent::initialize();
543
+ $this->_object_name = $object_name;
544
  }
545
 
546
  /**
563
  return $table_prefix.$this->_object_name;
564
  }
565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  /**
567
  * Sets the name of the factory method used to create a model for this entity
568
  * @param string $method_name
products/photocrati_nextgen/modules/datamapper/class.datamapper_installer.php CHANGED
@@ -4,7 +4,7 @@ class C_DataMapper_Installer
4
  {
5
  function __construct()
6
  {
7
- $this->settings = C_NextGen_Settings::get_instance();
8
  }
9
 
10
  function install()
4
  {
5
  function __construct()
6
  {
7
+ $this->settings = C_NextGen_Global_Settings::get_instance();
8
  }
9
 
10
  function install()
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=NULL, $properties=array(), $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=NULL, $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
- return $this->get_mapper()->destroy($this->_stdObject);
109
  }
110
 
111
 
@@ -121,14 +121,16 @@ class C_DataMapper_Model extends C_Component
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
 
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
  * @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
  */
106
  function destroy()
107
  {
108
+ $this->get_mapper()->destroy($this->_stdObject);
109
  }
110
 
111
 
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
 
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.4',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
@@ -48,17 +48,14 @@ class M_DataMapper extends C_Base_Module
48
  */
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;
56
- }
57
 
58
- // Perhaps we're to initiate a delete query instead?
59
- elseif ($wp_query->get('is_delete')) {
60
- $sql = preg_replace("/^SELECT.*FROM/i", "DELETE FROM", $sql);
61
- }
62
  }
63
 
64
  return $sql;
@@ -72,13 +69,8 @@ class M_DataMapper extends C_Base_Module
72
  */
73
  function set_custom_wp_query_fields($fields, &$wp_query)
74
  {
75
- if ($wp_query->get('datmapper')) {
76
- if (($custom_fields = $wp_query->get('fields'))) {
77
- $fields = $custom_fields;
78
- }
79
- }
80
-
81
- return $fields;
82
  }
83
 
84
 
@@ -90,11 +82,8 @@ class M_DataMapper extends C_Base_Module
90
  */
91
  function set_custom_wp_query_where($where, &$wp_query)
92
  {
93
- if ($wp_query->get('datamapper')) {
94
- $this->add_post_title_where_clauses($where, $wp_query);
95
- $this->add_post_name_where_clauses($where, $wp_query);
96
- }
97
-
98
  return $where;
99
  }
100
 
@@ -117,12 +106,6 @@ class M_DataMapper extends C_Base_Module
117
  }
118
  $retval = "GROUP BY ".implode(', ', $group_by_columns);
119
  }
120
- // Not all mysql servers allow access to create temporary tables which are used when doing GROUP BY
121
- // statements; this can potentially ruin basic queries. If no group_by_columns is set AND the query originates
122
- // within the datamapper we strip the "GROUP BY" clause entirely in this filter.
123
- else if ($wp_query->get('datamapper')) {
124
- $retval = '';
125
- }
126
  return $retval;
127
  }
128
 
@@ -195,7 +178,7 @@ class M_DataMapper extends C_Base_Module
195
  return array(
196
  'A_Datamapper_Factory' => 'adapter.datamapper_factory.php',
197
  'C_Datamapper_Installer' => 'class.datamapper_installer.php',
198
- 'C_Datamapper' => 'class.datamapper.php',
199
  'C_Custompost_Datamapper_Driver' => 'class.custompost_datamapper_driver.php',
200
  'C_Customtable_Datamapper_Driver' => 'class.customtable_datamapper_driver.php',
201
  'C_Datamapper_Driver_Base' => 'class.datamapper_driver_base.php',
14
  'photocrati-datamapper',
15
  'DataMapper',
16
  'Provides a database abstraction layer following the DataMapper pattern',
17
+ '0.2',
18
  'http://www.photocrati.com',
19
  'Photocrati Media',
20
  'http://www.photocrati.com'
48
  */
49
  function set_custom_wp_query($sql, &$wp_query)
50
  {
51
+ // Set the custom query
52
+ if (($custom_sql = $wp_query->get('custom_sql'))) {
53
+ $sql = $custom_sql;
54
+ }
 
 
55
 
56
+ // Perhaps we're to initiate a delete query instead?
57
+ elseif ($wp_query->get('is_delete')) {
58
+ $sql = preg_replace("/^SELECT.*FROM/i", "DELETE FROM", $sql);
 
59
  }
60
 
61
  return $sql;
69
  */
70
  function set_custom_wp_query_fields($fields, &$wp_query)
71
  {
72
+ $custom_fields = $wp_query->get('fields');
73
+ return $custom_fields ? $custom_fields : $fields;
 
 
 
 
 
74
  }
75
 
76
 
82
  */
83
  function set_custom_wp_query_where($where, &$wp_query)
84
  {
85
+ $this->add_post_title_where_clauses($where, $wp_query);
86
+ $this->add_post_name_where_clauses($where, $wp_query);
 
 
 
87
  return $where;
88
  }
89
 
106
  }
107
  $retval = "GROUP BY ".implode(', ', $group_by_columns);
108
  }
 
 
 
 
 
 
109
  return $retval;
110
  }
111
 
178
  return array(
179
  'A_Datamapper_Factory' => 'adapter.datamapper_factory.php',
180
  'C_Datamapper_Installer' => 'class.datamapper_installer.php',
181
+ 'C_Datamapper' => 'class.datamapper.php',
182
  'C_Custompost_Datamapper_Driver' => 'class.custompost_datamapper_driver.php',
183
  'C_Customtable_Datamapper_Driver' => 'class.customtable_datamapper_driver.php',
184
  'C_Datamapper_Driver_Base' => 'class.datamapper_driver_base.php',
products/photocrati_nextgen/modules/dynamic_stylesheet/class.dynamic_stylesheet_controller.php CHANGED
@@ -17,7 +17,7 @@ class C_Dynamic_Stylesheet_Controller extends C_MVC_Controller
17
  function initialize()
18
  {
19
  parent::initialize();
20
- $this->_app = C_NextGen_Settings::get_instance()->dynamic_stylesheet_slug;
21
  }
22
 
23
  static function &get_instance($context=FALSE)
@@ -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={$index}&data={$data}"
80
  );
81
  }
82
  }
17
  function initialize()
18
  {
19
  parent::initialize();
20
+ $this->_app = C_NextGen_Global_Settings::get_instance()->dynamic_stylesheet_slug;
21
  }
22
 
23
  static function &get_instance($context=FALSE)
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
  }
products/photocrati_nextgen/modules/dynamic_stylesheet/class.dynamic_stylesheet_installer.php CHANGED
@@ -4,7 +4,7 @@ class C_Dynamic_Stylesheet_Installer
4
  {
5
  function __construct()
6
  {
7
- $this->settings = C_NextGen_Settings::get_instance();
8
  }
9
 
10
  function install()
4
  {
5
  function __construct()
6
  {
7
+ $this->settings = C_NextGen_Global_Settings::get_instance();
8
  }
9
 
10
  function install()
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', $check_existance=FALSE)
49
  {
50
  $retval = NULL;
51
  $dynthumbs = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
@@ -61,14 +61,7 @@ class A_Dynamic_Thumbnails_Storage_Driver extends Mixin
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;
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
  }
62
 
63
  if ($retval == null) {
64
+ $retval = $this->call_parent('get_image_url', $image, $size);
 
 
 
 
 
 
 
65
  }
66
 
67
  return $retval;
products/photocrati_nextgen/modules/dynamic_thumbnails/class.dynamic_thumbnails_installer.php CHANGED
@@ -4,7 +4,7 @@ class C_Dynamic_Thumbnails_Installer
4
  {
5
  function __construct()
6
  {
7
- $this->settings = C_NextGen_Settings::get_instance();
8
  }
9
 
10
  function install()
4
  {
5
  function __construct()
6
  {
7
+ $this->settings = C_NextGen_Global_Settings::get_instance();
8
  }
9
 
10
  function install()
products/photocrati_nextgen/modules/dynamic_thumbnails/class.dynamic_thumbnails_manager.php CHANGED
@@ -4,7 +4,7 @@ class Mixin_Dynamic_Thumbnails_Manager extends Mixin
4
  {
5
  function get_route_name()
6
  {
7
- return C_NextGen_Settings::get_instance()->get('dynamic_thumbnail_slug');
8
  }
9
 
10
  function _get_params_sanitized($params)
4
  {
5
  function get_route_name()
6
  {
7
+ return C_NextGen_Global_Settings::get_instance()->get('dynamic_thumbnail_slug');
8
  }
9
 
10
  function _get_params_sanitized($params)
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.4',
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.2',
17
  'http://www.nextgen-gallery.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/frame_communication/class.frame_communication_installer.php CHANGED
@@ -4,7 +4,7 @@ class C_Frame_Communication_Installer
4
  {
5
  function __construct()
6
  {
7
- $this->settings = C_NextGen_Settings::get_instance();
8
  }
9
 
10
  function install()
4
  {
5
  function __construct()
6
  {
7
+ $this->settings = C_NextGen_Global_Settings::get_instance();
8
  }
9
 
10
  function install()
products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php CHANGED
@@ -15,7 +15,7 @@ class C_Frame_Event_Publisher extends C_Component
15
  function initialize()
16
  {
17
  parent::initialize();
18
- $this->setting_name = C_NextGen_Settings::get_instance()->frame_communication_option_name;
19
  }
20
 
21
  /**
@@ -64,15 +64,7 @@ class Mixin_Frame_Event_Publisher extends Mixin
64
  {
65
  $id = md5(serialize($data));
66
  $data['context'] = $this->object->context;
67
-
68
- $write_cookie = TRUE;
69
- if (defined('XMLRPC_REQUEST')) {
70
- $write_cookie = XMLRPC_REQUEST == FALSE;
71
- }
72
-
73
- if ($write_cookie) {
74
- setrawcookie($this->object->setting_name.'_'.$id,$this->object->_encode($data));
75
- }
76
 
77
  return $data;
78
  }
15
  function initialize()
16
  {
17
  parent::initialize();
18
+ $this->setting_name = C_NextGen_Global_Settings::get_instance()->frame_communication_option_name;
19
  }
20
 
21
  /**
64
  {
65
  $id = md5(serialize($data));
66
  $data['context'] = $this->object->context;
67
+ setrawcookie($this->object->setting_name.'_'.$id,$this->object->_encode($data));
 
 
 
 
 
 
 
 
68
 
69
  return $data;
70
  }
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.3',
19
  'http://www.nextgen-gallery.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com',
@@ -35,7 +35,7 @@ class M_Frame_Communication extends C_Base_Module
35
 
36
  function _register_hooks()
37
  {
38
- add_action('init', array($this, 'enqueue_admin_scripts'));
39
 
40
  }
41
 
@@ -48,9 +48,7 @@ class M_Frame_Communication extends C_Base_Module
48
  $router->get_static_url('photocrati-frame_communication#frame_event_publisher.js'),
49
  array('jquery')
50
  );
51
-
52
- if (is_admin())
53
- wp_enqueue_script('frame_event_publisher');
54
  }
55
 
56
  function get_type_list()
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',
35
 
36
  function _register_hooks()
37
  {
38
+ add_action('admin_enqueue_scripts', array(&$this, 'enqueue_admin_scripts'));
39
 
40
  }
41
 
48
  $router->get_static_url('photocrati-frame_communication#frame_event_publisher.js'),
49
  array('jquery')
50
  );
51
+ wp_enqueue_script('frame_event_publisher');
 
 
52
  }
53
 
54
  function get_type_list()
products/photocrati_nextgen/modules/fs/class.fs.php CHANGED
@@ -290,19 +290,16 @@ class Mixin_Fs_Instance_Methods extends Mixin
290
 
291
  // determine if each piece should be appended to $retval
292
  foreach ($pieces as $ndx => $val) {
293
- if ($val === '') continue;
294
  $one = array_search($val, $retval);
295
  $two = array_search($val, $pieces);
296
  $one = (FALSE === $one ? 0 : count($one) + 1);
297
  $two = (FALSE === $two ? 0 : count($two) + 1);
298
  if (!empty($protocol)) {
299
- $existing_val = isset($retval[$ndx]) ? $retval[$ndx] : NULL;
300
- if ($existing_val !== $val || $two >= $one)
301
  $retval[] = $val;
302
  }
303
  else {
304
- $existing_val = isset($retval[$ndx]) ? $retval[$ndx] : NULL;
305
- if ($existing_val !== $val && $two >= $one)
306
  $retval[] = $val;
307
  }
308
  }
@@ -362,7 +359,7 @@ class Mixin_Fs_Instance_Methods extends Mixin
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
  }
290
 
291
  // determine if each piece should be appended to $retval
292
  foreach ($pieces as $ndx => $val) {
 
293
  $one = array_search($val, $retval);
294
  $two = array_search($val, $pieces);
295
  $one = (FALSE === $one ? 0 : count($one) + 1);
296
  $two = (FALSE === $two ? 0 : count($two) + 1);
297
  if (!empty($protocol)) {
298
+ if (@$retval[$ndx] !== $val || $two >= $one)
 
299
  $retval[] = $val;
300
  }
301
  else {
302
+ if (@$retval[$ndx] !== $val && $two >= $one)
 
303
  $retval[] = $val;
304
  }
305
  }
359
  */
360
  function set_document_root($value)
361
  {
362
+ // Even for windows hosts we force '/' as the path separator
363
+ return $this->_document_root = untrailingslashit(str_replace('\\', '/', $value));
364
  }
365
  }
products/photocrati_nextgen/modules/fs/module.fs.php CHANGED
@@ -12,7 +12,7 @@ class M_Fs extends C_Base_Module
12
  'photocrati-fs',
13
  'Filesystem',
14
  'Provides a filesystem abstraction layer for Pope modules',
15
- '0.2',
16
  'http://www.photocrati.com',
17
  'Photocrati Media',
18
  'http://www.photocrati.com'
12
  'photocrati-fs',
13
  'Filesystem',
14
  'Provides a filesystem abstraction layer for Pope modules',
15
+ '0.1',
16
  'http://www.photocrati.com',
17
  'Photocrati Media',
18
  'http://www.photocrati.com'
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($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
  }
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
  }
products/photocrati_nextgen/modules/lightbox/class.lightbox_installer.php CHANGED
@@ -128,7 +128,7 @@ class C_Lightbox_Installer
128
  $this->install_lightbox(
129
  'highslide',
130
  'Highslide',
131
- 'class="highslide" onclick="return hs.expand(this, {slideshowGroup: ' . "'%GALLERY_NAME%'" . '});"',
132
  array('photocrati-lightbox#highslide/highslide.css'),
133
  array('photocrati-lightbox#highslide/highslide-full.packed.js', 'photocrati-lightbox#highslide/nextgen_highslide_init.js'),
134
  array('nextgen_highslide_graphics_dir' => $this->router->get_static_url('photocrati-lightbox#highslide/graphics'))
@@ -171,6 +171,6 @@ class C_Lightbox_Installer
171
  */
172
  function uninstall($hard = FALSE)
173
  {
174
- $this->mapper->delete()->run_query();
175
  }
176
  }
128
  $this->install_lightbox(
129
  'highslide',
130
  'Highslide',
131
+ 'class="highslide" onclick="return hs.expand(this, galleryOptions);"',
132
  array('photocrati-lightbox#highslide/highslide.css'),
133
  array('photocrati-lightbox#highslide/highslide-full.packed.js', 'photocrati-lightbox#highslide/nextgen_highslide_init.js'),
134
  array('nextgen_highslide_graphics_dir' => $this->router->get_static_url('photocrati-lightbox#highslide/graphics'))
171
  */
172
  function uninstall($hard = FALSE)
173
  {
174
+ if ($hard) $this->mapper->delete()->run_query();
175
  }
176
  }
products/photocrati_nextgen/modules/lightbox/class.lightbox_library.php CHANGED
@@ -11,23 +11,12 @@
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
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
products/photocrati_nextgen/modules/lightbox/module.lightbox.php CHANGED
@@ -12,15 +12,13 @@ define('NEXTGEN_LIGHTBOX_ADVANCED_OPTIONS_SLUG', 'ngg_lightbox_advanced_options'
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,152 +64,6 @@ class M_Lightbox extends C_Base_Module
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
  {
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.3',
22
  'http://leandrovieira.com/projects/jquery/lightbox/',
23
  'Photocrati Media',
24
  'http://www.photocrati.com'
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
  {
products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js CHANGED
@@ -1,15 +1,9 @@
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() {
9
- $('#fancybox-wrap').css('z-index', 10000);
10
- }
11
- });
12
- };
13
- $(this).bind('refreshed', nextgen_fancybox_init);
14
- nextgen_fancybox_init();
15
  });
1
  jQuery(function($) {
2
+ $(".ngg-fancybox").fancybox({
3
+ titlePosition: 'inside',
4
+ // Needed for twenty eleven
5
+ onComplete: function(){
6
+ $('#fancybox-wrap').css('z-index', 10000);
7
+ }
8
+ });
 
 
 
 
 
 
9
  });
products/photocrati_nextgen/modules/lightbox/static/highslide/nextgen_highslide_init.js CHANGED
@@ -1,45 +1,24 @@
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'];
16
- hs.dimmingOpacity = galleryOptions['dimmingOpacity'];
17
- hs.fadeInOut = galleryOptions['fadeInOut'];
18
- hs.marginBottom = galleryOptions['marginBottom'];
19
- hs.marginLeft = galleryOptions['marginLeft'];
20
- hs.numberPosition = galleryOptions['numberPosition'];
21
- hs.transitions = galleryOptions['transitions'];
22
- hs.showCredits = galleryOptions['showCredits'];
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
  });
 
1
  var galleryOptions = {
2
+ align: 'center',
3
+ dimmingOpacity: 0.8,
4
+ fadeInOut: true,
5
+ marginBottom: 80,
6
+ marginLeft: 100,
7
+ numberPosition: 'caption',
8
+ slideshowGroup: 'gallery',
9
+ transitions: ['expand', 'crossfade'],
10
+ wrapperClassName: 'dark borderless floating-caption'
 
11
  };
12
 
13
+ hs.graphicsDir = nextgen_highslide_graphics_dir + '/';
14
+ hs.addSlideshow({
15
+ fixedControls: true,
16
+ interval: 5000,
17
+ overlayOptions: {
18
+ hideOnMouseOut: true,
19
+ opacity: .6,
20
+ position: 'top center'
21
+ },
22
+ repeat: true,
23
+ useControls: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  });
products/photocrati_nextgen/modules/lightbox/static/jquery.lightbox/nextgen_lightbox_init.js CHANGED
@@ -5,10 +5,7 @@ jQuery(function($) {
5
  */
6
  function insert_code_in_another_methods_scope(scope, method_name, callback)
7
  {
8
- var do_that_name = 'e' + '' + ('v');
9
- do_that_name += 'a' + 'l';
10
- var do_that = window[do_that_name];
11
- var scope_code = do_that(scope).toString();
12
  var callback_code = callback.toString().replace(/[^\{]*{/, '').replace(/\}$/, '');
13
  var regex = new RegExp('(fu' + 'nc' + '' + 'tion '+method_name+'\\([^\\)]*\\)){');
14
  scope_code = scope_code.replace(regex, function(str, match){
@@ -16,8 +13,8 @@ jQuery(function($) {
16
  }).replace(/\$([\s\.\(=])/g, function(str, match){
17
  return 'jQuery'+match;
18
  });
19
- do_that(scope+" = "+scope_code);
20
- return do_that(scope);
21
  };
22
 
23
  // Adjusts the _resize_container_image_box() function to take into
@@ -45,18 +42,11 @@ jQuery(function($) {
45
  });
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,
55
- imageBtnNext: nextgen_lightbox_btn_next_url,
56
- imageBlank: nextgen_lightbox_blank_img_url
57
- });
58
- };
59
- $(this).bind('refreshed', nextgen_jquery_lightbox_init);
60
- nextgen_jquery_lightbox_init();
61
-
62
  });
5
  */
6
  function insert_code_in_another_methods_scope(scope, method_name, callback)
7
  {
8
+ var scope_code = eval(scope).toString();
 
 
 
9
  var callback_code = callback.toString().replace(/[^\{]*{/, '').replace(/\}$/, '');
10
  var regex = new RegExp('(fu' + 'nc' + '' + 'tion '+method_name+'\\([^\\)]*\\)){');
11
  scope_code = scope_code.replace(regex, function(str, match){
13
  }).replace(/\$([\s\.\(=])/g, function(str, match){
14
  return 'jQuery'+match;
15
  });
16
+ window.eval(scope+" = "+scope_code);
17
+ return eval(scope);
18
  };
19
 
20
  // Adjusts the _resize_container_image_box() function to take into
42
  });
43
  });
44
 
45
+ $('.ngg_lightbox').lightBox({
46
+ imageLoading: nextgen_lightbox_loading_img_url,
47
+ imageBtnClose: nextgen_lightbox_close_btn_url,
48
+ imageBtnPrev: nextgen_lightbox_btn_prev_url,
49
+ imageBtnNext: nextgen_lightbox_btn_next_url,
50
+ imageBlank: nextgen_lightbox_blank_img_url
51
+ });
 
 
 
 
 
 
 
52
  });
products/photocrati_nextgen/modules/lightbox/static/lightbox_context.js DELETED
@@ -1,27 +0,0 @@
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,8 +1,5 @@
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);
1
  jQuery(function($){
2
  var callback = function(){
 
 
 
3
  var shutterLinks = {}, shutterSets = {}; shutterReloaded.init();
4
  };
5
  $(this).bind('refreshed', callback);
products/photocrati_nextgen/modules/lightbox/static/shutter_reloaded/nextgen_shutter_reloaded.js CHANGED
@@ -1,8 +1,5 @@
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,4 +10,4 @@ jQuery(function($){
13
  else return;
14
 
15
  callback();
16
- });
1
  jQuery(function($){
2
  var callback = function(){
 
 
 
3
  var shutterLinks = {}, shutterSets = {}; shutterReloaded.Init();
4
  };
5
  $(this).bind('refreshed', callback);
10
  else return;
11
 
12
  callback();
13
+ });
products/photocrati_nextgen/modules/lightbox/static/thickbox/nextgen_thickbox_init.js CHANGED
@@ -1,6 +1,6 @@
1
  var thickboxL10n = {
2
- loadingAnimation: photocrati_ajax.wp_site_static_url + '/wp-includes/js/thickbox/loadingAnimation.gif',
3
- closeImage: photocrati_ajax.wp_site_static_url + '/wp-includes/js/thickbox/tb-close.png',
4
  next: 'Next &gt;',
5
  prev: '&lt; Prev',
6
  image: 'Image',
@@ -8,8 +8,3 @@ var thickboxL10n = {
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
- });
1
  var thickboxL10n = {
2
+ loadingAnimation: photocrati_ajax.wp_site_url + '/wp-includes/js/thickbox/loadingAnimation.gif',
3
+ closeImage: photocrati_ajax.wp_site_url + '/wp-includes/js/thickbox/tb-close.png',
4
  next: 'Next &gt;',
5
  prev: '&lt; Prev',
6
  image: 'Image',
8
  close: 'Close',
9
  noiframes: 'This feature requires inline frames. You have iframes disabled or your browser does not support them.'
10
  };
 
 
 
 
 
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', NULL, $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', json_decode($params), $mapper
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', $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', $mapper, json_decode($params)
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.2',
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.1',
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 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,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 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 ?>
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
  <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 ?>
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, '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,7 +18,7 @@
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>
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
  ?>
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>
products/photocrati_nextgen/modules/mvc/adapter.mvc_fs.php CHANGED
@@ -20,7 +20,7 @@ class A_MVC_Fs extends Mixin
20
  // Create the absolute path to the file
21
  $path = $fs->join_paths(
22
  $mod_dir,
23
- C_NextGen_Settings::get_instance()->get('mvc_static_dirname'),
24
  $path
25
  );
26
 
20
  // Create the absolute path to the file
21
  $path = $fs->join_paths(
22
  $mod_dir,
23
+ C_NextGen_Global_Settings::get_instance()->get('mvc_static_dirname'),
24
  $path
25
  );
26
 
products/photocrati_nextgen/modules/mvc/class.mvc_installer.php CHANGED
@@ -4,7 +4,7 @@ class C_MVC_Installer
4
  {
5
  function __construct()
6
  {
7
- $this->settings = C_NextGen_Settings::get_instance();
8
  }
9
 
10
  function install()
4
  {
5
  function __construct()
6
  {
7
+ $this->settings = C_NextGen_Global_Settings::get_instance();
8
  }
9
 
10
  function install()
products/photocrati_nextgen/modules/mvc/class.mvc_view.php CHANGED
@@ -230,7 +230,7 @@ class Mixin_Mvc_View_Instance_Methods extends Mixin
230
  function find_template_abspath($path, $module=FALSE)
231
  {
232
  $fs = $this->get_registry()->get_utility('I_Fs');
233
- $settings = C_NextGen_Settings::get_instance();
234
 
235
  // We also accept module_name#path, which needs parsing.
236
  if (!$module)
230
  function find_template_abspath($path, $module=FALSE)
231
  {
232
  $fs = $this->get_registry()->get_utility('I_Fs');
233
+ $settings = C_NextGen_Global_Settings::get_instance();
234
 
235
  // We also accept module_name#path, which needs parsing.
236
  if (!$module)
products/photocrati_nextgen/modules/mvc/module.mvc.php CHANGED
@@ -3,7 +3,7 @@
3
  /***
4
  {
5
  Module: photocrati-mvc,
6
- Depends: { photocrati-router, photocrati-nextgen_settings }
7
  }
8
  ***/
9
 
@@ -31,7 +31,7 @@ class M_MVC extends C_Base_Module
31
  C_Photocrati_Installer::add_handler($this->module_id, 'C_Mvc_Installer');
32
 
33
  include_once('class.mvc_option_handler.php');
34
- C_NextGen_Settings::add_option_handler('C_Mvc_Option_Handler', array(
35
  'mvc_template_dir'
36
  ));
37
  }
3
  /***
4
  {
5
  Module: photocrati-mvc,
6
+ Depends: { photocrati-router }
7
  }
8
  ***/
9
 
31
  C_Photocrati_Installer::add_handler($this->module_id, 'C_Mvc_Installer');
32
 
33
  include_once('class.mvc_option_handler.php');
34
+ C_NextGen_Global_Settings::add_option_handler('C_Mvc_Option_Handler', array(
35
  'mvc_template_dir'
36
  ));
37
  }
products/photocrati_nextgen/modules/mvc/template_helper.php CHANGED
@@ -23,17 +23,4 @@ if (strpos($_SERVER['REQUEST_URI'], 'adminer') === FALSE) {
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
- }
23
  echo h($str);
24
  }
25
  }
26
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/mvc/templates/index.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $settings = C_NextGen_Settings::get_instance();
3
  $obj = method_exists($this, 'get_class_definition_dir') ? $this : $this->object;
4
  $template_dir = path_join($obj->get_class_definition_dir(), 'templates');
5
  $default_template_dir = $settings->mvc_template_dir;
1
  <?php
2
+ $settings = C_NextGen_Global_Settings::get_instance();
3
  $obj = method_exists($this, 'get_class_definition_dir') ? $this : $this->object;
4
  $template_dir = path_join($obj->get_class_definition_dir(), 'templates');
5
  $default_template_dir = $settings->mvc_template_dir;
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_NggErrorException $ex) {
62
  $retval['error'] = $ex->getMessage();
63
  $error = TRUE;
64
  }
@@ -68,14 +68,14 @@ 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 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;
81
  }
@@ -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 = NEXTGEN_GALLERY_IMPORT_ROOT;
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($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,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 or ensuring that your user account has sufficient roles/privileges.";
122
  }
123
 
124
  return $retval;
@@ -132,27 +132,22 @@ 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 = 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;
58
  $error = TRUE;
59
  }
60
  }
61
+ catch (E_InsufficientWriteAccessException $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.";
74
  $error = TRUE;
75
+ }
76
 
77
+ if ($error) header('HTTP/1.1 400 Bad Request');
78
+ else $retval['gallery_name'] = $gallery_name;
79
 
80
  return $retval;
81
  }
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
  $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
  }
119
  }
120
  else {
121
+ $retval['error'] = "No permissions to browse folders. Try refreshing the page.";
122
  }
123
 
124
  return $retval;
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
+ $retval = $storage->import_gallery_from_fs($fs->join_paths($fs->get_document_root(), 'wp-content', $folder));
 
139
  if (!$retval) $retval = array('error' => "Could not import folder. No images found.");
140
  }
141
+ catch (Exception $ex) {
142
+ $retval['error'] = $ex->getMessage();
143
+ }
 
 
 
 
144
  }
145
  else {
146
  $retval['error'] = "No folder specified";
147
  }
148
  }
149
  else {
150
+ $retval['error'] = "No permissions to import folders. Try refreshing the page.";
151
  }
152
 
153
  return $retval;
products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.nextgen_addgallery_forms.php CHANGED
@@ -4,16 +4,18 @@ class A_NextGen_AddGallery_Forms extends Mixin
4
  {
5
  function initialize()
6
  {
7
- $settings = C_NextGen_Settings::get_instance();
8
- $registry = $this->object->get_registry();
9
-
10
- $forms = array('upload_images' => 'A_Upload_Images_Form');
11
- if (!is_multisite() || (is_multisite() && $settings->get('wpmuImportFolder')))
12
- $forms['import_folder'] = 'A_Import_Folder_Form';
13
 
 
14
  foreach ($forms as $form => $adapter) {
15
  $registry->add_adapter('I_Form', $adapter, $form);
16
- $this->object->add_form(NEXTGEN_ADD_GALLERY_SLUG, $form);
 
 
 
17
  }
18
  }
19
  }
4
  {
5
  function initialize()
6
  {
7
+ $forms = array(
8
+ 'upload_images' => 'A_Upload_Images_Form',
9
+ 'import_folder' => 'A_Import_Folder_Form'
10
+ );
 
 
11
 
12
+ $registry = $this->object->get_registry();
13
  foreach ($forms as $form => $adapter) {
14
  $registry->add_adapter('I_Form', $adapter, $form);
15
+ $this->object->add_form(
16
+ NEXTGEN_ADD_GALLERY_SLUG,
17
+ $form
18
+ );
19
  }
20
  }
21
  }
products/photocrati_nextgen/modules/nextgen_addgallery_page/adapter.upload_images_form.php CHANGED
@@ -47,14 +47,10 @@ class A_Upload_Images_Form extends Mixin
47
  $imgs->extensions = "jpg,jpeg,gif,png,JPG,JPEG,GIF,PNG";
48
  $retval[] = $imgs;
49
 
50
- $settings = C_NextGen_Settings::get_instance();
51
- if (!is_multisite() || (is_multisite() && $settings->get('wpmuZipUpload')))
52
- {
53
- $zips = new stdClass;
54
- $zips->title = "Zip files";
55
- $zips->extensions = "zip,ZIP";
56
- $retval[] = $zips;
57
- }
58
 
59
  return $retval;
60
  }
47
  $imgs->extensions = "jpg,jpeg,gif,png,JPG,JPEG,GIF,PNG";
48
  $retval[] = $imgs;
49
 
50
+ $zips = new stdClass;
51
+ $zips->title = "Zip files";
52
+ $zips->extensions = "zip,ZIP";
53
+ $retval[] = $zips;
 
 
 
 
54
 
55
  return $retval;
56
  }
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.3',
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.2',
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
@@ -2,7 +2,6 @@
2
  <div id="file_browser">
3
  </div>
4
  <p>
5
- <input type="checkbox" id="import_keep_location" name="keep_location" value="on" /> <label for="import_keep_location"> <?php esc_html_e('Keep images in original location.', 'nggallery'); ?> <span style="font-size: 85%"><?php esc_html_e('Caution: If you keep images in the original folder and later delete the gallery, the images in that folder might be deleted depending on your settings.', 'nggallery'); ?></span></label><br/><br/>
6
  <input type="button" id="import_button" name="import_folder" value="Import Folder" class="button-primary"/>
7
  </p>
8
  <script type="text/javascript">
@@ -44,19 +43,19 @@
44
  // Start importing process
45
  var post_params = {
46
  action: 'import_folder',
47
- folder: selected_folder,
48
- keep_location: $('#import_keep_location').is(":checked") ? 'on' : 'off'
49
  };
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
  });
62
- </script>
2
  <div id="file_browser">
3
  </div>
4
  <p>
 
5
  <input type="button" id="import_button" name="import_folder" value="Import Folder" class="button-primary"/>
6
  </p>
7
  <script type="text/javascript">
43
  // Start importing process
44
  var post_params = {
45
  action: 'import_folder',
46
+ folder: selected_folder
 
47
  };
48
  $.post(photocrati_ajax.url, post_params, function(response){
49
  if (typeof(response) != 'object') response = JSON.parse(response);
50
  if (typeof(response.error) == 'string') {
51
+ progress_bar.set("Error occurred");
52
+ alert(response.error);
53
  }
54
  else {
55
  progress_bar.set('Done! Successfully imported '+response.image_ids.length+' images.');
56
  }
57
+ progress_bar.close();
58
  });
59
  })
60
  });
61
+ </script>
products/photocrati_nextgen/modules/nextgen_addgallery_page/templates/upload_images.php CHANGED
@@ -159,21 +159,11 @@
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,40 +187,28 @@
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);
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
  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);
products/photocrati_nextgen/modules/nextgen_admin/class.form.php CHANGED
@@ -210,26 +210,14 @@ class Mixin_Form_Field_Generators extends Mixin
210
  True
211
  );
212
  }
213
-
214
- function _render_ajax_pagination_field($display_type)
215
- {
216
- return $this->object->_render_radio_field(
217
- $display_type,
218
- 'ajax_pagination',
219
- _('Enable AJAX pagination'),
220
- isset($display_type->settings['ajax_pagination']) ? $display_type->settings['ajax_pagination'] : FALSE
221
- );
222
- }
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,9 +227,9 @@ class Mixin_Form_Field_Generators extends Mixin
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,27 +242,27 @@ class Mixin_Form_Field_Generators extends Mixin
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,13 +279,11 @@ class Mixin_Form_Field_Generators extends Mixin
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,7 +296,7 @@ class Mixin_Form_Field_Generators extends Mixin
310
  $qualities,
311
  $display_type->settings['image_quality'],
312
  '',
313
- $hidden
314
  );
315
 
316
  $crop_field = $this->_render_radio_field(
@@ -319,7 +305,7 @@ class Mixin_Form_Field_Generators extends Mixin
319
  'Image crop',
320
  $display_type->settings['image_crop'],
321
  '',
322
- $hidden
323
  );
324
 
325
  $watermark_field = $this->_render_radio_field(
@@ -328,7 +314,7 @@ class Mixin_Form_Field_Generators extends Mixin
328
  'Image watermark',
329
  $display_type->settings['image_watermark'],
330
  '',
331
- $hidden
332
  );
333
 
334
  $everything = $override_field . $quality_field . $crop_field . $watermark_field;
210
  True
211
  );
212
  }
 
 
 
 
 
 
 
 
 
 
213
 
214
  function _render_thumbnail_override_settings_field($display_type)
215
  {
 
 
216
  $override_field = $this->_render_radio_field(
217
  $display_type,
218
  'override_thumbnail_settings',
219
  'Override thumbnail settings',
220
+ $display_type->settings['override_thumbnail_settings'],
221
  "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."
222
  );
223
 
227
  'display_type_name' => $display_type->name,
228
  'name' => 'thumbnail_dimensions',
229
  'label'=> _('Thumbnail dimensions'),
230
+ 'thumbnail_width' => $display_type->settings['thumbnail_width'],
231
+ 'thumbnail_height'=> $display_type->settings['thumbnail_height'],
232
+ 'hidden' => empty($display_type->settings['override_thumbnail_settings']) ? 'hidden' : '',
233
  'text' => ''
234
  ),
235
  TRUE
242
  'thumbnail_quality',
243
  'Thumbnail quality',
244
  $qualities,
245
+ $display_type->settings['thumbnail_quality'],
246
  '',
247
+ empty($display_type->settings['override_thumbnail_settings']) ? TRUE : FALSE
248
  );
249
 
250
  $crop_field = $this->_render_radio_field(
251
  $display_type,
252
  'thumbnail_crop',
253
  'Thumbnail crop',
254
+ $display_type->settings['thumbnail_crop'],
255
  '',
256
+ empty($display_type->settings['override_thumbnail_settings']) ? TRUE : FALSE
257
  );
258
 
259
  $watermark_field = $this->_render_radio_field(
260
  $display_type,
261
  'thumbnail_watermark',
262
  'Thumbnail watermark',
263
+ $display_type->settings['thumbnail_watermark'],
264
  '',
265
+ empty($display_type->settings['override_thumbnail_settings']) ? TRUE : FALSE
266
  );
267
 
268
  $everything = $override_field . $dimensions_field . $quality_field . $crop_field . $watermark_field;
279
  */
280
  function _render_image_override_settings_field($display_type)
281
  {
 
 
282
  $override_field = $this->_render_radio_field(
283
  $display_type,
284
  'override_image_settings',
285
  'Override image settings',
286
+ $display_type->settings['override_image_settings'],
287
  'Overriding the image settings will create an additional set of images'
288
  );
289
 
296
  $qualities,
297
  $display_type->settings['image_quality'],
298
  '',
299
+ empty($display_type->settings['override_image_settings']) ? TRUE : FALSE
300
  );
301
 
302
  $crop_field = $this->_render_radio_field(
305
  'Image crop',
306
  $display_type->settings['image_crop'],
307
  '',
308
+ empty($display_type->settings['override_image_settings']) ? TRUE : FALSE
309
  );
310
 
311
  $watermark_field = $this->_render_radio_field(
314
  'Image watermark',
315
  $display_type->settings['image_watermark'],
316
  '',
317
+ empty($display_type->settings['override_image_settings']) ? TRUE : FALSE
318
  );
319
 
320
  $everything = $override_field . $quality_field . $crop_field . $watermark_field;
products/photocrati_nextgen/modules/nextgen_admin/class.nextgen_admin_installer.php CHANGED
@@ -8,7 +8,7 @@ class C_NextGen_Admin_Installer
8
  // were statically set rather than dynamically using a handler. Therefore, we need
9
  // to delete those static values
10
  $module_name = 'photocrati-nextgen_admin';
11
- $settings = C_NextGen_Settings::get_instance();
12
  $modules = $settings->pope_module_list;
13
  $cleanup = FALSE;
14
  if (!isset($modules[$module_name])) $cleanup = FALSE;
8
  // were statically set rather than dynamically using a handler. Therefore, we need
9
  // to delete those static values
10
  $module_name = 'photocrati-nextgen_admin';
11
+ $settings = C_NextGen_Global_Settings::get_instance();
12
  $modules = $settings->pope_module_list;
13
  $cleanup = FALSE;
14
  if (!isset($modules[$module_name])) $cleanup = FALSE;
products/photocrati_nextgen/modules/nextgen_admin/class.nextgen_admin_page_controller.php CHANGED
@@ -82,8 +82,6 @@ class Mixin_NextGen_Admin_Page_Instance_Methods extends Mixin
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,20 +114,11 @@ class Mixin_NextGen_Admin_Page_Instance_Methods extends Mixin
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()
131
  {
132
- $settings = C_NextGen_Settings::get_instance();
133
  wp_enqueue_style(
134
  $settings->jquery_ui_theme,
135
  is_ssl() ?
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
  // Ensure select2
115
  wp_enqueue_style('select2');
116
  wp_enqueue_script('select2');
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  function enqueue_jquery_ui_theme()
120
  {
121
+ $settings = C_NextGen_Global_Settings::get_instance();
122
  wp_enqueue_style(
123
  $settings->jquery_ui_theme,
124
  is_ssl() ?
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.5',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
@@ -29,7 +29,7 @@ class M_NextGen_Admin extends C_Base_Module
29
  C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Admin_Installer');
30
 
31
  include_once('class.nextgen_admin_option_handler.php');
32
- C_NextGen_Settings::add_option_handler('C_NextGen_Admin_Option_Handler', array(
33
  'jquery_ui_theme',
34
  'jquery_ui_theme_version',
35
  'jquery_ui_theme_url'
@@ -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'), 9);
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.4',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
29
  C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Admin_Installer');
30
 
31
  include_once('class.nextgen_admin_option_handler.php');
32
+ C_NextGen_Global_Settings::add_option_handler('C_NextGen_Admin_Option_Handler', array(
33
  'jquery_ui_theme',
34
  'jquery_ui_theme_version',
35
  'jquery_ui_theme_url'
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);
products/photocrati_nextgen/modules/nextgen_admin/templates/field_generator/nextgen_settings_field_color.php CHANGED
@@ -11,6 +11,7 @@
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>
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>
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 nextgen_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 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,21 +27,19 @@ 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 = $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(
@@ -59,14 +57,11 @@ class A_NextGen_Basic_Album_Controller extends Mixin
59
  else if (($album = $this->param('album'))) {
60
 
61
  // Are we to display a sub-album?
 
62
  {
63
  $mapper = $this->object->get_registry()->get_utility('I_Album_Mapper');
64
  $result = array_pop($mapper->select()->where(array('slug = %s', $album))->limit(1)->run_query());
65
- $album_sub = $result ? $result->{$result->id_field} : null;
66
-
67
- if ($album_sub != null) {
68
- $album = $album_sub;
69
- }
70
  }
71
  $displayed_gallery->entity_ids = array();
72
  $displayed_gallery->sortorder = array();
@@ -108,7 +103,6 @@ class A_NextGen_Basic_Album_Controller extends Mixin
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);
@@ -156,53 +150,32 @@ class A_NextGen_Basic_Album_Controller extends Mixin
156
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
157
  $image_gen = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
158
 
159
- if (empty($displayed_gallery->display_settings['override_thumbnail_settings']))
160
- {
161
- // legacy templates expect these dimensions
162
- $image_gen_params = array(
163
- 'width' => 91,
164
- 'height' => 68,
165
- 'crop' => TRUE
166
- );
167
- }
168
- else {
169
- // use settings requested by user
170
- $image_gen_params = array(
171
- 'width' => $displayed_gallery->display_settings['thumbnail_width'],
172
- 'height' => $displayed_gallery->display_settings['thumbnail_height'],
173
- 'quality' => $displayed_gallery->display_settings['thumbnail_quality'],
174
- 'crop' => $displayed_gallery->display_settings['thumbnail_crop'],
175
- 'watermark' => $displayed_gallery->display_settings['thumbnail_watermark']
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']);
185
-
186
  foreach ($params['galleries'] as &$gallery) {
187
 
188
  // Get the preview image url
189
- $gallery->previewurl = '';
190
- if ($gallery->previewpic && $gallery->previewpic > 0)
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
  }
198
 
199
  // Get the page link. If the entity is an album, then the url will
200
  // look like /nggallery/album--slug.
201
  $id_field = $gallery->id_field;
202
- if ($gallery->is_album)
203
- {
204
- if ($gallery->pageid > 0)
205
- $gallery->pagelink = get_post_permalink($gallery->pageid);
206
  else {
207
  $gallery->pagelink = $this->object->set_param_for(
208
  $this->object->get_routed_url(TRUE),
@@ -215,10 +188,8 @@ class A_NextGen_Basic_Album_Controller extends Mixin
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) {
@@ -230,12 +201,9 @@ class A_NextGen_Basic_Album_Controller extends Mixin
230
  }
231
  // Legacy compat: use an album slug of 'all' if we're missing a container_id
232
  else if($displayed_gallery->container_ids === array('0')
233
- || $displayed_gallery->container_ids === array('')) {
234
  $pagelink = $this->object->set_param_for($pagelink, 'album', 'all');
235
  }
236
- else {
237
- $pagelink = $this->object->set_param_for($pagelink, 'album', 'album');
238
- }
239
  $gallery->pagelink = $this->object->set_param_for(
240
  $pagelink,
241
  'gallery',
@@ -247,8 +215,7 @@ class A_NextGen_Basic_Album_Controller extends Mixin
247
  // The router by default will generate param segments that look like,
248
  // /gallery--foobar. We need to convert these to the admittingly
249
  // nicer links that ngglegacy uses
250
- if ($gallery->pageid <= 0)
251
- $gallery->pagelink = $this->object->prettify_pagelink($gallery->pagelink);
252
 
253
  // Let plugins modify the gallery
254
  $gallery = apply_filters('ngg_album_galleryobject', $gallery);
@@ -266,19 +233,16 @@ class A_NextGen_Basic_Album_Controller extends Mixin
266
 
267
  function prettify_pagelink($pagelink)
268
  {
269
- $param_separator = C_NextGen_Settings::get_instance()->get('router_param_separator');
270
-
271
  $regex = implode('', array(
272
  '#',
273
  '/(gallery|album)',
274
- preg_quote($param_separator, '#'),
275
  '([^/?]+)',
276
  '#'
277
  ));
278
-
279
- $pagelink = preg_replace($regex, '/\2', $pagelink);
280
-
281
- return $pagelink;
282
  }
283
 
284
 
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(
57
  else if (($album = $this->param('album'))) {
58
 
59
  // Are we to display a sub-album?
60
+ if (!is_numeric($album))
61
  {
62
  $mapper = $this->object->get_registry()->get_utility('I_Album_Mapper');
63
  $result = array_pop($mapper->select()->where(array('slug = %s', $album))->limit(1)->run_query());
64
+ $album = $result->{$result->id_field};
 
 
 
 
65
  }
66
  $displayed_gallery->entity_ids = array();
67
  $displayed_gallery->sortorder = array();
103
  else {
104
  $params = $display_settings;
105
  $albums = $this->prepare_legacy_album_params($displayed_gallery->get_entity(), array('entities' => $entities));;
 
106
  $params['galleries'] = $albums['galleries'];
107
  $params['displayed_gallery'] = $displayed_gallery;
108
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
150
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
151
  $image_gen = $this->object->get_registry()->get_utility('I_Dynamic_Thumbnails_Manager');
152
 
153
+ // legacy templates expect these dimensions
154
+ $image_gen_params = array(
155
+ 'width' => 91,
156
+ 'height' => 68,
157
+ 'crop' => TRUE
158
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
  // Transform entities
161
+ $params['galleries'] = $params['entities'];
162
  unset($params['entities']);
 
163
  foreach ($params['galleries'] as &$gallery) {
164
 
165
  // Get the preview image url
166
+ $gallery->previewurl = '';
167
+ if ($gallery->previewpic && $gallery->previewpic > 0) {
168
+ if (($image = $image_mapper->find(intval($gallery->previewpic)))) {
169
+ $gallery->previewurl = $storage->get_image_url($image, $image_gen->get_size_name($image_gen_params));
170
+ $gallery->previewname = $gallery->name;
 
 
171
  }
172
  }
173
 
174
  // Get the page link. If the entity is an album, then the url will
175
  // look like /nggallery/album--slug.
176
  $id_field = $gallery->id_field;
177
+ if ($gallery->is_album) {
178
+ if ($gallery->pageid > 0) $gallery->pagelink = get_post_permalink($gallery->pageid);
 
 
179
  else {
180
  $gallery->pagelink = $this->object->set_param_for(
181
  $this->object->get_routed_url(TRUE),
188
  // Otherwise, if it's a gallery then it will look like
189
  // /nggallery/album--slug/gallery--slug
190
  else {
191
+ if ($gallery->pageid > 0) $gallery->pagelink = get_post_permalink($gallery->pageid);
192
+ else {
 
 
193
  $pagelink = $this->object->get_routed_url(TRUE);
194
  $parent_album = $this->object->get_parent_album_for($gallery->$id_field);
195
  if ($parent_album) {
201
  }
202
  // Legacy compat: use an album slug of 'all' if we're missing a container_id
203
  else if($displayed_gallery->container_ids === array('0')
204
+ || $displayed_gallery->container_ids === array('')) {
205
  $pagelink = $this->object->set_param_for($pagelink, 'album', 'all');
206
  }
 
 
 
207
  $gallery->pagelink = $this->object->set_param_for(
208
  $pagelink,
209
  'gallery',
215
  // The router by default will generate param segments that look like,
216
  // /gallery--foobar. We need to convert these to the admittingly
217
  // nicer links that ngglegacy uses
218
+ if ($gallery->pageid <= 0) $gallery->pagelink = $this->object->prettify_pagelink($gallery->pagelink);
 
219
 
220
  // Let plugins modify the gallery
221
  $gallery = apply_filters('ngg_album_galleryobject', $gallery);
233
 
234
  function prettify_pagelink($pagelink)
235
  {
236
+ $param_separator = C_NextGen_Global_Settings::get_instance()->get('router_param_separator');
 
237
  $regex = implode('', array(
238
  '#',
239
  '/(gallery|album)',
240
+ preg_quote($param_separator),
241
  '([^/?]+)',
242
  '#'
243
  ));
244
+
245
+ return preg_replace($regex, '/\2', $pagelink);
 
 
246
  }
247
 
248
 
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 (isset($entity->name) && in_array($entity->name, array(
25
  NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM,
26
  NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM))) {
27
 
@@ -30,18 +30,6 @@ class Hook_NextGen_Basic_Album_Defaults extends Hook
30
  $this->object->_set_default_value($entity, 'settings', 'galleries_per_page', $settings->galPagedGalleries);
31
  $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
32
  $this->object->_set_default_value($entity, 'settings', 'template', '');
33
-
34
- // Thumbnail dimensions -- only used by extended albums
35
- if ($entity->name == NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM)
36
- {
37
- $this->_set_default_value($entity, 'settings', 'override_thumbnail_settings', 0);
38
- $this->_set_default_value($entity, 'settings', 'thumbnail_width', $settings->thumbwidth);
39
- $this->_set_default_value($entity, 'settings', 'thumbnail_height', $settings->thumbheight);
40
- $this->_set_default_value($entity, 'settings', 'thumbnail_quality', $settings->thumbquality);
41
- $this->_set_default_value($entity, 'settings', 'thumbnail_crop', $settings->thumbfix);
42
- $this->_set_default_value($entity, 'settings', 'thumbnail_watermark', 0);
43
- }
44
-
45
  if (defined('NEXTGEN_GALLERY_BASIC_THUMBNAILS'))
46
  $this->object->_set_default_value($entity, 'settings', 'gallery_display_type', NEXTGEN_GALLERY_BASIC_THUMBNAILS);
47
  }
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
 
30
  $this->object->_set_default_value($entity, 'settings', 'galleries_per_page', $settings->galPagedGalleries);
31
  $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
32
  $this->object->_set_default_value($entity, 'settings', 'template', '');
 
 
 
 
 
 
 
 
 
 
 
 
33
  if (defined('NEXTGEN_GALLERY_BASIC_THUMBNAILS'))
34
  $this->object->_set_default_value($entity, 'settings', 'gallery_display_type', NEXTGEN_GALLERY_BASIC_THUMBNAILS);
35
  }
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_album_routes.php CHANGED
@@ -22,21 +22,20 @@ 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}/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
22
  // Get router
23
  $router = $this->get_registry()->get_utility('I_Router');
24
  $app = $router->get_routed_app();
25
+ $slug = C_NextGen_Global_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
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_compact_album_form.php CHANGED
@@ -6,30 +6,4 @@ class A_NextGen_Basic_Compact_Album_Form extends Mixin_NextGen_Basic_Album_Form
6
  {
7
  return NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM;
8
  }
9
-
10
- /**
11
- * Returns a list of fields to render on the settings page
12
- */
13
- function _get_field_names()
14
- {
15
- $fields = parent::_get_field_names();
16
- $fields[] = 'thumbnail_override_settings';
17
- return $fields;
18
- }
19
-
20
- /**
21
- * Enqueues static resources required by this form
22
- */
23
- function enqueue_static_resources()
24
- {
25
- wp_enqueue_script(
26
- 'nextgen_basic_compact_albums_settings_script',
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
- }
6
  {
7
  return NEXTGEN_GALLERY_NEXTGEN_BASIC_COMPACT_ALBUM;
8
  }
9
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_basic_album/adapter.nextgen_basic_extended_album_form.php CHANGED
@@ -6,30 +6,4 @@ class A_NextGen_Basic_Extended_Album_Form extends Mixin_NextGen_Basic_Album_Form
6
  {
7
  return NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM;
8
  }
9
-
10
- /**
11
- * Returns a list of fields to render on the settings page
12
- */
13
- function _get_field_names()
14
- {
15
- $fields = parent::_get_field_names();
16
- $fields[] = 'thumbnail_override_settings';
17
- return $fields;
18
- }
19
-
20
- /**
21
- * Enqueues static resources required by this form
22
- */
23
- function enqueue_static_resources()
24
- {
25
- wp_enqueue_script(
26
- 'nextgen_basic_extended_albums_settings_script',
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
  }
6
  {
7
  return NEXTGEN_GALLERY_NEXTGEN_BASIC_EXTENDED_ALBUM;
8
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
products/photocrati_nextgen/modules/nextgen_basic_album/mixin.nextgen_basic_album_form.php CHANGED
@@ -6,6 +6,7 @@ class Mixin_NextGen_Basic_Album_Form extends Mixin_Display_Type_Form
6
  {
7
  return array(
8
  'nextgen_basic_album_gallery_display_type',
 
9
  'nextgen_basic_templates_template',
10
  );
11
  }
6
  {
7
  return array(
8
  'nextgen_basic_album_gallery_display_type',
9
+ // 'nextgen_basic_album_galleries_per_page',
10
  'nextgen_basic_templates_template',
11
  );
12
  }
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.5',
22
  'http://nextgen-gallery.com',
23
  'Photocrati Media',
24
  'http://www.photocrati.com'
@@ -60,19 +60,17 @@ class M_NextGen_Basic_Album extends C_Base_Module
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,18 +78,16 @@ class M_NextGen_Basic_Album extends C_Base_Module
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()
92
  {
93
- C_NextGen_Shortcode_Manager::add('album', array(&$this, 'ngglegacy_shortcode'));
94
- C_NextGen_Shortcode_Manager::add('nggalbum', array(&$this, 'ngglegacy_shortcode'));
95
  }
96
 
97
  /**
18
  'photocrati-nextgen_basic_album',
19
  'NextGEN Basic Album',
20
  "Provides support for NextGEN's Basic Album",
21
+ NEXTGEN_GALLERY_PLUGIN_VERSION,
22
  'http://nextgen-gallery.com',
23
  'Photocrati Media',
24
  'http://www.photocrati.com'
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
  '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()
88
  {
89
+ add_shortcode('album', array(&$this, 'ngglegacy_shortcode'));
90
+ add_shortcode('nggalbum', array(&$this, 'ngglegacy_shortcode'));
91
  }
92
 
93
  /**
products/photocrati_nextgen/modules/nextgen_basic_album/static/compact_settings.js DELETED
@@ -1,7 +0,0 @@
1
- jQuery(function($){
2
- $('input[name="photocrati-nextgen_basic_compact_album[override_thumbnail_settings]"]')
3
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_compact_album_thumbnail_dimensions'))
4
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_compact_album_thumbnail_quality'))
5
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_compact_album_thumbnail_crop'))
6
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_compact_album_thumbnail_watermark'));
7
- });
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_basic_album/static/extended_settings.js DELETED
@@ -1,7 +0,0 @@
1
- jQuery(function($){
2
- $('input[name="photocrati-nextgen_basic_extended_album[override_thumbnail_settings]"]')
3
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_extended_album_thumbnail_dimensions'))
4
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_extended_album_thumbnail_quality'))
5
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_extended_album_thumbnail_crop'))
6
- .nextgen_radio_toggle_tr('1', $('#tr_photocrati-nextgen_basic_extended_album_thumbnail_watermark'));
7
- });
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_basic_album/static/nextgen_basic_album.css CHANGED
@@ -49,61 +49,36 @@
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 {
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 {
products/photocrati_nextgen/modules/nextgen_basic_album/templates/compact.php CHANGED
@@ -4,25 +4,18 @@
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>
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>
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 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 } ?>
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 } ?>
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.ajax_pagination_actions.php CHANGED
@@ -11,9 +11,8 @@ 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', 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');
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
 
17
  // render the displayed gallery
18
  $this->renderer = $this->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_mapper.php CHANGED
@@ -19,13 +19,11 @@ class Hook_NextGen_Basic_Gallery_Defaults extends Hook
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)
@@ -73,9 +71,7 @@ class Hook_NextGen_Basic_Gallery_Defaults extends Hook
73
  $this->object->_set_default_value($entity, 'settings', 'thumbnail_height', $settings->thumbheight);
74
  $this->object->_set_default_value($entity, 'settings', 'show_all_in_lightbox', $settings->galHiddenImg);
75
  $this->object->_set_default_value($entity, 'settings', 'ajax_pagination', $settings->galAjaxNav);
76
- $this->object->_set_default_value($entity, 'settings', 'use_imagebrowser_effect', $settings->galImgBrowser);
77
  $this->object->_set_default_value($entity, 'settings', 'template', '');
78
- $this->object->_set_default_value($entity, 'settings', 'display_no_images_error', 1);
79
 
80
  // TODO: Should this be called enable pagination?
81
  $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
@@ -101,4 +97,4 @@ class Hook_NextGen_Basic_Gallery_Defaults extends Hook
101
  // Part of the pro-modules
102
  $this->object->_set_default_value($entity, 'settings', 'ngg_triggers_display', 'never');
103
  }
104
- }
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)
71
  $this->object->_set_default_value($entity, 'settings', 'thumbnail_height', $settings->thumbheight);
72
  $this->object->_set_default_value($entity, 'settings', 'show_all_in_lightbox', $settings->galHiddenImg);
73
  $this->object->_set_default_value($entity, 'settings', 'ajax_pagination', $settings->galAjaxNav);
 
74
  $this->object->_set_default_value($entity, 'settings', 'template', '');
 
75
 
76
  // TODO: Should this be called enable pagination?
77
  $this->object->_set_default_value($entity, 'settings', 'disable_pagination', 0);
97
  // Part of the pro-modules
98
  $this->object->_set_default_value($entity, 'settings', 'ngg_triggers_display', 'never');
99
  }
100
+ }
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/{*}", "{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
  }
14
 
15
  function add_nextgen_basic_gallery_routes()
16
  {
17
+ $slug = C_NextGen_Global_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
  }
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_gallery_urls.php CHANGED
@@ -25,7 +25,6 @@ class A_NextGen_Basic_Gallery_Urls extends Mixin
25
  if ($key == 'show') {
26
  if ($value == NEXTGEN_GALLERY_BASIC_SLIDESHOW) $value = 'slideshow';
27
  elseif ($value == NEXTGEN_GALLERY_BASIC_THUMBNAILS) $value = 'thumbnails';
28
- elseif ($value == NEXTGEN_GALLERY_NEXTGEN_BASIC_IMAGEBROWSER) $value = 'imagebrowser';
29
  return '/'.$value;
30
  }
31
  elseif ($key == 'page') {
@@ -58,7 +57,7 @@ class A_NextGen_Basic_Gallery_Urls extends Mixin
58
  );
59
 
60
  // Get the settings manager
61
- $settings = C_NextGen_Settings::get_instance();
62
 
63
  // Create the regex pattern
64
  $sep = preg_quote($settings->router_param_separator, '#');
25
  if ($key == 'show') {
26
  if ($value == NEXTGEN_GALLERY_BASIC_SLIDESHOW) $value = 'slideshow';
27
  elseif ($value == NEXTGEN_GALLERY_BASIC_THUMBNAILS) $value = 'thumbnails';
 
28
  return '/'.$value;
29
  }
30
  elseif ($key == 'page') {
57
  );
58
 
59
  // Get the settings manager
60
+ $settings = C_NextGen_Global_Settings::get_instance();
61
 
62
  // Create the regex pattern
63
  $sep = preg_quote($settings->router_param_separator, '#');
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_controller.php CHANGED
@@ -12,7 +12,6 @@ class A_NextGen_Basic_Slideshow_Controller extends Mixin_NextGen_Basic_Gallery_C
12
  // Get the images to be displayed
13
  $current_page = (int)$this->param('page', 1);
14
 
15
- // TODO: Shouldn't we be using maximum_entity_count instead?
16
  $limit = FALSE;
17
  if (in_array($displayed_gallery->source, array('random_images', 'recent_images')))
18
  $limit = $displayed_gallery->display_settings['images_per_page'];
@@ -40,7 +39,7 @@ class A_NextGen_Basic_Slideshow_Controller extends Mixin_NextGen_Basic_Gallery_C
40
  if ($displayed_gallery->display_settings['flash_enabled'])
41
  {
42
  include_once(path_join(NGGALLERY_ABSPATH, implode(DIRECTORY_SEPARATOR, array('lib', 'swfobject.php'))));
43
- $transient_id = $displayed_gallery->transient_id;
44
  $params['mediarss_link'] = $this->get_router()->get_url(
45
  '/nextgen-mediarss?template=playlist_feed&source=displayed_gallery&transient_id=' . $transient_id, false
46
  );
@@ -53,7 +52,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
  }
12
  // Get the images to be displayed
13
  $current_page = (int)$this->param('page', 1);
14
 
 
15
  $limit = FALSE;
16
  if (in_array($displayed_gallery->source, array('random_images', 'recent_images')))
17
  $limit = $displayed_gallery->display_settings['images_per_page'];
39
  if ($displayed_gallery->display_settings['flash_enabled'])
40
  {
41
  include_once(path_join(NGGALLERY_ABSPATH, implode(DIRECTORY_SEPARATOR, array('lib', 'swfobject.php'))));
42
+ $transient_id = $displayed_gallery->to_transient();
43
  $params['mediarss_link'] = $this->get_router()->get_url(
44
  '/nextgen-mediarss?template=playlist_feed&source=displayed_gallery&transient_id=' . $transient_id, false
45
  );
52
  );
53
  }
54
 
55
+ $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
56
 
57
  $retval = $this->object->render_partial('photocrati-nextgen_basic_gallery#slideshow/index', $params, $return);
58
  }
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_slideshow_form.php CHANGED
@@ -17,10 +17,6 @@ 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
- if ($atp != null) {
23
- $atp->mark_script('nextgen_basic_slideshow_settings-js');
24
  }
25
 
26
  /**
@@ -107,7 +103,7 @@ class A_NextGen_Basic_Slideshow_Form extends Mixin_Display_Type_Form
107
  {
108
  return $this->render_partial('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow_settings_gallery_dimensions', array(
109
  'display_type_name' => $display_type->name,
110
- 'gallery_dimensions_label' => _('Maximum dimensions'),
111
  'gallery_width' => $display_type->settings['gallery_width'],
112
  'gallery_height' => $display_type->settings['gallery_height'],
113
  ), True);
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
  /**
103
  {
104
  return $this->render_partial('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow_settings_gallery_dimensions', array(
105
  'display_type_name' => $display_type->name,
106
+ 'gallery_dimensions_label' => _('Maximum Dimensions'),
107
  'gallery_width' => $display_type->settings['gallery_width'],
108
  'gallery_height' => $display_type->settings['gallery_height'],
109
  ), True);
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnail_form.php CHANGED
@@ -23,10 +23,6 @@ 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
- if ($atp != null) {
29
- $atp->mark_script('nextgen_basic_thumbnails_settings');
30
  }
31
 
32
  /**
@@ -40,7 +36,6 @@ class A_NextGen_Basic_Thumbnail_Form extends Mixin_Display_Type_Form
40
  'nextgen_basic_thumbnails_number_of_columns',
41
  'nextgen_basic_thumbnails_ajax_pagination',
42
  'nextgen_basic_thumbnails_hidden',
43
- 'nextgen_basic_thumbnails_imagebrowser_effect',
44
  'nextgen_basic_thumbnails_show_piclens_link',
45
  'nextgen_basic_thumbnails_piclens_link_text',
46
  'nextgen_basic_thumbnails_show_slideshow_link',
@@ -140,17 +135,6 @@ class A_NextGen_Basic_Thumbnail_Form extends Mixin_Display_Type_Form
140
  );
141
  }
142
 
143
- function _render_nextgen_basic_thumbnails_imagebrowser_effect_field($display_type)
144
- {
145
- return $this->_render_radio_field(
146
- $display_type,
147
- 'use_imagebrowser_effect',
148
- 'Use imagebrowser effect',
149
- $display_type->settings['use_imagebrowser_effect'],
150
- 'When active each image in the gallery will link to an imagebrowser display and lightbox effects will not be applied.'
151
- );
152
- }
153
-
154
  /**
155
  * Renders the show_piclens_link settings field
156
  *
@@ -162,7 +146,7 @@ class A_NextGen_Basic_Thumbnail_Form extends Mixin_Display_Type_Form
162
  return $this->_render_radio_field(
163
  $display_type,
164
  'ajax_pagination',
165
- 'Enable AJAX pagination',
166
  $display_type->settings['ajax_pagination'],
167
  'Browse images without reloading the page.'
168
  );
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
  /**
36
  'nextgen_basic_thumbnails_number_of_columns',
37
  'nextgen_basic_thumbnails_ajax_pagination',
38
  'nextgen_basic_thumbnails_hidden',
 
39
  'nextgen_basic_thumbnails_show_piclens_link',
40
  'nextgen_basic_thumbnails_piclens_link_text',
41
  'nextgen_basic_thumbnails_show_slideshow_link',
135
  );
136
  }
137
 
 
 
 
 
 
 
 
 
 
 
 
138
  /**
139
  * Renders the show_piclens_link settings field
140
  *
146
  return $this->_render_radio_field(
147
  $display_type,
148
  'ajax_pagination',
149
+ 'Enable Ajax pagination',
150
  $display_type->settings['ajax_pagination'],
151
  'Browse images without reloading the page.'
152
  );
products/photocrati_nextgen/modules/nextgen_basic_gallery/adapter.nextgen_basic_thumbnails_controller.php CHANGED
@@ -19,21 +19,16 @@ 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
- $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);
31
  else
32
  $current_page = 1;
33
 
34
  $offset = $display_settings['images_per_page'] * ($current_page - 1);
35
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
36
  $total = $displayed_gallery->get_entity_count();
 
37
 
38
  // Get the images to be displayed
39
  if ($display_settings['images_per_page'] > 0 && $display_settings['show_all_in_lightbox'])
@@ -81,6 +76,9 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
81
  list($pagination_prev, $pagination_next, $pagination) = array(NULL, NULL, NULL);
82
  }
83
 
 
 
 
84
  $thumbnail_size_name = 'thumbnail';
85
 
86
  if ($display_settings['override_thumbnail_settings'])
@@ -116,31 +114,12 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
116
 
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
  );
126
  }
127
 
128
- // This setting 1) points all images to an imagebrowser display & 2) disables the lightbox effect
129
- if ($display_settings['use_imagebrowser_effect'])
130
- {
131
- // this hook *MUST* be removed later; it should not apply to galleries that may come after this one!
132
- $storage->add_post_hook(
133
- 'get_image_url',
134
- 'imagebrowser alternate url replacer',
135
- 'Hook_NextGen_Basic_Imagebrowser_Alt_URLs',
136
- 'get_image_url'
137
- );
138
- $effect_code = '';
139
- }
140
- else {
141
- $effect_code = $this->object->get_effect_code($displayed_gallery);
142
- }
143
-
144
  // The render functions require different processing
145
  if (!empty($display_settings['template']))
146
  {
@@ -153,11 +132,13 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
153
  'next' => (empty($pagination_next)) ? FALSE : $pagination_next,
154
  'prev' => (empty($pagination_prev)) ? FALSE : $pagination_prev,
155
  'pagination' => $pagination,
156
- 'piclens_link' => $piclens_link,
157
- 'slideshow_link' => $slideshow_link
 
 
158
  )
159
  );
160
- $output = $this->object->legacy_render($display_settings['template'], $params, $return, 'gallery');
161
  }
162
  else {
163
  $params = $display_settings;
@@ -167,23 +148,17 @@ class A_NextGen_Basic_Thumbnails_Controller extends Mixin_NextGen_Basic_Gallery_
167
  $params['transient_id'] = $displayed_gallery->transient_id;
168
  $params['current_page'] = $current_page;
169
  $params['piclens_link'] = $piclens_link;
170
- $params['effect_code'] = $effect_code;
171
  $params['pagination'] = $pagination;
172
  $params['thumbnail_size_name'] = $thumbnail_size_name;
173
  $params['slideshow_link'] = $slideshow_link;
174
 
175
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
176
 
177
- $output = $this->object->render_view('photocrati-nextgen_basic_gallery#thumbnails/index', $params, $return);
178
  }
179
-
180
- if ($display_settings['use_imagebrowser_effect'])
181
- $storage->del_post_hook('get_image_url', 'imagebrowser alternate url replacer');
182
-
183
- return $output;
184
-
185
  }
186
- else if ($display_settings['display_no_images_error']) {
187
  return $this->object->render_partial("photocrati-nextgen_gallery_display#no_images_found", array(), $return);
188
  }
189
  }
19
  function index_action($displayed_gallery, $return=FALSE)
20
  {
21
  $display_settings = $displayed_gallery->display_settings;
22
+
23
+ if(!$display_settings['disable_pagination'])
24
+ $current_page = (int)$this->param('page', $displayed_gallery->id(), 1);
 
 
 
 
 
 
25
  else
26
  $current_page = 1;
27
 
28
  $offset = $display_settings['images_per_page'] * ($current_page - 1);
29
  $storage = $this->object->get_registry()->get_utility('I_Gallery_Storage');
30
  $total = $displayed_gallery->get_entity_count();
31
+ $gallery_id = $displayed_gallery->id();
32
 
33
  // Get the images to be displayed
34
  if ($display_settings['images_per_page'] > 0 && $display_settings['show_all_in_lightbox'])
76
  list($pagination_prev, $pagination_next, $pagination) = array(NULL, NULL, NULL);
77
  }
78
 
79
+ if ($display_settings['show_piclens_link'] || $display_settings['ajax_pagination'])
80
+ $gallery_id = $displayed_gallery->to_transient();
81
+
82
  $thumbnail_size_name = 'thumbnail';
83
 
84
  if ($display_settings['override_thumbnail_settings'])
114
 
115
  // Generate a slideshow link
116
  $slideshow_link = '';
117
+ if ($display_settings['show_slideshow_link']) {
 
 
 
118
  $slideshow_link = $this->object->get_url_for_alternate_display_type(
119
+ $displayed_gallery, NEXTGEN_GALLERY_BASIC_SLIDESHOW
120
  );
121
  }
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  // The render functions require different processing
124
  if (!empty($display_settings['template']))
125
  {
132
  'next' => (empty($pagination_next)) ? FALSE : $pagination_next,
133
  'prev' => (empty($pagination_prev)) ? FALSE : $pagination_prev,
134
  'pagination' => $pagination,
135
+ 'piclens_link' => @$piclens_link,
136
+ 'show_slideshow_link' => @$display_settings['show_slideshow_link'],
137
+ 'slideshow_link' => @$display_settings['slideshow_link'],
138
+ 'slideshow_link_text' => @$display_settings['slideshow_link_text']
139
  )
140
  );
141
+ return $this->object->legacy_render($display_settings['template'], $params, $return, 'gallery');
142
  }
143
  else {
144
  $params = $display_settings;
148
  $params['transient_id'] = $displayed_gallery->transient_id;
149
  $params['current_page'] = $current_page;
150
  $params['piclens_link'] = $piclens_link;
151
+ $params['effect_code'] = $this->object->get_effect_code($displayed_gallery);
152
  $params['pagination'] = $pagination;
153
  $params['thumbnail_size_name'] = $thumbnail_size_name;
154
  $params['slideshow_link'] = $slideshow_link;
155
 
156
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
157
 
158
+ return $this->object->render_view('photocrati-nextgen_basic_gallery#thumbnails/index', $params, $return);
159
  }
 
 
 
 
 
 
160
  }
161
+ else {
162
  return $this->object->render_partial("photocrati-nextgen_gallery_display#no_images_found", array(), $return);
163
  }
164
  }
products/photocrati_nextgen/modules/nextgen_basic_gallery/hook.nextgen_basic_gallery_integration.php CHANGED
@@ -4,19 +4,13 @@ class Hook_NextGen_Basic_Gallery_Integration extends Hook
4
  {
5
  function index_action($displayed_gallery, $return=FALSE)
6
  {
7
- $show = $this->object->param('show');
8
- $pid = $this->object->param('pid');
9
-
10
- if (!empty($pid) && isset($displayed_gallery->display_settings['use_imagebrowser_effect']) && intval($displayed_gallery->display_settings['use_imagebrowser_effect']))
11
- $show = NEXTGEN_GALLERY_NEXTGEN_BASIC_IMAGEBROWSER;
12
-
13
  // Are we to display a different display type?
14
- if (!empty($show))
15
  {
16
  $params = (array)$displayed_gallery->get_entity();
17
  $ds = $params['display_settings'];
18
 
19
- if ((!empty($ds['show_slideshow_link']) || !empty($ds['show_thumbnail_link']) || !empty($ds['use_imagebrowser_effect']))
20
  && $show != $this->object->context)
21
  {
22
  // We've got an alternate request. We'll use a different display
@@ -47,4 +41,4 @@ class Hook_NextGen_Basic_Gallery_Integration extends Hook
47
  }
48
  }
49
  }
50
- }
4
  {
5
  function index_action($displayed_gallery, $return=FALSE)
6
  {
 
 
 
 
 
 
7
  // Are we to display a different display type?
8
+ if (($show = $this->object->param('show')))
9
  {
10
  $params = (array)$displayed_gallery->get_entity();
11
  $ds = $params['display_settings'];
12
 
13
+ if ((!empty($ds['show_slideshow_link']) || !empty($ds['show_thumbnail_link']))
14
  && $show != $this->object->context)
15
  {
16
  // We've got an alternate request. We'll use a different display
41
  }
42
  }
43
  }
44
+ }
products/photocrati_nextgen/modules/nextgen_basic_gallery/mixin.nextgen_basic_gallery_controller.php CHANGED
@@ -19,9 +19,9 @@ class Mixin_NextGen_Basic_Gallery_Controller extends Mixin
19
  * @param string $display_type
20
  * @return string
21
  */
22
- function get_url_for_alternate_display_type($displayed_gallery, $display_type, $origin_url = FALSE)
23
  {
24
- $url = ($origin_url ? $origin_url : $this->object->get_routed_url(TRUE));
25
  $url = $this->object->remove_param_for($url, 'show', $displayed_gallery->id());
26
  $url = $this->object->set_param_for($url, 'show', $display_type, $displayed_gallery->id());
27
 
19
  * @param string $display_type
20
  * @return string
21
  */
22
+ function get_url_for_alternate_display_type($displayed_gallery, $display_type)
23
  {
24
+ $url = $this->object->get_routed_url(TRUE);
25
  $url = $this->object->remove_param_for($url, 'show', $displayed_gallery->id());
26
  $url = $this->object->set_param_for($url, 'show', $display_type, $displayed_gallery->id());
27
 
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.7',
29
  'http://www.nextgen-gallery.com',
30
  'Photocrati Media',
31
  'http://www.photocrati.com'
@@ -57,19 +57,17 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
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,24 +112,22 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
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()
127
  {
128
- C_NextGen_Shortcode_Manager::add('nggallery', array(&$this, 'render'));
129
- C_NextGen_Shortcode_Manager::add('nggtags', array(&$this, 'render_based_on_tags'));
130
- C_NextGen_Shortcode_Manager::add('random', array(&$this, 'render_random_images'));
131
- C_NextGen_Shortcode_Manager::add('recent', array(&$this, 'render_recent_images'));
132
- C_NextGen_Shortcode_Manager::add('thumb', array(&$this, 'render_thumb_shortcode'));
133
- C_NextGen_Shortcode_Manager::add('slideshow', array(&$this, 'render_slideshow'));
134
- C_NextGen_Shortcode_Manager::add('nggslideshow', array(&$this, 'render_slideshow'));
135
  }
136
 
137
  /**
25
  'photocrati-nextgen_basic_gallery',
26
  'NextGEN Basic Gallery',
27
  "Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
28
+ NEXTGEN_GALLERY_PLUGIN_VERSION,
29
  'http://www.nextgen-gallery.com',
30
  'Photocrati Media',
31
  'http://www.photocrati.com'
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
  '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()
123
  {
124
+ add_shortcode('nggallery', array(&$this, 'render'));
125
+ add_shortcode('nggtags', array(&$this, 'render_based_on_tags'));
126
+ add_shortcode('random', array(&$this, 'render_random_images'));
127
+ add_shortcode('recent', array(&$this, 'render_recent_images'));
128
+ add_shortcode('thumb', array(&$this, 'render_thumb_shortcode'));
129
+ add_shortcode('slideshow', array(&$this, 'render_slideshow'));
130
+ add_shortcode('nggslideshow', array(&$this, 'render_slideshow'));
131
  }
132
 
133
  /**
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/slideshow/nextgen_basic_slideshow.css CHANGED
@@ -35,7 +35,7 @@ body {
35
 
36
  .ngg-slideshow img {
37
  max-width: 100% !important;
38
- max-height: 100%;
39
  width: auto;
40
  height: auto;
41
  border: none;
35
 
36
  .ngg-slideshow img {
37
  max-width: 100% !important;
38
+ max-height: 100%;
39
  width: auto;
40
  height: auto;
41
  border: none;
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/slideshow/nextgen_basic_slideshow.js CHANGED
@@ -40,7 +40,6 @@ jQuery.fn.nggShowSlideshow = function(args) {
40
  containerResize: false,
41
  fit: 1,
42
  timeout: s.timeout,
43
- next: self, // advance to next image when clicked
44
  after: function(currSlideElement, nextSlideElement, options, forwardFlag) {
45
  // update the pro-lightbox triggers should they exist
46
  jQuery(nextSlideElement).parent().siblings('div.ngg-trigger-buttons').each(function() {
40
  containerResize: false,
41
  fit: 1,
42
  timeout: s.timeout,
 
43
  after: function(currSlideElement, nextSlideElement, options, forwardFlag) {
44
  // update the pro-lightbox triggers should they exist
45
  jQuery(nextSlideElement).parent().siblings('div.ngg-trigger-buttons').each(function() {
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/ajax_pagination.js CHANGED
@@ -8,14 +8,10 @@ jQuery(function($){
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
 
@@ -38,7 +34,7 @@ jQuery(function($){
38
  $(document).trigger('refreshed');
39
  }).always(function() {
40
  self.toggle_busy(false);
41
- });
42
 
43
  });
44
  },
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
 
34
  $(document).trigger('refreshed');
35
  }).always(function() {
36
  self.toggle_busy(false);
37
+ });;
38
 
39
  });
40
  },
products/photocrati_nextgen/modules/nextgen_basic_gallery/static/thumbnails/nextgen_basic_thumbnails.css CHANGED
@@ -62,8 +62,6 @@
62
 
63
  .ngg-galleryoverview div.pic img {
64
  width: 100%;
65
- border: 0px;
66
- border-radius: 0px;
67
  }
68
 
69
  .ngg-gallery-list li {
62
 
63
  .ngg-galleryoverview div.pic img {
64
  width: 100%;
 
 
65
  }
66
 
67
  .ngg-gallery-list li {
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, 'full', TRUE))?>"
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 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
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
  <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
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<?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,18 +50,14 @@ $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, '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;"
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
 
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;"
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_controller.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Provides rendering logic for the NextGen Basic ImageBrowser
5
  */
6
- class A_NextGen_Basic_ImageBrowser_Controller extends Mixin_NextGen_Basic_Gallery_Controller
7
  {
8
  /**
9
  * Renders the front-end display for the imagebrowser display type
@@ -98,21 +98,17 @@ class A_NextGen_Basic_ImageBrowser_Controller extends Mixin_NextGen_Basic_Galler
98
  $picture_list_pos = $key + 1;
99
 
100
  // our image to display
101
- $picture = new C_Image_Wrapper($imap->find($numeric_pid), $displayed_gallery, TRUE);
102
  $picture = apply_filters('ngg_image_object', $picture, $numeric_pid);
103
 
104
  // determine URI to the next & previous images
105
  $back_pid = ($key >= 1) ? $picture_array[$key - 1] : end($picture_array);
106
 
107
- // 'show' is set when using the imagebrowser as an alternate view to a thumbnail or slideshow
108
- // for which the basic-gallery module will rewrite the show parameter into existence as long as 'image'
109
- // is set. We remove 'show' here so navigation appears fluid.
110
  $prev_image_link = $this->object->set_param_for(
111
  $application->get_routed_url(TRUE),
112
  'pid',
113
  $picture_list[$back_pid]->image_slug
114
  );
115
- $prev_image_link = trailingslashit($this->object->remove_param_for($prev_image_link, 'show', $displayed_gallery->id()));
116
 
117
  $next_pid = ($key < ($total - 1)) ? $picture_array[$key + 1] : reset($picture_array);
118
  $next_image_link = $this->object->set_param_for(
@@ -120,10 +116,9 @@ class A_NextGen_Basic_ImageBrowser_Controller extends Mixin_NextGen_Basic_Galler
120
  'pid',
121
  $picture_list[$next_pid]->image_slug
122
  );
123
- $next_image_link = trailingslashit($this->object->remove_param_for($next_image_link, 'show', $displayed_gallery->id()));
124
 
125
  // css class
126
- $anchor = 'ngg-imagebrowser-' . $displayed_gallery->id() . '-' . (get_the_ID() == false ? 0 : get_the_ID());
127
 
128
  // try to read EXIF data, but fallback to the db presets
129
  $meta = new C_NextGen_Metadata($picture);
3
  /**
4
  * Provides rendering logic for the NextGen Basic ImageBrowser
5
  */
6
+ class A_NextGen_Basic_ImageBrowser_Controller extends Mixin
7
  {
8
  /**
9
  * Renders the front-end display for the imagebrowser display type
98
  $picture_list_pos = $key + 1;
99
 
100
  // our image to display
101
+ $picture = new C_Image_Wrapper($imap->find($numeric_pid), NULL, TRUE);
102
  $picture = apply_filters('ngg_image_object', $picture, $numeric_pid);
103
 
104
  // determine URI to the next & previous images
105
  $back_pid = ($key >= 1) ? $picture_array[$key - 1] : end($picture_array);
106
 
 
 
 
107
  $prev_image_link = $this->object->set_param_for(
108
  $application->get_routed_url(TRUE),
109
  'pid',
110
  $picture_list[$back_pid]->image_slug
111
  );
 
112
 
113
  $next_pid = ($key < ($total - 1)) ? $picture_array[$key + 1] : reset($picture_array);
114
  $next_image_link = $this->object->set_param_for(
116
  'pid',
117
  $picture_list[$next_pid]->image_slug
118
  );
 
119
 
120
  // css class
121
+ $anchor = 'ngg-imagebrowser-' . $picture->galleryid . '-' . (get_the_ID() == false ? 0 : get_the_ID());
122
 
123
  // try to read EXIF data, but fallback to the db presets
124
  $meta = new C_NextGen_Metadata($picture);
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/adapter.nextgen_basic_imagebrowser_form.php CHANGED
@@ -12,9 +12,6 @@ class A_NextGen_Basic_ImageBrowser_Form extends Mixin_Display_Type_Form
12
  */
13
  function _get_field_names()
14
  {
15
- return array(
16
- 'ajax_pagination',
17
- 'nextgen_basic_templates_template',
18
- );
19
  }
20
  }
12
  */
13
  function _get_field_names()
14
  {
15
+ return array('nextgen_basic_templates_template');
 
 
 
16
  }
17
  }
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 (isset($entity->name) && $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 ($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}", "{1}{$slug}{2}/pid--{3}");
19
  }
20
  }
14
 
15
  function _add_nextgen_basic_imagebrowser_routes()
16
  {
17
+ $slug = C_NextGen_Global_Settings::get_instance()->router_param_slug;
18
+ $this->object->rewrite("{$slug}{*}/image/{\\w}", "{$slug}{1}/pid--{2}");
19
  }
20
  }
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/hook.nextgen_basic_imagebrowser_alt_urls.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
-
3
- class Hook_NextGen_Basic_Imagebrowser_Alt_URLs extends Hook {
4
- /**
5
- * Replaces the full-size image url with a path to the current url + a pid (image) parameter. This causes
6
- * basic thumbnail displays to render a basic imagebrowser.
7
- *
8
- * @param $image
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(
16
- $this->method_called,
17
- ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE
18
- );
19
-
20
- if ($size == 'full')
21
- {
22
- $router = $this->object->get_registry()->get_utility('I_Router');
23
- $controller = $this->object->get_registry()->get_utility('I_Display_Type_Controller');
24
- $application = $router->get_routed_app();
25
-
26
- if ($router->param('ajax_pagination_referrer'))
27
- $url = $router->param('ajax_pagination_referrer');
28
- else
29
- $url = $application->get_routed_url(TRUE);
30
-
31
- $url = $controller->set_param_for($url, 'pid', $image->image_slug);
32
- $url = $controller->remove_param_for($url, 'show');
33
-
34
- $retval = $url;
35
-
36
- $this->object->set_method_property(
37
- $this->method_called,
38
- ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE,
39
- $retval
40
- );
41
- }
42
-
43
- return $retval;
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5',
23
  'http://www.nextgen-gallery.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
@@ -59,24 +59,23 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
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()
78
  {
79
- C_NextGen_Shortcode_Manager::add('imagebrowser', array(&$this, 'render_shortcode'));
80
  }
81
 
82
  /**
@@ -114,8 +113,7 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
114
  'C_Nextgen_Basic_Imagebrowser_Installer' => 'class.nextgen_basic_imagebrowser_installer.php',
115
  'A_Nextgen_Basic_Imagebrowser_Mapper' => 'adapter.nextgen_basic_imagebrowser_mapper.php',
116
  'A_Nextgen_Basic_Imagebrowser_Routes' => 'adapter.nextgen_basic_imagebrowser_routes.php',
117
- 'A_Nextgen_Basic_Imagebrowser_Urls' => 'adapter.nextgen_basic_imagebrowser_urls.php',
118
- 'Hook_NextGen_Basic_Imagebrowser_Alt_URLs' => 'hook.nextgen_basic_imagebrowser_alt_urls.php'
119
  );
120
  }
121
  }
19
  'photocrati-nextgen_basic_imagebrowser',
20
  'NextGEN Basic ImageBrowser',
21
  'Provides the NextGEN Basic ImageBrowser Display Type',
22
+ NEXTGEN_GALLERY_PLUGIN_VERSION,
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
+ // 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()
77
  {
78
+ add_shortcode('imagebrowser', array(&$this, 'render_shortcode'));
79
  }
80
 
81
  /**
113
  'C_Nextgen_Basic_Imagebrowser_Installer' => 'class.nextgen_basic_imagebrowser_installer.php',
114
  'A_Nextgen_Basic_Imagebrowser_Mapper' => 'adapter.nextgen_basic_imagebrowser_mapper.php',
115
  'A_Nextgen_Basic_Imagebrowser_Routes' => 'adapter.nextgen_basic_imagebrowser_routes.php',
116
+ 'A_Nextgen_Basic_Imagebrowser_Urls' => 'adapter.nextgen_basic_imagebrowser_urls.php'
 
117
  );
118
  }
119
  }
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/templates/nextgen_basic_imagebrowser.php CHANGED
@@ -14,17 +14,13 @@
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
 
@@ -64,13 +60,4 @@
64
  </div>
65
 
66
  </div>
67
- <?php $this->end_element(); ?>
68
- <script type='text/javascript'>
69
- jQuery(function($){
70
- new NggPaginatedGallery(
71
- '<?php echo $displayed_gallery->id() ?>',
72
- $('#<?php echo $anchor ?>'),
73
- $('#<?php echo $anchor ?> .ngg-browser-prev, #<?php echo $anchor ?> .ngg-browser-next')
74
- )
75
- });
76
- </script>
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
 
60
  </div>
61
 
62
  </div>
63
+ <?php $this->end_element(); ?>
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_basic_singlepic/adapter.nextgen_basic_singlepic_controller.php CHANGED
@@ -32,19 +32,8 @@ class A_NextGen_Basic_Singlepic_Controller extends Mixin
32
  break;
33
  }
34
 
35
- $params = array();
36
-
37
- if (!empty($display_settings['link']))
38
- {
39
- $target = '_blank';
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
- }
47
- $params['target'] = $target;
48
 
49
  // mode is a legacy parameter
50
  if (!is_array($display_settings['mode']))
@@ -99,28 +88,17 @@ class A_NextGen_Basic_Singlepic_Controller extends Mixin
99
  $params['image']->container[0]->_cache_overrides['classname'] = 'ngg-singlepic ' . $display_settings['float'];
100
  $params['image']->container[0]->_cache_overrides['imageURL'] = $display_settings['link'];
101
  $params['image']->container[0]->_cache_overrides['thumbnailURL'] = $thumbnail_url;
102
- $params['target'] = $target;
103
-
104
- // if a link is present we temporarily must filter out the effect code
105
- if (empty($effect_code))
106
- add_filter('ngg_get_thumbcode', array(&$this, 'strip_thumbcode'), 10);
107
-
108
- $retval = $this->object->legacy_render($display_settings['template'], $params, $return, 'singlepic');
109
 
110
- if (empty($effect_code))
111
- remove_filter('ngg_get_thumbcode', array(&$this, 'strip_thumbcode'), 10);
112
-
113
- return $retval;
114
  }
115
  else {
116
  $params = $display_settings;
117
  $params['storage'] = &$storage;
118
  $params['image'] = &$image;
119
- $params['effect_code'] = $effect_code;
120
  $params['inner_content'] = $displayed_gallery->inner_content;
121
  $params['settings'] = $display_settings;
122
  $params['thumbnail_url'] = $thumbnail_url;
123
- $params['target'] = $target;
124
 
125
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
126
 
@@ -128,14 +106,6 @@ class A_NextGen_Basic_Singlepic_Controller extends Mixin
128
  }
129
  }
130
 
131
- /**
132
- * Intentionally disable the application of the effect code
133
- */
134
- function strip_thumbcode($thumbcode)
135
- {
136
- return '';
137
- }
138
-
139
  /**
140
  * Enqueues all static resources required by this display type
141
  *
32
  break;
33
  }
34
 
35
+ // validate and/or clean our passed settings
36
+ $display_settings['link'] = (!empty($display_settings['link'])) ? $display_settings['link'] : $storage->get_image_url($image);
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  // mode is a legacy parameter
39
  if (!is_array($display_settings['mode']))
88
  $params['image']->container[0]->_cache_overrides['classname'] = 'ngg-singlepic ' . $display_settings['float'];
89
  $params['image']->container[0]->_cache_overrides['imageURL'] = $display_settings['link'];
90
  $params['image']->container[0]->_cache_overrides['thumbnailURL'] = $thumbnail_url;
 
 
 
 
 
 
 
91
 
92
+ return $this->object->legacy_render($display_settings['template'], $params, $return, 'singlepic');
 
 
 
93
  }
94
  else {
95
  $params = $display_settings;
96
  $params['storage'] = &$storage;
97
  $params['image'] = &$image;
98
+ $params['effect_code'] = $this->object->get_effect_code($displayed_gallery);
99
  $params['inner_content'] = $displayed_gallery->inner_content;
100
  $params['settings'] = $display_settings;
101
  $params['thumbnail_url'] = $thumbnail_url;
 
102
 
103
  $params = $this->object->prepare_display_parameters($displayed_gallery, $params);
104
 
106
  }
107
  }
108
 
 
 
 
 
 
 
 
 
109
  /**
110
  * Enqueues all static resources required by this display type
111
  *
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 (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', '');
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', '');
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.5',
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
@@ -43,24 +43,23 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
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()
62
  {
63
- C_NextGen_Shortcode_Manager::add('singlepic', array(&$this, 'render_singlepic'));
64
  }
65
 
66
  /**
17
  NEXTGEN_BASIC_SINGLEPIC_MODULE_NAME,
18
  'NextGen Basic Singlepic',
19
  'Provides a singlepic gallery for NextGEN Gallery',
20
+ NEXTGEN_GALLERY_PLUGIN_VERSION,
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
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()
61
  {
62
+ add_shortcode('singlepic', array(&$this, 'render_singlepic'));
63
  }
64
 
65
  /**
products/photocrati_nextgen/modules/nextgen_basic_singlepic/templates/nextgen_basic_singlepic.php CHANGED
@@ -64,14 +64,9 @@
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); ?>"
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
+ <?php echo $effect_code ?>>
69
+ <img class="ngg-singlepic"
 
 
 
 
 
70
  src="<?php echo $thumbnail_url; ?>"
71
  alt="<?php echo esc_attr($image->alttext); ?>"
72
  title="<?php echo esc_attr($image->alttext); ?>"
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_form.php CHANGED
@@ -25,7 +25,6 @@ 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 (!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
  }
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
  }
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 (isset($entity->name) && $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 ($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}{*}", "{1}{$slug}{2}/gallerytag--{3}{4}");
19
  }
20
  }
14
 
15
  function _add_nextgen_basic_tagcloud_routes()
16
  {
17
+ $slug = C_NextGen_Global_Settings::get_instance()->router_param_slug;
18
+ $this->object->rewrite("{$slug}{*}/tags/{\\w}{*}", "{$slug}{1}/gallerytag--{2}{3}");
19
  }
20
  }
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/adapter.nextgen_basic_tagcloud_urls.php CHANGED
@@ -48,7 +48,7 @@ class A_NextGen_Basic_TagCloud_Urls extends Mixin
48
  );
49
 
50
  // Get the settings manager
51
- $settings = C_NextGen_Settings::get_instance();
52
 
53
  // Create the regex pattern
54
  $sep = preg_quote($settings->router_param_separator, '#');
48
  );
49
 
50
  // Get the settings manager
51
+ $settings = C_NextGen_Global_Settings::get_instance();
52
 
53
  // Create the regex pattern
54
  $sep = preg_quote($settings->router_param_separator, '#');
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/class.taxonomy_controller.php DELETED
@@ -1,127 +0,0 @@
1
- <?php
2
-
3
- class C_Taxonomy_Controller extends C_MVC_Controller
4
- {
5
- static $_instances = array();
6
- protected $ngg_tag_detection_has_run = FALSE;
7
-
8
- /**
9
- * Returns an instance of this class
10
- *
11
- * @param string $context
12
- * @return C_Taxonomy_Controller
13
- */
14
- static function get_instance($context = FALSE)
15
- {
16
- if (!isset(self::$_instances[$context]))
17
- {
18
- $klass = get_class();
19
- self::$_instances[$context] = new $klass($context);
20
- }
21
- return self::$_instances[$context];
22
- }
23
-
24
- function define($context = FALSE)
25
- {
26
- parent::define($context);
27
- $this->implement('I_Taxonomy_Controller');
28
- }
29
-
30
- /**
31
- * Returns the rendered HTML of a gallery based on the provided tag
32
- *
33
- * @param string $tag
34
- * @return string
35
- */
36
- function index_action($tag)
37
- {
38
- $renderer = $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer');
39
- $output = $renderer->display_images(array(
40
- 'source' => 'tags',
41
- 'container_ids' => $tag,
42
- 'slug' => $tag,
43
- 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS
44
- ));
45
-
46
- // This strips extra whitespace and strips newlines. For some reason this is especially
47
- // necessary on Wordpress taxonomy pages.
48
- return trim(preg_replace("/\s\s+/", " ", $output));
49
- }
50
-
51
- /**
52
- * Determines if the current page is /ngg_tag/{*}
53
- *
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'));
70
-
71
- if (!$this->ngg_tag_detection_has_run // don't run more than once; necessary for certain themes
72
- && !is_admin() // will destroy 'view all posts' page without this
73
- && !empty($tag) // only run when a tag has been given to wordpress
74
- && (stripos($wp->request, 'ngg_tag') === 0 // make sure the query begins with /ngg_tag
75
- || (isset($wp_query->query_vars['page_id'])
76
- && $wp_query->query_vars['page_id'] === 'ngg_tag')
77
- )
78
- )
79
- {
80
- $this->ngg_tag_detection_has_run = TRUE;
81
-
82
- // Wordpress somewhat-correctly generates several notices, so silence them as they're really unnecessary
83
- if (!defined('WP_DEBUG') || !WP_DEBUG)
84
- error_reporting(0);
85
-
86
- // create in-code a fake post; we feed it back to Wordpress as the sole result of the "the_posts" filter
87
- $posts = NULL;
88
- $posts[] = $this->create_ngg_tag_post($tag);
89
-
90
- $wp_query->is_404 = FALSE;
91
- $wp_query->is_page = TRUE;
92
- $wp_query->is_singular = TRUE;
93
- $wp_query->is_home = FALSE;
94
- $wp_query->is_archive = FALSE;
95
- $wp_query->is_category = FALSE;
96
-
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
- }
107
-
108
- function create_ngg_tag_post($tag)
109
- {
110
- $post = new stdClass;
111
- $post->post_author = FALSE;
112
- $post->post_name = 'ngg_tag';
113
- $post->guid = get_bloginfo('wpurl') . '/' . 'ngg_tag';
114
- $post->post_title = "Images tagged &quot;{$tag}&quot;";
115
- $post->post_content = $this->index_action($tag);
116
- $post->ID = FALSE;
117
- $post->post_type = 'page';
118
- $post->post_status = 'static';
119
- $post->comment_status = 'closed';
120
- $post->ping_status = 'closed';
121
- $post->comment_count = 0;
122
- $post->post_date = current_time('mysql');
123
- $post->post_date_gmt = current_time('mysql', 1);
124
-
125
- return($post);
126
- }
127
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/interface.taxonomy_controller.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- interface I_Taxonomy_Controller extends I_MVC_Controller
4
- {
5
- function index_action($tag);
6
- function detect_ngg_tag($posts);
7
- function create_ngg_tag_post($tag);
8
- }
 
 
 
 
 
 
 
 
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.5',
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
@@ -27,10 +27,6 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
27
  C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Basic_Tagcloud_Installer');
28
  }
29
 
30
- function _register_utilities()
31
- {
32
- $this->get_registry()->add_utility('I_Taxonomy_Controller', 'C_Taxonomy_Controller');
33
- }
34
 
35
  function _register_adapters()
36
  {
@@ -65,33 +61,23 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
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()
84
  {
85
- C_NextGen_Shortcode_Manager::add('tagcloud', array(&$this, 'render_shortcode'));
86
-
87
- add_filter(
88
- 'the_posts',
89
- array(
90
- $this->get_registry()->get_utility('I_Taxonomy_Controller'),
91
- 'detect_ngg_tag'),
92
- -10,
93
- 2
94
- );
95
  }
96
 
97
  /**
@@ -133,9 +119,7 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
133
  'C_NextGen_Basic_Tagcloud_Installer' => 'class.nextgen_basic_tagcloud_installer.php',
134
  'A_Nextgen_Basic_Tagcloud_Mapper' => 'adapter.nextgen_basic_tagcloud_mapper.php',
135
  'A_Nextgen_Basic_Tagcloud_Routes' => 'adapter.nextgen_basic_tagcloud_routes.php',
136
- 'A_Nextgen_Basic_Tagcloud_Urls' => 'adapter.nextgen_basic_tagcloud_urls.php',
137
- 'I_Taxonomy_Controller' => 'interface.taxonomy_controller.php',
138
- 'C_Taxonomy_Controller' => 'class.taxonomy_controller.php'
139
  );
140
  }
141
  }
17
  NEXTGEN_BASIC_TAG_CLOUD_MODULE_NAME,
18
  'NextGen Basic Tagcloud',
19
  'Provides a tagcloud for NextGEN Gallery',
20
+ NEXTGEN_GALLERY_PLUGIN_VERSION,
21
  'http://www.photocrati.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
27
  C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Basic_Tagcloud_Installer');
28
  }
29
 
 
 
 
 
30
 
31
  function _register_adapters()
32
  {
61
  'A_NextGen_Basic_TagCloud_Urls'
62
  );
63
 
64
+ // Adds a display settings form
65
+ $this->get_registry()->add_adapter(
66
+ 'I_Form',
67
+ 'A_NextGen_Basic_TagCloud_Form',
68
+ $this->module_id
69
+ );
70
+
71
+ // Provides the forms for the settings
72
+ $this->get_registry()->add_adapter(
73
+ 'I_Form_Manager',
74
+ 'A_NextGen_Basic_TagCloud_Forms'
75
+ );
 
76
  }
77
 
78
  function _register_hooks()
79
  {
80
+ add_shortcode('tagcloud', array(&$this, 'render_shortcode'));
 
 
 
 
 
 
 
 
 
81
  }
82
 
83
  /**
119
  'C_NextGen_Basic_Tagcloud_Installer' => 'class.nextgen_basic_tagcloud_installer.php',
120
  'A_Nextgen_Basic_Tagcloud_Mapper' => 'adapter.nextgen_basic_tagcloud_mapper.php',
121
  'A_Nextgen_Basic_Tagcloud_Routes' => 'adapter.nextgen_basic_tagcloud_routes.php',
122
+ 'A_Nextgen_Basic_Tagcloud_Urls' => 'adapter.nextgen_basic_tagcloud_urls.php'
 
 
123
  );
124
  }
125
  }
products/photocrati_nextgen/modules/nextgen_basic_templates/adapter.nextgen_basic_template_form.php CHANGED
@@ -133,35 +133,32 @@ class A_NextGen_Basic_Template_Form extends Mixin
133
 
134
  // create the 'gallery' object
135
  $gallery = new stdclass;
136
- $gallery->ID = $displayed_gallery->id();
 
 
137
  $gallery->name = stripslashes($orig_gallery->name);
138
  $gallery->title = stripslashes($orig_gallery->title);
139
  $gallery->description = html_entity_decode(stripslashes($orig_gallery->galdesc));
140
  $gallery->pageid = $orig_gallery->pageid;
141
-
142
- if ($displayed_gallery->display_settings['ajax_pagination'])
143
- $gallery_id = $displayed_gallery->transient_id;
144
- else
145
- $gallery_id = $displayed_gallery->id();
146
-
147
- $gallery->anchor = 'ngg-gallery-' . $gallery_id . '-' . $current_page;
148
  $gallery->displayed_gallery = &$displayed_gallery;
149
  $gallery->columns = @intval($displayed_gallery->display_settings['number_of_columns']);
150
  $gallery->imagewidth = ($gallery->columns > 0) ? 'style="width:' . floor(100 / $gallery->columns) . '%;"' : '';
151
 
152
- if (!empty($displayed_gallery->display_settings['show_slideshow_link'])) {
153
- $gallery->show_slideshow = TRUE;
154
- $gallery->slideshow_link = $params['slideshow_link'];
155
- $gallery->slideshow_link_text = $displayed_gallery->display_settings['slideshow_link_text'];
156
- }
157
- else $gallery->show_slideshow = FALSE;
 
158
 
159
- if (!empty($displayed_gallery->display_settings['show_piclens_link'])) {
160
- $gallery->show_piclens = true;
161
- $gallery->piclens_link = $params['piclens_link'];
162
- $gallery->piclens_link_text = $displayed_gallery->display_settings['piclens_link_text'];
 
163
  }
164
- else $gallery->show_piclens = FALSE;
165
 
166
  $gallery = apply_filters('ngg_gallery_object', $gallery, 4);
167
 
@@ -210,9 +207,5 @@ class A_NextGen_Basic_Template_Form extends Mixin
210
  $this->module_version,
211
  TRUE
212
  );
213
-
214
-
215
- if ($atp != null) {
216
- $atp->mark_script('ngg_template_settings');
217
  }
218
  }
133
 
134
  // create the 'gallery' object
135
  $gallery = new stdclass;
136
+ $gallery->ID = $orig_gallery->$gallery_key;
137
+ $gallery->show_slideshow = FALSE;
138
+ $gallery->show_piclens = FALSE;
139
  $gallery->name = stripslashes($orig_gallery->name);
140
  $gallery->title = stripslashes($orig_gallery->title);
141
  $gallery->description = html_entity_decode(stripslashes($orig_gallery->galdesc));
142
  $gallery->pageid = $orig_gallery->pageid;
143
+ $gallery->anchor = 'ngg-gallery-' . $orig_gallery->$gallery_key . '-' . $current_page;
 
 
 
 
 
 
144
  $gallery->displayed_gallery = &$displayed_gallery;
145
  $gallery->columns = @intval($displayed_gallery->display_settings['number_of_columns']);
146
  $gallery->imagewidth = ($gallery->columns > 0) ? 'style="width:' . floor(100 / $gallery->columns) . '%;"' : '';
147
 
148
+ if (is_integer($gallery->ID))
149
+ {
150
+ if (!empty($displayed_gallery->display_settings['alternative_view'])) {
151
+ $gallery->show_slideshow = TRUE;
152
+ $gallery->slideshow_link = $params['alternative_view_link_url'];
153
+ $gallery->slideshow_link_text = $displayed_gallery->display_settings['alternative_view_link_text'];
154
+ }
155
 
156
+ if (!empty($displayed_gallery->display_settings['show_piclens_link'])) {
157
+ $gallery->show_piclens = true;
158
+ $gallery->piclens_link = $params['piclens_link'];
159
+ $gallery->piclens_link_text = $displayed_gallery->display_settings['piclens_link_text'];
160
+ }
161
  }
 
162
 
163
  $gallery = apply_filters('ngg_gallery_object', $gallery, 4);
164
 
207
  $this->module_version,
208
  TRUE
209
  );
 
 
 
 
210
  }
211
  }
products/photocrati_nextgen/modules/nextgen_basic_templates/class.legacy_template_locator.php CHANGED
@@ -38,8 +38,7 @@ class Mixin_Legacy_Template_Locator extends Mixin
38
  function get_template_directories()
39
  {
40
  return array(
41
- 'Child Theme' => get_stylesheet_directory() . DIRECTORY_SEPARATOR . 'nggallery' . DIRECTORY_SEPARATOR,
42
- 'Parent Theme' => get_template_directory() . DIRECTORY_SEPARATOR . 'nggallery' . DIRECTORY_SEPARATOR,
43
  'NextGEN' => NGGALLERY_ABSPATH . 'view' . DIRECTORY_SEPARATOR
44
  );
45
  }
@@ -91,7 +90,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);
38
  function get_template_directories()
39
  {
40
  return array(
41
+ 'Overrides' => STYLESHEETPATH . DIRECTORY_SEPARATOR . 'nggallery' . DIRECTORY_SEPARATOR,
 
42
  'NextGEN' => NGGALLERY_ABSPATH . 'view' . DIRECTORY_SEPARATOR
43
  );
44
  }
90
  }
91
  elseif (is_string($prefix))
92
  {
93
+ $regex_iterator = new RegexIterator($iterator, "#(.*)/{$prefix}\-?.*\.php$#i", RecursiveRegexIterator::GET_MATCH);
94
  }
95
  else {
96
  $regex_iterator = new RegexIterator($iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
products/photocrati_nextgen/modules/nextgen_basic_templates/module.nextgen_basic_templates.php CHANGED
@@ -15,7 +15,7 @@ class M_NextGen_Basic_Templates extends C_Base_Module
15
  'photocrati-nextgen_basic_templates',
16
  'NextGen Basic Templates',
17
  'Provides a NextGen-Legacy compatible thumbnail gallery for NextGEN Gallery',
18
- '0.2',
19
  'http://www.photocrati.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
15
  'photocrati-nextgen_basic_templates',
16
  'NextGen Basic Templates',
17
  'Provides a NextGen-Legacy compatible thumbnail gallery for NextGEN Gallery',
18
+ '0.1',
19
  'http://www.photocrati.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
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($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,11 +43,6 @@ class A_NextGen_Data_Factory extends Mixin
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
  {
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
  return new C_Gallery_Storage($context);
44
  }
45
 
 
 
 
 
 
46
 
47
  function gallerystorage($context=FALSE)
48
  {
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($properties=array(), $mapper=FALSE, $context=FALSE)
9
  {
10
  parent::define($mapper, $properties, $context);
11
  $this->add_mixin('Mixin_NextGen_Album_Instance_Methods');
@@ -18,17 +18,16 @@ class C_Album extends C_DataMapper_Model
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
  /**
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
  * @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
  /**
products/photocrati_nextgen/modules/nextgen_data/class.album_mapper.php CHANGED
@@ -4,38 +4,31 @@ class C_Album_Mapper extends C_CustomTable_DataMapper_Driver
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
41
  * @param bool|mixed $context
@@ -51,6 +44,19 @@ class C_Album_Mapper extends C_CustomTable_DataMapper_Driver
51
  }
52
  }
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  /**
56
  * Provides album-specific methods for the datamapper
@@ -67,11 +73,29 @@ class Mixin_Album_Mapper extends Mixin
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
  }
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
34
  * @param bool|mixed $context
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
  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
+ unset($entity->exclude);
89
+ $retval = $this->call_parent('_convert_to_table_data', $entity);
90
+ $entity->exclude = $exclude;
91
+ return $retval;
92
+ }
93
+
94
  function _save_entity($entity)
95
  {
96
  $retval = $this->call_parent('_save_entity', $entity);
97
  if ($retval) {
98
+ C_Photocrati_Cache::flush();
99
  }
100
  return $retval;
101
  }
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 (($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,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=FALSE, $context=FALSE)
54
  {
55
  parent::define($mapper, $properties, $context);
56
  $this->add_mixin('Mixin_NextGen_Gallery_Validation');
@@ -63,21 +63,12 @@ class C_Gallery extends C_DataMapper_Model
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
  }
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
  * 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
  * @param C_DataMapper $mapper
64
  * @param string $context
65
  */
66
+ function initialize($properties = FALSE, $mapper=FALSE) {
 
67
 
68
  // Get the mapper is not specified
69
  if (!$mapper) {
70
  $mapper = $this->get_registry()->get_utility($this->_mapper_interface);
71
  }
 
 
72
  parent::initialize($mapper, $properties);
73
  }
 
 
 
 
 
 
74
  }
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, $not_used=FALSE)
15
  {
16
  // Add 'gallery' context
17
  if (!is_array($context)) $context = array($context);
@@ -22,22 +22,11 @@ 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_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
  }
@@ -75,7 +64,7 @@ class Mixin_Gallery_Mapper extends Mixin
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,7 +73,7 @@ class Mixin_Gallery_Mapper extends Mixin
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
 
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
  // 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
  }
64
 
65
  if ($retval) {
66
  do_action('ngg_created_new_gallery', $entity->{$entity->id_field});
67
+ C_Photocrati_Cache::flush();
68
  }
69
 
70
  return $retval;
73
  function destroy($image)
74
  {
75
  $retval = $this->call_parent('destroy',$image);
76
+ C_Photocrati_Cache::flush();
77
  return $retval;
78
  }
79
 
products/photocrati_nextgen/modules/nextgen_data/class.gallery_storage.php CHANGED
@@ -24,7 +24,7 @@ class Mixin_GalleryStorage extends Mixin
24
  if (!defined('GALLERYSTORAGE_DRIVER')) {
25
 
26
  // Get the datamapper configured in the database
27
- $factory_method = C_NextGen_Settings::get_instance()->gallerystorage_driver;
28
 
29
  // Define a constant and use this as the global gallerystorage driver,
30
  // unless running in a SimpleTest Environment
24
  if (!defined('GALLERYSTORAGE_DRIVER')) {
25
 
26
  // Get the datamapper configured in the database
27
+ $factory_method = C_NextGen_Global_Settings::get_instance()->gallerystorage_driver;
28
 
29
  // Define a constant and use this as the global gallerystorage driver,
30
  // unless running in a SimpleTest Environment
products/photocrati_nextgen/modules/nextgen_data/class.gallerystorage_driver_base.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class E_UploadException extends E_NggErrorException
4
  {
5
  function __construct($message='', $code=NULL, $previous=NULL)
6
  {
@@ -9,20 +9,17 @@ class E_UploadException extends E_NggErrorException
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,16 +27,6 @@ class E_NoSpaceAvailableException extends E_NggErrorException
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,9 +255,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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,9 +374,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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,9 +404,9 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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,19 +487,6 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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
@@ -521,7 +495,7 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
521
  * @param type $filename specifies the name of the file
522
  * @return C_Image
523
  */
524
- function upload_base64_image($gallery, $data, $filename=FALSE, $image_id=FALSE)
525
  {
526
  $settings = C_NextGen_Settings::get_instance();
527
  $memory_limit = intval(ini_get('memory_limit'));
@@ -530,9 +504,11 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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
@@ -553,21 +529,13 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
553
  $filename = str_replace($match[0], '.'.$match[1], $filename);
554
  }
555
  $abs_filename = path_join($upload_dir, $filename);
556
-
557
- // Create or retrieve the image object
558
- $image = NULL;
559
- if ($image_id) {
560
- $image = $this->object->_image_mapper->find($image_id, TRUE);
561
- unset($image->meta_data['saved']);
562
- }
563
- if (!$image) $image = $this->object->_image_mapper->create();
564
- $retval = $image;
565
 
566
- // Create or update the database record
 
 
567
  $image->alttext = sanitize_title_with_dashes(basename($filename, '.' . pathinfo($filename, PATHINFO_EXTENSION)));
568
  $image->galleryid = $this->object->_get_gallery_id($gallery);
569
  $image->filename = $filename;
570
- $image->image_slug = nggdb::get_unique_slug( sanitize_title_with_dashes( $image->alttext ), 'image' );
571
  $image_key = $this->object->_image_mapper->get_primary_key_column();
572
 
573
  // If we can't write to the directory, then there's no point in continuing
@@ -582,6 +550,7 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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,12 +596,6 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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
@@ -648,24 +611,15 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
648
  return $retval;
649
  }
650
 
651
- function import_gallery_from_fs($abspath, $gallery_id=FALSE, $move_files=TRUE)
652
  {
653
  $retval = FALSE;
654
  if (@file_exists($abspath)) {
655
 
656
  // Ensure that this folder has images
657
- $files_all = scandir($abspath);
658
- $files = array();
659
-
660
- // first perform some filtering on file list
661
- foreach ($files_all as $file)
662
- {
663
- if ($file == '.' || $file == '..')
664
- continue;
665
-
666
- $files[] = $file;
667
- }
668
-
669
  if (!empty($files)) {
670
 
671
  // Get needed utilities
@@ -674,7 +628,7 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
674
 
675
  // Sometimes users try importing a directory, which actually has all images under another directory
676
  $first_file_abspath = $fs->join_paths($abspath, $files[0]);
677
- if (is_dir($first_file_abspath) && count($files) == 1) return $this->import_gallery_from_fs($first_file_abspath, $gallery_id, $move_files);
678
 
679
  // If no gallery has been specified, then use the directory name as the gallery name
680
  if (!$gallery_id) {
@@ -682,10 +636,6 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
682
  $gallery = $gallery_mapper->create(array(
683
  'title' => basename($abspath),
684
  ));
685
-
686
- if (!$move_files) {
687
- $gallery->path = str_ireplace(ABSPATH, '', $abspath);
688
- }
689
 
690
  // Save the gallery
691
  if ($gallery->save()) $gallery_id = $gallery->id();
@@ -697,82 +647,15 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
697
  foreach ($files as $file) {
698
  if (!preg_match("/\.(jpg|jpeg|gif|png)/i", $file)) continue;
699
  $file_abspath = $fs->join_paths($abspath, $file);
700
- $image = null;
701
-
702
- if ($move_files) {
703
- $image = $this->object->upload_base64_image(
704
- $gallery_id,
705
- file_get_contents($file_abspath),
706
- str_replace(' ', '_', $file)
707
- );
708
- }
709
- else {
710
- // Create the database record ... TODO cleanup, some duplication here from upload_base64_image
711
- $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
712
- $image = $factory->create('image');
713
- $image->alttext = sanitize_title_with_dashes(basename($file_abspath, '.' . pathinfo($file_abspath, PATHINFO_EXTENSION)));
714
- $image->galleryid = $this->object->_get_gallery_id($gallery_id);
715
- $image->filename = basename($file_abspath);
716
- $image->image_slug = nggdb::get_unique_slug( sanitize_title_with_dashes( $image->alttext ), 'image' );
717
- $image_key = $this->object->_image_mapper->get_primary_key_column();
718
- $abs_filename = $file_abspath;
719
-
720
- if (($image_id = $this->object->_image_mapper->save($image))) {
721
- try {
722
- // backup and image resizing should have already been performed, better to avoid
723
- # if ($settings->imgBackup)
724
- # $this->object->backup_image($image);
725
-
726
- # if ($settings->imgAutoResize)
727
- # $this->object->generate_image_clone(
728
- # $abs_filename,
729
- # $abs_filename,
730
- # $this->object->get_image_size_params($image_id, 'full')
731
- # );
732
-
733
- // Ensure that fullsize dimensions are added to metadata array
734
- $dimensions = getimagesize($abs_filename);
735
- $full_meta = array(
736
- 'width' => $dimensions[0],
737
- 'height' => $dimensions[1]
738
- );
739
- if (!isset($image->meta_data) OR (is_string($image->meta_data) && strlen($image->meta_data) == 0)) {
740
- $image->meta_data = array();
741
- }
742
- $image->meta_data = array_merge($image->meta_data, $full_meta);
743
- $image->meta_data['full'] = $full_meta;
744
-
745
- // Generate a thumbnail for the image
746
- $this->object->generate_thumbnail($image);
747
-
748
- // Set gallery preview image if missing
749
- $this->object->get_registry()->get_utility('I_Gallery_Mapper')->set_preview_image($gallery, $image_id, TRUE);
750
-
751
- // Notify other plugins that an image has been added
752
- do_action('ngg_added_new_image', $image);
753
-
754
- // delete dirsize after adding new images
755
- delete_transient( 'dirsize_cache' );
756
-
757
- // Seems redundant to above hook. Maintaining for legacy purposes
758
- do_action(
759
- 'ngg_after_new_images_added',
760
- $gallery_id,
761
- array($image->$image_key)
762
- );
763
- }
764
- catch(Exception $ex) {
765
- throw new E_InsufficientWriteAccessException(
766
- FALSE, $abs_filename, FALSE, $ex
767
- );
768
- }
769
- }
770
- else throw new E_InvalidEntityException();
771
- }
772
-
773
- $retval['image_ids'][] = $image->{$image->id_field};
774
  }
775
 
 
776
  // Add the gallery name to the result
777
  $gallery = $gallery_mapper->find($gallery_id);
778
  $retval['gallery_name'] = $gallery->title;
@@ -1158,11 +1041,6 @@ class Mixin_GalleryStorage_Driver_Base extends Mixin
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
1165
- $size = getimagesize($image_path, $detailed_size);
1166
 
1167
  $result = $this->object->calculate_image_clone_result($image_path, $clone_path, $params);
1168
 
1
  <?php
2
 
3
+ class E_UploadException extends RuntimeException
4
  {
5
  function __construct($message='', $code=NULL, $previous=NULL)
6
  {
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
  parent::__construct($message, $code, $previous);
28
  }
29
  }
 
 
 
 
 
 
 
 
 
 
30
 
31
  class Mixin_GalleryStorage_Driver_Base extends Mixin
32
  {
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
  * 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
  * @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
  return $retval;
488
  }
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
 
491
  /**
492
  * Uploads base64 file to a gallery
495
  * @param type $filename specifies the name of the file
496
  * @return C_Image
497
  */
498
+ function upload_base64_image($gallery, $data, $filename=FALSE)
499
  {
500
  $settings = C_NextGen_Settings::get_instance();
501
  $memory_limit = intval(ini_get('memory_limit'));
504
  $retval = NULL;
505
  if (($gallery_id = $this->object->_get_gallery_id($gallery))) {
506
 
507
+ // Ensure that there is capacity available
508
+ if ( (is_multisite()) && nggWPMU::wpmu_enable_function('wpmuQuotaCheck')) {
509
+ if (upload_is_user_over_quota(FALSE)) {
510
+ throw new E_NoSpaceAvailableException();
511
+ }
512
  }
513
 
514
  // Get path information. The use of get_upload_abspath() might
529
  $filename = str_replace($match[0], '.'.$match[1], $filename);
530
  }
531
  $abs_filename = path_join($upload_dir, $filename);
 
 
 
 
 
 
 
 
 
532
 
533
+ // Create the database record
534
+ $factory = $this->object->get_registry()->get_utility('I_Component_Factory');
535
+ $retval = $image = $factory->create('image');
536
  $image->alttext = sanitize_title_with_dashes(basename($filename, '.' . pathinfo($filename, PATHINFO_EXTENSION)));
537
  $image->galleryid = $this->object->_get_gallery_id($gallery);
538
  $image->filename = $filename;
 
539
  $image_key = $this->object->_image_mapper->get_primary_key_column();
540
 
541
  // If we can't write to the directory, then there's no point in continuing
550
  if (($image_id = $this->object->_image_mapper->save($image))) {
551
  try {
552
  // Try writing the image
553
+ if (!@file_exists($upload_dir)) wp_mkdir_p($upload_dir);
554
  $fp = fopen($abs_filename, 'w');
555
  fwrite($fp, $data);
556
  fclose($fp);
596
  array($image->$image_key)
597
  );
598
  }
 
 
 
 
 
 
599
  catch(Exception $ex) {
600
  throw new E_InsufficientWriteAccessException(
601
  FALSE, $abs_filename, FALSE, $ex
611
  return $retval;
612
  }
613
 
614
+ function import_gallery_from_fs($abspath, $gallery_id=FALSE)
615
  {
616
  $retval = FALSE;
617
  if (@file_exists($abspath)) {
618
 
619
  // Ensure that this folder has images
620
+ $files = scandir($abspath);
621
+ array_shift($files);
622
+ array_shift($files);
 
 
 
 
 
 
 
 
 
623
  if (!empty($files)) {
624
 
625
  // Get needed utilities
628
 
629
  // Sometimes users try importing a directory, which actually has all images under another directory
630
  $first_file_abspath = $fs->join_paths($abspath, $files[0]);
631
+ if (is_dir($first_file_abspath)) return $this->import_gallery_from_fs($first_file_abspath, $gallery_id);
632
 
633
  // If no gallery has been specified, then use the directory name as the gallery name
634
  if (!$gallery_id) {
636
  $gallery = $gallery_mapper->create(array(
637
  'title' => basename($abspath),
638
  ));
 
 
 
 
639
 
640
  // Save the gallery
641
  if ($gallery->save()) $gallery_id = $gallery->id();
647
  foreach ($files as $file) {
648
  if (!preg_match("/\.(jpg|jpeg|gif|png)/i", $file)) continue;
649
  $file_abspath = $fs->join_paths($abspath, $file);
650
+ $image = $this->object->upload_base64_image(
651
+ $gallery_id,
652
+ file_get_contents($file_abspath),
653
+ str_replace(' ', '_', $file)
654
+ );
655
+ $retval['image_ids'][] = $image->{$image->id_field};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
  }
657
 
658
+
659
  // Add the gallery name to the result
660
  $gallery = $gallery_mapper->find($gallery_id);
661
  $retval['gallery_name'] = $gallery->title;
1041
  $crop_frame = isset($params['crop_frame']) ? $params['crop_frame'] : NULL;
1042
  $destpath = NULL;
1043
  $thumbnail = NULL;
 
 
 
 
 
1044
 
1045
  $result = $this->object->calculate_image_clone_result($image_path, $clone_path, $params);
1046
 
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=array(), $mapper=FALSE, $context=FALSE)
25
  {
26
  parent::define($mapper, $properties, $context);
27
  $this->add_mixin('Mixin_NextGen_Gallery_Image_Validation');
@@ -34,8 +34,7 @@ class C_Image extends C_DataMapper_Model
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) {
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
  * @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) {
products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.php CHANGED
@@ -8,38 +8,27 @@ 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, $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
  }
@@ -73,11 +62,9 @@ class Mixin_Gallery_Image_Mapper extends Mixin
73
  $retval = $this->call_parent('_save_entity', $entity);
74
  if ($retval) {
75
  include_once(NGGALLERY_ABSPATH.'/admin/functions.php');
76
- $image_id = $this->get_id($entity);
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
  }
@@ -122,7 +109,7 @@ class Mixin_Gallery_Image_Mapper extends Mixin
122
  {
123
  // If not set already, we'll add an exclude property. This is used
124
  // by NextGEN Gallery itself, as well as the Attach to Post module
125
- $this->object->_set_default_value($entity, 'exclude', 0);
126
 
127
  // Ensure that the object has a description attribute
128
  $this->object->_set_default_value($entity, 'description', '');
@@ -152,9 +139,18 @@ class Mixin_Gallery_Image_Mapper extends Mixin
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
  }
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
  }
62
  $retval = $this->call_parent('_save_entity', $entity);
63
  if ($retval) {
64
  include_once(NGGALLERY_ABSPATH.'/admin/functions.php');
65
+ $image_id = $this->get_id($entity);;
66
+ nggAdmin::import_MetaData($image_id);
67
+ C_Photocrati_Cache::flush();
 
 
68
  }
69
  return $retval;
70
  }
109
  {
110
  // If not set already, we'll add an exclude property. This is used
111
  // by NextGEN Gallery itself, as well as the Attach to Post module
112
+ $this->object->_set_default_value($entity, 'exclude', FALSE);
113
 
114
  // Ensure that the object has a description attribute
115
  $this->object->_set_default_value($entity, 'description', '');
139
  // Ensure that the exclude parameter is an integer or boolean-evaluated
140
  // value
141
  if (is_string($entity->exclude)) $entity->exclude = intval($entity->exclude);
142
+ }
143
+ }
144
 
145
+ /**
146
+ * Unserializes the metadata when fetched from the database
147
+ */
148
+ class Hook_Unserialize_Image_Metadata extends Hook
149
+ {
150
+ function unserialize_metadata($entity)
151
+ {
152
+ if (isset($entity->meta_data) && is_string($entity->meta_data)) {
153
+ $entity->meta_data = $this->object->unserialize($entity->meta_data);
154
+ }
155
  }
156
  }
products/photocrati_nextgen/modules/nextgen_data/class.image_wrapper.php CHANGED
@@ -13,20 +13,19 @@ class C_Image_Wrapper
13
  public $_orig_image_id; // original image ID
14
  public $_cache_overrides; // allow for forcing variable values
15
  public $_legacy = FALSE;
16
- public $_displayed_gallery; // cached object
17
 
18
  /**
19
  * Constructor. Converts the image class into an array and fills from defaults any missing values
20
  *
21
  * @param object $gallery Individual result from displayed_gallery->get_entities()
22
- * @param object $displayed_gallery Displayed gallery -- MAY BE NULL
23
  * @param bool $legacy Whether the image source is from NextGen Legacy or NextGen
24
  * @return void
25
  */
26
- public function __construct($image, $displayed_gallery=NULL, $legacy = FALSE)
27
  {
28
  // for clarity
29
- if ($displayed_gallery && isset($displayed_gallery->display_settings['number_of_columns']))
30
  {
31
  $columns = $displayed_gallery->display_settings['number_of_columns'];
32
  }
@@ -83,11 +82,11 @@ class C_Image_Wrapper
83
 
84
  // cache the results
85
  ksort($image);
 
86
  $id_field = (!empty($image['id_field']) ? $image['id_field'] : 'pid');
87
- $this->_cache = (array) apply_filters('ngg_image_object', (object) $image, $image[$id_field]);
88
  $this->_orig_image_id = $image[$id_field];
 
89
  $this->_legacy = $legacy;
90
- $this->_displayed_gallery = $displayed_gallery;
91
  }
92
 
93
  public function __set($name, $value)
@@ -274,13 +273,8 @@ class C_Image_Wrapper
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':
@@ -408,35 +402,27 @@ class C_Image_Wrapper
408
  */
409
  function get_thumbcode($gallery_name = '')
410
  {
411
- if (empty($this->_displayed_gallery))
 
 
 
 
 
 
412
  {
413
- $effect_code = C_NextGen_Settings::get_instance()->thumbCode;
414
- $effect_code = str_replace('%GALLERY_ID%', $gallery_name, $effect_code);
415
- $effect_code = str_replace('%GALLERY_NAME%', $gallery_name, $effect_code);
416
- $retval = $effect_code;
417
  }
418
- else {
419
- $controller = C_Component_Registry::get_instance()->get_utility('I_Display_Type_Controller');
420
- $retval = $controller->get_effect_code($this->_displayed_gallery);
421
 
422
- // This setting requires that we disable the effect code
423
- $ds = $this->_displayed_gallery->display_settings;
424
- if (isset($ds['use_imagebrowser_effect']) && $ds['use_imagebrowser_effect'])
425
- $retval = '';
 
 
 
426
  }
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;
440
  }
441
 
442
  /**
13
  public $_orig_image_id; // original image ID
14
  public $_cache_overrides; // allow for forcing variable values
15
  public $_legacy = FALSE;
 
16
 
17
  /**
18
  * Constructor. Converts the image class into an array and fills from defaults any missing values
19
  *
20
  * @param object $gallery Individual result from displayed_gallery->get_entities()
21
+ * @param object $displayed_gallery Displayed gallery
22
  * @param bool $legacy Whether the image source is from NextGen Legacy or NextGen
23
  * @return void
24
  */
25
+ public function __construct($image, $displayed_gallery, $legacy = FALSE)
26
  {
27
  // for clarity
28
+ if (isset($displayed_gallery->display_settings['number_of_columns']))
29
  {
30
  $columns = $displayed_gallery->display_settings['number_of_columns'];
31
  }
82
 
83
  // cache the results
84
  ksort($image);
85
+ $this->_cache = $image;
86
  $id_field = (!empty($image['id_field']) ? $image['id_field'] : 'pid');
 
87
  $this->_orig_image_id = $image[$id_field];
88
+
89
  $this->_legacy = $legacy;
 
90
  }
91
 
92
  public function __set($name, $value)
273
  $this->_orig_image->meta_data
274
  );
275
  }
276
+ $w = $this->_orig_image->meta_data['thumbnail']['width'];
277
+ $h = $this->_orig_image->meta_data['thumbnail']['height'];
 
 
 
 
 
278
  return "width='{$w}' height='{$h}'";
279
 
280
  case 'slug':
402
  */
403
  function get_thumbcode($gallery_name = '')
404
  {
405
+ $settings = $this->get_settings();
406
+
407
+ // clean up the name
408
+ $gallery_name = sanitize_title($gallery_name);
409
+
410
+ // get the effect code
411
+ if ('none' != $settings->get('thumbEffect'))
412
  {
413
+ $this->_cache['thumbcode'] = stripslashes($settings->get('thumbCode'));
 
 
 
414
  }
 
 
 
415
 
416
+ // for highslide to a different approach
417
+ if ('highslide' == $settings->get('thumbEffect'))
418
+ {
419
+ $this->_cache['thumbcode'] = str_replace('%GALLERY_NAME%', "'{$gallery_name}'", $this->_cache['thumbcode']);
420
+ }
421
+ else {
422
+ $this->_cache['thumbcode'] = str_replace('%GALLERY_NAME%', $gallery_name, $this->_cache['thumbcode']);
423
  }
424
 
425
+ return apply_filters('ngg_get_thumbcode', $this->_cache['thumbcode'], $this);
 
 
 
 
 
 
 
 
 
 
 
426
  }
427
 
428
  /**
products/photocrati_nextgen/modules/nextgen_data/class.nextgen_data_installer.php CHANGED
@@ -1,20 +1,15 @@
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) {
17
- /* Yes: this is commented twice.
18
  // TODO for now never delete galleries/albums/content
19
  # $mappers = array(
20
  # $this->get_registry()->get_utility('I_Album_Mapper'),
@@ -30,7 +25,6 @@ class C_NextGen_Data_Installer extends C_NggLegacy_Installer
30
  # global $wpdb;
31
  # $wpdb->query("DELETE FROM {$wpdb->terms} WHERE term_id IN (SELECT term_id FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag')");
32
  # $wpdb->query("DELETE FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag'");
33
- */
34
  }
35
  }
36
  }
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) {
 
13
  // TODO for now never delete galleries/albums/content
14
  # $mappers = array(
15
  # $this->get_registry()->get_utility('I_Album_Mapper'),
25
  # global $wpdb;
26
  # $wpdb->query("DELETE FROM {$wpdb->terms} WHERE term_id IN (SELECT term_id FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag')");
27
  # $wpdb->query("DELETE FROM {$wpdb->term_taxonomy} WHERE taxonomy='ngg_tag'");
 
28
  }
29
  }
30
  }
products/photocrati_nextgen/modules/nextgen_data/class.nextgen_metadata.php CHANGED
@@ -85,7 +85,7 @@ class C_NextGen_Metadata extends C_Component
85
  $meta = $this->image->meta_data;
86
 
87
  // check if we already import the meta data to the database
88
- if (!is_array($meta) || !isset($meta['saved']) OR ($meta['saved'] != TRUE))
89
  {
90
  return FALSE;
91
  }
85
  $meta = $this->image->meta_data;
86
 
87
  // check if we already import the meta data to the database
88
+ if (!is_array($meta) || ($meta['saved'] != TRUE))
89
  {
90
  return FALSE;
91
  }
products/photocrati_nextgen/modules/nextgen_data/class.ngglegacy_gallerystorage_driver.php CHANGED
@@ -161,33 +161,16 @@ class Mixin_NggLegacy_GalleryStorage_Driver extends Mixin
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,10 +638,15 @@ class Mixin_NggLegacy_GalleryStorage_Driver extends Mixin
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))
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
  }
639
 
640
  foreach ($images as $image) {
641
+
642
+ // Ensure that there is capacity available
643
+ if ((is_multisite()) && $settings->get('wpmuQuotaCheck'))
644
+ {
645
+ if (upload_is_user_over_quota(FALSE)) {
646
+ $message .= sprintf(__('Sorry, you have used your space allocation. Please delete some files to upload more files.', 'nggallery'));
647
+ throw new E_NoSpaceAvailableException();
648
+ }
649
+ }
650
 
651
  // Copy the db entry
652
  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
- throw new E_No_Image_Library_Exception();
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', '512M');
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
+ C_NextGEN_Bootstrap::shutdown();
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', '128M');
165
 
166
  if($this->error == false) {
167
  // Check memory consumption if file exists
products/photocrati_nextgen/modules/nextgen_data/mixin.nextgen_table_extras.php DELETED
@@ -1,195 +0,0 @@
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.4',
19
  'http://www.photocrati.com',
20
  'Photocrati Media',
21
  'http://www.photocrati.com'
@@ -61,7 +61,6 @@ 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
- '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,26 +80,8 @@ class M_NextGen_Data extends C_Base_Module
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
  {
15
  'photocrati-nextgen-data',
16
  'NextGEN Data Tier',
17
  "Provides a data tier for NextGEN gallery based on the DataMapper module",
18
+ '0.2',
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
  '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
 
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
  {
products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.displayed_gallery_related_element.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class A_Displayed_Gallery_Related_Element extends Mixin
4
+ {
5
+ function initialize()
6
+ {
7
+ $this->object->add_post_hook(
8
+ 'render_object',
9
+ 'Renders "related" link for the gallery',
10
+ get_class(),
11
+ 'render_related'
12
+ );
13
+ }
14
+
15
+ function _check_rendering($displayed_gallery, $template_id, $root_element)
16
+ {
17
+ $ret = $this->object->_check_addition_rendering($displayed_gallery, $template_id, $root_element, 'layout');
18
+
19
+ switch ($template_id)
20
+ {
21
+ case 'photocrati-nextgen_basic_album#compact':
22
+ case 'photocrati-nextgen_basic_album#extended':
23
+ case 'photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud':
24
+ {
25
+ $ret = false;
26
+
27
+ break;
28
+ }
29
+ }
30
+
31
+ return $ret;
32
+ }
33
+
34
+ function render_related()
35
+ {
36
+ if (!C_NextGen_Settings::get_instance()->get('activateTags')) return;
37
+
38
+ $root_element = $this->object->get_method_property(
39
+ $this->method_called,
40
+ ExtensibleObject::METHOD_PROPERTY_RETURN_VALUE
41
+ );
42
+
43
+ $displayed_type = $this->object->get_param('display_type_rendering');
44
+ $displayed_gallery = $this->object->get_param('displayed_gallery');
45
+ $template_id = $root_element->get_id();
46
+
47
+ if (!$this->object->_check_rendering($displayed_gallery, $template_id, $root_element))
48
+ return;
49
+
50
+ if ($displayed_type && $displayed_gallery != null)
51
+ {
52
+ $list = $root_element->find('nextgen_gallery.gallery_container', TRUE);
53
+ foreach ($list as $container_element) {
54
+ $container_element->append($this->object->render_related_string());
55
+ }
56
+ }
57
+
58
+ return $root_element;
59
+ }
60
+
61
+ function render_related_string()
62
+ {
63
+ $settings = C_NextGen_Settings::get_instance();
64
+ $type = $settings->appendType;
65
+ $maxImages = $settings->maxImages;
66
+ $sluglist = array();
67
+
68
+ switch ($type) {
69
+ case 'tags':
70
+ if (function_exists('get_the_tags'))
71
+ {
72
+ $taglist = get_the_tags();
73
+ if (is_array($taglist)) {
74
+ foreach ($taglist as $tag) {
75
+ $sluglist[] = $tag->slug;
76
+ }
77
+ }
78
+ }
79
+ break;
80
+ case 'category':
81
+ $catlist = get_the_category();
82
+ if (is_array($catlist))
83
+ {
84
+ foreach ($catlist as $cat) {
85
+ $sluglist[] = $cat->category_nicename;
86
+ }
87
+ }
88
+ break;
89
+ }
90
+
91
+ $taglist = implode(',', $sluglist);
92
+
93
+ if ($taglist === 'uncategorized' || empty($taglist))
94
+ return;
95
+
96
+ $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
97
+ $view = C_Component_Registry::get_instance()->get_utility('I_Component_Factory')
98
+ ->create('mvc_view', '');
99
+ $retval = $renderer->display_images(array(
100
+ 'source' => 'tags',
101
+ 'container_ids' => $taglist,
102
+ 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS,
103
+ 'images_per_page' => $maxImages,
104
+ 'maximum_entity_count' => $maxImages,
105
+ 'template' => $view->get_template_abspath('photocrati-nextgen_gallery_display#related'),
106
+ 'show_all_in_lightbox' => FALSE,
107
+ 'show_slideshow_link' => FALSE,
108
+ 'disable_pagination' => TRUE
109
+ ));
110
+
111
+ return apply_filters('ngg_show_related_gallery_content', $retval, $taglist);
112
+ }
113
+
114
+ }
products/photocrati_nextgen/modules/nextgen_gallery_display/adapter.gallery_display_ajax.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- class A_Gallery_Display_Ajax extends Mixin
4
- {
5
- function render_displayed_gallery_action()
6
- {
7
- $retval = array();
8
-
9
- if (isset($_POST['ajax_referrer'])) {
10
- $_SERVER['REQUEST_URI'] = $_POST['ajax_referrer'];
11
- C_Router::get_instance()->serve_request();
12
- }
13
-
14
- if (isset($_POST['displayed_gallery_id'])) {
15
- $displayed_gallery = new C_Displayed_Gallery();
16
- $displayed_gallery->apply_transient($_POST['displayed_gallery_id']);
17
- $renderer = C_Displayed_Gallery_Renderer::get_instance();
18
- $retval['html'] = $renderer->render($displayed_gallery, TRUE);
19
- }
20
-
21
- return $retval;
22
- }
23
- }
24
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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($properties=array(), $mapper=FALSE, $context=FALSE)
12
  {
13
- return new C_Display_Type($properties, $mapper, $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($properties=array(), $mapper=FALSE, $context=FALSE)
23
  {
24
- return new C_Displayed_Gallery($properties, $mapper, $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($properties=array(), $mapper=FALSE, $context=FALSE)
35
  {
36
- return new C_Displayed_Gallery_Source($properties, $mapper, $context);
37
  }
38
  }
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
  * @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
  * @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
  }
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($properties=array(), $mapper=FALSE, $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($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);
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
  * @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);
products/photocrati_nextgen/modules/nextgen_gallery_display/class.display_type_controller.php CHANGED
@@ -7,7 +7,6 @@
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,16 +69,15 @@ class Mixin_Display_Type_Controller extends Mixin
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,7 +243,7 @@ class Mixin_Display_Type_Controller extends Mixin
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,8 +260,6 @@ class Mixin_Display_Type_Controller extends Mixin
262
  }
263
 
264
  $script->extra['data'] = $data;
265
-
266
- unset($script);
267
  }
268
 
269
  return $retval;
7
  class C_Display_Type_Controller extends C_MVC_Controller
8
  {
9
  static $_instances = array();
 
10
 
11
  function define($context=FALSE)
12
  {
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('', 'lightbox')),
79
  TRUE,
80
+ FALSE
81
  );
82
 
83
  {
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
  }
261
 
262
  $script->extra['data'] = $data;
 
 
263
  }
264
 
265
  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, $not_used=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($object_name, $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 (isset($display_type->entity_types) && 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)
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(NULL, $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 (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($properties=array(), $mapper=FALSE, $context=FALSE)
21
  {
22
  parent::define($mapper, $properties, $context);
23
  $this->add_mixin('Mixin_Displayed_Gallery_Validation');
@@ -33,12 +33,10 @@ 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($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
 
@@ -78,7 +76,7 @@ class Mixin_Displayed_Gallery_Validation extends Mixin
78
 
79
  // If no maximum_entity_count has been given, then set a maximum
80
  if (!isset($this->object->maximum_entity_count)) {
81
- $this->object->maximum_entity_count = C_Photocrati_Settings_Manager::get('maximum_entity_count', 500);
82
  }
83
 
84
  }
@@ -92,28 +90,6 @@ class Mixin_Displayed_Gallery_Validation extends Mixin
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,7 +134,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
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
 
@@ -192,14 +168,13 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
192
  $select,
193
  $image_key,
194
  $sortorder_set,
195
- 'new_sortorder',
196
  TRUE
197
  );
198
  // A user might want to sort the results by the order of
199
  // images that they specified to be included. For that,
200
  // we need some trickery by reversing the order direction
201
  $sort_direction = $this->object->order_direction == 'ASC' ? 'DESC' : 'ASC';
202
- $sort_by = 'new_sortorder';
203
  }
204
 
205
  // Add exclude column
@@ -229,11 +204,10 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
229
  $select,
230
  $image_key,
231
  $this->object->sortorder,
232
- 'new_sortorder',
233
  TRUE
234
  );
235
  $sort_direction = $this->object->order_direction == 'ASC' ? 'DESC' : 'ASC';
236
- $sort_by = 'new_sortorder';
237
  }
238
  $mapper->select($select);
239
 
@@ -265,11 +239,10 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
265
  $select,
266
  $image_key,
267
  $this->object->sortorder,
268
- 'new_sortorder',
269
  TRUE
270
  );
271
  $sort_direction = $this->object->order_direction == 'ASC' ? 'DESC' : 'ASC';
272
- $sort_by = 'new_sortorder';
273
  }
274
 
275
  // Mark each result as excluded
@@ -308,7 +281,9 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
308
  // Container ids are tags
309
  if ($source_obj->name == 'tags') {
310
  $term_ids = $this->object->get_term_ids_for_tags($this->object->container_ids);
311
- $mapper->where(array("{$image_key} IN %s",get_objects_in_term($term_ids, 'ngg_tag')));
 
 
312
  }
313
 
314
  // Container ids are gallery ids
@@ -317,21 +292,6 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
317
  }
318
  }
319
 
320
- // Filter based on excluded container ids
321
- if ($this->object->excluded_container_ids) {
322
-
323
- // Container ids are tags
324
- if ($source_obj->name == 'tags') {
325
- $term_ids = $this->object->get_term_ids_for_tags($this->object->excluded_container_ids);
326
- $mapper->where(array("{$image_key} NOT IN %s",get_objects_in_term($term_ids, 'ngg_tag')));
327
- }
328
-
329
- // Container ids are gallery ids
330
- else {
331
- $mapper->where(array("galleryid NOT IN %s", $this->object->excluded_container_ids));
332
- }
333
- }
334
-
335
  // Adjust the query more based on what source was selected
336
  if ($this->object->source == 'recent_images') {
337
  $sort_direction = 'DESC';
@@ -344,7 +304,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
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,9 +312,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
352
  else $mapper->limit($limit);
353
  }
354
 
355
- $results = $mapper->run_query();
356
-
357
- return $results;
358
  }
359
 
360
  /**
@@ -376,7 +334,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
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,8 +389,8 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
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,8 +468,8 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
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) {
@@ -607,7 +565,7 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
607
  unset($counts[$id]);
608
  }
609
  }
610
-
611
  $retval[] = $gallery;
612
  }
613
  }
@@ -752,30 +710,23 @@ class Mixin_Displayed_Gallery_Queries extends Mixin
752
  {
753
  global $wpdb;
754
 
 
 
 
 
755
  // If no tags were provided, get them from the container_ids
756
  if (!$tags) $tags = $this->object->container_ids;
757
 
758
  // Convert container ids to a string suitable for WHERE IN
759
  $container_ids = array();
760
- if (!in_array('all', array_map('strtolower', $tags))) {
761
- foreach ($tags as $container) {
762
- $container_ids[]= "'{$container}'";
763
- }
764
- $container_ids = implode(',', $container_ids);
765
  }
766
-
767
- // Construct query
768
- $query = "SELECT {$wpdb->term_taxonomy}.term_id FROM {$wpdb->term_taxonomy}
769
- INNER JOIN {$wpdb->terms} ON {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id
770
- WHERE {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id
771
- AND {$wpdb->term_taxonomy}.taxonomy = %s";
772
- if (!empty($container_ids))
773
- $query .= " AND ({$wpdb->terms}.slug IN ({$container_ids}) OR {$wpdb->terms}.name IN ({$container_ids}))";
774
- $query .= " ORDER BY {$wpdb->terms}.term_id";
775
- $query = $wpdb->prepare($query, 'ngg_tag');
776
 
777
  // Get all term_ids for each image tag slug
778
  $term_ids = array();
 
779
  foreach ($wpdb->get_results($query) as $row) {
780
  $term_ids[] = $row->term_id;
781
  }
@@ -846,13 +797,9 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
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,14 +850,32 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
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
  }
@@ -920,19 +885,9 @@ class Mixin_Displayed_Gallery_Instance_Methods extends Mixin
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
-
936
- return $retval;
937
  }
938
  }
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
  * @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
 
76
 
77
  // If no maximum_entity_count has been given, then set a maximum
78
  if (!isset($this->object->maximum_entity_count)) {
79
+ $this->object->maximum_entity_count = C_Photocrati_Global_Settings_Manager::get('maximum_entity_count', 500);
80
  }
81
 
82
  }
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
  // 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
 
168
  $select,
169
  $image_key,
170
  $sortorder_set,
171
+ 'sortorder',
172
  TRUE
173
  );
174
  // A user might want to sort the results by the order of
175
  // images that they specified to be included. For that,
176
  // we need some trickery by reversing the order direction
177
  $sort_direction = $this->object->order_direction == 'ASC' ? 'DESC' : 'ASC';
 
178
  }
179
 
180
  // Add exclude column
204
  $select,
205
  $image_key,
206
  $this->object->sortorder,
207
+ 'sortorder',
208
  TRUE
209
  );
210
  $sort_direction = $this->object->order_direction == 'ASC' ? 'DESC' : 'ASC';
 
211
  }
212
  $mapper->select($select);
213
 
239
  $select,
240
  $image_key,
241
  $this->object->sortorder,
242
+ 'sortorder',
243
  TRUE
244
  );
245
  $sort_direction = $this->object->order_direction == 'ASC' ? 'DESC' : 'ASC';
 
246
  }
247
 
248
  // Mark each result as excluded
281
  // Container ids are tags
282
  if ($source_obj->name == 'tags') {
283
  $term_ids = $this->object->get_term_ids_for_tags($this->object->container_ids);
284
+ if ($term_ids) {
285
+ $mapper->where(array("{$image_key} IN %s",get_objects_in_term($term_ids, 'ngg_tag')));
286
+ }
287
  }
288
 
289
  // Container ids are gallery ids
292
  }
293
  }
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  // Adjust the query more based on what source was selected
296
  if ($this->object->source == 'recent_images') {
297
  $sort_direction = 'DESC';
304
  }
305
 
306
  // Apply a sorting order
307
+ if ($sort_by) $mapper->order_by($sort_by, $sort_direction);
308
 
309
  // Apply a limit
310
  if ($limit) {
312
  else $mapper->limit($limit);
313
  }
314
 
315
+ return $mapper->run_query();
 
 
316
  }
317
 
318
  /**
334
  $album_key = $album_mapper->get_primary_key_column();
335
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
336
  $gallery_key = $gallery_mapper->get_primary_key_column();
337
+ $select = $id_only ? $album_key.", sortorder" : '*';
338
  $retval = array();
339
 
340
  // If no exclusions are specified, are entity_ids are specified,
389
  // always take precedence
390
  $included_ids = $this->object->entity_ids;
391
  foreach ($this->object->exclusions as $excluded_id) {
392
+ if (($index = array_search($excluded_id, $included_entity_ids)) !== FALSE) {
393
+ unset($included_entity_ids[$index]);
394
  }
395
  }
396
  $excluded_ids = array_diff($entity_ids, $included_ids);
468
  $gallery_mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
469
  $image_mapper = $this->object->get_registry()->get_utility('I_Image_Mapper');
470
  $gallery_key = $gallery_mapper->get_primary_key_column();
471
+ $album_select = ($id_only ? $album_key : '*').", 1 AS is_album, 0 AS is_gallery, name AS title, albumdesc AS galdesc";
472
+ $gallery_select = ($id_only ? $gallery_key : '*').", 1 AS is_gallery, 0 AS is_album";
473
 
474
  // Modify the sort order of the entities
475
  if ($this->object->sortorder) {
565
  unset($counts[$id]);
566
  }
567
  }
568
+
569
  $retval[] = $gallery;
570
  }
571
  }
710
  {
711
  global $wpdb;
712
 
713
+ // don't run for galleries without a container-id, like the tagcloud
714
+ if (!$tags && empty($this->object->container_ids))
715
+ return array();
716
+
717
  // If no tags were provided, get them from the container_ids
718
  if (!$tags) $tags = $this->object->container_ids;
719
 
720
  // Convert container ids to a string suitable for WHERE IN
721
  $container_ids = array();
722
+ foreach ($tags as $container) {
723
+ $container_ids[]= "'{$container}'";
 
 
 
724
  }
725
+ $container_ids = implode(',', $container_ids);
 
 
 
 
 
 
 
 
 
726
 
727
  // Get all term_ids for each image tag slug
728
  $term_ids = array();
729
+ $query = $wpdb->prepare("SELECT term_id FROM $wpdb->terms WHERE slug IN ({$container_ids}) ORDER BY term_id ASC ", NULL);
730
  foreach ($wpdb->get_results($query) as $row) {
731
  $term_ids[] = $row->term_id;
732
  }
797
  */
798
  function get_source()
799
  {
 
800
  $sources = $this->object->_get_source_map();
801
+ $mapper = $this->get_registry()->get_utility('I_Displayed_Gallery_Source_Mapper');
802
+ $retval = $mapper->find_by_name($sources[$this->object->source], TRUE);
 
 
 
803
  return $retval;
804
  }
805
 
850
  */
851
  function to_transient()
852
  {
853
+ // TODO: put this someplace more appropriate
854
+ // If the source is random do a separate image id lookup and fill those values into the gallery entity_ids
855
+ // This is necessary for compat w/Pro Lightbox so it can retrieve (through it's iframe request) the same images
856
+ // the viewer was previously looking at.
857
+ if (in_array($this->object->source, array('random', 'random_images')) && empty($this->object->entity_ids))
858
+ {
859
+ global $wpdb;
860
+
861
+ $image_ids = array();
862
+ $limit = (!empty($this->object->display_settings['images_per_page']) ? $this->object->display_settings['images_per_page'] : $this->object->maximum_entity_count);
863
+
864
+ $sql = "SELECT `pid` FROM `{$wpdb->nggpictures}` WHERE `exclude` = 0";
865
+ if (!empty($this->object->exclusions))
866
+ $sql .= sprintf(" AND `pid` NOT IN (%s)", implode(',', $this->object->exclusions));
867
+ $sql .= " ORDER BY RAND() LIMIT {$limit}";
868
+
869
+ foreach ($wpdb->get_results($sql, ARRAY_N) as $res) {
870
+ $image_ids[] = reset($res);
871
+ }
872
+
873
+ $this->object->entity_ids = $image_ids;
874
+ }
875
+
876
  $group = 'displayed_galleries';
877
  $key = C_Photocrati_Cache::generate_key($this->object->get_entity(), $group);
878
+ C_Photocrati_Cache::set($key, $this->object->get_entity(), $group);
 
 
 
 
 
879
 
880
  return $key;
881
  }
885
  * Applies the values of a transient to this object
886
  * @param string $transient_id
887
  */
888
+ function apply_transient($transient_id)
889
  {
890
+ if (($transient = C_Photocrati_Cache::get($transient_id, 'displayed_galleries')))
 
 
 
 
891
  $this->object->_stdObject = $transient;
 
 
 
 
 
 
892
  }
893
  }
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, $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');
@@ -90,7 +90,6 @@ class Mixin_Displayed_Gallery_Defaults extends Mixin
90
 
91
  // Ensure other properties exist
92
  $this->object->_set_default_value($entity, 'container_ids', array());
93
- $this->object->_set_default_value($entity, 'excluded_container_ids', array());
94
  $this->object->_seT_default_value($entity, 'sortorder', array());
95
  $this->object->_set_default_value($entity, 'entity_ids', array());
96
  $this->object->_set_default_value($entity, 'returns', 'included');
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');
90
 
91
  // Ensure other properties exist
92
  $this->object->_set_default_value($entity, 'container_ids', array());
 
93
  $this->object->_seT_default_value($entity, 'sortorder', array());
94
  $this->object->_set_default_value($entity, 'entity_ids', array());
95
  $this->object->_set_default_value($entity, 'returns', 'included');
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', $args, $mapper);
190
 
191
  unset($factory);
192
  }
@@ -198,15 +198,11 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
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
  }
204
- else {
205
- if (C_NextGEN_Bootstrap::$debug)
206
- $retval = "Invalid Displayed Gallery" . var_dump($displayed_gallery->get_errors());
207
- else
208
- $retval = "Gallery not found. Please <strong>check your settings</strong>.";
209
- }
210
  }
211
  else {
212
  $retval = "Invalid Displayed Gallery";
@@ -214,26 +210,6 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
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,58 +217,37 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
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,43 +264,43 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
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
  }
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', $mapper, $args);
190
 
191
  unset($factory);
192
  }
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
  }
205
+ else $retval = "Invalid Displayed Gallery".var_dump($displayed_gallery->get_errors());
 
 
 
 
 
206
  }
207
  else {
208
  $retval = "Invalid Displayed Gallery";
210
  return $retval;
211
  }
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
  /**
215
  * Renders a displayed gallery on the frontend
217
  */
218
  function render($displayed_gallery, $return=FALSE, $mode = null)
219
  {
220
+ if ($mode == null)
221
+ {
222
+ $mode = 'normal';
223
+ }
224
+
225
+ // Save the displayed gallery as a transient
226
+ $displayed_gallery->transient_id = $displayed_gallery->to_transient();
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
  // Get the display type controller
229
  $controller = $this->get_registry()->get_utility(
230
  'I_Display_Type_Controller', $displayed_gallery->display_type
231
  );
232
 
233
+ // Enqueue any necessary static resources
234
+ $controller->enqueue_frontend_resources($displayed_gallery);
235
+
236
  // Get routing info
237
  $router = $url = C_Router::get_instance();
238
  $url = $router->get_url($router->get_request_uri(), TRUE);
239
 
240
  // Should we lookup in cache?
241
+ $lookup = TRUE;
242
+ if ($displayed_gallery->source == 'random_images') $lookup = FALSE;
243
+ elseif (is_array($displayed_gallery->container_ids) && in_array('All', $displayed_gallery->container_ids)) $lookup = FALSE;
244
  elseif ($displayed_gallery->source == 'albums' && ($controller->param('gallery')) OR $controller->param('album')) $lookup = FALSE;
245
+ elseif (!$controller->cachable) $lookup = FALSE;
 
 
 
 
246
 
247
  // Try cache lookup, if we're to do so
248
  $key = null;
249
  $html = FALSE;
250
  if ($lookup) {
 
 
 
 
 
 
 
 
 
 
251
  // Some settings affect display types
252
  $settings = C_NextGen_Settings::get_instance();
253
  $key_params = apply_filters('ngg_displayed_gallery_cache_params', array(
264
  ));
265
 
266
  // Try getting the rendered HTML from the cache
267
+ $key = C_Photocrati_Cache::generate_key($key_params);
268
+ $html = C_Photocrati_Cache::get($key, FALSE);
 
 
 
 
 
269
 
270
  // TODO: This is hack. We need to figure out a more uniform way of detecting dynamic image urls
271
+ if (strpos($html, C_Photocrati_Settings_Manager::get_instance()->dynamic_thumbnail_slug) !== FALSE) {
272
  $html = FALSE; // forces the cache to be re-generated
273
  }
274
  }
 
 
 
 
 
 
275
 
276
  // If a cached version doesn't exist, then create the cache
277
  if (!$html) {
 
 
 
278
  $current_mode = $controller->get_render_mode();
279
  $controller->set_render_mode($mode);
280
  $html = $controller->index_action($displayed_gallery, TRUE);
281
+ if ($key != null)
282
+ C_Photocrati_Cache::set($key, $html);
283
  $controller->set_render_mode($current_mode);
 
 
 
284
 
285
+ // Compress the html to avoid wpautop problems
286
+ $html = $this->compress_html($html);
287
+ }
288
 
289
+ if (!$return) echo $html;
290
 
291
+ return $html;
292
  }
293
+
294
+ /**
295
+ * Removes any un-nessessary whitespace from the HTML
296
+ * @param string $html
297
+ * @return string
298
+ */
299
+ function compress_html($html)
300
+ {
301
+ $html = preg_replace("/>\\s+/", ">", $html);
302
+ $html = preg_replace("/\\s+</", "<", $html);
303
+ $html = preg_replace("/<!--(?:(?!-->).)*-->/m", "", $html);
304
+ return $html;
305
+ }
306
  }
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($properties=array(), $mapper=FALSE, $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($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);
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
  * @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);
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, $not_used=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($object_name, $context);
39
 
40
  // Add the mixin of instance methods
41
  $this->add_mixin('Mixin_Displayed_Gallery_Source_Mapper');
@@ -85,7 +85,5 @@ class Mixin_Displayed_Gallery_Source_Mapper extends Mixin
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
  }
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
  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
  function set_defaults($entity)
86
  {
87
  if (!isset($entity->aliases)) $entity->aliases = array();
 
 
88
  }
89
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/class.gallery_display_installer.php CHANGED
@@ -94,8 +94,7 @@ 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
- 'has_variations' => TRUE
99
  ));
100
 
101
  $this->install_displayed_gallery_source('recent_images', array(
@@ -122,7 +121,6 @@ class C_Gallery_Display_Installer
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();
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
  // 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();
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.7',
23
  'http://www.photocrati.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
@@ -82,19 +82,13 @@ class M_Gallery_Display extends C_Base_Module
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',
94
- 'A_Gallery_Display_Ajax'
95
  );
96
 
97
  $this->get_registry()->add_adapter('I_MVC_View', 'A_Gallery_Display_View');
 
98
  }
99
 
100
  /**
@@ -103,110 +97,22 @@ class M_Gallery_Display extends C_Base_Module
103
  function _register_hooks()
104
  {
105
  // Add a shortcode for displaying galleries
106
- C_NextGen_Shortcode_Manager::add('ngg_images', array(&$this, 'display_images'));
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()
144
- {
145
- $settings = C_NextGen_Settings::get_instance();
146
- $type = $settings->appendType;
147
- $maxImages = $settings->maxImages;
148
- $sluglist = array();
149
 
150
- switch ($type) {
151
- case 'tags':
152
- if (function_exists('get_the_tags'))
153
- {
154
- $taglist = get_the_tags();
155
- if (is_array($taglist)) {
156
- foreach ($taglist as $tag) {
157
- $sluglist[] = $tag->slug;
158
- }
159
- }
160
- }
161
- break;
162
- case 'category':
163
- $catlist = get_the_category();
164
- if (is_array($catlist))
165
- {
166
- foreach ($catlist as $cat) {
167
- $sluglist[] = $cat->category_nicename;
168
- }
169
- }
170
- break;
171
- }
172
-
173
- $taglist = implode(',', $sluglist);
174
-
175
- if ($taglist === 'uncategorized' || empty($taglist))
176
- return;
177
-
178
- $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
179
- $view = C_Component_Registry::get_instance()->get_utility('I_Component_Factory')
180
- ->create('mvc_view', '');
181
- $retval = $renderer->display_images(array(
182
- 'source' => 'tags',
183
- 'container_ids' => $taglist,
184
- 'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS,
185
- 'images_per_page' => $maxImages,
186
- 'maximum_entity_count' => $maxImages,
187
- 'template' => $view->get_template_abspath('photocrati-nextgen_gallery_display#related'),
188
- 'show_all_in_lightbox' => FALSE,
189
- 'show_slideshow_link' => FALSE,
190
- 'disable_pagination' => TRUE,
191
- 'display_no_images_error' => FALSE
192
- ));
193
-
194
- return apply_filters('ngg_show_related_gallery_content', $retval, $taglist);
195
- }
196
-
197
- function _render_related_images($content)
198
- {
199
- $settings = C_NextGen_Settings::get_instance();
200
-
201
- if ($settings->get('activateTags')) {
202
- $related = $this->_render_related_string();
203
-
204
- if ($related != null) {
205
- $heading = $settings->relatedHeading;
206
- $content .= $heading . $related;
207
- }
208
- }
209
-
210
  return $content;
211
  }
212
 
@@ -232,21 +138,7 @@ class M_Gallery_Display extends C_Base_Module
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',
@@ -259,12 +151,6 @@ class M_Gallery_Display extends C_Base_Module
259
  $router->get_static_url('photocrati-nextgen_gallery_display#nextgen_gallery_display_settings.css')
260
  );
261
 
262
- wp_register_style(
263
- 'nextgen_gallery_related_images',
264
- $router->get_static_url('photocrati-nextgen_gallery_display#nextgen_gallery_related_images.css')
265
- );
266
- wp_enqueue_style('nextgen_gallery_related_images');
267
-
268
  wp_register_script(
269
  'jquery.nextgen_radio_toggle',
270
  $router->get_static_url('photocrati-nextgen_gallery_display#jquery.nextgen_radio_toggle.js'),
@@ -318,31 +204,31 @@ class M_Gallery_Display extends C_Base_Module
318
  function get_type_list()
319
  {
320
  return array(
321
- 'A_Gallery_Display_Ajax' => 'adapter.gallery_display_ajax.php',
322
  'A_Display_Settings_Controller' => 'adapter.display_settings_controller.php',
323
- 'A_Display_Settings_Page' => 'adapter.display_settings_page.php',
324
- 'A_Gallery_Display_Factory' => 'adapter.gallery_display_factory.php',
325
- 'C_Gallery_Display_Installer' => 'class.gallery_display_installer.php',
326
- 'A_Gallery_Display_View' => 'adapter.gallery_display_view.php',
327
- 'C_Displayed_Gallery' => 'class.displayed_gallery.php',
328
- 'C_Displayed_Gallery_Mapper' => 'class.displayed_gallery_mapper.php',
329
- 'C_Displayed_Gallery_Renderer' => 'class.displayed_gallery_renderer.php',
330
- 'C_Displayed_Gallery_Source' => 'class.displayed_gallery_source.php',
 
331
  'C_Displayed_Gallery_Source_Mapper' => 'class.displayed_gallery_source_mapper.php',
332
- 'C_Display_Type' => 'class.display_type.php',
333
- 'C_Display_Type_Controller' => 'class.display_type_controller.php',
334
- 'C_Display_Type_Mapper' => 'class.display_type_mapper.php',
335
  'Hook_Propagate_Thumbnail_Dimensions_To_Settings' => 'hook.propagate_thumbnail_dimensions_to_settings.php',
336
- 'I_Displayed_Gallery' => 'interface.displayed_gallery.php',
337
- 'I_Displayed_Gallery_Mapper' => 'interface.displayed_gallery_mapper.php',
338
- 'I_Displayed_Gallery_Renderer' => 'interface.displayed_gallery_renderer.php',
339
- 'I_Displayed_Gallery_Source' => 'interface.displayed_gallery_source.php',
340
  'I_Displayed_Gallery_Source_Mapper' => 'interface.displayed_gallery_source_mapper.php',
341
  'I_Display_Settings_Controller' => 'interface.display_settings_controller.php',
342
- 'I_Display_Type' => 'interface.display_type.php',
343
- 'I_Display_Type_Controller' => 'interface.display_type_controller.php',
344
- 'I_Display_Type_Mapper' => 'interface.display_type_mapper.php',
345
- 'Mixin_Display_Type_Form' => 'mixin.display_type_form.php'
346
  );
347
  }
348
  }
19
  'photocrati-nextgen_gallery_display',
20
  'Gallery Display',
21
  'Provides the ability to display gallery of images',
22
+ '0.2',
23
  'http://www.photocrati.com',
24
  'Photocrati Media',
25
  'http://www.photocrati.com'
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('I_MVC_View', 'A_Gallery_Display_View');
91
+ $this->get_registry()->add_adapter('I_MVC_View', 'A_Displayed_Gallery_Related_Element');
92
  }
93
 
94
  /**
97
  function _register_hooks()
98
  {
99
  // Add a shortcode for displaying galleries
100
+ add_shortcode('ngg_images', array(&$this, 'display_images'));
101
  add_action('init', array(&$this, '_register_resources'));
102
  add_action('admin_bar_menu', array(&$this, 'add_admin_bar_menu'), 100);
103
+ add_filter('the_content', array(&$this, 'disable_pp_formatter'), 1);
 
 
104
  }
105
 
106
+ /**
107
+ *
108
+ */
109
+ function disable_pp_formatter($content)
110
  {
111
+ // Reposition the filter
112
+ remove_filter('the_content', 'pp_formatter', 99);
113
+ if (function_exists('pp_formatter'))
114
+ add_filter('the_content', 'pp_formatter');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  return $content;
117
  }
118
 
138
  */
139
  function _register_resources()
140
  {
141
+ $router = $this->get_registry()->get_utility('I_Router');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
  wp_register_script(
144
  'nextgen_gallery_display_settings',
151
  $router->get_static_url('photocrati-nextgen_gallery_display#nextgen_gallery_display_settings.css')
152
  );
153
 
 
 
 
 
 
 
154
  wp_register_script(
155
  'jquery.nextgen_radio_toggle',
156
  $router->get_static_url('photocrati-nextgen_gallery_display#jquery.nextgen_radio_toggle.js'),
204
  function get_type_list()
205
  {
206
  return array(
 
207
  'A_Display_Settings_Controller' => 'adapter.display_settings_controller.php',
208
+ 'A_Display_Settings_Page' => 'adapter.display_settings_page.php',
209
+ 'A_Displayed_Gallery_Related_Element' => 'adapter.displayed_gallery_related_element.php',
210
+ 'A_Gallery_Display_Factory' => 'adapter.gallery_display_factory.php',
211
+ 'C_Gallery_Display_Installer' => 'class.gallery_display_installer.php',
212
+ 'A_Gallery_Display_View' => 'adapter.gallery_display_view.php',
213
+ 'C_Displayed_Gallery' => 'class.displayed_gallery.php',
214
+ 'C_Displayed_Gallery_Mapper' => 'class.displayed_gallery_mapper.php',
215
+ 'C_Displayed_Gallery_Renderer' => 'class.displayed_gallery_renderer.php',
216
+ 'C_Displayed_Gallery_Source' => 'class.displayed_gallery_source.php',
217
  'C_Displayed_Gallery_Source_Mapper' => 'class.displayed_gallery_source_mapper.php',
218
+ 'C_Display_Type' => 'class.display_type.php',
219
+ 'C_Display_Type_Controller' => 'class.display_type_controller.php',
220
+ 'C_Display_Type_Mapper' => 'class.display_type_mapper.php',
221
  'Hook_Propagate_Thumbnail_Dimensions_To_Settings' => 'hook.propagate_thumbnail_dimensions_to_settings.php',
222
+ 'I_Displayed_Gallery' => 'interface.displayed_gallery.php',
223
+ 'I_Displayed_Gallery_Mapper' => 'interface.displayed_gallery_mapper.php',
224
+ 'I_Displayed_Gallery_Renderer' => 'interface.displayed_gallery_renderer.php',
225
+ 'I_Displayed_Gallery_Source' => 'interface.displayed_gallery_source.php',
226
  'I_Displayed_Gallery_Source_Mapper' => 'interface.displayed_gallery_source_mapper.php',
227
  'I_Display_Settings_Controller' => 'interface.display_settings_controller.php',
228
+ 'I_Display_Type' => 'interface.display_type.php',
229
+ 'I_Display_Type_Controller' => 'interface.display_type_controller.php',
230
+ 'I_Display_Type_Mapper' => 'interface.display_type_mapper.php',
231
+ 'Mixin_Display_Type_Form' => 'mixin.display_type_form.php'
232
  );
233
  }
234
  }
products/photocrati_nextgen/modules/nextgen_gallery_display/static/common.js CHANGED
@@ -1,85 +1 @@
1
- (function($){
2
- window.NggPaginatedGallery = function(displayed_gallery_id, container, links) {
3
- this.displayed_gallery_id = displayed_gallery_id;
4
- this.links = links;
5
- this.container = container;
6
-
7
- this.get_displayed_gallery_obj = function(){
8
- var index = 'gallery_'+this.displayed_gallery_id;
9
- if (typeof(window.galleries[index]) == 'undefined')
10
- return false;
11
- else
12
- return window.galleries[index];
13
- };
14
-
15
-
16
- this.enable_ajax_pagination = function(){
17
- var transient_id = this.get_displayed_gallery_obj().transient_id;
18
- var obj = this;
19
-
20
- // Attach a click event handler for each pagination link to
21
- // adjust the request to be sent via XHR
22
- this.links.each(function(){
23
- var $link = $(this);
24
- $link.click(function(e){
25
- e.preventDefault();
26
-
27
- // Describe AJAX request
28
- var request = {
29
- action: 'render_displayed_gallery',
30
- displayed_gallery_id: transient_id,
31
- ajax_referrer: $link.attr('href')
32
- }
33
-
34
- // Notify the user that we're busy
35
- obj.do_ajax(request);
36
- });
37
- });
38
- };
39
-
40
- this.do_ajax = function(request){
41
-
42
- var container = this.container;
43
-
44
- // Adjust the user notification
45
- window['ngg_ajax_operaton_count']++;
46
- $('body, a').css('cursor', 'wait');
47
-
48
- // Send the AJAX request
49
- $.post(photocrati_ajax.url, request, function(response){
50
-
51
- // Adjust the user notification
52
- window['ngg_ajax_operaton_count']--;
53
- if (window['ngg_ajax_operaton_count'] <= 0) {
54
- window['ngg_ajax_operaton_count'] = 0;
55
- $('body, a').css('cursor', 'auto');
56
- }
57
-
58
- // Ensure that the server returned JSON
59
- if (typeof(response) != 'object') response = JSON.parse(response);
60
- if (response) {
61
- container.replaceWith(response.html);
62
-
63
- // Let the user know that we've refreshed the content
64
- $(document).trigger('refreshed');
65
- }
66
- });
67
- };
68
-
69
- // Initialize
70
- var displayed_gallery = this.get_displayed_gallery_obj();
71
- if (displayed_gallery) {
72
- if (typeof(displayed_gallery.display_settings['ajax_pagination']) != 'undefined') {
73
- if (parseInt(displayed_gallery.display_settings['ajax_pagination'])) {
74
- this.enable_ajax_pagination();
75
- }
76
- }
77
- }
78
-
79
- // We maintain a count of all the current AJAX actions initiated
80
- if (typeof(window['ngg_ajax_operation_count']) == 'undefined') {
81
- window['ngg_ajax_operaton_count'] = 0;
82
- }
83
- };
84
-
85
- })(jQuery);
1
+ // common.js is intentionally empty
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_gallery_display/static/nextgen_gallery_related_images.css DELETED
@@ -1,22 +0,0 @@
1
-
2
- /* ----------- Related images -------------*/
3
- .ngg-related-gallery {
4
- background:#F9F9F9;
5
- border:1px solid #E0E0E0;
6
- overflow:hidden;
7
- margin-bottom:1em;
8
- margin-top:1em;
9
- padding:5px;
10
- }
11
- .ngg-related-gallery img {
12
- border: 1px solid #DDDDDD;
13
- float: left;
14
- margin: 0pt 3px;
15
- padding: 2px;
16
- height: 50px;
17
- width: 50px;
18
- }
19
-
20
- .ngg-related-gallery img:hover {
21
- border: 1px solid #000000;
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/nextgen_other_options/adapter.image_options_form.php CHANGED
@@ -90,7 +90,7 @@ class A_Image_Options_Form extends Mixin
90
  'delete_image_files_help' => _('When enabled, image files will be removed after a Gallery has been deleted'),
91
  'delete_image_files' => $settings->deleteImg,
92
  'show_related_images_label' => _('Show Related Images on Posts?'),
93
- 'show_related_images_help' => _('When enabled, related images will be appended to each post by matching the posts tags/categories to image tags'),
94
  'show_related_images' => $settings->activateTags,
95
  'related_images_hidden_label' => _('(Show Customization Settings)'),
96
  'related_images_active_label' => _('(Hide Customization Settings)'),
@@ -99,8 +99,6 @@ class A_Image_Options_Form extends Mixin
99
  'match_related_image_options' => $this->object->_get_related_image_match_options(),
100
  'max_related_images_label' => _('Maximum # of related images to display'),
101
  'max_related_images' => $settings->maxImages,
102
- 'related_images_heading_label' => _('Heading for related images'),
103
- 'related_images_heading' => $settings->relatedHeading,
104
  'sorting_order_label' => _("What's the default sorting method?"),
105
  'sorting_order_options' => $this->object->_get_image_sorting_options(),
106
  'sorting_order' => $settings->galSort,
@@ -136,32 +134,30 @@ class A_Image_Options_Form extends Mixin
136
  $fs = $this->get_registry()->get_utility('I_Fs');
137
  $original_dir = $fs->get_abspath($this->object->get_model()->get('gallerypath'));
138
  $new_dir = $fs->get_abspath($image_options['gallerypath']);
139
- $image_options['gallerypath'] = $fs->add_trailing_slash($image_options['gallerypath']);
140
-
141
- // Note: the below file move is disabled because it's quite unreliable as it doesn't perform any checks
142
- // For instance changing gallery path from /wp-content to /wp-content/gallery would attempt a recursive copy and then delete ALL files under wp-content, which would be disastreus
143
- # // If the gallery path has changed...
144
- # if ($original_dir != $new_dir) {
145
-
146
- # // Try creating the new directory
147
- # if ($this->object->_create_gallery_storage_dir($new_dir) AND is_writable($new_dir)) {
148
-
149
- # // Try moving files
150
- # $this->object->recursive_copy($original_dir, $new_dir);
151
- # $this->object->recursive_delete($original_dir);
152
-
153
- # // Update gallery paths
154
- # $mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
155
- # foreach ($mapper->find_all() as $gallery) {
156
- # $gallery->path = $image_options['gallerypath'] . $gallery->name;
157
- # $mapper->save($gallery);
158
- # }
159
- # }
160
- # else {
161
- # $this->get_model()->add_error("Unable to change gallery path. Insufficient filesystem permissions");
162
- # $save = FALSE;
163
- # }
164
- # }
165
  }
166
  elseif (isset($image_options['gallerypath'])) {
167
  unset($image_options['gallerypath']);
90
  'delete_image_files_help' => _('When enabled, image files will be removed after a Gallery has been deleted'),
91
  'delete_image_files' => $settings->deleteImg,
92
  'show_related_images_label' => _('Show Related Images on Posts?'),
93
+ 'show_related_images_help' => _('When enabled, related images will be appended to each post'),
94
  'show_related_images' => $settings->activateTags,
95
  'related_images_hidden_label' => _('(Show Customization Settings)'),
96
  'related_images_active_label' => _('(Hide Customization Settings)'),
99
  'match_related_image_options' => $this->object->_get_related_image_match_options(),
100
  'max_related_images_label' => _('Maximum # of related images to display'),
101
  'max_related_images' => $settings->maxImages,
 
 
102
  'sorting_order_label' => _("What's the default sorting method?"),
103
  'sorting_order_options' => $this->object->_get_image_sorting_options(),
104
  'sorting_order' => $settings->galSort,
134
  $fs = $this->get_registry()->get_utility('I_Fs');
135
  $original_dir = $fs->get_abspath($this->object->get_model()->get('gallerypath'));
136
  $new_dir = $fs->get_abspath($image_options['gallerypath']);
137
+ $image_options['gallerypath'] = $fs->add_trailing_slash($image_options['gallerypath']);
138
+
139
+ // If the gallery path has changed...
140
+ if ($original_dir != $new_dir) {
141
+
142
+ // Try creating the new directory
143
+ if ($this->object->_create_gallery_storage_dir($new_dir) AND is_writable($new_dir)) {
144
+
145
+ // Try moving files
146
+ $this->object->recursive_copy($original_dir, $new_dir);
147
+ $this->object->recursive_delete($original_dir);
148
+
149
+ // Update gallery paths
150
+ $mapper = $this->get_registry()->get_utility('I_Gallery_Mapper');
151
+ foreach ($mapper->find_all() as $gallery) {
152
+ $gallery->path = $image_options['gallerypath'] . $gallery->name;
153
+ $mapper->save($gallery);
154
+ }
155
+ }
156
+ else {
157
+ $this->get_model()->add_error("Unable to change gallery path. Insufficient filesystem permissions");
158
+ $save = FALSE;
159
+ }
160
+ }
 
 
161
  }
162
  elseif (isset($image_options['gallerypath'])) {
163
  unset($image_options['gallerypath']);
products/photocrati_nextgen/modules/nextgen_other_options/adapter.lightbox_manager_form.php CHANGED
@@ -40,8 +40,7 @@ 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
- 'lightbox_global' => $this->object->get_model()->thumbEffectContext,
45
  ),
46
  TRUE
47
  );
@@ -95,10 +94,5 @@ class A_Lightbox_Manager_Form extends Mixin
95
  }
96
  }
97
  }
98
-
99
- if (($thumbEffectContext = $this->object->param('thumbEffectContext'))) {
100
- $settings->thumbEffectContext = $thumbEffectContext;
101
- $settings->save();
102
- }
103
  }
104
  }
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
  }
95
  }
96
  }
 
 
 
 
 
97
  }
98
  }
products/photocrati_nextgen/modules/nextgen_other_options/adapter.miscellaneous_form.php CHANGED
@@ -54,7 +54,6 @@ class A_Miscellaneous_Form extends Mixin
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()
54
  $cache->flush_galleries();
55
  C_Photocrati_Cache::flush();
56
  C_Photocrati_Cache::flush('displayed_galleries');
 
57
  }
58
 
59
  function save_action()
products/photocrati_nextgen/modules/nextgen_other_options/adapter.other_options_forms.php CHANGED
@@ -5,26 +5,14 @@ class A_Other_Options_Forms extends Mixin
5
  function initialize()
6
  {
7
  $forms = array(
8
- 'image_options' => 'A_Image_Options_Form',
9
- 'thumbnail_options' => 'A_Thumbnail_Options_Form',
10
- 'lightbox_effects' => 'A_Lightbox_Manager_Form',
11
- 'watermarks' => 'A_Watermarks_Form'
12
- );
13
-
14
- if (!is_multisite() || (is_multisite() && C_NextGen_Settings::get_instance()->get('wpmuStyle')))
15
- $forms['styles'] = 'A_Styles_Form';
16
-
17
- if (is_super_admin() && (!is_multisite() || (is_multisite() && C_NextGen_Settings::get_instance()->get('wpmuRoles'))))
18
- $forms['roles_and_capabilities'] = 'A_Roles_Form';
19
-
20
- $forms += array(
21
  'image_options' => 'A_Image_Options_Form',
22
  'thumbnail_options' => 'A_Thumbnail_Options_Form',
23
  'lightbox_effects' => 'A_Lightbox_Manager_Form',
24
  'watermarks' => 'A_Watermarks_Form',
25
  'styles' => 'A_Styles_Form',
26
  'roles_and_capabilities'=> 'A_Roles_Form',
27
- 'miscellaneous' => 'A_Miscellaneous_Form'
 
28
  );
29
 
30
  $registry = $this->object->get_registry();
5
  function initialize()
6
  {
7
  $forms = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  'image_options' => 'A_Image_Options_Form',
9
  'thumbnail_options' => 'A_Thumbnail_Options_Form',
10
  'lightbox_effects' => 'A_Lightbox_Manager_Form',
11
  'watermarks' => 'A_Watermarks_Form',
12
  'styles' => 'A_Styles_Form',
13
  'roles_and_capabilities'=> 'A_Roles_Form',
14
+ 'miscellaneous' => 'A_Miscellaneous_Form',
15
+ //'reset_and_uninstall' => 'A_Reset_Form',
16
  );
17
 
18
  $registry = $this->object->get_registry();
products/photocrati_nextgen/modules/nextgen_other_options/adapter.reset_form.php CHANGED
@@ -4,7 +4,7 @@ class A_Reset_Form extends Mixin
4
  {
5
  function get_title()
6
  {
7
- return 'Reset Options';
8
  }
9
 
10
  function render()
@@ -15,9 +15,9 @@ class A_Reset_Form extends Mixin
15
  'reset_value' => _('Reset all options to default settings'),
16
  'reset_warning' => _('Replace all existing options and gallery options with their default settings'),
17
  'reset_label' => _('Reset settings'),
18
- 'reset_confirmation' => _("Reset all options to default settings?\n\nChoose [Cancel] to Stop, [OK] to proceed.")
19
- // 'uninstall_label' => _('Deactivate & Uninstall'),
20
- // 'uninstall_confirmation'=>_("Completely uninstall NextGEN Gallery (will reset settings and de-activate)?\n\nChoose [Cancel] to Stop, [OK] to proceed."),
21
  ),
22
  TRUE
23
  );
@@ -25,29 +25,12 @@ class A_Reset_Form extends Mixin
25
 
26
  function reset_action()
27
  {
28
- global $wpdb;
29
-
30
  $installer = C_Photocrati_Installer::get_instance();
31
- $settings = C_NextGen_Settings::get_instance();
32
-
33
- // removes lightbox, display type, and source settings
34
- $installer->uninstall(NEXTGEN_GALLERY_PLUGIN_BASENAME);
35
-
36
- // removes ngg_options entry in wp_options
37
- $settings->destroy();
38
- $settings->save();
39
-
40
- // TODO: remove this sometime after 2.0.21
41
- //
42
- // Some installations of NextGen that upgraded from 1.9x to 2.0x have duplicate display types installed,
43
- // so for now (as of 2.0.21) we explicitly remove all display types from the db as a way of fixing this
44
- $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s", 'display_type'));
45
-
46
- // trigger the install routine
47
  $installer->update(TRUE);
48
  }
49
 
50
- /*
51
  function uninstall_action()
52
  {
53
  $installer = C_Photocrati_Installer::get_instance();
@@ -55,5 +38,4 @@ class A_Reset_Form extends Mixin
55
  deactivate_plugins(NEXTGEN_GALLERY_PLUGIN_BASENAME);
56
  wp_redirect(admin_url('/plugins.php'));
57
  }
58
- */
59
  }
4
  {
5
  function get_title()
6
  {
7
+ return 'Reset & Uninstall';
8
  }
9
 
10
  function render()
15
  'reset_value' => _('Reset all options to default settings'),
16
  'reset_warning' => _('Replace all existing options and gallery options with their default settings'),
17
  'reset_label' => _('Reset settings'),
18
+ 'reset_confirmation' => _("Reset all options to default settings?\n\nChoose [Cancel] to Stop, [OK] to proceed."),
19
+ 'uninstall_label' => _('Deactivate & Uninstall'),
20
+ 'uninstall_confirmation'=>_("Completely uninstall NextGEN Gallery (will reset settings and de-activate)?\n\nChoose [Cancel] to Stop, [OK] to proceed."),
21
  ),
22
  TRUE
23
  );
25
 
26
  function reset_action()
27
  {
 
 
28
  $installer = C_Photocrati_Installer::get_instance();
29
+ // TODO right now we pass $hard = TRUE because many modules only delete settings in that specific case
30
+ $installer->uninstall(NEXTGEN_GALLERY_PLUGIN_BASENAME, TRUE);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  $installer->update(TRUE);
32
  }
33
 
 
34
  function uninstall_action()
35
  {
36
  $installer = C_Photocrati_Installer::get_instance();
38
  deactivate_plugins(NEXTGEN_GALLERY_PLUGIN_BASENAME);
39
  wp_redirect(admin_url('/plugins.php'));
40
  }
 
41
  }
products/photocrati_nextgen/modules/nextgen_other_options/class.settings_model.php CHANGED
@@ -22,7 +22,7 @@ class C_Settings_Model extends C_Component
22
  parent::define($context);
23
  $this->add_mixin('Mixin_Validation');
24
  if ($this->has_context('global') OR $this->has_context('site')) {
25
- $this->wrapper = C_NextGen_Settings::get_instance();
26
  }
27
  else $this->wrapper = C_NextGen_Settings::get_instance();
28
  }
22
  parent::define($context);
23
  $this->add_mixin('Mixin_Validation');
24
  if ($this->has_context('global') OR $this->has_context('site')) {
25
+ $this->wrapper = C_NextGen_Global_Settings::get_instance();
26
  }
27
  else $this->wrapper = C_NextGen_Settings::get_instance();
28
  }
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.5',
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.3',
20
  'http://www.nextgen-gallery.com',
21
  'Photocrati Media',
22
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/nextgen_other_options/templates/image_options_tab.php CHANGED
@@ -129,10 +129,10 @@
129
  </label>
130
  <input
131
  id="backup_images_yes"
132
- name="image_options[imgBackup]"
133
  value="1"
134
  type="radio"
135
- <?php checked(1, $backup_images ? 1 : 0)?>
136
  />
137
  &nbsp;
138
  <label for="backup_images_no">
@@ -140,10 +140,10 @@
140
  </label>
141
  <input
142
  id="backup_images_no"
143
- name="image_options[imgBackup]"
144
  value="0"
145
  type="radio"
146
- <?php checked(0, $backup_images ? 1 : 0)?>
147
  />
148
  </td>
149
  </tr>
@@ -212,47 +212,34 @@
212
  ><?php echo_h($related_images_hidden_label) ?></a>
213
  </td>
214
  </tr>
215
- <tbody id="related_images_advanced_form" class="hidden">
216
- <tr>
217
- <td>
218
- <label for="match_related_images">
219
- <?php echo_h($match_related_images_label) ?>
220
- </label>
221
- </td>
222
- <td>
223
- <select id="match_related_images" name="image_options[appendType]">
224
- <?php foreach ($match_related_image_options as $label => $value): ?>
225
- <option
226
- value="<?php echo esc_attr($value)?>"
227
- <?php selected($value, $match_related_images)?>
228
- >
229
- <?php echo_h($label) ?>
230
- </option>
231
- <?php endforeach ?>
232
- </select>
233
- </td>
234
- <td class="column3">
235
- <label for="max_related_images">
236
- <?php echo_h($max_related_images_label)?>
237
- </label>
238
- <input
239
- id="max_related_images"
240
- type="text"
241
- name="image_options[maxImages]"
242
- value="<?php echo esc_attr($max_related_images)?>"
243
- />
244
- </td>
245
- </tr>
246
- <tr>
247
- <td>
248
- <label for="related_images_heading">
249
- <?php echo_h($related_images_heading_label) ?>
250
- </label>
251
- </td>
252
- <td>
253
- <input id="related_images_heading" type="text" name="image_options[relatedHeading]"
254
- value="<?php echo esc_attr($related_images_heading)?>"/>
255
- </td>
256
- </tr>
257
- </tbody>
258
  </table>
129
  </label>
130
  <input
131
  id="backup_images_yes"
132
+ name="image_options[backup_images]"
133
  value="1"
134
  type="radio"
135
+ <?php checked(1, $backup_images)?>
136
  />
137
  &nbsp;
138
  <label for="backup_images_no">
140
  </label>
141
  <input
142
  id="backup_images_no"
143
+ name="image_options[backup_images]"
144
  value="0"
145
  type="radio"
146
+ <?php checked(0, $backup_images)?>
147
  />
148
  </td>
149
  </tr>
212
  ><?php echo_h($related_images_hidden_label) ?></a>
213
  </td>
214
  </tr>
215
+ <tr id="related_images_advanced_form" class="hidden">
216
+ <td>
217
+ <label for="match_related_images">
218
+ <?php echo_h($match_related_images_label) ?>
219
+ </label>
220
+ </td>
221
+ <td>
222
+ <select id="match_related_images" name="image_options[appendType]">
223
+ <?php foreach ($match_related_image_options as $label => $value): ?>
224
+ <option
225
+ value="<?php echo esc_attr($value)?>"
226
+ <?php selected($value, $match_related_images)?>
227
+ >
228
+ <?php echo_h($label) ?>
229
+ </option>
230
+ <?php endforeach ?>
231
+ </select>
232
+ </td>
233
+ <td class="column3">
234
+ <label for="max_related_images">
235
+ <?php echo_h($max_related_images_label)?>
236
+ </label>
237
+ <input
238
+ id="max_related_images"
239
+ type="text"
240
+ name="image_options[maxImages]"
241
+ value="<?php echo esc_attr($max_related_images)?>"
242
+ />
243
+ </td>
244
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  </table>
products/photocrati_nextgen/modules/nextgen_other_options/templates/lightbox_library_tab.php CHANGED
@@ -44,24 +44,6 @@
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>
44
  <?php echo $form; ?>
45
  </tbody>
46
  <?php } ?>
47
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  </tbody>
49
+ </table>
products/photocrati_nextgen/modules/nextgen_other_options/templates/reset_tab.php CHANGED
@@ -15,7 +15,6 @@
15
  />
16
  </td>
17
  </tr>
18
- <?php /*
19
  <tr>
20
  <td class='column1'>
21
  <?php echo $uninstall_label; ?>
@@ -30,5 +29,4 @@
30
  />
31
  </td>
32
  </tr>
33
- */ ?>
34
  </table>
15
  />
16
  </td>
17
  </tr>
 
18
  <tr>
19
  <td class='column1'>
20
  <?php echo $uninstall_label; ?>
29
  />
30
  </td>
31
  </tr>
 
32
  </table>
products/photocrati_nextgen/modules/nextgen_pagination/mixin.nextgen_basic_pagination.php CHANGED
@@ -20,26 +20,8 @@ class Mixin_NextGen_Basic_Pagination extends Mixin
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,4 +75,4 @@ class Mixin_NextGen_Basic_Pagination extends Mixin
93
 
94
  return $return;
95
  }
96
- }
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
 
76
  return $return;
77
  }
78
+ }
products/photocrati_nextgen/modules/nextgen_settings/class.nextgen_settings_installer.php CHANGED
@@ -7,16 +7,13 @@ class C_NextGen_Settings_Installer
7
 
8
  function __construct()
9
  {
10
- $this->blog_settings = C_NextGen_Settings::get_instance();
11
  $this->site_settings = C_NextGen_Global_Settings::get_instance();
 
12
 
13
- $this->_global_settings = array(
14
  'gallerypath' => 'wp-content/blogs.dir/%BLOG_ID%/files/',
15
  'wpmuCSSfile' => 'nggallery.css',
16
- 'wpmuStyle' => FALSE,
17
- 'wpmuRoles' => FALSE,
18
- 'wpmuImportFolder' => FALSE,
19
- 'wpmuZipUpload' => FALSE,
20
  'datamapper_driver' => 'custom_table_datamapper',
21
  'gallerystorage_driver' => 'ngglegacy_gallery_storage',
22
  'maximum_entity_count' => 500,
@@ -38,7 +35,6 @@ class C_NextGen_Settings_Installer
38
  'activateTags' => 0, // append related images
39
  'appendType' => 'tags', // look for category or tags
40
  'maxImages' => 7, // number of images toshow
41
- 'relatedHeading' => __('<h3>Related Images:</h3>', 'nggallery'), // subheading for related images
42
 
43
  // Thumbnail Settings
44
  'thumbwidth' => 120, // Thumb Width
@@ -49,7 +45,7 @@ class C_NextGen_Settings_Installer
49
  // Image Settings
50
  'imgWidth' => 800, // Image Width
51
  'imgHeight' => 600, // Image height
52
- 'imgQuality' => 100, // Image Quality
53
  'imgBackup' => True, // Create a backup
54
  'imgAutoResize' => False, // Resize after upload
55
 
@@ -58,8 +54,8 @@ class C_NextGen_Settings_Installer
58
  'galPagedGalleries' => 0, // Number of galleries per page (in a album)
59
  'galColumns' => 0, // Number of columns for the gallery
60
  'galShowSlide' => True, // Show slideshow
61
- 'galTextSlide' => __('[Show slideshow]', 'nggallery'), // Text for slideshow
62
- 'galTextGallery' => __('[Show thumbnails]', 'nggallery'), // Text for gallery
63
  'galShowOrder' => 'gallery', // Show order
64
  'galSort' => 'sortorder', // Sort order
65
  'galSortDir' => 'ASC', // Sort direction
@@ -71,7 +67,6 @@ class C_NextGen_Settings_Installer
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
@@ -115,7 +110,7 @@ class C_NextGen_Settings_Installer
115
 
116
  function install_global_settings($reset=FALSE)
117
  {
118
- foreach ($this->_global_settings as $key => $value) {
119
  if ($reset) $this->site_settings->set($key, NULL);
120
  $this->site_settings->set_default_value($key, $value);
121
  }
@@ -123,27 +118,19 @@ class C_NextGen_Settings_Installer
123
 
124
  function install_local_settings($reset=FALSE)
125
  {
 
 
 
 
 
 
 
 
 
126
  foreach ($this->_local_settings as $key => $value) {
127
  if ($reset) $this->blog_settings->set($key, NULL);
128
  $this->blog_settings->set_default_value($key, $value);
129
  }
130
-
131
- if (is_multisite())
132
- {
133
- // If this is already network activated we just need to use the existing setting
134
- // Note: attempting to use C_NextGen_Global_Settings here may result in an infinite loop,
135
- // so get_site_option() is used to check
136
- if ($options = get_site_option('ngg_options'))
137
- $gallerypath = $options['gallerypath'];
138
- else
139
- $gallerypath = $this->_global_settings['gallerypath'];
140
-
141
- $gallerypath = $this->gallerypath_replace($gallerypath);
142
-
143
- // a gallerypath setting has already been set, so we explicitly set a default AND set a new value
144
- $this->blog_settings->set_default_value('gallerypath', $gallerypath);
145
- $this->blog_settings->set('gallerypath', $gallerypath);
146
- }
147
  }
148
 
149
  function install($reset=FALSE)
@@ -151,21 +138,4 @@ class C_NextGen_Settings_Installer
151
  $this->install_global_settings($reset);
152
  $this->install_local_settings($reset);
153
  }
154
-
155
- function get_global_defaults()
156
- {
157
- return $this->_global_settings;
158
- }
159
-
160
- function get_local_defaults()
161
- {
162
- return $this->_local_settings;
163
- }
164
-
165
- function gallerypath_replace($gallerypath)
166
- {
167
- $gallerypath = str_replace('%BLOG_NAME%', get_bloginfo('name'), $gallerypath);
168
- $gallerypath = str_replace('%BLOG_ID%', get_current_blog_id(), $gallerypath);
169
- return $gallerypath;
170
- }
171
- }
7
 
8
  function __construct()
9
  {
 
10
  $this->site_settings = C_NextGen_Global_Settings::get_instance();
11
+ $this->blog_settings = C_NextGen_Settings::get_instance();
12
 
13
+ $this->_global_defaults = array(
14
  'gallerypath' => 'wp-content/blogs.dir/%BLOG_ID%/files/',
15
  'wpmuCSSfile' => 'nggallery.css',
16
+ 'wpmuStyle' => TRUE,
 
 
 
17
  'datamapper_driver' => 'custom_table_datamapper',
18
  'gallerystorage_driver' => 'ngglegacy_gallery_storage',
19
  'maximum_entity_count' => 500,
35
  'activateTags' => 0, // append related images
36
  'appendType' => 'tags', // look for category or tags
37
  'maxImages' => 7, // number of images toshow
 
38
 
39
  // Thumbnail Settings
40
  'thumbwidth' => 120, // Thumb Width
45
  // Image Settings
46
  'imgWidth' => 800, // Image Width
47
  'imgHeight' => 600, // Image height
48
+ 'imgQuality' => 85, // Image Quality
49
  'imgBackup' => True, // Create a backup
50
  'imgAutoResize' => False, // Resize after upload
51
 
54
  'galPagedGalleries' => 0, // Number of galleries per page (in a album)
55
  'galColumns' => 0, // Number of columns for the gallery
56
  'galShowSlide' => True, // Show slideshow
57
+ 'galTextSlide' => __('[Show as slideshow]', 'nggallery'), // Text for slideshow
58
+ 'galTextGallery' => __('[Show picture list]', 'nggallery'), // Text for gallery
59
  'galShowOrder' => 'gallery', // Show order
60
  'galSort' => 'sortorder', // Sort order
61
  'galSortDir' => 'ASC', // Sort direction
67
  // Thumbnail Effect
68
  'thumbEffect' => 'fancybox', // select effect
69
  'thumbCode' => 'class="ngg-fancybox" rel="%GALLERY_NAME%"',
 
70
 
71
  // Watermark settings
72
  'wmPos' => 'botRight', // Postion
110
 
111
  function install_global_settings($reset=FALSE)
112
  {
113
+ foreach ($this->_global_defaults as $key => $value) {
114
  if ($reset) $this->site_settings->set($key, NULL);
115
  $this->site_settings->set_default_value($key, $value);
116
  }
118
 
119
  function install_local_settings($reset=FALSE)
120
  {
121
+ if (is_multisite()) {
122
+ $gallerypath = str_replace(
123
+ array('%BLOG_ID%', get_current_blog_id()),
124
+ array('%BLOG_NAME%', get_bloginfo('name')),
125
+ $this->_global_defaults['gallerypath']
126
+ );
127
+ $this->_local_settings['gallerypath'] = $gallerypath;
128
+ }
129
+
130
  foreach ($this->_local_settings as $key => $value) {
131
  if ($reset) $this->blog_settings->set($key, NULL);
132
  $this->blog_settings->set_default_value($key, $value);
133
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
 
136
  function install($reset=FALSE)
138
  $this->install_global_settings($reset);
139
  $this->install_local_settings($reset);
140
  }
141
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3',
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.2',
21
  'http://www.nextgen-gallery.com',
22
  'Photocrati Media',
23
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/nextgen_xmlrpc/module.nextgen_xmlrpc.php DELETED
@@ -1,632 +0,0 @@
1
- <?php
2
-
3
- /***
4
- {
5
- Module: photocrati-nextgen_xmlrpc
6
- }
7
- ***/
8
- class M_NextGen_XmlRpc extends C_Base_Module
9
- {
10
- function define()
11
- {
12
- parent::define(
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'
20
- );
21
- }
22
-
23
- function _register_hooks()
24
- {
25
- add_filter('xmlrpc_methods', array(&$this, 'add_methods') );
26
- }
27
-
28
- function add_methods($methods)
29
- {
30
- $methods['ngg.installed'] = array(&$this, 'get_version');
31
- // Image methods
32
- $methods['ngg.getImage'] = array(&$this, 'get_image');
33
- $methods['ngg.getImages'] = array(&$this, 'get_images');
34
- $methods['ngg.uploadImage'] = array(&$this, 'upload_image');
35
- $methods['ngg.editImage'] = array(&$this, 'edit_image');
36
- $methods['ngg.deleteImage'] = array(&$this, 'delete_image');
37
- // Gallery methods
38
- $methods['ngg.getGallery'] = array(&$this, 'get_gallery');
39
- $methods['ngg.getGalleries'] = array(&$this, 'get_galleries');
40
- $methods['ngg.newGallery'] = array(&$this, 'create_gallery');
41
- $methods['ngg.editGallery'] = array(&$this, 'edit_gallery');
42
- $methods['ngg.deleteGallery'] = array(&$this, 'delete_gallery');
43
-
44
- // Album methods
45
- $methods['ngg.getAlbum'] = array(&$this, 'get_album');
46
- $methods['ngg.getAlbums'] = array(&$this, 'get_albums');
47
- $methods['ngg.newAlbum'] = array(&$this, 'create_album');
48
- $methods['ngg.editAlbum'] = array(&$this, 'edit_album');
49
- $methods['ngg.deleteAlbum'] = array(&$this, 'delete_album');
50
-
51
- return $methods;
52
- }
53
-
54
- /**
55
- * Gets the version of NextGEN Gallery installed
56
- * @return string
57
- */
58
- function get_version()
59
- {
60
- return array('version' => NEXTGEN_GALLERY_PLUGIN_VERSION);
61
- }
62
-
63
- /**
64
- * Login a user
65
- * @param $username
66
- * @param $password
67
- * @return bool|WP_Error|WP_User
68
- */
69
- function _login($username, $password, $blog_id=1)
70
- {
71
- $retval = FALSE;
72
-
73
- if (!is_a(($user_obj = wp_authenticate($username, $password)), 'WP_Error')) {
74
- wp_set_current_user($user_obj->ID);
75
- $retval = $user_obj;
76
-
77
- if (is_multisite()) switch_to_blog($blog_id);
78
- }
79
-
80
- return $retval;
81
- }
82
-
83
- function _can_manage_gallery($gallery_id_or_obj, $check_upload_capability=FALSE)
84
- {
85
- $retval = FALSE;
86
-
87
- // Get the gallery object, if we don't have it already
88
- $gallery = NULL;
89
- if (is_int($gallery_id_or_obj)) {
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)
135
- */
136
- function get_image($args, $return_model=FALSE)
137
- {
138
- $retval = new IXR_Error(403, 'Invalid username or password');
139
- $blog_id = intval($args[0]);
140
- $username = strval($args[1]);
141
- $password = strval($args[2]);
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();
149
- if (($image = $image_mapper->find($image_id, TRUE))) {
150
-
151
- // Try to find the gallery that the image belongs to
152
- $gallery_mapper = C_Gallery_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();
163
- }
164
-
165
- else {
166
- $retval = new IXR_Error(403, "You don't have permission to manage gallery #{$image->galleryid}");
167
- }
168
- }
169
-
170
- // No gallery found
171
- else {
172
- $retval = new IXR_Error(404, "Gallery not found (with id #{$image->gallerid}");
173
- }
174
- }
175
-
176
- // No image found
177
- else $retval = FALSE;
178
- }
179
-
180
- return $retval;
181
- }
182
-
183
- /**
184
- * Returns a collection of images
185
- * @param $args (blog_id, username, password, gallery_id
186
- */
187
- function get_images($args)
188
- {
189
- $retval = new IXR_Error(403, 'Invalid username or password');
190
- $blog_id = intval($args[0]);
191
- $username = strval($args[1]);
192
- $password = strval($args[2]);
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 {
207
- $retval = new IXR_Error(403, "You don't have permission to manage gallery #{$image->galleryid}");
208
- }
209
- }
210
-
211
- // No gallery found
212
- else {
213
- $retval = new IXR_Error(404, "Gallery not found (with id #{$image->gallerid}");
214
- }
215
- }
216
-
217
- return $retval;
218
- }
219
-
220
- /**
221
- * Uploads an image to a particular gallery
222
- * @param $args (blog_id, username, password, data)
223
- *
224
- * Data is an assoc array:
225
- * o string name
226
- * o string type (optional)
227
- * o base64 bits
228
- * o bool overwrite (optional)
229
- * o int gallery
230
- * o int image_id (optional)
231
- * @return image
232
- */
233
- function upload_image($args)
234
- {
235
- $retval = new IXR_Error(403, 'Invalid username or password');
236
- $blog_id = intval($args[0]);
237
- $username = strval($args[1]);
238
- $password = strval($args[2]);
239
- $data = $args[3];
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();
254
- $image = $storage->upload_base64_image($gallery, $data['bits'], $data['name'], $data['image_id']);
255
- if ($image) {
256
- $storage = C_Gallery_Storage::get_instance();
257
- $image->imageURL = $storage->get_image_url($image);
258
- $image->thumbURL = $storage->get_thumb_url($image);
259
- $image->imagePath = $storage->get_image_abspath($image);
260
- $image->thumbPath = $storage->get_thumb_abspath($image);
261
- $retval = $image->get_entity();
262
- }
263
- else
264
- $retval = new IXR_Error(500, "Could not upload image");
265
- }
266
- else {
267
- $retval = new IXR_Error(403, "You don't have permission to upload to gallery #{$image->galleryid}");
268
- }
269
- }
270
-
271
- // No gallery found
272
- else {
273
- $retval = new IXR_Error(404, "Gallery not found (with id #{$image->gallerid}");
274
- }
275
- }
276
-
277
- return $retval;
278
- }
279
-
280
- /**
281
- * Edits an image object
282
- * @param $args (blog_id, username, password, image_id, alttext, description, exclude, other_properties
283
- */
284
- function edit_image($args)
285
- {
286
- $alttext = strval($args[4]);
287
- $description = strval($args[5]);
288
- $exclude = intval($args[6]);
289
- $properties = isset($args[7]) ? (array)$args[7] : array();
290
-
291
- $retval = $this->get_image($args, TRUE);
292
- if (!($retval instanceof IXR_Error)) {
293
- $retval->alttext = $alttext;
294
- $retval->description = $description;
295
- $retval->exclude = $exclude;
296
-
297
- // Other properties can be specified using an associative array
298
- foreach ($properties as $key => $value) {
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
-
310
- return $retval;
311
- }
312
-
313
- /**
314
- * Deletes an existing image from a gallery
315
- * @param $args (blog_id, username, password, image_id)
316
- */
317
- function delete_image($args)
318
- {
319
- $retval = $this->get_image($args, TRUE);
320
- if (!($retval instanceof IXR_Error)) {
321
- $retval = $retval->destroy();
322
- }
323
- return $retval;
324
- }
325
-
326
- /**
327
- * Creates a new gallery
328
- * @param $args (blog_id, username, password, title)
329
- */
330
- function create_gallery($args)
331
- {
332
- $retval = new IXR_Error(403, 'Invalid username or password');
333
- $blog_id = intval($args[0]);
334
- $username = strval($args[1]);
335
- $password = strval($args[2]);
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')) {
343
- $mapper = C_Gallery_Mapper::get_instance();
344
- if (($gallery = $mapper->create(array('title' => $title))) && $gallery->save()) {
345
- $retval = $gallery->id();
346
- }
347
- else $retval = new IXR_Error(500, "Unable to create gallery");
348
-
349
- }
350
- else $retval = new IXR_Error(403, "Sorry, but you must be able to manage galleries. Check your roles/capabilities.");
351
- }
352
-
353
- return $retval;
354
- }
355
-
356
- /**
357
- * Edits an existing gallery
358
- * @param $args (blog_id, username, password, gallery_id, name, title, description, preview_pic_id)
359
- */
360
- function edit_gallery($args)
361
- {
362
- $retval = new IXR_Error(403, 'Invalid username or password');
363
- $blog_id = intval($args[0]);
364
- $username = strval($args[1]);
365
- $password = strval($args[2]);
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");
394
- }
395
- else $retval = new IXR_Error(404, "Gallery #{$gallery_id} doesn't exist");
396
- }
397
-
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)
434
- */
435
- function get_gallery($args, $return_model=FALSE)
436
- {
437
- $retval = new IXR_Error(403, 'Invalid username or password');
438
- $blog_id = intval($args[0]);
439
- $username = strval($args[1]);
440
- $password = strval($args[2]);
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
- }
455
-
456
- return $retval;
457
- }
458
-
459
- /**
460
- * Deletes a gallery
461
- * @param $args (blog_id, username, password, gallery_id)
462
- */
463
- function delete_gallery($args)
464
- {
465
- $retval = $this->get_gallery($args, TRUE);
466
-
467
- if (!($retval instanceof IXR_Error)) {
468
- $retval = $retval->destroy();
469
- }
470
-
471
- return $retval;
472
- }
473
-
474
- /**
475
- * Creates a new album
476
- * @param $args (blog_id, username, password, title, previewpic, description, galleries
477
- */
478
- function create_album($args)
479
- {
480
- $retval = new IXR_Error(403, 'Invalid username or password');
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');
495
- if ($security->is_allowed('nextgen_edit_album')) {
496
-
497
- $mapper = C_Album_Mapper::get_instance();
498
- $album = $mapper->create(array(
499
- 'name' => $title,
500
- 'previewpic' => $previewpic,
501
- 'albumdesc' => $desc,
502
- 'sortorder' => $sortorder,
503
- 'pageid' => $page_id
504
- ));
505
-
506
- if ($album->save()) $retval = $album->id();
507
- else $retval = new IXR_Error(500, "Unable to create album");
508
- }
509
- }
510
-
511
- return $retval;
512
- }
513
-
514
-
515
- /**
516
- * Returns all albums
517
- * @param $args (blog_id, username, password)
518
- * @return IXR_Error
519
- */
520
- function get_albums($args)
521
- {
522
- $retval = new IXR_Error(403, 'Invalid username or password');
523
- $blog_id = intval($args[0]);
524
- $username = strval($args[1]);
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');
532
- if ($security->is_allowed('nextgen_edit_album')) {
533
-
534
- // Fetch all albums
535
- $mapper = C_Album_Mapper::get_instance();
536
- $retval = array();
537
- foreach ($mapper->find_all() as $album) {
538
- // Vladimir's Lightroom plugins requires the 'id' to be a string
539
- // Ask if he can accept integers as well. Currently, integers break
540
- // his plugin
541
- $album->id = (string) $album->id;
542
- $album->galleries = $album->sortorder;
543
-
544
- $retval[$album->{$album->id_field}] = (array) $album;
545
- }
546
- }
547
- else $retval = new IXR_Error(403, "Sorry, you must be able to manage albums");
548
-
549
-
550
- }
551
-
552
- return $retval;
553
- }
554
-
555
- /**
556
- * Gets a single album
557
- * @param $args (blog_id, username, password, album_id)
558
- */
559
- function get_album($args, $return_model=FALSE)
560
- {
561
- $retval = new IXR_Error(403, 'Invalid username or password');
562
- $blog_id = intval($args[0]);
563
- $username = strval($args[1]);
564
- $password = strval($args[2]);
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
- }
588
-
589
- return $retval;
590
- }
591
-
592
- /**
593
- * Deletes an existing album
594
- * @param $args (blog_id, username, password, album_id)
595
- */
596
- function delete_album($args)
597
- {
598
- $retval = $this->get_album($args, TRUE);
599
-
600
- if (!($retval instanceof IXR_Error)) {
601
- $retval = $retval->destroy();
602
- }
603
-
604
- return $retval;
605
- }
606
-
607
- /**
608
- * Edit an existing album
609
- * @param $args (blog_id, username, password, album_id, name, preview pic id, description, galleries)
610
- */
611
- function edit_album($args)
612
- {
613
- $retval = $this->get_album($args, TRUE);
614
-
615
- if (!($retval instanceof IXR_Error)) {
616
- $retval->name = strval($args[4]);
617
- $retval->previewpic = intval($args[5]);
618
- $retval->albumdesc = strval($args[6]);
619
- $retval->sortorder = $args[7];
620
-
621
- $properties = isset($args[8]) ? $args[8] : array();
622
- foreach ($properties as $key => $value) $retval->$key = $value;
623
- unset($retval->galleries);
624
-
625
- $retval = $retval->save();
626
- }
627
-
628
- return $retval;
629
- }
630
- }
631
-
632
- new M_NextGen_XmlRpc;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/ngglegacy/admin/admin.php CHANGED
@@ -172,7 +172,7 @@ class nggAdminPanel{
172
 
173
  add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'), path_join(NGGALLERY_URLPATH, 'admin/images/nextgen_16_color.png') );
174
  add_submenu_page( NGGFOLDER , __('Network settings', 'nggallery'), __('Network settings', 'nggallery'), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'));
175
- // add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
176
  }
177
 
178
  /**
@@ -392,7 +392,7 @@ class nggAdminPanel{
392
 
393
  function enqueue_jquery_ui_theme()
394
  {
395
- $settings = C_NextGen_Settings::get_instance();
396
  wp_enqueue_style(
397
  $settings->jquery_ui_theme,
398
  $settings->jquery_ui_theme_url,
172
 
173
  add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'), path_join(NGGALLERY_URLPATH, 'admin/images/nextgen_16_color.png') );
174
  add_submenu_page( NGGFOLDER , __('Network settings', 'nggallery'), __('Network settings', 'nggallery'), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'));
175
+ add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
176
  }
177
 
178
  /**
392
 
393
  function enqueue_jquery_ui_theme()
394
  {
395
+ $settings = C_NextGen_Global_Settings::get_instance();
396
  wp_enqueue_style(
397
  $settings->jquery_ui_theme,
398
  $settings->jquery_ui_theme_url,
products/photocrati_nextgen/modules/ngglegacy/admin/album.php CHANGED
@@ -70,6 +70,19 @@ class nggManageAlbum {
70
  return $this->_registry;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * Init the album output
75
  *
@@ -79,6 +92,9 @@ class nggManageAlbum {
79
  }
80
 
81
  function controller() {
 
 
 
82
 
83
  if (isset ($_POST['update']) || isset( $_POST['delete'] ) || isset( $_POST['add'] ) )
84
  $this->processor();
@@ -87,43 +103,12 @@ class nggManageAlbum {
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,23 +119,27 @@ class nggManageAlbum {
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,23 +162,23 @@ class nggManageAlbum {
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,7 +190,7 @@ class nggManageAlbum {
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,36 +204,34 @@ class nggManageAlbum {
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,12 +244,11 @@ class nggManageAlbum {
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,14 +398,14 @@ function showDialog() {
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,8 +447,8 @@ function showDialog() {
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,7 +465,7 @@ function showDialog() {
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,13 +481,17 @@ function showDialog() {
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,7 +512,7 @@ function showDialog() {
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,7 +601,7 @@ function showDialog() {
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,7 +620,7 @@ function showDialog() {
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,7 +647,7 @@ function showDialog() {
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,8 +683,9 @@ function showDialog() {
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
  }
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
  }
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
  $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
  */
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
 
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
  $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
  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
 
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
  <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
  <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
 
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
 
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
  </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
  // 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
  $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
  $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
  $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
  }
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 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,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 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>
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
  <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>
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
- static function import_MetaData($imagesIds) {
582
 
583
  global $wpdb;
584
 
578
  * @param array|int $imagesIds
579
  * @return string result code
580
  */
581
+ function import_MetaData($imagesIds) {
582
 
583
  global $wpdb;
584
 
products/photocrati_nextgen/modules/ngglegacy/admin/install.php CHANGED
@@ -8,8 +8,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
8
  * @access internal
9
  * @return void
10
  */
11
- function nggallery_install($installer)
12
- {
13
 
14
  global $wpdb , $wp_roles, $wp_version;
15
 
@@ -36,6 +35,19 @@ function nggallery_install($installer)
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,8 +67,8 @@ function nggallery_install($installer)
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,8 +82,8 @@ function nggallery_install($installer)
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,8 +95,8 @@ function nggallery_install($installer)
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,3 +129,36 @@ function ngg_remove_capability($capability){
117
  }
118
 
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  * @access internal
9
  * @return void
10
  */
11
+ function nggallery_install () {
 
12
 
13
  global $wpdb , $wp_roles, $wp_version;
14
 
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
  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
  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
  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
  }
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
+ }
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: 30000,
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: 30000,
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: 10000,
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: 10000,
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 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,7 +481,7 @@ if($picturelist) {
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,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 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
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
  <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
  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
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('displayed_gallery_rendering');
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 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,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 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
28
  $sortindex++;
29
  }
30
 
31
+ C_Photocrati_Cache::flush();
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 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 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
- $result = $mapper->destroy($this->pid);
82
  do_action('ngg_delete_picture', $this->pid);
83
 
84
  if ($result)
@@ -376,16 +376,6 @@ class nggManageGallery {
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,14 +606,14 @@ class nggManageGallery {
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,14 +633,14 @@ class nggManageGallery {
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
 
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
  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
  $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
  $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
 
products/photocrati_nextgen/modules/ngglegacy/admin/media-upload.php CHANGED
@@ -33,32 +33,18 @@ function media_upload_nextgen() {
33
  $img = nggdb::find_image($send_id);
34
  $thumbcode = $img->get_thumbcode();
35
  $class="ngg-singlepic ngg-{$image['align']}";
36
-
37
- // Create a shell displayed-gallery so we can inspect its settings
38
- $registry = C_Component_Registry::get_instance();
39
- $mapper = $registry->get_utility('I_Displayed_Gallery_Mapper');
40
- $factory = $registry->get_utility('I_Component_Factory');
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
-
48
  // Build output
49
  if ($image['size'] == "thumbnail")
50
- $html = "<img src='{$image['thumb']}' alt='{$alttext}' class='{$class}' />";
51
- else
52
- $html = '';
53
-
54
- // Wrap the link to the fullsize image around
55
- $html = "<a {$thumbcode} href='{$image['url']}' title='{$clean_description}'>{$html}</a>";
56
 
57
  if ($image['size'] == "full")
58
- $html = "<img src='{$image['url']}' alt='{$alttext}' class='{$class}' />";
59
 
60
  if ($image['size'] == "singlepic")
61
- $html = "[singlepic id={$send_id} w={$width} h={$height} float={$image['align']}]";
62
 
63
  media_upload_nextgen_save_image();
64
 
33
  $img = nggdb::find_image($send_id);
34
  $thumbcode = $img->get_thumbcode();
35
  $class="ngg-singlepic ngg-{$image['align']}";
36
+
 
 
 
 
 
 
 
 
 
 
 
37
  // Build output
38
  if ($image['size'] == "thumbnail")
39
+ $html = "<img src='{$image['thumb']}' alt='$alttext' class='$class' />";
40
+ // Wrap the link to the fullsize image around
41
+ $html = "<a $thumbcode href='{$image['url']}' title='$clean_description'>$html</a>";
 
 
 
42
 
43
  if ($image['size'] == "full")
44
+ $html = "<img src='{$image['url']}' alt='$alttext' class='$class' />";
45
 
46
  if ($image['size'] == "singlepic")
47
+ $html = "[singlepic id=$send_id w=320 h=240 float={$image['align']}]";
48
 
49
  media_upload_nextgen_save_image();
50
 
products/photocrati_nextgen/modules/ngglegacy/admin/overview.php CHANGED
@@ -90,7 +90,9 @@ if ( !(get_locale() == 'en_US') )
90
  add_meta_box('ngg_about_meta_box', __('About', 'nggallery'), 'ngg_AboutMetaBox', 'ngg_overview', 'left', 'core');
91
  //add_meta_box('ngg_lastdonators', __('Recent donators', 'nggallery'), 'ngg_widget_overview_donators', 'ngg_overview', 'right', 'core');
92
  if ( !is_multisite() || is_super_admin() ) {
 
93
  add_meta_box('ngg_server', __('Server Settings', 'nggallery'), 'ngg_overview_server', 'ngg_overview', 'right', 'core');
 
94
  }
95
 
96
  function ngg_AboutMetaBox()
@@ -110,12 +112,7 @@ function ngg_likeThisMetaBox() {
110
  echo sprintf(__('This plugin is primarily developed, maintained, supported and documented by <a href="%s" target="_blank">Photocrati Media</a> with a lot of love & effort. Any kind of contribution would be highly appreciated. Thanks!', 'nggallery'), 'http://www.photocrati.com/');
111
  echo '</p><ul>';
112
 
113
- $url = 'http://wordpress.org/plugins/nextgen-gallery/' ;
114
- echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-rating.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
115
- _e('Please click "Works" on WordPress.org', 'nggallery');
116
- echo "</a></li>";
117
-
118
- $url = 'http://wordpress.org/plugins/nextgen-gallery/' ;
119
  echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-rating.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
120
  _e('Give it a good rating on WordPress.org', 'nggallery');
121
  echo "</a></li>";
@@ -136,6 +133,210 @@ function ngg_likeThisMetaBox() {
136
  <div class="social" style="text-align:center;margin:15px 0 10px 0;"><span class="social" style="margin-right:5px;"><a target="_blank" href="http://twitter.com/NextGENGallery"><img title="Follow NextGEN on Twitter" alt="Twitter" src="' . NGGALLERY_URLPATH . 'admin/images/twitter.png"></a></span><span class="social" style="margin-right:5px;"><a target="_blank" href="http://www.facebook.com/NextGENGallery"><img title="Like NextGEN on Facebook" alt="Facebook" src="' . NGGALLERY_URLPATH . 'admin/images/facebook.png"></a></span><span class="social"><a target="_blank" href="http://plus.google.com/101643895780935290171"><img title="Add NextGEN to your circles" alt="GooglePlus" src="' . NGGALLERY_URLPATH . 'admin/images/googleplus.png"></a></span></div>';
137
  }
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  /**
140
  * Show the server settings in a dashboard widget
141
  *
@@ -235,7 +436,7 @@ function ngg_overview_news(){
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');
@@ -292,8 +493,8 @@ function ngg_overview_right_now() {
292
  <table>
293
  <tbody>
294
  <tr class="first">
295
- <td class="first b"><a href="admin.php?page=ngg_addgallery"><?php echo $images; ?></a></td>
296
- <td class="t"><a href="admin.php?page=ngg_addgallery"><?php echo _n( 'Image', 'Images', $images, 'nggallery' ); ?></a></td>
297
  <td class="b"></td>
298
  <td class="last"></td>
299
  </tr>
@@ -345,7 +546,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>' ), 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,7 +554,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>' ), 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,7 +586,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 nextgen_esc_url(strip_tags($overview_url)); ?>"><?php _e('Reload page', 'nggallery'); ?></a>
389
  </p>
390
  <?php
391
  } else {
@@ -416,7 +617,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 nextgen_esc_url( strip_tags($update_url) ); ?>"><?php _e('Update', 'nggallery'); ?></a>
420
  </p>
421
  <?php
422
  }
@@ -427,7 +628,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 nextgen_esc_url( strip_tags($update_url) ); ?>"><?php _e('Download', 'nggallery'); ?></a>
431
  </p>
432
  <?php
433
  }
@@ -496,8 +697,7 @@ 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 (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');
@@ -582,6 +782,82 @@ function ngg_get_phpinfo() {
582
  return $phpinfo;
583
  }
584
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
585
  function ngg_list_contributors() {
586
  /* The list of my contributors. Thanks to all of them !*/
587
 
90
  add_meta_box('ngg_about_meta_box', __('About', 'nggallery'), 'ngg_AboutMetaBox', 'ngg_overview', 'left', 'core');
91
  //add_meta_box('ngg_lastdonators', __('Recent donators', 'nggallery'), 'ngg_widget_overview_donators', 'ngg_overview', 'right', 'core');
92
  if ( !is_multisite() || is_super_admin() ) {
93
+ add_meta_box('ngg_plugin_check', __('Plugin Check', 'nggallery'), 'ngg_plugin_check', 'ngg_overview', 'right', 'core');
94
  add_meta_box('ngg_server', __('Server Settings', 'nggallery'), 'ngg_overview_server', 'ngg_overview', 'right', 'core');
95
+ add_meta_box('dashboard_plugins', __('Related plugins', 'nggallery'), 'ngg_widget_related_plugins', 'ngg_overview', 'left', 'core');
96
  }
97
 
98
  function ngg_AboutMetaBox()
112
  echo sprintf(__('This plugin is primarily developed, maintained, supported and documented by <a href="%s" target="_blank">Photocrati Media</a> with a lot of love & effort. Any kind of contribution would be highly appreciated. Thanks!', 'nggallery'), 'http://www.photocrati.com/');
113
  echo '</p><ul>';
114
 
115
+ $url = 'http://wordpress.org/extend/plugins/nextgen-gallery/' ;
 
 
 
 
 
116
  echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-rating.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
117
  _e('Give it a good rating on WordPress.org', 'nggallery');
118
  echo "</a></li>";
133
  <div class="social" style="text-align:center;margin:15px 0 10px 0;"><span class="social" style="margin-right:5px;"><a target="_blank" href="http://twitter.com/NextGENGallery"><img title="Follow NextGEN on Twitter" alt="Twitter" src="' . NGGALLERY_URLPATH . 'admin/images/twitter.png"></a></span><span class="social" style="margin-right:5px;"><a target="_blank" href="http://www.facebook.com/NextGENGallery"><img title="Like NextGEN on Facebook" alt="Facebook" src="' . NGGALLERY_URLPATH . 'admin/images/facebook.png"></a></span><span class="social"><a target="_blank" href="http://plus.google.com/101643895780935290171"><img title="Add NextGEN to your circles" alt="GooglePlus" src="' . NGGALLERY_URLPATH . 'admin/images/googleplus.png"></a></span></div>';
134
  }
135
 
136
+ /**
137
+ * Ajax Check for conflict with other plugins/themes
138
+ *
139
+ * @return void
140
+ */
141
+ function ngg_plugin_check() {
142
+
143
+ global $ngg;
144
+ ?>
145
+ <script type="text/javascript">
146
+ (function($) {
147
+ nggPluginCheck = {
148
+
149
+ settings: {
150
+ img_run: '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="icon" alt="started"/>',
151
+ img_ok: '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" class="icon" alt="ok"/>',
152
+ img_fail: '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" class="icon" alt="failed" />',
153
+ domain: '<?php echo esc_url( home_url('index.php', is_ssl() ? 'https' : 'http') ); ?>'
154
+ },
155
+
156
+ run: function( index, state ) {
157
+ ul = $('#plugin_check');
158
+ s = this.settings;
159
+ var step = 1;
160
+ switch ( index ) {
161
+ case 1:
162
+ this.check1();
163
+ break;
164
+ case 2:
165
+ this.check2( step );
166
+ break;
167
+ case 3:
168
+ this.check3();
169
+ break;
170
+ }
171
+ },
172
+
173
+ // this function check if the json API will work with your theme & plugins
174
+ check1 : function() {
175
+ this.start(1);
176
+ var req = $.ajax({
177
+ dataType: 'json',
178
+ url: s.domain,
179
+ data:'callback=json&format=json&method=version',
180
+ cache: false,
181
+ timeout: 10000,
182
+ success: function(msg){
183
+ if (msg.version == '<?php echo $ngg->version; ?>')
184
+ nggPluginCheck.success(1);
185
+ else
186
+ nggPluginCheck.failed(1);
187
+ },
188
+ error: function (msg) {
189
+ nggPluginCheck.failed(1);
190
+ },
191
+ complete: function () {
192
+ nggPluginCheck.run(2);
193
+ }
194
+ });
195
+
196
+ },
197
+
198
+ // this function check if GD lib can create images & thumbnails
199
+ check2 : function( step ) {
200
+ if (step == 1) this.start(2);
201
+ var stop = false;
202
+ var req = $.ajax({
203
+ type: "POST",
204
+ url: ajaxurl,
205
+ data:"action=ngg_image_check&step=" + step,
206
+ cache: false,
207
+ timeout: 10000,
208
+ success: function(msg){
209
+ if (msg.stat == 'ok') {
210
+ nggPluginCheck.success(2, msg.message);
211
+ } else {
212
+ if (step == 1)
213
+ nggPluginCheck.failed(2);
214
+ stop = true;
215
+ }
216
+
217
+ },
218
+ error: function (msg) {
219
+ if (step == 1)
220
+ nggPluginCheck.failed(2);
221
+ stop = true;
222
+ },
223
+ complete: function () {
224
+ step++;
225
+ if (step <= 11 && stop == false)
226
+ nggPluginCheck.check2(step);
227
+ else
228
+ nggPluginCheck.run(3);
229
+ }
230
+ });
231
+ },
232
+
233
+ // this function check if wp_head / wp_footer is avaiable
234
+ check3 : function() {
235
+ this.start(3);
236
+ var req = $.ajax({
237
+ type: "POST",
238
+ url: ajaxurl,
239
+ data:"action=ngg_test_head_footer",
240
+ cache: false,
241
+ timeout: 10000,
242
+ success: function(msg){
243
+ if (msg == 'success')
244
+ nggPluginCheck.success(3);
245
+ else
246
+ nggPluginCheck.failed(3, msg);
247
+ },
248
+ error: function (msg) {
249
+ nggPluginCheck.failed(3);
250
+ }
251
+ });
252
+ },
253
+
254
+ start: function( id ) {
255
+
256
+ s = this.settings;
257
+ var field = "#check" + id;
258
+
259
+ if ( ul.find(field + " img").length == 0)
260
+ $(field).prepend( s.img_run );
261
+ else
262
+ $(field + " img").replaceWith( s.img_run );
263
+
264
+ $(field + " .success").hide();
265
+ $(field + " .failed").hide();
266
+ $(field + " .default").replaceWith('<p class="default message"><?php echo esc_js( __('Running...', 'nggallery') ); ?></p> ');
267
+ },
268
+
269
+ success: function( id, msg ) {
270
+
271
+ s = this.settings;
272
+ var field = "#check" + id;
273
+
274
+ if ( ul.find(field + " img").length == 0)
275
+ $(field).prepend( s.img_ok );
276
+ else
277
+ $(field + " img").replaceWith( s.img_ok );
278
+
279
+ $(field + " .default").hide();
280
+ if (msg)
281
+ $(field + " .success").replaceWith('<p class="success message">' + msg +' </p> ');
282
+ else
283
+ $(field + " .success").show();
284
+
285
+ },
286
+
287
+ failed: function( id, msg ) {
288
+
289
+ s = this.settings;
290
+ var field = "#check" + id;
291
+
292
+ if ( ul.find(field + " img").length == 0)
293
+ $(field).prepend( s.img_fail );
294
+ else
295
+ $(field + " img").replaceWith( s.img_fail );
296
+
297
+ $(field + " .default").hide();
298
+ if (msg)
299
+ $(field + " .failed").replaceWith('<p class="failed message">' + msg +' </p> ');
300
+ else
301
+ $(field + " .failed").show();
302
+
303
+ }
304
+
305
+ };
306
+ })(jQuery);
307
+ </script>
308
+ <div class="dashboard-widget-holder wp_dashboard_empty">
309
+ <div class="ngg-dashboard-widget">
310
+ <div class="dashboard-widget-content">
311
+ <ul id="plugin_check" class="settings">
312
+ <li id="check1">
313
+ <strong><?php _e('Check plugin/theme conflict', 'nggallery'); ?></strong>
314
+ <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
315
+ <p class="success message" style="display: none;"><?php _e('No conflict could be detected', 'nggallery'); ?></p>
316
+ <p class="failed message" style="display: none;"><?php _e('Test failed, disable other plugins & switch to default theme', 'nggallery'); ?></p>
317
+ </li>
318
+ <li id="check2">
319
+ <strong><?php _e('Test image function', 'nggallery'); ?></strong>
320
+ <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
321
+ <p class="success message" style="display: none;"><?php _e('The plugin could create images', 'nggallery'); ?></p>
322
+ <p class="failed message" style="display: none;"><?php _e('Couldn\'t create image, check your memory limit', 'nggallery'); ?></p>
323
+ </li>
324
+ <li id="check3">
325
+ <strong><?php _e('Check theme compatibility', 'nggallery'); ?></strong>
326
+ <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
327
+ <p class="success message" style="display: none;"><?php _e('Your theme should work fine with NextGEN Gallery', 'nggallery'); ?></p>
328
+ <p class="failed message" style="display: none;"><?php _e('wp_head()/wp_footer() is missing, contact the theme author', 'nggallery'); ?></p>
329
+ </li>
330
+ </ul>
331
+ <p class="textright">
332
+ <input type="button" name="update" value="<?php _e('Check plugin', 'nggallery'); ?>" onclick="nggPluginCheck.run(1);" class="button-secondary" />
333
+ </p>
334
+ </div>
335
+ </div>
336
+ </div>
337
+ <?php
338
+ }
339
+
340
  /**
341
  * Show the server settings in a dashboard widget
342
  *
436
  $link = $item->get_link();
437
  while ( stristr($link, 'http') != $link )
438
  $link = substr($link, 1);
439
+ $link = esc_url(strip_tags($link));
440
  $title = esc_attr(strip_tags($item->get_title()));
441
  if ( empty($title) )
442
  $title = __('Untitled');
493
  <table>
494
  <tbody>
495
  <tr class="first">
496
+ <td class="first b"><a href="admin.php?page=nggallery-add-gallery"><?php echo $images; ?></a></td>
497
+ <td class="t"><a href="admin.php?page=nggallery-add-gallery"><?php echo _n( 'Image', 'Images', $images, 'nggallery' ); ?></a></td>
498
  <td class="b"></td>
499
  <td class="last"></td>
500
  </tr>
546
  <div class="table table_content musubtable">
547
  <table>
548
  <tr class="first">
549
+ <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>
550
  <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
551
  </tr>
552
  </table>
554
  <div class="table table_discussion musubtable">
555
  <table>
556
  <tr class="first">
557
+ <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>
558
  <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
559
  </tr>
560
  </table>
586
  ?>
587
  <p class="hint"><?php _e('Translation file successful updated. Please reload page.', 'nggallery'); ?></p>
588
  <p class="textright">
589
+ <a class="button" href="<?php echo esc_url(strip_tags($overview_url)); ?>"><?php _e('Reload page', 'nggallery'); ?></a>
590
  </p>
591
  <?php
592
  } else {
617
  if ( !is_wp_error($locale->response) && $locale->response['response']['code'] == '200') {
618
  ?>
619
  <p class="textright">
620
+ <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Update', 'nggallery'); ?></a>
621
  </p>
622
  <?php
623
  }
628
  ?>
629
  <p><strong>Download now your language file !</strong></p>
630
  <p class="textright">
631
+ <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Download', 'nggallery'); ?></a>
632
  </p>
633
  <?php
634
  }
697
  if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'nggallery');
698
  else $allow_url_fopen = __('Off', 'nggallery');
699
  // Get PHP Max Upload Size
700
+ if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
 
701
  else $upload_max = __('N/A', 'nggallery');
702
  // Get PHP Output buffer Size
703
  if(ini_get('pcre.backtrack_limit')) $backtrack_limit = ini_get('pcre.backtrack_limit');
782
  return $phpinfo;
783
  }
784
 
785
+ /**
786
+ * Show NextGEN Gallery related plugins. Fetch plugins from wp.org which have added 'nextgen-gallery' as tag in readme.txt
787
+ *
788
+ * @return postbox output
789
+ */
790
+ function ngg_widget_related_plugins() {
791
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
792
+ }
793
+ function ngg_related_plugins() {
794
+ include(ABSPATH . 'wp-admin/includes/plugin-install.php');
795
+
796
+ if ( false === ( $api = get_transient( 'ngg_related_plugins' ) ) ) {
797
+ // this api sucks , tags will not be used in the correct way : nextgen-gallery cannot be searched
798
+ $api = plugins_api('query_plugins', array('search' => 'nextgen') );
799
+
800
+ if ( is_wp_error($api) )
801
+ return;
802
+
803
+ set_transient( 'ngg_related_plugins', $api, 60*60*24 );
804
+ }
805
+
806
+ echo '<div style="margin-bottom:10px;padding:8px;font-size:110%;background:#eebbaa;"><b>Note</b>: these plugins are provided by third parties and are <b>NOT</b> supported by Photocrati Media in any way</div>';
807
+
808
+ // don't show my own plugin :-) and some other plugins, which come up with the search result
809
+ $blacklist = array(
810
+ 'nextgen-gallery',
811
+ 'galleria-wp',
812
+ 'photosmash-galleries',
813
+ 'flash-album-gallery',
814
+ 'events-calendar',
815
+ 'widgets',
816
+ 'side-content',
817
+ 'featurific-for-wordpress',
818
+ 'smooth-gallery-replacement',
819
+ 'livesig',
820
+ 'wordpress-gallery-slideshow',
821
+ 'nkmimagefield',
822
+ 'nextgen-ajax',
823
+ 'projectmanager'
824
+ );
825
+
826
+ $i = 0;
827
+ while ( $i < 4 ) {
828
+
829
+ // pick them randomly
830
+ if ( 0 == count($api->plugins) )
831
+ return;
832
+
833
+ $key = array_rand($api->plugins);
834
+ $plugin = $api->plugins[$key];
835
+
836
+ // don't forget to remove them
837
+ unset($api->plugins[$key]);
838
+
839
+ if ( !isset($plugin->name) )
840
+ continue;
841
+
842
+ if ( in_array($plugin->slug , $blacklist ) )
843
+ continue;
844
+
845
+ $link = esc_url( $plugin->homepage );
846
+ $title = esc_html( $plugin->name );
847
+
848
+ $description = esc_html( strip_tags(@html_entity_decode($plugin->short_description, ENT_QUOTES, get_option('blog_charset'))) );
849
+
850
+ $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin->slug, 'install-plugin_' . $plugin->slug) .
851
+ '&amp;TB_iframe=true&amp;width=600&amp;height=800';
852
+
853
+ echo "<h5><a href='{$link}' target='_blank'>{$title}</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
854
+ echo "<p>$description<strong> " . __( 'Author' ) . " : </strong>$plugin->author</p>\n";
855
+
856
+ $i++;
857
+ }
858
+
859
+ }
860
+
861
  function ngg_list_contributors() {
862
  /* The list of my contributors. Thanks to all of them !*/
863
 
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 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 />
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 />
products/photocrati_nextgen/modules/ngglegacy/admin/wpmu.php CHANGED
@@ -92,16 +92,16 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
92
  <td>
93
  <select name="wpmuCSSfile">
94
  <?php
95
- // $csslist = ngg_get_cssfiles();
96
- $csslist = C_NextGen_Style_Manager::get_instance()->find_all_stylesheets();
97
- foreach ($csslist as $key => $a_cssfile) {
98
- $css_name = $a_cssfile['name'];
99
  if ($key == $ngg_options['wpmuCSSfile']) {
 
100
  $selected = " selected='selected'";
101
  }
102
  else $selected = '';
103
  $css_name = esc_attr($css_name);
104
- echo "\n\t<option value=\"{$key}\" {$selected}>{$css_name}</option>";
105
  }
106
  ?>
107
  </select><br />
92
  <td>
93
  <select name="wpmuCSSfile">
94
  <?php
95
+ $csslist = ngg_get_cssfiles();
96
+ foreach ($csslist as $key =>$a_cssfile) {
97
+ $css_name = $a_cssfile['Name'];
 
98
  if ($key == $ngg_options['wpmuCSSfile']) {
99
+ $file_show = $key;
100
  $selected = " selected='selected'";
101
  }
102
  else $selected = '';
103
  $css_name = esc_attr($css_name);
104
+ echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
105
  }
106
  ?>
107
  </select><br />
products/photocrati_nextgen/modules/ngglegacy/changelog.txt ADDED
@@ -0,0 +1,718 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NextGEN Gallery
2
+ by Photocrati Media
3
+
4
+ = V1.9.5 - 05.07.2012 =
5
+ * Changed: Branding changes following Photocrati acquisition (removed donation messages and updated links)
6
+ * Secured: Use WordPress-bundled JavaScript libraries for swfobject and swfupload instead of bundling our own
7
+ * Bugfix: Adjusted thickbox effect styling to ensure that the lightbox is always displayed in the foreground
8
+ * Bugfix: Fixed compatibility issues with Contact Form 7 and other plugins by following WordPress Plugin conventions
9
+ * Bugfix: Fixed network-wide activation in WordPress 3.4
10
+ * Bugfix: Plugin is no longer dependent on it's folder name
11
+
12
+ = V1.9.3 - 26.02.2012 =
13
+ * Bugfix : Ensure to set the slug for "all" albums
14
+ * Bugfix : Updated german translation ( THX to Roger Hunziker )
15
+ * Bugfix : Ensure error checking on IPTC array (THX to Kristian Edlund)
16
+ * Bugfix : Handle IE8 cached images better in slideshow
17
+ * Bugfix : Show album preview image if selected (THX to Kristian Edlund)
18
+
19
+ = V1.9.2 - 17.01.2012 =
20
+ * NEW : Added more XMLRPC commands (THX to Vladimir Vinogradsky)
21
+ * Changed : Rework Post-thumbnail function (THX to Kristian Edlund)
22
+ * Bugfix : Check first for valid images on unzip (only Mac OS zip-files)
23
+ * Bugfix : Increase z-index for twenty eleven theme
24
+ * Bugfix : Support non latin chars in tagcloud
25
+ * Bugfix : Allow other tinymce intance
26
+ * Bugfix : Better support for WPML translation
27
+
28
+ = V1.9.1 - 10.12.2011 =
29
+ * Bugfix : Security hardness for untrusted filenames/meta data (THX to Brian St. Pierre)
30
+ * Bugfix : Fixed security vulnerability (TXH to Jon Cave)
31
+ * Bugfix : Load piclens script via other function
32
+ * Bugfix : IE7 script fix for add gallery
33
+ * Bugfix : IE7/IE8 width set correctly for edit album autocomplete field
34
+
35
+ = V1.9.0 - 27.11.2011 =
36
+ * NEW : Keep images transparency for PNG and GIF format
37
+ * NEW : Switch to Plupload, support now HTML5 Upload (only with WordPress 3.3)
38
+ * NEW : Added client side resize feature (only with WordPress 3.3)
39
+ * NEW : Support for gallery templates in album shortcodes [ album id=x template="name" gallery="templatename" ]
40
+ * NEW : Added new hook ngg_delete_picture
41
+ * Changed : Updated to jQuery Cycle Version 2.9995
42
+ * Changed : Always cache the single pictures, remove option
43
+ * Bugfix : Couldn't use bulk operation for search results
44
+ * Bugfix : Bugfix for Edit thumbnails under IE 8 + 9
45
+ * Bugfix : Allow empty altext in ngg.editImage
46
+ * Bugfix : Various PHP notice fixes
47
+ * Bugfix : Resize fix for Shutter effect and mobile Browser
48
+ * Bugfix : FTP Import missing slug field into database
49
+ * Bugfix : Check also EXIF field "DateTimeOriginal" for timestamp
50
+
51
+ = V1.8.4 - 26.10.2011 =
52
+ * Bugfix : Fixed security vulnerability (TXH to Alain Schneider)
53
+
54
+ = V1.8.3 - 07.08.2011 =
55
+ * Changed : Support for simple custom permalink structures (i.e. /%category%/%postname%/)
56
+ * Bugfix : Sub-Albums in Albums didn't create the correct link
57
+ * Bugfix : AJAX Pagination didn't work anymore
58
+ * Bugfix : Adding index.php to home_url()
59
+ * Bugfix : Preview picture lost on backend gallery page 2 or higher
60
+
61
+ = V1.8.2 - 12.07.2011 =
62
+ * Bugfix : Set pagination variables for search result, otherwise update failed
63
+ * Bugfix : Update failed for paged galleries since WordPress 3.2
64
+
65
+ = V1.8.1 - 18.06.2011 =
66
+ * Bugfix : Special case for pagination, instead of showing page-1, we show the clean url
67
+ * Bugfix : Various PHP notice fixes
68
+ * Bugfix : Typo in rewrite rules
69
+ * Bugfix : Flush rewrite rules during upgrade later
70
+
71
+ = V1.8.0 - 12.06.2011 =
72
+ * NEW : Full rework of permalink url structure
73
+ * NEW : Adding Google Sitemaps for Images (require WordPress SEO plugin by YOAST )
74
+ * NEW : Support for WPML ( WordPress Multilingual Plugin )
75
+ * NEW : Adding support for arrow key in shutter effect (THX to Flyvans)
76
+ * NEW : Adding sort operation for galleries overview page
77
+ * Changed : Updated pagination to new WP3.1 style
78
+ * Bugfix : Create unique slug in a better way
79
+ * Bugfix : Rework screen options filter for gallery and image table
80
+ * Bugfix : Empty values in XMLRPC update calls are ignored
81
+ * Bugfix : Create gallery failed when safe-mode on
82
+ * Bugfix : Permalink didn't work in combination with album & imagebrowser
83
+
84
+ = V1.7.4 - 15.02.2011 =
85
+ * Bugfix : Disallow direct call of ajax file to avoid path disclosure (THX to High-Tech Bridge SA)
86
+ * Bugfix : Rework jQuery Cycle slideshow for IE compat reason (THX to Justin Dickenson)
87
+ * Bugfix : Resize only larger images in slideshow
88
+ * Bugfix : Improved image format detection in gd.thumbnail class (THX to Kupar.b)
89
+
90
+ = V1.7.3 - 20.01.2011 =
91
+ * NEW : Introduce plugin health check for conflicts with other plugins/themes
92
+ * NEW : Adding new XMLRPC method ngg.deleteImage
93
+ * NEW : Adding new XMLRPC method ngg.editImage
94
+ * Changed : Rework register script for autocomplete feature
95
+ * Bugfix : Bugfix for Multisite setup and flash upload
96
+ * Bugfix : WP3.1 compat issue, show site admin page only on Multisite installation
97
+
98
+ = V1.7.2 - 13.12.2010 =
99
+ * Bugfix : Adding images to database require slug
100
+
101
+ = V1.7.1 - 13.12.2010 =
102
+ * Changed : Disable upgrade for PHP4 user
103
+ * Changed : Disable colorpicker for option page
104
+ * Bugfix : Compat fix for upgrade
105
+
106
+ = V1.7.0 - 11.12.2010 =
107
+ * NEW : Publish a new post direct from the gallery admin page
108
+ * NEW : Added filter hook 'ngg_get_image_metadata' to add more exif/iptc information
109
+ * NEW : Adding Autocomplete field to TinyMCE Popup and Album page
110
+ * NEW : More methods for XMLRPC interface
111
+ * Changed : New hooks for gallery table (THX to Alexander Schneider)
112
+ * Changed : Introduce jQuery dialog as new UI element
113
+ * Changed : Call TinyMCE window via admin-ajax
114
+ * Bugfix : Better support for SSL blogs
115
+ * Bugfix : Install/Upgrade failed when table prefix contain captial letters
116
+ * Bugfix : Fix validation issues in Media-RSS
117
+ * Bugfix : Empty tags in XMP Meta causes PHP error
118
+ * Bugfix : Rework load mechanism for slideshow
119
+ * Bugfix : Copy meta data when image is copied
120
+ * Bugfix : Icon Support for Ozh' Admin Drop Down Menu
121
+ * Bugfix : Use correct sort order in slideshow
122
+
123
+ = V1.6.2 - 19.09.2010 =
124
+ * NEW : Added constant NGG_SKIP_LOAD_SCRIPTS to avoid script load
125
+ * Bugfix : Load Tags library with core files
126
+ * Bugfix : Slideshow script failed in IE7, load script now in header
127
+ * Bugfix : Load slideshow widget always
128
+ * Changed : New admin notice for database upgrade
129
+ * Changed : Rework crop feature for featured images
130
+ * Changed : Use site_url() instead get_option ('siteurl'), required for SSL support
131
+
132
+ = V1.6.1 - 08.09.2010 =
133
+ * Bugfix : Script load of swfobject.js failed
134
+ * Bugfix : Show sideshow also with 1 or 2 images
135
+ * Bugfix : Rework null byte check in zip upload
136
+
137
+ = V1.6.0 - 07.09.2010 =
138
+ * NEW : Wordpress 3.0 Network (Multi-Site) support
139
+ * NEW : Integrate jQuery Cycle as NON-Flash slideshow
140
+ * NEW : Adding jQuery File Tree for import folder (THX to Sergey Pasyuk )
141
+ * NEW : Added action hook 'ngg_show_imagebrowser_first' on custom request
142
+ * NEW : Added filter hook 'ngg_slideshow_size' to resize sildeshow for mobile browser plugins
143
+ * Changed : Reorder tabs for upload
144
+ * Changed : New menu icon and screen icon (THX to Ben Dunkle)
145
+ * Changed : Load frontend libs always
146
+ * Changed : Rework of overview page
147
+ * Bugfix : Security bugfix for Zip-Upload (THX to Dominic Szablewski)
148
+ * Bugfix : Allow JPG, PNG, GIF extension
149
+ * Bugfix : New German translation (THX to Martin Kramarz)
150
+ * Bugfix : Copy/Move also backup file
151
+ * Bugfix : Calculate correct ratio for fix thumbnail size (THX to Alekz Keck)
152
+
153
+ = V1.5.5 - 14.06.2010 =
154
+ * Bugfix : Compat issue for post thumbnails with WP2.9
155
+ * NEW : Adding more hooks for custom fields plugin
156
+
157
+ = V1.5.4 - 14.06.2010 =
158
+ * Bugfix : No resize of smaller images
159
+ * Bugfix : Compat issues for Post Thumbnails under WP3.0
160
+ * Bugfix : Esc_URL in Media RSS
161
+
162
+ = V1.5.3 - 11.04.2010 =
163
+ * New : Adding pagination to footer
164
+ * Changed : Prepare new filter to replace slideshow
165
+ * Bugfix : Remove non-breaking space from navigation
166
+ * Bugfix : Pagination of galleries
167
+ * Bugfix : Fixed brackets position for old shortcode query
168
+ * Bugfix : Slideshow option 'Show next image on click" has wrong default value
169
+
170
+ = V1.5.2 - 25.03.2010 =
171
+ * Bugfix : XSS security vulnerability (THX to Core Security Advisories Team , Pedro Varangot)
172
+ * Bugfix : Missing $wpdb in shortcodes.php
173
+
174
+ = V1.5.1 - 23.03.2010 =
175
+ * Bugfix : PHP4 compat issue for Add gallery & options page
176
+ * Bugfix : Gallery widget can now have a empty title
177
+ * Bugfix : Adding correct stripslash for gallery title
178
+
179
+ = V1.5.0 - 18.03.2010 =
180
+ * NEW : Support for Post thumbnail feature
181
+ * NEW : Backup and Recover function for images (THX to Simone Fumagalli)
182
+ * NEW : Resize images after upload (THX to Simone Fumagalli)
183
+ * NEW : Added a JSON class for fetching galleries in a RESTful way (see xml/json.php)
184
+ * NEW : Adding various new capabilities for user roles
185
+ * NEW : Auto downloader for translation file
186
+ * Changed : Rename query var from slideshow to callback for compat reason with other plugin
187
+ * Changed : Convert widget function to new WP structure
188
+ * Changed : Include lookup for tags into the backend search
189
+ * Changed : Restructure addgallery and settings page to enable custom tabs
190
+ * Bugfix : Select album preview from gallery preview pics instead random list
191
+ * Bugfix : Keep fix dimension in edit thumbnail operation
192
+ * Bugfix : Import meta data didn't work correct for existing images
193
+ * Bugfix : Fix onload bug for Chrome 4 in Shutter script
194
+ * Bugfix : Remove various PHP notices for a better world
195
+ * Removed : Canonical link is now part of Wordpress 2.9
196
+
197
+ = V1.4.3 - 16.11.2009 =
198
+ * Bugfix : Urlencode XML file path for sildeshow
199
+
200
+ = V1.4.2 - 16.11.2009 =
201
+ * Changed : Load sildeshow XML not longer via relative path
202
+ * Bugfix : No imagebrowser in carousel mode
203
+ * Bugfix : JS Effect navigation based on wrong array structure
204
+ * Bugfix : Remove whitespaces from meta import
205
+ * Bugfix : Capability check for upgrade notice
206
+ * Removed : Hide "more settings" for now, causes problems with IE and jQuery UI tabs
207
+
208
+ = V1.4.1 - 10.11.2009 =
209
+ * Bugfix : Capabilites could not be saved
210
+ * Bugfix : Ajax pagination option not saved
211
+ * Bugfix : echo nggSlideshowWidget() for compat reason
212
+
213
+ = V1.4.0 - 08.11.2009 =
214
+ * NEW : Automatic rotate images during upload or via manage gallery page (THX to Simone Fumagalli)
215
+ * NEW : Include Bulkupdate for gallery overview, require PHP 5.2
216
+ * NEW : XMLRPC support with 4 new methods : see xmlrpc.php for more information
217
+ * NEW : Recent and random images can be taken from a specific gallery using the id=x parameter in the shortcode (THX to Prollius)
218
+ * NEW : Recent images can be recent by exif date (instead of database id) by using the mode=recentdate parameter in the shortcode (THX to Prollius)
219
+ * NEW : Introduce the WP_Object_cache and meta_data
220
+ * NEW : Various new hooks and filters
221
+ * Added : Better support for role manager plugin (THX to Mattias Buelens)
222
+ * Added : New option to add hidden images. Needed to show all images in a modal window (Thickbox, Lightbox et.)
223
+ * Added : New link parameter for the singlepic shortcode : [singlepic id=x w=x h=x link="http://google.com"]
224
+ * Added : New template gallery-carousel
225
+ * Added : New id parameter for recent and random shortcodes : [random max="7" template="filename" id="2"] takes only pictures from the gallery with id=2
226
+ * Added : New mode parameter for recent shortcode : [recent max="7" template="filename" id="3" mode="date" /] where mode can be one of (id, date, sort). Recent pictures are delivered by addition to database (id), exif date (date) or user sort order (sort).
227
+ * Added : Enable/Disable Ajax navigation via settings
228
+ * Added : New filter hook 'ngg_render_template' to render templates with a other plugin
229
+ * Changed : Added option to link an album with a page id
230
+ * Changed : Support templates for child themes, use STYLESHEETPATH instead TEMPLATEPATH (THX to Prollius)
231
+ * Changed : Rework of Media RSS Widget
232
+ * Bugfix : Check capability to create a new page
233
+ * Bugfix : Fix double call of filter name , changed to ngg_picturelist_object (THX to Prollius)
234
+ * Bugfix : Check for a deleted gallery in a album
235
+
236
+ = V1.3.6 - 20.09.2009 =
237
+ * Changed : Just change the feed link
238
+
239
+ = V1.3.5 - 17.07.2009 =
240
+ * Bugfix : Fixed XSS issue for Page title
241
+
242
+ = V1.3.4 - 07.07.2009 =
243
+ * Added : New filter ngg_gallery_object and ngg_image_object
244
+ * Bugfix : Fix double rendering of a gallery if two album shortcodes are used
245
+ * Bugfix : Fix for custom field ngg_gal_sort
246
+ * Bugfix : Changed capability check for upload
247
+ * Bugfix : Check for correct version OR memory limit
248
+
249
+ = V1.3.3 - 11.06.2009 =
250
+ * Changed : Load Thickbox images via wp_footer()
251
+ * Bugfix : Widget setting couldnot be saved
252
+
253
+ = V1.3.2 - 10.06.2009 =
254
+ * Changed : Resize maximum to 1280 x 1280 with nggshow (THX to onezero)
255
+ * Bugfix : Bugfix for Multifile upload
256
+ * Bugfix : Bugfix for sortorder under jQuery 1.3
257
+ * Bugfix : Workaround for more albums per page, need more rework
258
+ * Bugfix : AJAX reload didn't work if slideshow is shown by default
259
+ * Bugfix : Redirect links didn't work if permalinks are deactivates
260
+ * Bugfix : Add new gallery in manage-overview didn't use defaultpath
261
+
262
+ = V1.3.1 - 07.06.2009 =
263
+ * Bugfix : Fixed ZIP upload, wrong variable used
264
+ * Bugfix : Check for array before foreach in album missing
265
+
266
+ = V1.3.0 - 07.06.2009 =
267
+ * NEW : Subalbum support
268
+ * NEW : Search for images in the admin tab
269
+ * NEW : Add new gallery also in manage tab
270
+ * NEW : AJAX support for Imagebrowser and gallery navigation (THX to Anty)
271
+ * NEW : Added zip upload via URL (THX to Juan Jose Galvez)
272
+ * Added : jQuery Multiple File Upload Plugin v1.44
273
+ * Added : SWFUpload V2.2.0
274
+ * Changed : Remove extension for Alttext during first import
275
+ * Changed : Meta tag added via wp_head hook (THX to Viper)
276
+ * Bugfix : Correct various PHP notice messages
277
+ * Bugfix : Typo fix in custom fields for ngg_gal_ImageBrowser
278
+ * Bugfix : Avoid upload of images in gallery without correct capability
279
+
280
+ = V1.2.1 - 22.03.2009 =
281
+ * NEW : Support for IE8 Web Slices in widgets
282
+ * NEW : Add filter ngg_image_object
283
+ * Changed : Descending order in add gallery menu
284
+ * Bugfix : Exclude option didnT work for multi pages
285
+ * Bugfix : Check for correct capability in manage gallery
286
+
287
+ = V1.2.0 - 09.03.2009 =
288
+ * NEW : Support for image tag cloud with shortcode [tagcloud]
289
+ * NEW : Adding shortcode [recent max="7" template="filename" /] & [random max="7" template="filename" /] to show the most recent/random pictures (THX to Bernhard)
290
+ * NEW : Crop thumbnails manually (THX to Simone Fumagalli)
291
+ * NEW : Support for i18n with polyglot or qtrans plugin (THX to Boris Glumpler)
292
+ * NEW : Canonical meta link support
293
+ * Added : SWFUpload V2.2.0 B5
294
+ * Added : New memory limit check in upload screen
295
+ * Bugfix : Language typo fixes
296
+ * Bugfix : Admin Pagination fix
297
+ * Bugfix : Typo fix in widgets
298
+ * Bugfix : Init column script after document is ready
299
+ * Bugfix : htmlspecialchars() instead htmlentities() for links in the a href title description
300
+ * Bugfix : Upgrade routine didn't add sortorder to correct table (THX to Uwe)
301
+ * Bugfix : Correct shotcode in media upload tab
302
+
303
+ = V1.1.0 - 26.01.2009 =
304
+ * NEW : Pagination for album page via custom fields ('ngg_paged_Galleries')
305
+ * NEW : Support for fixed number of columns inside the gallery
306
+ * NEW : Added pagination for galleries and images in admin section
307
+ * NEW : New action hook after image is added to database, called 'ngg_added_new_image'
308
+ * NEW : New template for caption below images, called via [nggallery id=x template=caption]
309
+ * Added : SWFUpload V2.2.0 B4
310
+ * Changed : Rework of Manage image tables
311
+ * Changed : Move imagerotator.swf to wp-content/uploads
312
+ * Changed : Added a URL field to setup the path to the Imagerotator
313
+ * Changed : Add additional parameter to gallery object
314
+ * Changed : Load donators list external
315
+ * Bugfix : Style fixes for tables in IE7
316
+ * Bugfix : All albums code couldn't use the slideshow, query is empty for 0
317
+ * Bugfix : Htmlentities() for links in the a href title description
318
+ * Bugfix : Clean up mode for singlepic
319
+ * Bugfix : Typo in widget settings
320
+
321
+ = V1.0.2 - 19.12.2008 =
322
+ * Added : Option to enable/disable the MediaRSS Feed
323
+ * Added : For flash under FF3/WIN we should use outline: none;
324
+ * Added : Use sort order also for Media RSS
325
+ * Changed : Descending order for TinyMCE Editor
326
+ * Changed : Added screencolor flashvar as bgcolor for the flash slideshow
327
+ * Changed : Remove link to gallery in sidebar widget
328
+ * Bugfix : Check for empty gallery title and show name instead
329
+ * Bugfix : Album id=all / Album id=0 didn't show content
330
+ * Bugfix : Check for a empty description and alttext
331
+ * Bugfix : Remove HTML tags from slideshow
332
+ * Bugfix : Load SWFobject always when the imagerotator exist
333
+ * Bugfix : Zip-Upload in existing gallery failed
334
+ * Bugifx : Typo in functions.php (THX to David Horat)
335
+
336
+ = V1.0.1 - 11.12.2008 =
337
+ * Bugfix : Change upgrade routine, import_date_time could cause a memory problem
338
+ * Bugfix : Help pages will not show up in non-english enviroment
339
+ * Bugfix : Show gallery name if title is empty
340
+
341
+ = V1.0.0 - 11.12.2008 =
342
+ * NEW : Adding some rewrite rules for the Blog title for a better SEO (Will be continued...)
343
+ * NEW : Added ImageMagick support (currently a bit experimental) (THX to Frederic de Ranter)
344
+ * NEW : Automatic unistall via register_uninstall_hook()
345
+ * NEW : Added a presort option to sort easier the images
346
+ * NEW : Lookup for a nggallery.css in the theme folder
347
+ * NEW : Added Date/Time field to database and import it from EXIF, new sort option
348
+ * NEW : Multi Widgets to show links to Media RSS feeds (THX to Vincent Prat)
349
+ * NEW : PicLens support for galleries (THX to Vincent Prat)
350
+ * NEW : Copy/Move images between galleries (THX to Vincent Prat)
351
+ * NEW : Media RSS feeds (either for galleries, albums or global) (THX to Vincent Prat)
352
+ * NEW : Image tag management (THX to Vincent Prat)
353
+ * NEW : Convert all shortcodes to WP shortcodes API
354
+ * NEW : AJAX based thumbnail generator
355
+ * NEW : Create output via template files, more flexible and support for multiple templates
356
+ * NEW : Extended role system. Each gallery has now a author
357
+ * NEW : [thumb id="4,5,12,..."] shortcode. You can now insert thumbnails for one or more images (that are not necessarly inside the same gallery).
358
+ * Changed : Add swfupload 2.2.0. Support for Adobe Flash 10 upload
359
+ * Changed : Update all Admin pages for Wordpress 2.7 Admin UI
360
+ * Changed : New icon for TinyMCE and WP2.7 Menue from http://www.pinvoke.com/
361
+ * Changed : Move update message to admin.php
362
+ * Changed : Widgets are now core and doesn't need to be activate, rework as Multi Widgets
363
+ * Changed : Improved the gallery management page.
364
+ * Changed : Rename the filter 'ngg_create_gallery_thumbcode' to 'ngg_get_thumbcode'.
365
+ * Changed : Convert tags to WP-Taxonomy tables, no more need for ngg_tags, ngg_pic2tags
366
+ * Changed : Arrange manage fields in a new way
367
+ * Changed : Support now SSL
368
+ * Changed : Use JQuery UI instead of interface lib
369
+ * Changed : Updated to swfobject 2.1
370
+ * Changed : Rework of database queries and new central nggdb class
371
+ * Bugfix : Changed CSS for singlepic padding to margin
372
+ * Bugfix : Check for zero in Exif Focal Length
373
+ * Bugfix : Round instead inval for square thumbnails
374
+ * Removed : Do not longer check for myGallery folders
375
+ * Removed : Use now PclZip from WP Core
376
+ * Removed : Wordpress 2.1 - 2.3 files deleted
377
+
378
+ = V0.99 - 27.09.2008 =
379
+ * Changed : Included swfobject version 2.1
380
+ * Bugfix : Recognize the zip better
381
+ * Bugfix : Limit the length of the title in the media-upload
382
+ * Bugfix : Round instead inval for square thumbnails
383
+
384
+ = V0.98 - 15.07.2008 =
385
+ * Bugfix : Removed all whitespaces at EOF
386
+
387
+ = V0.97 - 10.07.2008 =
388
+ * Changed : Get new path contstant from WP2.6
389
+ * Changed : Minor updates for WP2.6
390
+ * Changed : Added new filters (THX to Vincent Prat)
391
+ * Removed : Revert singlepic wrapper, breaks validation
392
+
393
+ = V0.96 - 18.05.2008 =
394
+ * Changed : Use postbox for gallery settings
395
+ * Added : New filter function to add custom columns
396
+ * Bugfix : Fixed width for Thickbox in Manage gallery
397
+ * Bugfix : fixed width for media upload select box
398
+ * Bugfix : Remove <p> tag in singlepic regex
399
+ * Bugfix : Correct format of shutter speed
400
+ * Bugfix : Album name in Short code not useable
401
+
402
+ = V0.95 - 25.04.2008 =
403
+ * Bugfix : Correction in media-upload to fit with Wordpress 2.5.1
404
+ * Bugfix : Attribute_escape all objects in media-upload
405
+ * Bugfix : Correct sortorder for albums
406
+ * Bugfix : Typo correction (THX to Momo-I)
407
+
408
+ = V0.94 - 20.04.2008 =
409
+ * Added : New filter option ngg_create_gallery_link
410
+ * Changed : Reduce amount of DB queries in albums (Big THX to Alexandr Kindras)
411
+ * Changed : Revert wpautop priority change. Doesn't good for other plugins
412
+
413
+ = V0.93 - 12.04.2008 =
414
+ * Added : Select Full-Size or Singlepic in Media Upload
415
+ * Added : Check for minimum 8 MB Memory
416
+ * Changed : Priority from wpautop must be before gallery
417
+ * Bugfix : Added Screencolor to Widgets
418
+ * Bugfix : Clean CSS class in setup.php
419
+ * Bugfix : Change PHP short tag (Thx to Archedition)
420
+ * Bugfix : Remove tab.png from CSS (Thx to Frisco)
421
+ * Bugfix : Remove newline and encode quotes in Media-Upload (THX to Trip Mellinger)
422
+
423
+ = V0.92 - 30.03.2008 =
424
+ * Changed : Higher priority for filter in WP2.5 final
425
+ * Changed : Do not increase memory_limit with ini_set
426
+ * Added : Read EXIF field ImageDescription
427
+
428
+ = V0.91 - 24.03.2008 =
429
+ * Changed : Resample mode back to 3
430
+ * Changed : Add DIV "ngg-singlepic-wrapper" for SingelPic (THX to Travel-Junkie)
431
+ * Changed : Increase Tweakfactor for Memory Check
432
+ * Bugfix : Use admin.css only on NextGEN pages (THX tp Oliver)
433
+ * Bugfix : Updates widgets (V1.21) for ImageRotator 3.15
434
+ * Bugfix : Change order of rewrite rules for WP 2.5
435
+ * Bugfix : Include Dashboard CSS also for page "nextgen-gallery"
436
+
437
+ = V0.90 - 18.03.2008 =
438
+ * NEW : Sort order for images
439
+ * NEW : Updated style for Wp 2.5
440
+ * NEW : Media upload tab integration for WP 2.5
441
+ * Added : Change wp shortcode filter
442
+ * Added : TinyMCE V3 Button for WordPress 2.5
443
+ * Added : Singlepic center class
444
+ * Changed : New default parameter for ImageRotator 3.15
445
+ * Changed : By default enable metadata import
446
+ * Changed : Moved disable/enable flash setting to add gallery
447
+ * Changed : wpdb->escape gallerytag in nggfunctions
448
+ * Changed : Sort files after scan folder
449
+ * Changed : Check for filename during upload
450
+ * Changed : Remove jQuery plugin for navigation
451
+ * Changed : Remove myGallery import
452
+ * Changed : Resample mode default set to 5, causes problems at PHP 4.4.8 /PHP 5.2.4
453
+ * Bugfix : nggextractXML missing stripslashes
454
+ * Bugfix : P tags not closed in manage.php
455
+ * Bugfix : Remove " from singlepic class
456
+ * Bugfix : Rewrite rule for ImageBrowser added
457
+
458
+ = V0.83 - 14.02.2008 =
459
+ * Changed : New Interfaces.js from WP Core 2.5, for sortable bug under IE7
460
+ * Changed : Update to jQuery V1.2.2, deregister older version from WP
461
+ * Changed : Add ini_set 128MB for memory-limit
462
+ * Bugfix : SWFUpload Cookie Post_Params are overwritten , no upload possible
463
+ * Bugfix : WPMU options are not saved after installation
464
+ * Bugfix : Remove Flush rewrite rules during install
465
+
466
+ = V0.82 - 09.02.2008 =
467
+ * Bugfix : add_filter (searchnggallerytags) not proper included for some other plugins
468
+
469
+ = V0.81 - 04.02.2008 =
470
+ * Changed : Use stristr first to reduce CPU cycles (THX to Alakhnor)
471
+ * Changed : Flush Rewrites rules after option update
472
+ * Changed : Rework for folder check under Safe-Mode
473
+ * Bugfix : Check for array in get_option() (THX to Alessandro)
474
+ * Bugfix : Add Cookie to SWFUpload, show Error code included
475
+ * Bugfix : galShowOrder = Sildeshow at first didn't work
476
+ * Bugfix : Remove reference from ngg_getOnlyImages
477
+
478
+ = V0.80 - 02.02.2008 =
479
+ * NEW : SWFUpload integrated : Show upload progress and select multiple files in the file browser dialog.
480
+ * NEW : Progress bar for resize, watermark and thumbnail operation
481
+ * NEW : Import Meta data from images
482
+ * NEW : Show Meta data information
483
+ * NEW : Cache option for SinglePic
484
+ * NEW : Permalink support
485
+ * NEW : Custom fields support - Change the settings for each post/page
486
+ * Changed : Up to 10 Widgets, exclude galleries from random/recent images.
487
+ * Changed : Refactor permission check for Safe-Mode Check and mkdir/chmod
488
+ * Changed : Admin CSS in new folder/file for better structure
489
+ * Changed : Clean up folder structure
490
+ * Changed : Clean up code in manage.php, functions.php
491
+ * Changed : Moved several functions into nggAdmin Class (functions.php)
492
+ * Changed : Update to jQuery V1.1.4 (v1.2.1 causes problems with interface.js)
493
+ * Changed : Hide used galleries in album admin page
494
+ * Changed : Remove float in singlepic code and added class ngg-left , ngg-right (THX to Nathan Sylvain)
495
+ * Changed : Edit style setting (added new class .desc , THX to Sebastian)
496
+ * Changed : Check for galleryfolder instead name (THX to Luke Poland)
497
+ * Changed : Delete images per default
498
+ * Changed : Change CSS (ngg-album-compact) , remove width & height setting from code
499
+ * Bugfix : Fixed static front page problem
500
+ * Bugfix : Missing stripslashes & html_entity_decode
501
+ * Bugfix : Change Album CSS (THX to Thomas-DK)
502
+ * Bugfix : Watermark for GIF not correct supported
503
+ * Bugfix : Missing wp_nonce at setup page
504
+ * Bugfix : Add DIV in Slideshow link (for Safari & Opera)
505
+ * Added : Screencolor flashvar for JW Image Rotator 3.13 or higher
506
+ * Added : Set WP-CHARSET / COLLATE during installation
507
+ * Added : Updated to Pclzip.lib.php v2.6
508
+ * Added : CSS ID field for gallery & images
509
+ * WPMU : New site admin page (wpmu.php)
510
+ * WPMU : Integrated quota check
511
+ * WPMU : No update check
512
+ * WPMU : Remove edit style (THX to Kristin)
513
+ * WPMU : Remove uninstall button
514
+ * WPMU : Remove server settings
515
+ * WPMU : Gallery path set to blog.dir
516
+ * Added : Support for WPMU
517
+
518
+ = V0.74 - 01.12.2007 =
519
+ * NEW : Added meta reader class, first step to integrated meta data import
520
+
521
+ = V0.73 - 20.10.2007 =
522
+ * Added : Support for Shutter Reloaded
523
+ * Update to jQuery Tabs 2.7.4
524
+ * Changed : Remove $_SERVER['REQUEST_URI'] for IIS compatibility
525
+ * Bugfix : Option Sildeshow didn't jump to overview
526
+
527
+ = V0.72 - 13.09.2007 =
528
+ * Added : Missing overflow:hidden in ngg-album.css
529
+ * Added : New experimental stylesheet hovereffect.css
530
+ * Changed : Better check for memory limit in zip-files
531
+ * Bugfix : Missing stripslashes for alttext (THX to Lawrence)
532
+ * Bugfix : Navigation didn't highlight page 1 (THX to Brot)
533
+ * Bugfix : Albums automatic minimize if more than 4 galleries
534
+ * Bugfix : Missing check_admin_referer in style (THX again to Christopher)
535
+
536
+ = V0.71 - 07.09.2007 =
537
+ * Added : Add defer="defer" to Slideshow to avoid IE crash (THX to Simbo)
538
+ * Bugfix : Bugfix for slideshow to show all pictures
539
+ * Bugfix : Wrong check_admin_referer in albums (THX to Christopher)
540
+ * Bugfix : No exclude check in counter and widgets (THX to Christopher)
541
+ * Bugfix : Check for existing role (THX to Lost in Network)
542
+ * Bugfix : Label in roles are wrong (THX to Joern)
543
+
544
+ = V0.70 - 06.09.2007 =
545
+ * NEW : Add role manager page and capabilities
546
+ * NEW : Show gallery with [tags=list of tags]
547
+ * NEW : Show album with [albumtags=list of tags]
548
+ * NEW : Tag system for all images
549
+ * NEW : Option for append related images
550
+ * NEW : Option to show description below thumbnail
551
+ * NEW : Option to show ImageBrowser instead JS effect
552
+ * Added : Add Full size link to thickbox
553
+ * Added : Check for page/postid in tag processing
554
+ * Added : Sildeshow widget can now contain all images
555
+ * Added : Minimize/Maximize option for albums
556
+ * Added : Deregister jQuery V1.1.2 for WP2.2 (to use V1.1.3.1)
557
+ * Added : Integrate wp_nonce_field at all admin pages
558
+ * Changed : Update to Thickbox 3.1 + mods for NextGEN gallery
559
+ * Changed : Moved "clear:both" into class "ngg-clear" (THX to Gero)
560
+ * Changed : Switched from jQuery Interface to jQuery Tabs from Klaus Hartl
561
+ * Remove : Remove option for singlepic link
562
+ * Remove : Remove options for imagebrowser
563
+ * Bugfix : Most Recent image in Widget are wrong
564
+ * Bugfix : More XHTML valid , htmlspecialchars() after add_query_arg()
565
+ * Bugfix : Sanitize file name before upload
566
+ * Bugfix : Sanitize folder name (THX to Tom Fowler)
567
+ * Bugfix : Show title/alt in jQuery plugin (THX to Gregory Green)
568
+ * Bugfix : i18n support for Gallery tab
569
+ * Bugfix : Reduce memory-needs for plugin
570
+ * Bugfix : Typo/spelling correction
571
+ * Bugfix : Removed myGallery author from contribute list
572
+
573
+ = V0.64 - 31.07.2007 =
574
+ * Bugfix : Remove arrows in image browser text
575
+ * Bugfix : Include nggadmintab.php with dirname
576
+ * Bugfix : Zip-Upload under Mac > look for basename
577
+
578
+ = V0.63 - 10.07.2007 =
579
+ * NEW : You can now upload a zip file into a existing gallery
580
+ * Added : Remove subfolder in Zip-files
581
+ * Added : Show required memory for thumbnail creation
582
+ * Added : Updated to jQuery.multifile 1.22
583
+ * Added : Install-Upgrade for WordPress 2.3
584
+ * Bugfix : Supress unlink error message for thumbs
585
+ * Bugfix : Support upload of zip files from MAC
586
+ * Bugfix : Add Stripslash for image description
587
+ * Bugfix : Use for Singlepic not rel="Gallery name"
588
+ * Bugfix : Moved RSS/Snoopy includes into function
589
+
590
+ = V0.62 - 06.07.2007 =
591
+ * NEW : Import for myGallery
592
+ * Added : Updated to jQuery 1.1.3.1
593
+ * Bugfix : Check for memory_limit setting, otherwise pass the test
594
+ * Bugfix : Thumbcode not insert for nggDisplayRandomImages and nggDisplayRecentImages
595
+
596
+ = V0.61 - 29.06.2007 =
597
+ * Added : Forgot the file jquery.nextgen.pack.js and jquery.nextgen.js
598
+
599
+ = V0.60 - 27.06.2007 =
600
+ * NEW : Select a image from the Upload Tab
601
+ * NEW : Tag [imagebrowser=id] for a Inline Gallery Browser
602
+ * NEW : Show gallery without Subpages
603
+ * NEW : Manage gallery : Function "Add a new page"
604
+ * NEW : Manage gallery : Show/Hide thumbnails
605
+ * Added : Slideshow option : Watermark / Background music
606
+ * Added : Check for memory limit
607
+ * Added : Show actual memory usage in overview
608
+ * Added : Include function check in widget
609
+ * Added : Latest Sidebar widget from KeViN
610
+ * Added : Check for capability during installation
611
+ * Changed : Remove P Tag around gallery tags ( THX to the work from John Godley )
612
+ * Bugfix : Delete picture, check for pid
613
+ * Bugfix : admin/settings.php line #172: typos corrected (this=these,maxium=maximum). (THX to Helene D.)
614
+ * Bugfix : admin/settings.php line #311: missing </td> added. (THX to Helene D.)
615
+
616
+ = V0.52 - 31.05.2007 =
617
+ * Changed : Create better thubmnails in square mode (THX to Kees de Bruin)
618
+ * Changed : Again , fixed ratio create better thumbnails (Also for widescreen photos)
619
+ * Removed : Option "Resize image before cropping" removed and included in Create square thumbnail
620
+ * Bugfix : Scan folder for new picture didn't set exclude = 0
621
+ * Bugfix : If no option is checked in thumbnails, resize failed (THK to Joern Kretzschmar)
622
+
623
+ = V0.51 - 28.05.2007 =
624
+ * Bugfix : Thumbnail permission not set correct
625
+ * Bugfix : Folder permission check wrong
626
+ * Bugfix : Remove echo in album (THX to Lazy)
627
+
628
+ = V0.50 - 28.05.2007 =
629
+ * NEW : Select multiple files for upload (THX to Diego A., http://www.fyneworks.com)
630
+ * NEW : Sidebar widget contain now Slideshow, recent images and random images
631
+ * Added : New Option for Imagerotator 3.8 (Slow zoom effect)
632
+ * Added : Option for CDATA wrapper (not working proper)
633
+ * Added : Option for Thickbox Loading Image
634
+ * Added : CSS file for dKret2 (THK to Joern)
635
+ * Added : Better file permission check
636
+ * Changed : Fixed ratio create better thumbnails in portrait mode
637
+ * Changed : All jQuery scripts are now in "No Conflict" mode
638
+ * Changed : Script loading now via wp_enqueue_script
639
+ * Changed : Add constant values for folder/file permission
640
+ * Changed : Use description in <A href title>
641
+ * Bugfix : Remove wrong DIV tag in slideshow
642
+ * Bugfix : Tag [Slideshow=id,width,height] didn't work proper
643
+ * Bugfix : Name conflict in Album script (serialize) (THX to Die-Andis)
644
+ * Bugfix : Changed check for CSS activation
645
+ * Bugfix : Changed check for safe-mode (Don't ask)
646
+
647
+ = V0.43 - 20.05.2007 =
648
+ * Changed : Rename Thumbnail class to avoid php name collision
649
+ * Bugfix : Missing translation flag in setup
650
+ * Bugfix : Changed check for safe-mode
651
+ * Bugfix : Changed check for Zip-File
652
+
653
+ = V0.42 - 17.05.2007 =
654
+ * Bugfix : Float function for singlepic not integrated, sorry !
655
+ * Bugfix : Remove clear:both in widget
656
+
657
+ = V0.41 - 17.05.2007 =
658
+ * NEW : Sidebar widget from KeViN
659
+ * Update : Better album management for more galleries
660
+ * Update : Thickbox v3 integrated
661
+ * Added : Float selection for singlepic
662
+ * Added : CSS class for widget
663
+ * Added : CSS file for K2 theme
664
+ * Added : German translation (THX to Lazy)
665
+ * Added : Better check for safe-mode
666
+ * Added : CSS Class for single-pic : class="ngg-singlepic"
667
+ * Added : Option to resize image before cropping it (Setting reset of prior versions needed! Setup -> Reset Settings)
668
+ * Changed : Image quality by default 85% (THX to ArizonaGroovejet)
669
+ * Bugfix : Update wrong file when select other style
670
+ * Bugfix : Fixed Permalink in album (THX to Helene D.)
671
+ * Bugfix : Scan folder in empty gallery
672
+ * Bugfix : Swfobjects only added with Thickbox effect
673
+ * Bugfix : Umlauts are now handled correctly
674
+
675
+ = V0.40 - 29.04.2007 =
676
+ * NEW : TinyMCE Button integration
677
+ * Removed : CSS Style : remove width/height in album
678
+
679
+ = V0.39 - 28.04.2007 =
680
+ * Added : Set ORDER BY for gallery
681
+ * Bugfix : check now for Exclude != 1
682
+ * Bugfix : DB Query in function wrong
683
+ * Bugfix : DB exlude = DEFAULT '0'
684
+ * Bugfix : Scan folder in empty gallery
685
+
686
+ = V0.38 - 28.04.2007 =
687
+ * Bugfix : One time more remove get_settings :-)
688
+ * Bugfix : $_GET in Manage gallery
689
+ * Bugfix : exclude option
690
+
691
+ = V0.37 - 28.04.2007 =
692
+ * Bugfix : $_GET in Manage gallery
693
+ * Bugfix : update DB installation routine
694
+
695
+ = V0.36 - 26.04.2007 =
696
+ * Bugfix : Stupid PHP beginner failure in album management
697
+
698
+ = V0.35 - 26.04.2007 =
699
+ * Rework : Folder name can be flexible
700
+ * New option : Fullsize pic for Singlepic mode
701
+ * New option : Select show order
702
+ * Added : Check for WP2.1
703
+ * Added : Check for permission for default folder
704
+ * Bugfix : Remove get_settings
705
+ * Bugfix : Correction for Safe-Mode ON
706
+ * Bugfix : Set Default '0' for table album.sortorder
707
+ * Bugfix : Update sort order
708
+
709
+ = V0.34 - 24.04.2007 =
710
+ * Added : Add fix ration setting
711
+ * Added : Add language file file
712
+ * Bugfix : Change link in Album to get_bloginfo('wpurl')
713
+ * Bugfix : Album CSS file not loaded
714
+
715
+ = V0.33 - 23.04.2007 =
716
+ * NEW : Overview Page
717
+ * NEW : Core function
718
+ * NEW : Slideshow
products/photocrati_nextgen/modules/ngglegacy/class.ngglegacy_installer.php CHANGED
@@ -4,103 +4,13 @@ class C_NggLegacy_Installer
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
  }
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
  }
products/photocrati_nextgen/modules/ngglegacy/lang/nggallery.pot CHANGED
@@ -1128,11 +1128,11 @@ msgid "NextGEN Gallery : Tables could not created, please check your database se
1128
  msgstr ""
1129
 
1130
  #: ../admin/install.php:170
1131
- msgid "[Show slideshow]"
1132
  msgstr ""
1133
 
1134
  #: ../admin/install.php:171
1135
- msgid "[Show thumbnails]"
1136
  msgstr ""
1137
 
1138
  #: ../admin/manage-galleries.php:69
1128
  msgstr ""
1129
 
1130
  #: ../admin/install.php:170
1131
+ msgid "[Show as slideshow]"
1132
  msgstr ""
1133
 
1134
  #: ../admin/install.php:171
1135
+ msgid "[Show picture list]"
1136
  msgstr ""
1137
 
1138
  #: ../admin/manage-galleries.php:69
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='" . 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";
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";
products/photocrati_nextgen/modules/ngglegacy/lib/meta.php CHANGED
@@ -129,8 +129,6 @@ class nggMeta{
129
  $meta['created_timestamp'] = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $this->exif_date2ts($exif['DateTimeDigitized']));
130
  else if (!empty($exif['DateTimeOriginal']))
131
  $meta['created_timestamp'] = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $this->exif_date2ts($exif['DateTimeOriginal']));
132
- else if (!empty($exif['FileDateTime']))
133
- $meta['created_timestamp'] = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $this->exif_date2ts($exif['FileDateTime']));
134
  if (!empty($exif['FocalLength']))
135
  $meta['focal_length'] = $this->exif_frac2dec( $exif['FocalLength'] ) . __(' mm','nggallery');
136
  if (!empty($exif['ISOSpeedRatings']))
@@ -500,37 +498,25 @@ class nggMeta{
500
  */
501
  function get_date_time() {
502
 
503
- $date = time();
504
 
505
- // Try XMP first
506
- if (isset($this->xmp_array['created_timestamp'])) {
507
- $date = @strtotime($this->xmp_array['created_timestamp']);
508
- }
509
 
510
- // Then EXIF
511
- else if (isset($this->exif_array['created_timestamp'])) {
512
- $date = @strtotime($this->exif_array['created_timestamp']);
513
- }
514
-
515
- // Then IPTC
516
- else if (isset($this->iptc_array['created_date'])) {
517
- $date = $this->iptc_array['created_date'];
518
- if (isset($this->iptc_array['created_time'])) {
519
- $date .= " {$this->iptc_array['created_time']}";
520
- }
521
- $date = @strtotime($date);
522
- }
523
-
524
- // If all else fails, use the file creation time
525
- else if ($this->image->imagePath) {
526
- $date = @filectime($this->image->imagePath);
527
- }
528
-
529
- // Failback
530
- if (!$date) $date = time();
531
 
532
  // Return the MySQL format
533
- $date_time = date( 'Y-m-d H:i:s', $date);
534
 
535
  return $date_time;
536
  }
129
  $meta['created_timestamp'] = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $this->exif_date2ts($exif['DateTimeDigitized']));
130
  else if (!empty($exif['DateTimeOriginal']))
131
  $meta['created_timestamp'] = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $this->exif_date2ts($exif['DateTimeOriginal']));
 
 
132
  if (!empty($exif['FocalLength']))
133
  $meta['focal_length'] = $this->exif_frac2dec( $exif['FocalLength'] ) . __(' mm','nggallery');
134
  if (!empty($exif['ISOSpeedRatings']))
498
  */
499
  function get_date_time() {
500
 
501
+ $date_time = time();
502
 
503
+ // get exif - data
504
+ if ( isset( $this->exif_data['EXIF']) ) {
 
 
505
 
506
+ // try to read the date / time from the exif
507
+ foreach (array('DateTimeDigitized', 'DateTimeOriginal', 'FileDateTime') as $key) {
508
+ if (isset($this->exif_data['EXIF'][$key])) {
509
+ $date_time = strtotime($this->exif_data['EXIF'][$key]);
510
+ break;
511
+ }
512
+ }
513
+ } else {
514
+ // if no other date available, get the filetime
515
+ $date_time = @filectime($this->image->imagePath );
516
+ }
 
 
 
 
 
 
 
 
 
 
517
 
518
  // Return the MySQL format
519
+ $date_time = date( 'Y-m-d H:i:s', $date_time );
520
 
521
  return $date_time;
522
  }
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
- static 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
- static 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
- static 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
+ 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
+ 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
+ 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="' . 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,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="' . 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);
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
 
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);
products/photocrati_nextgen/modules/ngglegacy/lib/shortcodes.php CHANGED
@@ -13,12 +13,8 @@ class NextGEN_shortcodes {
13
  // register the new shortcodes
14
  function 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
-
22
 
23
  // convert the old shortcode
24
  add_filter('the_content', array(&$this, 'convert_shortcode'));
13
  // register the new shortcodes
14
  function NextGEN_shortcodes() {
15
 
16
+ //Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
17
+ @ini_set('pcre.backtrack_limit', 500000);
 
 
 
 
18
 
19
  // convert the old shortcode
20
  add_filter('the_content', array(&$this, 'convert_shortcode'));
products/photocrati_nextgen/modules/ngglegacy/lib/sitemap.php CHANGED
@@ -44,11 +44,11 @@ class nggSitemaps {
44
  remove_all_shortcodes();
45
 
46
  // We cannot parse at this point a album, just galleries & single images
47
- C_NextGen_Shortcode_Manager::add( 'singlepic', array(&$this, 'add_images' ) );
48
- C_NextGen_Shortcode_Manager::add( 'thumb', array(&$this, 'add_images' ) );
49
- C_NextGen_Shortcode_Manager::add( 'nggallery', array(&$this, 'add_gallery') );
50
- C_NextGen_Shortcode_Manager::add( 'imagebrowser', array(&$this, 'add_gallery' ) );
51
- C_NextGen_Shortcode_Manager::add( 'slideshow', array(&$this, 'add_gallery' ) );
52
 
53
  // Search now for shortcodes
54
  do_shortcode( $p->post_content );
44
  remove_all_shortcodes();
45
 
46
  // We cannot parse at this point a album, just galleries & single images
47
+ add_shortcode( 'singlepic', array(&$this, 'add_images' ) );
48
+ add_shortcode( 'thumb', array(&$this, 'add_images' ) );
49
+ add_shortcode( 'nggallery', array(&$this, 'add_gallery') );
50
+ add_shortcode( 'imagebrowser', array(&$this, 'add_gallery' ) );
51
+ add_shortcode( 'slideshow', array(&$this, 'add_gallery' ) );
52
 
53
  // Search now for shortcodes
54
  do_shortcode( $p->post_content );
products/photocrati_nextgen/modules/ngglegacy/lib/xmlrpc.php ADDED
@@ -0,0 +1,882 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * XML-RPC protocol support for NextGEN Gallery
4
+ *
5
+ * @package NextGEN Gallery
6
+ * @author Alex Rabe
7
+ *
8
+ */
9
+ class nggXMLRPC{
10
+
11
+ /**
12
+ * Init the methods for the XMLRPC hook
13
+ *
14
+ */
15
+ function __construct() {
16
+
17
+ add_filter('xmlrpc_methods', array(&$this, 'add_methods') );
18
+ }
19
+
20
+ function add_methods($methods) {
21
+
22
+ $methods['ngg.installed'] = array(&$this, 'nggInstalled');
23
+ // Image methods
24
+ $methods['ngg.getImage'] = array(&$this, 'getImage');
25
+ $methods['ngg.getImages'] = array(&$this, 'getImages');
26
+ $methods['ngg.uploadImage'] = array(&$this, 'uploadImage');
27
+ $methods['ngg.editImage'] = array(&$this, 'editImage');
28
+ $methods['ngg.deleteImage'] = array(&$this, 'deleteImage');
29
+ // Gallery methods
30
+ $methods['ngg.getGallery'] = array(&$this, 'getGallery');
31
+ $methods['ngg.getGalleries'] = array(&$this, 'getGalleries');
32
+ $methods['ngg.newGallery'] = array(&$this, 'newGallery');
33
+ $methods['ngg.editGallery'] = array(&$this, 'editGallery');
34
+ $methods['ngg.deleteGallery'] = array(&$this, 'deleteGallery');
35
+ // Album methods
36
+ $methods['ngg.getAlbum'] = array(&$this, 'getAlbum');
37
+ $methods['ngg.getAlbums'] = array(&$this, 'getAlbums');
38
+ $methods['ngg.newAlbum'] = array(&$this, 'newAlbum');
39
+ $methods['ngg.editAlbum'] = array(&$this, 'editAlbum');
40
+ $methods['ngg.deleteAlbum'] = array(&$this, 'deleteAlbum');
41
+
42
+ return $methods;
43
+ }
44
+
45
+ /**
46
+ * Check if it's an csv string, then serialize it.
47
+ *
48
+ * @since 1.9.2
49
+ * @param string $data
50
+ * @return serialized string
51
+ */
52
+ function is_serialized( $data ) {
53
+
54
+ // if it isn't a string, we don't serialize it.
55
+ if ( ! is_string( $data ) )
56
+ return false;
57
+
58
+ if ($data && !strpos( $data , '{')) {
59
+ $items = explode(',', $data);
60
+ return serialize($items);
61
+ }
62
+
63
+ return $data;
64
+ }
65
+
66
+ /**
67
+ * Check if NextGEN Gallery is installed
68
+ *
69
+ * @since 1.4
70
+ *
71
+ * @param none
72
+ * @return string version number
73
+ */
74
+ function nggInstalled($args) {
75
+ global $ngg;
76
+ return array( 'version' => $ngg->version );
77
+ }
78
+
79
+ /**
80
+ * Log user in.
81
+ *
82
+ * @since 2.8
83
+ *
84
+ * @param string $username User's username.
85
+ * @param string $password User's password.
86
+ * @return mixed WP_User object if authentication passed, false otherwise
87
+ */
88
+ function login($username, $password) {
89
+ global $wp_version;
90
+
91
+ if (version_compare($wp_version,"3.5","<")) {
92
+ if ( !get_option( 'enable_xmlrpc' ) ) {
93
+ $this->error = new IXR_Error( 405, sprintf( __('XML-RPC services are disabled on this blog. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
94
+ return false;
95
+ }
96
+ }
97
+
98
+ $user = wp_authenticate($username, $password);
99
+
100
+ if (is_wp_error($user)) {
101
+ $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
102
+ return false;
103
+ }
104
+
105
+ set_current_user( $user->ID );
106
+ return $user;
107
+ }
108
+
109
+ /**
110
+ * Method "ngg.uploadImage"
111
+ * Uploads a image to a gallery
112
+ *
113
+ * @since 1.4
114
+ *
115
+ * @copyright addapted from WP Core
116
+ * @param array $args Method parameters.
117
+ * - int blog_id
118
+ * - string username
119
+ * - string password
120
+ * - struct data
121
+ * o string name
122
+ * o string type (optional)
123
+ * o base64 bits
124
+ * o bool overwrite (optional)
125
+ * o int gallery
126
+ * o int image_id (optional)
127
+ * @return array with image meta data
128
+ */
129
+ function uploadImage($args) {
130
+ global $wpdb;
131
+
132
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
133
+ require_once ( 'meta.php' ); // meta data import
134
+
135
+ $blog_ID = (int) $args[0];
136
+ $username = $wpdb->escape($args[1]);
137
+ $password = $wpdb->escape($args[2]);
138
+ $data = $args[3];
139
+
140
+ $name = $data['name'];
141
+ $type = $data['type'];
142
+ $bits = $data['bits'];
143
+
144
+ // gallery & image id
145
+ $gid = (int) $data['gallery']; // required field
146
+ $pid = (int) $data['image_id']; // optional but more foolproof of overwrite
147
+ $image = false; // container for the image object
148
+
149
+ logIO('O', '(NGG) Received '.strlen($bits).' bytes');
150
+
151
+ if ( !$user = $this->login($username, $password) )
152
+ return $this->error;
153
+
154
+ // Check if you have the correct capability for upload
155
+ if ( !current_user_can('NextGEN Upload images') ) {
156
+ logIO('O', '(NGG) User does not have upload_files capability');
157
+ $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
158
+ return $this->error;
159
+ }
160
+
161
+ // Look for the gallery , could we find it ?
162
+ if ( !$gallery = nggdb::find_gallery($gid) )
163
+ return new IXR_Error(404, __('Could not find gallery ' . $gid ));
164
+
165
+ // Now check if you have the correct capability for this gallery
166
+ if ( !nggAdmin::can_manage_this_gallery($gallery->author) ) {
167
+ logIO('O', '(NGG) User does not have upload_files capability');
168
+ $this->error = new IXR_Error(401, __('You are not allowed to upload files to this gallery.'));
169
+ return $this->error;
170
+ }
171
+
172
+ //clean filename and extract extension
173
+ $filepart = nggGallery::fileinfo( $name );
174
+ $name = $filepart['basename'];
175
+
176
+ // check for allowed extension and if it's an image file
177
+ $ext = array('jpg', 'png', 'gif');
178
+ if ( !in_array($filepart['extension'], $ext) ){
179
+ logIO('O', '(NGG) Not allowed file type');
180
+ $this->error = new IXR_Error(401, __('This is no valid image file.','nggallery'));
181
+ return $this->error;
182
+ }
183
+
184
+ // in the case you would overwrite the image, let's delete the old one first
185
+ if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) {
186
+
187
+ // search for the image based on the filename, if it's not already provided
188
+ if ($pid == 0)
189
+ $pid = $wpdb->get_col(" SELECT pid FROM {$wpdb->nggpictures} WHERE filename = '{$name}' AND galleryid = '{$gid}' ");
190
+
191
+ if ( !$image = nggdb::find_image( $pid ) )
192
+ return new IXR_Error(404, __('Could not find image id ' . $pid ));
193
+
194
+ // sync the gallery<->image parameter, otherwise we may copy it to the wrong gallery
195
+ $gallery = $image;
196
+
197
+ // delete now the image
198
+ if ( !@unlink( $image->imagePath ) ) {
199
+ $errorString = sprintf(__('Failed to delete image %1$s ','nggallery'), $image->imagePath);
200
+ logIO('O', '(NGG) ' . $errorString);
201
+ return new IXR_Error(500, $errorString);
202
+ }
203
+ }
204
+
205
+ // upload routine from wp core, load first the image to the upload folder, $upload['file'] contain the path
206
+ $upload = wp_upload_bits($name, $type, $bits);
207
+ if ( ! empty($upload['error']) ) {
208
+ $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
209
+ logIO('O', '(NGG) ' . $errorString);
210
+ return new IXR_Error(500, $errorString);
211
+ }
212
+
213
+ // this is the dir to the gallery
214
+ $path = WINABSPATH . $gallery->path;
215
+
216
+ // check if the filename already exist, if not add a counter index
217
+ $filename = wp_unique_filename( $path, $name );
218
+ $destination = $path . '/'. $filename;
219
+
220
+ // Move files to gallery folder
221
+ if ( !@rename($upload['file'], $destination ) ) {
222
+ $errorString = sprintf(__('Failed to move image %1$s to %2$s','nggallery'), '<strong>' . $upload['file'] . '</strong>', $destination);
223
+ logIO('O', '(NGG) ' . $errorString);
224
+ return new IXR_Error(500, $errorString);
225
+ }
226
+
227
+ //add to database if it's a new image
228
+ if(empty($data["overwrite"]) || ($data["overwrite"] == false)) {
229
+ $pid_array = nggAdmin::add_Images( $gallery->gid, array( $filename ) );
230
+ // the first element is our new image id
231
+ if (count($pid_array) == 1)
232
+ $pid = $pid_array[0];
233
+ }
234
+
235
+ //get all information about the image, in the case it's a new one
236
+ if (!$image)
237
+ $image = nggdb::find_image( $pid );
238
+
239
+ // create again the thumbnail, should return a '1'
240
+ nggAdmin::create_thumbnail( $image );
241
+
242
+ return apply_filters( 'ngg_upload_image', $image );
243
+
244
+ }
245
+
246
+ /**
247
+ * Method "ngg.deleteImage"
248
+ * Delete a Image from the database and gallery
249
+ *
250
+ * @since 1.7.3
251
+ *
252
+ * @param array $args Method parameters.
253
+ * - int blog_id
254
+ * - string username
255
+ * - string password
256
+ * - int image_id
257
+ * @return true
258
+ */
259
+ function deleteImage($args) {
260
+
261
+ global $nggdb, $ngg;
262
+
263
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
264
+
265
+ $this->escape($args);
266
+ $blog_ID = (int) $args[0];
267
+ $username = $args[1];
268
+ $password = $args[2];
269
+ $id = (int) $args[3];
270
+
271
+ if ( !$user = $this->login($username, $password) )
272
+ return $this->error;
273
+
274
+ if ( !$image = nggdb::find_image($id) )
275
+ return(new IXR_Error(404, __("Invalid image ID")));
276
+
277
+ if ( !current_user_can( 'NextGEN Manage gallery' ) && !nggAdmin::can_manage_this_gallery($image->author) )
278
+ return new IXR_Error( 401, __( 'Sorry, you must be able to edit this image' ) );
279
+
280
+ if ($ngg->options['deleteImg']) {
281
+ @unlink($image->imagePath);
282
+ @unlink($image->thumbPath);
283
+ @unlink($image->imagePath . "_backup" );
284
+ }
285
+
286
+ nggdb::delete_image ( $id );
287
+
288
+ return true;
289
+
290
+ }
291
+
292
+ /**
293
+ * Method "ngg.editImage"
294
+ * Edit a existing Image
295
+ *
296
+ * @since 1.7.3
297
+ *
298
+ * @param array $args Method parameters.
299
+ * - int blog_id
300
+ * - string username
301
+ * - string password
302
+ * - int Image ID
303
+ * - string alt/title text
304
+ * - string description
305
+ * - int exclude from gallery (0 or 1)
306
+ * @return true if success
307
+ */
308
+ function editImage($args) {
309
+
310
+ global $ngg;
311
+
312
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
313
+
314
+ $this->escape($args);
315
+ $blog_ID = (int) $args[0];
316
+ $username = $args[1];
317
+ $password = $args[2];
318
+ $id = (int) $args[3];
319
+ $alttext = $args[4];
320
+ $description= $args[5];
321
+ $exclude = (int) $args[6];
322
+
323
+ if ( !$user = $this->login($username, $password) )
324
+ return $this->error;
325
+
326
+ if ( !$image = nggdb::find_image($id) )
327
+ return(new IXR_Error(404, __( 'Invalid image ID' )));
328
+
329
+ if ( !current_user_can( 'NextGEN Manage gallery' ) && !nggAdmin::can_manage_this_gallery($image->author) )
330
+ return new IXR_Error( 401, __( 'Sorry, you must be able to edit this image' ) );
331
+
332
+ if ( !empty( $id ) )
333
+ $result = nggdb::update_image($id, false, false, $description, $alttext, $exclude);
334
+
335
+ if ( !$result )
336
+ return new IXR_Error(500, __('Sorry, could not update the image'));
337
+
338
+ return true;
339
+
340
+ }
341
+
342
+ /**
343
+ * Method "ngg.newGallery"
344
+ * Create a new gallery
345
+ *
346
+ * @since 1.4
347
+ *
348
+ * @param array $args Method parameters.
349
+ * - int blog_id
350
+ * - string username
351
+ * - string password
352
+ * - string new gallery name
353
+ * @return int with new gallery ID
354
+ */
355
+ function newGallery($args) {
356
+
357
+ global $ngg;
358
+
359
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
360
+
361
+ $this->escape($args);
362
+ $blog_ID = (int) $args[0];
363
+ $username = $args[1];
364
+ $password = $args[2];
365
+ $name = $args[3];
366
+ $id = false;
367
+
368
+ if ( !$user = $this->login($username, $password) )
369
+ return $this->error;
370
+
371
+ if( !current_user_can( 'NextGEN Manage gallery' ) )
372
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage galleries' ) );
373
+
374
+ if ( !empty( $name ) )
375
+ $id = nggAdmin::create_gallery($name, $ngg->options['gallerypath'], false);
376
+
377
+ if ( !$id )
378
+ return new IXR_Error(500, __('Sorry, could not create the gallery'));
379
+
380
+ return($id);
381
+
382
+ }
383
+
384
+ /**
385
+ * Method "ngg.editGallery"
386
+ * Edit a existing gallery
387
+ *
388
+ * @since 1.7.0
389
+ *
390
+ * @param array $args Method parameters.
391
+ * - int blog_id
392
+ * - string username
393
+ * - string password
394
+ * - int gallery ID
395
+ * - string gallery name
396
+ * - string title
397
+ * - string description
398
+ * - int ID of the preview picture
399
+ * @return true if success
400
+ */
401
+ function editGallery($args) {
402
+
403
+ global $ngg;
404
+
405
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
406
+
407
+ $this->escape($args);
408
+ $blog_ID = (int) $args[0];
409
+ $username = $args[1];
410
+ $password = $args[2];
411
+ $id = (int) $args[3];
412
+ $name = $args[4];
413
+ $title = $args[5];
414
+ $description= $args[6];
415
+ $previewpic = (int) $args[7];
416
+
417
+ if ( !$user = $this->login($username, $password) )
418
+ return $this->error;
419
+
420
+ if ( !$gallery = nggdb::find_gallery($id) )
421
+ return(new IXR_Error(404, __("Invalid gallery ID")));
422
+
423
+ if ( !current_user_can( 'NextGEN Manage gallery' ) && !nggAdmin::can_manage_this_gallery($gallery->author) )
424
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage this gallery' ) );
425
+
426
+ if ( !empty( $name ) )
427
+ $result = nggdb::update_gallery($id, $name, false, $title, $description, false, $previewpic);
428
+
429
+ if ( !$result )
430
+ return new IXR_Error(500, __('Sorry, could not update the gallery'));
431
+
432
+ return true;
433
+
434
+ }
435
+
436
+ /**
437
+ * Method "ngg.newAlbum"
438
+ * Create a new album
439
+ *
440
+ * @since 1.7.0
441
+ *
442
+ * @param array $args Method parameters.
443
+ * - int blog_id
444
+ * - string username
445
+ * - string password
446
+ * - string new album name
447
+ * - int id of preview image
448
+ * - string description
449
+ * - string serialized array of galleries or a comma-separated string of gallery IDs
450
+ * @return int with new album ID
451
+ */
452
+ function newAlbum($args) {
453
+
454
+ global $ngg;
455
+
456
+ $this->escape($args);
457
+ $blog_ID = (int) $args[0];
458
+ $username = $args[1];
459
+ $password = $args[2];
460
+ $name = $args[3];
461
+ $preview = (int) $args[4];
462
+ $description= $args[5];
463
+ $galleries = $this->is_serialized($args[6]);
464
+ $id = false;
465
+
466
+ if ( !$user = $this->login($username, $password) )
467
+ return $this->error;
468
+
469
+ if( !current_user_can( 'NextGEN Edit album' ) || !nggGallery::current_user_can( 'NextGEN Add/Delete album' ) )
470
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage albums' ) );
471
+
472
+ if ( !empty( $name ) )
473
+ $id = $result = nggdb::add_album( $name, $preview, $description, $galleries );
474
+
475
+ if ( !$id )
476
+ return new IXR_Error(500, __('Sorry, could not create the album'));
477
+
478
+ return($id);
479
+
480
+ }
481
+
482
+ /**
483
+ * Method "ngg.editAlbum"
484
+ * Edit a existing Album
485
+ *
486
+ * @since 1.7.0
487
+ *
488
+ * @param array $args Method parameters.
489
+ * - int blog_id
490
+ * - string username
491
+ * - string password
492
+ * - int album ID
493
+ * - string album name
494
+ * - int id of preview image
495
+ * - string description
496
+ * - string serialized array of galleries or a comma-separated string of gallery IDs
497
+ * @return true if success
498
+ */
499
+ function editAlbum($args) {
500
+
501
+ global $ngg;
502
+
503
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
504
+
505
+ $this->escape($args);
506
+ $blog_ID = (int) $args[0];
507
+ $username = $args[1];
508
+ $password = $args[2];
509
+ $id = (int) $args[3];
510
+ $name = $args[4];
511
+ $preview = (int) $args[5];
512
+ $description= $args[6];
513
+ $galleries = $this->is_serialized($args[7]);
514
+
515
+ if ( !$user = $this->login($username, $password) )
516
+ return $this->error;
517
+
518
+ if ( !$album = nggdb::find_album($id) )
519
+ return(new IXR_Error(404, __("Invalid album ID")));
520
+
521
+ if( !current_user_can( 'NextGEN Edit album' ) )
522
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage albums' ) );
523
+
524
+ if ( !empty( $name ) )
525
+ $result = nggdb::update_album($id, $name, $preview, $description, $galleries);
526
+
527
+ if ( !$result )
528
+ return new IXR_Error(500, __('Sorry, could not update the album'));
529
+
530
+ return true;
531
+
532
+ }
533
+
534
+ /**
535
+ * Method "ngg.deleteAlbum"
536
+ * Delete a album from the database
537
+ *
538
+ * @since 1.7.0
539
+ *
540
+ * @param array $args Method parameters.
541
+ * - int blog_id
542
+ * - string username
543
+ * - string password
544
+ * - int album id
545
+ * @return true
546
+ */
547
+ function deleteAlbum($args) {
548
+
549
+ global $nggdb;
550
+
551
+ $this->escape($args);
552
+ $blog_ID = (int) $args[0];
553
+ $username = $args[1];
554
+ $password = $args[2];
555
+ $id = (int) $args[3];
556
+
557
+ if ( !$user = $this->login($username, $password) )
558
+ return $this->error;
559
+
560
+ if ( !$album = nggdb::find_album($id) )
561
+ return(new IXR_Error(404, __("Invalid album ID")));
562
+
563
+ if( !current_user_can( 'NextGEN Edit album' ) && !nggGallery::current_user_can( 'NextGEN Add/Delete album' ) )
564
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage albums' ) );
565
+
566
+ $nggdb->delete_album($id);
567
+
568
+ return true;
569
+
570
+ }
571
+
572
+ /**
573
+ * Method "ngg.deleteGallery"
574
+ * Delete a gallery from the database, including all images
575
+ *
576
+ * @since 1.7.0
577
+ *
578
+ * @param array $args Method parameters.
579
+ * - int blog_id
580
+ * - string username
581
+ * - string password
582
+ * - int gallery_id
583
+ * @return true
584
+ */
585
+ function deleteGallery($args) {
586
+
587
+ global $nggdb;
588
+
589
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
590
+
591
+ $this->escape($args);
592
+ $blog_ID = (int) $args[0];
593
+ $username = $args[1];
594
+ $password = $args[2];
595
+ $id = (int) $args[3];
596
+
597
+ if ( !$user = $this->login($username, $password) )
598
+ return $this->error;
599
+
600
+ if ( !$gallery = nggdb::find_gallery($id) )
601
+ return(new IXR_Error(404, __("Invalid gallery ID")));
602
+
603
+ if ( !current_user_can( 'NextGEN Manage gallery' ) && !nggAdmin::can_manage_this_gallery($gallery->author) )
604
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage galleries' ) );
605
+
606
+ $nggdb->delete_gallery($id);
607
+
608
+ return true;
609
+
610
+ }
611
+
612
+ /**
613
+ * Method "ngg.getAlbums"
614
+ * Return the list of all albums
615
+ *
616
+ * @since 1.7.0
617
+ *
618
+ * @param array $args Method parameters.
619
+ * - int blog_id
620
+ * - string username
621
+ * - string password
622
+ * @return array with all galleries
623
+ */
624
+ function getAlbums($args) {
625
+
626
+ global $nggdb;
627
+
628
+ $this->escape($args);
629
+ $blog_ID = (int) $args[0];
630
+ $username = $args[1];
631
+ $password = $args[2];
632
+
633
+ if ( !$user = $this->login($username, $password) )
634
+ return $this->error;
635
+
636
+ if( !current_user_can( 'NextGEN Edit album' ) )
637
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage albums' ) );
638
+
639
+ $album_list = $nggdb->find_all_album('id', 'ASC', 0, 0 );
640
+
641
+ return($album_list);
642
+
643
+ }
644
+
645
+ /**
646
+ * Method "ngg.getAlbum"
647
+ * Return the specified album
648
+ *
649
+ * @since 1.9.2
650
+ *
651
+ * @param array $args Method parameters.
652
+ * - int blog_id
653
+ * - string username
654
+ * - string password
655
+ * - int album_id
656
+ * @return array with the album object
657
+ */
658
+ function getAlbum($args) {
659
+
660
+ global $nggdb;
661
+
662
+ $this->escape($args);
663
+ $blog_ID = (int) $args[0];
664
+ $username = $args[1];
665
+ $password = $args[2];
666
+ $id = (int) $args[3];
667
+
668
+ if ( !$user = $this->login($username, $password) )
669
+ return $this->error;
670
+
671
+ if( !current_user_can( 'NextGEN Edit album' ) )
672
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage albums' ) );
673
+
674
+ $album = $nggdb->find_album( $id );
675
+
676
+ return($album);
677
+
678
+ }
679
+
680
+ /**
681
+ * Method "ngg.getGalleries"
682
+ * Return the list of all galleries
683
+ *
684
+ * @since 1.4
685
+ *
686
+ * @param array $args Method parameters.
687
+ * - int blog_id
688
+ * - string username
689
+ * - string password
690
+ * @return array with all galleries
691
+ */
692
+ function getGalleries($args) {
693
+
694
+ global $nggdb;
695
+
696
+ $this->escape($args);
697
+ $blog_ID = (int) $args[0];
698
+ $username = $args[1];
699
+ $password = $args[2];
700
+
701
+ if ( !$user = $this->login($username, $password) )
702
+ return $this->error;
703
+
704
+ if( !current_user_can( 'NextGEN Manage gallery' ) )
705
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage galleries' ) );
706
+
707
+ $gallery_list = $nggdb->find_all_galleries('gid', 'asc', true, 0, 0, false);
708
+
709
+ return($gallery_list);
710
+
711
+ }
712
+
713
+ /**
714
+ * Method "ngg.getGallery"
715
+ * Return the specified gallery
716
+ *
717
+ * @since 1.9.2
718
+ *
719
+ * @param array $args Method parameters.
720
+ * - int blog_id
721
+ * - string username
722
+ * - string password
723
+ * - int gallery_id
724
+ * @return array with the gallery object
725
+ */
726
+ function getGallery($args) {
727
+
728
+ global $nggdb;
729
+
730
+ $this->escape($args);
731
+ $blog_ID = (int) $args[0];
732
+ $username = $args[1];
733
+ $password = $args[2];
734
+ $gid = (int) $args[3];
735
+
736
+ if ( !$user = $this->login($username, $password) )
737
+ return $this->error;
738
+
739
+ if( !current_user_can( 'NextGEN Manage gallery' ) )
740
+ return new IXR_Error( 401, __( 'Sorry, you must be able to manage galleries' ) );
741
+
742
+ $gallery = $nggdb->find_gallery($gid);
743
+
744
+ return($gallery);
745
+
746
+ }
747
+
748
+ /**
749
+ * Method "ngg.getImages"
750
+ * Return the list of all images inside a gallery
751
+ *
752
+ * @since 1.4
753
+ *
754
+ * @param array $args Method parameters.
755
+ * - int blog_id
756
+ * - string username
757
+ * - string password
758
+ * - int gallery_id
759
+ * @return array with all images
760
+ */
761
+ function getImages($args) {
762
+
763
+ global $nggdb;
764
+
765
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
766
+
767
+ $this->escape($args);
768
+ $blog_ID = (int) $args[0];
769
+ $username = $args[1];
770
+ $password = $args[2];
771
+ $gid = (int) $args[3];
772
+
773
+ if ( !$user = $this->login($username, $password) )
774
+ return $this->error;
775
+
776
+ // Look for the gallery , could we find it ?
777
+ if ( !$gallery = nggdb::find_gallery( $gid ) )
778
+ return new IXR_Error(404, __('Could not find gallery ' . $gid ));
779
+
780
+ // Now check if you have the correct capability for this gallery
781
+ if ( !nggAdmin::can_manage_this_gallery($gallery->author) ) {
782
+ logIO('O', '(NGG) User does not have upload_files capability');
783
+ $this->error = new IXR_Error(401, __('You are not allowed to upload files to this gallery.'));
784
+ return $this->error;
785
+ }
786
+
787
+ // get picture values
788
+ $picture_list = $nggdb->get_gallery( $gid, 'pid', 'ASC', false );
789
+
790
+ return($picture_list);
791
+
792
+ }
793
+
794
+ /**
795
+ * Method "ngg.getImage"
796
+ * Return a single image inside a gallery
797
+ *
798
+ * @since 1.9.2
799
+ *
800
+ * @param array $args Method parameters.
801
+ * - int blog_id
802
+ * - string username
803
+ * - string password
804
+ * - int picture_id
805
+ * @return array with image properties
806
+ */
807
+ function getImage($args) {
808
+
809
+ global $nggdb;
810
+
811
+ require_once ( dirname ( dirname( __FILE__ ) ). '/admin/functions.php' ); // admin functions
812
+
813
+ $this->escape($args);
814
+ $blog_ID = (int) $args[0];
815
+ $username = $args[1];
816
+ $password = $args[2];
817
+ $pid = (int) $args[3];
818
+
819
+ if ( !$user = $this->login($username, $password) )
820
+ return $this->error;
821
+
822
+ // get picture
823
+ $image = $nggdb->find_image( $pid );
824
+
825
+ if ($image) {
826
+ $gid = $image->galleryid;
827
+
828
+ // Look for the gallery , could we find it ?
829
+ if ( !$gallery = nggdb::find_gallery( $gid ) )
830
+ return new IXR_Error(404, __('Could not find gallery ' . $gid ));
831
+
832
+ // Now check if you have the correct capability for this gallery
833
+ if ( !nggAdmin::can_manage_this_gallery($gallery->author) ) {
834
+ logIO('O', '(NGG) User does not have upload_files capability');
835
+ $this->error = new IXR_Error(401, __('You are not allowed to upload files to this gallery.'));
836
+ return $this->error;
837
+ }
838
+ }
839
+
840
+ return($image);
841
+
842
+ }
843
+
844
+ /**
845
+ * Sanitize string or array of strings for database.
846
+ *
847
+ * @since 1.7.0
848
+ * @author WordPress Core
849
+ * @filesource inludes/class-wp-xmlrpc-server.php
850
+ *
851
+ * @param string|array $array Sanitize single string or array of strings.
852
+ * @return string|array Type matches $array and sanitized for the database.
853
+ */
854
+ function escape(&$array) {
855
+ global $wpdb;
856
+
857
+ if (!is_array($array)) {
858
+ return($wpdb->escape($array));
859
+ } else {
860
+ foreach ( (array) $array as $k => $v ) {
861
+ if ( is_array($v) ) {
862
+ $this->escape($array[$k]);
863
+ } else if ( is_object($v) ) {
864
+ //skip
865
+ } else {
866
+ $array[$k] = $wpdb->escape($v);
867
+ }
868
+ }
869
+ }
870
+ }
871
+
872
+ /**
873
+ * PHP5 style destructor and will run when database object is destroyed.
874
+ *
875
+ * @return bool Always true
876
+ */
877
+ function __destruct() {
878
+
879
+ }
880
+ }
881
+
882
+ $nggxmlrpc = new nggXMLRPC();
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.3',
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.1',
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.1';
15
  var $donators = 'http://www.nextgen-gallery.com/donators.php';
16
  var $options = '';
17
  var $manage_page;
@@ -36,6 +36,13 @@ if (!class_exists('nggLoader')) {
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
 
@@ -112,8 +119,6 @@ if (!class_exists('nggLoader')) {
112
  case 'image':
113
  require_once (dirname (__FILE__) . '/nggshow.php');
114
  break;
115
- default:
116
- return;
117
  }
118
  C_NextGEN_Bootstrap::shutdown();
119
  }
@@ -257,6 +262,10 @@ if (!class_exists('nggLoader')) {
257
  require_once (dirname (__FILE__) . '/nggfunctions.php'); // n.a.
258
  require_once (dirname (__FILE__) . '/lib/shortcodes.php'); // 92.664
259
 
 
 
 
 
260
  // We didn't need all stuff during a AJAX operation
261
  if ( defined('DOING_AJAX') )
262
  require_once (dirname (__FILE__) . '/admin/ajax.php');
@@ -307,12 +316,99 @@ if (!class_exists('nggLoader')) {
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
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
  $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
 
119
  case 'image':
120
  require_once (dirname (__FILE__) . '/nggshow.php');
121
  break;
 
 
122
  }
123
  C_NextGEN_Bootstrap::shutdown();
124
  }
262
  require_once (dirname (__FILE__) . '/nggfunctions.php'); // n.a.
263
  require_once (dirname (__FILE__) . '/lib/shortcodes.php'); // 92.664
264
 
265
+ //Just needed if you access remote to WordPress
266
+ if ( defined('XMLRPC_REQUEST') )
267
+ require_once (dirname (__FILE__) . '/lib/xmlrpc.php');
268
+
269
  // We didn't need all stuff during a AJAX operation
270
  if ( defined('DOING_AJAX') )
271
  require_once (dirname (__FILE__) . '/admin/ajax.php');
316
  if (is_plugin_active_for_network( $this->plugin_name )) {
317
  $current_blog = $wpdb->blogid;
318
  switch_to_blog($blog_id);
319
+ nggallery_install();
 
320
  switch_to_blog($current_blog);
321
  }
322
  }
323
 
324
+ /**
325
+ * Removes all transients created by NextGEN. Called during activation
326
+ * and deactivation routines
327
+ */
328
+ static function remove_transients()
329
+ {
330
+ global $wpdb, $_wp_using_ext_object_cache;
331
+
332
+ // Fetch all transients
333
+ $query = "
334
+ SELECT option_name FROM {$wpdb->options}
335
+ WHERE option_name LIKE '%ngg_request%'
336
+ ";
337
+ $transient_names = $wpdb->get_col($query);;
338
+
339
+ // Delete all transients in the database
340
+ $query = "
341
+ DELETE FROM {$wpdb->options}
342
+ WHERE option_name LIKE '%ngg_request%'
343
+ ";
344
+ $wpdb->query($query);
345
+
346
+ // If using an external caching mechanism, delete the cached items
347
+ if ($_wp_using_ext_object_cache) {
348
+ foreach ($transient_names as $transient) {
349
+ wp_cache_delete($transient, 'transient');
350
+ wp_cache_delete(substr($transient, 11), 'transient');
351
+ }
352
+ }
353
+ }
354
+
355
+ function activate() {
356
+ global $wpdb;
357
+ //Starting from version 1.8.0 it's works only with PHP5.2
358
+ if (version_compare(PHP_VERSION, '5.2.0', '<')) {
359
+ deactivate_plugins($this->plugin_name); // Deactivate ourself
360
+ wp_die("Sorry, but you can't run this plugin, it requires PHP 5.2 or higher.");
361
+ return;
362
+ }
363
+
364
+ // Clean up transients
365
+ self::remove_transients();
366
+
367
+ include_once (dirname (__FILE__) . '/admin/install.php');
368
+
369
+ if (is_multisite()) {
370
+ $network=isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:"";
371
+ $activate=isset($_GET['action'])?$_GET['action']:"";
372
+ $isNetwork=($network=='/wp-admin/network/plugins.php')?true:false;
373
+ $isActivation=($activate=='deactivate')?false:true;
374
+
375
+ if ($isNetwork and $isActivation){
376
+ $old_blog = $wpdb->blogid;
377
+ $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs", NULL));
378
+ foreach ($blogids as $blog_id) {
379
+ switch_to_blog($blog_id);
380
+ nggallery_install();
381
+ }
382
+ switch_to_blog($old_blog);
383
+ return;
384
+ }
385
+ }
386
+
387
+ // check for tables
388
+ nggallery_install();
389
+ // remove the update message
390
+ delete_option( 'ngg_update_exists' );
391
+
392
+ }
393
+
394
+ function deactivate() {
395
+
396
+ // remove & reset the init check option
397
+ delete_option( 'ngg_init_check' );
398
+ delete_option( 'ngg_update_exists' );
399
+
400
+ // Clean up transients
401
+ self::remove_transients();
402
+ }
403
+
404
+ function uninstall() {
405
+ // Clean up transients
406
+ self::remove_transients();
407
+
408
+ include_once (dirname (__FILE__) . '/admin/install.php');
409
+ nggallery_uninstall();
410
+ }
411
+
412
  function disable_upgrade($option){
413
 
414
  // PHP5.2 is required for NGG V1.4.0
products/photocrati_nextgen/modules/ngglegacy/view/album-compact.php CHANGED
@@ -22,24 +22,12 @@ 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 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; ?>
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; ?>
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 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,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 $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
 
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 nextgen_esc_url($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 nextgen_esc_url($gallery->piclens_link) ?>">
32
  <?php _e('[View with PicLens]','nggallery'); ?>
33
  </a>
34
  </div>
@@ -40,16 +40,9 @@ 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 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>
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
  <?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
 
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>
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 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,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 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,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 nextgen_esc_url($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 $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
  <?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
  <!-- 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
 
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 nextgen_esc_url($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 nextgen_esc_url($gallery->piclens_link) ?>">
32
  <?php _e('[View with PicLens]','nggallery'); ?>
33
  </a>
34
  </div>
@@ -40,16 +40,9 @@ 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 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>
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
  <?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
 
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>
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 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,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 $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
 
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 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>
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>
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 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,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 $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
 
35
  </div>
36
 
37
+ <?php endif; ?>
products/photocrati_nextgen/modules/ngglegacy/view/singlepic.php CHANGED
@@ -18,19 +18,9 @@ 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 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; ?>
18
  **/
19
  ?>
20
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($image)) : ?>
21
+
22
+ <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> >
23
+ <img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" />
 
 
 
 
 
 
 
 
 
 
24
  </a>
25
  <?php if (!empty ($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?>
26
+ <?php endif; ?>
products/photocrati_nextgen/modules/router/class.router.php CHANGED
@@ -150,11 +150,7 @@ class Mixin_Router extends Mixin
150
  */
151
  function is_https()
152
  {
153
- return (
154
- (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ||
155
- (!empty($_SERVER['HTTP_USESSL']) && strtolower($_SERVER['HTTP_USESSL']) !== 'off') ||
156
- (!empty($_SERVER['REDIRECT_HTTPS']) && strtolower($_SERVER['REDIRECT_HTTPS']) !== 'off') ||
157
- $_SERVER['SERVER_PORT'] == 443);
158
  }
159
 
160
 
150
  */
151
  function is_https()
152
  {
153
+ return isset($_SERVER['HTTPS']);
 
 
 
 
154
  }
155
 
156
 
products/photocrati_nextgen/modules/router/class.router_installer.php CHANGED
@@ -4,9 +4,9 @@ class C_Router_Installer
4
  {
5
  function install()
6
  {
7
- $settings = C_NextGen_Settings::get_instance();
8
  $settings->set_default_value('router_param_separator', '--');
9
  $settings->set_default_value('router_param_prefix', '');
10
- $settings->set_default_value('router_param_slug', 'nggallery');
11
  }
12
  }
4
  {
5
  function install()
6
  {
7
+ $settings = C_NextGen_Global_Settings::get_instance();
8
  $settings->set_default_value('router_param_separator', '--');
9
  $settings->set_default_value('router_param_prefix', '');
10
+ $settings->set_default_value('router_param_slug', 'params');
11
  }
12
  }
products/photocrati_nextgen/modules/router/class.routing_app.php CHANGED
@@ -50,11 +50,11 @@ class Mixin_Routing_App extends Mixin
50
  );
51
 
52
  // We treat wildcards much differently then normal rewrites
53
- if (preg_match("/\\{[\\.\\\\*]/", $src)) {
54
  $pattern = str_replace('{*}', '(.*?)', $src);
55
  $pattern = str_replace('{.*}', '(.*?)', $pattern);
56
- $pattern = str_replace('{\\w}', '([\\w-_]*)', $pattern);
57
- $pattern = str_replace('{\\d}', '(\\d*)', $pattern);
58
  $src = '#'.(strpos($src, '/') === 0 ? '^':'').$pattern.'/?$#';
59
  $definition['wildcards'] = TRUE;
60
  }
@@ -168,7 +168,6 @@ class Mixin_Routing_App extends Mixin
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,7 +178,7 @@ class Mixin_Routing_App extends Mixin
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,8 +189,9 @@ class Mixin_Routing_App extends Mixin
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,10 +204,7 @@ class Mixin_Routing_App extends Mixin
204
  }
205
 
206
  // Stop processing rewrite patterns?
207
- if ($details['stop']) {
208
- $stop_processing = TRUE;
209
-
210
- }
211
  }
212
  }
213
 
@@ -236,8 +233,6 @@ class Mixin_Routing_App extends Mixin
236
 
237
  }
238
  }
239
-
240
- if ($stop_processing) break;
241
  }
242
 
243
  // Cache all known data about the application request
@@ -450,7 +445,7 @@ class Mixin_Routing_App extends Mixin
450
  $route_regex = '#' . $route_regex . '/?$#i';
451
 
452
  // convert placeholders to regex as well
453
- return preg_replace('/~([^~]+)~/i', ($param_slug ? '('.preg_quote($param_slug,'#').'\K)?' : '').'(?P<\1>[^/]+)/?', $route_regex);
454
  }
455
 
456
  /**
@@ -524,7 +519,8 @@ class Mixin_Routing_App extends Mixin
524
  if (!isset($parts['path'])) $parts['path'] = '';
525
  $parts['path'] = $this->object->join_paths(
526
  $parts['path'],
527
- $param_slug && strpos($parts['path'], $param_slug) === FALSE ? $param_slug : '',
 
528
  $this->object->create_parameter_segment($key, $value, $id, $use_prefix)
529
  );
530
  $retval = $this->object->construct_url_from_parts($parts);
@@ -569,7 +565,7 @@ class Mixin_Routing_App extends Mixin
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,7 +614,7 @@ class Mixin_Routing_App extends Mixin
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,7 +698,7 @@ class Mixin_Routing_App extends Mixin
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,16 +797,16 @@ class C_Routing_App extends C_Component
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();
814
  $object = new stdClass();
815
  $object->router_param_separator = $settings->router_param_separator;
816
  $object->router_param_slug = $settings->router_param_slug;
50
  );
51
 
52
  // We treat wildcards much differently then normal rewrites
53
+ if (preg_match("/\{[\.\\\*]/", $src)) {
54
  $pattern = str_replace('{*}', '(.*?)', $src);
55
  $pattern = str_replace('{.*}', '(.*?)', $pattern);
56
+ $pattern = str_replace('{\w}', '([\w-_]*)', $pattern);
57
+ $pattern = str_replace('{\d}', '(\d*)', $pattern);
58
  $src = '#'.(strpos($src, '/') === 0 ? '^':'').$pattern.'/?$#';
59
  $definition['wildcards'] = TRUE;
60
  }
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
 
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
  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
  }
205
 
206
  // Stop processing rewrite patterns?
207
+ if ($details['stop']) break;
 
 
 
208
  }
209
  }
210
 
233
 
234
  }
235
  }
 
 
236
  }
237
 
238
  // Cache all known data about the application request
445
  $route_regex = '#' . $route_regex . '/?$#i';
446
 
447
  // convert placeholders to regex as well
448
+ return preg_replace('/~([^~]+)~/i', ($param_slug ? '('.preg_quote($param_slug,'#').'\K)?' : '').'(?<\1>[^/]+)/?', $route_regex);
449
  }
450
 
451
  /**
519
  if (!isset($parts['path'])) $parts['path'] = '';
520
  $parts['path'] = $this->object->join_paths(
521
  $parts['path'],
522
+ $param_slug && strpos($retval, $param_slug) === FALSE ?
523
+ $param_slug : '',
524
  $this->object->create_parameter_segment($key, $value, $id, $use_prefix)
525
  );
526
  $retval = $this->object->construct_url_from_parts($parts);
565
  $param_slug = $settings->router_param_slug ? preg_quote($settings->router_param_slug, '#') : FALSE;
566
 
567
  // Is the parameter already part of the request? If so, modify that
568
+ // parmaeter
569
  if (($segment = $this->object->get_parameter_segment($key, $id, $url))) {
570
  extract($segment);
571
 
614
  {
615
  $settings = $this->object->_settings;
616
  $param_slug = $settings->router_param_slug;
617
+
618
  $uri = $this->object->get_app_request_uri();
619
  $parts = array($uri);
620
  if ($param_slug && strpos($uri, $param_slug) === FALSE) $parts[] = $param_slug;
698
  return array(
699
  'querystring' => $this->object->get_formatted_querystring(),
700
  'request_uri' => $this->object->get_app_request_uri(),
701
+ 'postdata' => $this->object->get_postdata()
702
  );
703
  }
704
 
797
  $this->add_mixin('Mixin_Routing_App');
798
  $this->implement('I_Routing_App');
799
  }
800
+
801
  function initialize()
802
  {
803
  parent::initialize();
804
  $this->_settings = $this->object->get_routing_settings();
805
  }
806
+
807
  function get_routing_settings()
808
  {
809
+ $settings = C_NextGen_Global_Settings::get_instance();
810
  $object = new stdClass();
811
  $object->router_param_separator = $settings->router_param_separator;
812
  $object->router_param_slug = $settings->router_param_slug;
products/photocrati_nextgen/modules/router/mixin.url_manipulation.php CHANGED
@@ -121,16 +121,9 @@ class Mixin_Url_Manipulation extends Mixin
121
  */
122
  function construct_url_from_parts($parts)
123
  {
124
- // let relative paths be relative, and full paths full
125
- $prefix = '';
126
- if (!empty($parts['scheme']) && !empty($parts['host'])) {
127
- $prefix = $parts['scheme'] . '://' . $parts['host'];
128
- if (!empty($parts['port']))
129
- $prefix .= ':' . $parts['port'];
130
- }
131
-
132
  $retval = $this->object->join_paths(
133
- $prefix,
 
134
  isset($parts['path']) ? $parts['path'] : ''
135
  );
136
  if (isset($parts['query']) && $parts['query']) $retval .= "?{$parts['query']}";
@@ -151,7 +144,7 @@ class Mixin_Url_Manipulation extends Mixin
151
  function strip_param_segments($request_uri, $remove_slug=TRUE)
152
  {
153
  $retval = $request_uri ? $request_uri : '/';
154
- $settings = C_NextGen_Settings::get_instance();
155
  $sep = preg_quote($settings->router_param_separator, '#');
156
  $param_regex = "#((?P<id>\w+){$sep})?(?<key>\w+){$sep}(?P<value>.+)/?$#";
157
  $slug = $settings->router_param_slug && $remove_slug ? '/' . preg_quote($settings->router_param_slug,'#') : '';
121
  */
122
  function construct_url_from_parts($parts)
123
  {
 
 
 
 
 
 
 
 
124
  $retval = $this->object->join_paths(
125
+ isset($parts['scheme']) && $parts['host'] ?
126
+ "{$parts['scheme']}://{$parts['host']}" : '',
127
  isset($parts['path']) ? $parts['path'] : ''
128
  );
129
  if (isset($parts['query']) && $parts['query']) $retval .= "?{$parts['query']}";
144
  function strip_param_segments($request_uri, $remove_slug=TRUE)
145
  {
146
  $retval = $request_uri ? $request_uri : '/';
147
+ $settings = C_NextGen_Global_Settings::get_instance();
148
  $sep = preg_quote($settings->router_param_separator, '#');
149
  $param_regex = "#((?P<id>\w+){$sep})?(?<key>\w+){$sep}(?P<value>.+)/?$#";
150
  $slug = $settings->router_param_slug && $remove_slug ? '/' . preg_quote($settings->router_param_slug,'#') : '';
products/photocrati_nextgen/modules/router/module.router.php CHANGED
@@ -13,7 +13,7 @@ class M_Router extends C_Base_Module
13
  'photocrati-router',
14
  'Router for Pope',
15
  'Provides routing capabilities for Pope modules',
16
- '0.4',
17
  'http://www.photocrati.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
13
  'photocrati-router',
14
  'Router for Pope',
15
  'Provides routing capabilities for Pope modules',
16
+ '0.3',
17
  'http://www.photocrati.com',
18
  'Photocrati Media',
19
  'http://www.photocrati.com'
products/photocrati_nextgen/modules/security/class.wordpress_security_actor.php CHANGED
@@ -105,19 +105,6 @@ class Mixin_WordPress_Security_Action_Converter extends Mixin
105
  {
106
  $capability_name = 'NextGEN Upload images';
107
 
108
- break;
109
- }
110
- case 'nextgen_edit_album_settings':
111
- {
112
- $capability_name = 'NextGEN Edit album settings';
113
-
114
- break;
115
- }
116
-
117
- case 'nextgen_edit_album':
118
- {
119
- $capability_name = 'NextGEN Edit album';
120
-
121
  break;
122
  }
123
  }
105
  {
106
  $capability_name = 'NextGEN Upload images';
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  break;
109
  }
110
  }
products/photocrati_nextgen/modules/security/class.wordpress_security_manager.php CHANGED
@@ -59,19 +59,6 @@ class Mixin_WordPress_Security_Manager extends Mixin
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
 
59
 
60
  function get_current_actor()
61
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  return $this->object->get_actor(get_current_user_id(), 'user');
63
  }
64
 
products/photocrati_nextgen/modules/security/module.security.php CHANGED
@@ -14,15 +14,11 @@ class M_Security extends C_Base_Module
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()
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()
products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php DELETED
@@ -1,117 +0,0 @@
1
- <?php
2
-
3
- /***
4
- {
5
- Module: photocrati-third_party_compat,
6
- Depends: {}
7
- }
8
- ***/
9
- class M_Third_Party_Compat extends C_Base_Module
10
- {
11
- function define()
12
- {
13
- parent::define(
14
- 'photocrati-third_party_compat',
15
- 'Third Party Compatibility',
16
- "Adds Third party compatibility hacks, adjustments, and modifications",
17
- '0.1',
18
- 'http://www.nextgen-gallery.com',
19
- 'Photocrati Media',
20
- 'http://www.photocrati.com'
21
- );
22
- }
23
-
24
- function _register_adapters()
25
- {
26
- }
27
-
28
- function _register_hooks()
29
- {
30
- add_action('init', array(&$this, 'colorbox'), PHP_INT_MAX);
31
- add_action('wp', array(&$this, 'bjlazyload'), PHP_INT_MAX);
32
- }
33
-
34
- /**
35
- * Colorbox fires a filter (pri=100) to add class attributes to images via a the_content filter. We fire our
36
- * shortcodes at PHP_INT_MAX-1 to avoid encoding issues with some themes. Here we move the Colorbox filters
37
- * priority to PHP_INT_MAX so that they run after our shortcode text has been replaced with rendered galleries.
38
- */
39
- function colorbox()
40
- {
41
- if (!class_exists('JQueryColorboxFrontend'))
42
- return;
43
-
44
- global $wp_filter;
45
-
46
- if (empty($wp_filter['the_content'][100]))
47
- return;
48
-
49
- foreach ($wp_filter['the_content'][100] as $id => $filter) {
50
- if (!strpos($id, 'addColorboxGroupIdToImages'))
51
- continue;
52
-
53
- $object = $filter['function'][0];
54
-
55
- if (get_class($object) != 'JQueryColorboxFrontend')
56
- continue;
57
-
58
- remove_filter('the_content', array($object, 'addColorboxGroupIdToImages'), 100);
59
- remove_filter('the_excerpt', array($object, 'addColorboxGroupIdToImages'), 100);
60
- add_filter('the_content', array($object, 'addColorboxGroupIdToImages'), PHP_INT_MAX);
61
- add_filter('the_excerpt', array($object, 'addColorboxGroupIdToImages'), PHP_INT_MAX);
62
- break;
63
- }
64
- }
65
-
66
- /**
67
- * For the same reasons as Colorbox we move BJ-Lazy-load's filter() method to a later priority so it can access
68
- * our rendered galleries.
69
- */
70
- function bjlazyload()
71
- {
72
- if (!class_exists('BJLL'))
73
- return;
74
-
75
- global $wp_filter;
76
-
77
- if (empty($wp_filter['the_content'][200]))
78
- return;
79
-
80
- foreach ($wp_filter['the_content'][200] as $id => $filter) {
81
- if (!strpos($id, 'filter'))
82
- continue;
83
-
84
- $object = $filter['function'][0];
85
-
86
- if (get_class($object) != 'BJLL')
87
- continue;
88
-
89
- remove_filter('the_content', array($object, 'filter'), 200);
90
- add_filter('the_content', array($object, 'filter'), PHP_INT_MAX);
91
- break;
92
- }
93
-
94
- add_filter('the_content', array($this, 'bjlazyload_filter'), PHP_INT_MAX-1);
95
- }
96
-
97
- /**
98
- * BJ-Lazy-load's regex is lazy and doesn't handle multiline search or instances where <img is immediately followed
99
- * by a newline. The following regex replaces newlines and strips unnecessary space. We fire this filter
100
- * before BJ-Lazy-Load's to make our galleries compatible with its expectations.
101
- *
102
- * @param string $content
103
- * @return string
104
- */
105
- function bjlazyload_filter($content)
106
- {
107
- return trim(preg_replace("/\s\s+/", " ", $content));
108
- }
109
-
110
- function get_type_list()
111
- {
112
- return array(
113
- );
114
- }
115
- }
116
-
117
- new M_Third_Party_Compat();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
products/photocrati_nextgen/modules/widget/class.widget.php CHANGED
@@ -30,6 +30,8 @@ class Mixin_Widget extends Mixin
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,6 +54,8 @@ class Mixin_Widget extends Mixin
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,6 +81,8 @@ class Mixin_Widget extends Mixin
77
  */
78
  function echo_widget_slideshow($galleryID, $width = '', $height = '')
79
  {
 
 
80
  $widget = new C_Widget_Slideshow();
81
  $widget->render_slideshow($galleryID, $width, $height);
82
  }
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
  */
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
  */
82
  function echo_widget_slideshow($galleryID, $width = '', $height = '')
83
  {
84
+ wp_enqueue_style('nextgen_widgets_style', $this->get_static_url('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
  }
products/photocrati_nextgen/modules/widget/class.widget_gallery.php CHANGED
@@ -45,32 +45,6 @@ class C_Widget_Gallery extends WP_Widget
45
  function update($new_instance, $old_instance)
46
  {
47
  $instance = $old_instance;
48
-
49
- // do not allow 0 or less
50
- if ((int)$new_instance['items'] <= 0)
51
- $new_instance['items'] = 4;
52
-
53
- // for clarity: empty the list if we're showing every gallery anyway
54
- if ($new_instance['exclude'] == 'all')
55
- $new_instance['list'] = '';
56
-
57
- // remove gallery ids that do not exist
58
- if (in_array($new_instance['exclude'], array('denied', 'allow')))
59
- {
60
- // do search
61
- $mapper = C_Component_Registry::get_instance()->get_utility('I_Gallery_Mapper');
62
- $ids = explode(',', $new_instance['list']);
63
- foreach ($ids as $ndx => $id) {
64
- if (!$mapper->find($id))
65
- unset($ids[$ndx]);
66
- }
67
- $new_instance['list'] = implode(',', $ids);
68
- }
69
-
70
- // reset to show all galleries IF there are no valid galleries in the list
71
- if ($new_instance['exclude'] !== 'all' && empty($new_instance['list']))
72
- $new_instance['exclude'] = 'all';
73
-
74
  $instance['title'] = strip_tags($new_instance['title']);
75
  $instance['items'] = (int)$new_instance['items'];
76
  $instance['type'] = $new_instance['type'];
@@ -85,24 +59,55 @@ class C_Widget_Gallery extends WP_Widget
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,16 +116,15 @@ class C_Widget_Gallery extends WP_Widget
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,26 +140,6 @@ class C_Widget_Gallery extends WP_Widget
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
  }
45
  function update($new_instance, $old_instance)
46
  {
47
  $instance = $old_instance;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  $instance['title'] = strip_tags($new_instance['title']);
49
  $instance['items'] = (int)$new_instance['items'];
50
  $instance['type'] = $new_instance['type'];
59
 
60
  function widget($args, $instance)
61
  {
 
 
 
 
62
  // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
63
  $before_widget = NULL;
64
+ $before_title = NULL;
65
+ $after_widget = NULL;
66
+ $after_title = NULL;
67
+ $widget_id = NULL;
 
68
 
69
+ global $wpdb;
70
+
71
+ extract($args);
72
  $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
73
 
74
+ $renderer = C_Component_Registry::get_instance()->get_utility('I_Displayed_Gallery_Renderer');
75
+ $factory = C_Component_Registry::get_instance()->get_utility('I_Component_Factory');
76
+ $mapper = C_Component_Registry::get_instance()->get_utility('I_Image_Mapper');
77
  $view = $factory->create('mvc_view', '');
78
 
79
+ // To prevent huge db scans and/or the loading of every image available: we first retrieve X image
80
+ // ids and then create a gallery using the results for the image_ids parameter
81
+ $image_ids = array();
82
+
83
+ $sql = "SELECT `pid` FROM `{$wpdb->nggpictures}` WHERE `exclude` = 0";
84
+ // possibly filter images not from certain galleries
85
+ if ($instance['exclude'] == 'allow')
86
+ $sql .= sprintf(" AND `galleryid` IN (%s)", $instance['list']);
87
+ // possibly filter images from certain galleries
88
+ if ($instance['exclude'] == 'denied')
89
+ $sql .= sprintf(" AND `galleryid` NOT IN (%s)", $instance['list']);
90
+ if ($instance['type'] == 'random')
91
+ $sql .= ' ORDER BY RAND()';
92
+ else if ($instance['type'] == 'recent')
93
+ $sql .= ' ORDER BY `imagedate` DESC';
94
+ $sql .= " LIMIT {$instance['items']}";
95
+ foreach ($wpdb->get_results($sql, ARRAY_N) as $res) {
96
+ $image_ids[] = reset($res);
97
+ }
98
+ $image_ids = implode(',', $image_ids);
99
+
100
+ if ($instance['type'] == 'random')
101
+ {
102
+ $order_by = 'rand()';
103
+ $order_direction = 'DESC';
104
+ }
105
+ else if ($instance['type'] == 'recent')
106
+ {
107
+ $order_by = $mapper->get_primary_key_column();
108
+ $order_direction = 'DESC';
109
+ }
110
+
111
  // IE8 webslice support if needed
112
  if ($instance['webslice'])
113
  {
116
  $after_widget = '</div>' . $after_widget;
117
  }
118
 
119
+ echo $renderer->display_images(array(
120
+ 'source' => 'galleries',
121
+ 'order_by' => $order_by,
122
+ 'order_direction' => $order_direction,
123
+ 'image_ids' => $image_ids,
124
  'display_type' => NEXTGEN_GALLERY_BASIC_THUMBNAILS,
125
  'images_per_page' => $instance['items'],
126
  'maximum_entity_count' => $instance['items'],
127
  'template' => $view->get_template_abspath('photocrati-widget#display_gallery'),
 
128
  'show_all_in_lightbox' => FALSE,
129
  'show_slideshow_link' => FALSE,
130
  'disable_pagination' => TRUE,
140
  'widget_setting_height' => $instance['height'],
141
  'widget_setting_show_setting' => $instance['show'],
142
  'widget_setting_widget_id' => $widget_id
143
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
  }
products/photocrati_nextgen/modules/widget/class.widget_slideshow.php CHANGED
@@ -58,10 +58,6 @@ class C_Widget_Slideshow extends WP_Widget
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,7 +71,7 @@ class C_Widget_Slideshow extends WP_Widget
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,7 +89,7 @@ class C_Widget_Slideshow extends WP_Widget
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,7 +100,6 @@ class C_Widget_Slideshow extends WP_Widget
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'
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
 
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
  );
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
  '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'
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.3',
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.1',
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, '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>
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, 'thumb')); ?>"
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,18 +56,6 @@ class A_WordPress_Router extends Mixin
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,21 +63,29 @@ class A_WordPress_Router extends Mixin
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
  }
95
- }
56
  return $retval;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  function get_base_url($site_url = FALSE)
61
  {
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
  return $retval;
90
  }
91
+ }
products/photocrati_nextgen/modules/wordpress_routing/adapter.wordpress_routing_app.php CHANGED
@@ -4,18 +4,9 @@ class A_WordPress_Routing_App extends Mixin
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,14 +16,9 @@ class A_WordPress_Routing_App extends Mixin
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);
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
  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);
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.3',
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.2',
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,8 +17,8 @@ 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',
24
  'photocrati-frame_communication',
@@ -43,18 +43,16 @@ class P_Photocrati_NextGen extends C_Base_Product
43
  'photocrati-nextgen_basic_singlepic',
44
  'photocrati-nextgen_basic_tagcloud',
45
  'photocrati-nextgen_basic_album',
46
- 'photocrati-widget',
47
- 'photocrati-third_party_compat',
48
- 'photocrati-nextgen_xmlrpc'
49
  );
50
 
51
  function define()
52
  {
53
  parent::define(
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'
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-mvc',
21
+ 'photocrati-nextgen_settings',
22
  'photocrati-ajax',
23
  'photocrati-dynamic_stylesheet',
24
  'photocrati-frame_communication',
43
  'photocrati-nextgen_basic_singlepic',
44
  'photocrati-nextgen_basic_tagcloud',
45
  'photocrati-nextgen_basic_album',
46
+ 'photocrati-widget'
 
 
47
  );
48
 
49
  function define()
50
  {
51
  parent::define(
52
  'photocrati-nextgen',
53
+ 'Photocrati NextGen',
54
+ 'Photocrati NextGen',
55
+ '2.0.11',
56
  'http://www.nextgen-gallery.com',
57
  'Photocrati Media',
58
  'http://www.photocrati.com'
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.1
5
- Tested up to: 3.7.1
6
  Stable tag: trunk
7
  License: GPLv2
8
 
@@ -112,17 +112,13 @@ 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 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
 
119
  == Frequently Asked Questions ==
120
 
121
 
122
- = Why are my galleries not opening up in a lightbox after I move my site? =
123
-
124
- This is often due to the URL paths to the CSS and JavaScript files used by the Lightbox Effects not being changed to relevant addresses based on the new site. This article will help sort out this issue if that is the case: <a href="http://www.nextgen-gallery.com/galleries-opening-lightbox/" target="_blank">Why are my galleries not opening up in a lightbox?</a>.
125
-
126
  = Do you have documentation or tutorials? =
127
 
128
  Yes. See <a href="http://www.nextgen-gallery.com/help/" target="_blank">NextGEN Gallery Documentation</a>.
@@ -199,145 +195,6 @@ For more information, feel free to visit the official website for the NextGEN Ga
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
238
- * Fixed: Links are broken on the ngg_tags-sitemap.xml file by WordPress SEO
239
- * Fixed: PHP notice: Attempt to assign property of non-object
240
- * Fixed: Undefined property warnings when using NextGEN Basic Thumbnails
241
- * Fixed: Detect if an applying a transient to a displayed gallery was successful
242
- * Fixed: Compatibility issues with BJ-Lazy-Load and Colorbox
243
- * Fixed: Pagination conflicts for multiple Imagebrowsers on the same page
244
- * Fixed: Ability to display previous exception with debug mode
245
- * Fixed: Tagclouds not working in multisite instances
246
- * Fixed: Load widgets.css when a widget is being used
247
- * Fixed: Installer should remove all instances of the component factory
248
- * Fixed: Widget settings interface not intuitive
249
- * Fixed: Inability to upload images in some Windows host environments
250
- * Fixed: Sorting images/galleries using the Attach To Post interface
251
- * Fixed: Fix detection of HTTPS (pull request by Leonhardt Wille)
252
- * Fixed: Compilation errors of regular expressions
253
- * Fixed: Pro galleries wouldn't display in environments using PHP 5.3.3 or less
254
- * Fixed: Scanning of router slug is now limited to the uri, not the url
255
- * Fixed: Show slideshow link isn't required for thumbnail/imagebrowser integration
256
- * Fixed: WordPress media-upload with 'singlepic' image size
257
- * Fixed: Use target=_blank when the link setting is provided for NextGEN Basic Singlepic
258
- * Fixed: Only display rendering errors if WP_DEBUG is enabled
259
-
260
- = V2.0.31 - 10.03.2013 =
261
- * NEW: Restored AJAX pagination for NextGEN Basic ImageBrowser display type
262
- * Fixed: Compatibility with WordPress Local SEO by Yoast
263
- * Fixed: Inability to upload images if image_slug field was missing in database
264
- * Fixed: Integration of NextGEN Basic Thumbnail and NextGEN Basic Slideshow display types
265
- * Fixed: Photocrati Resource Manager further adjusted to be third-party friendly
266
- * Fixed: Added the ability to find legacy templates in both the child/parent theme directories
267
- * Fixed: JavaScript errors in Attach to Post interface
268
- * Fixed: Router can handle port numbers in urls
269
- * Fixed: Carousel template was linking to NextGEN Basic ImageBrowser view
270
- * Fixed: SQL query generated for displayed galleries using tags as source
271
- * Fixed: 3rd party compat: raise & never lower pcre.backtrack_limit
272
-
273
- = V2.0.30 - 09.25.2013 =
274
- * NEW: Restored the ability to use imagebrowser display type instead of a lightbox effect
275
- * Changed: Displayed galleries are no longer rendered in RSS feeds
276
- * Changed: Removed "Plugin Check" widget from overview page
277
- * Fixed: Silence PHP warnings/errors in an output buffer for AJAX actions
278
- * Fixed: Compatibility issue with WordPress SEO and broken site maps (and large error_logs)
279
- * Fixed: Compatibility issue with AJAX Event Calendar (and possibly others)
280
- * Fixed: Adjusted Photocrati Resource Manager to be third-party friendly
281
- * Fixed: Fixed empty result set for displayed galleries selecting 'All' tags
282
- * Fixed: URL generation for imagebrowser pagination links
283
- * Fixed: Ensure that image meta is imported on creation
284
- * Fixed: Ensure that transients are removed when an external object cache is used
285
- * Fixed: Don't load pluggable.php. This will fix plugin conflicts
286
- * Fixed: In Attach to Post interface, galleries created in one tab weren't showing in another
287
- * Fixed: Don't output frame events cookie for XML-RPC requests
288
-
289
- = V2.0.27 - 09.18.2013 =
290
- * Fixed: Reduce performance impact of purging displayed gallery transients
291
-
292
- = V2.0.25 - 09.18.2013 =
293
- * Reverting to the 2.0.21 codebase, due to major performance issues in 2.0.23 and 2.0.24
294
-
295
- = V2.0.23 - 09.16.2013 =
296
- * NEW: WP-Cron job to periodically clean-up displayed gallery transients
297
- * NEW: Added "excluded_container_ids" as parameter for ngg_images shortcode
298
- * Fixed: Lightbox effect is honoured by all display types
299
- * Fixed: Highslide displays images from the correct displayed galleries
300
- * Fixed: Ensure that sub-albums display correctly when the word "album" is part of a slug
301
- * Fixed: Ensure that sub-albums display correctly when numerical slugs are used
302
- * Fixed: Related images heading only added when Related Images functionality is enabled
303
- * Fixed: PHP Warning about undefined index when viewing basic albums
304
- * Fixed: AJAX handling is third-party compatible
305
- * Fixed: Image date is no longer overwritten when an image is modified
306
- * Fixed: Fixed issue with displayed galleries using source='tags'
307
- * Fixed: Problem with transient cache not getting flushed properly from Other Options page
308
- * Fixed: Use correct gallery/transient ID when ajax pagination is used
309
-
310
- = V2.0.21 - 09.09.2013 =
311
- * NEW: Multisite support
312
- * Changed: Default image quality set to 100 for generated images
313
- * Changed: Removed dependence on simplehtmldom library
314
- * Fixed: Related images functionality works as it did in 1.9.x
315
- * Fixed: Don't compress inline JavaScript in post/page content
316
- * Fixed: Click-to-advance slideshow behavior for slideshows
317
- * Fixed: Security warnings from VaultPress
318
- * Fixed: View as Slideshow link works with AJAX pagination
319
- * Fixed: Broken links on Overview page
320
- * Fixed: Backup images option
321
- * Fixed: Stylesheet url generated correctly for Windows hosts
322
- * Fixed: Compatibility with NextGen Custom Fields plugin
323
- * Fixed: Compatibility with Adsense Explosion plugin
324
- * Fixed: Suppress wp_footer notices unless WP_DEBUG is set to TRUE
325
-
326
- = V2.0.17 - 08.30.2013 =
327
- Fixed: Match legacy behaviour when changing gallery path, i.e. don't move files
328
-
329
- = V2.0.14 - 08.27.2013 =
330
- * NEW: Added the ability to override thumbnail settings for NextGEN Basic Albums
331
- * NEW: Shortcode Manager API, which ensures that shortcodes are outputted as intended
332
- * Changed: Re-added the ability to select the original image size for widgets
333
- * Fixed: Ensure that stylesheet url returned is correct for Windows hosts
334
- * Fixed: Broken links and lightbox effects with AJAX pagination
335
- * Fixed: Try to ensure that third party plugins don't add content to our dynamic JS
336
- * Fixed: Improved reliability of iframely.js
337
- * Fixed: Ensure that urls are generated correctly in HTTPs environments
338
- * Fixed: Datamapper works correctly in environments where temporary tables aren't supported
339
- * Fixed: Fixed an issue with thickbox loading animation when home url differs from site url
340
-
341
  = V2.0.11 - 08.19.2013 =
342
  * NEW: Added "run_ngg_resource_manager" hook to by-pass our resource manager
343
  * Changed: Removed "Reset & Uninstall" tab, for now
@@ -656,4 +513,4 @@ Fixed: Match legacy behaviour when changing gallery path, i.e. don't move fi
656
  == Upgrade Notice ==
657
 
658
  = 1.5.5 =
659
- * Compatibility issue for post thumbnails with WP2.9 and WP3.0. No Database changes...
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
 
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
 
119
  == Frequently Asked Questions ==
120
 
121
 
 
 
 
 
122
  = Do you have documentation or tutorials? =
123
 
124
  Yes. See <a href="http://www.nextgen-gallery.com/help/" target="_blank">NextGEN Gallery Documentation</a>.
195
 
196
  == Changelog ==
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  = V2.0.11 - 08.19.2013 =
199
  * NEW: Added "run_ngg_resource_manager" hook to by-pass our resource manager
200
  * Changed: Removed "Reset & Uninstall" tab, for now
513
  == Upgrade Notice ==
514
 
515
  = 1.5.5 =
516
+ * Compatibility issue for post thumbnails with WP2.9 and WP3.0. No Database changes...