10% amazon-related-products

Code Review | Amazon Related Products

WordPress plugin Amazon Related Products scored10%from 54 tests.

About plugin

  • Plugin page: amazon-related-pr...
  • Plugin version: 0.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5.1
  • WordPress version: 6.3.1
  • First release: May 28, 2013
  • Latest release: May 28, 2013
  • Number of updates: 9
  • Update frequency: N/A
  • Top authors: alaingg (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

20+ active /9,882 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/amazon-related-products/units/grid/functions.php+83
    Function create_function() is deprecated

Server metrics [RAM: ▼1.70MB] [CPU: ▼56.36ms] Passed 4 tests

Analyzing server-side resources used by Amazon Related Products
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.29 ▼1.177.57 ▼35.39
Dashboard /wp-admin2.31 ▼0.998.66 ▼47.39
Posts /wp-admin/edit.php2.31 ▼1.0510.25 ▼43.33
Add New Post /wp-admin/post-new.php2.31 ▼3.588.22 ▼99.34
Media Library /wp-admin/upload.php2.31 ▼0.928.07 ▼31.86
Amazon Related Products /wp-admin/options-general.php?page=amz-related-products2.318.15

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 21 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
db_upgraded
widget_amzrp_widget
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Amazon Related Products
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲8314.48 ▲0.101.97 ▲0.0441.50 ▼0.80
Dashboard /wp-admin2,210 ▲254.85 ▼0.02112.36 ▲6.5539.36 ▼6.38
Posts /wp-admin/edit.php2,096 ▲72.06 ▲0.0742.77 ▼1.4638.17 ▲1.29
Add New Post /wp-admin/post-new.php1,517 ▼1617.54 ▼5.41659.50 ▲28.3659.12 ▲8.86
Media Library /wp-admin/upload.php1,389 ▲14.24 ▲0.10111.00 ▼4.3548.44 ▲6.22
Amazon Related Products /wp-admin/options-general.php?page=amz-related-products1,3601.6927.9732.52

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Uninstall procedure had uncaught errors
    • > Deprecated in wp-content/plugins/amazon-related-products/units/grid/functions.php+83
    Function create_function() is deprecated
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_amzrp_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=amz-related-products
    • > Deprecated in wp-content/plugins/amazon-related-products/functions.php+666
    Function create_function() is deprecated
    • > GET request to /wp-admin/options-general.php?page=amz-related-products
    • > Notice in wp-content/plugins/amazon-related-products/includes/amzrp_regions.php+314
    Undefined variable: search_index_arr
    • > GET request to /wp-admin/options-general.php?page=amz-related-products
    • > Notice in wp-content/plugins/amazon-related-products/includes/amzrp_regions.php+314
    Trying to access array offset on value of type null

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
Please fix the following items
  • 8× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/amazon-related-products/includes/class.amzrp_widget.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/amazon-related-products/includes/class.amzrp_units.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'AMZRP_UNIT' not found in wp-content/plugins/amazon-related-products/units/grid/functions.php:9
    • > PHP Warning
      Use of undefined constant AMZRP_VERSION - assumed 'AMZRP_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/amazon-related-products/functions.php on line 47
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/amazon-related-products/includes/amzrp_regions.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'AMZRP_UNIT' not found in wp-content/plugins/amazon-related-products/units/list/functions.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/amazon-related-products/functions.php:56
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/amazon-related-products/amazon-related-products.php:28

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Screenshots: These screenshots require images: #1 (Amazon Related Products Button), #2 (Amazon Related Products Example)
  • Tags: You are using too many tags: 15 tag instead of maximum 10
You can take inspiration from this readme.txt

amazon-related-products/amazon-related-products.php Passed 13 tests

This is the main PHP file of "Amazon Related Products" version 0.1.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
52 characters long description:
Insert contextual Amazon products into your content.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected1,655 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP84571941,381
JavaScript24810152
CSS33017122

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity11.67
▷ Minimum class complexity4.00
▷ Maximum class complexity31.00
Average method complexity2.60
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods40
▷ Static methods00.00%
▷ Public methods3895.00%
▷ Protected methods00.00%
▷ Private methods25.00%
Functions28
▷ Named functions28100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
5 PNG files occupy 0.23MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/units/list.png17.27KB4.79KB▼ 72.26%
screenshot-1.png40.70KB16.46KB▼ 59.56%
images/amz-related-products.png0.62KB0.45KB▼ 27.80%
images/units/grid.png28.58KB12.35KB▼ 56.79%
screenshot-2.png147.98KB36.86KB▼ 75.09%