68% ad-shortcodes

Code Review | Zumi Ad Shortcodes

WordPress plugin Zumi Ad Shortcodes scored 68% from 54 tests.

About plugin

  • Plugin page: ad-shortcodes
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.9.2
  • WordPress version: 6.3.1
  • First release: Jun 13, 2022
  • Latest release: Jun 13, 2022
  • Number of updates: 3
  • Update frequency: every 4.0 days
  • Top authors: zuminet (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 176 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: ▼1.89MB] [CPU: ▼49.95ms] Passed 4 tests

A check of server-side resources used by Zumi Ad Shortcodes
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.10 ▼1.367.52 ▼31.83
Dashboard /wp-admin2.12 ▼1.188.37 ▼42.42
Posts /wp-admin/edit.php2.12 ▼1.248.15 ▼36.57
Add New Post /wp-admin/post-new.php2.12 ▼3.778.78 ▼88.99
Media Library /wp-admin/upload.php2.12 ▼1.116.85 ▼29.08
Manage Ad Shortcode /wp-admin/admin.php?page=zumi-ad-shortcodes2.127.61
Manage Ads /wp-admin/admin.php?page=zumi-ads2.129.44
Manage Fixed Ads /wp-admin/admin.php?page=zumi-fixed-ads2.128.43

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_theysaidso_widget
widget_zumi_ads
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Zumi Ad Shortcodes
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,955 ▲22014.74 ▲0.371.96 ▲0.1933.30 ▼10.35
Dashboard /wp-admin2,267 ▲794.88 ▼1.02112.22 ▼5.9446.54 ▲1.32
Posts /wp-admin/edit.php2,156 ▲672.04 ▲0.0140.77 ▲5.7047.10 ▲9.31
Add New Post /wp-admin/post-new.php1,430 ▼8417.45 ▼0.17535.67 ▼155.6763.88 ▲3.93
Media Library /wp-admin/upload.php1,452 ▲644.19 ▼0.0195.00 ▼15.8744.92 ▼5.51
Manage Ad Shortcode /wp-admin/admin.php?page=zumi-ad-shortcodes8852.1724.6531.80
Manage Ads /wp-admin/admin.php?page=zumi-ads8962.0226.0639.24
Manage Fixed Ads /wp-admin/admin.php?page=zumi-fixed-ads8712.1823.8233.26

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin did not uninstall without warnings or errors
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the zumi-location-confirm handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • The uninstall procedure has failed, leaving 7 options in the database
    • db_upgraded
    • widget_zumi_ads
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments

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
These errors were triggered by the plugin
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zumi-fixed-ads
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the zumi-location-confirm handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zumi-fixed-ads
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the zumi-location-confirm handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zumi-fixed-ads
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the ZumiAdCSS handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zumi-fixed-ads
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the font-awesome handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zumi-fixed-ads
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the ZumiAdCSS handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=zumi-fixed-ads
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the font-awesome handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/admin.php?page=zumi-ads
    • > Notice in wp-content/plugins/ad-shortcodes/managements/ads.php+42
    Undefined variable: page

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 15× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/ad-shortcodes/display.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'ZumiAdModel' not found in wp-content/plugins/ad-shortcodes/db/Shortcode.php:5
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/ad-shortcodes/managements/shortcode.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'ZumiAdShortcode' not found in wp-content/plugins/ad-shortcodes/managements/shortcode.php:8
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/ad-shortcodes/managements/ad.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'Sanitize' not found in wp-content/plugins/ad-shortcodes/managements/fixed_ads.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'ZumiAd' not found in wp-content/plugins/ad-shortcodes/managements/ad.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'ZumiFixedAd' not found in wp-content/plugins/ad-shortcodes/managements/fixed_ad.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Sanitize' not found in wp-content/plugins/ad-shortcodes/managements/ads.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Sanitize' not found in wp-content/plugins/ad-shortcodes/managements/shortcodes.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Contributors: The plugin contributors field is missing
  • Screenshots: These screenshots require images: #1 (screenshot/screenshot1.png), #2 (screenshot/screenshot2.png), #3 (screenshot/screenshot3.png)
The official readme.txt might help

ad-shortcodes/index.php 92% from 13 tests

"Zumi Ad Shortcodes" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("ad-shortcodes.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin1,059 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP18348377996
CSS122059
JavaScript1304

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity4.50
▷ Minimum class complexity1.00
▷ Maximum class complexity11.00
Average method complexity2.22
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes112.50%
▷ Concrete classes787.50%
▷ Final classes00.00%
Methods24
▷ Static methods1041.67%
▷ Public methods2291.67%
▷ Protected methods00.00%
▷ Private methods28.33%
Functions11
▷ Named functions19.09%
▷ Anonymous functions1090.91%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 compressed PNG files occupy 0.03MB
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshots/screenshot3.png8.86KB8.84KB0.26%
screenshots/screenshot1.png13.20KB12.97KB▼ 1.79%
screenshots/screenshot2.png6.90KB6.54KB▼ 5.26%