Ticket #900: xmlrpc.php.diff
| File xmlrpc.php.diff, 4.0 kB (added by redsweater, 2 years ago) |
|---|
-
xmlrpc.php
old new 36 36 include_once(ABSPATH . 'wp-admin/admin-functions.php'); 37 37 include_once(ABSPATH . WPINC . '/class-IXR.php'); 38 38 39 // Required by post.php when tags are included, to resolve category_exists() 40 include_once(ABSPATH . "wp-admin/admin-db.php"); 41 39 42 // Turn off all warnings and errors. 40 43 // error_reporting(0); 41 44 … … 989 992 $post_excerpt = $content_struct['mt_excerpt']; 990 993 $post_more = $content_struct['mt_text_more']; 991 994 995 $tags_input = $content_struct['mt_keywords']; 996 992 997 $comment_status = (!isset($content_struct['mt_allow_comments'])) ? 993 998 get_option('default_comment_status') 994 999 : $content_struct['mt_allow_comments']; … … 1027 1032 } 1028 1033 1029 1034 // We've got all the data -- post it: 1030 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order' );1035 $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input'); 1031 1036 1032 1037 $post_ID = wp_insert_post($postdata); 1033 1038 … … 1171 1176 $post_more = $content_struct['mt_text_more']; 1172 1177 $post_status = $publish ? 'publish' : 'draft'; 1173 1178 1179 $tags_input = $content_struct['mt_keywords']; 1180 1174 1181 if ( ('publish' == $post_status) ) { 1175 1182 if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) 1176 1183 return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.')); … … 1202 1209 } 1203 1210 1204 1211 // We've got all the data -- post it: 1205 $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author' );1212 $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input'); 1206 1213 1207 1214 $result = wp_update_post($newpost); 1208 1215 if (!$result) { … … 1243 1250 $categories[] = get_cat_name($catid); 1244 1251 } 1245 1252 1253 $tagnames = array(); 1254 $tagids = get_post_tags($post_ID); 1255 if (!empty( $tagids ) ) { 1256 foreach($tagids as $tagid) { 1257 $tagnames[] = $tagid->cat_name; 1258 } 1259 } 1260 1246 1261 $post = get_extended($postdata['post_content']); 1247 1262 $link = post_permalink($postdata['ID']); 1248 1263 … … 1267 1282 'mt_text_more' => $post['extended'], 1268 1283 'mt_allow_comments' => $allow_comments, 1269 1284 'mt_allow_pings' => $allow_pings, 1285 'mt_keywords' => implode(', ', $tagnames), 1270 1286 'wp_slug' => $postdata['post_name'], 1271 1287 'wp_password' => $postdata['post_password'], 1272 1288 'wp_author_id' => $author->ID, … … 1304 1320 foreach ($posts_list as $entry) { 1305 1321 1306 1322 $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']); 1323 1307 1324 $categories = array(); 1308 1325 $catids = wp_get_post_categories($entry['ID']); 1309 1326 foreach($catids as $catid) { 1310 1327 $categories[] = get_cat_name($catid); 1311 1328 } 1312 1329 1330 $tagnames = array(); 1331 $tagids = get_post_tags($entry['ID']); 1332 if (!empty( $tagids ) ) { 1333 foreach($tagids as $tagid) { 1334 $tagnames[] = $tagid->cat_name; 1335 } 1336 } 1337 1313 1338 $post = get_extended($entry['post_content']); 1314 1339 $link = post_permalink($entry['ID']); 1315 1340 … … 1334 1359 'mt_text_more' => $post['extended'], 1335 1360 'mt_allow_comments' => $allow_comments, 1336 1361 'mt_allow_pings' => $allow_pings, 1362 'mt_keywords' => implode(', ', $tagnames), 1337 1363 'wp_slug' => $entry['post_name'], 1338 1364 'wp_password' => $entry['post_password'], 1339 1365 'wp_author_id' => $author->ID,
