87% plink-url-shortener

Code Review | Plink URL Shortener

WordPress plugin Plink URL Shortener scored 87% from 53 tests.

About plugin

  • Plugin page: plink-url-shortener
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-4.7.2
  • WordPress version: 5.8.1
  • First release: Jan 24, 2017
  • Latest release: Jan 31, 2017
  • Number of updates: 12
  • Update frequency: every 0.6 days
  • Top authors: persianlink (100%)

Code review

53 tests

User reviews

1 review

Install metrics

10+ active / 1,068 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.09MB] [CPU: ▲1.68ms] 75% from 4 tests

Analyzing server-side resources used by Plink URL Shortener
Please take the time to fix the following items
  • CPU: Try to keep total CPU usage under 500.00ms (currently 1,239.28ms on /wp-admin/admin.php?page=plink_short_link_settings_page)
PageMemory (MB)CPU Time (ms)
Home /2.90 ▲0.1832.68 ▲6.18
Dashboard /wp-admin3.13 ▲0.0844.15 ▲7.26
Posts /wp-admin/edit.php3.24 ▲0.1440.59 ▼0.27
Add New Post /wp-admin/post-new.php5.50 ▲0.072,697.66 ▲1,511.68
Media Library /wp-admin/upload.php3.07 ▲0.0735.73 ▼6.43
Statistics /wp-admin/admin.php?page=plink_short_link_settings_page3.041,239.28
Settings /wp-admin/admin.php?page=plink_short_link_settings_page23.0629.91

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 25 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Plink URL Shortener: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,715 ▲13316.34 ▲0.809.64 ▼0.1748.77 ▲4.35
Dashboard /wp-admin2,965 ▲1126.68 ▲0.75134.70 ▼2.62114.89 ▲15.49
Posts /wp-admin/edit.php2,746 ▲402.78 ▲0.0962.91 ▼1.6687.28 ▼5.52
Add New Post /wp-admin/post-new.php1,721 ▼13219.13 ▲0.06375.00 ▲11.07122.24 ▲13.54
Media Library /wp-admin/upload.php1,759 ▼165.34 ▲0.35127.40 ▼29.25124.91 ▲12.28
Statistics /wp-admin/admin.php?page=plink_short_link_settings_page1,2492.9067.6885.28
Settings /wp-admin/admin.php?page=plink_short_link_settings_page21,2892.6953.6785.63

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstaller ran successfully

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=plink_short_link_settings_page
    • > Warning in wp-includes/class-wp-hook.php+303
    call_user_func_array() expects parameter 1 to be a valid callback, function 'http://wp.com/wp-content/plugins/plink-url-shortener/icon.png' not found or invalid function name

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
Please fix the following items
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/plink-url-shortener/template/public.tpl.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/plink-url-shortener/plink_shorturl.php:13
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/plink-url-shortener/template/public.tpl.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/plink-url-shortener/template/settings.tpl.php:2
    • > PHP Notice
      Undefined variable: opt in wp-content/plugins/plink-url-shortener/template/public.tpl.php on line 2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Screenshots: These screenshots do not have images: #1 (Settings), #2 (The Get Shortlink button in Post Editor), #3 (Show Shortlink & Social Sharing Buttons), #4 (Statistics)
  • Tags: Please reduce the number of tags, currently 13 tag instead of maximum 10
The official readme.txt might help

plink-url-shortener/plink_shorturl.php 85% from 13 tests

The main PHP script in "Plink URL Shortener" version 1.0 is automatically included on every request by WordPress
The following require your attention:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("plink-url-shortener.php" instead of "plink_shorturl.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
There were no executable files found in this plugin615 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP39351385
PO File29298230

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity18.00
▷ Minimum class complexity18.00
▷ Maximum class complexity18.00
Average method complexity3.43
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods7100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants375.00%
▷ Class constants125.00%
▷ Public constants1100.00%

Plugin size Passed 1 test

Image compression Passed 1 test

PNG files should be compressed to save space and minimize bandwidth usage
17 compressed PNG files occupy 0.27MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
icons/blogger-32.png0.79KB0.79KB0.25%
icons/wordpress-32.png1.01KB1.00KB▼ 0.68%
icons/evernote-32.png0.87KB0.87KB▼ 0.56%
icons/mail-32.png0.82KB0.82KB▼ 0.59%
icons/google-plus-32.png0.65KB0.65KB0.30%