10% spartan-gallery

Code Review | Spartan Gallery

WordPress plugin Spartan Gallery scored 10% from 54 tests.

About plugin

  • Plugin page: spartan-gallery
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.0.0
  • WordPress version: 5.8.1
  • First release: Apr 24, 2018
  • Latest release: Aug 26, 2019
  • Number of updates: 37
  • Update frequency: every 13.2 days
  • Top authors: freelancermartin (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,759 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Warning in wp-content/plugins/spartan-gallery/admin/exopite-simple-options/fields-class.php+290
    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Server metrics [RAM: ▼1.43MB] [CPU: ▼188.15ms] Passed 4 tests

Server-side resources used by Spartan Gallery
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.44 ▲0.6146.73 ▲10.08
Dashboard /wp-admin2.23 ▼0.836.83 ▼42.88
Posts /wp-admin/edit.php2.23 ▼0.896.72 ▼51.27
Add New Post /wp-admin/post-new.php2.23 ▼3.217.28 ▼636.63
Media Library /wp-admin/upload.php2.23 ▼0.7810.74 ▼21.83
Export Gallery /wp-admin/edit.php?post_type=spartan_gallery_type&page=wbc-export-posts2.237.41
Import Gallery /wp-admin/edit.php?post_type=spartan_gallery_type&page=wbc-import-posts2.237.60
Add New /wp-admin/post-new.php?post_type=spartan_gallery_type2.2310.30
Welcome Page /wp-admin/edit.php?post_type=spartan_gallery_type&page=wpw_welcome_page2.2323.31
All Spartan Gallerys /wp-admin/edit.php?post_type=spartan_gallery_type2.238.95

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 579 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Spartan Gallery
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,989 ▲35217.04 ▲1.3720.39 ▲11.6246.25 ▼12.62
Dashboard /wp-admin3,028 ▲976.10 ▼0.06142.43 ▼26.00109.81 ▼16.12
Posts /wp-admin/edit.php2,780 ▲412.70 ▲0.0169.72 ▼4.8394.98 ▼7.66
Add New Post /wp-admin/post-new.php1,657 ▲7621.44 ▲0.99284.80 ▼132.53136.07 ▲22.44
Media Library /wp-admin/upload.php1,867 ▲575.27 ▲0.25149.81 ▼7.07133.75 ▲8.05
Export Gallery /wp-admin/edit.php?post_type=spartan_gallery_type&page=wbc-export-posts1,0482.3856.4957.46
Import Gallery /wp-admin/edit.php?post_type=spartan_gallery_type&page=wbc-import-posts1,0482.3958.6760.21
Add New /wp-admin/post-new.php?post_type=spartan_gallery_type4,5866.89210.99187.63
Welcome Page /wp-admin/edit.php?post_type=spartan_gallery_type&page=wpw_welcome_page1,4907.02279.36203.57
All Spartan Gallerys /wp-admin/edit.php?post_type=spartan_gallery_type1,4752.6365.5779.93

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Uninstall procedure validation failed for this plugin
    • > Warning in wp-content/plugins/spartan-gallery/admin/exopite-simple-options/fields-class.php+290
    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

Smoke tests 0% 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
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=spartan_gallery_type
    • > POST request to /wp-admin/admin-ajax.php
    • > Warning in wp-content/plugins/spartan-gallery/admin/exopite-simple-options/fields-class.php+290
    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
    • > GET request to /wp-admin/post-new.php?post_type=spartan_gallery_type
    • > Notice in wp-content/plugins/spartan-gallery/admin/exopite-simple-options/exopite-simple-options-framework-class.php+1077
    Undefined index: spartan-gallery-meta

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 4× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/spartan-gallery/public/spartan-gallery-styles.php
    • > /wp-content/plugins/spartan-gallery/public/custom-columns.php
    • > /wp-content/plugins/spartan-gallery/public/partials/spartan-gallery-public-display.php
    • > /wp-content/plugins/spartan-gallery/public/popup.php
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function PostType\\add_action() in wp-content/plugins/spartan-gallery/admin/class-spartan-gallery-post-type.php:89
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/spartan-gallery/admin/exopite-simple-options/fields-class.php on line 290
    • > PHP Fatal error
      Uncaught Error: Call to undefined function did_action() in wp-content/plugins/spartan-gallery/public/tgm/class-tgm-plugin-activation.php:2109
    • > PHP Fatal error
      Uncaught Error: Call to undefined function did_action() in wp-content/plugins/spartan-gallery/public/tgm/class-tgm-plugin-activation.php:2109
    • > PHP Fatal error
      Uncaught Error: Call to undefined function did_action() in wp-content/plugins/spartan-gallery/public/tgm/class-tgm-plugin-activation.php:2109

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please take a look at the following user-side issues
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=spartan_gallery_type
    • > Console-api (warning) in wp-admin/js/common.min.js?ver=5.8.1+1:283
    wpColorPickerL10n.defaultLabel is deprecated since version 5.5.0! Use wp.i18n instead.
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=spartan_gallery_type
    • > Console-api (warning) in wp-admin/js/common.min.js?ver=5.8.1+1:283
    wpColorPickerL10n.pick is deprecated since version 5.5.0! Use wp.i18n instead.
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=spartan_gallery_type
    • > Console-api (warning) in wp-admin/js/common.min.js?ver=5.8.1+1:283
    wpColorPickerL10n.clear is deprecated since version 5.5.0! Use wp.i18n instead.
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=spartan_gallery_type
    • > Console-api (warning) in wp-admin/js/common.min.js?ver=5.8.1+1:283
    wpColorPickerL10n.clearAriaLabel is deprecated since version 5.5.0! Use wp.i18n instead.
    • > GET request to /wp-admin/edit.php?post_type=spartan_gallery_type&page=wpw_welcome_page
    • > Network (severe)
    var/www/wordpress/wp-content/plugins/spartan-gallery/admin/class-spartan-gallery-welcome-dashboard.php/welcome/css/style.css?ver=/var/www/wordpress/wp-content/plugins/spartan-gallery/admin/class-spartan-gallery-welcome-dashboard.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/edit.php?post_type=spartan_gallery_type&page=wpw_welcome_page
    • > Deprecation (warning) in unknown
    deprecation 0 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% 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 (Banner for plugin), #2 (Banner for plugin smaller), #3 (Spartan Gallery logo), #4 (Layout Example 1), #5 (Layout Example 2)
  • Screenshots: A description for screenshot #12 is required in spartan-gallery/assets to your readme.txt
You can take inspiration from this readme.txt

spartan-gallery/spartan-gallery.php Passed 13 tests

The principal PHP file in "Spartan Gallery" v. 1.0.0 is loaded by WordPress automatically on each request
96 characters long description:
This is a short description of what the plugin does. It's displayed in the WordPress admin area.

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
No dangerous file extensions were detected28,840 lines of code in 519 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript4201,5418,6709,382
PHP622,6134,0616,624
CSS17119875,039
PO File171,4491,9934,842
SVG2002,672
Markdown1580281

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity19.00
▷ Minimum class complexity1.00
▷ Maximum class complexity235.00
Average method complexity4.23
▷ Minimum method complexity1.00
▷ Maximum method complexity63.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes56
▷ Abstract classes11.79%
▷ Concrete classes5598.21%
▷ Final classes00.00%
Methods306
▷ Static methods4013.07%
▷ Public methods26185.29%
▷ Protected methods3812.42%
▷ Private methods72.29%
Functions27
▷ Named functions2696.30%
▷ Anonymous functions13.70%
Constants4
▷ Global constants125.00%
▷ Class constants375.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
23 compressed PNG files occupy 1.81MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/spartan-logo.png163.51KB76.05KB▼ 53.49%
admin/exopite-simple-options/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
admin/exopite-simple-options/assets/images/ui-icons_454545_256x240.png4.27KB4.11KB▼ 3.78%
admin/exopite-simple-options/assets/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
admin/exopite-simple-options/assets/images/ui-icons_bf3030_256x240.png4.27KB4.11KB▼ 3.78%