78% buy-x-get-y-free-by-storepro

Code Review | Buy X Get Y Free by StorePro

WordPress plugin Buy X Get Y Free by StorePro scored78%from 54 tests.

About plugin

  • Plugin page: buy-x-get-y-free-...
  • Plugin version: 1.1.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.2-6.3.2
  • WordPress version: 6.3.1
  • First release: Aug 18, 2020
  • Latest release: Nov 7, 2023
  • Number of updates: 38
  • Update frequency: every 31.0 days
  • Top authors: storepro (76.32%)suhanastorepro (15.79%)saliya22 (7.89%)pranavstorepro (7.89%)

Code review

54 tests

User reviews

7 reviews

Install metrics

100+ active /6,362 total downloads

Benchmarks

Plugin footprint 83% 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.00MB] [CPU: ▼2.47ms] Passed 4 tests

An overview of server-side resources used by Buy X Get Y Free by StorePro
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.72 ▼3.22
Dashboard /wp-admin3.30 ▲0.0045.31 ▼7.26
Posts /wp-admin/edit.php3.36 ▲0.0049.90 ▲2.89
Add New Post /wp-admin/post-new.php5.89 ▲0.0093.18 ▼1.02
Media Library /wp-admin/upload.php3.23 ▲0.0032.77 ▲1.63

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 17 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for Buy X Get Y Free by StorePro
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.70 ▲0.371.75 ▲0.1239.54 ▼3.67
Dashboard /wp-admin2,195 ▲155.61 ▼0.0592.82 ▲1.3040.22 ▲3.09
Posts /wp-admin/edit.php2,100 ▼32.01 ▲0.0440.04 ▼3.3935.12 ▲0.22
Add New Post /wp-admin/post-new.php1,526 ▼022.79 ▼0.40598.79 ▼56.3348.33 ▼6.72
Media Library /wp-admin/upload.php1,397 ▼04.19 ▼0.0799.00 ▼6.5244.21 ▼0.65

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

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× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/buy-x-get-y-free-by-storepro/Inc/bogo_by_sp_class_forms.php
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/buy-x-get-y-free-by-storepro/admin/bogo_by_sp_class_admin_option.php:199
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/buy-x-get-y-free-by-storepro/Inc/includes.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/buy-x-get-y-free-by-storepro/public/bogo_by_sp_class_cart.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: Please add images for these screenshots: #7 (Select the Quantity of Free Product), #8 (Save settings), #9 (How that would look to customer)
You can take inspiration from this readme.txt

buy-x-get-y-free-by-storepro/bogo_by_sp.php 85% from 13 tests

Analyzing the main PHP file in "Buy X Get Y Free by StorePro" version 1.1.6
It is important to fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("5.8" instead of "2.2")
  • Main file name: The principal plugin file should be the same as the plugin slug ("buy-x-get-y-free-by-storepro.php" instead of "bogo_by_sp.php")

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
Success! There were no dangerous files found in this plugin1,152 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP12403197963
JavaScript1425187
CSS2052

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity26.89
▷ Minimum class complexity1.00
▷ Maximum class complexity185.00
Average method complexity5.40
▷ Minimum method complexity1.00
▷ Maximum method complexity37.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods53
▷ Static methods1426.42%
▷ Public methods5094.34%
▷ Protected methods00.00%
▷ Private methods35.66%
Functions7
▷ Named functions685.71%
▷ Anonymous functions114.29%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/img/Sp_bogo.png1.62KB1.86KB0.00%