Ticket #22980: 22980.diff
File 22980.diff, 2.9 KB (added by , 11 years ago) |
---|
-
src/wp-admin/edit-form-advanced.php
447 447 <div class="inside"> 448 448 <?php 449 449 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; 450 $shortlink = wp_get_shortlink($post->ID, 'post');451 $permalink = get_permalink( $post->ID );452 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )453 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';454 450 455 451 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { 456 452 $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; -
src/wp-admin/includes/post.php
1451 1451 return wp_create_post_autosave( $post_data ); 1452 1452 } 1453 1453 } 1454 1455 /** 1456 * Append the Get Shortlink button to the sample permalink HTML. 1457 * 1458 * This is attached to the 'sample_permalink_html' filter. Do not call this directly in plugins or theme templates. 1459 * 1460 * @uses get_sample_permalink_html() 1461 * 1462 * @return string The HTML of the sample permalink slug editor. 1463 */ 1464 function _get_sample_permalink_html_shortlink_button( $sample_permalink_html, $post_id, $new_title, $new_slug ) { 1465 $shortlink = wp_get_shortlink( $post_id, 'post' ); 1466 $permalink = get_permalink( $post_id ); 1467 1468 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url( '?page_id=' . $post_id ) ) { 1469 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; 1470 } 1471 1472 return $sample_permalink_html; 1473 } 1474 No newline at end of file -
src/wp-includes/default-filters.php
289 289 // This option no longer exists; tell plugins we always support auto-embedding. 290 290 add_filter( 'default_option_embed_autourls', '__return_true' ); 291 291 292 // Append shortlink to the slug display. 293 add_filter( 'get_sample_permalink_html', '_get_sample_permalink_html_shortlink_button', 5, 4 ); 294 292 295 // Default settings for heartbeat 293 296 add_filter( 'heartbeat_settings', 'wp_heartbeat_settings' ); 294 297