84% 2j-photo-gallery

Code Review | Photo Gallery by 2J

WordPress plugin Photo Gallery by 2J scored 84% from 54 tests.

About plugin

  • Plugin page: 2j-photo-gallery
  • Plugin version: 1.0.12
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-4.8
  • WordPress version: 5.9.2
  • First release: Apr 21, 2017
  • Latest release: Mar 7, 2018
  • Number of updates: 38
  • Update frequency: every 9.3 days
  • Top authors: 2jgallery (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

30+ active / 1,889 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼301.65ms] Passed 4 tests

Analyzing server-side resources used by Photo Gallery by 2J
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0449.29 ▼2.15
Dashboard /wp-admin3.46 ▲0.0536.80 ▼3.37
Posts /wp-admin/edit.php3.68 ▲0.0446.69 ▲7.90
Add New Post /wp-admin/post-new.php6.92 ▼0.0592.82 ▼1,202.39
Media Library /wp-admin/upload.php3.33 ▲0.0424.64 ▲1.31
2J Photo Gallery /wp-admin/options-general.php?page=photo_gallery_2j_settings3.3035.27

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 36 new files
Database: no new tables, 2 new options
New WordPress options
widget_photo_gallery_2j_widget
twoj_photo_gallery_BeforeActivator

Browser metrics Passed 4 tests

This is an overview of browser requirements for Photo Gallery by 2J
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,787 ▲6415.16 ▼0.436.01 ▼0.812.74 ▲0.44
Dashboard /wp-admin2,883 ▲226.03 ▼0.13113.94 ▼22.58157.53 ▼0.35
Posts /wp-admin/edit.php2,693 ▲23.24 ▲0.0068.84 ▲3.65154.58 ▲6.79
Add New Post /wp-admin/post-new.php1,664 ▲315.88 ▼0.08443.52 ▲27.08158.90 ▼40.31
Media Library /wp-admin/upload.php1,700 ▲25.55 ▲0.03143.79 ▼3.46185.72 ▲0.36
2J Photo Gallery /wp-admin/options-general.php?page=photo_gallery_2j_settings1,0352.3877.63101.76

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
You still need to fix the following
  • The uninstall procedure has failed, leaving 1 option in the database
    • widget_photo_gallery_2j_widget

Smoke tests 75% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=photo_gallery_2j_settings
    • > Notice in wp-content/plugins/2j-photo-gallery/includes/options.php+41
    Undefined index: active

SRP Passed 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
The SRP test was a success

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Screenshots: These screenshots require images: #1 (Photo gallery 2J - An example of plugin in action - [Grid Gallery Type]), #2 (Photo gallery - An example of plugin in action - [Grid Gallery Type]), #3 (An example of plugin in action - (LightBox Gallery Version)), #4 (An example of plugin in action - (LightBox Gallery Version)), #5 (An example of plugin in action - (Thumbnails Video Version)), #10 (An example of plugin in action - (Thumbnails Video Version))
The official readme.txt is a good inspiration

2j-photo-gallery/2j-photo-gallery.php Passed 13 tests

The entry point to "Photo Gallery by 2J" version 1.0.12 is a PHP file that has certain tags in its header comment area
128 characters long description:
Photo gallery with light style design. Simple config and interface settings of the photo gallery. Classic and grid photo layout.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin13,516 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
CSS71,2051910,197
JavaScript59294613,141
PHP44835177
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity7.00
▷ Minimum class complexity1.00
▷ Maximum class complexity13.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods6
▷ Static methods233.33%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.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
7 PNG files occupy 2.07MB with 1.23MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png6.21KB4.10KB▼ 33.93%
screenshot-5.png1,063.18KB246.50KB▼ 76.82%
screenshot-2.png6.33KB3.93KB▼ 37.95%
screenshot-6.png1,004.99KB231.62KB▼ 76.95%
screenshot-4.png31.39KB9.15KB▼ 70.86%