77% sell-media

Code Review | Sell Media

WordPress plugin Sell Media scored77%from 54 tests.

About plugin

  • Plugin page: sell-media
  • Plugin version: 2.5.8.3
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2.1-6.3.1
  • WordPress version: 6.3.1
  • First release: Nov 1, 2012
  • Latest release: Oct 11, 2023
  • Number of updates: 331
  • Update frequency: every 12.1 days
  • Top authors: endortrails (67.67%)ZaneMatthew (32.63%)

Code review

54 tests

User reviews

45 reviews

Install metrics

600+ active /131,704 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲3.15MB] [CPU: ▲24.44ms] 75% from 4 tests

This is a short check of server-side resources used by Sell Media
It is recommended to improve the following
  • CPU: Total CPU usage must kept under 500.00ms (currently 500.07ms on /wp-admin/post-new.php?post_type=sell_media_item)
PageMemory (MB)CPU Time (ms)
Home /6.31 ▲2.8572.91 ▲32.84
Dashboard /wp-admin6.56 ▲3.25111.46 ▲64.07
Posts /wp-admin/edit.php6.61 ▲3.2568.27 ▲19.40
Add New Post /wp-admin/post-new.php9.53 ▲3.64109.32 ▲14.46
Media Library /wp-admin/upload.php6.50 ▲3.2667.52 ▲31.05
Collections /wp-admin/edit-tags.php?taxonomy=collection&post_type=sell_media_item6.5257.59
Upgrades /wp-admin/edit.php?post_type=sell_media_item&page=sell_media_upgrades6.2951.83
Add New /wp-admin/post-new.php?post_type=sell_media_item6.73500.07
Licenses /wp-admin/edit-tags.php?taxonomy=licenses&post_type=sell_media_item6.4765.47
Keywords /wp-admin/edit-tags.php?taxonomy=keywords&post_type=attachment6.4758.06
Reports /wp-admin/edit.php?post_type=sell_media_item&page=sell_media_reports6.4894.49
All Products /wp-admin/edit.php?post_type=sell_media_item6.5664.08
Payments /wp-admin/edit.php?post_type=sell_media_payment6.5554.88
Pricing /wp-admin/edit.php?post_type=sell_media_item&page=pricelists6.5257.56
Settings /wp-admin/edit.php?post_type=sell_media_item&page=sell_media_plugin_options6.4657.32

Server storage [IO: ▲3.26MB] [DB: ▲0.01MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Please fix the following
  • Illegal file modification found: 1 file (0.63KB) outside of "wp-content/plugins/sell-media/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 417 new files
Database: no new tables, 17 new options
New WordPress options
can_compress_scripts
widget_sell_media_similar_widget
widget_sell_media_image_exif_widget
widget_recent-comments
price-group_children
sell_media_keywords_migrated
widget_sell_media_keywords_widget
sell_media_default_pricelists_saved_price-group
widget_sell_media_recent_widget
widget_recent-posts
...

Browser metrics Passed 4 tests

A check of browser resources used by Sell Media
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,012 ▲25113.56 ▼0.8013.59 ▲11.9747.19 ▲6.48
Dashboard /wp-admin2,259 ▲795.66 ▲0.0193.53 ▲6.7242.94 ▼0.98
Posts /wp-admin/edit.php2,163 ▲632.05 ▲0.1135.45 ▼0.1830.27 ▼7.19
Add New Post /wp-admin/post-new.php6,469 ▲4,94328.94 ▲5.58927.22 ▲264.3739.45 ▼13.77
Media Library /wp-admin/upload.php1,477 ▲744.17 ▼0.0197.60 ▼9.4144.10 ▼4.58
Collections /wp-admin/edit-tags.php?taxonomy=collection&post_type=sell_media_item1,5883.2748.3731.88
Upgrades /wp-admin/edit.php?post_type=sell_media_item&page=sell_media_upgrades1,25010.16548.37111.01
Add New /wp-admin/post-new.php?post_type=sell_media_item2,9518.01223.9254.26
Licenses /wp-admin/edit-tags.php?taxonomy=licenses&post_type=sell_media_item1,4211.9329.6432.85
Keywords /wp-admin/edit-tags.php?taxonomy=keywords&post_type=attachment1,3282.2427.5430.13
Reports /wp-admin/edit.php?post_type=sell_media_item&page=sell_media_reports1,5726.7462.9660.94
All Products /wp-admin/edit.php?post_type=sell_media_item1,2342.3442.8531.46
Payments /wp-admin/edit.php?post_type=sell_media_payment1,1321.9734.8030.42
Pricing /wp-admin/edit.php?post_type=sell_media_item&page=pricelists1,0932.6044.9625.20
Settings /wp-admin/edit.php?post_type=sell_media_item&page=sell_media_plugin_options1,7662.4842.9538.32

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The uninstall procedure has failed, leaving 17 options in the database
    • sell_media_options
    • widget_recent-posts
    • widget_sell_media_image_exif_widget
    • widget_sell_media_search_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • price-group_children
    • widget_sell_media_recent_widget
    • can_compress_scripts
    • widget_theysaidso_widget
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/sell-media/inc/widgets/sell-media-search.php
  • 129× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/sebastian/comparator/tests/DOMNodeComparatorTest.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'PayPalHttp\\Serializer' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/paypal/paypalhttp/lib/PayPalHttp/Serializer/Form.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'PayPalHttp\\Serializer' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/paypal/paypalhttp/lib/PayPalHttp/Serializer/Text.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PayPalHttp\\HttpRequest' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/lib/PayPalCheckoutSdk/Orders/OrdersCaptureRequest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/sebastian/diff/tests/DifferTest.php:27
    • > PHP Fatal error
      Uncaught Error: Interface 'SebastianBergmann\\Diff\\LCS\\LongestCommonSubsequence' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/sebastian/diff/src/LCS/TimeEfficientLongestCommonSubsequenceImplementation.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sell-media/inc/settings/settings.php:58
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Yaml\\Exception\\RuntimeException' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/symfony/yaml/Exception/ParseException.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'SebastianBergmann\\RecursionContext\\Exception' not found in wp-content/plugins/sell-media/inc/gateways/php-paypal-sdk/vendor/sebastian/recursion-context/src/InvalidArgumentException.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/sell-media/inc/widgets/sell-media-recent.php:1

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 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Tags: There are too many tags (13 tag instead of maximum 10)
Please take inspiration from this readme.txt

sell-media/sell-media.php 77% from 13 tests

"Sell Media" version 2.5.8.3'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:
  • Text Domain: Please use dashes and lowercase characters for text domains
  • Domain Path: Prefix the domain path with a forward slash character ("/languages")
  • Domain Path: Use only dashes and lowercase characters for the domain path ("languages")

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
Good job! No executable or dangerous file extensions detected52,619 lines of code in 377 files:
LanguageFilesBlank linesComment linesLines of code
PHP2655,1399,17225,254
PO File96,47110,29415,205
CSS93541313,396
JavaScript174483902,780
Sass233532,323
JSON18602,122
Markdown204140859
XML11130218
Ant9330205
YAML10471164
SVG60691
Ruby1002

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 129)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity11.93
▷ Minimum class complexity1.00
▷ Maximum class complexity310.00
Average method complexity3.27
▷ Minimum method complexity1.00
▷ Maximum method complexity129.00
Code structure
Namespaces35
Interfaces12
Traits1
Classes204
▷ Abstract classes31.47%
▷ Concrete classes20198.53%
▷ Final classes83.98%
Methods1,059
▷ Static methods979.16%
▷ Public methods85480.64%
▷ Protected methods868.12%
▷ Private methods11911.24%
Functions299
▷ Named functions28093.65%
▷ Anonymous functions196.35%
Constants93
▷ Global constants88.60%
▷ Class constants8591.40%
▷ Public constants85100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/chosen-sprite.png0.63KB0.88KB0.00%
images/cart.png0.96KB0.12KB▼ 87.88%
images/chosen-sprite@2x.png0.85KB0.83KB▼ 3.10%