/var/www/wordpress/wp-admin/includes/admin.php
/var/www/wordpress/wp-admin/includes/bookmark.php
/var/www/wordpress/wp-admin/includes/class-ftp-pure.php
/var/www/wordpress/wp-admin/includes/class-ftp-sockets.php
/var/www/wordpress/wp-admin/includes/class-ftp.php
/var/www/wordpress/wp-admin/includes/class-pclzip.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-base.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-direct.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
/var/www/wordpress/wp-admin/includes/class-wp-importer.php
/var/www/wordpress/wp-admin/includes/class-wp-upgrader.php
/var/www/wordpress/wp-admin/includes/comment.php
/var/www/wordpress/wp-admin/includes/continents-cities.php
/var/www/wordpress/wp-admin/includes/dashboard.php
/var/www/wordpress/wp-admin/includes/deprecated.php
/var/www/wordpress/wp-admin/includes/export.php
/var/www/wordpress/wp-admin/includes/file.php
/var/www/wordpress/wp-admin/includes/image-edit.php
/var/www/wordpress/wp-admin/includes/image.php
/var/www/wordpress/wp-admin/includes/import.php
/var/www/wordpress/wp-admin/includes/manifest.php
/var/www/wordpress/wp-admin/includes/media.php
/var/www/wordpress/wp-admin/includes/meta-boxes.php
/var/www/wordpress/wp-admin/includes/misc.php
/var/www/wordpress/wp-admin/includes/ms-deprecated.php
/var/www/wordpress/wp-admin/includes/ms.php
/var/www/wordpress/wp-admin/includes/nav-menu.php
/var/www/wordpress/wp-admin/includes/plugin-install.php
/var/www/wordpress/wp-admin/includes/plugin.php
/var/www/wordpress/wp-admin/includes/post.php
/var/www/wordpress/wp-admin/includes/schema.php
/var/www/wordpress/wp-admin/includes/taxonomy.php
/var/www/wordpress/wp-admin/includes/template.php
/var/www/wordpress/wp-admin/includes/theme-install.php
/var/www/wordpress/wp-admin/includes/theme.php
/var/www/wordpress/wp-admin/includes/update-core.php
/var/www/wordpress/wp-admin/includes/update.php
/var/www/wordpress/wp-admin/includes/upgrade.php
/var/www/wordpress/wp-admin/includes/user.php
/var/www/wordpress/wp-admin/includes/widgets.php
/var/www/wordpress/wp-admin/js/revisions-js.php
/var/www/wordpress/wp-admin/maint/repair.php
/var/www/wordpress/wp-admin/admin-ajax.php
/var/www/wordpress/wp-admin/admin-footer.php
/var/www/wordpress/wp-admin/admin-functions.php
/var/www/wordpress/wp-admin/admin-header.php
/var/www/wordpress/wp-admin/admin-post.php
/var/www/wordpress/wp-admin/admin.php
/var/www/wordpress/wp-admin/async-upload.php
/var/www/wordpress/wp-admin/comment.php
/var/www/wordpress/wp-admin/custom-background.php
/var/www/wordpress/wp-admin/custom-header.php
/var/www/wordpress/wp-admin/edit-attachment-rows.php
/var/www/wordpress/wp-admin/edit-comments.php
/var/www/wordpress/wp-admin/edit-form-advanced.php
/var/www/wordpress/wp-admin/edit-form-comment.php
/var/www/wordpress/wp-admin/edit-link-categories.php
/var/www/wordpress/wp-admin/edit-link-category-form.php
/var/www/wordpress/wp-admin/edit-link-form.php
/var/www/wordpress/wp-admin/edit-post-rows.php
/var/www/wordpress/wp-admin/edit-tag-form.php
/var/www/wordpress/wp-admin/edit-tags.php
/var/www/wordpress/wp-admin/edit.php
/var/www/wordpress/wp-admin/export.php
/var/www/wordpress/wp-admin/gears-manifest.php
/var/www/wordpress/wp-admin/import.php
/var/www/wordpress/wp-admin/index-extra.php
/var/www/wordpress/wp-admin/index.php
/var/www/wordpress/wp-admin/install-helper.php
/var/www/wordpress/wp-admin/install.php
/var/www/wordpress/wp-admin/link-add.php
/var/www/wordpress/wp-admin/link-category.php
/var/www/wordpress/wp-admin/link-manager.php
/var/www/wordpress/wp-admin/link-parse-opml.php
/var/www/wordpress/wp-admin/link.php
/var/www/wordpress/wp-admin/load-scripts.php
/var/www/wordpress/wp-admin/load-styles.php
/var/www/wordpress/wp-admin/media-new.php
/var/www/wordpress/wp-admin/media-upload.php
/var/www/wordpress/wp-admin/media.php
/var/www/wordpress/wp-admin/menu-header.php
/var/www/wordpress/wp-admin/menu.php
/var/www/wordpress/wp-admin/moderation.php
/var/www/wordpress/wp-admin/ms-admin.php
/var/www/wordpress/wp-admin/ms-delete-site.php
/var/www/wordpress/wp-admin/ms-edit.php
/var/www/wordpress/wp-admin/ms-options.php
/var/www/wordpress/wp-admin/ms-sites.php
/var/www/wordpress/wp-admin/ms-themes.php
/var/www/wordpress/wp-admin/ms-upgrade-network.php
/var/www/wordpress/wp-admin/ms-users.php
/var/www/wordpress/wp-admin/my-sites.php
/var/www/wordpress/wp-admin/nav-menus.php
/var/www/wordpress/wp-admin/network.php
/var/www/wordpress/wp-admin/options-discussion.php
/var/www/wordpress/wp-admin/options-general.php
/var/www/wordpress/wp-admin/options-head.php
/var/www/wordpress/wp-admin/options-media.php
/var/www/wordpress/wp-admin/options-permalink.php
/var/www/wordpress/wp-admin/options-privacy.php
/var/www/wordpress/wp-admin/options-reading.php
/var/www/wordpress/wp-admin/options-writing.php
/var/www/wordpress/wp-admin/options.php
/var/www/wordpress/wp-admin/plugin-editor.php
/var/www/wordpress/wp-admin/plugin-install.php
/var/www/wordpress/wp-admin/plugins.php
/var/www/wordpress/wp-admin/post-new.php
/var/www/wordpress/wp-admin/post.php
/var/www/wordpress/wp-admin/press-this.php
/var/www/wordpress/wp-admin/profile.php
/var/www/wordpress/wp-admin/revision.php
/var/www/wordpress/wp-admin/setup-config.php
/var/www/wordpress/wp-admin/sidebar.php
/var/www/wordpress/wp-admin/theme-editor.php
/var/www/wordpress/wp-admin/theme-install.php
/var/www/wordpress/wp-admin/themes.php
/var/www/wordpress/wp-admin/tools.php
/var/www/wordpress/wp-admin/update-core.php
/var/www/wordpress/wp-admin/update.php
/var/www/wordpress/wp-admin/upgrade-functions.php
/var/www/wordpress/wp-admin/upgrade.php
/var/www/wordpress/wp-admin/upload.php
/var/www/wordpress/wp-admin/user-edit.php
/var/www/wordpress/wp-admin/user-new.php
/var/www/wordpress/wp-admin/users.php
/var/www/wordpress/wp-admin/widgets.php
/var/www/wordpress/wp-content/languages/ru_RU.php
/var/www/wordpress/wp-content/plugins/akismet/akismet.php
/var/www/wordpress/wp-content/plugins/rh/rh.php
/var/www/wordpress/wp-content/plugins/hello.php
/var/www/wordpress/wp-content/plugins/index.php
/var/www/wordpress/wp-content/themes/twentyten/404.php
/var/www/wordpress/wp-content/themes/twentyten/archive.php
/var/www/wordpress/wp-content/themes/twentyten/attachment.php
/var/www/wordpress/wp-content/themes/twentyten/author.php
/var/www/wordpress/wp-content/themes/twentyten/category.php
/var/www/wordpress/wp-content/themes/twentyten/comments.php
/var/www/wordpress/wp-content/themes/twentyten/footer.php
/var/www/wordpress/wp-content/themes/twentyten/functions.php
/var/www/wordpress/wp-content/themes/twentyten/header.php
/var/www/wordpress/wp-content/themes/twentyten/index.php
/var/www/wordpress/wp-content/themes/twentyten/loop.php
/var/www/wordpress/wp-content/themes/twentyten/onecolumn-page.php
/var/www/wordpress/wp-content/themes/twentyten/page.php
/var/www/wordpress/wp-content/themes/twentyten/search.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar-footer.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar.php
/var/www/wordpress/wp-content/themes/twentyten/single.php
/var/www/wordpress/wp-content/themes/twentyten/tag.php
/var/www/wordpress/wp-content/themes/index.php
/var/www/wordpress/wp-content/index.php
/var/www/wordpress/wp-includes/js/tinymce/langs/wp-langs.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/config.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
/var/www/wordpress/wp-includes/js/tinymce/wp-mce-help.php
/var/www/wordpress/wp-includes/js/tinymce/wp-tinymce.php
/var/www/wordpress/wp-includes/pomo/entry.php
/var/www/wordpress/wp-includes/pomo/mo.php
/var/www/wordpress/wp-includes/pomo/po.php
/var/www/wordpress/wp-includes/pomo/streams.php
/var/www/wordpress/wp-includes/pomo/translations.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/native.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/shell.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/string.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/xdiff.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer/inline.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer.php
/var/www/wordpress/wp-includes/Text/Diff.php
/var/www/wordpress/wp-includes/theme-compat/comments-popup.php
/var/www/wordpress/wp-includes/theme-compat/comments.php
/var/www/wordpress/wp-includes/theme-compat/footer.php
/var/www/wordpress/wp-includes/theme-compat/header.php
/var/www/wordpress/wp-includes/theme-compat/sidebar.php
/var/www/wordpress/wp-includes/atomlib.php
/var/www/wordpress/wp-includes/author-template.php
/var/www/wordpress/wp-includes/bookmark-template.php
/var/www/wordpress/wp-includes/bookmark.php
/var/www/wordpress/wp-includes/cache.php
/var/www/wordpress/wp-includes/canonical.php
/var/www/wordpress/wp-includes/capabilities.php
/var/www/wordpress/wp-includes/category-template.php
/var/www/wordpress/wp-includes/category.php
/var/www/wordpress/wp-includes/class-feed.php
/var/www/wordpress/wp-includes/class-http.php
/var/www/wordpress/wp-includes/class-IXR.php
/var/www/wordpress/wp-includes/class-json.php
/var/www/wordpress/wp-includes/class-oembed.php
/var/www/wordpress/wp-includes/class-phpass.php
/var/www/wordpress/wp-includes/class-phpmailer.php
/var/www/wordpress/wp-includes/class-pop3.php
/var/www/wordpress/wp-includes/class-simplepie.php
/var/www/wordpress/wp-includes/class-smtp.php
/var/www/wordpress/wp-includes/class-snoopy.php
/var/www/wordpress/wp-includes/class.wp-dependencies.php
/var/www/wordpress/wp-includes/class.wp-scripts.php
/var/www/wordpress/wp-includes/class.wp-styles.php
/var/www/wordpress/wp-includes/classes.php
/var/www/wordpress/wp-includes/comment-template.php
/var/www/wordpress/wp-includes/comment.php
/var/www/wordpress/wp-includes/compat.php
/var/www/wordpress/wp-includes/cron.php
/var/www/wordpress/wp-includes/default-constants.php
/var/www/wordpress/wp-includes/default-embeds.php
/var/www/wordpress/wp-includes/default-filters.php
/var/www/wordpress/wp-includes/default-widgets.php
/var/www/wordpress/wp-includes/deprecated.php
/var/www/wordpress/wp-includes/feed-atom-comments.php
/var/www/wordpress/wp-includes/feed-atom.php
/var/www/wordpress/wp-includes/feed-rdf.php
/var/www/wordpress/wp-includes/feed-rss.php
/var/www/wordpress/wp-includes/feed-rss2-comments.php
/var/www/wordpress/wp-includes/feed-rss2.php
/var/www/wordpress/wp-includes/feed.php
/var/www/wordpress/wp-includes/formatting.php
/var/www/wordpress/wp-includes/functions.php
/var/www/wordpress/wp-includes/functions.wp-scripts.php
/var/www/wordpress/wp-includes/functions.wp-styles.php
/var/www/wordpress/wp-includes/general-template.php
/var/www/wordpress/wp-includes/http.php
/var/www/wordpress/wp-includes/kses.php
/var/www/wordpress/wp-includes/l10n.php
/var/www/wordpress/wp-includes/link-template.php
/var/www/wordpress/wp-includes/load.php
/var/www/wordpress/wp-includes/locale.php
/var/www/wordpress/wp-includes/media.php
/var/www/wordpress/wp-includes/meta.php
/var/www/wordpress/wp-includes/ms-blogs.php
/var/www/wordpress/wp-includes/ms-default-constants.php
/var/www/wordpress/wp-includes/ms-default-filters.php
/var/www/wordpress/wp-includes/ms-deprecated.php
/var/www/wordpress/wp-includes/ms-files.php
/var/www/wordpress/wp-includes/ms-functions.php
/var/www/wordpress/wp-includes/ms-load.php
/var/www/wordpress/wp-includes/ms-settings.php
/var/www/wordpress/wp-includes/nav-menu-template.php
/var/www/wordpress/wp-includes/nav-menu.php
/var/www/wordpress/wp-includes/pluggable-deprecated.php
/var/www/wordpress/wp-includes/pluggable.php
/var/www/wordpress/wp-includes/plugin.php
/var/www/wordpress/wp-includes/post-template.php
/var/www/wordpress/wp-includes/post-thumbnail-template.php
/var/www/wordpress/wp-includes/post.php
/var/www/wordpress/wp-includes/query.php
/var/www/wordpress/wp-includes/registration-functions.php
/var/www/wordpress/wp-includes/registration.php
/var/www/wordpress/wp-includes/rewrite.php
/var/www/wordpress/wp-includes/rss-functions.php
/var/www/wordpress/wp-includes/rss.php
/var/www/wordpress/wp-includes/script-loader.php
/var/www/wordpress/wp-includes/shortcodes.php
/var/www/wordpress/wp-includes/taxonomy.php
/var/www/wordpress/wp-includes/template-loader.php
/var/www/wordpress/wp-includes/theme.php
/var/www/wordpress/wp-includes/update.php
/var/www/wordpress/wp-includes/user.php
/var/www/wordpress/wp-includes/vars.php
/var/www/wordpress/wp-includes/version.php
/var/www/wordpress/wp-includes/widgets.php
/var/www/wordpress/wp-includes/wp-db.php
/var/www/wordpress/wp-includes/wp-diff.php
/var/www/wordpress/index.php
/var/www/wordpress/wp-activate.php
/var/www/wordpress/wp-app.php
/var/www/wordpress/wp-atom.php
/var/www/wordpress/wp-blog-header.php
/var/www/wordpress/wp-comments-post.php
/var/www/wordpress/wp-commentsrss2.php
/var/www/wordpress/wp-config-sample.php
/var/www/wordpress/wp-cron.php
/var/www/wordpress/wp-feed.php
/var/www/wordpress/wp-links-opml.php
/var/www/wordpress/wp-load.php
/var/www/wordpress/wp-login.php
/var/www/wordpress/wp-mail.php
/var/www/wordpress/wp-pass.php
/var/www/wordpress/wp-rdf.php
/var/www/wordpress/wp-register.php
/var/www/wordpress/wp-rss.php
/var/www/wordpress/wp-rss2.php
/var/www/wordpress/wp-settings.php
/var/www/wordpress/wp-signup.php
/var/www/wordpress/wp-trackback.php
/var/www/wordpress/xmlrpc.php
#CodeDescriptions
1<?php
2/**
3 * XML-RPC protocol support for WordPress
4 *
5 * @license GPL v2 <./license.txt>
6 * @package WordPress
7 */
8
9/**
10 * Whether this is a XMLRPC Request
11 *
12 * @var bool
13 */
14define('XMLRPC_REQUEST', true);
15
16// Some browser-embedded clients send cookies. We don't want them.
17$_COOKIE = array();
18
19// A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
20// but we can do it ourself.
21if ( !isset( $HTTP_RAW_POST_DATA ) ) {
22 $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
23}
24
25// fix for mozBlog and other cases where '<?xml' isn't on the very first line
26if ( isset($HTTP_RAW_POST_DATA) )
27 $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
28
29/** Include the bootstrap for setting up WordPress environment */
30include('./wp-load.php');
31
32if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
33header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
34?>
35<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
36<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
37 <service>
38 <engineName>WordPress</engineName>
39 <engineLink>http://wordpress.org/</engineLink>
40 <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
41 <apis>
42 <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
43 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
44 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
45 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
46 <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service', 'rpc') ) ?>" />
47 </apis>
48 </service>
49</rsd>
50<?php
51exit;
52}
53
54include_once(ABSPATH . 'wp-admin/includes/admin.php');
55include_once(ABSPATH . WPINC . '/class-IXR.php');
56
57// Turn off all warnings and errors.
58// error_reporting(0);
59
60/**
61 * Posts submitted via the xmlrpc interface get that title
62 * @name post_default_title
63 * @var string
64 */
65$post_default_title = "";
66
67/**
68 * Whether to enable XMLRPC Logging.
69 *
70 * @name xmlrpc_logging
71 * @var int|bool
72 */
73$xmlrpc_logging = 0;
74
75/**
76 * logIO() - Writes logging info to a file.
77 *
78 * @uses $xmlrpc_logging
79 * @package WordPress
80 * @subpackage Logging
81 *
82 * @param string $io Whether input or output
83 * @param string $msg Information describing logging reason.
84 * @return bool Always return true
85 */
86function logIO($io,$msg) {
87 global $xmlrpc_logging;
88 if ($xmlrpc_logging) {
89 $fp = fopen("../xmlrpc.log","a+");
90 $date = gmdate("Y-m-d H:i:s ");
91 $iot = ($io == "I") ? " Input: " : " Output: ";
92 fwrite($fp, "\n\n".$date.$iot.$msg);//Arbitrary file manipulations
93 fclose($fp);
94 }
95 return true;
96}
97
98if ( isset($HTTP_RAW_POST_DATA) )
99 logIO("I", $HTTP_RAW_POST_DATA);
100
101/**
102 * WordPress XMLRPC server implementation.
103 *
104 * Implements compatability for Blogger API, MetaWeblog API, MovableType, and
105 * pingback. Additional WordPress API for managing comments, pages, posts,
106 * options, etc.
107 *
108 * Since WordPress 2.6.0, WordPress XMLRPC server can be disabled in the
109 * administration panels.
110 *
111 * @package WordPress
112 * @subpackage Publishing
113 * @since 1.5.0
114 */
115class wp_xmlrpc_server extends IXR_Server {
116
117 /**
118 * Register all of the XMLRPC methods that XMLRPC server understands.
119 *
120 * PHP4 constructor and sets up server and method property. Passes XMLRPC
121 * methods through the 'xmlrpc_methods' filter to allow plugins to extend
122 * or replace XMLRPC methods.
123 *
124 * @since 1.5.0
125 *
126 * @return wp_xmlrpc_server
127 */
128 function wp_xmlrpc_server() {
129 $this->methods = array(
130 // WordPress API
131 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs',
132 'wp.getPage' => 'this:wp_getPage',
133 'wp.getPages' => 'this:wp_getPages',
134 'wp.newPage' => 'this:wp_newPage',
135 'wp.deletePage' => 'this:wp_deletePage',
136 'wp.editPage' => 'this:wp_editPage',
137 'wp.getPageList' => 'this:wp_getPageList',
138 'wp.getAuthors' => 'this:wp_getAuthors',
139 'wp.getCategories' => 'this:mw_getCategories', // Alias
140 'wp.getTags' => 'this:wp_getTags',
141 'wp.newCategory' => 'this:wp_newCategory',
142 'wp.deleteCategory' => 'this:wp_deleteCategory',
143 'wp.suggestCategories' => 'this:wp_suggestCategories',
144 'wp.uploadFile' => 'this:mw_newMediaObject', // Alias
145 'wp.getCommentCount' => 'this:wp_getCommentCount',
146 'wp.getPostStatusList' => 'this:wp_getPostStatusList',
147 'wp.getPageStatusList' => 'this:wp_getPageStatusList',
148 'wp.getPageTemplates' => 'this:wp_getPageTemplates',
149 'wp.getOptions' => 'this:wp_getOptions',
150 'wp.setOptions' => 'this:wp_setOptions',
151 'wp.getComment' => 'this:wp_getComment',
152 'wp.getComments' => 'this:wp_getComments',
153 'wp.deleteComment' => 'this:wp_deleteComment',
154 'wp.editComment' => 'this:wp_editComment',
155 'wp.newComment' => 'this:wp_newComment',
156 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
157
158 // Blogger API
159 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
160 'blogger.getUserInfo' => 'this:blogger_getUserInfo',
161 'blogger.getPost' => 'this:blogger_getPost',
162 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
163 'blogger.getTemplate' => 'this:blogger_getTemplate',
164 'blogger.setTemplate' => 'this:blogger_setTemplate',
165 'blogger.newPost' => 'this:blogger_newPost',
166 'blogger.editPost' => 'this:blogger_editPost',
167 'blogger.deletePost' => 'this:blogger_deletePost',
168
169 // MetaWeblog API (with MT extensions to structs)
170 'metaWeblog.newPost' => 'this:mw_newPost',
171 'metaWeblog.editPost' => 'this:mw_editPost',
172 'metaWeblog.getPost' => 'this:mw_getPost',
173 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
174 'metaWeblog.getCategories' => 'this:mw_getCategories',
175 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
176
177 // MetaWeblog API aliases for Blogger API
178 // see http://www.xmlrpc.com/stories/storyReader$2460
179 'metaWeblog.deletePost' => 'this:blogger_deletePost',
180 'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
181 'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
182 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
183
184 // MovableType API
185 'mt.getCategoryList' => 'this:mt_getCategoryList',
186 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
187 'mt.getPostCategories' => 'this:mt_getPostCategories',
188 'mt.setPostCategories' => 'this:mt_setPostCategories',
189 'mt.supportedMethods' => 'this:mt_supportedMethods',
190 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
191 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
192 'mt.publishPost' => 'this:mt_publishPost',
193
194 // PingBack
195 'pingback.ping' => 'this:pingback_ping',
196 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
197
198 'demo.sayHello' => 'this:sayHello',
199 'demo.addTwoNumbers' => 'this:addTwoNumbers'
200 );
201
202 $this->initialise_blog_option_info( );
203 $this->methods = apply_filters('xmlrpc_methods', $this->methods);
204 }
205
206 function serve_request() {
207 $this->IXR_Server($this->methods);
208 }
209
210 /**
211 * Test XMLRPC API by saying, "Hello!" to client.
212 *
213 * @since 1.5.0
214 *
215 * @param array $args Method Parameters.
216 * @return string
217 */
218 function sayHello($args) {
219 return 'Hello!';
220 }
221
222 /**
223 * Test XMLRPC API by adding two numbers for client.
224 *
225 * @since 1.5.0
226 *
227 * @param array $args Method Parameters.
228 * @return int
229 */
230 function addTwoNumbers($args) {
231 $number1 = $args[0];
232 $number2 = $args[1];
233 return $number1 + $number2;
234 }
235
236 /**
237 * Check user's credentials.
238 *
239 * @since 1.5.0
240 *
241 * @param string $user_login User's username.
242 * @param string $user_pass User's password.
243 * @return bool Whether authentication passed.
244 * @deprecated use wp_xmlrpc_server::login
245 * @see wp_xmlrpc_server::login
246 */
247 function login_pass_ok($user_login, $user_pass) {
248 if ( !get_option( 'enable_xmlrpc' ) ) {
249 $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
250 return false;
251 }
252
253 if (!user_pass_ok($user_login, $user_pass)) {
254 $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
255 return false;
256 }
257 return true;
258 }
259
260 /**
261 * Log user in.
262 *
263 * @since 2.8
264 *
265 * @param string $username User's username.
266 * @param string $password User's password.
267 * @return mixed WP_User object if authentication passed, false otherwise
268 */
269 function login($username, $password) {
270 if ( !get_option( 'enable_xmlrpc' ) ) {
271 $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
272 return false;
273 }
274
275 $user = wp_authenticate($username, $password);
276
277 if (is_wp_error($user)) {
278 $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
279 return false;
280 }
281
282 wp_set_current_user( $user->ID );
283 return $user;
284 }
285
286 /**
287 * Sanitize string or array of strings for database.
288 *
289 * @since 1.5.2
290 *
291 * @param string|array $array Sanitize single string or array of strings.
292 * @return string|array Type matches $array and sanitized for the database.
293 */
294 function escape(&$array) {
295 global $wpdb;
296
297 if (!is_array($array)) {
298 return($wpdb->escape($array));
299 } else {
300 foreach ( (array) $array as $k => $v ) {
301 if ( is_array($v) ) {
302 $this->escape($array[$k]);
303 } else if ( is_object($v) ) {
304 //skip
305 } else {
306 $array[$k] = $wpdb->escape($v);
307 }
308 }
309 }
310 }
311
312 /**
313 * Retrieve custom fields for post.
314 *
315 * @since 2.5.0
316 *
317 * @param int $post_id Post ID.
318 * @return array Custom fields, if exist.
319 */
320 function get_custom_fields($post_id) {
321 $post_id = (int) $post_id;
322
323 $custom_fields = array();
324
325 foreach ( (array) has_meta($post_id) as $meta ) {
326 // Don't expose protected fields.
327 if ( strpos($meta['meta_key'], '_wp_') === 0 ) {
328 continue;
329 }
330
331 $custom_fields[] = array(
332 "id" => $meta['meta_id'],
333 "key" => $meta['meta_key'],
334 "value" => $meta['meta_value']
335 );
336 }
337
338 return $custom_fields;
339 }
340
341 /**
342 * Set custom fields for post.
343 *
344 * @since 2.5.0
345 *
346 * @param int $post_id Post ID.
347 * @param array $fields Custom fields.
348 */
349 function set_custom_fields($post_id, $fields) {
350 $post_id = (int) $post_id;
351
352 foreach ( (array) $fields as $meta ) {
353 if ( isset($meta['id']) ) {
354 $meta['id'] = (int) $meta['id'];
355
356 if ( isset($meta['key']) ) {
357 update_meta($meta['id'], $meta['key'], $meta['value']);
358 }
359 else {
360 delete_meta($meta['id']);
361 }
362 }
363 else {
364 $_POST['metakeyinput'] = $meta['key'];
365 $_POST['metavalue'] = $meta['value'];
366 add_meta($post_id);
367 }
368 }
369 }
370
371 /**
372 * Set up blog options property.
373 *
374 * Passes property through 'xmlrpc_blog_options' filter.
375 *
376 * @since 2.6.0
377 */
378 function initialise_blog_option_info( ) {
379 global $wp_version;
380
381 $this->blog_options = array(
382 // Read only options
383 'software_name' => array(
384 'desc' => __( 'Software Name' ),
385 'readonly' => true,
386 'value' => 'WordPress'
387 ),
388 'software_version' => array(
389 'desc' => __( 'Software Version' ),
390 'readonly' => true,
391 'value' => $wp_version
392 ),
393 'blog_url' => array(
394 'desc' => __( 'Site URL' ),
395 'readonly' => true,
396 'option' => 'siteurl'
397 ),
398
399 // Updatable options
400 'time_zone' => array(
401 'desc' => __( 'Time Zone' ),
402 'readonly' => false,
403 'option' => 'gmt_offset'
404 ),
405 'blog_title' => array(
406 'desc' => __( 'Site Title' ),
407 'readonly' => false,
408 'option' => 'blogname'
409 ),
410 'blog_tagline' => array(
411 'desc' => __( 'Site Tagline' ),
412 'readonly' => false,
413 'option' => 'blogdescription'
414 ),
415 'date_format' => array(
416 'desc' => __( 'Date Format' ),
417 'readonly' => false,
418 'option' => 'date_format'
419 ),
420 'time_format' => array(
421 'desc' => __( 'Time Format' ),
422 'readonly' => false,
423 'option' => 'time_format'
424 ),
425 'users_can_register' => array(
426 'desc' => __( 'Allow new users to sign up' ),
427 'readonly' => false,
428 'option' => 'users_can_register'
429 )
430 );
431
432 $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
433 }
434
435 /**
436 * Retrieve the blogs of the user.
437 *
438 * @since 2.6.0
439 *
440 * @param array $args Method parameters.
441 * @return array
442 */
443 function wp_getUsersBlogs( $args ) {
444 global $current_site;
445 // If this isn't on WPMU then just use blogger_getUsersBlogs
446 if ( !is_multisite() ) {
447 array_unshift( $args, 1 );
448 return $this->blogger_getUsersBlogs( $args );
449 }
450
451 $this->escape( $args );
452
453 $username = $args[0];
454 $password = $args[1];
455
456 if ( !$user = $this->login($username, $password) )
457 return $this->error;
458
459
460 do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
461
462 $blogs = (array) get_blogs_of_user( $user->ID );
463 $struct = array( );
464
465 foreach ( $blogs as $blog ) {
466 // Don't include blogs that aren't hosted at this site
467 if ( $blog->site_id != $current_site->id )
468 continue;
469
470 $blog_id = $blog->userblog_id;
471 switch_to_blog($blog_id);
472 $is_admin = current_user_can('manage_options');
473
474 $struct[] = array(
475 'isAdmin' => $is_admin,
476 'url' => get_option( 'home' ) . '/',
477 'blogid' => $blog_id,
478 'blogName' => get_option( 'blogname' ),
479 'xmlrpc' => site_url( 'xmlrpc.php' )
480 );
481
482 restore_current_blog( );
483 }
484
485 return $struct;
486 }
487
488 /**
489 * Retrieve page.
490 *
491 * @since 2.2.0
492 *
493 * @param array $args Method parameters.
494 * @return array
495 */
496 function wp_getPage($args) {
497 $this->escape($args);
498
499 $blog_id = (int) $args[0];
500 $page_id = (int) $args[1];
501 $username = $args[2];
502 $password = $args[3];
503
504 if ( !$user = $this->login($username, $password) ) {
505 return $this->error;
506 }
507
508 if ( !current_user_can( 'edit_page', $page_id ) )
509 return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
510
511 do_action('xmlrpc_call', 'wp.getPage');
512
513 // Lookup page info.
514 $page = get_page($page_id);
515
516 // If we found the page then format the data.
517 if ( $page->ID && ($page->post_type == "page") ) {
518 // Get all of the page content and link.
519 $full_page = get_extended($page->post_content);
520 $link = post_permalink($page->ID);
521
522 // Get info the page parent if there is one.
523 $parent_title = "";
524 if ( !empty($page->post_parent) ) {
525 $parent = get_page($page->post_parent);
526 $parent_title = $parent->post_title;
527 }
528
529 // Determine comment and ping settings.
530 $allow_comments = comments_open($page->ID) ? 1 : 0;
531 $allow_pings = pings_open($page->ID) ? 1 : 0;
532
533 // Format page date.
534 $page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false);
535 $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false);
536
537 // For drafts use the GMT version of the date
538 if ( $page->post_status == 'draft' )
539 $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' );
540
541 // Pull the categories info together.
542 $categories = array();
543 foreach ( wp_get_post_categories($page->ID) as $cat_id ) {
544 $categories[] = get_cat_name($cat_id);
545 }
546
547 // Get the author info.
548 $author = get_userdata($page->post_author);
549
550 $page_template = get_post_meta( $page->ID, '_wp_page_template', true );
551 if ( empty( $page_template ) )
552 $page_template = 'default';
553
554 $page_struct = array(
555 "dateCreated" => new IXR_Date($page_date),
556 "userid" => $page->post_author,
557 "page_id" => $page->ID,
558 "page_status" => $page->post_status,
559 "description" => $full_page["main"],
560 "title" => $page->post_title,
561 "link" => $link,
562 "permaLink" => $link,
563 "categories" => $categories,
564 "excerpt" => $page->post_excerpt,
565 "text_more" => $full_page["extended"],
566 "mt_allow_comments" => $allow_comments,
567 "mt_allow_pings" => $allow_pings,
568 "wp_slug" => $page->post_name,
569 "wp_password" => $page->post_password,
570 "wp_author" => $author->display_name,
571 "wp_page_parent_id" => $page->post_parent,
572 "wp_page_parent_title" => $parent_title,
573 "wp_page_order" => $page->menu_order,
574 "wp_author_id" => $author->ID,
575 "wp_author_display_name" => $author->display_name,
576 "date_created_gmt" => new IXR_Date($page_date_gmt),
577 "custom_fields" => $this->get_custom_fields($page_id),
578 "wp_page_template" => $page_template
579 );
580
581 return($page_struct);
582 }
583 // If the page doesn't exist indicate that.
584 else {
585 return(new IXR_Error(404, __("Sorry, no such page.")));
586 }
587 }
588
589 /**
590 * Retrieve Pages.
591 *
592 * @since 2.2.0
593 *
594 * @param array $args Method parameters.
595 * @return array
596 */
597 function wp_getPages($args) {
598 $this->escape($args);
599
600 $blog_id = (int) $args[0];
601 $username = $args[1];
602 $password = $args[2];
603 $num_pages = isset($args[3]) ? (int) $args[3] : 10;
604
605 if ( !$user = $this->login($username, $password) )
606 return $this->error;
607
608 if ( !current_user_can( 'edit_pages' ) )
609 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
610
611 do_action('xmlrpc_call', 'wp.getPages');
612
613 $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
614 $num_pages = count($pages);
615
616 // If we have pages, put together their info.
617 if ( $num_pages >= 1 ) {
618 $pages_struct = array();
619
620 for ( $i = 0; $i < $num_pages; $i++ ) {
621 $page = wp_xmlrpc_server::wp_getPage(array(
622 $blog_id, $pages[$i]->ID, $username, $password
623 ));
624 $pages_struct[] = $page;
625 }
626
627 return($pages_struct);
628 }
629 // If no pages were found return an error.
630 else {
631 return(array());
632 }
633 }
634
635 /**
636 * Create new page.
637 *
638 * @since 2.2.0
639 *
640 * @param array $args Method parameters.
641 * @return unknown
642 */
643 function wp_newPage($args) {
644 // Items not escaped here will be escaped in newPost.
645 $username = $this->escape($args[1]);
646 $password = $this->escape($args[2]);
647 $page = $args[3];
648 $publish = $args[4];
649
650 if ( !$user = $this->login($username, $password) )
651 return $this->error;
652
653 do_action('xmlrpc_call', 'wp.newPage');
654
655 // Make sure the user is allowed to add new pages.
656 if ( !current_user_can("publish_pages") )
657 return(new IXR_Error(401, __("Sorry, you cannot add new pages.")));
658
659 // Mark this as content for a page.
660 $args[3]["post_type"] = "page";
661
662 // Let mw_newPost do all of the heavy lifting.
663 return($this->mw_newPost($args));
664 }
665
666 /**
667 * Delete page.
668 *
669 * @since 2.2.0
670 *
671 * @param array $args Method parameters.
672 * @return bool True, if success.
673 */
674 function wp_deletePage($args) {
675 $this->escape($args);
676
677 $blog_id = (int) $args[0];
678 $username = $args[1];
679 $password = $args[2];
680 $page_id = (int) $args[3];
681
682 if ( !$user = $this->login($username, $password) )
683 return $this->error;
684
685 do_action('xmlrpc_call', 'wp.deletePage');
686
687 // Get the current page based on the page_id and
688 // make sure it is a page and not a post.
689 $actual_page = wp_get_single_post($page_id, ARRAY_A);
690 if ( !$actual_page || ($actual_page["post_type"] != "page") )
691 return(new IXR_Error(404, __("Sorry, no such page.")));
692
693 // Make sure the user can delete pages.
694 if ( !current_user_can("delete_page", $page_id) )
695 return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
696
697 // Attempt to delete the page.
698 $result = wp_delete_post($page_id);
699 if ( !$result )
700 return(new IXR_Error(500, __("Failed to delete the page.")));
701
702 return(true);
703 }
704
705 /**
706 * Edit page.
707 *
708 * @since 2.2.0
709 *
710 * @param array $args Method parameters.
711 * @return unknown
712 */
713 function wp_editPage($args) {
714 // Items not escaped here will be escaped in editPost.
715 $blog_id = (int) $args[0];
716 $page_id = (int) $this->escape($args[1]);
717 $username = $this->escape($args[2]);
718 $password = $this->escape($args[3]);
719 $content = $args[4];
720 $publish = $args[5];
721
722 if ( !$user = $this->login($username, $password) )
723 return $this->error;
724
725 do_action('xmlrpc_call', 'wp.editPage');
726
727 // Get the page data and make sure it is a page.
728 $actual_page = wp_get_single_post($page_id, ARRAY_A);
729 if ( !$actual_page || ($actual_page["post_type"] != "page") )
730 return(new IXR_Error(404, __("Sorry, no such page.")));
731
732 // Make sure the user is allowed to edit pages.
733 if ( !current_user_can("edit_page", $page_id) )
734 return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page.")));
735
736 // Mark this as content for a page.
737 $content["post_type"] = "page";
738
739 // Arrange args in the way mw_editPost understands.
740 $args = array(
741 $page_id,
742 $username,
743 $password,
744 $content,
745 $publish
746 );
747
748 // Let mw_editPost do all of the heavy lifting.
749 return($this->mw_editPost($args));
750 }
751
752 /**
753 * Retrieve page list.
754 *
755 * @since 2.2.0
756 *
757 * @param array $args Method parameters.
758 * @return unknown
759 */
760 function wp_getPageList($args) {
761 global $wpdb;
762
763 $this->escape($args);
764
765 $blog_id = (int) $args[0];
766 $username = $args[1];
767 $password = $args[2];
768
769 if ( !$user = $this->login($username, $password) )
770 return $this->error;
771
772 if ( !current_user_can( 'edit_pages' ) )
773 return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
774
775 do_action('xmlrpc_call', 'wp.getPageList');
776
777 // Get list of pages ids and titles
778 $page_list = $wpdb->get_results("
779 SELECT ID page_id,
780 post_title page_title,
781 post_parent page_parent_id,
782 post_date_gmt,
783 post_date,
784 post_status
785 FROM {$wpdb->posts}
786 WHERE post_type = 'page'
787 ORDER BY ID
788 ");
789
790 // The date needs to be formated properly.
791 $num_pages = count($page_list);
792 for ( $i = 0; $i < $num_pages; $i++ ) {
793 $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false);
794 $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false);
795
796 $page_list[$i]->dateCreated = new IXR_Date($post_date);
797 $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
798
799 // For drafts use the GMT version of the date
800 if ( $page_list[$i]->post_status == 'draft' ) {
801 $page_list[$i]->date_created_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page_list[$i]->post_date ), 'Ymd\TH:i:s' );
802 $page_list[$i]->date_created_gmt = new IXR_Date( $page_list[$i]->date_created_gmt );
803 }
804
805 unset($page_list[$i]->post_date_gmt);
806 unset($page_list[$i]->post_date);
807 unset($page_list[$i]->post_status);
808 }
809
810 return($page_list);
811 }
812
813 /**
814 * Retrieve authors list.
815 *
816 * @since 2.2.0
817 *
818 * @param array $args Method parameters.
819 * @return array
820 */
821 function wp_getAuthors($args) {
822
823 $this->escape($args);
824
825 $blog_id = (int) $args[0];
826 $username = $args[1];
827 $password = $args[2];
828
829 if ( !$user = $this->login($username, $password) )
830 return $this->error;
831
832 if ( !current_user_can("edit_posts") )
833 return(new IXR_Error(401, __("Sorry, you cannot edit posts on this site.")));
834
835 do_action('xmlrpc_call', 'wp.getAuthors');
836
837 $authors = array();
838 foreach ( (array) get_users_of_blog() as $row ) {
839 $authors[] = array(
840 "user_id" => $row->user_id,
841 "user_login" => $row->user_login,
842 "display_name" => $row->display_name
843 );
844 }
845
846 return($authors);
847 }
848
849 /**
850 * Get list of all tags
851 *
852 * @since 2.7
853 *
854 * @param array $args Method parameters.
855 * @return array
856 */
857 function wp_getTags( $args ) {
858 $this->escape( $args );
859
860 $blog_id = (int) $args[0];
861 $username = $args[1];
862 $password = $args[2];
863
864 if ( !$user = $this->login($username, $password) )
865 return $this->error;
866
867 if ( !current_user_can( 'edit_posts' ) )
868 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
869
870 do_action( 'xmlrpc_call', 'wp.getKeywords' );
871
872 $tags = array( );
873
874 if ( $all_tags = get_tags() ) {
875 foreach( (array) $all_tags as $tag ) {
876 $struct['tag_id'] = $tag->term_id;
877 $struct['name'] = $tag->name;
878 $struct['count'] = $tag->count;
879 $struct['slug'] = $tag->slug;
880 $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) );
881 $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) );
882
883 $tags[] = $struct;
884 }
885 }
886
887 return $tags;
888 }
889
890 /**
891 * Create new category.
892 *
893 * @since 2.2.0
894 *
895 * @param array $args Method parameters.
896 * @return int Category ID.
897 */
898 function wp_newCategory($args) {
899 $this->escape($args);
900
901 $blog_id = (int) $args[0];
902 $username = $args[1];
903 $password = $args[2];
904 $category = $args[3];
905
906 if ( !$user = $this->login($username, $password) )
907 return $this->error;
908
909 do_action('xmlrpc_call', 'wp.newCategory');
910
911 // Make sure the user is allowed to add a category.
912 if ( !current_user_can("manage_categories") )
913 return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
914
915 // If no slug was provided make it empty so that
916 // WordPress will generate one.
917 if ( empty($category["slug"]) )
918 $category["slug"] = "";
919
920 // If no parent_id was provided make it empty
921 // so that it will be a top level page (no parent).
922 if ( !isset($category["parent_id"]) )
923 $category["parent_id"] = "";
924
925 // If no description was provided make it empty.
926 if ( empty($category["description"]) )
927 $category["description"] = "";
928
929 $new_category = array(
930 "cat_name" => $category["name"],
931 "category_nicename" => $category["slug"],
932 "category_parent" => $category["parent_id"],
933 "category_description" => $category["description"]
934 );
935
936 $cat_id = wp_insert_category($new_category, true);
937 if ( is_wp_error( $cat_id ) ) {
938 if ( 'term_exists' == $cat_id->get_error_code() )
939 return (int) $cat_id->get_error_data();
940 else
941 return(new IXR_Error(500, __("Sorry, the new category failed.")));
942 } elseif ( ! $cat_id ) {
943 return(new IXR_Error(500, __("Sorry, the new category failed.")));
944 }
945
946 return($cat_id);
947 }
948
949 /**
950 * Remove category.
951 *
952 * @since 2.5.0
953 *
954 * @param array $args Method parameters.
955 * @return mixed See {@link wp_delete_category()} for return info.
956 */
957 function wp_deleteCategory($args) {
958 $this->escape($args);
959
960 $blog_id = (int) $args[0];
961 $username = $args[1];
962 $password = $args[2];
963 $category_id = (int) $args[3];
964
965 if ( !$user = $this->login($username, $password) )
966 return $this->error;
967
968 do_action('xmlrpc_call', 'wp.deleteCategory');
969
970 if ( !current_user_can("manage_categories") )
971 return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
972
973 return wp_delete_category( $category_id );
974 }
975
976 /**
977 * Retrieve category list.
978 *
979 * @since 2.2.0
980 *
981 * @param array $args Method parameters.
982 * @return array
983 */
984 function wp_suggestCategories($args) {
985 $this->escape($args);
986
987 $blog_id = (int) $args[0];
988 $username = $args[1];
989 $password = $args[2];
990 $category = $args[3];
991 $max_results = (int) $args[4];
992
993 if ( !$user = $this->login($username, $password) )
994 return $this->error;
995
996 if ( !current_user_can( 'edit_posts' ) )
997 return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) );
998
999 do_action('xmlrpc_call', 'wp.suggestCategories');
1000