62% zip-code-based-content-protection

Code Review | ZIP Code Based Content Protection

WordPress plugin ZIP Code Based Content Protection scored62%from 54 tests.

About plugin

  • Plugin page: zip-code-based-co...
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jun 22, 2021
  • Latest release: Aug 10, 2023
  • Number of updates: 7
  • Update frequency: every 112.0 days
  • Top authors: PressTigers (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,209 total downloads

Benchmarks

Plugin footprint 65% 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.27MB] [CPU: ▼11.46ms] Passed 4 tests

An overview of server-side resources used by ZIP Code Based Content Protection
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.4459.51 ▲14.51
Dashboard /wp-admin3.76 ▲0.4656.32 ▼3.52
Posts /wp-admin/edit.php3.79 ▲0.4455.30 ▲7.48
Add New Post /wp-admin/post-new.php3.54 ▼2.3442.20 ▼59.71
Media Library /wp-admin/upload.php3.62 ▲0.3945.09 ▲9.92
Settings /wp-admin/admin.php?page=zbcp-settings3.5944.73
User Requests /wp-admin/admin.php?page=zbcp-users-requests3.6042.68
ZBCP /wp-admin/admin.php?page=zbcp3.6041.88
Requested ZIP Codes /wp-admin/admin.php?page=zbcp-requests3.6038.31

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 30 new files
Database: 3 new tables, 15 new options
New tables
wp_zipcode_requested
wp_zipcode_serving
wp_zipcode_requested_users
New WordPress options
cdzc_settings_user_already_requested
cdzc_settings_for_checkbox
cdzc_settings_requested_zipcode_highlight
can_compress_scripts
cdzc_settings_not_providing_services
cdzc_settings_no_zipcode_added
cdzc_settings_frontend_description
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
...

Browser metrics Passed 4 tests

An overview of browser requirements for ZIP Code Based Content Protection
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,918 ▲15713.64 ▼0.718.17 ▲6.3842.35 ▲3.18
Dashboard /wp-admin2,238 ▲585.86 ▲0.2089.90 ▼4.7140.96 ▼3.21
Posts /wp-admin/edit.php2,146 ▲462.53 ▲0.5441.14 ▲2.1433.09 ▼3.17
Add New Post /wp-admin/post-new.php1,627 ▲10123.28 ▼0.31676.98 ▼9.6659.09 ▲6.89
Media Library /wp-admin/upload.php1,443 ▲434.57 ▲0.35113.24 ▲4.1049.01 ▲3.14
Settings /wp-admin/admin.php?page=zbcp-settings9692.0437.0031.26
User Requests /wp-admin/admin.php?page=zbcp-users-requests1,0732.0930.2530.93
ZBCP /wp-admin/admin.php?page=zbcp1,2962.1433.7527.44
Requested ZIP Codes /wp-admin/admin.php?page=zbcp-requests1,0702.0532.1127.50

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The uninstall procedure failed, leaving 3 tables in the database
    • wp_zipcode_requested
    • wp_zipcode_requested_users
    • wp_zipcode_serving
  • Zombie WordPress options detected upon uninstall: 15 options
    • db_upgraded
    • cdzc_settings_user_already_requested
    • widget_recent-posts
    • cdzc_settings_for_checkbox
    • zbcp_plugin_general_display_options
    • widget_recent-comments
    • can_compress_scripts
    • cdzc_settings_not_providing_services
    • cdzc_settings_thankyou_for_email
    • cdzc_settings_requested_zipcode_highlight
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/zip-code-based-content-protection/admin/partials/zipcode-bcp-admin-display.php
  • 10× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > 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/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-zipcodes-list.php on line 23
    • > 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/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-requested-zipcodes.php on line 23
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-user-requested-zipcodes.php on line 23
    • > 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/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-zipcodes-list.php on line 23
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-zipcodes-list.php on line 23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/zip-code-based-content-protection/public/partials/zipcode-bcp-public-display.php:14
    • > 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/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-user-requested-zipcodes.php on line 23
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-requested-zipcodes.php on line 23
    • > 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/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-requested-zipcodes.php on line 23
    • > 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/zip-code-based-content-protection/admin/lists/class-zipcode-bcp-admin-user-requested-zipcodes.php on line 23

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There are user-side issues you should fix
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zbcp-requests
    • > Rendering (severe) in unknown
    /wp-content/plugins/zip-code-based-content-protection/admin/js/zipcode-bcp-admin.js?ver=1.0.0 277 Error: attribute cx: Expected length, "NaN".
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zbcp-requests
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of null (reading 'appendChild')" "TypeError: Cannot read properties of null (reading 'appendChild')\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/zip-code-based-content-protection/admin/js/zipcode-bcp-admin.js?ver=1.0.0:304:45)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zbcp-requests
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of null (reading 'appendChild')

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that need to be fixed:
  • Donate link: Invalid url: "www.presstigers.com"
You can look at the official readme.txt

zip-code-based-content-protection/zipcode-based-content-protection.php 85% from 13 tests

The main PHP file in "ZIP Code Based Content Protection" ver. 1.0.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("zip-code-based-content-protection.php" instead of "zipcode-based-content-protection.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin344,249 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
JSON100341,930
PHP173861,0771,640
JavaScript31787431
CSS31314248

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity8.47
▷ Minimum class complexity1.00
▷ Maximum class complexity22.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods114
▷ Static methods1916.67%
▷ Public methods10995.61%
▷ Protected methods00.00%
▷ Private methods54.39%
Functions8
▷ Named functions450.00%
▷ Anonymous functions450.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
PNG images were not found in this plugin