68% gallery-for-posts-basic

Code Review | Gallery for Posts

WordPress plugin Gallery for Posts scored68%from 54 tests.

About plugin

  • Plugin page: gallery-for-posts...
  • Plugin version: 1.1
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.8
  • WordPress version: 6.3.1
  • First release: Apr 20, 2021
  • Latest release: Aug 16, 2021
  • Number of updates: 3
  • Update frequency: every 39.3 days
  • Top authors: sidngr (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /396 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▼0.71MB] [CPU: ▼21.72ms] Passed 4 tests

Server-side resources used by Gallery for Posts
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0837.91 ▼0.88
Dashboard /wp-admin3.20 ▼0.1133.37 ▼13.99
Posts /wp-admin/edit.php3.28 ▼0.0836.13 ▼9.99
Add New Post /wp-admin/post-new.php3.24 ▼2.6538.70 ▼62.00
Media Library /wp-admin/upload.php3.22 ▼0.0136.00 ▲0.16
Post Types /wp-admin/admin.php?page=sn-gfp-post-types3.2835.74
Templates /wp-admin/admin.php?page=sn-gfp-templates3.2835.73

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 20 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Gallery for Posts
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲7414.35 ▲0.001.84 ▲0.2245.33 ▲8.56
Dashboard /wp-admin2,235 ▲585.66 ▲0.0284.18 ▼2.2781.58 ▲37.66
Posts /wp-admin/edit.php2,149 ▲492.22 ▲0.1937.60 ▲0.5035.17 ▲0.90
Add New Post /wp-admin/post-new.php1,556 ▲3022.77 ▼0.43747.18 ▲83.1555.39 ▲4.08
Media Library /wp-admin/upload.php1,443 ▲464.25 ▲0.09111.48 ▲10.9169.42 ▲19.38
Post Types /wp-admin/admin.php?page=sn-gfp-post-types1,0042.2931.7148.07
Templates /wp-admin/admin.php?page=sn-gfp-templates9472.1733.6330.96

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin cannot be uninstalled
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method SN_GFP_INIT::uninstall_plugin_data() should not be called statically
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sn-gfp-templates
    • > Notice in wp-content/plugins/gallery-for-posts-basic/includes/class.sn-gfp-init.php+127
    Undefined index: sn_gfp_message
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sn-gfp-templates
    • > Notice in wp-content/plugins/gallery-for-posts-basic/includes/class.sn-gfp-init.php+127
    Trying to access array offset on value of type null
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sn-gfp-post-types
    • > Warning in wp-content/plugins/gallery-for-posts-basic/templates/post-types.php+22
    in_array() expects parameter 2 to be array, bool given

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'SN_GFP_INIT' not found in wp-content/plugins/gallery-for-posts-basic/templates/navigation.php:1

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 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
3 plugin tags: wordpress, custom post, gallery

gallery-for-posts-basic/init.php 92% from 13 tests

The principal PHP file in "Gallery for Posts" v. 1.1 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("gallery-for-posts-basic.php" instead of "init.php")

Code Analysis Passed 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 plugin1,588 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript5135245959
PHP987168347
CSS21316282

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity4.00
▷ Minimum class complexity2.00
▷ Maximum class complexity7.00
Average method complexity1.56
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods27
▷ Static methods414.81%
▷ Public methods2696.30%
▷ Protected methods00.00%
▷ Private methods13.70%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants11100.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon.png0.94KB0.11KB▼ 88.20%