62% sirv

Code Review | Image Optimizer, Resizer and CDN - Sirv

WordPress plugin Image Optimizer, Resizer and CDN - Sirv scored62%from 54 tests.

About plugin

  • Plugin page: sirv
  • Plugin version: 7.1.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.3.1
  • WordPress version: 6.3.1
  • First release: Jul 23, 2015
  • Latest release: Oct 9, 2023
  • Number of updates: 227
  • Update frequency: every 13.2 days
  • Top authors: sirv (100%)

Code review

54 tests

User reviews

246 reviews

Install metrics

1,000+ active /89,339 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.15MB] [CPU: ▲4.03ms] Passed 4 tests

A check of server-side resources used by Image Optimizer, Resizer and CDN - Sirv
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2136.85 ▲0.62
Dashboard /wp-admin3.44 ▲0.1450.88 ▲1.29
Posts /wp-admin/edit.php3.49 ▲0.1352.78 ▲6.64
Add New Post /wp-admin/post-new.php6.31 ▲0.4399.04 ▲11.02
Media Library /wp-admin/upload.php3.36 ▲0.1341.76 ▲7.58
Media Library /wp-admin/admin.php?page=sirv/plugdata/media_library.php3.3737.54
Feedback /wp-admin/admin.php?page=sirv/plugdata/submenu_pages/feedback.php3.3536.48
Help /wp-admin/admin.php?page=sirv/plugdata/submenu_pages/help.php3.3937.77
Settings /wp-admin/admin.php?page=sirv/plugdata/options.php3.4039.87
Account /wp-admin/admin.php?page=sirv/plugdata/submenu_pages/account.php3.4037.42
Shortcodes /wp-admin/admin.php?page=sirv/plugdata/shortcodes-view.php3.3736.44

Server storage [IO: ▲1.53MB] [DB: ▲0.01MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 105 new files
Database: 3 new tables, 64 new options
New tables
wp_sirv_images
wp_sirv_shortcodes
wp_sirv_fetching_errors
New WordPress options
widget_recent-comments
SIRV_CUSTOM_SMV_SH_OPTIONS
SIRV_WOO_PIN
SIRV_RESPONSIVE_PLACEHOLDER
can_compress_scripts
SIRV_WOO_MAX_HEIGHT
SIRV_PARSE_STATIC_IMAGES
SIRV_FOLDER
SIRV_EXCLUDE_FILES
SIRV_WOO_TTL
...

Browser metrics Passed 4 tests

An overview of browser requirements for Image Optimizer, Resizer and CDN - Sirv
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,884 ▲12314.25 ▼0.102.03 ▲0.4943.25 ▼2.45
Dashboard /wp-admin2,262 ▲825.57 ▼0.0586.73 ▲0.4577.62 ▲33.40
Posts /wp-admin/edit.php2,173 ▲731.99 ▲0.0238.32 ▲4.4436.51 ▲0.66
Add New Post /wp-admin/post-new.php10,924 ▲9,39824.07 ▲0.621,032.31 ▲413.3036.60 ▼22.32
Media Library /wp-admin/upload.php1,461 ▲644.23 ▼0.17102.80 ▲4.7071.72 ▲31.06
Media Library /wp-admin/admin.php?page=sirv/plugdata/media_library.php8541.9924.0228.05
Feedback /wp-admin/admin.php?page=sirv/plugdata/submenu_pages/feedback.php9402.0128.9126.04
Help /wp-admin/admin.php?page=sirv/plugdata/submenu_pages/help.php1,5201.9331.1445.89
Settings /wp-admin/admin.php?page=sirv/plugdata/options.php1,0481.8727.6029.28
Account /wp-admin/admin.php?page=sirv/plugdata/submenu_pages/account.php1,0291.8727.0826.57
Shortcodes /wp-admin/admin.php?page=sirv/plugdata/shortcodes-view.php9602.0346.3730.23

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The plugin did not uninstall successfully, leaving 3 tables in the database
    • wp_sirv_fetching_errors
    • wp_sirv_shortcodes
    • wp_sirv_images
  • The uninstall procedure has failed, leaving 64 options in the database
    • SIRV_WOO_CAT_SWAP_METHOD
    • theysaidso_admin_options
    • SIRV_HTTP_AUTH_CHECK
    • SIRV_WOO_CAT_SHOWING_METHOD
    • SIRV_WOO_CAT_ITEMS
    • SIRV_WOO_PRODUCTS_MOBILE_PROFILE
    • SIRV_ENABLE_CDN
    • SIRV_CROP_SIZES
    • SIRV_HTTP_AUTH_PASS
    • SIRV_JS_MODULES
    • ...

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=sirv/plugdata/options.php
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

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
The following issues need your attention
  • 32× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/sirv/plugdata/includes/classes/query-string.class.php
    • > /wp-content/plugins/sirv/plugdata/template.php
    • > /wp-content/plugins/sirv/sirv.php
    • > /wp-content/plugins/sirv/plugdata/submenu_pages/account.php
    • > /wp-content/plugins/sirv/plugdata/submenu_pages/woocommerce.php
    • > /wp-content/plugins/sirv/plugdata/includes/classes/woo.class.php
    • > /wp-content/plugins/sirv/plugdata/includes/classes/sirv.api.class.php
    • > /wp-content/plugins/sirv/plugdata/htmlBuilders/elementor/Plugin.php
    • > /wp-content/plugins/sirv/plugdata/shortcodes.php
    • > /wp-content/plugins/sirv/plugdata/includes/classes/logger.class.php
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/sirv/plugdata/submenu_pages/settings.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sirv_getStorageInfo() in wp-content/plugins/sirv/plugdata/submenu_pages/sync.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Woo' not found in wp-content/plugins/sirv/plugdata/woo_templates/woo-category-template.php:4
    • > PHP Notice
      Undefined variable: storageInfo in wp-content/plugins/sirv/plugdata/submenu_pages/woocommerce.php on line 3
    • > PHP Warning
      Use of undefined constant SIRV_PLUGIN_RELATIVE_SUBDIR_PATH - assumed 'SIRV_PLUGIN_RELATIVE_SUBDIR_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/sirv/plugdata/submenu_pages/help.php on line 90
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sirv_getAPIClient() in wp-content/plugins/sirv/plugdata/submenu_pages/stats.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
5 plugin tags: compress, image, optimize, cdn, resize

sirv/sirv.php 92% from 13 tests

The primary PHP file in "Image Optimizer, Resizer and CDN - Sirv" version 7.1.2 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 433 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin24,849 lines of code in 87 files:
LanguageFilesBlank linesComment linesLines of code
PHP383,34061811,809
JavaScript191,7744766,911
CSS126942053,507
HTML72951152,329
SVG1115293

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity34.23
▷ Minimum class complexity2.00
▷ Maximum class complexity221.00
Average method complexity3.18
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes22
▷ Abstract classes00.00%
▷ Concrete classes22100.00%
▷ Final classes00.00%
Methods336
▷ Static methods10130.06%
▷ Public methods15546.13%
▷ Protected methods17251.19%
▷ Private methods92.68%
Functions283
▷ Named functions27898.23%
▷ Anonymous functions51.77%
Constants18
▷ Global constants1055.56%
▷ Class constants844.44%
▷ Public constants8100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
14 PNG files occupy 0.28MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
plugdata/assets/ico-folder-old.png14.14KB6.21KB▼ 56.12%
plugdata/assets/wordpress-plugin-instructions-3.png50.19KB51.62KB0.00%
plugdata/assets/add_media.png16.25KB6.52KB▼ 59.84%
plugdata/assets/ico-folder.png1.44KB0.94KB▼ 35.03%
plugdata/assets/pen.png1.14KB0.51KB▼ 55.08%