10% wpcargo

Code Review | WPCargo Track & Trace

WordPress plugin WPCargo Track & Trace scored 10% from 54 tests.

About plugin

  • Plugin page: wpcargo
  • Plugin version: 6.13.3
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Nov 10, 2015
  • Latest release: Aug 26, 2023
  • Number of updates: 387
  • Update frequency: every 7.4 days
  • Top authors: wptaskforce (100%)

Code review

54 tests

User reviews

23 reviews

Install metrics

10,000+ active / 289,442 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Please fix the following installer errors
  • The plugin did not install without errors
    • > User deprecated in wp-includes/functions.php+5453
    Function get_page_by_title is deprecated since version 6.2.0! Use WP_Query instead.

Server metrics [RAM: ▲1.13MB] [CPU: ▲10.34ms] Passed 4 tests

Analyzing server-side resources used by WPCargo Track & Trace
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.55 ▲1.0954.12 ▲6.58
Dashboard /wp-admin4.45 ▲1.1457.98 ▲9.33
Posts /wp-admin/edit.php4.56 ▲1.2057.53 ▲10.52
Add New Post /wp-admin/post-new.php7.05 ▲1.16105.25 ▲16.06
Media Library /wp-admin/upload.php4.37 ▲1.1448.96 ▲14.92
Admin Email Settings /wp-admin/admin.php?page=wpcargo-admin-email-settings4.3542.31
Print Layout /wp-admin/admin.php?page=wpcargo-print-layout4.5545.06
Shipment Label /wp-admin/admin.php?page=wpcargo-print-label4.3437.32
Map Settings /wp-admin/admin.php?page=wpc-shmap-settings4.4148.16
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=wpcargo_shipment4.3743.36
Reports /wp-admin/admin.php?page=wpc-ie-import4.3440.28
Client Email Settings /wp-admin/admin.php?page=wpcargo-email-settings4.3641.52
Reports /wp-admin/edit.php?post_type=wpcargo_shipment&page=wpc-report-export4.3945.06
Multiple Package Settings /wp-admin/admin.php?page=wpc-multiple-package4.3448.05
Add Shipment /wp-admin/post-new.php?post_type=wpcargo_shipment4.6073.58

Server storage [IO: ▲6.37MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 741 new files
Database: no new tables, 13 new options
New WordPress options
wpcargo_option_settings
wpcargo_admin_mail_subject
widget_recent-posts
db_upgraded
theysaidso_admin_options
wpcargo_admin_mail_to
wpcargo_mail_settings
wpcargo_admin_mail_active
widget_recent-comments
can_compress_scripts
...

Browser metrics Passed 4 tests

Checking browser requirements for WPCargo Track & Trace
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,996 ▲22514.63 ▲0.237.59 ▲5.3043.48 ▼0.90
Dashboard /wp-admin2,302 ▲1145.53 ▼0.28105.49 ▼2.5337.61 ▼2.19
Posts /wp-admin/edit.php2,188 ▲992.35 ▲0.3244.40 ▲2.5235.71 ▲1.25
Add New Post /wp-admin/post-new.php1,605 ▲8618.45 ▼4.30646.78 ▼27.3636.56 ▼21.95
Media Library /wp-admin/upload.php1,484 ▲994.76 ▲0.5597.44 ▼4.5143.68 ▼0.21
Admin Email Settings /wp-admin/admin.php?page=wpcargo-admin-email-settings1,1982.2930.5837.24
Print Layout /wp-admin/admin.php?page=wpcargo-print-layout1,0352.2629.9734.55
Shipment Label /wp-admin/admin.php?page=wpcargo-print-label8542.2827.3519.98
Map Settings /wp-admin/admin.php?page=wpc-shmap-settings1,3423.6242.9157.97
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=wpcargo_shipment1,4032.3633.2230.46
Reports /wp-admin/admin.php?page=wpc-ie-import8942.2830.5026.33
Client Email Settings /wp-admin/admin.php?page=wpcargo-email-settings1,2302.2529.7335.21
Reports /wp-admin/edit.php?post_type=wpcargo_shipment&page=wpc-report-export2,2332.7255.3231.42
Multiple Package Settings /wp-admin/admin.php?page=wpc-multiple-package1,0662.2627.6627.98
Add Shipment /wp-admin/post-new.php?post_type=wpcargo_shipment8,3915.43139.7342.44

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 13 options
    • can_compress_scripts
    • wpcargo_admin_mail_subject
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • wpcargo_option_settings
    • wpcargo_admin_mail_active
    • widget_recent-posts
    • wpc_mp_settings
    • wpcargo_mail_settings
    • widget_recent-comments
    • ...

Smoke tests 25% 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 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/wpcargo/lib/phpqrcode-master/index.php
  • 92× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Picqer\\Barcode\\Types\\TypeRms4cc' not found in wp-content/plugins/wpcargo/lib/barcode-generator/vendor/picqer/php-barcode-generator/src/Types/TypeKix.php:13
    • > PHP Notice
      Trying to get property 'post_title' of non-object in wp-content/plugins/wpcargo/admin/templates/print-details-header.tpl.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpcargo_brand_name() in wp-content/plugins/wpcargo/admin/templates/user-profile.tpl.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'Picqer\\Barcode\\BarcodeGenerator' not found in wp-content/plugins/wpcargo/lib/barcode-generator/vendor/picqer/php-barcode-generator/src/BarcodeGeneratorDynamicHTML.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpcargo_trackform_shipment_number() in wp-content/plugins/wpcargo/templates/result-form.tpl.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wpcargo/lib/barcode-generator/vendor/picqer/php-barcode-generator/tests/BarcodeHtmlTest.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'Picqer\\Barcode\\Types\\TypeInterface' not found in wp-content/plugins/wpcargo/lib/barcode-generator/vendor/picqer/php-barcode-generator/src/Types/TypeIntelligentMailBarcode.php:35
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/wpcargo/admin/templates/settings-fields-option.tpl.php:2
    • > PHP Fatal error
      Uncaught Error: Call to a member function barcode() on null in wp-content/plugins/wpcargo/admin/templates/print-details-header.tpl.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Picqer\\Barcode\\Types\\TypeInterleaved25Checksum' not found in wp-content/plugins/wpcargo/lib/barcode-generator/vendor/picqer/php-barcode-generator/src/Types/TypeInterleaved25.php:11

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please take a look at the following user-side issues
    • > GET request to /wp-admin/post-new.php?post_type=wpcargo_shipment
    • > Deprecation (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1 Listener added for a synchronous 'DOMSubtreeModified' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 20 tag instead of maximum 10
  • Screenshots: Screenshot #1 (All Shipments) image not found
The official readme.txt might help

wpcargo/wpcargo.php 92% from 13 tests

The entry point to "WPCargo Track & Trace" version 6.13.3 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 354 characters long)

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
Almost there! Just fix the following issues
  • Do not distribute dangerous files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/wpcargo/lib/phpqrcode-master/tools/merge.bat
55,687 lines of code in 259 files:
LanguageFilesBlank linesComment linesLines of code
PHP1472,3553,25617,112
JavaScript373872,83216,512
PO File124,4645,98810,371
SVG330125,987
CSS1481324,993
Markdown41420329
HTML400194
JSON300140
XML10023
YAML29022
Bourne Shell1002
DOS Batch1002

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity15.84
▷ Minimum class complexity1.00
▷ Maximum class complexity292.00
Average method complexity3.45
▷ Minimum method complexity1.00
▷ Maximum method complexity64.00
Code structure
Namespaces6
Interfaces1
Traits0
Classes109
▷ Abstract classes21.83%
▷ Concrete classes10798.17%
▷ Final classes00.00%
Methods656
▷ Static methods14822.56%
▷ Public methods51077.74%
▷ Protected methods13821.04%
▷ Private methods81.22%
Functions137
▷ Named functions12792.70%
▷ Anonymous functions107.30%
Constants139
▷ Global constants10676.26%
▷ Class constants3323.74%
▷ Public constants3296.97%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
47 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/phpqrcode-master/cache/frame_1.png0.12KB0.12KB▼ 1.59%
assets/images/printer.png0.73KB0.49KB▼ 33.64%
lib/phpqrcode-master/cache/frame_34.png0.25KB0.23KB▼ 8.59%
lib/phpqrcode-master/cache/frame_4.png0.15KB0.14KB▼ 1.34%
admin/assets/images/wpcmarker.png0.93KB0.44KB▼ 52.90%