68% zara-4

Code Review | Zara 4 Image Compression

WordPress plugin Zara 4 Image Compression scored68%from 54 tests.

About plugin

  • Plugin page: zara-4
  • Plugin version: 1.2.17.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.1
  • WordPress version: 6.3.1
  • First release: Jan 14, 2016
  • Latest release: Mar 13, 2019
  • Number of updates: 102
  • Update frequency: every 11.3 days
  • Top authors: Zara 4 (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

200+ active /23,819 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲0.31MB] [CPU: ▼11.75ms] Passed 4 tests

This is a short check of server-side resources used by Zara 4 Image Compression
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.98 ▲0.5254.49 ▲11.90
Dashboard /wp-admin3.70 ▲0.3640.73 ▼27.53
Posts /wp-admin/edit.php3.76 ▲0.4143.15 ▼9.68
Add New Post /wp-admin/post-new.php5.94 ▲0.0576.64 ▼19.73
Media Library /wp-admin/upload.php3.64 ▲0.4247.88 ▲9.93
Zara 4 /wp-admin/options-general.php?page=zara-43.6137.34

Server storage [IO: ▲0.64MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
It is recommended to fix the following issues
  • The plugin illegally modified 1 file (0.00KB) outside of "wp-content/plugins/zara-4/" and "wp-content/uploads/"
    • (new file) .zara4_v1.2_preupgrade-backup
Filesystem: 55 new files
Database: 2 new tables, 7 new options
New tables
wp_zara4_exclude_from_bulk_compression_r1
wp_zara4_file_compression_metadata_r1
New WordPress options
zara-4_version
widget_recent-posts
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Zara 4 Image Compression
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,861 ▲10414.38 ▼0.221.67 ▼0.3541.98 ▲1.20
Dashboard /wp-admin2,264 ▲875.66 ▲0.1384.25 ▼17.2237.74 ▼5.78
Posts /wp-admin/edit.php2,107 ▲42.03 ▲0.0138.14 ▲2.3334.90 ▼3.26
Add New Post /wp-admin/post-new.php1,563 ▲1523.37 ▼0.01650.99 ▼45.9849.56 ▼11.16
Media Library /wp-admin/upload.php1,583 ▲1924.69 ▲0.46132.14 ▲25.8848.49 ▼1.98
Zara 4 /wp-admin/options-general.php?page=zara-41,2542.2054.6933.84

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% 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
  • This plugin does not fully uninstall, leaving 2 tables in the database
    • wp_zara4_exclude_from_bulk_compression_r1
    • wp_zara4_file_compression_metadata_r1
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • zara-4_version
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=zara-4
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)
    • > GET request to /wp-admin/options-general.php?page=zara-4
    • > Notice in wp-content/plugins/zara-4/lib/WordPress/AdminNotice.php+20
    Undefined index: HTTPS

SRP 50% 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
Almost there! Just fix the following items
  • 10× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Exception' not found in wp-content/plugins/zara-4/lib/API/Communication/Exception.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_AccessToken_AccessToken' not found in wp-content/plugins/zara-4/lib/API/Communication/AccessToken/ReissuableAccessToken.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_Grant_GrantRequest' not found in wp-content/plugins/zara-4/lib/API/Communication/Grant/ClientCredentialsGrantRequest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_AccessToken_AccessToken' not found in wp-content/plugins/zara-4/lib/API/Communication/AccessToken/RefreshableAccessToken.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_Authentication_Authenticator' not found in wp-content/plugins/zara-4/lib/API/Communication/Authentication/UserAuthenticator.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_Authentication_Authenticator' not found in wp-content/plugins/zara-4/lib/API/Communication/Authentication/ApplicationAuthenticator.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_Grant_GrantRequest' not found in wp-content/plugins/zara-4/lib/API/Communication/Grant/RefreshTokenGrant.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/zara-4/zara-4.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_Grant_GrantRequest' not found in wp-content/plugins/zara-4/lib/API/Communication/Grant/PasswordGrant.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Zara4_API_Communication_Exception' not found in wp-content/plugins/zara-4/lib/API/Communication/AccessDeniedException.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: You are using too many tags: 37 tag instead of maximum 10
Please take inspiration from this readme.txt

zara-4/zara-4.php Passed 13 tests

The main PHP script in "Zara 4 Image Compression" version 1.2.17.2 is automatically included on every request by WordPress
21 characters long description:
Compress your images.

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
Good job! No executable or dangerous file extensions detected2,656 lines of code in 50 files:
LanguageFilesBlank linesComment linesLines of code
PHP381,3381,5542,489
CSS340134
JavaScript972233

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity7.45
▷ Minimum class complexity1.00
▷ Maximum class complexity85.00
Average method complexity2.06
▷ Minimum method complexity1.00
▷ Maximum method complexity30.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes38
▷ Abstract classes37.89%
▷ Concrete classes3592.11%
▷ Final classes00.00%
Methods232
▷ Static methods7632.76%
▷ Public methods20086.21%
▷ Protected methods31.29%
▷ Private methods2912.50%
Functions4
▷ Named functions00.00%
▷ Anonymous functions4100.00%
Constants34
▷ Global constants38.82%
▷ Class constants3191.18%
▷ Public constants31100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/logo.png0.94KB0.95KB0.00%