68% post-draft-preview

Code Review | Post Draft Preview

WordPress plugin Post Draft Preview scored68%from 54 tests.

About plugin

  • Plugin page: post-draft-preview
  • Plugin version: 1.2.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.3
  • WordPress version: 6.3.1
  • First release: Mar 4, 2022
  • Latest release: Nov 20, 2023
  • Number of updates: 11
  • Update frequency: every 57.0 days
  • Top authors: wpserved (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active /1,756 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.40MB] [CPU: ▼1.65ms] Passed 4 tests

A check of server-side resources used by Post Draft Preview
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.88 ▲0.4141.96 ▲2.10
Dashboard /wp-admin3.71 ▲0.3747.11 ▼11.43
Posts /wp-admin/edit.php3.76 ▲0.4152.62 ▲4.23
Add New Post /wp-admin/post-new.php6.31 ▲0.4393.14 ▼1.18
Media Library /wp-admin/upload.php3.63 ▲0.4135.89 ▲3.90
Post Draft Preview /wp-admin/tools.php?page=pdp-dashboard3.5732.78

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 1,672 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Post Draft Preview
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,888 ▲14113.38 ▼0.718.53 ▲6.9740.30 ▼2.98
Dashboard /wp-admin2,211 ▲315.65 ▲0.0693.68 ▼2.4338.38 ▼5.36
Posts /wp-admin/edit.php2,113 ▲162.01 ▼0.0141.39 ▲0.2935.39 ▼4.77
Add New Post /wp-admin/post-new.php1,538 ▲823.39 ▲0.44677.99 ▲30.1954.16 ▲6.59
Media Library /wp-admin/upload.php1,416 ▲134.25 ▲0.0899.01 ▲3.3843.62 ▲1.51
Post Draft Preview /wp-admin/tools.php?page=pdp-dashboard8712.0523.0428.43

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=pdp-dashboard
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

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
Please fix the following
  • 336× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Illuminate\\Support\\Facades\\Facade' not found in wp-content/plugins/post-draft-preview/vendor/illuminate/support/Facades/App.php:47
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Translation\\Loader\\LoaderInterface' not found in wp-content/plugins/post-draft-preview/vendor/symfony/translation/Loader/ArrayLoader.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Contracts\\Translation\\TranslatorInterface' not found in wp-content/plugins/post-draft-preview/vendor/symfony/translation/PseudoLocalizationTranslator.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Translation\\Writer\\TranslationWriterInterface' not found in wp-content/plugins/post-draft-preview/vendor/symfony/translation/Writer/TranslationWriter.php:24
    • > PHP Fatal error
      Uncaught Error: Interface 'Carbon\\Exceptions\\BadMethodCallException' not found in wp-content/plugins/post-draft-preview/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Illuminate\\Support\\Facades\\Facade' not found in wp-content/plugins/post-draft-preview/vendor/illuminate/support/Facades/Route.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'Illuminate\\Contracts\\Support\\MessageProvider' not found in wp-content/plugins/post-draft-preview/vendor/illuminate/contracts/Validation/Validator.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/post-draft-preview/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/post-draft-preview/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Translation\\Loader\\LoaderInterface' not found in wp-content/plugins/post-draft-preview/vendor/symfony/translation/Loader/QtFileLoader.php:26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
4 plugin tags: post draft, post preview, draft preview, public link

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

The entry point to "Post Draft Preview" version 1.2.1 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis 3% from 3 tests

File types 0% from 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
Almost there! Just fix the following issues
  • For security reasons, never distribute binary or executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/post-draft-preview/vendor/nesbot/carbon/bin/carbon.bat
57,865 lines of code in 1,451 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,40010,39336,31751,995
XSD392482,803
JSON18001,810
Markdown183781974
YAML3313123
reStructuredText1747875
PO File1152746
SVG10019
Bourne Shell131112
DOS Batch1004
JavaScript3003
CSS1001

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please tend to the following items
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 140)
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity7.55
▷ Minimum class complexity1.00
▷ Maximum class complexity324.00
Average method complexity2.48
▷ Minimum method complexity1.00
▷ Maximum method complexity140.00
Code structure
Namespaces91
Interfaces129
Traits35
Classes383
▷ Abstract classes225.74%
▷ Concrete classes36194.26%
▷ Final classes3910.80%
Methods3,203
▷ Static methods64320.07%
▷ Public methods2,77186.51%
▷ Protected methods2828.80%
▷ Private methods1504.68%
Functions458
▷ Named functions9420.52%
▷ Anonymous functions36479.48%
Constants196
▷ Global constants115.61%
▷ Class constants18594.39%
▷ Public constants18298.38%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG files were detected