74% wp-coupons-and-deals

Code Review | WP Coupons and Deals - WordPress Coupon Plugin

WordPress plugin WP Coupons and Deals - WordPress Coupon Plugin scored74%from 54 tests.

About plugin

  • Plugin page: wp-coupons-and-deals
  • Plugin version: 3.2.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.3
  • WordPress version: 6.3.1
  • First release: Apr 16, 2017
  • Latest release: Sep 13, 2023
  • Number of updates: 159
  • Update frequency: every 14.7 days
  • Top authors: imtiazrayhan (100%)

Code review

54 tests

User reviews

122 reviews

Install metrics

2,000+ active /104,996 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.76MB] [CPU: ▲5.33ms] Passed 4 tests

Server-side resources used by WP Coupons and Deals - WordPress Coupon Plugin
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.21 ▲0.7548.43 ▲11.35
Dashboard /wp-admin4.12 ▲0.7855.78 ▼7.59
Posts /wp-admin/edit.php4.18 ▲0.8253.89 ▲7.25
Add New Post /wp-admin/post-new.php6.62 ▲0.74109.57 ▲10.30
Media Library /wp-admin/upload.php4.02 ▲0.7948.01 ▲16.21
Freemius Debug [v.2.5.12] /wp-admin/admin.php?page=freemius4.4143.63
WP Coupons and Deals /wp-admin/index.php?page=wpcd_welcome_menu_page4.1241.94

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 312 new files
Database: no new tables, 14 new options
New WordPress options
widget_recent-posts
widget_wpcd_coupons_deals_widget
widget_theysaidso_widget
db_upgraded
widget_recent-comments
wpcd_form-shortcode-split-form
theysaidso_admin_options
fs_active_plugins
fs_debug_mode
wpcd_review_notify
...

Browser metrics Passed 4 tests

Checking browser requirements for WP Coupons and Deals - WordPress Coupon Plugin
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,272 ▲51115.11 ▲0.767.80 ▲6.2230.52 ▼7.66
Dashboard /wp-admin2,511 ▲3316.18 ▲0.51111.17 ▲23.4997.84 ▲54.17
Posts /wp-admin/edit.php2,328 ▲2283.32 ▲1.3053.17 ▲15.4570.67 ▲39.50
Add New Post /wp-admin/post-new.php1,729 ▲20321.95 ▼1.14609.92 ▼91.9634.46 ▼18.31
Media Library /wp-admin/upload.php1,464 ▲614.20 ▼0.1583.30 ▼19.7979.16 ▲33.80
Freemius Debug [v.2.5.12] /wp-admin/admin.php?page=freemius1,3033.0139.9563.24
WP Coupons and Deals /wp-admin/index.php?page=wpcd_welcome_menu_page1,92410.07269.04138.45

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/wp-coupons-and-deals/includes/sdk/freemius/includes/class-freemius.php+8515
    Undefined property: stdClass::$plugins
  • The uninstall procedure has failed, leaving 14 options in the database
    • widget_wpcd_coupons_deals_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • wpcd_review_notify
    • widget_recent-posts
    • widget_recent-comments
    • fs_accounts
    • wpcd_form-shortcode-enable-thrash
    • db_upgraded
    • wpcd_popup-goto-link
    • ...

Smoke tests 75% 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 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
Please fix the following
  • 8× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/wp-coupons-and-deals/includes/templates/archive/coupon_type__image.php:6
    • > PHP Fatal error
      Trait 'WPCD_Global_Caller_Trait' not found in wp-content/plugins/wp-coupons-and-deals/includes/classes/wpcd-ajax-base.php on line 7
    • > PHP Fatal error
      Trait 'WPCD_Global_Caller_Trait' not found in wp-content/plugins/wp-coupons-and-deals/includes/classes/wpcd-short-code-base.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/wp-coupons-and-deals/includes/templates/extras/vote-system.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_count_posts() in wp-content/plugins/wp-coupons-and-deals/includes/templates/extras/dashboard-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/wp-coupons-and-deals/includes/templates/extras/coupon-link.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_the_title() in wp-content/plugins/wp-coupons-and-deals/includes/templates/widget/widget-default.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/wp-coupons-and-deals/includes/templates/extras/social-share.php:3

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

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
6 plugin tags: coupons, deal, affiliate, deals, affiliate marketing...

wp-coupons-and-deals/wp-coupons-deals.php 92% from 13 tests

This is the main PHP file of "WP Coupons and Deals - WordPress Coupon Plugin" version 3.2.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("wp-coupons-and-deals.php" instead of "wp-coupons-deals.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected50,689 lines of code in 231 files:
LanguageFilesBlank linesComment linesLines of code
PHP1688,87319,14938,912
CSS471,1111757,741
JavaScript73932592,302
PO File36091,3591,712
XML13016
SVG5006

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please tend to the following items
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,088)
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity63.04
▷ Minimum class complexity1.00
▷ Maximum class complexity3,088.00
Average method complexity4.55
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes77
▷ Abstract classes45.19%
▷ Concrete classes7394.81%
▷ Final classes00.00%
Methods1,392
▷ Static methods26218.82%
▷ Public methods99771.62%
▷ Protected methods201.44%
▷ Private methods37526.94%
Functions117
▷ Named functions117100.00%
▷ Anonymous functions00.00%
Constants157
▷ Global constants9862.42%
▷ Class constants5937.58%
▷ Public constants59100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
31 PNG files occupy 0.40MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/admin/img/searchicon.png0.84KB0.46KB▼ 45.23%
assets/img/lightweight.png9.58KB4.40KB▼ 54.07%
assets/admin/img/coupon-200x200.png14.65KB6.15KB▼ 58.02%
assets/img/image.png7.23KB6.31KB▼ 12.76%
assets/img/widget.png7.67KB3.39KB▼ 55.82%