Changeset 17823
- Timestamp:
- 05/06/2011 07:51:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-xmlrpc-server.php
r17771 r17823 476 476 477 477 // If we found the page then format the data. 478 if ( $page->ID && ($page->post_type == "page") ) {478 if ( $page->ID && ($page->post_type == 'page') ) { 479 479 // Get all of the page content and link. 480 480 $full_page = get_extended($page->post_content); … … 493 493 494 494 // Format page date. 495 $page_date = mysql2date( "Ymd\TH:i:s", $page->post_date, false);496 $page_date_gmt = mysql2date( "Ymd\TH:i:s", $page->post_date_gmt, false);495 $page_date = mysql2date('Ymd\TH:i:s', $page->post_date, false); 496 $page_date_gmt = mysql2date('Ymd\TH:i:s', $page->post_date_gmt, false); 497 497 498 498 // For drafts use the GMT version of the date … … 514 514 515 515 $page_struct = array( 516 "dateCreated"=> new IXR_Date($page_date),517 "userid"=> $page->post_author,518 "page_id"=> $page->ID,519 "page_status"=> $page->post_status,520 "description" => $full_page["main"],521 "title"=> $page->post_title,522 "link"=> $link,523 "permaLink"=> $link,524 "categories"=> $categories,525 "excerpt"=> $page->post_excerpt,526 "text_more" => $full_page["extended"],527 "mt_allow_comments"=> $allow_comments,528 "mt_allow_pings"=> $allow_pings,529 "wp_slug"=> $page->post_name,530 "wp_password"=> $page->post_password,531 "wp_author"=> $author->display_name,532 "wp_page_parent_id"=> $page->post_parent,533 "wp_page_parent_title"=> $parent_title,534 "wp_page_order"=> $page->menu_order,535 "wp_author_id"=> $author->ID,536 "wp_author_display_name"=> $author->display_name,537 "date_created_gmt"=> new IXR_Date($page_date_gmt),538 "custom_fields"=> $this->get_custom_fields($page_id),539 "wp_page_template"=> $page_template516 'dateCreated' => new IXR_Date($page_date), 517 'userid' => $page->post_author, 518 'page_id' => $page->ID, 519 'page_status' => $page->post_status, 520 'description' => $full_page['main'], 521 'title' => $page->post_title, 522 'link' => $link, 523 'permaLink' => $link, 524 'categories' => $categories, 525 'excerpt' => $page->post_excerpt, 526 'text_more' => $full_page['extended'], 527 'mt_allow_comments' => $allow_comments, 528 'mt_allow_pings' => $allow_pings, 529 'wp_slug' => $page->post_name, 530 'wp_password' => $page->post_password, 531 'wp_author' => $author->display_name, 532 'wp_page_parent_id' => $page->post_parent, 533 'wp_page_parent_title' => $parent_title, 534 'wp_page_order' => $page->menu_order, 535 'wp_author_id' => $author->ID, 536 'wp_author_display_name' => $author->display_name, 537 'date_created_gmt' => new IXR_Date($page_date_gmt), 538 'custom_fields' => $this->get_custom_fields($page_id), 539 'wp_page_template' => $page_template 540 540 ); 541 541 … … 544 544 // If the page doesn't exist indicate that. 545 545 else { 546 return(new IXR_Error(404, __( "Sorry, no such page.")));546 return(new IXR_Error(404, __('Sorry, no such page.'))); 547 547 } 548 548 } … … 619 619 620 620 // Make sure the user is allowed to add new pages. 621 if ( !current_user_can( "publish_pages") )622 return(new IXR_Error(401, __( "Sorry, you cannot add new pages.")));621 if ( !current_user_can('publish_pages') ) 622 return(new IXR_Error(401, __('Sorry, you cannot add new pages.'))); 623 623 624 624 // Mark this as content for a page. 625 $args[3]["post_type"] = "page";625 $args[3]["post_type"] = 'page'; 626 626 627 627 // Let mw_newPost do all of the heavy lifting. … … 653 653 // make sure it is a page and not a post. 654 654 $actual_page = wp_get_single_post($page_id, ARRAY_A); 655 if ( !$actual_page || ($actual_page[ "post_type"] != "page") )656 return(new IXR_Error(404, __( "Sorry, no such page.")));655 if ( !$actual_page || ($actual_page['post_type'] != 'page') ) 656 return(new IXR_Error(404, __('Sorry, no such page.'))); 657 657 658 658 // Make sure the user can delete pages. 659 if ( !current_user_can( "delete_page", $page_id) )660 return(new IXR_Error(401, __( "Sorry, you do not have the right to delete this page.")));659 if ( !current_user_can('delete_page', $page_id) ) 660 return(new IXR_Error(401, __('Sorry, you do not have the right to delete this page.'))); 661 661 662 662 // Attempt to delete the page. 663 663 $result = wp_delete_post($page_id); 664 664 if ( !$result ) 665 return(new IXR_Error(500, __( "Failed to delete the page.")));665 return(new IXR_Error(500, __('Failed to delete the page.'))); 666 666 667 667 return(true); … … 692 692 // Get the page data and make sure it is a page. 693 693 $actual_page = wp_get_single_post($page_id, ARRAY_A); 694 if ( !$actual_page || ($actual_page[ "post_type"] != "page") )695 return(new IXR_Error(404, __( "Sorry, no such page.")));694 if ( !$actual_page || ($actual_page['post_type'] != 'page') ) 695 return(new IXR_Error(404, __('Sorry, no such page.'))); 696 696 697 697 // Make sure the user is allowed to edit pages. 698 if ( !current_user_can( "edit_page", $page_id) )699 return(new IXR_Error(401, __( "Sorry, you do not have the right to edit this page.")));698 if ( !current_user_can('edit_page', $page_id) ) 699 return(new IXR_Error(401, __('Sorry, you do not have the right to edit this page.'))); 700 700 701 701 // Mark this as content for a page. 702 $content[ "post_type"] = "page";702 $content['post_type'] = 'page'; 703 703 704 704 // Arrange args in the way mw_editPost understands. … … 756 756 $num_pages = count($page_list); 757 757 for ( $i = 0; $i < $num_pages; $i++ ) { 758 $post_date = mysql2date( "Ymd\TH:i:s", $page_list[$i]->post_date, false);759 $post_date_gmt = mysql2date( "Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false);758 $post_date = mysql2date('Ymd\TH:i:s', $page_list[$i]->post_date, false); 759 $post_date_gmt = mysql2date('Ymd\TH:i:s', $page_list[$i]->post_date_gmt, false); 760 760 761 761 $page_list[$i]->dateCreated = new IXR_Date($post_date); … … 795 795 return $this->error; 796 796 797 if ( !current_user_can( "edit_posts") )798 return(new IXR_Error(401, __( "Sorry, you cannot edit posts on this site.")));797 if ( !current_user_can('edit_posts') ) 798 return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'))); 799 799 800 800 do_action('xmlrpc_call', 'wp.getAuthors'); … … 803 803 foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) { 804 804 $authors[] = array( 805 "user_id"=> $user->ID,806 "user_login"=> $user->user_login,807 "display_name"=> $user->display_name805 'user_id' => $user->ID, 806 'user_login' => $user->user_login, 807 'display_name' => $user->display_name 808 808 ); 809 809 } … … 875 875 876 876 // Make sure the user is allowed to add a category. 877 if ( !current_user_can( "manage_categories") )878 return(new IXR_Error(401, __( "Sorry, you do not have the right to add a category.")));877 if ( !current_user_can('manage_categories') ) 878 return(new IXR_Error(401, __('Sorry, you do not have the right to add a category.'))); 879 879 880 880 // If no slug was provided make it empty so that 881 881 // WordPress will generate one. 882 if ( empty($category[ "slug"]) )883 $category[ "slug"] = "";882 if ( empty($category['slug']) ) 883 $category['slug'] = ''; 884 884 885 885 // If no parent_id was provided make it empty 886 886 // so that it will be a top level page (no parent). 887 if ( !isset($category[ "parent_id"]) )888 $category[ "parent_id"] = "";887 if ( !isset($category['parent_id']) ) 888 $category['parent_id'] = ''; 889 889 890 890 // If no description was provided make it empty. … … 893 893 894 894 $new_category = array( 895 "cat_name" => $category["name"],896 "category_nicename" => $category["slug"],897 "category_parent" => $category["parent_id"],898 "category_description" => $category["description"]895 'cat_name' => $category['name'], 896 'category_nicename' => $category['slug'], 897 'category_parent' => $category['parent_id'], 898 'category_description' => $category['description'] 899 899 ); 900 900 … … 904 904 return (int) $cat_id->get_error_data(); 905 905 else 906 return(new IXR_Error(500, __( "Sorry, the new category failed.")));906 return(new IXR_Error(500, __('Sorry, the new category failed.'))); 907 907 } elseif ( ! $cat_id ) { 908 return(new IXR_Error(500, __( "Sorry, the new category failed.")));908 return(new IXR_Error(500, __('Sorry, the new category failed.'))); 909 909 } 910 910 … … 933 933 do_action('xmlrpc_call', 'wp.deleteCategory'); 934 934 935 if ( !current_user_can( "manage_categories") )936 return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category.") );935 if ( !current_user_can('manage_categories') ) 936 return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) ); 937 937 938 938 return wp_delete_term( $category_id, 'category' ); … … 968 968 foreach ( (array) get_categories($args) as $cat ) { 969 969 $category_suggestions[] = array( 970 "category_id"=> $cat->term_id,971 "category_name"=> $cat->name970 'category_id' => $cat->term_id, 971 'category_name' => $cat->name 972 972 ); 973 973 } … … 1004 1004 1005 1005 // Format page date. 1006 $comment_date = mysql2date( "Ymd\TH:i:s", $comment->comment_date, false);1007 $comment_date_gmt = mysql2date( "Ymd\TH:i:s", $comment->comment_date_gmt, false);1006 $comment_date = mysql2date('Ymd\TH:i:s', $comment->comment_date, false); 1007 $comment_date_gmt = mysql2date('Ymd\TH:i:s', $comment->comment_date_gmt, false); 1008 1008 1009 1009 if ( '0' == $comment->comment_approved ) … … 1019 1019 1020 1020 $comment_struct = array( 1021 "date_created_gmt"=> new IXR_Date($comment_date_gmt),1022 "user_id"=> $comment->user_id,1023 "comment_id"=> $comment->comment_ID,1024 "parent"=> $comment->comment_parent,1025 "status"=> $comment_status,1026 "content"=> $comment->comment_content,1027 "link"=> $link,1028 "post_id"=> $comment->comment_post_ID,1029 "post_title"=> get_the_title($comment->comment_post_ID),1030 "author"=> $comment->comment_author,1031 "author_url"=> $comment->comment_author_url,1032 "author_email"=> $comment->comment_author_email,1033 "author_ip"=> $comment->comment_author_IP,1034 "type"=> $comment->comment_type,1021 'date_created_gmt' => new IXR_Date($comment_date_gmt), 1022 'user_id' => $comment->user_id, 1023 'comment_id' => $comment->comment_ID, 1024 'parent' => $comment->comment_parent, 1025 'status' => $comment_status, 1026 'content' => $comment->comment_content, 1027 'link' => $link, 1028 'post_id' => $comment->comment_post_ID, 1029 'post_title' => get_the_title($comment->comment_post_ID), 1030 'author' => $comment->comment_author, 1031 'author_url' => $comment->comment_author_url, 1032 'author_email' => $comment->comment_author_email, 1033 'author_ip' => $comment->comment_author_IP, 1034 'type' => $comment->comment_type, 1035 1035 ); 1036 1036 … … 1374 1374 $count = wp_count_comments( $post_id ); 1375 1375 return array( 1376 "approved"=> $count->approved,1377 "awaiting_moderation"=> $count->moderated,1378 "spam"=> $count->spam,1379 "total_comments"=> $count->total_comments1376 'approved' => $count->approved, 1377 'awaiting_moderation' => $count->moderated, 1378 'spam' => $count->spam, 1379 'total_comments' => $count->total_comments 1380 1380 ); 1381 1381 } … … 1587 1587 1588 1588 // Format page date. 1589 $attachment_date = mysql2date( "Ymd\TH:i:s", $attachment->post_date, false);1590 $attachment_date_gmt = mysql2date( "Ymd\TH:i:s", $attachment->post_date_gmt, false);1589 $attachment_date = mysql2date('Ymd\TH:i:s', $attachment->post_date, false); 1590 $attachment_date_gmt = mysql2date('Ymd\TH:i:s', $attachment->post_date_gmt, false); 1591 1591 1592 1592 $link = wp_get_attachment_url($attachment->ID); … … 1594 1594 1595 1595 $attachment_struct = array( 1596 "date_created_gmt"=> new IXR_Date($attachment_date_gmt),1597 "parent"=> $attachment->post_parent,1598 "link"=> $link,1599 "thumbnail"=> $thumbnail_link,1600 "title"=> $attachment->post_title,1601 "caption"=> $attachment->post_excerpt,1602 "description"=> $attachment->post_content,1603 "metadata"=> wp_get_attachment_metadata($attachment->ID),1596 'date_created_gmt' => new IXR_Date($attachment_date_gmt), 1597 'parent' => $attachment->post_parent, 1598 'link' => $link, 1599 'thumbnail' => $thumbnail_link, 1600 'title' => $attachment->post_title, 1601 'caption' => $attachment->post_excerpt, 1602 'description' => $attachment->post_content, 1603 'metadata' => wp_get_attachment_metadata($attachment->ID), 1604 1604 ); 1605 1605 … … 2244 2244 // one has been provided. 2245 2245 $post_name = ""; 2246 if ( isset($content_struct[ "wp_slug"]) )2247 $post_name = $content_struct[ "wp_slug"];2246 if ( isset($content_struct['wp_slug']) ) 2247 $post_name = $content_struct['wp_slug']; 2248 2248 2249 2249 // Only use a password if one was given. 2250 if ( isset($content_struct[ "wp_password"]) )2251 $post_password = $content_struct[ "wp_password"];2250 if ( isset($content_struct['wp_password']) ) 2251 $post_password = $content_struct['wp_password']; 2252 2252 2253 2253 // Only set a post parent if one was provided. 2254 if ( isset($content_struct[ "wp_page_parent_id"]) )2255 $post_parent = $content_struct[ "wp_page_parent_id"];2254 if ( isset($content_struct['wp_page_parent_id']) ) 2255 $post_parent = $content_struct['wp_page_parent_id']; 2256 2256 2257 2257 // Only set the menu_order if it was provided. 2258 if ( isset($content_struct[ "wp_page_order"]) )2259 $menu_order = $content_struct[ "wp_page_order"];2258 if ( isset($content_struct['wp_page_order']) ) 2259 $menu_order = $content_struct['wp_page_order']; 2260 2260 2261 2261 $post_author = $user->ID; 2262 2262 2263 2263 // If an author id was provided then use it instead. 2264 if ( isset($content_struct[ "wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {2264 if ( isset($content_struct['wp_author_id']) && ($user->ID != $content_struct['wp_author_id']) ) { 2265 2265 switch ( $post_type ) { 2266 2266 case "post": 2267 if ( !current_user_can( "edit_others_posts") )2268 return(new IXR_Error(401, __( "You are not allowed to post as this user")));2267 if ( !current_user_can('edit_others_posts') ) 2268 return(new IXR_Error(401, __('You are not allowed to post as this user'))); 2269 2269 break; 2270 2270 case "page": 2271 if ( !current_user_can( "edit_others_pages") )2272 return(new IXR_Error(401, __( "You are not allowed to create pages as this user")));2271 if ( !current_user_can('edit_others_pages') ) 2272 return(new IXR_Error(401, __('You are not allowed to create pages as this user'))); 2273 2273 break; 2274 2274 default: 2275 return(new IXR_Error(401, __( "Invalid post type.")));2275 return(new IXR_Error(401, __('Invalid post type.'))); 2276 2276 break; 2277 2277 } 2278 $post_author = $content_struct[ "wp_author_id"];2278 $post_author = $content_struct['wp_author_id']; 2279 2279 } 2280 2280 … … 2303 2303 $tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null; 2304 2304 2305 if ( isset($content_struct[ "mt_allow_comments"]) ) {2306 if ( !is_numeric($content_struct[ "mt_allow_comments"]) ) {2307 switch ( $content_struct[ "mt_allow_comments"] ) {2308 case "closed":2309 $comment_status = "closed";2305 if ( isset($content_struct['mt_allow_comments']) ) { 2306 if ( !is_numeric($content_struct['mt_allow_comments']) ) { 2307 switch ( $content_struct['mt_allow_comments'] ) { 2308 case 'closed': 2309 $comment_status = 'closed'; 2310 2310 break; 2311 case "open":2312 $comment_status = "open";2311 case 'open': 2312 $comment_status = 'open'; 2313 2313 break; 2314 2314 default: 2315 $comment_status = get_option( "default_comment_status");2315 $comment_status = get_option('default_comment_status'); 2316 2316 break; 2317 2317 } 2318 2318 } else { 2319 switch ( (int) $content_struct[ "mt_allow_comments"] ) {2319 switch ( (int) $content_struct['mt_allow_comments'] ) { 2320 2320 case 0: 2321 2321 case 2: 2322 $comment_status = "closed";2322 $comment_status = 'closed'; 2323 2323 break; 2324 2324 case 1: 2325 $comment_status = "open";2325 $comment_status = 'open'; 2326 2326 break; 2327 2327 default: 2328 $comment_status = get_option( "default_comment_status");2328 $comment_status = get_option('default_comment_status'); 2329 2329 break; 2330 2330 } 2331 2331 } 2332 2332 } else { 2333 $comment_status = get_option( "default_comment_status");2334 } 2335 2336 if ( isset($content_struct[ "mt_allow_pings"]) ) {2337 if ( !is_numeric($content_struct[ "mt_allow_pings"]) ) {2333 $comment_status = get_option('default_comment_status'); 2334 } 2335 2336 if ( isset($content_struct['mt_allow_pings']) ) { 2337 if ( !is_numeric($content_struct['mt_allow_pings']) ) { 2338 2338 switch ( $content_struct['mt_allow_pings'] ) { 2339 case "closed":2340 $ping_status = "closed";2339 case 'closed': 2340 $ping_status = 'closed'; 2341 2341 break; 2342 case "open":2343 $ping_status = "open";2342 case 'open': 2343 $ping_status = 'open'; 2344 2344 break; 2345 2345 default: 2346 $ping_status = get_option( "default_ping_status");2346 $ping_status = get_option('default_ping_status'); 2347 2347 break; 2348 2348 } 2349 2349 } else { 2350 switch ( (int) $content_struct[ "mt_allow_pings"] ) {2350 switch ( (int) $content_struct['mt_allow_pings'] ) { 2351 2351 case 0: 2352 $ping_status = "closed";2352 $ping_status = 'closed'; 2353 2353 break; 2354 2354 case 1: 2355 $ping_status = "open";2355 $ping_status = 'open'; 2356 2356 break; 2357 2357 default: 2358 $ping_status = get_option( "default_ping_status");2358 $ping_status = get_option('default_ping_status'); 2359 2359 break; 2360 2360 } 2361 2361 } 2362 2362 } else { 2363 $ping_status = get_option( "default_ping_status");2363 $ping_status = get_option('default_ping_status'); 2364 2364 } 2365 2365 2366 2366 if ( $post_more ) 2367 $post_content = $post_content . "<!--more-->". $post_more;2367 $post_content = $post_content . '<!--more-->' . $post_more; 2368 2368 2369 2369 $to_ping = null; … … 2552 2552 // created (which was the old behavior). 2553 2553 if ( empty($postdata["ID"]) ) 2554 return(new IXR_Error(404, __( "Invalid post ID.")));2554 return(new IXR_Error(404, __('Invalid post ID.'))); 2555 2555 2556 2556 $this->escape($postdata); … … 2560 2560 $post_name = ""; 2561 2561 $post_name = $postdata['post_name']; 2562 if ( isset($content_struct[ "wp_slug"]) )2563 $post_name = $content_struct[ "wp_slug"];2562 if ( isset($content_struct['wp_slug']) ) 2563 $post_name = $content_struct['wp_slug']; 2564 2564 2565 2565 // Only use a password if one was given. 2566 if ( isset($content_struct[ "wp_password"]) )2567 $post_password = $content_struct[ "wp_password"];2566 if ( isset($content_struct['wp_password']) ) 2567 $post_password = $content_struct['wp_password']; 2568 2568 2569 2569 // Only set a post parent if one was given. 2570 if ( isset($content_struct[ "wp_page_parent_id"]) )2571 $post_parent = $content_struct[ "wp_page_parent_id"];2570 if ( isset($content_struct['wp_page_parent_id']) ) 2571 $post_parent = $content_struct['wp_page_parent_id']; 2572 2572 2573 2573 // Only set the menu_order if it was given. 2574 if ( isset($content_struct[ "wp_page_order"]) )2575 $menu_order = $content_struct[ "wp_page_order"];2576 2577 $post_author = $postdata[ "post_author"];2574 if ( isset($content_struct['wp_page_order']) ) 2575 $menu_order = $content_struct['wp_page_order']; 2576 2577 $post_author = $postdata['post_author']; 2578 2578 2579 2579 // Only set the post_author if one is set. 2580 if ( isset($content_struct[ "wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {2580 if ( isset($content_struct['wp_author_id']) && ($user->ID != $content_struct['wp_author_id']) ) { 2581 2581 switch ( $post_type ) { 2582 case "post":2583 if ( !current_user_can( "edit_others_posts") )2584 return(new IXR_Error(401, __( "You are not allowed to change the post author as this user.")));2582 case 'post': 2583 if ( !current_user_can('edit_others_posts') ) 2584 return(new IXR_Error(401, __('You are not allowed to change the post author as this user.'))); 2585 2585 break; 2586 case "page":2587 if ( !current_user_can( "edit_others_pages") )2588 return(new IXR_Error(401, __( "You are not allowed to change the page author as this user.")));2586 case 'page': 2587 if ( !current_user_can('edit_others_pages') ) 2588 return(new IXR_Error(401, __('You are not allowed to change the page author as this user.'))); 2589 2589 break; 2590 2590 default: 2591 return(new IXR_Error(401, __( "Invalid post type.")));2591 return(new IXR_Error(401, __('Invalid post type.'))); 2592 2592 break; 2593 2593 } 2594 $post_author = $content_struct[ "wp_author_id"];2595 } 2596 2597 if ( isset($content_struct[ "mt_allow_comments"]) ) {2598 if ( !is_numeric($content_struct[ "mt_allow_comments"]) ) {2599 switch ( $content_struct[ "mt_allow_comments"] ) {2600 case "closed":2601 $comment_status = "closed";2594 $post_author = $content_struct['wp_author_id']; 2595 } 2596 2597 if ( isset($content_struct['mt_allow_comments']) ) { 2598 if ( !is_numeric($content_struct['mt_allow_comments']) ) { 2599 switch ( $content_struct['mt_allow_comments'] ) { 2600 case 'closed': 2601 $comment_status = 'closed'; 2602 2602 break; 2603 case "open":2604 $comment_status = "open";2603 case 'open': 2604 $comment_status = 'open'; 2605 2605 break; 2606 2606 default: 2607 $comment_status = get_option( "default_comment_status");2607 $comment_status = get_option('default_comment_status'); 2608 2608 break; 2609 2609 } 2610 2610 } else { 2611 switch ( (int) $content_struct[ "mt_allow_comments"] ) {2611 switch ( (int) $content_struct['mt_allow_comments'] ) { 2612 2612 case 0: 2613 2613 case 2: 2614 $comment_status = "closed";2614 $comment_status = 'closed'; 2615 2615 break; 2616 2616 case 1: 2617 $comment_status = "open";2617 $comment_status = 'open'; 2618 2618 break; 2619 2619 default: 2620 $comment_status = get_option( "default_comment_status");2620 $comment_status = get_option('default_comment_status'); 2621 2621 break; 2622 2622 } … … 2624 2624 } 2625 2625 2626 if ( isset($content_struct[ "mt_allow_pings"]) ) {2627 if ( !is_numeric($content_struct[ "mt_allow_pings"]) ) {2628 switch ( $content_struct[ "mt_allow_pings"] ) {2629 case "closed":2630 $ping_status = "closed";2626 if ( isset($content_struct['mt_allow_pings']) ) { 2627 if ( !is_numeric($content_struct['mt_allow_pings']) ) { 2628 switch ( $content_struct['mt_allow_pings'] ) { 2629 case 'closed': 2630 $ping_status = 'closed'; 2631 2631 break; 2632 case "open":2633 $ping_status = "open";2632 case 'open': 2633 $ping_status = 'open'; 2634 2634 break; 2635 2635 default: 2636 $ping_status = get_option( "default_ping_status");2636 $ping_status = get_option('default_ping_status'); 2637 2637 break; 2638 2638 } … … 2640 2640 switch ( (int) $content_struct["mt_allow_pings"] ) { 2641 2641 case 0: 2642 $ping_status = "closed";2642 $ping_status = 'closed'; 2643 2643 break; 2644 2644 case 1: 2645 $ping_status = "open";2645 $ping_status = 'open'; 2646 2646 break; 2647 2647 default: 2648 $ping_status = get_option( "default_ping_status");2648 $ping_status = get_option('default_ping_status'); 2649 2649 break; 2650 2650 } … … 3063 3063 } 3064 3064 3065 if ( $upload_err = apply_filters( "pre_upload_error", false ) )3065 if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) 3066 3066 return new IXR_Error(500, $upload_err); 3067 3067 3068 if ( !empty($data[ "overwrite"]) && ($data["overwrite"] == true) ) {3068 if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) { 3069 3069 // Get postmeta info on the object. 3070 3070 $old_file = $wpdb->get_row(" … … 3080 3080 // Make sure the new name is different by pre-pending the 3081 3081 // previous post id. 3082 $filename = preg_replace( "/^wpid\d+-/", "", $name);3082 $filename = preg_replace('/^wpid\d+-/', '', $name); 3083 3083 $name = "wpid{$old_file->ID}-{$filename}"; 3084 3084 }
Note: See TracChangeset
for help on using the changeset viewer.