10% attachments-handler

Code Review | Attachments Handler

WordPress plugin Attachments Handler scored 10% from 54 tests.

About plugin

  • Plugin page: attachments-handler
  • Plugin version: 1.1.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.5
  • WordPress version: 5.8.1
  • First release: Feb 13, 2014
  • Latest release: Apr 17, 2016
  • Number of updates: 55
  • Update frequency: every 14.4 days
  • Top authors: sedLex (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,946 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/attachments-handler/core.class.php+1698
    Methods with the same name as their class will not be constructors in a future version of PHP; coreSLframework has a deprecated constructor

Server metrics [RAM: ▼0.00MB] [CPU: ▼170.68ms] Passed 4 tests

An overview of server-side resources used by Attachments Handler
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.83 ▲0.1236.68 ▲8.10
Dashboard /wp-admin3.06 ▲0.0045.58 ▼4.75
Posts /wp-admin/edit.php3.11 ▲0.0049.69 ▲16.96
Add New Post /wp-admin/post-new.php5.42 ▼0.0194.10 ▼675.18
Media Library /wp-admin/upload.php3.00 ▼0.0130.95 ▼10.90

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 159 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Attachments Handler
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,679 ▲8316.12 ▲0.606.90 ▼3.7053.24 ▼1.57
Dashboard /wp-admin2,970 ▲365.90 ▲0.01138.15 ▼6.87120.00 ▲6.96
Posts /wp-admin/edit.php2,739 ▼02.70 ▲0.0168.25 ▲1.75100.03 ▲4.52
Add New Post /wp-admin/post-new.php1,615 ▲2121.31 ▲2.55280.30 ▼109.83114.93 ▼0.43
Media Library /wp-admin/upload.php1,810 ▲35.01 ▼0.00155.03 ▼5.64129.88 ▼3.49

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Uninstall procedure had uncaught errors
    • > Deprecated in wp-content/plugins/attachments-handler/core.class.php+1698
    Methods with the same name as their class will not be constructors in a future version of PHP; coreSLframework has a deprecated constructor

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

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
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/attachments-handler/attachments-handler.php
    • > /wp-content/plugins/attachments-handler/core.class.php
    • > /wp-content/plugins/attachments-handler/core.php
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      require_once(): Failed opening required 'core.php' (include_path='.:/usr/share/php') in wp-content/plugins/attachments-handler/core/templates/my-plugin.php on line 18
    • > PHP Warning
      require_once(core.php): failed to open stream: No such file or directory in wp-content/plugins/attachments-handler/core/templates/my-plugin.php on line 18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: Add images for these screenshots: #1 (Issue detection), #2 (All links), #3 (Parameter screen)
You can take inspiration from this readme.txt

attachments-handler/attachments-handler.php 92% from 13 tests

The entry point to "Attachments Handler" version 1.1.7 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 304 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected17,496 lines of code in 70 files:
LanguageFilesBlank linesComment linesLines of code
PO File313,83808,351
PHP191,1311,8737,671
JavaScript6218233900
CSS108513459
Markdown120084
JSON10029
INI2002

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 119)
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity58.47
▷ Minimum class complexity1.00
▷ Maximum class complexity211.00
Average method complexity7.62
▷ Minimum method complexity1.00
▷ Maximum method complexity119.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes19
▷ Abstract classes15.26%
▷ Concrete classes1894.74%
▷ Final classes00.00%
Methods165
▷ Static methods3621.82%
▷ Public methods16298.18%
▷ Protected methods31.82%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
37 PNG files occupy 0.67MB with 0.20MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
core/img/tree_node_minus.png0.14KB0.12KB▼ 15.17%
core/img/tree_node_plus.png0.15KB0.13KB▼ 12.50%
core/img/warning.png4.46KB1.51KB▼ 66.10%
core/img/flags_sprite.png30.37KB15.11KB▼ 50.23%
core/img/arrow_down_s.png0.27KB0.27KB▼ 1.79%