78% safe-svg

Code Review | Safe SVG

WordPress plugin Safe SVG scored78%from 54 tests.

About plugin

  • Plugin page: safe-svg
  • Plugin version: 2.2.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.7-6.4
  • WordPress version: 6.3.1
  • First release: Jul 3, 2015
  • Latest release: Nov 21, 2023
  • Number of updates: 77
  • Update frequency: every 39.8 days
  • Top authors: enshrined (87.01%)10up (14.29%)

Code review

54 tests

User reviews

69 reviews

Install metrics

800,000+ active /6,370,558 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.39MB] [CPU: ▼1.48ms] Passed 4 tests

An overview of server-side resources used by Safe SVG
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.4436.59 ▼3.23
Dashboard /wp-admin3.74 ▲0.3945.81 ▼16.12
Posts /wp-admin/edit.php3.79 ▲0.4352.90 ▲6.59
Add New Post /wp-admin/post-new.php6.26 ▲0.3797.55 ▲13.90
Media Library /wp-admin/upload.php3.60 ▲0.3741.01 ▲6.85

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Safe SVG
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7814.56 ▼0.151.78 ▼0.0239.55 ▼4.72
Dashboard /wp-admin2,202 ▲225.59 ▲0.0193.23 ▲1.7342.59 ▼0.99
Posts /wp-admin/edit.php2,103 ▲31.96 ▼0.0438.79 ▼2.2335.47 ▼3.15
Add New Post /wp-admin/post-new.php1,690 ▲16422.04 ▼1.05615.70 ▼74.0649.16 ▼4.13
Media Library /wp-admin/upload.php1,406 ▲34.27 ▲0.0496.09 ▲0.3939.73 ▼1.79

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/safe-svg/vendor/enshrined/svg-sanitize/src/svg-scanner.php
  • 173× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_Filter' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Filter/ExtractStyleBlocks.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrDef_Enum' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/FrameTarget.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrDef' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_Token_Tag' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Token/End.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrDef' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Number.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_Filter' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Filter/YouTube.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_URIFilter' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/URIFilter/DisableExternal.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrDef' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_HTMLModule' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/Object.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'HTMLPurifier_AttrDef_URI_IPv4' not found in wp-content/plugins/safe-svg/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/IPv6.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 97% 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
These attributes need to be fixed:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
You can take inspiration from this readme.txt

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

The main PHP file in "Safe SVG" ver. 2.2.2 adds more information about the plugin and also serves as the entry point for this plugin
94 characters long description:
Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website

Code Analysis 97% from 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 plugin19,979 lines of code in 288 files:
LanguageFilesBlank linesComment linesLines of code
PHP2743,60411,44819,557
JavaScript72639225
JSON200173
Sass12013
CSS33410
INI1111

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 232)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity13.39
▷ Minimum class complexity1.00
▷ Maximum class complexity539.00
Average method complexity4.70
▷ Minimum method complexity1.00
▷ Maximum method complexity232.00
Code structure
Namespaces12
Interfaces2
Traits0
Classes254
▷ Abstract classes155.91%
▷ Concrete classes23994.09%
▷ Final classes00.00%
Methods882
▷ Static methods738.28%
▷ Public methods68777.89%
▷ Protected methods11012.47%
▷ Private methods859.64%
Functions23
▷ Named functions1252.17%
▷ Anonymous functions1147.83%
Constants67
▷ Global constants811.94%
▷ Class constants5988.06%
▷ Public constants59100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin