Changeset 38925 for trunk/src/wp-includes/post.php
- Timestamp:
- 10/25/2016 08:47:06 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r38852 r38925 5613 5613 5614 5614 $date = wp_cache_get( $key, 'timeinfo' ); 5615 5616 if ( ! $date ) { 5617 if ( 'any' === $post_type ) { 5618 $post_types = get_post_types( array( 'public' => true ) ); 5619 array_walk( $post_types, array( $wpdb, 'escape_by_ref' ) ); 5620 $post_types = "'" . implode( "', '", $post_types ) . "'"; 5621 } else { 5622 $post_types = "'" . sanitize_key( $post_type ) . "'"; 5623 } 5624 5625 switch ( $timezone ) { 5626 case 'gmt': 5627 $date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); 5628 break; 5629 case 'blog': 5630 $date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); 5631 break; 5632 case 'server': 5633 $add_seconds_server = date( 'Z' ); 5634 $date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); 5635 break; 5636 } 5637 5638 if ( $date ) { 5639 wp_cache_set( $key, $date, 'timeinfo' ); 5640 } 5641 } 5642 5643 return $date; 5615 if ( false !== $date ) { 5616 return $date; 5617 } 5618 5619 if ( 'any' === $post_type ) { 5620 $post_types = get_post_types( array( 'public' => true ) ); 5621 array_walk( $post_types, array( $wpdb, 'escape_by_ref' ) ); 5622 $post_types = "'" . implode( "', '", $post_types ) . "'"; 5623 } else { 5624 $post_types = "'" . sanitize_key( $post_type ) . "'"; 5625 } 5626 5627 switch ( $timezone ) { 5628 case 'gmt': 5629 $date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); 5630 break; 5631 case 'blog': 5632 $date = $wpdb->get_var("SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); 5633 break; 5634 case 'server': 5635 $add_seconds_server = date( 'Z' ); 5636 $date = $wpdb->get_var("SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1"); 5637 break; 5638 } 5639 5640 if ( $date ) { 5641 wp_cache_set( $key, $date, 'timeinfo' ); 5642 5643 return $date; 5644 } 5645 5646 return false; 5644 5647 } 5645 5648
Note: See TracChangeset
for help on using the changeset viewer.