10% ad-blocking-detector

Code Review | Ad Blocking Detector

WordPress plugin Ad Blocking Detector scored 10% from 54 tests.

About plugin

  • Plugin page: ad-blocking-detector
  • Plugin version: 3.6.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-4.7
  • WordPress version: 5.8.1
  • First release: Jan 10, 2014
  • Latest release: Aug 31, 2018
  • Number of updates: 166
  • Update frequency: every 10.2 days
  • Top authors: jtmorris (92.17%)getadmiral (8.43%)

Code review

54 tests

User reviews

25 reviews

Install metrics

300+ active / 42,811 total downloads

Benchmarks

Plugin footprint 39% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Please fix the following installer errors
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/ad-blocking-detector/includes/anti-adblock.php+87
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲1.27MB] [CPU: ▲502.10ms] 75% from 4 tests

A check of server-side resources used by Ad Blocking Detector
The following require your attention
  • Extra CPU: Extra CPU usage should be kept under 200.00ms (currently 502.10ms on /wp-admin/upload.php)
PageMemory (MB)CPU Time (ms)
Home /3.89 ▲1.16827.08 ▲803.82
Dashboard /wp-admin4.53 ▲1.47845.67 ▲797.94
Posts /wp-admin/edit.php4.57 ▲1.46862.03 ▲791.26
Add New Post /wp-admin/post-new.php6.41 ▲0.97855.28 ▲198.22
Media Library /wp-admin/upload.php4.53 ▲1.53258.12 ▲220.98

Server storage [IO: ▲4.35MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
These are issues you should consider
  • There were 270 files (4,067.33KB) illegally modified outside of "wp-content/plugins/ad-blocking-detector/" and "wp-content/uploads/"
    • (new file) wp-content/plugins/evil-treatment/assets/banner-1544x500.png
    • (new file) wp-content/plugins/evil-treatment/assets/anti-adblock/plugin-files/readme.txt
    • (new file) wp-content/plugins/evil-treatment/assets/css/jquery/smoothness-theme/images/ui-bg_flat_0_aaaaaa_40x100.png
    • (new file) wp-content/plugins/evil-treatment/assets/anti-adblock/zip-name.txt
    • (new file) wp-content/plugins/evil-treatment/assets/anti-adblock/well-representative-manual.zip
    • (new file) wp-content/plugins/evil-treatment/assets/anti-adblock/plugin-files/ad-blocking-detector-block-list-countermeasure.php
    • (new file) wp-content/plugins/evil-treatment/assets/css/admin.css
    • (new file) wp-content/plugins/evil-treatment/assets/css/codemirror.css
    • (new file) wp-content/plugins/evil-treatment/ad-blocking-detector-block-list-countermeasure.php
    • (new file) wp-content/plugins/evil-treatment/assets/banner-772x250.png
    • ...
Filesystem: 292 new files
Database: 1 new table, 1 new option
New tables
wp_abd_adblocker_stats
New WordPress options
widget_abd_shortcode_widget

Browser metrics Passed 4 tests

A check of browser resources used by Ad Blocking Detector
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,932 ▲33618.07 ▲2.7218.17 ▲8.0159.12 ▲8.37
Dashboard /wp-admin3,066 ▲1327.76 ▲1.79155.40 ▲12.84113.88 ▲2.33
Posts /wp-admin/edit.php2,823 ▲843.51 ▲0.8087.99 ▲24.5795.09 ▼8.65
Add New Post /wp-admin/post-new.php1,589 ▼2,06315.45 ▼2.93287.20 ▼192.03110.46 ▼4.64
Media Library /wp-admin/upload.php1,903 ▲966.39 ▲1.36148.80 ▼6.33120.76 ▼12.61

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/ad-blocking-detector/includes/anti-adblock.php+221
    Trying to access array offset on value of type bool
  • This plugin does not fully uninstall, leaving 1 option in the database
    • widget_abd_shortcode_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
Good news, no errors were detected

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 take a closer look at the following
  • 17× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      include_once(ABSPATH/wp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/ad-blocking-detector/includes/multisite.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/ad-blocking-detector/ad-blocking-detector.php:56
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/ad-blocking-detector/includes/multisite.php on line 9
    • > PHP Fatal error
      require_once(): Failed opening required 'ABD_ROOT_PATHvendor/AdmiralAdBlockAnalytics.php' (include_path='.:/usr/share/php') in wp-content/plugins/ad-blocking-detector/views/admin-views.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/ad-blocking-detector/assets/anti-adblock/plugin-files/ad-blocking-detector-block-list-countermeasure.php:51
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/ad-blocking-detector/includes/widget.php:7
    • > PHP Warning
      require(ABD_ROOT_PATHincludes/database.php): failed to open stream: No such file or directory in wp-content/plugins/ad-blocking-detector/includes/setup.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ad-blocking-detector/includes/wpsm/settings-manager.php:42
    • > PHP Warning
      require_once(ABD_ROOT_PATHvendor/AdmiralAdBlockAnalytics.php): failed to open stream: No such file or directory in wp-content/plugins/ad-blocking-detector/views/admin-views.php on line 7
    • > PHP Warning
      Use of undefined constant ABD_ROOT_PATH - assumed 'ABD_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/ad-blocking-detector/includes/setup.php on line 10

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
9 plugin tags: adblock plus, detector, ads, block adblock, adblock detector...

ad-blocking-detector/ad-blocking-detector.php 92% from 13 tests

Analyzing the main PHP file in "Ad Blocking Detector" version 3.6.0
The following require your attention:
  • Description: Keep the plugin description shorter than 140 characters (currently 158 characters long)

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Please fix the following items
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/ad-blocking-detector/vendor/caroots.crt
50,212 lines of code in 261 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1264,1102,84431,631
HTML1072,157811,467
PHP201,5611,6855,449
CSS6134971,653
Bourne Shell1259
make1103

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity35.32
▷ Minimum class complexity3.00
▷ Maximum class complexity116.00
Average method complexity3.38
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes19
▷ Abstract classes00.00%
▷ Concrete classes19100.00%
▷ Final classes00.00%
Methods273
▷ Static methods18668.13%
▷ Public methods22783.15%
▷ Protected methods3813.92%
▷ Private methods82.93%
Functions5
▷ Named functions240.00%
▷ Anonymous functions360.00%
Constants18
▷ Global constants1055.56%
▷ Class constants844.44%
▷ Public constants8100.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
16 PNG files occupy 0.31MB with 0.14MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/css/jquery/smoothness-theme/images/ui-bg_glass_75_e6e6e6_1x400.png0.26KB0.15KB▼ 42.37%
assets/css/jquery/smoothness-theme/images/ui-bg_glass_95_fef1ec_1x400.png0.32KB0.15KB▼ 54.82%
assets/banner-1544x500.png210.98KB157.02KB▼ 25.58%
assets/css/jquery/smoothness-theme/images/ui-bg_glass_55_fbf9ee_1x400.png0.33KB0.12KB▼ 62.09%
assets/banner-772x250.png53.95KB33.39KB▼ 38.10%