83% mpdf-addon-for-pdf-invoices

Code Review | mPDF add-on for RTL and Unicode Support

WordPress plugin mPDF add-on for RTL and Unicode Support scored83%from 54 tests.

About plugin

  • Plugin page: mpdf-addon-for-pd...
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.4
  • WordPress version: 6.3.1
  • First release: Sep 7, 2020
  • Latest release: Nov 21, 2023
  • Number of updates: 18
  • Update frequency: every 65.2 days
  • Top authors: webtoffee (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

3,000+ active /25,124 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.01MB] [CPU: ▼5.68ms] Passed 4 tests

Analyzing server-side resources used by mPDF add-on for RTL and Unicode Support
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0040.77 ▼2.36
Dashboard /wp-admin3.31 ▼0.0446.31 ▼16.89
Posts /wp-admin/edit.php3.36 ▲0.0048.30 ▲1.20
Add New Post /wp-admin/post-new.php5.89 ▲0.0091.37 ▼2.78
Media Library /wp-admin/upload.php3.23 ▲0.0035.70 ▼0.67

Server storage [IO: ▲92.18MB] [DB: ▲0.00MB] 67% from 3 tests

A short overview of filesystem and database impact
Just a few items left to fix
  • Try to limit filesystem usage to 25MB (currently using 92.18MB)
Filesystem: 630 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by mPDF add-on for RTL and Unicode Support
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.72 ▲0.281.81 ▼0.0444.23 ▲0.03
Dashboard /wp-admin2,192 ▲185.58 ▲0.0391.35 ▼7.4141.31 ▼5.32
Posts /wp-admin/edit.php2,100 ▼01.98 ▼0.1638.89 ▼0.6534.34 ▼0.32
Add New Post /wp-admin/post-new.php1,526 ▼023.18 ▼0.42688.78 ▲42.4364.61 ▲16.33
Media Library /wp-admin/upload.php1,400 ▲34.16 ▼0.0595.08 ▼3.2745.17 ▲5.16

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

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

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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 210× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Trait 'Mpdf\\Strict' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Writer/PageWriter.php on line 9
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\FormFeed' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/PageBreak.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\Tcpdf\\Fpdi' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/setasign/fpdi/src/TcpdfFpdi.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/Bdi.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerAwareInterface' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Mpdf.php:36
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'DeepCopy\\TypeFilter\\TypeFilter' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/Font.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\PdfParserException' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/mpdf-addon-for-pdf-invoices/vendor/mpdf/mpdf/src/Tag/I.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
These attributes need your attention:
  • Tags: Please delete some tags, you are using 14 tag instead of maximum 10
Please take inspiration from this readme.txt

mpdf-addon-for-pdf-invoices/wt-woocommerce-packing-list-mpdf.php 85% from 13 tests

The main file in "mPDF add-on for RTL and Unicode Support" v. 1.1.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Main file name: The principal plugin file should be the same as the plugin slug ("mpdf-addon-for-pdf-invoices.php" instead of "wt-woocommerce-packing-list-mpdf.php")

Code Analysis 95% from 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
Good job! No executable or dangerous file extensions detected79,235 lines of code in 478 files:
LanguageFilesBlank linesComment linesLines of code
PHP38210,96411,77576,987
Markdown837401,129
JSON79320588
CSS26518405
XML311073
YAML311350
Bourne Shell1203

PHP code 0% from 2 tests

An overview of cyclomatic complexity and code structure
It is recommended to fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 7,009)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 460)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity60.89
▷ Minimum class complexity1.00
▷ Maximum class complexity7,009.00
Average method complexity13.55
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
Namespaces44
Interfaces10
Traits6
Classes284
▷ Abstract classes93.17%
▷ Concrete classes27596.83%
▷ Final classes134.73%
Methods1,438
▷ Static methods1248.62%
▷ Public methods1,23685.95%
▷ Protected methods694.80%
▷ Private methods1339.25%
Functions35
▷ Named functions1028.57%
▷ Anonymous functions2571.43%
Constants458
▷ Global constants367.86%
▷ Class constants42292.14%
▷ Public constants422100.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.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/webtoffee-logo_small.png4.04KB2.85KB▼ 29.40%