83% urvanov-syntax-highlighter

Code Review | Urvanov Syntax Highlighter

WordPress plugin Urvanov Syntax Highlighter scored83%from 54 tests.

About plugin

  • Plugin page: urvanov-syntax-hi...
  • Plugin version: 2.8.34
  • PHP version: 7.4.16
  • WordPress compatibility: 6.3-6.3
  • WordPress version: 6.3.1
  • First release: Nov 23, 2019
  • Latest release: Oct 21, 2023
  • Number of updates: 69
  • Update frequency: every 20.8 days
  • Top authors: urvanov (100%)

Code review

54 tests

User reviews

16 reviews

Install metrics

3,000+ active /39,850 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.47MB] [CPU: ▼18.59ms] Passed 4 tests

This is a short check of server-side resources used by Urvanov Syntax Highlighter
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.87 ▲0.4152.70 ▲13.22
Dashboard /wp-admin3.52 ▲0.2245.06 ▼4.97
Posts /wp-admin/edit.php3.58 ▲0.2250.09 ▲1.23
Add New Post /wp-admin/post-new.php3.33 ▼2.5635.75 ▼71.56
Media Library /wp-admin/upload.php3.45 ▲0.2237.34 ▲0.96
Crayon /wp-admin/options-general.php?page=urvanov_syntax_highlighter_settings4.1587.70

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 586 new files
Database: no new tables, 9 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
urvanov_syntax_highlighter_posts
can_compress_scripts
widget_recent-comments
db_upgraded
widget_theysaidso_widget
urvanov_syntax_highlighter_options
urvanov_syntax_highlighter_legacy_posts

Browser metrics Passed 4 tests

Urvanov Syntax Highlighter: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,904 ▲14313.52 ▼0.768.90 ▲7.3635.87 ▼5.92
Dashboard /wp-admin2,199 ▲195.55 ▼0.1480.31 ▼8.0837.49 ▼1.44
Posts /wp-admin/edit.php2,101 ▲12.02 ▲0.0439.85 ▲3.0834.16 ▼1.61
Add New Post /wp-admin/post-new.php6,250 ▲4,71520.65 ▲2.31969.99 ▲319.5138.14 ▼32.87
Media Library /wp-admin/upload.php1,404 ▲44.21 ▲0.1194.22 ▼15.0941.32 ▼3.13
Crayon /wp-admin/options-general.php?page=urvanov_syntax_highlighter_settings2,7052.8570.1477.20

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • db_upgraded
    • can_compress_scripts
    • urvanov_syntax_highlighter_legacy_posts
    • widget_recent-posts
    • widget_theysaidso_widget
    • urvanov_syntax_highlighter_posts
    • theysaidso_admin_options
    • widget_recent-comments
    • urvanov_syntax_highlighter_options

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
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      require_once(): Failed opening required 'URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATHclass-urvanov-syntax-highlighter-settings.php' (include_path='.:/usr/share/php') in wp-content/plugins/urvanov-syntax-highlighter/util/tag-editor/class-urvanov-syntax-highlighter-tag-editor-wp.php on line 3
    • > PHP Warning
      Use of undefined constant URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATH - assumed 'URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/urvanov-syntax-highlighter/util/tag-editor/class-urvanov-syntax-highlighter-tag-editor-wp.php on line 3
    • > PHP Warning
      require_once(URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATHclass-urvanov-syntax-highlighter-settings.php): failed to open stream: No such file or directory in wp-content/plugins/urvanov-syntax-highlighter/util/tag-editor/class-urvanov-syntax-highlighter-tag-editor-wp.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATHclass-urvanov-syntax-highlighter-settings.php' (include_path='.:/usr/share/php') in wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-log.php on line 2
    • > PHP Warning
      Use of undefined constant URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATH - assumed 'URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-log.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php:1393
    • > PHP Warning
      require_once(URVANOV_SYNTAX_HIGHLIGHTER_ROOT_PATHclass-urvanov-syntax-highlighter-settings.php): failed to open stream: No such file or directory in wp-content/plugins/urvanov-syntax-highlighter/util/class-urvanov-syntax-highlighter-log.php on line 2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Classic theme.), #2 (Twilight theme.), #3 (Mixed Language Highlighting.), #4 (Tag Editor.), #5 (Theme Editor.)
The official readme.txt might help

urvanov-syntax-highlighter/class-urvanov-syntax-highlighter-plugin.php 92% from 13 tests

The main PHP script in "Urvanov Syntax Highlighter" version 2.8.34 is automatically included on every request by WordPress
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("urvanov-syntax-highlighter.php" instead of "class-urvanov-syntax-highlighter-plugin.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
Good job! No executable or dangerous file extensions detected40,574 lines of code in 148 files:
LanguageFilesBlank linesComment linesLines of code
PO File225,0338,88111,444
CSS8331751711,359
JavaScript171,2547888,562
PHP169481,0076,561
SVG8012,452
Markdown2850196

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity30.08
▷ Minimum class complexity1.00
▷ Maximum class complexity176.00
Average method complexity3.36
▷ Minimum method complexity1.00
▷ Maximum method complexity92.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes37
▷ Abstract classes00.00%
▷ Concrete classes37100.00%
▷ Final classes00.00%
Methods456
▷ Static methods28362.06%
▷ Public methods42593.20%
▷ Protected methods00.00%
▷ Private methods316.80%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants242
▷ Global constants8133.47%
▷ Class constants16166.53%
▷ Public constants161100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
41 PNG files occupy 0.52MB with 0.26MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/urvanov_syntax_highlighter_tinymce.png2.18KB1.00KB▼ 54.05%
js/jquery-colorpicker/images/map-pointer.png0.34KB0.25KB▼ 26.45%
screenshots/screenshot-3.png90.40KB31.87KB▼ 64.75%
js/jquery-colorpicker/images/bar-pointer.png0.19KB0.13KB▼ 34.34%
screenshots/screenshot-5.png72.91KB21.63KB▼ 70.33%