78% content-warning-v2

Code Review | Agy - Age verification for WooCommerce

WordPress plugin Agy - Age verification for WooCommerce scored 78% from 54 tests.

About plugin

  • Plugin page: content-warning-v2
  • Plugin version: 4.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.9
  • WordPress version: 5.9.2
  • First release: Oct 11, 2011
  • Latest release: Mar 10, 2022
  • Number of updates: 228
  • Update frequency: every 16.7 days
  • Top authors: Phyrax (72.81%)patrickposner (27.63%)

Code review

54 tests

User reviews

38 reviews

Install metrics

4,000+ active / 141,377 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▼0.02MB] [CPU: ▼302.94ms] Passed 4 tests

An overview of server-side resources used by Agy - Age verification for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0158.30 ▲8.81
Dashboard /wp-admin3.41 ▲0.0132.17 ▼1.13
Posts /wp-admin/edit.php3.64 ▲0.0136.21 ▼1.28
Add New Post /wp-admin/post-new.php6.91 ▼0.0991.36 ▼1,207.98
Media Library /wp-admin/upload.php3.30 ▲0.0022.57 ▼1.37

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 248 new files
Database: no new tables, 4 new options
New WordPress options
fs_accounts
fs_active_plugins
fs_gdpr
fs_debug_mode

Browser metrics Passed 4 tests

Agy - Age verification for WooCommerce: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4115.53 ▼0.066.56 ▼0.282.76 ▲0.08
Dashboard /wp-admin2,892 ▲316.17 ▼0.01126.06 ▼16.93161.12 ▼8.06
Posts /wp-admin/edit.php2,694 ▼03.24 ▼0.0063.38 ▼3.49146.47 ▲0.48
Add New Post /wp-admin/post-new.php1,661 ▼1116.68 ▼5.39433.07 ▲30.85163.84 ▲4.57
Media Library /wp-admin/upload.php1,695 ▼35.50 ▼0.02144.32 ▲10.67191.19 ▲8.76

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 4 options in the database
    • fs_accounts
    • fs_gdpr
    • fs_debug_mode
    • fs_active_plugins

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 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/content-warning-v2/src/templates/accept-age.php
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/content-warning-v2/content-warning-v2.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 96% 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
6 plugin tags: content warning, age verification, age restriction, age gate, page gate...

content-warning-v2/content-warning-v2.php 92% from 13 tests

The main file in "Agy - Age verification for WooCommerce" v. 4.3.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.6" instead of "4.5")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin51,139 lines of code in 197 files:
LanguageFilesBlank linesComment linesLines of code
PHP1257,48916,76632,461
PO File137,1118,72915,496
Sass28399772,515
CSS17301310
JavaScript95776289
JSON20028
Markdown17022
XML10017
SVG1001

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity77.47
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity4.54
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes55
▷ Abstract classes23.64%
▷ Concrete classes5396.36%
▷ Final classes00.00%
Methods1,218
▷ Static methods18615.27%
▷ Public methods87772.00%
▷ Protected methods151.23%
▷ Private methods32626.77%
Functions102
▷ Named functions10098.04%
▷ Anonymous functions21.96%
Constants125
▷ Global constants10080.00%
▷ Class constants2520.00%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
inc/freemius/assets/img/content-warning-v2.png9.16KB5.26KB▼ 42.58%
inc/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%