83% preview-link-generator

Code Review | Preview Link Generator

WordPress plugin Preview Link Generator scored83%from 54 tests.

About plugin

  • Plugin page: preview-link-gene...
  • Plugin version: 1.0.6
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: May 13, 2021
  • Latest release: Oct 25, 2023
  • Number of updates: 16
  • Update frequency: every 56.0 days
  • Top authors: hasthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,063 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲1.55MB] [CPU: ▲4.45ms] 75% from 4 tests

An overview of server-side resources used by Preview Link Generator
The following require your attention
  • CPU: You should keep total CPU usage under 500.00ms (currently 1,422.54ms on /wp-admin/edit.php?post_type=htpl-link&page=previewlink-recommendations)
PageMemory (MB)CPU Time (ms)
Home /5.01 ▲1.5453.92 ▲6.82
Dashboard /wp-admin4.86 ▲1.5556.05 ▲5.17
Posts /wp-admin/edit.php4.91 ▲1.5554.03 ▲7.48
Add New Post /wp-admin/post-new.php7.45 ▲1.56100.45 ▼1.67
Media Library /wp-admin/upload.php4.79 ▲1.5548.41 ▲16.22
Generate New Link /wp-admin/post-new.php?post_type=htpl-link4.9362.75
Categories /wp-admin/edit-tags.php?taxonomy=htpl_link_cat&post_type=htpl-link4.9044.13
All Links /wp-admin/edit.php?post_type=htpl-link4.8648.43
Recommendations /wp-admin/edit.php?post_type=htpl-link&page=previewlink-recommendations9.191,422.54
Settings /wp-admin/edit.php?post_type=htpl-link&page=htpl-admin4.7944.54

Server storage [IO: ▲2.23MB] [DB: ▲0.67MB] Passed 3 tests

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 178 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
htpl_options

Browser metrics Passed 4 tests

Checking browser requirements for Preview Link Generator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,840 ▲7914.24 ▼0.151.89 ▲0.1442.91 ▲0.63
Dashboard /wp-admin2,246 ▲695.60 ▼0.0582.50 ▼1.6136.34 ▼3.64
Posts /wp-admin/edit.php2,156 ▲562.05 ▲0.0436.77 ▲2.6833.05 ▼5.73
Add New Post /wp-admin/post-new.php1,563 ▲3523.40 ▲0.22600.61 ▼74.3852.94 ▼2.07
Media Library /wp-admin/upload.php1,456 ▲534.27 ▲0.0895.81 ▲2.9342.92 ▼1.17
Generate New Link /wp-admin/post-new.php?post_type=htpl-link1,8764.3670.7734.29
Categories /wp-admin/edit-tags.php?taxonomy=htpl_link_cat&post_type=htpl-link1,3302.2925.8830.36
All Links /wp-admin/edit.php?post_type=htpl-link1,3203.4449.9928.93
Recommendations /wp-admin/edit.php?post_type=htpl-link&page=previewlink-recommendations3,0393.5646.97103.69
Settings /wp-admin/edit.php?post_type=htpl-link&page=htpl-admin1,1743.6351.7063.32

Uninstaller [IO: ▲0.00MB] [DB: ▲0.67MB] 75% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 7 options in the database
    • htpl_options
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% 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 | 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
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/preview-link-generator/templates/single-htpl-link.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function HtplGenerator\\add_action() in wp-content/plugins/preview-link-generator/includes/Custom_Posts.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PreviewLink\\Admin\\Recommended_Plugins' not found in wp-content/plugins/preview-link-generator/includes/Admin/class.recommendation-plugin.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function HtplGenerator\\add_action() in wp-content/plugins/preview-link-generator/includes/Taxonomies.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 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
5 plugin tags: link generator, themeforest, demo, envato, preview

preview-link-generator/preview_link_generator.php 85% from 13 tests

Analyzing the main PHP file in "Preview Link Generator" version 1.0.6
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("preview-link-generator.php" instead of "preview_link_generator.php")
  • 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

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin27,902 lines of code in 135 files:
LanguageFilesBlank linesComment linesLines of code
PHP862,7631,1858,749
PO File203,0373,4146,180
Sass1595234,811
JavaScript71,2803824,101
CSS52804854,059
SVG2002

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.64
Average class complexity23.48
▷ Minimum class complexity1.00
▷ Maximum class complexity152.00
Average method complexity6.46
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes69
▷ Abstract classes22.90%
▷ Concrete classes6797.10%
▷ Final classes11.49%
Methods284
▷ Static methods4415.49%
▷ Public methods28198.94%
▷ Protected methods00.00%
▷ Private methods31.06%
Functions22
▷ Named functions22100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
17 PNG files occupy 0.11MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/extensions/just-tables-pro.png1.02KB1.05KB0.00%
(invalid) assets/images/extensions/wp-plugin-manager-pro.png13.31KB0.00KB▼ 100.00%
(invalid) assets/images/extensions/docus-pro.png3.98KB0.00KB▼ 100.00%
(invalid) assets/images/extensions/ht-menu.png2.85KB0.00KB▼ 100.00%
libs/codestar-framework/assets/images/checkerboard.png2.29KB2.54KB0.00%