On this page
WP_REST_Plugins_Controller::validate_plugin_param( string $file ): bool
Checks that the “plugin” parameter is a valid path.
Parameters
$filestring Required-
The plugin file parameter.
Return
bool
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| validate_file() wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| plugin_basename() wp-includes/plugin.php | Gets the basename of a plugin. |
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_plugins_controller/validate_plugin_param