10% phraseanet-client

Code Review | Phraseanet Wordpress Client

WordPress plugin Phraseanet Wordpress Client scored10%from 54 tests.

About plugin

  • Plugin page: phraseanet-client
  • Plugin version: 1.3.11
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6.0-6.0
  • WordPress version: 6.3.1
  • First release: Feb 28, 2022
  • Latest release: Jun 21, 2022
  • Number of updates: 55
  • Update frequency: every 2.1 days
  • Top authors: alchemydev (98.18%)sam0hack (3.64%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,063 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/phraseanet-client/admin/metabox.php+325
    Trying to get property 'cap' of non-object

Server metrics [RAM: ▲0.70MB] [CPU: ▲2.30ms] Passed 4 tests

A check of server-side resources used by Phraseanet Wordpress Client
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.15 ▲0.6939.97 ▼4.24
Dashboard /wp-admin4.01 ▲0.7054.74 ▲0.98
Posts /wp-admin/edit.php4.05 ▲0.7055.11 ▲9.23
Add New Post /wp-admin/post-new.php6.65 ▲0.76101.10 ▲3.22
Media Library /wp-admin/upload.php3.93 ▲0.7144.38 ▲10.82
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius4.2739.05

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 856 new files
Database: no new tables, 10 new options
New WordPress options
can_compress_scripts
fs_active_plugins
db_upgraded
fs_accounts
widget_recent-comments
widget_recent-posts
fs_gdpr
widget_theysaidso_widget
fs_debug_mode
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Phraseanet Wordpress Client
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,027 ▲28118.56 ▲4.2023.85 ▲22.0031.44 ▼13.33
Dashboard /wp-admin2,290 ▲1028.17 ▲3.31152.22 ▲45.4181.51 ▲40.00
Posts /wp-admin/edit.php2,187 ▲985.01 ▲2.9660.52 ▲24.3933.22 ▼3.94
Add New Post /wp-admin/post-new.php6,355 ▲4,82729.31 ▲10.83899.39 ▲273.7134.44 ▼28.57
Media Library /wp-admin/upload.php1,487 ▲1026.54 ▲2.38114.49 ▲13.8943.18 ▲3.11
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,0924.5143.6625.33

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/phraseanet-client/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 10 options
    • db_upgraded
    • can_compress_scripts
    • fs_debug_mode
    • widget_recent-posts
    • widget_theysaidso_widget
    • fs_active_plugins
    • fs_gdpr
    • theysaidso_admin_options
    • widget_recent-comments
    • fs_accounts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

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 take a closer look at the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/phraseanet-client/admin/partials/phraseanet-admin-display-form-generator.php
  • 193× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/phraseanet-client/vendor/phraseanet/php-sdk/tests/PhraseanetSDK/Tests/Http/APIGuzzleAdapterTest.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/phraseanet-client/vendor/phraseanet/php-sdk/tests/PhraseanetSDK/Tests/Http/APIResponseTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/phraseanet-client/vendor/kevinrob/guzzle-cache-middleware/tests/PublicCacheTest.php:25
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/phraseanet-client/vendor/guzzlehttp/psr7/src/InflateStream.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/phraseanet-client/vendor/psr/http-message/src/RequestInterface.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Psr\\Log\\AbstractLogger' not found in wp-content/plugins/phraseanet-client/vendor/psr/log/Psr/Log/NullLogger.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/phraseanet-client/vendor/guzzlehttp/psr7/src/NoSeekStream.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/phraseanet-client/admin/partials/logo.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Log\\LoggerInterface' not found in wp-content/plugins/phraseanet-client/vendor/psr/log/Psr/Log/AbstractLogger.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'PhraseanetSDK\\Http\\GuzzleAdapterInterface' not found in wp-content/plugins/phraseanet-client/vendor/phraseanet/php-sdk/src/PhraseanetSDK/Http/APIGuzzleAdapter.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that require attention:
  • Requires php: The plugin version is formatted incorrectly
The official readme.txt is a good inspiration

phraseanet-client/phraseanet.php 77% from 13 tests

"Phraseanet Wordpress Client" version 1.3.11's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("phraseanet-client.php" instead of "phraseanet.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 246 characters long)

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Please fix the following items
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/phraseanet-client/vendor/phraseanet/php-sdk/docs/make.bat
105,032 lines of code in 771 files:
LanguageFilesBlank linesComment linesLines of code
PHP45213,21730,09153,682
HTML1254,7573820,790
JSON665019,099
Markdown271,57704,801
LESS375897003,339
CSS223081951,033
JavaScript17137306845
reStructuredText8417489409
Python6128170309
PO File294115229
XML5212201
DOS Batch1221153
make3385142

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
It is recommended to fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 2,910)
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity18.12
▷ Minimum class complexity1.00
▷ Maximum class complexity2,910.00
Average method complexity2.94
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces37
Interfaces40
Traits5
Classes319
▷ Abstract classes113.45%
▷ Concrete classes30896.55%
▷ Final classes3210.39%
Methods3,329
▷ Static methods39811.96%
▷ Public methods2,60478.22%
▷ Protected methods2196.58%
▷ Private methods50615.20%
Functions316
▷ Named functions15549.05%
▷ Anonymous functions16150.95%
Constants270
▷ Global constants10840.00%
▷ Class constants16260.00%
▷ Public constants15796.91%

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
13 PNG files occupy 0.46MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
freemius/assets/img/phraseanet-client.png67.46KB15.63KB▼ 76.83%
vendor/phraseanet/php-sdk/docs/source/_themes/Alchemy/static/img/project.png19.75KB8.02KB▼ 59.42%
vendor/phraseanet/php-sdk/docs/source/API/API/i/tree_bg.png0.20KB0.10KB▼ 50.24%
admin/images/phrasea-logo_big.png76.93KB25.62KB▼ 66.69%