62% wp-ldp

Code Review | WP-LDP

WordPress plugin WP-LDP scored 62% from 54 tests.

About plugin

  • Plugin page: wp-ldp
  • Plugin version: 2.0.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4.0-4.8
  • WordPress version: 6.3.1
  • First release: Aug 12, 2016
  • Latest release: Aug 28, 2017
  • Number of updates: 31
  • Update frequency: every 12.3 days
  • Top authors: balessan (96.77%)mahagonny (6.45%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 942 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.55MB] [CPU: ▼11.44ms] Passed 4 tests

A check of server-side resources used by WP-LDP
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1246.09 ▲2.30
Dashboard /wp-admin3.43 ▲0.1258.70 ▲5.00
Posts /wp-admin/edit.php3.55 ▲0.1956.73 ▲0.37
Add New Post /wp-admin/post-new.php3.31 ▼2.5848.31 ▼53.41
Media Library /wp-admin/upload.php3.36 ▲0.1342.98 ▲6.36
Group /wp-admin/edit.php?post_type=ldp_resource&ldp_container=group3.3736.96
Containers /wp-admin/edit-tags.php?taxonomy=ldp_container&post_type=ldp_resource3.3648.76
Person /wp-admin/edit.php?post_type=ldp_resource&ldp_container=person3.3745.09
Artwork /wp-admin/edit.php?post_type=ldp_resource&ldp_container=artwork3.3738.73
Organization /wp-admin/edit.php?post_type=ldp_resource&ldp_container=organization3.3740.50
Event /wp-admin/edit.php?post_type=ldp_resource&ldp_container=event3.3740.51
WP-LDP Settings /wp-admin/options-general.php?page=wpldp3.3242.90
Sites /wp-admin/edit-tags.php?taxonomy=ldp_site&post_type=ldp_resource3.3538.75
Initiative /wp-admin/edit.php?post_type=ldp_resource&ldp_container=initiative3.3739.26
Theme /wp-admin/edit.php?post_type=ldp_resource&ldp_container=theme3.3741.98

Server storage [IO: ▲23.49MB] [DB: ▼0.32MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Please try to fix the following items
  • There were 1 file (0.60KB) illegally modified outside of "wp-content/plugins/wp-ldp/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 1,244 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
wpldp_version
ldp_container_children
can_compress_scripts
widget_recent-comments
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

WP-LDP: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,822 ▲3314.38 ▲0.781.79 ▼3.4447.90 ▼0.82
Dashboard /wp-admin2,258 ▲524.91 ▼0.94122.97 ▲6.3351.49 ▲7.92
Posts /wp-admin/edit.php2,154 ▲652.05 ▼0.0037.82 ▼1.2537.61 ▲5.02
Add New Post /wp-admin/post-new.php1,588 ▲5521.81 ▼1.15597.85 ▼90.5956.08 ▼0.60
Media Library /wp-admin/upload.php1,471 ▲804.21 ▼0.0296.17 ▼3.9941.43 ▼1.72
Group /wp-admin/edit.php?post_type=ldp_resource&ldp_container=group1,4325.8485.2932.24
Containers /wp-admin/edit-tags.php?taxonomy=ldp_container&post_type=ldp_resource1,9912.1430.3435.39
Person /wp-admin/edit.php?post_type=ldp_resource&ldp_container=person1,4325.9083.1930.37
Artwork /wp-admin/edit.php?post_type=ldp_resource&ldp_container=artwork1,4265.8457.9328.83
Organization /wp-admin/edit.php?post_type=ldp_resource&ldp_container=organization1,4265.8262.4827.78
Event /wp-admin/edit.php?post_type=ldp_resource&ldp_container=event1,4235.9657.7927.12
WP-LDP Settings /wp-admin/options-general.php?page=wpldp8742.0223.6529.33
Sites /wp-admin/edit-tags.php?taxonomy=ldp_site&post_type=ldp_resource1,3532.1427.3729.33
Initiative /wp-admin/edit.php?post_type=ldp_resource&ldp_container=initiative1,4265.8263.4630.71
Theme /wp-admin/edit.php?post_type=ldp_resource&ldp_container=theme1,4265.8362.1628.55

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/wp-ldp/wp-ldp.php+717
    Undefined index: primary
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • wpldp_version
    • can_compress_scripts
    • widget_theysaidso_widget
    • ldp_container_children
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Smoke test failed, please fix the following
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ldp_resource&ldp_container=theme
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)

SRP 0% from 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
Please take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wp-ldp/wp-ldp.php
    • > /wp-content/plugins/wp-ldp/public/index.php
  • 8× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WpLdp\\register_activation_hook() in wp-content/plugins/wp-ldp/class-site-taxonomy.php:32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WpLdp\\register_activation_hook() in wp-content/plugins/wp-ldp/class-container-taxonomy.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/wp-ldp/tests/test-resource-api.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/wp-ldp/tests/test-sample.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WpLdp\\add_filter() in wp-content/plugins/wp-ldp/class-api.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function WpLdp\\add_action() in wp-content/plugins/wp-ldp/class-settings.php:30
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-ldp/tests/bootstrap.php on line 14
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/wp-ldp/tests/bootstrap.php on line 14

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots do not have images: #1 (The settings menu item), #2 (The settings page with the container initialization option), #3 (The containers menu item), #4 (The default containers listing page), #5 (The default actor JSON Model), #6 (The resources menu item), #7 (The new resource editing page), #8 (The newly created resource edition form), #9 (The created resource generated JSON raw view)
You can take inspiration from this readme.txt

wp-ldp/wp-ldp.php 92% from 13 tests

The primary PHP file in "WP-LDP" version 2.0.7 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin314,236 lines of code in 1,063 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript66642,90031,175268,697
CSS3359827414,665
Sass1191,5451,6519,812
HTML921,107156,721
JSON35003,277
Markdown281,25402,858
SVG5012,492
PHP102815531,576
LESS1328341,510
TypeScript25951,873811
Handlebars35813657
Windows Module Definition5880437
XML860363
PO File16060140
Bourne Shell2247105
YAML85095
Bourne Again Shell12120

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity18.88
▷ Minimum class complexity1.00
▷ Maximum class complexity53.00
Average method complexity3.55
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods60
▷ Static methods58.33%
▷ Public methods5795.00%
▷ Protected methods00.00%
▷ Private methods35.00%
Functions5
▷ Named functions120.00%
▷ Anonymous functions480.00%
Constants4
▷ Global constants125.00%
▷ Class constants375.00%
▷ Public constants3100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
80 PNG files occupy 1.56MB with 0.73MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
library/js/select2/docs/vendor/images/flags/pa.png10.93KB4.55KB▼ 58.38%
library/js/select2/docs/vendor/images/flags/ia.png6.94KB3.21KB▼ 53.75%
public/library/jquery/jquery-ui-1.12.1/images/ui-icons_cc0000_256x240.png4.44KB4.17KB▼ 6.02%
library/js/select2/docs/vendor/images/flags/in.png6.82KB3.17KB▼ 53.59%
assets/screenshot-5.png123.00KB46.97KB▼ 61.81%