77% ad-inserter

Code Review | Ad Inserter - Ad Manager & AdSense Ads

WordPress plugin Ad Inserter - Ad Manager & AdSense Ads scored77%from 54 tests.

About plugin

  • Plugin page: ad-inserter
  • Plugin version: 2.7.32
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5-6.3
  • WordPress version: 6.3.1
  • First release: Nov 14, 2010
  • Latest release: Oct 30, 2023
  • Number of updates: 1,593
  • Update frequency: every 3.0 days
  • Top authors: spacetime (100%)

Code review

54 tests

User reviews

2221 reviews

Install metrics

300,000+ active /14,197,790 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲7.35MB] [CPU: ▲60.55ms] 75% from 4 tests

An overview of server-side resources used by Ad Inserter - Ad Manager & AdSense Ads
The following require your attention
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 7.35MB on /wp-admin/ad-inserter.php)
PageMemory (MB)CPU Time (ms)
Home /10.95 ▲7.49110.22 ▲70.41
Dashboard /wp-admin10.65 ▲7.31108.86 ▲43.28
Posts /wp-admin/edit.php10.71 ▲7.35120.41 ▲73.17
Add New Post /wp-admin/post-new.php13.26 ▲7.36148.27 ▲55.33
Media Library /wp-admin/upload.php10.60 ▲7.37116.32 ▲83.02

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 1,897 new files
Database: no new tables, 9 new options
New WordPress options
ai-install
db_upgraded
can_compress_scripts
widget_ai_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
dst_notification_times

Browser metrics Passed 4 tests

This is an overview of browser requirements for Ad Inserter - Ad Manager & AdSense Ads
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,888 ▲14214.70 ▲0.355.61 ▲3.9638.70 ▼5.39
Dashboard /wp-admin2,232 ▲525.67 ▲0.02102.51 ▲14.8075.61 ▲36.43
Posts /wp-admin/edit.php2,153 ▲532.12 ▲0.1242.84 ▲6.9535.45 ▲0.53
Add New Post /wp-admin/post-new.php1,727 ▲20120.28 ▼3.34692.89 ▲5.5081.25 ▲25.53
Media Library /wp-admin/upload.php1,449 ▲494.28 ▲0.09107.65 ▲6.2180.39 ▲36.32
Ad Inserter /wp-admin/ad-inserter.php260.420.0913.12

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_ai_widget
    • widget_recent-posts
    • ai-install
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • dst_notification_times
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

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
  • 808× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'ParagonIE\\ConstantTime\\Base32' not found in wp-content/plugins/ad-inserter/includes/google-api/vendor/paragonie/constant_time_encoding/src/Base32Hex.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Formatter\ormalizerFormatter' not found in wp-content/plugins/ad-inserter/includes/google-api-8/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/ad-inserter/includes/google-api/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/ad-inserter/includes/google-api/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Event\\SubscriberInterface' not found in wp-content/plugins/ad-inserter/includes/google-api-8/vendor/google/auth/src/Subscriber/AuthTokenSubscriber.php:37
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' not found in wp-content/plugins/ad-inserter/includes/google-api-8/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v1.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/ad-inserter/includes/google-api-8/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php:73
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Auth\\CredentialsLoader' not found in wp-content/plugins/ad-inserter/includes/google-api-8/vendor/google/auth/src/Credentials/UserRefreshCredentials.php:35
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Model' not found in wp-content/plugins/ad-inserter/includes/google-api-8/vendor/google/apiclient-services/src/Adsense/ContentAdsSettings.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Collection' not found in wp-content/plugins/ad-inserter/includes/google-api/vendor/google/apiclient-services/src/Adsense/ListLinkedAdUnitsResponse.php:20

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There are user-side issues you should fix
    • > GET request to /wp-admin/ad-inserter.php
    • > Network (severe)
    wp-admin/ad-inserter.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
You can take inspiration from this readme.txt

ad-inserter/ad-inserter.php 92% from 13 tests

"Ad Inserter - Ad Manager & AdSense Ads" version 2.7.32's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Requires at least: Please use periods and digits for the required version (ex. "7.0" instead of "5")

Code Analysis 95% from 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
Good job! No executable or dangerous file extensions detected217,974 lines of code in 1,318 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,02126,31671,093148,727
JavaScript1616,3916,37127,412
PO File118,40411,36724,468
Markdown583,751010,851
JSON38003,845
CSS12473782,259
YAML6271164
Python24450149
XML50076
Dockerfile18010
make1409
Bourne Shell1203
HTML1001

PHP code 0% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
These items need your attention
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 2,727)
  • Method cyclomatic complexity should be reduced to less than 100 (currently 642)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity15.43
▷ Minimum class complexity1.00
▷ Maximum class complexity2,727.00
Average method complexity3.73
▷ Minimum method complexity1.00
▷ Maximum method complexity642.00
Code structure
Namespaces83
Interfaces90
Traits26
Classes1,326
▷ Abstract classes43332.65%
▷ Concrete classes89367.35%
▷ Final classes9210.30%
Methods7,714
▷ Static methods1,48619.26%
▷ Public methods5,89976.47%
▷ Protected methods84710.98%
▷ Private methods96812.55%
Functions764
▷ Named functions46560.86%
▷ Anonymous functions29939.14%
Constants2,479
▷ Global constants1,40356.60%
▷ Class constants1,07643.40%
▷ Public constants1,04396.93%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
31 PNG files occupy 0.17MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/ui-icons_222222_256x240.png6.76KB4.17KB▼ 38.24%
images/ai-amp.png8.67KB8.92KB0.00%
css/images/ui-icons_cd0a0a_256x240.png4.44KB4.17KB▼ 6.02%
images/ai-charts-250.png10.03KB10.29KB0.00%
css/images/ui-icons_888888_256x240.png6.83KB4.17KB▼ 38.92%