62% trainingpress

Code Review | TrainingPress

WordPress plugin TrainingPress scored62%from 54 tests.

About plugin

  • Plugin page: trainingpress
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8.2
  • WordPress version: 6.3.1
  • First release: Dec 12, 2018
  • Latest release: Jan 7, 2022
  • Number of updates: 4
  • Update frequency: every 281.8 days
  • Top authors: rudrainnovatives (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /728 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.90MB] [CPU: ▲0.38ms] Passed 4 tests

Server-side resources used by TrainingPress
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.37 ▲0.9149.18 ▲9.85
Dashboard /wp-admin4.20 ▲0.8948.65 ▲2.89
Posts /wp-admin/edit.php4.25 ▲0.8952.75 ▲2.68
Add New Post /wp-admin/post-new.php6.82 ▲0.9393.97 ▼11.29
Media Library /wp-admin/upload.php4.12 ▲0.8939.90 ▲7.26
Chapters /wp-admin/edit.php?post_type=chapters4.1337.48
User Progress /wp-admin/admin.php?page=user-progress4.0434.65
Settings /wp-admin/admin.php?page=training-settings4.1241.02
Courses /wp-admin/edit.php?post_type=training4.1744.16
Modules /wp-admin/edit.php?post_type=modules4.1336.74
Exercises /wp-admin/edit.php?post_type=exercises4.1335.34
View Progress /wp-admin/admin.php?page=view-progress4.0036.29

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 133 new files
Database: 5 new tables, 8 new options
New tables
wp_rd_user_course_progress
wp_rd_user_uploaded_files
wp_rd_course_exercise_sequence
wp_rd_user_course_enroll
wp_rd_user_exercise_progress
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_recent-comments
rdtr_training_plugin_status
theysaidso_admin_options
widget_theysaidso_widget
wpl_training_course_image

Browser metrics Passed 4 tests

TrainingPress: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,973 ▲22715.84 ▲1.162.03 ▲0.2245.03 ▲3.25
Dashboard /wp-admin2,307 ▲1226.49 ▲0.63129.38 ▲24.5040.79 ▼4.37
Posts /wp-admin/edit.php2,213 ▲1243.81 ▲1.7954.61 ▲10.8336.28 ▲1.72
Add New Post /wp-admin/post-new.php1,622 ▲10824.31 ▲6.76652.38 ▼1.4540.48 ▼11.60
Media Library /wp-admin/upload.php1,504 ▲1225.24 ▲1.07112.24 ▲12.7142.94 ▲2.16
Chapters /wp-admin/edit.php?post_type=chapters1,2003.5451.2930.29
User Progress /wp-admin/admin.php?page=user-progress9003.2537.5124.12
Settings /wp-admin/admin.php?page=training-settings1,2094.7653.7987.22
Courses /wp-admin/edit.php?post_type=training1,2533.7346.3730.77
Modules /wp-admin/edit.php?post_type=modules1,2023.5546.2332.47
Exercises /wp-admin/edit.php?post_type=exercises1,1833.5650.1433.43
View Progress /wp-admin/admin.php?page=view-progress1,0103.2839.6726.37

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Zombie tables detected upon uninstall: 5 tables
    • wp_rd_course_exercise_sequence
    • wp_rd_user_course_progress
    • wp_rd_user_uploaded_files
    • wp_rd_user_course_enroll
    • wp_rd_user_exercise_progress
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • wpl_training_course_image

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=exercises
    • > Notice in wp-content/plugins/trainingpress/admin/class-rdtr-admin.php+1941
    Trying to get property 'post_title' of non-object
    • > GET request to /wp-admin/admin.php?page=view-progress
    • > Notice in wp-content/plugins/trainingpress/admin/class-rdtr-view-progress.php+400
    Trying to access array offset on value of type null
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=view-progress
    • > Notice in wp-content/plugins/trainingpress/admin/class-rdtr-view-progress.php+37
    Trying to get property 'display_name' of non-object

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/trainingpress/public/partials/rdtr-course.php
    • > /wp-content/plugins/trainingpress/admin/file/dummy.php
  • 17× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: course_name in wp-content/plugins/trainingpress/admin/partials/tmpl/tmpl-users-progress.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_the_title() in wp-content/plugins/trainingpress/admin/partials/rdtr-course-progress.php:4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/trainingpress/admin/class-rdtr-user-progress.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_var() on null in wp-content/plugins/trainingpress/admin/partials/tmpl/tmpl-users-enrolled.php:7
    • > PHP Notice
      Undefined variable: course_name in wp-content/plugins/trainingpress/admin/partials/tmpl/tmpl-users-enrolled.php on line 5
    • > PHP Notice
      Undefined variable: wpdb in wp-content/plugins/trainingpress/admin/partials/tmpl/tmpl-users-enrolled.php on line 7
    • > PHP Notice
      Undefined variable: wpdb in wp-content/plugins/trainingpress/admin/partials/tmpl/tmpl-users-progress.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/trainingpress/admin/partials/tmpl/tmpl-users-progress.php:4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/trainingpress/admin/class-rdtr-view-progress.php on line 3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/trainingpress/public/templates/tmpl/rdtr-load-course-detail-left-sidebar.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
4 plugin tags: training, e-learning, courses, online training

trainingpress/rdtr.php 77% from 13 tests

The main file in "TrainingPress" v. 1.0.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 248 characters long)
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("trainingpress.php" instead of "rdtr.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
Good job! No executable or dangerous file extensions detected44,160 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
SVG1426916,177
CSS133,66828814,074
JavaScript122,1853387,068
PHP291,3309896,412
Sass2275262
LESS1115152
Ruby1208
Markdown1207

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity50.50
▷ Minimum class complexity1.00
▷ Maximum class complexity374.00
Average method complexity4.64
▷ Minimum method complexity1.00
▷ Maximum method complexity95.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes00.00%
Methods163
▷ Static methods00.00%
▷ Public methods15393.87%
▷ Protected methods00.00%
▷ Private methods106.13%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.09MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/sort_both.png0.20KB0.29KB0.00%
assets/images/no-image.png10.97KB6.62KB▼ 39.60%
public/img/dummy-auther.png77.80KB29.55KB▼ 62.02%
assets/images/sort_asc.png0.16KB0.25KB0.00%