72% cocoon-media-management

Code Review | Cocoon Media Management

WordPress plugin Cocoon Media Management scored72%from 54 tests.

About plugin

  • Plugin page: cocoon-media-mana...
  • Plugin version: 1.5.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-5.7
  • WordPress version: 6.3.1
  • First release: Apr 4, 2018
  • Latest release: Mar 26, 2021
  • Number of updates: 47
  • Update frequency: every 23.5 days
  • Top authors: usecocoon (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /4,068 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.17MB] [CPU: ▼6.50ms] Passed 4 tests

This is a short check of server-side resources used by Cocoon Media Management
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1734.99 ▼6.47
Dashboard /wp-admin3.47 ▲0.1643.55 ▼4.19
Posts /wp-admin/edit.php3.58 ▲0.2347.48 ▼1.46
Add New Post /wp-admin/post-new.php6.07 ▲0.1880.09 ▼13.86
Media Library /wp-admin/upload.php3.39 ▲0.1644.64 ▲9.70
Cocoon Library /wp-admin/upload.php?page=cocoon-library3.3430.15

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 74 new files
Database: no new tables, 10 new options
New WordPress options
cmm_stng_secret
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
can_compress_scripts
cmm_stng_domain
cmm_thumbs_per_page
db_upgraded
widget_theysaidso_widget
cmm_stng_username

Browser metrics Passed 4 tests

A check of browser resources used by Cocoon Media Management
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5713.58 ▼0.971.54 ▼0.2441.07 ▼3.27
Dashboard /wp-admin2,212 ▲354.87 ▼0.80105.00 ▲19.6279.01 ▲40.00
Posts /wp-admin/edit.php2,129 ▲292.10 ▲0.1046.15 ▲9.7037.01 ▲0.23
Add New Post /wp-admin/post-new.php1,709 ▲18321.47 ▼1.72661.07 ▼34.3130.99 ▼22.31
Media Library /wp-admin/upload.php1,443 ▲494.37 ▲0.2397.44 ▼3.8981.45 ▲37.33
Cocoon Library /wp-admin/upload.php?page=cocoon-library7171.8920.8521.72

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
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/upload.php?page=cocoon-library
    • > POST request to /wp-admin/admin-ajax.php
    • > Error in wp-content/plugins/cocoon-media-management/Cocoon_Media_Management.php+780
    Uncaught Error: Call to undefined function is_soap_fault() in wp-content/plugins/cocoon-media-management/Cocoon_Media_Management.php:780
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): CMM_GetTags()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin-ajax.php(188): do_action()
    #4 {main}
    thrown

SRP 50% 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
Please fix the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/cocoon-media-management/Cocoon_Media_Management.php

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following user-side errors
    • > GET request to /wp-admin/upload.php?page=cocoon-library
    • > Network (severe)
    wp-admin/admin-ajax.php - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Contributors: The plugin contributors field is missing
You can look at the official readme.txt

cocoon-media-management/Cocoon_Media_Management.php 85% from 13 tests

The primary PHP file in "Cocoon Media Management" version 1.5.7 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Text Domain: The text domain should only use lowercase characters and dashes
  • Main file name: The principal plugin file should be the same as the plugin slug ("cocoon-media-management.php" instead of "Cocoon_Media_Management.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin3,635 lines of code in 66 files:
LanguageFilesBlank linesComment linesLines of code
SVG6125512,299
PHP219326806
CSS1360260
JavaScript1250254
JSON10016

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity26.00
▷ Minimum class complexity26.00
▷ Maximum class complexity26.00
Average method complexity3.27
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods11
▷ Static methods19.09%
▷ Public methods11100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions26
▷ Named functions2596.15%
▷ Anonymous functions13.85%
Constants1
▷ Global constants1100.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
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/icon.png14.66KB0.49KB▼ 96.66%
img/thumb_up.png1.18KB1.17KB▼ 0.99%
img/thumb_down.png1.19KB1.17KB▼ 1.64%