62% wp-smart-contracts

Code Review | WPSmartContracts

WordPress plugin WPSmartContracts scored 62% from 54 tests.

About plugin

  • Plugin page: wp-smart-contracts
  • Plugin version: 1.3.5
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.9.2
  • WordPress version: 5.9.2
  • First release: Jun 18, 2019
  • Latest release: Apr 2, 2022
  • Number of updates: 68
  • Update frequency: every 15.0 days
  • Top authors: wpsmartcontracts (100%)

Code review

54 tests

User reviews

21 reviews

Install metrics

1,000+ active / 27,681 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲3.21MB] [CPU: ▼269.44ms] Passed 4 tests

Analyzing server-side resources used by WPSmartContracts
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.84 ▲2.3292.04 ▲21.97
Dashboard /wp-admin7.88 ▲4.47123.44 ▲79.35
Posts /wp-admin/edit.php8.01 ▲4.36122.24 ▲52.18
Add New Post /wp-admin/post-new.php8.64 ▲1.67105.74 ▼1,230.18
Media Library /wp-admin/upload.php7.89 ▲4.60120.37 ▲78.27
Add New NFT /wp-admin/post-new.php?post_type=nft8.24162.98
Add New Collection /wp-admin/post-new.php?post_type=nft-collection8.90174.51
All Coins /wp-admin/edit.php?post_type=coin8.03107.42
Batch Mint NFTs /wp-admin/edit.php?post_type=nft&page=nft-batch-mint7.88116.89
Taxonomies /wp-admin/edit-tags.php?taxonomy=nft-taxonomy&post_type=nft7.90124.12
Add New /wp-admin/post-new.php?post_type=crowdfunding8.24154.70
Add New /wp-admin/post-new.php?post_type=coin8.24149.58
Add New Stake /wp-admin/post-new.php?post_type=staking8.24154.79
Create Smart Contract /wp-admin/admin.php?page=wpsc_dashboard_menu8.20111.83
All Crowdfundings /wp-admin/edit.php?post_type=crowdfunding8.03104.38

Server storage [IO: ▲74.60MB] [DB: ▲0.04MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • Total filesystem usage should be limited to 25MB (currently using 74.60MB)
Filesystem: 1,318 new files
Database: no new tables, 5 new options
New WordPress options
NFT_permalinks_flushed
wpsc_onetime_notice_1
coin_permalinks_flushed
crowdfunding_permalinks_flushed
Staking_permalinks_flushed

Browser metrics Passed 4 tests

Checking browser requirements for WPSmartContracts
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,626 ▲87224.86 ▲9.8025.73 ▲14.823.86 ▲0.43
Dashboard /wp-admin3,540 ▲65513.74 ▲7.30670.42 ▲443.70244.80 ▲16.37
Posts /wp-admin/edit.php3,459 ▲77410.43 ▲7.01172.22 ▲44.25215.38 ▼27.04
Add New Post /wp-admin/post-new.php2,148 ▲48127.32 ▲7.57780.14 ▲59.03200.38 ▼20.35
Media Library /wp-admin/upload.php2,615 ▲92312.61 ▲6.89276.93 ▲93.05273.55 ▲23.33
Add New NFT /wp-admin/post-new.php?post_type=nft5,23317.82381.17480.74
Add New Collection /wp-admin/post-new.php?post_type=nft-collection8,69917.08445.89594.64
All Coins /wp-admin/edit.php?post_type=coin2,20810.18177.53195.55
Batch Mint NFTs /wp-admin/edit.php?post_type=nft&page=nft-batch-mint2,75011.56183.98331.93
Taxonomies /wp-admin/edit-tags.php?taxonomy=nft-taxonomy&post_type=nft2,24510.04163.42191.03
Add New /wp-admin/post-new.php?post_type=crowdfunding5,81715.99405.41502.51
Add New /wp-admin/post-new.php?post_type=coin6,41816.10402.07494.79
Add New Stake /wp-admin/post-new.php?post_type=staking6,16715.68368.71523.24
Create Smart Contract /wp-admin/admin.php?page=wpsc_dashboard_menu2,3009.84151.80265.64
All Crowdfundings /wp-admin/edit.php?post_type=crowdfunding2,24010.27164.74184.34

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie WordPress options were found after uninstall: 5 options
    • Staking_permalinks_flushed
    • crowdfunding_permalinks_flushed
    • wpsc_onetime_notice_1
    • NFT_permalinks_flushed
    • coin_permalinks_flushed

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)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/bin/build_bootstrap.php
  • 72× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/Loader/InlineLoaderTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/AutoloaderTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php:12
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/../vendor/yaml/lib/sfYamlParser.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/bootstrap.php on line 16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/HelperCollectionTest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/ContextTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/Source/FilesystemSourceTest.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'Mustache_Exception' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'Mustache_Loader' not found in wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php:50

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=staking
    • > Network (severe)
    http://localhost/wpsc/wp-content/plugins/wp-smart-contracts/assets/img/deploy-identicon.gif - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/post-new.php?post_type=nft-collection
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,regenerator-runtime,wp-polyfill,wp-hooks&ver=5.9.2 1:31592 "jQuery.Deferred exception: web3 is not defined" "ReferenceError: web3 is not defined\n at getNetworkVersion (/wp-content/plugins/wp-smart-contracts/assets/js/wpsc.js?ver=5.9.2:1:2898290)\n at doLoadOtherNetworks (/wp-content/plugins/wp-smart-contracts/assets/js/wpsc.js?ver=5.9.2:1:11228769)\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/wp-smart-contracts/assets/js/wpsc.js?ver=5.9.2:1:13306254)" undefined
    • > GET request to /wp-admin/post-new.php?post_type=nft-collection
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,regenerator-runtime,wp-polyfill,wp-hooks&ver=5.9.2 1:31702 Uncaught ReferenceError: web3 is not defined
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=staking
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2 1:31592 "jQuery.Deferred exception: web3 is not defined" "ReferenceError: web3 is not defined\n at getNetworkVersion (/wp-content/plugins/wp-smart-contracts/assets/js/wpsc.js?ver=5.9.2:1:2898290)\n at doLoadOtherNetworks (/wp-content/plugins/wp-smart-contracts/assets/js/wpsc.js?ver=5.9.2:1:11228769)\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/wp-smart-contracts/assets/js/wpsc.js?ver=5.9.2:1:13306254)" undefined
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=staking
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2 1:31702 Uncaught ReferenceError: web3 is not defined

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Add descriptions for screenshots #7, #8, #9 in wp-smart-contracts/assets to your readme.txt
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
You can look at the official readme.txt

wp-smart-contracts/wp-smart-contracts.php Passed 13 tests

The main PHP script in "WPSmartContracts" version 1.3.5 is automatically included on every request by WordPress
73 characters long description:
Easily create powerful Smart Contracts in a dozen of blockchain networks.

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Please make sure to remedy the following
  • For security reasons, never distribute binary or executable files with your plugin
    • .ms - Maxwell Script in Maxwell Render
      • wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/fixtures/templates/alpha.ms
      • wp-content/plugins/wp-smart-contracts/classes/vendor/mustache/mustache/test/fixtures/templates/beta.ms
205,775 lines of code in 702 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1579,42812,29282,782
CSS10011,0789,10956,799
Mustache2113,391320,783
LESS483,2613,79119,722
PHP1513,8924,14515,716
SVG163256,184
PO File21,0461,3202,806
JSON700794
Markdown5550117
HTML210029
YAML26028
XML12015

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity11.46
▷ Minimum class complexity1.00
▷ Maximum class complexity260.00
Average method complexity3.17
▷ Minimum method complexity1.00
▷ Maximum method complexity67.00
Code structure
Namespaces1
Interfaces6
Traits0
Classes147
▷ Abstract classes53.40%
▷ Concrete classes14296.60%
▷ Final classes00.00%
Methods770
▷ Static methods16621.56%
▷ Public methods67187.14%
▷ Protected methods192.47%
▷ Private methods8010.39%
Functions60
▷ Named functions915.00%
▷ Anonymous functions5185.00%
Constants68
▷ Global constants00.00%
▷ Class constants68100.00%
▷ Public constants68100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
97 PNG files occupy 14.53MB with 10.29MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/bluemoon-flavor.png7.25KB2.97KB▼ 59.07%
assets/img/icon-nft-collection-dark.png8.27KB0.91KB▼ 88.99%
assets/img/icon-nft-collection.png8.59KB0.91KB▼ 89.41%
assets/img/skin0.png394.59KB114.29KB▼ 71.04%
assets/img/heco-network.png22.92KB12.48KB▼ 45.53%