65% api-video

Code Review | api.video

WordPress plugin api.video scored65%from 54 tests.

About plugin

  • Plugin page: api-video
  • Plugin version: 1.0.9
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.2
  • WordPress version: 6.3.1
  • First release: Mar 8, 2022
  • Latest release: Oct 24, 2023
  • Number of updates: 7
  • Update frequency: every 85.0 days
  • Top authors: apivideoecosystem (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /662 total downloads

Benchmarks

Plugin footprint 82% 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.05MB] [CPU: ▼10.97ms] 75% from 4 tests

An overview of server-side resources used by api.video
The following require your attention
  • CPU: You should keep total CPU usage under 500.00ms (currently 568.93ms on /wp-admin/admin.php?page=settings-api-video)
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0637.49 ▼5.89
Dashboard /wp-admin3.37 ▲0.0243.98 ▼15.93
Posts /wp-admin/edit.php3.42 ▲0.0647.40 ▼5.60
Add New Post /wp-admin/post-new.php5.97 ▲0.0879.93 ▼16.45
Media Library /wp-admin/upload.php3.29 ▲0.0636.40 ▲5.01
Settings /wp-admin/admin.php?page=settings-api-video3.75568.93
Library /wp-admin/admin.php?page=api.video-library3.75414.37
Add New /wp-admin/admin.php?page=add-new-video3.75433.71

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 637 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for api.video
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,827 ▲6613.25 ▼1.105.41 ▲3.6439.54 ▼0.92
Dashboard /wp-admin2,228 ▲514.97 ▼0.6399.97 ▲10.8942.39 ▲2.45
Posts /wp-admin/edit.php2,139 ▲392.45 ▲0.4634.99 ▼0.3629.05 ▼8.40
Add New Post /wp-admin/post-new.php1,559 ▲3123.23 ▲2.31664.00 ▲56.4635.62 ▼16.14
Media Library /wp-admin/upload.php1,423 ▲234.20 ▲0.0197.55 ▲2.8540.68 ▼4.10
Settings /wp-admin/admin.php?page=settings-api-video8471.9326.1825.06
Library /wp-admin/admin.php?page=api.video-library8191.9325.3521.45
Add New /wp-admin/admin.php?page=add-new-video8192.0526.7921.82

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=add-new-video
    • > Notice in wp-content/plugins/api-video/includes/av_functions.php+31
    Undefined property: stdClass::$token_type
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=add-new-video
    • > Notice in wp-content/plugins/api-video/includes/av_functions.php+32
    Undefined property: stdClass::$access_token

SRP 0% 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 fix the following items
  • 7× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/video_upload/resources/views/response.blade.php
    • > /wp-content/plugins/api-video/api.video.php
    • > /wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/infinite_scroll/resources/views/holidayView.blade.php
    • > /wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/video_upload/resources/views/welcome.blade.php
    • > /wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/infinite_scroll/resources/views/data.blade.php
    • > /wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/video_upload/resources/views/home.blade.php
    • > /wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/infinite_scroll/resources/views/welcome.blade.php
  • 322× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'ApiVideo\\Client\\Model\\ModelInterface' not found in wp-content/plugins/api-video/vendor/api-video/php-api-client/src/Model/Metadata.php:27
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/delete_token.php on line 5
    • > PHP Warning
      require(wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/authenticate.php on line 2
    • > PHP Fatal error
      Uncaught Error: Interface 'ApiVideo\\Client\\Model\\ModelInterface' not found in wp-content/plugins/api-video/vendor/api-video/php-api-client/src/Model/TokenCreationPayload.php:27
    • > PHP Fatal error
      Uncaught LogicException: You cannot use "Symfony\\Component\\HttpClient\\AmpHttpClient" as the "amphp/http-client" package is not installed. Try running "composer require amphp/http-client:^4.2.1". in wp-content/plugins/api-video/vendor/symfony/http-client/AmpHttpClient.php:33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function env() in wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/video_upload/config/database.php:18
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/create_token.php on line 4
    • > PHP Fatal error
      Uncaught Error: Interface 'ApiVideo\\Client\\Model\\ModelInterface' not found in wp-content/plugins/api-video/vendor/api-video/php-api-client/src/Model/RefreshTokenPayload.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Illuminate\\Foundation\\Http\\Middleware\\TrimStrings' not found in wp-content/plugins/api-video/vendor/api-video/php-api-client/examples/laravel/infinite_scroll/app/Http/Middleware/TrimStrings.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface' not found in wp-content/plugins/api-video/vendor/symfony/http-client/Retry/GenericRetryStrategy.php:23

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=add-new-video
    • > 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 null (reading 'dataset')" "TypeError: Cannot read properties of null (reading 'dataset')\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/api-video/assets/script.js?ver=6.3.1:10:39)\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
    • > GET request to /wp-admin/admin.php?page=add-new-video
    • > 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 null (reading 'dataset')

Optimizations

Plugin configuration 79% 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
2 plugin tags: player, video

api-video/api.video.php 54% from 13 tests

Analyzing the main PHP file in "api.video" version 1.0.9
Please take the time to fix the following:
  • Domain Path: The domain path must begin with a forward slash character ("/where to find the translation files (see How to Internationalize Your Plugin)")
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Description: Keep the plugin description shorter than 140 characters (currently 308 characters long)
  • Domain Path: The domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("where to find the translation files (see How to Internationalize Your Plugin)")
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("api-video.php" instead of "api.video.php")
  • Git Repository: A Git repository was detected inside this plugin

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
Good job! No executable or dangerous file extensions detected49,729 lines of code in 548 files:
LanguageFilesBlank linesComment linesLines of code
PHP3826,87415,42227,471
CSS41,513488,962
JSON25008,895
Markdown1112,12903,419
JavaScript7158249446
Blade6468354
YAML64092
XML40272
Sass24617
SVG1001

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity9.27
▷ Minimum class complexity1.00
▷ Maximum class complexity181.00
Average method complexity2.20
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces46
Interfaces51
Traits14
Classes261
▷ Abstract classes62.30%
▷ Concrete classes25597.70%
▷ Final classes5621.96%
Methods2,052
▷ Static methods20610.04%
▷ Public methods1,88091.62%
▷ Protected methods231.12%
▷ Private methods1497.26%
Functions181
▷ Named functions3016.57%
▷ Anonymous functions15183.43%
Constants59
▷ Global constants46.78%
▷ Class constants5593.22%
▷ Public constants4072.73%

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
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
.wordpress-org/icon-256x256.png7.58KB3.94KB▼ 48.03%
.wordpress-org/icon-128x128.png3.95KB2.33KB▼ 41.10%
vendor/api-video/php-api-client/tests/resources/logo.png8.12KB4.03KB▼ 50.38%