62% ds-simple-gallery

Code Review | DS Simple Gallery

WordPress plugin DS Simple Gallery scored 62% from 54 tests.

About plugin

  • Plugin page: ds-simple-gallery
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.7
  • WordPress version: 5.8.1
  • First release: Jul 23, 2015
  • Latest release: Dec 27, 2016
  • Number of updates: 6
  • Update frequency: every 87.3 days
  • Top authors: dswpsupport (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,336 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.67MB] [CPU: ▼174.95ms] Passed 4 tests

Analyzing server-side resources used by DS Simple Gallery
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.01 ▲0.1732.94 ▼0.65
Dashboard /wp-admin2.98 ▼0.0722.49 ▼23.69
Posts /wp-admin/edit.php2.98 ▼0.1321.46 ▼19.15
Add New Post /wp-admin/post-new.php2.98 ▼2.4520.60 ▼648.31
Media Library /wp-admin/upload.php2.98 ▼0.0221.93 ▼8.63
All Galleries /wp-admin/edit.php?post_type=gallery2.9823.25
Add New Gallery /wp-admin/post-new.php?post_type=gallery2.9824.08

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 86 new files
Database: no new tables, 2 new options
New WordPress options
wrsimplegallery
wrsg_optionsframework

Browser metrics Passed 4 tests

A check of browser resources used by DS Simple Gallery
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,149 ▲55316.41 ▲0.6914.95 ▲3.2145.14 ▼7.66
Dashboard /wp-admin3,123 ▲1926.20 ▲0.15170.74 ▲17.54106.25 ▼6.29
Posts /wp-admin/edit.php2,898 ▲1592.76 ▲0.0470.76 ▼0.5084.24 ▼12.33
Add New Post /wp-admin/post-new.php1,570 ▲7018.36 ▼0.45351.86 ▼44.01122.66 ▲7.54
Media Library /wp-admin/upload.php1,966 ▲1595.13 ▲0.11160.02 ▲3.71117.13 ▲8.92
All Galleries /wp-admin/edit.php?post_type=gallery1,5652.6874.7671.37
Add New Gallery /wp-admin/post-new.php?post_type=gallery2,0853.7793.1294.48

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/ds-simple-gallery/wp-gallery.php+121
    Invalid argument supplied for foreach()
  • This plugin did not uninstall successfully, leaving 2 options in the database
    • wrsimplegallery
    • wrsg_optionsframework

Smoke tests 25% 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
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=gallery
    • > Warning in wp-content/plugins/ds-simple-gallery/wp-gallery.php+121
    Invalid argument supplied for foreach()
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=gallery
    • > User notice in wp-includes/functions.php+5663
    register_post_type was called incorrectly. Post type names must be between 1 and 20 characters in length. Please see Debugging in WordPress for more information. (This message was added in version 4.2.0.)

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/ds-simple-gallery/admin/options-framework.php
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/ds-simple-gallery/wp-gallery.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/ds-simple-gallery/admin/options-sanitize.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/ds-simple-gallery/admin/options-medialibrary-uploader.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Donate link: Invalid url: ""
You can look at the official readme.txt

ds-simple-gallery/wp-gallery.php 92% from 13 tests

The principal PHP file in "DS Simple Gallery" v. 1.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("ds-simple-gallery.php" instead of "wp-gallery.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin2,213 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP63223191,169
CSS1347138767
JavaScript66571277

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity44.00
▷ Minimum class complexity44.00
▷ Maximum class complexity44.00
Average method complexity3.26
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods15.26%
▷ Public methods1578.95%
▷ Protected methods00.00%
▷ Private methods421.05%
Functions47
▷ Named functions47100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
47 PNG files occupy 0.19MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
colorbox/themes/theme8/images/overlay.png0.18KB0.15KB▼ 15.93%
colorbox/themes/theme7/images/controls.png2.83KB1.28KB▼ 54.82%
(invalid) colorbox/themes/theme7/style.png13.38KB0.00KB▼ 100.00%
colorbox/themes/theme1/images/overlay.png0.18KB0.15KB▼ 15.93%
colorbox/themes/theme8/images/border.png0.20KB0.20KB0.00%