63% wp-copysafe-pdf

Code Review | CopySafe PDF Protection

WordPress plugin CopySafe PDF Protection scored63%from 54 tests.

About plugin

  • Plugin page: wp-copysafe-pdf
  • Plugin version: 1.29
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Apr 3, 2013
  • Latest release: May 5, 2023
  • Number of updates: 64
  • Update frequency: every 58.0 days
  • Top authors: ArtistScope (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

500+ active /31,805 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▼1.23MB] [CPU: ▼47.50ms] Passed 4 tests

A check of server-side resources used by CopySafe PDF Protection
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.75 ▼0.7214.20 ▼35.42
Dashboard /wp-admin2.78 ▼0.5216.20 ▼37.88
Posts /wp-admin/edit.php2.79 ▼0.5717.74 ▼33.22
Add New Post /wp-admin/post-new.php2.78 ▼3.1016.13 ▼83.49
Media Library /wp-admin/upload.php2.78 ▼0.4415.47 ▼23.76
List Files /wp-admin/admin.php?page=wpcsp_list2.7916.50
Settings /wp-admin/admin.php?page=wpcsp_settings2.7917.68

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 40 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
wpcsp_settings
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for CopySafe PDF Protection
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲6414.48 ▲0.091.78 ▲0.0348.23 ▼0.54
Dashboard /wp-admin2,228 ▲514.97 ▼0.6990.19 ▼2.7938.93 ▼5.11
Posts /wp-admin/edit.php2,139 ▲392.36 ▲0.3335.86 ▼0.0230.14 ▼6.28
Add New Post /wp-admin/post-new.php1,716 ▲18422.54 ▼0.68602.77 ▼78.3628.31 ▼28.19
Media Library /wp-admin/upload.php1,434 ▲404.19 ▼0.0288.06 ▼19.8143.30 ▼1.78
List Files /wp-admin/admin.php?page=wpcsp_list8981.9726.7731.84
Settings /wp-admin/admin.php?page=wpcsp_settings1,1712.1427.5634.30

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/wp-copysafe-pdf/wp-copysafe-pdf.php+667
    Undefined index: page
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpcsp_settings
    • > Notice in wp-content/plugins/wp-copysafe-pdf/wp-copysafe-pdf.php+669
    Undefined index: cspfilename
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpcsp_settings
    • > Notice in wp-content/plugins/wp-copysafe-pdf/wp-copysafe-pdf.php+671
    Undefined index: action
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wpcsp_settings
    • > Notice in wp-content/plugins/wp-copysafe-pdf/wp-copysafe-pdf.php+673
    Undefined index: cspdel_nonce
    • > GET request to /wp-admin/admin.php?page=wpcsp_list
    • > Warning in wp-content/plugins/wp-copysafe-pdf/function.php+273
    scandir(wp-content/uploads/copysafe-pdf/): failed to open dir: Permission denied
    • > GET request to /wp-admin/admin.php?page=wpcsp_list
    • > Warning in wp-content/plugins/wp-copysafe-pdf/function.php+273
    scandir(): (errno 13): Permission denied
    • > GET request to /wp-admin/admin.php?page=wpcsp_list
    • > Warning in wp-content/plugins/wp-copysafe-pdf/function.php+275
    Invalid argument supplied for foreach()
    • > GET request to /wp-admin/admin.php?page=wpcsp_settings
    • > Notice in wp-content/plugins/wp-copysafe-pdf/wp-copysafe-pdf.php+354
    Undefined variable: latest_version

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
Please take a closer look at the following
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wp-copysafe-pdf/popup_load.php
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Warning
      include(WPCSP_PLUGIN_PATHmedia-upload.php): failed to open stream: No such file or directory in wp-content/plugins/wp-copysafe-pdf/popup_load.php on line 44
    • > PHP Warning
      include(): Failed opening 'WPCSP_PLUGIN_PATHmedia-upload.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/wp-copysafe-pdf/popup_load.php on line 44
    • > PHP Warning
      Use of undefined constant WPCSP_PLUGIN_URL - assumed 'WPCSP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-copysafe-pdf/popup_load.php on line 49
    • > PHP Warning
      Use of undefined constant WPCSP_PLUGIN_PATH - assumed 'WPCSP_PLUGIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-copysafe-pdf/popup_load.php on line 44
    • > PHP Warning
      Use of undefined constant WPCSP_PLUGIN_URL - assumed 'WPCSP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-copysafe-pdf/popup_load.php on line 54

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

Optimizations

Plugin configuration Passed 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
4 plugin tags: secure, prevent, protect, pdf

wp-copysafe-pdf/wp-copysafe-pdf.php Passed 13 tests

"CopySafe PDF Protection" version 1.29's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
115 characters long description:
This Wordpress plugin enables sites using CopySafe PDF to easily add protected PDF for display in the ArtisBrowser.

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
Good job! No executable or dangerous file extensions detected2,427 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP42031371,271
CSS36244517
JavaScript47388449
HTML3230190

PHP code Passed 2 tests

A brief analysis 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.32
Average class complexity1.00
▷ Minimum class complexity1.00
▷ Maximum class complexity1.00
Average method complexity1.00
▷ Minimum method complexity1.00
▷ Maximum method complexity1.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods6
▷ Static methods00.00%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions35
▷ Named functions35100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
10 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/help-24-30.png1.52KB1.19KB▼ 21.77%
images/artistscope-logo48.png3.10KB1.78KB▼ 42.54%
images/copysafepdfbutton.png2.96KB0.16KB▼ 94.50%
images/artisbrowser256.png48.23KB11.98KB▼ 75.16%
images/add_file.png1.02KB1.31KB0.00%