83% beaf-before-and-after-gallery

Code Review | Ultimate Before After Image Slider & Gallery - BEAF

WordPress plugin Ultimate Before After Image Slider & Gallery - BEAF scored83%from 54 tests.

About plugin

  • Plugin page: beaf-before-and-a...
  • Plugin version: 4.4.7
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4
  • WordPress version: 6.3.1
  • First release: Jan 29, 2020
  • Latest release: Nov 16, 2023
  • Number of updates: 182
  • Update frequency: every 7.6 days
  • Top authors: psdtowpservice (100%)

Code review

54 tests

User reviews

61 reviews

Install metrics

20,000+ active /311,589 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.69MB] [CPU: ▲3.76ms] Passed 4 tests

A check of server-side resources used by Ultimate Before After Image Slider & Gallery - BEAF
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.19 ▲0.7343.89 ▲2.85
Dashboard /wp-admin4.04 ▲0.7057.13 ▼4.13
Posts /wp-admin/edit.php4.09 ▲0.7354.45 ▲8.02
Add New Post /wp-admin/post-new.php6.56 ▲0.6794.73 ▲9.42
Media Library /wp-admin/upload.php3.88 ▲0.6541.18 ▲8.31
All Sliders /wp-admin/edit.php?post_type=bafg4.0143.99
Add New /wp-admin/post-new.php?post_type=bafg4.1152.21
Gallery Generator /wp-admin/edit.php?post_type=bafg&page=bafg_gallery3.9343.64
Settings /wp-admin/edit.php?post_type=bafg&page=bafg_settings3.8837.73
Category /wp-admin/edit-tags.php?taxonomy=bafg_gallery&post_type=bafg3.9647.19

Server storage [IO: ▲1.31MB] [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: 44 new files
Database: no new tables, 9 new options
New WordPress options
widget_bafg_widget
widget_recent-posts
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
db_upgraded
bafg_installation_date
tf_display_admin_notice_time
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Ultimate Before After Image Slider & Gallery - BEAF
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,131 ▲36915.37 ▲0.616.40 ▲4.6628.99 ▼15.73
Dashboard /wp-admin2,406 ▲2256.49 ▲0.81127.49 ▲26.4148.06 ▲3.72
Posts /wp-admin/edit.php2,347 ▲2473.66 ▲1.7261.32 ▲23.7443.09 ▲11.97
Add New Post /wp-admin/post-new.php1,588 ▲6223.52 ▲0.14616.06 ▼184.0135.29 ▼21.19
Media Library /wp-admin/upload.php1,481 ▲784.52 ▲0.3287.97 ▼10.9748.66 ▲5.04
All Sliders /wp-admin/edit.php?post_type=bafg1,3413.6157.5435.81
Add New /wp-admin/post-new.php?post_type=bafg5,1164.59186.27133.25
Gallery Generator /wp-admin/edit.php?post_type=bafg&page=bafg_gallery1,7484.1273.5533.83
Settings /wp-admin/edit.php?post_type=bafg&page=bafg_settings1,2763.4642.7739.35
Category /wp-admin/edit-tags.php?taxonomy=bafg_gallery&post_type=bafg1,5263.4549.1035.66

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 9 options in the database
    • tf_display_admin_notice_time
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_bafg_widget
    • bafg_installation_date

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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 take a closer look at the following
  • 9× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/beaf-before-and-after-gallery/inc/widget/bafg-widget.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/beaf-before-and-after-gallery/admin/global-options.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/beaf-before-and-after-gallery/inc/templates/single-bafg.php:1
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/beaf-before-and-after-gallery/inc/functions.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/beaf-before-and-after-gallery/inc/templates/bafg-gallery-generator.php:4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/beaf-before-and-after-gallery/inc/functions.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function ElementorBafg\\add_action() in wp-content/plugins/beaf-before-and-after-gallery/inc/bafg-elementor/bafg-register.php:57
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/beaf-before-and-after-gallery/inc/functions.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_plugin_active() in wp-content/plugins/beaf-before-and-after-gallery/inc/functions.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 81% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Screenshots: Screenshot #24 (Before After Video Slider) image required
  • Tags: Too many tags (31 tag instead of maximum 10); only the first 5 tags are used in your directory listing
  • Donate link: Please fix this invalid url: ""
The official readme.txt is a good inspiration

beaf-before-and-after-gallery/before-and-after-gallery.php 85% from 13 tests

The main PHP script in "Ultimate Before After Image Slider & Gallery - BEAF" version 4.4.7 is automatically included on every request by WordPress
It is important to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("beaf-before-and-after-gallery.php" instead of "before-and-after-gallery.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin6,884 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
PHP168459024,119
CSS3259331,387
JavaScript52721701,077
Markdown1820255
JSON11045
SVG1001

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity29.11
▷ Minimum class complexity2.00
▷ Maximum class complexity86.00
Average method complexity3.22
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes111.11%
Methods116
▷ Static methods21.72%
▷ Public methods7968.10%
▷ Protected methods86.90%
▷ Private methods2925.00%
Functions54
▷ Named functions5194.44%
▷ Anonymous functions35.56%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
12 PNG files occupy 0.94MB with 0.35MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/image/style6.png0.97KB0.52KB▼ 46.83%
assets/image/style1.png1.10KB0.63KB▼ 42.49%
assets/image/BLACK_FRIDAY_BACKGROUND_GRUNGE.png257.30KB273.29KB0.00%
assets/image/default.png1.19KB0.57KB▼ 52.02%
assets/image/style2.png0.86KB0.45KB▼ 47.90%