10% mir-ad-network

Code Review | Mir Ad Network

WordPress plugin Mir Ad Networkscored10%from 54 tests.

About plugin

  • Plugin page: mir-ad-network
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.2
  • WordPress version: 6.3.1
  • First release: Apr 12, 2019
  • Latest release: Apr 28, 2019
  • Number of updates: 9
  • Update frequency: every 2.3 days
  • Top authors: mirone (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /547 total downloads

Benchmarks

Plugin footprint 40% 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/mir-ad-network/mir-ad-network.php+314
    Undefined offset: 2

Server metrics [RAM: ▲0.03MB] [CPU: ▲1.81ms] Passed 4 tests

An overview of server-side resources used by Mir Ad Network
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1747.74 ▼1.65
Dashboard /wp-admin3.34 ▲0.0352.71 ▼0.11
Posts /wp-admin/edit.php3.39 ▲0.0369.61 ▲13.56
Add New Post /wp-admin/post-new.php5.92 ▲0.03111.18 ▲4.84
Media Library /wp-admin/upload.php3.26 ▲0.0339.93 ▲4.14
Ad Segments /wp-admin/admin.php?page=man-add-ad-slots3.2932.50
Wallet Address /wp-admin/admin.php?page=man-add-wallet-address3.2838.25
Ad Approval /wp-admin/admin.php?page=man-approve-ad3.3037.20
Settings /wp-admin/admin.php?page=man-settings3.2836.41

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 34 new files
Database: 5 new tables, 8 new options
New tables
wp_ads_size
wp_min_amount_txid
wp_adsegment
wp_wallet_address
wp_ad_segment_details
New WordPress options
can_compress_scripts
api_server
widget_recent-posts
db_upgraded
widget_theysaidso_widget
widget_recent-comments
tadn_jal_db_version
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Mir Ad Network
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,860 ▲11413.32 ▼1.272.56 ▲0.9141.41 ▼5.72
Dashboard /wp-admin2,244 ▲565.83 ▼0.05135.00 ▲25.6446.37 ▲3.80
Posts /wp-admin/edit.php2,127 ▲412.02 ▼0.0439.26 ▼0.5534.91 ▼3.27
Add New Post /wp-admin/post-new.php1,570 ▲5618.19 ▼5.35603.80 ▼78.6053.75 ▼0.44
Media Library /wp-admin/upload.php1,426 ▲354.21 ▼0.0195.25 ▼4.3044.41 ▼1.32
Ad Segments /wp-admin/admin.php?page=man-add-ad-slots9262.0334.6732.47
Wallet Address /wp-admin/admin.php?page=man-add-wallet-address8742.0425.2230.76
Ad Approval /wp-admin/admin.php?page=man-approve-ad8732.1922.2924.84
Settings /wp-admin/admin.php?page=man-settings9522.1523.6225.80

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • Zombie tables were found after uninstall: 5 tables
    • wp_ads_size
    • wp_min_amount_txid
    • wp_wallet_address
    • wp_adsegment
    • wp_ad_segment_details
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • api_server
    • can_compress_scripts
    • theysaidso_admin_options
    • tadn_jal_db_version
    • widget_recent-posts

Smoke tests 25% 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/admin.php?page=man-add-wallet-address
    • > Notice in wp-content/plugins/mir-ad-network/includes/add-wallet-address.php+75
    Undefined variable: labell
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=man-add-ad-slots
    • > Notice in wp-content/plugins/mir-ad-network/includes/add-ad-slots.php+107
    Undefined variable: size_id_db
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=man-add-wallet-address
    • > Notice in wp-content/plugins/mir-ad-network/includes/add-wallet-address.php+82
    Undefined variable: id
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=man-add-wallet-address
    • > Notice in wp-content/plugins/mir-ad-network/includes/add-wallet-address.php+87
    Undefined variable: btntxt
    • > GET request to /wp-admin/admin.php?page=man-add-wallet-address
    • > Notice in wp-content/plugins/mir-ad-network/includes/add-wallet-address.php+79
    Undefined variable: addresss

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/mir-ad-network/base58php/vendor/kevinlebrun/colors.php/example.php
  • 578× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      require(wp-content/plugins/mir-ad-network/base58php/vendor/nategood/commando/vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/mir-ad-network/base58php/vendor/nategood/commando/examples/file.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'phpDocumentor\\Reflection\\DocBlock\\Tags\\BaseTag' not found in wp-content/plugins/mir-ad-network/base58php/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Author.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_MockObject_Matcher_InvokedRecorder' not found in wp-content/plugins/mir-ad-network/base58php/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/InvokedAtLeastOnce.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'phpDocumentor\\Reflection\\Type' not found in wp-content/plugins/mir-ad-network/base58php/vendor/phpdocumentor/type-resolver/src/Types/Boolean.php:20
    • > PHP Fatal error
      require_once(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/mir-ad-network/base58php/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'Prophecy\\Argument\\Token\\TokenInterface' not found in wp-content/plugins/mir-ad-network/base58php/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/AnyValuesToken.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'SebastianBergmann\\Comparator\\ObjectComparator' not found in wp-content/plugins/mir-ad-network/base58php/vendor/sebastian/comparator/src/DateTimeComparator.php:16
    • > PHP Parse error
      Invalid body indentation level (expecting an indentation level of at least 1) in wp-content/plugins/mir-ad-network/base58php/vendor/sebastian/diff/tests/ParserTest.php on line 78
    • > PHP Fatal error
      Uncaught Error: Class 'Prophecy\\Exception\\Doubler\\ClassNotFoundException' not found in wp-content/plugins/mir-ad-network/base58php/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/InterfaceNotFoundException.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/mir-ad-network/base58php/vendor/phpunit/phpunit/tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php:14

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 93% 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:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === Mir Ad Network=== )
The official readme.txt is a good inspiration

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

The main PHP script in "Mir Ad Network" version 1.0.0 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Git Repository: An alternative Git repository was detected

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Please make sure to remedy the following
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/mir-ad-network/base58php/bin/athletic.bat
      • wp-content/plugins/mir-ad-network/base58php/bin/phpunit.bat
72,181 lines of code in 1,177 files:
LanguageFilesBlank linesComment linesLines of code
PHP97213,43628,44260,182
YAML48211893,578
Markdown501,30502,751
JSON321202,468
XML438611916
C115232756
Ant10910573
SVG100288
XSD100264
C/C++ Header23546122
CSS326498
reStructuredText1707862
PO File1161842
m41111141
JavaScript752120
Bourne Shell26212
DOS Batch2008

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
These items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 154)
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity6.15
▷ Minimum class complexity1.00
▷ Maximum class complexity252.00
Average method complexity2.27
▷ Minimum method complexity1.00
▷ Maximum method complexity154.00
Code structure
Namespaces83
Interfaces76
Traits2
Classes945
▷ Abstract classes313.28%
▷ Concrete classes91496.72%
▷ Final classes545.91%
Methods4,238
▷ Static methods46110.88%
▷ Public methods3,58284.52%
▷ Protected methods3428.07%
▷ Private methods3147.41%
Functions283
▷ Named functions17361.13%
▷ Anonymous functions11038.87%
Constants117
▷ Global constants1311.11%
▷ Class constants10488.89%
▷ Public constants104100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 compressed PNG files occupy 0.01MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/imgs/1 (2).png2.17KB2.11KB▼ 2.97%
includes/imgs/1.png0.76KB0.84KB0.00%
includes/imgs/1 (1).png0.64KB0.64KB0.15%
includes/imgs/11.png9.70KB7.02KB▼ 27.67%