84% custom-post-types-relationships-cptr

Code Review | Custom Post Types Relationships (CPTR)

WordPress plugin Custom Post Types Relationships (CPTR) scored84%from 54 tests.

About plugin

  • Plugin page: custom-post-types...
  • Plugin version: 2.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-6.0
  • WordPress version: 6.3.1
  • First release: Nov 16, 2010
  • Latest release: Jun 13, 2022
  • Number of updates: 46
  • Update frequency: every 92.2 days
  • Top authors: anastis (93.48%)tsiger (6.52%)cssigniterteam (4.35%)

Code review

54 tests

User reviews

2 reviews

Install metrics

500+ active /12,293 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.01MB] [CPU: ▼6.72ms] Passed 4 tests

A check of server-side resources used by Custom Post Types Relationships (CPTR)
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0138.52 ▼0.96
Dashboard /wp-admin3.33 ▼0.0244.77 ▼12.72
Posts /wp-admin/edit.php3.38 ▲0.0248.01 ▲3.54
Add New Post /wp-admin/post-new.php5.91 ▲0.0282.16 ▼12.67
Media Library /wp-admin/upload.php3.25 ▲0.0234.70 ▼0.52
Custom Post Types Relationships /wp-admin/options-general.php?page=ci_cptr_plugin3.2229.84

Server storage [IO: ▲0.05MB] [DB: ▲0.07MB] Passed 3 tests

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 11 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
ci_cptr_plugin
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
db_upgraded
ci_cptr_plugin_version
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Custom Post Types Relationships (CPTR)
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲8913.34 ▼1.411.85 ▲0.0542.63 ▼3.07
Dashboard /wp-admin2,215 ▲265.80 ▲0.8699.01 ▼13.0138.59 ▼1.30
Posts /wp-admin/edit.php2,095 ▲62.03 ▼0.0239.88 ▲2.8737.97 ▲6.61
Add New Post /wp-admin/post-new.php6,328 ▲4,80925.85 ▲2.99880.88 ▲259.8965.63 ▲13.02
Media Library /wp-admin/upload.php1,394 ▲94.23 ▲0.08123.24 ▲26.9946.78 ▲1.49
Custom Post Types Relationships /wp-admin/options-general.php?page=ci_cptr_plugin9752.1523.5729.78

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 7 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • ci_cptr_plugin_version
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
The following issues need your attention
  • 8× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      Use of undefined constant CPTR_DEFAULT_THUMB - assumed 'CPTR_DEFAULT_THUMB' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 16
    • > PHP Warning
      Use of undefined constant CPTR_DEFAULT_EXCERPT - assumed 'CPTR_DEFAULT_EXCERPT' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/custom-post-types-relationships-cptr/cptr.php:50
    • > PHP Warning
      Use of undefined constant CPTR_DEFAULT_THUMB_WIDTH - assumed 'CPTR_DEFAULT_THUMB_WIDTH' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 17
    • > PHP Warning
      Use of undefined constant CPTR_DEFAULT_THUMB_HEIGHT - assumed 'CPTR_DEFAULT_THUMB_HEIGHT' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 18
    • > PHP Warning
      Use of undefined constant CPTR_VERSION - assumed 'CPTR_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 4
    • > PHP Warning
      Use of undefined constant CPTR_DEFAULT_EXCERPT_LENGTH - assumed 'CPTR_DEFAULT_EXCERPT_LENGTH' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 15
    • > PHP Warning
      Use of undefined constant CPTR_DEFAULT_LIMIT - assumed 'CPTR_DEFAULT_LIMIT' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-types-relationships-cptr/cpr.php on line 13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 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
6 plugin tags: related, post, post relationships, related posts, custom relations...

custom-post-types-relationships-cptr/cptr.php 92% from 13 tests

The principal PHP file in "Custom Post Types Relationships (CPTR)" v. 2.5.1 is loaded by WordPress automatically on each request
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("custom-post-types-relationships-cptr.php" instead of "cptr.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected842 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP419766733
JavaScript125980
CSS32129

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions44
▷ Named functions44100.00%
▷ Anonymous functions00.00%
Constants20
▷ Global constants20100.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/sortable.png0.21KB0.17KB▼ 16.82%