73% content-restrictor-for-divi

Code Review | Divi Content Restrictor

WordPress plugin Divi Content Restrictor scored73%from 54 tests.

About plugin

  • Plugin page: content-restricto...
  • Plugin version: 1.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-6.3
  • WordPress version: 6.3.1
  • First release: Jan 12, 2021
  • Latest release: Aug 24, 2023
  • Number of updates: 11
  • Update frequency: every 86.7 days
  • Top authors: wpt00ls (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /2,631 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲5.36MB] [CPU: ▲24.00ms] 75% from 4 tests

Analyzing server-side resources used by Divi Content Restrictor
Please take the time to fix the following items
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 5.36MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.20 ▲5.7374.19 ▲31.32
Dashboard /wp-admin9.22 ▲5.9175.05 ▲29.86
Posts /wp-admin/edit.php9.22 ▲5.8681.01 ▲34.39
Add New Post /wp-admin/post-new.php9.84 ▲3.95103.54 ▲1.37
Media Library /wp-admin/upload.php9.22 ▲5.9967.51 ▲33.44
Divi Content Restrictor /wp-admin/admin.php?page=content-restrictor-for-divi9.2279.63
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius9.2259.12

Server storage [IO: ▲3.22MB] [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: 236 new files
Database: no new tables, 9 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
fs_debug_mode
can_compress_scripts
fs_active_plugins
widget_theysaidso_widget
db_upgraded
fs_accounts
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Divi Content Restrictor
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲7213.57 ▼1.062.01 ▲0.0131.92 ▼12.59
Dashboard /wp-admin2,224 ▲395.80 ▲0.91103.46 ▼5.1440.34 ▼7.53
Posts /wp-admin/edit.php2,107 ▲152.02 ▲0.0639.85 ▼4.2838.96 ▼0.38
Add New Post /wp-admin/post-new.php1,523 ▼621.94 ▲3.52675.42 ▲55.0561.39 ▲10.70
Media Library /wp-admin/upload.php1,406 ▲154.19 ▲0.0195.34 ▼8.4247.56 ▲4.55
Divi Content Restrictor /wp-admin/admin.php?page=content-restrictor-for-divi9751.7125.7759.66
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,0781.8322.7625.68

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/content-restrictor-for-divi/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_theysaidso_widget
    • fs_debug_mode
    • widget_recent-comments
    • fs_active_plugins
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • fs_accounts
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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 take a closer look at the following
  • 16× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Container\\ContainerInterface' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php:38
    • > PHP Fatal error
      Uncaught Error: Class 'DiviExtension' not found in wp-content/plugins/content-restrictor-for-divi/includes/DiviContentRestrictorExtension.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php:34
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Container\otFoundExceptionInterface' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php:36
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'Pimple\\Container' not found in wp-content/plugins/content-restrictor-for-divi/includes/classes/Loader.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php:39
    • > PHP Fatal error
      Uncaught Error: Interface 'Pimple\\ServiceProviderInterface' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'ET_Builder_Module_Field_Base' not found in wp-content/plugins/content-restrictor-for-divi/includes/classes/Divi/BoxShadow.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/content-restrictor-for-divi/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php:34

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
2 plugin tags: divi restrict content, divi content access control

content-restrictor-for-divi/content-restrictor-for-divi.php 85% from 13 tests

The main file in "Divi Content Restrictor" v. 1.4.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Domain Path: The domain path points to a folder that does not exist ("/languages")

Code Analysis 97% from 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
Good job! No executable or dangerous file extensions detected36,020 lines of code in 185 files:
LanguageFilesBlank linesComment linesLines of code
PHP1568,45318,51035,483
JavaScript63660201
JSON300165
reStructuredText19413597
YAML25038
CSS150015
XML11013
Markdown1508

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
It is recommended to fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity58.79
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.38
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces13
Interfaces4
Traits0
Classes76
▷ Abstract classes22.63%
▷ Concrete classes7497.37%
▷ Final classes22.70%
Methods1,433
▷ Static methods21815.21%
▷ Public methods1,03972.51%
▷ Protected methods201.40%
▷ Private methods37426.10%
Functions159
▷ Named functions10062.89%
▷ Anonymous functions5937.11%
Constants145
▷ Global constants9867.59%
▷ Class constants4732.41%
▷ Public constants47100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/content-restrictor-for-divi.png6.66KB3.35KB▼ 49.68%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%