65% night-mode-and-font-size-kit

Code Review | Night Mode for WordPress

WordPress plugin Night Mode for WordPress scored 65% from 54 tests.

About plugin

  • Plugin page: night-mode-and-fo...
  • Plugin version: 2.4
  • PHP version: 7.4.16
  • WordPress version: 5.9.2
  • First release: Feb 23, 2019
  • Latest release: Feb 3, 2021
  • Number of updates: 10
  • Update frequency: every 71.5 days
  • Top authors: mdshuvo (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

200+ active / 4,456 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲1.29MB] [CPU: ▲289.77ms] 50% from 4 tests

This is a short check of server-side resources used by Night Mode for WordPress
The following require your attention
  • CPU: Total CPU usage must kept under 500.00ms (currently 977.79ms on /wp-admin/admin.php?page=_nmfs&tab=5)
  • Extra CPU: Extra CPU usage should be kept under 200.00ms (currently 289.77ms on /wp-admin/admin.php?page=_nmfs&tab=5)
PageMemory (MB)CPU Time (ms)
Home /4.90 ▲1.3863.56 ▲12.92
Dashboard /wp-admin5.00 ▲1.59644.71 ▲611.42
Posts /wp-admin/edit.php4.89 ▲1.24970.90 ▲933.85
Add New Post /wp-admin/post-new.php8.19 ▲1.221,100.54 ▼167.62
Media Library /wp-admin/upload.php4.61 ▲1.30730.40 ▲702.37
Night Mode /wp-admin/admin.php?page=_nmfs&tab=16.05847.98
Options Object /wp-admin/admin.php?page=_nmfs&tab=44.92953.41
Redux Framework /wp-admin/tools.php?page=redux-about4.59967.89
Extras /wp-admin/admin.php?page=_nmfs&tab=34.92592.07
Font Size kit /wp-admin/admin.php?page=_nmfs&tab=24.92595.21
Import / Export /wp-admin/admin.php?page=_nmfs&tab=54.92977.79

Server storage [IO: ▲3.98MB] [DB: ▲0.06MB] Passed 3 tests

Filesystem and database footprint
The plugin installed successfully
Filesystem: 424 new files
Database: no new tables, 3 new options
New WordPress options
nmfs_opt
nmfs_opt-transients
redux_version_upgraded_from

Browser metrics Passed 4 tests

Checking browser requirements for Night Mode for WordPress
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,039 ▲28516.44 ▲0.829.32 ▲3.372.30 ▼0.80
Dashboard /wp-admin3,033 ▲1726.08 ▼0.14120.80 ▼13.78160.10 ▼2.45
Posts /wp-admin/edit.php2,746 ▲613.24 ▼0.0066.22 ▲0.64140.50 ▼3.96
Add New Post /wp-admin/post-new.php1,752 ▲9117.21 ▼3.73445.81 ▲48.23160.16 ▲1.57
Media Library /wp-admin/upload.php1,749 ▲545.54 ▲0.08141.61 ▼9.45170.94 ▼28.74
Night Mode /wp-admin/admin.php?page=_nmfs&tab=12,9246.46160.92150.84
Options Object /wp-admin/admin.php?page=_nmfs&tab=41,9525.15101.19144.64
Redux Framework /wp-admin/tools.php?page=redux-about1,3924.03100.95214.47
Extras /wp-admin/admin.php?page=_nmfs&tab=32,0305.58126.89193.60
Font Size kit /wp-admin/admin.php?page=_nmfs&tab=22,0125.14110.08150.71
Import / Export /wp-admin/admin.php?page=_nmfs&tab=51,9525.04100.83141.24

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin does not fully uninstall, leaving 3 options in the database
    • nmfs_opt-transients
    • redux_version_upgraded_from
    • nmfs_opt

Smoke tests 0% 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
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=_nmfs&tab=5
    • > Warning in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/framework.php+1029
    Invalid argument supplied for foreach()

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/night-mode-and-font-size-kit/nightmode-and-fontsize.php
  • 22× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'themecheck' not found in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/themecheck/checks/full_package.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/templates/panel/container.tpl.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Section' not found in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/extensions/customizer/inc/customizer_devs.php:12
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/templates/panel/content.tpl.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Redux_Customizer_Control' not found in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/extensions/customizer/inc/customizer_fields.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'themecheck' not found in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/themecheck/checks/embedded.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/templates/panel/header_stickybar.tpl.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/welcome/views/changelog.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/class.p.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/night-mode-and-font-size-kit/inc/redux-framework/ReduxCore/inc/welcome/views/support.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)
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=_nmfs&tab=1
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=_nmfs&tab=1 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=edf413708a&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3Dedf413708a%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    • > GET request to /wp-admin/admin.php?page=_nmfs&tab=4
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=_nmfs&tab=4 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=edf413708a&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3Dedf413708a%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    • > GET request to /wp-admin/admin.php?page=_nmfs&tab=3
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=_nmfs&tab=3 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=edf413708a&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3Dedf413708a%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    • > GET request to /wp-admin/admin.php?page=_nmfs&tab=2
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=_nmfs&tab=2 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=edf413708a&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3Dedf413708a%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    • > GET request to /wp-admin/admin.php?page=_nmfs&tab=5
    • > Security (severe) in unknown
    /wp-admin/admin.php?page=_nmfs&tab=5 - Refused to execute script from '/wp-admin/admin-ajax.php?action=redux_p&nonce=edf413708a&url=http%3A%2F%2Flook.redux.io%2Fapi%2Findex.php%3Fjs%26g%261%26v%3D2&proxy=http%3A%2F%2Fwp.com%2Fwp-admin%2Fadmin-ajax.php%3Faction%3Dredux_p%26nonce%3Dedf413708a%26url%3D' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Optimizations

Plugin configuration 86% 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
Attributes that need to be fixed:
  • Tags: Please delete some tags, you are using 16 tag instead of maximum 10
The official readme.txt might help

night-mode-and-font-size-kit/nightmode-and-fontsize.php 77% from 13 tests

The entry point to "Night Mode for WordPress" version 2.4 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 146 characters long)
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("night-mode-and-font-size-kit.php" instead of "nightmode-and-fontsize.php")

Code Analysis 97% from 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
Everything looks great! No dangerous files found in this plugin38,105 lines of code in 303 files:
LanguageFilesBlank linesComment linesLines of code
PHP1113,8145,67516,094
JavaScript862,6121,95812,061
Sass541,187607,580
SVG100934
JSON11840909
CSS473645405
HTML16062
LESS10053
XML1007

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
These items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 113)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity32.56
▷ Minimum class complexity1.00
▷ Maximum class complexity881.00
Average method complexity6.48
▷ Minimum method complexity1.00
▷ Maximum method complexity113.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes103
▷ Abstract classes00.00%
▷ Concrete classes103100.00%
▷ Final classes00.00%
Methods594
▷ Static methods10818.18%
▷ Public methods44975.59%
▷ Protected methods9115.32%
▷ Private methods549.09%
Functions17
▷ Named functions1694.12%
▷ Anonymous functions15.88%
Constants59
▷ Global constants11.69%
▷ Class constants5898.31%
▷ Public constants58100.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
31 PNG files occupy 0.08MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/redux-framework/ReduxCore/assets/img/1col.png2.83KB0.14KB▼ 95.13%
inc/redux-framework/ReduxCore/assets/css/vendor/jquery-ui-bootstrap/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
inc/redux-framework/ReduxCore/assets/img/4-col-portfolio.png1.01KB0.17KB▼ 83.45%
inc/redux-framework/ReduxCore/assets/css/vendor/jquery-ui-bootstrap/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
inc/redux-framework/ReduxCore/assets/css/vendor/jquery-ui-bootstrap/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%