78% postgallery

Code Review | PostGallery

WordPress plugin PostGallery scored78%from 54 tests.

About plugin

  • Plugin page: postgallery
  • Plugin version: 1.12.4
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0
  • WordPress version: 6.3.1
  • First release: Dec 23, 2015
  • Latest release: Jul 11, 2022
  • Number of updates: 110
  • Update frequency: every 21.8 days
  • Top authors: crazypsycho (70.91%)rtowebsites (30%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /3,741 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.79MB] [CPU: ▲1.59ms] Passed 4 tests

A check of server-side resources used by PostGallery
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.34 ▲0.8748.90 ▲10.90
Dashboard /wp-admin4.09 ▲0.7853.12 ▼0.19
Posts /wp-admin/edit.php4.16 ▲0.8051.96 ▲8.85
Add New Post /wp-admin/post-new.php6.86 ▲0.9691.01 ▼5.88
Media Library /wp-admin/upload.php3.95 ▲0.7240.49 ▲3.58
Add New /wp-admin/post-new.php?post_type=postgalleryslider4.3355.79
Add New /wp-admin/post-new.php?post_type=gallery4.4162.12
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=gallery3.9638.49
Slider /wp-admin/edit.php?post_type=postgalleryslider4.0538.32
Galleries /wp-admin/edit.php?post_type=gallery4.0640.46

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 90 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
category_children
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for PostGallery
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,018 ▲25714.30 ▼0.0510.84 ▲9.3154.06 ▲15.40
Dashboard /wp-admin2,281 ▲1015.04 ▼0.58102.45 ▲19.6244.16 ▲0.17
Posts /wp-admin/edit.php2,189 ▲922.44 ▲0.4637.69 ▲1.0533.42 ▼0.82
Add New Post /wp-admin/post-new.php6,658 ▲5,13027.95 ▲4.71906.20 ▲247.1959.13 ▲6.33
Media Library /wp-admin/upload.php1,481 ▲814.28 ▲0.1088.00 ▼21.4137.34 ▼8.68
Add New /wp-admin/post-new.php?post_type=postgalleryslider2,5763.3662.0245.64
Add New /wp-admin/post-new.php?post_type=gallery2,8628.06176.4573.90
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=gallery1,5412.1932.5031.14
Slider /wp-admin/edit.php?post_type=postgalleryslider1,1322.4035.2429.19
Galleries /wp-admin/edit.php?post_type=gallery1,2092.3932.3426.41

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • category_children

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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 take a closer look at the following
  • 4× PHP files output text when accessed directly:
    • > /wp-content/plugins/postgallery/admin/partials/uploaded-image-item.php
    • > /wp-content/plugins/postgallery/public/partials/post-gallery-public-display.php
    • > /wp-content/plugins/postgallery/admin/partials/slider-admin-display.php
    • > /wp-content/plugins/postgallery/admin/partials/post-gallery-admin-display.php
  • 21× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined variable: filename in wp-content/plugins/postgallery/admin/partials/uploaded-image-item.php on line 12
    • > PHP Notice
      Undefined variable: imageDir in wp-content/plugins/postgallery/admin/partials/uploader-ui.php on line 2
    • > PHP Warning
      array_unshift() expects parameter 1 to be array, null given in wp-content/plugins/postgallery/templates/slider.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'Lib\\PostGallery' not found in wp-content/plugins/postgallery/includes/PostGallery.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/postgallery/admin/partials/uploader-ui.php:6
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/postgallery/admin/partials/uploader-ui.php on line 4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/postgallery/litebox-templates/default-with-thumbs.php:2
    • > PHP Notice
      Undefined variable: fullFilename in wp-content/plugins/postgallery/admin/partials/uploaded-image-item.php on line 4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/postgallery/litebox-templates/default.php:1
    • > PHP Notice
      Undefined variable: currentLangPost in wp-content/plugins/postgallery/admin/partials/uploader-ui.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need your attention:
  • Tags: There are too many tags (12 tag instead of maximum 10)
You can take inspiration from this readme.txt

postgallery/post-gallery.php 92% from 13 tests

The main PHP file in "PostGallery" ver. 1.12.4 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("postgallery.php" instead of "post-gallery.php")

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
Success! There were no dangerous files found in this plugin10,593 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
PHP461,2251,9835,645
JSON2002,446
JavaScript153163601,396
CSS913860872
PO File11070234

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity26.48
▷ Minimum class complexity1.00
▷ Maximum class complexity144.00
Average method complexity4.10
▷ Minimum method complexity1.00
▷ Maximum method complexity71.00
Code structure
Namespaces7
Interfaces0
Traits1
Classes26
▷ Abstract classes00.00%
▷ Concrete classes26100.00%
▷ Final classes00.00%
Methods223
▷ Static methods5926.46%
▷ Public methods18783.86%
▷ Protected methods94.04%
▷ Private methods2712.11%
Functions6
▷ Named functions583.33%
▷ Anonymous functions116.67%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/image-placeholder.png14.82KB9.42KB▼ 36.42%
build/css/grabbing.png0.11KB0.14KB0.00%