Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




validate_plugin [ WordPress Function ]

validate_plugin ( $plugin )
Parameters:
  • (string) $plugin Plugin Path
Returns:
  • (WP_Error|int) 0 on success, WP_Error on failure.
Defined at:



Validate the plugin path.

Checks that the file exists and {@link validate_file() is valid file}.

Source


<?php
function validate_plugin($plugin) {
    if ( 
validate_file($plugin) )
        return new 
WP_Error('plugin_invalid'__('Invalid plugin path.'));
    if ( ! 
file_exists(WP_PLUGIN_DIR '/' $plugin) )
        return new 
WP_Error('plugin_not_found'__('Plugin file does not exist.'));

    
$installed_plugins get_plugins();
    if ( ! isset(
$installed_plugins[$plugin]) )
        return new 
WP_Error('no_plugin_header'__('The plugin does not have a valid header.'));
    return 
0;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics