77% mp3-music-player-by-sonaar

Code Review | MP3 Audio Player for Music, Radio & Podcast by Sonaar

WordPress plugin MP3 Audio Player for Music, Radio & Podcast by Sonaar scored77%from 54 tests.

About plugin

  • Plugin page: mp3-music-player-...
  • Plugin version: 4.10.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Apr 27, 2018
  • Latest release: Nov 14, 2023
  • Number of updates: 79
  • Update frequency: every 25.7 days
  • Top authors: sonaar (100%)

Code review

54 tests

User reviews

220 reviews

Install metrics

20,000+ active /455,080 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
Installer ran successfully

Server metrics [RAM: ▲0.76MB] [CPU: ▲6.67ms] Passed 4 tests

This is a short check of server-side resources used by MP3 Audio Player for Music, Radio & Podcast by Sonaar
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.84 ▲0.3852.58 ▲17.43
Dashboard /wp-admin4.09 ▲0.7558.14 ▼4.53
Posts /wp-admin/edit.php4.52 ▲1.1773.29 ▲23.13
Add New Post /wp-admin/post-new.php7.15 ▲1.2690.52 ▼0.34
Media Library /wp-admin/upload.php4.00 ▲0.7750.23 ▲14.13
Stats & Reports /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_stats4.2648.81
Tools /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_tools4.2551.84
Categories /wp-admin/edit-tags.php?taxonomy=playlist-category&post_type=sr_playlist4.2652.39
Sticky Player Settings /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_sticky_player4.2653.85
Share a Track /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_share4.2952.12
Tags /wp-admin/edit-tags.php?taxonomy=playlist-tag&post_type=sr_playlist4.2652.95
Popup Settings /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_popup4.2551.05
Favorites /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_favorites4.2549.87
Add New /wp-admin/post-new.php?post_type=sr_playlist7.4691.68
All Playlists /wp-admin/edit.php?post_type=sr_playlist4.3059.45

Server storage [IO: ▲16.51MB] [DB: ▲0.08MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 628 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
sonaar_music_show_review_box_after
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_sonaar-music
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for MP3 Audio Player for Music, Radio & Podcast by Sonaar
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,889 ▲14214.35 ▼0.012.02 ▲0.5044.54 ▲3.10
Dashboard /wp-admin2,266 ▲885.73 ▲0.0493.66 ▼20.7745.58 ▲6.15
Posts /wp-admin/edit.php2,845 ▲7453.77 ▲1.7499.26 ▲63.6134.58 ▲2.68
Add New Post /wp-admin/post-new.php6,945 ▲5,41929.50 ▲5.87847.40 ▲170.1034.08 ▼15.94
Media Library /wp-admin/upload.php1,465 ▲654.26 ▲0.0794.90 ▼1.2945.26 ▲1.26
Stats & Reports /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_stats1,6483.5654.5148.42
Tools /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_tools1,6123.5149.0730.97
Categories /wp-admin/edit-tags.php?taxonomy=playlist-category&post_type=sr_playlist2,0193.5752.6632.14
Sticky Player Settings /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_sticky_player1,7983.5648.5262.26
Share a Track /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_share1,7383.4949.0833.56
Tags /wp-admin/edit-tags.php?taxonomy=playlist-tag&post_type=sr_playlist2,0223.5850.8230.77
Popup Settings /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_popup1,8023.6650.2879.22
Favorites /wp-admin/edit.php?post_type=sr_playlist&page=srmp3_settings_favorites1,6203.4652.2728.76
Add New /wp-admin/post-new.php?post_type=sr_playlist8,85020.67923.6288.82
All Playlists /wp-admin/edit.php?post_type=sr_playlist1,9333.7252.1832.38

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_recent-posts
    • sonaar_music_show_review_box_after
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_sonaar-music
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/mp3-music-player-by-sonaar/public/partials/sonaar-music-public-display.php
  • 62× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2-conditionals/example-functions.php:28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2/example-functions.php:105
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup' not found in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2/includes/CMB2_Options_Hookup.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2-store-list/song-store-field-type.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/mp3-music-player-by-sonaar/admin/partials/sonaar-music-admin-display.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Select' not found in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2/includes/types/CMB2_Type_Taxonomy_Select_Hierarchical.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2/includes/types/CMB2_Type_Checkbox.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2/includes/types/CMB2_Type_Counter_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2/includes/types/CMB2_Type_Text_Date.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mp3-music-player-by-sonaar/admin/library/cmb2-image-select-field-type/image_select_metafield.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Tags: You are using too many tags: 13 tag instead of maximum 10
You can look at the official readme.txt

mp3-music-player-by-sonaar/sonaar-music.php 85% from 13 tests

The entry point to "MP3 Audio Player for Music, Radio & Podcast by Sonaar" version 4.10.1 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("mp3-music-player-by-sonaar.php" instead of "sonaar-music.php")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected153,250 lines of code in 397 files:
LanguageFilesBlank linesComment linesLines of code
SVG3455838,324
PHP1024,3118,47134,832
PO File12014,31518,50232,323
CSS383,5031,47616,398
JavaScript341,4131,00712,597
Sass481,1651139,687
JSON7007,513
Markdown1136101,165
HTML191402
XML1428
YAML1001

PHP code 0% from 2 tests

An overview of cyclomatic complexity and code structure
The following items need your attention
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 1,425)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 707)
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity47.13
▷ Minimum class complexity1.00
▷ Maximum class complexity1,425.00
Average method complexity6.52
▷ Minimum method complexity1.00
▷ Maximum method complexity707.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes92
▷ Abstract classes99.78%
▷ Concrete classes8390.22%
▷ Final classes11.20%
Methods774
▷ Static methods12215.76%
▷ Public methods62981.27%
▷ Protected methods9512.27%
▷ Private methods506.46%
Functions79
▷ Named functions7493.67%
▷ Anonymous functions56.33%
Constants35
▷ Global constants2057.14%
▷ Class constants1542.86%
▷ Public constants15100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
27 PNG files occupy 0.71MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/library/cmb2-post-search-field/post-search-field.png18.07KB5.58KB▼ 69.11%
admin/library/cmb2/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
admin/library/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
admin/library/cmb2-field-faiconselect/screenshot-1.png28.57KB8.58KB▼ 69.96%
admin/library/cmb2/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%