72% prism-detached

Code Review | Prism Syntax Highlighter (detached)

WordPress plugin Prism Syntax Highlighter (detached) scored72%from 54 tests.

About plugin

  • Plugin page: prism-detached
  • Plugin version: 1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-3.5.2
  • WordPress version: 6.3.1
  • First release: Sep 4, 2012
  • Latest release: Jul 30, 2013
  • Number of updates: 32
  • Update frequency: every 11.7 days
  • Top authors: apfelbox (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

10+ active /2,486 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: ▲0.09MB] [CPU: ▲0.03ms] Passed 4 tests

Server-side resources used by Prism Syntax Highlighter (detached)
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2151.42 ▲13.76
Dashboard /wp-admin3.43 ▲0.0852.62 ▲0.23
Posts /wp-admin/edit.php3.54 ▲0.1451.34 ▼2.19
Add New Post /wp-admin/post-new.php6.01 ▲0.0884.97 ▼5.42
Media Library /wp-admin/upload.php3.35 ▲0.0842.60 ▲7.49
Prism Detached /wp-admin/options-general.php?page=prism-detached3.3533.74

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 62 new files
Database: no new tables, 7 new options
New WordPress options
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
prism_detached_cache_keys
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Prism Syntax Highlighter (detached)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,822 ▲3614.49 ▼0.153.52 ▲1.5745.21 ▲1.54
Dashboard /wp-admin2,193 ▲135.55 ▼0.1087.41 ▼2.2342.55 ▼3.27
Posts /wp-admin/edit.php2,101 ▲42.02 ▲0.0834.80 ▼4.9135.04 ▼5.46
Add New Post /wp-admin/post-new.php1,529 ▲323.09 ▲0.06673.56 ▲48.3858.33 ▲5.03
Media Library /wp-admin/upload.php1,407 ▲74.13 ▼0.08110.00 ▲7.1547.79 ▲2.04
Prism Detached /wp-admin/options-general.php?page=prism-detached9121.9921.4726.98

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=prism-detached
    • > Notice in wp-content/plugins/prism-detached/templates/admin_settings.php+19
    Undefined variable: pageUrl
    • > GET request to /wp-admin/options-general.php?page=prism-detached
    • > Notice in wp-content/plugins/prism-detached/templates/admin_settings.php+28
    Undefined variable: invisibles
    • > GET request to /wp-admin/options-general.php?page=prism-detached
    • > Notice in wp-content/plugins/prism-detached/templates/admin_settings.php+37
    Undefined variable: autolinker

SRP 0% 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 items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/prism-detached/templates/admin_settings.php
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: autolinker in wp-content/plugins/prism-detached/templates/admin_settings.php on line 37
    • > PHP Fatal error
      Uncaught Error: Class 'Prism_Detached_Extension_Base' not found in wp-content/plugins/prism-detached/vendor/extensions/Prism_LineHighlight/Prism_Detached_Extension_Prism_LineHighlight.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/prism-detached/lib/Prism/Detached/Settings.php:60
    • > PHP Notice
      Undefined variable: pageUrl in wp-content/plugins/prism-detached/templates/admin_settings.php on line 19
    • > PHP Notice
      Undefined variable: invisibles in wp-content/plugins/prism-detached/templates/admin_settings.php on line 28
    • > PHP Fatal error
      Uncaught Error: Class 'Prism_Detached_Extension_Base' not found in wp-content/plugins/prism-detached/vendor/extensions/Prism_FileHighlight/Prism_Detached_Extension_Prism_FileHighlight.php:7
    • > PHP Notice
      Undefined variable: availableThemes in wp-content/plugins/prism-detached/templates/admin_settings.php on line 47
    • > PHP Fatal error
      Uncaught Error: Class 'Prism_Detached_AssetsLoader_Base' not found in wp-content/plugins/prism-detached/lib/Prism/Detached/AssetsLoader/Default.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Prism_Detached_Extension_Base' not found in wp-content/plugins/prism-detached/vendor/extensions/Prism_IE8/Prism_Detached_Extension_Prism_IE8.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Prism_Detached_Extension_Base' not found in wp-content/plugins/prism-detached/vendor/extensions/Prism_WebPlatformDocs/Prism_Detached_Extension_Prism_WebPlatformDocs.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need your attention:
  • Plugin Name: You should set the name of your plugin on the first line ( === prism-detached === )
  • Screenshots: Add images for these screenshots: #1 (Add the code as custom field and reference it in the rich text editor via shortcode.), #2 (Code highlighting in the frontend), #3 (You can also specify some lines, which should be marked), #4 (Code highlighting with marked lines in the frontend), #5 (Plugin options screen)
The official readme.txt might help

prism-detached/Prism_Detached.php 92% from 13 tests

The main PHP file in "Prism Syntax Highlighter (detached)" ver. 1.5 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("prism-detached.php" instead of "Prism_Detached.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin1,990 lines of code in 55 files:
LanguageFilesBlank linesComment linesLines of code
PHP18465781929
CSS2212146629
JavaScript1411939363
Markdown150069

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity4.35
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.52
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes17
▷ Abstract classes211.76%
▷ Concrete classes1588.24%
▷ Final classes00.00%
Methods112
▷ Static methods10.89%
▷ Public methods9282.14%
▷ Protected methods00.00%
▷ Private methods2017.86%
Functions3
▷ Named functions00.00%
▷ Anonymous functions3100.00%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.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
5 PNG files occupy 0.44MB with 0.31MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png106.33KB30.88KB▼ 70.95%
screenshot-3.png38.42KB13.76KB▼ 64.19%
screenshot-5.png73.63KB20.49KB▼ 72.17%
screenshot-4.png127.80KB33.07KB▼ 74.12%
screenshot-1.png104.29KB33.29KB▼ 68.08%