73% ahachat-messenger-marketing

Code Review | AhaChat Messenger Marketing

WordPress plugin AhaChat Messenger Marketing scored73%from 54 tests.

About plugin

  • Plugin page: ahachat-messenger...
  • Plugin version: 1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-5.3.2
  • WordPress version: 6.3.1
  • First release: Mar 25, 2020
  • Latest release: Sep 2, 2020
  • Number of updates: 15
  • Update frequency: every 10.8 days
  • Top authors: ahachat (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /803 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.83MB] [CPU: ▼9.62ms] Passed 4 tests

Analyzing server-side resources used by AhaChat Messenger Marketing
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.82 ▲0.3625.45 ▼20.78
Dashboard /wp-admin4.41 ▲1.1157.40 ▲5.71
Posts /wp-admin/edit.php4.14 ▲0.7838.45 ▼15.13
Add New Post /wp-admin/post-new.php7.06 ▲1.1792.27 ▼8.27
Media Library /wp-admin/upload.php4.29 ▲1.0644.94 ▲9.43

Server storage [IO: ▲3.58MB] [DB: ▲0.01MB] 67% from 3 tests

Filesystem and database footprint
These are issues you should consider
  • You have illegally modified 1 file (0.00KB) outside of "wp-content/plugins/ahachat-messenger-marketing/" and "wp-content/uploads/"
    • (new file) "wp-content/plugins/ahachat-messenger-marketing/banner-772\303\227250.png"
Filesystem: 78 new files
Database: 4 new tables, 7 new options
New tables
wp_ahachat_analytics
wp_ahachat_shortcodes
wp_ahachat_analytics_fb
wp_ahachat_user_ref
New WordPress options
db_upgraded
theysaidso_admin_options
ahachat_app_enable_status
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by AhaChat Messenger Marketing
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,032 ▲26113.69 ▼0.6615.49 ▲13.4944.24 ▲1.36
Dashboard /wp-admin2,231 ▲515.66 ▼0.00101.44 ▲8.6285.68 ▲40.65
Posts /wp-admin/edit.php2,154 ▲542.01 ▲0.0540.46 ▲5.2036.91 ▼1.56
Add New Post /wp-admin/post-new.php1,582 ▲5418.34 ▼4.68731.43 ▲54.1765.38 ▲1.41
Media Library /wp-admin/upload.php1,448 ▲484.14 ▼0.03107.19 ▲0.7871.68 ▲25.36

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie tables were found after uninstall: 4 tables
    • wp_ahachat_shortcodes
    • wp_ahachat_user_ref
    • wp_ahachat_analytics
    • wp_ahachat_analytics_fb
  • Zombie WordPress options detected upon uninstall: 7 options
    • theysaidso_admin_options
    • ahachat_app_enable_status
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments

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)
Even though no errors were found, this is by no means an exhaustive test

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
Almost there! Just fix the following items
  • 14× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/ahachat-messenger-marketing/includes/ahachat_tables-user-audience.php on line 5
    • > PHP Warning
      Use of undefined constant AHACHAT_ANALYTICS_FB_TABLE - assumed 'AHACHAT_ANALYTICS_FB_TABLE' (this will throw an Error in a future version of PHP) in wp-content/plugins/ahachat-messenger-marketing/includes/ahachat_anylystic.php on line 12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/ahachat-messenger-marketing/includes/ahachat_coupon.php: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/ahachat-messenger-marketing/includes/ahachat_tables-user-audience.php on line 5
    • > PHP Warning
      Use of undefined constant AHACHAT_ANALYTICS_TABLE - assumed 'AHACHAT_ANALYTICS_TABLE' (this will throw an Error in a future version of PHP) in wp-content/plugins/ahachat-messenger-marketing/includes/ahachat_anylystic.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ahachat-messenger-marketing/includes/facebook-api/ahachat_rule.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ahachat-messenger-marketing/includes/ahachat_settings_fb_api.php:18
    • > 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/ahachat-messenger-marketing/includes/ahachat_tables-user-audience.php on line 5
    • > 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/ahachat-messenger-marketing/includes/ahachat_tables-user.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/ahachat-messenger-marketing/includes/ahachat_shortcode.php:28

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
5 plugin tags: ahachat, chatbot, abandoned cart, messenger, woocommerce

ahachat-messenger-marketing/ahachat.php 92% from 13 tests

This is the main PHP file of "AhaChat Messenger Marketing" version 1.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("ahachat-messenger-marketing.php" instead of "ahachat.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 plugin7,216 lines of code in 53 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript199941,2854,634
PHP184561102,285
SVG201215
HTML132069
CSS1311413

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity41.19
▷ Minimum class complexity1.00
▷ Maximum class complexity168.00
Average method complexity5.23
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes16
▷ Abstract classes00.00%
▷ Concrete classes16100.00%
▷ Final classes00.00%
Methods152
▷ Static methods10.66%
▷ Public methods15199.34%
▷ Protected methods10.66%
▷ Private methods00.00%
Functions30
▷ Named functions30100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants16100.00%
▷ Class constants00.00%
▷ Public constants00.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
14 PNG files occupy 1.07MB with 0.65MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-9.png119.67KB47.66KB▼ 60.18%
screenshot-2.png174.32KB71.01KB▼ 59.26%
screenshot-5.png90.90KB35.84KB▼ 60.57%
screenshot-1.png134.12KB56.16KB▼ 58.12%
banner-772×250.png61.37KB20.39KB▼ 66.78%