10% pdf-creator

Code Review | PDF-Creator

WordPress plugin PDF-Creator scored10%from 54 tests.

About plugin

  • Plugin page: pdf-creator
  • Plugin version: 0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-3.4
  • WordPress version: 6.3.1
  • First release: May 16, 2014
  • Latest release: May 16, 2014
  • Number of updates: 9
  • Update frequency: every 0.1 days
  • Top authors: maartenhemmes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,507 total downloads

Benchmarks

Plugin footprint 57% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The following installer errors require your attention
  • Install procedure had errors
    • > Compile error in wp-content/plugins/pdf-creator/MPDF/mpdf.php+1422
    Switch statements may only contain one default clause

Server metrics [RAM: ▲0.00MB] [CPU: ▼4.98ms] Passed 4 tests

Server-side resources used by PDF-Creator
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0038.45 ▲1.59
Dashboard /wp-admin3.31 ▲0.0147.07 ▲0.57
Posts /wp-admin/edit.php3.36 ▲0.0044.90 ▼4.84
Add New Post /wp-admin/post-new.php5.89 ▲0.0077.11 ▼17.22
Media Library /wp-admin/upload.php3.23 ▲0.0036.64 ▲4.28

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

How much does this plugin use your filesystem and database?
These are issues you should consider
  • Filesystem usage must be lower than 25MB (currently using 30.15MB)
Filesystem: 262 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for PDF-Creator
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.80 ▲0.421.80 ▲0.1843.83 ▲0.14
Dashboard /wp-admin2,206 ▲315.90 ▲0.95101.46 ▼9.8941.59 ▲0.20
Posts /wp-admin/edit.php2,089 ▼02.01 ▲0.0434.02 ▼7.6834.51 ▼0.39
Add New Post /wp-admin/post-new.php1,514 ▼1917.58 ▼5.63664.77 ▲32.0562.33 ▲7.63
Media Library /wp-admin/upload.php1,385 ▼64.21 ▲0.02107.44 ▲11.5247.41 ▲3.05

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
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 5× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/pdf-creator/MPDF/utils/index.php
    • > /wp-content/plugins/pdf-creator/MPDF/examples/formsubmit.php
    • > /wp-content/plugins/pdf-creator/MPDF/compress.php
    • > /wp-content/plugins/pdf-creator/MPDF/examples/show_code.php
    • > /wp-content/plugins/pdf-creator/MPDF/examples/index.php
  • 115× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      include_once(): Failed opening '_JPGRAPH_PATHjpgraph_log.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/pdf-creator/MPDF/graph.php on line 26
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422
    • > PHP Warning
      Use of undefined constant _JPGRAPH_PATH - assumed '_JPGRAPH_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/pdf-creator/MPDF/graph.php on line 26
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422
    • > PHP Warning
      Use of undefined constant _MPDF_PATH - assumed '_MPDF_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/pdf-creator/MPDF/graph.php on line 13
    • > PHP Fatal error
      Switch statements may only contain one default clause in wp-content/plugins/pdf-creator/MPDF/mpdf.php on line 1422

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
2 plugin tags: creator, pdf

pdf-creator/pdf-creator.php Passed 13 tests

The principal PHP file in "PDF-Creator" v. 0.3 is loaded by WordPress automatically on each request
26 characters long description:
Plugin to create PDF files

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin81,111 lines of code in 143 files:
LanguageFilesBlank linesComment linesLines of code
PHP1358,6475,71578,521
SVG2002,213
CSS55720345
HTML14032

PHP code 0% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 9,842)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 1,516)
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity465.29
▷ Minimum class complexity1.00
▷ Maximum class complexity9,842.00
Average method complexity22.07
▷ Minimum method complexity1.00
▷ Maximum method complexity1,516.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes28
▷ Abstract classes00.00%
▷ Concrete classes28100.00%
▷ Final classes00.00%
Methods619
▷ Static methods00.00%
▷ Public methods59896.61%
▷ Protected methods213.39%
▷ Private methods00.00%
Functions21
▷ Named functions21100.00%
▷ Anonymous functions00.00%
Constants57
▷ Global constants57100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
15 PNG files occupy 0.67MB with 0.45MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
MPDF/examples/img3.png1.06KB0.20KB▼ 80.86%
MPDF/examples/img1.png0.98KB0.14KB▼ 86.10%
MPDF/examples/tiger.png83.21KB32.43KB▼ 61.03%
MPDF/examples/alpha3.png8.39KB3.56KB▼ 57.61%
MPDF/examples/firefox-48.png5.51KB2.60KB▼ 52.77%