88% affiliate-promotions

Code Review | Affiliate Promotions

WordPress plugin Affiliate Promotions scored 88% from 53 tests.

About plugin

  • Plugin page: affiliate-promotions
  • Plugin version: 0.1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.9.5
  • WordPress version: 5.8.1
  • First release: Mar 27, 2017
  • Latest release: May 15, 2018
  • Number of updates: 26
  • Update frequency: every 15.5 days
  • Top authors: leduchuy89vn (76.92%)gearazk (26.92%)

Code review

53 tests

User reviews

3 reviews

Install metrics

10+ active / 998 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.00MB] [CPU: ▼255.35ms] Passed 4 tests

An overview of server-side resources used by Affiliate Promotions
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.83 ▲0.1132.49 ▲12.45
Dashboard /wp-admin3.06 ▲0.0044.44 ▲7.87
Posts /wp-admin/edit.php3.11 ▲0.0041.26 ▼2.15
Add New Post /wp-admin/post-new.php5.42 ▼0.0195.25 ▼1,026.04
Media Library /wp-admin/upload.php3.00 ▲0.0030.66 ▼1.06

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 391 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Affiliate Promotions
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,674 ▲9215.43 ▼0.129.83 ▲2.5244.59 ▲2.03
Dashboard /wp-admin2,931 ▲785.92 ▲0.02155.52 ▼3.12112.86 ▲5.15
Posts /wp-admin/edit.php2,706 ▼02.69 ▼0.0067.27 ▼5.5198.61 ▲2.67
Add New Post /wp-admin/post-new.php1,577 ▼27618.51 ▼0.31389.03 ▼30.69115.15 ▲6.88
Media Library /wp-admin/upload.php1,772 ▼05.02 ▼0.02161.68 ▼10.74115.49 ▼12.45

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/templates/image-advanced.php
    • > /wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/templates/media.php
    • > /wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/templates/upload.php
  • 96× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Text_Field' not found in wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/fields/color.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/affiliate-promotions/includes/libs/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/affiliate-promotions/includes/libs/vendor/guzzlehttp/psr7/src/BufferStream.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/affiliate-promotions/includes/libs/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\UriInterface' not found in wp-content/plugins/affiliate-promotions/includes/libs/vendor/guzzlehttp/psr7/src/Uri.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Text_Field' not found in wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/fields/url.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/affiliate-promotions/includes/offers/shortcodes.php:154
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Select_Field' not found in wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/fields/select-advanced.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/affiliate-promotions/includes/libs/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Field' not found in wp-content/plugins/affiliate-promotions/includes/libs/meta-box/inc/fields/custom-html.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Tags: You are using too many tags: 11 tag instead of maximum 10
  • Screenshots: No descriptions were found for these screenshots #3, #4 in affiliate-promotions/assets to your readme.txt
You can look at the official readme.txt

affiliate-promotions/affiliate-promotions.php Passed 13 tests

The main file in "Affiliate Promotions" v. 0.1.6 serves as a complement to information provided in readme.txt and as the entry point to the plugin
81 characters long description:
Promote promotions and deals of products and earn money with affiliate referrals.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin28,390 lines of code in 340 files:
LanguageFilesBlank linesComment linesLines of code
PHP1883,1857,53816,053
CSS442681294,219
JavaScript851,1634184,094
Markdown984302,946
PO File2266276608
JSON600372
YAML212049
make211031
XML10017
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity12.41
▷ Minimum class complexity1.00
▷ Maximum class complexity198.00
Average method complexity2.67
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces8
Interfaces14
Traits2
Classes127
▷ Abstract classes75.51%
▷ Concrete classes12094.49%
▷ Final classes54.17%
Methods1,014
▷ Static methods29629.19%
▷ Public methods88286.98%
▷ Protected methods302.96%
▷ Private methods10210.06%
Functions250
▷ Named functions15662.40%
▷ Anonymous functions9437.60%
Constants78
▷ Global constants4355.13%
▷ Class constants3544.87%
▷ Public constants35100.00%

Plugin size Passed 1 test

Image compression Passed 1 test

Using a strong compression for your PNG files is a great way to speed-up your plugin
18 compressed PNG files occupy 0.03MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/libs/meta-box/img/jqueryui/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
includes/libs/meta-box/img/jqueryui/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
public/assets/assets/button-corner_red.png0.66KB0.66KB0.00%
includes/libs/meta-box/img/jqueryui/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%
public/assets/img/thumb-small.png1.47KB1.49KB0.00%