78% photoswipe-for-nextgen-gallery

Code Review | Photoswipe for NextGEN Gallery

WordPress plugin Photoswipe for NextGEN Gallery scored78%from 54 tests.

About plugin

  • Plugin page: photoswipe-for-ne...
  • Plugin version: 1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.4.1
  • WordPress version: 6.3.1
  • First release: Oct 13, 2012
  • Latest release: Jan 29, 2013
  • Number of updates: 18
  • Update frequency: every 6.1 days
  • Top authors: gsenas (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

700+ active /28,428 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.18MB] [CPU: ▼9.79ms] Passed 4 tests

An overview of server-side resources used by Photoswipe for NextGEN Gallery
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.73 ▼0.7313.25 ▼32.75
Dashboard /wp-admin3.31 ▲0.0145.64 ▼3.15
Posts /wp-admin/edit.php3.36 ▲0.0149.23 ▲2.39
Add New Post /wp-admin/post-new.php5.89 ▲0.0193.03 ▼2.67
Media Library /wp-admin/upload.php3.23 ▲0.0136.34 ▼0.58
Photoswipe /wp-admin/admin.php?page=photoswipe-for-nextgen-gallery/ngg-photoswipe.php3.1828.06

Server storage [IO: ▲0.76MB] [DB: ▲0.00MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 15 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
nggphotoswipe_enabled
db_upgraded
can_compress_scripts
additional_viewers
theysaidso_admin_options
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Photoswipe for NextGEN Gallery
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.74 ▲0.371.76 ▼0.1444.06 ▼2.75
Dashboard /wp-admin2,206 ▲144.85 ▼0.03108.38 ▼3.3443.98 ▼6.97
Posts /wp-admin/edit.php2,089 ▼02.04 ▲0.0539.97 ▲3.7835.77 ▲3.71
Add New Post /wp-admin/post-new.php1,514 ▼917.87 ▼5.32658.39 ▼25.5356.90 ▲0.47
Media Library /wp-admin/upload.php1,382 ▼64.20 ▼0.0295.86 ▲3.1543.08 ▼3.73
Photoswipe /wp-admin/admin.php?page=photoswipe-for-nextgen-gallery/ngg-photoswipe.php8362.0525.3027.15

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=photoswipe-for-nextgen-gallery/ngg-photoswipe.php
    • > Notice in wp-content/plugins/photoswipe-for-nextgen-gallery/ngg-photoswipe.php+73
    Undefined index: nggphotoswipe_enabled
    • > GET request to /wp-admin/admin.php?page=photoswipe-for-nextgen-gallery/ngg-photoswipe.php
    • > Notice in wp-content/plugins/photoswipe-for-nextgen-gallery/ngg-photoswipe.php+77
    Undefined index: additional_viewers
    • > GET request to /wp-admin/admin.php?page=photoswipe-for-nextgen-gallery/ngg-photoswipe.php
    • > Warning in wp-content/plugins/photoswipe-for-nextgen-gallery/ngg-photoswipe.php+95
    Illegal string offset 'fancybox'
    • > GET request to /wp-admin/admin.php?page=photoswipe-for-nextgen-gallery/ngg-photoswipe.php
    • > Notice in wp-content/plugins/photoswipe-for-nextgen-gallery/ngg-photoswipe.php+95
    Uninitialized string offset: 0

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/photoswipe-for-nextgen-gallery/ngg-photoswipe.php:48

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Screenshots: These screenshots require images: #1 (Plugin options - Choose when Photoswipe should be applied.), #2 (New Gallery submenu), #3 (Result)
The official readme.txt is a good inspiration

photoswipe-for-nextgen-gallery/ngg-photoswipe.php 92% from 13 tests

"Photoswipe for NextGEN Gallery" version 1.2.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("photoswipe-for-nextgen-gallery.php" instead of "ngg-photoswipe.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected418 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript4217187
CSS13118154
PHP1182277

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.66MB with 0.34MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/photoswipe/images/icons@2x.png9.19KB5.50KB▼ 40.21%
screenshot-2.png6.86KB3.77KB▼ 45.00%
screenshot-1.png15.42KB6.28KB▼ 59.26%
lib/photoswipe/images/icons.png5.84KB3.80KB▼ 35.05%
screenshot-3.png637.47KB131.41KB▼ 79.39%