78% custom-post-type-pdf-attachment

Code Review | Custom Post Type Attachment

WordPress plugin Custom Post Type Attachment scored 78% from 54 tests.

About plugin

  • Plugin page: custom-post-type-...
  • Plugin version: 3.4.5
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0.2-5.7
  • WordPress version: 5.8.1
  • First release: Feb 24, 2014
  • Latest release: Apr 12, 2021
  • Number of updates: 93
  • Update frequency: every 28.0 days
  • Top authors: avi.megladon (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

2,000+ active / 71,984 total downloads


Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.21MB] [CPU: ▼142.76ms] Passed 4 tests

Analyzing server-side resources used by Custom Post Type Attachment
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.02 ▲0.3037.60 ▲17.71
Dashboard /wp-admin3.30 ▲0.2447.70 ▼1.78
Posts /wp-admin/edit.php3.35 ▲0.2444.31 ▲1.93
Add New Post /wp-admin/post-new.php5.59 ▲0.1684.89 ▼573.86
Media Library /wp-admin/upload.php3.18 ▲0.1834.04 ▲2.66
Custom Post Type Attachment /wp-admin/options-general.php?page=custom_pdf_attachment3.1633.24

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 39 new files
Database: no new tables, 1 new option
New WordPress options

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Post Type Attachment
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,718 ▲12215.94 ▲0.468.74 ▼0.6358.06 ▲13.89
Dashboard /wp-admin2,983 ▲466.15 ▲0.22136.04 ▼4.50114.04 ▲4.20
Posts /wp-admin/edit.php2,765 ▲262.71 ▲0.0168.32 ▲5.9597.57 ▲6.53
Add New Post /wp-admin/post-new.php1,683 ▼18918.92 ▼0.15380.21 ▲12.39126.61 ▲13.60
Media Library /wp-admin/upload.php1,820 ▲105.05 ▲0.04135.46 ▼18.46114.90 ▼8.10
Custom Post Type Attachment /wp-admin/options-general.php?page=custom_pdf_attachment1,5642.4661.4284.01

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin does not fully uninstall, leaving 1 option in the database
    • widget_pdf_attachment_wid

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

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
Almost there! Just fix the following items
  • 4× PHP files output text when accessed directly:
    • > /wp-content/plugins/custom-post-type-pdf-attachment/view/admin/info.php
    • > /wp-content/plugins/custom-post-type-pdf-attachment/view/admin/pro-add.php
    • > /wp-content/plugins/custom-post-type-pdf-attachment/view/admin/help-info.php
    • > /wp-content/plugins/custom-post-type-pdf-attachment/view/admin/attachment-not-defined.php
  • 10× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/custom-post-type-pdf-attachment/view/admin/help.php:3
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/custom-post-type-pdf-attachment/custom-pdf-attachment.php on line 23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/custom-post-type-pdf-attachment/view/admin/settings.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/custom-post-type-pdf-attachment/view/admin/donate.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_plugin_active() in wp-content/plugins/custom-post-type-pdf-attachment/custom-pdf-attachment.php:24
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/custom-post-type-pdf-attachment/custom-pdf-attachment.php on line 23
    • > 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-type-pdf-attachment/custom-pdf-attachment.php on line 23
    • > PHP Notice
      Undefined variable: saved_no_of_pdf_attachment in wp-content/plugins/custom-post-type-pdf-attachment/view/admin/help-info.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/custom-post-type-pdf-attachment/view/admin/attachment-form.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/custom-post-type-pdf-attachment/pdf-attachment-widget.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side


Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Tags: There are too many tags (15 tag instead of maximum 10)
The official readme.txt is a good inspiration

custom-post-type-pdf-attachment/custom-pdf-attachment.php 85% from 13 tests

The primary PHP file in "Custom Post Type Attachment" version 3.4.5 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 163 characters long)
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("custom-post-type-pdf-attachment.php" instead of "custom-pdf-attachment.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin1,064 lines of code in 28 files:
LanguageFilesBlank linesComment linesLines of code
PO File16014

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity14.44
▷ Minimum class complexity1.00
▷ Maximum class complexity53.00
Average method complexity3.47
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
▷ Static methods714.29%
▷ Public methods4897.96%
▷ Protected methods00.00%
▷ Private methods12.04%
▷ Named functions1090.91%
▷ Anonymous functions19.09%
▷ Global constants2100.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
8 compressed PNG files occupy 0.00MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/xls.png0.54KB0.53KB▼ 3.06%
images/zip.png0.18KB0.14KB▼ 22.28%