83% gf2pdf

Code Review | Gravity 2 PDF

WordPress plugin Gravity 2 PDF scored 83% from 54 tests.

About plugin

  • Plugin page: gf2pdf
  • Plugin version: 3.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.9.8
  • WordPress version: 6.3.1
  • First release: Jul 7, 2016
  • Latest release: Nov 9, 2018
  • Number of updates: 96
  • Update frequency: every 9.0 days
  • Top authors: gravity2pdf (100%)

Code review

54 tests

User reviews

17 reviews

Install metrics

100+ active / 17,598 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

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

This is a short check of server-side resources used by Gravity 2 PDF
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.71 ▼1.44
Dashboard /wp-admin3.31 ▲0.0043.50 ▼3.22
Posts /wp-admin/edit.php3.36 ▲0.0047.77 ▲3.54
Add New Post /wp-admin/post-new.php5.89 ▲0.0086.95 ▼3.66
Media Library /wp-admin/upload.php3.23 ▲0.0035.14 ▲3.98

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 39 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Gravity 2 PDF
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲4313.27 ▼1.041.99 ▲0.0842.01 ▼0.58
Dashboard /wp-admin2,203 ▲155.83 ▲0.9394.38 ▼12.8536.61 ▼2.35
Posts /wp-admin/edit.php2,089 ▲32.05 ▲0.0539.19 ▲3.4334.08 ▼0.23
Add New Post /wp-admin/post-new.php1,533 ▲1223.28 ▲0.15658.85 ▲33.1550.25 ▼8.82
Media Library /wp-admin/upload.php1,391 ▲34.23 ▲0.01109.21 ▲8.4447.64 ▲4.20

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

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
Please fix the following items
  • 39× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/gf2pdf/class/merges_table.class.php on line 4
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/gf2pdf/class/merges_table.class.php on line 4
    • > PHP Warning
      include_once(): Failed opening 'GM_PATH_INCLUDES/gravity_merge_tab_menus.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/gf2pdf/includes/gravity_merges_update.php on line 3
    • > PHP Warning
      include_once(GM_PATH_INCLUDES/gravity_merge_tab_menus.php): failed to open stream: No such file or directory in wp-content/plugins/gf2pdf/includes/gravity_merges.php on line 3
    • > PHP Warning
      include_once(): Failed opening 'GM_PATH_CLASS/merges_table.class.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/gf2pdf/class/gravity_merge_pages.class.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'Gravity_Merge_Settings' not found in wp-content/plugins/gf2pdf/includes/gravity_merges_update.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Gravity_Merge_Settings' not found in wp-content/plugins/gf2pdf/includes/gravity_merges.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_errors() in wp-content/plugins/gf2pdf/includes/gravity_merge_addons.php:2
    • > PHP Warning
      Use of undefined constant GM_PATH_CLASS - assumed 'GM_PATH_CLASS' (this will throw an Error in a future version of PHP) in wp-content/plugins/gf2pdf/class/gravity_merge_pages.class.php on line 2
    • > PHP Warning
      include_once(GM_PATH_INCLUDES/gravity_merge_tab_menus.php): failed to open stream: No such file or directory in wp-content/plugins/gf2pdf/includes/gravity_merges_new.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 19 tag instead of maximum 10
The official readme.txt might help

gf2pdf/GravityMerge.php 85% from 13 tests

"Gravity 2 PDF" version 3.1.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • 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
  • Main file name: Name the main plugin file the same as the plugin slug ("gf2pdf.php" instead of "GravityMerge.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin5,451 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
PHP271,1061,7914,851
JavaScript45311304
CSS2370268
JSON10028

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity33.48
▷ Minimum class complexity1.00
▷ Maximum class complexity206.00
Average method complexity4.02
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes21
▷ Abstract classes00.00%
▷ Concrete classes21100.00%
▷ Final classes00.00%
Methods226
▷ Static methods156.64%
▷ Public methods19284.96%
▷ Protected methods2310.18%
▷ Private methods114.87%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants18
▷ Global constants1583.33%
▷ Class constants316.67%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.04MB with 0.03MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/gravity2pdf-icon.png3.80KB1.26KB▼ 66.82%
assets/images/gravity2pdf-logo.png40.37KB18.13KB▼ 55.09%