82% wp-theme-optimizer

Code Review | WP Theme Optimizer

WordPress plugin WP Theme Optimizer scored 82% from 54 tests.

About plugin

  • Plugin page: wp-theme-optimizer
  • Plugin version: 1.1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.6
  • WordPress version: 5.8.1
  • First release: Jul 30, 2016
  • Latest release: Nov 7, 2016
  • Number of updates: 21
  • Update frequency: every 4.8 days
  • Top authors: dsgnr (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

900+ active / 10,407 total downloads

Benchmarks

Plugin footprint Passed 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.02MB] [CPU: ▼139.98ms] Passed 4 tests

Server-side resources used by WP Theme Optimizer
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.1436.02 ▲11.89
Dashboard /wp-admin3.08 ▲0.0347.85 ▲2.26
Posts /wp-admin/edit.php3.14 ▲0.0346.15 ▼0.25
Add New Post /wp-admin/post-new.php5.44 ▲0.0192.86 ▼559.56
Media Library /wp-admin/upload.php3.03 ▲0.0331.04 ▼2.38
WP Theme Optimizer /wp-admin/options-general.php?page=wpto3.0731.60

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 50 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP Theme Optimizer
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,708 ▲11215.77 ▲0.159.39 ▼0.8243.79 ▼7.57
Dashboard /wp-admin2,972 ▲445.91 ▼0.26151.29 ▼10.88112.38 ▼8.80
Posts /wp-admin/edit.php2,741 ▲22.69 ▲0.0070.89 ▼0.1093.73 ▲3.12
Add New Post /wp-admin/post-new.php1,686 ▲318.73 ▲0.43393.59 ▼4.57105.81 ▼1.25
Media Library /wp-admin/upload.php1,812 ▲54.99 ▼0.03163.76 ▼10.33113.91 ▼2.41
WP Theme Optimizer /wp-admin/options-general.php?page=wpto1,8583.5282.5490.24

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 25% 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
  • 36 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wpto
    • > Notice in wp-content/plugins/wp-theme-optimizer/admin/partials/wpto-admin-display.php+78
    Trying to access array offset on value of type bool

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/wp-theme-optimizer/public/partials/wpto-public-display.php
  • 24× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/wp-theme-optimizer/admin/partials/wpto_theme_scripts.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/wp-theme-optimizer/admin/partials/wpto_wc.php:12
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-theme-optimizer/includes/partials/public-misc.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-theme-optimizer/admin/partials/includes/wpto-scripts/08-remove-shortlink.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/wp-theme-optimizer/admin/partials/wpto-admin-display.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-theme-optimizer/admin/partials/includes/wpto-scripts/02-remove-jquery-migrate.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-theme-optimizer/admin/partials/includes/wpto-theme-links/01-remove-oembed.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-theme-optimizer/admin/partials/includes/wpto-scripts/01-remove-query-strings.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-theme-optimizer/admin/partials/includes/wpto-scripts/04-remove-comments-css.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-theme-optimizer/includes/partials/public-scripts.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed: Please take inspiration from this readme.txt

wp-theme-optimizer/wpto.php 85% from 13 tests

The main PHP file in "WP Theme Optimizer" ver. 1.1.4 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("wp-theme-optimizer.php" instead of "wpto.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected1,551 lines of code in 43 files:
LanguageFilesBlank linesComment linesLines of code
PHP372745081,289
CSS2511156
JavaScript24013447
Markdown119036
JSON10023

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity26.86
▷ Minimum class complexity1.00
▷ Maximum class complexity102.00
Average method complexity3.34
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods92
▷ Static methods22.17%
▷ Public methods8794.57%
▷ Protected methods00.00%
▷ Private methods55.43%
Functions3
▷ Named functions3100.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
No PNG images were found in this plugin