84% restrict-file-access

Code Review | Restrict File Access

WordPress plugin Restrict File Access scored 84% from 54 tests.

About plugin

  • Plugin page: restrict-file-access
  • Plugin version: 1.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.3.2
  • WordPress version: 6.3.1
  • First release: May 9, 2019
  • Latest release: Dec 27, 2019
  • Number of updates: 15
  • Update frequency: every 15.5 days
  • Top authors: josxha (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

40+ active / 881 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.11MB] [CPU: ▲2.39ms] Passed 4 tests

A check of server-side resources used by Restrict File Access
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0942.00 ▼6.66
Dashboard /wp-admin3.42 ▲0.1156.47 ▲10.33
Posts /wp-admin/edit.php3.51 ▲0.1657.20 ▲5.93
Add New Post /wp-admin/post-new.php6.00 ▲0.11102.90 ▲5.70
Media Library /wp-admin/upload.php3.34 ▲0.1138.55 ▲4.59
Geschützte Dateien /wp-admin/upload.php?page=restrict-file-access3.3139.43

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 9 new files
Database: no new tables, 7 new options
New WordPress options
restrict-file-access
db_upgraded
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Restrict File Access
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.23 ▼1.174.96 ▲3.0049.35 ▲8.14
Dashboard /wp-admin2,207 ▲195.86 ▲0.95109.78 ▼5.9041.38 ▼6.61
Posts /wp-admin/edit.php2,093 ▲41.97 ▼0.0840.75 ▲2.6635.22 ▲4.56
Add New Post /wp-admin/post-new.php1,546 ▲3218.31 ▲0.80637.78 ▲11.4353.49 ▼1.07
Media Library /wp-admin/upload.php1,392 ▲74.30 ▲0.1096.81 ▼8.0343.56 ▲1.59
Geschützte Dateien /wp-admin/upload.php?page=restrict-file-access1,0442.0532.7235.12

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • restrict-file-access
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function stripslashes_deep() in wp-content/plugins/restrict-file-access/url_rewrite/url_rewrite.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention:
  • Tags: There are too many tags (14 tag instead of maximum 10)
You can look at the official readme.txt

restrict-file-access/index.php 92% from 13 tests

"Restrict File Access" version 1.1.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("restrict-file-access.php" instead of "index.php")

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 plugin609 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP36978505
CSS19064
JavaScript18340

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity31.00
▷ Minimum class complexity30.00
▷ Maximum class complexity32.00
Average method complexity5.00
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods15
▷ Static methods00.00%
▷ Public methods15100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions685.71%
▷ Anonymous functions114.29%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/ic_copy.png0.24KB0.19KB▼ 21.14%
admin/ic_success.png0.90KB0.75KB▼ 17.30%
admin/ic_delete.png0.91KB0.76KB▼ 16.47%