83% insert-headers-and-footers-script

Code Review | Insert Headers and Footers Code - HT Script

WordPress plugin Insert Headers and Footers Code - HT Script scored 83% from 54 tests.

About plugin

  • Plugin page: insert-headers-an...
  • Plugin version: 1.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jun 17, 2019
  • Latest release: Aug 1, 2023
  • Number of updates: 27
  • Update frequency: every 55.8 days
  • Top authors: htplugins (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

9,000+ active / 51,240 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▼2.34ms] 75% from 4 tests

A check of server-side resources used by Insert Headers and Footers Code - HT Script
Please take the time to fix the following items
  • CPU: Total CPU usage must kept under 500.00ms (currently 1,780.12ms on /wp-admin/edit.php?post_type=ihafs_script&page=ihafs_extensions)
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0538.88 ▼3.81
Dashboard /wp-admin3.49 ▲0.1847.66 ▲0.08
Posts /wp-admin/edit.php3.53 ▲0.1745.66 ▲1.99
Add New Post /wp-admin/post-new.php6.03 ▲0.1586.52 ▼7.62
Media Library /wp-admin/upload.php3.43 ▲0.2038.35 ▲3.82
Recommendations /wp-admin/edit.php?post_type=ihafs_script&page=ihafs_extensions7.711,780.12
All Scripts /wp-admin/edit.php?post_type=ihafs_script3.4639.14
Add New Script /wp-admin/post-new.php?post_type=ihafs_script3.8852.24

Server storage [IO: ▲1.11MB] [DB: ▲0.69MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 143 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Insert Headers and Footers Code - HT Script
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,872 ▲13713.68 ▼1.131.74 ▼0.4345.10 ▼5.18
Dashboard /wp-admin2,278 ▲905.31 ▲0.31105.10 ▼13.1138.74 ▼2.64
Posts /wp-admin/edit.php2,160 ▲712.39 ▲0.3945.10 ▲9.1632.25 ▼6.25
Add New Post /wp-admin/post-new.php1,576 ▲3423.37 ▲5.01679.22 ▲49.4837.69 ▼23.01
Media Library /wp-admin/upload.php1,451 ▲604.57 ▲0.3498.90 ▼3.7741.88 ▼2.64
Recommendations /wp-admin/edit.php?post_type=ihafs_script&page=ihafs_extensions2,9182.4640.4080.78
All Scripts /wp-admin/edit.php?post_type=ihafs_script1,1322.5235.8627.43
Add New Script /wp-admin/post-new.php?post_type=ihafs_script1,9495.3787.3844.78

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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
Please fix the following
  • 45× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Multi_Base' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/types/CMB2_Type_Taxonomy_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/types/CMB2_Type_Checkbox.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup_Base' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/rest-api/CMB2_REST.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/insert-headers-and-footers-script/admin/functions.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup_Base' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/CMB2_Hookup.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/types/CMB2_Type_Oembed.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Textarea' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/types/CMB2_Type_Textarea_Code.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/insert-headers-and-footers-script/init.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/helper-functions.php:131
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/insert-headers-and-footers-script/admin/cmb2/includes/types/CMB2_Type_Colorpicker.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: inject code, google analytics, inject html, inject javascript, facebook pixel

insert-headers-and-footers-script/init.php 85% from 13 tests

Analyzing the main PHP file in "Insert Headers and Footers Code - HT Script" version 1.1.1
You should first fix the following items:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("insert-headers-and-footers-script.php" instead of "init.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin15,242 lines of code in 101 files:
LanguageFilesBlank linesComment linesLines of code
PHP632,2566,2707,719
CSS132501,1904,593
JavaScript93946081,551
Sass16300251,379

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity19.75
▷ Minimum class complexity1.00
▷ Maximum class complexity188.00
Average method complexity3.36
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes69
▷ Abstract classes913.04%
▷ Concrete classes6086.96%
▷ Final classes00.00%
Methods552
▷ Static methods9216.67%
▷ Public methods46083.33%
▷ Protected methods8916.12%
▷ Private methods30.54%
Functions36
▷ Named functions3597.22%
▷ Anonymous functions12.78%
Constants11
▷ Global constants545.45%
▷ Class constants654.55%
▷ Public constants6100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
32 PNG files occupy 0.15MB with 0.09MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
(invalid) admin/recommended-plugins/assets/images/extensions/ht-menu.png2.85KB0.00KB▼ 100.00%
admin/recommended-plugins/assets/images/extensions/multicurrencypro.png19.01KB9.36KB▼ 50.77%
admin/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
(invalid) admin/recommended-plugins/assets/images/extensions/ht-click-to-call.png1.70KB0.00KB▼ 100.00%