78% order-approval-with-attachment

Code Review | Order Approval with Attachment

WordPress plugin Order Approval with Attachment scored78%from 54 tests.

About plugin

  • Plugin page: order-approval-wi...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-5.7
  • WordPress version: 6.3.1
  • First release: May 26, 2021
  • Latest release: May 26, 2021
  • Number of updates: 5
  • Update frequency: every 0.8 days
  • Top authors: sarankumar (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /386 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼4.00ms] Passed 4 tests

This is a short check of server-side resources used by Order Approval with Attachment
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0432.18 ▼9.06
Dashboard /wp-admin3.34 ▲0.0445.07 ▼2.40
Posts /wp-admin/edit.php3.39 ▲0.0445.70 ▼1.71
Add New Post /wp-admin/post-new.php5.92 ▲0.0488.84 ▼0.57
Media Library /wp-admin/upload.php3.26 ▲0.0433.41 ▼2.82

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 44 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Order Approval with Attachment
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲4314.44 ▼0.311.94 ▼0.4744.24 ▼1.25
Dashboard /wp-admin2,209 ▲215.85 ▼0.03109.17 ▼8.7340.37 ▼9.36
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0339.49 ▲2.8538.11 ▲5.54
Add New Post /wp-admin/post-new.php1,541 ▲823.36 ▲0.18628.58 ▼47.0266.77 ▲7.22
Media Library /wp-admin/upload.php1,388 ▼04.22 ▼0.0193.18 ▼21.3843.31 ▼4.09

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

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

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/order-approval-with-attachment/admin/partials/sg-woocommerce-order-approval-with-attachment-admin-display.php
    • > /wp-content/plugins/order-approval-with-attachment/public/partials/sg-woocommerce-order-approval-with-attachment-public-display.php
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/order-approval-with-attachment/includes/class-sg-order-approval-woocommerce-pro-payment-gateway.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Email' not found in wp-content/plugins/order-approval-with-attachment/includes/class-sg-order-approval-woocommerce-pro-wc-admin-order.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Email' not found in wp-content/plugins/order-approval-with-attachment/includes/class-sg-order-approval-woocommerce-pro-wc-customer-order.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/order-approval-with-attachment/includes/class-sg-order-approval-woocommerce-pro-wc_email.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Email' not found in wp-content/plugins/order-approval-with-attachment/includes/class-sg-order-approval-woocommerce-pro-wc-customer-order-approved.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Email' not found in wp-content/plugins/order-approval-with-attachment/includes/class-sg-order-approval-woocommerce-pro-wc-customer-order-rejected.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
2 plugin tags: order, order-with-attachment

order-approval-with-attachment/order-approval-with-attachment.php 85% from 13 tests

This is the main PHP file of "Order Approval with Attachment" version 1.0.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("3.0" instead of "3.7")
  • Description: The description should be shorter than 140 characters (currently 142 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected2,978 lines of code in 35 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript5117151,332
PHP264501,0361,180
CSS48139466

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity8.92
▷ Minimum class complexity1.00
▷ Maximum class complexity43.00
Average method complexity2.36
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes00.00%
Methods76
▷ Static methods22.63%
▷ Public methods7193.42%
▷ Protected methods00.00%
▷ Private methods56.58%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 compressed PNG files occupy 0.01MB
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/css/chosen-sprite.png0.53KB0.88KB0.00%
admin/css/chosen-sprite@2x.png0.72KB0.83KB0.00%
public/img/file_upload.png8.60KB8.56KB0.47%