62% custom-post-links

Code Review | Custom Post Links

WordPress plugin Custom Post Links scored62%from 54 tests.

About plugin

  • Plugin page: custom-post-links
  • Plugin version: 2.0.8
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.6.1
  • WordPress version: 6.3.1
  • First release: Aug 5, 2016
  • Latest release: Dec 14, 2016
  • Number of updates: 21
  • Update frequency: every 6.2 days
  • Top authors: grosbouff (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,113 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼1.78MB] [CPU: ▼51.61ms] Passed 4 tests

A check of server-side resources used by Custom Post Links
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.21 ▼1.258.72 ▼35.56
Dashboard /wp-admin2.23 ▼1.079.60 ▼39.25
Posts /wp-admin/edit.php2.23 ▼1.1210.50 ▼43.16
Add New Post /wp-admin/post-new.php2.23 ▼3.6511.25 ▼88.48
Media Library /wp-admin/upload.php2.23 ▼1.009.41 ▼31.20
Add New /wp-admin/link-add.php2.2310.95
All Links /wp-admin/link-manager.php2.2510.25
Custom Post Links /wp-admin/options-general.php?page=cpl_settings2.2311.07
Link Categories /wp-admin/edit-tags.php?taxonomy=link_category2.2310.96

Server storage [IO: ▲0.15MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
These are issues you should consider
  • You have illegally modified 1 file (4.00KB) outside of "wp-content/plugins/custom-post-links/" and "wp-content/uploads/"
    • (new file) wp-content/mgd_mirror/mgd_maximinodotpy-gitdown-test-repository
Filesystem: 16 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
_cp_links-db_version
theysaidso_admin_options
widget_recent-posts
widget_links
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Custom Post Links
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,855 ▲9413.24 ▼1.171.91 ▼0.0137.52 ▼10.22
Dashboard /wp-admin2,253 ▲475.80 ▲0.9298.12 ▼9.1140.74 ▼3.23
Posts /wp-admin/edit.php2,135 ▲321.97 ▼0.0241.14 ▼2.1236.28 ▼1.33
Add New Post /wp-admin/post-new.php6,499 ▲4,97319.02 ▲1.34913.06 ▲216.2970.41 ▲13.35
Media Library /wp-admin/upload.php1,435 ▲354.22 ▼0.03100.38 ▼1.2044.08 ▲0.90
Add New /wp-admin/link-add.php1,6662.2649.1035.67
All Links /wp-admin/link-manager.php1,0722.0724.2030.56
Custom Post Links /wp-admin/options-general.php?page=cpl_settings8971.9034.9836.48
Link Categories /wp-admin/edit-tags.php?taxonomy=link_category1,4092.1528.7931.14

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Warning in wp-content/plugins/custom-post-links/cp_links-functions.php+120
    count(): Parameter must be an array or an object that implements Countable
  • This plugin does not fully uninstall, leaving 8 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • _cp_links-db_version
    • widget_recent-posts
    • widget_recent-comments
    • widget_links
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit-tags.php?taxonomy=link_category
    • > Warning in wp-content/plugins/custom-post-links/cp_links-functions.php+120
    count(): Parameter must be an array or an object that implements Countable

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-post-links/cp_links-settings.php:6
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/custom-post-links/cp_links-table.php on line 4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-links/cp_links-table.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/custom-post-links/custom-post-links.php:66
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-post-links/cp_links-ajax.php:19
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/custom-post-links/cp_links-table.php on line 4

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please take a look at the following user-side issues
    • > GET request to /wp-admin/options-general.php?page=cpl_settings
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/custom-post-links/_inc/js/cp_links_admin.js?ver=2.0.8:6:46)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/options-general.php?page=cpl_settings
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-mouse,jquery-ui-sortable&ver=6.3.1 1:28721 Uncaught TypeError: $(...).live is not a function

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: related links, custom links, post links, quick links, links

custom-post-links/custom-post-links.php 92% from 13 tests

The primary PHP file in "Custom Post Links" version 2.0.8 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 180 characters long)

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
Success! There were no dangerous files found in this plugin1,163 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP6346165849
Sass2372128
CSS212105
JavaScript1201073
Ruby1108

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity27.33
▷ Minimum class complexity9.00
▷ Maximum class complexity61.00
Average method complexity2.84
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods43
▷ Static methods12.33%
▷ Public methods4195.35%
▷ Protected methods12.33%
▷ Private methods12.33%
Functions18
▷ Named functions18100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
3 PNG files occupy 0.10MB with 0.06MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png37.75KB17.73KB▼ 53.04%
screenshot-1.png27.27KB13.29KB▼ 51.24%
screenshot-3.png34.80KB11.64KB▼ 66.55%