Changeset 967

Show
Ignore:
Timestamp:
04/17/07 16:27:48 (2 years ago)
Author:
donncha
Message:

WP Merge, gettext updates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/xmlrpc.php

    r934 r967  
    141141        function login_pass_ok($user_login, $user_pass) { 
    142142                if (!user_pass_ok($user_login, $user_pass)) { 
    143                         $this->error = new IXR_Error(403, 'Bad login/pass combination.'); 
     143                        $this->error = new IXR_Error(403, __('Bad login/pass combination.')); 
    144144                        return false; 
    145145                } 
     
    242242                // If the page doesn't exist indicate that. 
    243243                else { 
    244                         return(new IXR_Error(404, "Sorry, no such page.")); 
     244                        return(new IXR_Error(404, __("Sorry, no such page."))); 
    245245                } 
    246246        } 
     
    303303                $user = set_current_user(0, $username); 
    304304                if(!current_user_can("publish_pages")) { 
    305                         return(new IXR_Error(401, "Sorry, you can not add new pages.")); 
     305                        return(new IXR_Error(401, __("Sorry, you can not add new pages."))); 
    306306                } 
    307307 
     
    336336                        || ($actual_page["post_type"] != "page") 
    337337                ) { 
    338                         return(new IXR_Error(404, "Sorry, no such page.")); 
     338                        return(new IXR_Error(404, __("Sorry, no such page."))); 
    339339                } 
    340340 
     
    342342                set_current_user(0, $username); 
    343343                if(!current_user_can("delete_page", $page_id)) { 
    344                         return(new IXR_Error(401, "Sorry, you do not have the right to delete this page.")); 
     344                        return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page."))); 
    345345                } 
    346346 
     
    348348                $result = wp_delete_post($page_id); 
    349349                if(!$result) { 
    350                         return(new IXR_Error(500, "Failed to delete the page.")); 
     350                        return(new IXR_Error(500, __("Failed to delete the page."))); 
    351351                } 
    352352 
     
    361361                // Items not escaped here will be escaped in editPost. 
    362362                $blog_id        = (int) $args[0]; 
    363                 $page_id        = $this->escape((int) $args[1]); 
     363                $page_id        = (int) $this->escape($args[1]); 
    364364                $username       = $this->escape($args[2]); 
    365365                $password       = $this->escape($args[3]); 
     
    377377                        || ($actual_page["post_type"] != "page") 
    378378                ) { 
    379                         return(new IXR_Error(404, "Sorry, no such page.")); 
     379                        return(new IXR_Error(404, __("Sorry, no such page."))); 
    380380                } 
    381381 
     
    383383                set_current_user(0, $username); 
    384384                if(!current_user_can("edit_page", $page_id)) { 
    385                         return(new IXR_Error(401, "Sorry, you do not have the right to edit this page.")); 
     385                        return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page."))); 
    386386                } 
    387387 
     
    482482                set_current_user(0, $username); 
    483483                if(!current_user_can("manage_categories", $page_id)) { 
    484                         return(new IXR_Error(401, "Sorry, you do not have the right to add a category.")); 
     484                        return(new IXR_Error(401, __("Sorry, you do not have the right to add a category."))); 
    485485                } 
    486486 
     
    514514                $cat_id = wp_insert_category($new_category); 
    515515                if(!$cat_id) { 
    516                         return(new IXR_Error(500, "Sorry, the new category failed.")); 
     516                        return(new IXR_Error(500, __("Sorry, the new category failed."))); 
    517517                } 
    518518 
     
    677677 
    678678                if (!$posts_list) { 
    679                         $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); 
     679                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 
    680680                        return $this->error; 
    681681                } 
     
    724724          set_current_user(0, $user_login); 
    725725          if ( !current_user_can('edit_themes') ) { 
    726             return new IXR_Error(401, 'Sorry, this user can not edit the template.'); 
     726            return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 
    727727          } 
    728728 
     
    759759          set_current_user(0, $user_login); 
    760760          if ( !current_user_can('edit_themes') ) { 
    761             return new IXR_Error(401, 'Sorry, this user can not edit the template.'); 
     761            return new IXR_Error(401, __('Sorry, this user can not edit the template.')); 
    762762          } 
    763763 
     
    770770            fclose($f); 
    771771          } else { 
    772             return new IXR_Error(500, 'Either the file is not writable, or something wrong happened. The file has not been updated.'); 
     772            return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.')); 
    773773          } 
    774774 
     
    797797          $user = set_current_user(0, $user_login); 
    798798          if ( !current_user_can($cap) ) 
    799             return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.'); 
     799            return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 
    800800 
    801801          $post_status = ($publish) ? 'publish' : 'draft'; 
     
    815815 
    816816          if (!$post_ID) { 
    817             return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.'); 
     817            return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 
    818818          } 
    819819          $this->attach_uploads( $post_ID, $post_content ); 
     
    845845 
    846846          if (!$actual_post) { 
    847                 return new IXR_Error(404, 'Sorry, no such post.'); 
     847                return new IXR_Error(404, __('Sorry, no such post.')); 
    848848          } 
    849849 
     
    852852          set_current_user(0, $user_login); 
    853853          if ( !current_user_can('edit_post', $post_ID) ) 
    854             return new IXR_Error(401, 'Sorry, you do not have the right to edit this post.'); 
     854            return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.')); 
    855855 
    856856          extract($actual_post); 
    857857 
    858858          if ( ('publish' == $post_status) && !current_user_can('publish_posts') ) 
    859                 return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.'); 
     859                return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 
    860860 
    861861          $post_title = xmlrpc_getposttitle($content); 
     
    868868 
    869869          if (!$result) { 
    870                 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be edited.'); 
     870                return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.')); 
    871871          } 
    872872          $this->attach_uploads( $ID, $post_content ); 
     
    895895 
    896896          if (!$actual_post) { 
    897                 return new IXR_Error(404, 'Sorry, no such post.'); 
     897                return new IXR_Error(404, __('Sorry, no such post.')); 
    898898          } 
    899899 
    900900          set_current_user(0, $user_login); 
    901901          if ( !current_user_can('edit_post', $post_ID) ) 
    902             return new IXR_Error(401, 'Sorry, you do not have the right to delete this post.'); 
     902            return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.')); 
    903903 
    904904          $result = wp_delete_post($post_ID); 
    905905 
    906906          if (!$result) { 
    907                 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be deleted.'); 
     907                return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.')); 
    908908          } 
    909909 
     
    936936          $user = set_current_user(0, $user_login); 
    937937          if ( !current_user_can('publish_posts') ) 
    938             return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.'); 
     938            return new IXR_Error(401, __('Sorry, you can not post on this weblog or category.')); 
    939939 
    940940                // The post_type defaults to post, but could also be page. 
     
    987987                                        break; 
    988988                                default: 
    989                                         return(new IXR_Error(401, "Invalid post type.")); 
     989                                        return(new IXR_Error(401, __("Invalid post type."))); 
    990990                                        break; 
    991991                        } 
     
    10431043 
    10441044          if (!$post_ID) { 
    1045             return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.'); 
     1045            return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.')); 
    10461046          } 
    10471047 
     
    10971097          // Edit page caps are checked in editPage.  Just check post here. 
    10981098          if ( ( 'post' == $post_type ) && !current_user_can('edit_post', $post_ID) ) 
    1099             return new IXR_Error(401, 'Sorry, you can not edit this post.'); 
     1099            return new IXR_Error(401, __('Sorry, you can not edit this post.')); 
    11001100 
    11011101          $postdata = wp_get_single_post($post_ID, ARRAY_A); 
     
    11051105                // created (which was the old behavior). 
    11061106                if(empty($postdata["ID"])) { 
    1107                         return(new IXR_Error(404, "Invalid post id.")); 
     1107                        return(new IXR_Error(404, __("Invalid post id."))); 
    11081108                } 
    11091109 
     
    11481148                                        break; 
    11491149                                default: 
    1150                                         return(new IXR_Error(401, "Invalid post type.")); 
     1150                                        return(new IXR_Error(401, __("Invalid post type."))); 
    11511151                                        break; 
    11521152                        } 
     
    11841184          if ( ('publish' == $post_status) ) { 
    11851185                if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') ) 
    1186                         return new IXR_Error(401, 'Sorry, you do not have the right to publish this page.'); 
     1186                        return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.')); 
    11871187                else if ( !current_user_can('publish_posts') ) 
    1188                         return new IXR_Error(401, 'Sorry, you do not have the right to publish this post.'); 
     1188                        return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.')); 
    11891189          } 
    11901190 
     
    12171217          $result = wp_update_post($newpost); 
    12181218          if (!$result) { 
    1219             return new IXR_Error(500, 'Sorry, your entry could not be edited. Something wrong happened.'); 
     1219            return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.')); 
    12201220          } 
    12211221          $this->attach_uploads( $ID, $post_content ); 
     
    12861286            return $resp; 
    12871287          } else { 
    1288                 return new IXR_Error(404, 'Sorry, no such post.'); 
     1288                return new IXR_Error(404, __('Sorry, no such post.')); 
    12891289          } 
    12901290        } 
     
    13081308 
    13091309                if (!$posts_list) { 
    1310                         $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); 
     1310                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 
    13111311                        return $this->error; 
    13121312                } 
     
    14391439                if ( !current_user_can('upload_files') ) { 
    14401440                        logIO('O', '(MW) User does not have upload_files capability'); 
    1441                         $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.'); 
     1441                        $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.')); 
    14421442                        return $this->error; 
    14431443                } 
     
    14931493 
    14941494                if (!$posts_list) { 
    1495                         $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.'); 
     1495                        $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.')); 
    14961496                        return $this->error; 
    14971497                } 
     
    15961596                set_current_user(0, $user_login); 
    15971597                if ( !current_user_can('edit_post', $post_ID) ) 
    1598                         return new IXR_Error(401, 'Sorry, you can not edit this post.'); 
     1598                        return new IXR_Error(401, __('Sorry, you can not edit this post.')); 
    15991599 
    16001600                foreach($categories as $cat) { 
     
    16371637 
    16381638                if (!$actual_post) { 
    1639                         return new IXR_Error(404, 'Sorry, no such post.'); 
     1639                        return new IXR_Error(404, __('Sorry, no such post.')); 
    16401640                } 
    16411641 
     
    16781678                set_current_user(0, $user_login); 
    16791679                if ( !current_user_can('edit_post', $post_ID) ) 
    1680                         return new IXR_Error(401, 'Sorry, you can not edit this post.'); 
     1680                        return new IXR_Error(401, __('Sorry, you can not edit this post.')); 
    16811681 
    16821682                $postdata = wp_get_single_post($post_ID,ARRAY_A); 
     
    17191719                $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); 
    17201720                if( !$pos1 ) 
    1721                                 return new IXR_Error(0, 'Is there no link to us?'); 
     1721                                return new IXR_Error(0, __('Is there no link to us?')); 
    17221722 
    17231723                // let's find which post is linked to 
     
    17721772 
    17731773                if ( $post_ID == url_to_postid($pagelinkedfrom) ) 
    1774                         return new IXR_Error(0, 'The source URL and the target URL cannot both point to the same resource.'); 
     1774                        return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.')); 
    17751775 
    17761776                // Check if pings are on 
     
    17821782 
    17831783                if ( $wpdb->num_rows ) // We already have a Pingback from this URL 
    1784                         return new IXR_Error(48, 'The pingback has already been registered.'); 
     1784                        return new IXR_Error(48, __('The pingback has already been registered.')); 
    17851785 
    17861786                // very stupid, but gives time to the 'from' server to publish ! 
     
    17901790                $linea = wp_remote_fopen( $pagelinkedfrom ); 
    17911791                if ( !$linea ) 
    1792                         return new IXR_Error(16, 'The source URL does not exist.'); 
     1792                        return new IXR_Error(16, __('The source URL does not exist.')); 
    17931793 
    17941794                // Work around bug in strip_tags(): 
     
    18001800                $title = $matchtitle[1]; 
    18011801                if ( empty( $title ) ) 
    1802                         return new IXR_Error(32, 'We cannot find a title on that page.'); 
     1802                        return new IXR_Error(32, __('We cannot find a title on that page.')); 
    18031803 
    18041804                $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need 
     
    18361836 
    18371837                if ( empty($context) ) // Link to target not found 
    1838                         return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.'); 
     1838                        return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.')); 
    18391839 
    18401840                $pagelinkedfrom = preg_replace('#&([^amp\;])#is', '&amp;$1', $pagelinkedfrom); 
     
    18831883                if (!$actual_post) { 
    18841884                        // No such post = resource not found 
    1885                         return new IXR_Error(32, 'The specified target URL does not exist.'); 
     1885                        return new IXR_Error(32, __('The specified target URL does not exist.')); 
    18861886                } 
    18871887