57% post-snippets

Code Review | Post Snippets - Custom WordPress Code Snippets Customizer

WordPress plugin Post Snippets - Custom WordPress Code Snippets Customizer scored57%from 54 tests.

About plugin

  • Plugin page: post-snippets
  • Plugin version: 4.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 23, 2009
  • Latest release: Jul 14, 2023
  • Number of updates: 473
  • Update frequency: every 11.1 days
  • Top authors: artstorm (75.48%)wpexpertsio (17.55%)davdebcom (4.23%)GreenTreeLabs (3.38%)

Code review

54 tests

User reviews

89 reviews

Install metrics

30,000+ active /644,757 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲5.53MB] [CPU: ▲23.80ms] 75% from 4 tests

Server-side resources used by Post Snippets - Custom WordPress Code Snippets Customizer
Please have a look at the following items
  • Extra RAM: The extra memory usage should kept under 5MB (currently 5.53MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.23 ▲5.7764.53 ▲27.29
Dashboard /wp-admin9.25 ▲5.9177.76 ▲19.92
Posts /wp-admin/edit.php9.25 ▲5.9075.24 ▲26.85
Add New Post /wp-admin/post-new.php10.43 ▲4.54115.98 ▲21.12
Media Library /wp-admin/upload.php9.25 ▲6.0277.48 ▲41.98
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius9.2563.22

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 387 new files
Database: 2 new tables, 11 new options
New tables
wp_pspro_snippets
wp_pspro_groups
New WordPress options
post_snippets_version
fs_accounts
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
fs_active_plugins
db_upgraded
fs_debug_mode
widget_recent-comments
can_compress_scripts
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Post Snippets - Custom WordPress Code Snippets Customizer
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,997 ▲23613.78 ▼0.501.76 ▲0.1730.50 ▼11.05
Dashboard /wp-admin2,391 ▲2175.49 ▼0.09105.86 ▲19.0279.31 ▲37.69
Posts /wp-admin/edit.php2,316 ▲2162.88 ▲0.9052.54 ▲15.1538.29 ▲4.56
Add New Post /wp-admin/post-new.php1,916 ▲38825.86 ▲2.59735.40 ▲50.7741.89 ▼9.60
Media Library /wp-admin/upload.php1,596 ▲1935.14 ▲0.97109.30 ▲12.1896.16 ▲50.66
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,2542.5350.3130.87

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] 25% 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+8486
    Undefined property: stdClass::$plugins
  • Zombie tables were found after uninstall: 2 tables
    • wp_pspro_groups
    • wp_pspro_snippets
  • The uninstall procedure has failed, leaving 11 options in the database
    • can_compress_scripts
    • fs_accounts
    • widget_recent-comments
    • fs_active_plugins
    • theysaidso_admin_options
    • post_snippets_version
    • widget_theysaidso_widget
    • psp_db_version
    • fs_debug_mode
    • db_upgraded
    • ...

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
  • 20× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/post-snippets/views/jquery_ui_dialog_footer.php:11
    • > PHP Notice
      Undefined variable: snippets in wp-content/plugins/post-snippets/views/jquery_ui_dialog_head.php on line 61
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/post-snippets/views/help/php.php:4
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/post-snippets/views/admin_news.php on line 32
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/post-snippets/views/jquery_ui_dialog_head.php on line 12
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/post-snippets/views/jquery_ui_dialog_head.php on line 61
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/post-snippets/views/help/restapi.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 _e() in wp-content/plugins/post-snippets/views/help/advanced.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/post-snippets/views/help/post.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 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Please fix the following attributes:
  • Screenshots: Add descriptions for screenshots #10, #11, #6, #7, #8, #9 in post-snippets/assets to your readme.txt
  • Requires php: Version not formatted correctly
Please take inspiration from this readme.txt

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

The main PHP script in "Post Snippets - Custom WordPress Code Snippets Customizer" version 4.0.4 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 plugin112,840 lines of code in 291 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript5849571952,230
PHP1479,56618,19937,783
PO File267,5019,12617,048
CSS2390802,891
Sass31402782,553
Markdown1680214
SVG31180
JSON10027
XML10014

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 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity84.31
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.55
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes59
▷ Abstract classes23.39%
▷ Concrete classes5796.61%
▷ Final classes00.00%
Methods1,416
▷ Static methods25217.80%
▷ Public methods1,00570.97%
▷ Protected methods191.34%
▷ Private methods39227.68%
Functions110
▷ Named functions10797.27%
▷ Anonymous functions32.73%
Constants168
▷ Global constants10663.10%
▷ Class constants6236.90%
▷ Public constants62100.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
24 PNG files occupy 1.06MB with 0.64MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
repo/screenshot-2.png135.57KB37.84KB▼ 72.08%
repo/banner-1544x500.png50.13KB20.81KB▼ 58.48%
repo/screenshot-1.png181.14KB51.24KB▼ 71.71%
assets/img/ProductDisclaimer.png6.96KB4.08KB▼ 41.34%
assets/img/help/create-snippet-success.png8.02KB3.42KB▼ 57.31%