10% magic-wp-coupons

Code Review | Magic WP Coupons - Lite

WordPress plugin Magic WP Coupons - Lite scored10%from 54 tests.

About plugin

  • Plugin page: magic-wp-coupons
  • Plugin version: 3.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.5
  • WordPress version: 6.3.1
  • First release: Dec 28, 2012
  • Latest release: Apr 20, 2016
  • Number of updates: 44
  • Update frequency: every 27.5 days
  • Top authors: shahzad11 (100%)

Code review

54 tests

User reviews

19 reviews

Install metrics

10+ active /23,771 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Please fix the following installer errors
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/magic-wp-coupons/admin/widgets/latest_coupons.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; dv_latest_coupons_widget has a deprecated constructor

Server metrics [RAM: ▼1.87MB] [CPU: ▼53.31ms] Passed 4 tests

Analyzing server-side resources used by Magic WP Coupons - Lite
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.13 ▼1.335.65 ▼35.18
Dashboard /wp-admin2.15 ▼1.209.41 ▼53.62
Posts /wp-admin/edit.php2.15 ▼1.217.99 ▼37.00
Add New Post /wp-admin/post-new.php2.15 ▼3.747.96 ▼87.44
Media Library /wp-admin/upload.php2.15 ▼1.086.96 ▼26.08
Add New Coupon /wp-admin/post-new.php?post_type=coupons2.157.76
Stores /wp-admin/edit-tags.php?taxonomy=stores&post_type=coupons2.158.72
All Coupons /wp-admin/edit.php?post_type=coupons2.157.62

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 474 new files
Database: 3 new tables, 9 new options
New tables
wp_taxonomymeta
dv_cloaked_urls
dv_report
New WordPress options
theysaidso_admin_options
widget_dv_coupons_popular_widget_id
widget_dv_coupons_stores_widget_id
widget_recent-posts
can_compress_scripts
widget_home_top_work_widget
widget_theysaidso_widget
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Magic WP Coupons - Lite
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,220 ▲47414.60 ▲0.027.95 ▲6.1727.05 ▼19.11
Dashboard /wp-admin2,452 ▲2646.06 ▲0.97119.29 ▲5.5547.63 ▲2.08
Posts /wp-admin/edit.php2,200 ▲1112.78 ▲0.7842.31 ▲5.9741.44 ▲3.04
Add New Post /wp-admin/post-new.php1,603 ▲8218.64 ▼4.51642.42 ▼71.9434.12 ▼24.23
Media Library /wp-admin/upload.php1,489 ▲985.22 ▲1.04103.63 ▲1.5441.50 ▼3.14
Add New Coupon /wp-admin/post-new.php?post_type=coupons2,3914.8182.0736.67
Stores /wp-admin/edit-tags.php?taxonomy=stores&post_type=coupons1,4002.5239.9531.31
All Coupons /wp-admin/edit.php?post_type=coupons1,2522.7539.1429.77

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/magic-wp-coupons/admin/widgets/latest_coupons.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; dv_latest_coupons_widget has a deprecated constructor
  • Zombie tables were found after uninstall: 3 tables
    • wp_taxonomymeta
    • dv_report
    • dv_cloaked_urls
  • This plugin does not fully uninstall, leaving 9 options in the database
    • db_upgraded
    • widget_recent-comments
    • widget_dv_coupons_popular_widget_id
    • widget_dv_coupons_stores_widget_id
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_home_top_work_widget
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > Deprecated in wp-content/plugins/magic-wp-coupons/admin/widgets/latest_coupons.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; dv_latest_coupons_widget has a deprecated constructor
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > Deprecated in wp-content/plugins/magic-wp-coupons/admin/widgets/popular_coupons.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; dv_popular_coupons_widget has a deprecated constructor
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > Deprecated in wp-content/plugins/magic-wp-coupons/admin/widgets/coupon_stores.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; dv_coupon_stores_widget has a deprecated constructor
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > Deprecated in wp-content/plugins/magic-wp-coupons/lib/report.class.php+8
    Methods with the same name as their class will not be constructors in a future version of PHP; DV_Coupon_Report has a deprecated constructor
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > User notice in wp-includes/functions.php+5905
    Function register_sidebar was called incorrectly. No id was set in the arguments array for the "Blog Sidebar" sidebar. Defaulting to "sidebar-1". Manually set the id to "sidebar-1" to silence this notice and keep existing sidebar content. Please see Debugging in WordPress for more information. (This message was added in version 4.2.0.)
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in dv_latest_coupons_widget is deprecated since version 4.3.0! Use __construct() instead.
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in dv_popular_coupons_widget is deprecated since version 4.3.0! Use __construct() instead.
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=coupons
    • > POST request to /wp-admin/admin-ajax.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in dv_coupon_stores_widget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/post-new.php?post_type=coupons
    • > Notice in wp-content/plugins/magic-wp-coupons/admin/meta_box.php+104
    Undefined index: dv_coupons_meta_box_nonce
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=coupons
    • > Notice in wp-content/plugins/magic-wp-coupons/admin/meta_box.php+71
    Undefined index: std

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
  • 40× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-wp-coupons/lib/functions.php:116
    • > PHP Notice
      Undefined variable: shortname in wp-content/plugins/magic-wp-coupons/admin/includes/data_options.php on line 16
    • > PHP Warning
      Use of undefined constant PLUGIN_BASE - assumed 'PLUGIN_BASE' (this will throw an Error in a future version of PHP) in wp-content/plugins/magic-wp-coupons/admin/includes/data_options.php on line 112
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_template_directory() in wp-content/plugins/magic-wp-coupons/taxonomy-stores.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/magic-wp-coupons/lib/admin_reporting.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/magic-wp-coupons/index.php:17
    • > PHP Notice
      Undefined variable: shortname in wp-content/plugins/magic-wp-coupons/admin/includes/data_options.php on line 220
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-wp-coupons/admin/term_meta_class.php:5
    • > PHP Notice
      Undefined variable: shortname in wp-content/plugins/magic-wp-coupons/admin/includes/data_options.php on line 144
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/magic-wp-coupons/lib/cron.php:26

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

readme.txt 88% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Tags: You are using too many tags: 22 tag instead of maximum 10
  • Screenshots: These screenshots require images: #1 (Magic WP Coupons settings page to enable/disable features), #2 (Uploading and activating new templates), #3 (Managing coupon stores), #4 (Adding new coupons manually), #5 (Using shortcode insert button), #6 (Adding shortcodes to page or posts), #7 (The front-end of the site with coupons displayed with activated template)
The official readme.txt is a good inspiration

magic-wp-coupons/index.php 85% from 13 tests

The primary PHP file in "Magic WP Coupons - Lite" version 3.0 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 148 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("magic-wp-coupons.php" instead of "index.php")

Code Analysis Passed 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
There were no executable files found in this plugin32,001 lines of code in 131 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript373,4792,03619,095
CSS292,068956,387
PHP311,4005274,245
HTML28582121,527
SVG100504
LESS2174197
Markdown224035
JSON10011

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity32.18
▷ Minimum class complexity2.00
▷ Maximum class complexity208.00
Average method complexity3.93
▷ Minimum method complexity1.00
▷ Maximum method complexity65.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods117
▷ Static methods32.56%
▷ Public methods8673.50%
▷ Protected methods3025.64%
▷ Private methods10.85%
Functions81
▷ Named functions81100.00%
▷ Anonymous functions00.00%
Constants57
▷ Global constants57100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
149 PNG files occupy 1.73MB with 0.64MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
templates/superfoodcoupons/sprite.png18.56KB8.40KB▼ 54.75%
templates/koupon/images/googleplus.png6.06KB3.22KB▼ 46.83%
admin/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png0.27KB0.13KB▼ 51.45%
templates/mycoupons/code.png1.02KB0.93KB▼ 8.69%
admin/images/custom_hsb_s.png1.14KB0.89KB▼ 21.75%