72% ns-maintenance-mode-for-wp

Code Review | NS Maintenance Mode for WP

WordPress plugin NS Maintenance Mode for WP scored72%from 54 tests.

About plugin

  • Plugin page: ns-maintenance-mo...
  • Plugin version: 1.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-5.9
  • WordPress version: 6.3.1
  • First release: May 27, 2019
  • Latest release: Feb 7, 2022
  • Number of updates: 22
  • Update frequency: every 45.0 days
  • Top authors: nsthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /5,110 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.22MB] [CPU: ▼0.75ms] Passed 4 tests

Analyzing server-side resources used by NS Maintenance Mode for WP
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1946.41 ▲4.03
Dashboard /wp-admin3.58 ▲0.2853.80 ▲3.08
Posts /wp-admin/edit.php3.65 ▲0.2954.97 ▼5.02
Add New Post /wp-admin/post-new.php6.12 ▲0.2297.21 ▼5.08
Media Library /wp-admin/upload.php3.43 ▲0.2042.65 ▲7.85
Maintenance Mode /wp-admin/admin.php?page=ns-maintenance-mode-for-wp/ns-admin-options/ns_admin_option_dashboard.php3.4548.41
Add New /wp-admin/post-new.php?post_type=subscriber3.5565.06
/wp-admin/admin.php?page=plugineye2763.4338.29
Subscribers /wp-admin/edit.php?post_type=subscriber3.5142.70
How to install premium version /wp-admin/admin.php?page=ns-rac-graph-stats3.4037.51

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 39 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

NS Maintenance Mode for WP: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,995 ▲20914.83 ▲0.451.86 ▲0.0742.50 ▼1.99
Dashboard /wp-admin2,383 ▲2036.19 ▲0.60123.28 ▲31.2692.19 ▲53.68
Posts /wp-admin/edit.php2,331 ▲2283.38 ▲1.3551.56 ▲12.6078.13 ▲40.93
Add New Post /wp-admin/post-new.php1,739 ▲21122.55 ▼0.62593.12 ▼54.5134.82 ▼18.64
Media Library /wp-admin/upload.php1,477 ▲774.25 ▲0.0482.78 ▼20.6184.17 ▲36.24
Maintenance Mode /wp-admin/admin.php?page=ns-maintenance-mode-for-wp/ns-admin-options/ns_admin_option_dashboard.php4,51512.65308.69103.14
Add New /wp-admin/post-new.php?post_type=subscriber2,2727.76190.97119.18
/wp-admin/admin.php?page=plugineye2761,1333.2139.4157.91
Subscribers /wp-admin/edit.php?post_type=subscriber1,3223.3646.1978.70
How to install premium version /wp-admin/admin.php?page=ns-rac-graph-stats7321.7011.4619.91

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=ns-rac-graph-stats
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

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
  • 9× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_head() in wp-content/plugins/ns-maintenance-mode-for-wp/index.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-maintenance-mode-for-wp/ns-mm-js.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/ns-maintenance-mode-for-wp/ns-maintenance-mode.php:27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-maintenance-mode-for-wp/plugineye/plugineye-ajax/plugineye_on_deactivation_function.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-maintenance-mode-for-wp/csvMaker.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-maintenance-mode-for-wp/ns-mm-css.php:51
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/ns-maintenance-mode-for-wp/ns-mm-options-page-html.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/ns-maintenance-mode-for-wp/ns-mm-options.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ns-maintenance-mode-for-wp/ns-admin-options/inc.php:22

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=ns-maintenance-mode-for-wp/ns-admin-options/ns_admin_option_dashboard.php
    • > Network (severe)
    wp-content/plugins/ns-maintenance-mode-for-wp//assets/fonts/fontawesome-webfont.woff2?v=4.5.0 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=ns-maintenance-mode-for-wp/ns-admin-options/ns_admin_option_dashboard.php
    • > Network (severe)
    wp-content/plugins/ns-maintenance-mode-for-wp//assets/fonts/fontawesome-webfont.woff?v=4.5.0 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=ns-maintenance-mode-for-wp/ns-admin-options/ns_admin_option_dashboard.php
    • > Network (severe)
    wp-content/plugins/ns-maintenance-mode-for-wp//assets/fonts/fontawesome-webfont.ttf?v=4.5.0 - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots require images: #1 (Maintenance Mode Settings.), #2 (View frontend example.)
The official readme.txt might help

ns-maintenance-mode-for-wp/ns-maintenance-mode.php 92% from 13 tests

"NS Maintenance Mode for WP" version 1.3.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("ns-maintenance-mode-for-wp.php" instead of "ns-maintenance-mode.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected2,698 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP171462201,308
CSS9173761,306
JavaScript316684

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.21
Average class complexity20.00
▷ Minimum class complexity20.00
▷ Maximum class complexity20.00
Average method complexity2.23
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods526.32%
▷ Protected methods00.00%
▷ Private methods1473.68%
Functions32
▷ Named functions2268.75%
▷ Anonymous functions1031.25%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
5 PNG files occupy 1.94MB with 0.88MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot2.PNG1,932.76KB1,008.99KB▼ 47.80%
ns-admin-options/img/ns_banner_membership-500.png24.95KB26.27KB0.00%
screenshot-1.PNG24.26KB11.79KB▼ 51.42%
assets/img/backend-sidebar-icon.png1.48KB0.54KB▼ 63.47%
ns-admin-options/img/backend-sidebar-icon.png1.48KB0.54KB▼ 63.47%