84% replace-contents

Code Review | Replace Contents

WordPress plugin Replace Contents scored84%from 54 tests.

About plugin

  • Plugin page: replace-contents
  • Plugin version: 1.09
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Apr 5, 2021
  • Latest release: Oct 31, 2023
  • Number of updates: 31
  • Update frequency: every 30.3 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

200+ active /2,310 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.09MB] [CPU: ▼5.19ms] Passed 4 tests

This is a short check of server-side resources used by Replace Contents
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0938.28 ▼6.22
Dashboard /wp-admin3.40 ▲0.0949.28 ▼0.65
Posts /wp-admin/edit.php3.45 ▲0.0946.14 ▼5.41
Add New Post /wp-admin/post-new.php5.98 ▲0.0983.03 ▼7.20
Media Library /wp-admin/upload.php3.32 ▲0.0933.26 ▼1.91
Replace Contents /wp-admin/tools.php?page=replacecontents3.2932.94

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 7 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
can_compress_scripts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Replace Contents
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.72 ▲0.071.91 ▲0.3643.73 ▲4.44
Dashboard /wp-admin2,193 ▲165.57 ▲0.0388.05 ▼11.2239.24 ▼2.98
Posts /wp-admin/edit.php2,104 ▲12.03 ▲0.0238.09 ▼5.4734.49 ▼2.35
Add New Post /wp-admin/post-new.php1,529 ▲223.12 ▲0.06649.27 ▼122.2561.35 ▲0.31
Media Library /wp-admin/upload.php1,407 ▲74.20 ▲0.0994.56 ▼23.9043.59 ▼4.24
Replace Contents /wp-admin/tools.php?page=replacecontents1,2722.0330.6029.55

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
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

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
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/replace-contents/lib/class-replacecontents.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/replace-contents/lib/class-replacecontents.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/replace-contents/lib/class-replacecontentsadmin.php:36

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
4 plugin tags: html, contents, content, replace

replace-contents/replacecontents.php 92% from 13 tests

The main PHP script in "Replace Contents" version 1.09 is automatically included on every request by WordPress
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("replace-contents.php" instead of "replacecontents.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin1,752 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
CSS141481,222
PHP464141518
JavaScript131712

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity30.00
▷ Minimum class complexity16.00
▷ Maximum class complexity44.00
Average method complexity4.22
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods880.00%
▷ Protected methods00.00%
▷ Private methods220.00%
Functions2
▷ Named functions00.00%
▷ Anonymous functions2100.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
PNG images were not found in this plugin