78% gallery-box

Code Review | Gallery Box

WordPress plugin Gallery Box scored78%from 54 tests.

About plugin

  • Plugin page: gallery-box
  • Plugin version: 1.7.33
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-6.3
  • WordPress version: 6.3.1
  • First release: Jul 2, 2016
  • Latest release: Aug 12, 2023
  • Number of updates: 140
  • Update frequency: every 18.6 days
  • Top authors: nalam (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

2,000+ active /120,013 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.48MB] [CPU: ▼1.19ms] Passed 4 tests

Analyzing server-side resources used by Gallery Box
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0941.02 ▲3.27
Dashboard /wp-admin3.93 ▲0.6361.65 ▲15.71
Posts /wp-admin/edit.php4.03 ▲0.6850.33 ▲5.33
Add New Post /wp-admin/post-new.php6.51 ▲0.6284.51 ▼14.40
Media Library /wp-admin/upload.php3.82 ▲0.5937.28 ▲1.06
All gallery /wp-admin/edit.php?post_type=gallery_box3.8945.11
Add New gallery /wp-admin/post-new.php?post_type=gallery_box4.9067.49

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 488 new files
Database: no new tables, 11 new options
New WordPress options
vimeo_style
youtube_style
img_style
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
Lightbox_settings
widget_recent-posts
iframe_style
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

An overview of browser requirements for Gallery Box
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,143 ▲38215.34 ▲1.069.84 ▲8.2131.67 ▼8.88
Dashboard /wp-admin2,420 ▲2436.40 ▲0.81117.69 ▲25.5346.43 ▲7.29
Posts /wp-admin/edit.php2,354 ▲2543.74 ▲1.7754.08 ▲16.6134.57 ▼3.66
Add New Post /wp-admin/post-new.php1,610 ▲8423.68 ▲0.56681.71 ▲15.0537.72 ▼13.57
Media Library /wp-admin/upload.php1,488 ▲884.67 ▲0.5682.65 ▼34.3846.08 ▼2.11
All gallery /wp-admin/edit.php?post_type=gallery_box1,3343.7548.5032.02
Add New gallery /wp-admin/post-new.php?post_type=gallery_box7,2438.28226.76162.94
Gallery Box settings /wp-admin/gallery-box-options.php260.420.1313.27

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 11 options in the database
    • youtube_style
    • widget_theysaidso_widget
    • img_style
    • db_upgraded
    • widget_recent-posts
    • vimeo_style
    • Lightbox_settings
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
The following issues need your attention
  • 82× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/gallery-box/admin/src/CMB2/includes/types/CMB2_Type_Title.php:13
    • > PHP Warning
      require_once(GALLERY_BOX_PATH/includes/all-gallery/portfolio-gallery/portfolio-script.php): failed to open stream: No such file or directory in wp-content/plugins/gallery-box/includes/all-gallery/portfolio-gallery/portfolio-gallery.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gallery-box/includes/all-gallery/portfolio-gallery/portfolio-script.php:36
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_File_Base' not found in wp-content/plugins/gallery-box/admin/src/CMB2/includes/types/CMB2_Type_File.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/gallery-box/admin/gallerybox-options.php:1019
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Counter_Base' not found in wp-content/plugins/gallery-box/admin/src/CMB2/includes/types/CMB2_Type_Textarea.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gallery-box/includes/all-gallery/portfolio-gallery/portfolio-style.php:128
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/gallery-box/includes/gallerybox-shortcode.php:128
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/gallery-box/admin/src/cmb2-select2/select2.php:20
    • > PHP Warning
      Use of undefined constant GALLERY_BOX_PATH - assumed 'GALLERY_BOX_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/gallery-box/includes/all-gallery/iframe-gallery/iframe-gallery.php on line 12

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/gallery-box-options.php
    • > Network (severe)
    wp-admin/gallery-box-options.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: These screenshots lack descriptions #4, #5 in gallery-box/assets to your readme.txt
  • Tags: You are using too many tags: 13 tag instead of maximum 10
The official readme.txt might help

gallery-box/gallery-box.php 92% from 13 tests

"Gallery Box" version 1.7.33's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin64,973 lines of code in 303 files:
LanguageFilesBlank linesComment linesLines of code
PO File12014,31518,50232,323
PHP1063,7278,26514,354
CSS266171,3468,215
JSON5004,352
JavaScript224556741,865
SVG3101,500
Sass17306291,411
Markdown43150953

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity20.17
▷ Minimum class complexity1.00
▷ Maximum class complexity188.00
Average method complexity3.18
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes84
▷ Abstract classes910.71%
▷ Concrete classes7589.29%
▷ Final classes00.00%
Methods744
▷ Static methods11215.05%
▷ Public methods61282.26%
▷ Protected methods9813.17%
▷ Private methods344.57%
Functions86
▷ Named functions8598.84%
▷ Anonymous functions11.16%
Constants15
▷ Global constants533.33%
▷ Class constants1066.67%
▷ Public constants10100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
23 PNG files occupy 0.12MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/src/CMB2/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
admin/src/CMB2/images/ui-icons_888888_256x240.png5.23KB4.11KB▼ 21.49%
images/simple-setting.png1.21KB0.85KB▼ 29.80%
images/gbox-pro.png46.80KB15.55KB▼ 66.77%
images/galleryBox-icon.png2.42KB1.42KB▼ 41.29%