10% socialdraft

Code Review | Socialdraft

WordPress plugin Socialdraft scored10%from 54 tests.

About plugin

  • Plugin page: socialdraft
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.8
  • WordPress version: 6.3.1
  • First release: Jul 21, 2014
  • Latest release: Jul 21, 2014
  • Number of updates: 3
  • Update frequency: every 2.0 days
  • Top authors: Socialdraft (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /559 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/socialdraft/includes/pagination.class.php+2
    Methods with the same name as their class will not be constructors in a future version of PHP; pagination has a deprecated constructor

Server metrics [RAM: ▼1.81MB] [CPU: ▼55.85ms] Passed 4 tests

This is a short check of server-side resources used by Socialdraft
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.19 ▼1.275.11 ▼31.69
Dashboard /wp-admin2.21 ▼1.146.70 ▼54.57
Posts /wp-admin/edit.php2.21 ▼1.155.88 ▼44.12
Add New Post /wp-admin/post-new.php2.21 ▼3.686.47 ▼93.03
Media Library /wp-admin/upload.php2.21 ▼1.026.09 ▼26.20
Customers /wp-admin/admin.php?page=socialdraft-customers2.217.34
Settings /wp-admin/admin.php?page=socialdraft-admin-menu2.217.79
Reviews /wp-admin/admin.php?page=socialdraft-reviews2.216.12
Trendings /wp-admin/admin.php?page=socialdraft-trendings2.216.80
Socialdraft /wp-admin/options-general.php?page=socialdraft2.217.17

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 17 new files
Database: no new tables, 7 new options
New WordPress options
recovery_mode_email_last_sent
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
db_upgraded
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Socialdraft
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,824 ▲6314.35 ▲0.001.75 ▲0.0343.64 ▲4.93
Dashboard /wp-admin2,227 ▲465.51 ▼0.1891.57 ▼8.9138.16 ▼5.66
Posts /wp-admin/edit.php2,135 ▲351.95 ▼0.0239.96 ▼2.2035.96 ▲1.37
Add New Post /wp-admin/post-new.php1,563 ▲3618.19 ▼5.13624.42 ▲13.0857.59 ▲4.92
Media Library /wp-admin/upload.php1,438 ▲384.17 ▼0.0999.79 ▲1.4944.45 ▼1.56
Customers /wp-admin/admin.php?page=socialdraft-customers8561.6117.8127.02
Settings /wp-admin/admin.php?page=socialdraft-admin-menu7471.516.6820.55
Reviews /wp-admin/admin.php?page=socialdraft-reviews8561.7915.3123.33
Trendings /wp-admin/admin.php?page=socialdraft-trendings7391.516.4716.84
Socialdraft /wp-admin/options-general.php?page=socialdraft7521.516.7722.79

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
You still need to fix the following
  • This plugin did not uninstall without warnings or errors
    • > Deprecated in wp-content/plugins/socialdraft/includes/pagination.class.php+2
    Methods with the same name as their class will not be constructors in a future version of PHP; pagination has a deprecated constructor
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • recovery_mode_email_last_sent
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 0% 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)
Please fix the following server-side errors
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=socialdraft
    • > Deprecated in wp-content/plugins/socialdraft/includes/pagination.class.php+2
    Methods with the same name as their class will not be constructors in a future version of PHP; pagination has a deprecated constructor
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=socialdraft
    • > Warning in wp-includes/class-wp-hook.php+310
    call_user_func_array() expects parameter 1 to be a valid callback, function 'sd_scripts' not found or invalid function name
    • > GET request to /wp-admin/admin.php?page=socialdraft-customers
    • > Error in wp-content/plugins/socialdraft/templates/customers.php+221
    Uncaught Error: Cannot use object of type WP_Error as array in wp-content/plugins/socialdraft/templates/customers.php:221
    Stack trace:
    #0 wp-content/plugins/socialdraft/settings.php(187): include()
    #1 wp-includes/class-wp-hook.php(310): Socialdraft_Settings->plugin_customers_page()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=socialdraft-admin-menu
    • > Error in wp-admin/includes/template.php+1801
    Uncaught ArgumentCountError: Too few arguments to function do_settings_fields(), 1 passed in wp-content/plugins/socialdraft/templates/settings.php on line 30 and exactly 2 expected in wp-admin/includes/template.php:1801
    Stack trace:
    #0 wp-content/plugins/socialdraft/templates/settings.php(30): do_settings_fields()
    #1 wp-content/plugins/socialdraft/settings.php(157): include('/var/www/wordpr...')
    #2 wp-includes/class-wp-hook.php(310): Socialdraft_Settings->plugin_settings_page()
    #3 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #4 wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 wp-admin/admin.php(259): do_action()
    #6 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=socialdraft-reviews
    • > Error in wp-content/plugins/socialdraft/templates/reviews.php+174
    Uncaught Error: Cannot use object of type WP_Error as array in wp-content/plugins/socialdraft/templates/reviews.php:174
    Stack trace:
    #0 wp-content/plugins/socialdraft/settings.php(201): include()
    #1 wp-includes/class-wp-hook.php(310): Socialdraft_Settings->plugin_reviews_page()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=socialdraft-trendings
    • > Error in wp-content/plugins/socialdraft/templates/trendings.php+176
    Uncaught Error: Cannot use object of type WP_Error as array in wp-content/plugins/socialdraft/templates/trendings.php:176
    Stack trace:
    #0 wp-content/plugins/socialdraft/settings.php(173): include()
    #1 wp-includes/class-wp-hook.php(310): Socialdraft_Settings->plugin_trendings_page()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/options-general.php?page=socialdraft
    • > Error in wp-admin/includes/template.php+1801
    Uncaught ArgumentCountError: Too few arguments to function do_settings_fields(), 1 passed in wp-content/plugins/socialdraft/templates/settings.php on line 30 and exactly 2 expected in wp-admin/includes/template.php:1801
    Stack trace:
    #0 wp-content/plugins/socialdraft/templates/settings.php(30): do_settings_fields()
    #1 wp-content/plugins/socialdraft/settings.php(157): include('/var/www/wordpr...')
    #2 wp-includes/class-wp-hook.php(310): Socialdraft_Settings->plugin_settings_page()
    #3 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #4 wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 wp-admin/admin.php(259): do_action()
    #6 wp-admin/options-general.php(10): require_once('/var/www/wordpr...')
    #7 {main}
    thrown

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/socialdraft/templates/reviews.php
    • > /wp-content/plugins/socialdraft/templates/customers.php
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      require(../wp-load.php): failed to open stream: No such file or directory in wp-content/plugins/socialdraft/templates/settings.php on line 3
    • > PHP Fatal error
      require(): Failed opening required '../wp-load.php' (include_path='.:/usr/share/php') in wp-content/plugins/socialdraft/templates/settings.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/socialdraft/templates/customers.php:213
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/socialdraft/templates/trendings.php:170
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/socialdraft/socialdraft.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/socialdraft/templates/post-type-template_metabox.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/socialdraft/templates/reviews.php:166

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=socialdraft-customers
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=socialdraft-customers 336:34 Uncaught TypeError: $(...).brokenImage is not a function
    • > GET request to /wp-admin/admin.php?page=socialdraft-reviews
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=socialdraft-reviews 290:26 Uncaught TypeError: $(...).brokenImage is not a function

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: reviews, marketing, social, plugin, socialdraft

socialdraft/socialdraft.php 92% from 13 tests

"Socialdraft" version 1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 198 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
Good job! No executable or dangerous file extensions detected1,780 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP101741851,598
CSS110153
JavaScript2103926
Markdown1103

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity14.50
▷ Minimum class complexity1.00
▷ Maximum class complexity38.00
Average method complexity2.20
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods45
▷ Static methods24.44%
▷ Public methods45100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants150.00%
▷ Class constants150.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG images were found in this plugin