MS word2007에서 잘 되지 않아서 (이건 word의 오류인듯 합니다) 플러그인 소스를 열어보니 무지하게 복잡하네요... stand-alone에 가깝군요^^
컴포넌트로 이미 구현된 명령들에 대해서 어떻게 설명을 드릴 수 있을까 생각해 보았습니다.
그러고보니 이런 물건이 있습니다. 태터툴즈 1.0에서 함께 내놓으려고 했던 플러그인인 MetaWeblog API 1.0 입니다.
xml부분은 1.0.6에 맞도록 적당히 손 봐 놓았습니다.
태터툴즈 안이 어떻게 생겼는지 분석하기에는 시간이 걸립니다^^. 이 플러그인을 보시고 어떤 부분들이 가능한지 파악하시는데 도움이 되셨으면 합니다.
분석할 시간을 줄이실 수 있지 않을까 합니다 
참고로, 아래의 플러그인은 현재 동작을 보장하지 못합니다. ㅎㅎ rc3였나? 까지만 존재했던 플러그인이죠.
index.xml
<?xml version="1.0" encoding="utf-8"?>
<plugin>
<title>MetaWeblog API</title>
<title xml:lang="ko">MetaWeblog API</title>
<link>http://www.tattertools.com/plugins</link>
<version>1.0 test</version>
<description xml:lang="ko">MetaWeblog API의 태터툴즈 구현입니다. newPost/editPost/getPost/getRecentPosts를 지원하고 있습니다. URL은 {블로그 주소}/plugin/MetaWeblogAPI/ 입니다.</description>
<description xml:lang="en">MetaWeblog API for Tattertools. Supports newPost/editPost/getPost/getRecentPosts functions. URL is {weblog URL}/plugin/MetaWeblogAPI/ </description>
<license>GPL</license>
<author xml:lang="ko" link="http://www.tattertools.com"><![CDATA[태터앤컴퍼니]]></author>
<author xml:lang="en" link="http://www.tattertools.com"><![CDATA[Tatter & Company]]></author>
<safety changeData="yes" exposeData="no" accessLocal="no" accessRemote="no" accessRaw="no" />
<requirements>
<tattertools>1.0</tattertools>
<component>Eolin.PHP.XMLRPC</component>
<component>Tattertools.Model.Entry</component>
</requirements>
<binding>
<listener event="/plugin/MetaWeblogAPI/">serveMetaWeblogAPI</listener>
</binding>
</plugin>
index.php
<?
requireComponent('Eolin.PHP.XMLRPC');
requireComponent('Tattertools.Control.Auth');
function serveMetaWeblogAPI($target, $mother) {
$xmlrpc = new XMLRPC();
$xmlrpc->registerMethod('metaWeblog.newPost', 'metaWeblog_newPost');
$xmlrpc->registerMethod('metaWeblog.editPost', 'metaWeblog_editPost');
$xmlrpc->registerMethod('metaWeblog.getPost', 'metaWeblog_getPost');
$xmlrpc->registerMethod('metaWeblog.getRecentPosts', 'metaWeblog_getRecentPosts');
if (!$xmlrpc->receive())
$xmlrpc->sendFault();
}
function metaWeblog_newPost($blogid, $username, $password, $item, $publish) {
if (!Auth::login($username, $password))
return new XMLRPCFault(1, 'Incorrect username or password');
if (empty($item['title']))
return new XMLRPCFault(1, 'The title is required');
if (empty($item['description']))
return new XMLRPCFault(1, 'The description is required');
requireComponent('Tattertools.Model.Entry');
$entry = new Entry();
$entry->title = $item['title'];
$entry->content = $item['description'];
if ($publish)
$entry->visibility = 'public';
if ($entry->add())
return strval($entry->id);
else
return new XMLRPCFault(1, 'Could not post');
}
function metaWeblog_editPost($postid, $username, $password, $item, $publish) {
if (!Auth::login($username, $password))
return new XMLRPCFault(1, 'Incorrect username or password');
if (empty($item['title']))
return new XMLRPCFault(1, 'The title is required');
if (empty($item['description']))
return new XMLRPCFault(1, 'The description is required');
requireComponent('Tattertools.Model.Entry');
$entry = new Entry();
if (!$entry->select($postid))
return new XMLRPCFault(1, 'Post was not found');
$entry->title = $item['title'];
$entry->content = $item['description'];
if ($publish)
$entry->visibility = 'public';
if ($entry->update())
return true;
else
return new XMLRPCFault(1, 'Could not edit a post');
}
function metaWeblog_getPost($postid, $username, $password) {
if (!Auth::login($username, $password))
return new XMLRPCFault(1, 'Incorrect username or password');
requireComponent('Tattertools.Model.Entry');
$entry = new Entry();
if (!$entry->select($postid))
return new XMLRPCFault(1, 'Post was not found');
return getmetaWeblogItem($entry);
}
function metaWeblog_getRecentPosts($blogid, $username, $password, $numberOfPosts) {
if (!Auth::login($username, $password))
return new XMLRPCFault(1, 'Incorrect username or password');
requireComponent('Tattertools.Model.Entry');
$entry = new Entry();
if (!$entry->select())
return new XMLRPCFault(1, 'Post was not found');
$items = array();
do {
array_push($items, getmetaWeblogItem($entry));
} while ($entry->moveNext() && --$numberOfPosts);
return $items;
}
function getmetaWeblogItem($entry) {
return array('postid' => $entry->id, 'title' => $entry->title, 'description' => $entry->content, 'dateCreated' => gmdate('Ymd\TH:i:s', $entry->published));
}
?>
"Everything looks different on the other side."
-Ian Malcomm, from Michael Crichton's 'The Jurassic Park'