WordPress.org

Make WordPress Core

Ticket #7878: 7878.diff

File 7878.diff, 1.5 KB (added by DD32, 10 years ago)
  • wp-admin/includes/plugin.php

     
    215215 */
    216216function activate_plugin($plugin, $redirect = '') {
    217217        $current = get_option('active_plugins');
    218         $plugin = trim($plugin);
     218        $plugin = plugin_basename(trim($plugin));
    219219
    220220        $valid = validate_plugin($plugin);
    221221        if ( is_wp_error($valid) )
     
    254254                $plugins = array($plugins);
    255255
    256256        foreach ( $plugins as $plugin ) {
     257                $plugin = plugin_basename($plugin);
    257258                if( ! is_plugin_active($plugin) )
    258259                        continue;
    259260                array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
     
    501502
    502503        $admin_page_hooks[$file] = sanitize_title( $menu_title );
    503504
    504         $hookname = get_plugin_page_hookname( $file, '' );
     505        $hookname = get_plugin_page_hookname( $file, $file );
    505506        if (!empty ( $function ) && !empty ( $hookname ))
    506507                add_action( $hookname, $function );
    507508
     
    529530        // as the first item in the submenu.  If the submenu file is the same as the
    530531        // parent file someone is trying to link back to the parent manually.  In
    531532        // this case, don't automatically add a link back to avoid duplication.
    532         if (!isset( $submenu[$parent] ) && $file != $parent  ) {
     533        if (!isset( $submenu[$parent] ) && $file != $parent ) {
    533534                foreach ( $menu as $parent_menu ) {
    534535                        if ( $parent_menu[2] == $parent && current_user_can( $parent_menu[1] ) )
    535536                                $submenu[$parent][] = $parent_menu;