57% sunshine-photo-cart

Code Review | Sunshine Photo Cart: Sell photos in WordPress for free

WordPress plugin Sunshine Photo Cart: Sell photos in WordPress for free scored57%from 54 tests.

About plugin

  • Plugin page: sunshine-photo-cart
  • Plugin version: 3.0.20
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.4.1
  • WordPress version: 6.3.1
  • First release: Aug 6, 2015
  • Latest release: Nov 20, 2023
  • Number of updates: 265
  • Update frequency: every 11.5 days
  • Top authors: sunshinephotocart (77.36%)wpsunshine (23.02%)

Code review

54 tests

User reviews

131 reviews

Install metrics

1,000+ active /149,439 total downloads

Benchmarks

Plugin footprint 63% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲6.29MB] [CPU: ▲46.67ms] 25% from 4 tests

An overview of server-side resources used by Sunshine Photo Cart: Sell photos in WordPress for free
It is recommended to improve the following
  • RAM: Total memory usage should be kept under 10MB (currently 10.08MB on /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine)
  • CPU: The total CPU usage must kept under 500.00ms (currently 939.67ms on /wp-admin/admin.php?page=sunshine-update)
  • Extra RAM: The extra memory usage should kept under 5MB (currently 6.29MB on /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine)
PageMemory (MB)CPU Time (ms)
Home /8.10 ▲4.6478.75 ▲38.44
Dashboard /wp-admin10.13 ▲6.78104.48 ▲41.59
Posts /wp-admin/edit.php10.27 ▲6.91100.18 ▲52.68
Add New Post /wp-admin/post-new.php12.89 ▲7.00151.49 ▲53.96
Media Library /wp-admin/upload.php10.06 ▲6.83102.62 ▲70.26
Add New /wp-admin/post-new.php?post_type=sunshine-gallery12.91157.33
Reports /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine-reports10.08105.63
Add-ons /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine-addons10.221,193.91
All Products /wp-admin/edit.php?post_type=sunshine-product10.24100.63
All Orders /wp-admin/edit.php?post_type=sunshine-order10.2593.15
Customers /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine-customers10.0891.29
Update /wp-admin/admin.php?page=sunshine-update10.63939.67
Product Categories /wp-admin/edit-tags.php?taxonomy=sunshine-product-category&post_type=sunshine-product10.2395.06
All Galleries /wp-admin/edit.php?post_type=sunshine-gallery10.1795.07
Settings /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine10.0890.88

Server storage [IO: ▲27.04MB] [DB: ▲0.05MB] 67% from 3 tests

A short overview of filesystem and database impact
Just a few items left to fix
  • Total filesystem usage should be limited to 25MB (currently using 27.04MB)
Filesystem: 4,064 new files
Database: 3 new tables, 7 new options
New tables
wp_sunshine_sessions
wp_sunshine_order_items
wp_sunshine_order_itemmeta
New WordPress options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_recent-comments
can_compress_scripts
sunshine-product-category_children
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Sunshine Photo Cart: Sell photos in WordPress for free
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,197 ▲45014.34 ▲0.083.92 ▲2.2128.98 ▼15.34
Dashboard /wp-admin2,568 ▲3885.74 ▲0.14105.81 ▲9.1996.14 ▲49.40
Posts /wp-admin/edit.php2,224 ▲1241.98 ▼0.0339.34 ▼2.4837.35 ▲0.87
Add New Post /wp-admin/post-new.php1,783 ▲25721.36 ▼2.15700.00 ▲80.7962.16 ▲8.88
Media Library /wp-admin/upload.php1,512 ▲1094.16 ▼0.04103.43 ▲4.6473.96 ▲33.29
Add New /wp-admin/post-new.php?post_type=sunshine-gallery6,67819.60901.9961.47
Reports /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine-reports2,1785.02124.68111.56
Add-ons /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine-addons4,1323.5659.8799.10
All Products /wp-admin/edit.php?post_type=sunshine-product2,2483.9056.93108.95
All Orders /wp-admin/edit.php?post_type=sunshine-order2,3773.4560.0489.16
Customers /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine-customers2,1893.4449.1579.38
Update /wp-admin/admin.php?page=sunshine-update2,3603.4447.2190.60
Product Categories /wp-admin/edit-tags.php?taxonomy=sunshine-product-category&post_type=sunshine-product2,5173.8348.9585.48
All Galleries /wp-admin/edit.php?post_type=sunshine-gallery2,2473.6956.3995.62
Settings /wp-admin/edit.php?post_type=sunshine-gallery&page=sunshine3,5273.5364.26100.28

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The plugin did not uninstall successfully, leaving 3 tables in the database
    • wp_sunshine_order_items
    • wp_sunshine_order_itemmeta
    • wp_sunshine_sessions
  • Zombie WordPress options detected upon uninstall: 7 options
    • db_upgraded
    • sunshine-product-category_children
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
  • 11× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/sunshine-photo-cart/templates/email/style.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/admin/upgrade-footer.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/order/product-option-images.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/order/product-option-item.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/admin/promo/multi-image-products.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/admin/promo/packages.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/admin/promo/volume-galleries.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/admin/promo/price-levels.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/order/comment.php
    • > /wp-content/plugins/sunshine-photo-cart/templates/admin/promo/product-options.php
  • 632× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\StripeObject' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/SearchResult.php:28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SPC() in wp-content/plugins/sunshine-photo-cart/templates/admin/header.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/Service/Treasury/OutboundTransferService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\StripeObject' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/Collection.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/Sigma/ScheduledQueryRun.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/square/square/tests/Apis/BaseTestController.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/Refund.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/Service/ApplePayDomainService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/lib/Service/ChargeService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Square\\Apis\\BaseApi' not found in wp-content/plugins/sunshine-photo-cart/includes/vendor/square/square/src/Apis/CatalogApi.php:40

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
10 plugin tags: photo cart, proof gallery, client proofing, proofing gallery, client gallery...

sunshine-photo-cart/sunshine-photo-cart.php Passed 13 tests

"Sunshine Photo Cart: Sell photos in WordPress for free" version 3.0.20's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
96 characters long description:
Client Gallery Photo Cart & Photo Proofing Plugin for Professional Photographers using WordPress

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
It is important to fix the following items
  • For security reasons, never distribute binary or executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/sunshine-photo-cart/includes/vendor/stripe/stripe-php/data/ca-certificates.crt
376,982 lines of code in 3,996 files:
LanguageFilesBlank linesComment linesLines of code
PHP2,78540,629132,799170,971
PO File1866,21681,719145,982
Markdown1,13714,880054,405
CSS63641271,920
JavaScript102632091,253
JSON1000737
SVG1002628
XML8340489
YAML11367373
reStructuredText1156144224

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity8.68
▷ Minimum class complexity1.00
▷ Maximum class complexity301.00
Average method complexity1.78
▷ Minimum method complexity1.00
▷ Maximum method complexity93.00
Code structure
Namespaces83
Interfaces27
Traits9
Classes2,557
▷ Abstract classes170.66%
▷ Concrete classes2,54099.34%
▷ Final classes20.08%
Methods20,053
▷ Static methods1,2766.36%
▷ Public methods18,85394.02%
▷ Protected methods1240.62%
▷ Private methods1,0765.37%
Functions1,297
▷ Named functions33725.98%
▷ Anonymous functions96074.02%
Constants2,967
▷ Global constants110.37%
▷ Class constants2,95699.63%
▷ Public constants2,95499.93%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
5 PNG files occupy 0.02MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/js/select2/select2.png0.60KB0.99KB0.00%
assets/images/missing-image.png3.78KB2.07KB▼ 45.14%
includes/vendor/square/square/tests/Resources/square.png6.46KB4.88KB▼ 24.49%
assets/js/select2/select2x2.png0.83KB0.77KB▼ 6.15%
assets/images/sunshine-icon.png7.93KB3.90KB▼ 50.79%