10% document-gallery

Code Review | Document Gallery

WordPress plugin Document Gallery scored 10% from 53 tests.

About plugin

  • Plugin page: document-gallery
  • Plugin version: 4.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-4.8
  • WordPress version: 5.8.1
  • First release: Aug 25, 2012
  • Latest release: Nov 12, 2017
  • Number of updates: 567
  • Update frequency: every 3.4 days
  • Top authors: dan.rossiter (93.83%)demur (6.35%)

Code review

53 tests

User reviews

104 reviews

Install metrics

10,000+ active / 281,981 total downloads


Plugin footprint 75% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > 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.08MB] [CPU: ▼285.59ms] Passed 4 tests

An overview of server-side resources used by Document Gallery
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.88 ▲0.1635.60 ▲15.48
Dashboard /wp-admin3.17 ▲0.1244.66 ▲3.60
Posts /wp-admin/edit.php3.22 ▲0.1242.40 ▼0.13
Add New Post /wp-admin/post-new.php5.48 ▲0.0596.32 ▼1,141.66
Media Library /wp-admin/upload.php3.05 ▲0.0532.05 ▼4.18
Document Gallery /wp-admin/options-general.php?page=document_gallery3.1128.85

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 103 new files
Database: no new tables, 1 new option
New WordPress options

Browser metrics Passed 4 tests

Checking browser requirements for Document Gallery
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲19016.24 ▲0.6713.14 ▲5.7647.28 ▼4.40
Dashboard /wp-admin2,957 ▲1046.11 ▲0.16137.72 ▲3.86106.16 ▼4.37
Posts /wp-admin/edit.php2,733 ▲302.73 ▲0.0564.17 ▲1.8182.30 ▼4.70
Add New Post /wp-admin/post-new.php1,683 ▲3219.19 ▲1.76361.26 ▼31.33114.83 ▼4.50
Media Library /wp-admin/upload.php1,805 ▲335.07 ▲0.07136.65 ▼25.87108.72 ▼12.22
Document Gallery /wp-admin/options-general.php?page=document_gallery1,5962.6269.68101.22

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 4× PHP files trigger server errors when accessed directly:
    • > 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
    • > 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

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found


Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Screenshots: These screenshots do not have images: #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).)
You can look at the official readme.txt

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

The main file in "Document Gallery" v. 4.4.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
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 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin7,874 lines of code in 51 files:
LanguageFilesBlank linesComment linesLines of code
PO File65605821,622

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
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
▷ Abstract classes27.41%
▷ Concrete classes2592.59%
▷ Final classes00.00%
▷ Static methods18559.11%
▷ Public methods22070.29%
▷ Protected methods185.75%
▷ Private methods7523.96%
▷ Named functions27100.00%
▷ Anonymous functions00.00%
▷ Global constants844.44%
▷ Class constants1055.56%
▷ Public constants10100.00%

Plugin size 0% from 1 test

Image compression 0% from 1 test

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
40 PNG files occupy 0.56MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icons/javascript.png7.43KB4.44KB▼ 40.22%
screenshot-3.png41.94KB17.15KB▼ 59.10%
assets/icons/pages.png6.17KB3.48KB▼ 43.59%
assets/icons/msdoc.png8.46KB4.41KB▼ 47.84%
assets/icons/opendocument-spreadsheet.png6.85KB3.27KB▼ 52.27%