63% giveasap

Code Review | Simple Giveaways - Grow your business, email lists and traffic with contests

WordPress plugin Simple Giveaways - Grow your business, email lists and traffic with contests scored63%from 54 tests.

About plugin

  • Plugin page: giveasap
  • Plugin version: 2.47.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4.0
  • WordPress version: 6.3.1
  • First release: Jul 7, 2016
  • Latest release: Nov 11, 2023
  • Number of updates: 218
  • Update frequency: every 12.3 days
  • Top authors: ibenic (100%)

Code review

54 tests

User reviews

19 reviews

Install metrics

900+ active /84,459 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲7.13MB] [CPU: ▲44.96ms] 50% from 4 tests

Analyzing server-side resources used by Simple Giveaways - Grow your business, email lists and traffic with contests
Please have a look at the following items
  • RAM: You should keep total memory usage under 10MB (currently 10.83MB on /wp-admin/admin.php?page=freemius)
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 7.13MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.90 ▲6.4476.30 ▲26.61
Dashboard /wp-admin10.67 ▲7.3693.43 ▲41.74
Posts /wp-admin/edit.php10.72 ▲7.36102.00 ▲56.74
Add New Post /wp-admin/post-new.php13.41 ▲7.52141.11 ▲54.75
Media Library /wp-admin/upload.php10.59 ▲7.36115.04 ▲80.57
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius10.8376.23

Server storage [IO: ▲14.27MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 497 new files
Database: 3 new tables, 13 new options
New tables
wp_giveasap_actions
wp_giveasap_entries
wp_giveasap_meta
New WordPress options
theysaidso_admin_options
fs_active_plugins
widget_recent-comments
db_upgraded
fs_debug_mode
sg_about_page_was_read
can_compress_scripts
widget_giveasap_widget
widget_theysaidso_widget
giveasap_settings
...

Browser metrics Passed 4 tests

A check of browser resources used by Simple Giveaways - Grow your business, email lists and traffic with contests
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,024 ▲27714.18 ▼0.171.67 ▲0.0127.63 ▼18.12
Dashboard /wp-admin2,429 ▲2525.57 ▼0.02101.47 ▲8.9550.62 ▲7.74
Posts /wp-admin/edit.php2,218 ▲1182.03 ▲0.0139.03 ▲2.2236.14 ▲1.73
Add New Post /wp-admin/post-new.php1,675 ▲13923.14 ▼0.00697.66 ▲7.2454.90 ▼12.39
Media Library /wp-admin/upload.php1,517 ▲1174.11 ▼0.06111.96 ▲12.0648.77 ▲6.75
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,1541.7025.8326.03

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/giveasap/freemius/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • Zombie tables were found after uninstall: 3 tables
    • wp_giveasap_meta
    • wp_giveasap_entries
    • wp_giveasap_actions
  • This plugin did not uninstall successfully, leaving 13 options in the database
    • giveasap_settings
    • widget_recent-posts
    • fs_accounts
    • fs_active_plugins
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • giveasap_version
    • sg_about_page_was_read
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

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
  • 49× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Simple_Giveaways\\GA_Integration' not found in wp-content/plugins/giveasap/includes/integrations/class-sg-math-captcha.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Simple_Giveaways\\SG_Extra_Action' not found in wp-content/plugins/giveasap/includes/extra-actions/class-sg-action-comment.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Simple_Giveaways\\SG_Email' not found in wp-content/plugins/giveasap/includes/emails/class-sg-email-referrer.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/giveasap/admin/views/reports/reports.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'AutomatorWP_Integration_Trigger' not found in wp-content/plugins/giveasap/includes/integrations/abstracts/class-automatorwp-base-trigger.php:11
    • > PHP Notice
      Undefined variable: display in wp-content/plugins/giveasap/public/templates/template1.php on line 10
    • > PHP Fatal error
      Uncaught Error: Class 'Simple_Giveaways\\SG_Report' not found in wp-content/plugins/giveasap/admin/reports/class-sg-report-actions.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function giveasap_get_giveaways() in wp-content/plugins/giveasap/admin/views/customizer/email.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Simple_Giveaways\\SG_Extra_Action' not found in wp-content/plugins/giveasap/includes/extra-actions/class-sg-action-image.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Simple_Giveaways\\SG_Giveaway' not found in wp-content/plugins/giveasap/includes/class-sg-giveaway-limited.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 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
7 plugin tags: sweepstake, sweepstakes, giveaway, giveaways, contest...

giveasap/giveasap.php Passed 13 tests

The main PHP file in "Simple Giveaways - Grow your business, email lists and traffic with contests" ver. 2.47.1 adds more information about the plugin and also serves as the entry point for this plugin
65 characters long description:
Create beautiful giveaways and grow your email list and business.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected113,940 lines of code in 359 files:
LanguageFilesBlank linesComment linesLines of code
PHP23912,62824,23752,218
CSS269,03048432,878
JavaScript341,3406288,945
SVG19418,603
Sass381,142358,443
PO File31,1841,5702,853

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
The following items need your attention
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 3,096)
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity37.14
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity3.97
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces2
Interfaces1
Traits0
Classes160
▷ Abstract classes74.38%
▷ Concrete classes15395.62%
▷ Final classes00.00%
Methods1,988
▷ Static methods22311.22%
▷ Public methods1,56078.47%
▷ Protected methods321.61%
▷ Private methods39619.92%
Functions336
▷ Named functions33499.40%
▷ Anonymous functions20.60%
Constants152
▷ Global constants10468.42%
▷ Class constants4831.58%
▷ Public constants48100.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
51 PNG files occupy 0.69MB with 0.26MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/css/vendor/images/ui-bg_glass_65_ffffff_1x400.png0.20KB0.09KB▼ 57.49%
admin/documentation/images/schedule.png14.46KB14.78KB0.00%
assets/dist/images/ui-bg_glass_75_e6e6e6_1x400.png0.26KB0.15KB▼ 42.37%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
assets/css/vendor/images/ui-icons_888888_256x240.png6.83KB4.17KB▼ 38.92%