84% enable-media-replace

Code Review | Enable Media Replace

WordPress plugin Enable Media Replace scored 84% from 54 tests.

About plugin

  • Plugin page: enable-media-replace
  • Plugin version: 4.1.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.7-6.3
  • WordPress version: 6.3.1
  • First release: Jun 1, 2009
  • Latest release: Sep 22, 2023
  • Number of updates: 174
  • Update frequency: every 30.1 days
  • Top authors: MungoBBQ (61.49%)ShortPixel (21.26%)petredobrescu (18.39%)

Code review

54 tests

User reviews

283 reviews

Install metrics

600,000+ active / 9,654,004 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.08MB] [CPU: ▼6.32ms] Passed 4 tests

Analyzing server-side resources used by Enable Media Replace
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0643.88 ▼4.46
Dashboard /wp-admin3.36 ▲0.0644.93 ▼21.65
Posts /wp-admin/edit.php3.48 ▲0.1249.41 ▲2.85
Add New Post /wp-admin/post-new.php5.96 ▲0.0893.54 ▼2.00
Media Library /wp-admin/upload.php3.37 ▲0.14245.59 ▲210.20
Replace media /wp-admin/upload.php?page=enable-media-replace/enable-media-replace.php3.2435.68

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 111 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
EnableMediaReplace-notices
widget_recent-posts
theysaidso_admin_options
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Enable Media Replace
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.48 ▼0.082.20 ▼0.0855.01 ▲4.56
Dashboard /wp-admin2,203 ▲155.79 ▲0.9298.12 ▼22.9644.26 ▲1.10
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0258.04 ▲15.1036.55 ▼0.53
Add New Post /wp-admin/post-new.php1,542 ▲1818.50 ▼4.63628.20 ▼45.6058.02 ▼28.31
Media Library /wp-admin/upload.php1,388 ▼34.17 ▼0.09114.93 ▲10.4250.76 ▲4.61
Replace media /wp-admin/upload.php?page=enable-media-replace/enable-media-replace.php6541.146.8019.19

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/enable-media-replace/classes/external/upsell_installer.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function EnableMediaReplace\\apply_filters() in wp-content/plugins/enable-media-replace/views/upsell.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Upgrader_Skin' not found in wp-content/plugins/enable-media-replace/classes/external/upgrader_skin.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function EnableMediaReplace\\add_action() in wp-content/plugins/enable-media-replace/classes/ajax.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function EnableMediaReplace\\ShortPixelLogger\\wp_enqueue_script() in wp-content/plugins/enable-media-replace/build/shortpixel/log/src/view-debug-box.php:4

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 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention:
  • Tags: You are using too many tags: 11 tag instead of maximum 10
The official readme.txt is a good inspiration

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

Analyzing the main PHP file in "Enable Media Replace" version 4.1.4
112 characters long description:
Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.

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
Everything looks great! No dangerous files found in this plugin12,440 lines of code in 82 files:
LanguageFilesBlank linesComment linesLines of code
PHP461,7239686,236
CSS5458201,987
SVG3331,650
Sass681151,112
PO File12249294755
JavaScript49332504
Markdown1420111
JSON51085

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity27.79
▷ Minimum class complexity1.00
▷ Maximum class complexity90.00
Average method complexity3.52
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces12
Interfaces0
Traits0
Classes33
▷ Abstract classes13.03%
▷ Concrete classes3296.97%
▷ Final classes26.25%
Methods350
▷ Static methods3810.86%
▷ Public methods26174.57%
▷ Protected methods5616.00%
▷ Private methods339.43%
Functions17
▷ Named functions1376.47%
▷ Anonymous functions423.53%
Constants44
▷ Global constants49.09%
▷ Class constants4090.91%
▷ Public constants40100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
6 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/ui-icons_555555_256x240.png6.82KB4.17KB▼ 38.82%
img/notices/slider.png4.63KB2.34KB▼ 49.41%
img/notices/robo-cool.png5.51KB2.65KB▼ 51.83%
img/notices/robo-scared.png6.42KB2.21KB▼ 65.62%
img/ui-icons_444444_256x240.png6.83KB4.17KB▼ 38.86%