Changeset 2697
- Timestamp:
- 07/04/2005 09:53:26 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r2695 r2697 1073 1073 } 1074 1074 1075 function plugin_basename($file) {1076 return preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file);1077 }1078 1079 1075 function add_menu_page($page_title, $menu_title, $access_level, $file, $function = '') { 1080 1076 global $menu, $admin_page_hooks; -
trunk/wp-admin/plugins.php
r2594 r2697 4 4 if ( isset($_GET['action']) ) { 5 5 check_admin_referer(); 6 6 7 7 if ('activate' == $_GET['action']) { 8 8 $current = get_settings('active_plugins'); 9 9 if (!in_array($_GET['plugin'], $current)) { 10 10 $current[] = trim( $_GET['plugin'] ); 11 sort($current); 12 update_option('active_plugins', $current); 13 include(ABSPATH . 'wp-content/plugins/' . trim( $_GET['plugin'] )); 14 do_action('activate_' . trim( $_GET['plugin'] )); 11 15 } 12 sort($current);13 update_option('active_plugins', $current);14 16 header('Location: plugins.php?activate=true'); 15 } 16 17 if ('deactivate' == $_GET['action']) { 17 } else if ('deactivate' == $_GET['action']) { 18 18 $current = get_settings('active_plugins'); 19 19 array_splice($current, array_search( $_GET['plugin'], $current), 1 ); // Array-fu! 20 20 update_option('active_plugins', $current); 21 do_action('deactivate_' . trim( $_GET['plugin'] )); 21 22 header('Location: plugins.php?deactivate=true'); 22 23 } -
trunk/wp-includes/functions.php
r2671 r2697 1967 1967 } 1968 1968 1969 function register_activation_hook($file, $function) { 1970 $file = plugin_basename($file); 1971 1972 add_action('activate_' . $file, $function); 1973 } 1974 1975 function register_deactivation_hook($file, $function) { 1976 $file = plugin_basename($file); 1977 1978 add_action('deactivate_' . $file, $function); 1979 } 1980 1981 function plugin_basename($file) { 1982 return preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $file); 1983 } 1984 1969 1985 ?>
Note: See TracChangeset
for help on using the changeset viewer.