82% easy-settings-for-learndash

Code Review | Easy Settings for LearnDash

WordPress plugin Easy Settings for LearnDash scored 82% from 54 tests.

About plugin

  • Plugin page: easy-settings-for...
  • Plugin version: 1.3.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9
  • WordPress version: 5.9.2
  • First release: Aug 30, 2021
  • Latest release: Mar 18, 2022
  • Number of updates: 19
  • Update frequency: every 10.6 days
  • Top authors: maurolopes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active / 603 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▼0.02MB] [CPU: ▼315.12ms] Passed 4 tests

A check of server-side resources used by Easy Settings for LearnDash
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0153.28 ▼3.55
Dashboard /wp-admin3.41 ▲0.0033.40 ▲0.92
Posts /wp-admin/edit.php3.65 ▲0.0036.22 ▲0.24
Add New Post /wp-admin/post-new.php6.89 ▼0.0992.40 ▼1,257.63
Media Library /wp-admin/upload.php3.30 ▲0.0024.10 ▲0.48
Easy Settings /wp-admin/admin.php?page=learndash-easy-settings3.1017.06

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 189 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Easy Settings for LearnDash
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,763 ▲916.13 ▲0.365.67 ▼0.822.45 ▲0.18
Dashboard /wp-admin2,895 ▲376.17 ▼0.10124.22 ▼10.79159.19 ▲0.80
Posts /wp-admin/edit.php2,691 ▼33.24 ▼0.0164.95 ▲4.67140.00 ▲3.07
Add New Post /wp-admin/post-new.php1,752 ▲9121.29 ▲5.73451.24 ▲12.72158.16 ▲6.85
Media Library /wp-admin/upload.php1,698 ▲65.47 ▼0.06143.77 ▲0.54183.36 ▼10.13
Easy Settings /wp-admin/admin.php?page=learndash-easy-settings280.940.0416.70

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Uninstall script ran successfully

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)
Even though everything seems fine, this is not 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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/easy-settings-for-learndash/admin/ld-easy-settings-editor.php
    • > /wp-content/plugins/easy-settings-for-learndash/freemius/templates/ajax-loader.php
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/easy-settings-for-learndash/admin/ld-easy-settings.php on line 3
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/easy-settings-for-learndash/freemius/templates/account/partials/addon.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function freemius() in wp-content/plugins/easy-settings-for-learndash/freemius/templates/partials/network-activation.php:6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/easy-settings-for-learndash/freemius/templates/account/partials/addon.php on line 6
    • > PHP Warning
      Use of undefined constant LD_EASY_SETTINGS_ITEMS_EDITORS - assumed 'LD_EASY_SETTINGS_ITEMS_EDITORS' (this will throw an Error in a future version of PHP) in wp-content/plugins/easy-settings-for-learndash/admin/ld-easy-settings-editor.php on line 3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/easy-settings-for-learndash/freemius/templates/account/partials/addon.php on line 8
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/easy-settings-for-learndash/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/easy-settings-for-learndash/includes/filters.php:3
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/easy-settings-for-learndash/freemius/templates/account/partials/addon.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/easy-settings-for-learndash/admin/ld-easy-settings-defaults.php:2

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=learndash-easy-settings
    • > Network (severe)
    wp-admin/admin.php?page=learndash-easy-settings - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 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
5 plugin tags: lms, learning, learndash, education, elearning

easy-settings-for-learndash/learndash-easy-settings.php 85% from 13 tests

The principal PHP file in "Easy Settings for LearnDash" v. 1.3.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("easy-settings-for-learndash.php" instead of "learndash-easy-settings.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin39,121 lines of code in 145 files:
LanguageFilesBlank linesComment linesLines of code
PHP1157,42216,17131,914
JSON7404,550
JavaScript71501631,412
CSS1413062683
PO File1157162348
Markdown1680214

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 2,907)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity90.20
▷ Minimum class complexity1.00
▷ Maximum class complexity2,907.00
Average method complexity4.65
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes45
▷ Abstract classes24.44%
▷ Concrete classes4395.56%
▷ Final classes00.00%
Methods1,132
▷ Static methods17315.28%
▷ Public methods79269.96%
▷ Protected methods151.33%
▷ Private methods32528.71%
Functions155
▷ Named functions15499.35%
▷ Anonymous functions10.65%
Constants133
▷ Global constants10881.20%
▷ Class constants2518.80%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
freemius/assets/img/easy-settings-for-learndash.png3.15KB2.85KB▼ 9.48%