84% unsplash

Code Review | Unsplash

WordPress plugin Unsplash scored84%from 54 tests.

About plugin

  • Plugin page: unsplash
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.5
  • WordPress version: 6.3.1
  • First release: Jul 21, 2020
  • Latest release: Aug 12, 2020
  • Number of updates: 6
  • Update frequency: every 6.8 days
  • Top authors: unsplash (100%)

Code review

54 tests

User reviews

27 reviews

Install metrics

5,000+ active /36,956 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.67MB] [CPU: ▲0.87ms] Passed 4 tests

Analyzing server-side resources used by Unsplash
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.16 ▲0.6940.60 ▲1.87
Dashboard /wp-admin3.99 ▲0.6855.14 ▲7.50
Posts /wp-admin/edit.php4.04 ▲0.6850.47 ▲2.08
Add New Post /wp-admin/post-new.php7.22 ▲1.3396.01 ▼0.68
Media Library /wp-admin/upload.php3.85 ▲0.6237.95 ▲0.20
Unsplash /wp-admin/options-general.php?page=unsplash3.8133.71

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 47 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
db_upgraded
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Unsplash: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲10013.27 ▼0.964.51 ▲2.6142.46 ▼3.96
Dashboard /wp-admin2,226 ▲345.84 ▲0.88113.98 ▼4.2886.64 ▲45.04
Posts /wp-admin/edit.php2,123 ▲312.03 ▼0.0336.11 ▼5.8232.04 ▼3.72
Add New Post /wp-admin/post-new.php6,226 ▲4,71219.36 ▲1.74920.19 ▲192.4640.15 ▼14.44
Media Library /wp-admin/upload.php1,431 ▲434.19 ▼0.0499.46 ▼18.2671.58 ▲23.72
Unsplash /wp-admin/options-general.php?page=unsplash8272.0124.7226.57

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
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/unsplash/php/class-rest-controller.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Unsplash\\Plugin_Base' not found in wp-content/plugins/unsplash/php/class-plugin.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Unsplash\\content_url() in wp-content/plugins/unsplash/php/class-plugin-base.php:176
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Unsplash\\content_url() in wp-content/plugins/unsplash/php/class-plugin-base.php:176

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
7 plugin tags: photographs, unsplash, media, images, photos...

unsplash/unsplash.php 85% from 13 tests

"Unsplash" version 1.0.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Requires PHP: The required version number did not match the one declared in readme.txt ("5.6.20" instead of "5.6")

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 plugin9,024 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript91,04710,1305,945
PHP225691,4062,891
JSON200152
SVG30228
CSS8008

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.37
Average class complexity32.75
▷ Minimum class complexity1.00
▷ Maximum class complexity89.00
Average method complexity3.68
▷ Minimum method complexity1.00
▷ Maximum method complexity32.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes12
▷ Abstract classes18.33%
▷ Concrete classes1191.67%
▷ Final classes00.00%
Methods142
▷ Static methods10.70%
▷ Public methods13897.18%
▷ Protected methods21.41%
▷ Private methods21.41%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.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
No PNG images were found in this plugin