78% wr-age-verification

Code Review | Wr Age Verification

WordPress plugin Wr Age Verification scored 78% from 54 tests.

About plugin

  • Plugin page: wr-age-verification
  • Plugin version: 2.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0.0-5.7
  • WordPress version: 5.8.1
  • First release: Jun 30, 2021
  • Latest release: Jul 10, 2021
  • Number of updates: 6
  • Update frequency: every 2.0 days
  • Top authors: robindkumar (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 236 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.11MB] [CPU: ▼182.38ms] Passed 4 tests

An overview of server-side resources used by Wr Age Verification
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.96 ▲0.1337.95 ▲12.83
Dashboard /wp-admin3.17 ▲0.1035.62 ▼9.71
Posts /wp-admin/edit.php3.28 ▲0.1736.38 ▲0.60
Add New Post /wp-admin/post-new.php5.53 ▲0.1075.00 ▼720.23
Media Library /wp-admin/upload.php3.11 ▲0.1124.89 ▼0.19
Add State /wp-admin/admin.php?page=add-state3.0622.00
Add Country /wp-admin/admin.php?page=add-country3.4427.67

Server storage [IO: ▲3.99MB] [DB: ▲0.02MB] Passed 3 tests

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 47 new files
Database: 2 new tables, no new options
New tables
wp_age_v_country
wp_age_v_settings

Browser metrics Passed 4 tests

An overview of browser requirements for Wr Age Verification
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,229 ▲62816.23 ▲0.678.79 ▲1.93147.04 ▲73.18
Dashboard /wp-admin2,964 ▲686.47 ▲0.29118.08 ▼15.73189.17 ▲19.28
Posts /wp-admin/edit.php2,775 ▲383.29 ▲0.0466.74 ▲3.01197.44 ▲50.94
Add New Post /wp-admin/post-new.php2,094 ▼1,71415.94 ▼2.82407.19 ▼43.58194.17 ▲32.06
Media Library /wp-admin/upload.php1,778 ▲265.93 ▲0.45130.23 ▼9.97212.42 ▲24.66
Add State /wp-admin/admin.php?page=add-state1,0352.7655.00105.53
Add Country /wp-admin/admin.php?page=add-country1,6072.7758.93139.60

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The plugin did not uninstall successfully, leaving 2 tables in the database
    • wp_age_v_country
    • wp_age_v_settings

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
    • > GET request to /wp-admin/admin.php?page=add-state
    • > Warning in wp-includes/class-wp-hook.php+303
    call_user_func_array() expects parameter 1 to be a valid callback, class 'Age_Verification_Admin' does not have a method 'display_plugin_state_page'

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 13× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/wr-age-verification/public/partials/age-verification-public-display-one.php:18
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/wr-age-verification/public/partials/age-verification-public-display-two.php:18
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/wr-age-verification/admin/partials/country-listing.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === wr-age-verification === )
The official readme.txt is a good inspiration

wr-age-verification/age-verification.php 92% from 13 tests

The main PHP script in "Wr Age Verification" version 2.0.0 is automatically included on every request by WordPress
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wr-age-verification.php" instead of "age-verification.php")

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
No dangerous file extensions were detected1,786 lines of code in 26 files:
LanguageFilesBlank linesComment linesLines of code
PHP171536581,467
JavaScript6965176
CSS3920143

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity6.38
▷ Minimum class complexity1.00
▷ Maximum class complexity16.00
Average method complexity2.02
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods42
▷ Static methods37.14%
▷ Public methods3788.10%
▷ Protected methods00.00%
▷ Private methods511.90%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
11 PNG files occupy 0.91MB with 0.60MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/template.png26.55KB11.48KB▼ 56.77%
Screenshot-4.png74.88KB25.77KB▼ 65.58%
Screenshot-5.png280.81KB99.67KB▼ 64.51%
public/images/dummy-logo.png27.23KB7.61KB▼ 72.05%
Screenshot-2.png85.72KB27.89KB▼ 67.46%