Thread Starter
rphair
(@rphair)
to illustrate: we are just trying to determine the Gallery Path from the Gallery ID as shown on this screen:
http://cosd.com/stuff/ngg-gid-to-pathname.jpg
There is some good documentation in /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules but I haven’t yet found a description of the arrays or objects that the plugins are working with. It would be wonderful to have this information, but in the meantime our site is down until we can find a mapping between the gallery ID & gallery pathnames and put it back into our custom theme.
Hi rphair,
C_Gallery_Storage::get_instance()->get_gallery_abspath($gallery_id)
Will return the gallery absolute path, or you inspect the path attribute of a gallery: C_Gallery_Mapper::get_instance()->find($gallery_id)->path
There are a few similar management classes, with C_(Gallery|Album|Image)_Mapper used to find and retrieve items from the database, and C_(Gallery|Image|Album)_Storage are available to determine file paths or URI.
Thread Starter
rphair
(@rphair)
thanks @benjamin, that’s great: the images are now restored to our site’s custom theme.
Please, to help me answer similar questions in the future: I can see in
/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_data/package.module.nextgen_data.php
that
get_instance() on these Storage and Mapper objects provides us with some methods for accessing the gallery database. That’s great… but for the second part of my original question, where are these methods enumerated?
That is to say, where is the description of the Storage & Mapper API’s… or are the class functions to be reverse engineered by themers from the 4819 lines of code in package.module.nextgen_data.php?
We began ‘compiling’ NextGen’s PHP for public releases around 2.0.79 by combining all files in a given module into the package file you see in our public releases. The plugin code is hosted on Bitbucket where our classes are kept in separate files during development.
Thread Starter
rphair
(@rphair)
OK, thanks @benjamin, I can see that the code is at that link too. The inline comments correspond exactly to those in the larger file. And, unless I’ve missed it, at the source web site there is still no high-level description of all the class functions that correspond to these Storage & Mapper objects.
If the plugin is truly lacking that kind of high-level description, it means that themers have to reverse-engineer an API based on going through the code… whether it is one massive file or dozens of little ones, the difficulty is the same.
There is an additional problem: our web site broke in this case because a previous designer relied upon an array reference in the legacy code to determine the gallery path. Now, in the current version, the same data is available only in an object-oriented system. Unless the API for the Gallery data is documented anywhere, there is no assurance we would be able to correct our web site quickly, or at all, if it were to change again.
Your last response suggested I thought the problem was “too many lines of code in the file.” That’s not the problem at all… it’s that the plugin appears to be undocumented. Developers need a documented API to work with other people’s code: that’s the bottom line all over the industry. I appreciate your help, but if we don’t get a positive response about this documentation in code or online, we will have to assume it doesn’t exist and look for something more developer-friendly.