84% wp-social-preview

Code Review | WP Social Preview

WordPress plugin WP Social Preview scored84%from 54 tests.

About plugin

  • Plugin page: wp-social-preview
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.1
  • WordPress version: 6.3.1
  • First release: Feb 25, 2020
  • Latest release: Nov 19, 2022
  • Number of updates: 20
  • Update frequency: every 49.9 days
  • Top authors: gilbitron (70%)polevaultweb (35%)

Code review

54 tests

User reviews

2 reviews

Install metrics

1,000+ active /4,965 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.33MB] [CPU: ▼1.03ms] Passed 4 tests

A check of server-side resources used by WP Social Preview
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.76 ▲0.3052.59 ▲7.60
Dashboard /wp-admin3.71 ▲0.4072.08 ▲12.80
Posts /wp-admin/edit.php3.76 ▲0.4049.43 ▼6.75
Add New Post /wp-admin/post-new.php6.17 ▲0.2993.08 ▼7.40
Media Library /wp-admin/upload.php3.57 ▲0.3444.21 ▲2.43
WP Social Preview /wp-admin/options-general.php?page=wp_social_preview3.5842.55

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 210 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by WP Social Preview
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲4814.35 ▼0.042.34 ▲0.4448.94 ▲0.48
Dashboard /wp-admin2,202 ▲225.66 ▲0.0487.44 ▼9.9442.89 ▼4.02
Posts /wp-admin/edit.php2,101 ▼21.95 ▼0.0236.51 ▼3.1237.23 ▲3.08
Add New Post /wp-admin/post-new.php1,902 ▲37625.19 ▲2.36710.60 ▲15.9649.27 ▼0.08
Media Library /wp-admin/upload.php1,404 ▲44.20 ▲0.02104.37 ▼1.5544.25 ▼2.53
WP Social Preview /wp-admin/options-general.php?page=wp_social_preview1,2903.3964.6835.57

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% 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 everything seems fine, this is not 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
  • 136× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/wp-social-preview/vendor/psr/http-message/src/RequestInterface.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Intervention\\Image\\AbstractDriver' not found in wp-content/plugins/wp-social-preview/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Intervention\\Image\\Commands\\AbstractCommand' not found in wp-content/plugins/wp-social-preview/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-social-preview/vendor/guzzlehttp/psr7/src/AppendStream.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Intervention\\Image\\Commands\\AbstractCommand' not found in wp-content/plugins/wp-social-preview/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Intervention\\Image\\Gd\\Commands\\ResizeCommand' not found in wp-content/plugins/wp-social-preview/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\RequestInterface' not found in wp-content/plugins/wp-social-preview/vendor/psr/http-message/src/ServerRequestInterface.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'Illuminate\\Support\\ServiceProvider' not found in wp-content/plugins/wp-social-preview/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Intervention\\Image\\Commands\\AbstractCommand' not found in wp-content/plugins/wp-social-preview/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-social-preview/vendor/guzzlehttp/psr7/src/DroppingStream.php:10

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: social, twitter card, social image, open graph, social sharing

wp-social-preview/wp-social-preview.php Passed 13 tests

The main PHP file in "WP Social Preview" ver. 1.0.2 adds more information about the plugin and also serves as the entry point for this plugin
89 characters long description:
Previewing and manage how your content will look on social media sites before sharing it.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin11,076 lines of code in 204 files:
LanguageFilesBlank linesComment linesLines of code
PHP1802,4915,4859,241
Markdown53990668
JSON800448
JavaScript82515400
CSS3430319

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity6.93
▷ Minimum class complexity1.00
▷ Maximum class complexity65.00
Average method complexity2.49
▷ Minimum method complexity1.00
▷ Maximum method complexity43.00
Code structure
Namespaces15
Interfaces8
Traits2
Classes156
▷ Abstract classes85.13%
▷ Concrete classes14894.87%
▷ Final classes32.03%
Methods762
▷ Static methods425.51%
▷ Public methods64184.12%
▷ Protected methods547.09%
▷ Private methods678.79%
Functions51
▷ Named functions2854.90%
▷ Anonymous functions2345.10%
Constants17
▷ Global constants00.00%
▷ Class constants17100.00%
▷ Public constants17100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG images were found in this plugin