10% post-to-docx

Code Review | WP Post to DOCX

WordPress plugin WP Post to DOCX scored10%from 54 tests.

About plugin

  • Plugin page: post-to-docx
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.7-3.5.1
  • WordPress version: 6.3.1
  • First release: Jun 26, 2013
  • Latest release: Jun 26, 2013
  • Number of updates: 2
  • Update frequency: every 2.5 days
  • Top authors: jlopez2mdc (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /938 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The following installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/post-to-docx/post-to-docx.php+27
    Methods with the same name as their class will not be constructors in a future version of PHP; Posttodocx has a deprecated constructor

Server metrics [RAM: ▼1.91MB] [CPU: ▼53.25ms] Passed 4 tests

A check of server-side resources used by WP Post to DOCX
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.08 ▼1.384.55 ▼38.24
Dashboard /wp-admin2.10 ▼1.206.20 ▼46.07
Posts /wp-admin/edit.php2.10 ▼1.256.51 ▼43.29
Add New Post /wp-admin/post-new.php2.10 ▼3.795.39 ▼85.38
Media Library /wp-admin/upload.php2.10 ▼1.135.40 ▼30.24
Post to DOCX /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php2.106.67

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 179 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
posttodocx
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

WP Post to DOCX: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.35 ▲0.081.80 ▲0.1544.84 ▼2.94
Dashboard /wp-admin2,202 ▲285.59 ▲0.0683.69 ▼8.6440.18 ▼1.44
Posts /wp-admin/edit.php2,104 ▲12.03 ▲0.0336.07 ▼3.0836.63 ▼4.30
Add New Post /wp-admin/post-new.php1,529 ▲323.73 ▲0.64729.56 ▲47.6463.84 ▲12.00
Media Library /wp-admin/upload.php1,398 ▼24.21 ▲0.09101.30 ▼5.9443.80 ▼1.29
Post to DOCX /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php8452.0124.3627.83

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Deprecated in wp-content/plugins/post-to-docx/post-to-docx.php+27
    Methods with the same name as their class will not be constructors in a future version of PHP; Posttodocx has a deprecated constructor
  • The uninstall procedure has failed, leaving 7 options in the database
    • theysaidso_admin_options
    • posttodocx
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php
    • > Deprecated in wp-content/plugins/post-to-docx/post-to-docx.php+27
    Methods with the same name as their class will not be constructors in a future version of PHP; Posttodocx has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php
    • > Warning in wp-content/plugins/post-to-docx/post-to-docx.php+25
    Use of undefined constant Posttodocx - assumed 'Posttodocx' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php
    • > Notice in wp-content/plugins/post-to-docx/posttodocx_options.php+22
    Undefined index: attachment
    • > GET request to /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php
    • > Notice in wp-content/plugins/post-to-docx/posttodocx_options.php+33
    Undefined index: nonPublic

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/post-to-docx/phpdocx/examples/easy/SetLanguage.php
    • > /wp-content/plugins/post-to-docx/post-to-docx.php
  • 62× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerLayout' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/layouts/LoggerLayoutSerialized.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerAppender' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/appenders/LoggerAppenderNull.php:30
    • > PHP Warning
      Declaration of CreateList::generatePSTYLE($val) should be compatible with CreateElement::generatePSTYLE($val = 'Textonotaa...') in /var/www/wordpress/wp-content/plugins/post-to-docx/phpdocx/classes/CreateList.inc on line 377
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerAppenderFile' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/appenders/LoggerAppenderDailyFile.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerLayout' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/layouts/LoggerLayoutXml.php:56
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerPatternConverter' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/pattern/LoggerPatternConverterFile.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerConfigurable' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/LoggerLayout.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerPatternConverter' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/pattern/LoggerPatternConverterNewLine.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'LoggerPatternConverter' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/pattern/LoggerPatternConverterRelative.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'LoggerConfigurator' not found in wp-content/plugins/post-to-docx/phpdocx/lib/log4php/configurators/LoggerConfiguratorDefault.php:31

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=post-to-docx/post-to-docx.php
    • > Network (severe)
    wp-content/plugins/post-to-docx/asset/css/admin.css?ver=1.0 - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: post, docx, posts, phpdocx, post to docx

post-to-docx/post-to-docx.php Passed 13 tests

The main PHP file in "WP Post to DOCX" ver. 1.0 adds more information about the plugin and also serves as the entry point for this plugin
46 characters long description:
Allow visitor to download post in DOCX format.

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Please make sure to remedy the following
  • Do not include executable or dangerous files in your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/post-to-docx/phpdocx/excel/xl/printerSettings/printerSettings1.bin
59,030 lines of code in 158 files:
LanguageFilesBlank linesComment linesLines of code
XML2121737,488
PHP1041,7408,1698,674
XSLT17482657,462
Pascal299056,6645,326
DTD1255469
CSS1107
INI1244

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity7.44
▷ Minimum class complexity1.00
▷ Maximum class complexity54.00
Average method complexity2.11
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces3
Traits0
Classes77
▷ Abstract classes67.79%
▷ Concrete classes7192.21%
▷ Final classes00.00%
Methods468
▷ Static methods5611.97%
▷ Public methods39584.40%
▷ Protected methods234.91%
▷ Private methods5010.68%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants51
▷ Global constants59.80%
▷ Class constants4690.20%
▷ Public constants46100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
5 PNG files occupy 0.66MB with 0.33MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
phpdocx/examples/files/img/imageP2.png140.73KB46.48KB▼ 66.98%
phpdocx/examples/files/img/image.png32.33KB19.79KB▼ 38.80%
phpdocx/examples/files/img/imageP1.png231.34KB64.58KB▼ 72.08%
phpdocx/examples/files/img/imageP3.png270.93KB65.75KB▼ 75.73%
assets/images/docx.png0.64KB0.70KB0.00%