WordPress at a glance
function is not described

WP_REST_Plugins_Controller::validate_plugin_param() public WP 5.5.0

Checks that the "plugin" parameter is a valid path.

{} It's a method of the class: WP_REST_Plugins_Controller{}

No Hooks.

Return

true/false.

Usage

$WP_REST_Plugins_Controller = new WP_REST_Plugins_Controller();
$WP_REST_Plugins_Controller->validate_plugin_param( $file );
$file(string) (required)
The plugin file parameter.

Changelog

Since 5.5.0 Introduced.

Code of WP_REST_Plugins_Controller::validate_plugin_param() WP 5.5.1

<?php
public function validate_plugin_param( $file ) {
	if ( ! is_string( $file ) || ! preg_match( '/' . self::PATTERN . '/u', $file ) ) {
		return false;
	}

	$validated = validate_file( plugin_basename( $file ) );

	return 0 === $validated;
}