57% 3d-printing-quote-calculator-by-phanes

Code Review | Phanes 3DP Calculator - Legacy

WordPress plugin Phanes 3DP Calculator - Legacy scored 57% from 54 tests.

About plugin

  • Plugin page: 3d-printing-quote...
  • Plugin version: 1.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.5.3
  • WordPress version: 6.3.1
  • First release: Feb 17, 2017
  • Latest release: Jan 16, 2021
  • Number of updates: 78
  • Update frequency: every 18.4 days
  • Top authors: phanesco (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

20+ active / 3,647 total downloads

Benchmarks

Plugin footprint 65% 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.87MB] [CPU: ▲11.61ms] Passed 4 tests

Server-side resources used by Phanes 3DP Calculator - Legacy
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.09 ▲0.6356.26 ▲16.02
Dashboard /wp-admin4.30 ▲1.0054.59 ▲6.83
Posts /wp-admin/edit.php4.35 ▲1.0058.64 ▲11.33
Add New Post /wp-admin/post-new.php6.82 ▲0.93108.54 ▲19.83
Media Library /wp-admin/upload.php4.16 ▲0.9347.56 ▲12.25
Settings /wp-admin/admin.php?page=pqc-settings-page4.1442.95
/wp-admin/admin.php?page=pqc-about4.1342.07
Orders /wp-admin/edit.php?post_type=pqc_order4.2748.24
Coupons /wp-admin/edit.php?post_type=pqc_coupon4.2745.80
/wp-admin/admin.php?page=pqc-start4.1345.89
License code /wp-admin/admin.php?page=pqc-license-page4.1341.90
Materials /wp-admin/admin.php?page=pqc-materials-page4.1546.08
Shipping Options /wp-admin/edit.php?post_type=pqc_shipping_option4.2742.60

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 200 new files
Database: 2 new tables, 10 new options
New tables
wp_pqc_data
wp_pqc_materials
New WordPress options
widget_recent-posts
db_upgraded
pqc-options
widget_recent-comments
pqc-version
pqc-license
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
pqc-rewrite-flush

Browser metrics Passed 4 tests

Phanes 3DP Calculator - Legacy: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,086 ▲35114.76 ▲0.1024.67 ▲22.8341.04 ▼3.15
Dashboard /wp-admin2,293 ▲1045.86 ▲0.00101.93 ▼19.6279.04 ▲30.03
Posts /wp-admin/edit.php2,190 ▲982.16 ▲0.1140.44 ▲3.8036.42 ▲4.58
Add New Post /wp-admin/post-new.php1,674 ▲14022.41 ▼0.75639.01 ▼25.12193.70 ▲140.50
Media Library /wp-admin/upload.php1,484 ▲994.29 ▲0.0898.07 ▼0.4179.09 ▲30.22
Settings /wp-admin/admin.php?page=pqc-settings-page1,2022.6839.7637.13
/wp-admin/admin.php?page=pqc-about8862.5835.0059.01
Orders /wp-admin/edit.php?post_type=pqc_order1,2192.9040.7431.04
Coupons /wp-admin/edit.php?post_type=pqc_coupon1,2282.9141.9733.34
/wp-admin/admin.php?page=pqc-start9692.5736.1141.80
License code /wp-admin/admin.php?page=pqc-license-page9292.7135.8633.86
Materials /wp-admin/admin.php?page=pqc-materials-page1,5272.7238.4645.29
Shipping Options /wp-admin/edit.php?post_type=pqc_shipping_option1,1872.8739.5328.48

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 2 tables in the database
    • wp_pqc_data
    • wp_pqc_materials
  • Zombie WordPress options were found after uninstall: 10 options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • pqc-options
    • theysaidso_admin_options
    • pqc-rewrite-flush
    • db_upgraded
    • pqc-license
    • pqc-version

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
Even though no errors were found, this is by no means 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
Almost there! Just fix the following items
  • 3× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/frontend.php
    • > /wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/build.php
    • > /wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/backend.php
  • 110× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/3d-printing-quote-calculator-by-phanes/templates/cart.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function PQC() in wp-content/plugins/3d-printing-quote-calculator-by-phanes/templates/frontend/widget.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/tests/SourceTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/lib/BalanceTransaction.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/tests/ProductTest.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/3d-printing-quote-calculator-by-phanes/admin/templates/welcome/footer.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/lib/Coupon.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/lib/Order.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/lib/ApplicationFee.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/lib/Plan.php:23

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 79% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes:
  • Screenshots: Add descriptions for screenshots #1, #10, #11, #12, #13, #14, #15, #2, #3, #4, #5, #6, #7, #8, #9 in 3d-printing-quote-calculator-by-phanes/assets to your readme.txt
  • Tags: Too many tags (19 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

3d-printing-quote-calculator-by-phanes/init.php 69% from 13 tests

Analyzing the main PHP file in "Phanes 3DP Calculator - Legacy" version 1.1.2
It is important to fix the following:
  • Domain Path: The domain path is invalid: folder "/i18n/languages/" does not exist
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("3d-printing-quote-calculator-by-phanes.php" instead of "init.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 169 characters long)

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Almost there! Just fix the following issues
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/3d-printing-quote-calculator-by-phanes/core/lib/stripe/data/ca-certificates.crt
21,393 lines of code in 166 files:
LanguageFilesBlank linesComment linesLines of code
PHP1393,6862,96011,622
JavaScript129759415,042
SVG2002,695
CSS5204561,618
Markdown32290332
JSON10036
XML20030
YAML23018

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity9.34
▷ Minimum class complexity1.00
▷ Maximum class complexity253.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces5
Interfaces3
Traits0
Classes111
▷ Abstract classes54.50%
▷ Concrete classes10695.50%
▷ Final classes65.66%
Methods627
▷ Static methods15725.04%
▷ Public methods54386.60%
▷ Protected methods233.67%
▷ Private methods619.73%
Functions33
▷ Named functions2781.82%
▷ Anonymous functions618.18%
Constants37
▷ Global constants2670.27%
▷ Class constants1129.73%
▷ Public constants11100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
16 PNG files occupy 0.08MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/badge.png0.22KB0.22KB▼ 1.78%
assets/images/paypal.png6.94KB5.33KB▼ 23.25%
assets/images/clear-cart.png0.68KB0.69KB0.00%
assets/images/stripe.png37.38KB11.46KB▼ 69.35%
assets/images/delete.png0.55KB0.30KB▼ 45.00%