73% amazon-product-in-a-post-plugin

Code Review | Amazon Product in a Post Plugin

WordPress plugin Amazon Product in a Post Plugin scored73%from 54 tests.

About plugin

  • Plugin page: amazon-product-in...
  • Plugin version: 5.2.2
  • PHP compatiblity: 5.6.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.6.1
  • WordPress version: 6.3.1
  • First release: Sep 17, 2009
  • Latest release: Feb 22, 2021
  • Number of updates: 77
  • Update frequency: every 54.3 days
  • Top authors: prophecy2040 (94.81%)flowdee (6.49%)

Code review

54 tests

User reviews

53 reviews

Install metrics

2,000+ active /219,924 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.43MB] [CPU: ▼1.72ms] Passed 4 tests

An overview of server-side resources used by Amazon Product in a Post Plugin
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.14 ▲0.6839.87 ▲1.45
Dashboard /wp-admin4.00 ▲0.7053.65 ▲6.53
Posts /wp-admin/edit.php4.11 ▲0.7658.39 ▲13.42
Add New Post /wp-admin/post-new.php5.55 ▼0.3465.72 ▼24.38
Media Library /wp-admin/upload.php3.92 ▲0.6942.32 ▲9.54
Getting Started /wp-admin/admin.php?page=apipp-main-menu3.9036.83
Shortcodes/Blocks /wp-admin/admin.php?page=apipp_plugin-shortcode3.9939.21
New Amazon Post /wp-admin/admin.php?page=apipp-add-new3.9039.58
Button Settings /wp-admin/admin.php?page=apipp_plugin-button-url3.9349.05
FAQs/Help /wp-admin/admin.php?page=apipp_plugin-faqs3.9738.26
Plugin Settings /wp-admin/admin.php?page=apipp_plugin_admin3.9044.03
Product Cache /wp-admin/admin.php?page=apipp-cache-page3.8934.37

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 111 new files
Database: 1 new table, 12 new options
New tables
wp_amazoncache
New WordPress options
db_upgraded
widget_recent-posts
apipp_dbversion
widget_recent-comments
theysaidso_admin_options
apipp_amazon_debugkey
appip_encodemode
widget_theysaidso_widget
apipp_amazon_cache_sec
can_compress_scripts
...

Browser metrics Passed 4 tests

An overview of browser requirements for Amazon Product in a Post Plugin
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,062 ▲31613.23 ▼1.531.59 ▼0.2340.57 ▼0.53
Dashboard /wp-admin2,454 ▲2665.84 ▼0.0398.04 ▼16.5842.24 ▲0.38
Posts /wp-admin/edit.php2,306 ▲2172.13 ▲0.1248.27 ▲9.9837.41 ▲3.78
Add New Post /wp-admin/post-new.php6,418 ▲4,89928.08 ▲4.77839.60 ▲151.0036.69 ▼19.34
Media Library /wp-admin/upload.php1,681 ▲2964.29 ▲0.0793.25 ▼9.4144.45 ▼1.13
Getting Started /wp-admin/admin.php?page=apipp-main-menu1,4962.1526.3228.34
Shortcodes/Blocks /wp-admin/admin.php?page=apipp_plugin-shortcode2,8532.1140.4130.59
New Amazon Post /wp-admin/admin.php?page=apipp-add-new1,3072.1040.3163.86
Button Settings /wp-admin/admin.php?page=apipp_plugin-button-url1,4683.2750.9431.15
FAQs/Help /wp-admin/admin.php?page=apipp_plugin-faqs2,1792.1823.4352.47
Plugin Settings /wp-admin/admin.php?page=apipp_plugin_admin2,1691.9827.6853.98
Product Cache /wp-admin/admin.php?page=apipp-cache-page1,0561.8027.0430.29

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_amazoncache
  • This plugin does not fully uninstall, leaving 12 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • apipp_product_upgraded_version
    • apipp_dbversion
    • appip_encodemode
    • can_compress_scripts
    • theysaidso_admin_options
    • apipp_amazon_cache_sec
    • db_upgraded
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

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
  • 14× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Amazon_Product_Shortcode' not found in wp-content/plugins/amazon-product-in-a-post-plugin/inc/class-shortcode-search.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amazon-product-in-a-post-plugin/inc/aws-signed-request.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amazon-product-in-a-post-plugin/inc/class-add-custom-mce.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Amazon_Product_Shortcode' not found in wp-content/plugins/amazon-product-in-a-post-plugin/inc/class-shortcode-elements.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amazon-product-in-a-post-plugin/inc/options.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amazon-product-in-a-post-plugin/inc/tools.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Amazon_Product_Shortcode' not found in wp-content/plugins/amazon-product-in-a-post-plugin/inc/class-shortcode-grid.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amazon-product-in-a-post-plugin/inc/aws-signed-request-test.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/amazon-product-in-a-post-plugin/inc/class-featured-image.php:186
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/amazon-product-in-a-post-plugin/amazon-product-in-a-post.php:48

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 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
4 plugin tags: amazon, amazon affiliate, amazon product, amazon associate

amazon-product-in-a-post-plugin/amazon-product-in-a-post.php 92% from 13 tests

"Amazon Product in a Post Plugin" version 5.2.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("amazon-product-in-a-post-plugin.php" instead of "amazon-product-in-a-post.php")

Code Analysis 97% from 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 detected27,533 lines of code in 45 files:
LanguageFilesBlank linesComment linesLines of code
PO File74,1655,63915,723
PHP203858159,656
JavaScript1144781,378
CSS64021760
SVG10016

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
It is recommended to fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 310)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity95.73
▷ Minimum class complexity2.00
▷ Maximum class complexity310.00
Average method complexity15.21
▷ Minimum method complexity1.00
▷ Maximum method complexity310.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods100
▷ Static methods2020.00%
▷ Public methods8787.00%
▷ Protected methods00.00%
▷ Private methods1313.00%
Functions96
▷ Named functions8689.58%
▷ Anonymous functions1010.42%
Constants11
▷ Global constants11100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
45 PNG files occupy 0.80MB with 0.50MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/new-buyamzon-button-com.png6.43KB2.23KB▼ 65.40%
images/signup-step-misc2.png46.81KB20.22KB▼ 56.80%
images/signup-step2.png28.61KB10.44KB▼ 63.52%
images/custom-icon.png6.78KB2.14KB▼ 68.39%
images/signup-step8.png34.43KB14.42KB▼ 58.13%