10% wp-syntaxhighlighter

Code Review | WP SyntaxHighlighter

WordPress plugin WP SyntaxHighlighter scored10%from 54 tests.

About plugin

  • Plugin page: wp-syntaxhighlighter
  • Plugin version: 1.7.3
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-3.3.1
  • WordPress version: 6.3.1
  • First release: May 2, 2011
  • Latest release: Feb 29, 2012
  • Number of updates: 269
  • Update frequency: every 1.1 days
  • Top authors: redcocker (100%)

Code review

54 tests

User reviews

1 review

Install metrics

600+ active /48,837 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Notice in wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php+478
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.05MB] [CPU: ▼3.30ms] Passed 4 tests

Analyzing server-side resources used by WP SyntaxHighlighter
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0639.55 ▼1.84
Dashboard /wp-admin3.35 ▲0.0543.82 ▼9.42
Posts /wp-admin/edit.php3.40 ▲0.0546.13 ▲0.10
Add New Post /wp-admin/post-new.php5.94 ▲0.0594.94 ▼2.05
Media Library /wp-admin/upload.php3.27 ▲0.0535.15 ▲2.35
WP SyntaxHighlighter /wp-admin/options-general.php?page=wp-syntaxhighlighter-options3.2228.50

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 180 new files
Database: no new tables, 25 new options
New WordPress options
wp_sh_comment_hl_description_before
recovery_mode_email_last_sent
db_upgraded
wp_sh_language3
wp_sh_updated
wp_sh_addl_style
wp_sh_bbpress_hl_stylesheet
can_compress_scripts
wp_sh_collapse_lable_text
wp_sh_version
...

Browser metrics Passed 4 tests

A check of browser resources used by WP SyntaxHighlighter
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,821 ▲6413.33 ▼1.051.70 ▼0.3543.94 ▼12.65
Dashboard /wp-admin2,218 ▲305.84 ▲0.93104.96 ▼12.4740.08 ▼3.07
Posts /wp-admin/edit.php2,103 ▲172.01 ▲0.0140.38 ▲4.3037.20 ▲2.54
Add New Post /wp-admin/post-new.php1,748 ▲23423.08 ▲5.27578.11 ▼112.2056.00 ▲5.01
Media Library /wp-admin/upload.php1,403 ▲154.18 ▼0.0396.44 ▼1.0042.19 ▼3.33
WP SyntaxHighlighter /wp-admin/options-general.php?page=wp-syntaxhighlighter-options2,3951.566.3938.64

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
Please fix the following items
  • Zombie WordPress options were found after uninstall: 7 options
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/options-general.php?page=wp-syntaxhighlighter-options
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=wp-syntaxhighlighter-options
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=wp-syntaxhighlighter-options
    • > Error in wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter-admin.php+715
    Uncaught Error: Call to undefined function mysql_get_server_info() in wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter-admin.php:715
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): wp_sh_options_panel()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin.php(259): do_action()
    #4 wp-admin/options-general.php(10): require_once('/var/www/wordpr...')
    #5 {main}
    thrown

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
The following issues need your attention
  • 81× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined index: codebox in wp-content/plugins/wp-syntaxhighlighter/get-updated-settings.php on line 119
    • > PHP Notice
      Undefined index: lib_version in wp-content/plugins/wp-syntaxhighlighter/get-updated-settings.php on line 55
    • > PHP Notice
      Undefined index: wiget_shorcode in wp-content/plugins/wp-syntaxhighlighter/get-updated-settings.php on line 178
    • > PHP Fatal error
      Uncaught Error: Call to undefined function bbp_is_anonymous() in wp-content/plugins/wp-syntaxhighlighter/bbpress-highlight-button.php:15
    • > PHP Notice
      Undefined index: button_row in wp-content/plugins/wp-syntaxhighlighter/get-updated-settings.php on line 125
    • > PHP Notice
      Undefined index: css in wp-content/plugins/wp-syntaxhighlighter/get-updated-settings.php on line 109
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/wp-syntaxhighlighter/sh-pre-quicktag.php:11
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/wp-syntaxhighlighter/bbpress-highlight-button.php on line 11
    • > PHP Notice
      Undefined index: quick_code in wp-content/plugins/wp-syntaxhighlighter/get-updated-settings.php on line 66
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php:38

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)
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% 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
Attributes that require attention:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (This is a highlighted code.), #2 (This is a highlighted code in comments and buttons added to the form.), #3 (This is a highlighted code in bbPress and buttons added to the form), #4 (This is setting panel.), #5 (This is "SH TinyMCE" button.), #6 (This is pop up window at the click of "pre" button.), #7 (This is pop up window at the click of "CODE" button.), #8 (This is "SH pre" button.), #9 (This is pop up window at the click of "SH pre" button.)
  • Tags: There are too many tags (12 tag instead of maximum 10)
The official readme.txt is a good inspiration

wp-syntaxhighlighter/wp-syntaxhighlighter.php 85% from 13 tests

The main PHP file in "WP SyntaxHighlighter" ver. 1.7.3 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Text Domain: The text domain name must use dashes instead of underscores, and it must be lowercase
  • Description: Please don't use more than 140 characters for the plugin description (currently 276 characters long)

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 detected13,552 lines of code in 135 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript851,1742,7665,471
CSS282516274,509
PHP192493803,111
PO File2180209394
Markdown134067

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.64
Average class complexity11.00
▷ Minimum class complexity11.00
▷ Maximum class complexity11.00
Average method complexity3.50
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions85
▷ Named functions85100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
7 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
sh-tinymce-button-ins/shtb_img.png2.88KB0.23KB▼ 92.08%
sh-tinymce-button-box/shtb_img.png2.83KB0.19KB▼ 93.37%
syntaxhighlighter2/styles/printer.png0.71KB0.77KB0.00%
syntaxhighlighter2/styles/help.png0.77KB0.82KB0.00%
syntaxhighlighter2/styles/magnifier.png0.60KB0.60KB0.00%