10% pay-with-a-tweet

Code Review | Pay with a tweet

WordPress plugin Pay with a tweet scored 10% from 54 tests.

About plugin

  • Plugin page: pay-with-a-tweet
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.0
  • WordPress version: 6.3.1
  • First release: May 24, 2013
  • Latest release: Sep 8, 2014
  • Number of updates: 42
  • Update frequency: every 11.2 days
  • Top authors: rolando.caldas (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

30+ active / 5,699 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
It is recommended to fix the following installer errors
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/pay-with-a-tweet/inc/widget.php+43
    Methods with the same name as their class will not be constructors in a future version of PHP; Pwt_Widget has a deprecated constructor

Server metrics [RAM: ▼1.70MB] [CPU: ▼48.38ms] Passed 4 tests

Server-side resources used by Pay with a tweet
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.28 ▼1.189.22 ▼28.78
Dashboard /wp-admin2.30 ▼1.0010.88 ▼36.71
Posts /wp-admin/edit.php2.31 ▼1.0510.57 ▼39.14
Add New Post /wp-admin/post-new.php2.31 ▼3.5810.30 ▼88.89
Media Library /wp-admin/upload.php2.31 ▼0.9210.73 ▼25.46
New payment button /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-create-button.php2.309.63
Manage your buttons /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-buttons.php2.309.81
Upload files /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-upload.php2.309.56
Manage files /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-files.php2.3012.97
/wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-async-upload.php2.3011.00
Configuration /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-config.php2.3011.69

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 142 new files
Database: 2 new tables, 10 new options
New tables
wp_pwt_button
wp_pwt_button_stats
New WordPress options
widget_theysaidso_widget
pay-with-a-tweet_db_version
widget_pwt_widget
widget_recent-posts
pay-with-a-tweet_twitter_consumerkey
can_compress_scripts
widget_recent-comments
db_upgraded
theysaidso_admin_options
pay-with-a-tweet_twitter_consumersecret

Browser metrics Passed 4 tests

Checking browser requirements for Pay with a tweet
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,838 ▲10313.25 ▼1.394.21 ▲2.3339.11 ▼2.18
Dashboard /wp-admin2,247 ▲584.94 ▲0.02112.07 ▼10.8967.49 ▲28.11
Posts /wp-admin/edit.php2,134 ▲482.01 ▲0.0039.73 ▼0.8432.90 ▼0.99
Add New Post /wp-admin/post-new.php1,551 ▲3723.09 ▲5.38785.09 ▲142.7056.09 ▲7.56
Media Library /wp-admin/upload.php1,429 ▲384.18 ▼0.0498.86 ▼0.8575.15 ▲29.92
New payment button /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-create-button.php1,0204.6143.4259.00
Manage your buttons /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-buttons.php8152.0224.4427.61
Upload files /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-upload.php9782.5442.0131.54
Manage files /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-files.php8602.0323.9225.36
/wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-async-upload.php120.440.093.89
Configuration /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-config.php1,4259.36263.4170.69

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in Pwt_Widget is deprecated since version 4.3.0! Use __construct() instead.
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_pwt_button_stats
    • wp_pwt_button
  • This plugin did not uninstall successfully, leaving 10 options in the database
    • pay-with-a-tweet_db_version
    • widget_recent-posts
    • widget_recent-comments
    • pay-with-a-tweet_twitter_consumerkey
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • pay-with-a-tweet_twitter_consumersecret
    • db_upgraded
    • widget_pwt_widget
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-config.php
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in Pwt_Widget is deprecated since version 4.3.0! Use __construct() instead.
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-config.php
    • > User deprecated in wp-includes/functions.php+5453
    Function add_object_page is deprecated since version 4.5.0! Use add_menu_page() instead.
  • 77 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-config.php
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-create-button.php
    • > Notice in wp-content/plugins/pay-with-a-tweet/admin/pwt-create-button.php+92
    Undefined variable: key
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-create-button.php
    • > Notice in wp-content/plugins/pay-with-a-tweet/admin/pwt-create-button.php+126
    getimagesize(): Read error!
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-files.php
    • > Notice in wp-content/plugins/pay-with-a-tweet/admin/pwt-files.php+20
    Undefined index: action
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-files.php
    • > Notice in wp-content/plugins/pay-with-a-tweet/admin/pwt-files.php+49
    Undefined variable: message
    • > GET request to /wp-admin/admin.php?page=pay-with-a-tweet/admin/pwt-config.php
    • > 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=pay-with-a-tweet/admin/pwt-config.php
    • > 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 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 13× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/pay-with-a-tweet/admin/pwt-config.php:33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pay-with-a-tweet/inc/widget.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/pay-with-a-tweet/admin/pwt-async-upload.php:18
    • > PHP Warning
      Use of undefined constant PWT_PLUGIN_UPLOAD_DIR - assumed 'PWT_PLUGIN_UPLOAD_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/pay-with-a-tweet/admin/pwt-files.php on line 39
    • > PHP Notice
      Undefined index: action in wp-content/plugins/pay-with-a-tweet/admin/pwt-buttons.php on line 20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/pay-with-a-tweet/admin/pwt-files.php:46
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/pay-with-a-tweet/admin/pwt-upload.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/pay-with-a-tweet/admin/pwt-buttons.php:56
    • > PHP Notice
      Undefined index: action in wp-content/plugins/pay-with-a-tweet/admin/pwt-files.php on line 20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/pay-with-a-tweet/inc/shortcode.php:51

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need your attention:
  • Donate link: Invalid url: ""
  • Tags: Please reduce the number of tags, currently 15 tag instead of maximum 10
  • Screenshots: Add images for these screenshots: #1 (Configuration screen), #2 (Manage files), #3 (Upload files), #4 (Upload files 2), #5 (Manage buttons), #6 (New button), #7 (Widget)
You can take inspiration from this readme.txt

pay-with-a-tweet/pay-with-a-tweet.php 92% from 13 tests

The main PHP script in "Pay with a tweet" version 1.0.5 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 289 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin24,460 lines of code in 92 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript382,3912,55510,109
HTML26205,296
CSS8115425,017
XML1101,973
PHP153996751,598
PO File296110247
SVG2124220

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity8.15
▷ Minimum class complexity1.00
▷ Maximum class complexity29.00
Average method complexity2.19
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes13
▷ Abstract classes215.38%
▷ Concrete classes1184.62%
▷ Final classes00.00%
Methods82
▷ Static methods1012.20%
▷ Public methods7186.59%
▷ Protected methods22.44%
▷ Private methods910.98%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
36 PNG files occupy 0.69MB with 0.35MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
docs/img/icons/ok.png3.60KB0.90KB▼ 74.95%
docs/img/icons/visibility_protected.png0.75KB0.98KB0.00%
docs/img/icons/file-php.png3.92KB1.22KB▼ 68.78%
docs/img/iviewer/iviewer.zoom_zero.png1.07KB0.14KB▼ 87.17%
docs/img/icons/function.png0.33KB0.27KB▼ 19.23%