10% document-gallery

Code Review | Document Gallery

WordPress plugin Document Gallery scored10%from 54 tests.

About plugin

  • Plugin page: document-gallery
  • Plugin version: 4.4.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.2.2
  • WordPress version: 6.3.1
  • First release: Aug 25, 2012
  • Latest release: Dec 1, 2023
  • Number of updates: 570
  • Update frequency: every 7.2 days
  • Top authors: dan.rossiter (93.86%)demur (6.32%)

Code review

54 tests

User reviews

109 reviews

Install metrics

10,000+ active /293,764 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
It is recommended to fix the following installer errors
  • Install procedure had errors
    • > Notice in wp-content/plugins/document-gallery/inc/class-thumber.php+150
    Trying to access array offset on value of type null

Server metrics [RAM: ▲0.53MB] [CPU: ▼1.92ms] Passed 4 tests

Server-side resources used by Document Gallery
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.93 ▲0.4746.26 ▲6.24
Dashboard /wp-admin3.87 ▲0.5348.96 ▼14.15
Posts /wp-admin/edit.php3.92 ▲0.5750.07 ▲1.77
Add New Post /wp-admin/post-new.php6.48 ▲0.5997.00 ▼1.55
Media Library /wp-admin/upload.php3.79 ▲0.5639.13 ▲8.72
Document Gallery /wp-admin/options-general.php?page=document_gallery3.9437.12

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 103 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
db_upgraded
widget_recent-comments
can_compress_scripts
document_gallery

Browser metrics Passed 4 tests

An overview of browser requirements for Document Gallery
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,923 ▲16113.44 ▼1.279.63 ▲7.8643.24 ▼1.49
Dashboard /wp-admin2,212 ▲355.70 ▲0.1191.47 ▼7.2441.58 ▼2.89
Posts /wp-admin/edit.php2,117 ▲142.06 ▲0.0940.49 ▼1.0834.65 ▼3.45
Add New Post /wp-admin/post-new.php1,555 ▲2923.47 ▼0.12651.11 ▼16.2352.60 ▲1.87
Media Library /wp-admin/upload.php1,420 ▲204.26 ▲0.0996.77 ▲0.4840.23 ▼0.21
Document Gallery /wp-admin/options-general.php?page=document_gallery1,2542.4327.3134.16

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

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
Please fix the following
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/document-gallery/admin/media-manager-template.php:5
    • > PHP Warning
      include_once(DG_PATHinc/class-gallery.php): failed to open stream: No such file or directory in wp-content/plugins/document-gallery/admin/media-manager-template.php on line 2
    • > PHP Warning
      include_once(): Failed opening 'DG_PATHinc/class-gallery.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/document-gallery/admin/media-manager-template.php on line 2
    • > PHP Warning
      Use of undefined constant DG_PATH - assumed 'DG_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/document-gallery/admin/media-manager-template.php on line 2

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 97% 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 your attention:
  • Screenshots: Please add images for these screenshots: #1 (Document Gallery integrates directly with the WordPress Media Manager.), #2 (The common configuration options are directly accessible through the Media Manager), #3 (This is an example of "fancy" thumbnails. The images are a copy of the front), #4 (This is an example of multiple Document Galleries on a single page (using), #5 (This is how the Document Gallery looks with `descriptions=false` (default).)
The official readme.txt might help

document-gallery/document-gallery.php Passed 13 tests

This is the main PHP file of "Document Gallery" version 4.4.4, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
92 characters long description:
Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin7,861 lines of code in 51 files:
LanguageFilesBlank linesComment linesLines of code
PHP341,0092,2984,146
PO File65605821,622
JavaScript6123219881
CSS414418757
Markdown1840455

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity19.70
▷ Minimum class complexity1.00
▷ Maximum class complexity63.00
Average method complexity2.63
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes27
▷ Abstract classes27.41%
▷ Concrete classes2592.59%
▷ Final classes00.00%
Methods313
▷ Static methods18559.11%
▷ Public methods22070.29%
▷ Protected methods185.75%
▷ Private methods7523.96%
Functions27
▷ Named functions27100.00%
▷ Anonymous functions00.00%
Constants18
▷ Global constants844.44%
▷ Class constants1055.56%
▷ Public constants10100.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
40 PNG files occupy 0.56MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icons/opendocument-presentation.png6.95KB3.32KB▼ 52.30%
assets/icons/rtf.png9.40KB5.08KB▼ 45.89%
assets/icons/opendocument-database.png8.03KB3.60KB▼ 55.17%
assets/icons/opendocument-formula.png7.91KB4.14KB▼ 47.68%
assets/icons/html.png9.11KB4.44KB▼ 51.25%