78% similar-posts-ai-spai

Code Review | SPAI - Similar posts AI Plugin

WordPress plugin SPAI - Similar posts AI Plugin scored78%from 54 tests.

About plugin

  • Plugin page: similar-posts-ai-...
  • Plugin version: 1.8.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Oct 1, 2021
  • Latest release: Oct 8, 2023
  • Number of updates: 73
  • Update frequency: every 10.1 days
  • Top authors: spaisite (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /1,566 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.29MB] [CPU: ▼0.78ms] Passed 4 tests

Server-side resources used by SPAI - Similar posts AI Plugin
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.81 ▲0.3545.15 ▲1.95
Dashboard /wp-admin3.62 ▲0.3155.05 ▼0.55
Posts /wp-admin/edit.php3.67 ▲0.3151.57 ▲3.86
Add New Post /wp-admin/post-new.php6.15 ▲0.2793.06 ▼3.18
Media Library /wp-admin/upload.php3.48 ▲0.2537.34 ▼1.35
Similar Posts AI /wp-admin/options-general.php?page=spai3.47354.31

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 61 new files
Database: 1 new table, 8 new options
New tables
wp_spai_posts_data_sync
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_spai_widget
widget_theysaidso_widget
db_upgraded
widget_recent-posts
spai_table_posts_data_sync_version
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for SPAI - Similar posts AI Plugin
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,928 ▲16714.04 ▼0.317.93 ▲5.7940.57 ▼2.67
Dashboard /wp-admin2,215 ▲355.42 ▼0.2391.81 ▼8.0042.08 ▼2.69
Posts /wp-admin/edit.php2,123 ▲232.38 ▲0.3842.29 ▲4.9635.15 ▼2.25
Add New Post /wp-admin/post-new.php1,547 ▲1023.39 ▲5.25643.16 ▲13.9838.02 ▼23.71
Media Library /wp-admin/upload.php1,423 ▲234.90 ▲0.70101.16 ▼2.9541.68 ▼5.03
Similar Posts AI /wp-admin/options-general.php?page=spai8522.3030.1222.34

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 8 options
    • can_compress_scripts
    • spai_table_posts_data_sync_version
    • widget_spai_widget
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 50% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/similar-posts-ai-spai/public/partials/spai-public-display.php
    • > /wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-contact.php
    • > /wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-statistic.php
  • 29× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: api_key in wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-monetization.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/similar-posts-ai-spai/admin/partials/spai-admin-display.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/similar-posts-ai-spai/includes/class-spai-widget-form.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/similar-posts-ai-spai/includes/widget-templates/template4.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/similar-posts-ai-spai/admin/partials/spai-admin-setup.php:20
    • > PHP Notice
      Undefined variable: clicksStat in wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-statistic.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-monetization.php:10
    • > PHP Warning
      array_walk() expects parameter 1 to be array, null given in wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-statistic.php on line 9
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-statistic.php on line 5
    • > PHP Warning
      Use of undefined constant __SPAI_SITE__ - assumed '__SPAI_SITE__' (this will throw an Error in a future version of PHP) in wp-content/plugins/similar-posts-ai-spai/admin/partials/tab-content/spai-tab-monetization.php on line 4

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 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed: The official readme.txt might help

similar-posts-ai-spai/spai.php 85% from 13 tests

The main PHP script in "SPAI - Similar posts AI Plugin" version 1.8.0 is automatically included on every request by WordPress
You should first fix the following items:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("similar-posts-ai-spai.php" instead of "spai.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected5,018 lines of code in 50 files:
LanguageFilesBlank linesComment linesLines of code
PHP366451,6133,014
CSS417710925
JavaScript8219228891
PO File2746188

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity17.91
▷ Minimum class complexity1.00
▷ Maximum class complexity139.00
Average method complexity3.26
▷ Minimum method complexity1.00
▷ Maximum method complexity78.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes23
▷ Abstract classes00.00%
▷ Concrete classes23100.00%
▷ Final classes00.00%
Methods172
▷ Static methods1810.47%
▷ Public methods12170.35%
▷ Protected methods179.88%
▷ Private methods3419.77%
Functions7
▷ Named functions571.43%
▷ Anonymous functions228.57%
Constants24
▷ Global constants625.00%
▷ Class constants1875.00%
▷ Public constants18100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
public/img/default-picture.png7.65KB2.94KB▼ 61.57%