10% cost-calculator

Code Review | EM Cost Calculator

WordPress plugin EM Cost Calculator scored10%from 54 tests.

About plugin

  • Plugin page: cost-calculator
  • Plugin version: 2.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.3
  • WordPress version: 6.3.1
  • First release: May 17, 2018
  • Latest release: Nov 18, 2019
  • Number of updates: 56
  • Update frequency: every 9.8 days
  • Top authors: motahar1 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active /7,360 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
These installer errors require your attention
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/cost-calculator/em-cost-calculator.php+79
    Undefined variable: wpdb

Server metrics [RAM: ▼1.68MB] [CPU: ▼53.70ms] Passed 4 tests

A check of server-side resources used by EM Cost Calculator
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.31 ▼1.165.72 ▼35.55
Dashboard /wp-admin2.33 ▼0.987.14 ▼45.12
Posts /wp-admin/edit.php2.33 ▼1.036.85 ▼45.30
Add New Post /wp-admin/post-new.php2.33 ▼3.568.75 ▼88.83
Media Library /wp-admin/upload.php2.33 ▼0.905.74 ▼32.57
EMCC Customers /wp-admin/admin.php?page=em_add_data2.337.20
About EMCC /wp-admin/admin.php?page=em_payment_settings2.337.84

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 18 new files
Database: 4 new tables, 10 new options
New tables
emotahar_cost_calc
wp_emotahar_cost_calc
wp_emcc_order_details
wp_emcc_default_mail_user
New WordPress options
widget_recent-comments
theysaidso_admin_options
emcc_order_details_db_version
db_upgraded
widget_recent-posts
widget_theysaidso_widget
em_cost_calc_db_version
widget_em_cost_calculator_id
emcc_order_mail_db_version
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for EM Cost Calculator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,908 ▲16213.58 ▼0.817.01 ▲5.1942.84 ▼1.81
Dashboard /wp-admin2,231 ▲634.85 ▼0.06106.54 ▼20.4241.70 ▼7.31
Posts /wp-admin/edit.php2,114 ▲222.06 ▲0.0338.96 ▼2.5835.74 ▼3.07
Add New Post /wp-admin/post-new.php1,534 ▼822.28 ▲4.02642.87 ▼20.2340.46 ▼10.70
Media Library /wp-admin/upload.php1,407 ▲224.19 ▼0.0595.82 ▼13.1440.60 ▼4.74
EMCC Customers /wp-admin/admin.php?page=em_add_data8902.0223.8832.47
About EMCC /wp-admin/admin.php?page=em_payment_settings7882.1525.3645.50

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] 25% 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 cannot be uninstalled
    • > Warning in wp-content/plugins/cost-calculator/em-cost-calculator.php+339
    include_once(wp-content/plugins/cost-calculator/em-add-custom-template.php): failed to open stream: No such file or directory
  • Zombie tables detected upon uninstall: 4 tables
    • wp_emcc_order_details
    • wp_emotahar_cost_calc
    • emotahar_cost_calc
    • wp_emcc_default_mail_user
  • The uninstall procedure has failed, leaving 10 options in the database
    • emcc_order_mail_db_version
    • theysaidso_admin_options
    • widget_recent-posts
    • emcc_order_details_db_version
    • db_upgraded
    • em_cost_calc_db_version
    • widget_em_cost_calculator_id
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=em_payment_settings
    • > Warning in wp-content/plugins/cost-calculator/em-cost-calculator.php+339
    include_once(wp-content/plugins/cost-calculator/em-add-custom-template.php): failed to open stream: No such file or directory
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=em_payment_settings
    • > Warning in wp-content/plugins/cost-calculator/em-cost-calculator.php+339
    include_once(): Failed opening 'wp-content/plugins/cost-calculator/em-add-custom-template.php' for inclusion (include_path='.:/usr/share/php')

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/cost-calculator/emcc_captcha.php

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 90% from 29 tests

readme.txt 88% 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:
  • Screenshots: A description for screenshot #12 is required in cost-calculator/assets to your readme.txt
  • Screenshots: Please add an image for screenshot #1 (On a full width widget)
Please take inspiration from this readme.txt

cost-calculator/em-cost-calculator.php 92% from 13 tests

Analyzing the main PHP file in "EM Cost Calculator" version 2.3.1
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("cost-calculator.php" instead of "em-cost-calculator.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin1,852 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP5256112873
CSS21112693
JavaScript1396286

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity71.00
▷ Minimum class complexity71.00
▷ Maximum class complexity71.00
Average method complexity18.50
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions18
▷ Named functions1794.44%
▷ Anonymous functions15.56%
Constants0
▷ Global constants00.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.19MB with 0.10MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-2.png55.34KB22.13KB▼ 60.02%
assets/screenshot-4.png57.34KB30.27KB▼ 47.21%
assets/screenshot-1.png36.75KB16.80KB▼ 54.28%
assets/screenshot-3.png29.86KB11.30KB▼ 62.14%
assets/banner-772x250.png11.91KB6.32KB▼ 46.96%