84% boxers-and-swipers

Code Review | Boxers and Swipers

WordPress plugin Boxers and Swipers scored84%from 54 tests.

About plugin

  • Plugin page: boxers-and-swipers
  • Plugin version: 4.02
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.4
  • WordPress version: 6.3.1
  • First release: Apr 14, 2014
  • Latest release: Nov 2, 2023
  • Number of updates: 220
  • Update frequency: every 15.9 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

700+ active /28,868 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.30MB] [CPU: ▼9.25ms] Passed 4 tests

This is a short check of server-side resources used by Boxers and Swipers
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.79 ▲0.3244.75 ▲3.43
Dashboard /wp-admin3.61 ▲0.2647.89 ▼26.24
Posts /wp-admin/edit.php3.73 ▲0.3753.76 ▲3.60
Add New Post /wp-admin/post-new.php6.20 ▲0.3187.16 ▼16.03
Media Library /wp-admin/upload.php3.54 ▲0.3038.04 ▲1.86
Boxers and Swipers /wp-admin/options-general.php?page=boxersandswipers3.5034.12

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 53 new files
Database: no new tables, 13 new options
New WordPress options
boxersandswipers_nivolightbox
boxersandswipers_useragent
can_compress_scripts
boxersandswipers_colorbox
widget_recent-comments
theysaidso_admin_options
boxersandswipers_effect
widget_theysaidso_widget
widget_recent-posts
boxersandswipers_slimbox
...

Browser metrics Passed 4 tests

An overview of browser requirements for Boxers and Swipers
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,928 ▲15713.65 ▼0.8812.04 ▲10.1942.32 ▼1.00
Dashboard /wp-admin2,202 ▲275.63 ▼0.0891.64 ▼8.2343.63 ▼3.73
Posts /wp-admin/edit.php2,104 ▲41.99 ▼0.0240.42 ▲2.8937.60 ▲2.39
Add New Post /wp-admin/post-new.php1,537 ▲1118.22 ▼5.54585.66 ▼95.4170.50 ▲18.30
Media Library /wp-admin/upload.php1,407 ▲74.20 ▼0.0294.63 ▼13.2742.65 ▼6.44
Boxers and Swipers /wp-admin/options-general.php?page=boxersandswipers2,8412.0024.6729.21

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/boxers-and-swipers/lib/class-boxersandswipersadmin.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/boxers-and-swipers/lib/class-boxersandswipersregist.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/boxers-and-swipers/lib/class-boxersandswipersregist.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/boxers-and-swipers/lib/class-boxersandswipers.php:45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
9 plugin tags: nivolightbox, useragent, colorbox, images, smartphone...

boxers-and-swipers/boxersandswipers.php 92% from 13 tests

The entry point to "Boxers and Swipers" version 4.02 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("boxers-and-swipers.php" instead of "boxersandswipers.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected4,562 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP51382662,227
CSS7140127949
JavaScript15128206915
Sass11201467
Markdown1103
SVG1001

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 109)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity91.33
▷ Minimum class complexity12.00
▷ Maximum class complexity208.00
Average method complexity13.32
▷ Minimum method complexity1.00
▷ Maximum method complexity109.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods22
▷ Static methods00.00%
▷ Public methods1568.18%
▷ Protected methods00.00%
▷ Private methods731.82%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
11 PNG files occupy 0.02MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
nivolightbox/themes/default/next.png3.12KB0.32KB▼ 89.60%
colorbox/images/controls.png2.83KB1.28KB▼ 54.82%
colorbox/images/overlay.png0.18KB0.15KB▼ 15.93%
nivolightbox/themes/default/close.png2.88KB0.24KB▼ 91.76%
nivolightbox/themes/default/next@2x.png4.14KB0.98KB▼ 76.27%