68% teachpress

Code Review | teachPress

WordPress plugin teachPress scored68%from 54 tests.

About plugin

  • Plugin page: teachpress
  • Plugin version: 9.0.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9-6.4.1
  • WordPress version: 6.3.1
  • First release: Oct 4, 2009
  • Latest release: Nov 28, 2023
  • Number of updates: 365
  • Update frequency: every 14.2 days
  • Top authors: winkm89 (69.59%)DonSalierie (30.68%)

Code review

54 tests

User reviews

22 reviews

Install metrics

2,000+ active /98,051 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲2.23MB] [CPU: ▲12.27ms] Passed 4 tests

An overview of server-side resources used by teachPress
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /5.12 ▲1.6546.05 ▲4.55
Dashboard /wp-admin5.73 ▲2.4259.80 ▲10.65
Posts /wp-admin/edit.php5.78 ▲2.4264.23 ▲18.89
Add New Post /wp-admin/post-new.php8.31 ▲2.43108.85 ▲15.18
Media Library /wp-admin/upload.php5.65 ▲2.4251.89 ▲18.68
teachPress /wp-admin/options-general.php?page=teachpress/settings.php5.5847.84

Server storage [IO: ▲5.92MB] [DB: ▲0.08MB] Passed 3 tests

Filesystem and database footprint
This plugin installed successfully
Filesystem: 145 new files
Database: 12 new tables, 7 new options
New tables
wp_teachpress_rel_pub_auth
wp_teachpress_tags
wp_teachpress_pub_documents
wp_teachpress_pub
wp_teachpress_settings
wp_teachpress_monitored_sources
wp_teachpress_authors
wp_teachpress_pub_meta
wp_teachpress_relation
wp_teachpress_pub_capabilities
...
New WordPress options
widget_tp_books_widget
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for teachPress
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,852 ▲9014.24 ▼0.491.69 ▼0.0538.33 ▼5.86
Dashboard /wp-admin2,245 ▲675.51 ▼0.2194.23 ▼21.3282.13 ▲36.25
Posts /wp-admin/edit.php2,156 ▲562.00 ▲0.0538.22 ▼2.2033.32 ▼0.19
Add New Post /wp-admin/post-new.php1,585 ▲5923.05 ▼0.62674.22 ▲9.8248.10 ▼5.71
Media Library /wp-admin/upload.php1,450 ▲474.13 ▼0.0697.49 ▲2.3776.74 ▲36.17
Your publications /wp-admin/publications.php?page=teachpress/publications.php260.410.0716.07
Publications /wp-admin/publications.php260.410.075.87
Add new /wp-admin/publications.php?page=teachpress/addpublications.php260.410.076.83
Import/Export /wp-admin/publications.php?page=teachpress/import.php260.410.066.12
teachPress /wp-admin/options-general.php?page=teachpress/settings.php1,2372.9448.2968.91
Authors /wp-admin/publications.php?page=teachpress/authors.php260.410.084.96
Auto-publish /wp-admin/publications.php?page=teachpress/sources.php260.410.087.24
Tags /wp-admin/publications.php?page=teachpress/tags.php260.410.285.70

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The uninstall procedure failed, leaving 12 tables in the database
    • wp_teachpress_rel_pub_auth
    • wp_teachpress_monitored_sources
    • wp_teachpress_settings
    • wp_teachpress_pub_capabilities
    • wp_teachpress_pub_documents
    • wp_teachpress_pub_meta
    • wp_teachpress_pub_imports
    • wp_teachpress_tags
    • wp_teachpress_user
    • wp_teachpress_relation
    • ...
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_tp_books_widget
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 50% 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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 55× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 69
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 104
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 90
    • > PHP Fatal error
      Uncaught Error: Class 'TP_Bibtex_Import' not found in wp-content/plugins/teachpress/core/publications/class-pubmed-import.php:17
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 83
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 125
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 55
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 118
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/teachpress/core/constants.php on line 132
    • > PHP Fatal error
      Uncaught Error: Class 'TP_Bibtex_Import' not found in wp-content/plugins/teachpress/core/publications/class-crossref-import.php:27

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)
Please take a look at the following user-side issues
    • > GET request to /wp-admin/publications.php?page=teachpress/publications.php
    • > Network (severe)
    wp-admin/publications.php?page=teachpress/publications.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/publications.php
    • > Network (severe)
    wp-admin/publications.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/publications.php?page=teachpress/addpublications.php
    • > Network (severe)
    wp-admin/publications.php?page=teachpress/addpublications.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/publications.php?page=teachpress/import.php
    • > Network (severe)
    wp-admin/publications.php?page=teachpress/import.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/publications.php?page=teachpress/authors.php
    • > Network (severe)
    wp-admin/publications.php?page=teachpress/authors.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/publications.php?page=teachpress/sources.php
    • > Network (severe)
    wp-admin/publications.php?page=teachpress/sources.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/publications.php?page=teachpress/tags.php
    • > Network (severe)
    wp-admin/publications.php?page=teachpress/tags.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (Publication overview screen), #2 (Add publication screen), #3 (Example for a publication list created with [tpcloud]), #4 (Example for a publication list created with [tpsearch]), #5 (Example for a reference list created with [tpcite] and [tpref]), #6 (Import publications screen)
You can take inspiration from this readme.txt

teachpress/teachpress.php Passed 13 tests

The principal PHP file in "teachPress" v. 9.0.6 is loaded by WordPress automatically on each request
45 characters long description:
Powerful publication management for WordPress

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin38,704 lines of code in 96 files:
LanguageFilesBlank linesComment linesLines of code
PHP491,8845,21311,754
SVG40128,998
PO File83,5045,5247,874
CSS222,8821306,813
JavaScript101012343,189
Markdown223068
JSON1008

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.39
Average class complexity34.31
▷ Minimum class complexity1.00
▷ Maximum class complexity185.00
Average method complexity4.80
▷ Minimum method complexity1.00
▷ Maximum method complexity45.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes44
▷ Abstract classes00.00%
▷ Concrete classes44100.00%
▷ Final classes00.00%
Methods393
▷ Static methods30577.61%
▷ Public methods29575.06%
▷ Protected methods20.51%
▷ Private methods9624.43%
Functions88
▷ Named functions8293.18%
▷ Anonymous functions66.82%
Constants37
▷ Global constants37100.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
8 PNG files occupy 0.03MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/full.png10.40KB4.34KB▼ 58.24%
images/child.png2.78KB0.10KB▼ 96.24%
images/logo_big.png4.23KB0.96KB▼ 77.24%
images/logo_small.png3.78KB0.44KB▼ 88.23%
js/logo_small_black.png3.00KB0.44KB▼ 85.18%