63% expandable-paywall

Code Review | Expandable Paywall

WordPress plugin Expandable Paywall scored63%from 54 tests.

About plugin

  • Plugin page: expandable-paywall
  • Plugin version: 2.0.20
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-6.4.2
  • WordPress version: 6.3.1
  • First release: Mar 4, 2020
  • Latest release: Nov 22, 2023
  • Number of updates: 30
  • Update frequency: every 46.3 days
  • Top authors: mattpramschufer (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /1,577 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲5.56MB] [CPU: ▲27.42ms] 75% from 4 tests

A check of server-side resources used by Expandable Paywall
Please have a look at the following items
  • Extra RAM: The extra memory usage should kept under 5MB (currently 5.56MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.33 ▲5.8664.42 ▲22.49
Dashboard /wp-admin9.35 ▲6.0478.87 ▲30.28
Posts /wp-admin/edit.php9.35 ▲5.9984.51 ▲38.62
Add New Post /wp-admin/post-new.php10.25 ▲4.36118.65 ▲23.04
Media Library /wp-admin/upload.php9.35 ▲6.1168.03 ▲33.85
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius9.3562.21

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 908 new files
Database: 1 new table, 10 new options
New tables
wp_expandable_paywall_log
New WordPress options
fs_debug_mode
widget_recent-comments
db_upgraded
expandable-paywall_logging_database_present
fs_accounts
theysaidso_admin_options
widget_theysaidso_widget
fs_active_plugins
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Expandable Paywall
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,828 ▲6614.31 ▼0.401.48 ▼0.2128.42 ▼16.93
Dashboard /wp-admin2,233 ▲655.52 ▼0.1698.19 ▼2.8946.65 ▲1.47
Posts /wp-admin/edit.php2,142 ▲422.02 ▲0.0140.63 ▲3.8040.34 ▲1.52
Add New Post /wp-admin/post-new.php1,573 ▲4722.40 ▼0.67683.23 ▲2.3455.26 ▲0.55
Media Library /wp-admin/upload.php1,438 ▲354.26 ▲0.08100.03 ▼2.6048.74 ▲6.25
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,0931.6628.1729.73

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/expandable-paywall/vendor/freemius/wordpress-sdk/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_expandable_paywall_log
  • Zombie WordPress options were found after uninstall: 10 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • fs_debug_mode
    • expandable-paywall_logging_database_present
    • theysaidso_admin_options
    • fs_accounts
    • db_upgraded
    • widget_recent-posts
    • fs_active_plugins
    • can_compress_scripts

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
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 fix the following items
  • 15× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Grav\\Common\\Plugin' not found in wp-content/plugins/expandable-paywall/vendor/select2/select2/docs/plugins/simplesearch/simplesearch.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/expandable-paywall/admin/partials/settings-authentication-roles.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Grav\\Common\\Plugin' not found in wp-content/plugins/expandable-paywall/vendor/select2/select2/docs/plugins/highlight/highlight.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/expandable-paywall/public/templates/register.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/expandable-paywall/admin/partials/settings.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Grav\\Common\\Plugin' not found in wp-content/plugins/expandable-paywall/vendor/select2/select2/docs/plugins/breadcrumbs/breadcrumbs.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/expandable-paywall/admin/partials/settings-sidebar.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Grav\\Console\\ConsoleCommand' not found in wp-content/plugins/expandable-paywall/vendor/select2/select2/docs/plugins/error/cli/LogCommand.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Grav\\Common\\Plugin' not found in wp-content/plugins/expandable-paywall/vendor/select2/select2/docs/plugins/error/error.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/expandable-paywall/admin/partials/log.php:2

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
10 plugin tags: paywall, hard paywall, pcs link, cambey west, ip based authentication...

expandable-paywall/expandable-paywall.php Passed 13 tests

The primary PHP file in "Expandable Paywall" version 2.0.20 is used by WordPress to initiate all plugin functionality
97 characters long description:
A simple paywall solution with integration with several third party providers for authentication.

Code Analysis 97% from 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 plugin103,596 lines of code in 758 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript23712,1526,61545,435
PHP1568,87818,36536,254
CSS1001,3786218,126
Sass1321,0115344,639
Markdown621,61004,485
SVG4012,697
YAML28550807
Twig24560557
HTML7650344
JSON700250
Bourne Shell1002

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,096)
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity65.69
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity4.41
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces6
Interfaces1
Traits0
Classes74
▷ Abstract classes22.70%
▷ Concrete classes7297.30%
▷ Final classes00.00%
Methods1,451
▷ Static methods25817.78%
▷ Public methods1,02570.64%
▷ Protected methods261.79%
▷ Private methods40027.57%
Functions111
▷ Named functions10594.59%
▷ Anonymous functions65.41%
Constants153
▷ Global constants10367.32%
▷ Class constants5032.68%
▷ Public constants50100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
78 PNG files occupy 1.04MB with 0.45MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/select2/select2/docs/themes/site/images/favicon.png1.13KB1.03KB▼ 9.09%
vendor/select2/select2/docs/pages/images/flags/ri.png6.76KB3.13KB▼ 53.76%
vendor/select2/select2/docs/pages/images/flags/wv.png44.19KB5.77KB▼ 86.94%
vendor/select2/select2/docs/themes/site/images/apple-touch-icon.png1.59KB1.49KB▼ 6.21%
vendor/select2/select2/docs/pages/images/flags/mi.png10.23KB4.30KB▼ 57.95%