WP RSS Aggregator - Version 4.5

Version Description

(2014-08-25) = * New Feature: Bulk importer allows you to create multiple feed sources at once. * Enhanced: Improved OPML importer with added hooks. * Enhanced: Centralized add-on licensing, fixing multiple bugs. * Fixed bug: Undefined feed_limit errors when using the shortcode.

Download this release

Release Info

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

Code changes from version 4.4.4 to 4.5

changelog.txt CHANGED
@@ -1,11 +1,17 @@
 
 
 
 
 
 
1
  4.4.4 (2014-08-19)
2
- Fixed bug: More fatal errors when using PHP version 5.3 or lower.
3
 
4
  4.4.3 (2014-08-19)
5
- Fixed bug: Fatal error when using PHP version 5.3 or lower.
6
 
7
  4.4.2 (2014-08-19)
8
- Fixed bug: Fatal error when using PHP version 5.3 or lower.
9
 
10
  4.4.1 (2014-08-18)
11
  Enhanced: Various improvements to the plugin interface and texts.
1
+ 4.5 (2014-08-25)
2
+ New Feature: Bulk importer allows you to create multiple feed sources at once.
3
+ Enhanced: Improved OPML importer with added hooks.
4
+ Enhanced: Centralized add-on licensing, fixing multiple bugs.
5
+ Fixed bug: Undefined `feed_limit` errors when using the shortcode.
6
+
7
  4.4.4 (2014-08-19)
8
+ Fixed bug: Errors when using older PHP versions 5.3 or lower.
9
 
10
  4.4.3 (2014-08-19)
11
+ Fixed bug: Errors when using older PHP versions 5.3 or lower.
12
 
13
  4.4.2 (2014-08-19)
14
+ Fixed bug: Errors when using older PHP versions 5.3 or lower.
15
 
16
  4.4.1 (2014-08-18)
17
  Enhanced: Various improvements to the plugin interface and texts.
images/welcome-page/authors.png DELETED
Binary file
images/welcome-page/bulk-add.png ADDED
Binary file
images/welcome-page/default-pagination.png DELETED
Binary file
images/welcome-page/numbered-pagination.png DELETED
Binary file
images/welcome-page/view-items.png DELETED
Binary file
includes/OPML.php CHANGED
@@ -108,6 +108,12 @@ class WPRSS_OPML {
108
  'description' => (string) $element['description']
109
  );
110
 
 
 
 
 
 
 
111
  /*
112
  * Check for existence of htmlUrl and xmlUrl.
113
  * If not found, use lowercased attribute names.
@@ -123,4 +129,4 @@ class WPRSS_OPML {
123
 
124
  }
125
 
126
- ?>
108
  'description' => (string) $element['description']
109
  );
110
 
111
+ // Check for category attribute
112
+ if ( isset( $element['category'] ) ) {
113
+ // split categories by comma, and trim each category string
114
+ $result['categories'] = array_map( 'trim', explode(',', $category) );
115
+ }
116
+
117
  /*
118
  * Check for existence of htmlUrl and xmlUrl.
119
  * If not found, use lowercased attribute names.
129
 
130
  }
131
 
132
+ ?>
includes/admin-import-export.php CHANGED
@@ -6,6 +6,62 @@
6
  * @since 3.1
7
  */
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  add_action( 'admin_init', 'wp_rss_aggregator_export', 1 );
11
 
@@ -131,7 +187,23 @@
131
  if ( !isset( $_POST['export'] ) ) { ?>
132
  <div class="wrap">
133
  <?php screen_icon( 'wprss-aggregator' ); ?>
134
- <h2><?php _e( 'Import & Export Settings', 'wprss' ); ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  <h3><?php _e( 'Export Settings', 'wprss' ); ?></h3>
137
  <p><?php _e( 'Click the <strong>Export Settings</strong> button to generate a file containing all the settings used by WP RSS Aggregator', 'wprss' ); ?></p>
6
  * @since 3.1
7
  */
8
 
9
+ add_action( 'admin_init', 'wp_rss_aggregator_bulk_import' );
10
+ /**
11
+ * Checks for the submission of a bulk import.
12
+ * If a bulk submission is made, creates the feed sources.
13
+ *
14
+ * @since 4.5
15
+ */
16
+ function wp_rss_aggregator_bulk_import() {
17
+ // Check if recieving
18
+ if ( !empty( $_POST['bulk-feeds'] ) ) {
19
+ // Check nonce
20
+ check_admin_referer('wprss-bulk-import', 'wprss-bulk-import');
21
+ // Get the text
22
+ $bulk_feeds = $_POST['bulk-feeds'];
23
+ // Split by lines
24
+ $lines = explode("\n", $bulk_feeds);
25
+ // Keep a counter
26
+ global $wprss_bulk_count;
27
+ $wprss_bulk_count = 0;
28
+ // Iterate each line
29
+ foreach( $lines as $line ) {
30
+ // Split by comma
31
+ $parts = array_map('trim', explode(",", $line) );
32
+ // Check if split was successful
33
+ if ( count($parts) < 2 ) continue;
34
+ // Prepare the feed data
35
+ $name = $parts[0];
36
+ $url = $parts[1];
37
+ // Check if both name and url are set
38
+ if ( empty($name) || empty($url) ) continue;
39
+ $feed = array(
40
+ 'post_title' => $name,
41
+ 'post_status' => 'publish',
42
+ 'post_type' => 'wprss_feed'
43
+ );
44
+ // Insert the feed into the DB
45
+ $inserted_id = wp_insert_post( $feed );
46
+ // Check if an error occurred
47
+ if ( is_wp_error($inserted_id) ) continue;
48
+ // Set the URL
49
+ update_post_meta($inserted_id, 'wprss_url', $url);
50
+ // Increment the counter
51
+ $wprss_bulk_count++;
52
+ }
53
+ add_action('admin_notices', 'wprss_notify_bulk_add');
54
+ }
55
+ }
56
+
57
+ function wprss_notify_bulk_add() {
58
+ global $wprss_bulk_count; ?>
59
+ <div class="updated">
60
+ <p><?php _e('Successfully imported', 'wprss'); ?> <code><?php echo $wprss_bulk_count; ?></code> <?php _e('feed sources','wprss'); ?>.</p>
61
+ </div>
62
+ <?php
63
+ }
64
+
65
 
66
  add_action( 'admin_init', 'wp_rss_aggregator_export', 1 );
67
 
187
  if ( !isset( $_POST['export'] ) ) { ?>
188
  <div class="wrap">
189
  <?php screen_icon( 'wprss-aggregator' ); ?>
190
+
191
+ <!-- Bulk Add -->
192
+ <h2><?php _e( 'Bulk Feed Import', 'wprss' ); ?></h2>
193
+ <p><?php _e('Import multiple feed sources at once, by entering the name and URLs of your feeds below.', 'wprss'); ?></p>
194
+ <p><?php _e('Separate the name and the URL using a comma on each line:', 'wprss'); ?>
195
+ <code><?php _e('Feed Name, http://www.myfeed.com', 'wprss'); ?></code>
196
+ </p>
197
+ <form id="bulk-add-form" method="POST">
198
+ <textarea rows="6" cols="80" form="bulk-add-form" name="bulk-feeds" autofocus></textarea>
199
+ <br/>
200
+ <?php wp_nonce_field('wprss-bulk-import', 'wprss-bulk-import'); ?>
201
+ <input type="submit" class="button-secondary" name="bulk-add" value="Bulk Import" />
202
+ </form>
203
+ <hr/>
204
+
205
+ <!-- Settings Import/Export -->
206
+ <h2><?php _e( 'Import & Export Settings', 'wprss' ); ?></h2>
207
 
208
  <h3><?php _e( 'Export Settings', 'wprss' ); ?></h3>
209
  <p><?php _e( 'Click the <strong>Export Settings</strong> button to generate a file containing all the settings used by WP RSS Aggregator', 'wprss' ); ?></p>
includes/admin-metaboxes.php CHANGED
@@ -96,19 +96,21 @@
96
 
97
  // Field Array
98
  $wprss_meta_fields[ 'url' ] = array(
99
- 'label' => __( 'URL', 'wprss' ),
100
- 'desc' => __( 'Enter feed URL (including http://)', 'wprss' ),
101
- 'id' => $prefix .'url',
102
- 'type' => 'url',
103
- 'after' => 'wprss_validate_feed_link',
 
104
  );
105
-
106
  $wprss_meta_fields[ 'description' ] = array(
107
  'label' => __( 'Description', 'wprss' ),
108
  'desc' => __( 'A short description about this feed source (optional)', 'wprss' ),
109
  'id' => $prefix .'description',
110
  'type' => 'textarea'
111
- );
 
112
 
113
  $wprss_meta_fields[ 'limit' ] = array(
114
  'label' => __( 'Limit', 'wprss' ),
@@ -158,13 +160,16 @@
158
  if ( isset( $field['before'] ) && !empty( $field['before'] ) ) {
159
  call_user_func( $field['before'] );
160
  }
161
-
 
 
 
162
  switch( $field['type'] ) {
163
 
164
  // text/url
165
  case 'url':
166
  case 'text':
167
- echo '<input type="'.$field['type'].'" name="'.$field['id'].'" id="'.$field['id'].'" value="'. esc_attr( $meta ) .'" size="55" />
168
  <br><span class="description">'.$field['desc'].'</span>';
169
  break;
170
 
96
 
97
  // Field Array
98
  $wprss_meta_fields[ 'url' ] = array(
99
+ 'label' => __( 'URL', 'wprss' ),
100
+ 'desc' => __( 'Enter feed URL (including http://)', 'wprss' ),
101
+ 'id' => $prefix .'url',
102
+ 'type' => 'url',
103
+ 'after' => 'wprss_validate_feed_link',
104
+ 'placeholder' => 'http://'
105
  );
106
+ /*
107
  $wprss_meta_fields[ 'description' ] = array(
108
  'label' => __( 'Description', 'wprss' ),
109
  'desc' => __( 'A short description about this feed source (optional)', 'wprss' ),
110
  'id' => $prefix .'description',
111
  'type' => 'textarea'
112
+ );
113
+ */
114
 
115
  $wprss_meta_fields[ 'limit' ] = array(
116
  'label' => __( 'Limit', 'wprss' ),
160
  if ( isset( $field['before'] ) && !empty( $field['before'] ) ) {
161
  call_user_func( $field['before'] );
162
  }
163
+
164
+ // Add default placeholder value
165
+ $field = wp_parse_args( $field, array( 'placeholder' => '' ) );
166
+
167
  switch( $field['type'] ) {
168
 
169
  // text/url
170
  case 'url':
171
  case 'text':
172
+ echo '<input type="'.$field['type'].'" name="'.$field['id'].'" id="'.$field['id'].'" value="'. esc_attr( $meta ) .'" placeholder="'.__($field['placeholder'], 'wprss').'" size="55" />
173
  <br><span class="description">'.$field['desc'].'</span>';
174
  break;
175
 
includes/admin-welcome.php CHANGED
@@ -106,7 +106,22 @@
106
  default: ?>
107
  <div class="changelog">
108
 
109
- <h2 class="about-headline-callout">New Feed Item Blacklist</h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  <div class="feature-section col three-col">
111
  <div class="col-1">
112
  <img src="<?php echo WPRSS_IMG;?>welcome-page/trash-feed-item.png" />
@@ -135,27 +150,8 @@
135
  </p>
136
  </div>
137
  </div>
138
-
139
- <h2 class="about-headline-callout">New Author Importing!</h2>
140
- <div class="about-overview">
141
- <img src="<?php echo WPRSS_IMG;?>welcome-page/authors.png" />
142
- <h4>Author Names for Feed Items</h4>
143
- <p>
144
- Show the name of the author for each feed item you import!
145
- <br/>
146
- Perfect for giving attribution to the original author of an article.
147
- <br/>
148
- Head over to the
149
- <a href="<?php echo $settings_url; ?>">settings page</a>
150
- to enable the option and start importing authors names!
151
- <br/>
152
- More options soon!
153
- </p>
154
- </div>
155
-
156
 
157
  <hr/>
158
-
159
 
160
  <h3>Check out our add-ons:</h3>
161
 
106
  default: ?>
107
  <div class="changelog">
108
 
109
+ <h2 class="about-headline-callout">Bulk Adding Feed Sources</h2>
110
+ <div class="about-overview">
111
+ <img src="<?php echo WPRSS_IMG;?>welcome-page/bulk-add.png" />
112
+ <p>
113
+ The new bulk adding option saves you time by allowing you to enter your feed names and URLs
114
+ all at once.
115
+ <br/>
116
+ Simply type in or paste your feed sources, and with the press of a button, your feed sources will instantly be created!
117
+ <br/>
118
+ Try it now from the
119
+ <a href="<?php echo admin_url('edit.php?post_type=wprss_feed&page=wprss-import-export-settings'); ?>">Import &amp; Export</a>
120
+ page.
121
+ </p>
122
+ </div>
123
+
124
+ <h2 class="about-headline-callout">Feed Item Blacklist</h2>
125
  <div class="feature-section col three-col">
126
  <div class="col-1">
127
  <img src="<?php echo WPRSS_IMG;?>welcome-page/trash-feed-item.png" />
150
  </p>
151
  </div>
152
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  <hr/>
 
155
 
156
  <h3>Check out our add-ons:</h3>
157
 
includes/feed-display.php CHANGED
@@ -77,7 +77,13 @@
77
  * @since 3.0
78
  */
79
  function wprss_get_feed_items_query( $settings ) {
80
- $posts_per_page = ( isset( $settings['posts_per_page'] ) )? $settings['posts_per_page'] : $settings['feed_limit'];
 
 
 
 
 
 
81
  global $paged;
82
  if ( get_query_var('paged') ) {
83
  $paged = get_query_var('paged');
77
  * @since 3.0
78
  */
79
  function wprss_get_feed_items_query( $settings ) {
80
+ if ( isset( $settings['posts_per_page'] ) ) {
81
+ $posts_per_page = $settings['posts_per_page'];
82
+ } elseif( isset( $settings['feed_limit'] ) ) {
83
+ $posts_per_page = isset( $settings['feed_limit'] );
84
+ } else {
85
+ $posts_per_page = -1;
86
+ }
87
  global $paged;
88
  if ( get_query_var('paged') ) {
89
  $paged = get_query_var('paged');
includes/feed-importing.php CHANGED
@@ -12,8 +12,6 @@
12
  add_filter('wprss_normalize_permalink', 'wprss_convert_video_permalink', 100);
13
 
14
 
15
-
16
-
17
  add_action( 'wprss_fetch_single_feed_hook', 'wprss_fetch_insert_single_feed_items' );
18
  /**
19
  * The main feed fetching function.
@@ -124,10 +122,6 @@
124
  }
125
 
126
 
127
-
128
-
129
-
130
-
131
  /**
132
  * Fetches the feed items from a feed at the given URL.
133
  *
@@ -158,11 +152,6 @@
158
  }
159
 
160
 
161
-
162
-
163
-
164
-
165
-
166
  /**
167
  * A clone of the function 'fetch_feed' in wp-includes/feed.php [line #529]
168
  *
@@ -226,7 +215,6 @@
226
  }
227
 
228
 
229
-
230
  /**
231
  * Normalizes the given permalink.
232
  *
@@ -253,6 +241,7 @@
253
  return wprss_tracking_url_fix($permalink, '!^(https?:\/\/)?' . preg_quote('news.google.com', '!') . '.*!');
254
  }
255
 
 
256
  /**
257
  * Extracts the actual URL from a Bing permalink
258
  *
@@ -263,6 +252,7 @@
263
  return wprss_tracking_url_fix($permalink, '!^(https?:\/\/)?(www\.)?' . preg_quote('bing.com/news', '!') . '.*!');
264
  }
265
 
 
266
  /**
267
  * Checks if the permalink is a tracking permalink based on host, and if
268
  * it is, returns the normalized URL of the proper feed item article,
@@ -315,7 +305,6 @@
315
  }
316
 
317
 
318
-
319
  /**
320
  * Converts YouTube, Vimeo and DailyMotion video urls
321
  * into embedded video player urls.
@@ -363,9 +352,6 @@
363
  }
364
 
365
 
366
-
367
-
368
-
369
  /**
370
  * Insert wprss_feed_item posts into the DB
371
  *
@@ -461,9 +447,6 @@
461
  }
462
 
463
 
464
-
465
-
466
-
467
  /**
468
  * Inserts the appropriate post meta for feed items.
469
  *
@@ -487,11 +470,6 @@
487
  }
488
 
489
 
490
-
491
-
492
-
493
-
494
-
495
  /**
496
  * Fetches all feed items from all feed sources.
497
  * Iteratively calls 'wprss_fetch_insert_single_feed_items' for all feed sources.
@@ -525,6 +503,7 @@
525
  }
526
  }
527
 
 
528
  /**
529
  * Runs the above function with parameter FALSE
530
  *
12
  add_filter('wprss_normalize_permalink', 'wprss_convert_video_permalink', 100);
13
 
14
 
 
 
15
  add_action( 'wprss_fetch_single_feed_hook', 'wprss_fetch_insert_single_feed_items' );
16
  /**
17
  * The main feed fetching function.
122
  }
123
 
124
 
 
 
 
 
125
  /**
126
  * Fetches the feed items from a feed at the given URL.
127
  *
152
  }
153
 
154
 
 
 
 
 
 
155
  /**
156
  * A clone of the function 'fetch_feed' in wp-includes/feed.php [line #529]
157
  *
215
  }
216
 
217
 
 
218
  /**
219
  * Normalizes the given permalink.
220
  *
241
  return wprss_tracking_url_fix($permalink, '!^(https?:\/\/)?' . preg_quote('news.google.com', '!') . '.*!');
242
  }
243
 
244
+
245
  /**
246
  * Extracts the actual URL from a Bing permalink
247
  *
252
  return wprss_tracking_url_fix($permalink, '!^(https?:\/\/)?(www\.)?' . preg_quote('bing.com/news', '!') . '.*!');
253
  }
254
 
255
+
256
  /**
257
  * Checks if the permalink is a tracking permalink based on host, and if
258
  * it is, returns the normalized URL of the proper feed item article,
305
  }
306
 
307
 
 
308
  /**
309
  * Converts YouTube, Vimeo and DailyMotion video urls
310
  * into embedded video player urls.
352
  }
353
 
354
 
 
 
 
355
  /**
356
  * Insert wprss_feed_item posts into the DB
357
  *
447
  }
448
 
449
 
 
 
 
450
  /**
451
  * Inserts the appropriate post meta for feed items.
452
  *
470
  }
471
 
472
 
 
 
 
 
 
473
  /**
474
  * Fetches all feed items from all feed sources.
475
  * Iteratively calls 'wprss_fetch_insert_single_feed_items' for all feed sources.
503
  }
504
  }
505
 
506
+
507
  /**
508
  * Runs the above function with parameter FALSE
509
  *
includes/feed-processing.php CHANGED
@@ -5,7 +5,6 @@
5
  * @package WPRSSAggregator
6
  */
7
 
8
-
9
  /**
10
  * Returns whether or not the feed source will forcefully fetch the next fetch,
11
  * ignoring whether or not it is paused or not.
@@ -20,7 +19,6 @@
20
  }
21
 
22
 
23
-
24
  /**
25
  * Change the default feed cache recreation period to 2 hours
26
  *
@@ -64,7 +62,6 @@
64
  }
65
 
66
 
67
-
68
  /**
69
  * Returns all the feed items of a source.
70
  *
@@ -148,7 +145,6 @@
148
  }
149
 
150
 
151
-
152
  /**
153
  * Returns the image of the feed.
154
  * The reason this function exists is for add-ons to be able to detect if the plugin core
@@ -226,7 +222,6 @@
226
  }
227
 
228
 
229
-
230
  add_action( 'added_post_meta', 'wprss_update_feed_meta', 10, 4 );
231
  add_action( 'updated_post_meta', 'wprss_update_feed_meta', 10, 4 );
232
  /**
@@ -353,7 +348,6 @@
353
  }
354
 
355
 
356
-
357
  /**
358
  * Returns whether or not the feed source is deleting its feeed items.
359
  *
@@ -380,7 +374,6 @@
380
  }
381
 
382
 
383
-
384
  /**
385
  * Returns the given parameter as a string. Used in wprss_truncate_posts()
386
  *
@@ -392,7 +385,6 @@
392
  }
393
 
394
 
395
-
396
  /**
397
  * Returns true if the feed item is older than the given timestamp,
398
  * false otherwise;
@@ -487,12 +479,9 @@
487
  if ( apply_filters( 'wprss_use_fixed_feed_limit', FALSE ) === TRUE && isset( $general_settings['limit_feed_items_db'] ) ) {
488
  wprss_old_truncate_posts();
489
  }
490
-
491
  }
492
 
493
 
494
-
495
-
496
  /**
497
  * The old truncation function.
498
  * This truncation method uses the deprecated fixed feed limit.
5
  * @package WPRSSAggregator
6
  */
7
 
 
8
  /**
9
  * Returns whether or not the feed source will forcefully fetch the next fetch,
10
  * ignoring whether or not it is paused or not.
19
  }
20
 
21
 
 
22
  /**
23
  * Change the default feed cache recreation period to 2 hours
24
  *
62
  }
63
 
64
 
 
65
  /**
66
  * Returns all the feed items of a source.
67
  *
145
  }
146
 
147
 
 
148
  /**
149
  * Returns the image of the feed.
150
  * The reason this function exists is for add-ons to be able to detect if the plugin core
222
  }
223
 
224
 
 
225
  add_action( 'added_post_meta', 'wprss_update_feed_meta', 10, 4 );
226
  add_action( 'updated_post_meta', 'wprss_update_feed_meta', 10, 4 );
227
  /**
348
  }
349
 
350
 
 
351
  /**
352
  * Returns whether or not the feed source is deleting its feeed items.
353
  *
374
  }
375
 
376
 
 
377
  /**
378
  * Returns the given parameter as a string. Used in wprss_truncate_posts()
379
  *
385
  }
386
 
387
 
 
388
  /**
389
  * Returns true if the feed item is older than the given timestamp,
390
  * false otherwise;
479
  if ( apply_filters( 'wprss_use_fixed_feed_limit', FALSE ) === TRUE && isset( $general_settings['limit_feed_items_db'] ) ) {
480
  wprss_old_truncate_posts();
481
  }
 
482
  }
483
 
484
 
 
 
485
  /**
486
  * The old truncation function.
487
  * This truncation method uses the deprecated fixed feed limit.
includes/licensing.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Returns all registered addons.
6
+ *
7
+ * @since 4.4.5
8
+ */
9
+ function wprss_get_addons() {
10
+ return apply_filters( 'wprss_register_addon', array() );
11
+ }
12
+
13
+
14
+ /**
15
+ * Calls the EDD Software Licensing API to perform licensing tasks on the addon's store server.
16
+ *
17
+ * @since 4.4.5
18
+ */
19
+ function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_license' ) {
20
+ // If no license argument was given
21
+ if ( $license_key === NULL ) {
22
+ // Get the license key
23
+ $license_key = wprss_get_license_key( $addon );
24
+ }
25
+ // Get the license status from the DB
26
+ $license_status = wprss_get_license_status( $addon );
27
+
28
+ // Prepare constants
29
+ $item_name = strtoupper( $addon );
30
+ $item_name_constant = constant( "WPRSS_{$item_name}_SL_ITEM_NAME" );
31
+ $store_url_constant = constant( "WPRSS_{$item_name}_SL_STORE_URL" );
32
+
33
+ // data to send in our API request
34
+ $api_params = array(
35
+ 'edd_action' => $action,
36
+ 'license' => $license_key,
37
+ 'item_name' => urlencode( $item_name_constant )
38
+ );
39
+
40
+ // Call the custom API.
41
+ $response = wp_remote_get( add_query_arg( $api_params, $store_url_constant ) );
42
+
43
+ // If the response is an error, return the value in the DB
44
+ if ( is_wp_error( $response ) ) return $license_status;
45
+
46
+ // decode the license data
47
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
48
+
49
+ // Update the DB option
50
+ $license_statuses["{$addon}_license_status"] = $license_data->license;
51
+ update_option( 'wprss_settings_license_statuses', $license_statuses );
52
+
53
+ // Return TRUE if it is 'active', FALSE otherwise
54
+ return $license_data->license;
55
+ }
56
+
57
+
58
+ /**
59
+ * Returns the license status. Also updates the status in the DB.
60
+ *
61
+ * @since 4.4.5
62
+ */
63
+ function wprss_edd_check_license( $addon, $license_key = NULL ) {
64
+ return wprss_edd_licensing_api( $addon, $license_key, 'check_license' );
65
+ }
66
+
67
+
68
+ /**
69
+ * Activates an addon's license.
70
+ *
71
+ * @since 4.4.5
72
+ */
73
+ function wprss_edd_activate_license( $addon, $license_key = NULL ) {
74
+ return wprss_edd_licensing_api( $addon, $license_key, 'activate_license' );
75
+ }
76
+
77
+
78
+ /**
79
+ * Deactivates an addon's license.
80
+ *
81
+ * @since 4.4.5
82
+ */
83
+ function wprss_edd_deactivate_license( $addon, $license_key = NULL ) {
84
+ return wprss_edd_licensing_api( $addon, $license_key, 'deactivate_license' );
85
+ }
86
+
87
+
88
+ /**
89
+ * Returns an array of the default license settings. Used for plugin activation.
90
+ *
91
+ * @since 4.4.5
92
+ *
93
+ */
94
+ function wprss_default_license_settings( $addon ) {
95
+ // Set up the default license settings
96
+ $settings = apply_filters(
97
+ 'wprss_default_license_settings',
98
+ array(
99
+ "{$addon}_license_key" => FALSE,
100
+ "{$addon}_license_status" => 'invalid'
101
+ )
102
+ );
103
+
104
+ // Return the default settings
105
+ return $settings;
106
+ }
107
+
108
+ /**
109
+ * Returns the saved license code.
110
+ *
111
+ * @since 4.4.5
112
+ */
113
+ function wprss_get_license_key( $addon ) {
114
+ // Get default and current options
115
+ $defaults = wprss_default_license_settings( $addon );
116
+ $keys = get_option( 'wprss_settings_license_keys', array() );
117
+ // Prepare the array key and target
118
+ $k = "{$addon}_license_key";
119
+ // Return the appropriate value
120
+ return isset( $keys["{$addon}_license_key"] )? $keys[$k] : $defaults[$k];
121
+ }
122
+
123
+
124
+ /**
125
+ * Returns the saved license code.
126
+ *
127
+ * @since 4.4.5
128
+ */
129
+ function wprss_get_license_status( $addon ) {
130
+ // Get the default and current options
131
+ $defaults = wprss_default_license_settings( $addon );
132
+ $statuses = get_option( 'wprss_settings_license_statuses', array() );
133
+ // Prepare the key
134
+ $k = "{$addon}_license_status";
135
+ // Return the appropriate value
136
+ return isset( $statuses["{$addon}_license_status"] )? $statuses[$k] : $defaults[$k];
137
+ }
138
+
139
+
140
+ add_action( 'wprss_admin_init', 'wprss_license_settings', 100 );
141
+ /**
142
+ * Adds the license sections and settings for registered add-ons.
143
+ *
144
+ * @since 4.4.5
145
+ */
146
+ function wprss_license_settings() {
147
+ $addons = wprss_get_addons();
148
+ foreach( $addons as $addon_id => $addon_name ) {
149
+ // Settings Section
150
+ add_settings_section(
151
+ "wprss_settings_{$addon_id}_licenses_section",
152
+ $addon_name . __( 'License', 'wprss' ),
153
+ '__return_empty_string',
154
+ 'wprss_settings_license_keys'
155
+ );
156
+ // License key field
157
+ add_settings_field(
158
+ "wprss_settings_{$addon_id}_license",
159
+ __( 'License Key', 'wprss' ),
160
+ 'wprss_license_key_field',
161
+ 'wprss_settings_license_keys',
162
+ "wprss_settings_{$addon_id}_licenses_section",
163
+ array( $addon_id )
164
+ );
165
+ // Activate license button
166
+ add_settings_field(
167
+ "wprss_settings_{$addon_id}_activate_license",
168
+ __( 'Activate License', 'wprss' ),
169
+ 'wprss_activate_license_button',
170
+ 'wprss_settings_license_keys',
171
+ "wprss_settings_{$addon_id}_licenses_section",
172
+ array( $addon_id )
173
+ );
174
+ }
175
+ }
176
+
177
+
178
+ /**
179
+ * Renders the license field for a particular add-on.
180
+ *
181
+ * @since 4.4.5
182
+ */
183
+ function wprss_license_key_field( $args ) {
184
+ $addon_id = $args[0];
185
+ $license = wprss_get_license_key( $addon_id ); ?>
186
+ <input id="wprss-<?php echo $addon_id; ?>-license-key" name="wprss_settings_license_keys[<?php echo $addon_id; ?>_license_key]"
187
+ type="text" value="<?php echo esc_attr( $license ); ?>" style="width: 300px;"
188
+ />
189
+ <label class='description' for='wprss-<?php echo $addon_id; ?>-license-key'>
190
+ <?php _e( 'Enter your license key', 'wprss' ); ?>
191
+ </label> <?
192
+ }
193
+
194
+
195
+ /**
196
+ * Renders the activate/deactivate license button for a particular add-on.
197
+ *
198
+ * @since 4.4.5
199
+ */
200
+ function wprss_activate_license_button( $args ) {
201
+ $addon_id = $args[0];
202
+ $status = wprss_edd_check_license( $addon_id );
203
+ if ( $status === 'site_inactive' ) $status = 'inactive';
204
+
205
+ $valid = $status == 'valid';
206
+ $btn_text = $valid ? 'Deactivate License' : 'Activate License';
207
+ $btn_name = "wprss_{$addon_id}_license_" . ( $valid? 'deactivate' : 'activate' );
208
+ wp_nonce_field( "wprss_{$addon_id}_license_nonce", "wprss_{$addon_id}_license_nonce" ); ?>
209
+
210
+ <input type="submit" class="button-secondary" name="<?php echo $btn_name; ?>" value="<?php _e( $btn_text, 'wprss' ); ?>" />
211
+ <span id="wprss-<?php echo $addon_id; ?>-license-status-text">
212
+ <strong>Status:
213
+ <span class="wprss-<?php echo $addon_id; ?>-license-<?php echo $status; ?>">
214
+ <?php _e( ucfirst($status), 'wprss' ); ?>
215
+ <?php if ( $status === 'valid' ) : ?>
216
+ <i class="fa fa-check"></i>
217
+ <?php elseif( $status === 'invalid' ): ?>
218
+ <i class="fa fa-times"></i>
219
+ <?php elseif( $status === 'inactive' ): ?>
220
+ <i class="fa fa-warning"></i>
221
+ <?php endif; ?>
222
+ </strong>
223
+ </span>
224
+ </span>
225
+
226
+ <style type="text/css">
227
+ .wprss-<?php echo $addon_id; ?>-license-valid {
228
+ color: green;
229
+ }
230
+ .wprss-<?php echo $addon_id; ?>-license-invalid {
231
+ color: #b71919;
232
+ }
233
+ .wprss-<?php echo $addon_id; ?>-license-inactive {
234
+ color: #d19e5b;
235
+ }
236
+ #wprss-<?php echo $addon_id; ?>-license-status-text {
237
+ margin-left: 8px;
238
+ line-height: 27px;
239
+ vertical-align: middle;
240
+ }
241
+ </style>
242
+
243
+
244
+ <?php
245
+ }
246
+
247
+
248
+ //add_action( 'admin_init', 'wprss_process_addon_license' );
249
+ /**
250
+ * Handles the activation/deactivation process
251
+ *
252
+ * @since 1.0
253
+ */
254
+ function wprss_process_addon_license() {
255
+ $addons = wprss_get_addons();
256
+
257
+ // Get for each registered addon
258
+ foreach( $addons as $id => $name ) {
259
+
260
+ // listen for our activate button to be clicked
261
+ if( isset( $_POST["wprss_{$id}_license_activate"] ) || isset( $_POST["wprss_{$id}_license_deactivate"] ) ) {
262
+ // run a quick security check
263
+ if( ! check_admin_referer( "wprss_{$id}_license_nonce", "wprss_{$id}_license_nonce" ) )
264
+ continue; // get out if we didn't click the Activate/Deactivate button
265
+ }
266
+
267
+ // retrieve the license keys and statuses from the database
268
+ $license = wprss_get_license_key( $id );
269
+ $license_statuses = get_option( 'wprss_settings_license_statuses' );
270
+
271
+ // If the license is not saved in DB, but is included in POST
272
+ if ( $license == '' && !empty($_POST['wprss_settings_license_keys'][$id.'_license_key']) ) {
273
+ // Use the license given in POST
274
+ $license = $_POST['wprss_settings_license_keys'][$id.'_license_key'];
275
+ }
276
+
277
+ // Prepare the action to take
278
+ if ( isset( $_POST['wprss_kf_license_activate'] ) ) {
279
+ $action = 'activate';
280
+ }
281
+ elseif ( isset( $_POST['wprss_kf_license_deactivate'] ) ) {
282
+ $action = 'deactivate';
283
+ }
284
+ else continue;
285
+
286
+ // Call the API accordingly
287
+ wprss_edd_licensing_api( $id, $license, $action );
288
+ }
289
+ }
includes/opml-importer.php CHANGED
@@ -129,35 +129,42 @@
129
  * @since 3.3
130
  * @param $outline The outline OPML element
131
  */
132
- private function import_opml_feed( $outline ) {
133
- // IF the necassary fields are not present in the element
134
- if ( !isset( $outline['title'] ) && !isset( $outline['xmlUrl'] ) ) {
135
- // Check if the element is an array
136
- if ( is_array( $outline ) ) {
137
- // Treat it as an array of sub <outline> elements
138
- $inserted_ids = array();
139
- // Insert all sub outline elements
140
- foreach ( $outline as $key => $sub_outline ) {
141
- $inserted_ids[] = $this->import_opml_feed( $sub_outline );
142
- }
143
- // Return the inserted IDs
144
- return $inserted_ids;
145
- }
146
- // IF not an array, return NULL
147
- else return NULL;
148
- }
149
-
150
- // Create an associative array, with the feed's properties
151
- $feed = array(
152
- 'post_title' => $outline['title'],
153
- 'post_content' => '',
154
- 'post_status' => 'publish',
155
- 'post_type' => 'wprss_feed'
 
 
156
  );
 
157
  // Insert the post into the database and store the inserted ID
158
  $inserted_id = wp_insert_post( $feed );
159
  // Update the post's meta
160
- update_post_meta( $inserted_id, 'wprss_url', $outline['xmlUrl'] );
 
 
 
 
161
  // Return inserted ID
162
  return $inserted_id;
163
  }
129
  * @since 3.3
130
  * @param $outline The outline OPML element
131
  */
132
+ private function import_opml_feed( $outline ) {
133
+ // IF the necassary fields are not present in the element
134
+ if ( !isset( $outline['title'] ) && !isset( $outline['xmlUrl'] ) ) {
135
+ // Check if the element is an array
136
+ if ( is_array( $outline ) ) {
137
+ // Treat it as an array of sub <outline> elements
138
+ $inserted_ids = array();
139
+ // Insert all sub outline elements
140
+ foreach ( $outline as $key => $sub_outline ) {
141
+ $inserted_ids[] = $this->import_opml_feed( $sub_outline );
142
+ }
143
+ // Return the inserted IDs
144
+ return $inserted_ids;
145
+ }
146
+ // IF not an array, return NULL
147
+ else return NULL;
148
+ }
149
+ // Create an associative array, with the feed's properties
150
+ $feed = apply_filters(
151
+ 'wprss_opml_insert_feed',
152
+ array(
153
+ 'post_title' => $outline['title'],
154
+ 'post_content' => '',
155
+ 'post_status' => 'publish',
156
+ 'post_type' => 'wprss_feed'
157
+ )
158
  );
159
+
160
  // Insert the post into the database and store the inserted ID
161
  $inserted_id = wp_insert_post( $feed );
162
  // Update the post's meta
163
+ update_post_meta( $inserted_id, 'wprss_url', $outline['xmlUrl'] );
164
+
165
+ // Trigger an action, to allow modifications to the inserted feed, based on the outline element
166
+ do_action( 'wprss_opml_inserted_feed', $inserted_id, $outline );
167
+
168
  // Return inserted ID
169
  return $inserted_id;
170
  }
includes/scripts.php CHANGED
@@ -57,6 +57,13 @@
57
  wp_enqueue_style( 'wprss-admin-styles', WPRSS_CSS . 'admin-styles.css' );
58
  }
59
 
 
 
 
 
 
 
 
60
  do_action( 'wprss_admin_scripts_styles' );
61
  } // end wprss_admin_scripts_styles
62
 
57
  wp_enqueue_style( 'wprss-admin-styles', WPRSS_CSS . 'admin-styles.css' );
58
  }
59
 
60
+ // Creates the wprss_urls object in JS
61
+ wp_localize_script( 'wprss-admin-custom', 'wprss_urls',
62
+ array(
63
+ 'import_export' => admin_url('edit.php?post_type=wprss_feed&page=wprss-import-export-settings')
64
+ )
65
+ );
66
+
67
  do_action( 'wprss_admin_scripts_styles' );
68
  } // end wprss_admin_scripts_styles
69
 
js/admin-custom.js CHANGED
@@ -173,6 +173,9 @@ jQuery(window).load( function(){
173
  (function($){
174
  $(window).load( function(){
175
 
 
 
 
176
  // Initialize all collapsable meta settings
177
  $('.wprss-meta-slider').each(function(){
178
  // Get all required elements
173
  (function($){
174
  $(window).load( function(){
175
 
176
+ // Adds the Bulk Add button
177
+ $('<a>').text('Bulk Add').attr('href', wprss_urls.import_export).addClass('add-new-h2').insertAfter( $('.add-new-h2') );
178
+
179
  // Initialize all collapsable meta settings
180
  $('.wprss-meta-slider').each(function(){
181
  // Get all required elements
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.wprssaggregator.com
5
  Tags: rss, feeds, aggregation, rss to post, 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.9.1
8
- Stable tag: 4.4.4
9
  License: GPLv2 or later
10
  Imports and aggregates multiple RSS Feeds using SimplePie. Outputs feeds sorted by date (latest first).
11
 
@@ -163,14 +163,20 @@ The full documentation section can be found on the [WP RSS Aggregator website](w
163
 
164
  == Changelog ==
165
 
 
 
 
 
 
 
166
  = 4.4.4 (2014-08-19) =
167
- * Fixed bug: More fatal errors when using PHP version 5.3 or lower.
168
 
169
  = 4.4.3 (2014-08-19) =
170
- * Fixed bug: Fatal error when using PHP version 5.3 or lower.
171
 
172
  = 4.4.2 (2014-08-19) =
173
- * Fixed bug: Fatal error when using PHP version 5.3 or lower.
174
 
175
  = 4.4.1 (2014-08-18) =
176
  * Enhanced: Various improvements to the plugin interface and texts.
5
  Tags: rss, feeds, aggregation, rss to post, 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.9.1
8
+ Stable tag: 4.5
9
  License: GPLv2 or later
10
  Imports and aggregates multiple RSS Feeds using SimplePie. Outputs feeds sorted by date (latest first).
11
 
163
 
164
  == Changelog ==
165
 
166
+ = 4.5 (2014-08-25) =
167
+ * New Feature: Bulk importer allows you to create multiple feed sources at once.
168
+ * Enhanced: Improved OPML importer with added hooks.
169
+ * Enhanced: Centralized add-on licensing, fixing multiple bugs.
170
+ * Fixed bug: Undefined `feed_limit` errors when using the shortcode.
171
+
172
  = 4.4.4 (2014-08-19) =
173
+ * Fixed bug: Errors when using older PHP versions 5.3 or lower.
174
 
175
  = 4.4.3 (2014-08-19) =
176
+ * Fixed bug: Errors when using older PHP versions 5.3 or lower.
177
 
178
  = 4.4.2 (2014-08-19) =
179
+ * Fixed bug: Errors when using older PHP versions 5.3 or lower.
180
 
181
  = 4.4.1 (2014-08-18) =
182
  * Enhanced: Various improvements to the plugin interface and texts.
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: 4.4.4
7
  Author: Jean Galea
8
  Author URI: http://www.wprssaggregator.com
9
  License: GPLv2
@@ -29,7 +29,7 @@
29
 
30
  /**
31
  * @package WPRSSAggregator
32
- * @version 4.4.4
33
  * @since 1.0
34
  * @author Jean Galea <info@wprssaggregator.com>
35
  * @copyright Copyright (c) 2012-2014, Jean Galea
@@ -43,7 +43,7 @@
43
 
44
  // Set the version number of the plugin.
45
  if( !defined( 'WPRSS_VERSION' ) )
46
- define( 'WPRSS_VERSION', '4.4.4', true );
47
 
48
  // Set the database version number of the plugin.
49
  if( !defined( 'WPRSS_DB_VERSION' ) )
@@ -178,6 +178,9 @@
178
 
179
  /* Load the security reset file */
180
  require_once ( WPRSS_INC . 'secure-reset.php' );
 
 
 
181
 
182
  /* Load the admin editor file */
183
  require_once ( WPRSS_INC . 'admin-editor.php' );
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: 4.5
7
  Author: Jean Galea
8
  Author URI: http://www.wprssaggregator.com
9
  License: GPLv2
29
 
30
  /**
31
  * @package WPRSSAggregator
32
+ * @version 4.5
33
  * @since 1.0
34
  * @author Jean Galea <info@wprssaggregator.com>
35
  * @copyright Copyright (c) 2012-2014, Jean Galea
43
 
44
  // Set the version number of the plugin.
45
  if( !defined( 'WPRSS_VERSION' ) )
46
+ define( 'WPRSS_VERSION', '4.5', true );
47
 
48
  // Set the database version number of the plugin.
49
  if( !defined( 'WPRSS_DB_VERSION' ) )
178
 
179
  /* Load the security reset file */
180
  require_once ( WPRSS_INC . 'secure-reset.php' );
181
+
182
+ /* Load the licensing file */
183
+ require_once ( WPRSS_INC . 'licensing.php' );
184
 
185
  /* Load the admin editor file */
186
  require_once ( WPRSS_INC . 'admin-editor.php' );