72% cm-business-directory

Code Review | CM Business Directory

WordPress plugin CM Business Directory scored 72% from 54 tests.

About plugin

  • Plugin page: cm-business-direc...
  • Plugin version: 1.3.2
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.0-5.9
  • WordPress version: 5.8.1
  • First release: Jul 7, 2015
  • Latest release: Jan 26, 2022
  • Number of updates: 268
  • Update frequency: every 8.9 days
  • Top authors: CreativeMindsSolutions (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

200+ active / 22,411 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.15MB] [CPU: ▼152.59ms] 75% from 4 tests

A check of server-side resources used by CM Business Directory
Please have a look at the following items
  • CPU: You should keep total CPU usage under 500.00ms (currently 1,391.28ms on /wp-admin/edit.php?post_type=cm-business&page=cm-business-directory-settings)
PageMemory (MB)CPU Time (ms)
Home /2.94 ▲0.1032.54 ▲8.95
Dashboard /wp-admin3.26 ▲0.1931.30 ▼5.04
Posts /wp-admin/edit.php3.30 ▲0.1931.32 ▲0.65
Add New Post /wp-admin/post-new.php5.71 ▲0.2770.09 ▼605.24
Media Library /wp-admin/upload.php3.13 ▲0.1222.79 ▼0.72
User Guide /wp-admin/edit.php?post_type=cm-business&page=cmbd_about3.2727.70
Settings /wp-admin/edit.php?post_type=cm-business&page=cm-business-directory-settings3.411,391.28
Add Business /wp-admin/post-new.php?post_type=cm-business5.7172.04
Business /wp-admin/edit.php?post_type=cm-business3.1823.05
Upgrade ➤ /wp-admin/edit.php?post_type=cm-business&page=cmbd_pro3.1320.24
Categories /wp-admin/edit-tags.php?taxonomy=cm-business-category&post_type=cm-business3.1328.42

Server storage [IO: ▲1.50MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 130 new files
Database: no new tables, 2 new options
New WordPress options
cmbd_shortcode_page_id
cmbd_permalink_old

Browser metrics Passed 4 tests

This is an overview of browser requirements for CM Business Directory
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,731 ▲12015.86 ▼0.104.74 ▼0.0976.07 ▼3.72
Dashboard /wp-admin2,990 ▲916.12 ▼0.00112.46 ▼24.95178.19 ▼1.15
Posts /wp-admin/edit.php2,800 ▲603.23 ▲0.0162.96 ▼1.21143.76 ▼1.58
Add New Post /wp-admin/post-new.php3,845 ▲3018.42 ▼0.66426.25 ▲6.86155.59 ▼7.70
Media Library /wp-admin/upload.php1,810 ▲585.54 ▲0.13133.68 ▼13.79190.60 ▲15.19
User Guide /wp-admin/edit.php?post_type=cm-business&page=cmbd_about5,61913.64352.68297.04
Settings /wp-admin/edit.php?post_type=cm-business&page=cm-business-directory-settings5,0777.15154.40256.87
Add Business /wp-admin/post-new.php?post_type=cm-business7,71421.59463.31210.88
Business /wp-admin/edit.php?post_type=cm-business1,5463.0857.44119.95
Upgrade ➤ /wp-admin/edit.php?post_type=cm-business&page=cmbd_pro1,9083.0964.53121.47
Categories /wp-admin/edit-tags.php?taxonomy=cm-business-category&post_type=cm-business1,8122.7859.97132.27

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin does not fully uninstall, leaving 2 options in the database
    • cmbd_shortcode_page_id
    • cmbd_permalink_old

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/edit.php?post_type=cm-business&page=cmbd_about
    • > Warning in wp-content/plugins/cm-business-directory/package/cminds-free.php+3001
    mysqli_get_server_info() expects exactly 1 parameter, 0 given

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      include_once(): Failed opening 'CMBD_PLUGIN_DIRbackend/classes/SettingsViewAbstract.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/cm-business-directory/backend/classes/SettingsView.php on line 2
    • > PHP Warning
      include_once(): Failed opening 'CMBD_PLUGIN_DIR/frontend/classes/Template.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/cm-business-directory/frontend/templates/cm_default/business-page-view.php on line 3
    • > PHP Warning
      include_once(CMBD_PLUGIN_DIRbackend/classes/SettingsViewAbstract.php): failed to open stream: No such file or directory in wp-content/plugins/cm-business-directory/backend/classes/SettingsView.php on line 2
    • > PHP Warning
      Use of undefined constant CMBD_PLUGIN_DIR - assumed 'CMBD_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-business-directory/backend/cm-business-directory-backend.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'CMBD_SettingsViewAbstract' not found in wp-content/plugins/cm-business-directory/backend/classes/SettingsView.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'CMBDBusinessPageTemplate' not found in wp-content/plugins/cm-business-directory/frontend/templates/cm_default/business-page-view.php:5
    • > PHP Warning
      Use of undefined constant CMBD_PLUGIN_DIR - assumed 'CMBD_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-business-directory/frontend/templates/cm_default/business-page-view.php on line 3
    • > PHP Warning
      include_once(CMBD_PLUGIN_DIR/frontend/classes/Template.php): failed to open stream: No such file or directory in wp-content/plugins/cm-business-directory/frontend/templates/cm_default/business-page-view.php on line 3
    • > PHP Warning
      include_once(CMBD_PLUGIN_DIR/frontend/cm-business-directory-business-page.php): failed to open stream: No such file or directory in wp-content/plugins/cm-business-directory/backend/cm-business-directory-backend.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-business-directory/package/views/registration.php:42

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
    • > GET request to /wp-admin/edit.php?post_type=cm-business&page=cmbd_about
    • > Console-api (severe) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yc/r/gGTO4iuWbYx.js?_nc_x=Ij3Wp8lg5Kz 57:562 "ErrorUtils caught an error:\n\nCannot listen to an undefined element. [Caught in: Tried to listen to element of type click]\n\nSubsequent non-fatal errors won't be logged; see https://fburl.com/debugjs."
    • > GET request to /wp-admin/edit.php?post_type=cm-business&page=cm-business-directory-settings
    • > Other (warning) in unknown
    /wp-admin/edit.php?post_type=cm-business&page=cm-business-directory-settings 982 Allow attribute will take precedence over 'allowfullscreen'.
    • > GET request to /wp-admin/post-new.php?post_type=cm-business
    • > Console-api (warning) in wp-includes/js/dist/blocks.min.js?ver=7ed7fe32dad771c4e0af4f56539ff156+1:40463
    Block validation: Expected attribute `%s` of value `%s`, saw `%s`." "style" "height:100px" "height:5px
    • > GET request to /wp-admin/post-new.php?post_type=cm-business
    • > Console-api (severe) in wp-includes/js/dist/blocks.min.js?ver=7ed7fe32dad771c4e0af4f56539ff156+1:40463
    Block validation: Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s" "core/spacer" Object "\u003Cdiv style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\">\u003C/div>" "\u003Cdiv style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\">\u003C/div>

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: catalog, directory plugin, classified, business directory, directory

cm-business-directory/cm-business-directory.php Passed 13 tests

This is the main PHP file of "CM Business Directory" version 1.3.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
58 characters long description:
Build, organize and display a local directory of business.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected9,593 lines of code in 53 files:
LanguageFilesBlank linesComment linesLines of code
PHP381,1727437,423
CSS8223681,799
JavaScript64122232
Sass1232139

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity42.21
▷ Minimum class complexity1.00
▷ Maximum class complexity251.00
Average method complexity3.49
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes14
▷ Abstract classes214.29%
▷ Concrete classes1285.71%
▷ Final classes00.00%
Methods235
▷ Static methods11850.21%
▷ Public methods19683.40%
▷ Protected methods3414.47%
▷ Private methods52.13%
Functions10
▷ Named functions990.00%
▷ Anonymous functions110.00%
Constants73
▷ Global constants1115.07%
▷ Class constants6284.93%
▷ Public constants62100.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
63 PNG files occupy 0.86MB with 0.42MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
package/css/images/ui-icons_2e83ff_256x240.png4.44KB4.17KB▼ 6.02%
package/views/banner_yearly-membership_220px.png31.34KB10.91KB▼ 65.19%
package/views/img/assets.png16.34KB6.92KB▼ 57.67%
package/views/routes.png12.59KB4.78KB▼ 62.02%
backend/assets/css/images/ui-bg_glass_95_fef1ec_1x400.png0.32KB0.15KB▼ 54.82%