78% click-to-tweet

Code Review | Click To Tweet

WordPress plugin Click To Tweet scored78%from 54 tests.

About plugin

  • Plugin page: click-to-tweet
  • Plugin version: 2.0.14
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-4.9.6
  • WordPress version: 6.3.1
  • First release: Jul 8, 2016
  • Latest release: Jul 2, 2018
  • Number of updates: 37
  • Update frequency: every 19.6 days
  • Top authors: clicktotweet (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

1,000+ active /45,884 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.17MB] [CPU: ▼0.32ms] Passed 4 tests

A check of server-side resources used by Click To Tweet
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1643.56 ▼1.50
Dashboard /wp-admin3.47 ▲0.1752.26 ▼1.66
Posts /wp-admin/edit.php3.58 ▲0.2356.09 ▲5.06
Add New Post /wp-admin/post-new.php6.07 ▲0.1896.39 ▼2.66
Media Library /wp-admin/upload.php3.39 ▲0.1640.14 ▲4.55
Click To Tweet /wp-admin/options-general.php?page=ctt3.3631.25

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 61 new files
Database: no new tables, 9 new options
New WordPress options
ctt_image_setting
can_compress_scripts
widget_theysaidso_widget
db_upgraded
ctt_hint_box
theysaidso_admin_options
widget_recent-comments
ctt_box_setting
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Click To Tweet
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲5514.22 ▼0.132.33 ▼0.0247.73 ▲1.13
Dashboard /wp-admin2,200 ▲235.57 ▼0.1085.83 ▼10.6153.37 ▲9.61
Posts /wp-admin/edit.php2,111 ▲142.04 ▲0.0239.83 ▲3.5349.06 ▲12.42
Add New Post /wp-admin/post-new.php1,533 ▼223.06 ▲4.62597.81 ▼77.3643.06 ▼36.25
Media Library /wp-admin/upload.php1,402 ▲54.27 ▲0.03138.36 ▲27.3852.10 ▲6.13
Click To Tweet /wp-admin/options-general.php?page=ctt7742.0735.4847.41

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 9 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • ctt_box_setting
    • theysaidso_admin_options
    • can_compress_scripts
    • ctt_image_setting
    • ctt_hint_box
    • db_upgraded
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 40× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/click-to-tweet/view/ctt-settings.php:3
    • > PHP Notice
      Undefined variable: bopt in wp-content/plugins/click-to-tweet/view/author-box.php on line 26
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/click-to-tweet/view/author-box.php on line 28
    • > PHP Notice
      Undefined variable: bopt in wp-content/plugins/click-to-tweet/view/author-box.php on line 29
    • > PHP Notice
      Undefined variable: bopt in wp-content/plugins/click-to-tweet/view/author-box.php on line 12
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/click-to-tweet/view/author-box.php on line 12
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/click-to-tweet/view/author-box.php on line 28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/click-to-tweet/view/hint-box.php:1
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/click-to-tweet/view/author-box.php on line 10
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/click-to-tweet/view/author-box.php on line 13

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=ctt
    • > Javascript (severe) in unknown
    /wp-admin/options-general.php?page=ctt 152:40 Uncaught TypeError: Cannot read properties of null (reading 'focus')

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
8 plugin tags: twitter plugin, click to tweet, share, clicktotweet, social media...

click-to-tweet/ctt.php 85% from 13 tests

The principal PHP file in "Click To Tweet" v. 2.0.14 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 150 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("click-to-tweet.php" instead of "ctt.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected5,646 lines of code in 33 files:
LanguageFilesBlank linesComment linesLines of code
PHP174367283,109
PO File82473001,111
CSS41741091,000
JavaScript2314350
Markdown123050
JSON10026

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity17.83
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity2.78
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes211.11%
▷ Concrete classes1688.89%
▷ Final classes00.00%
Methods174
▷ Static methods169.20%
▷ Public methods12370.69%
▷ Protected methods21.15%
▷ Private methods4928.16%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants150.00%
▷ Class constants150.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
11 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/img/tw.png5.64KB3.36KB▼ 40.50%
images/sprite-twitter.png9.13KB5.65KB▼ 38.13%
images/pattern.png0.19KB0.19KB▼ 0.52%
images/editor-ticon.png1.45KB0.59KB▼ 59.30%
images/down-arrow-1.png1.25KB0.87KB▼ 30.60%