Make WordPress Core

Ticket #3422: patch.diff

File patch.diff, 5.7 KB (added by donncha, 20 years ago)
  • wp-admin/link-manager.php

     
    9393?>
    9494<input type="submit" name="action" value="<?php _e('Update &raquo;') ?>" /></p>
    9595</form>
     96<?php
     97$link_columns = array(
     98        'name'       => '<th width="15%">' . __('Name') . '</th>',
     99        'url'       => '<th>' . __('URL') . '</th>',
     100        'categories' => '<th>' . __('Categories') . '</th>',
     101        'rel'      => '<th style="text-align: center">' . __('rel') . '</th>',
     102        'visible'   => '<th style="text-align: center">' . __('Visible') . '</th>',
     103        'action'   => '<th colspan="2" style="text-align: center">' . __('Action') . '</th>',
     104);
     105$link_columns = apply_filters('manage_link_columns', $link_columns);
     106?>
    96107
    97108<form id="links" method="post" action="link.php">
    98109<?php wp_nonce_field('bulk-bookmarks') ?>
     
    103114<table class="widefat">
    104115        <thead>
    105116        <tr>
    106                 <th width="15%"><?php _e('Name') ?></th>
    107                 <th><?php _e('URL') ?></th>
    108                 <th><?php _e('Categories') ?></th>
    109                 <th style="text-align: center"><?php _e('rel') ?></th>
    110                 <th style="text-align: center"><?php _e('Visible') ?></th>
    111                 <th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
    112                 <th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
     117<?php foreach($link_columns as $column_display_name) {
     118        echo $column_display_name;
     119} ?>
     120        <th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
    113121        </tr>
    114122        </thead>
    115123        <tbody id="the-list">
     
    133141                $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
    134142                ++ $i;
    135143                $style = ($i % 2) ? '' : ' class="alternate"';
    136 ?>
    137         <tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
    138                 <td><strong><?php echo $link->link_name; ?></strong><br />
    139                 <?php
     144                ?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
     145                foreach($link_columns as $column_name=>$column_display_name) {
     146                        switch($column_name) {
     147                                case 'name':
     148                                        ?><td><strong><?php echo $link->link_name; ?></strong><br /><?php
     149                                        echo $link->link_description . "</td>";
     150                                        break;
     151                                case 'url':
     152                                        echo "<td><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
     153                                        break;
     154                                case 'categories':
     155                                        ?><td><?php
     156                                        $cat_names = array();
     157                                        foreach ($link->link_category as $category) {
     158                                                $cat_name = get_the_category_by_ID($category);
     159                                                $cat_name = wp_specialchars($cat_name);
     160                                                if ( $cat_id != $category )
     161                                                        $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
     162                                                $cat_names[] = $cat_name;
     163                                        }
     164                                        echo implode(', ', $cat_names);
     165                                        ?> </td><?php
     166                                        break;
     167                                case 'rel':
     168                                        ?><td><?php echo $link->link_rel; ?></td><?php
     169                                        break;
     170                                case 'visible':
     171                                        ?><td align='center'><?php echo $visible; ?></td><?php
     172                                        break;
     173                                case 'action':
     174                                        echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>';
     175                                        echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the &quot;%s&quot; link to %s.\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
     176                                        break;
     177                                default:
     178                                        ?>
     179                                        <td><?php do_action('manage_link_custom_column', $column_name, $id); ?></td>
     180                                        <?php
     181                                        break;
    140182
    141 
    142                 echo $link->link_description . "</td>";
    143                 echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
    144                 ?>
    145                 <td>
    146                 <?php
    147 
    148                 $cat_names = array();
    149                 foreach ($link->link_category as $category) {
    150                         $cat_name = get_the_category_by_ID($category);
    151                         $cat_name = wp_specialchars($cat_name);
    152                         if ( $cat_id != $category )
    153                                 $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
    154                         $cat_names[] = $cat_name;
     183                        }
    155184                }
    156                 echo implode(', ', $cat_names);
    157                 ?>
    158                 </td>
    159                 <td><?php echo $link->link_rel; ?></td>
    160                 <td align='center'><?php echo $visible; ?></td>
    161 <?php
    162 
    163                 echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>';
    164                 echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the &quot;%s&quot; link to %s.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
    165185                echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>';
    166186                echo "\n    </tr>\n";
    167187        }
     
    171191
    172192<div id="ajax-response"></div>
    173193
    174 <p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> &raquo;" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently \\n  \'Cancel\' to stop, \'OK\' to delete.")); ?>')" /></p>
     194<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> &raquo;" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently \n  \'Cancel\' to stop, \'OK\' to delete.")); ?>')" /></p>
    175195</form>
    176196</div>
    177197