78% pdpa-consent

Code Review | PDPA Consent for Thailand

WordPress plugin PDPA Consent for Thailand scored 78% from 54 tests.

About plugin

  • Plugin page: pdpa-consent
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.4.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.4.1
  • WordPress version: 5.8.1
  • First release: May 14, 2020
  • Latest release: Jun 28, 2020
  • Number of updates: 48
  • Update frequency: every 0.9 days
  • Top authors: iamapinan (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

400+ active / 2,233 total downloads

Benchmarks

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
Install script ran successfully

Server metrics [RAM: ▲0.05MB] [CPU: ▼147.47ms] Passed 4 tests

Server-side resources used by PDPA Consent for Thailand
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.72 ▲0.0127.96 ▲2.81
Dashboard /wp-admin3.13 ▲0.0849.78 ▼2.82
Posts /wp-admin/edit.php3.18 ▲0.0847.76 ▲3.28
Add New Post /wp-admin/post-new.php5.48 ▲0.0591.60 ▼593.13
Media Library /wp-admin/upload.php3.08 ▲0.0842.48 ▲6.38

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 36 new files
Database: no new tables, 2 new options
New WordPress options
pdpa-consent-user_privacy-page
Activated_Plugin

Browser metrics Passed 4 tests

A check of browser resources used by PDPA Consent for Thailand
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,780 ▲18416.19 ▲0.499.62 ▲0.3949.80 ▼6.76
Dashboard /wp-admin3,034 ▲976.52 ▲0.59146.93 ▼13.00109.28 ▼13.93
Posts /wp-admin/edit.php2,807 ▲683.00 ▲0.3168.37 ▲0.41114.17 ▲21.48
Add New Post /wp-admin/post-new.php1,730 ▲12618.56 ▼0.20379.82 ▼52.03111.96 ▼10.93
Media Library /wp-admin/upload.php1,872 ▲655.40 ▲0.39145.49 ▼16.56129.09 ▼1.58

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie WordPress options were found after uninstall: 2 options
    • pdpa-consent-user_privacy-page
    • Activated_Plugin

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/pdpa-consent/pdpa-consent.php
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/pdpa-consent/includes/frontends/user_template.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_avatar() in wp-content/plugins/pdpa-consent/includes/user_template.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/pdpa-consent/includes/frontends/consent_template.php:1
    • > PHP Notice
      Undefined variable: is_login in wp-content/plugins/pdpa-consent/includes/frontends/user_template.php on line 2

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed:
  • Tags: Too many tags (14 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

pdpa-consent/pdpa-consent.php Passed 13 tests

"PDPA Consent for Thailand" version 1.1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
101 characters long description:
PDPA Consent allows you to notify to the user to accept privacy terms. Comply with Thailand PDPA law.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected1,537 lines of code in 26 files:
LanguageFilesBlank linesComment linesLines of code
PHP88495780
PO File2102138262
CSS52410219
Markdown3470154
JavaScript69774
HTML121247
YAML1001

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 issues
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity20.00
▷ Minimum class complexity2.00
▷ Maximum class complexity37.00
Average method complexity2.12
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods51
▷ Static methods00.00%
▷ Public methods4996.08%
▷ Protected methods00.00%
▷ Private methods23.92%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.41MB with 0.25MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/pdpa-consent-banner.png419.82KB165.61KB▼ 60.55%