Make WordPress Core

Changeset 8484


Ignore:
Timestamp:
07/29/2008 05:22:58 AM (16 years ago)
Author:
ryan
Message:

Use get_edit_post_link() instead of hardcoding edit links. Props mdawaffe. fixes #7425

Location:
trunk/wp-admin
Files:
10 edited

Legend:

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

    r7831 r8484  
    5555    case 'media':
    5656        ?>
    57         <td><strong><a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
     57        <td><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
    5858        <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
    5959        <?php do_action('manage_media_media_column', $post->ID); ?>
     
    9898            }
    9999            ?>
    100             <td><strong><a href="post.php?action=edit&amp;post=<?php echo $post->post_parent; ?>"><?php echo $title ?></a></strong></td>
     100            <td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong></td>
    101101            <?php
    102102        } else {
  • trunk/wp-admin/edit-pages.php

    r8345 r8484  
    106106endif;
    107107if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    108 <div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="page.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit page'); ?></a></p></div>
     108<div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>
    109109<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    110110endif;
  • trunk/wp-admin/edit-post-rows.php

    r7775 r8484  
    3535global $current_user;
    3636$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
     37$edit_link = get_edit_post_link( $post->ID );
    3738$title = get_the_title();
    3839if ( empty($title) )
     
    8182    case 'title':
    8283        ?>
    83         <td><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="post.php?action=edit&amp;post=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong>
     84        <td><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong>
    8485        <?php if ( !empty($post->post_password) ) { _e(' &#8212; <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' &#8212; <strong>Private</strong>'); } ?></td>
    8586        <?php
     
    174175    case 'control_edit':
    175176        ?>
    176         <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
     177        <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>
    177178        <?php
    178179        break;
  • trunk/wp-admin/edit.php

    r7998 r8484  
    111111
    112112if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    113 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit post'); ?></a></p></div>
     113<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
    114114<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    115115endif;
  • trunk/wp-admin/includes/template.php

    r8455 r8484  
    458458    case 'title':
    459459        ?>
    460         <td><strong><a class="row-title" href="page.php?action=edit&amp;post=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a></strong>
     460        <td><strong><a class="row-title" href="<?php echo get_edit_post_link( $page->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a></strong>
    461461        <?php if ('private' == $page->post_status) _e(' &#8212; <strong>Private</strong>'); ?></td>
    462462        <?php
  • trunk/wp-admin/page.php

    r8033 r8484  
    2121    } elseif ( isset($_POST['save']) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
    2222        if ( $_POST['_wp_original_http_referer'] && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/page-new.php') === false )
    23             $location = add_query_arg( '_wp_original_http_referer', urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), "page.php?action=edit&post=$page_ID&message=1" );
     23            $location = add_query_arg( array(
     24                '_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ),
     25                'message' => 1
     26            ), get_edit_post_link( $page_ID, 'url' ) );
    2427        else
    25             $location = "page.php?action=edit&post=$page_ID&message=4";
     28            $location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
    2629    } elseif ($_POST['addmeta']) {
    2730        $location = add_query_arg( 'message', 2, wp_get_referer() );
     
    4649        $location = 'attachments.php';
    4750    } else {
    48         $location = "page.php?action=edit&post=$page_ID&message=4";
     51        $location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
    4952    }
    5053
  • trunk/wp-admin/post-new.php

    r8033 r8484  
    2727
    2828if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    29 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit post'); ?></a></p></div>
     29<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
    3030<?php
    3131endif;
  • trunk/wp-admin/post.php

    r8033 r8484  
    2323    } elseif ( isset($_POST['save']) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
    2424        if ( $_POST['_wp_original_http_referer'] && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false )
    25             $location = add_query_arg( '_wp_original_http_referer', urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), "post.php?action=edit&post=$post_ID&message=1" );
     25            $location = add_query_arg( array(
     26                '_wp_original_http_referer' => urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ),
     27                'message' => 1
     28            ), get_edit_post_link( $post_ID, 'url' ) );
    2629        else
    27             $location = "post.php?action=edit&post=$post_ID&message=4";
     30            $location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
    2831    } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
    2932        $location = add_query_arg( 'message', 2, wp_get_referer() );
     
    4851        $location = 'attachments.php';
    4952    } else {
    50         $location = "post.php?action=edit&post=$post_ID&message=4";
     53        $location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
    5154    }
    5255
  • trunk/wp-admin/press-this.php

    r8476 r8484  
    9494    </head>
    9595    <body class="press-this">
    96         <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
     96        <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
    9797        <div id="footer">
    9898        <p><?php
  • trunk/wp-admin/upload.php

    r7883 r8484  
    112112<?php
    113113if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    114 <div id="message" class="updated fade"><p><strong><?php _e('Your media has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View media'); ?></a> | <a href="media.php?action=edit&amp;attachment_id=<?php echo $_GET['posted']; ?>"><?php _e('Edit media'); ?></a></p></div>
     114<div id="message" class="updated fade"><p><strong><?php _e('Your media has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View media'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit media'); ?></a></p></div>
    115115<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    116116endif;
Note: See TracChangeset for help on using the changeset viewer.