Version Description
Download this release
Release Info
Developer | jenswaern |
Plugin | RSS Post Importer |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- lang/rss_pi-sv_SE.mo +0 -0
- lang/rss_pi-sv_SE.po +17 -4
- log.txt +0 -0
- readme.txt +11 -1
- rss_pi-ui.php +17 -1
- rss_pi.php +44 -11
lang/rss_pi-sv_SE.mo
CHANGED
Binary file
|
lang/rss_pi-sv_SE.po
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: Rss Post Importer v1.0.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
-
"PO-Revision-Date: 2013-09-09
|
7 |
"Last-Translator: admin <jens@simmalugnt.se>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -109,12 +109,12 @@ msgstr ""
|
|
109 |
msgid "Allow comments"
|
110 |
msgstr "Tillåt kommentarer"
|
111 |
|
112 |
-
#: rss_pi.php:
|
113 |
#@ default
|
114 |
msgid "Settings saved."
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: rss_pi.php:
|
118 |
#@ default
|
119 |
msgid "new posts imported."
|
120 |
msgstr ""
|
@@ -136,12 +136,14 @@ msgstr "Tillgängliga taggar:"
|
|
136 |
|
137 |
#: parts/table_row.php:63
|
138 |
#: rss_pi-ui.php:138
|
|
|
139 |
#@ default
|
140 |
msgid "Yes"
|
141 |
msgstr ""
|
142 |
|
143 |
#: parts/table_row.php:66
|
144 |
#: rss_pi-ui.php:141
|
|
|
145 |
#@ default
|
146 |
msgid "No"
|
147 |
msgstr ""
|
@@ -156,3 +158,14 @@ msgstr "Ta bort html-taggar"
|
|
156 |
msgid "Close"
|
157 |
msgstr ""
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: Rss Post Importer v1.0.2\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-09-11 09:26:25+0000\n"
|
7 |
"Last-Translator: admin <jens@simmalugnt.se>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
109 |
msgid "Allow comments"
|
110 |
msgstr "Tillåt kommentarer"
|
111 |
|
112 |
+
#: rss_pi.php:98
|
113 |
#@ default
|
114 |
msgid "Settings saved."
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: rss_pi.php:106
|
118 |
#@ default
|
119 |
msgid "new posts imported."
|
120 |
msgstr ""
|
136 |
|
137 |
#: parts/table_row.php:63
|
138 |
#: rss_pi-ui.php:138
|
139 |
+
#: rss_pi-ui.php:154
|
140 |
#@ default
|
141 |
msgid "Yes"
|
142 |
msgstr ""
|
143 |
|
144 |
#: parts/table_row.php:66
|
145 |
#: rss_pi-ui.php:141
|
146 |
+
#: rss_pi-ui.php:157
|
147 |
#@ default
|
148 |
msgid "No"
|
149 |
msgstr ""
|
158 |
msgid "Close"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: rss_pi-ui.php:148
|
162 |
+
#@ rss_pi
|
163 |
+
msgid "Enable logging?"
|
164 |
+
msgstr "Aktivera loggen?"
|
165 |
+
|
166 |
+
#: rss_pi-ui.php:149
|
167 |
+
#, php-format
|
168 |
+
#@ rss_pi
|
169 |
+
msgid "The logfile can be found <a href=\"%s\">here</a>."
|
170 |
+
msgstr "Du hittar loggfilen <a href=\"%s\">här</a>."
|
171 |
+
|
log.txt
ADDED
File without changes
|
readme.txt
CHANGED
@@ -15,6 +15,7 @@ This plugin lets you set up an import posts from one or several rss-feeds and sa
|
|
15 |
This plugin is not a shortcode for just displaying displaying a bunch of links from an rss feeds, it imports data from a feed and saves it as posts.
|
16 |
|
17 |
Features include:
|
|
|
18 |
* Importing feeds automatically using cron.
|
19 |
* Set number of posts and category per feed.
|
20 |
* Set what author to assign imported content to.
|
@@ -28,4 +29,13 @@ Features include:
|
|
28 |
|
29 |
== Screenshots ==
|
30 |
|
31 |
-
1. This is the combined settings- and feed-management-screen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
This plugin is not a shortcode for just displaying displaying a bunch of links from an rss feeds, it imports data from a feed and saves it as posts.
|
16 |
|
17 |
Features include:
|
18 |
+
|
19 |
* Importing feeds automatically using cron.
|
20 |
* Set number of posts and category per feed.
|
21 |
* Set what author to assign imported content to.
|
29 |
|
30 |
== Screenshots ==
|
31 |
|
32 |
+
1. This is the combined settings- and feed-management-screen.
|
33 |
+
|
34 |
+
== Change Log ==
|
35 |
+
|
36 |
+
= Version 1.0.2 =
|
37 |
+
* Fixed bug that caused posts to be duplicated when post status was set to anything put 'Publish'.
|
38 |
+
* Added possibility to log each time imports are made in a textfile (for debugging purposes).
|
39 |
+
|
40 |
+
= Version 1.0.1 =
|
41 |
+
* Fixed some localization issues.
|
rss_pi-ui.php
CHANGED
@@ -100,7 +100,7 @@
|
|
100 |
</td>
|
101 |
</tr>
|
102 |
<tr>
|
103 |
-
<td><?php _e('Post status', "rss_pi"); ?></td>
|
104 |
<td>
|
105 |
|
106 |
<select name="post_status" id="post_status">
|
@@ -143,6 +143,22 @@
|
|
143 |
</ul>
|
144 |
</td>
|
145 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
</table>
|
147 |
</td>
|
148 |
</tr>
|
100 |
</td>
|
101 |
</tr>
|
102 |
<tr>
|
103 |
+
<td><label for="post_status"><?php _e('Post status', "rss_pi"); ?></label></td>
|
104 |
<td>
|
105 |
|
106 |
<select name="post_status" id="post_status">
|
143 |
</ul>
|
144 |
</td>
|
145 |
</tr>
|
146 |
+
<tr>
|
147 |
+
<td>
|
148 |
+
<?php _e('Enable logging?', "rss_pi"); ?>
|
149 |
+
<p class="description"><?php printf( __('The logfile can be found <a href="%s">here</a>.', "rss_pi"), $this->settings['dir'] . 'log.txt' ); ?></p>
|
150 |
+
</td>
|
151 |
+
<td>
|
152 |
+
<ul class="radiolist">
|
153 |
+
<li>
|
154 |
+
<label><input type="radio" id="enable_logging" name="enable_logging" value="true" <?php echo($options['settings']['enable_logging'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes'); ?></label>
|
155 |
+
</li>
|
156 |
+
<li>
|
157 |
+
<label><input type="radio" id="enable_logging" name="enable_logging" value="false" <?php echo($options['settings']['enable_logging'] == 'false' || $options['settings']['enable_logging'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No'); ?></label>
|
158 |
+
</li>
|
159 |
+
</ul>
|
160 |
+
</td>
|
161 |
+
</tr>
|
162 |
</table>
|
163 |
</td>
|
164 |
</tr>
|
rss_pi.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Rss Post Importer
|
|
4 |
Plugin URI: -
|
5 |
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.
|
6 |
Author: Jens Waern
|
7 |
-
Version: 1.0.
|
8 |
Author URI: http://www.simmalugnt.se
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -25,7 +25,7 @@ class rss_pi {
|
|
25 |
add_action('admin_menu', array(&$this, 'admin_menu'));
|
26 |
|
27 |
$this->settings = array(
|
28 |
-
'version' => '1.0',
|
29 |
'dir' => plugin_dir_path( __FILE__ )
|
30 |
);
|
31 |
|
@@ -66,9 +66,12 @@ class rss_pi {
|
|
66 |
'post_template' => stripslashes_deep($_POST['post_template']),
|
67 |
'post_status' => $_POST['post_status'],
|
68 |
'author_id' => $_POST['author_id'],
|
69 |
-
'allow_comments' => $_POST['allow_comments']
|
|
|
70 |
);
|
71 |
-
|
|
|
|
|
72 |
// Reset cron
|
73 |
wp_clear_scheduled_hook( 'rss_pi_cron' );
|
74 |
wp_schedule_event( time(), $settings['frequency'], 'rss_pi_cron');
|
@@ -106,8 +109,8 @@ class rss_pi {
|
|
106 |
endif;
|
107 |
endif;
|
108 |
|
109 |
-
$options =
|
110 |
-
|
111 |
$ids = array();
|
112 |
|
113 |
|
@@ -124,7 +127,7 @@ class rss_pi {
|
|
124 |
// Get a SimplePie feed object from the specified feed source.
|
125 |
$rss = fetch_feed( $url );
|
126 |
|
127 |
-
$options =
|
128 |
|
129 |
// Remove the surrounding <div> from XHTML content in Atom feeds.
|
130 |
|
@@ -140,6 +143,8 @@ class rss_pi {
|
|
140 |
{
|
141 |
$saved_posts = array();
|
142 |
|
|
|
|
|
143 |
foreach ( $rss_items as $item )
|
144 |
{
|
145 |
if (!$this->post_exists($item->get_permalink()))
|
@@ -159,8 +164,16 @@ class rss_pi {
|
|
159 |
add_post_meta( $post_id, 'rss_pi_source_url', esc_url($item->get_permalink()) );
|
160 |
|
161 |
array_push($saved_posts, $new_post);
|
|
|
|
|
162 |
}
|
163 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
return $saved_posts;
|
165 |
exit;
|
166 |
}
|
@@ -170,7 +183,7 @@ class rss_pi {
|
|
170 |
|
171 |
function return_frequency($seconds)
|
172 |
{
|
173 |
-
$options =
|
174 |
return $options['settings']['frequency'];
|
175 |
}
|
176 |
|
@@ -179,7 +192,7 @@ class rss_pi {
|
|
179 |
|
180 |
$post_count = 0;
|
181 |
|
182 |
-
$options =
|
183 |
|
184 |
add_filter( 'wp_feed_cache_transient_lifetime', array(&$this, 'return_frequency' ) );
|
185 |
|
@@ -197,12 +210,19 @@ class rss_pi {
|
|
197 |
|
198 |
remove_filter( 'wp_feed_cache_transient_lifetime', array(&$this, 'return_frequency' ) );
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
return $post_count;
|
201 |
}
|
202 |
|
203 |
function parse_content($item, $feed_title, $strip_html)
|
204 |
{
|
205 |
-
$options =
|
206 |
$post_template = $options['settings']['post_template'];
|
207 |
$c = $item->get_content() != "" ? $item->get_content() : $item->get_description();
|
208 |
|
@@ -222,6 +242,7 @@ class rss_pi {
|
|
222 |
{
|
223 |
|
224 |
$args = array(
|
|
|
225 |
'meta_key' => 'rss_pi_source_url',
|
226 |
'meta_value' => esc_url($permalink)
|
227 |
);
|
@@ -250,7 +271,19 @@ class rss_pi {
|
|
250 |
));
|
251 |
|
252 |
}
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
new rss_pi;
|
256 |
?>
|
4 |
Plugin URI: -
|
5 |
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.
|
6 |
Author: Jens Waern
|
7 |
+
Version: 1.0.2
|
8 |
Author URI: http://www.simmalugnt.se
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
25 |
add_action('admin_menu', array(&$this, 'admin_menu'));
|
26 |
|
27 |
$this->settings = array(
|
28 |
+
'version' => '1.0.2',
|
29 |
'dir' => plugin_dir_path( __FILE__ )
|
30 |
);
|
31 |
|
66 |
'post_template' => stripslashes_deep($_POST['post_template']),
|
67 |
'post_status' => $_POST['post_status'],
|
68 |
'author_id' => $_POST['author_id'],
|
69 |
+
'allow_comments' => $_POST['allow_comments'],
|
70 |
+
'enable_logging' => $_POST['enable_logging']
|
71 |
);
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
// Reset cron
|
76 |
wp_clear_scheduled_hook( 'rss_pi_cron' );
|
77 |
wp_schedule_event( time(), $settings['frequency'], 'rss_pi_cron');
|
109 |
endif;
|
110 |
endif;
|
111 |
|
112 |
+
$options = $this->rss_pi_get_option();
|
113 |
+
|
114 |
$ids = array();
|
115 |
|
116 |
|
127 |
// Get a SimplePie feed object from the specified feed source.
|
128 |
$rss = fetch_feed( $url );
|
129 |
|
130 |
+
$options = $this->rss_pi_get_option();
|
131 |
|
132 |
// Remove the surrounding <div> from XHTML content in Atom feeds.
|
133 |
|
143 |
{
|
144 |
$saved_posts = array();
|
145 |
|
146 |
+
$log = '';
|
147 |
+
|
148 |
foreach ( $rss_items as $item )
|
149 |
{
|
150 |
if (!$this->post_exists($item->get_permalink()))
|
164 |
add_post_meta( $post_id, 'rss_pi_source_url', esc_url($item->get_permalink()) );
|
165 |
|
166 |
array_push($saved_posts, $new_post);
|
167 |
+
|
168 |
+
//$log .= date("Y-m-d H:i:s") . "\t Imported '" . $item->get_title() . "' from " . $feed_title . "\n";
|
169 |
}
|
170 |
}
|
171 |
+
//if($options['settings']['enable_logging'] == 'true')
|
172 |
+
//{
|
173 |
+
// $log_file = $this->settings['dir'] . 'log.txt';
|
174 |
+
// file_put_contents($log_file, $log, FILE_APPEND);
|
175 |
+
//}
|
176 |
+
|
177 |
return $saved_posts;
|
178 |
exit;
|
179 |
}
|
183 |
|
184 |
function return_frequency($seconds)
|
185 |
{
|
186 |
+
$options = $this->rss_pi_get_option();
|
187 |
return $options['settings']['frequency'];
|
188 |
}
|
189 |
|
192 |
|
193 |
$post_count = 0;
|
194 |
|
195 |
+
$options = $this->rss_pi_get_option();
|
196 |
|
197 |
add_filter( 'wp_feed_cache_transient_lifetime', array(&$this, 'return_frequency' ) );
|
198 |
|
210 |
|
211 |
remove_filter( 'wp_feed_cache_transient_lifetime', array(&$this, 'return_frequency' ) );
|
212 |
|
213 |
+
if($options['settings']['enable_logging'] == 'true')
|
214 |
+
{
|
215 |
+
$log .= date("Y-m-d H:i:s") . "\t Imported " . $post_count . " new posts. \n";
|
216 |
+
$log_file = $this->settings['dir'] . 'log.txt';
|
217 |
+
file_put_contents($log_file, $log, FILE_APPEND);
|
218 |
+
}
|
219 |
+
|
220 |
return $post_count;
|
221 |
}
|
222 |
|
223 |
function parse_content($item, $feed_title, $strip_html)
|
224 |
{
|
225 |
+
$options = $this->rss_pi_get_option();
|
226 |
$post_template = $options['settings']['post_template'];
|
227 |
$c = $item->get_content() != "" ? $item->get_content() : $item->get_description();
|
228 |
|
242 |
{
|
243 |
|
244 |
$args = array(
|
245 |
+
'post_status' => 'any',
|
246 |
'meta_key' => 'rss_pi_source_url',
|
247 |
'meta_value' => esc_url($permalink)
|
248 |
);
|
271 |
));
|
272 |
|
273 |
}
|
274 |
+
|
275 |
+
function rss_pi_get_option()
|
276 |
+
{
|
277 |
+
$options = get_option('rss_pi_feeds');
|
278 |
+
|
279 |
+
// Insert new settings
|
280 |
+
if(!array_key_exists('enable_logging', $options['settings']))
|
281 |
+
{
|
282 |
+
$options['settings']['enable_logging'] = 'false';
|
283 |
+
}
|
284 |
+
|
285 |
+
return $options;
|
286 |
+
}
|
287 |
}
|
288 |
new rss_pi;
|
289 |
?>
|