78% svg-support

Code Review | SVG Support

WordPress plugin SVG Support scored78%from 54 tests.

About plugin

  • Plugin page: svg-support
  • Plugin version: 2.5.5
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-6.1.1
  • WordPress version: 6.3.1
  • First release: Jul 22, 2014
  • Latest release: Dec 13, 2022
  • Number of updates: 193
  • Update frequency: every 15.9 days
  • Top authors: Benbodhi (100%)

Code review

54 tests

User reviews

316 reviews

Install metrics

1,000,000+ active /7,277,785 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.36MB] [CPU: ▼1.87ms] Passed 4 tests

This is a short check of server-side resources used by SVG Support
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3739.44 ▼4.13
Dashboard /wp-admin3.70 ▲0.4048.34 ▲1.05
Posts /wp-admin/edit.php3.75 ▲0.3950.98 ▲1.83
Add New Post /wp-admin/post-new.php6.24 ▲0.3581.46 ▼6.21
Media Library /wp-admin/upload.php3.56 ▲0.3338.24 ▲5.87
SVG Support /wp-admin/options-general.php?page=svg-support3.6838.08

Server storage [IO: ▲2.52MB] [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: 110 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
widget_recent-comments
bodhi_svgs_plugin_version
widget_recent-posts
can_compress_scripts
bodhi_svgs_settings
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for SVG Support
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,813 ▲5613.27 ▼0.971.62 ▼0.9137.07 ▼13.30
Dashboard /wp-admin2,216 ▲254.94 ▲0.11108.36 ▲6.4738.14 ▼5.82
Posts /wp-admin/edit.php2,105 ▲132.10 ▲0.1340.72 ▲1.6936.79 ▲0.19
Add New Post /wp-admin/post-new.php1,542 ▲2823.49 ▲5.90660.25 ▲58.9772.08 ▲22.63
Media Library /wp-admin/upload.php1,400 ▲124.27 ▲0.0397.09 ▼2.2941.76 ▼2.02
SVG Support /wp-admin/options-general.php?page=svg-support2,0911.8730.0850.10

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • bodhi_svgs_settings
    • db_upgraded
    • bodhi_svgs_plugin_version
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/src/svg-scanner.php
  • 10× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      array_values() expects parameter 1 to be array, null given in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/src/svg-scanner.php on line 70
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/tests/AllowedAttributesTest.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'enshrined\\svgSanitize\\data\\AttributeInterface' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/tests/Fixtures/TestAllowedAttributes.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/tests/SanitizerTest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/tests/SubjectTest.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'enshrined\\svgSanitize\\data\\TagInterface' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/src/data/AllowedTags.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'enshrined\\svgSanitize\\data\\AttributeInterface' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/src/data/AllowedAttributes.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/svg-support/admin/svgs-settings-page.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/tests/AllowedTagsTest.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'enshrined\\svgSanitize\\data\\TagInterface' not found in wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/tests/Fixtures/TestAllowedTags.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 23 tag instead of maximum 10
You can look at the official readme.txt

svg-support/svg-support.php Passed 13 tests

"SVG Support" version 2.5.5's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
138 characters long description:
Upload SVG files to the Media Library and render SVG files inline for direct styling/animation of an SVG's internal elements using CSS/JS.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin106,741 lines of code in 100 files:
LanguageFilesBlank linesComment linesLines of code
SVG2420,0408100,749
PHP439841,1153,232
JavaScript125394521,698
Sass5559423
PO File210296367
JSON20088
HTML147056
Markdown143049
XML35039
YAML212535
CSS5005

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity7.09
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.11
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces8
Interfaces2
Traits0
Classes21
▷ Abstract classes00.00%
▷ Concrete classes21100.00%
▷ Final classes00.00%
Methods131
▷ Static methods2418.32%
▷ Public methods10983.21%
▷ Protected methods2116.03%
▷ Private methods10.76%
Functions45
▷ Named functions4293.33%
▷ Anonymous functions36.67%
Constants3
▷ Global constants266.67%
▷ Class constants133.33%
▷ Public constants1100.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
2 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
svg-support.png37.32KB17.57KB▼ 52.93%
admin/img/shortpixel.png3.29KB3.33KB0.00%