72% defender-by-played

Code Review | Defender

WordPress plugin Defender scored 72% from 54 tests.

About plugin

  • Plugin page: defender-by-played
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.5.1
  • WordPress version: 5.8.1
  • First release: Apr 3, 2013
  • Latest release: Apr 3, 2013
  • Number of updates: 3
  • Update frequency: N/A
  • Top authors: adeneo (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active / 1,514 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼142.83ms] Passed 4 tests

A check of server-side resources used by Defender
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.032,152.88 ▲2,118.50
Dashboard /wp-admin3.08 ▲0.0347.57 ▲1.63
Posts /wp-admin/edit.php3.14 ▲0.0343.47 ▼1.38
Add New Post /wp-admin/post-new.php5.44 ▲0.0193.36 ▼570.95
Media Library /wp-admin/upload.php3.03 ▲0.0331.37 ▼0.63
Defender /wp-admin/plugins.php?page=Defender3.0935.04

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 6 new files
Database: no new tables, 2 new options
New WordPress options
redirect_to
def_login

Browser metrics Passed 4 tests

Checking browser requirements for Defender
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,686 ▲8016.27 ▲0.608.46 ▼0.3449.56 ▲1.02
Dashboard /wp-admin2,980 ▲495.95 ▼0.04136.61 ▼2.34105.30 ▼19.16
Posts /wp-admin/edit.php2,746 ▲72.69 ▲0.0162.18 ▼0.4895.44 ▲4.91
Add New Post /wp-admin/post-new.php1,620 ▲12021.59 ▲2.84264.62 ▼110.12106.53 ▲0.86
Media Library /wp-admin/upload.php1,814 ▲75.04 ▲0.03144.18 ▼19.29117.18 ▼3.07
Defender /wp-admin/plugins.php?page=Defender2,1852.1059.0882.09

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 2 options
    • redirect_to
    • def_login

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 251 occurences, only the last one shown
    • > GET request to /wp-admin/plugins.php?page=Defender
    • > Warning in wp-content/plugins/defender-by-played/admin.php+53
    in_array() expects parameter 2 to be array, bool given

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
Almost there! Just fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/defender-by-played/blocked.php
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/defender-by-played/admin.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/defender-by-played/defender.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: anti-spam, spam, user-control, block

defender-by-played/defender.php 92% from 13 tests

This is the main PHP file of "Defender" version 1.0, 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: The principal plugin file should be the same as the plugin slug ("defender-by-played.php" instead of "defender.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected220 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP32610179
JavaScript14041

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
PNG images were not found in this plugin