62% token-manager

Code Review | Token Manager

WordPress plugin Token Manager scored62%from 54 tests.

About plugin

  • Plugin page: token-manager
  • Plugin version: 1.0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.4.2
  • WordPress version: 6.3.1
  • First release: Feb 7, 2012
  • Latest release: Oct 30, 2012
  • Number of updates: 62
  • Update frequency: every 4.3 days
  • Top authors: Codevendor (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /3,689 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼9.42ms] Passed 4 tests

An overview of server-side resources used by Token Manager
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0545.04 ▼8.85
Dashboard /wp-admin3.39 ▲0.0947.51 ▼2.37
Posts /wp-admin/edit.php3.43 ▲0.0745.60 ▼1.65
Add New Post /wp-admin/post-new.php6.08 ▲0.2076.82 ▼24.79
Media Library /wp-admin/upload.php3.33 ▲0.1039.36 ▲3.33
Backup System /wp-admin/admin.php?page=tokenmanagerpro3.3337.32
Token Types /wp-admin/admin.php?page=tokenmanagertypes3.4238.38
Information /wp-admin/admin.php?page=tokenmanagerinfo3.2932.77
/wp-admin/admin.php?page=tokenmanagerjson3.4134.56
Add New Token /wp-admin/admin.php?page=tokenmanageradd3.3637.41
Tokens /wp-admin/admin.php?page=tokenmanager3.5045.61
Settings /wp-admin/admin.php?page=tokenmanagersettings3.3344.67
Add New Type /wp-admin/admin.php?page=tokenmanageraddtype3.3236.55
/wp-admin/admin.php?page=tokenmanagertypeedit3.3334.23
/wp-admin/admin.php?page=tokenmanageredit3.3635.58

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 83 new files
Database: 5 new tables, 7 new options
New tables
wp_tokenmanagerpages
wp_tokenmanagerversions
wp_tokenmanagertypesversions
wp_tokenmanager
wp_tokenmanagertypes
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
db_upgraded
can_compress_scripts
tokenmanager_db_version

Browser metrics Passed 4 tests

A check of browser resources used by Token Manager
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲7414.27 ▼0.322.06 ▼0.4847.30 ▼16.65
Dashboard /wp-admin2,241 ▲645.74 ▲0.0590.11 ▼29.3977.95 ▲21.19
Posts /wp-admin/edit.php2,146 ▲461.98 ▼0.0133.69 ▼7.3534.19 ▼3.96
Add New Post /wp-admin/post-new.php1,579 ▲4223.42 ▲5.26780.75 ▲142.4754.48 ▼17.48
Media Library /wp-admin/upload.php1,449 ▲494.12 ▲0.0199.92 ▼16.6769.02 ▲23.44
Backup System /wp-admin/admin.php?page=tokenmanagerpro1,0962.1825.3431.76
Token Types /wp-admin/admin.php?page=tokenmanagertypes9401.9924.9129.89
Information /wp-admin/admin.php?page=tokenmanagerinfo9762.1125.6630.30
/wp-admin/admin.php?page=tokenmanagerjson8041.9723.6925.03
Add New Token /wp-admin/admin.php?page=tokenmanageradd2,0252.2033.8239.69
Tokens /wp-admin/admin.php?page=tokenmanager1,0412.0324.0127.28
Settings /wp-admin/admin.php?page=tokenmanagersettings9692.1725.8124.90
Add New Type /wp-admin/admin.php?page=tokenmanageraddtype9052.1226.1525.47
/wp-admin/admin.php?page=tokenmanagertypeedit8872.1324.8928.25
/wp-admin/admin.php?page=tokenmanageredit2,0212.2136.0538.48

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
It is recommended to fix the following
  • The plugin did not uninstall successfully, leaving 5 tables in the database
    • wp_tokenmanagerpages
    • wp_tokenmanagertypesversions
    • wp_tokenmanagertypes
    • wp_tokenmanager
    • wp_tokenmanagerversions
  • The uninstall procedure has failed, leaving 7 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • tokenmanager_db_version
    • theysaidso_admin_options

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
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=tokenmanageredit
    • > Notice in wp-content/plugins/token-manager/tokenedit.php+194
    Undefined index: tid

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/token-manager/json.php
  • 11× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/info.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/types.php:24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/token-manager/token-manager.php:33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/tokenadd.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/token-manager/settings.php:65
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/typeedit.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/typeadd.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/sidebar.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/tokens.php:25
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/token-manager/tokenedit.php:23

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Screenshots: These screenshots do not have images: #1 (Here is a screen shot of adding a token that creates a copyright.), #2 (Here is what the Token Manager looks like.), #3 (This screen shot shows how to assign tokens to pages.), #4 (This screen shot shows adding the token text to the page we assigned.), #5 (Shows the actual copyright token being rendered in a view.), #6 (Example helloworld, showing how to use the HTML tab.), #7 (Example helloworld, showing how to use the PHP tab.), #8 (Example helloworld, showing how to use the CSS tab.), #9 (Example helloworld, showing how to use the JS tab.), #10 (Shows the actual helloworld token being rendered in a view.), #11 (Shows the actual helloworld token running the javascript onclick.), #12 (The error handler showing a PHP error on the page.), #13 (Show all key value pairs for the page with settings turned on.), #14 (Shows the token ordering for processing tokens in a specific custom order.), #15 (Shows the code editor for the tokens.)
  • Tags: There are too many tags (12 tag instead of maximum 10)
You can look at the official readme.txt

token-manager/token-manager.php Passed 13 tests

"Token Manager" version 1.0.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
131 characters long description:
The Token Manager allows web developers to program PHP, HTML, CSS and JavaScript into tokens that can be used throughout Wordpress.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin8,575 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript244053715,719
PHP133801932,487
CSS44614369

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity32.50
▷ Minimum class complexity12.00
▷ Maximum class complexity69.00
Average method complexity5.26
▷ Minimum method complexity1.00
▷ Maximum method complexity32.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods74
▷ Static methods1722.97%
▷ Public methods6486.49%
▷ Protected methods00.00%
▷ Private methods1013.51%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
37 PNG files occupy 0.43MB with 0.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
icons/up.png0.54KB0.45KB▼ 17.77%
icons/icon1_32.png2.14KB1.63KB▼ 23.84%
icons/history.png0.84KB0.73KB▼ 13.30%
screenshot-1.png35.31KB12.66KB▼ 64.13%
screenshot-14.png23.33KB8.00KB▼ 65.70%