78% cp-image-gallery

Code Review | CP Image Gallery

WordPress plugin CP Image Gallery scored 78% from 54 tests.

About plugin

  • Plugin page: cp-image-gallery
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.8.3
  • WordPress version: 5.8.1
  • First release: Jul 15, 2016
  • Latest release: Nov 13, 2017
  • Number of updates: 10
  • Update frequency: every 48.8 days
  • Top authors: commercepundit (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active / 2,176 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.69MB] [CPU: ▼131.84ms] Passed 4 tests

Server-side resources used by CP Image Gallery
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.55 ▲1.8346.22 ▲22.30
Dashboard /wp-admin4.86 ▲1.8163.89 ▲19.73
Posts /wp-admin/edit.php4.98 ▲1.8661.37 ▲6.95
Add New Post /wp-admin/post-new.php6.76 ▲1.3394.06 ▼566.92
Media Library /wp-admin/upload.php4.80 ▲1.8050.27 ▲12.90
Freemius Debug [v.1.2.1] /wp-admin/admin.php?page=freemius4.8539.75
Add New /wp-admin/post-new.php?post_type=cpgallery4.8053.85
All CP Galleries /wp-admin/edit.php?post_type=cpgallery4.8448.61

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 304 new files
Database: no new tables, 4 new options
New WordPress options
fs_api_cache
fs_debug_mode
fs_active_plugins
fs_accounts

Browser metrics Passed 4 tests

Checking browser requirements for CP Image Gallery
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,793 ▲15615.87 ▲0.2811.44 ▲2.0247.93 ▼6.96
Dashboard /wp-admin3,052 ▲1215.95 ▼0.25154.23 ▼22.26133.46 ▲11.68
Posts /wp-admin/edit.php2,823 ▲842.73 ▲0.0276.27 ▲0.61116.07 ▲8.74
Add New Post /wp-admin/post-new.php1,636 ▼4717.31 ▼1.43378.97 ▼6.05116.79 ▼3.89
Media Library /wp-admin/upload.php1,889 ▲825.06 ▲0.03161.41 ▲4.73150.52 ▲18.12
Freemius Debug [v.1.2.1] /wp-admin/admin.php?page=freemius1,3732.1159.5989.06
Add New /wp-admin/post-new.php?post_type=cpgallery3,0798.94232.21157.18
All CP Galleries /wp-admin/edit.php?post_type=cpgallery1,4902.6665.3198.19

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 4 options
    • fs_debug_mode
    • fs_accounts
    • fs_api_cache
    • fs_active_plugins

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/post-new.php?post_type=cpgallery
    • > Notice in wp-content/plugins/cp-image-gallery/inc/metabox.php+16
    Undefined index: cp_seometabox

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cp-image-gallery/inc/admin-page.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cp-image-gallery/inc/cp-gallery.php:49
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/cp-image-gallery/inc/single-cpgallery.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
7 plugin tags: commercepundit, image gallery, simple, galleries, image...

cp-image-gallery/cp-image-gallery.php 92% from 13 tests

The main PHP script in "CP Image Gallery" version 1.0.1 is automatically included on every request by WordPress
The following require your attention:
  • Description: The description should be shorter than 140 characters (currently 147 characters long)

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
Everything looks great! No dangerous files found in this plugin19,358 lines of code in 123 files:
LanguageFilesBlank linesComment linesLines of code
PHP783,2577,59013,609
PO File47347651,809
Sass15248801,558
JavaScript83831261,445
CSS137333682
Markdown1590191
JSON20042
YAML22022

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity41.49
▷ Minimum class complexity1.00
▷ Maximum class complexity943.00
Average method complexity3.41
▷ Minimum method complexity1.00
▷ Maximum method complexity73.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes71
▷ Abstract classes45.63%
▷ Concrete classes6794.37%
▷ Final classes00.00%
Methods1,243
▷ Static methods17213.84%
▷ Public methods90973.13%
▷ Protected methods241.93%
▷ Private methods31024.94%
Functions146
▷ Named functions146100.00%
▷ Anonymous functions00.00%
Constants186
▷ Global constants15281.72%
▷ Class constants3418.28%
▷ Public constants34100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
48 compressed PNG files occupy 0.09MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/lib/images/prettyPhoto/facebook/contentPatternLeft.png0.13KB0.10KB▼ 24.82%
inc/lib/fancybox/fancy_nav_right.png1.42KB1.66KB0.00%
inc/lib/images/prettyPhoto/dark_rounded/contentPattern.png0.13KB0.09KB▼ 25.38%
inc/lib/fancybox/fancy_title_over.png0.07KB0.09KB0.00%
inc/lib/fancybox/fancy_shadow_nw.png0.32KB0.47KB0.00%