84% magic-fields-2-toolkit

Code Review | Magic Fields 2 Toolkit

WordPress plugin Magic Fields 2 Toolkit scored84%from 54 tests.

About plugin

  • Plugin page: magic-fields-2-to...
  • Plugin version: 1.2.1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-4.2
  • WordPress version: 6.3.1
  • First release: Mar 22, 2013
  • Latest release: Nov 15, 2015
  • Number of updates: 91
  • Update frequency: every 10.6 days
  • Top authors: Magenta Cuda (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

30+ active /6,281 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.16MB] [CPU: ▼3.58ms] Passed 4 tests

This is a short check of server-side resources used by Magic Fields 2 Toolkit
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1641.32 ▲1.86
Dashboard /wp-admin3.46 ▲0.1652.38 ▲0.70
Posts /wp-admin/edit.php3.58 ▲0.2250.93 ▲1.28
Add New Post /wp-admin/post-new.php6.06 ▲0.1888.16 ▼18.15
Media Library /wp-admin/upload.php3.38 ▲0.1641.49 ▲5.13

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 120 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Magic Fields 2 Toolkit
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲3914.28 ▼0.271.63 ▲0.0634.24 ▼10.12
Dashboard /wp-admin2,203 ▲295.62 ▲0.0985.15 ▼8.8341.80 ▼3.40
Posts /wp-admin/edit.php2,106 ▲61.99 ▼0.0340.65 ▲1.7836.80 ▼0.10
Add New Post /wp-admin/post-new.php1,534 ▲623.11 ▼0.26627.07 ▼77.5134.26 ▼33.02
Media Library /wp-admin/upload.php1,402 ▼14.21 ▲0.0296.08 ▼11.9343.81 ▼4.51

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 75% 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 50% 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
  • 29× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/magic-fields-2-toolkit/magic-fields-2-dumb-macros.php on line 28
    • > PHP Warning
      require_once(WP_PLUGIN_DIR/magic-fields-2-toolkit/alt_media_field.php): failed to open stream: No such file or directory in wp-content/plugins/magic-fields-2-toolkit/alt_video_field/alt_video_field.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-fields-2-toolkit/magic-fields-2-toolkit.php:24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-fields-2-toolkit/magic-fields-2-clean-files_mf.php:23
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/magic-fields-2-toolkit/magic-fields-2-dumb-macros.php on line 28
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/magic-fields-2-toolkit/magic-fields-2-search-by-custom-field-kai.php:24
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/magic-fields-2-toolkit/magic-fields-2-dumb-macros.php on line 28
    • > PHP Fatal error
      Uncaught Error: Class 'mf_custom_fields' not found in wp-content/plugins/magic-fields-2-toolkit/alt_embed_field/alt_embed_field.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'mf_custom_fields' not found in wp-content/plugins/magic-fields-2-toolkit/alt_url_field/alt_url_field.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'mf_custom_fields' not found in wp-content/plugins/magic-fields-2-toolkit/alt_dropdown_field/alt_dropdown_field.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Donate link: Invalid url: ""
The official readme.txt is a good inspiration

magic-fields-2-toolkit/magic-fields-2-toolkit-loader.php 92% from 13 tests

"Magic Fields 2 Toolkit" version 1.2.1.2.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("magic-fields-2-toolkit.php" instead of "magic-fields-2-toolkit-loader.php")

Code Analysis Passed 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 plugin7,795 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
PHP254747336,555
JavaScript52578732
CSS1110229508

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity28.22
▷ Minimum class complexity1.00
▷ Maximum class complexity155.00
Average method complexity5.43
▷ Minimum method complexity1.00
▷ Maximum method complexity45.00
Code structure
Namespaces2
Interfaces0
Traits1
Classes16
▷ Abstract classes16.25%
▷ Concrete classes1593.75%
▷ Final classes00.00%
Methods66
▷ Static methods2334.85%
▷ Public methods6496.97%
▷ Protected methods00.00%
▷ Private methods23.03%
Functions156
▷ Named functions3925.00%
▷ Anonymous functions11775.00%
Constants9
▷ Global constants00.00%
▷ Class constants9100.00%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
66 PNG files occupy 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/mf2tk-jquery-ui/le-frog/images/ui-bg_highlight-soft_50_4eb305_1x100.png0.34KB0.19KB▼ 45.01%
css/mf2tk-jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png0.33KB0.12KB▼ 62.09%
alt_video_field/icon_gray.png3.13KB0.54KB▼ 82.81%
css/mf2tk-jquery-ui/overcast/images/ui-bg_flat_0_eeeeee_40x100.png0.21KB0.08KB▼ 60.45%
alt_dropdown_field/icon_gray.png3.08KB0.47KB▼ 84.63%