78% import-youtube-by-northwoods-digital

Code Review | Import YouTube by Northwoods Digital

WordPress plugin Import YouTube by Northwoods Digital scored 78% from 54 tests.

About plugin

  • Plugin page: import-youtube-by...
  • Plugin version: 1.2.0
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8.1
  • WordPress version: 5.9.2
  • First release: Apr 6, 2018
  • Latest release: Oct 16, 2021
  • Number of updates: 21
  • Update frequency: every 61.4 days
  • Top authors: mathewemoore (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 754 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▼0.06MB] [CPU: ▼314.89ms] Passed 4 tests

An overview of server-side resources used by Import YouTube by Northwoods Digital
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.79 ▲0.2749.12 ▼4.19
Dashboard /wp-admin3.62 ▲0.2125.56 ▼40.28
Posts /wp-admin/edit.php3.75 ▲0.1030.06 ▼30.35
Add New Post /wp-admin/post-new.php6.15 ▼0.8357.96 ▼1,184.73
Media Library /wp-admin/upload.php3.69 ▲0.3923.73 ▼3.06
Add New /wp-admin/post-new.php?post_type=yih4-video6.15119.21
All Videos /wp-admin/edit.php?post_type=yih4-video3.7324.01
Menus /wp-admin/nav-menus.php3.7630.84
Settings /wp-admin/edit.php?post_type=yih4-video&page=youtube_import_nwdigital&tab=display_options3.5421.30
API Key /wp-admin/edit.php?post_type=yih4-video&page=youtube_import_nwdigital&tab=display_api_key3.5420.06
Widgets /wp-admin/widgets.php5.4549.90
Import Videos /wp-admin/edit.php?post_type=yih4-video&page=youtube_import_nwdigital3.5420.83
Tags /wp-admin/edit-tags.php?taxonomy=yih4-tag&post_type=yih4-video3.6930.33
Categories /wp-admin/edit-tags.php?taxonomy=yih4-category&post_type=yih4-video3.6925.54

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 20 new files
Database: no new tables, 4 new options
New WordPress options
yih4_nwd_tab_settings_3
yih4_nwd_tab_settings_2
widget_yih4_widget_categories
yih4_nwd_channel_settings

Browser metrics Passed 4 tests

A check of browser resources used by Import YouTube by Northwoods Digital
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,920 ▲19815.94 ▲0.296.21 ▲0.502.65 ▲0.25
Dashboard /wp-admin3,001 ▲1446.05 ▼0.11116.94 ▼12.04236.29 ▲67.73
Posts /wp-admin/edit.php2,787 ▲1023.28 ▲0.0567.72 ▲3.91146.81 ▲0.47
Add New Post /wp-admin/post-new.php1,725 ▲6417.52 ▲1.90428.03 ▼18.68181.80 ▼1.28
Media Library /wp-admin/upload.php1,800 ▲995.60 ▲0.10139.55 ▲4.82186.06 ▼3.73
Add New /wp-admin/post-new.php?post_type=yih4-video9,85620.71583.43179.34
All Videos /wp-admin/edit.php?post_type=yih4-video1,5553.1874.04124.74
Menus /wp-admin/nav-menus.php2,4453.4590.72142.39
Settings /wp-admin/edit.php?post_type=yih4-video&page=youtube_import_nwdigital&tab=display_options1,5033.6077.91140.80
API Key /wp-admin/edit.php?post_type=yih4-video&page=youtube_import_nwdigital&tab=display_api_key1,2853.6774.78131.55
Widgets /wp-admin/widgets.php2,63726.03433.97142.89
Import Videos /wp-admin/edit.php?post_type=yih4-video&page=youtube_import_nwdigital1,2113.5272.56130.44
Tags /wp-admin/edit-tags.php?taxonomy=yih4-tag&post_type=yih4-video1,7192.92210.39159.20
Categories /wp-admin/edit-tags.php?taxonomy=yih4-category&post_type=yih4-video1,7242.9260.08112.90

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 1 option
    • widget_yih4_widget_categories

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
  • 21 occurences, only the last one shown
    • > GET request to /wp-admin/edit-tags.php?taxonomy=yih4-category&post_type=yih4-video
    • > Notice in wp-content/plugins/import-youtube-by-northwoods-digital/import-youtube-nwdigital.php+287
    Trying to access array offset on value of type bool
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/widgets.php
    • > Warning in wp-content/plugins/import-youtube-by-northwoods-digital/includes/public/yih4-comments.php+26
    file_get_contents(https://www.googleapis.com/youtube/v3/commentThreads?key=&textFormat=plainText&part=snippet&videoId=&maxResults=15): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden

  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/widgets.php
    • > Notice in wp-content/plugins/import-youtube-by-northwoods-digital/includes/public/yih4-comments.php+32
    Trying to access array offset on value of type null
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/widgets.php
    • > Warning in wp-content/plugins/import-youtube-by-northwoods-digital/includes/public/yih4-comments.php+28
    count(): Parameter must be an array or an object that implements Countable
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/widgets.php
    • > Warning in wp-content/plugins/import-youtube-by-northwoods-digital/includes/public/yih4-comments.php+32
    Invalid argument supplied for foreach()

SRP Passed 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Everything seems fine, however this is by no means an exhaustive test

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/post-new.php?post_type=yih4-video
    • > 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: Cannot read properties of undefined (reading 'substring')" "TypeError: Cannot read properties of undefined (reading 'substring')\n at Object.getYouTubeId (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:133949)\n at Object.create (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:136905)\n at HTMLUnknownElement.f.mediaElement.changeRenderer (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:15716)\n at HTMLUnknownElement.P [as setSrc] (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:17930)\n at HTMLUnknownElement.set (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:16380)\n at new e (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:19858)\n at r.value (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:80914)\n at r.MediaElementPlayer.init (/wp-includes/js/mediaelement/mediaelement-migrate.min.js?ver=5.9.2:1:492)\n at new r (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:76580)\n at HTMLVideoElement.\u003Canonymous> (/wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.16:12:111861)" undefined
    • > GET request to /wp-admin/post-new.php?post_type=yih4-video
    • > 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: Cannot read properties of undefined (reading 'substring')

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
9 plugin tags: video importer, youtube importer, youtube to post, videos, youtube api...

import-youtube-by-northwoods-digital/import-youtube-nwdigital.php 77% from 13 tests

The main PHP script in "Import YouTube by Northwoods Digital" version 1.2.0 is automatically included on every request by WordPress
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Description: Please don't use more than 140 characters for the plugin description (currently 156 characters long)
  • Main file name: Name the main plugin file the same as the plugin slug ("import-youtube-by-northwoods-digital.php" instead of "import-youtube-nwdigital.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected2,809 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP122781901,496
JavaScript493601,017
CSS31823296

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity7.00
▷ Minimum class complexity7.00
▷ Maximum class complexity7.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions80
▷ Named functions80100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
There were not PNG files found in your plugin