84% post-and-page-specific-product-ads

Code Review | Post and Page Specific Product Ads

WordPress plugin Post and Page Specific Product Ads scored 84% from 54 tests.

About plugin

  • Plugin page: post-and-page-spe...
  • Plugin version: 1.0.4
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-4.9.8
  • WordPress version: 5.9.2
  • First release: Jul 14, 2018
  • Latest release: Nov 3, 2018
  • Number of updates: 20
  • Update frequency: every 5.6 days
  • Top authors: grrega (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 619 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼291.02ms] Passed 4 tests

This is a short check of server-side resources used by Post and Page Specific Product Ads
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.1658.78 ▲8.04
Dashboard /wp-admin3.49 ▲0.0961.07 ▲19.50
Posts /wp-admin/edit.php3.73 ▲0.0939.96 ▲1.11
Add New Post /wp-admin/post-new.php6.96 ▼0.0197.84 ▼1,180.47
Media Library /wp-admin/upload.php3.38 ▲0.0832.32 ▲7.23

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 29 new files
Database: no new tables, 2 new options
New WordPress options
papspa_settings
papspa_version

Browser metrics Passed 4 tests

A check of browser resources used by Post and Page Specific Product Ads
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,805 ▲8315.70 ▼0.026.85 ▲0.152.89 ▲0.84
Dashboard /wp-admin2,905 ▲476.15 ▼0.10122.48 ▼15.11161.31 ▼2.84
Posts /wp-admin/edit.php2,680 ▼83.24 ▲0.0098.67 ▲32.85161.05 ▲12.16
Add New Post /wp-admin/post-new.php1,779 ▲2122.04 ▲0.72448.83 ▼39.42164.28 ▼56.12
Media Library /wp-admin/upload.php1,708 ▲135.48 ▲0.02150.47 ▼2.26197.83 ▼36.79

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 2 options in the database
    • papspa_settings
    • papspa_version

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

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
Please fix the following
  • 14× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/post-and-page-specific-product-ads/templates/shortcode_ad-vertical.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/post-and-page-specific-product-ads/includes/class-papspa-widget.php:10
    • > PHP Notice
      Undefined variable: nonce in wp-content/plugins/post-and-page-specific-product-ads/includes/views/papspa_metabox.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'PAPSPA' not found in wp-content/plugins/post-and-page-specific-product-ads/admin/class-papspa-admin.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PAPSPA' not found in wp-content/plugins/post-and-page-specific-product-ads/public/class-papspa-public.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PAPSPA' not found in wp-content/plugins/post-and-page-specific-product-ads/admin/class-papspa-settings.php:10
    • > PHP Notice
      Undefined variable: nonce in wp-content/plugins/post-and-page-specific-product-ads/includes/views/papspa_category_form.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/post-and-page-specific-product-ads/includes/views/papspa_metabox.php:14
    • > PHP Notice
      Undefined variable: link in wp-content/plugins/post-and-page-specific-product-ads/templates/widget_ad.php on line 11
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/post-and-page-specific-product-ads/includes/views/papspa_metabox.php on line 12

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

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

post-and-page-specific-product-ads/post-and-page-specific-product-ads.php 92% from 13 tests

"Post and Page Specific Product Ads" version 1.0.4'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:
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.4.0" instead of "3.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected2,166 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP181877611,604
CSS3348326
PO File16274160
JavaScript28076

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity49.78
▷ Minimum class complexity1.00
▷ Maximum class complexity126.00
Average method complexity6.05
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods87
▷ Static methods44.60%
▷ Public methods8294.25%
▷ Protected methods00.00%
▷ Private methods55.75%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
PNG images were not found in this plugin