68% wp-offers

Code Review | WordPress Coupon Plugin for Bloggers and Marketers – WP Offers

WordPress plugin WordPress Coupon Plugin for Bloggers and Marketers – WP Offers scored 68% from 54 tests.

About plugin

  • Plugin page: wp-offers
  • Plugin version: 1.1.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-5.9
  • WordPress version: 5.9.2
  • First release: Jun 11, 2020
  • Latest release: Mar 18, 2022
  • Number of updates: 18
  • Update frequency: every 35.9 days
  • Top authors: kitthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 1,580 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲4.59MB] [CPU: ▼265.71ms] Passed 4 tests

Analyzing server-side resources used by WordPress Coupon Plugin for Bloggers and Marketers – WP Offers
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /8.37 ▲4.8581.48 ▲23.29
Dashboard /wp-admin8.39 ▲4.9866.43 ▲34.26
Posts /wp-admin/edit.php8.39 ▲4.7470.15 ▲33.90
Add New Post /wp-admin/post-new.php10.76 ▲3.79129.77 ▼1,143.94
Media Library /wp-admin/upload.php8.39 ▲5.0852.00 ▲23.92
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.3953.07

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 221 new files
Database: no new tables, 4 new options
New WordPress options
fs_debug_mode
fs_gdpr
fs_accounts
fs_active_plugins

Browser metrics Passed 4 tests

A check of browser resources used by WordPress Coupon Plugin for Bloggers and Marketers – WP Offers
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,848 ▲10416.37 ▲0.717.83 ▲0.952.40 ▼0.67
Dashboard /wp-admin2,957 ▲966.16 ▲0.06114.83 ▼15.88172.22 ▲6.21
Posts /wp-admin/edit.php2,753 ▲653.38 ▲0.0264.91 ▲2.68153.95 ▲14.95
Add New Post /wp-admin/post-new.php1,662 ▲120.58 ▲4.36424.37 ▼8.19144.80 ▼5.80
Media Library /wp-admin/upload.php1,763 ▲655.54 ▲0.01133.78 ▼9.06204.65 ▲15.74
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,4632.8356.38118.04

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/wp-offers/includes/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • The uninstall procedure has failed, leaving 4 options in the database
    • fs_gdpr
    • fs_debug_mode
    • fs_accounts
    • fs_active_plugins

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
Please fix the following items
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wp-offers/includes/options-kit/view/options.php
    • > /wp-content/plugins/wp-offers/includes/edit-form-coupon.php
    • > /wp-content/plugins/wp-offers/templates/coupons.php
  • 11× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: coupons in wp-content/plugins/wp-offers/templates/coupons.php on line 16
    • > PHP Fatal error
      Uncaught Error: Call to a member function offer_text() on null in wp-content/plugins/wp-offers/templates/item/default.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-offers/includes/options.php:484
    • > PHP Fatal error
      Uncaught Error: Class 'WPOffers\\Coupon' not found in wp-content/plugins/wp-offers/includes/class-coupon-preview.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/wp-offers/includes/options-kit/class-options-kit.php:459
    • > PHP Fatal error
      Uncaught Error: Call to a member function offer_text() on null in wp-content/plugins/wp-offers/templates/item/grid.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WPOffers\\add_action() in wp-content/plugins/wp-offers/includes/class-ask-for-review.php:113
    • > PHP Notice
      Undefined variable: coupon in wp-content/plugins/wp-offers/templates/item/default.php on line 19
    • > PHP Notice
      Undefined variable: coupon in wp-content/plugins/wp-offers/templates/item/grid.php on line 18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/wp-offers/includes/preview.php:14

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

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
8 plugin tags: affiliate marketing, wp offers, affiliates, affiliate coupons, coupon...

wp-offers/wp-offers.php 92% from 13 tests

The main PHP file in "WordPress Coupon Plugin for Bloggers and Marketers – WP Offers" ver. 1.1.4 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 146 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin52,224 lines of code in 175 files:
LanguageFilesBlank linesComment linesLines of code
PHP1327,68618,06532,707
JavaScript184,2892,72918,135
CSS21101271,139
Markdown1680214
JSON10027
SVG2002

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 2,910)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity78.93
▷ Minimum class complexity1.00
▷ Maximum class complexity2,910.00
Average method complexity4.48
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes54
▷ Abstract classes23.70%
▷ Concrete classes5296.30%
▷ Final classes00.00%
Methods1,244
▷ Static methods17614.15%
▷ Public methods89571.95%
▷ Protected methods151.21%
▷ Private methods33426.85%
Functions123
▷ Named functions11291.06%
▷ Anonymous functions118.94%
Constants126
▷ Global constants10180.16%
▷ Class constants2519.84%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
3 PNG files occupy 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
includes/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
includes/freemius/assets/img/wp-offers.png34.43KB11.84KB▼ 65.61%