66% gallery-portfolio

Code Review | Portfolio Gallery - Responsive Image Gallery

WordPress plugin Portfolio Gallery - Responsive Image Gallery scored66%from 54 tests.

About plugin

  • Plugin page: gallery-portfolio
  • Plugin version: 1.4.8
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-6.3
  • WordPress version: 6.3.1
  • First release: Jun 24, 2016
  • Latest release: Oct 20, 2023
  • Number of updates: 132
  • Update frequency: every 20.3 days
  • Top authors: totalsoft (100%)

Code review

54 tests

User reviews

58 reviews

Install metrics

2,000+ active /121,153 total downloads

Benchmarks

Plugin footprint 64% from 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: ▲5.18MB] [CPU: ▲4.00ms] 75% from 4 tests

A check of server-side resources used by Portfolio Gallery - Responsive Image Gallery
The following require your attention
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 5.18MB on /wp-admin/admin.php?page=Total_Soft_Portfolio_General)
PageMemory (MB)CPU Time (ms)
Home /9.17 ▲5.7154.64 ▲15.46
Dashboard /wp-admin9.19 ▲5.8554.49 ▼2.94
Posts /wp-admin/edit.php9.19 ▲5.8456.32 ▲8.77
Add New Post /wp-admin/post-new.php9.19 ▲3.3190.64 ▼5.30
Media Library /wp-admin/upload.php9.19 ▲5.9755.67 ▲20.81
Support /wp-admin/admin.php?page=9.1941.22
Total Products /wp-admin/admin.php?page=Total_Soft_Products9.1938.00
Portfolio Manager /wp-admin/admin.php?page=Total_Soft_Portfolio9.19121.86
General Options /wp-admin/admin.php?page=Total_Soft_Portfolio_General9.24225.99

Server storage [IO: ▲8.61MB] [DB: ▲0.03MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 131 new files
Database: 10 new tables, 7 new options
New tables
wp_totalsoft_new_plugin
wp_totalsoft_portfolio_dbt
wp_totalsoft_portfolio_albums
wp_totalsoft_portfolio_id
wp_totalsoft_portfolio_manager
wp_totalsoft_portfolio_images
wp_totalsoft_portfolio_dbt_4
wp_totalsoft_portfolio_dbt_1
wp_totalsoft_portfolio_dbt_2
wp_totalsoft_portfolio_dbt_3
New WordPress options
widget_recent-posts
theysaidso_admin_options
widget_total_soft_portfolio
widget_recent-comments
db_upgraded
can_compress_scripts
widget_theysaidso_widget

Browser metrics 75% from 4 tests

A check of browser resources used by Portfolio Gallery - Responsive Image Gallery
It is time to focus on the following
  • Nodes: For the best user experience, please reduce the number of DOM nodes under 25,000 (currently 119,212 on /wp-admin/admin.php?page=Total_Soft_Portfolio_General)
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,963 ▲20213.62 ▼1.049.59 ▲7.3742.36 ▼4.09
Dashboard /wp-admin2,279 ▲995.82 ▲0.1785.41 ▲1.4478.54 ▲34.57
Posts /wp-admin/edit.php2,183 ▲832.30 ▲0.3633.57 ▼3.2933.60 ▲0.22
Add New Post /wp-admin/post-new.php1,755 ▲22923.09 ▼0.12671.10 ▼4.0937.60 ▼17.17
Media Library /wp-admin/upload.php1,478 ▲784.50 ▲0.33109.66 ▲10.2689.89 ▲45.73
Support /wp-admin/admin.php?page=1,0192.0025.7427.96
Total Products /wp-admin/admin.php?page=Total_Soft_Products1,0172.0125.8823.81
Portfolio Manager /wp-admin/admin.php?page=Total_Soft_Portfolio2,2864.3865.91161.45
General Options /wp-admin/admin.php?page=Total_Soft_Portfolio_General119,2122.0180.2873.75

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie tables detected upon uninstall: 10 tables
    • wp_totalsoft_portfolio_dbt_1
    • wp_totalsoft_portfolio_dbt_3
    • wp_totalsoft_portfolio_images
    • wp_totalsoft_new_plugin
    • wp_totalsoft_portfolio_dbt
    • wp_totalsoft_portfolio_dbt_4
    • wp_totalsoft_portfolio_albums
    • wp_totalsoft_portfolio_manager
    • wp_totalsoft_portfolio_id
    • wp_totalsoft_portfolio_dbt_2
  • The uninstall procedure has failed, leaving 7 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_total_soft_portfolio
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=Total_Soft_Portfolio
    • > Notice in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-New.php+99
    Undefined offset: 0
    • > GET request to /wp-admin/admin.php?page=Total_Soft_Portfolio
    • > Notice in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-New.php+99
    Trying to get property 'Portfolio_ID' of non-object

SRP 50% 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 take a closer look at the following
  • 21× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Install.php on line 4
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Media.php on line 3
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Install.php on line 7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Widget.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-New.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Settings.php:2
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Install.php on line 10
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Portfolio-Install.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Products.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/gallery-portfolio/Includes/Total-Soft-Pricing.php:2

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 87% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: Add descriptions for screenshots #6, #7, #8, #9 in gallery-portfolio/assets to your readme.txt
  • Screenshots: Please add images for these screenshots: #14 (An example of plugin in action (Slider)), #15 (An example of plugin in action (Slider)), #16 (An example of plugin in action (Album Animation)), #17 (An example of plugin in action (Album Animation))
The official readme.txt is a good inspiration

gallery-portfolio/index.php 85% from 13 tests

Analyzing the main PHP file in "Portfolio Gallery - Responsive Image Gallery" version 1.4.8
You should first fix the following items:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("gallery-portfolio.php" instead of "index.php")
  • Description: The description should be shorter than 140 characters (currently 244 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected38,564 lines of code in 79 files:
LanguageFilesBlank linesComment linesLines of code
PHP9046626,840
CSS16401749,236
JavaScript500581,553
SVG400935

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 486)
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity487.00
▷ Minimum class complexity487.00
▷ Maximum class complexity487.00
Average method complexity163.00
▷ Minimum method complexity1.00
▷ Maximum method complexity486.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods00.00%
▷ Public methods3100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions27
▷ Named functions27100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
16 PNG files occupy 3.93MB with 2.32MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
Images/Products/Gallery_video.png135.83KB50.52KB▼ 62.80%
Images/Products/Event_Calendar.png31.90KB31.51KB▼ 1.22%
Images/Sprite/urban-sprite.png684.26KB281.66KB▼ 58.84%
Images/Products/Portfolio.png383.06KB68.48KB▼ 82.12%
Images/Products/Pricing_Table.png404.40KB41.69KB▼ 89.69%