67% zip-codes-redirect

Code Review | Zip Code Redirect

WordPress plugin Zip Code Redirect scored67%from 54 tests.

About plugin

  • Plugin page: zip-codes-redirect
  • Plugin version: 5.1.6
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.3-6.4
  • WordPress version: 6.3.1
  • First release: Feb 14, 2021
  • Latest release: Nov 27, 2023
  • Number of updates: 114
  • Update frequency: every 8.9 days
  • Top authors: paulio21 (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /3,404 total downloads

Benchmarks

Plugin footprint 65% 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: ▲5.10MB] [CPU: ▲25.99ms] 75% from 4 tests

Analyzing server-side resources used by Zip Code Redirect
Please fix the following
  • Extra RAM: The extra memory usage must be under 5MB (currently 5.10MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.00 ▲5.5360.12 ▲19.90
Dashboard /wp-admin9.02 ▲5.7177.71 ▲28.69
Posts /wp-admin/edit.php9.02 ▲5.6676.58 ▲28.50
Add New Post /wp-admin/post-new.php9.36 ▲3.48120.74 ▲26.86
Media Library /wp-admin/upload.php9.02 ▲5.7963.74 ▲30.63
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius9.0258.58

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 199 new files
Database: no new tables, 22 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
zipcodesneg
zipcodeswon
zipcodestime
zipsubmitcheck
zipcodeswait
fs_accounts
zipcodes2
zipcodesuse
...

Browser metrics Passed 4 tests

Zip Code Redirect: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,850 ▲8814.24 ▼0.101.85 ▼0.1627.68 ▼17.43
Dashboard /wp-admin2,213 ▲335.58 ▼0.0797.26 ▼1.3483.75 ▲42.27
Posts /wp-admin/edit.php2,140 ▲401.96 ▲0.0239.44 ▲1.8236.68 ▼2.51
Add New Post /wp-admin/post-new.php1,555 ▲2924.99 ▲1.53755.39 ▲89.1363.96 ▲14.15
Media Library /wp-admin/upload.php1,430 ▲274.21 ▲0.0297.29 ▲0.1671.61 ▲29.74
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,1041.6626.0427.26

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/zip-codes-redirect/freemius/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 9 options
    • fs_debug_mode
    • widget_theysaidso_widget
    • fs_active_plugins
    • widget_recent-comments
    • can_compress_scripts
    • fs_accounts
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means 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
Please take a closer look at the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/zip-codes-redirect/admin/townsearch.php
  • 6× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sanitize_text_field() in wp-content/plugins/zip-codes-redirect/includes/postcode.php:4
    • > PHP Notice
      Undefined variable: hint in wp-content/plugins/zip-codes-redirect/admin/townsearch.php on line 40
    • > PHP Notice
      Undefined index: q in wp-content/plugins/zip-codes-redirect/admin/townsearch.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/zip-codes-redirect/includes/admin_data_ajax_call.php:5
    • > PHP Warning
      DOMDocument::load(): I/O warning : failed to load external entity "wp-content/plugins/zip-codes-redirect/town/towns.xml" in /var/www/wordpress/wp-content/plugins/zip-codes-redirect/admin/townsearch.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function check_ajax_referer() in wp-content/plugins/zip-codes-redirect/includes/data_ajax_call.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Please fix the following attributes:
  • Screenshots: Please add images for these screenshots: #1 (Zip Code Settings), #2 (With Submit Button), #3 (Without Submit Button)
You can look at the official readme.txt

zip-codes-redirect/zipcoderedirect.php 92% from 13 tests

The principal PHP file in "Zip Code Redirect" v. 5.1.6 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("zip-codes-redirect.php" instead of "zipcoderedirect.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected47,833 lines of code in 152 files:
LanguageFilesBlank linesComment linesLines of code
PHP1308,31017,38734,105
XML20013,447
JavaScript63559258
CSS1411423

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
The following items need your attention
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,096)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity85.66
▷ 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
Classes52
▷ Abstract classes23.85%
▷ Concrete classes5096.15%
▷ Final classes00.00%
Methods1,293
▷ Static methods19915.39%
▷ Public methods89369.06%
▷ Protected methods171.31%
▷ Private methods38329.62%
Functions102
▷ Named functions102100.00%
▷ Anonymous functions00.00%
Constants146
▷ Global constants9967.81%
▷ Class constants4732.19%
▷ Public constants47100.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
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%