72% browser-caching-with-htaccess

Code Review | Browser Caching with .htaccess

WordPress plugin Browser Caching with .htaccess scored72%from 54 tests.

About plugin

  • Plugin page: browser-caching-w...
  • Plugin version: 1.2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.4
  • WordPress version: 6.3.1
  • First release: Sep 9, 2015
  • Latest release: Nov 19, 2015
  • Number of updates: 9
  • Update frequency: every 7.9 days
  • Top authors: tobias_.MerZ (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

1,000+ active /27,644 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼9.59ms] Passed 4 tests

This is a short check of server-side resources used by Browser Caching with .htaccess
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0437.74 ▼4.62
Dashboard /wp-admin3.35 ▲0.0446.98 ▼2.38
Posts /wp-admin/edit.php3.40 ▲0.0448.52 ▲8.16
Add New Post /wp-admin/post-new.php5.93 ▲0.0490.59 ▼29.53
Media Library /wp-admin/upload.php3.27 ▲0.0435.01 ▼1.82
Browser Caching /wp-admin/tools.php?page=bch_caching_submenu3.2129.51

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Browser Caching with .htaccess
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,895 ▲14914.10 ▼0.295.59 ▲3.6643.06 ▼0.51
Dashboard /wp-admin2,214 ▲265.88 ▲0.94109.80 ▼8.8940.74 ▼4.14
Posts /wp-admin/edit.php2,097 ▲82.04 ▼0.0040.33 ▼1.4135.51 ▼1.76
Add New Post /wp-admin/post-new.php1,521 ▼1223.43 ▲0.32661.79 ▼17.4457.50 ▲5.02
Media Library /wp-admin/upload.php1,399 ▲144.27 ▼0.03108.98 ▲7.0547.62 ▲2.19
Browser Caching /wp-admin/tools.php?page=bch_caching_submenu9831.8128.9447.60

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

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/tools.php?page=bch_caching_submenu
    • > Notice in wp-content/plugins/browser-caching-with-htaccess/adminpages/admin.php+52
    Undefined index: modified_hidden_bch

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/browser-caching-with-htaccess/open_htaccess.php
    • > /wp-content/plugins/browser-caching-with-htaccess/caching.php
    • > /wp-content/plugins/browser-caching-with-htaccess/caching_modified.php
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/browser-caching-with-htaccess/adminpages/admin.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Please fix the following attributes:
  • Screenshots: These screenshots do not have images: #1 (The Plugin Dashboard), #2 (The impact of a sample .htaccess file, shown after the 'check .htaccess file' button was clicked), #3 (Error message after 'activate Browser Caching' button was clicked and no .htaccess file was found), #4 (Success message after Browser Caching was successfully activated), #5 (To open the modification menu press the 'modify Expires' button), #6 (Error message that occurs when you are already using Browser Caching)
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === browser-caching-with-htaccess === )
The official readme.txt might help

browser-caching-with-htaccess/caching.php 92% from 13 tests

This is the main PHP file of "Browser Caching with .htaccess" version 1.2.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("browser-caching-with-htaccess.php" instead of "caching.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin352 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP457116329
CSS11018
JavaScript1005

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.22
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%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
6 PNG files occupy 0.21MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png31.43KB10.63KB▼ 66.19%
screenshot-1.png34.56KB15.36KB▼ 55.54%
screenshot-4.png47.30KB21.31KB▼ 54.94%
screenshot-3.png42.55KB19.10KB▼ 55.10%
screenshot-6.png17.64KB9.32KB▼ 47.20%