WP RSS Aggregator - Version 3.9.6

Version Description

(2014-01-17) = * Enhanced: Added error logging.

Download this release

Release Info

Developer jeangalea
Plugin Icon 128x128 WP RSS Aggregator
Version 3.9.6
Comparing to
See all releases

Code changes from version 3.9.5 to 3.9.6

changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  3.9.5 (2014-01-02)
2
  Enhanced: Added a feed validator link in the New/Edit Feed Sources page.
3
  Enhanced: The Next Update column also shows the time remaining for next update, for feed source on the global update interval.
1
+ 3.9.6 (2014-01-17)
2
+ Enhanced: Added error logging.
3
+
4
  3.9.5 (2014-01-02)
5
  Enhanced: Added a feed validator link in the New/Edit Feed Sources page.
6
  Enhanced: The Next Update column also shows the time remaining for next update, for feed source on the global update interval.
css/admin-styles.css CHANGED
@@ -291,4 +291,17 @@ div.inside .wprss-meta-side-setting:last-child {
291
  .column-category { text-align: left; width:15% !important; overflow:hidden }
292
  .column-id { text-align: left; width:5% !important; overflow:hidden }
293
  .column-next-update { text-align: left; width:10% !important; overflow:hidden }
294
- .column-state { text-align: left; width:10% !important; overflow:hidden }
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  .column-category { text-align: left; width:15% !important; overflow:hidden }
292
  .column-id { text-align: left; width:5% !important; overflow:hidden }
293
  .column-next-update { text-align: left; width:10% !important; overflow:hidden }
294
+ .column-state { text-align: left; width:10% !important; overflow:hidden }
295
+
296
+
297
+ /* Log textarea styles */
298
+ #wprss-log-textarea {
299
+ width: 800px;
300
+ height: 400px;
301
+ font-family: Menlo, Monaco, monospace;
302
+ background: none;
303
+ white-space: pre-wrap;
304
+ overflow: auto;
305
+ display: block;
306
+ background: rgb( 255, 245, 245 );
307
+ }
includes/admin-debugging.php CHANGED
@@ -25,7 +25,7 @@
25
  * @since 3.4.6
26
  */
27
  function wprss_get_debug_operations() {
28
- return apply_filters(
29
  'wprss_debug_operations',
30
  array(
31
  'update-feeds' => array(
@@ -40,9 +40,21 @@
40
  'run' => 'wprss_feed_reset',
41
  'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=2',
42
  'render' => 'wprss_debug_reimport_feeds',
43
- )
44
  )
45
  );
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
 
@@ -113,6 +125,30 @@
113
  }
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  * Build the debugging page
118
  *
@@ -123,7 +159,8 @@
123
  'wprss_debug_messages',
124
  array(
125
  '1' => 'wprss_debugging_admin_notice_update_feeds',
126
- '2' => 'wprss_debugging_admin_notice_reimport_feeds'
 
127
  )
128
  );
129
 
@@ -176,4 +213,14 @@
176
  */
177
  function wprss_debugging_admin_notice_reimport_feeds() {
178
  echo '<div class="updated"><p>Feeds deleted and are being re-imported in the background.</p></div>';
 
 
 
 
 
 
 
 
 
 
179
  }
25
  * @since 3.4.6
26
  */
27
  function wprss_get_debug_operations() {
28
+ $operations = apply_filters(
29
  'wprss_debug_operations',
30
  array(
31
  'update-feeds' => array(
40
  'run' => 'wprss_feed_reset',
41
  'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=2',
42
  'render' => 'wprss_debug_reimport_feeds',
43
+ ),
44
  )
45
  );
46
+
47
+ $operations['log'] = apply_filters(
48
+ 'wprss_debug_log_operation',
49
+ array(
50
+ 'nonce' => 'wprss-clear-log',
51
+ 'run' => 'wprss_clear_log',
52
+ 'redirect' => 'edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=3',
53
+ 'render' => 'wprss_debug_clear_log_button'
54
+ )
55
+ );
56
+
57
+ return $operations;
58
  }
59
 
60
 
125
  }
126
 
127
 
128
+
129
+
130
+ /**
131
+ * Renders the Clear Log button
132
+ *
133
+ * @since 3.9.6
134
+ */
135
+ function wprss_debug_clear_log_button() {
136
+ ?>
137
+ <h3><?php _e( 'Error Log', 'wprss' ); ?></h3>
138
+
139
+ <textarea readonly="readonly" id="wprss-log-textarea"><?php echo wprss_get_log(); ?></textarea>
140
+
141
+ <form action="edit.php?post_type=wprss_feed&page=wprss-debugging" method="POST">
142
+ <?php wp_nonce_field( 'wprss-clear-log' );
143
+ submit_button( __( 'Clear log', 'wprss' ), 'button-primary', 'log', true ); ?>
144
+ </form>
145
+
146
+ <?php
147
+ }
148
+
149
+
150
+
151
+
152
  /**
153
  * Build the debugging page
154
  *
159
  'wprss_debug_messages',
160
  array(
161
  '1' => 'wprss_debugging_admin_notice_update_feeds',
162
+ '2' => 'wprss_debugging_admin_notice_reimport_feeds',
163
+ '3' => 'wprss_debugging_admin_notice_clear_log',
164
  )
165
  );
166
 
213
  */
214
  function wprss_debugging_admin_notice_reimport_feeds() {
215
  echo '<div class="updated"><p>Feeds deleted and are being re-imported in the background.</p></div>';
216
+ }
217
+
218
+
219
+ /**
220
+ * Output admin notice that log has been cleard
221
+ *
222
+ * @since 3.9.6
223
+ */
224
+ function wprss_debugging_admin_notice_clear_log() {
225
+ echo '<div class="updated"><p>The error log has been cleared.</p></div>';
226
  }
includes/admin-display.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
 
 
 
 
 
 
2
 
3
- add_filter( 'manage_edit-wprss_feed_columns', 'wprss_set_feed_custom_columns');
4
  /**
5
  * Set up the custom columns for the wprss_feed list
6
  *
@@ -14,14 +20,17 @@
14
  'url' => __( 'URL', 'wprss' ),
15
  // 'description' => __( 'Description', 'wprss' )
16
  );
 
17
  $columns = apply_filters( 'wprss_set_feed_custom_columns', $columns );
18
  $columns['id'] = __( 'ID', 'wprss' );
 
19
  // Columns to add when feed is not trashed
20
  if ( !isset( $_GET['post_status'] ) || $_GET['post_status'] !== 'trash' ) {
21
  $columns['next-update'] = __( 'Next Update', 'wprss' );
22
  $columns['state'] = __( 'State', 'wprss' );
23
  $columns['feed-count'] = __( apply_filters( 'wprss_feed_items_count_column', 'Imported items' ), 'wprss' );
24
  }
 
25
  return $columns;
26
  }
27
 
@@ -141,7 +150,7 @@
141
  }
142
 
143
 
144
- add_filter( 'manage_edit-wprss_feed_item_columns', 'wprss_set_feed_item_custom_columns');
145
  /**
146
  * Set up the custom columns for the wprss_feed source list
147
  *
1
  <?php
2
+ /**
3
+ * Functions for the admin section, columns and row actions
4
+ *
5
+ * @package WP RSS Aggregator
6
+ */
7
+
8
 
9
+ add_filter( 'manage_wprss_feed_posts_columns', 'wprss_set_feed_custom_columns');
10
  /**
11
  * Set up the custom columns for the wprss_feed list
12
  *
20
  'url' => __( 'URL', 'wprss' ),
21
  // 'description' => __( 'Description', 'wprss' )
22
  );
23
+
24
  $columns = apply_filters( 'wprss_set_feed_custom_columns', $columns );
25
  $columns['id'] = __( 'ID', 'wprss' );
26
+
27
  // Columns to add when feed is not trashed
28
  if ( !isset( $_GET['post_status'] ) || $_GET['post_status'] !== 'trash' ) {
29
  $columns['next-update'] = __( 'Next Update', 'wprss' );
30
  $columns['state'] = __( 'State', 'wprss' );
31
  $columns['feed-count'] = __( apply_filters( 'wprss_feed_items_count_column', 'Imported items' ), 'wprss' );
32
  }
33
+
34
  return $columns;
35
  }
36
 
150
  }
151
 
152
 
153
+ add_filter( 'manage_wprss_feed_item_posts_columns', 'wprss_set_feed_item_custom_columns');
154
  /**
155
  * Set up the custom columns for the wprss_feed source list
156
  *
includes/admin-log.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Clears the log file.
6
+ *
7
+ * @since 3.9.6
8
+ */
9
+ function wprss_clear_log() {
10
+ file_put_contents( WPRSS_LOG_FILE, '' );
11
+ }
12
+
13
+
14
+ /**
15
+ * Alias for wprss_clear_log(). Used for code readability.
16
+ *
17
+ * @since 3.9.6
18
+ */
19
+ function wprss_reset_log() {
20
+ wprss_clear_log();
21
+ }
22
+
23
+
24
+
25
+ /**
26
+ * Adds a log entry to the log file.
27
+ *
28
+ * @since 3.9.6
29
+ */
30
+ function wprss_log( $message, $src = NULL ) {
31
+ if ( $src === NULL ) {
32
+ $callers = debug_backtrace();
33
+ $src = $callers[1]['function'];
34
+ }
35
+ $date = date( 'd-m-Y H:i:s' );
36
+ $source = 'WPRSS' . ( ( strlen( $src ) > 0 )? " > $src" : '' ) ;
37
+ $str = "[$date] $source:\n";
38
+ $str .= str_repeat(' ', strlen( strval( $date ) ) + 3 );
39
+ $str .= "$message\n";
40
+ file_put_contents( WPRSS_LOG_FILE , $str, FILE_APPEND );
41
+
42
+ add_action( 'shutdown', 'wprss_log_separator' );
43
+ }
44
+
45
+ /**
46
+ * Dumps an object to the log file.
47
+ *
48
+ * @since 3.9.6
49
+ */
50
+ function wprss_log_obj( $message, $obj, $src = '' ) {
51
+ wprss_log( "$message: " . print_r( $obj, TRUE ), $src );
52
+ }
53
+
54
+
55
+ /**
56
+ * Returns the contents of the log file.
57
+ *
58
+ * @since 3.9.6
59
+ */
60
+ function wprss_get_log() {
61
+ if ( !file_exists( WPRSS_LOG_FILE ) ) {
62
+ wprss_clear_log();
63
+ }
64
+ $contents = file_get_contents( WPRSS_LOG_FILE , '' );
65
+ // Trim the log file to a fixed number of chars
66
+ $limit = 10000;
67
+ if ( strlen( $contents ) > $limit ) {
68
+ file_put_contents( WPRSS_LOG_FILE, substr( $contents, 0, $limit ) );
69
+ return wprss_get_log();
70
+ } else {
71
+ return $contents;
72
+ }
73
+ }
74
+
75
+
76
+ /**
77
+ * Adds an empty line at the end of the log file.
78
+ *
79
+ * This function is called on wordpress shutdown, if at least one new line
80
+ * is logged in the log file, to separate logs from different page loads.
81
+ *
82
+ * @since 3.9.6
83
+ */
84
+ function wprss_log_separator() {
85
+ file_put_contents( WPRSS_LOG_FILE, "\n", FILE_APPEND );
86
+ }
includes/admin-welcome.php CHANGED
@@ -74,13 +74,7 @@
74
 
75
  <h3>Changelog for v<?php echo WPRSS_VERSION; ?></h3>
76
  <ul>
77
- <li>Enhanced: Added a feed validator link in the New/Edit Feed Sources page.</li>
78
- <li>Enhanced: The Next Update column also shows the time remaining for next update, for feed source on the global update interval.</li>
79
- <li>Enhanced: The custom feed has been improved, and is now identical to the feeds displayed with the shortcode.</li>
80
- <li>Enhanced: License notifications only appear on the main site when using WordPress multisite.</li>
81
- <li>Enhanced: Updated Colorbox script to 1.4.33</li>
82
- <li>Fixed bug: The Imported Items column was always showing zero.</li>
83
- <li>Fixed bug: Feed items not being imported with limit set to zero. Should be unlimited.</li>
84
  </ul>
85
 
86
 
74
 
75
  <h3>Changelog for v<?php echo WPRSS_VERSION; ?></h3>
76
  <ul>
77
+ <li>Enhanced: Added error logging.</li>
 
 
 
 
 
 
78
  </ul>
79
 
80
 
includes/feed-processing.php CHANGED
@@ -200,8 +200,9 @@
200
  $feed->init();
201
  $feed->handle_content_type();
202
 
203
- if ( $feed->error() )
204
  return new WP_Error( 'simplepie-error', $feed->error() );
 
205
 
206
  return $feed;
207
  }
@@ -217,7 +218,7 @@
217
  $feed_item_limit = $general_settings['limit_feed_items_imported'];
218
 
219
  // Don't fetch the feed if feed item limit is 0, there's no need, huge speed improvement
220
- if ( $feed_item_limit === '' ) return;
221
 
222
  add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_feed_cache_lifetime' );
223
 
@@ -246,7 +247,10 @@
246
  return $items;
247
  }
248
 
249
- else { return; }
 
 
 
250
  }
251
 
252
 
@@ -309,7 +313,11 @@
309
  if ( ! ( in_array( $permalink, $existing_permalinks ) ) ) {
310
 
311
  // Apply filters that determine if the feed item should be inserted into the DB or not.
312
- $item = apply_filters( 'wprss_insert_post_item_conditionals', $item, $feed_ID, $permalink );
 
 
 
 
313
 
314
  // If the item is not NULL, continue to inserting the feed item post into the DB
315
  if ( $item !== NULL ) {
@@ -351,6 +359,9 @@
351
 
352
  // Remember newly added permalink
353
  $existing_permalinks[] = $permalink;
 
 
 
354
  }
355
  }
356
  }
@@ -827,7 +838,12 @@
827
  // Calculate the age difference
828
  $difference = $age - $max_age;
829
 
830
- return ( $difference <= 0 )? NULL : $item;
 
 
 
 
 
831
  }
832
 
833
 
200
  $feed->init();
201
  $feed->handle_content_type();
202
 
203
+ if ( $feed->error() ) {
204
  return new WP_Error( 'simplepie-error', $feed->error() );
205
+ }
206
 
207
  return $feed;
208
  }
218
  $feed_item_limit = $general_settings['limit_feed_items_imported'];
219
 
220
  // Don't fetch the feed if feed item limit is 0, there's no need, huge speed improvement
221
+ // if ( $feed_item_limit === '' ) return;
222
 
223
  add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_feed_cache_lifetime' );
224
 
247
  return $items;
248
  }
249
 
250
+ else {
251
+ wprss_log( 'Failed to fetch feed ' . $url );
252
+ return;
253
+ }
254
  }
255
 
256
 
313
  if ( ! ( in_array( $permalink, $existing_permalinks ) ) ) {
314
 
315
  // Apply filters that determine if the feed item should be inserted into the DB or not.
316
+ $new_item = apply_filters( 'wprss_insert_post_item_conditionals', $item, $feed_ID, $permalink );
317
+ if ( $new_item === NULL ) {
318
+ wprss_log( 'Feed item skipped (got null): ' . $item->get_title() );
319
+ }
320
+ $item = $new_item;
321
 
322
  // If the item is not NULL, continue to inserting the feed item post into the DB
323
  if ( $item !== NULL ) {
359
 
360
  // Remember newly added permalink
361
  $existing_permalinks[] = $permalink;
362
+ }
363
+ else {
364
+ wprss_log_obj( 'Failed to insert post', $feed_item, 'wprss_items_insert_post > wp_insert_post' );
365
  }
366
  }
367
  }
838
  // Calculate the age difference
839
  $difference = $age - $max_age;
840
 
841
+ if ( $difference <= 0 ) {
842
+ wprss_log( 'Feed item skipped (older than specified settings): ' . $item->get_title() );
843
+ return NULL;
844
+ } else {
845
+ return $item;
846
+ }
847
  }
848
 
849
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.wprssaggregator.com
5
  Tags: rss, feeds, aggregation, autoblog aggregator, rss import, feed aggregator, rss aggregator, multiple rss feeds, multi rss feeds, rss multi importer, feed import, feed import, multiple feed import, feed aggregation, rss feader, feed reader, feed to post, multiple feeds, multi feed importer, multi feed import, multi import, autoblogging, autoblogger
6
  Requires at least: 3.3
7
  Tested up to: 3.8
8
- Stable tag: 3.9.5
9
  License: GPLv2 or later
10
  Imports and aggregates multiple RSS Feeds using SimplePie. Outputs feeds sorted by date (latest first).
11
 
@@ -145,6 +145,9 @@ Yes, within the [Feed to Post](http://www.wprssaggregator.com/extensions/feed-to
145
 
146
  == Changelog ==
147
 
 
 
 
148
  = 3.9.5 (2014-01-02) =
149
  * Enhanced: Added a feed validator link in the New/Edit Feed Sources page.
150
  * Enhanced: The Next Update column also shows the time remaining for next update, for feed source on the global update interval.
5
  Tags: rss, feeds, aggregation, autoblog aggregator, rss import, feed aggregator, rss aggregator, multiple rss feeds, multi rss feeds, rss multi importer, feed import, feed import, multiple feed import, feed aggregation, rss feader, feed reader, feed to post, multiple feeds, multi feed importer, multi feed import, multi import, autoblogging, autoblogger
6
  Requires at least: 3.3
7
  Tested up to: 3.8
8
+ Stable tag: 3.9.6
9
  License: GPLv2 or later
10
  Imports and aggregates multiple RSS Feeds using SimplePie. Outputs feeds sorted by date (latest first).
11
 
145
 
146
  == Changelog ==
147
 
148
+ = 3.9.6 (2014-01-17) =
149
+ * Enhanced: Added error logging.
150
+
151
  = 3.9.5 (2014-01-02) =
152
  * Enhanced: Added a feed validator link in the New/Edit Feed Sources page.
153
  * Enhanced: The Next Update column also shows the time remaining for next update, for feed source on the global update interval.
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
wp-rss-aggregator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP RSS Aggregator
4
  Plugin URI: http://www.wprssaggregator.com
5
  Description: Imports and aggregates multiple RSS Feeds using SimplePie
6
- Version: 3.9.5
7
  Author: Jean Galea
8
  Author URI: http://www.wprssaggregator.com
9
  License: GPLv2
@@ -11,7 +11,7 @@
11
  */
12
 
13
  /*
14
- Copyright 2012-2013 Jean Galea (email : info@jeangalea.com)
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
17
  the Free Software Foundation; either version 2 of the License, or
@@ -29,7 +29,7 @@
29
 
30
  /**
31
  * @package WPRSSAggregator
32
- * @version 3.9.5
33
  * @since 1.0
34
  * @author Jean Galea <info@jeangalea.com>
35
  * @copyright Copyright (c) 2012-2013, Jean Galea
@@ -43,7 +43,7 @@
43
 
44
  // Set the version number of the plugin.
45
  if( !defined( 'WPRSS_VERSION' ) )
46
- define( 'WPRSS_VERSION', '3.9.5', true );
47
 
48
  // Set the database version number of the plugin.
49
  if( !defined( 'WPRSS_DB_VERSION' ) )
@@ -80,6 +80,10 @@
80
  // Set the constant path to the plugin's includes directory.
81
  if( !defined( 'WPRSS_INC' ) )
82
  define( 'WPRSS_INC', WPRSS_DIR . trailingslashit( 'includes' ), true );
 
 
 
 
83
 
84
 
85
  /**
@@ -161,6 +165,9 @@
161
 
162
  require_once ( WPRSS_INC . 'admin-editor.php' );
163
 
 
 
 
164
 
165
  register_activation_hook( __FILE__ , 'wprss_activate' );
166
  register_deactivation_hook( __FILE__ , 'wprss_deactivate' );
3
  Plugin Name: WP RSS Aggregator
4
  Plugin URI: http://www.wprssaggregator.com
5
  Description: Imports and aggregates multiple RSS Feeds using SimplePie
6
+ Version: 3.9.6
7
  Author: Jean Galea
8
  Author URI: http://www.wprssaggregator.com
9
  License: GPLv2
11
  */
12
 
13
  /*
14
+ Copyright 2012-2014 Jean Galea (email : info@jeangalea.com)
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License as published by
17
  the Free Software Foundation; either version 2 of the License, or
29
 
30
  /**
31
  * @package WPRSSAggregator
32
+ * @version 3.9.6
33
  * @since 1.0
34
  * @author Jean Galea <info@jeangalea.com>
35
  * @copyright Copyright (c) 2012-2013, Jean Galea
43
 
44
  // Set the version number of the plugin.
45
  if( !defined( 'WPRSS_VERSION' ) )
46
+ define( 'WPRSS_VERSION', '3.9.6', true );
47
 
48
  // Set the database version number of the plugin.
49
  if( !defined( 'WPRSS_DB_VERSION' ) )
80
  // Set the constant path to the plugin's includes directory.
81
  if( !defined( 'WPRSS_INC' ) )
82
  define( 'WPRSS_INC', WPRSS_DIR . trailingslashit( 'includes' ), true );
83
+
84
+ // Set the constant path to the plugin's log file.
85
+ if( !defined( 'WPRSS_LOG_FILE' ) )
86
+ define( 'WPRSS_LOG_FILE', WPRSS_DIR . 'log.txt', true );
87
 
88
 
89
  /**
165
 
166
  require_once ( WPRSS_INC . 'admin-editor.php' );
167
 
168
+ // Load the logging functions file
169
+ require_once ( WPRSS_INC . 'admin-log.php' );
170
+
171
 
172
  register_activation_hook( __FILE__ , 'wprss_activate' );
173
  register_deactivation_hook( __FILE__ , 'wprss_deactivate' );