Changeset 38852 for trunk/src/wp-includes/post.php
- Timestamp:
- 10/21/2016 05:59:34 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/post.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r38849 r38852 3992 3992 * 3993 3993 * @since 1.5.0 3994 * @since 4.7.0 $post_id can be a WP_Post object. 3995 * @since 4.7.0 $uri can be an array of URIs. 3994 3996 * 3995 3997 * @global wpdb $wpdb WordPress database abstraction object. 3996 3998 * 3997 * @param int $post_id PostID.3998 * @param string $uri Ping URI.3999 * @param int|WP_Post $post_id Post object or ID. 4000 * @param string|array $uri Ping URI or array of URIs. 3999 4001 * @return int|false How many rows were updated. 4000 4002 */ 4001 4003 function add_ping( $post_id, $uri ) { 4002 4004 global $wpdb; 4003 $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); 4004 $pung = trim($pung); 4005 $pung = preg_split('/\s/', $pung); 4006 $pung[] = $uri; 4005 4006 $post = get_post( $post_id ); 4007 if ( ! $post ) { 4008 return false; 4009 } 4010 4011 $pung = trim( $post->pinged ); 4012 $pung = preg_split( '/\s/', $pung ); 4013 4014 if ( is_array( $uri ) ) { 4015 $pung = array_merge( $pung, $uri ); 4016 } 4017 else { 4018 $pung[] = $uri; 4019 } 4007 4020 $new = implode("\n", $pung); 4008 4021 … … 4016 4029 $new = apply_filters( 'add_ping', $new ); 4017 4030 4018 // expected_slashed ($new).4019 $new = wp_unslash($new);4020 return $ wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );4031 $return = $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post->ID ) ); 4032 clean_post_cache( $post->ID ); 4033 return $return; 4021 4034 } 4022 4035 … … 4060 4073 * @since 1.5.0 4061 4074 * 4062 * @ global wpdb $wpdb WordPress database abstractionobject.4063 * 4064 * @param int $post_id Post ID.4075 * @since 4.7.0 $post_id can be a WP_Post object. 4076 * 4077 * @param int|WP_Post $post_id Post ID or object. 4065 4078 * @return array 4066 4079 */ 4067 4080 function get_pung( $post_id ) { 4068 global $wpdb; 4069 $pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id )); 4070 $pung = trim($pung); 4071 $pung = preg_split('/\s/', $pung); 4081 $post = get_post( $post_id ); 4082 if ( ! $post ) { 4083 return false; 4084 } 4085 4086 $pung = trim( $post->pinged ); 4087 $pung = preg_split( '/\s/', $pung ); 4072 4088 4073 4089 /** … … 4085 4101 * 4086 4102 * @since 1.5.0 4087 * 4088 * @global wpdb $wpdb WordPress database abstraction object. 4089 * 4090 * @param int $post_id Post ID 4103 * @since 4.7.0 $post_id can be a WP_Post object. 4104 * 4105 * @param int|WP_Post $post_id Post Object or ID 4091 4106 * @return array 4092 4107 */ 4093 4108 function get_to_ping( $post_id ) { 4094 global $wpdb; 4095 $to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id )); 4096 $to_ping = sanitize_trackback_urls( $to_ping ); 4109 $post = get_post( $post_id ); 4110 4111 if ( ! $post ) { 4112 return false; 4113 } 4114 4115 $to_ping = sanitize_trackback_urls( $post->to_ping ); 4097 4116 $to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY); 4098 4117
Note: See TracChangeset
for help on using the changeset viewer.