WordPress.org

Make WordPress Core

Changeset 8895


Ignore:
Timestamp:
09/15/08 19:28:26 (6 years ago)
Author:
ryan
Message:

Implement attachmenet delete link. Use get_edit_post_link(). see #7552

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-attachment-rows.php

    r8894 r8895  
    9393        <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?> 
    9494        <p> 
    95         <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> | 
    96         <a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a> | 
    97         <a href="#" class="delete"><?php _e('Delete'); ?></a> 
    98         </p> 
    99         <?php do_action('manage_media_media_column', $post->ID); ?> 
    100         </td> 
    101         <?php 
     95        <?php 
     96        $actions = array(); 
     97        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>'; 
     98        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
     99        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 
     100        $action_count = count($actions); 
     101        $i = 0; 
     102        foreach ( $actions as $action => $link ) { 
     103            ++$i; 
     104            ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 
     105            echo "<span class='$action'>$link$sep</span>"; 
     106        } 
    102107        break; 
    103108 
  • trunk/wp-admin/includes/template.php

    r8894 r8895  
    763763 
    764764            $actions = array(); 
    765             $actions['edit'] = '<a href="post.php?action=edit&amp;post=' . $post->ID . '">' . __('Edit') . '</a>'; 
     765            $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>'; 
    766766            $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    767767            $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
Note: See TracChangeset for help on using the changeset viewer.