84% droit-dark-mode

Code Review | Droit Dark Mode

WordPress plugin Droit Dark Mode scored84%from 54 tests.

About plugin

  • Plugin page: droit-dark-mode
  • Plugin version: 1.1.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2.2
  • WordPress version: 6.3.1
  • First release: Feb 25, 2021
  • Latest release: Aug 22, 2023
  • Number of updates: 49
  • Update frequency: every 18.5 days
  • Top authors: droitthemes (100%)

Code review

54 tests

User reviews

17 reviews

Install metrics

5,000+ active /54,849 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▼1.02MB] [CPU: ▼222,497.70ms] Passed 4 tests

An overview of server-side resources used by Droit Dark Mode
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.2746.35 ▼2.57
Dashboard /wp-admin3.60 ▼4.8857.67 ▼889,993.55
Posts /wp-admin/edit.php3.71 ▲0.3157.19 ▲5.53
Add New Post /wp-admin/post-new.php6.20 ▲0.2792.97 ▼0.20
Media Library /wp-admin/upload.php3.52 ▲0.2547.49 ▲6.54

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Droit Dark Mode
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,895 ▲13413.58 ▼1.0810.24 ▲8.3343.39 ▼5.57
Dashboard /wp-admin2,198 ▲285.52 ▼0.0896.95 ▼5.2774.36 ▲32.13
Posts /wp-admin/edit.php2,115 ▲152.01 ▼0.0234.98 ▼2.8239.31 ▲3.90
Add New Post /wp-admin/post-new.php6,382 ▲4,85627.43 ▲4.26940.60 ▲213.7340.95 ▼23.09
Media Library /wp-admin/upload.php1,415 ▲184.17 ▼0.03105.36 ▼3.7774.42 ▲25.88

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

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
The following issues need your attention
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/droit-dark-mode/templates/button/style-3.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/droit-dark-mode/templates/button/style-1.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/droit-dark-mode/templates/admin/view/image.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/droit-dark-mode/templates/admin/view/os-base.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/droit-dark-mode/templates/admin/view/preset.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/droit-dark-mode/templates/admin/settings.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/droit-dark-mode/templates/admin/view/time.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/droit-dark-mode/templates/button/style-5.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/droit-dark-mode/templates/admin/view/active-pro.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/droit-dark-mode/templates/button/style-4.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
10 plugin tags: dark mode, image opacity, elementor dark mode, dark, dark theme...

droit-dark-mode/droit-dark-mode.php Passed 13 tests

The main PHP file in "Droit Dark Mode" ver. 1.1.2 adds more information about the plugin and also serves as the entry point for this plugin
83 characters long description:
Droit Dark Mode plugin to create dark version of your website base on your browser.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin30,620 lines of code in 84 files:
LanguageFilesBlank linesComment linesLines of code
CSS213,84311510,729
SVG13629,721
Sass19515345,127
JavaScript116354333,135
PHP202903141,908

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity36.60
▷ Minimum class complexity5.00
▷ Maximum class complexity84.00
Average method complexity4.02
▷ Minimum method complexity1.00
▷ Maximum method complexity45.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes120.00%
Methods60
▷ Static methods1321.67%
▷ Public methods5693.33%
▷ Protected methods23.33%
▷ Private methods23.33%
Functions3
▷ Named functions00.00%
▷ Anonymous functions3100.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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
30 PNG files occupy 0.47MB with 0.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/color/6.png31.73KB13.76KB▼ 56.64%
assets/images/button-style/5.png1.95KB1.05KB▼ 46.38%
assets/images/front_btn/5-1.png0.33KB0.30KB▼ 8.71%
assets/images/color/2.png28.16KB12.24KB▼ 56.54%
assets/images/admin/dark.png0.88KB1.21KB0.00%