Changeset 7139
- Timestamp:
- 03/03/2008 09:02:53 PM (17 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r7138 r7139 574 574 check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); 575 575 $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; 576 die(get_sample_permalink_html($post_id, $_POST['new_ slug']));576 die(get_sample_permalink_html($post_id, $_POST['new_title'], $_POST['new_slug'])); 577 577 break; 578 578 default : -
trunk/wp-admin/includes/post.php
r7133 r7139 578 578 } 579 579 580 function get_sample_permalink($id, $ name = null) {580 function get_sample_permalink($id, $title, $name = null) { 581 581 $post = &get_post($id); 582 582 if (!$post->ID) { … … 586 586 $original_date = $post->post_date; 587 587 $original_name = $post->post_name; 588 $original_title = $post->post_title; 589 590 $post->post_title = $title; 591 $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID); 592 588 593 if (in_array($post->post_status, array('draft', 'pending'))) { 589 594 $post->post_status = 'publish'; 590 595 $post->post_date = date('Y-m-d H:i:s'); 591 $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);592 596 } 593 597 if (!is_null($name)) { 594 $post->post_name = sanitize_title($name , $post->ID);598 $post->post_name = sanitize_title($name? $name : $post->post_title, $post->ID); 595 599 } 596 600 … … 611 615 $post->post_date = $original_date; 612 616 $post->post_name = $original_name; 617 $post->post_title = $original_title; 613 618 return $permalink; 614 619 } 615 620 616 function get_sample_permalink_html($id, $new_ slug=null) {621 function get_sample_permalink_html($id, $new_title=null, $new_slug=null) { 617 622 $post = &get_post($id); 618 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_ slug);623 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); 619 624 if (false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%')) { 620 625 return ''; -
trunk/wp-admin/js/slug.js
r7130 r7139 11 11 b.html('<a href="" class="save">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>'); 12 12 b.children('.save').click(function() { 13 var new_slug = e.children('input'). attr('value');13 var new_slug = e.children('input').val(); 14 14 jQuery.post(slugL10n.requestFile, { 15 15 action: 'sample-permalink', 16 16 post_id: post_id, 17 17 new_slug: new_slug, 18 new_title: jQuery('#title').val(), 18 19 samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) { 19 20 jQuery('#edit-slug-box').html(data);
Note: See TracChangeset
for help on using the changeset viewer.