72% wppopupmagic

Code Review | WP Popup Magic

WordPress plugin WP Popup Magic scored72%from 54 tests.

About plugin

  • Plugin page: wppopupmagic
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.2.1
  • WordPress version: 6.3.1
  • First release: Aug 5, 2019
  • Latest release: Aug 6, 2019
  • Number of updates: 18
  • Update frequency: every 0.2 days
  • Top authors: themelocation (100%)

Code review

54 tests

User reviews

1 review

Install metrics

80+ active /1,194 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.91MB] [CPU: ▲406.49ms] 75% from 4 tests

A check of server-side resources used by WP Popup Magic
The following require your attention
  • Extra CPU: Try to keep extra CPU usage under 200.00ms (currently 406.49ms on /wp-admin/edit.php?post_type=wppum_popup&page=wppum_settings)
PageMemory (MB)CPU Time (ms)
Home /4.48 ▲1.02828.89 ▲786.83
Dashboard /wp-admin4.28 ▲0.98400.31 ▲353.03
Posts /wp-admin/edit.php4.35 ▲1.00402.32 ▲350.37
Add New Post /wp-admin/post-new.php6.53 ▲0.65415.01 ▲302.15
Media Library /wp-admin/upload.php4.27 ▲1.04653.20 ▲620.40
Add New /wp-admin/post-new.php?post_type=wppum_popup4.37396.55
Create New Popup /wp-admin/edit.php?post_type=wppum_popup&page=wppum_create_popup4.27399.43
All Popups /wp-admin/edit.php?post_type=wppum_popup4.31394.00
Preview Popup /wp-admin/admin.php?page=wppum_preview_popup4.26390.18
Settings /wp-admin/edit.php?post_type=wppum_popup&page=wppum_settings4.27378.29

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 163 new files
Database: no new tables, 10 new options
New WordPress options
wppum_popup_rewrite_rules_updated
widget_theysaidso_widget
widget_recent-comments
db_upgraded
recovery_mode_email_last_sent
wppum_version
wppum_settings
can_compress_scripts
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by WP Popup Magic
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,016 ▲27014.83 ▲0.631.56 ▼0.0637.04 ▼2.18
Dashboard /wp-admin2,403 ▲2216.65 ▲0.84133.17 ▲28.8497.23 ▲56.77
Posts /wp-admin/edit.php2,327 ▲2353.50 ▲1.4951.12 ▲6.7178.70 ▲42.36
Add New Post /wp-admin/post-new.php1,572 ▲4421.68 ▲3.72654.60 ▲34.2237.47 ▼13.52
Media Library /wp-admin/upload.php1,463 ▲724.29 ▲0.0482.43 ▼18.2375.73 ▲32.09
Add New /wp-admin/post-new.php?post_type=wppum_popup5,1778.64210.18137.06
Create New Popup /wp-admin/edit.php?post_type=wppum_popup&page=wppum_create_popup1,3843.3044.4386.25
All Popups /wp-admin/edit.php?post_type=wppum_popup1,2543.7445.0673.40
Preview Popup /wp-admin/admin.php?page=wppum_preview_popup7532.0412.7315.81
Settings /wp-admin/edit.php?post_type=wppum_popup&page=wppum_settings1,1833.4343.8766.06

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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 does not fully uninstall, leaving 10 options in the database
    • recovery_mode_email_last_sent
    • widget_theysaidso_widget
    • wppum_popup_rewrite_rules_updated
    • can_compress_scripts
    • wppum_version
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • wppum_settings

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=wppum_popup&page=wppum_settings
    • > Notice in wp-content/plugins/wppopupmagic/class-wppum-admin.php+884
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/post-new.php?post_type=wppum_popup
    • > Notice in wp-content/plugins/wppopupmagic/class-wppum-admin.php+1587
    Undefined index: Title HTML
    • > GET request to /wp-admin/post-new.php?post_type=wppum_popup
    • > Notice in wp-content/plugins/wppopupmagic/class-wppum-admin.php+1587
    Undefined index: OK Button HTML
    • > GET request to /wp-admin/post-new.php?post_type=wppum_popup
    • > Notice in wp-content/plugins/wppopupmagic/class-wppum-admin.php+1587
    Undefined index: Cancel Button HTML
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Notice in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+10
    Undefined index: wppum_preview
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Notice in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+13
    Trying to get property 'post_title' of non-object
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Notice in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+14
    Trying to get property 'ID' of non-object
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Notice in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+16
    Trying to get property 'post_content' of non-object
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Notice in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+17
    Trying to get property 'menu_order' of non-object
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Notice in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+18
    Trying to get property 'post_status' of non-object
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Warning in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+79
    DOMDocument::loadHTML(): Empty string supplied as input
    • > GET request to /wp-admin/admin.php?page=wppum_preview_popup
    • > Error in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php+80
    Uncaught TypeError: Argument 1 passed to DOMNode::removeChild() must be an instance of DOMNode, null given in wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php:80
    Stack trace:
    #0 wp-content/plugins/wppopupmagic/admin/templates/preview-popup-page.php(80): DOMNode->removeChild()
    #1 wp-content/plugins/wppopupmagic/class-wppum-admin.php(698): require_once('/var/www/wordpr...')
    #2 wp-includes/class-wp-hook.php(310): WPPUM_Admin->preview_popup_callback()
    #3 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #4 wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 wp-admin/admin.php(259): do_action()
    #6 {main}
    thrown

SRP 0% 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
Please fix the following
  • 5× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wppopupmagic/admin/templates/newsletter_2.php
    • > /wp-content/plugins/wppopupmagic/admin/templates/newsletter_3.php
    • > /wp-content/plugins/wppopupmagic/admin/templates/newsletter_4.php
    • > /wp-content/plugins/wppopupmagic/admin/templates/newsletter_5.php
    • > /wp-content/plugins/wppopupmagic/admin/templates/newsletter_1.php
  • 153× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wppopupmagic/admin/templates/newsletter_4.php on line 9
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wppopupmagic/admin/templates/newsletter_1.php on line 25
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wppopupmagic/admin/templates/newsletter_4.php on line 49
    • > PHP Notice
      Undefined variable: popup in wp-content/plugins/wppopupmagic/admin/templates/newsletter_4.php on line 49
    • > PHP Notice
      Undefined variable: popup in wp-content/plugins/wppopupmagic/admin/templates/newsletter_1.php on line 34
    • > PHP Notice
      Undefined variable: popup in wp-content/plugins/wppopupmagic/admin/templates/newsletter_4.php on line 11
    • > PHP Notice
      Undefined variable: popup in wp-content/plugins/wppopupmagic/admin/templates/newsletter_5.php on line 71
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wppopupmagic/admin/templates/newsletter_2.php on line 13
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wppopupmagic/admin/templates/newsletter_1.php on line 11
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wppopupmagic/admin/templates/newsletter_5.php on line 71

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
These attributes need to be fixed:
  • Donate link: Invalid URI found ("")
The official readme.txt is a good inspiration

wppopupmagic/wp-popup-magic.php 92% from 13 tests

The main file in "WP Popup Magic" v. 1.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wppopupmagic.php" instead of "wp-popup-magic.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected20,407 lines of code in 36 files:
LanguageFilesBlank linesComment linesLines of code
CSS1014012710,277
PHP159519435,309
SVG1002,671
JavaScript93962202,147
LESS1003

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity95.88
▷ Minimum class complexity1.00
▷ Maximum class complexity381.00
Average method complexity5.66
▷ Minimum method complexity1.00
▷ Maximum method complexity58.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods161
▷ Static methods00.00%
▷ Public methods15696.89%
▷ Protected methods00.00%
▷ Private methods53.11%
Functions6
▷ Named functions350.00%
▷ Anonymous functions350.00%
Constants18
▷ Global constants1794.44%
▷ Class constants15.56%
▷ Public constants1100.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
104 PNG files occupy 3.12MB with 1.52MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/ad.png42.29KB18.16KB▼ 57.06%
images/open-buttons/open-buttons-flat-top-red.png3.53KB0.48KB▼ 86.37%
images/close-buttons/wppum-close-btn-flat-11.png1.19KB0.80KB▼ 32.46%
assets/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png0.30KB0.15KB▼ 49.68%
images/close-buttons/hide-red-cirlce.png0.93KB0.77KB▼ 17.73%