10% ninja-galleries

Code Review | Ninja Galleries

WordPress plugin Ninja Galleries scored10%from 54 tests.

About plugin

  • Plugin page: ninja-galleries
  • Plugin version: 1.0.24
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.1
  • WordPress version: 6.3.1
  • First release: Mar 23, 2011
  • Latest release: Jun 13, 2019
  • Number of updates: 69
  • Update frequency: every 43.6 days
  • Top authors: kstover (85.51%)krmoorhouse (15.94%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /11,412 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
These installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/ninja-galleries/wpnj-media-tags/media_tags.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; wpnjMediaTags has a deprecated constructor

Server metrics [RAM: ▼1.77MB] [CPU: ▼55.07ms] Passed 4 tests

An overview of server-side resources used by Ninja Galleries
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.21 ▼1.255.55 ▼35.05
Dashboard /wp-admin2.23 ▼1.077.83 ▼45.23
Posts /wp-admin/edit.php2.23 ▼1.126.37 ▼44.26
Add New Post /wp-admin/post-new.php2.23 ▼3.656.99 ▼95.75
Media Library /wp-admin/upload.php2.23 ▼1.007.84 ▼32.22
Galleries /wp-admin/edit.php?post_type=wpnj_gallery2.235.78
Gallery Category /wp-admin/edit-tags.php?taxonomy=wpnj_gallery_cat&post_type=wpnj_gallery2.236.57
Wpnj Media Tags /wp-admin/options-general.php?page=wpnj-media-tags2.236.30
Wpnj Media Tags /wp-admin/upload.php?page=wpnj-media-tags2.236.64
Add New /wp-admin/post-new.php?post_type=wpnj_gallery2.236.74

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 25 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Ninja Galleries
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,865 ▲11913.42 ▼0.821.66 ▼0.1042.66 ▲1.36
Dashboard /wp-admin2,259 ▲685.00 ▼0.01103.02 ▼2.2659.08 ▲15.09
Posts /wp-admin/edit.php2,151 ▲622.23 ▲0.2534.29 ▼3.3833.05 ▼3.42
Add New Post /wp-admin/post-new.php1,558 ▲2517.48 ▼5.71708.88 ▲70.4758.90 ▲1.36
Media Library /wp-admin/upload.php1,447 ▲564.35 ▲0.08108.88 ▲3.7570.97 ▲24.83
Galleries /wp-admin/edit.php?post_type=wpnj_gallery1,1162.1534.9431.38
Gallery Category /wp-admin/edit-tags.php?taxonomy=wpnj_gallery_cat&post_type=wpnj_gallery1,3272.2227.6131.93
Wpnj Media Tags /wp-admin/options-general.php?page=wpnj-media-tags9161.7725.2528.61
Wpnj Media Tags /wp-admin/upload.php?page=wpnj-media-tags1,0881.8226.9730.20
Add New /wp-admin/post-new.php?post_type=wpnj_gallery2,3717.65172.91132.76

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall without warnings or errors
    • > Deprecated in wp-content/plugins/ninja-galleries/wpnj-media-tags/media_tags.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; wpnjMediaTags has a deprecated constructor
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > Deprecated in wp-content/plugins/ninja-galleries/wpnj-media-tags/media_tags.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; wpnjMediaTags has a deprecated constructor
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > User deprecated in wp-includes/functions.php+5828
    Hook contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/upload.php?page=wpnj-media-tags
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/upload.php?page=wpnj-media-tags
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > Notice in wp-content/plugins/ninja-galleries/ninja-galleries.php+368
    Undefined index: mytheme_meta_box2_nonce
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > Notice in wp-content/plugins/ninja-galleries/ninja-galleries.php+208
    Undefined variable: post_ID
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > Notice in wp-content/plugins/ninja-galleries/ninja-galleries.php+207
    Undefined variable: post
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > Notice in wp-content/plugins/ninja-galleries/ninja-galleries.php+207
    Trying to get property 'post_date' of non-object

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
The following issues need your attention
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/ninja-galleries/wpnj-media-tags/mediatags_config.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/ninja-galleries/wpnj-media-tags/mediatags_config.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/ninja-galleries/wpnj-media-tags/mediatags_config.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function feed_content_type() in wp-content/plugins/ninja-galleries/wpnj-media-tags/mediatags_rss.php:8

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There are user-side issues you should fix
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=wpnj_gallery
    • > Network (severe)
    wp-content/themes/twentytwentyone/images/icon-gallery.png - Failed to load resource: the server responded with a status of 404 (Not Found)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/upload.php?page=wpnj-media-tags
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'substr')" "TypeError: Cannot read properties of undefined (reading 'substr')\n at Object.init (/wp-content/plugins/ninja-galleries/wpnj-media-tags/mediatags_inline_edit.js:8:44)\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/ninja-galleries/wpnj-media-tags/mediatags_inline_edit.js:154:50)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/upload.php?page=wpnj-media-tags
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of undefined (reading 'substr')

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots do not have images: #1 (The add/edit gallery view.), #2 (Editing a gallery. Underneath the description you can select any number of media tags to pull into this gallery. You can also assign a category and give this gallery a featured image. The featured image will be the gallery thumbnail.), #3 (Editing a picture/media. At the bottom of the page, you can assign media tags that exist or create new ones.), #4 (The final product. The images are all inside
    tags and styled accordingly.), #5 (Since we have Lightbox Plus (v. 2.2.2) installed, clicking on an image in the gallery opens this Lightbox Popup.)
You can take inspiration from this readme.txt

ninja-galleries/ninja-galleries.php Passed 13 tests

This is the main PHP file of "Ninja Galleries" version 1.0.24, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
126 characters long description:
Ninja Galleries lets you easily create image galleries by tagging your images and then assigning those tags to a gallery page.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected2,136 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP134011921,972
JavaScript1367112
CSS19052

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity57.00
▷ Minimum class complexity57.00
▷ Maximum class complexity57.00
Average method complexity8.00
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods8
▷ Static methods00.00%
▷ Public methods8100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions69
▷ Named functions69100.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants10100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
5 PNG files occupy 1.96MB with 1.42MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-5.png960.07KB283.49KB▼ 70.47%
screenshot-1.png127.98KB33.98KB▼ 73.45%
screenshot-4.png606.80KB155.39KB▼ 74.39%
screenshot-3.png110.31KB30.53KB▼ 72.32%
screenshot-2.png197.19KB52.67KB▼ 73.29%