10% canalplan-ac

Code Review | Canalplan

WordPress plugin Canalplan scored10%from 54 tests.

About plugin

  • Plugin page: canalplan-ac
  • Plugin version: 5.00
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Jul 11, 2011
  • Latest release: Apr 8, 2023
  • Number of updates: 78
  • Update frequency: every 55.4 days
  • Top authors: SteveAtty (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /4,057 total downloads

Benchmarks

Plugin footprint 57% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • Install procedure had errors
    • > Notice in wp-content/plugins/canalplan-ac/canalplan.php+1299
    Undefined variable: blog_id

Server metrics [RAM: ▲0.06MB] [CPU: ▼4.22ms] 75% from 4 tests

Analyzing server-side resources used by Canalplan
Please fix the following
  • CPU: Try to keep total CPU usage under 500.00ms (currently 769.43ms on /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-diagnostics.php)
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0743.03 ▼0.99
Dashboard /wp-admin3.37 ▲0.0350.51 ▼9.52
Posts /wp-admin/edit.php3.42 ▲0.0753.14 ▲2.30
Add New Post /wp-admin/post-new.php5.95 ▲0.0790.97 ▼6.04
Media Library /wp-admin/upload.php3.30 ▲0.0736.33 ▼0.33
Google Maps /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php3.3535.27
Set Location /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-location.php3.3836.68
Diagnostics /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-diagnostics.php3.36769.43
Home Mooring /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-home.php3.3035.61
CanalPlan AC /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-menu.php3.2934.48
Favourites /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-fav.php3.3134.86
Canalplan Maps /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php3.3531.30
Manage Routes /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-manage_route.php3.5136.13
Import Routes /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-import_route.php3.3734.16
General Options /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-general.php3.52249.65

Server storage [IO: ▲2.39MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
This plugin installed successfully
Filesystem: 166 new files
Database: 9 new tables, 8 new options
New tables
wp_canalplan_polylines
wp_canalplan_link
wp_canalplan_routes
wp_canalplan_aliases
wp_canalplan_codes
wp_canalplan_route_day
wp_canalplan_canals
wp_canalplan_favourites
wp_canalplan_options
New WordPress options
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_canalplan_widget
plugin_error
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Canalplan
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,928 ▲18215.91 ▲1.3833.03 ▲31.2338.58 ▼3.58
Dashboard /wp-admin2,261 ▲845.63 ▲0.0888.30 ▼6.1537.96 ▼7.78
Posts /wp-admin/edit.php2,163 ▲602.00 ▼0.0140.04 ▼1.3237.16 ▲1.05
Add New Post /wp-admin/post-new.php6,346 ▲4,81819.18 ▼3.99902.75 ▲212.4165.31 ▼2.93
Media Library /wp-admin/upload.php1,460 ▲634.25 ▲0.0598.80 ▼4.6745.16 ▼0.98
Google Maps /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php4,3262.1631.7827.77
Set Location /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-location.php9832.0625.2830.19
Diagnostics /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-diagnostics.php1,1031.9923.1752.61
Home Mooring /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-home.php8992.0625.4024.89
CanalPlan AC /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-menu.php9111.9522.7627.87
Favourites /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-fav.php9932.0322.3430.80
Canalplan Maps /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php4,3161.9622.2425.54
Manage Routes /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-manage_route.php8292.0225.5826.97
Import Routes /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-import_route.php8442.0223.9724.34
General Options /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-general.php1,0252.0422.7628.86

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
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_recent-comments
    • plugin_error
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_canalplan_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
  • 54 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+56
    Trying to access array offset on value of type bool
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+61
    Undefined index: canalplan_pm_width
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+67
    Undefined index: canalplan_rm_type
  • 22 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+73
    Undefined index: canalplan_rm_zoom
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+77
    Undefined index: canalplan_rm_height
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+81
    Undefined index: canalplan_rm_width
  • 256 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+86
    Undefined index: canalplan_rm_r_hex
  • 256 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+91
    Undefined index: canalplan_rm_g_hex
  • 256 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+96
    Undefined index: canalplan_rm_b_hex
  • 22 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+102
    Undefined index: canalplan_rm_weight
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-google.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-google.php+110
    Undefined index: canalplan_rm_key
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-diagnostics.php
    • > Warning in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-diagnostics.php+142
    A non-numeric value encountered
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-diagnostics.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-diagnostics.php+142
    Undefined variable: timestring
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+60
    Undefined index: canalplan_cppm_width
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+66
    Undefined index: canalplan_cprm_type
  • 18 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+72
    Undefined index: canalplan_cprm_zoom
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+76
    Undefined index: canalplan_cprm_height
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+80
    Undefined index: canalplan_cprm_width
  • 256 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+85
    Undefined index: canalplan_cprm_r_hex
  • 256 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+90
    Undefined index: canalplan_cprm_g_hex
  • 256 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+95
    Undefined index: canalplan_cprm_b_hex
  • 22 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-cpmaps.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php+101
    Undefined index: canalplan_cprm_weight
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-general.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-general.php+521
    Undefined variable: gchecked
    • > GET request to /wp-admin/admin.php?page=canalplan-ac/admin-pages/cp-admin-general.php
    • > Notice in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-general.php+523
    Undefined variable: cpchecked

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
Almost there! Just fix the following items
  • 23× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      require_once(admin.php): failed to open stream: No such file or directory in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-diagnostics.php on line 10
    • > PHP Warning
      require_once(admin.php): failed to open stream: No such file or directory in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-cpmaps.php on line 10
    • > PHP Warning
      require_once(admin.php): failed to open stream: No such file or directory in wp-content/plugins/canalplan-ac/admin-pages/cp-manage_route.php on line 10
    • > PHP Fatal error
      require_once(): Failed opening required 'admin.php' (include_path='.:/usr/share/php') in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-fav.php on line 10
    • > PHP Warning
      require_once(admin.php): failed to open stream: No such file or directory in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-fav.php on line 10
    • > PHP Warning
      require_once(admin.php): failed to open stream: No such file or directory in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-location.php on line 10
    • > PHP Warning
      require_once(admin.php): failed to open stream: No such file or directory in wp-content/plugins/canalplan-ac/admin-pages/cp-import_route.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-menu.php:10
    • > PHP Notice
      Trying to get property 'base_prefix' of non-object in wp-content/plugins/canalplan-ac/canalplan.php on line 44
    • > PHP Fatal error
      require_once(): Failed opening required 'admin.php' (include_path='.:/usr/share/php') in wp-content/plugins/canalplan-ac/admin-pages/cp-admin-home.php on line 10

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
2 plugin tags: crosspost, canalplan ac

canalplan-ac/canalplan.php 92% from 13 tests

The main PHP script in "Canalplan" version 5.00 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("canalplan-ac.php" instead of "canalplan.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 plugin8,648 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP173543675,316
JavaScript112372092,915
HTML1612417

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity21.00
▷ Minimum class complexity21.00
▷ Maximum class complexity21.00
Average method complexity6.00
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions54
▷ Named functions5398.15%
▷ Anonymous functions11.85%
Constants18
▷ Global constants18100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
130 compressed PNG files occupy 0.23MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
canalplan/markers/turnround_6.png0.48KB0.45KB▼ 5.54%
canalplan/markers/turnround_9.png0.48KB0.45KB▼ 5.54%
canalplan/markers/turnround_12.png0.48KB0.45KB▼ 5.54%
canalplan/markers/cp_73.png1.22KB1.00KB▼ 17.61%
canalplan/markers/cp_3.png1.09KB0.89KB▼ 18.73%