78% shins-pageload-magic

Code Review | A faster website! (aka defer.js)

WordPress plugin A faster website! (aka defer.js) scored78%from 54 tests.

About plugin

  • Plugin page: shins-pageload-magic
  • Plugin version: 2.6.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3.1
  • WordPress version: 6.3.1
  • First release: May 23, 2017
  • Latest release: Sep 19, 2023
  • Number of updates: 241
  • Update frequency: every 9.6 days
  • Top authors: shinsenter (100%)

Code review

54 tests

User reviews

44 reviews

Install metrics

500+ active /27,289 total downloads

Benchmarks

Plugin footprint 83% 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.83MB] [CPU: ▼5.20ms] Passed 4 tests

Server-side resources used by A faster website! (aka defer.js)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.78 ▲0.3141.63 ▼0.39
Dashboard /wp-admin4.35 ▲1.0155.16 ▼9.96
Posts /wp-admin/edit.php4.40 ▲1.0553.08 ▲2.80
Add New Post /wp-admin/post-new.php6.89 ▲1.0093.80 ▼13.26
Media Library /wp-admin/upload.php4.21 ▲0.9850.25 ▲13.80

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 161 new files
Database: no new tables, 36 new options
New WordPress options
defer-wordpress_long_copyright
defer-wordpress_ignore_lazyload_paths
defer-wordpress_polyfill_src
defer-wordpress_default_defer_time
defer-wordpress_console_copyright
defer-wordpress_fix_render_blocking
defer-wordpress_add_missing_meta_tags
defer-wordpress_offline_cache_path
widget_recent-comments
defer-wordpress_enable_dns_prefetch
...

Browser metrics Passed 4 tests

A faster website! (aka defer.js): an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,932 ▲17113.25 ▼1.434.21 ▲2.1638.53 ▼5.11
Dashboard /wp-admin2,223 ▲235.88 ▲0.04106.53 ▼11.3983.40 ▲39.48
Posts /wp-admin/edit.php2,114 ▲142.00 ▼0.0137.88 ▲1.2535.19 ▲0.96
Add New Post /wp-admin/post-new.php1,540 ▼517.51 ▼5.62740.40 ▲62.5437.43 ▼17.79
Media Library /wp-admin/upload.php1,411 ▲144.21 ▼0.07115.32 ▲12.9684.92 ▲37.88

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 35 options in the database
    • defer-wordpress_enable_preloading
    • defer-wordpress_default_defer_time
    • defer-wordpress_iframe_placeholder
    • defer-wordpress_img_placeholder
    • defer-wordpress_optimize_scripts
    • defer-wordpress_ignore_lazyload_css_selectors
    • defer-wordpress_offline_cache_ttl
    • defer-wordpress_defer_third_party
    • defer-wordpress_enable_lazyloading
    • defer-wordpress_ignore_lazyload_texts
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
Almost there! Just fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/shins-pageload-magic/public/partials/defer-wordpress-public-display.php
    • > /wp-content/plugins/shins-pageload-magic/admin/partials/update-note.php
  • 66× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php:29
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php:31
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/options-resolver/Exception/NoSuchOptionException.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\\Exception\\ParseException' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/Exception/InternalErrorException.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\SimpleCache\\CacheInterface' not found in wp-content/plugins/shins-pageload-magic/vendor/shinsenter/defer.php/src/Helpers/DeferCache.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\ode\\AbstractNode' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/Node/FunctionNode.php:26
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/Parser/Handler/StringHandler.php:32
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\CssSelector\\Exception\\ExceptionInterface' not found in wp-content/plugins/shins-pageload-magic/vendor/symfony/css-selector/Exception/ParseException.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 20 tag instead of maximum 10
The official readme.txt might help

shins-pageload-magic/shins-pageload-magic.php 92% from 13 tests

The primary PHP file in "A faster website! (aka defer.js)" version 2.6.0 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

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
Good job! No executable or dangerous file extensions detected12,093 lines of code in 145 files:
LanguageFilesBlank linesComment linesLines of code
PHP1352,2856,27011,521
JSON100480
CSS318484
JavaScript62298

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.46
Average class complexity10.70
▷ Minimum class complexity1.00
▷ Maximum class complexity153.00
Average method complexity2.74
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces25
Interfaces18
Traits1
Classes97
▷ Abstract classes22.06%
▷ Concrete classes9597.94%
▷ Final classes2829.47%
Methods634
▷ Static methods9014.20%
▷ Public methods57490.54%
▷ Protected methods152.37%
▷ Private methods457.10%
Functions66
▷ Named functions4771.21%
▷ Anonymous functions1928.79%
Constants97
▷ Global constants2424.74%
▷ Class constants7375.26%
▷ Public constants73100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 compressed PNG file occupies 0.01MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/donate.png8.45KB8.94KB0.00%