Ticket #21309: 21309.9.diff
File 21309.9.diff, 14.6 KB (added by , 13 years ago) |
---|
-
wp-includes/post-template.php
101 101 * @return string 102 102 */ 103 103 function get_the_title( $id = 0 ) { 104 $post = &get_post($id);104 $post = get_post($id); 105 105 106 106 $title = isset($post->post_title) ? $post->post_title : ''; 107 107 $id = isset($post->ID) ? $post->ID : (int) $id; … … 148 148 * @return string 149 149 */ 150 150 function get_the_guid( $id = 0 ) { 151 $post = &get_post($id);151 $post = get_post($id); 152 152 153 153 return apply_filters('get_the_guid', $post->guid); 154 154 } … … 276 276 * @return bool 277 277 */ 278 278 function has_excerpt( $id = 0 ) { 279 $post = &get_post( $id );279 $post = get_post( $id ); 280 280 return ( !empty( $post->post_excerpt ) ); 281 281 } 282 282 … … 1138 1138 */ 1139 1139 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { 1140 1140 $id = intval( $id ); 1141 $_post = &get_post( $id );1141 $_post = get_post( $id ); 1142 1142 1143 1143 if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) 1144 1144 return __( 'Missing Attachment' ); -
wp-includes/taxonomy.php
3073 3073 * @return array 3074 3074 */ 3075 3075 function get_the_taxonomies($post = 0, $args = array() ) { 3076 if ( is_int($post) ) 3077 $post =& get_post($post); 3078 elseif ( !is_object($post) ) 3079 $post =& $GLOBALS['post']; 3076 $post = get_post( $post ); 3080 3077 3081 3078 $args = wp_parse_args( $args, array( 3082 3079 'template' => '%s: %l.', … … 3122 3119 * @return array 3123 3120 */ 3124 3121 function get_post_taxonomies($post = 0) { 3125 $post = & get_post($post);3122 $post = get_post( $post ); 3126 3123 3127 3124 return get_object_taxonomies($post); 3128 3125 } -
wp-includes/post.php
586 586 * @return bool|string False on failure or returns the mime type 587 587 */ 588 588 function get_post_mime_type($ID = '') { 589 $post = &get_post($ID);589 $post = get_post($ID); 590 590 591 591 if ( is_object($post) ) 592 592 return $post->post_mime_type; … … 3716 3716 if (strpos($url, home_url('/?attachment_id=')) !== false) 3717 3717 return true; 3718 3718 if ( $id = url_to_postid($url) ) { 3719 $post = &get_post($id);3719 $post = get_post($id); 3720 3720 if ( 'attachment' == $post->post_type ) 3721 3721 return true; 3722 3722 } … … 4012 4012 */ 4013 4013 function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) { 4014 4014 $post_id = (int) $post_id; 4015 if ( !$post = &get_post( $post_id ) )4015 if ( !$post = get_post( $post_id ) ) 4016 4016 return false; 4017 4017 4018 4018 $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); … … 4034 4034 */ 4035 4035 function wp_update_attachment_metadata( $post_id, $data ) { 4036 4036 $post_id = (int) $post_id; 4037 if ( !$post = &get_post( $post_id ) )4037 if ( !$post = get_post( $post_id ) ) 4038 4038 return false; 4039 4039 4040 4040 $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); … … 4052 4052 */ 4053 4053 function wp_get_attachment_url( $post_id = 0 ) { 4054 4054 $post_id = (int) $post_id; 4055 if ( !$post = &get_post( $post_id ) )4055 if ( !$post = get_post( $post_id ) ) 4056 4056 return false; 4057 4057 4058 4058 if ( 'attachment' != $post->post_type ) … … 4091 4091 */ 4092 4092 function wp_get_attachment_thumb_file( $post_id = 0 ) { 4093 4093 $post_id = (int) $post_id; 4094 if ( !$post = &get_post( $post_id ) )4094 if ( !$post = get_post( $post_id ) ) 4095 4095 return false; 4096 4096 if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) ) 4097 4097 return false; … … 4113 4113 */ 4114 4114 function wp_get_attachment_thumb_url( $post_id = 0 ) { 4115 4115 $post_id = (int) $post_id; 4116 if ( !$post = &get_post( $post_id ) )4116 if ( !$post = get_post( $post_id ) ) 4117 4117 return false; 4118 4118 if ( !$url = wp_get_attachment_url( $post->ID ) ) 4119 4119 return false; … … 4140 4140 */ 4141 4141 function wp_attachment_is_image( $post_id = 0 ) { 4142 4142 $post_id = (int) $post_id; 4143 if ( !$post = &get_post( $post_id ) )4143 if ( !$post = get_post( $post_id ) ) 4144 4144 return false; 4145 4145 4146 4146 if ( !$file = get_attached_file( $post->ID ) ) … … 4171 4171 $post_mimes = array(); 4172 4172 if ( is_numeric($mime) ) { 4173 4173 $mime = (int) $mime; 4174 if ( $post = &get_post( $mime ) ) {4174 if ( $post = get_post( $mime ) ) { 4175 4175 $post_id = (int) $post->ID; 4176 4176 $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid); 4177 4177 if ( !empty($ext) ) { -
wp-includes/comment.php
1371 1371 if ( '0' == $commentdata['comment_approved'] ) 1372 1372 wp_notify_moderator($comment_ID); 1373 1373 1374 $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment1374 $post = get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment 1375 1375 1376 1376 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) ) 1377 1377 wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' ); -
wp-includes/media.php
655 655 $hwstring = image_hwstring($width, $height); 656 656 if ( is_array($size) ) 657 657 $size = join('x', $size); 658 $attachment = &get_post($attachment_id);658 $attachment = get_post($attachment_id); 659 659 $default_attr = array( 660 660 'src' => $src, 661 661 'class' => "attachment-$size", -
wp-includes/link-template.php
96 96 $post = $id; 97 97 $sample = true; 98 98 } else { 99 $post = &get_post($id);99 $post = get_post($id); 100 100 $sample = false; 101 101 } 102 102 … … 178 178 function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { 179 179 global $wp_rewrite; 180 180 181 $post = &get_post($id);181 $post = get_post($id); 182 182 183 183 if ( is_wp_error( $post ) ) 184 184 return $post; … … 271 271 if ( !$id ) 272 272 $id = (int) $post->ID; 273 273 else 274 $post = &get_post($id);274 $post = get_post($id); 275 275 276 276 $draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) ); 277 277 … … 898 898 * @return string 899 899 */ 900 900 function get_edit_post_link( $id = 0, $context = 'display' ) { 901 if ( !$post = &get_post( $id ) )901 if ( !$post = get_post( $id ) ) 902 902 return; 903 903 904 904 if ( 'display' == $context ) … … 927 927 * @param int $id Optional. Post ID. 928 928 */ 929 929 function edit_post_link( $link = null, $before = '', $after = '', $id = 0 ) { 930 if ( !$post = &get_post( $id ) )930 if ( !$post = get_post( $id ) ) 931 931 return; 932 932 933 933 if ( !$url = get_edit_post_link( $post->ID ) ) … … 957 957 if ( ! empty( $deprecated ) ) 958 958 _deprecated_argument( __FUNCTION__, '3.0' ); 959 959 960 if ( !$post = &get_post( $id ) )960 if ( !$post = get_post( $id ) ) 961 961 return; 962 962 963 963 $post_type_object = get_post_type_object( $post->post_type ); … … 1204 1204 */ 1205 1205 function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) { 1206 1206 if ( $previous && is_attachment() && is_object( $GLOBALS['post'] ) ) 1207 $post = &get_post($GLOBALS['post']->post_parent);1207 $post = get_post($GLOBALS['post']->post_parent); 1208 1208 else 1209 1209 $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous); 1210 1210 … … 1369 1369 */ 1370 1370 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { 1371 1371 if ( $previous && is_attachment() ) 1372 $post = &get_post($GLOBALS['post']->post_parent);1372 $post = get_post($GLOBALS['post']->post_parent); 1373 1373 else 1374 1374 $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous); 1375 1375 -
wp-includes/general-template.php
1627 1627 1628 1628 if ( is_single() || is_page() ) { 1629 1629 $id = 0; 1630 $post = &get_post( $id );1630 $post = get_post( $id ); 1631 1631 1632 1632 if ( comments_open() || pings_open() || $post->comment_count > 0 ) { 1633 1633 $title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ); -
wp-includes/deprecated.php
26 26 function get_postdata($postid) { 27 27 _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' ); 28 28 29 $post = &get_post($postid);29 $post = get_post($postid); 30 30 31 31 $postdata = array ( 32 32 'ID' => $post->ID, … … 1892 1892 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 1893 1893 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' ); 1894 1894 $id = (int) $id; 1895 $_post = &get_post($id);1895 $_post = get_post($id); 1896 1896 1897 1897 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) 1898 1898 return __('Missing Attachment'); … … 1921 1921 function get_attachment_icon_src( $id = 0, $fullsize = false ) { 1922 1922 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' ); 1923 1923 $id = (int) $id; 1924 if ( !$post = &get_post($id) )1924 if ( !$post = get_post($id) ) 1925 1925 return false; 1926 1926 1927 1927 $file = get_attached_file( $post->ID ); … … 1966 1966 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { 1967 1967 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' ); 1968 1968 $id = (int) $id; 1969 if ( !$post = &get_post($id) )1969 if ( !$post = get_post($id) ) 1970 1970 return false; 1971 1971 1972 1972 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) … … 2023 2023 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { 2024 2024 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' ); 2025 2025 $id = (int) $id; 2026 if ( !$post = &get_post($id) )2026 if ( !$post = get_post($id) ) 2027 2027 return false; 2028 2028 2029 2029 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) … … 2801 2801 _deprecated_function( __FUNCTION__, '3.3' ); 2802 2802 2803 2803 if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) 2804 $post = &get_post($GLOBALS['post']->post_parent);2804 $post = get_post($GLOBALS['post']->post_parent); 2805 2805 2806 2806 if ( empty($post) ) 2807 2807 return; -
wp-admin/includes/post.php
160 160 161 161 // Autosave shouldn't save too soon after a real save 162 162 if ( 'autosave' == $post_data['action'] ) { 163 $post = &get_post( $post_ID );163 $post = get_post( $post_ID ); 164 164 $now = time(); 165 165 $then = strtotime($post->post_date_gmt . ' +0000'); 166 166 $delta = AUTOSAVE_INTERVAL / 2; … … 439 439 $post->page_template = 'default'; 440 440 $post->post_parent = 0; 441 441 $post->menu_order = 0; 442 $post = new WP_Post( $post ); 442 443 } 443 444 444 445 $post->post_content = apply_filters( 'default_content', $post_content, $post ); … … 745 746 * @return unknown 746 747 */ 747 748 function _fix_attachment_links( $post_ID ) { 748 $post = &get_post( $post_ID, ARRAY_A );749 $post = get_post( $post_ID, ARRAY_A ); 749 750 $content = $post['post_content']; 750 751 751 752 // quick sanity check, don't run if no pretty permalinks or post is not published … … 1012 1013 * @return array With two entries of type string 1013 1014 */ 1014 1015 function get_sample_permalink($id, $title = null, $name = null) { 1015 $post = &get_post($id);1016 $post = get_post($id); 1016 1017 if ( !$post->ID ) 1017 1018 return array('', ''); 1018 1019 … … 1078 1079 */ 1079 1080 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 1080 1081 global $wpdb; 1081 $post = &get_post($id);1082 $post = get_post($id); 1082 1083 1083 1084 list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); 1084 1085 -
wp-admin/includes/template.php
705 705 */ 706 706 function the_attachment_links( $id = false ) { 707 707 $id = (int) $id; 708 $post = &get_post( $id );708 $post = get_post( $id ); 709 709 710 710 if ( $post->post_type != 'attachment' ) 711 711 return false; -
wp-admin/includes/media.php
893 893 * @return unknown 894 894 */ 895 895 function image_media_send_to_editor($html, $attachment_id, $attachment) { 896 $post = &get_post($attachment_id);896 $post = get_post($attachment_id); 897 897 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 898 898 $url = $attachment['url']; 899 899 $align = !empty($attachment['align']) ? $attachment['align'] : 'none'; … … 920 920 */ 921 921 function get_attachment_fields_to_edit($post, $errors = null) { 922 922 if ( is_int($post) ) 923 $post = &get_post($post);923 $post = get_post($post); 924 924 if ( is_array($post) ) 925 $post = (object) $post;925 $post = new WP_Post( (object) $post ); 926 926 927 927 $image_url = wp_get_attachment_url($post->ID); 928 928 -
wp-admin/post.php
202 202 case 'trash': 203 203 check_admin_referer('trash-post_' . $post_id); 204 204 205 $post = &get_post($post_id);205 $post = get_post($post_id); 206 206 207 207 if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) 208 208 wp_die( __('You are not allowed to move this item to the Trash.') ); -
wp-admin/upload.php
57 57 if ( !$parent_id ) 58 58 return; 59 59 60 $parent = &get_post( $parent_id );60 $parent = get_post( $parent_id ); 61 61 if ( !current_user_can( 'edit_post', $parent_id ) ) 62 62 wp_die( __( 'You are not allowed to edit this post.' ) ); 63 63 -
wp-admin/edit.php
103 103 case 'delete': 104 104 $deleted = 0; 105 105 foreach( (array) $post_ids as $post_id ) { 106 $post_del = &get_post($post_id);106 $post_del = get_post($post_id); 107 107 108 108 if ( !current_user_can($post_type_object->cap->delete_post, $post_id) ) 109 109 wp_die( __('You are not allowed to delete this item.') );