60% nextgen-gallery

Code Review | WordPress Gallery Plugin - NextGEN Gallery

WordPress plugin WordPress Gallery Plugin - NextGEN Gallery scored60%from 54 tests.

About plugin

  • Plugin page: nextgen-gallery
  • Plugin version: 3.54
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5.4-6.4.1
  • WordPress version: 6.3.1
  • First release: Apr 23, 2007
  • Latest release: Dec 1, 2023
  • Number of updates: 960
  • Update frequency: every 6.3 days
  • Top authors: photocrati (69.48%)alexrabe (29.9%)

Code review

54 tests

User reviews

4166 reviews

Install metrics

500,000+ active /38,837,317 total downloads

Benchmarks

Plugin footprint 63% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲6.49MB] [CPU: ▲61.75ms] 50% from 4 tests

A check of server-side resources used by WordPress Gallery Plugin - NextGEN Gallery
It is recommended to improve the following
  • RAM: Try to keep total memory usage under 10MB (currently 10.74MB on /wp-admin/admin.php?page=nextgen-gallery-about-us)
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 6.49MB on /wp-admin/admin.php?page=nextgen-gallery-about-us)
PageMemory (MB)CPU Time (ms)
Home /7.31 ▲3.8568.86 ▲27.91
Dashboard /wp-admin10.71 ▲7.37162.68 ▲100.99
Posts /wp-admin/edit.php10.73 ▲7.37116.55 ▲69.86
Add New Post /wp-admin/post-new.php13.41 ▲7.53158.10 ▲58.79
Media Library /wp-admin/upload.php10.62 ▲7.39121.79 ▲90.42
Extensions /wp-admin/admin.php?page=ngg_pro_upgrade10.69125.28
Add Gallery / Images /wp-admin/admin.php?page=ngg_addgallery10.82463.72
Overview /wp-admin/admin.php?page=nextgen-gallery10.6696.16
Other Options /wp-admin/admin.php?page=ngg_other_options10.69111.81
Manage Galleries /wp-admin/admin.php?page=nggallery-manage-gallery11.03108.55
Gallery Settings /wp-admin/admin.php?page=ngg_display_settings11.75172.47
Ecommerce /wp-admin/admin.php?page=nextgen-gallery-albums10.7992.82
Manage Tags /wp-admin/admin.php?page=nggallery-tags10.7490.92
Manage Albums /wp-admin/admin.php?page=nggallery-manage-album10.8898.42
About Us /wp-admin/admin.php?page=nextgen-gallery-about-us10.7489.36

Server storage [IO: ▲16.83MB] [DB: ▲0.04MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Please try to fix the following items
  • Illegal file modification found: 21 files (0.00KB) outside of "wp-content/plugins/nextgen-gallery/" and "wp-content/uploads/"
    • (new file) wp-content/gallery/.empty
    • (new file) wp-content/ngg/modules/photocrati-attach_to_post/templates/.empty
    • (new file) wp-content/ngg/modules/photocrati-frame_communication/static/.empty
    • (new file) wp-content/ngg/modules/imagely-displaytype_admin/templates/.empty
    • (new file) wp-content/ngg/modules/photocrati-marketing/static/.empty
    • (new file) wp-content/ngg/modules/photocrati-marketing/templates/.empty
    • (new file) wp-content/ngg/modules/photocrati-attach_to_post/static/.empty
    • (new file) wp-content/ngg/modules/photocrati-ajax/static/.empty
    • (new file) wp-content/ngg/modules/imagely-displaytype_admin/static/.empty
    • (new file) wp-content/ngg/modules/photocrati-lightbox/static/.empty
    • ...
Filesystem: 1,429 new files
Database: 3 new tables, 10 new options
New tables
wp_ngg_gallery
wp_ngg_album
wp_ngg_pictures
New WordPress options
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_ngg-mrssw
ngg_transient_groups
widget_slideshow
widget_ngg-images
widget_theysaidso_widget
db_upgraded
widget_recent-posts

Browser metrics 75% from 4 tests

WordPress Gallery Plugin - NextGEN Gallery: an overview of browser usage
A great user experience is important, so you should focus on the following
  • Script duration: Try to keep JavaScript execution under 1,500.00ms (currently 1,935.31ms on /wp-admin/admin.php?page=nextgen-gallery)
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,660 ▲89824.04 ▲9.7152.67 ▲50.9837.14 ▼6.76
Dashboard /wp-admin2,735 ▲55511.73 ▲6.10352.22 ▲262.9071.85 ▲32.60
Posts /wp-admin/edit.php2,974 ▲87411.98 ▲10.05236.91 ▲196.6831.74 ▼7.37
Add New Post /wp-admin/post-new.php7,136 ▲5,61035.89 ▲12.801,262.14 ▲629.4239.38 ▼41.97
Media Library /wp-admin/upload.php2,279 ▲88814.55 ▲10.37305.75 ▲206.8785.06 ▲45.00
Extensions /wp-admin/admin.php?page=ngg_pro_upgrade2,9334.4169.26144.34
Add Gallery / Images /wp-admin/admin.php?page=ngg_addgallery2,2357.10114.84174.83
Overview /wp-admin/admin.php?page=nextgen-gallery7,05471.681,935.31118.36
Other Options /wp-admin/admin.php?page=ngg_other_options5,0355.87105.15105.08
Manage Galleries /wp-admin/admin.php?page=nggallery-manage-gallery2,3879.70281.6696.94
Gallery Settings /wp-admin/admin.php?page=ngg_display_settings4,0935.5078.69148.62
Ecommerce /wp-admin/admin.php?page=nextgen-gallery-albums3,7427.11148.68105.24
Manage Tags /wp-admin/admin.php?page=nggallery-tags1,6682.3435.6951.69
Manage Albums /wp-admin/admin.php?page=nggallery-manage-album1,6962.5944.7056.00
About Us /wp-admin/admin.php?page=nextgen-gallery-about-us2,2282.2937.4497.98

Uninstaller [IO: ▲0.00MB] [DB: ▲0.04MB] 50% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie tables detected upon uninstall: 3 tables
    • wp_ngg_pictures
    • wp_ngg_gallery
    • wp_ngg_album
  • The uninstall procedure has failed, leaving 10 options in the database
    • can_compress_scripts
    • widget_slideshow
    • theysaidso_admin_options
    • ngg_transient_groups
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_ngg-mrssw
    • widget_ngg-images
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=ngg_other_options
    • > Notice in wp-includes/formatting.php+1104
    Array to string conversion

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 37× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/nextgen-gallery/src/Legacy/admin/showmeta.php
    • > /wp-content/plugins/nextgen-gallery/templates/GalleryDisplay/Related.php
    • > /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/templates/image/after.php
    • > /wp-content/plugins/nextgen-gallery/src/Legacy/view/album-compact.php
    • > /wp-content/plugins/nextgen-gallery/vendor/imagely/pope-framework/lib/class.component_factory.php
    • > /wp-content/plugins/nextgen-gallery/templates/Albums/breadcrumbs.php
    • > /wp-content/plugins/nextgen-gallery/vendor/imagely/pope-framework/lib/class.base_product.php
    • > /wp-content/plugins/nextgen-gallery/src/Legacy/view/gallery-caption.php
    • > /wp-content/plugins/nextgen-gallery/templates/AttachToPost/preview_tab.php
    • > /wp-content/plugins/nextgen-gallery/vendor/imagely/pope-framework/lib/interface.pope_module.php
  • 453× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: i18n in wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_other_options/templates/update_legacy_featured_images_field.php on line 20
    • > PHP Fatal error
      Uncaught Error: Class 'Imagely\GG\\Display\\StaticAssets' not found in wp-content/plugins/nextgen-gallery/src/Display/StaticPopeAssets.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_HTMLModule' not found in wp-content/plugins/nextgen-gallery/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/TargetNoreferrer.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrTransform' not found in wp-content/plugins/nextgen-gallery/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/Input.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'lsolesen\\pel\\PelException' not found in wp-content/plugins/nextgen-gallery/lib/pel-0.9.9/src/PelEntryException.php:49
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrTransform' not found in wp-content/plugins/nextgen-gallery/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrTransform/TargetNoreferrer.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_Filter' not found in wp-content/plugins/nextgen-gallery/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Filter/ExtractStyleBlocks.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrDef' not found in wp-content/plugins/nextgen-gallery/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Imagely\GG\\DisplayType\\Controller' not found in wp-content/plugins/nextgen-gallery/src/DisplayTypes/Albums/SharedController.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/displaytype_admin/templates/nextgen_basic_singlepic_settings_quality.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that need to be fixed:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

nextgen-gallery/nggallery.php 77% from 13 tests

The main PHP file in "WordPress Gallery Plugin - NextGEN Gallery" ver. 3.54 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("nextgen-gallery.php" instead of "nggallery.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Domain Path: Use only dashes and lowercase characters for the domain path ("/static/I18N/")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin139,130 lines of code in 1,066 files:
LanguageFilesBlank linesComment linesLines of code
PHP62012,63135,50073,237
JavaScript2616,9802,43127,372
CSS1271,71448618,241
SVG27109,875
PO File94,1507,2298,023
Sass79751,369
Markdown31150362
JSX4563275
JSON400210
LESS1115152
Ruby1208
XML1005
INI1111

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
The following items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 643)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity20.06
▷ Minimum class complexity1.00
▷ Maximum class complexity643.00
Average method complexity4.25
▷ Minimum method complexity1.00
▷ Maximum method complexity643.00
Code structure
Namespaces25
Interfaces4
Traits1
Classes585
▷ Abstract classes305.13%
▷ Concrete classes55594.87%
▷ Final classes00.00%
Methods3,493
▷ Static methods39211.22%
▷ Public methods3,28694.07%
▷ Protected methods1063.03%
▷ Private methods1012.89%
Functions74
▷ Named functions4054.05%
▷ Anonymous functions3445.95%
Constants919
▷ Global constants13614.80%
▷ Class constants78385.20%
▷ Public constants77899.36%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
99 PNG files occupy 0.56MB with 0.11MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
static/Lightbox/fancybox/fancy_title_main.png0.09KB0.14KB0.00%
products/photocrati_nextgen/modules/nextgen_admin/static/jquery-ui/images/ui-icons_cccccc_256x240.png6.81KB4.17KB▼ 38.71%
static/Lightbox/fancybox/fancy_shadow_nw.png0.32KB0.47KB0.00%
products/photocrati_nextgen/modules/nextgen_admin/static/jquery-ui/images/ui-bg_flat_0_fff_40x100.png0.20KB0.08KB▼ 58.17%
products/photocrati_nextgen/modules/nextgen_admin/static/select2/select2.png0.60KB0.99KB0.00%