84% ad-publisher

Code Review | AD Publisher - Automatically insert post ads

WordPress plugin AD Publisher - Automatically insert post ads scored84%from 54 tests.

About plugin

  • Plugin page: ad-publisher
  • Plugin version: 1.1.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.0
  • WordPress version: 6.3.1
  • First release: Jan 30, 2019
  • Latest release: Apr 30, 2019
  • Number of updates: 21
  • Update frequency: every 4.3 days
  • Top authors: adsstudio (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /4,052 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 gracefully, with no errors

Server metrics [RAM: ▲0.17MB] [CPU: ▼5.15ms] Passed 4 tests

This is a short check of server-side resources used by AD Publisher - Automatically insert post ads
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1742.98 ▲1.25
Dashboard /wp-admin3.47 ▲0.1748.53 ▼3.89
Posts /wp-admin/edit.php3.59 ▲0.2345.19 ▼5.50
Add New Post /wp-admin/post-new.php6.05 ▲0.1785.09 ▼12.44
Media Library /wp-admin/upload.php3.40 ▲0.1739.29 ▲7.69
Add New Ad /wp-admin/post-new.php?post_type=adpublisher3.4742.97
Modules /wp-admin/edit.php?post_type=adpublisher&page=adp_modules3.3833.11
Settings /wp-admin/edit.php?post_type=adpublisher3.4439.07

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 28 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for AD Publisher - Automatically insert post ads
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,851 ▲9014.35 ▼0.311.95 ▲0.4144.13 ▲7.71
Dashboard /wp-admin2,226 ▲525.52 ▼0.0681.91 ▼6.0961.79 ▲18.70
Posts /wp-admin/edit.php2,117 ▲171.99 ▼0.0438.07 ▲3.1132.97 ▼6.17
Add New Post /wp-admin/post-new.php6,427 ▲4,90127.51 ▲4.53981.47 ▲321.4959.72 ▼0.51
Media Library /wp-admin/upload.php1,437 ▲404.15 ▼0.0198.34 ▼6.4864.83 ▲19.31
Add New Ad /wp-admin/post-new.php?post_type=adpublisher1,6772.5246.5949.45
Modules /wp-admin/edit.php?post_type=adpublisher&page=adp_modules1,0361.8224.4449.96
Settings /wp-admin/edit.php?post_type=adpublisher1,1902.0534.4240.34

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

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
Please fix the following items
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/ad-publisher/includes/views/modules.php:2
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/ad-publisher/includes/views/adp-post-metabox.php on line 4
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/ad-publisher/includes/views/adp-post-metabox.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_current_screen() in wp-content/plugins/ad-publisher/includes/views/settings.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_current_screen() in wp-content/plugins/ad-publisher/includes/views/head.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Upgrader_Skin' not found in wp-content/plugins/ad-publisher/includes/classes/class-upgrader-skin.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/ad-publisher/includes/views/adp-post-metabox.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
8 plugin tags: ad injection, adsense, ad manager, adsense injection, ads...

ad-publisher/ad-publisher.php Passed 13 tests

"AD Publisher - Automatically insert post ads" version 1.1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
45 characters long description:
Plugin for automatic insertion of the ad code

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
Success! There were no dangerous files found in this plugin2,319 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP123238331,356
CSS210322562
PO File2121130343
JavaScript17158

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity28.86
▷ Minimum class complexity1.00
▷ Maximum class complexity134.00
Average method complexity3.79
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes114.29%
Methods70
▷ Static methods1014.29%
▷ Public methods6390.00%
▷ Protected methods57.14%
▷ Private methods22.86%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants218.18%
▷ Class constants981.82%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon.png18.55KB0.71KB▼ 96.18%
assets/images/module-1.png10.47KB4.68KB▼ 55.29%
assets/images/module-4.png23.24KB4.23KB▼ 81.81%
assets/images/module-2.png2.04KB1.71KB▼ 16.29%
assets/images/module-3.png1.80KB2.01KB0.00%