78% insert-post-ads

Code Review | Insert Post Ads

WordPress plugin Insert Post Ads scored78%from 54 tests.

About plugin

  • Plugin page: insert-post-ads
  • Plugin version: 1.3.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.0.2
  • WordPress version: 6.3.1
  • First release: Apr 25, 2014
  • Latest release: Jan 19, 2022
  • Number of updates: 36
  • Update frequency: every 78.6 days
  • Top authors: insertpostads (44.44%)n7studios (36.11%)deb255 (19.44%)namith.jawahar (8.33%)

Code review

54 tests

User reviews

19 reviews

Install metrics

10,000+ active /282,367 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▼13.81MB] [CPU: ▼3,221,758.68ms] Passed 4 tests

Analyzing server-side resources used by Insert Post Ads
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.26 ▼60.3854.03 ▼12,887,048.93
Dashboard /wp-admin65.65 ▲62.2612,896,625.44 ▲12,896,557.78
Posts /wp-admin/edit.php5.15 ▲1.7560.18 ▲2.86
Add New Post /wp-admin/post-new.php7.63 ▲1.7095.38 ▼1.37
Media Library /wp-admin/upload.php4.96 ▲1.6851.79 ▲12.73
Settings /wp-admin/edit.php?post_type=insertpostads&page=insert-post-ads4.9340.85
Add vi stories /wp-admin/edit.php?post_type=insertpostads&page=vi_integration4.9345.99
Post Adverts /wp-admin/edit.php?post_type=insertpostads5.0751.80
Add New Post /wp-admin/post-new.php?post_type=insertpostads5.0557.55

Server storage [IO: ▲1.21MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 62 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
insert_ads_inpostads
insert_ads_version
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Insert Post Ads
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,960 ▲19914.20 ▼0.291.74 ▲0.1541.44 ▲0.93
Dashboard /wp-admin2,363 ▲1836.03 ▲0.37107.54 ▲17.5996.59 ▲51.72
Posts /wp-admin/edit.php2,270 ▲1703.16 ▲1.1554.17 ▲16.2943.51 ▲7.76
Add New Post /wp-admin/post-new.php6,370 ▲4,84425.19 ▲2.08975.27 ▲316.6574.42 ▲4.39
Media Library /wp-admin/upload.php1,568 ▲1715.44 ▲1.23127.81 ▲22.3185.14 ▲40.61
Settings /wp-admin/edit.php?post_type=insertpostads&page=insert-post-ads1,0192.8349.1132.79
Add vi stories /wp-admin/edit.php?post_type=insertpostads&page=vi_integration1,0062.7139.9040.10
Post Adverts /wp-admin/edit.php?post_type=insertpostads1,2753.0844.0641.53
Add New Post /wp-admin/post-new.php?post_type=insertpostads1,6353.6761.9572.09

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • insert_ads_inpostads
    • insert_ads_version

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
  • 48 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=insertpostads
    • > POST request to /wp-cron.php?doing_wp_cron=1697551793.8827230930328369140625
    • > Warning in wp-content/plugins/easy-age-verifier/lib/extras/wpApi.php+48
    file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known
  • 48 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=insertpostads
    • > POST request to /wp-cron.php?doing_wp_cron=1697551793.8827230930328369140625
    • > Warning in wp-content/plugins/easy-age-verifier/lib/extras/wpApi.php+48
    file_get_contents(http://www.fillyourtaproom.com/wp-json/wp/v2/posts?per_page=10): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known
    • > GET request to /wp-admin/post-new.php?post_type=insertpostads
    • > request to
    • > Notice in wp-content/plugins/insert-post-ads/includes/geotargeting.php+299
    Undefined index: REMOTE_ADDR
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=insertpostads
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

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
  • 12× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-post-ads/includes/common.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/insert-post-ads/views/sidebar.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-post-ads/includes/rules.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/insert-post-ads/views/dashboard-notices.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/insert-post-ads/insert-post-ads.php:41
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-post-ads/includes/inpostads.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-post-ads/includes/geotargeting.php:296
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/insert-post-ads/views/settings.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-post-ads/includes/gdpr.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-post-ads/adstxt.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

insert-post-ads/insert-post-ads.php Passed 13 tests

The main PHP script in "Insert Post Ads" version 1.3.2 is automatically included on every request by WordPress
62 characters long description:
Allows you to insert ads after paragraphs of your post content

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin12,195 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript75794544,384
PHP162684184,029
CSS6556433,601
PO File1390968119
SVG20239
Markdown27023

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 338)
Cyclomatic complexity
Average complexity per logical line of code0.85
Average class complexity265.00
▷ Minimum class complexity59.00
▷ Maximum class complexity471.00
Average method complexity18.03
▷ Minimum method complexity1.00
▷ Maximum method complexity338.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods31
▷ Static methods13.23%
▷ Public methods2993.55%
▷ Protected methods00.00%
▷ Private methods26.45%
Functions77
▷ Named functions77100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
17 PNG files occupy 0.20MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/chosen-sprite@2x.png0.72KB0.83KB0.00%
images/vi-logo-square.png6.06KB2.67KB▼ 55.86%
controls/assets/images/chosen-sprite@2x.png0.72KB0.83KB0.00%
images/chosen-sprite.png0.53KB0.88KB0.00%
images/icon.png14.30KB0.17KB▼ 98.81%