68% cardznet

Code Review | CardzNet - Multiplayer Card Games

WordPress plugin CardzNet - Multiplayer Card Games scored68%from 54 tests.

About plugin

  • Plugin page: cardznet
  • Plugin version: 2.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Nov 25, 2020
  • Latest release: Oct 13, 2023
  • Number of updates: 22
  • Update frequency: every 47.9 days
  • Top authors: Malcolm-OPH (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,804 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲1.03MB] [CPU: ▲153.39ms] Passed 4 tests

This is a short check of server-side resources used by CardzNet - Multiplayer Card Games
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.63 ▲1.16190.11 ▲150.35
Dashboard /wp-admin4.33 ▲1.03189.52 ▲142.31
Posts /wp-admin/edit.php4.38 ▲1.03210.14 ▲166.09
Add New Post /wp-admin/post-new.php6.93 ▲1.05245.04 ▲154.79
Media Library /wp-admin/upload.php4.25 ▲1.02442.07 ▲409.75
Games /wp-admin/admin.php?page=wpcardznet_games4.23206.36
Overview /wp-admin/admin.php?page=wpcardznet_adminmenu4.23176.66
Groups /wp-admin/admin.php?page=wpcardznet_groups4.23189.41
Settings /wp-admin/admin.php?page=wpcardznet_settings4.23173.12

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 114 new files
Database: 10 new tables, 6 new options
New tables
wp_cardznet_games
wp_cardznet_settings
wp_cardznet_hands
wp_cardznet_groups
wp_cardznet_members
wp_cardznet_players
wp_cardznet_rounds
wp_cardznet_tricks
wp_cardznet_invites
wp_cardznet_sessions
New WordPress options
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for CardzNet - Multiplayer Card Games
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,969 ▲20813.47 ▼0.897.64 ▲6.0835.50 ▼4.35
Dashboard /wp-admin2,242 ▲655.60 ▼0.0180.89 ▼2.8139.03 ▼5.36
Posts /wp-admin/edit.php2,150 ▲501.98 ▲0.0239.12 ▲1.8735.48 ▲0.84
Add New Post /wp-admin/post-new.php1,723 ▲19522.43 ▼0.44605.00 ▼50.1358.29 ▼17.15
Media Library /wp-admin/upload.php1,450 ▲534.17 ▼0.03102.10 ▲1.3045.49 ▲0.77
Games /wp-admin/admin.php?page=wpcardznet_games8352.1727.2428.21
Overview /wp-admin/admin.php?page=wpcardznet_adminmenu8142.1824.3823.60
Groups /wp-admin/admin.php?page=wpcardznet_groups8142.1823.7225.48
Settings /wp-admin/admin.php?page=wpcardznet_settings1,4051.6826.0232.86

Uninstaller [IO: ▲0.23MB] [DB: ▲0.01MB] 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
  • Zombie tables detected upon uninstall: 10 tables
    • wp_cardznet_rounds
    • wp_cardznet_groups
    • wp_cardznet_tricks
    • wp_cardznet_players
    • wp_cardznet_hands
    • wp_cardznet_games
    • wp_cardznet_members
    • wp_cardznet_settings
    • wp_cardznet_invites
    • wp_cardznet_sessions
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpcardznet_settings
    • > Warning in wp-content/plugins/cardznet/include/wpcardznetlib_dbase_api.php+1598
    session_start(): Cannot start session when headers already sent
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpcardznet_games
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 91× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      include(): Failed opening 'WPCARDZNETLIB_INCLUDE_PATHwpcardznet_tabletop.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/cardznet/games/wpcardznet_whist.php on line 22
    • > PHP Warning
      include(): Failed opening 'WPCARDZNETLIB_INCLUDE_PATHwpcardznet_tabletop.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/cardznet/games/wpcardznet_rummy.php on line 22
    • > PHP Warning
      Use of undefined constant WPCARDZNET_GAMES_PATH - assumed 'WPCARDZNET_GAMES_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cardznet/games/wpcardznet_hearts.php on line 22
    • > PHP Fatal error
      require_once(): Failed opening required 'WPCARDZNET_INCLUDE_PATHwpcardznetlib_adminlist.php' (include_path='.:/usr/share/php') in wp-content/plugins/cardznet/admin/wpcardznet_manage_settings.php on line 23
    • > PHP Warning
      Use of undefined constant WPCARDZNET_INCLUDE_PATH - assumed 'WPCARDZNET_INCLUDE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cardznet/admin/wpcardznet_manage_groups.php on line 23
    • > PHP Fatal error
      Uncaught Error: Class 'WPCardzNetLibDBaseClass' not found in wp-content/plugins/cardznet/include/wpcardznet_dbase_api.php:62
    • > PHP Fatal error
      Uncaught Error: Class 'WPCardzNetLibUtilsClass' not found in wp-content/plugins/cardznet/test/wpcardznetlib_testbase.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'WPCardzNetCardsClass' not found in wp-content/plugins/cardznet/games/wpcardznet_whist.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'WPCardzNetLibTableClass' not found in wp-content/plugins/cardznet/include/wpcardznetlib_adminlist.php:27
    • > PHP Warning
      Use of undefined constant WPCARDZNET_INCLUDE_PATH - assumed 'WPCARDZNET_INCLUDE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cardznet/admin/wpcardznet_debug.php on line 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)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
The official readme.txt might help

cardznet/wpcardznet.php 92% from 13 tests

The main PHP file in "CardzNet - Multiplayer Card Games" ver. 2.5.1 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("cardznet.php" instead of "wpcardznet.php")

Code Analysis Passed 3 tests

File types Passed 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
No dangerous file extensions were detected19,492 lines of code in 63 files:
LanguageFilesBlank linesComment linesLines of code
PHP423,9182,20214,107
JavaScript109455563,589
CSS103162351,742
XML10054

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity38.27
▷ Minimum class complexity1.00
▷ Maximum class complexity271.00
Average method complexity3.24
▷ Minimum method complexity1.00
▷ Maximum method complexity73.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes52
▷ Abstract classes00.00%
▷ Concrete classes52100.00%
▷ Final classes00.00%
Methods867
▷ Static methods12314.19%
▷ Public methods86599.77%
▷ Protected methods00.00%
▷ Private methods20.23%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants277
▷ Global constants17262.09%
▷ Class constants10537.91%
▷ Public constants105100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
28 PNG files occupy 1.51MB with 0.88MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
games/images/goout.png10.87KB0.59KB▼ 94.58%
images/swop.png0.89KB0.80KB▼ 9.15%
images/fullscreen.png6.64KB0.10KB▼ 98.46%
images/hearts.png3.82KB3.04KB▼ 20.56%
images/clubs.png4.42KB1.36KB▼ 69.33%