[wp-cvs] wordpress/wp-admin xmlrpc.php,1.13,1.14
Michel Valdrighi
michelvaldrighi at users.sourceforge.net
Tue Sep 14 16:52:15 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31018/wp-admin
Modified Files:
xmlrpc.php
Log Message:
various fixes, and started MT API support
Index: xmlrpc.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/xmlrpc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** xmlrpc.php 1 Sep 2004 16:13:35 -0000 1.13
--- xmlrpc.php 14 Sep 2004 16:52:13 -0000 1.14
***************
*** 14,18 ****
$post_default_category = 1; // posts submitted via the xmlrpc interface go into that category
! $xmlrpc_logging = 0;
function logIO($io,$msg) {
--- 14,18 ----
$post_default_category = 1; // posts submitted via the xmlrpc interface go into that category
! $xmlrpc_logging = 1;
function logIO($io,$msg) {
***************
*** 140,144 ****
'isAdmin' => $is_admin,
'url' => get_settings('home') .'/'.get_settings('blogfilename'),
! 'blogid' => 1,
'blogName' => get_settings('blogname')
);
--- 140,144 ----
'isAdmin' => $is_admin,
'url' => get_settings('home') .'/'.get_settings('blogfilename'),
! 'blogid' => '1',
'blogName' => get_settings('blogname')
);
***************
*** 634,650 ****
$resp = array(
! 'link' => $link,
! 'title' => $postdata['post_title'],
! 'description' => $post['main'],
! 'dateCreated' => new IXR_Date($post_date),
! 'userid' => $postdata['post_author'],
! 'postid' => $postdata['ID'],
! 'content' => $postdata['post_content'],
! 'permaLink' => $link,
! 'categories' => $categories,
! 'mt_excerpt' => $postdata['post_excerpt'],
! 'mt_allow_comments' => $allow_comments,
! 'mt_allow_pings' => $allow_pings,
! 'mt_text_more' => $post['extended']
);
--- 634,650 ----
$resp = array(
! 'dateCreated' => new IXR_Date($post_date),
! 'userid' => $entry['post_author'],
! 'postid' => $entry['ID'],
! 'description' => $post['main'],
! 'title' => $entry['post_title'],
! 'link' => $link,
! 'permaLink' => $link,
! // 'content' => $entry['post_content'],
! // 'categories' => $categories
! 'mt_excerpt' => $entry['post_excerpt'],
! 'mt_text_more' => $post['extended'],
! 'mt_allow_comments' => $allow_comments,
! 'mt_allow_pings' => $allow_pings
);
***************
*** 662,666 ****
$user_login = $args[1];
$user_pass = $args[2];
! $num_posts = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) {
--- 662,666 ----
$user_login = $args[1];
$user_pass = $args[2];
! $num_posts = $args[3];
if (!$this->login_pass_ok($user_login, $user_pass)) {
***************
*** 691,707 ****
$struct[] = array(
- 'link' => $link,
- 'title' => $entry['post_title'],
- 'description' => $post['main'],
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
! 'content' => $entry['post_content'],
! 'permalink' => $link,
! 'categories' => $categories,
'mt_excerpt' => $entry['post_excerpt'],
'mt_allow_comments' => $allow_comments,
! 'mt_allow_pings' => $allow_pings,
! 'mt_text_more' => $post['extended']
);
--- 691,707 ----
$struct[] = array(
'dateCreated' => new IXR_Date($post_date),
'userid' => $entry['post_author'],
'postid' => $entry['ID'],
! 'description' => $post['main'],
! 'title' => $entry['post_title'],
! 'link' => $link,
! 'permaLink' => $link,
! // 'content' => $entry['post_content'],
! // 'categories' => $categories
'mt_excerpt' => $entry['post_excerpt'],
+ 'mt_text_more' => $post['extended'],
'mt_allow_comments' => $allow_comments,
! 'mt_allow_pings' => $allow_pings
);
***************
*** 824,827 ****
--- 824,902 ----
}
+
+
+ /* MovableType API functions
+ * specs on http://www.movabletype.org/docs/mtmanual_programmatic.html
+ */
+
+ /* mt.getRecentPostTitles ...returns recent posts' titles */
+ function mt_getRecentPostTitles($args) {
+
+ $blog_ID = $args[0];
+ $user_login = $args[1];
+ $user_pass = $args[2];
+ $num_posts = $args[3];
+
+ if (!$this->login_pass_ok($user_login, $user_pass)) {
+ return $this->error;
+ }
+
+ $posts_list = wp_get_recent_posts($num_posts);
+
+ if (!$posts_list) {
+ $this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
+ return $this->error;
+ }
+
+ foreach ($posts_list as $entry) {
+
+ $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
+
+ $struct[] = array(
+ 'dateCreated' => new IXR_Date($post_date),
+ 'userid' => $entry['post_author'],
+ 'postid' => $entry['ID'],
+ 'title' => $entry['post_title'],
+ );
+
+ }
+
+ $recent_posts = array();
+ for ($j=0; $j<count($struct); $j++) {
+ array_push($recent_posts, $struct[$j]);
+ }
+
+ return $recent_posts;
+ }
+
+
+ /* mt.getCategoryList ...returns the list of categories on a given weblog */
+ function mt_getCategoryList($args) {
+
+ global $wpdb;
+
+ $blog_ID = $args[0];
+ $user_login = $args[1];
+ $user_pass = $args[2];
+
+ if (!$this->login_pass_ok($user_login, $user_pass)) {
+ return $this->error;
+ }
+
+ $categories_struct = array();
+
+ // FIXME: can we avoid using direct SQL there?
+ if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
+ foreach ($cats as $cat) {
+ $struct['categoryId'] = $cat['cat_ID'];
+ $struct['categoryName'] = $cat['cat_name'];
+
+ $categories_struct[] = $struct;
+ }
+ }
+
+ return $categories_struct;
+ }
+
}
More information about the cvs
mailing list