78% coupon-central

Code Review | Coupon Central

WordPress plugin Coupon Central scored78%from 54 tests.

About plugin

  • Plugin page: coupon-central
  • Plugin version: 1.0.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.7.2
  • WordPress version: 6.3.1
  • First release: Sep 10, 2020
  • Latest release: Jun 7, 2021
  • Number of updates: 9
  • Update frequency: every 30.1 days
  • Top authors: wakamin (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /433 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.36MB] [CPU: ▼1.31ms] Passed 4 tests

This is a short check of server-side resources used by Coupon Central
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.86 ▲0.4049.06 ▲7.29
Dashboard /wp-admin3.67 ▲0.3745.74 ▼1.22
Posts /wp-admin/edit.php3.73 ▲0.3851.43 ▲3.97
Add New Post /wp-admin/post-new.php6.32 ▲0.4391.70 ▼5.16
Media Library /wp-admin/upload.php3.53 ▲0.3034.19 ▼2.81
Stores /wp-admin/edit-tags.php?taxonomy=sd_coupon_store&post_type=sd_coupon3.5235.49
Categories /wp-admin/edit-tags.php?taxonomy=sd_coupon_category&post_type=sd_coupon3.5330.61
Add New /wp-admin/post-new.php?post_type=sd_coupon5.9070.88
All Coupons /wp-admin/edit.php?post_type=sd_coupon3.6844.50

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 60 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
db_upgraded
widget_sdcoupon_widget_random_coupons

Browser metrics Passed 4 tests

A check of browser resources used by Coupon Central
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲19313.97 ▼0.686.98 ▲5.2443.02 ▼0.03
Dashboard /wp-admin2,251 ▲666.03 ▲0.9598.60 ▼6.4639.27 ▼5.10
Posts /wp-admin/edit.php2,144 ▲552.00 ▲0.0340.82 ▲1.9335.54 ▲2.91
Add New Post /wp-admin/post-new.php1,549 ▲2023.38 ▲5.28600.97 ▼74.1050.48 ▼7.95
Media Library /wp-admin/upload.php1,436 ▲484.32 ▼0.0597.14 ▼18.1840.66 ▼9.23
Stores /wp-admin/edit-tags.php?taxonomy=sd_coupon_store&post_type=sd_coupon1,3152.1427.6934.96
Categories /wp-admin/edit-tags.php?taxonomy=sd_coupon_category&post_type=sd_coupon1,3452.2731.5625.48
Add New /wp-admin/post-new.php?post_type=sd_coupon6,37120.30902.1945.26
All Coupons /wp-admin/edit.php?post_type=sd_coupon1,3443.7865.0630.34

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_sdcoupon_widget_random_coupons

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/post-new.php?post_type=sd_coupon
    • > Notice in wp-content/plugins/coupon-central/includes/services/class-sdcoupon-coupon-service.php+59
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/post-new.php?post_type=sd_coupon
    • > Notice in wp-content/plugins/coupon-central/views/admin/coupon/meta-box/coupon-detail.php+16
    Trying to get property 'term_id' of non-object

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 17× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/coupon-central/views/admin/store/meta-box/store-logo.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/coupon-central/views/frontend/coupon/coupon-archive.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sdcc_coupon_image() in wp-content/plugins/coupon-central/views/frontend/coupon/coupon-card.php:3
    • > PHP Notice
      Undefined variable: logo in wp-content/plugins/coupon-central/views/admin/store/meta-box/store-logo.php on line 3
    • > PHP Notice
      Undefined variable: mediaBtnData in wp-content/plugins/coupon-central/views/share/add-media-button.php on line 11
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/coupon-central/views/share/add-media-button.php on line 3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/coupon-central/views/share/add-media-button.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sdcc_render_media_button() in wp-content/plugins/coupon-central/views/admin/coupon/taxonomy/category/category-icon-field.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sdcc_render_media_button() in wp-content/plugins/coupon-central/views/admin/coupon/taxonomy/store/store-logo-field.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/coupon-central/includes/widgets/class-sdcoupon-widget-random-coupons.php:4

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

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
3 plugin tags: coupon, discount, promo

coupon-central/coupon-central.php 92% from 13 tests

Analyzing the main PHP file in "Coupon Central" version 1.0.1
It is important to fix the following:
  • Text Domain: The text domain name must use dashes instead of underscores, and it must be lowercase

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin3,810 lines of code in 54 files:
LanguageFilesBlank linesComment linesLines of code
CSS3386551,574
PHP323056171,511
Sass14650393
PO File18499210
JavaScript42227122

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity3.76
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.60
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes16
▷ Abstract classes00.00%
▷ Concrete classes16100.00%
▷ Final classes00.00%
Methods82
▷ Static methods33.66%
▷ Public methods82100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions18
▷ Named functions1794.44%
▷ Anonymous functions15.56%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/logo-placeholder.png0.83KB0.82KB▼ 1.87%
src/assets/images/logo-placeholder.png2.30KB0.82KB▼ 64.37%