Changes in trunk/wp-admin/includes/post.php [12110:12298]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r12110 r12298 714 714 */ 715 715 function _fix_attachment_links( $post_ID ) { 716 global $_fix_attachment_link_id; 716 717 717 718 $post = & get_post( $post_ID, ARRAY_A ); … … 741 742 742 743 $post_search[$i] = $anchor; 743 $post_replace[$i] = preg_replace( "#href=(\"|')[^'\"]*\\1#e", "stripslashes( 'href=\\1' ).get_attachment_link( $id ).stripslashes( '\\1' )", $anchor ); 744 $_fix_attachment_link_id = $id; 745 $post_replace[$i] = preg_replace_callback( "#href=(\"|')[^'\"]*\\1#", '_fix_attachment_links_replace_cb', $anchor ); 744 746 ++$i; 745 747 } … … 751 753 752 754 return wp_update_post( $post); 755 } 756 757 function _fix_attachment_links_replace_cb($match) { 758 global $_fix_attachment_link_id; 759 return stripslashes( 'href='.$match[1] ).get_attachment_link( $_fix_attachment_link_id ).stripslashes( $match[1] ); 753 760 } 754 761 … … 767 774 $old_ID = (int) $old_ID; 768 775 $new_ID = (int) $new_ID; 769 return $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('post_parent' => $old_ID) ); 776 777 $children = $wpdb->get_col( $wpdb->prepare(" 778 SELECT post_id 779 FROM $wpdb->postmeta 780 WHERE meta_key = '_wp_attachment_temp_parent' 781 AND meta_value = %d", $old_ID) ); 782 783 foreach ( $children as $child_id ) { 784 $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) ); 785 delete_post_meta($child_id, '_wp_attachment_temp_parent'); 786 } 770 787 } 771 788 … … 927 944 * @since unknown 928 945 * 929 * @param unknown_type $id930 * @param unknown_type $title931 * @param unknown_type $name932 * @return unknown946 * @param int|object $id Post ID or post object. 947 * @param string $title (optional) Title 948 * @param string $name (optional) Name 949 * @return array With two entries of type string 933 950 */ 934 951 function get_sample_permalink($id, $title = null, $name = null) { … … 945 962 if (in_array($post->post_status, array('draft', 'pending'))) { 946 963 $post->post_status = 'publish'; 947 $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);964 $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID); 948 965 } 949 966 … … 953 970 // Note: if empty name is supplied -- use the title instead, see #6072 954 971 if (!is_null($name)) { 955 $post->post_name = sanitize_title($name ? $name : $title, $post->ID);972 $post->post_name = sanitize_title($name ? $name : $title, $post->ID); 956 973 } 957 974 … … 981 998 982 999 /** 983 * {@internal Missing Short Description}} 984 * 985 * @since unknown 986 * 987 * @param unknown_type $id 988 * @param unknown_type $new_title 989 * @param unknown_type $new_slug 990 * @return unknown 1000 * sample permalink html 1001 * 1002 * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 1003 * 1004 * @since unknown 1005 * 1006 * @param int|object $id Post ID or post object. 1007 * @param string $new_title (optional) New title 1008 * @param string $new_slug (optional) New slug 1009 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 991 1010 */ 992 1011 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
Note: See TracChangeset
for help on using the changeset viewer.