wp-to-red: now supports editing, titles, and native permalinks
This commit is contained in:
parent
41e9d0f0f9
commit
cbe096dd90
13
mod/item.php
13
mod/item.php
@ -77,6 +77,8 @@ function item_post(&$a) {
|
|||||||
$webpage = ((x($_REQUEST,'webpage')) ? intval($_REQUEST['webpage']) : 0);
|
$webpage = ((x($_REQUEST,'webpage')) ? intval($_REQUEST['webpage']) : 0);
|
||||||
$pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : '');
|
$pagetitle = ((x($_REQUEST,'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : '');
|
||||||
$layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): '');
|
$layout_mid = ((x($_REQUEST,'layout_mid')) ? escape_tags($_REQUEST['layout_mid']): '');
|
||||||
|
$plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check service class limits
|
Check service class limits
|
||||||
*/
|
*/
|
||||||
@ -196,6 +198,16 @@ function item_post(&$a) {
|
|||||||
|
|
||||||
$orig_post = null;
|
$orig_post = null;
|
||||||
|
|
||||||
|
if($namespace && $remote_id) {
|
||||||
|
// It wasn't an internally generated post - see if we've got an item matching this remote service id
|
||||||
|
$i = q("select iid from item_id where service = '%s' and sid = '%s' limit 1",
|
||||||
|
dbesc($namespace),
|
||||||
|
dbesc($remote_id)
|
||||||
|
);
|
||||||
|
if($i)
|
||||||
|
$post_id = $i[0]['iid'];
|
||||||
|
}
|
||||||
|
|
||||||
if($post_id) {
|
if($post_id) {
|
||||||
$i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
$i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||||
intval($profile_uid),
|
intval($profile_uid),
|
||||||
@ -616,6 +628,7 @@ function item_post(&$a) {
|
|||||||
$datarray['layout_mid'] = $layout_mid;
|
$datarray['layout_mid'] = $layout_mid;
|
||||||
$datarray['comment_policy'] = map_scope($channel['channel_w_comment']);
|
$datarray['comment_policy'] = map_scope($channel['channel_w_comment']);
|
||||||
$datarray['term'] = $post_tags;
|
$datarray['term'] = $post_tags;
|
||||||
|
$datarray['plink'] = $plink;
|
||||||
|
|
||||||
// preview mode - prepare the body for display and send it via json
|
// preview mode - prepare the body for display and send it via json
|
||||||
|
|
||||||
|
@ -91,8 +91,6 @@ function post_to_red_post($post_id) {
|
|||||||
|
|
||||||
$message = $post->post_title . "<br /><br />" . $message;
|
$message = $post->post_title . "<br /><br />" . $message;
|
||||||
|
|
||||||
$message .= "<br /><br />permalink: " . $post->guid;
|
|
||||||
|
|
||||||
if (isset($tag_string)) {
|
if (isset($tag_string)) {
|
||||||
$message .= "<br />$tag_string";
|
$message .= "<br />$tag_string";
|
||||||
}
|
}
|
||||||
@ -104,7 +102,14 @@ function post_to_red_post($post_id) {
|
|||||||
|
|
||||||
|
|
||||||
$headers = array('Authorization' => 'Basic '.base64_encode("$user_name:$password"));
|
$headers = array('Authorization' => 'Basic '.base64_encode("$user_name:$password"));
|
||||||
$body = array('status' => $bbcode,'source' => 'WordPress', 'namespace' => $message_namespace, 'remote_id' => $message_id);
|
$body = array(
|
||||||
|
'title' => xpost_to_html2bbcode($post->post_title),
|
||||||
|
'status' => $bbcode,
|
||||||
|
'source' => 'WordPress',
|
||||||
|
'namespace' => 'wordpress',
|
||||||
|
'remote_id' => $message_id,
|
||||||
|
'permalink' => $post->guid;
|
||||||
|
);
|
||||||
if($channel)
|
if($channel)
|
||||||
$body['channel'] = $channel;
|
$body['channel'] = $channel;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user