本文整理汇总了PHP中xmlrpc_getpostcategory函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_getpostcategory函数的具体用法?PHP xmlrpc_getpostcategory怎么用?PHP xmlrpc_getpostcategory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_getpostcategory函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: blogger_editPost
/**
* Edit a post.
*
* @since 1.5.0
*
* @param array $args Method parameters.
* @return bool|IXR_Error true when done.
*/
public function blogger_editPost($args)
{
$this->escape($args);
$post_ID = (int) $args[1];
$username = $args[2];
$password = $args[3];
$content = $args[4];
$publish = $args[5];
if (!($user = $this->login($username, $password))) {
return $this->error;
}
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action('xmlrpc_call', 'blogger.editPost');
$actual_post = get_post($post_ID, ARRAY_A);
if (!$actual_post || $actual_post['post_type'] != 'post') {
return new IXR_Error(404, __('Sorry, no such post.'));
}
$this->escape($actual_post);
if (!current_user_can('edit_post', $post_ID)) {
return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
}
if ('publish' == $actual_post['post_status'] && !current_user_can('publish_posts')) {
return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
}
$postdata = array();
$postdata['ID'] = $actual_post['ID'];
$postdata['post_content'] = xmlrpc_removepostdata($content);
$postdata['post_title'] = xmlrpc_getposttitle($content);
$postdata['post_category'] = xmlrpc_getpostcategory($content);
$postdata['post_status'] = $actual_post['post_status'];
$postdata['post_excerpt'] = $actual_post['post_excerpt'];
$result = wp_update_post($postdata);
if (!$result) {
return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
}
$this->attach_uploads($actual_post['ID'], $postdata['post_content']);
/**
* Fires after a post has been successfully updated via the XML-RPC Blogger API.
*
* @since 3.4.0
*
* @param int $post_ID ID of the updated post.
* @param array $args An array of arguments for the post to edit.
*/
do_action('xmlrpc_call_success_blogger_editPost', $post_ID, $args);
return true;
}
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:55,代码来源:class-wp-xmlrpc-server.php
示例2: blogger_editPost
function blogger_editPost($args)
{
global $wpdb;
$this->escape($args);
$post_ID = (int) $args[1];
$user_login = $args[2];
$user_pass = $args[3];
$content = $args[4];
$publish = $args[5];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$actual_post = wp_get_single_post($post_ID, ARRAY_A);
if (!$actual_post) {
return new IXR_Error(404, __('Sorry, no such post.'));
}
$this->escape($actual_post);
set_current_user(0, $user_login);
if (!current_user_can('edit_post', $post_ID)) {
return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
}
extract($actual_post, EXTR_SKIP);
if ('publish' == $post_status && !current_user_can('publish_posts')) {
return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
}
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
$post_content = xmlrpc_removepostdata($content);
$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
$result = wp_update_post($postdata);
if (!$result) {
return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
}
$this->attach_uploads($ID, $post_content);
return true;
}
开发者ID:helmonaut,项目名称:owb-mirror,代码行数:36,代码来源:xmlrpc.php
示例3: blogger_editPost
/**
* Edit a post.
*
* @since 1.5.0
*
* @param array $args Method parameters.
* @return bool true when done.
*/
function blogger_editPost($args)
{
$this->escape($args);
$post_ID = (int) $args[1];
$username = $args[2];
$password = $args[3];
$content = $args[4];
$publish = $args[5];
if (!($user = $this->login($username, $password))) {
return $this->error;
}
do_action('xmlrpc_call', 'blogger.editPost');
$actual_post = get_post($post_ID, ARRAY_A);
if (!$actual_post || $actual_post['post_type'] != 'post') {
return new IXR_Error(404, __('Sorry, no such post.'));
}
$this->escape($actual_post);
if (!current_user_can('edit_post', $post_ID)) {
return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
}
extract($actual_post, EXTR_SKIP);
if ('publish' == $post_status && !current_user_can('publish_posts')) {
return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
}
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
$post_content = xmlrpc_removepostdata($content);
$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
$result = wp_update_post($postdata);
if (!$result) {
return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
}
$this->attach_uploads($ID, $post_content);
do_action('xmlrpc_call_success_blogger_editPost', $post_ID, $args);
return true;
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:44,代码来源:class-wp-xmlrpc-server.php
示例4: trim
}
}
} else {
$sql = "SELECT ID, user_level FROM {$tableusers} WHERE user_login='" . trim($user_login) . "' AND user_pass='{$user_pass}' ORDER BY ID DESC LIMIT 1";
$result = $wpdb->get_row($sql);
if (!$result) {
echo '<p><b>Wrong login or password.</b></p></div>';
continue;
}
}
$user_level = $result->user_level;
$post_author = $result->ID;
if ($user_level > 0) {
$default_category = '1';
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
if ($post_title == '') {
$post_title = $subject;
}
if ($post_category == '') {
$post_category = $default_category;
}
$content = addslashes(mb_convert_encoding(trim($content), $blog_charset, "JIS"));
if (!$emailtestonly) {
$post_title = addslashes(trim($post_title));
#If we find an attachment, add it to the post
if ($attachment) {
if (file_exists("attach/thumb-" . $temp_file)) {
$content = "<a href=\"" . $siteurl . "\\/attach\\/" . $temp_file . "\"><img style=\"float: left;\" hspace=\"6\" src = \"" . $siteurl . "\\/attach\\/thumb-" . $temp_file . "\" alt=\"moblog\" ></a>" . $content . "<br clear=left>";
} else {
$content = "<a href=\"" . $siteurl . "\\/attach\\/" . $temp_file . "\"><img style=\"float: left;\" hspace=\"6\" src = \"" . $siteurl . "\\/attach\\/" . $temp_file . "\" alt=\"moblog\" ></a>" . $content . "<br clear=left>";
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-moblog.php
示例5: wp_mail_receive
//.........这里部分代码省略.........
$flatStr = $secLineParts[0];
$flonStr = $secLineParts[1];
// echo "String are ".$flatStr.$flonStr;
$flat = floatval($secLineParts[0]);
$flon = floatval($secLineParts[1]);
// echo "values are ".$flat." and ".$flon;
// ok remove that position... we should not have it in the final output
$content = str_replace($secondline, '', $content);
}
$blah = explode(':', $userpassstring);
$user_login = $blah[0];
$user_pass = $blah[1];
$user_login = mb_conv(trim($user_login), $blog_charset, $charset);
$content = $contentfirstline . str_replace($firstline, '', $content);
$content = trim($content);
// Please uncomment following line, only if you want to check user and password.
// echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>";
if (!user_pass_ok($user_login, $user_pass)) {
echo "<p><b>Error: Wrong Login.</b></p></div>\n";
continue;
}
$userdata = get_userdatabylogin($user_login);
$user_level = $userdata->user_level;
$post_author = $userdata->ID;
if ($user_level > 0) {
$post_title = xmlrpc_getposttitle($content);
if ($post_title == '') {
$post_title = $subject;
}
echo "Subject : " . mb_conv($post_title, $blog_charset, $sub_charset) . " <br />\n";
$post_category = get_settings('default_category');
if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
$post_category = xmlrpc_getpostcategory($content);
}
if (empty($post_category)) {
$post_category = get_settings('default_post_category');
}
echo "Category : {$post_category} <br />\n";
$post_category = explode(',', $post_category);
if (!get_settings('emailtestonly')) {
// Attaching Image Files Save
if ($att_boundary != "") {
$attachment = wp_getattach($contents[2], "user-" . trim($post_author), 1);
}
if ($boundary != "" && $hatt_boundary != "") {
for ($i = 2; $i < count($contents); $i++) {
$hattachment = wp_getattach($contents[$i], "user-" . trim($post_author), 0);
if ($hattachment) {
if (preg_match("/Content-Id: \\<([^\\>]*)>/i", $contents[$i], $matches)) {
$content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", get_settings('fileupload_url') . '/' . $hattachment, $content);
}
}
}
}
if ($boundary != "") {
$content = preg_replace("/\\=[\r\n]/", "", $content);
$content = preg_replace("/[\r\n]/", " ", $content);
}
$content = preg_replace("|\n([^\n])|", " \$1", $content);
$content = preg_replace("/\\=([0-9a-fA-F]{2,2})/e", "pack('c',base_convert('\\1',16,10))", $content);
$content = mb_conv(trim($content), $blog_charset, $charset);
// If we find an attachment, add it to the post
if ($attachment) {
if (isset($img_target) && $img_target) {
$img_target = ' target="' . $img_target . '"';
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:67,代码来源:wp-mail.php
示例6: wp_mail_receive
//.........这里部分代码省略.........
// echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>";
if ($xoopsDB) {
$sql = "SELECT ID, user_level FROM {$wpdb->users[$wp_id]} WHERE user_login='{$user_login}' ORDER BY ID DESC LIMIT 1";
$result = $wpdb->get_row($sql);
if (!$result) {
echo "<p><b>Wrong Login.</b></p></div>\n";
continue;
} else {
$sql = "SELECT * FROM " . $xoopsDB->prefix('users') . " WHERE uname='{$user_login}' AND pass='" . md5(trim($user_pass)) . "' ORDER BY uid DESC LIMIT 1";
$result1 = $wpdb->get_row($sql);
if (!$result1) {
echo "<p><b>Wrong login or password.</b></p></div>\n";
continue;
}
}
} else {
$sql = "SELECT ID, user_level FROM {$wpdb->users[$wp_id]} WHERE user_login='{$user_login}' AND user_pass='{$user_pass}' ORDER BY ID DESC LIMIT 1";
$result = $wpdb->get_row($sql);
if (!$result) {
echo "<p><b>Wrong login or password.</b></p></div>\n";
continue;
}
}
$user_level = $result->user_level;
$post_author = $result->ID;
if ($user_level > 0) {
$post_title = xmlrpc_getposttitle($content);
if ($post_title == '') {
$post_title = $subject;
}
$post_category = get_settings('default_category');
if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
$post_category = xmlrpc_getpostcategory($content);
}
if ($post_category == '') {
$post_category = get_settings('default_post_category');
}
if (function_exists('mb_convert_encoding')) {
echo "Subject : " . mb_convert_encoding($subject, $blog_charset, $sub_charset) . " <br />\n";
} else {
echo "Subject : " . $subject . " <br />\n";
}
echo "Category : {$post_category} <br />\n";
if (!get_settings('emailtestonly')) {
// Attaching Image Files Save
if ($att_boundary != "") {
$attachment = wp_getattach($contents[2], trim($user_login), 1);
}
if ($boundary != "" && $hatt_boundary != "") {
for ($i = 2; $i < count($contents); $i++) {
$hattachment = wp_getattach($contents[$i], trim($user_login), 0);
if ($hattachment) {
if (preg_match("/Content-Id: \\<([^\\>]*)>/i", $contents[$i], $matches)) {
$content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", "{$siteurl}/attach/" . $hattachment, $content);
}
}
}
}
if ($boundary != "") {
$content = preg_replace("/\\=[\r\n]/", "", $content);
$content = preg_replace("/[\r\n]/", " ", $content);
}
$content = preg_replace("|\n([^\n])|", " \$1", $content);
$content = preg_replace("/\\=([0-9a-fA-F]{2,2})/e", "pack('c',base_convert('\\1',16,10))", $content);
if (function_exists('mb_convert_encoding')) {
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:67,代码来源:wp-mail.php
示例7: blogger_editPost
function blogger_editPost($args)
{
global $wpdb;
$this->escape($args);
$post_ID = $args[1];
$user_login = $args[2];
$user_pass = $args[3];
$content = $args[4];
$publish = $args[5];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$actual_post = wp_get_single_post($post_ID, ARRAY_A);
if (!$actual_post) {
return new IXR_Error(404, 'Sorry, no such post.');
}
$this->escape($actual_post);
$user = new WP_User(0, $user_login);
if (!$user->has_cap('edit_post', $post_ID)) {
return new IXR_Error(401, 'Sorry, you do not have the right to edit this post.');
}
extract($actual_post);
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
$post_content = xmlrpc_removepostdata($content);
$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
$result = wp_update_post($postdata);
if (!$result) {
return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be edited.');
}
return true;
}
开发者ID:robertlange81,项目名称:Website,代码行数:32,代码来源:xmlrpc.php
示例8: bloggereditpost
function bloggereditpost($m)
{
global $wpdb;
global $xmlrpcerruser;
// import user errcode value
global $blog_ID, $cache_userdata, $tableposts, $use_rss, $use_weblogsping, $post_autobr;
global $post_default_title, $post_default_category, $sleep_after_edit;
$err = "";
$post_ID = $m->getParam(1);
$username = $m->getParam(2);
$password = $m->getParam(3);
$newcontent = $m->getParam(4);
$publish = $m->getParam(5);
$ID = $post_ID->scalarval();
$username = $username->scalarval();
$password = $password->scalarval();
$newcontent = $newcontent->scalarval();
$post_status = $publish->scalarval() ? 'publish' : 'draft';
$result = wp_get_single_post($ID, ARRAY_A);
if (!$result) {
return new xmlrpcresp(0, $xmlrpcerruser + 2, "No such post '{$ID}'.");
}
$userdata = get_userdatabylogin($username);
$user_ID = $userdata->ID;
$user_level = $userdata->user_level;
$postdata = get_postdata($ID);
$post_authordata = get_userdata($postdata["Author_ID"]);
$post_author_ID = $postdata["Author_ID"];
if ($user_ID != $post_author_ID && $user_level <= $post_authordata->user_level) {
return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, you do not have the right to edit this post");
}
if (user_pass_ok($username, $password)) {
if ($user_level < 1) {
return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, level 0 users can not edit posts");
}
extract($result);
$content = $newcontent;
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
$content = xmlrpc_removepostdata($content);
$post_content = format_to_post($content);
$postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_date', 'post_excerpt');
$result = wp_update_post($postdata);
if (!$result) {
return new xmlrpcresp(0, $xmlrpcerruser + 2, "For some strange yet very annoying reason, the entry couldn't be edited.");
}
if (!isset($blog_ID)) {
$blog_ID = 1;
}
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
pingWeblogs($blog_ID);
return new xmlrpcresp(new xmlrpcval("1", "boolean"));
} else {
return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
}
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:58,代码来源:xmlrpc.php
示例9: bloggereditpost
function bloggereditpost($m)
{
$ID = $m->getParam(1);
$username = $m->getParam(2);
$password = $m->getParam(3);
$newcontent = $m->getParam(4);
$publish = $m->getParam(5);
$ID = intval($ID->scalarval());
$username = $username->scalarval();
$password = $password->scalarval();
$newcontent = $newcontent->scalarval();
$postarr['post_status'] = $publish->scalarval() ? 'publish' : 'draft';
if (user_pass_ok($username, $password)) {
$postdata = wp_get_single_post($ID, ARRAY_A);
if (!$postdata) {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 2, "No such post '{$ID}'.");
}
$userdata = get_userdatabylogin($username);
if ($userdata->user_level < 1) {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 1, 'Sorry, level 0 users can not edit posts');
}
if ($userdata->ID != $postdata['post_author'] && $userdata->user_level != 10) {
$authordata = get_userdata($postdata['post_author']);
if ($userdata->user_level <= $authordata->user_level) {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 1, 'Sorry, you do not have the right to edit this post');
}
}
$postarr['ID'] = $ID;
$postarr['post_title'] = xmlrpc_getposttitle($newcontent);
$postarr['post_category'] = array(xmlrpc_getpostcategory($newcontent));
$postarr['post_content'] = format_to_post(xmlrpc_removepostdata($newcontent));
$post_ID = wp_update_post($postarr);
if (!$post_ID) {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 2, 'For some strange yet very annoying reason, the entry could not be edited.');
}
if (!isset($GLOBALS['blog_ID'])) {
$GLOBALS['blog_ID'] = 1;
}
pingWeblogs($GLOBALS['blog_ID']);
return new xmlrpcresp(new xmlrpcval('1', 'boolean'));
} else {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
}
}
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:44,代码来源:xmlrpc.php
示例10: wp_mail_receive
//.........这里部分代码省略.........
$secLineParts = explode(',', $secondlineParts[1]);
$flatStr = $secLineParts[0];
$flonStr = $secLineParts[1];
// echo "String are ".$flatStr.$flonStr;
$flat = floatval($secLineParts[0]);
$flon = floatval($secLineParts[1]);
// echo "values are ".$flat." and ".$flon;
// ok remove that position... we should not have it in the final output
$content = str_replace($secondline, '', $content);
}
$blah = explode(':', $userpassstring);
$user_login = trim($blah[0]);
$user_pass = $blah[1];
$content = $contentfirstline . str_replace($firstline, '', $content);
$content = trim($content);
// Please uncomment following line, only if you want to check user and password.
// echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>";
if (!user_pass_ok($user_login, $user_pass)) {
echo "<p><b>Error: Wrong Login.</b></p></div>\n";
continue;
}
$userdata = get_userdatabylogin($user_login);
$user_level = $userdata->user_level;
$post_author = $userdata->ID;
if ($user_level > 0) {
$post_title = xmlrpc_getposttitle($content);
if ($post_title == '') {
$post_title = $subject;
}
echo "Subject : " . mb_conv($post_title, $GLOBALS['blog_charset'], $sub_charset) . " <br />\n";
$post_category = get_settings('default_category');
if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
$post_category = xmlrpc_getpostcategory($content);
$content = xmlrpc_removepostdata($content);
}
if (empty($post_category)) {
$post_category = get_settings('default_post_category');
}
echo "Category : {$post_category} <br />\n";
$post_category = explode(',', $post_category);
if (!get_settings('emailtestonly')) {
$content = preg_replace('|\\n([^\\n])|', " \$1", trim($content));
$content_before = "";
$content_after = "";
for ($i = 0; $i < count($attaches); $i++) {
$create_thumbs = $attaches[$i]['type'] == 'mix' ? 1 : 0;
list($file_name, $is_img, $orig_name) = wp_getattach($attaches[$i]['body'], "user-" . trim($post_author), $create_thumbs);
if ($file_name) {
if ($attaches[$i]['type'] == 'relate') {
$content = preg_replace("/cid:" . preg_quote($attaches[$i]['id']) . "/", get_settings('fileupload_url') . '/' . $file_name, $content);
} else {
if (isset($img_target) && $img_target) {
$img_target = ' target="' . $img_target . '"';
} else {
$img_target = '';
}
if ($is_img) {
if (file_exists(get_settings('fileupload_realpath') . "/thumb-" . $file_name)) {
$content_before .= "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($file_name) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src=\"" . get_settings('fileupload_url') . '/thumb-' . rawurlencode($file_name) . "\" alt=\"" . $orig_name . "\" title=\"" . $orig_name . "\" /></a>";
} else {
$content_before .= "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($file_name) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src=\"" . get_settings('fileupload_url') . '/' . rawurlencode($file_name) . "\" alt=\"" . $orig_name . "\" title=\"" . $orig_name . "\" /></a>";
}
} else {
$content_after .= "<a href=\"" . wp_siteurl() . "/wp-download.php?from=" . rawurlencode($file_name) . "&fname=" . urlencode($orig_name) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src=\"" . wp_siteurl() . "/wp-images/file.gif\" alt=\"" . $orig_name . "\" title=\"" . $orig_name . "\" />" . $orig_name . "</a>";
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:67,代码来源:wp-mail.php
示例11: _rs_get_posted_xmlrpc_terms
function _rs_get_posted_xmlrpc_terms($taxonomy)
{
global $wp_xmlrpc_server;
if (empty($wp_xmlrpc_server->message)) {
return array();
}
$xmlrpc_method = $GLOBALS['wp_xmlrpc_server']->message->methodName;
if (empty($GLOBALS['wp_xmlrpc_server']->message->params)) {
return array();
}
if (in_array($xmlrpc_method, array('metaWeblog.newPost', 'metaWeblog.editPost'))) {
if (!empty($GLOBALS['wp_xmlrpc_server']->message->params[3])) {
$data = $GLOBALS['wp_xmlrpc_server']->message->params[3];
if ('category' == $taxonomy) {
if (is_array($data['categories'])) {
$post_category = array();
foreach ($data['categories'] as $cat) {
$post_category[] = get_cat_ID($cat);
}
return $post_category;
}
} elseif ('post_tag' == $taxonomy) {
if (!empty($data['mt_keywords'])) {
$tags = $data['mt_keywords'];
$comma = _x(',', 'tag delimiter');
if (',' !== $comma) {
$tags = str_replace($comma, ',', $tags);
}
$tags = explode(',', trim($tags, " \n\t\r\v,"));
return $tags;
}
}
}
} elseif (in_array($xmlrpc_method, array('blogger.newPost', 'blogger.editPost'))) {
if (!empty($GLOBALS['wp_xmlrpc_server']->message->params[4])) {
$data = $GLOBALS['wp_xmlrpc_server']->message->params[4];
if ('category' == $taxonomy) {
if (function_exists('xmlrpc_getpostcategory')) {
$post_category = xmlrpc_getpostcategory($data);
return $post_category;
}
}
}
} elseif (in_array($xmlrpc_method, array('wp.newPost', 'wp.editPost'))) {
if (!empty($GLOBALS['wp_xmlrpc_server']->message->params[3])) {
$post_data = $GLOBALS['wp_xmlrpc_server']->message->params[3];
// accumulate term IDs from terms and terms_names
$terms = array();
if (isset($post_data['terms']) && is_array($post_data['terms'])) {
foreach ($post_data['terms'][$taxonomy] as $term_id) {
if ($term = get_term_by('id', $term_id, $taxonomy)) {
$terms[] = (int) $term_id;
}
}
}
if (isset($post_data['terms_names']) && is_array($post_data['terms_names'])) {
foreach ($post_data['terms_names'][$taxonomy] as $term_name) {
if ($term = get_term_by('name', $term_name, $taxonomy)) {
// term creation is outside the scope of this usage
$terms[] = (int) $term->term_id;
}
}
}
return $terms;
}
}
return array();
}
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:68,代码来源:filters-admin-xmlrpc_rs.php
示例12: bloggereditpost
function bloggereditpost($m)
{
global $xmlrpcerruser;
// import user errcode value
global $blog_ID, $cache_userdata, $tableposts, $use_rss, $use_weblogsping, $post_autobr;
global $post_default_title, $post_default_category, $sleep_after_edit;
$err = "";
dbconnect();
$post_ID = $m->getParam(1);
$username = $m->getParam(2);
$password = $m->getParam(3);
$newcontent = $m->getParam(4);
$post_ID = $post_ID->scalarval();
$username = $username->scalarval();
$password = $password->scalarval();
$newcontent = $newcontent->scalarval();
$sql = "SELECT * FROM {$tableposts} WHERE ID = '{$post_ID}'";
$result = @mysql_query($sql);
if (!$result) {
return new xmlrpcresp(0, $xmlrpcerruser + 2, "No such post.");
}
$userdata = get_userdatabylogin($username);
$user_ID = $userdata["ID"];
$user_level = $userdata["user_level"];
$postdata = get_postdata($post_ID);
$post_authordata = get_userdata($postdata["Author_ID"]);
$post_author_ID = $postdata["Author_ID"];
if ($user_ID != $post_author_ID && $user_level <= $post_authordata["user_level"]) {
return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, you do not have the right to edit this post");
}
if (user_pass_ok($username, $password)) {
if ($user_level < 1) {
return new xmlrpcresp(0, $xmlrpcerruser + 1, "Sorry, level 0 users can not edit posts");
}
$content = $newcontent;
$post_title = addslashes(xmlrpc_getposttitle($content));
$post_category = xmlrpc_getpostcategory($content);
$content = xmlrpc_removepostdata($content);
$content = format_to_post($content);
$sql = "UPDATE {$tableposts} SET post_content='{$content}', post_title='{$post_title}', post_category='{$post_category}' WHERE ID = '{$post_ID}'";
$result = mysql_query($sql);
if (!$result) {
return new xmlrpcresp(0, $xmlrpcerruser + 2, "For some strange yet very annoying reason, the entry couldn't be edited.");
}
if (!isset($blog_ID)) {
$blog_ID = 1;
}
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
rss_update($blog_ID);
pingWeblogs($blog_ID);
return new xmlrpcresp(new xmlrpcval("1", "boolean"));
} else {
return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
}
}
开发者ID:ericandrewlewis,项目名称:b2,代码行数:57,代码来源:xmlrpc.php
示例13: test_xmlrpc_getpostcategory_bad_cdate
/**
* pass cdata with tag category
*/
function test_xmlrpc_getpostcategory_bad_cdate()
{
$this->assertEquals(array('<![CDATA["<category>category'), xmlrpc_getpostcategory('<category><![CDATA["<category>category</category>"]]></category>'));
}
开发者ID:pbearne,项目名称:contrib2core,代码行数:7,代码来源:xmlrpc-getpostcatergory.php
注:本文中的xmlrpc_getpostcategory函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论