【php开源代码栏目提醒】:网学会员php开源代码为您提供api_mt.inc.php参考,解决您在api_mt.inc.php学习中工作中的难题,参考学习。
<?php
/*
* Nucleus:
PHP/MySQL Weblog CMS (http://nucleuscms.org/)
* Copyright (C) 2002-2005 The Nucleus Group
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* (see nucleus/documentation/index.html#license for more info)
*/
/**
* This file contains definitions for the methods in the Movable Type API
*
* Wouter Demuynck 2003-08-31
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2005 The Nucleus Group
* @version $Id: api_mt.inc.php 775 2005-08-21 09:46:00Z dekarma $
*/
// mt.supportedMethods
$f_mt_supportedMethods_sig = array(array(
// return type
$xmlrpcArray // array of strings
));
$f_mt_supportedMethods_doc = 'returns an array of supported methods';
function f_mt_supportedMethods($m) {
$res = new xmlrpcresp(new xmlrpcval(
array(
new xmlrpcval('mt.supportedMethods', 'string'),
new xmlrpcval('mt.supportedTextFilters', 'string'),
new xmlrpcval('mt.publishPost', 'string'),
new xmlrpcval('mt.getCategoryList', 'string'),
new xmlrpcval('mt.getPostCategories', 'string'),
new xmlrpcval('mt.setPostCategories', 'string'),
new xmlrpcval('mt.getRecentPostTitles', 'string'),
new xmlrpcval('mt.getTrackbackPings','string'),
), 'array')
);
return $res;
}
// mt.supportedTextFilters
$f_mt_supportedTextFilters_sig = array(array(
// return type
$xmlrpcArray // array of structs
));
$f_mt_supportedTextFilters_doc = 'returns the supported text filters';
function f_mt_supportedTextFilters($m) {
$res = new xmlrpcresp(new xmlrpcval(
array(
// no text filters in nucleus
), 'array')
);
return $res;
}
// mt.getCategoryList
$f_mt_getCategoryList_sig = array(array(
// return type
$xmlrpcArray, // array of structs
// params
$xmlrpcString, // blogid
$xmlrpcString, // username
$xmlrpcString // password
));
$f_mt_getCategoryList_doc = 'Returns a list of all categories defined in the
weblog';
function f_mt_getCategoryList($m) {
$blogid = _getScalar($m,0);
$username = _getScalar($m,1);
$password = _getScalar($m,2);
return _mt_categoryList($blogid, $username, $password);
}
// mt.publishPost
$f_mt_publishPost_sig = array(array(
// return type
$xmlrpcBoolean, // true
// params
$xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString // password
));
$f_mt_publishPost_doc = 'Transfers an item from the "draft" state to the "published" state. For items that were published earlier, does nothing.';
function f_mt_publishPost($m) {
$itemid = intval(_getScalar($m, 0));
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
return _mt_publishPost($itemid, $username, $password);
}
// mt.getPostCategories
$f_mt_getPostCategories_sig = array(array(
// return
$
xmlrpcArray, // array of structs
// parameters
$xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString // password
));
$f_mt_getPostCategories_doc = 'Returns a list of all categories to which the post is assigned.';
function f_mt_getPostCategories($m) {
$itemid = intval(_getScalar($m, 0));
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
return _mt_getPostCategories($itemid, $username, $pass
word);
}
// mt.setPostCategories
$f_mt_setPostCategories_sig = array(array(
// return
$xmlrpcBoolean, // true
// parameters
$xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString, // password
$xmlrpcArray // categories
));
$f_mt_setPostCategories_doc = 'Sets the categories for a post. Only the primary category will be stored';
function f_mt_setPostCategories($m) {
$itemid = intval(_getScalar($m, 0));
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
$categories = $m->getParam(3);
$iSize = $categories->arraysize();
$category = '';
for ($i=0;$i<$iSize;$i++) {
$struct = $categories->arraymem($i);
$bPrimary = $struct->structmem('isPrimary');
if ($bPrimary)
$bPrimary = $bPrimary->scalarval();
else if (!$category)
$bPrimary = 1; // "Using isPrimary to set the primary category is optional--
// in the absence of this flag, the first struct in