10% recommend-a-friend

Code Review | Recommend to a friend

WordPress plugin Recommend to a friend scored10%from 54 tests.

About plugin

  • Plugin page: recommend-a-friend
  • Plugin version: 2.2.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-4.9.5
  • WordPress version: 6.3.1
  • First release: May 4, 2011
  • Latest release: Apr 9, 2018
  • Number of updates: 53
  • Update frequency: every 48.0 days
  • Top authors: benjaminniess (94.34%)Cocola (7.55%)

Code review

54 tests

User reviews

6 reviews

Install metrics

100+ active /19,693 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/recommend-a-friend/inc/class-raf-widget.php+63
    Function create_function() is deprecated

Server metrics [RAM: ▼1.86MB] [CPU: ▼48.70ms] Passed 4 tests

Server-side resources used by Recommend to a friend
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.13 ▼1.345.41 ▼37.61
Dashboard /wp-admin2.15 ▼1.168.31 ▼35.88
Posts /wp-admin/edit.php2.15 ▼1.217.11 ▼37.16
Add New Post /wp-admin/post-new.php2.15 ▼3.746.83 ▼84.16
Media Library /wp-admin/upload.php2.15 ▼1.086.30 ▼28.14
Recommend to a friend /wp-admin/options-general.php?page=raf-options2.157.80

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 73 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
widget_recommend_a_friend
raf_options
widget_recent-comments
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Recommend to a friend
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,924 ▲15314.07 ▼0.726.42 ▲4.4440.98 ▼4.02
Dashboard /wp-admin2,228 ▲405.06 ▲0.20102.41 ▼14.4839.17 ▼3.82
Posts /wp-admin/edit.php2,095 ▲62.33 ▲0.2937.18 ▲0.1333.78 ▲0.64
Add New Post /wp-admin/post-new.php1,537 ▼523.30 ▲5.23627.33 ▲26.1335.74 ▼11.08
Media Library /wp-admin/upload.php1,417 ▲264.42 ▲0.1790.69 ▼7.4042.94 ▲1.09
Recommend to a friend /wp-admin/options-general.php?page=raf-options1,4372.8767.1626.04

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
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/recommend-a-friend/inc/class-raf-widget.php+63
    Function create_function() is deprecated
  • The uninstall procedure has failed, leaving 8 options in the database
    • raf_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recommend_a_friend
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=raf-options
    • > Deprecated in wp-content/plugins/recommend-a-friend/inc/class-raf-widget.php+63
    Function create_function() is deprecated

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/recommend-a-friend/inc/class-raf-widget.php:6
    • > PHP Notice
      Undefined variable: display_type in wp-content/plugins/recommend-a-friend/views/widget.tpl.php on line 13
    • > PHP Warning
      Use of undefined constant RAF_URL - assumed 'RAF_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/recommend-a-friend/views/raf-form.tpl.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/recommend-a-friend/recommend-to-a-friend.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'ReCaptcha\\RequestMethod' not found in wp-content/plugins/recommend-a-friend/lib/recaptcha/ReCaptcha/RequestMethod/CurlPost.php:37
    • > PHP Warning
      Use of undefined constant RAF_URL - assumed 'RAF_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/recommend-a-friend/views/raf-form.tpl.php on line 7
    • > PHP Fatal error
      Uncaught Error: Interface 'ReCaptcha\\RequestMethod' not found in wp-content/plugins/recommend-a-friend/lib/recaptcha/ReCaptcha/RequestMethod/SocketPost.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_stylesheet_directory() in wp-content/plugins/recommend-a-friend/views/raf-form.tpl.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_query_arg() in wp-content/plugins/recommend-a-friend/views/raf-link.tpl.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/recommend-a-friend/views/admin/options-page.tpl.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: share, email, widget, facebook, recommend

recommend-a-friend/recommend-to-a-friend.php 77% from 13 tests

The entry point to "Recommend to a friend" version 2.2.2 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("recommend-a-friend.php" instead of "recommend-to-a-friend.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Git Repository: Please remove the Git repository from this plugin

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
Good job! No executable or dangerous file extensions detected2,969 lines of code in 36 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript7302122932
PHP21191598751
PO File4252278577
CSS35946462
SVG100247

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity8.00
▷ Minimum class complexity1.00
▷ Maximum class complexity46.00
Average method complexity2.32
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces2
Interfaces1
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods39
▷ Static methods923.08%
▷ Public methods39100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions375.00%
▷ Anonymous functions125.00%
Constants9
▷ Global constants222.22%
▷ Class constants777.78%
▷ Public constants7100.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
25 compressed PNG files occupy 0.07MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/fancybox/fancy_shadow_nw.png0.32KB0.47KB0.00%
images/share-twt-btn.png1.78KB1.55KB▼ 13.01%
js/fancybox/fancy_shadow_e.png0.10KB0.18KB0.00%
js/fancybox/fancy_title_main.png0.09KB0.14KB0.00%
js/fancybox/fancy_close.png1.48KB1.73KB0.00%