84% custom-fonts

Code Review | Custom Fonts - Host Your Fonts Locally

WordPress plugin Custom Fonts - Host Your Fonts Locally scored84%from 54 tests.

About plugin

  • Plugin page: custom-fonts
  • Plugin version: 2.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4
  • WordPress version: 6.3.1
  • First release: Aug 12, 2017
  • Latest release: Nov 24, 2023
  • Number of updates: 46
  • Update frequency: every 49.9 days
  • Top authors: brainstormworg (63.04%)Nikschavan (36.96%)patilvikasj (4.35%)

Code review

54 tests

User reviews

48 reviews

Install metrics

300,000+ active /3,238,425 total downloads

Benchmarks

Plugin footprint 82% 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.61MB] [CPU: ▼0.01ms] 75% from 4 tests

Analyzing server-side resources used by Custom Fonts - Host Your Fonts Locally
Please take the time to fix the following items
  • RAM: Try to keep total memory usage under 10MB (currently 10.26MB on /wp-admin/themes.php?page=bsf-custom-fonts)
PageMemory (MB)CPU Time (ms)
Home /3.89 ▲0.4249.72 ▲7.12
Dashboard /wp-admin4.00 ▲0.6554.52 ▼9.04
Posts /wp-admin/edit.php4.05 ▲0.6957.57 ▲8.33
Add New Post /wp-admin/post-new.php6.64 ▲0.7492.68 ▼2.16
Media Library /wp-admin/upload.php3.90 ▲0.6741.88 ▲4.04
Custom Fonts /wp-admin/themes.php?page=bsf-custom-fonts10.2674.77

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 71 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
widget_recent-comments
theysaidso_admin_options
_custom_fonts_db_version
can_compress_scripts
widget_recent-posts
bcf_custom_fonts_2_0_2_migration
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Custom Fonts - Host Your Fonts Locally
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,935 ▲18814.44 ▲0.171.56 ▼0.1838.96 ▼5.74
Dashboard /wp-admin2,340 ▲1656.16 ▲0.47120.53 ▲16.1241.68 ▼3.00
Posts /wp-admin/edit.php2,274 ▲1743.41 ▲1.3955.12 ▲14.7435.05 ▼0.90
Add New Post /wp-admin/post-new.php1,535 ▲923.27 ▲0.22574.65 ▼45.5632.92 ▼15.02
Media Library /wp-admin/upload.php1,402 ▲24.21 ▲0.1383.72 ▼24.5242.23 ▼2.60
Custom Fonts /wp-admin/themes.php?page=bsf-custom-fonts1,1408.99194.1349.31

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The uninstall procedure has failed, leaving 8 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • _custom_fonts_db_version
    • widget_recent-posts
    • bcf_custom_fonts_2_0_2_migration
    • db_upgraded

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

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
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      require_once(): Failed opening required 'BSF_CUSTOM_FONTS_DIRincludes/plugin-update/class-custom-fonts-update.php' (include_path='.:/usr/share/php') in wp-content/plugins/custom-fonts/classes/class-bsf-custom-fonts.php on line 56
    • > PHP Warning
      Use of undefined constant BSF_CUSTOM_FONTS_DIR - assumed 'BSF_CUSTOM_FONTS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-fonts/classes/class-bsf-custom-fonts.php on line 56
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-fonts/classes/class-bsf-custom-fonts-white-label.php:56
    • > PHP Warning
      require_once(BSF_CUSTOM_FONTS_DIRincludes/plugin-update/class-custom-fonts-update.php): failed to open stream: No such file or directory in wp-content/plugins/custom-fonts/classes/class-bsf-custom-fonts.php on line 56

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 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
9 plugin tags: performance, full site editing, custom fonts, typography, privacy...

custom-fonts/custom-fonts.php 92% from 13 tests

"Custom Fonts - Host Your Fonts Locally" version 2.1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 295 characters long)

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 plugin52,384 lines of code in 69 files:
LanguageFilesBlank linesComment linesLines of code
JSON31026,826
PHP237601,95119,604
JavaScript34321993,426
CSS82672262,201
Sass1190327

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity21.89
▷ Minimum class complexity2.00
▷ Maximum class complexity89.00
Average method complexity3.12
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes00.00%
▷ Concrete classes18100.00%
▷ Final classes211.11%
Methods171
▷ Static methods4023.39%
▷ Public methods14081.87%
▷ Protected methods105.85%
▷ Private methods2112.28%
Functions17
▷ Named functions1270.59%
▷ Anonymous functions529.41%
Constants13
▷ Global constants13100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There are no PNG files in this plugin