67% ads-for-wp

Code Review | Google Adsense & Banner Ads by AdsforWP

WordPress plugin Google Adsense & Banner Ads by AdsforWP scored67%from 54 tests.

About plugin

  • Plugin page: ads-for-wp
  • Plugin version: 1.9.25
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-6.3
  • WordPress version: 6.3.1
  • First release: Jul 24, 2018
  • Latest release: Sep 12, 2023
  • Number of updates: 131
  • Update frequency: every 14.3 days
  • Top authors: magazine3 (64.89%)mohammed_kaludi (19.08%)ampforwp (17.56%)

Code review

54 tests

User reviews

42 reviews

Install metrics

5,000+ active /186,079 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲3.70MB] [CPU: ▲24.09ms] Passed 4 tests

A check of server-side resources used by Google Adsense & Banner Ads by AdsforWP
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /5.67 ▲2.2165.53 ▲24.73
Dashboard /wp-admin7.55 ▲4.2584.66 ▲36.73
Posts /wp-admin/edit.php7.58 ▲4.2385.90 ▲33.76
Add New Post /wp-admin/post-new.php10.08 ▲4.19117.84 ▲2.10
Media Library /wp-admin/upload.php7.38 ▲4.1574.04 ▲35.78
Analytics /wp-admin/edit.php?post_type=adsforwp&page=adsforwp-analytics7.3867.72
Groups /wp-admin/edit.php?post_type=adsforwp-groups7.4569.80
Settings /wp-admin/edit.php?post_type=adsforwp&page=adsforwp7.4168.51
Ads /wp-admin/edit.php?post_type=adsforwp7.4572.96

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 91 new files
Database: 1 new table, 10 new options
New tables
wp_adsforwp_stats
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
adsforwp_ip_request_2023-10-14
adsforwp_activation_date
db_upgraded
widget_adsforwp_ads_widget
widget_recent-comments
widget_recent-posts
adsforwp-database-on-first-load

Browser metrics Passed 4 tests

This is an overview of browser requirements for Google Adsense & Banner Ads by AdsforWP
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,119 ▲35815.52 ▲1.141.84 ▼0.1945.61 ▲3.40
Dashboard /wp-admin2,507 ▲3276.90 ▲1.20129.56 ▲40.5844.19 ▲2.55
Posts /wp-admin/edit.php2,449 ▲3493.86 ▲1.8572.02 ▲35.4538.52 ▲0.26
Add New Post /wp-admin/post-new.php6,516 ▲4,97128.31 ▲5.05880.17 ▲215.8039.52 ▼14.23
Media Library /wp-admin/upload.php1,583 ▲1894.83 ▲0.6399.67 ▲4.5248.00 ▲3.65
Analytics /wp-admin/edit.php?post_type=adsforwp&page=adsforwp-analytics1,1503.7355.5928.25
Groups /wp-admin/edit.php?post_type=adsforwp-groups1,4273.9463.1531.53
Settings /wp-admin/edit.php?post_type=adsforwp&page=adsforwp2,3135.42116.7140.66
Ads /wp-admin/edit.php?post_type=adsforwp1,5383.9062.2134.01

Uninstaller [IO: ▲0.00MB] [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
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_adsforwp_stats
  • Zombie WordPress options were found after uninstall: 10 options
    • adsforwp-database-on-first-load
    • widget_recent-comments
    • adsforwp_ip_request_2023-10-14
    • widget_adsforwp_ads_widget
    • adsforwp_activation_date
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=adsforwp
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 104× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ADSFORWP_LIB_PATHGoogle/Client.php' (include_path='.:/usr/share/php') in wp-content/plugins/ads-for-wp/admin/inc/Google/IO/Abstract.php on line 22
    • > PHP Fatal error
      require_once(): Failed opening required 'ADSFORWP_LIB_PATHGoogle/Cache/Abstract.php' (include_path='.:/usr/share/php') in wp-content/plugins/ads-for-wp/admin/inc/Google/Cache/Apc.php on line 18
    • > PHP Warning
      Use of undefined constant ADSFORWP_LIB_PATH - assumed 'ADSFORWP_LIB_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/ads-for-wp/admin/inc/Google/Http/Request.php on line 18
    • > PHP Fatal error
      require_once(): Failed opening required 'ADSFORWP_LIB_PATHGoogle/Client.php' (include_path='.:/usr/share/php') in wp-content/plugins/ads-for-wp/admin/inc/Google/Http/MediaFileUpload.php on line 18
    • > PHP Fatal error
      require_once(): Failed opening required 'ADSFORWP_LIB_PATHGoogle/Auth/Abstract.php' (include_path='.:/usr/share/php') in wp-content/plugins/ads-for-wp/admin/inc/Google/Auth/OAuth2.php on line 18
    • > PHP Fatal error
      Uncaught Error: Class 'adsforwp_admin_common_functions' not found in wp-content/plugins/ads-for-wp/view/ad-groups.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ads-for-wp/view/visitor-condition.php:6
    • > PHP Warning
      Use of undefined constant ADSFORWP_LIB_PATH - assumed 'ADSFORWP_LIB_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/ads-for-wp/admin/inc/Google/Signer/P12.php on line 18
    • > PHP Warning
      require_once(ADSFORWP_LIB_PATHGoogle/Exception.php): failed to open stream: No such file or directory in wp-content/plugins/ads-for-wp/admin/inc/Google/Service/Exception.php on line 3
    • > PHP Warning
      require_once(ADSFORWP_LIB_PATHGoogle/Auth/Abstract.php): failed to open stream: No such file or directory in wp-content/plugins/ads-for-wp/admin/inc/Google/Auth/AppIdentity.php on line 25

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that need to be fixed:
  • Screenshots: These screenshots lack descriptions #1, #2, #3, #4, #5, #6, #7, #8 in ads-for-wp/assets to your readme.txt
Please take inspiration from this readme.txt

ads-for-wp/ads-for-wp.php 85% from 13 tests

"Google Adsense & Banner Ads by AdsforWP" version 1.9.25'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:
  • Domain Path: The domain path folder was not found ("/languages")
  • Description: The description should be shorter than 140 characters (currently 145 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected42,171 lines of code in 89 files:
LanguageFilesBlank linesComment linesLines of code
PHP674,9004,83524,156
JavaScript153,1112,54816,069
CSS7601031,946

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 168)
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity11.82
▷ Minimum class complexity1.00
▷ Maximum class complexity472.00
Average method complexity2.20
▷ Minimum method complexity1.00
▷ Maximum method complexity168.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes201
▷ Abstract classes52.49%
▷ Concrete classes19697.51%
▷ Final classes00.00%
Methods1,829
▷ Static methods231.26%
▷ Public methods1,78597.59%
▷ Protected methods130.71%
▷ Private methods311.69%
Functions70
▷ Named functions70100.00%
▷ Anonymous functions00.00%
Constants53
▷ Global constants611.32%
▷ Class constants4788.68%
▷ Public constants47100.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
No PNG images were found in this plugin