Ticket #4635: plugins.php.3.diff

File plugins.php.3.diff, 2.0 KB (added by GaryKing, 5 years ago)

anchor has been changed to work after activating/deactivating a plugin

  • wp-admin/plugins.php

     
    113113        _e("Couldn’t open plugins directory or there are no plugins available."); // TODO: make more helpful 
    114114        echo '</p>'; 
    115115} else { 
     116         
     117        echo '<style type="text/css"> 
     118                table#plugins-table-of-contents { border: 1px solid #ccc; width: 100%; margin-bottom: 10px; } 
     119                table#plugins-table-of-contents ul { list-style-type: none; } 
     120        </style>'; 
     121         
     122        $number_of_plugins = count($plugins); 
     123        $i = 1; 
     124 
     125        foreach ($plugins as $plugin_file => $plugin_data) 
     126        { 
     127                $plugins[$i] = array_merge($plugin_data, array('file' => $plugin_file)); 
     128                $plugins[$plugin_file] = array_merge($plugin_data, array('order' => $i)); 
     129                $i++; 
     130        } 
     131         
     132        $table_columns = 4; 
     133        $plugins_per_table = ceil(count($plugins) / 2 / $table_columns); 
     134         
     135        echo '<h3>Plugins Table of Contents for ' . (count($plugins) / 2) . ' plugins</h3><table id="plugins-table-of-contents"><tr>'; 
     136 
     137        $k = 1; 
     138        $starting_plugin = $plugins_per_table; 
     139        for ($i = 1; $i <= $table_columns; $i++) 
     140        { 
     141                echo '<td valign="top"><ul>'; 
     142                for ($j = $k; $j <= $starting_plugin; $j++) 
     143                { 
     144                        $plugins[$k]['order'] = $k; 
     145                        echo '<li>' . $k . '. <a href="#plugin-' . $k . '">' . $plugins[$k]['Name'] . '</a>' . (!in_array($plugins[$k]['file'], $current_plugins) ? ' (disabled)' : '') . '</li>'; 
     146                        if ($k == $number_of_plugins) 
     147                                break; 
     148                        $k++; 
     149                } 
     150                $starting_plugin += $plugins_per_table; 
     151                echo '</ul></td>'; 
     152        } 
     153         
     154        echo '</tr></table>'; 
     155         
     156        for ($i = 1; $i <= $number_of_plugins; $i++) 
     157        { 
     158                unset($plugins[$i]); 
     159        } 
     160         
    116161?> 
    117162<table class="widefat plugins"> 
    118163        <thead> 
     
    153198                        $edit = ''; 
    154199 
    155200                echo " 
    156         <tr $style> 
     201        <tr $style id=\"plugin-{$plugin_data['order']}\"> 
    157202                <td class='name'>{$plugin_data['Title']}</td> 
    158203                <td class='vers'>{$plugin_data['Version']}</td> 
    159204                <td class='desc'><p>{$plugin_data['Description']} <cite>".sprintf(__('By %s'), $plugin_data['Author']).".</cite></p></td>