72% fontsampler

Code Review | Fontsampler

WordPress plugin Fontsampler scored72%from 54 tests.

About plugin

  • Plugin page: fontsampler
  • Plugin version: 0.4.14
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.7
  • WordPress version: 6.3.1
  • First release: Nov 18, 2016
  • Latest release: Mar 28, 2021
  • Number of updates: 62
  • Update frequency: every 25.6 days
  • Top authors: kontur (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

800+ active /10,095 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲1.48MB] [CPU: ▲5.21ms] Passed 4 tests

Server-side resources used by Fontsampler
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.98 ▲1.5154.56 ▲17.54
Dashboard /wp-admin4.81 ▲1.5159.38 ▲7.62
Posts /wp-admin/edit.php4.86 ▲1.5165.63 ▲8.77
Add New Post /wp-admin/post-new.php7.33 ▲1.4599.47 ▼4.03
Media Library /wp-admin/upload.php4.67 ▲1.4450.92 ▲8.46
Settings /wp-admin/admin.php?page=fontsampler-settings4.5541.03
New Fontsampler /wp-admin/admin.php?page=fontsampler-new4.5540.26
All Fontsamplers /wp-admin/admin.php?page=fontsampler4.5538.05

Server storage [IO: ▲3.64MB] [DB: ▲0.01MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 458 new files
Database: 4 new tables, 10 new options
New tables
wp_fontsampler_settings
wp_fontsampler_sets
wp_fontsampler_sets_x_fonts
wp_fontsampler_fonts
New WordPress options
theysaidso_admin_options
fontsampler_hide_legacy_formats
widget_theysaidso_widget
db_upgraded
widget_recent-comments
can_compress_scripts
fontsampler_proxy_urls
widget_recent-posts
fontsampler_db_version
fontsampler_last_changelog

Browser metrics Passed 4 tests

Checking browser requirements for Fontsampler
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,839 ▲9313.21 ▼1.161.65 ▼0.2941.54 ▼4.00
Dashboard /wp-admin2,245 ▲574.88 ▼1.20109.02 ▼1.0837.03 ▼7.44
Posts /wp-admin/edit.php2,131 ▲392.06 ▲0.0439.89 ▼7.5035.99 ▼3.67
Add New Post /wp-admin/post-new.php1,547 ▲1217.72 ▼5.75696.49 ▼0.5752.43 ▼5.36
Media Library /wp-admin/upload.php1,430 ▲424.25 ▲0.1497.50 ▼18.9842.97 ▼5.78
Settings /wp-admin/admin.php?page=fontsampler-settings4,5956.30171.56127.75
New Fontsampler /wp-admin/admin.php?page=fontsampler-new5,5535.40164.68139.37
All Fontsamplers /wp-admin/admin.php?page=fontsampler1,1123.8356.0467.18

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • fontsampler_proxy_urls
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=fontsampler
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=fontsampler-settings
    • > Notice in wp-content/plugins/fontsampler/vendor/oyejorge/less.php/lib/Less/Parser.php+1927
    Trying to access array offset on value of type null

SRP 0% 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
The following issues need your attention
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/fontsampler/fontsampler.php
    • > /wp-content/plugins/fontsampler/includes/interface.php
  • 196× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\TestExpression' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/Node/Expression/Test/EvenTest.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Less_Tree' not found in wp-content/plugins/fontsampler/vendor/oyejorge/less.php/lib/Less/Tree/Url.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\\TokenParser\\AbstractTokenParser' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/TokenParser/AutoEscapeTokenParser.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\AbstractExpression' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/Node/CheckToStringNode.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\ode' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/Node/MacroNode.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\ode' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/Node/CheckSecurityNode.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\ode' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/Node/TextNode.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\\Error\\Error' not found in wp-content/plugins/fontsampler/vendor/twig/twig/src/Error/RuntimeError.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Less_Tree' not found in wp-content/plugins/fontsampler/vendor/oyejorge/less.php/lib/Less/Tree/Element.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Less_Tree' not found in wp-content/plugins/fontsampler/vendor/oyejorge/less.php/lib/Less/Tree/Javascript.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Plugin Name: Please specify the plugin name on the first line ( === fontsampler === )
You can look at the official readme.txt

fontsampler/fontsampler.php 92% from 13 tests

The primary PHP file in "Fontsampler" version 0.4.14 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 150 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin51,343 lines of code in 371 files:
LanguageFilesBlank linesComment linesLines of code
PHP2745,7326,74043,883
LESS15322861,803
Twig37134121,519
CSS4561,434
JavaScript133444471,184
JSON600528
Markdown51130293
HTML1521255
SVG8010183
YAML24533151
PO File4405256
Bourne Shell16143
reStructuredText18511

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity14.79
▷ Minimum class complexity1.00
▷ Maximum class complexity441.00
Average method complexity3.13
▷ Minimum method complexity1.00
▷ Maximum method complexity44.00
Code structure
Namespaces26
Interfaces11
Traits0
Classes238
▷ Abstract classes125.04%
▷ Concrete classes22694.96%
▷ Final classes5825.66%
Methods1,570
▷ Static methods1288.15%
▷ Public methods1,32384.27%
▷ Protected methods684.33%
▷ Private methods17911.40%
Functions147
▷ Named functions11980.95%
▷ Anonymous functions2819.05%
Constants67
▷ Global constants710.45%
▷ Class constants6089.55%
▷ Public constants60100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
6 PNG files occupy 0.07MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
supporter-logos/james-puckett-logo.png6.92KB3.91KB▼ 43.46%
supporter-logos/liberty-type-logo.png30.05KB5.60KB▼ 81.36%
supporter-logos/paulo-goode-logo.png24.33KB24.34KB0.00%
supporter-logos/canada-type-logo.png4.01KB1.44KB▼ 64.12%
supporter-logos/underscore-type-logo.png6.36KB3.11KB▼ 51.14%