10% swiftad

Code Review | SwiftAd

WordPress plugin SwiftAd scored10%from 54 tests.

About plugin

  • Plugin page: swiftad
  • Plugin version: 0.5.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.7.4
  • WordPress version: 6.3.1
  • First release: Sep 9, 2016
  • Latest release: May 25, 2017
  • Number of updates: 12
  • Update frequency: every 23.9 days
  • Top authors: ralva83702 (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

10+ active /1,438 total downloads

Benchmarks

Plugin footprint 57% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Please fix the following installer errors
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/swiftad/swiftad.php+213
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.39MB] [CPU: ▲0.24ms] 75% from 4 tests

This is a short check of server-side resources used by SwiftAd
It is recommended to improve the following
  • CPU: You should keep total CPU usage under 500.00ms (currently 10,121.78ms on /wp-admin/admin.php?page=swiftad)
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2144.04 ▲0.15
Dashboard /wp-admin3.75 ▲0.4552.70 ▲3.83
Posts /wp-admin/edit.php3.87 ▲0.5152.62 ▼10.44
Add New Post /wp-admin/post-new.php6.36 ▲0.47127.12 ▲25.52
Media Library /wp-admin/upload.php3.68 ▲0.4444.13 ▲7.41
Dashboard /wp-admin/admin.php?page=swiftad3.6610,121.78
Inventory /wp-admin/admin.php?page=swiftad-inventory3.6544.86
Swift Display Ads /wp-admin/edit.php?post_type=swiftad_post_type3.7251.03
Plugin Setup /wp-admin/admin.php?page=swiftad-settings3.6241.47
Reports /wp-admin/admin.php?page=swiftad-displayads3.6439.20
Split Testing /wp-admin/admin.php?page=swiftad-abtest3.6439.45

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 34 new files
Database: 3 new tables, 8 new options
New tables
wp_swiftad_inventory
wp_swiftad_displayad
wp_swiftad_abtest
New WordPress options
can_compress_scripts
swiftad_config
widget_recent-posts
widget_theysaidso_widget
swiftpost_license
db_upgraded
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for SwiftAd
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,873 ▲12713.39 ▼0.661.92 ▲0.2846.71 ▲5.96
Dashboard /wp-admin2,272 ▲845.92 ▲0.04117.44 ▲8.7846.62 ▲1.13
Posts /wp-admin/edit.php2,158 ▲692.24 ▲0.2242.77 ▲3.2740.12 ▲5.75
Add New Post /wp-admin/post-new.php1,573 ▲5217.61 ▼5.65658.00 ▼18.1278.12 ▲15.51
Media Library /wp-admin/upload.php1,457 ▲694.33 ▲0.11102.61 ▼11.8545.54 ▲1.81
Dashboard /wp-admin/admin.php?page=swiftad1,0142.3127.9247.77
Inventory /wp-admin/admin.php?page=swiftad-inventory9472.1933.9331.97
Swift Display Ads /wp-admin/edit.php?post_type=swiftad_post_type1,1642.2046.4033.08
Plugin Setup /wp-admin/admin.php?page=swiftad-settings9442.2244.4734.74
Reports /wp-admin/admin.php?page=swiftad-displayads8982.2130.5443.92
Split Testing /wp-admin/admin.php?page=swiftad-abtest9022.1832.6533.83

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 25 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=swiftad-abtest
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+204
    Undefined offset: 0
  • 25 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=swiftad-abtest
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+205
    Trying to get property 'guid' of non-object
  • 101 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=swiftad-abtest
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+221
    Trying to get property 'ID' of non-object
  • 26 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=swiftad-abtest
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+222
    Trying to get property 'post_title' of non-object
    • > GET request to /wp-admin/admin.php?page=swiftad-settings
    • > Notice in wp-content/plugins/swiftad/swiftad.php+1037
    Undefined index: shortcode_in_widgets
    • > GET request to /wp-admin/admin.php?page=swiftad-settings
    • > Notice in wp-content/plugins/swiftad/swiftad.php+1040
    Undefined index: serve-asap

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 fix the following
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Error' not found in wp-content/plugins/swiftad/admin/wpsa-notifications.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/swiftad/admin/swiftad_admin_functions.php:188
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/swiftad/swiftad.php:45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Screenshots: Screenshot #1 (Example of Swift Ad New Form) image missing
The official readme.txt is a good inspiration

swiftad/swiftad.php Passed 13 tests

This is the main PHP file of "SwiftAd" version 0.5.4, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
67 characters long description:
Swift Display Ads with geo targeting and per user frequency capping

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin4,172 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP74934481,953
CSS5140641,783
PO File17480237
JavaScript34042140
SVG30257
HTML1302

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity11.00
▷ Minimum class complexity11.00
▷ Maximum class complexity11.00
Average method complexity3.50
▷ Minimum method complexity2.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions46
▷ Named functions46100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
7 PNG files occupy 0.39MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png391.75KB97.55KB▼ 75.10%
images/icon-menu.png0.78KB0.73KB▼ 6.61%
images/logo.png3.80KB2.82KB▼ 25.73%
images/small-logo.png4.73KB3.75KB▼ 20.69%
images/icon-close.png1.78KB1.11KB▼ 37.92%