Ticket #18429: 18429.diff
File 18429.diff, 20.5 KB (added by , 13 years ago) |
---|
-
wp-includes/class-wp-xmlrpc-server.php
495 495 * 496 496 * @access protected 497 497 * 498 * @param array|object $taxonomy The unprepared taxonomy data498 * @param object $taxonomy The unprepared taxonomy data 499 499 * @return array The prepared taxonomy data 500 500 */ 501 protected function _prepare_taxonomy( $taxonomy ) { 502 $_taxonomy = (array) $taxonomy; 501 protected function _prepare_taxonomy( $taxonomy, $fields ) { 502 $_taxonomy = array( 503 'name' => $taxonmy->name, 504 'label' => $taxonomy->label, 505 'hierarchical' => (bool) $taxonomy->hierarchical, 506 'public' => (bool) $taxonomy->public, 507 'show_ui' => (bool) $taxonomy->show_ui, 508 '_builtin' => (bool) $taxnomy->_builtin, 509 ); 503 510 504 unset( $_taxonomy['update_count_callback'] ); 511 if ( in_array( 'labels', $fields ) ) 512 $_taxonomy['labels'] = (array) $taxonomy->labels; 505 513 506 return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy ); 514 if ( in_array( 'capabilities', $fields ) ) 515 $_taxonomy['cap'] = (array) $post_type->cap; 516 517 if ( in_array( 'object-types', $fields ) ) 518 $_taxonomy['taxonomies'] = array_unique( (array) $taxonomy->object_type ); 519 520 return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields ); 507 521 } 508 522 509 523 /** … … 652 666 * 653 667 * @access protected 654 668 * 655 * @param array|object $post_type The unprepared post type data669 * @param object $post_type Post type object 656 670 * @param array $fields The subset of post fields to return 657 671 * @return array The prepared post type data 658 672 */ 659 protected function _prepare_post_type( $post_type, $fields ) { 660 $post_type = (array) $post_type; 661 673 public function _prepare_post_type( $post_type, $fields ) { 662 674 $_post_type = array( 663 'name' => $post_type['name'], 664 'label' => $post_type['label'], 665 'description' => $post_type['description'], 666 'hierarchical' => $post_type['hierarchical'], 667 'public' => $post_type['public'], 668 '_builtin' => $post_type['_builtin'], 669 'supports' => get_all_post_type_supports( $post_type['name'] ) 675 'name' => $post_type->name, 676 'label' => $post_type->label, 677 'hierarchical' => (bool) $post_type->hierarchical, 678 'public' => (bool) $post_type->public, 679 'show_ui' => (bool) $post_type->show_ui, 680 '_builtin' => (bool) $post_type->_builtin, 681 'has_archive' => (bool) $post_type->has_archive, 682 'supports' => array_keys( array_filter( get_all_post_type_supports( $post_type->name ) ) ), 670 683 ); 671 684 672 685 if ( in_array( 'labels', $fields ) ) { 673 $_post_type['labels'] = (array) $post_type ['labels'];686 $_post_type['labels'] = (array) $post_type->labels; 674 687 } 675 688 676 689 if ( in_array( 'capabilities', $fields ) ) { 677 $_post_type['cap'] = (array) $post_type['cap']; 678 $_post_type['capability_type'] = $post_type['capability_type']; 679 $_post_type['map_meta_cap'] = $post_type['map_meta_cap']; 690 $_post_type['cap'] = (array) $post_type->cap; 691 $_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap; 680 692 } 681 693 682 if ( in_array( 'admin', $fields ) ) {683 $_post_type['publicly_queryable'] = $post_type['publicly_queryable'];684 $_post_type['exclude_from_search'] = $post_type['exclude_from_search'];685 $_post_type['_edit_link'] = $post_type['_edit_link'];686 $_post_type['rewrite'] = $post_type['rewrite'];687 $_post_type['has_archive'] = $post_type['has_archive'];688 $_post_type['query_var'] = $post_type['query_var'];689 }690 691 694 if ( in_array( 'menu', $fields ) ) { 692 $_post_type['show_ui'] = $post_type['show_ui']; 693 $_post_type['menu_position'] = $post_type['menu_position']; 694 $_post_type['menu_icon'] = $post_type['menu_icon']; 695 $_post_type['show_in_nav_menus'] = $post_type['show_in_nav_menus']; 696 $_post_type['show_in_menu'] = $post_type['show_in_menu']; 697 $_post_type['show_in_admin_bar'] = $post_type['show_in_admin_bar']; 695 $_post_type['menu_position'] = (int) $post_type->menu_position; 696 $_post_type['menu_icon'] = $post_type->menu_icon; 697 $_post_type['menu_parent'] = is_bool( $post_type->show_in_menu ) ? '' : (string) $post_type->show_in_menu; 698 $_post_type['show_in_menu'] = (bool) $post_type->show_in_menu; 698 699 } 699 700 700 if ( in_array( 'taxonomies', $fields ) ) { 701 $_post_type['taxonomies'] = get_object_taxonomies( $_post_type['name'] ); 702 } 701 if ( in_array( 'taxonomies', $fields ) ) 702 $_post_type['taxonomies'] = get_object_taxonomies( $_post_type->name, 'names' ); 703 703 704 704 return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type ); 705 705 } … … 737 737 /** 738 738 * Create a new post for any registered post type. 739 739 * 740 * @since 3.4.0 741 * 740 742 * @uses wp_insert_post() 741 743 * @param array $args Method parameters. Contains: 742 744 * - int $blog_id … … 784 786 785 787 /* 786 788 * Helper method for filtering out elements from an array. 789 * 790 * @since 3.4.0 787 791 */ 788 function _is_greater_than_one( $count ) {792 function _is_greater_than_one( $count ) { 789 793 return $count > 1; 790 794 } 791 795 792 796 /* 793 797 * Helper method for wp_newPost and wp_editPost, containing shared logic. 798 * 799 * @since 3.4.0 794 800 */ 795 function _insert_post( $user, $content_struct ) {801 protected function _insert_post( $user, $content_struct ) { 796 802 $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0, 797 'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' , 'sticky' => 0);803 'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' ); 798 804 799 805 $post_data = wp_parse_args( $content_struct, $defaults ); 800 806 801 807 $post_type = get_post_type_object( $post_data['post_type'] ); 802 if ( ! ( (bool) $post_type ))808 if ( ! $post_type ) 803 809 return new IXR_Error( 403, __( 'Invalid post type' ) ); 804 810 805 $update = false; 806 if ( ! empty( $post_data[ 'ID' ] ) ) 807 $update = true; 811 $update = ! empty( $post_data['ID'] ); 808 812 809 813 if ( $update ) { 810 if ( ! current_user_can( $post_type->cap->edit_post, $post_data[ 'ID'] ) )814 if ( ! current_user_can( $post_type->cap->edit_post, $post_data['ID'] ) ) 811 815 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 816 if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) ) 817 return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); 812 818 } else { 813 819 if ( ! current_user_can( $post_type->cap->edit_posts ) ) 814 820 return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); … … 819 825 case 'pending': 820 826 break; 821 827 case 'private': 828 unset( $post_data['sticky'] ); 822 829 if ( ! current_user_can( $post_type->cap->publish_posts ) ) 823 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );830 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) ); 824 831 break; 825 832 case 'publish': 826 833 case 'future': 827 834 if ( ! current_user_can( $post_type->cap->publish_posts ) ) 828 return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );835 return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) ); 829 836 break; 830 837 default: 831 838 $post_data['post_status'] = 'draft'; 832 839 break; 833 840 } 834 841 835 if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) 836 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) ); 842 if ( ! empty( $post_data['post_password'] ) ) { 843 if ( ! current_user_can( $post_type->cap->publish_posts ) ) 844 return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) ); 845 unset( $post_data['sticky'] ); 846 } 837 847 838 848 $post_data['post_author'] = absint( $post_data['post_author'] ); 839 849 if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) { … … 848 858 $post_data['post_author'] = $user->ID; 849 859 } 850 860 851 if ( isset( $post_data['comment_status'] ) ) { 852 if ( ! post_type_supports( $post_data['post_type'], 'comments' ) || ( $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' ) ) { 853 unset( $post_data['comment_status'] ); 854 } 855 } 861 if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' ) 862 unset( $post_data['comment_status'] ); 856 863 857 if ( isset( $post_data['ping_status'] ) ) { 858 if ( ! post_type_supports( $post_data['post_type'], 'trackbacks' ) || ( $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' ) ) { 859 unset( $post_data['ping_status'] ); 860 } 861 } 864 if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' ) 865 unset( $post_data['ping_status'] ); 862 866 863 867 // Do some timestamp voodoo 864 868 if ( ! empty( $post_data['post_date_gmt'] ) ) { 865 869 // We know this is supposed to be GMT, so we're going to slap that Z on there by force 866 $dateCreated = str_replace( 'Z', '', $post_data['post_date_gmt']->getIso()) . 'Z';870 $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z'; 867 871 } elseif ( ! empty( $post_data['post_date'] ) ) { 868 872 $dateCreated = $post_data['post_date']->getIso(); 869 873 } … … 873 877 $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' ); 874 878 } 875 879 876 if ( ! isset( $post_data['ID'] ) ) {880 if ( ! isset( $post_data['ID'] ) ) 877 881 $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID; 878 }879 882 $post_ID = $post_data['ID']; 880 883 881 $sticky = $post_data['sticky'] ? true : false; 882 883 if ( $post_data['post_type'] == 'post' && $sticky == true ) { 884 if ( $post_data['post_type'] == 'post' && isset( $post_data['sticky'] ) ) { 884 885 if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) 885 886 return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) ); 886 887 if ( $post_data['post_status'] != 'publish' ) 888 return new IXR_Error( 401, __( 'Only published posts can be made sticky.' ) ); 889 890 stick_post( $post_ID ); 887 if ( $post_data['sticky'] ) 888 stick_post( $post_ID ); 889 else 890 unstick_post( $post_ID ); 891 891 } 892 892 893 if ( isset 893 if ( isset( $post_data['post_thumbnail'] ) ) { 894 894 // empty value deletes, non-empty value adds/updates 895 if ( empty( $post_data['post_thumbnail'] ) ) {895 if ( ! $post_data['post_thumbnail'] ) 896 896 delete_post_thumbnail( $post_ID ); 897 } 898 else { 899 if ( set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) === false ) 897 elseif ( ! set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) ) 900 898 return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 901 }902 899 unset( $content_struct['post_thumbnail'] ); 903 900 } 904 901 905 if ( isset ( $post_data['custom_fields'] ) && post_type_supports( $post_data['post_type'], 'custom-fields' ) ) {902 if ( isset( $post_data['custom_fields'] ) ) 906 903 $this->set_custom_fields( $post_ID, $post_data['custom_fields'] ); 907 }908 904 909 905 if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) { 910 906 $post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' ); … … 987 983 } 988 984 989 985 $post_data['tax_input'] = $terms; 990 unset( $post_data['terms'] ); 991 unset( $post_data['terms_names'] ); 986 unset( $post_data['terms'], $post_data['terms_names'] ); 992 987 } else { 993 988 // do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names' 994 unset( $post_data['tax_input'] );989 unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] ); 995 990 } 996 991 997 992 if ( isset( $post_data['post_format'] ) ) { … … 1024 1019 /** 1025 1020 * Edit a post for any registered post type. 1026 1021 * 1022 * @since 3.4.0 1023 * 1027 1024 * The $content_struct parameter only needs to contain fields that 1028 1025 * should be changed. All other fields will retain their existing values. 1029 1026 * … … 1039 1036 function wp_editPost( $args ) { 1040 1037 $this->escape( $args ); 1041 1038 1042 $blog_id = (int) $args[0]; // we will support this in the near future1039 $blog_id = (int) $args[0]; 1043 1040 $username = $args[1]; 1044 1041 $password = $args[2]; 1045 1042 $post_id = (int) $args[3]; … … 1050 1047 1051 1048 do_action( 'xmlrpc_call', 'wp.editPost' ); 1052 1049 1053 // User Capabilities are checked in _insert_post.1054 1055 1050 $post = get_post( $post_id, ARRAY_A ); 1056 1051 1057 if ( empty( $post[ "ID"] ) )1052 if ( empty( $post['ID'] ) ) 1058 1053 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 1059 1054 1060 1055 // convert the date field back to IXR form … … 1067 1062 else 1068 1063 $post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] ); 1069 1064 1070 $this->escape( $post );1071 1065 $merged_content_struct = array_merge( $post, $content_struct ); 1072 1066 1073 1067 $retval = $this->_insert_post( $user, $merged_content_struct ); … … 1080 1074 /** 1081 1075 * Delete a post for any registered post type. 1082 1076 * 1077 * @since 3.4.0 1078 * 1083 1079 * @uses wp_delete_post() 1084 1080 * @param array $args Method parameters. Contains: 1085 1081 * - int $blog_id … … 1120 1116 /** 1121 1117 * Retrieve a post. 1122 1118 * 1119 * @since 3.4.0 1120 * 1123 1121 * The optional $fields parameter specifies what fields will be included 1124 1122 * in the response array. This should be a list of field names. 'post_id' will 1125 1123 * always be included in the response regardless of the value of $fields. … … 1179 1177 1180 1178 $post = wp_get_single_post( $post_id, ARRAY_A ); 1181 1179 1182 if ( empty( $post[ "ID"] ) )1180 if ( empty( $post['ID'] ) ) 1183 1181 return new IXR_Error( 404, __( 'Invalid post ID.' ) ); 1184 1182 1185 1183 $post_type = get_post_type_object( $post['post_type'] ); … … 1192 1190 /** 1193 1191 * Retrieve posts. 1194 1192 * 1193 * @since 3.4.0 1194 * 1195 1195 * The optional $filter parameter modifies the query used to retrieve posts. 1196 1196 * Accepted keys are 'post_type', 'post_status', 'number', 'offset', 1197 1197 * 'orderby', and 'order'. … … 1280 1280 /** 1281 1281 * Create a new term. 1282 1282 * 1283 * @since 3.4.0 1284 * 1283 1285 * @uses wp_insert_term() 1284 1286 * @param array $args Method parameters. Contains: 1285 1287 * - int $blog_id … … 1361 1363 /** 1362 1364 * Edit a term. 1363 1365 * 1366 * @since 3.4.0 1367 * 1364 1368 * @uses wp_update_term() 1365 1369 * @param array $args Method parameters. Contains: 1366 1370 * - int $blog_id … … 1455 1459 /** 1456 1460 * Delete a term. 1457 1461 * 1462 * @since 3.4.0 1463 * 1458 1464 * @uses wp_delete_term() 1459 1465 * @param array $args Method parameters. Contains: 1460 1466 * - int $blog_id … … 1508 1514 /** 1509 1515 * Retrieve a term. 1510 1516 * 1517 * @since 3.4.0 1518 * 1511 1519 * @uses get_term() 1512 1520 * @param array $args Method parameters. Contains: 1513 1521 * - int $blog_id … … 1562 1570 /** 1563 1571 * Retrieve all terms for a taxonomy. 1564 1572 * 1573 * @since 3.4.0 1574 * 1565 1575 * The optional $filter parameter modifies the query used to retrieve terms. 1566 1576 * Accepted keys are 'number', 'offset', 'orderby', 'order', 'hide_empty', and 'search'. 1567 1577 * … … 1636 1646 /** 1637 1647 * Retrieve a taxonomy. 1638 1648 * 1649 * @since 3.4.0 1650 * 1639 1651 * @uses get_taxonomy() 1640 1652 * @param array $args Method parameters. Contains: 1641 1653 * - int $blog_id … … 1652 1664 $password = $args[2]; 1653 1665 $taxonomy = $args[3]; 1654 1666 1667 if ( isset( $args[4] ) ) 1668 $fields = $args[4]; 1669 else 1670 $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'capabilities', 'object-types' ), 'wp.getTaxonomy' ); 1671 1655 1672 if ( ! $user = $this->login( $username, $password ) ) 1656 1673 return $this->error; 1657 1674 … … 1665 1682 if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) 1666 1683 return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) ); 1667 1684 1668 return $this->_prepare_taxonomy( $taxonomy );1685 return $this->_prepare_taxonomy( $taxonomy, $fields ); 1669 1686 } 1670 1687 1671 1688 /** 1672 1689 * Retrieve all taxonomies. 1673 1690 * 1691 * @since 3.4.0 1692 * 1674 1693 * @uses get_taxonomies() 1675 1694 * @param array $args Method parameters. Contains: 1676 1695 * - int $blog_id … … 1684 1703 $blog_id = (int) $args[0]; 1685 1704 $username = $args[1]; 1686 1705 $password = $args[2]; 1706 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 1687 1707 1708 if ( isset( $args[4] ) ) 1709 $fields = $args[4]; 1710 else 1711 $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'capabilities', 'object-types' ), 'wp.getTaxonomies' ); 1712 1688 1713 if ( ! $user = $this->login( $username, $password ) ) 1689 1714 return $this->error; 1690 1715 1691 1716 do_action( 'xmlrpc_call', 'wp.getTaxonomies' ); 1692 1717 1693 $taxonomies = get_taxonomies( array(), 'objects' );1718 $taxonomies = get_taxonomies( $filter, 'objects' ); 1694 1719 1695 1720 // holds all the taxonomy data 1696 1721 $struct = array(); … … 1700 1725 if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) 1701 1726 continue; 1702 1727 1703 $struct[] = $this->_prepare_taxonomy( $taxonomy );1728 $struct[] = $this->_prepare_taxonomy( $taxonomy, $fields ); 1704 1729 } 1705 1730 1706 1731 return $struct; … … 2063 2088 /** 2064 2089 * Get list of all tags 2065 2090 * 2066 * @since 2.7 2091 * @since 2.7.0 2067 2092 * 2068 2093 * @param array $args Method parameters. 2069 2094 * @return array … … 2469 2494 2470 2495 // Do some timestamp voodoo 2471 2496 if ( !empty( $content_struct['date_created_gmt'] ) ) { 2472 $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force 2497 // We know this is supposed to be GMT, so we're going to slap that Z on there by force 2498 $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z'; 2473 2499 $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated)); 2474 2500 $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT'); 2475 2501 } … … 2957 2983 /** 2958 2984 * Retrieves a post type 2959 2985 * 2986 * @since 3.4.0 2987 * 2960 2988 * @uses get_post_type_object() 2961 2989 * @param array $args Method parameters. Contains: 2962 2990 * - int $blog_id … … 2983 3011 $password = $args[2]; 2984 3012 $post_type_name = $args[3]; 2985 3013 2986 if ( isset( $args[4] ) ) 2987 $fields = $args[4]; 2988 else 2989 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostType' ); 3014 if ( isset( $args[4] ) ) 3015 $fields = $args[4]; 3016 else 3017 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostType' ); 2990 3018 2991 3019 if ( !$user = $this->login( $username, $password ) ) 2992 3020 return $this->error; … … 3007 3035 /** 3008 3036 * Retrieves a post types 3009 3037 * 3010 * @ access private3038 * @since 3.4.0 3011 3039 * 3012 3040 * @uses get_post_types() 3013 3041 * @param array $args Method parameters. Contains: … … 3024 3052 $blog_id = (int) $args[0]; 3025 3053 $username = $args[1]; 3026 3054 $password = $args[2]; 3027 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 3055 $filter = isset( $args[3] ) ? $args[3] : array( 'public' => true ); 3028 3056 3029 if ( isset( $args[4] ) ) 3030 $fields = $args[4]; 3031 else 3032 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostTypes' ); 3057 if ( isset( $args[4] ) ) 3058 $fields = $args[4]; 3059 else 3060 $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'capabilities', 'taxonomies' ), 'wp.getPostTypes' ); 3033 3061 3034 3062 if ( ! $user = $this->login( $username, $password ) ) 3035 3063 return $this->error; … … 3529 3557 function mw_newPost($args) { 3530 3558 $this->escape($args); 3531 3559 3532 $blog_ID = (int) $args[0]; // we will support this in the near future3560 $blog_ID = (int) $args[0]; 3533 3561 $username = $args[1]; 3534 3562 $password = $args[2]; 3535 3563 $content_struct = $args[3]; … … 3726 3754 3727 3755 // Do some timestamp voodoo 3728 3756 if ( !empty( $content_struct['date_created_gmt'] ) ) 3729 $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force 3757 // We know this is supposed to be GMT, so we're going to slap that Z on there by force 3758 $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z'; 3730 3759 elseif ( !empty( $content_struct['dateCreated']) ) 3731 3760 $dateCreated = $content_struct['dateCreated']->getIso(); 3732 3761 … … 4044 4073 4045 4074 // Do some timestamp voodoo 4046 4075 if ( !empty( $content_struct['date_created_gmt'] ) ) 4047 $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force 4076 // We know this is supposed to be GMT, so we're going to slap that Z on there by force 4077 $dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z'; 4048 4078 elseif ( !empty( $content_struct['dateCreated']) ) 4049 4079 $dateCreated = $content_struct['dateCreated']->getIso(); 4050 4080