73% acf-city-selector

Code Review | ACF City Selector

WordPress plugin ACF City Selector scored73%from 54 tests.

About plugin

  • Plugin page: acf-city-selector
  • Plugin version: 1.11.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Dec 25, 2020
  • Latest release: Apr 30, 2023
  • Number of updates: 39
  • Update frequency: every 22.0 days
  • Top authors: Beee (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /5,140 total downloads

Benchmarks

Plugin footprint 65% 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.50MB] [CPU: ▼3.43ms] 75% from 4 tests

This is a short check of server-side resources used by ACF City Selector
Please fix the following
  • CPU: The total CPU usage must kept under 500.00ms (currently 1,302.80ms on /wp-admin/admin.php?page=acfcs-countries)
PageMemory (MB)CPU Time (ms)
Home /3.96 ▲0.5041.57 ▼5.23
Dashboard /wp-admin3.80 ▲0.5053.15 ▼1.48
Posts /wp-admin/edit.php3.92 ▲0.5654.14 ▲5.96
Add New Post /wp-admin/post-new.php6.40 ▲0.5295.19 ▼11.50
Media Library /wp-admin/upload.php3.73 ▲0.5041.89 ▲4.50
Get countries /wp-admin/admin.php?page=acfcs-countries3.801,302.80
Info /wp-admin/admin.php?page=acfcs-info3.7140.12
Preview data /wp-admin/admin.php?page=acfcs-preview3.7036.18
Settings /wp-admin/admin.php?page=acfcs-settings3.7038.47
Search /wp-admin/admin.php?page=acfcs-search3.7035.25
City Selector /wp-admin/options-general.php?page=acfcs-dashboard3.7037.29

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 45 new files
Database: 1 new table, 7 new options
New tables
wp_cities
New WordPress options
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
acfcs_db_version
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

ACF City Selector: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,810 ▲4914.39 ▲0.031.84 ▼0.2943.02 ▼0.94
Dashboard /wp-admin2,214 ▲405.67 ▲0.0886.89 ▼9.4341.83 ▼5.55
Posts /wp-admin/edit.php2,119 ▲192.02 ▲0.0341.01 ▲1.1437.57 ▼2.30
Add New Post /wp-admin/post-new.php1,553 ▲1918.04 ▼0.09609.18 ▼46.3673.43 ▲4.00
Media Library /wp-admin/upload.php1,419 ▲194.30 ▲0.06103.36 ▼13.5245.28 ▼4.37
Get countries /wp-admin/admin.php?page=acfcs-countries1,8131.8427.4341.85
Info /wp-admin/admin.php?page=acfcs-info1,3431.8225.7934.06
Preview data /wp-admin/admin.php?page=acfcs-preview1,1321.8124.4531.49
Settings /wp-admin/admin.php?page=acfcs-settings1,2251.8323.8730.48
Search /wp-admin/admin.php?page=acfcs-search1,1321.8126.0230.23
City Selector /wp-admin/options-general.php?page=acfcs-dashboard1,1961.9325.0739.00

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
You still need to fix the following
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_cities
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

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 fix the following
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/acfcs-help-tabs.php:110
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/acfcs-actions.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/form-handling.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/acfcs-ajax.php:57

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% 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
These attributes need your attention: You can look at the official readme.txt

acf-city-selector/ACF_City_Selector.php 92% from 13 tests

The entry point to "ACF City Selector" version 1.11.0 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("acf-city-selector.php" instead of "ACF_City_Selector.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin5,385 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
PHP245567563,395
PO File26109231,318
CSS29216390
JavaScript44841282

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.64
Average class complexity93.40
▷ Minimum class complexity40.00
▷ Maximum class complexity118.00
Average method complexity11.63
▷ Minimum method complexity1.00
▷ Maximum method complexity53.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods45
▷ Static methods48.89%
▷ Public methods45100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions48
▷ Named functions4695.83%
▷ Anonymous functions24.17%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
5 PNG files occupy 0.30MB with 0.17MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-256x256.png8.01KB4.29KB▼ 46.40%
assets/banner-772x250.png28.64KB11.03KB▼ 61.48%
assets/banner-1544x500.png48.14KB19.37KB▼ 59.76%
assets/screenshot-1.png210.79KB53.60KB▼ 74.57%
assets/icon-128x128.png6.71KB3.13KB▼ 53.32%