77% custom-sitemap-template

Code Review | Custom Sitemap Shortcode

WordPress plugin Custom Sitemap Shortcode scored77%from 54 tests.

About plugin

  • Plugin page: custom-sitemap-te...
  • Plugin version: 2.6.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2.2
  • WordPress version: 6.3.1
  • First release: Jun 18, 2015
  • Latest release: Jun 29, 2023
  • Number of updates: 45
  • Update frequency: every 65.2 days
  • Top authors: anil.oxzin (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

70+ active /2,786 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.00MB] [CPU: ▼9.94ms] Passed 4 tests

A check of server-side resources used by Custom Sitemap Shortcode
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0134.84 ▼6.29
Dashboard /wp-admin3.32 ▼0.0344.47 ▼14.66
Posts /wp-admin/edit.php3.37 ▲0.0147.11 ▼1.91
Add New Post /wp-admin/post-new.php5.91 ▲0.0390.50 ▼16.91
Media Library /wp-admin/upload.php3.24 ▲0.0133.41 ▲1.79
Sitemap Settings /wp-admin/options-general.php?page=sitemap_settings3.1832.78

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 11 new files
Database: no new tables, 8 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
cst_admin_css_setting
db_upgraded
theysaidso_admin_options
cst_version

Browser metrics Passed 4 tests

This is an overview of browser requirements for Custom Sitemap Shortcode
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,937 ▲19113.83 ▼0.785.30 ▲3.6538.26 ▼3.64
Dashboard /wp-admin2,233 ▲515.10 ▼0.71110.39 ▲4.4538.85 ▼4.40
Posts /wp-admin/edit.php2,123 ▲342.35 ▲0.3441.67 ▼1.1133.98 ▼1.40
Add New Post /wp-admin/post-new.php1,535 ▲723.14 ▲4.90677.49 ▲71.7636.33 ▼20.33
Media Library /wp-admin/upload.php1,418 ▲364.35 ▲0.1697.91 ▼0.1640.99 ▼2.53
Sitemap Settings /wp-admin/options-general.php?page=sitemap_settings1,5612.6866.5330.80

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 8 options
    • widget_recent-posts
    • cst_admin_css_setting
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • cst_version
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=sitemap_settings
    • > Notice in wp-content/plugins/custom-sitemap-template/lib/functions.php+248
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/options-general.php?page=sitemap_settings
    • > Notice in wp-content/plugins/custom-sitemap-template/lib/functions.php+282
    Undefined index: cst_admin_css_field

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-sitemap-template/lib/functions.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/custom-sitemap-template/my-custom-sitemap.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention: You can look at the official readme.txt

custom-sitemap-template/my-custom-sitemap.php 77% from 13 tests

The primary PHP file in "Custom Sitemap Shortcode" version 2.6.1 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("custom-sitemap-template.php" instead of "my-custom-sitemap.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 150 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin640 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP210837470
CSS319116
JavaScript418454

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
PNG images were not found in this plugin