83% addfunc-backgrounds

Code Review | AddFunc Backgrounds

WordPress plugin AddFunc Backgrounds scored 83% from 54 tests.

About plugin

  • Plugin page: addfunc-backgrounds
  • Plugin version: 0.10
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.0
  • WordPress version: 5.8.1
  • First release: Nov 29, 2018
  • Latest release: Dec 11, 2018
  • Number of updates: 4
  • Update frequency: every 31.2 days
  • Top authors: joerhoney (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active / 822 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.36MB] [CPU: ▼136.78ms] Passed 4 tests

A check of server-side resources used by AddFunc Backgrounds
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.98 ▲0.1437.06 ▲2.04
Dashboard /wp-admin3.55 ▲0.5049.60 ▲3.18
Posts /wp-admin/edit.php3.56 ▲0.4549.96 ▲5.98
Add New Post /wp-admin/post-new.php5.80 ▲0.3791.97 ▼557.73
Media Library /wp-admin/upload.php3.56 ▲0.5535.16 ▲5.40
Backgrounds /wp-admin/edit.php?post_type=background3.5641.06
Add New /wp-admin/post-new.php?post_type=background3.5647.37

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 10 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for AddFunc Backgrounds
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,718 ▲12215.96 ▲0.389.68 ▼0.2742.70 ▼2.09
Dashboard /wp-admin3,002 ▲685.91 ▼0.09143.03 ▼9.47104.82 ▼3.81
Posts /wp-admin/edit.php2,774 ▲382.73 ▲0.0268.75 ▲2.4985.75 ▼1.21
Add New Post /wp-admin/post-new.php1,697 ▲19920.91 ▲2.12281.84 ▼124.75118.49 ▲10.68
Media Library /wp-admin/upload.php1,842 ▲355.02 ▼0.01152.11 ▼8.77117.23 ▲12.75
Backgrounds /wp-admin/edit.php?post_type=background1,6834.49103.1967.18
Add New /wp-admin/post-new.php?post_type=background6,6584.84124.96132.44

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstall script ran successfully

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=background
    • > Notice in wp-content/plugins/addfunc-backgrounds/metaboxes.php+1165
    Undefined variable: fieldcss

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
Almost there! Just fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/addfunc-backgrounds/metaboxes.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/addfunc-backgrounds/addfunc-backgrounds.php:24

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following browser errors
    • > GET request to /wp-admin/edit.php?post_type=background
    • > Javascript (severe) in unknown
    /wp-admin/edit.php?post_type=background 968:4 Uncaught TypeError: $ is not a function
    • > GET request to /wp-admin/edit.php?post_type=background
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1 1:31592 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/addfunc-backgrounds/js/addfunc-backgrounds-admin.js?ver=1637344151:4:22)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1:2:30340)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=background
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1 1:31702 Uncaught TypeError: $(...).live is not a function
    • > GET request to /wp-admin/post-new.php?post_type=background
    • > Javascript (severe) in unknown
    /wp-admin/post-new.php?post_type=background 2221:4 Uncaught TypeError: $ is not a function
    • > GET request to /wp-admin/post-new.php?post_type=background
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1 1:31592 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/addfunc-backgrounds/js/addfunc-backgrounds-admin.js?ver=1637344153:4:22)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.8.1:2:30340)" undefined

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
6 plugin tags: backgrounds, fixed background, parallax background, multi-layer background, video background...

addfunc-backgrounds/addfunc-backgrounds.php Passed 13 tests

The principal PHP file in "AddFunc Backgrounds" v. 0.10 is loaded by WordPress automatically on each request
89 characters long description:
Create Backgrounds and choose them from a dropdown on any Post, Page or custom post type.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin3,193 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP342621,930
CSS27969986
JavaScript3228277

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.75
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions22
▷ Named functions22100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.07MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
css/jquery.minicolors.png67.02KB34.31KB▼ 48.80%