10% offer-calc

Code Review | Offer Calc

WordPress plugin Offer Calc scored10%from 54 tests.

About plugin

  • Plugin page: offer-calc
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-6.1
  • WordPress version: 6.3.1
  • First release: Jul 4, 2011
  • Latest release: Jan 12, 2023
  • Number of updates: 33
  • Update frequency: every 127.6 days
  • Top authors: nofearinc (60.61%)metodiew (36.36%)devrix (9.09%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /10,334 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
These installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/offer-calc/includes/widgets/class-offer-calc-widget.php+26
    Methods with the same name as their class will not be constructors in a future version of PHP; Offer_Calc_Widget has a deprecated constructor

Server metrics [RAM: ▲0.13MB] [CPU: ▲3.53ms] Passed 4 tests

An overview of server-side resources used by Offer Calc
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1239.18 ▲2.11
Dashboard /wp-admin3.43 ▲0.1347.42 ▼2.57
Posts /wp-admin/edit.php3.55 ▲0.2054.66 ▲7.36
Add New Post /wp-admin/post-new.php6.04 ▲0.16106.11 ▲8.81
Media Library /wp-admin/upload.php3.36 ▲0.1342.45 ▲7.20
Offer Calc Help /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-help3.3731.92
Offer Calc /wp-admin/edit.php?post_type=offer-calc3.4041.71
Settings /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-global-settings3.4032.13
Add Offer /wp-admin/post-new.php?post_type=offer-calc3.4654.87

Server storage [IO: ▲2.39MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 77 new files
Database: no new tables, 10 new options
New WordPress options
can_compress_scripts
ofc_version
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
ofc_migration_done
widget_offer_calc_widget
widget_recent-comments
ofc_pro_notice

Browser metrics Passed 4 tests

A check of browser resources used by Offer Calc
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,968 ▲20713.50 ▼1.218.97 ▲7.3939.14 ▼2.84
Dashboard /wp-admin2,285 ▲1045.59 ▼0.0384.73 ▼18.4875.95 ▲35.03
Posts /wp-admin/edit.php2,154 ▲512.21 ▲0.1956.40 ▲17.9551.85 ▲19.12
Add New Post /wp-admin/post-new.php1,781 ▲25521.50 ▼1.48760.46 ▲130.7430.90 ▼47.45
Media Library /wp-admin/upload.php1,440 ▲464.14 ▼0.04123.97 ▲25.4947.29 ▲3.05
Offer Calc Help /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-help1,0601.7826.8127.48
Offer Calc /wp-admin/edit.php?post_type=offer-calc1,1452.1637.5733.90
Settings /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-global-settings1,9967.48172.95127.84
Add Offer /wp-admin/post-new.php?post_type=offer-calc2,5217.92176.31203.34

Uninstaller [IO: ▲0.00MB] [DB: ▲0.07MB] 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 does not fully uninstall, leaving 10 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_offer_calc_widget
    • ofc_pro_notice
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • ofc_migration_done
    • ofc_version

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)
These server-side errors were triggered
    • > GET request to /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-global-settings
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-global-settings
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=offer-calc&page=offer-calc-global-settings
    • > Notice in wp-content/plugins/offer-calc/offer-calc-pro/includes/admin/forms/offer-calc-global-setting.php+217
    Trying to access array offset on value of type bool
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=offer-calc
    • > Warning in wp-content/plugins/offer-calc/includes/meta-boxes/class-offer-calc-meta-box.php+1214
    count(): Parameter must be an array or an object that implements Countable

SRP 0% 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
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      imagettftext(): Could not find/open font in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 66
    • > PHP Warning
      imagettfbbox(): Could not find/open font in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 61
    • > PHP Notice
      Trying to get property 'post_title' of non-object in wp-content/plugins/offer-calc/offer-calc-pro/includes/admin/forms/offer-email.php on line 15
    • > PHP Notice
      Trying to access array offset on value of type bool in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 63
    • > PHP Notice
      Trying to access array offset on value of type bool in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 64
    • > PHP Warning
      Use of undefined constant OFFER_CALC_PRO_DIR - assumed 'OFFER_CALC_PRO_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 16
    • > PHP Notice
      Undefined index: ofc_id in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 73
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/offer-calc/offer-calc-pro/includes/admin/forms/offer-email.php on line 15
    • > PHP Notice
      Undefined index: rand in wp-content/plugins/offer-calc/offer-calc-pro/includes/offer-calc-captcha-code.php on line 73
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/offer-calc/offer-calc-pro/includes/admin/forms/offer-email.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Tags: Too many tags (14 tag instead of maximum 10); only the first 5 tags are used in your directory listing
Please take inspiration from this readme.txt

offer-calc/offercalc.php 92% from 13 tests

The primary PHP file in "Offer Calc" version 1.2 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("offer-calc.php" instead of "offercalc.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
Good job! No executable or dangerous file extensions detected8,011 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript107594683,558
PHP231,1251,7452,929
CSS985581,314
PO File16483150
Markdown120060

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity49.30
▷ Minimum class complexity1.00
▷ Maximum class complexity265.00
Average method complexity4.31
▷ Minimum method complexity1.00
▷ Maximum method complexity55.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods146
▷ Static methods00.00%
▷ Public methods146100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.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

Using a strong compression for your PNG files is a great way to speed-up your plugin
27 PNG files occupy 1.97MB with 0.97MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-2.png93.06KB28.08KB▼ 69.83%
sample-form.png7.27KB3.23KB▼ 55.59%
assets/screenshot-8.png95.39KB27.69KB▼ 70.97%
includes/meta-boxes/images/delete-16.png1.74KB0.90KB▼ 48.23%
includes/meta-boxes/images/edit.png1.24KB1.23KB▼ 0.87%