78% promotion-slider

Code Review | Promotion Slider

WordPress plugin Promotion Slider scored 78% from 54 tests.

About plugin

  • Plugin page: promotion-slider
  • Plugin version: 3.3.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-3.5.1
  • WordPress version: 5.9.2
  • First release: Sep 28, 2010
  • Latest release: Apr 12, 2013
  • Number of updates: 88
  • Update frequency: every 10.6 days
  • Top authors: woodent (100%)

Code review

54 tests

User reviews

39 reviews

Install metrics

4,000+ active / 300,942 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▼0.11MB] [CPU: ▼306.80ms] Passed 4 tests

A check of server-side resources used by Promotion Slider
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.80 ▲0.2858.64 ▼2.06
Dashboard /wp-admin3.48 ▲0.0724.76 ▼16.39
Posts /wp-admin/edit.php3.60 ▼0.0429.49 ▼10.14
Add New Post /wp-admin/post-new.php6.26 ▼0.7183.91 ▼1,198.62
Media Library /wp-admin/upload.php3.54 ▲0.2523.45 ▼1.11
Sliders /wp-admin/edit-tags.php?taxonomy=promotion-categories&post_type=ps_promotion3.4733.65
Add New Promotion /wp-admin/post-new.php?post_type=ps_promotion3.7740.11
Promotions /wp-admin/edit.php?post_type=ps_promotion3.5825.57
Slider Options /wp-admin/edit.php?post_type=ps_promotion&page=options3.4621.98

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 27 new files
Database: no new tables, 1 new option
New WordPress options
promotion_slider_options

Browser metrics Passed 4 tests

Checking browser requirements for Promotion Slider
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,966 ▲22415.67 ▼0.119.22 ▲1.822.69 ▲0.52
Dashboard /wp-admin2,939 ▲816.03 ▼0.16124.12 ▼12.60169.60 ▲1.92
Posts /wp-admin/edit.php2,735 ▲443.24 ▼0.0164.24 ▼2.32146.10 ▼5.95
Add New Post /wp-admin/post-new.php1,690 ▼2716.65 ▼4.94420.46 ▼53.00159.11 ▲3.55
Media Library /wp-admin/upload.php1,745 ▲505.48 ▼0.01141.97 ▼21.22214.92 ▲15.99
Sliders /wp-admin/edit-tags.php?taxonomy=promotion-categories&post_type=ps_promotion1,7592.7855.87110.55
Add New Promotion /wp-admin/post-new.php?post_type=ps_promotion3,46510.20210.79224.20
Promotions /wp-admin/edit.php?post_type=ps_promotion1,5663.1864.92153.16
Slider Options /wp-admin/edit.php?post_type=ps_promotion&page=options1,8572.5266.77168.20

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] 75% 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 did not uninstall successfully, leaving 1 option in the database
    • promotion_slider_options

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
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ps_promotion&page=options
    • > User deprecated in wp-includes/functions.php+5691
    contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 8× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/promotion-slider/includes/functions.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/promotion-slider/index.php:28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/promotion-slider/includes/help.slider_options.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/promotion-slider/includes/help.categories.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/promotion-slider/includes/help.promotions.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/promotion-slider/includes/options_page.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/promotion-slider/includes/help.add_new_promotion.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/promotion-slider/includes/meta_box.php:3

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Tags: There are too many tags (25 tag instead of maximum 10)
The official readme.txt might help

promotion-slider/index.php 85% from 13 tests

Analyzing the main PHP file in "Promotion Slider" version 3.3.4
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("promotion-slider.php" instead of "index.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 349 characters long)

Code Analysis Passed 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
Success! There were no dangerous files found in this plugin1,450 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP152903381,205
JavaScript14633120
CSS2611114
HTML110011

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity21.12
▷ Minimum class complexity1.00
▷ Maximum class complexity102.00
Average method complexity3.06
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods78
▷ Static methods2835.90%
▷ Public methods5469.23%
▷ Protected methods2025.64%
▷ Private methods45.13%
Functions6
▷ Named functions6100.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.06MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/nav.png11.40KB6.12KB▼ 46.26%
css/images/title.png45.60KB22.40KB▼ 50.87%
css/images/next.png1.02KB0.89KB▼ 12.43%
css/images/prev.png1.02KB0.89KB▼ 12.54%
css/images/slide.png1.60KB0.84KB▼ 47.71%