WSP-62
This commit is contained in:
68
autoload.php
68
autoload.php
@@ -68,40 +68,6 @@ if ($obj['type'] == 'text') {
|
|||||||
$category = $settings['category'];
|
$category = $settings['category'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync = $wpdb->get_row("SELECT post_id FROM " . $wpdb->prefix . DB_TABLE_SYNC_POST . " WHERE guid = '" . $guid . "'");
|
|
||||||
|
|
||||||
if ($sync) {
|
|
||||||
$post_ID = $sync->post_id;
|
|
||||||
$edit_post = array(
|
|
||||||
'ID' => $sync->post_id,
|
|
||||||
'post_title' => wp_strip_all_tags($obj['headline']),
|
|
||||||
'post_name' => wp_strip_all_tags($obj['headline']),
|
|
||||||
'post_content' => $content,
|
|
||||||
'post_content_filtered' => $content,
|
|
||||||
'post_category' => $category
|
|
||||||
);
|
|
||||||
|
|
||||||
wp_update_post($edit_post);
|
|
||||||
|
|
||||||
$attachmentExist = get_post_thumbnail_id($post_ID);
|
|
||||||
|
|
||||||
if ($attachmentExist) {
|
|
||||||
wp_delete_attachment($attachmentExist);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($taxonomyTag && !empty($taxonomyTag)) {
|
|
||||||
wp_set_post_tags($post_ID, $taxonomyTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
$wpdb->insert(
|
|
||||||
$wpdb->prefix . DB_TABLE_SYNC_POST, array(
|
|
||||||
'post_id' => $post_ID,
|
|
||||||
'guid' => wp_strip_all_tags($obj['guid']),
|
|
||||||
'time' => current_time('mysql')
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if ($settings['author-byline'] && $settings['author-byline'] == 'on') {
|
if ($settings['author-byline'] && $settings['author-byline'] == 'on') {
|
||||||
$author_name = $obj['byline'];
|
$author_name = $obj['byline'];
|
||||||
if (!empty(trim($settings['byline-words']))) {
|
if (!empty(trim($settings['byline-words']))) {
|
||||||
@@ -132,10 +98,40 @@ if ($obj['type'] == 'text') {
|
|||||||
$author_id = 0;
|
$author_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if ($settings['convert-keywords'] && $settings['convert-keywords'] == 'on') {
|
$sync = $wpdb->get_row("SELECT post_id FROM " . $wpdb->prefix . DB_TABLE_SYNC_POST . " WHERE guid = '" . $guid . "'");
|
||||||
|
|
||||||
} */
|
if ($sync) {
|
||||||
|
$post_ID = $sync->post_id;
|
||||||
|
$edit_post = array(
|
||||||
|
'ID' => $sync->post_id,
|
||||||
|
'post_title' => wp_strip_all_tags($obj['headline']),
|
||||||
|
'post_name' => wp_strip_all_tags($obj['headline']),
|
||||||
|
'post_content' => $content,
|
||||||
|
'post_author' => (int) $author_id,
|
||||||
|
'post_content_filtered' => $content,
|
||||||
|
'post_category' => $category
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_update_post($edit_post);
|
||||||
|
|
||||||
|
$attachmentExist = get_post_thumbnail_id($post_ID);
|
||||||
|
|
||||||
|
if ($attachmentExist) {
|
||||||
|
wp_delete_attachment($attachmentExist);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($taxonomyTag && !empty($taxonomyTag)) {
|
||||||
|
wp_set_post_tags($post_ID, $taxonomyTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
$wpdb->insert(
|
||||||
|
$wpdb->prefix . DB_TABLE_SYNC_POST, array(
|
||||||
|
'post_id' => $post_ID,
|
||||||
|
'guid' => wp_strip_all_tags($obj['guid']),
|
||||||
|
'time' => current_time('mysql')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
$postarr = array(
|
$postarr = array(
|
||||||
'post_title' => wp_strip_all_tags($obj['headline']),
|
'post_title' => wp_strip_all_tags($obj['headline']),
|
||||||
'post_name' => wp_strip_all_tags($obj['headline']),
|
'post_name' => wp_strip_all_tags($obj['headline']),
|
||||||
|
|||||||
Reference in New Issue
Block a user