78% tokpw-safe-url-shortener

Code Review | tokpw Short URLs

WordPress plugin tokpw Short URLs scored78%from 54 tests.

About plugin

  • Plugin page: tokpw-safe-url-sh...
  • Plugin version: 0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.6
  • WordPress version: 6.3.1
  • First release: Apr 1, 2013
  • Latest release: May 6, 2013
  • Number of updates: 5
  • Update frequency: every 7.0 days
  • Top authors: netandreus (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /804 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.69MB] [CPU: ▲0.09ms] Passed 4 tests

This is a short check of server-side resources used by tokpw Short URLs
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0036.63 ▼1.56
Dashboard /wp-admin3.31 ▲0.0149.49 ▲1.96
Posts /wp-admin/edit.php3.36 ▲0.0145.94 ▼1.60
Add New Post /wp-admin/post-new.php3.10 ▼2.79165.84 ▲70.25
Media Library /wp-admin/upload.php3.23 ▲0.0133.73 ▲1.55

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for tokpw Short URLs
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲5413.39 ▼0.981.75 ▼0.2340.26 ▼5.31
Dashboard /wp-admin2,206 ▲184.85 ▼1.04110.59 ▼5.5742.21 ▼0.03
Posts /wp-admin/edit.php2,089 ▼31.99 ▼0.0539.57 ▲2.9034.32 ▼1.39
Add New Post /wp-admin/post-new.php1,520 ▼1223.35 ▲0.21652.53 ▲5.9148.43 ▼2.17
Media Library /wp-admin/upload.php1,382 ▼94.29 ▲0.1195.30 ▼8.8140.94 ▼3.76

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

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
Good news, no errors were detected

SRP 0% 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
Please fix the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/tokpw-safe-url-shortener/template/public.tpl.php
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/tokpw-safe-url-shortener/template/settings.tpl.php:8
    • > PHP Notice
      Undefined variable: opt in wp-content/plugins/tokpw-safe-url-shortener/template/public.tpl.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/tokpw-safe-url-shortener/tokpw_shorturl.php:12
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/tokpw-safe-url-shortener/template/public.tpl.php on line 9
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/tokpw-safe-url-shortener/template/public.tpl.php on line 2
    • > PHP Notice
      Undefined variable: opt in wp-content/plugins/tokpw-safe-url-shortener/template/public.tpl.php on line 9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% 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
Attributes that need to be fixed:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

tokpw-safe-url-shortener/tokpw_shorturl.php 92% from 13 tests

"tokpw Short URLs" version 0.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("tokpw-safe-url-shortener.php" instead of "tokpw_shorturl.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin199 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP34670199

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity14.00
▷ Minimum class complexity14.00
▷ Maximum class complexity14.00
Average method complexity4.25
▷ Minimum method complexity1.00
▷ Maximum method complexity8.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%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants266.67%
▷ Class constants133.33%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin