78% attachments

Code Review | Attachments

WordPress plugin Attachments scored78%from 54 tests.

About plugin

  • Plugin page: attachments
  • Plugin version: 3.5.9
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.9.0
  • WordPress version: 6.3.1
  • First release: Nov 2, 2009
  • Latest release: Feb 10, 2022
  • Number of updates: 185
  • Update frequency: every 24.2 days
  • Top authors: jchristopher (100%)

Code review

54 tests

User reviews

53 reviews

Install metrics

10,000+ active /261,552 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
Installer ran successfully

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

This is a short check of server-side resources used by Attachments
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.78 ▲0.3243.38 ▼0.28
Dashboard /wp-admin3.61 ▲0.3149.71 ▼4.89
Posts /wp-admin/edit.php3.71 ▲0.3553.71 ▲2.78
Add New Post /wp-admin/post-new.php5.71 ▼0.1896.23 ▼7.89
Media Library /wp-admin/upload.php3.46 ▲0.2338.51 ▲3.13
Attachments /wp-admin/options-general.php?page=attachments3.7037.29

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 68 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Attachments
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲7013.33 ▼1.051.94 ▲0.2043.88 ▲4.10
Dashboard /wp-admin2,222 ▲306.03 ▲1.14112.79 ▼4.1743.79 ▲0.02
Posts /wp-admin/edit.php2,272 ▲1833.50 ▲1.5093.21 ▲49.3437.64 ▼3.51
Add New Post /wp-admin/post-new.php6,242 ▲4,70519.02 ▲0.44881.08 ▲223.3435.51 ▼21.22
Media Library /wp-admin/upload.php1,398 ▲134.07 ▼0.1280.51 ▼24.5243.49 ▼0.64
Attachments /wp-admin/options-general.php?page=attachments2,2352.0727.0333.32

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
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=attachments
    • > User deprecated in wp-includes/functions.php+5453
    Function wp_richedit_pre is deprecated since version 4.3.0! Use format_for_editor() instead.

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
The following issues need your attention
  • 9× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Warning
      include_once(ATTACHMENTS_DIR/classes/class.attachments.migrate.php): failed to open stream: No such file or directory in wp-content/plugins/attachments/views/options.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'Attachments_Field' not found in wp-content/plugins/attachments/classes/fields/class.field.textarea.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Attachments_Field' not found in wp-content/plugins/attachments/classes/fields/class.field.wysiwyg.php:10
    • > PHP Warning
      include_once(): Failed opening 'ATTACHMENTS_DIR/classes/class.attachments.migrate.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/attachments/views/options.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'Attachments_Field' not found in wp-content/plugins/attachments/classes/fields/class.field.text.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/attachments/deprecated/attachments.options.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentsMigrate' not found in wp-content/plugins/attachments/views/options.php:5
    • > PHP Warning
      Use of undefined constant ATTACHMENTS_DIR - assumed 'ATTACHMENTS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/attachments/views/options.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'Attachments_Field' not found in wp-content/plugins/attachments/classes/fields/class.field.select.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 15 tag instead of maximum 10
The official readme.txt is a good inspiration

attachments/index.php 92% from 13 tests

The main file in "Attachments" v. 3.5.9 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("attachments.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected6,235 lines of code in 45 files:
LanguageFilesBlank linesComment linesLines of code
PHP189169972,589
JavaScript3269621,486
PO File103264081,251
Markdown121960605
CSS27216304

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity42.67
▷ Minimum class complexity1.00
▷ Maximum class complexity207.00
Average method complexity4.83
▷ Minimum method complexity1.00
▷ Maximum method complexity39.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes111.11%
▷ Concrete classes888.89%
▷ Final classes00.00%
Methods102
▷ Static methods00.00%
▷ Public methods102100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions18
▷ Named functions18100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There are no PNG files in this plugin