73% ads-for-wp

Code Review | Ads for WP - Advanced Ads & Adsense Solution for WP & AMP

WordPress plugin Ads for WP - Advanced Ads & Adsense Solution for WP & AMP scored 73% from 54 tests.

About plugin

  • Plugin page: ads-for-wp
  • Plugin version: 1.9.16.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.7
  • WordPress version: 5.8.1
  • First release: Jul 24, 2018
  • Latest release: Jun 25, 2021
  • Number of updates: 118
  • Update frequency: every 9.0 days
  • Top authors: magazine3 (61.02%)mohammed_kaludi (21.19%)ampforwp (19.49%)

Code review

54 tests

User reviews

41 reviews

Install metrics

6,000+ active / 140,505 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.94MB] [CPU: ▼134.94ms] Passed 4 tests

Server-side resources used by Ads for WP - Advanced Ads & Adsense Solution for WP & AMP
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.09 ▲0.2635.23 ▲11.24
Dashboard /wp-admin4.28 ▲1.2241.70 ▲3.15
Posts /wp-admin/edit.php4.31 ▲1.2043.27 ▲12.44
Add New Post /wp-admin/post-new.php6.56 ▲1.1278.65 ▼561.16
Media Library /wp-admin/upload.php4.19 ▲1.1829.31 ▲7.03
Settings /wp-admin/edit.php?post_type=adsforwp&page=adsforwp4.2036.45
Ads /wp-admin/edit.php?post_type=adsforwp4.2637.85
Groups /wp-admin/edit.php?post_type=adsforwp-groups4.2635.88
Analytics /wp-admin/edit.php?post_type=adsforwp&page=adsforwp-analytics4.1932.77

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 88 new files
Database: 1 new table, 6 new options
New tables
wp_adsforwp_stats
New WordPress options
wisdom_last_track_time
adsforwp_ip_request_2022-03-11
adsforwp-database-on-first-load
adsforwp_activation_date
wisdom_admin_emails
widget_adsforwp_ads_widget

Browser metrics Passed 4 tests

Checking browser requirements for Ads for WP - Advanced Ads & Adsense Solution for WP & AMP
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,256 ▲60518.42 ▲2.7611.28 ▲3.8476.55 ▼1.85
Dashboard /wp-admin3,373 ▲4747.99 ▲1.83165.83 ▲37.09178.40 ▲2.59
Posts /wp-admin/edit.php3,230 ▲4875.58 ▲2.3699.05 ▲29.71144.96 ▲1.94
Add New Post /wp-admin/post-new.php2,041 ▼1,76620.46 ▲3.37412.51 ▼52.54174.57 ▲8.75
Media Library /wp-admin/upload.php2,013 ▲2616.37 ▲0.87119.75 ▼25.54212.36 ▲35.43
Settings /wp-admin/edit.php?post_type=adsforwp&page=adsforwp3,3655.49127.35169.63
Ads /wp-admin/edit.php?post_type=adsforwp2,0495.4392.84142.43
Groups /wp-admin/edit.php?post_type=adsforwp-groups1,9155.3091.02140.19
Analytics /wp-admin/edit.php?post_type=adsforwp&page=adsforwp-analytics1,5275.0283.65123.88

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_adsforwp_stats
  • Zombie WordPress options were found after uninstall: 6 options
    • adsforwp_activation_date
    • adsforwp-database-on-first-load
    • widget_adsforwp_ads_widget
    • adsforwp_ip_request_2022-03-11
    • wisdom_admin_emails
    • wisdom_last_track_time

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
  • 103× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ads-for-wp/admin/ads-setup.php:3
    • > 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/Batch.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/REST.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/Cache/Memcache.php on line 18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/ads-for-wp/view/ads-type.php:696
    • > 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/Cache/File.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/IO/Exception.php on line 18
    • > PHP Warning
      require_once(ADSFORWP_LIB_PATHGoogle/Client.php): failed to open stream: No such file or directory in wp-content/plugins/ads-for-wp/admin/inc/Google/Service/Resource.php on line 18
    • > PHP Warning
      require_once(ADSFORWP_LIB_PATHGoogle/Cache/Abstract.php): failed to open stream: No such file or directory in wp-content/plugins/ads-for-wp/admin/inc/Google/Cache/Null.php on line 18
    • > PHP Warning
      require_once(ADSFORWP_LIB_PATHGoogle/Auth/Exception.php): failed to open stream: No such file or directory in wp-content/plugins/ads-for-wp/admin/inc/Google/Signer/P12.php on line 18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% 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 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
You can look at the official readme.txt

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

The primary PHP file in "Ads for WP - Advanced Ads & Adsense Solution for WP & AMP" version 1.9.16.2 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Domain Path: The domain path is invalid: folder "/languages" does not exist
  • Description: Please keep the plugin description shorter than 140 characters (currently 146 characters long)

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected42,371 lines of code in 86 files:
LanguageFilesBlank linesComment linesLines of code
PHP664,9695,09424,469
JavaScript143,1032,53515,990
CSS657981,912

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 159)
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity12.00
▷ Minimum class complexity1.00
▷ Maximum class complexity433.00
Average method complexity2.21
▷ Minimum method complexity1.00
▷ Maximum method complexity159.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes202
▷ Abstract classes52.48%
▷ Concrete classes19797.52%
▷ Final classes00.00%
Methods1,851
▷ Static methods231.24%
▷ Public methods1,80797.62%
▷ Protected methods130.70%
▷ Private methods311.67%
Functions67
▷ Named functions67100.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 files were detected