68% pay2post

Code Review | Pay2Post

WordPress plugin Pay2Post scored68%from 54 tests.

About plugin

  • Plugin page: pay2post
  • Plugin version: 0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-3.9
  • WordPress version: 6.3.1
  • First release: Apr 29, 2014
  • Latest release: Jun 14, 2014
  • Number of updates: 9
  • Update frequency: every 6.3 days
  • Top authors: chacha102 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /977 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.82MB] [CPU: ▲11.09ms] Passed 4 tests

A check of server-side resources used by Pay2Post
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.31 ▲1.8463.40 ▲22.11
Dashboard /wp-admin5.23 ▲1.9257.45 ▲5.22
Posts /wp-admin/edit.php5.29 ▲1.9362.98 ▲13.67
Add New Post /wp-admin/post-new.php7.48 ▲1.59104.85 ▲3.37
Media Library /wp-admin/upload.php5.24 ▲2.0060.50 ▲23.57
Orders /wp-admin/edit.php?post_type=transaction5.2764.28
Settings /wp-admin/admin.php?page=app-payments-settings5.2367.75

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 221 new files
Database: 2 new tables, 7 new options
New tables
wp_p2pmeta
wp_p2p
New WordPress options
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_p2p
widget_recent-posts

Browser metrics Passed 4 tests

Pay2Post: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,828 ▲4214.24 ▼0.121.67 ▼0.0139.53 ▼8.73
Dashboard /wp-admin2,226 ▲495.54 ▼0.1482.95 ▼8.6074.21 ▲32.66
Posts /wp-admin/edit.php2,137 ▲341.99 ▼0.0233.93 ▼3.5635.63 ▲2.05
Add New Post /wp-admin/post-new.php1,557 ▲3123.58 ▲0.65679.77 ▼16.48117.13 ▲65.21
Media Library /wp-admin/upload.php1,431 ▲314.08 ▼0.08105.66 ▼12.8965.61 ▲16.45
Orders /wp-admin/edit.php?post_type=transaction1,1901.9430.8332.75
Settings /wp-admin/admin.php?page=app-payments-settings1,0751.7024.6738.62

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The plugin did not uninstall successfully, leaving 2 tables in the database
    • wp_p2pmeta
    • wp_p2p
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_p2p
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=app-payments-settings
    • > User deprecated in wp-includes/functions.php+5828
    Hook contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.
    • > GET request to /wp-admin/edit.php?post_type=transaction
    • > POST request to /wp-admin/admin-ajax.php
    • > Notice in wp-content/plugins/pay2post/admin/settings.php+6
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/admin.php?page=app-payments-settings
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/admin.php?page=app-payments-settings
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

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
  • 119× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'APP_TESTS_LIB/testcase.php' (include_path='.:/usr/share/php') in wp-content/plugins/pay2post/lib/payments/tests/test_templates.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'scbAdminPage' not found in wp-content/plugins/pay2post/lib/framework/admin/class-tabs-page.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/pay2post/lib/framework/includes/wrapping.php:54
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_get_theme() in wp-content/plugins/pay2post/pay-to-post.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/pay2post/lib/payments/gateways/bank-transfer/bank-transfer.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_rtl() in wp-content/plugins/pay2post/lib/framework/templates/email-template.php:6
    • > PHP Warning
      require_once(APP_TESTS_LIB/testcase.php): failed to open stream: No such file or directory in wp-content/plugins/pay2post/lib/payments/tests/test_queue.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'P2P_Item' not found in wp-content/plugins/pay2post/lib/framework/p2p-core/item-post.php:3
    • > PHP Fatal error
      'continue' not in the 'loop' or 'switch' context in wp-content/plugins/pay2post/lib/framework/admin/importer.php on line 380
    • > PHP Warning
      require_once(APP_TESTS_LIB/testcase.php): failed to open stream: No such file or directory in wp-content/plugins/pay2post/lib/payments/tests/test_templates.php on line 8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Pay2Post is loaded with AppThemes Payments which allows you to accept a wide range of payment methods through plugins.), #2 (Insert a post form in any page or posts to allow users to submit content.), #3 (Easily set the price to post content from the backend settings.)
You can look at the official readme.txt

pay2post/pay-to-post.php 92% from 13 tests

The main PHP file in "Pay2Post" ver. 0.5 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("pay2post.php" instead of "pay-to-post.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected20,147 lines of code in 171 files:
LanguageFilesBlank linesComment linesLines of code
PHP1465,4924,71714,947
JavaScript206925313,796
CSS4113791,382
JSON10022

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity11.14
▷ Minimum class complexity1.00
▷ Maximum class complexity131.00
Average method complexity2.40
▷ Minimum method complexity1.00
▷ Maximum method complexity36.00
Code structure
Namespaces0
Interfaces3
Traits0
Classes140
▷ Abstract classes1410.00%
▷ Concrete classes12690.00%
▷ Final classes00.00%
Methods1,074
▷ Static methods24122.44%
▷ Public methods92285.85%
▷ Protected methods938.66%
▷ Private methods595.49%
Functions342
▷ Named functions342100.00%
▷ Anonymous functions00.00%
Constants61
▷ Global constants1931.15%
▷ Class constants4268.85%
▷ Public constants42100.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
45 compressed PNG files occupy 0.17MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/framework/images/chart-bar.png0.53KB0.74KB0.00%
lib/framework/styles/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
lib/framework/images/cancel.png0.83KB0.80KB▼ 3.40%
lib/framework/styles/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
images/del.png0.64KB0.72KB0.00%