The essential add-on for the NextGEN Gallery WordPress plugin.
ADDED: Detection of base_url query string parameter pages in NextGEN Gallery Deactivator. These dynamic pages are sometimes generated by plugins (e.g. the "Calculated Fields Form" plugin) for AJAX calls, to pull in extra data. And where that extra data involves NextGEN functionality, we needed to be able to flag them as Allowed Pages.
ADDED: Detection of NextGEN's "Manage Gallery" meta links in NextGEN Gallery Deactivator. The URL's of the linked PHP files needed to be flagged as Allowed Pages, as although they're loaded in the admin, they're actually located in the "nextgen-gallery" plugin directory (therefore undetectable by is_admin() checks).
NEW: Now fully compatible with the major update of NextGEN Gallery v2.0.71 (up to v2.0.77).
NEW: Optimizer's Enhanced Fancybox Lightbox is now additionally integrated with the "C_Lightbox_Library_Manager" class, for front-end, in-memory lightbox registration in NextGEN v2.0.71+.
NEW: Added conditional removal of several script dependencies (when using Optimizer's "Advanced options"), that were introduced in NextGEN v2.0.71+. This enables us to continue to provide granular control of the scripts that load on posts and pages with NextGEN Gallery content in NextGEN v2.0.71+.
NEW: The exact version of NextGEN Gallery in current use is now taken directly from NextGEN's main plugin file header, as we can't count on Photocrati to not remove/rename the "NGG_PLUGIN_VERSION" constant (which had already replaced Legacy's "$ngg->version" in NextGEN v2.0+), nor provide any graceful deprecation or backwards compatibility to prevent errors after doing so (re: the NextGEN v2.0.71+ update. See below…).
FIXED: "Fatal error: Class 'C_Lightbox_Installer' not found" after Photocrati completely removed the "C_Lightbox_Installer" class in NextGEN v2.0.71 (without any graceful deprecation, or backwards compatibility in place).
FIXED: "Fatal error: Call to undefined method C_Lightbox_Installer::uninstall_lightbox()" after Photocrati reintroduced the "C_Lightbox_Installer" class in NextGEN v2.0.74+, but without the original "uninstall_lightbox()" method.
FIXED: "Fatal error: Class 'C_NextGen_Settings' not found" when activating other plugins. This is caused by new methods introduced by Photocrati in NextGEN v2.0.71+ intended to hide (instead of fix) PHP warnings when using their NextGEN Plus/Pro plugins or their theme. They are called "is_activating()" and "is_not_activating()", and are added to the "C_NextGEN_Bootstrap" class in "nggallery.php". This appears to prevent NextGEN from initializing on the activation of other plugins, and as a result, NextGEN doesn’t load its includes...causing all third-party calls to its "C_NextGen_Settings" class in the NextGEN 2.0 API to fail.
NEW: Now fully compatible with the major update of NextCellent Gallery v1.9.25 (up to v220.127.116.11).
NEW: Optimizer now deregisters the new sitewide stylesheet "framework-min.css" added in NextCellent Gallery 1.9.25+, and only loads it on posts and pages with NextCellent Gallery content. Re: https://wordpress.org/support/topic/latest-nextcellent-gallery-1925-loading-frameworkcss-file-on-every-page
NEW: Optimizer now deregisters the new slideshow script "owl.carousel.min.js" added in NextCellent Gallery 1.9.25+, and only loads it as required on posts and pages with slideshows (e.g. posts/pages with the [slideshow id=x] shortcode, or on [Show as slideshow] link sub-pages).
NEW: Optimizer is now fully compatible down to WordPress v3.7.
NEW: Optimizer is tested fully compatible with WordPress v4.1 and v4.1.1.
NEW: Added a "Thanks for updating" admin notification with a link to Optimizer's settings page, which displays after a user performs either a 1-click or manual update of Optimizer. This message is automatically removed once the settings page is visited, and is important so that users are aware of the major changes and extra options available in Optimizer's v2.0 codebase and beyond.
IMPROVED: Changed a small section of our Dynamic Fancybox Settings Interface initialization, for compatibility with the old-style admin in WordPress v3.7.
IMPROVED: Increased the help text font size in our Dynamic Fancybox Settings Interface, for the old-style admin in WordPress v3.7 (as the font rendering is less clear).
IMPROVED: Optimizer now references home_url() instead of site_url(), to support WordPress installations both stored in their own subdirectory (e.g. http://example.com/wordpress/), and that are configured to serve pages from the website root (e.g. http://example.com/).
NEW: Now fully compatible with the NextGEN Plus (v1.1.3) and NextGEN Pro (v2.1.4) premium add-ons. Re: https://wordpress.org/support/topic/interferes-with-nextgen-pro-lightbox-controls
NEW: Added checks for the "post_type" query-string parameter when removing NextGEN's scripts and stylesheets from all over the WordPress admin. This is required in order to detect some menu items under NextGEN Pro's Ecommerce tab.
NEW: Optimizer now detects if the NextGEN Pro lightbox is currently being displayed. The lightbox loads a separate page inside an iframe, and script and stylesheet removal on that page breaks its icon images.
IMPROVED: Replaced all instances of "pages without galleries" and "gallery pages" to "posts and pages with (or without) NextGEN Gallery content". Whilst longer, this should be far less open to misinterpretation, as it tackles two possible elements of confusion at once...
1. Of the word "gallery/Gallery" being taken too literally. E.g. pages displaying a "gallery" display type vs pages displaying an "album" display type, even though they're both displaying NextGEN "Gallery" content.
2. Ensuring we're clear there is no differentiation between WordPress Posts and WordPress Pages.
IMPROVED: Replaced all instances of "NextGEN Legacy" with "NextGEN Legacy (v1.6.2 to v1.9.13)" to be clear we still fully support the original NextGEN codebase. The Legacy nomenclature was introduced by Photocrati (NextGEN's new developers), and was required in the documentation as of Optimizer v2.0, in order to differentiate between the original and v2.0 NextGEN codebases. Re: https://wordpress.org/support/topic/announcement-nextgen-gallery-optimizer-v20-now-available
IMPROVED: Made some minor improvements to the text and layout on Optimizer's settings pages, to enable users to better differentiate between the features included in the Basic and Pro versions. Re: https://wordpress.org/support/topic/question-about-pro-version-1
NEW: NextGEN Gallery Deactivator now automatically flags the "nextgen-galleria-gallery" page in NextGEN Plus as an Allowed Page. This is used by the Pro slideshow in NextGEN Plus and NextGEN Pro, and is embedded in posts and pages inside an iframe.
NEW: NextGEN Gallery Deactivator now automatically flags the "nextgen-pro-lightbox-gallery" page and the "nextgen-pro-lightbox-load-images" page in NextGEN Plus and NextGEN Pro as Allowed Pages. These are embedded into gallery/slideshow posts and pages (when using the Pro lightbox), seemingly one iframe inside another.
NEW: NextGEN Gallery Deactivator now checks and allows the new AJAX path introduced in NextGEN v2.0.71+, which is required for comments and cart functionality in the NextGEN Pro lightbox, and save functionality in the Attach to Post interface. Now: http://www.example.com/?photocrati_ajax=1.
NEW: Added transient caching in the 1-click plugin updater to improve performance.
IMPROVED: A few minor coding improvements in NextGEN Gallery Deactivator.
SECURED: NextGEN Gallery Deactivator's directory now includes an index.php file (like all other directories in Optimizer) to prevent bots from scanning the directory tree.
NEW: Plugin completely rewritten to support the new NextGEN 2.0 codebase, and the NextGEN Legacy fork called NextCellent Gallery.
NEW: Completely restructured to ensure all admin-related code loads only in the admin.
NEW: Master shortcode regex.
NEW: Support for NextGEN's activate permalinks option.
NEW: Support for the link attribute in [singlepic id=x] shortcode.
NEW: Support for the "Show first --> Slideshow" option at Gallery --> Options --> Gallery.
NEW: Support for the new [nggalbum id=x] shortcode (for NextGEN v.1.9.12).
NEW: Support for AJAX pagination on [nggallery id=x] and album gallery pages.
NEW: Rewritten primary optimization logic.
NEW: Refined shortcode regex loop for multi-post pages to avoid conflicts with some plugins.
NEW: Sanitization, validation and error messaging for all settings on Optimizer's options page, including an if file exists headers check on Legacy's custom stylesheet URL field using the WordPress HTTP API.
NEW: Check if WordPress is at least v3.8 (the minimum version our Dynamic Fancybox Settings Interface currently supports).
NEW: Now using "wp_localize_script()" to insert NextGEN Legacy's CDATA blocks.
NEW: Refactored lightbox script/style/CDATA loading into single functions.
NEW: The code behind Optimizer 2.0 now utilizes class encapsulation, with a strong focus on WordPress coding standards and best practices.
NEW: Now getting NextGEN Legacy's query string parameters the WordPress way (replaced all $get variables with $wp_query->query_vars).
NEW: Replaced all calls to NextGEN's database options array, in favor of accessing settings via the $ngg object (NextGEN Legacy) and the C_NextGEN_Settings object (NextGEN v2.0). This saves up to 15KB of memory depending on the NextGEN codebase we're using.
NEW: Now storing all shortcode regex results (required for multi-post pages) in an array for further processing. This ensures we only run the regex operation once per load, speeding up execution.
FIXED: Small shortcode regex bug that affected some users (replaced our while have posts loop with a foreach iterating over the results of $wp_query->posts).
ADDED: jQuery migrate plugin in NextGEN Legacy (when Google-hosted jQuery is selected on Optimizer's Legacy settings page), for backwards compatibility with other themes and plugins.
UPDATED: Legacy's Google-hosted jQuery is now v1.11.1 to match the WordPress version included in WP 4.0.1.
NEW: Modified the Fancybox script for full compatibility with jQuery v1.9 and v1.10+ (doesn't require jQuery migrate).
NEW: Rewritten auto Fancybox installation with full integration with NextGEN's lightbox select menu at both Gallery --> Options --> Effects (NextGEN Legacy) and Gallery --> Other Options --> Lightbox Effects (NextGEN 2.0).
NEW: Support for AJAX pagination (inc. imagebrowser) when using the Fancybox lightbox (Shutter no longer required).
NEW: Improved our Fancybox stylesheet regex to accommodate devs moving sites from development servers to production.
NEW: Overhauled our responsive resize method. Now much faster!
NEW: Uniquely prefixed Fancybox function and selector names to avoid conflicts with themes simultaneously loading other versions.
NEW: Replaced Fancybox's fading-out / fading-in of the actual image on resize with a transparent overlay, as it's much less processor intensive. This runs a lot smoother in IE6/7/8 especially, and even improves performance in modern browsers when the CPU is being overworked.
NEW: Expanded the iframe "allowTransparency" conditional to include IE7 and 8, as they require this property also.
NEW: Improved a previous fix for NextGEN Legacy compatibility (space in empty title issue) so that it works perfectly in IE6 and 7.
NEW: Improved the responsive resize method invocation. Instead of firing independently on window.resize, this is now integrated into the Fancybox script itself. It's set to only fire once Fancybox's wrap centering is fully complete, ensuring smoother animations on older browsers, older equipment, or simply on overworked CPUs.
NEW: Adjusted vertical positioning of the loading animation, when adding room for the title position in Fancybox's image height calculations.
NEW: Fancybox now factors in the dynamic address and tab bar in Safari on iOS8 in its height calculations, ensuring perfect vertical centering.
FIXED: Fancybox's overlay width. When our document is wider than the browser window, we need to ensure the overlay covers the whole width (as it does the length), in case a user scrolls horizontally.
FIXED: The WordPress admin bar was hiding Fancybox's background overlay and "x" close image. I've increased all z-index values to bring them to the top.
FIXED: Some minor Fancybox errors in JSHint.
Added new checks to make sure NextGEN Gallery is both installed and activated. A new admin notification accompanies this to assist new users with downloading, activating and setting up NextGEN.
Major improvements to Optimizer's automatic Fancybox installation. 1. Checks to make sure NextGEN Gallery is actually installed. 2. Automatically resets if the NextGEN database settings are deleted (so it can run again if reinstalled). 3. Now deactivates and restores former NextGEN Effects values when Optimizer's Fancybox option is switched off (as well as on plugin deactivation).
Improved our "can't write css file" admin notification to include a small "how to" guide on changing file permissions, to assist users who are new to managing self-hosted sites.
Replaced all upload instructions with a step-by-step guide to installing Optimizer via the WordPress admin. This method of installation is much faster than FTP, largely automated and most importantly, ensures the correct file ownership and permissions are set.
Changed Google-hosted jQuery to version 1.8.3 to match the version now included in WordPress 3.5.
Updated the Basic version's messaging in regards to the [Show as slideshow] text link for greater clarity.
Removed the donate and hire me boxes from the Basic version's settings page, as some users had expressed annoyance.
Explicitly defined database settings variables as globals so they're able to be used inside functions called on register_activation_hook().
Added a dynamic administrative message on the front-end for logged-in admins, which displays on posts/pages where unsupported shortcodes are being used. It's intended to inform admins about the Basic version's limitations in case they skipped the documentation, and highlight the Premium version's feature set in case it would be more appropriate for their requirements. [Basic only]
Added a check to make sure jQuery isn't being deregistered in a user's theme, as it will break Fancybox. This regex runs on the plugins page and Optimizer's settings page in the admin, and looks for variants of "wp_deregister_script('jquery');" in the functions.php files of both the main active theme and the child theme (if present). If detected (and not re-registered with a CDN version), users are alerted via a message in the admin. [Basic and Premium]
Added a blank index.php file inside each of Optimizer's folders to prevent Google from accessing and indexing the Apache directory tree. [Basic and Premium]
Added a conditional bottom margin in Fancybox's image height calculations to make room for single-line titles. By default, especially with large images, the titles would be squished against the bottom of the viewport.
Added new options that allow users to choose between WordPress's included jQuery or Google-hosted jQuery. We used to just run the Google-hosted script, but as users have reported compatibility issues (even with the jQuery.noConflict(); method added in the last update) -- and that those issues have been resolved simply by using the built-in version instead -- I thought it would be best to make WordPress's jQuery the default and provide Google-hosted as an option.
Added support for WordPress's native Thickbox lightbox integrated with NextGEN Gallery.
Added support for NextGEN's built-in Shutter effect.
Added support for NextGEN's JW Image Rotator assistant (Premium) after permission granted from the authors. Turns out we only needed to include WordPress's native swfobject.js on the slideshow shortcode (if activated at Gallery --> Options --> Slideshow --> "Enable flash slideshow"), and grab the file path to the user's downloaded imagerotator.swf file entered below that.
Added support for NextGEN's AJAX pagination on the [imagebrowser id=x] shortcode (Premium). NextGEN also applies this to Gallery pages and Album gallery pages, but as I've outlined in the FAQ, the implementation is far too buggy, inconsistent and restrictive to add here. From a user interface perspective, it works rather well with imagebrowser (albeit, issuing notices), so I have added it in...but for the galleries, it's really not necessary. I'd say it's better to be without, than have it break the [Show as slideshow] links on the gallery pages.
Added a function to Fancybox's scripts (Premium) to trigger an auto-resize when a user resizes their browser window. I've also added a slight delay for smooth animation and it looks great! Previously, the lightbox did center itself on window resize, but the image wouldn't rescale without first exiting and re-entering the lightbox.
Changed three function names after adding support for Shutter and Thickbox (to be more descriptive and consistent).
Removed nggo_custom_style. Its functionality has been merged into nggo_load_nextgen_styles.
Added version number to Optimizer's HTML comment to assist with support.
Added a link to Premium in the plugin description.
Changed "compatible up to" version number after thorough testing on WordPress 3.4.
Fixed a Fancybox/NextGEN Gallery integration issue where a small white line would appear underneath the lightbox when no title was set.
Recompiled jquery.fancybox-1.3.4.pack.js with Google Closure Compiler after above fix.
Switched Google-hosted jQuery to the latest version (1.7.2).
Converted all jQuery "$" selectors in Fancybox's invocation code to "jQuery" to prevent conflicts with other plugins and scripts.
Fixed a minor bug in the "file not writable" admin message whereby the filename was omitted.
Installation of Fancybox is now fully automated and set by default. The plugin saves a copy of existing settings on the Gallery --> Options --> Effects page, then updates them with the Fancybox code so we don't have to enter it manually. Any changes to this code are then overridden as long as the Fancybox option on the settings page is checked. This helps prevent accidental changes that would break integration. A safety switch, if you will. There's also an admin message that prompts users to uncheck the Fancybox setting on the options page if they want to use another custom lightbox/effect. On deactivation, Optimizer will attempt to restore the former values...but only if Fancybox is selected (don't want to write over newer custom values!)
Removed installation instructions from the options pages as, well, we don't need them any more.
After discovering WordPress's auto-update downloads the full version of the plugin (not just the files that have changed), and with no way to redirect back to the plugin settings page from the upgrade page, I've set the Fancybox stylesheet regex to run on admin_init instead. Since we only want it to run once (on first activation and after auto-update), I've defined a version number in the code and added a "version" option to the settings array to check against.
Added (if !defined()) to skip_load_scripts to avoid possible error messages when both basic and premium versions of the plugin are installed.
Added extra fields to the options page for persistent plugin settings.
Replaced my shortcode regex with WordPress's native get_shortcode_regex() function for more precise matching.
Added a pre-emptive fix to solve a common problem where jQuery dependent scripts (such as Fancybox and NextGEN's slideshow) break if jQuery doesn't load first. Added array('jquery') dependencies to wp_register_script calls (which forces jQuery to not only load when these scripts are called, but load first), as well as add_action priority values to influence their order.
Launched my new NextGEN Gallery Optimizer Premium version which supports ALL TEN of NextGen's shortcodes, supports the [show as slideshow] link, adds targeting for shortcode sub-pages (eg. stylesheet only on album page / both styles and scripts (if selected) on album GALLERY pages) and adds the removal of NextGEN's version number comment.
Added promotional box to the basic version's settings page.
Added an automatic redirect that sends first time users to the plugin options page on first activation.
Added a one time welcome message on the redirect.
Added a default setting for the stylesheet in case anyone forgets to set it.
Added email contact to the settings page and main page at the plugin repository.
Changed all instances of $nextgen_gallery_optimizer to a global $nggo_options variable for less cumbersome handling of database options.
Moved the stylesheet drop-down if statements to scripts-and-styles.php to keep them together with their register and enqueue calls.
Replaced all hard-coded scripts and styles with WordPress's built-in wp_enqueue_scripts and wp_print_styles functions for better compatibility with other plugins.
Added several instances of wp_deregister_script to pages we're serving jquery and jquery.fancybox.js on. This will prevent conflicts (and page load overhead) if any other installed plugins try to serve duplicate scripts.
Added /wp-content/ url prefix to custom css input box on the settings page. Also made the Fancybox installation instructions clearer with larger text, a link to the NextGEN Effects page, and extra advice in the Tips section on plugin conflicts.
Added support for WordPress Pages
Fixed an issue where some page elements overlap Fancybox and prevent the close button from functioning (in particular the title text, header image and menu bar in Twenty Eleven).
Fixed a surprisingly common issue involving Fancybox not working in IE6 & IE8. My solution was to develop a regular expression that runs on the plugin options page ONLY to write the full urls Microsoft.AlphaImageLoader requires into the static Fancybox stylesheet. Much more efficient than some methods I've seen (such as dynamically rebuilding the stylesheet on every page view in php).
Switched JQuery to the latest version 1.7.1 (Google hosted)
Requires: 3.7 or higher
Compatible up to: 4.3.1
Last Updated: 3 months ago
Active Installs: 10,000+
1 of 1 support threads in the last two months have been resolved.
Got something to say? Need help?