78% mantis-ad-network

Code Review | MANTIS Ad Network

WordPress plugin MANTIS Ad Network scored78%from 54 tests.

About plugin

  • Plugin page: mantis-ad-network
  • Plugin version: 1.7.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Mar 25, 2014
  • Latest release: Jan 30, 2023
  • Number of updates: 63
  • Update frequency: every 51.3 days
  • Top authors: parisholley (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

300+ active /6,473 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
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼2.06ms] Passed 4 tests

An overview of server-side resources used by MANTIS Ad Network
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0647.20 ▲1.60
Dashboard /wp-admin3.36 ▲0.0650.43 ▼0.72
Posts /wp-admin/edit.php3.47 ▲0.1250.76 ▼0.67
Add New Post /wp-admin/post-new.php5.94 ▲0.0588.96 ▼8.46
Media Library /wp-admin/upload.php3.28 ▲0.0537.37 ▲3.92
MANTIS /wp-admin/options-general.php?page=mantis_ad_options3.2634.77

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for MANTIS Ad Network
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,802 ▲1614.23 ▼0.131.81 ▼0.3642.66 ▼0.73
Dashboard /wp-admin2,205 ▲285.56 ▼0.0685.05 ▼13.6840.01 ▼3.41
Posts /wp-admin/edit.php2,114 ▲172.00 ▼0.0335.05 ▼1.0937.22 ▲3.07
Add New Post /wp-admin/post-new.php1,538 ▲1023.44 ▲0.36651.17 ▼57.0656.63 ▼24.15
Media Library /wp-admin/upload.php1,416 ▲224.18 ▼0.0098.85 ▼0.5046.23 ▼3.68
MANTIS /wp-admin/options-general.php?page=mantis_ad_options9692.0329.2126.29

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
  • 6× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/mantis-ad-network/html/advertiser/config.php
    • > /wp-content/plugins/mantis-ad-network/html/publisher/recommend.php
    • > /wp-content/plugins/mantis-ad-network/html/publisher/styling.php
    • > /wp-content/plugins/mantis-ad-network/html/publisher/widgetform.php
    • > /wp-content/plugins/mantis-ad-network/html/publisher/config.php
    • > /wp-content/plugins/mantis-ad-network/html/publisher/video.php
  • 19× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Undefined variable: mantis_shortcodes in wp-content/plugins/mantis-ad-network/html/publisher/video.php on line 1
    • > PHP Notice
      Undefined variable: mantis_shortcodes in wp-content/plugins/mantis-ad-network/html/publisher/video.php on line 6
    • > PHP Notice
      Undefined variable: zones in wp-content/plugins/mantis-ad-network/html/publisher/widgetform.php on line 1
    • > PHP Notice
      Undefined variable: site in wp-content/plugins/mantis-ad-network/html/publisher/recommend.php on line 5
    • > PHP Notice
      Undefined variable: revenue in wp-content/plugins/mantis-ad-network/html/advertiser/config.php on line 6
    • > PHP Notice
      Undefined variable: advertiser in wp-content/plugins/mantis-ad-network/html/advertiser/config.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mantis-ad-network/woocommerce.php:22
    • > PHP Notice
      Undefined variable: site in wp-content/plugins/mantis-ad-network/html/publisher/config.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/mantis-ad-network/html/settings.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/mantis-ad-network/widget.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Contributors: Plugin contributors not specified
Please take inspiration from this readme.txt

mantis-ad-network/mantis.php 92% from 13 tests

This is the main PHP file of "MANTIS Ad Network" version 1.7.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("mantis-ad-network.php" instead of "mantis.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected1,215 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
SQL1119180620
PHP1413336473
Bourne Shell127045
YAML13035
Markdown118025
HTML30017

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity6.00
▷ Minimum class complexity5.00
▷ Maximum class complexity7.00
Average method complexity2.11
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods9100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions19
▷ Named functions19100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
No PNG files were detected