RSS Post Importer - Version 2.1.5

Version Description

Download this release

Release Info

Developer koralyne
Plugin Icon 128x128 RSS Post Importer
Version 2.1.5
Comparing to
See all releases

Code changes from version 2.1.4 to 2.1.5

app/assets/font/fontawesome-webfont.eot CHANGED
File without changes
app/assets/font/fontawesome-webfont.svg CHANGED
File without changes
app/assets/font/fontawesome-webfont.ttf CHANGED
File without changes
app/assets/font/fontawesome-webfont.woff CHANGED
File without changes
app/classes/admin/class-rss-pi-admin-processor.php CHANGED
@@ -238,6 +238,8 @@ class rssPIAdminProcessor {
238
  * @return array
239
  */
240
  private function process_feeds($ids) {
 
 
241
 
242
  $feeds = array();
243
 
@@ -253,6 +255,7 @@ class rssPIAdminProcessor {
253
  if (!empty($keyword_str)) {
254
  $keywords = explode(',', $keyword_str);
255
  }
 
256
  }
257
  array_push($feeds, array(
258
  'id' => $id,
@@ -323,13 +326,19 @@ class rssPIAdminProcessor {
323
 
324
  // set up keywords (otherwise don't)
325
  if (isset($_POST['keyword_filter']))
326
- $keyword_str = $_POST['keyword_filter'];
 
 
327
 
328
  $keywords = array();
329
 
330
  if (!empty($keyword_str)) {
331
  $keywords = explode(',', $keyword_str);
332
  }
 
 
 
 
333
  $settings['keywords'] = array_map('trim',$keywords);
334
 
335
  // set up "import deleted posts" (otherwise don't)
238
  * @return array
239
  */
240
  private function process_feeds($ids) {
241
+
242
+
243
 
244
  $feeds = array();
245
 
255
  if (!empty($keyword_str)) {
256
  $keywords = explode(',', $keyword_str);
257
  }
258
+
259
  }
260
  array_push($feeds, array(
261
  'id' => $id,
326
 
327
  // set up keywords (otherwise don't)
328
  if (isset($_POST['keyword_filter']))
329
+
330
+ $keyword_str = $_POST['keyword_filter'];
331
+
332
 
333
  $keywords = array();
334
 
335
  if (!empty($keyword_str)) {
336
  $keywords = explode(',', $keyword_str);
337
  }
338
+ $keywords;
339
+
340
+
341
+
342
  $settings['keywords'] = array_map('trim',$keywords);
343
 
344
  // set up "import deleted posts" (otherwise don't)
app/classes/helpers/rss-pi-functions.php CHANGED
@@ -27,3 +27,4 @@ if (!function_exists('array_intersect_key'))
27
  return $isec;
28
  }
29
  }
 
27
  return $isec;
28
  }
29
  }
30
+
app/classes/import/class-rss-pi-engine.php CHANGED
@@ -51,7 +51,7 @@ class rssPIEngine {
51
  */
52
  public function import_feed() {
53
  global $rss_post_importer;
54
-
55
  $this->load_options();
56
 
57
  $post_count = 0;
@@ -127,7 +127,9 @@ class rssPIEngine {
127
  * @return array
128
  */
129
  public function do_import($f) {
130
-
 
 
131
  $args = array(
132
  'feed_title' => $f['name'],
133
  'max_posts' => $f['max_posts'],
@@ -175,7 +177,8 @@ class rssPIEngine {
175
 
176
  // fetch the feed
177
  $feed = fetch_feed($url);
178
-
 
179
  if (is_wp_error($feed)) {
180
  return false;
181
  }
@@ -223,7 +226,10 @@ class rssPIEngine {
223
  // if we are saving
224
  if ($args['save_to_db']) {
225
  // insert and return
 
226
  $saved_posts = $this->insert($feed_items, $args);
 
 
227
  return $saved_posts;
228
  }
229
 
@@ -241,6 +247,7 @@ class rssPIEngine {
241
  private function filter($feed, $args) {
242
 
243
  // the count of keyword matched items
 
244
  $got = 0;
245
 
246
  // the current index of the items aray
@@ -261,6 +268,9 @@ class rssPIEngine {
261
  // else be in a forever loop
262
  // get the content
263
  $content = $feed_item[0]->get_content();
 
 
 
264
 
265
  // test it against the keywords
266
  $tested = $this->test($content,$args['keywords']);
@@ -343,15 +353,16 @@ class rssPIEngine {
343
  private function insert($items, $args = array()) {
344
 
345
  $saved_posts = array();
346
-
347
  // Initialise the content parser
348
  $parser = new rssPIParser($this->options);
349
 
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 ) {
@@ -375,6 +386,8 @@ class rssPIEngine {
375
  'comment_status' => $this->options['settings']['allow_comments'],
376
  'post_date' => get_date_from_gmt($item->get_date('Y-m-d H:i:s'))
377
  );
 
 
378
 
379
  // catch base url and replace any img src with it
380
  if (preg_match('/src="\//ui', $content)) {
@@ -398,6 +411,9 @@ class rssPIEngine {
398
  }
399
 
400
  // insert as post
 
 
 
401
  $post_id = $this->_insert($post, $item->get_permalink());
402
 
403
  // set thumbnail
@@ -453,6 +469,7 @@ class rssPIEngine {
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);
@@ -461,7 +478,8 @@ class rssPIEngine {
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
  }
@@ -492,7 +510,7 @@ class rssPIEngine {
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 {
@@ -503,7 +521,12 @@ class rssPIEngine {
503
  }
504
  }
505
  }
506
-
 
 
 
 
 
507
  return $post_exists;
508
  }
509
 
@@ -537,7 +560,7 @@ class rssPIEngine {
537
  }
538
 
539
  $_post = apply_filters('pre_rss_pi_insert_post', $post);
540
-
541
  $post_id = wp_insert_post($_post);
542
 
543
  add_action('save_rss_pi_post', $post_id);
51
  */
52
  public function import_feed() {
53
  global $rss_post_importer;
54
+
55
  $this->load_options();
56
 
57
  $post_count = 0;
127
  * @return array
128
  */
129
  public function do_import($f) {
130
+
131
+
132
+
133
  $args = array(
134
  'feed_title' => $f['name'],
135
  'max_posts' => $f['max_posts'],
177
 
178
  // fetch the feed
179
  $feed = fetch_feed($url);
180
+
181
+
182
  if (is_wp_error($feed)) {
183
  return false;
184
  }
226
  // if we are saving
227
  if ($args['save_to_db']) {
228
  // insert and return
229
+
230
  $saved_posts = $this->insert($feed_items, $args);
231
+
232
+
233
  return $saved_posts;
234
  }
235
 
247
  private function filter($feed, $args) {
248
 
249
  // the count of keyword matched items
250
+
251
  $got = 0;
252
 
253
  // the current index of the items aray
268
  // else be in a forever loop
269
  // get the content
270
  $content = $feed_item[0]->get_content();
271
+
272
+
273
+
274
 
275
  // test it against the keywords
276
  $tested = $this->test($content,$args['keywords']);
353
  private function insert($items, $args = array()) {
354
 
355
  $saved_posts = array();
356
+
357
  // Initialise the content parser
358
  $parser = new rssPIParser($this->options);
359
 
360
  // Featured Image setter
361
  $thumbnail = new rssPIFeaturedImage();
362
+
363
  foreach ( $items as $item ) {
364
  if ( ! $this->post_exists($item) ) {
365
+
366
  /* Code to convert tags id array to tag name array * */
367
  if ( ! empty($args['tags_id']) ) {
368
  foreach ( $args['tags_id'] as $tagid ) {
386
  'comment_status' => $this->options['settings']['allow_comments'],
387
  'post_date' => get_date_from_gmt($item->get_date('Y-m-d H:i:s'))
388
  );
389
+
390
+
391
 
392
  // catch base url and replace any img src with it
393
  if (preg_match('/src="\//ui', $content)) {
411
  }
412
 
413
  // insert as post
414
+
415
+
416
+
417
  $post_id = $this->_insert($post, $item->get_permalink());
418
 
419
  // set thumbnail
469
  // strip any params from the URL
470
  $permalink_new = $permalink;
471
  $permalink_new = explode('?',$permalink_new);
472
+
473
  $permalink_new = $permalink_new[0];
474
  // calculate new md5 hash
475
  $permalink_md5_new = md5($permalink_new);
478
  if ( isset($this->options['upgraded']['deleted_posts']) ) { // database migrated
479
  // check if there is post with this source URL that is not trashed
480
  // $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');
481
+ $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) AND pm.post_id = p.ID AND p.post_status <> 'trash'", $permalink_md5), 'ARRAY_A');
482
+ //echo $wpdb->last_query;
483
  if ( count($posts) ) {
484
  $post_exists = TRUE;
485
  }
510
  // check if the post has been imported and then deleted
511
  if ( $this->options['upgraded']['deleted_posts'] ) { // database migrated
512
  $rss_pi_deleted_posts = get_option( 'rss_pi_deleted_posts', array() );
513
+ if ( in_array( $permalink_md5, $rss_pi_deleted_posts )) {
514
  $post_exists = TRUE;
515
  }
516
  } else {
521
  }
522
  }
523
  }
524
+ /* if($post_exists==true){
525
+
526
+ echo "1";
527
+ }else{
528
+ echo "0";
529
+ }*/
530
  return $post_exists;
531
  }
532
 
560
  }
561
 
562
  $_post = apply_filters('pre_rss_pi_insert_post', $post);
563
+
564
  $post_id = wp_insert_post($_post);
565
 
566
  add_action('save_rss_pi_post', $post_id);
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.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,7 +27,7 @@ if (!defined('RSS_PI_BASENAME')) {
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')) {
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.5
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.5');
31
  }
32
 
33
  if (!defined('RSS_PI_LOG_PATH')) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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
 
@@ -124,6 +124,11 @@ Learn more (and get detailed instructions) in our [contribute guide](http://jetp
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
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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
124
 
125
  == Change Log ==
126
 
127
+ = Version 2.1.5 =
128
+ * Duplicate Post protection issue fixed
129
+ * RegEx filter bug fixed
130
+ * More Bug fixes and Stress-Test
131
+
132
  = Version 2.1.4 =
133
  * Possible duplicate post issue
134
  * Some encoding and structure issues with OPML Export/Import