71% pv-anlagen

Code Review | Solar-Energy-Visualizer

WordPress plugin Solar-Energy-Visualizer scored71%from 54 tests.

About plugin

  • Plugin page: pv-anlagen
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.0
  • WordPress version: 6.3.1
  • First release: Aug 30, 2022
  • Latest release: Feb 16, 2023
  • Number of updates: 10
  • Update frequency: every 17.4 days
  • Top authors: christinali (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,198 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.74MB] [CPU: ▲5.73ms] Passed 4 tests

An overview of server-side resources used by Solar-Energy-Visualizer
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.20 ▲0.7458.56 ▲17.10
Dashboard /wp-admin4.09 ▲0.7465.28 ▲0.55
Posts /wp-admin/edit.php4.14 ▲0.7862.36 ▲6.14
Add New Post /wp-admin/post-new.php6.63 ▲0.74114.39 ▼0.87
Media Library /wp-admin/upload.php3.95 ▲0.7258.87 ▲22.86
Stromabnehmer /wp-admin/admin.php?page=my_customer_submenu_page3.8946.59
Produzenten /wp-admin/admin.php?page=my-add-submenu-page3.8946.69
Einstellungen /wp-admin/admin.php?page=myplugin_admin_page3.9552.74
Dokumentation /wp-admin/admin.php?page=my-doku-submenu-page3.9245.70
Prosumer /wp-admin/admin.php?page=my_prosumer_submenu_page3.8945.29

Server storage [IO: ▲30.58MB] [DB: ▲0.00MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Just a few items left to fix
  • Filesystem usage must be lower than 25MB (currently using 30.58MB)
Filesystem: 287 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Solar-Energy-Visualizer
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,968 ▲22214.46 ▼0.159.41 ▲7.7945.18 ▲5.69
Dashboard /wp-admin2,264 ▲584.87 ▲0.04101.38 ▼3.5645.04 ▲0.27
Posts /wp-admin/edit.php2,143 ▲432.00 ▼0.0136.05 ▼7.5335.64 ▼0.73
Add New Post /wp-admin/post-new.php1,561 ▲3517.35 ▼0.35687.15 ▲73.7251.30 ▼2.33
Media Library /wp-admin/upload.php1,443 ▲404.15 ▼0.02112.92 ▲15.9352.40 ▲6.92
Stromabnehmer /wp-admin/admin.php?page=my_customer_submenu_page9562.0227.4531.65
Produzenten /wp-admin/admin.php?page=my-add-submenu-page1,0652.0222.4331.60
Einstellungen /wp-admin/admin.php?page=myplugin_admin_page1,2312.0421.8936.67
Dokumentation /wp-admin/admin.php?page=my-doku-submenu-page9092.1325.3833.46
Prosumer /wp-admin/admin.php?page=my_prosumer_submenu_page1,0602.0224.1230.81

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 25% 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=my_customer_submenu_page
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method SEVZ_Add_consumer::my_consumer_submenu_page_content() should not be called statically
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+33
    Undefined variable: pagetitle
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > User deprecated in wp-includes/functions.php+5453
    Function get_page_by_title is deprecated since version 6.2.0! Use WP_Query instead.
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+67
    Undefined variable: username
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+69
    Undefined variable: smartpasswort
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+73
    Undefined variable: smartname
  • 9 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+173
    Undefined variable: smartmeter
    • > GET request to /wp-admin/admin.php?page=my_customer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_consumer.php+125
    Undefined variable: verbraucher_id
    • > GET request to /wp-admin/admin.php?page=my_customer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_consumer.php+126
    Undefined variable: verbraucher_name
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+174
    Undefined variable: benutzername
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+175
    Undefined variable: passwort
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+176
    Undefined variable: link
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+177
    Undefined variable: strasse
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+178
    Undefined variable: hausnr
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+179
    Undefined variable: plz
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+180
    Undefined variable: stadt
    • > GET request to /wp-admin/admin.php?page=my-add-submenu-page
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method SEVZ_Add_producer::my_add_submenu_page_content() should not be called statically
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+172
    Undefined variable: betreiber_name
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+171
    Undefined variable: current_id
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+182
    Undefined variable: nettonennleistung
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+183
    Undefined variable: inbetriebnahmedatum
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+184
    Undefined variable: ausrichtung
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Notice in wp-content/plugins/pv-anlagen/admin/partials/class_sevz_add_prosumer.php+185
    Undefined variable: neigung
    • > GET request to /wp-admin/admin.php?page=my_prosumer_submenu_page
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method SEVZ_Add_prosumer::my_add_prosumer_submenu_page_content() should not be called statically

SRP 0% 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
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/pv-anlagen/includes/tcpdf/tools/tcpdf_addfont.php
  • 40× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Undefined variable: imsys_data in wp-content/plugins/pv-anlagen/public/view/energy_balance_templates/producer_template.php on line 207
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/pv-anlagen/includes/tcpdf/tcpdf.php on line 17778
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/pv-anlagen/public/view/login_assistant_templates/save_producer_10.php on line 2
    • > PHP Warning
      count(): Parameter must be an array or an object that implements Countable in wp-content/plugins/pv-anlagen/public/view/energy_balance_templates/producer_template.php on line 207
    • > PHP Notice
      Undefined variable: yesterdaydate1 in wp-content/plugins/pv-anlagen/public/view/energy_balance_templates/prosumer_template.php on line 224
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_next_scheduled() in wp-content/plugins/pv-anlagen/external/jobmanager.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/pv-anlagen/public/view/energy_forecast_templates/producer_template_forecast.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/pv-anlagen/public/view/login_assistant_templates/not_identic_prosumer_9.php:1
    • > PHP Notice
      Undefined variable: yesterdaydate1 in wp-content/plugins/pv-anlagen/public/view/energy_balance_templates/producer_template.php on line 210
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/pv-anlagen/public/view/energy_forecast_templates/consumer_template_forecast.php:17

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 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots do not have images: #1 (Login shortcode along with the "RegistrationMagic" plugin: 'admin/assets/shortcode.PNG'), #2 (Login area energy balance: 'admin/assets/Energiebilanz.PNG'), #3 (Home Total Production Energy together with the plugin "WP Google Maps": 'admin/assets/startseite_karte.PNG'), #4 (Sidebar settings: 'admin/assets/einstellungen.PNG'), #5 (User registration process: 'admin/assets/anmeldeassistent.PNG')
The official readme.txt might help

pv-anlagen/solar-energy-visualizer.php 77% from 13 tests

"Solar-Energy-Visualizer" version 1.0.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("pv-anlagen.php" instead of "solar-energy-visualizer.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 178 characters long)

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin57,180 lines of code in 149 files:
LanguageFilesBlank linesComment linesLines of code
PHP1423,77712,98156,255
CSS27254814
Markdown121063
JSON10040
JavaScript36658

PHP code 0% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 4,349)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 499)
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity203.36
▷ Minimum class complexity1.00
▷ Maximum class complexity4,349.00
Average method complexity9.99
▷ Minimum method complexity1.00
▷ Maximum method complexity499.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes33
▷ Abstract classes00.00%
▷ Concrete classes33100.00%
▷ Final classes00.00%
Methods743
▷ Static methods10914.67%
▷ Public methods46262.18%
▷ Protected methods27637.15%
▷ Private methods50.67%
Functions33
▷ Named functions33100.00%
▷ Anonymous functions00.00%
Constants129
▷ Global constants129100.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
8 PNG files occupy 1.05MB with 0.57MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/assets/startseite_karte.PNG820.84KB288.91KB▼ 64.80%
admin/assets/einstellungen.PNG39.15KB20.19KB▼ 48.44%
public/icons/kisspng-art-photography-clip-art-icon-sun-5b361804556db5.6012688415302717483499.png51.83KB19.40KB▼ 62.57%
admin/assets/shortcode.PNG9.92KB5.36KB▼ 45.91%
public/icons/kisspng-carbon-dioxide-clip-art-portable-network-graphics-5ba018ffad2554.9931904415372188157092.png10.20KB4.84KB▼ 52.60%