84% wp-random-post-thumbnails

Code Review | WP Random Post Thumbnails

WordPress plugin WP Random Post Thumbnails scored84%from 54 tests.

About plugin

  • Plugin page: wp-random-post-th...
  • Plugin version: 2.5.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.9.4
  • WordPress version: 6.3.1
  • First release: Dec 28, 2014
  • Latest release: Jul 2, 2018
  • Number of updates: 154
  • Update frequency: every 8.3 days
  • Top authors: bdeleasa (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

4,000+ active /28,491 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.88MB] [CPU: ▲6.08ms] Passed 4 tests

This is a short check of server-side resources used by WP Random Post Thumbnails
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.89 ▲0.4344.80 ▲5.97
Dashboard /wp-admin4.38 ▲1.0852.63 ▲0.27
Posts /wp-admin/edit.php4.40 ▲1.0452.41 ▲4.35
Add New Post /wp-admin/post-new.php6.91 ▲1.02101.74 ▲13.71
Media Library /wp-admin/upload.php4.24 ▲1.0148.64 ▲13.77
Random Thumbnails /wp-admin/options-general.php?page=wprpt_options5.0557.58

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

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

Browser metrics Passed 4 tests

Checking browser requirements for WP Random Post Thumbnails
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,817 ▲7114.48 ▼0.161.52 ▼0.2039.19 ▼1.06
Dashboard /wp-admin2,220 ▲465.90 ▲1.0198.25 ▼19.4939.56 ▼7.89
Posts /wp-admin/edit.php2,106 ▲202.07 ▲0.0637.20 ▲0.1933.50 ▼0.61
Add New Post /wp-admin/post-new.php1,526 ▼823.19 ▼0.12589.56 ▼38.9054.88 ▲1.48
Media Library /wp-admin/upload.php1,405 ▲174.27 ▲0.0797.91 ▼4.0742.57 ▼1.82
Random Thumbnails /wp-admin/options-general.php?page=wprpt_options2,5264.24103.8728.71

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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
Please fix the following items
  • 40× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_Multi_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_Title.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_Taxonomy_Select.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_Taxonomy_Radio.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/helper-functions.php:127
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_File_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Hookup_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/rest-api/CMB2_REST.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_File_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_File_List.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Multi_Base' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_Taxonomy_Base.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Taxonomy_Multicheck' not found in wp-content/plugins/wp-random-post-thumbnails/includes/cmb2/includes/types/CMB2_Type_Taxonomy_Multicheck_Hierarchical.php:13

User-side errors Passed 1 test

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

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
6 plugin tags: post thumbnails, random thumbnails, random post thumbnail, random images, random post thumbnails...

wp-random-post-thumbnails/wp-random-thumbnails.php 85% from 13 tests

The primary PHP file in "WP Random Post Thumbnails" version 2.5.0 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("wp-random-post-thumbnails.php" instead of "wp-random-thumbnails.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 183 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin48,138 lines of code in 223 files:
LanguageFilesBlank linesComment linesLines of code
PO File12014,31518,50232,323
PHP622,3766,6887,667
CSS131,1661,1484,654
Sass16300251,378
JavaScript73384551,373
Markdown42870726
JSON10017

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity19.33
▷ Minimum class complexity1.00
▷ Maximum class complexity181.00
Average method complexity3.23
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes69
▷ Abstract classes811.59%
▷ Concrete classes6188.41%
▷ Final classes00.00%
Methods565
▷ Static methods8715.40%
▷ Public methods46081.42%
▷ Protected methods8915.75%
▷ Private methods162.83%
Functions60
▷ Named functions5083.33%
▷ Anonymous functions1016.67%
Constants11
▷ Global constants545.45%
▷ Class constants654.55%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
14 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
includes/cmb2/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
includes/cmb2/images/ico-delete.png0.70KB0.72KB0.00%
includes/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
includes/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%