Version Description
Download this release
Release Info
Developer | koralyne |
Plugin | RSS Post Importer |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- app/class-rss-post-importer.php +4 -1
- app/classes/admin/class-rss-pi-opml.php +7 -1
- app/classes/import/class-rss-pi-engine.php +28 -12
- index.php +2 -2
- readme.txt +8 -2
app/class-rss-post-importer.php
CHANGED
@@ -116,8 +116,11 @@ class rssPostImporter {
|
|
116 |
$_start = microtime(TRUE);
|
117 |
// iterate through all imported posts' source URLs
|
118 |
foreach ( $rss_pi_imported_posts as $k => $source_url ) {
|
|
|
|
|
|
|
119 |
// hash the URL for storage
|
120 |
-
$source_md5 = md5($
|
121 |
// properly format the URL for comparison
|
122 |
$source_url = esc_url($source_url);
|
123 |
// skip if we already have "migrated" this item
|
116 |
$_start = microtime(TRUE);
|
117 |
// iterate through all imported posts' source URLs
|
118 |
foreach ( $rss_pi_imported_posts as $k => $source_url ) {
|
119 |
+
// strip any params from the URL
|
120 |
+
$_source_url = explode('?',$source_url);
|
121 |
+
$_source_url = $_source_url[0];
|
122 |
// hash the URL for storage
|
123 |
+
$source_md5 = md5($_source_url);
|
124 |
// properly format the URL for comparison
|
125 |
$source_url = esc_url($source_url);
|
126 |
// skip if we already have "migrated" this item
|
app/classes/admin/class-rss-pi-opml.php
CHANGED
@@ -69,9 +69,14 @@ if (!class_exists("Rss_pi_opml")) {
|
|
69 |
|
70 |
$file = $_FILES['import_opml']['tmp_name'];
|
71 |
$opml = file_get_contents($file);
|
72 |
-
$opml = new OPMLParser($opml);
|
73 |
@unlink($file);
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
$feeds = $this->_parse_data( $opml->data, $feeds );
|
76 |
$this->options['feeds'] = $feeds;
|
77 |
|
@@ -208,6 +213,7 @@ if (!class_exists("Rss_pi_opml")) {
|
|
208 |
// disposition / encoding on response body
|
209 |
header("Content-Disposition: attachment;filename={$filename}");
|
210 |
header("Content-Transfer-Encoding: binary");
|
|
|
211 |
|
212 |
}
|
213 |
|
69 |
|
70 |
$file = $_FILES['import_opml']['tmp_name'];
|
71 |
$opml = file_get_contents($file);
|
|
|
72 |
@unlink($file);
|
73 |
|
74 |
+
// apply some validation fixes:
|
75 |
+
// - & -> &
|
76 |
+
$opml = preg_replace( '/(&(?!amp;))/', '&', $opml );
|
77 |
+
|
78 |
+
$opml = new OPMLParser($opml);
|
79 |
+
|
80 |
$feeds = $this->_parse_data( $opml->data, $feeds );
|
81 |
$this->options['feeds'] = $feeds;
|
82 |
|
213 |
// disposition / encoding on response body
|
214 |
header("Content-Disposition: attachment;filename={$filename}");
|
215 |
header("Content-Transfer-Encoding: binary");
|
216 |
+
header("Content-type: text/html;charset=utf-8");
|
217 |
|
218 |
}
|
219 |
|
app/classes/import/class-rss-pi-engine.php
CHANGED
@@ -199,7 +199,8 @@ class rssPIEngine {
|
|
199 |
//if api key has been saved by user and is not empty
|
200 |
if (isset($key) && !empty($key)) {
|
201 |
|
202 |
-
$api_url = 'http://176.58.108.28/fetch.php?key=' . $key . '&url=' . $url;
|
|
|
203 |
|
204 |
return $api_url;
|
205 |
}
|
@@ -349,11 +350,11 @@ class rssPIEngine {
|
|
349 |
// Featured Image setter
|
350 |
$thumbnail = new rssPIFeaturedImage();
|
351 |
|
352 |
-
foreach ($items as $item) {
|
353 |
-
if (
|
354 |
/* Code to convert tags id array to tag name array * */
|
355 |
-
if (!empty($args['tags_id'])) {
|
356 |
-
foreach ($args['tags_id'] as $tagid) {
|
357 |
$tag_name = get_tag($tagid); // <-- your tag ID
|
358 |
$tags_name[] = $tag_name->name;
|
359 |
}
|
@@ -444,21 +445,30 @@ class rssPIEngine {
|
|
444 |
* @return boolean
|
445 |
*/
|
446 |
private function post_exists($item) {
|
447 |
-
|
448 |
global $wpdb;
|
|
|
449 |
$permalink = $item->get_permalink();
|
|
|
450 |
$permalink_md5 = md5($permalink);
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
$post_exists = FALSE;
|
452 |
|
453 |
if ( isset($this->options['upgraded']['deleted_posts']) ) { // database migrated
|
454 |
-
// check if there is
|
455 |
// $posts = $wpdb->get_results( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key = 'rss_pi_source_md5' and meta_value = %s", $permalink_md5 ), 'ARRAY_A');
|
456 |
-
$posts = $wpdb->get_results( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->postmeta} pm, {$wpdb->posts} p WHERE pm.meta_key = 'rss_pi_source_md5'
|
457 |
if ( count($posts) ) {
|
458 |
$post_exists = TRUE;
|
459 |
}
|
460 |
-
}
|
461 |
-
|
|
|
|
|
462 |
$title = $item->get_title();
|
463 |
$domain_old = $this->get_domain($permalink);
|
464 |
|
@@ -482,7 +492,7 @@ class rssPIEngine {
|
|
482 |
// check if the post has been imported and then deleted
|
483 |
if ( $this->options['upgraded']['deleted_posts'] ) { // database migrated
|
484 |
$rss_pi_deleted_posts = get_option( 'rss_pi_deleted_posts', array() );
|
485 |
-
if ( in_array( $permalink_md5, $rss_pi_deleted_posts ) ) {
|
486 |
$post_exists = TRUE;
|
487 |
}
|
488 |
} else {
|
@@ -532,7 +542,13 @@ class rssPIEngine {
|
|
532 |
|
533 |
add_action('save_rss_pi_post', $post_id);
|
534 |
|
535 |
-
$url_md5 = md5($url);
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
update_post_meta($post_id, 'rss_pi_source_url', esc_url($url));
|
537 |
update_post_meta($post_id, 'rss_pi_source_md5', $url_md5);
|
538 |
|
199 |
//if api key has been saved by user and is not empty
|
200 |
if (isset($key) && !empty($key)) {
|
201 |
|
202 |
+
// $api_url = 'http://176.58.108.28/fetch.php?key=' . $key . '&url=' . $url;
|
203 |
+
$api_url = 'http://176.58.108.28/fetch.php?key=' . $key . '&url=' . urlencode($url);
|
204 |
|
205 |
return $api_url;
|
206 |
}
|
350 |
// Featured Image setter
|
351 |
$thumbnail = new rssPIFeaturedImage();
|
352 |
|
353 |
+
foreach ( $items as $item ) {
|
354 |
+
if ( ! $this->post_exists($item) ) {
|
355 |
/* Code to convert tags id array to tag name array * */
|
356 |
+
if ( ! empty($args['tags_id']) ) {
|
357 |
+
foreach ( $args['tags_id'] as $tagid ) {
|
358 |
$tag_name = get_tag($tagid); // <-- your tag ID
|
359 |
$tags_name[] = $tag_name->name;
|
360 |
}
|
445 |
* @return boolean
|
446 |
*/
|
447 |
private function post_exists($item) {
|
|
|
448 |
global $wpdb;
|
449 |
+
|
450 |
$permalink = $item->get_permalink();
|
451 |
+
// calculate md5 hash
|
452 |
$permalink_md5 = md5($permalink);
|
453 |
+
// strip any params from the URL
|
454 |
+
$permalink_new = $permalink;
|
455 |
+
$permalink_new = explode('?',$permalink_new);
|
456 |
+
$permalink_new = $permalink_new[0];
|
457 |
+
// calculate new md5 hash
|
458 |
+
$permalink_md5_new = md5($permalink_new);
|
459 |
$post_exists = FALSE;
|
460 |
|
461 |
if ( isset($this->options['upgraded']['deleted_posts']) ) { // database migrated
|
462 |
+
// check if there is post with this source URL that is not trashed
|
463 |
// $posts = $wpdb->get_results( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key = 'rss_pi_source_md5' and meta_value = %s", $permalink_md5 ), 'ARRAY_A');
|
464 |
+
$posts = $wpdb->get_results( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->postmeta} pm, {$wpdb->posts} p WHERE pm.meta_key = 'rss_pi_source_md5' AND ( pm.meta_value = %s OR pm.meta_value = %s ) AND pm.post_id = p.ID AND p.post_status <> 'trash'", $permalink_md5, $permalink_md5_new ), 'ARRAY_A');
|
465 |
if ( count($posts) ) {
|
466 |
$post_exists = TRUE;
|
467 |
}
|
468 |
+
}
|
469 |
+
// } else {
|
470 |
+
if ( ! $post_exists ) {
|
471 |
+
// do it the old fashion way -> check for post title and source domain
|
472 |
$title = $item->get_title();
|
473 |
$domain_old = $this->get_domain($permalink);
|
474 |
|
492 |
// check if the post has been imported and then deleted
|
493 |
if ( $this->options['upgraded']['deleted_posts'] ) { // database migrated
|
494 |
$rss_pi_deleted_posts = get_option( 'rss_pi_deleted_posts', array() );
|
495 |
+
if ( in_array( $permalink_md5, $rss_pi_deleted_posts ) || in_array( $permalink_md5_new, $rss_pi_deleted_posts ) ) {
|
496 |
$post_exists = TRUE;
|
497 |
}
|
498 |
} else {
|
542 |
|
543 |
add_action('save_rss_pi_post', $post_id);
|
544 |
|
545 |
+
// $url_md5 = md5($url);
|
546 |
+
// strip any params from the URL
|
547 |
+
$url_new = $url;
|
548 |
+
$url_new = explode('?',$url_new);
|
549 |
+
$url_new = $url_new[0];
|
550 |
+
// calculate new md5 hash
|
551 |
+
$url_md5 = md5($url_new);
|
552 |
update_post_meta($post_id, 'rss_pi_source_url', esc_url($url));
|
553 |
update_post_meta($post_id, 'rss_pi_source_md5', $url_md5);
|
554 |
|
index.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Plugin URI: https://wordpress.org/plugins/rss-post-importer/
|
6 |
Description: This plugin lets you set up an import posts from one or several rss-feeds and save them as posts on your site, simple and flexible.
|
7 |
Author: feedsapi
|
8 |
-
Version: 2.1.
|
9 |
Author URI: https://www.feedsapi.org/
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -27,7 +27,7 @@ if (!defined('RSS_PI_BASENAME')) {
|
|
27 |
}
|
28 |
|
29 |
if (!defined('RSS_PI_VERSION')) {
|
30 |
-
define('RSS_PI_VERSION', '2.1.
|
31 |
}
|
32 |
|
33 |
if (!defined('RSS_PI_LOG_PATH')) {
|
5 |
Plugin URI: https://wordpress.org/plugins/rss-post-importer/
|
6 |
Description: This plugin lets you set up an import posts from one or several rss-feeds and save them as posts on your site, simple and flexible.
|
7 |
Author: feedsapi
|
8 |
+
Version: 2.1.4
|
9 |
Author URI: https://www.feedsapi.org/
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
27 |
}
|
28 |
|
29 |
if (!defined('RSS_PI_VERSION')) {
|
30 |
+
define('RSS_PI_VERSION', '2.1.4');
|
31 |
}
|
32 |
|
33 |
if (!defined('RSS_PI_LOG_PATH')) {
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: feedsapi
|
|
3 |
Donate link: https://www.feedsapi.org/
|
4 |
Tags: rss, feeds, import, feed, autoblog, feed aggregation, rss-feed, aggregation, atom, feed, rss, syndication, FeedWordPress, autoblog aggregator, Autoblogger, autoblogging, feed import, rss multi importer, feed reader, feed to post, multi feed import, multi feed importer, multi import, multi rss feeds, multiple feed import, multiple feeds, multiple rss feeds, rss, rss aggregator, rss feader, RSS import, rss to post, content curation, RSS Retriever, RSS fetch feed, WP RSS Aggregator, AutoPost, RSS Feed to Post, RSSImport, yahoo pipes, WP Pipes, Import XML feed , FeedSyndicate, RSSpost, RSS in Page
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to: 4.2.
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -59,6 +59,7 @@ Not only does this WordPress RSS Aggregator Plugin import a snippet of the rss f
|
|
59 |
* Assign Imported Posts to as many Tags as you want , the sky is the limit.
|
60 |
* Assign Imported Post to as many categories as you want , the sky is the limit.
|
61 |
* Export/import your Feeds and setting as CSV File.
|
|
|
62 |
* Disable Banner for a valid Full Text RSS Key
|
63 |
* Purge Deleted Posts from the Memory to re-import old posts
|
64 |
* Option to re-import the same articles several times and disable the protection
|
@@ -123,6 +124,11 @@ Learn more (and get detailed instructions) in our [contribute guide](http://jetp
|
|
123 |
|
124 |
== Change Log ==
|
125 |
|
|
|
|
|
|
|
|
|
|
|
126 |
= Version 2.1.3 =
|
127 |
* Template item inline_image to insert Featured image inline into post
|
128 |
* Import/Export Feeds + Feeds' Settings as OPML file
|
3 |
Donate link: https://www.feedsapi.org/
|
4 |
Tags: rss, feeds, import, feed, autoblog, feed aggregation, rss-feed, aggregation, atom, feed, rss, syndication, FeedWordPress, autoblog aggregator, Autoblogger, autoblogging, feed import, rss multi importer, feed reader, feed to post, multi feed import, multi feed importer, multi import, multi rss feeds, multiple feed import, multiple feeds, multiple rss feeds, rss, rss aggregator, rss feader, RSS import, rss to post, content curation, RSS Retriever, RSS fetch feed, WP RSS Aggregator, AutoPost, RSS Feed to Post, RSSImport, yahoo pipes, WP Pipes, Import XML feed , FeedSyndicate, RSSpost, RSS in Page
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 4.2.4
|
7 |
+
Stable tag: 2.1.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
59 |
* Assign Imported Posts to as many Tags as you want , the sky is the limit.
|
60 |
* Assign Imported Post to as many categories as you want , the sky is the limit.
|
61 |
* Export/import your Feeds and setting as CSV File.
|
62 |
+
* Import/Export Feeds + Feeds' Settings as OPML file
|
63 |
* Disable Banner for a valid Full Text RSS Key
|
64 |
* Purge Deleted Posts from the Memory to re-import old posts
|
65 |
* Option to re-import the same articles several times and disable the protection
|
124 |
|
125 |
== Change Log ==
|
126 |
|
127 |
+
= Version 2.1.4 =
|
128 |
+
* Possible duplicate post issue
|
129 |
+
* Some encoding and structure issues with OPML Export/Import
|
130 |
+
* API related issue for feed URLs with parameters
|
131 |
+
|
132 |
= Version 2.1.3 =
|
133 |
* Template item inline_image to insert Featured image inline into post
|
134 |
* Import/Export Feeds + Feeds' Settings as OPML file
|