RSS Post Importer - Version 2.0.12

Version Description

Download this release

Release Info

Developer phpaddicted
Plugin Icon 128x128 RSS Post Importer
Version 2.0.12
Comparing to
See all releases

Code changes from version 2.0.11 to 2.0.12

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
@@ -74,9 +74,13 @@ class rssPIAdminProcessor {
74
 
75
  // formulate the feeds array
76
 
77
- $feeds = $this->process_feeds($ids);
 
78
 
 
79
 
 
 
80
 
81
  // save and reload the options
82
 
@@ -102,7 +106,61 @@ class rssPIAdminProcessor {
102
 
103
  }
104
 
 
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  /**
108
 
74
 
75
  // formulate the feeds array
76
 
77
+ $feeds = $this->process_feeds($ids);
78
+
79
 
80
+ // save and reload the options
81
 
82
+ $feeds = $this->import_csv($feeds);
83
+
84
 
85
  // save and reload the options
86
 
106
 
107
  }
108
 
109
+ /**
110
 
111
+ * Import CSV function to import CSV file data into database
112
+
113
+ * @return array
114
+
115
+ */
116
+
117
+ private function import_csv($feeds) {
118
+
119
+ if(is_uploaded_file($_FILES['import_csv']['tmp_name'])) {
120
+ $file = $_FILES['import_csv']['tmp_name'];
121
+ $fcount = file($file);
122
+ $linescount = count($fcount)-1;
123
+ $file_handle = fopen($file,"r");
124
+ $t=0;
125
+ $titlearray = array();
126
+ while($csv_line = fgetcsv($file_handle,1024)) {
127
+ if($t <> 0)
128
+ {
129
+
130
+ for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
131
+ if($i == 0)
132
+ $importdata['feeds'][$t-1]['id'] = uniqid("54d4c".$t);
133
+
134
+ $importdata['feeds'][$t-1][$titlearray[$i]] = $csv_line[$i];
135
+
136
+ }
137
+ }
138
+ else{
139
+ for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
140
+ $titlearray[] = $csv_line[$i];
141
+ }
142
+ }
143
+ $t++;
144
+ }
145
+ fclose($file_handle) or die("can't close file");
146
+
147
+
148
+ if(!empty($importdata['feeds']))
149
+ {
150
+ for($r=0;$r<count($importdata['feeds']);$r++)
151
+ {
152
+ $importdata['feeds'][$r]['category_id'] = array(1);
153
+ $importdata['feeds'][$r]['tags_id'] = "";
154
+ $importdata['feeds'][$r]['strip_html'] = "false";
155
+
156
+ array_push($feeds,$importdata['feeds'][$r]);
157
+
158
+ }
159
+ }
160
+ }
161
+
162
+ return $feeds;
163
+ }
164
 
165
  /**
166
 
app/classes/admin/class-rss-pi-export-to-csv.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // This include gives us all the WordPress functionality
2
+
3
+ $options = get_option('rss_pi_feeds', array());
4
+
5
+
6
+ function array2csv(array &$array)
7
+ {
8
+ if (count($array) == 0) {
9
+ return null;
10
+ }
11
+ ob_start();
12
+ $df = fopen("php://output", 'w');
13
+ $arrayhead = array_keys(reset($array));
14
+ $exclude_data = array('id','category_id','tags_id','strip_html');
15
+ $arrayhead = array_diff($arrayhead, array('id','category_id','tags_id','strip_html'));
16
+
17
+ fputcsv($df, $arrayhead);
18
+
19
+ foreach ($array as $row) {
20
+ unset($row['id']);
21
+ unset($row['category_id']);
22
+ unset($row['tags_id']);
23
+ unset($row['strip_html']);
24
+ fputcsv($df, $row);
25
+ }
26
+ fclose($df);
27
+ return ob_get_clean();
28
+ }
29
+
30
+ function download_send_headers($filename) {
31
+ // disable caching
32
+ $now = gmdate("D, d M Y H:i:s");
33
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
34
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
35
+ header("Last-Modified: {$now} GMT");
36
+
37
+ // force download
38
+ header("Content-Type: application/force-download");
39
+ header("Content-Type: application/octet-stream");
40
+ header("Content-Type: application/download");
41
+
42
+ // disposition / encoding on response body
43
+ header("Content-Disposition: attachment;filename={$filename}");
44
+ header("Content-Transfer-Encoding: binary");
45
+ }
46
+ if(isset($_POST['csv_download'])){
47
+ download_send_headers("data_export_" . date("Y-m-d") . ".csv");
48
+ echo array2csv($options['feeds']);
49
+ die();
50
+ }
51
+ /* echo "<pre>";
52
+
53
+ print_r($options);
54
+ exit;*/
55
+ ?>
app/templates/admin-ui.php CHANGED
@@ -3,7 +3,7 @@
3
 
4
  <h2><?php _e("Rss Post Importer Settings", 'rss_pi'); ?></h2>
5
 
6
- <form method="post" id="">
7
 
8
  <input type="hidden" name="save_to_db" id="save_to_db" />
9
 
3
 
4
  <h2><?php _e("Rss Post Importer Settings", 'rss_pi'); ?></h2>
5
 
6
+ <form method="post" id="" enctype="multipart/form-data">
7
 
8
  <input type="hidden" name="save_to_db" id="save_to_db" />
9
 
app/templates/settings-table.php CHANGED
@@ -199,6 +199,40 @@
199
  </td>
200
 
201
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  </table>
203
  </td>
204
  </tr>
199
  </td>
200
 
201
  </tr>
202
+ <?php
203
+ if ($this->is_key_valid) {
204
+ ?>
205
+
206
+ <tr>
207
+ <td>
208
+ <?php _e('Export and backup your Feeds and setting as CSV File', "rss_pi"); ?>
209
+ <p class="description"><?php _e('This option will help you download a csv file with all your feeds setting , you can upload it back later.', "rss_pi"); ?></p>
210
+ </td>
211
+ <td>
212
+ <input type="submit" value="Export your Feeds and Setting as CSV File" name="csv_download" class="button button-primary button-large right">
213
+ </td>
214
+
215
+ </tr>
216
+ <tr>
217
+ <td>
218
+ <?php _e('Import your CSV file with your feeds settings', "rss_pi"); ?>
219
+ <p class="description"><?php _e('Create and Import a CSV file with your Feeds Setting with the following Structure and heading:<br/>
220
+
221
+ url , name, max_posts, author_id <br/>
222
+
223
+ url = your feed url <br/>
224
+ name = the name you gives to your feed <br/>
225
+ max_posts = the number of posts to simultaneously import <br/>
226
+ author_id = your author ID , this is a number.', "rss_pi"); ?></p>
227
+ </td>
228
+ <td>
229
+ <input type="file" name="import_csv" />
230
+ </td>
231
+
232
+ </tr>
233
+ <?php
234
+ }
235
+ ?>
236
  </table>
237
  </td>
238
  </tr>
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.0.11
9
  Author URI: https://www.feedsapi.org/
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -28,7 +28,7 @@ if (!defined('RSS_PI_BASENAME')) {
28
  }
29
 
30
  if (!defined('RSS_PI_VERSION')) {
31
- define('RSS_PI_VERSION', '2.0.11');
32
  }
33
 
34
  if (!defined('RSS_PI_LOG_PATH')) {
@@ -47,6 +47,7 @@ include_once RSS_PI_PATH . 'app/classes/helpers/class-rss-pi-parser.php';
47
  // admin classes
48
  include_once RSS_PI_PATH . 'app/classes/admin/class-rss-pi-admin-processor.php';
49
  include_once RSS_PI_PATH . 'app/classes/admin/class-rss-pi-admin.php';
 
50
 
51
  // Front classes
52
  include_once RSS_PI_PATH . 'app/classes/front/class-rss-pi-front.php';
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.0.12
9
  Author URI: https://www.feedsapi.org/
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
28
  }
29
 
30
  if (!defined('RSS_PI_VERSION')) {
31
+ define('RSS_PI_VERSION', '2.0.12');
32
  }
33
 
34
  if (!defined('RSS_PI_LOG_PATH')) {
47
  // admin classes
48
  include_once RSS_PI_PATH . 'app/classes/admin/class-rss-pi-admin-processor.php';
49
  include_once RSS_PI_PATH . 'app/classes/admin/class-rss-pi-admin.php';
50
+ include_once RSS_PI_PATH . 'app/classes/admin/class-rss-pi-export-to-csv.php';
51
 
52
  // Front classes
53
  include_once RSS_PI_PATH . 'app/classes/front/class-rss-pi-front.php';
readme.txt CHANGED
@@ -12,7 +12,7 @@ Requires at least: 3.5
12
 
13
  Tested up to: 4.1
14
 
15
- Stable tag: 2.0.11
16
 
17
  License: GPLv2 or later
18
 
@@ -108,6 +108,7 @@ Not only does this WordPress RSS Aggregator Plugin import a snippet of the rss f
108
 
109
  * Assign Imported Post to as many categories as you want , the sky is the limit.
110
 
 
111
 
112
 
113
  **Don't take my word for it, here's how easy to use it is:**
@@ -162,14 +163,21 @@ WP-o-Matic , WP-o-Matic, RSSImport, FeedWordPress, Syndicate Press, FeedWeb, RSS
162
 
163
  == Change Log ==
164
 
 
 
 
 
 
165
  = Version 2.0.11 =
166
 
167
  * Changed API URL
168
 
 
169
  = Version 2.0.10 =
170
 
171
  * Added option to download images locally instead of hotlinking.
172
 
 
173
  = Version 2.0.9 =
174
 
175
  * Bug fixed and Improvements in code.
12
 
13
  Tested up to: 4.1
14
 
15
+ Stable tag: 2.0.12
16
 
17
  License: GPLv2 or later
18
 
108
 
109
  * Assign Imported Post to as many categories as you want , the sky is the limit.
110
 
111
+ * Export/import your Feeds and setting as CSV File.
112
 
113
 
114
  **Don't take my word for it, here's how easy to use it is:**
163
 
164
  == Change Log ==
165
 
166
+ = Version 2.0.12 =
167
+
168
+ * Added export/import option to backup/restore feeds and settings.
169
+
170
+
171
  = Version 2.0.11 =
172
 
173
  * Changed API URL
174
 
175
+
176
  = Version 2.0.10 =
177
 
178
  * Added option to download images locally instead of hotlinking.
179
 
180
+
181
  = Version 2.0.9 =
182
 
183
  * Bug fixed and Improvements in code.