10% attachment-file-icons

Code Review | Attachment File Icons (AF Icons)

WordPress plugin Attachment File Icons (AF Icons) scored10%from 54 tests.

About plugin

  • Plugin page: attachment-file-i...
  • Plugin version: 1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-4.5
  • WordPress version: 6.3.1
  • First release: Jan 9, 2011
  • Latest release: Apr 25, 2016
  • Number of updates: 26
  • Update frequency: every 74.6 days
  • Top authors: Praveen Rajan (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

900+ active /14,540 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Please fix the following installer errors
  • The plugin cannot be installed
    • > Deprecated in wp-content/plugins/attachment-file-icons/attachment-file-icons.php+25
    Methods with the same name as their class will not be constructors in a future version of PHP; AttachmentFileIcons has a deprecated constructor

Server metrics [RAM: ▼1.76MB] [CPU: ▼53.37ms] Passed 4 tests

An overview of server-side resources used by Attachment File Icons (AF Icons)
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.22 ▼1.235.99 ▼38.15
Dashboard /wp-admin2.24 ▼1.066.01 ▼43.87
Posts /wp-admin/edit.php2.25 ▼1.115.85 ▼40.41
Add New Post /wp-admin/post-new.php2.25 ▼3.646.38 ▼91.04
Media Library /wp-admin/upload.php2.25 ▼0.986.91 ▼29.83

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 23 new files
Database: 1 new table, 6 new options
New tables
wp_afi_types
New WordPress options
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Attachment File Icons (AF Icons): an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,919 ▲18413.73 ▼0.646.17 ▲4.1241.62 ▼8.45
Dashboard /wp-admin2,226 ▲415.89 ▲1.0193.52 ▼23.0678.25 ▲32.45
Posts /wp-admin/edit.php2,112 ▲232.08 ▲0.0335.77 ▼1.2336.93 ▲2.07
Add New Post /wp-admin/post-new.php1,684 ▲15122.68 ▼0.49718.61 ▲34.6438.61 ▼15.43
Media Library /wp-admin/upload.php1,417 ▲294.18 ▼0.02121.73 ▲15.9442.25 ▼0.25

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
You still need to fix the following
  • Uninstall procedure had uncaught errors
    • > Deprecated in wp-content/plugins/attachment-file-icons/attachment-file-icons.php+25
    Methods with the same name as their class will not be constructors in a future version of PHP; AttachmentFileIcons has a deprecated constructor
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means 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
Almost there! Just fix the following items
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      Use of undefined constant WP_CONTENT_URL - assumed 'WP_CONTENT_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/attachment-file-icons/attachment-file-icons.php on line 38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/attachment-file-icons/attachment-file-icons.php:38

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
  • Screenshots: Add images for these screenshots: #1 (Screenshot Admin Section - Manage AF Icons), #2 (Screenshot Page Content with plugin enabled)
The official readme.txt is a good inspiration

attachment-file-icons/attachment-file-icons.php 92% from 13 tests

The main file in "Attachment File Icons (AF Icons)" v. 1.3 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:
  • Description: Keep the plugin description shorter than 140 characters (currently 189 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin758 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP1119139467
JavaScript196221218
PO File1172251
CSS10022

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity60.00
▷ Minimum class complexity60.00
▷ Maximum class complexity60.00
Average method complexity3.36
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods25
▷ Static methods416.00%
▷ Public methods25100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.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
17 PNG files occupy 0.14MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
mime/doc-icon.png0.76KB0.92KB0.00%
afi_small.png3.14KB0.57KB▼ 81.76%
screenshot-2.png31.55KB11.44KB▼ 63.74%
mime/csv-icon.png3.37KB0.94KB▼ 72.07%
mime/ppt-icon.png0.68KB0.60KB▼ 10.98%