63% twinfield

Code Review | Twinfield

WordPress plugin Twinfield scored63%from 54 tests.

About plugin

  • Plugin page: twinfield
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.1
  • WordPress version: 6.3.1
  • First release: Apr 15, 2011
  • Latest release: Jan 2, 2015
  • Number of updates: 14
  • Update frequency: every 97.2 days
  • Top authors: remcotolsma (64.29%)pronamic (42.86%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,245 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼0.62MB] [CPU: ▼31.23ms] Passed 4 tests

Analyzing server-side resources used by Twinfield
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1441.96 ▲4.00
Dashboard /wp-admin3.32 ▲0.0225.15 ▼29.97
Posts /wp-admin/edit.php3.33 ▼0.0324.46 ▼22.18
Add New Post /wp-admin/post-new.php3.32 ▼2.5625.03 ▼64.83
Media Library /wp-admin/upload.php3.32 ▲0.1027.49 ▼7.93
Documentation /wp-admin/admin.php?page=twinfield_documentation3.3327.42
Settings /wp-admin/admin.php?page=twinfield_settings3.3330.39
Twinfield /wp-admin/admin.php?page=twinfield3.3326.34
Customers /wp-admin/admin.php?page=twinfield_customers3.3330.79
Invoices /wp-admin/admin.php?page=twinfield_invoices3.3325.34

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

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

Browser metrics Passed 4 tests

Twinfield: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,840 ▲9414.45 ▲0.211.78 ▼1.0543.66 ▲2.40
Dashboard /wp-admin2,246 ▲555.87 ▲0.99101.85 ▲2.4261.59 ▲23.34
Posts /wp-admin/edit.php2,126 ▲341.97 ▼0.0533.55 ▼2.9732.57 ▼0.90
Add New Post /wp-admin/post-new.php1,552 ▲1922.95 ▼0.18734.04 ▲34.3453.61 ▲1.91
Media Library /wp-admin/upload.php1,422 ▲404.17 ▼0.0495.98 ▼4.5076.13 ▲34.05
Documentation /wp-admin/admin.php?page=twinfield_documentation1,1732.1431.5737.71
Settings /wp-admin/admin.php?page=twinfield_settings9512.0225.4830.18
Twinfield /wp-admin/admin.php?page=twinfield8502.0125.2624.29
Customers /wp-admin/admin.php?page=twinfield_customers8182.0625.8525.02
Invoices /wp-admin/admin.php?page=twinfield_invoices8182.0624.5725.85

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/twinfield/classes/Pronamic/WP/TwinfieldPlugin/Settings.php+36
    Function create_function() is deprecated
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 15 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=twinfield_invoices
    • > Deprecated in wp-content/plugins/twinfield/classes/Pronamic/WP/TwinfieldPlugin/Settings.php+170
    Function create_function() is deprecated

SRP 0% 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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/twinfield/views/Pronamic/WP/Merge/Customer/create_response.php
  • 28× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/twinfield/templates/invoice.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/twinfield/views/section-permalinks.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_admin_page_title() in wp-content/plugins/twinfield/views/page-twinfield.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Pronamic\\WP\\Twinfield\\FormBuilder\\Form\\ParentForm' not found in wp-content/plugins/twinfield/classes/Pronamic/WP/Twinfield/FormBuilder/Form/Invoice.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Pronamic\\WP\\Twinfield\\Merge\\Supports\\BaseSupport' not found in wp-content/plugins/twinfield/classes/Pronamic/WP/Twinfield/Merge/Supports/Customer.php:24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/twinfield/views/Pronamic/WP/FormBuilder/create_form_customer.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Pronamic\\Twinfield\\Request\\Read\\Read' not found in wp-content/plugins/twinfield/twinfield/src/Pronamic/Twinfield/Request/Read/Invoice.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_admin_page_title() in wp-content/plugins/twinfield/views/page-documentation.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/twinfield/views/meta-box-customer.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/twinfield/views/Pronamic/WP/FormBuilder/create_form_invoice.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
2 plugin tags: administration, twinfield

twinfield/twinfield.php Passed 13 tests

The primary PHP file in "Twinfield" version 1.1.0 is used by WordPress to initiate all plugin functionality
80 characters long description:
A base plugin to make the connection with the Twinfield administration software.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin4,470 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
PHP681,0681,8723,877
PO File1183831341
XSLT1200112
Markdown1500108
JSON10018
CSS15014

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity4.53
▷ Minimum class complexity1.00
▷ Maximum class complexity18.00
Average method complexity1.52
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces22
Interfaces0
Traits0
Classes49
▷ Abstract classes510.20%
▷ Concrete classes4489.80%
▷ Final classes00.00%
Methods336
▷ Static methods133.87%
▷ Public methods32596.73%
▷ Protected methods20.60%
▷ Private methods92.68%
Functions11
▷ Named functions11100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/admin/images/icon-32x32.png0.77KB0.44KB▼ 42.17%
assets/admin/images/icon-16x16.png0.41KB0.27KB▼ 32.94%