Make WordPress Core


Ignore:
Timestamp:
08/27/2008 10:04:12 PM (16 years ago)
Author:
ryan
Message:

Add edit and delete links to the Content->Links rows. Add get_edit_bookmark_link(). Add caching for individual bookmarks. see #7552

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-manager.php

    r8682 r8758  
    164164    <tbody>
    165165<?php
    166     $i = 0; // It is slower incrementing an undefined and valueless variable.
     166    $alt = 0;
    167167
    168168    foreach ($links as $link) {
     
    176176        if (strlen($short_url) > 35)
    177177            $short_url = substr($short_url, 0, 32).'...';
    178 
    179178        $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
    180         ++ $i;
    181         $style = ($i % 2) ? '' : ' class="alternate"';
     179        $style = ($alt % 2) ? '' : ' class="alternate"';
     180        ++ $alt;
     181        $edit_link = get_edit_bookmark_link();
    182182        ?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
    183183        echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></th>';
     
    186186                case 'name':
    187187
    188                     echo "<td><strong><a class='row-title' href='link.php?link_id=$link->link_id&amp;action=edit' title='" . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) . "' class='edit'>$link->link_name</a></strong><br />";
    189                     echo $link->link_description . "</td>";
     188                    echo "<td><strong><a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) . "' class='edit'>$link->link_name</a></strong><br />";
     189                    $actions = array();
     190                    $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     191                    $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
     192                    $action_count = count($actions);
     193                    $i = 0;
     194                    foreach ( $actions as $action => $link ) {
     195                        ++$i;
     196                        ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
     197                        echo "<span class='$action'>$link$sep</span>";
     198                    }
     199                    echo '</td>';
    190200                    break;
    191201                case 'url':
Note: See TracChangeset for help on using the changeset viewer.