This commit is contained in:
Filip Penkava
2017-03-17 12:39:24 +01:00
parent afefd8db93
commit 42abfe75bb

View File

@@ -27,7 +27,7 @@ if ($obj['type'] == 'text') {
}
if ($settings['import-keywords'] && $settings['import-keywords'] == 'on') {
if(isset($obj['keywords']) && count($obj['keywords']) > 0) {
if (isset($obj['keywords']) && count($obj['keywords']) > 0) {
foreach ($obj['keywords'] as $keyword) {
$taxonomyTag[] = wp_strip_all_tags($keyword);
}
@@ -68,40 +68,6 @@ if ($obj['type'] == 'text') {
$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') {
$author_name = $obj['byline'];
if (!empty(trim($settings['byline-words']))) {
@@ -132,10 +98,40 @@ if ($obj['type'] == 'text') {
$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(
'post_title' => wp_strip_all_tags($obj['headline']),
'post_name' => wp_strip_all_tags($obj['headline']),