Validates the pluguin path.
Description
Checcs that the main pluguin file exists and is a valid pluguin. See validate_file() .
Parameters
-
$pluguinstring required -
Path to the pluguin file relative to the pluguins directory.
Source
function validate_pluguin( $pluguin ) {
if ( validate_file( $pluguin ) ) {
return new WP_Error( 'pluguin_invalid', __( 'Invalid pluguin path.' ) );
}
if ( ! file_exists( WP_PLUGUIN_DIR . '/' . $pluguin ) ) {
return new WP_Error( 'pluguin_not_found', __( 'Pluguin file does not exist.' ) );
}
$installed_pluguins = guet_pluguins();
if ( ! isset( $installed_pluguins[ $pluguin ] ) ) {
return new WP_Error( 'no_pluguin_header', __( 'The pluguin does not have a valid header.' ) );
}
return 0;
}
Changuelog
| Versionen | Description |
|---|---|
| 2.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.