Changeset 47219 for trunk/src/wp-includes/class-wp-xmlrpc-server.php
- Timestamp:
- 02/09/2020 04:52:28 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r47122 r47219 697 697 foreach ( $blogs as $blog ) { 698 698 // Don't include blogs that aren't hosted at this site. 699 if ( $blog->site_id != get_current_network_id()) {699 if ( get_current_network_id() != $blog->site_id ) { 700 700 continue; 701 701 } … … 828 828 */ 829 829 protected function _convert_date( $date ) { 830 if ( $date === '0000-00-00 00:00:00') {830 if ( '0000-00-00 00:00:00' === $date ) { 831 831 return new IXR_Date( '00000000T00:00:00Z' ); 832 832 } … … 842 842 */ 843 843 protected function _convert_date_gmt( $date_gmt, $date ) { 844 if ( $date !== '0000-00-00 00:00:00' && $date_gmt === '0000-00-00 00:00:00') {844 if ( '0000-00-00 00:00:00' !== $date && '0000-00-00 00:00:00' === $date_gmt ) { 845 845 return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) ); 846 846 } … … 880 880 'comment_status' => $post['comment_status'], 881 881 'ping_status' => $post['ping_status'], 882 'sticky' => ( $post['post_type'] === 'post'&& is_sticky( $post['ID'] ) ),882 'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ), 883 883 ); 884 884 … … 892 892 893 893 // Consider future posts as published. 894 if ( $post_fields['post_status'] === 'future') {894 if ( 'future' === $post_fields['post_status'] ) { 895 895 $post_fields['post_status'] = 'publish'; 896 896 } … … 1287 1287 */ 1288 1288 if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) { 1289 if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00'|| isset( $content_struct['post_date'] ) ) {1289 if ( '0000-00-00 00:00:00' === $content_struct['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { 1290 1290 unset( $content_struct['post_date_gmt'] ); 1291 1291 } else { … … 1402 1402 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 1403 1403 } 1404 if ( $post_data['post_type'] != get_post_type( $post_data['ID'] )) {1404 if ( get_post_type( $post_data['ID'] ) !== $post_data['post_type'] ) { 1405 1405 return new IXR_Error( 401, __( 'The post type may not be changed.' ) ); 1406 1406 } … … 1452 1452 } 1453 1453 1454 if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed') {1454 if ( isset( $post_data['comment_status'] ) && 'open' !== $post_data['comment_status'] && 'closed' !== $post_data['comment_status'] ) { 1455 1455 unset( $post_data['comment_status'] ); 1456 1456 } 1457 1457 1458 if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed') {1458 if ( isset( $post_data['ping_status'] ) && 'open' !== $post_data['ping_status'] && 'closed' !== $post_data['ping_status'] ) { 1459 1459 unset( $post_data['ping_status'] ); 1460 1460 } … … 1484 1484 $post_ID = $post_data['ID']; 1485 1485 1486 if ( $post_data['post_type'] == 'post') {1486 if ( 'post' === $post_data['post_type'] ) { 1487 1487 $error = $this->_toggle_sticky( $post_data, $update ); 1488 1488 if ( $error ) { … … 1709 1709 * since _insert_post() will ignore the non-GMT date if the GMT date is set. 1710 1710 */ 1711 if ( $post['post_date_gmt'] == '0000-00-00 00:00:00'|| isset( $content_struct['post_date'] ) ) {1711 if ( '0000-00-00 00:00:00' === $post['post_date_gmt'] || isset( $content_struct['post_date'] ) ) { 1712 1712 unset( $post['post_date_gmt'] ); 1713 1713 } else { … … 2930 2930 2931 2931 // If we found the page then format the data. 2932 if ( $page->ID && ( $page->post_type == 'page') ) {2932 if ( $page->ID && ( 'page' === $page->post_type ) ) { 2933 2933 return $this->_prepare_page( $page ); 2934 2934 } else { … … 3067 3067 // make sure it is a page and not a post. 3068 3068 $actual_page = get_post( $page_id, ARRAY_A ); 3069 if ( ! $actual_page || ( $actual_page['post_type'] != 'page') ) {3069 if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { 3070 3070 return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); 3071 3071 } … … 3133 3133 // Get the page data and make sure it is a page. 3134 3134 $actual_page = get_post( $page_id, ARRAY_A ); 3135 if ( ! $actual_page || ( $actual_page['post_type'] != 'page') ) {3135 if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) { 3136 3136 return new IXR_Error( 404, __( 'Sorry, no such page.' ) ); 3137 3137 } … … 4239 4239 } 4240 4240 4241 if ( $this->blog_options[ $o_name ]['readonly'] == true) {4241 if ( true == $this->blog_options[ $o_name ]['readonly'] ) { 4242 4242 continue; 4243 4243 } … … 5115 5115 $actual_post = get_post( $post_ID, ARRAY_A ); 5116 5116 5117 if ( ! $actual_post || $actual_post['post_type'] != 'post') {5117 if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { 5118 5118 return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); 5119 5119 } … … 5124 5124 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) ); 5125 5125 } 5126 if ( 'publish' == $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) {5126 if ( 'publish' === $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) { 5127 5127 return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ) ); 5128 5128 } … … 5189 5189 $actual_post = get_post( $post_ID, ARRAY_A ); 5190 5190 5191 if ( ! $actual_post || $actual_post['post_type'] != 'post') {5191 if ( ! $actual_post || 'post' !== $actual_post['post_type'] ) { 5192 5192 return new IXR_Error( 404, __( 'Sorry, no such post.' ) ); 5193 5193 } … … 5277 5277 $page_template = ''; 5278 5278 if ( ! empty( $content_struct['post_type'] ) ) { 5279 if ( $content_struct['post_type'] == 'page') {5279 if ( 'page' === $content_struct['post_type'] ) { 5280 5280 if ( $publish ) { 5281 5281 $cap = 'publish_pages'; 5282 } elseif ( isset( $content_struct['page_status'] ) && 'publish' == $content_struct['page_status'] ) {5282 } elseif ( isset( $content_struct['page_status'] ) && 'publish' === $content_struct['page_status'] ) { 5283 5283 $cap = 'publish_pages'; 5284 5284 } else { … … 5290 5290 $page_template = $content_struct['wp_page_template']; 5291 5291 } 5292 } elseif ( $content_struct['post_type'] == 'post') {5292 } elseif ( 'post' === $content_struct['post_type'] ) { 5293 5293 if ( $publish ) { 5294 5294 $cap = 'publish_posts'; 5295 } elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] ) {5295 } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { 5296 5296 $cap = 'publish_posts'; 5297 5297 } else { … … 5307 5307 if ( $publish ) { 5308 5308 $cap = 'publish_posts'; 5309 } elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] ) {5309 } elseif ( isset( $content_struct['post_status'] ) && 'publish' === $content_struct['post_status'] ) { 5310 5310 $cap = 'publish_posts'; 5311 5311 } else { … … 5514 5514 5515 5515 // Only posts can be sticky. 5516 if ( $post_type == 'post'&& isset( $content_struct['sticky'] ) ) {5516 if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { 5517 5517 $data = $postdata; 5518 5518 $data['sticky'] = $content_struct['sticky']; … … 5847 5847 $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null; 5848 5848 5849 if ( 'publish' == $post_status || 'private'== $post_status ) {5849 if ( 'publish' === $post_status || 'private' === $post_status ) { 5850 5850 if ( 'page' == $post_type && ! current_user_can( 'publish_pages' ) ) { 5851 5851 return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this page.' ) ); … … 5902 5902 5903 5903 // Only posts can be sticky. 5904 if ( $post_type == 'post'&& isset( $content_struct['sticky'] ) ) {5904 if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) { 5905 5905 $data = $newpost; 5906 5906 $data['sticky'] = $content_struct['sticky']; … … 5992 5992 do_action( 'xmlrpc_call', 'metaWeblog.getPost' ); 5993 5993 5994 if ( $postdata['post_date'] != '') {5994 if ( '' != $postdata['post_date'] ) { 5995 5995 $post_date = $this->_convert_date( $postdata['post_date'] ); 5996 5996 $post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'], $postdata['post_date'] ); … … 6025 6025 6026 6026 // Consider future posts as published. 6027 if ( $postdata['post_status'] === 'future') {6027 if ( 'future' === $postdata['post_status'] ) { 6028 6028 $postdata['post_status'] = 'publish'; 6029 6029 } … … 6042 6042 $enclosure = array(); 6043 6043 foreach ( (array) get_post_custom( $post_ID ) as $key => $val ) { 6044 if ( $key == 'enclosure') {6044 if ( 'enclosure' === $key ) { 6045 6045 foreach ( (array) $val as $enc ) { 6046 6046 $encdata = explode( "\n", $enc ); … … 6177 6177 6178 6178 // Consider future posts as published. 6179 if ( $entry['post_status'] === 'future') {6179 if ( 'future' === $entry['post_status'] ) { 6180 6180 $entry['post_status'] = 'publish'; 6181 6181 } … … 6214 6214 'date_modified' => $post_modified, 6215 6215 'date_modified_gmt' => $post_modified_gmt, 6216 'sticky' => ( $entry['post_type'] === 'post'&& is_sticky( $entry['ID'] ) ),6216 'sticky' => ( 'post' === $entry['post_type'] && is_sticky( $entry['ID'] ) ), 6217 6217 'wp_post_thumbnail' => get_post_thumbnail_id( $entry['ID'] ), 6218 6218 ); … … 6840 6840 } 6841 6841 6842 if ( $post_ID == url_to_postid( $pagelinkedfrom )) {6842 if ( url_to_postid( $pagelinkedfrom ) == $post_ID ) { 6843 6843 return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) ); 6844 6844 }
Note: See TracChangeset
for help on using the changeset viewer.