68% magic-login-api

Code Review | Magic Login API

WordPress plugin Magic Login API scored68%from 54 tests.

About plugin

  • Plugin page: magic-login-api
  • Plugin version: 1.1.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-6.0.1
  • WordPress version: 6.3.1
  • First release: Aug 6, 2022
  • Latest release: Apr 30, 2023
  • Number of updates: 7
  • Update frequency: every 40.3 days
  • Top authors: roofboard (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /458 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲4.76MB] [CPU: ▼17.77ms] Passed 4 tests

Server-side resources used by Magic Login API
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /8.75 ▲5.2945.03 ▲1.89
Dashboard /wp-admin8.77 ▲5.4645.04 ▼9.08
Posts /wp-admin/edit.php8.77 ▲5.4143.54 ▼11.36
Add New Post /wp-admin/post-new.php8.77 ▲2.8853.07 ▼52.52
Media Library /wp-admin/upload.php8.77 ▲5.5460.22 ▲22.31
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.7744.64

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 176 new files
Database: no new tables, 11 new options
New WordPress options
widget_recent-comments
magicloginapi_token_settings_options
fs_debug_mode
fs_gdpr
fs_accounts
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
fs_active_plugins
...

Browser metrics Passed 4 tests

Magic Login API: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,846 ▲8513.43 ▼0.961.87 ▲0.1827.55 ▼21.15
Dashboard /wp-admin2,252 ▲495.86 ▲0.03105.20 ▼8.6762.82 ▲14.38
Posts /wp-admin/edit.php2,135 ▲321.99 ▼0.0137.41 ▼9.5543.81 ▲0.63
Add New Post /wp-admin/post-new.php1,696 ▲14221.82 ▲3.59757.56 ▲125.2575.34 ▲19.84
Media Library /wp-admin/upload.php1,431 ▲314.17 ▼0.0499.28 ▼8.9982.78 ▲39.09
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,0811.7029.3229.33

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function register_rest_route was called incorrectly. REST API routes must be registered on the rest_api_init action. Please see Debugging in WordPress for more information. (This message was added in version 5.1.0.)
  • This plugin did not uninstall successfully, leaving 11 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • fs_gdpr
    • fs_active_plugins
    • magicloginapi_token_settings_options
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • fs_accounts
    • fs_debug_mode
    • ...

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=freemius
    • > User notice in wp-includes/functions.php+5905
    Function register_rest_route was called incorrectly. REST API routes must be registered on the rest_api_init action. Please see Debugging in WordPress for more information. (This message was added in version 5.1.0.)
    • > GET request to /wp-admin/admin.php?page=freemius
    • > User notice in wp-includes/functions.php+5905
    Function register_rest_route was called incorrectly. The REST API route definition for magicloginapi/v1/get-token is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.)

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
Please fix the following items
  • 7× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      require_once(): Failed opening required 'MAGICLOGINAPI_PATHadmin/core/start.php' (include_path='.:/usr/share/php') in wp-content/plugins/magic-login-api/lib/core.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-login-api/admin/admin-setting.php:162
    • > PHP Fatal error
      Uncaught Error: Class 'MagicLoginAPI' not found in wp-content/plugins/magic-login-api/lib/class-magicloginapi.php:3
    • > PHP Warning
      Use of undefined constant MAGICLOGINAPI_PATH - assumed 'MAGICLOGINAPI_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/magic-login-api/lib/core.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/magic-login-api/magicloginmail.php:40
    • > PHP Warning
      require_once(MAGICLOGINAPI_PATHadmin/core/start.php): failed to open stream: No such file or directory in wp-content/plugins/magic-login-api/lib/core.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-login-api/lib/class-magicloginmail.php:38

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: magic, login, api, email, passwordless

magic-login-api/magicloginmail.php 85% from 13 tests

Analyzing the main PHP file in "Magic Login API" version 1.1.2
You should first fix the following items:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, 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 ("magic-login-api.php" instead of "magicloginmail.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin31,820 lines of code in 129 files:
LanguageFilesBlank linesComment linesLines of code
PHP1137,40816,32431,371
Markdown1680214
JavaScript33459194
JSON10027
CSS110014

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity88.02
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity4.65
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes47
▷ Abstract classes24.26%
▷ Concrete classes4595.74%
▷ Final classes00.00%
Methods1,150
▷ Static methods17315.04%
▷ Public methods80269.74%
▷ Protected methods151.30%
▷ Private methods33328.96%
Functions114
▷ Named functions11298.25%
▷ Anonymous functions21.75%
Constants124
▷ Global constants9979.84%
▷ Class constants2520.16%
▷ Public constants25100.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
5 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/core/assets/img/plugin-icon.png2.64KB2.49KB▼ 5.55%
admin/core/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
admin/core/assets/img/magic-login-icon.png2.64KB2.49KB▼ 5.55%
admin/core/assets/img/magic-login-icon_36.png0.80KB0.79KB▼ 1.33%
admin/core/assets/img/magic-login-api.png2.64KB2.49KB▼ 5.55%