Make WordPress Core


Ignore:
Timestamp:
07/04/2005 09:53:26 PM (20 years ago)
Author:
ryan
Message:

register_activation_hook() and register_deactivation_hook(). Let's try these on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2671 r2697  
    19671967}
    19681968
     1969function register_activation_hook($file, $function) {
     1970    $file = plugin_basename($file);
     1971   
     1972    add_action('activate_' . $file, $function);
     1973}
     1974
     1975function register_deactivation_hook($file, $function) {
     1976    $file = plugin_basename($file);
     1977   
     1978    add_action('deactivate_' . $file, $function);
     1979}
     1980
     1981function plugin_basename($file) {
     1982    return preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);
     1983}
     1984
    19691985?>
Note: See TracChangeset for help on using the changeset viewer.