63% terms-and-conditions-per-product

Code Review | Terms & Conditions Per Product

WordPress plugin Terms & Conditions Per Product scored63%from 54 tests.

About plugin

  • Plugin page: terms-and-conditi...
  • Plugin version: 1.2.9
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4.1
  • WordPress version: 6.3.1
  • First release: May 27, 2020
  • Latest release: Nov 27, 2023
  • Number of updates: 37
  • Update frequency: every 34.7 days
  • Top authors: giannis4 (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

800+ active /9,447 total downloads

Benchmarks

Plugin footprint 48% 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.64MB] [CPU: ▲3.72ms] Passed 4 tests

A check of server-side resources used by Terms & Conditions Per Product
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.12 ▲0.6542.30 ▼1.06
Dashboard /wp-admin3.96 ▲0.6654.08 ▲2.45
Posts /wp-admin/edit.php4.01 ▲0.6657.03 ▲8.30
Add New Post /wp-admin/post-new.php6.50 ▲0.6198.74 ▲5.20
Media Library /wp-admin/upload.php3.88 ▲0.6543.08 ▲9.67
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius4.2543.94

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 221 new files
Database: 1 new table, 9 new options
New tables
wp_tacpp_accept_log
New WordPress options
widget_recent-posts
widget_recent-comments
fs_active_plugins
fs_debug_mode
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
fs_accounts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Terms & Conditions Per Product
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,863 ▲10114.69 ▲0.341.88 ▲0.1327.58 ▼12.04
Dashboard /wp-admin2,243 ▲665.56 ▼0.0298.37 ▲1.3846.52 ▲4.19
Posts /wp-admin/edit.php2,149 ▲492.14 ▲0.1841.50 ▼0.2240.41 ▲2.17
Add New Post /wp-admin/post-new.php1,560 ▲3123.21 ▼0.06665.23 ▲68.9170.52 ▲22.29
Media Library /wp-admin/upload.php1,445 ▲424.14 ▼0.0399.63 ▼0.9644.93 ▼1.30
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,0791.6827.6428.38

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/terms-and-conditions-per-product/freemius/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • Zombie tables detected upon uninstall: 1 table
    • wp_tacpp_accept_log
  • Zombie WordPress options detected upon uninstall: 9 options
    • widget_recent-comments
    • fs_accounts
    • widget_theysaidso_widget
    • fs_active_plugins
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • fs_debug_mode
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
Please fix the following items
  • 10× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/terms-and-conditions-per-product/templates/admin-tacpp-page.php:10
    • > PHP Warning
      Use of undefined constant TACPP4_PLUGIN_URL - assumed 'TACPP4_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/terms-and-conditions-per-product/templates/admin-header.php on line 10
    • > PHP Warning
      Use of undefined constant TACPP4_PLUGIN_PATH - assumed 'TACPP4_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/terms-and-conditions-per-product/templates/admin-tacpp-page.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/terms-and-conditions-per-product/templates/admin-header.php:11
    • > PHP Fatal error
      require_once(): Failed opening required 'TACPP4_PLUGIN_PATH/templates/admin-header.php' (include_path='.:/usr/share/php') in wp-content/plugins/terms-and-conditions-per-product/templates/admin-settings-page.php on line 5
    • > PHP Warning
      Use of undefined constant TACPP4_PLUGIN_PATH - assumed 'TACPP4_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/terms-and-conditions-per-product/templates/admin-settings-page.php on line 5
    • > PHP Warning
      include(TACPP4_PLUGIN_PATH/templates/admin-header.php): failed to open stream: No such file or directory in wp-content/plugins/terms-and-conditions-per-product/templates/admin-tacpp-page.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/terms-and-conditions-per-product/terms-per-product.php:42
    • > PHP Warning
      require_once(TACPP4_PLUGIN_PATH/templates/admin-header.php): failed to open stream: No such file or directory in wp-content/plugins/terms-and-conditions-per-product/templates/admin-settings-page.php on line 5
    • > PHP Warning
      include(): Failed opening 'TACPP4_PLUGIN_PATH/templates/admin-header.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/terms-and-conditions-per-product/templates/admin-tacpp-page.php on line 5

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: product, terms and conditions, woocommerce, terms of service, legal

terms-and-conditions-per-product/terms-per-product.php 85% from 13 tests

The principal PHP file in "Terms & Conditions Per Product" v. 1.2.9 is loaded by WordPress automatically on each request
The following require your attention:
  • Requires at least: Required version does not match the one declared in readme.txt ("5.4" instead of "6.0")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("terms-and-conditions-per-product.php" instead of "terms-per-product.php")

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
No dangerous file extensions were detected35,883 lines of code in 156 files:
LanguageFilesBlank linesComment linesLines of code
PHP1318,62417,90235,138
JavaScript773121274
CSS16476240
Markdown1680214
SVG10017

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please fix the following
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 3,096)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity78.82
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity4.55
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes59
▷ Abstract classes23.39%
▷ Concrete classes5796.61%
▷ Final classes00.00%
Methods1,344
▷ Static methods21816.22%
▷ Public methods93869.79%
▷ Protected methods171.26%
▷ Private methods38928.94%
Functions108
▷ Named functions10799.07%
▷ Anonymous functions10.93%
Constants153
▷ Global constants10568.63%
▷ Class constants4831.37%
▷ Public constants48100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
9 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/tacpp-avatar-100.png6.47KB3.28KB▼ 49.38%
assets/images/tacpp-avatar-32.png1.22KB0.94KB▼ 22.89%
assets/icon-128x128.png2.82KB2.11KB▼ 25.23%
assets/images/tacpp-avatar-64.png2.47KB1.71KB▼ 30.65%
assets/images/tacpp-avatar-20-bw.png0.71KB0.61KB▼ 13.66%