68% post-preview-card

Code Review | Post Preview Card

WordPress plugin Post Preview Card scored68%from 54 tests.

About plugin

  • Plugin page: post-preview-card
  • Plugin version: 2.0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0.1-4.8.0
  • WordPress version: 6.3.1
  • First release: Apr 18, 2017
  • Latest release: Jul 2, 2017
  • Number of updates: 14
  • Update frequency: every 5.6 days
  • Top authors: fernandoanael (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,523 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼1.77MB] [CPU: ▼48.78ms] Passed 4 tests

This is a short check of server-side resources used by Post Preview Card
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.22 ▼1.245.31 ▼35.93
Dashboard /wp-admin2.24 ▼1.0710.21 ▼37.44
Posts /wp-admin/edit.php2.24 ▼1.127.66 ▼39.41
Add New Post /wp-admin/post-new.php2.24 ▼3.656.93 ▼82.33
Media Library /wp-admin/upload.php2.24 ▼0.997.52 ▼26.49
Widgets /wp-admin/admin.php?page=peaw_settings_widgets2.246.96
Layouts /wp-admin/admin.php?page=peaw_layout_settings2.248.07
General /wp-admin/admin.php?page=peaw_settings2.246.94

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 52 new files
Database: no new tables, 12 new options
New WordPress options
widget_peaw_single_post_by_id
peaw_activate_post_by_id
widget_recent-posts
peaw_activate_post_by_cat
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_peaw_random_post_by_category
db_upgraded
widget_peaw_multiple_posts
...

Browser metrics Passed 4 tests

Checking browser requirements for Post Preview Card
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,841 ▲10613.22 ▼1.181.66 ▼0.2652.94 ▲8.32
Dashboard /wp-admin2,237 ▲525.83 ▼0.02114.19 ▲12.1942.84 ▼3.31
Posts /wp-admin/edit.php2,123 ▲282.02 ▲0.0141.55 ▼13.8536.49 ▼8.28
Add New Post /wp-admin/post-new.php1,567 ▲5320.99 ▲3.50703.05 ▲60.5353.93 ▲8.76
Media Library /wp-admin/upload.php1,422 ▲434.19 ▼0.0895.52 ▼6.8942.45 ▼0.38
Widgets /wp-admin/admin.php?page=peaw_settings_widgets8192.0423.5025.15
Layouts /wp-admin/admin.php?page=peaw_layout_settings8362.0239.9639.29
General /wp-admin/admin.php?page=peaw_settings8002.0627.5229.75

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
The following items require your attention
  • Uninstall procedure had uncaught errors
    • > Deprecated in wp-content/plugins/post-preview-card/includes/peaw-class.php+62
    Non-static method Peaw_Ajax_Register_Manager::peaw_register_ajax() should not be called statically
  • This plugin does not fully uninstall, leaving 12 options in the database
    • peaw_activate_post_by_cat
    • widget_peaw_random_post_by_category
    • theysaidso_admin_options
    • peaw_activate_peaw_multiple_posts
    • widget_recent-posts
    • widget_peaw_single_post_by_id
    • widget_peaw_multiple_posts
    • can_compress_scripts
    • db_upgraded
    • peaw_activate_post_by_id
    • ...

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=peaw_settings
    • > Deprecated in wp-content/plugins/post-preview-card/includes/peaw-class.php+62
    Non-static method Peaw_Ajax_Register_Manager::peaw_register_ajax() should not be called statically

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 14× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Peaw_Options_Base' not found in wp-content/plugins/post-preview-card/includes/options/managers/peaw_widget_register_manager.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Peaw_Layouts_Base' not found in wp-content/plugins/post-preview-card/includes/options/layouts/peaw_layout_original_card.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_errors() in wp-content/plugins/post-preview-card/admin/partials/peaw-admin-settings-widgets-page.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Peaw_Options_Base' not found in wp-content/plugins/post-preview-card/includes/options/managers/peaw_general_settings_manager.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/post-preview-card/includes/widgets/peaw-single-post-by-id.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_errors() in wp-content/plugins/post-preview-card/admin/partials/peaw-admin-settings-general-page.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Peaw_Options_Base' not found in wp-content/plugins/post-preview-card/includes/options/managers/peaw_layouts_manager.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/post-preview-card/includes/peaw-class.php:163
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/post-preview-card/includes/widgets/peaw-random-post-by-category.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'Peaw_Ajax_Base' not found in wp-content/plugins/post-preview-card/includes/options/managers/peaw_ajax_register_manager.php:12

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
8 plugin tags: siteorigin, widget for elementor, elementor, preview, beaver...

post-preview-card/post-preview-card.php 92% from 13 tests

The primary PHP file in "Post Preview Card" version 2.0.3 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin4,816 lines of code in 33 files:
LanguageFilesBlank linesComment linesLines of code
Sass520601,901
CSS540561,466
PHP213885211,349
Markdown116055
JavaScript17045

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity12.73
▷ Minimum class complexity1.00
▷ Maximum class complexity56.00
Average method complexity3.71
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces3
Traits0
Classes12
▷ Abstract classes18.33%
▷ Concrete classes1191.67%
▷ Final classes00.00%
Methods72
▷ Static methods3447.22%
▷ Public methods6691.67%
▷ Protected methods00.00%
▷ Private methods68.33%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
public/images/image-not-found.png50.89KB20.63KB▼ 59.46%