83% wp-cloudflare-geoip-redirect

Code Review | WP Cloudflare GeoIP Redirect

WordPress plugin WP Cloudflare GeoIP Redirect scored83%from 54 tests.

About plugin

  • Plugin page: wp-cloudflare-geo...
  • Plugin version: 1.4
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.7
  • WordPress version: 6.3.1
  • First release: Mar 17, 2020
  • Latest release: Apr 23, 2021
  • Number of updates: 11
  • Update frequency: every 36.5 days
  • Top authors: webinvaders (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

100+ active /3,730 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.69MB] [CPU: ▼0.68ms] Passed 4 tests

An overview of server-side resources used by WP Cloudflare GeoIP Redirect
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.88 ▲0.4241.77 ▲1.05
Dashboard /wp-admin4.10 ▲0.8046.85 ▼3.00
Posts /wp-admin/edit.php4.12 ▲0.7648.46 ▲2.13
Add New Post /wp-admin/post-new.php6.68 ▲0.8094.85 ▼2.92
Media Library /wp-admin/upload.php4.02 ▲0.7938.42 ▲6.92

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 343 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

WP Cloudflare GeoIP Redirect: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,827 ▲8113.24 ▼1.141.88 ▼0.1040.26 ▼2.98
Dashboard /wp-admin2,233 ▲455.90 ▲1.0197.39 ▼18.1439.23 ▼6.26
Posts /wp-admin/edit.php2,116 ▲302.08 ▲0.0837.97 ▲0.8932.49 ▼1.92
Add New Post /wp-admin/post-new.php1,535 ▲1323.35 ▼0.11624.94 ▲35.1654.86 ▲5.31
Media Library /wp-admin/upload.php1,418 ▲304.29 ▲0.0695.78 ▼11.5245.56 ▼2.29

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 39× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/CMB2_Field.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Select' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Select_Timezone.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Base' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Taxonomy_Multicheck.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/CMB2_Options_Hookup.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Radio' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Multicheck.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text_Date' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Text_Time.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Select' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Taxonomy_Select_Hierarchical.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Text_Date.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Textarea' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_Textarea_Code.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/wp-cloudflare-geoip-redirect/cmb2/includes/types/CMB2_Type_File_Base.php:13

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 errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention: You can look at the official readme.txt

wp-cloudflare-geoip-redirect/cf-redirect.php 85% from 13 tests

The main PHP script in "WP Cloudflare GeoIP Redirect" version 1.4 is automatically included on every request by WordPress
You should first fix the following items:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("wp-cloudflare-geoip-redirect.php" instead of "cf-redirect.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin46,171 lines of code in 199 files:
LanguageFilesBlank linesComment linesLines of code
PO File12014,31518,50232,323
PHP572,1066,1487,148
CSS132501,1864,558
JavaScript73615901,466
Markdown22190676

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity18.97
▷ Minimum class complexity1.00
▷ Maximum class complexity186.00
Average method complexity3.29
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes68
▷ Abstract classes913.24%
▷ Concrete classes5986.76%
▷ Final classes00.00%
Methods536
▷ Static methods8816.42%
▷ Public methods44482.84%
▷ Protected methods8916.60%
▷ Private methods30.56%
Functions27
▷ Named functions27100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants333.33%
▷ Class constants666.67%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
14 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
cmb2/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%
cmb2/images/ui-icons_888888_256x240.png5.23KB4.11KB▼ 21.49%
cmb2/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
cmb2/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%
cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%