84% insert-js-or-css-in-post-via-custom-field

Code Review | Insert JS or CSS in post via Custom Field

WordPress plugin Insert JS or CSS in post via Custom Field scored84%from 54 tests.

About plugin

  • Plugin page: insert-js-or-css-...
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0-3.5.1
  • WordPress version: 6.3.1
  • First release: Apr 1, 2013
  • Latest release: Apr 1, 2013
  • Number of updates: 3
  • Update frequency: N/A
  • Top authors: fedmich (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,567 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼9.04ms] Passed 4 tests

Analyzing server-side resources used by Insert JS or CSS in post via Custom Field
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0140.50 ▼10.35
Dashboard /wp-admin3.31 ▲0.0146.70 ▼7.94
Posts /wp-admin/edit.php3.36 ▲0.0148.56 ▼6.13
Add New Post /wp-admin/post-new.php5.89 ▲0.0183.57 ▼11.73
Media Library /wp-admin/upload.php3.23 ▲0.0140.12 ▲1.97

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Insert JS or CSS in post via Custom Field
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.61 ▼0.781.66 ▼0.6445.38 ▼0.20
Dashboard /wp-admin2,209 ▲214.81 ▼0.10100.49 ▼19.7141.11 ▼1.45
Posts /wp-admin/edit.php2,086 ▼31.99 ▼0.0237.54 ▼2.4835.64 ▲3.27
Add New Post /wp-admin/post-new.php1,534 ▲2023.51 ▲5.82640.81 ▼53.9365.70 ▲10.59
Media Library /wp-admin/upload.php1,388 ▼04.26 ▲0.09102.17 ▼10.0448.97 ▲0.72

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 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options

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)
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
Almost there! Just fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/insert-js-or-css-in-post-via-custom-field/insert-js-css-custom-field-fedmich.php:38

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% 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
10 plugin tags: javascript, post, head, stylesheet, stylesheets...

insert-js-or-css-in-post-via-custom-field/insert-js-css-custom-field-fedmich.php 92% from 13 tests

The entry point to "Insert JS or CSS in post via Custom Field" version 0.1 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("insert-js-or-css-in-post-via-custom-field.php" instead of "insert-js-css-custom-field-fedmich.php")

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
No dangerous file extensions were detected24 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP16824

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.38
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%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected