78% universal-star-rating

Code Review | Universal Star Rating

WordPress plugin Universal Star Rating scored 78% from 54 tests.

About plugin

  • Plugin page: universal-star-ra...
  • Plugin version: 2.1.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.7.2
  • WordPress version: 5.9.2
  • First release: Jun 20, 2013
  • Latest release: Jul 2, 2021
  • Number of updates: 98
  • Update frequency: every 29.9 days
  • Top authors: Chasil (100%)

Code review

54 tests

User reviews

33 reviews

Install metrics

5,000+ active / 93,118 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.17MB] [CPU: ▼290.43ms] Passed 4 tests

An overview of server-side resources used by Universal Star Rating
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.75 ▲0.2356.95 ▲1.89
Dashboard /wp-admin3.57 ▲0.1634.18 ▲0.57
Posts /wp-admin/edit.php3.81 ▲0.1639.11 ▲2.53
Add New Post /wp-admin/post-new.php7.11 ▲0.1494.71 ▼1,165.23
Media Library /wp-admin/upload.php3.52 ▲0.2226.73 ▲1.04
Universal Star Rating /wp-admin/options-general.php?page=Universal-Star-Rating3.4924.75

Server storage [IO: ▲0.94MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
Please try to fix the following items
  • There were 6 files (0.00KB) illegally modified outside of "wp-content/plugins/universal-star-rating/" and "wp-content/uploads/"
    • (new file) wp-content/cusri/80/.empty
    • (new file) wp-content/cusri/40/.empty
    • (new file) wp-content/cusri/20/.empty
    • (new file) wp-content/cusri/60/.empty
    • (new file) wp-content/cusri/100/.empty
    • (new file) wp-content/cusri/189/.empty
Filesystem: 97 new files
Database: no new tables, 14 new options
New WordPress options
usrCalcAverage
usrTextSize
usrTextOutput
usrImageSize
usrVersion
usrLang
usrMaxRating
usrTextAsTooltip
usrTextModification
usrImage
...

Browser metrics Passed 4 tests

Universal Star Rating: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,794 ▲5016.01 ▲0.027.13 ▲0.393.09 ▲0.88
Dashboard /wp-admin2,899 ▲416.09 ▼0.12120.98 ▼13.95157.81 ▼5.38
Posts /wp-admin/edit.php2,698 ▲43.24 ▲0.0162.48 ▼3.51141.15 ▼3.03
Add New Post /wp-admin/post-new.php1,765 ▲12622.14 ▲0.76410.32 ▼1.30157.30 ▲11.41
Media Library /wp-admin/upload.php1,699 ▲15.54 ▲0.03138.05 ▲0.12188.88 ▲3.39
Universal Star Rating /wp-admin/options-general.php?page=Universal-Star-Rating1,5682.4652.05151.69

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 14 options in the database
    • usrVersion
    • usrTextOutput
    • usrLang
    • usrTextAsTooltip
    • usrImageSize
    • usrTextModification
    • usrAllowInComments
    • usrSchemaOrgType
    • usrMaxRating
    • usrTextSize
    • ...

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)
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/universal-star-rating/includes/image.php
    • > /wp-content/plugins/universal-star-rating/includes/templates/settings.content.php
  • 19× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/universal-star-rating/includes/templates/settings.content.preview.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/universal-star-rating/includes/functions/func.addCSS.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/universal-star-rating/includes/functions/func.insertSingleRating.php:68
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/universal-star-rating/includes/functions/func.initUsrAdmin.php:22
    • > PHP Notice
      Undefined variable: usr in wp-content/plugins/universal-star-rating/includes/templates/settings.headline.php on line 19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/universal-star-rating/includes/templates/settings.content.description.php:20
    • > PHP Notice
      Undefined variable: usr in wp-content/plugins/universal-star-rating/includes/templates/settings.footer.php on line 15
    • > PHP Notice
      Undefined variable: activeTab in wp-content/plugins/universal-star-rating/includes/templates/settings.content.php on line 27
    • > PHP Fatal error
      Uncaught Error: Call to a member function getPluginName() on null in wp-content/plugins/universal-star-rating/includes/templates/settings.headline.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/universal-star-rating/includes/functions/func.loadTextDomain.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: stars, shortcodes, books, rating, reviews...

universal-star-rating/universal-star-rating.php 92% from 13 tests

This is the main PHP file of "Universal Star Rating" version 2.1.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 145 characters long)

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
Good job! No executable or dangerous file extensions detected9,506 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
SVG1007,688
PHP242207971,537
PO File15474169
CSS1125112

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity21.67
▷ Minimum class complexity15.00
▷ Maximum class complexity32.00
Average method complexity1.72
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods86
▷ Static methods00.00%
▷ Public methods8598.84%
▷ Protected methods00.00%
▷ Private methods11.16%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
66 PNG files occupy 0.22MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/100/06.png3.22KB2.33KB▼ 27.72%
images/40/02.png1.77KB0.89KB▼ 49.45%
images/60/02.png2.15KB1.17KB▼ 45.34%
images/20/06.png1.01KB1.09KB0.00%
images/100/09.png5.86KB5.01KB▼ 14.38%