66% cm-context-related-product-recommendations

Code Review | CM Product Recommendations

WordPress plugin CM Product Recommendations scored66%from 54 tests.

About plugin

  • Plugin page: cm-context-relate...
  • Plugin version: 1.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.0-6.3
  • WordPress version: 6.3.1
  • First release: Sep 3, 2015
  • Latest release: Jul 23, 2023
  • Number of updates: 211
  • Update frequency: every 13.7 days
  • Top authors: CreativeMindsSolutions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /6,649 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.93MB] [CPU: ▲4.48ms] 75% from 4 tests

Server-side resources used by CM Product Recommendations
It is recommended to improve the following
  • CPU: Total CPU usage must kept under 500.00ms (currently 1,236.98ms on /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_settings)
PageMemory (MB)CPU Time (ms)
Home /4.40 ▲0.9343.35 ▼0.82
Dashboard /wp-admin4.24 ▲0.9356.34 ▲3.45
Posts /wp-admin/edit.php4.29 ▲0.9363.54 ▲14.85
Add New Post /wp-admin/post-new.php6.84 ▲0.95101.78 ▲10.20
Media Library /wp-admin/upload.php4.16 ▲0.9342.67 ▲5.10
Products /wp-admin/edit.php?post_type=cm_product_recommend4.2145.14
Upgrade ➤ /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_pro4.1138.64
Settings /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_settings4.341,236.98
User Guide /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_about4.28400.36
Add New /wp-admin/post-new.php?post_type=cm_product_recommend4.2361.70

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 89 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
cmcrpr_options
db_upgraded
widget_recent-comments
can_compress_scripts
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for CM Product Recommendations
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,844 ▲7314.74 ▲0.781.59 ▼0.2538.96 ▼3.02
Dashboard /wp-admin2,245 ▲574.82 ▼1.08122.65 ▲10.9951.49 ▲7.54
Posts /wp-admin/edit.php2,135 ▲462.44 ▲0.4372.97 ▲36.9740.15 ▲1.40
Add New Post /wp-admin/post-new.php1,584 ▲5123.13 ▼0.10663.13 ▲1.8133.08 ▼15.77
Media Library /wp-admin/upload.php1,427 ▲424.22 ▼0.01102.73 ▼31.0943.86 ▼4.82
Products /wp-admin/edit.php?post_type=cm_product_recommend1,1222.3836.6445.23
Upgrade ➤ /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_pro1,6492.2656.0196.71
Settings /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_settings2,7498.4690.48133.98
User Guide /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_about3,92616.81482.69190.40
Add New /wp-admin/post-new.php?post_type=cm_product_recommend1,6994.0972.9237.06

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • cmcrpr_options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 0% 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
  • 13 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=cm_product_recommend
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+204
    Undefined offset: 0
  • 13 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=cm_product_recommend
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+205
    Trying to get property 'guid' of non-object
  • 51 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=cm_product_recommend
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+221
    Trying to get property 'ID' of non-object
  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=cm_product_recommend
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+222
    Trying to get property 'post_title' of non-object

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 take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_about.php
    • > /wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_nav.php
  • 14× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-context-related-product-recommendations/package/views/plugin_compare_table.php:51
    • > PHP Notice
      Undefined variable: submenus in wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_nav.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_shortcode() in wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_settings.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-context-related-product-recommendations/cm-context-related-product-recommendations.php:121
    • > PHP Warning
      Use of undefined constant CMTOC_NAME - assumed 'CMTOC_NAME' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_about.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-context-related-product-recommendations/package/cminds-plugin-config.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-context-related-product-recommendations/package/cminds-plugin-config.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'CMCRPR_Base' not found in wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_template.php:6
    • > PHP Warning
      Use of undefined constant CMTOC_URL - assumed 'CMTOC_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-context-related-product-recommendations/views/backend/admin_about.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-context-related-product-recommendations/package/views/registration.php:42

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There are user-side issues you should fix
    • > GET request to /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.
    • > GET request to /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_about
    • > Deprecation (warning) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yx/r/RBH7b7zeA6F.js?_nc_x=Ij3Wp8lg5Kz 271 Listener added for a synchronous 'DOMSubtreeModified' DOM Mutation Event. This event type is deprecated (https://w3c.github.io/uievents/#legacy-event-types) and work is underway to remove it from this browser. Usage of this event listener will cause performance issues today, and represents a risk of future incompatibility. Consider using MutationObserver instead.
    • > GET request to /wp-admin/edit.php?post_type=cm_product_recommend&page=cmcrpr_about
    • > Console-api (severe) in unknown
    https://static.xx.fbcdn.net/rsrc.php/v3/yx/r/RBH7b7zeA6F.js?_nc_x=Ij3Wp8lg5Kz 60:573 "ErrorUtils caught an error:\n\nCannot listen to an undefined element. [Caught in: Tried to listen to element of type click]\n\nSubsequent non-fatal errors won't be logged; see https://fburl.com/debugjs."

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: products widget, recommended products, products, recommendations, product

cm-context-related-product-recommendations/cm-context-related-product-recommendations.php Passed 13 tests

The principal PHP file in "CM Product Recommendations" v. 1.1.3 is loaded by WordPress automatically on each request
109 characters long description:
Parses posts for defined recommended products and adds the widget with the image, short definition and links.

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
There were no executable files found in this plugin8,675 lines of code in 28 files:
LanguageFilesBlank linesComment linesLines of code
PHP181,1359296,221
CSS5161501,677
JavaScript59945777

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity63.50
▷ Minimum class complexity1.00
▷ Maximum class complexity254.00
Average method complexity4.26
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods153
▷ Static methods7850.98%
▷ Public methods14393.46%
▷ Protected methods106.54%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants29
▷ Global constants2068.97%
▷ Class constants931.03%
▷ Public constants9100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
54 PNG files occupy 0.57MB with 0.25MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/css/images/ui-bg_glass_65_ffffff_1x400.png0.20KB0.09KB▼ 57.49%
assets/css/images/ui-bg_flat_75_ffffff_40x100.png0.20KB0.08KB▼ 58.17%
package/css/images/ui-bg_glass_65_ffffff_1x400.png0.20KB0.09KB▼ 57.49%
package/views/img/v2.png0.38KB0.37KB▼ 1.79%
assets/css/images/ui-bg_glass_75_e6e6e6_1x400.png0.26KB0.15KB▼ 42.37%