10% file-gallery

Code Review | File Gallery

WordPress plugin File Gallery scored10%from 54 tests.

About plugin

  • Plugin page: file-gallery
  • Plugin version: 1.8.5.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.9.5
  • WordPress version: 6.3.1
  • First release: Apr 28, 2010
  • Latest release: Apr 20, 2023
  • Number of updates: 129
  • Update frequency: every 36.7 days
  • Top authors: aesqe (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

3,000+ active /257,840 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The following installer errors require your attention
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/file-gallery/includes/media-tags.php+97
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼0.82MB] [CPU: ▼37.56ms] Passed 4 tests

An overview of server-side resources used by File Gallery
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1248.01 ▲3.19
Dashboard /wp-admin3.12 ▼0.1830.82 ▼20.38
Posts /wp-admin/edit.php3.12 ▼0.2325.74 ▼23.43
Add New Post /wp-admin/post-new.php3.12 ▼2.7627.88 ▼88.29
Media Library /wp-admin/upload.php3.12 ▼0.1122.83 ▼18.13
Media tags /wp-admin/edit-tags.php?taxonomy=media_tag&post_type=attachment3.1327.69

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

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

Browser metrics Passed 4 tests

A check of browser resources used by File Gallery
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.35 ▼0.071.81 ▲0.0843.45 ▲0.09
Dashboard /wp-admin2,202 ▲285.59 ▼0.0682.53 ▼6.8238.51 ▼8.56
Posts /wp-admin/edit.php2,128 ▲312.03 ▲0.0538.18 ▲3.3638.21 ▲0.07
Add New Post /wp-admin/post-new.php2,554 ▲1,02821.93 ▼1.33749.51 ▲94.8874.46 ▲13.28
Media Library /wp-admin/upload.php1,421 ▲244.23 ▲0.0896.96 ▼15.0643.62 ▼3.34
Media tags /wp-admin/edit-tags.php?taxonomy=media_tag&post_type=attachment1,2532.1226.5029.81

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/file-gallery/includes/media-tags.php+48
    Function create_function() is deprecated
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • file_gallery
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Almost there, just fix the following server-side errors
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/edit-tags.php?taxonomy=media_tag&post_type=attachment
    • > Deprecated in wp-content/plugins/file-gallery/includes/media-settings.php+43
    Function create_function() is deprecated

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 4× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/file-gallery/templates/file-gallery/gallery.php
    • > /wp-content/plugins/file-gallery/templates/simple/gallery.php
    • > /wp-content/plugins/file-gallery/templates/list/gallery.php
    • > /wp-content/plugins/file-gallery/templates/default/gallery.php
  • 65× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: itemtag in wp-content/plugins/file-gallery/templates/default/gallery.php on line 9
    • > PHP Notice
      Undefined variable: endcol in wp-content/plugins/file-gallery/templates/simple/gallery.php on line 30
    • > PHP Notice
      Undefined variable: thumb_link in wp-content/plugins/file-gallery/templates/simple/gallery.php on line 33
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/file-gallery/includes/templates-media-wp43.php on line 4
    • > PHP Notice
      Undefined variable: title in wp-content/plugins/file-gallery/templates/default/gallery.php on line 13
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/file-gallery/includes/templates-media-wp39.php on line 5
    • > PHP Notice
      Undefined variable: delete_what in wp-content/plugins/file-gallery/includes/main-form.php on line 35
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/file-gallery/includes/tinymce.php:9
    • > PHP Notice
      Undefined variable: thumb_link in wp-content/plugins/file-gallery/templates/file-gallery/gallery.php on line 11
    • > PHP Notice
      Undefined variable: file_gallery_this_template_counter in wp-content/plugins/file-gallery/templates/simple/gallery.php on line 19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Tags: Please reduce the number of tags, currently 21 tag instead of maximum 10
  • Screenshots: These screenshots do not have images: #1 (File Gallery main box on editing screen), #2 (Edit attachment data), #3 (Copy all attachments from another post), #4 (Deleting attachments that have copies), #5 (Build a gallery by choosing media tags), #6 (Settings page), #7 (Post thumb and number of attachments as extras in this view), #8 (Copying attachments from media library), #9 (With "WPML Multilingual CMS" plugin istalled, you'll be able to copy), #10 (Custom fields for attachments)
The official readme.txt is a good inspiration

file-gallery/file-gallery.php 92% from 13 tests

Analyzing the main PHP file in "File Gallery" version 1.8.5.4
Please make the necessary changes and fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 208 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin17,267 lines of code in 54 files:
LanguageFilesBlank linesComment linesLines of code
PHP291,9882,8198,698
PO File71,6263,1523,571
JavaScript75041722,183
CSS10414432,009
HTML1290806

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
Please tend to the following items
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 653)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity144.62
▷ Minimum class complexity1.00
▷ Maximum class complexity765.00
Average method complexity20.46
▷ Minimum method complexity1.00
▷ Maximum method complexity653.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods60
▷ Static methods58.33%
▷ Public methods3660.00%
▷ Protected methods11.67%
▷ Private methods2338.33%
Functions102
▷ Named functions102100.00%
▷ Anonymous functions00.00%
Constants77
▷ Global constants1924.68%
▷ Class constants5875.32%
▷ Public constants58100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
78 PNG files occupy 0.60MB with 0.10MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/famfamfam_silk/lock_open.png0.71KB0.84KB0.00%
css/images/ui-bg_glass_75_e6e6e6_1x400.png0.26KB0.15KB▼ 42.37%
images/famfamfam_silk/tag_blue.png0.57KB0.61KB0.00%
help/images/19.png23.33KB17.30KB▼ 25.87%
images/white-grad.png0.21KB0.18KB▼ 12.38%