84% custom-post-widget

Code Review | Content Blocks (Custom Post Widget)

WordPress plugin Content Blocks (Custom Post Widget) scored84%from 54 tests.

About plugin

  • Plugin page: custom-post-widget
  • Plugin version: 3.2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.4
  • WordPress version: 6.3.1
  • First release: Nov 15, 2010
  • Latest release: Oct 18, 2023
  • Number of updates: 288
  • Update frequency: every 16.4 days
  • Top authors: vanderwijk (100%)

Code review

54 tests

User reviews

76 reviews

Install metrics

20,000+ active /585,740 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.13MB] [CPU: ▼4.19ms] Passed 4 tests

Analyzing server-side resources used by Content Blocks (Custom Post Widget)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1035.61 ▼0.32
Dashboard /wp-admin3.42 ▲0.1146.22 ▼6.18
Posts /wp-admin/edit.php3.53 ▲0.1746.34 ▼5.09
Add New Post /wp-admin/post-new.php6.08 ▲0.1982.13 ▼5.16
Media Library /wp-admin/upload.php3.35 ▲0.1234.81 ▲2.43
Add Content Block /wp-admin/post-new.php?post_type=content_block6.0976.74
Content Blocks /wp-admin/edit.php?post_type=content_block3.3840.49

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 37 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_custom_post_widget
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Content Blocks (Custom Post Widget)
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,858 ▲9714.29 ▼0.061.58 ▲0.0038.12 ▼0.88
Dashboard /wp-admin2,258 ▲815.51 ▼0.0881.07 ▼22.4135.65 ▼11.19
Posts /wp-admin/edit.php2,163 ▲632.00 ▲0.0234.14 ▼5.1134.15 ▼6.13
Add New Post /wp-admin/post-new.php1,590 ▲6223.31 ▲0.17664.61 ▼13.0853.52 ▼2.94
Media Library /wp-admin/upload.php1,469 ▲694.23 ▲0.0293.90 ▼16.9642.01 ▼5.44
Add Content Block /wp-admin/post-new.php?post_type=content_block1,58816.73869.8240.74
Content Blocks /wp-admin/edit.php?post_type=content_block1,1071.9330.5729.85

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_custom_post_widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-post-widget/post-type.php:35
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/custom-post-widget/widget.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-post-widget/custom-post-widget.php:35
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/custom-post-widget/shortcode.php:82
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-post-widget/meta-box.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (After activating the plugin a new post type called 'Content Blocks' is added.), #2 (The widget has a select box to choose the content block. Click on the 'Edit Content Block' link to edit the selected Content Block custom post.), #3 (You will find a button above the WYSIWYG editor that allows you to insert the content block using the shortcode.), #4 (After clicking the 'Add Content Block' button you can select a content block and insert the shortcode in the content area.)
The official readme.txt might help

custom-post-widget/custom-post-widget.php Passed 13 tests

"Content Blocks (Custom Post Widget)" version 3.2.7's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
94 characters long description:
Show the content of a custom post of the type 'content_block' in a widget or with a shortcode.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected1,917 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PO File115671,0351,506
PHP65948382
CSS10017
JavaScript23612

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity19.00
▷ Minimum class complexity19.00
▷ Maximum class complexity19.00
Average method complexity5.50
▷ Minimum method complexity1.00
▷ Maximum method complexity11.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%
Functions17
▷ Named functions17100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.10MB with 0.06MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png12.94KB5.41KB▼ 58.22%
screenshot-4.png16.17KB8.02KB▼ 50.38%
screenshot-2.png15.22KB6.00KB▼ 60.59%
screenshot-1.png55.00KB20.23KB▼ 63.21%