10% open-badge-factory

Code Review | Open Badge Factory

WordPress plugin Open Badge Factory scored10%from 54 tests.

About plugin

  • Plugin page: open-badge-factory
  • Plugin version: 1.4.7.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-4.5.2
  • WordPress version: 6.3.1
  • First release: Nov 4, 2015
  • Latest release: Jun 6, 2016
  • Number of updates: 19
  • Update frequency: every 11.6 days
  • Top authors: openbadgefactory (94.74%)leovainio (10.53%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,904 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
It is recommended to fix the following installer errors
  • This plugin did not install gracefully
    • > 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: ▼0.70MB] [CPU: ▼34.20ms] Passed 4 tests

This is a short check of server-side resources used by Open Badge Factory
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.25 ▼0.2221.07 ▼28.01
Dashboard /wp-admin3.32 ▲0.0225.10 ▼23.00
Posts /wp-admin/edit.php3.32 ▼0.0325.21 ▼21.26
Add New Post /wp-admin/post-new.php3.32 ▼2.5725.10 ▼64.51
Media Library /wp-admin/upload.php3.32 ▲0.0922.55 ▼14.49
Settings /wp-admin/admin.php?page=badgeos_settings3.3223.23
Connection Types /wp-admin/tools.php?page=connection-types3.3223.00
Badges /wp-admin/edit.php?post_type=badge3.3223.62
OBF Integration /wp-admin/admin.php?page=badgeos_sub_obf_integration3.3223.31
Log Entries /wp-admin/edit.php?post_type=badgeos-log-entry3.3223.01
Nominations /wp-admin/edit.php?post_type=nomination3.3222.95
Add-Ons /wp-admin/options.php?page=badgeos_sub_add_ons3.3223.63
Help / Support /wp-admin/admin.php?page=badgeos_sub_help_support3.3221.04
Submissions /wp-admin/edit.php?post_type=submission3.3225.34
Achievement Types /wp-admin/edit.php?post_type=achievement-type3.3221.98

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 415 new files
Database: 2 new tables, 13 new options
New tables
wp_p2pmeta
wp_p2p
New WordPress options
can_compress_scripts
obf_settings
widget_theysaidso_widget
widget_credly_credit_issuer_widget
badgeos_settings
widget_earned_user_achievements_widget
widget_recent-posts
p2p_storage
db_upgraded
credly_settings
...

Browser metrics Passed 4 tests

An overview of browser requirements for Open Badge Factory
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,238 ▲1,46716.63 ▲2.247.57 ▲5.3340.90 ▼3.00
Dashboard /wp-admin3,476 ▲1,2916.77 ▲0.83149.01 ▲32.97104.74 ▲61.78
Posts /wp-admin/edit.php3,392 ▲1,3034.47 ▲2.4672.35 ▲35.4080.55 ▲44.82
Add New Post /wp-admin/post-new.php2,484 ▲95623.98 ▲0.58641.43 ▼27.39199.66 ▲142.33
Media Library /wp-admin/upload.php2,566 ▲1,1755.58 ▲1.33108.89 ▲7.5559.23 ▲15.77
Settings /wp-admin/admin.php?page=badgeos_settings2,4084.0966.1076.06
Connection Types /wp-admin/tools.php?page=connection-types2,1303.9769.1479.93
Badges /wp-admin/edit.php?post_type=badge2,3984.3670.7180.82
OBF Integration /wp-admin/admin.php?page=badgeos_sub_obf_integration2,2814.1065.5377.24
Log Entries /wp-admin/edit.php?post_type=badgeos-log-entry3,0164.3172.8175.05
Nominations /wp-admin/edit.php?post_type=nomination2,3904.3768.4970.27
Add-Ons /wp-admin/options.php?page=badgeos_sub_add_ons2,0893.9864.6471.65
Help / Support /wp-admin/admin.php?page=badgeos_sub_help_support2,6764.0967.3899.36
Submissions /wp-admin/edit.php?post_type=submission2,4114.2870.8379.36
Achievement Types /wp-admin/edit.php?post_type=achievement-type2,9024.4375.6559.97

Uninstaller [IO: ▲0.05MB] [DB: ▲0.01MB] 25% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-content/plugins/open-badge-factory/includes/cmb/init.php+755
    count(): Parameter must be an array or an object that implements Countable
  • The plugin did not uninstall successfully, leaving 2 tables in the database
    • wp_p2pmeta
    • wp_p2p
  • This plugin does not fully uninstall, leaving 13 options in the database
    • p2p_storage
    • widget_recent-comments
    • obf_settings
    • widget_p2p
    • widget_theysaidso_widget
    • widget_credly_credit_issuer_widget
    • widget_earned_user_achievements_widget
    • can_compress_scripts
    • widget_recent-posts
    • credly_settings
    • ...

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 75 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=achievement-type
    • > POST request to /wp-admin/admin-ajax.php
    • > Warning in wp-content/plugins/open-badge-factory/includes/obf_svg_support.php+72
    count(): Parameter must be an array or an object that implements Countable
  • 10 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=achievement-type
    • > User deprecated in wp-includes/functions.php+5828
    Hook contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.
    • > GET request to /wp-admin/tools.php?page=connection-types
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/tools.php?page=connection-types
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 159× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Stream\\StreamInterface' not found in wp-content/plugins/open-badge-factory/vendor/guzzlehttp/streams/src/Stream.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/open-badge-factory/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function scb_register_table() in wp-content/plugins/open-badge-factory/includes/p2p/p2p-core/storage.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Side_Post' not found in wp-content/plugins/open-badge-factory/includes/p2p/p2p-core/side-attachment.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Event\\SubscriberInterface' not found in wp-content/plugins/open-badge-factory/vendor/guzzlehttp/guzzle/src/Subscriber/Prepare.php:24
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Stream\\StreamInterface' not found in wp-content/plugins/open-badge-factory/vendor/guzzlehttp/streams/src/LimitStream.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'React\\Promise\\ExtendedPromiseInterface' not found in wp-content/plugins/open-badge-factory/vendor/react/promise/src/FulfilledPromise.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Stream\\StreamInterface' not found in wp-content/plugins/open-badge-factory/vendor/guzzlehttp/streams/src/CachingStream.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Factory' not found in wp-content/plugins/open-badge-factory/includes/p2p/p2p-admin/dropdown-factory.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Ring\\Future\\CompletedFutureValue' not found in wp-content/plugins/open-badge-factory/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureArray.php:7

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=badgeos_sub_help_support
    • > Network (severe)
    wp-content/plugins/open-badge-factory//doc/install/generated_api_key.png - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=badgeos_sub_help_support
    • > Network (severe)
    wp-content/plugins/open-badge-factory//doc/install/wp_plugin_steps.png - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Tags: Too many tags (14 tag instead of maximum 10); only the first 5 tags are used in your directory listing
Please take inspiration from this readme.txt

open-badge-factory/open-badge-factory.php 85% from 13 tests

The main PHP script in "Open Badge Factory" version 1.4.7.5 is automatically included on every request by WordPress
The following require your attention:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Description: Please don't use more than 140 characters for the plugin description (currently 260 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin43,166 lines of code in 350 files:
LanguageFilesBlank linesComment linesLines of code
PHP2556,61211,24224,991
JavaScript191,5521,7065,893
PO File51,6222,5054,313
Markdown871202,736
reStructuredText191,2221,5702,029
CSS10219591,901
JSON600363
make57810333
CoffeeScript11276306
HTML1270110
YAML418079
XML42071
Python210041

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity12.30
▷ Minimum class complexity1.00
▷ Maximum class complexity177.00
Average method complexity2.61
▷ Minimum method complexity1.00
▷ Maximum method complexity43.00
Code structure
Namespaces15
Interfaces26
Traits6
Classes184
▷ Abstract classes168.70%
▷ Concrete classes16891.30%
▷ Final classes21.19%
Methods1,606
▷ Static methods27717.25%
▷ Public methods1,32682.57%
▷ Protected methods1056.54%
▷ Private methods17510.90%
Functions459
▷ Named functions38383.44%
▷ Anonymous functions7616.56%
Constants28
▷ Global constants621.43%
▷ Class constants2278.57%
▷ Public constants22100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
34 PNG files occupy 0.53MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/badgeos_icon.png1.62KB0.70KB▼ 56.70%
includes/p2p/p2p-admin/images/plus.png0.12KB0.12KB▼ 1.57%
images/arrows.png1.71KB0.91KB▼ 46.81%
js/select2/select2x2.png0.83KB0.77KB▼ 6.15%
includes/cmb/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%