10% auto-attachments

Code Review | Auto Attachments

WordPress plugin Auto Attachments scored10%from 54 tests.

About plugin

  • Plugin page: auto-attachments
  • Plugin version: 1.8.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.9.2
  • WordPress version: 6.3.1
  • First release: May 13, 2011
  • Latest release: Jan 17, 2018
  • Number of updates: 165
  • Update frequency: every 14.8 days
  • Top authors: kaisercrazy (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

60+ active /34,962 total downloads

Benchmarks

Plugin footprint 40% 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/auto-attachments/admin/rebuild.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; aARebuild has a deprecated constructor

Server metrics [RAM: ▼1.69MB] [CPU: ▼51.04ms] Passed 4 tests

An overview of server-side resources used by Auto Attachments
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.29 ▼1.175.93 ▼38.66
Dashboard /wp-admin2.31 ▼0.997.86 ▼45.29
Posts /wp-admin/edit.php2.31 ▼1.047.33 ▼38.60
Add New Post /wp-admin/post-new.php2.31 ▼3.577.88 ▼81.61
Media Library /wp-admin/upload.php2.31 ▼0.916.85 ▼26.80
Regen. Thumbnails /wp-admin/admin.php?page=aa_regen_thumb2.319.14
Auto Attachments /wp-admin/admin.php?page=auto_attachments2.318.64

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Auto Attachments
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,821 ▲3514.35 ▼0.201.60 ▼0.2138.52 ▼2.82
Dashboard /wp-admin2,227 ▲565.65 ▲0.0789.27 ▼13.4041.18 ▼2.28
Posts /wp-admin/edit.php2,129 ▲291.99 ▼0.0438.80 ▲4.9036.75 ▲0.34
Add New Post /wp-admin/post-new.php6,583 ▲5,05726.06 ▲2.46829.41 ▲137.4566.28 ▲9.87
Media Library /wp-admin/upload.php1,426 ▲264.17 ▼0.0593.27 ▼13.4642.72 ▼6.75
Regen. Thumbnails /wp-admin/admin.php?page=aa_regen_thumb8391.6925.1227.61
Auto Attachments /wp-admin/admin.php?page=auto_attachments1,8034.0280.0258.81

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/auto-attachments/admin/rebuild.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; aARebuild has a deprecated constructor
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

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
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=auto_attachments
    • > Deprecated in wp-content/plugins/auto-attachments/admin/rebuild.php+7
    Methods with the same name as their class will not be constructors in a future version of PHP; aARebuild has a deprecated constructor
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=auto_attachments
    • > Deprecated in wp-content/plugins/auto-attachments/admin/rebuild.php+163
    Function create_function() is deprecated
  • 9 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=auto_attachments
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
    • > GET request to /wp-admin/admin.php?page=auto_attachments
    • > Notice in wp-content/plugins/auto-attachments/auto-attachments.php+219
    Undefined index: serkoup

SRP 50% 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
Please take a closer look at the following
  • 5× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/auto-attachments/auto-attachments.php
    • > /wp-content/plugins/auto-attachments/admin/metaboxes.php
    • > /wp-content/plugins/auto-attachments/admin/admin-area.php
    • > /wp-content/plugins/auto-attachments/admin/rebuild.php
    • > /wp-content/plugins/auto-attachments/admin/shortcodes.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (Files Section & Audio Player), #2 (Audio & video Player), #3 (Admin Area), #4 (Shortcode Panel)
  • Tags: Please delete some tags, you are using 21 tag instead of maximum 10
The official readme.txt is a good inspiration

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

"Auto Attachments" version 1.8.5's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 177 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected11,124 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript85675005,231
CSS101051602,497
PO File97591,0521,909
PHP597781,485
SVG2002

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity1.00
▷ Minimum class complexity1.00
▷ Maximum class complexity1.00
Average method complexity1.00
▷ Minimum method complexity1.00
▷ Maximum method complexity1.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods00.00%
▷ Public methods3100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions35
▷ Named functions35100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
34 PNG files occupy 0.24MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/images/mime/application-vnd.openxmlformats-officedocument.presentationml.slideshow.png2.53KB2.02KB▼ 19.84%
includes/images/mime/application-vnd.oasis.opendocument.formula.png2.82KB1.93KB▼ 31.71%
includes/images/mime/applicationvnd.ms-excel.sheet.macroEnabled.12.png1.96KB2.05KB0.00%
includes/images/mime/application-vnd.oasis.opendocument.text.png3.22KB2.29KB▼ 28.81%
includes/images/mime/text-plain.png2.69KB1.88KB▼ 30.03%