77% advanced-related-posts

Code Review | Advanced Related Posts

WordPress plugin Advanced Related Posts scored77%from 54 tests.

About plugin

  • Plugin page: advanced-related-...
  • Plugin version: 1.2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Apr 27, 2021
  • Latest release: Nov 28, 2023
  • Number of updates: 61
  • Update frequency: every 15.5 days
  • Top authors: ays-pro (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,859 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.85MB] [CPU: ▼3.50ms] Passed 4 tests

Server-side resources used by Advanced Related Posts
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.31 ▲0.8554.44 ▲15.36
Dashboard /wp-admin4.19 ▲0.8549.98 ▼15.23
Posts /wp-admin/edit.php4.23 ▲0.8751.27 ▲5.97
Add New Post /wp-admin/post-new.php6.95 ▲1.0794.89 ▼6.92
Media Library /wp-admin/upload.php4.07 ▲0.8434.11 ▲2.20
PRO Features /wp-admin/admin.php?page=advanced-related-posts-related-posts-features4.1642.74
Display after post /wp-admin/admin.php?page=advanced-related-posts4.4150.41
Widget settings /wp-admin/admin.php?page=advanced-related-posts-wiget-settings4.4050.17
Our products /wp-admin/admin.php?page=advanced-related-posts-featured-plugins4.1743.06

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 152 new files
Database: 1 new table, 10 new options
New tables
wp_aysarp_settings
New WordPress options
ays_advanced_related_posts_db_version
ays_arp_banner_time
widget_recent-comments
ays_arp_sale_notification
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_advanced_related_posts

Browser metrics Passed 4 tests

An overview of browser requirements for Advanced Related Posts
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,987 ▲21513.79 ▼0.489.29 ▲7.3530.12 ▼14.99
Dashboard /wp-admin2,239 ▲625.55 ▼0.1294.22 ▼5.0280.60 ▲35.01
Posts /wp-admin/edit.php2,162 ▲591.99 ▼0.0238.48 ▼1.7537.42 ▲3.82
Add New Post /wp-admin/post-new.php6,300 ▲4,76425.87 ▲2.86925.93 ▲273.8660.46 ▲14.72
Media Library /wp-admin/upload.php1,456 ▲564.11 ▼0.0997.27 ▲0.2875.72 ▲34.98
PRO Features /wp-admin/admin.php?page=advanced-related-posts-related-posts-features1,8695.5675.14211.77
Display after post /wp-admin/admin.php?page=advanced-related-posts5,1538.67240.47161.09
Widget settings /wp-admin/admin.php?page=advanced-related-posts-wiget-settings5,0768.59228.97145.96
Our products /wp-admin/admin.php?page=advanced-related-posts-featured-plugins1,8425.4460.44132.66

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • db_upgraded
    • widget_recent-posts
    • ays_arp_banner_time
    • widget_theysaidso_widget
    • widget_advanced_related_posts
    • widget_recent-comments
    • theysaidso_admin_options
    • ays_arp_sale_notification
    • can_compress_scripts

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)
Even though no errors were found, this is by no means an exhaustive test

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 take a closer look at the following
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/advanced-related-posts/public/partials/advanced-related-posts-public-display.php
    • > /wp-content/plugins/advanced-related-posts/admin/partials/under-posts/advanced-related-under-posts-admin-display.php
    • > /wp-content/plugins/advanced-related-posts/admin/partials/advanced-related-posts-admin-display.php
    • > /wp-content/plugins/advanced-related-posts/admin/partials/settings/advanced-related-posts-settings-admin-display.php
  • 42× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/advanced-related-posts/includes/metabox/advanced-related-posts-metabox.php:151
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/advanced-related-posts/admin/partials/under-posts/actions/advanced-related-posts-under-posts-actions-options.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Advanced_Related_Posts_Widget' not found in wp-content/plugins/advanced-related-posts/widget/partials/class-advanced-related-posts-widget-grid-layout.php:31
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/advanced-related-posts/admin/partials/settings/actions/partials/advanced-related-posts-settings-actions-tab2.php:2
    • > PHP Notice
      Undefined variable: ays_tab in wp-content/plugins/advanced-related-posts/admin/partials/settings/actions/partials/advanced-related-posts-settings-actions-tab3.php on line 1
    • > PHP Warning
      Use of undefined constant ADVANCED_RELATED_POSTS_ADMIN_PATH - assumed 'ADVANCED_RELATED_POSTS_ADMIN_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/advanced-related-posts/admin/partials/under-posts/actions/advanced-related-posts-under-posts-actions.php on line 2
    • > PHP Notice
      Undefined variable: class_prefix in wp-content/plugins/advanced-related-posts/admin/partials/under-posts/actions/partials/advanced-related-posts-under-posts-actions-tab2.php on line 1
    • > PHP Notice
      Undefined variable: class_prefix in wp-content/plugins/advanced-related-posts/admin/partials/under-posts/actions/partials/advanced-related-posts-under-posts-actions-tab1.php on line 1
    • > PHP Notice
      Undefined variable: ays_tab in wp-content/plugins/advanced-related-posts/admin/partials/settings/actions/partials/advanced-related-posts-settings-actions-tab1.php on line 1
    • > PHP Notice
      Undefined variable: ays_tab in wp-content/plugins/advanced-related-posts/admin/partials/under-posts/actions/partials/advanced-related-posts-under-posts-actions-tab4.php on line 1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention: You can look at the official readme.txt

advanced-related-posts/advanced-related-posts.php 92% from 13 tests

This is the main PHP file of "Advanced Related Posts" version 1.2.7, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 145 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin13,608 lines of code in 91 files:
LanguageFilesBlank linesComment linesLines of code
PHP361,8012,1456,994
SVG23032,917
CSS184439362,717
JavaScript14153132980

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 231)
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity66.24
▷ Minimum class complexity1.00
▷ Maximum class complexity332.00
Average method complexity9.81
▷ Minimum method complexity1.00
▷ Maximum method complexity231.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes17
▷ Abstract classes00.00%
▷ Concrete classes17100.00%
▷ Final classes00.00%
Methods121
▷ Static methods1814.88%
▷ Public methods10385.12%
▷ Protected methods1310.74%
▷ Private methods54.13%
Functions13
▷ Named functions538.46%
▷ Anonymous functions861.54%
Constants13
▷ Global constants13100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
43 PNG files occupy 0.84MB with 0.33MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/icons/icon-popup-128x128.png11.65KB8.54KB▼ 26.73%
admin/images/themes/grid_theme_under_posts250.png2.26KB0.95KB▼ 57.75%
admin/images/avatars/personal_avatar.png31.34KB11.84KB▼ 62.23%
admin/images/icons/icon-sccp-128x128.png1.18KB1.18KB0.00%
admin/images/themes/classy_theme_widget250.png6.07KB3.18KB▼ 47.63%