78% easy-media-replace

Code Review | Easy Media Replace

WordPress plugin Easy Media Replace scored78%from 54 tests.

About plugin

  • Plugin page: easy-media-replace
  • Plugin version: 0.2.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2
  • WordPress version: 6.3.1
  • First release: Jan 10, 2019
  • Latest release: Apr 25, 2023
  • Number of updates: 24
  • Update frequency: every 65.3 days
  • Top authors: nlemsieh (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

2,000+ active /15,528 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: ▲0.11MB] [CPU: ▼1.23ms] Passed 4 tests

Analyzing server-side resources used by Easy Media Replace
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0954.20 ▲10.33
Dashboard /wp-admin3.47 ▲0.1757.30 ▲2.29
Posts /wp-admin/edit.php3.53 ▲0.1751.51 ▼3.08
Add New Post /wp-admin/post-new.php5.99 ▲0.1196.50 ▼8.03
Media Library /wp-admin/upload.php3.32 ▲0.0940.17 ▲3.90

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
emr_plugin_version
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Easy Media Replace
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,949 ▲18814.87 ▲0.521.76 ▲0.0142.28 ▲1.79
Dashboard /wp-admin2,355 ▲1846.46 ▲0.85114.86 ▲15.8139.56 ▼7.48
Posts /wp-admin/edit.php2,286 ▲1863.63 ▲1.6251.63 ▲14.7532.70 ▼0.55
Add New Post /wp-admin/post-new.php1,550 ▲1523.64 ▲5.33642.40 ▼57.2336.08 ▼34.36
Media Library /wp-admin/upload.php1,417 ▲144.43 ▲0.2083.91 ▼15.6542.41 ▼2.63

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
  • This plugin does not fully uninstall, leaving 7 options in the database
    • emr_plugin_version
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • 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)
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/easy-media-replace/public/partials/easy-media-replace-public-display.php
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Easy_Media_Replace_Helper' not found in wp-content/plugins/easy-media-replace/admin/partials/dialog.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: There are too many tags (11 tag instead of maximum 10)
The official readme.txt is a good inspiration

easy-media-replace/easy-media-replace.php Passed 13 tests

The primary PHP file in "Easy Media Replace" version 0.2.0 is used by WordPress to initiate all plugin functionality
51 characters long description:
Replace Images and Media Files in WordPress Easily.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
No dangerous file extensions were detected3,747 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript35707482,627
CSS39567678
PHP13154531442

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity5.00
▷ Minimum class complexity1.00
▷ Maximum class complexity23.00
Average method complexity1.94
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods34
▷ Static methods617.65%
▷ Public methods2985.29%
▷ Protected methods00.00%
▷ Private methods514.71%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.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 are no PNG files in this plugin