68% post-snippets

Code Review | Post Snippets

WordPress plugin Post Snippets scored 68% from 54 tests.

About plugin

  • Plugin page: post-snippets
  • Plugin version: 3.1.7
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-5.9.1
  • WordPress version: 5.9.2
  • First release: Mar 23, 2009
  • Latest release: Mar 3, 2022
  • Number of updates: 449
  • Update frequency: every 10.5 days
  • Top authors: artstorm (79.51%)wpexpertsio (13.14%)davdebcom (4.45%)GreenTreeLabs (3.56%)

Code review

54 tests

User reviews

84 reviews

Install metrics

30,000+ active / 546,575 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲4.24MB] [CPU: ▼275.90ms] Passed 4 tests

Server-side resources used by Post Snippets
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /8.38 ▲4.8774.43 ▲17.65
Dashboard /wp-admin8.40 ▲5.0062.90 ▼8.44
Posts /wp-admin/edit.php8.40 ▲4.7688.92 ▲52.86
Add New Post /wp-admin/post-new.php9.30 ▲2.3394.64 ▼1,123.55
Media Library /wp-admin/upload.php8.40 ▲5.1153.69 ▲10.75
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.4048.80

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 301 new files
Database: no new tables, 4 new options
New WordPress options
fs_accounts
fs_active_plugins
fs_gdpr
fs_debug_mode

Browser metrics Passed 4 tests

This is an overview of browser requirements for Post Snippets
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,022 ▲26816.79 ▲1.116.04 ▼0.412.13 ▼0.44
Dashboard /wp-admin3,121 ▲2607.62 ▲1.45130.16 ▼2.88188.93 ▲24.93
Posts /wp-admin/edit.php2,935 ▲2474.16 ▲0.9382.91 ▲17.85173.87 ▼9.78
Add New Post /wp-admin/post-new.php1,955 ▲28724.74 ▲6.05484.23 ▲84.85148.64 ▼17.50
Media Library /wp-admin/upload.php1,932 ▲2346.86 ▲1.33135.82 ▼2.40213.63 ▲26.78
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,6473.7084.50135.42

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/post-snippets/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • The uninstall procedure has failed, leaving 4 options in the database
    • fs_active_plugins
    • fs_debug_mode
    • fs_gdpr
    • fs_accounts

Smoke tests 50% 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)
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/post-snippets/views/admin_news.php
    • > /wp-content/plugins/post-snippets/views/jquery_ui_dialog_head.php
  • 17× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/post-snippets/views/help/advanced.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/post-snippets/views/help/php.php:4
    • > PHP Notice
      Undefined variable: plugins in wp-content/plugins/post-snippets/views/admin_news.php on line 31
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/post-snippets/views/jquery_ui_dialog_footer.php:11
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/post-snippets/views/admin_news.php on line 31
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/post-snippets/views/help/usage.php:1
    • > PHP Notice
      Undefined variable: snippetStack in wp-content/plugins/post-snippets/views/jquery_ui_dialog_head.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/post-snippets/views/help/post.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/post-snippets/views/admin_options.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/post-snippets/views/help/filters.php:1

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
9 plugin tags: snippet, block, snippets, blocks, shortcodes...

post-snippets/post-snippets.php Passed 13 tests

The main PHP script in "Post Snippets" version 3.1.7 is automatically included on every request by WordPress
132 characters long description:
Create a library of reusable content and insert it into your posts and pages. Navigate to "Settings > Post Snippets" to get started.

Code Analysis 97% from 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 plugin53,698 lines of code in 220 files:
LanguageFilesBlank linesComment linesLines of code
PHP1297,61216,73332,494
JavaScript549919318,480
PO File145506821,826
CSS175648566
Markdown1680214
SVG31180
JSON10027
Sass11111

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
These items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity80.98
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity4.62
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes53
▷ Abstract classes23.77%
▷ Concrete classes5196.23%
▷ Final classes00.00%
Methods1,199
▷ Static methods18115.10%
▷ Public methods84270.23%
▷ Protected methods171.42%
▷ Private methods34028.36%
Functions100
▷ Named functions9898.00%
▷ Anonymous functions22.00%
Constants139
▷ Global constants10676.26%
▷ Class constants3323.74%
▷ Public constants33100.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
16 PNG files occupy 0.95MB with 0.44MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
repo/icon-128x128.png11.52KB6.35KB▼ 44.86%
assets/img/ContactSlider.png6.44KB3.80KB▼ 41.06%
assets/img/ProductDisclaimer.png6.96KB4.08KB▼ 41.34%
assets/img/WholesaleForWoocommerce.png23.92KB8.85KB▼ 63.02%