83% fancybox-for-wordpress

Code Review | FancyBox for WordPress

WordPress plugin FancyBox for WordPress scored83%from 54 tests.

About plugin

  • Plugin page: fancybox-for-word...
  • Plugin version: 3.3.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.0
  • WordPress version: 6.3.1
  • First release: Feb 6, 2009
  • Latest release: May 24, 2022
  • Number of updates: 148
  • Update frequency: every 32.8 days
  • Top authors: moskis (67.57%)machothemes (12.16%)giucu91 (8.78%)silkalns (8.78%)colorlibplugins (5.41%)

Code review

54 tests

User reviews

87 reviews

Install metrics

50,000+ active /1,809,725 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.12MB] [CPU: ▼4.52ms] Passed 4 tests

This is a short check of server-side resources used by FancyBox for WordPress
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1339.94 ▼3.18
Dashboard /wp-admin3.43 ▲0.1250.92 ▲4.53
Posts /wp-admin/edit.php3.54 ▲0.1846.85 ▼2.43
Add New Post /wp-admin/post-new.php6.01 ▲0.1284.19 ▼14.56
Media Library /wp-admin/upload.php3.35 ▲0.1235.33 ▲2.08
Fancybox for WP /wp-admin/options-general.php?page=fancybox-for-wordpress3.4133.11

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 51 new files
Database: no new tables, 9 new options
New WordPress options
mfbfw_active_version
db_upgraded
mfbfw-rate-time
widget_theysaidso_widget
widget_recent-comments
mfbfw
can_compress_scripts
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

FancyBox for WordPress: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,898 ▲15214.16 ▼0.0211.76 ▲10.0544.46 ▼0.92
Dashboard /wp-admin2,213 ▲224.82 ▼0.07101.89 ▼5.5739.37 ▼5.40
Posts /wp-admin/edit.php2,090 ▲11.99 ▲0.0035.23 ▼1.2533.11 ▲2.03
Add New Post /wp-admin/post-new.php1,545 ▲2618.31 ▼5.03603.57 ▼87.1452.28 ▼15.07
Media Library /wp-admin/upload.php1,392 ▲104.17 ▲0.0297.17 ▼3.4442.11 ▲0.70
Fancybox for WP /wp-admin/options-general.php?page=fancybox-for-wordpress3,4645.33111.47111.04

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_recent-posts
    • mfbfw
    • db_upgraded
    • theysaidso_admin_options
    • mfbfw_active_version
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • mfbfw-rate-time

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
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 9× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/fancybox-for-wordpress/lib/admin-head.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/fancybox-for-wordpress/fancybox.php:40
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/fancybox-for-wordpress/lib/admin-tab-appearance.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/fancybox-for-wordpress/lib/admin-tab-behaviour.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/fancybox-for-wordpress/lib/admin-tab-animations.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/fancybox-for-wordpress/lib/admin-tab-galleries.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/fancybox-for-wordpress/class-fancybox-review.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/fancybox-for-wordpress/lib/admin-tab-support.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/fancybox-for-wordpress/lib/admin-tab-other.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Simple example of fancybox on a post. [Live demo here](http://blog.moskis.net/2012/01/20/teclado-apple-en-windows-7/)), #2 (Basic settings on Options Page in the Admin Panel. This makes it very easy to customize the plugin to your needs)
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can take inspiration from this readme.txt

fancybox-for-wordpress/fancybox.php 85% from 13 tests

The main file in "FancyBox for WordPress" v. 3.3.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("fancybox-for-wordpress.php" instead of "fancybox.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected8,280 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript21,2086523,923
PHP101891081,543
PO File45207321,514
CSS3214581,300

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity10.00
▷ Minimum class complexity10.00
▷ Maximum class complexity10.00
Average method complexity2.12
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods8
▷ Static methods00.00%
▷ Public methods675.00%
▷ Protected methods00.00%
▷ Private methods225.00%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.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
21 compressed PNG files occupy 0.47MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/fancy_nav_left.png1.41KB1.64KB0.00%
assets/images/fancy_shadow_s.png0.11KB0.19KB0.00%
assets/images/fancy_shadow_ne.png0.34KB0.48KB0.00%
assets/images/fancybox-y.png0.17KB0.24KB0.00%
assets/images/fancy_close.png1.48KB1.73KB0.00%