【php开源代码栏目提醒】:网学会员,鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“api_metaweblog.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 of the metaWeblog API
*
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2005 The Nucleus Group
* @version $Id: api_meta
weblog.inc.php 775 2005-08-21 09:46:00Z dekarma $
*/
// metaWeblog.newPost
$f_metaWeblog_newPost_sig = array(array(
// return type
$xmlrpcString, // itemid of the new item
// params:
$xmlrpcString, // blogid
$xmlrpcString, // username
$xmlrpcString, // password
$xmlrpcStruct, // content
$xmlrpcBoolean, // publish boolean (set to false to create draft)
));
$f_metaWeblog_newPost_doc = "Adds a new item to the given blog. Adds it as a draft when publish is false";
function f_metaWeblog_newPost($m) {
global $manager;
$blogid = _getScalar($m,0);
$username = _getScalar($m,1);
$password = _getScalar($m,2);
$struct = $m->getParam(3);
$content = _getStructVal($struct, 'description');
$more = _getStructVal($struct, 'mt_text_more');
$title = _getStructVal($struct, 'title');
// category is optional (thus: be careful)!
$catlist = $struct->structmem('categories');
if ($catlist && ($catlist->kindOf() == "array") && ($catlist->arraysize() > 0))
$category = _getArrayVal($catlist, 0);
$comments = (int) _getStructVal($struct, 'mt_allow_comments') ? 0 : 1;
$publish = _getScalar($m,4);
// Add item
$res = _addItem($blogid, $username, $password, $title, $content, $more, $publish, $comments, $category);
// Handle trackbacks
$trackbacks = array();
$tblist = $struct->structmem('mt_tb_ping_urls');
if ($tblist && ($tblist->kindOf() == "array") && ($tblist->arraysize() > 0)) {
for ($i = 0; $i < $tblist->arraysize(); $i++) {
$trackbacks[] = _getArrayVal($tblist, $i);
}
$manager->notify('SendTrackback', array ('tb_id' => $itemid, 'urls' => & $trackbacks));
}
return $res;
}
// metaWeblog.getCategories
$f_metaWeblog_getCategories_sig = array(array(
// return
$xmlrpcStruct, // categories for blog
// params
$xmlrpcString, // blogid
$xmlrpcString, // username
$xmlrpcString, // password
));
$f_metaWeblog_getCategories_doc = "Returns the categories for a given blog";
function f_metaWeblog_getCategories($m) {
$blogid = _getScalar($m,0);
$username = _getScalar($m,1);
$password = _getScalar($m,2);
return _categoryList($blogid, $username, $password);
}
// metaWeblog.getPost
$f_metaWeblog_getPost_sig = array(array(
// return
$xmlrpcStruct, // the juice
// params
$xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString, // password
));
$f_metaWeblog_getPost_doc = "Retrieves a post";
function f_metaWeblog_getPost($m) {
$itemid = _getScalar($m,0);
$username = _getScalar($m,1);
$password = _getScalar($m,2);
return _mw_getPost($itemid, $username, $password);
}
// metaWeblog.editPost
$f_metaWeblog_editPost_sig = array(array(
// return type
$xmlrpcBoolean, // true
// params:
$
xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString, // password
$xmlrpcStruct, // content
$xmlrpcBoolean, // publish boolean (set to false to create draft)
));
$f_metaWeblog_editPost_doc = "Edits an item";
function f_metaWeblog_editPost($m) {
global $manager;
$itemid = _getScalar($m,0);
$username = _getScalar($m,1);
$pass
word = _getScalar($m,2);
$category = '';
$struct = $m->getParam(3);
$content = _getStructVal($struct, 'description');
$title = _getStructVal($struct, 'title');
// category is optional (thus: be careful)!
$catlist = $struct->structmem('categories');
if ($catlist && ($catlist->kindOf() == "array") && ($catlist->arraysize() > 0)) {
$category = _getArrayVal($catlist, 0);
}
$publish = _getScalar($m,4);
// get old title and extended part
if (!$manager->existsItem($itemid,1,1))
r