68% simple-photo-gallery

Code Review | Simple Photo Gallery

WordPress plugin Simple Photo Gallery scored 68% from 54 tests.

About plugin

  • Plugin page: simple-photo-gallery
  • Plugin version: v1.8.1...
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.7
  • WordPress version: 5.9.2
  • First release: Jan 4, 2014
  • Latest release: Dec 5, 2016
  • Number of updates: 32
  • Update frequency: every 33.3 days
  • Top authors: mra13 (100%)

Code review

54 tests

User reviews

20 reviews

Install metrics

3,000+ active / 102,540 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
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼297.29ms] Passed 4 tests

This is a short check of server-side resources used by Simple Photo Gallery
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.0957.58 ▲8.09
Dashboard /wp-admin3.45 ▲0.0438.29 ▲2.47
Posts /wp-admin/edit.php3.67 ▲0.0336.86 ▼11.37
Add New Post /wp-admin/post-new.php6.91 ▼0.0695.97 ▼1,177.77
Media Library /wp-admin/upload.php3.32 ▲0.0323.06 ▼2.48
Albums /wp-admin/admin.php?page=wppg_album3.5228.56
Settings /wp-admin/admin.php?page=wppg_settings3.4128.30
Gallery /wp-admin/admin.php?page=wppg_gallery3.6136.36

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 79 new files
Database: 5 new tables, 2 new options
New tables
wp_wppg_album
wp_wppg_downloads
wp_wppg_gallery
wp_wppg_global_meta
wp_wppg_settings
New WordPress options
wp_photo_configs
wp_photo_db_version

Browser metrics Passed 4 tests

Checking browser requirements for Simple Photo Gallery
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,913 ▲15916.49 ▲0.8811.02 ▲5.155.81 ▲3.13
Dashboard /wp-admin2,915 ▲716.19 ▲0.06149.03 ▲20.50179.90 ▲23.63
Posts /wp-admin/edit.php2,742 ▲513.26 ▲0.0266.58 ▲1.07165.92 ▲24.71
Add New Post /wp-admin/post-new.php1,693 ▼8018.69 ▼3.20386.70 ▼97.38214.93 ▲57.56
Media Library /wp-admin/upload.php1,733 ▲355.46 ▼0.06129.21 ▼5.65219.89 ▲33.94
Albums /wp-admin/admin.php?page=wppg_album1,4746.1098.74130.43
Settings /wp-admin/admin.php?page=wppg_settings1,7046.1484.06153.89
Gallery /wp-admin/admin.php?page=wppg_gallery1,7486.4382.52141.57

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The plugin did not uninstall successfully, leaving 5 tables in the database
    • wp_wppg_global_meta
    • wp_wppg_album
    • wp_wppg_settings
    • wp_wppg_gallery
    • wp_wppg_downloads
  • This plugin did not uninstall successfully, leaving 2 options in the database
    • wp_photo_configs
    • wp_photo_db_version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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 fix the following items
  • 7× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Photo_Gallery_Admin_Menu' not found in wp-content/plugins/simple-photo-gallery/admin/wppg-photo-settings-menu.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Photo_Gallery_List_Table' not found in wp-content/plugins/simple-photo-gallery/admin/wppg-list-galleries.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/simple-photo-gallery/classes/wppg-photo-config.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Photo_Gallery_List_Table' not found in wp-content/plugins/simple-photo-gallery/admin/wppg-list-albums.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Photo_Gallery_Admin_Menu' not found in wp-content/plugins/simple-photo-gallery/admin/wppg-album-menu.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Photo_Gallery_List_Table' not found in wp-content/plugins/simple-photo-gallery/admin/wppg-list-gallery-images.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Photo_Gallery_Admin_Menu' not found in wp-content/plugins/simple-photo-gallery/admin/wppg-gallery-menu.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please take a look at the following user-side issues
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wppg_gallery
    • > Network (severe)
    wp-content/plugins/simple-photo-gallery/js/wppg-gallery-admin-script.js?ver=5.9.2 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=wppg_album
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,thickbox,underscore,shortcode,media-upload,utils,moxiejs,plupload&ver=5.9.2 1:31592 "jQuery.Deferred exception: jQuery(...).live is not a function" "TypeError: jQuery(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/simple-photo-gallery/js/wppg_media_uploader.js?ver=5.9.2:15:38)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,thickbox,underscore,shortcode,media-upload,utils,moxiejs,plupload&ver=5.9.2:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,thickbox,underscore,shortcode,media-upload,utils,moxiejs,plupload&ver=5.9.2:2:30340)" undefined
    • > GET request to /wp-admin/admin.php?page=wppg_album
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,thickbox,underscore,shortcode,media-upload,utils,moxiejs,plupload&ver=5.9.2 1:31702 Uncaught TypeError: jQuery(...).live is not a function
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wppg_gallery
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2 1:31592 "jQuery.Deferred exception: jQuery(...).live is not a function" "TypeError: jQuery(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/simple-photo-gallery/js/wppg_media_uploader.js?ver=5.9.2:15:38)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2:2:30340)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wppg_gallery
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2 1:31702 Uncaught TypeError: jQuery(...).live is not a function

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Tags: Too many tags (21 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

simple-photo-gallery/wppg-photo-gallery.php 85% from 13 tests

The entry point to "Simple Photo Gallery" version v1.8.1... is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("simple-photo-gallery.php" instead of "wppg-photo-gallery.php")
  • Version: Use only periods and digits for the version number (ex. "1.0.3" instead of "v1.8.1...")

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
There were no executable files found in this plugin6,837 lines of code in 55 files:
LanguageFilesBlank linesComment linesLines of code
PHP297347544,687
PO File2244282823
CSS125943802
JavaScript1125258506
SVG10019

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity22.22
▷ Minimum class complexity1.00
▷ Maximum class complexity110.00
Average method complexity3.65
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes27
▷ Abstract classes13.70%
▷ Concrete classes2696.30%
▷ Final classes00.00%
Methods216
▷ Static methods4621.30%
▷ Public methods216100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants20
▷ Global constants20100.00%
▷ Class constants00.00%
▷ Public constants00.00%

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
7 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/photo-seller-banner-240-103.png12.04KB10.92KB▼ 9.33%
images/plugin-icon.png1.64KB0.91KB▼ 44.57%
images/wppg_logo_sm.png7.60KB2.25KB▼ 70.34%
js/flexslider/images/bg_play_pause.png1.51KB0.52KB▼ 65.52%
images/Camera-icon-24x24.png4.08KB1.33KB▼ 67.44%