83% media-defaults

Code Review | Media Defaults

WordPress plugin Media Defaults scored83%from 54 tests.

About plugin

  • Plugin page: media-defaults
  • Plugin version: 1.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-4.6
  • WordPress version: 6.3.1
  • First release: Oct 11, 2016
  • Latest release: Nov 7, 2016
  • Number of updates: 14
  • Update frequency: every 1.9 days
  • Top authors: squarestar (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /896 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.15MB] [CPU: ▼2.55ms] Passed 4 tests

An overview of server-side resources used by Media Defaults
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1337.09 ▼6.35
Dashboard /wp-admin3.44 ▲0.1345.83 ▼2.56
Posts /wp-admin/edit.php3.55 ▲0.2046.30 ▲0.82
Add New Post /wp-admin/post-new.php6.04 ▲0.1597.29 ▼2.10
Media Library /wp-admin/upload.php3.41 ▲0.1838.48 ▲2.39

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

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

Browser metrics Passed 4 tests

Media Defaults: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲8313.25 ▼1.051.59 ▼0.6837.14 ▼10.04
Dashboard /wp-admin2,206 ▲184.86 ▼0.04105.92 ▼5.4338.80 ▼3.20
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0436.57 ▼3.8535.39 ▼0.98
Add New Post /wp-admin/post-new.php1,535 ▲223.30 ▲0.01635.47 ▼3.9947.98 ▲1.15
Media Library /wp-admin/upload.php1,357 ▼284.19 ▼0.0495.06 ▼2.3742.49 ▼1.61

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% 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)
Good news, no errors were detected

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
Please take a closer look at the following
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/media-defaults/admin/partials/media-defaults-admin-footer-templates.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
You can take inspiration from this readme.txt

media-defaults/media-defaults.php 85% from 13 tests

The main PHP script in "Media Defaults" version 1.1.1 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 189 characters long)
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin996 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP9202582843
JavaScript13825153

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity7.00
▷ Minimum class complexity1.00
▷ Maximum class complexity29.00
Average method complexity1.75
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods40
▷ Static methods25.00%
▷ Public methods3075.00%
▷ Protected methods00.00%
▷ Private methods1025.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
There were not PNG files found in your plugin