WP RSS Aggregator - Version 4.6.8

Version Description

(2014-01-07) = * Enhanced: Added more logging during feed importing. * Enhanced: Irrelevent metaboxes added by other plugins are now removed from the Add/Edit Feed Source page. * Fixed bug: Valid feed URLS were being invalidated. * Fixed bug: The Blacklist feature was being hidden when the Feed to Post add-on was enabled. * Fixed bug: Patched a vulnerability where any user on the site can issue a feed fetch. * Fixed bug: The "Activate" and "Pause" actions are not shown in the bulk actions dropdown in WordPress v4.1.

Download this release

Release Info

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

Code changes from version 4.6.7 to 4.6.8

changelog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  4.6.7 (2014-12-17)
2
  Enhanced: Some minor interface updates.
3
  Enhanced: Added filters for use by the premium add-ons.
1
+ 4.6.8 (2014-01-07)
2
+ Enhanced: Added more logging during feed importing.
3
+ Enhanced: Irrelevent metaboxes added by other plugins are now removed from the Add/Edit Feed Source page.
4
+ Fixed bug: Valid feed URLS were being invalidated.
5
+ Fixed bug: The Blacklist feature was being hidden when the Feed to Post add-on was enabled.
6
+ Fixed bug: Patched a vulnerability where any user on the site can issue a feed fetch.
7
+ Fixed bug: The "Activate" and "Pause" actions are not shown in the bulk actions dropdown in WordPress v4.1.
8
+
9
  4.6.7 (2014-12-17)
10
  Enhanced: Some minor interface updates.
11
  Enhanced: Added filters for use by the premium add-ons.
includes/admin-display.php CHANGED
@@ -456,6 +456,7 @@
456
  */
457
  function wprss_fetch_feeds_action_hook() {
458
  if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
 
459
  $id = $_POST['id'];
460
  update_post_meta( $id, 'wprss_force_next_fetch', '1' );
461
 
@@ -479,6 +480,7 @@
479
 
480
  // Schedule the event for 5 seconds from now
481
  wp_schedule_single_event( time() + 1, 'wprss_fetch_single_feed_hook', $schedule_args );
 
482
  die();
483
  }
484
  }
456
  */
457
  function wprss_fetch_feeds_action_hook() {
458
  if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
459
+ if ( ! current_user_can( 'edit_feed_sources' ) ) die();
460
  $id = $_POST['id'];
461
  update_post_meta( $id, 'wprss_force_next_fetch', '1' );
462
 
480
 
481
  // Schedule the event for 5 seconds from now
482
  wp_schedule_single_event( time() + 1, 'wprss_fetch_single_feed_hook', $schedule_args );
483
+ wprss_flag_feed_as_updating( $id );
484
  die();
485
  }
486
  }
includes/admin-metaboxes.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- add_action( 'add_meta_boxes', 'wprss_add_meta_boxes');
4
  /**
5
  * Set up the input boxes for the wprss_feed post type
6
  *
@@ -8,10 +8,13 @@
8
  */
9
  function wprss_add_meta_boxes() {
10
  global $wprss_meta_fields;
11
-
12
  // Remove the default WordPress Publish box, because we will be using custom ones
13
  remove_meta_box( 'submitdiv', 'wprss_feed', 'side' );
14
-
 
 
 
15
  add_meta_box(
16
  'submitdiv', // $id
17
  __( 'Save Feed Source', WPRSS_TEXT_DOMAIN ), // $title
@@ -49,7 +52,7 @@
49
  'low'
50
  );
51
  }
52
-
53
  add_meta_box(
54
  'custom_meta_box',
55
  __( 'Feed Source Details', WPRSS_TEXT_DOMAIN ),
@@ -58,18 +61,31 @@
58
  'normal',
59
  'high'
60
  );
61
-
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
 
64
 
65
- /**
66
  * Set up fields for the meta box for the wprss_feed post type
67
- *
68
  * @since 2.0
69
- */
70
  function wprss_get_custom_fields() {
71
  $prefix = 'wprss_';
72
-
73
  // Field Array
74
  $wprss_meta_fields[ 'url' ] = array(
75
  'label' => __( 'URL', WPRSS_TEXT_DOMAIN ),
@@ -96,11 +112,11 @@
96
  }
97
 
98
 
99
- /**
100
  * Set up the meta box for the wprss_feed post type
101
- *
102
  * @since 2.0
103
- */
104
  function wprss_show_meta_box_callback() {
105
  global $post;
106
  $meta_fields = wprss_get_custom_fields();
@@ -108,8 +124,8 @@
108
  $help = WPRSS_Help::get_instance();
109
 
110
  // Use nonce for verification
111
- wp_nonce_field( basename( __FILE__ ), 'wprss_meta_box_nonce' );
112
-
113
  // Fix for WordpRess SEO JS issue
114
  ?><input type="hidden" id="content" value="" /><?php
115
 
@@ -123,23 +139,23 @@
123
  ?><tr>
124
  <th><label for="<?php echo $field['id'] ?>"><?php echo $field['label'] /* Should be already translated */ ?></label></th>
125
  <td><?php
126
-
127
  if ( isset( $field['before'] ) && !empty( $field['before'] ) ) {
128
  call_user_func( $field['before'] );
129
  }
130
-
131
  // Add default placeholder value
132
  $field = wp_parse_args( $field, array(
133
  'desc' => '',
134
  'placeholder' => '',
135
  'type' => 'text'
136
  ) );
137
-
138
  $tooltip = isset( $field['tooltip'] ) ? trim( $field['tooltip'] ) : null;
139
  $tooltip_id = isset( $field['id'] ) ? $field_tooltip_id_prefix . $field['id'] : uniqid( $field_tooltip_id_prefix );
140
-
141
  $field_description = __( $field['desc'], WPRSS_TEXT_DOMAIN );
142
-
143
  /*
144
  * So, here's how tooltips work here.
145
  * Tooltip output will be attempted in any case.
@@ -149,9 +165,9 @@
149
  * is by default an empty string, but can be altered
150
  * by the `tooltip_not_found_handle_html` option of `WPRSS_Help`.
151
  */
152
-
153
  switch( $field['type'] ) {
154
-
155
  // text/url
156
  case 'url':
157
  case 'text':
@@ -161,7 +177,7 @@
161
  ?><br /><label for="<?php echo $field['id'] ?>"><span class="description"><?php _e( $field['desc'], WPRSS_TEXT_DOMAIN ) ?></span></label><?php
162
  }
163
  break;
164
-
165
  // textarea
166
  case 'textarea':
167
  ?><textarea name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" cols="60" rows="4"><?php echo esc_attr( $meta ) ?></textarea><?php
@@ -170,7 +186,7 @@
170
  ?><br /><label for="<?php echo $field['id'] ?>"><span class="description"><?php echo $field_description ?></span></label><?php
171
  }
172
  break;
173
-
174
  // checkbox
175
  case 'checkbox':
176
  ?>
@@ -180,8 +196,8 @@
180
  if ( strlen( trim( $field['desc'] ) ) > 0 ) {
181
  ?><label for="<?php echo $field['id'] ?>"><span class="description"><?php echo $field_description ?></span></label><?php
182
  }
183
- break;
184
-
185
  // select
186
  case 'select':
187
  ?><select name="<?php echo $field['id'] ?>" id="<?php $field['id'] ?>"><?php
@@ -194,8 +210,8 @@
194
  if ( strlen( trim( $field['desc'] ) ) > 0 ) {
195
  ?><label for="<?php echo $field['id'] ?>"><span class="description"><?php echo $field_description ?></span></label><?php
196
  }
197
- break;
198
-
199
  // number
200
  case 'number':
201
  ?><input class="wprss-number-roller" type="number" placeholder="<?php _e( 'Default', WPRSS_TEXT_DOMAIN ) ?>" min="0" name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" value="<?php echo esc_attr( $meta ) ?>" /><?php
@@ -215,11 +231,11 @@
215
  } // end foreach
216
  ?></table><?php
217
  }
218
-
219
 
220
  /**
221
  * Adds the link that validates the feed
222
- * @since 3.9.5
223
  */
224
  function wprss_validate_feed_link() {
225
  ?>
@@ -253,25 +269,25 @@
253
 
254
 
255
 
256
- add_action( 'save_post', 'wprss_save_custom_fields', 10, 2 );
257
- /**
258
  * Save the custom fields
259
- *
260
  * @since 2.0
261
- */
262
  function wprss_save_custom_fields( $post_id, $post ) {
263
  $meta_fields = wprss_get_custom_fields();
264
 
265
  /* Verify the nonce before proceeding. */
266
  if ( !isset( $_POST['wprss_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wprss_meta_box_nonce'], basename( __FILE__ ) ) )
267
- return $post_id;
268
 
269
  /* Get the post type object. */
270
  $post_type = get_post_type_object( $post->post_type );
271
 
272
  /* Check if the current user has permission to edit the post. */
273
  if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
274
- return $post_id;
275
 
276
  /* // Stop WP from clearing custom fields on autosave - maybe not needed
277
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
@@ -287,8 +303,8 @@
287
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
288
  return;
289
  if ( defined( 'DOING_CRON' ) && DOING_CRON )
290
- return;
291
-
292
  // Change the limit, if it is zero, to an empty string
293
  if ( isset( $_POST['wprss_limit'] ) && strval( $_POST['wprss_limit'] ) == '0' ) {
294
  $_POST['wprss_limit'] = '';
@@ -338,21 +354,21 @@
338
  if ( $update_interval === wprss_get_default_feed_source_update_interval() ) {
339
  wp_schedule_single_event( time(), 'wprss_fetch_single_feed_hook', array( $post_id ) );
340
  }
341
- }
342
 
343
 
344
- /**
345
  * Generate a preview of the latest 5 posts from the feed source being added/edited
346
- *
347
  * @since 2.0
348
- */
349
  function wprss_preview_meta_box_callback() {
350
  global $post;
351
  $feed_url = get_post_meta( $post->ID, 'wprss_url', true );
352
-
353
  $help = WPRSS_Help::get_instance();
354
  /* @var $help WPRSS_Help */
355
-
356
  if ( ! empty( $feed_url ) ) {
357
  $feed = wprss_fetch_feed( $feed_url, $post->ID );
358
  if ( ! is_wp_error( $feed ) ) {
@@ -423,7 +439,7 @@
423
 
424
  /**
425
  * Renders the Feed Processing metabox
426
- *
427
  * @since 3.7
428
  */
429
  function wprss_feed_processing_meta_box_callback() {
@@ -467,7 +483,7 @@
467
  // Inline help
468
  $help = WPRSS_Help::get_instance();
469
  $help_options = array('tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-side');
470
-
471
  ?>
472
 
473
  <div class="wprss-meta-side-setting">
@@ -556,93 +572,93 @@
556
  </div>
557
  </div>
558
 
559
-
560
  <?php
561
  }
562
 
563
 
564
 
565
- /**
566
  * Generate Help meta box
567
- *
568
  * @since 2.0
569
- *
570
- */
571
- function wprss_help_meta_box_callback() {
572
  echo '<p><a href="http://www.wprssaggregator.com/documentation/">View the documentation</p>';
573
  echo '<p><strong>';
574
  _e( 'Need help?', WPRSS_TEXT_DOMAIN );
575
  echo '</strong> <a target="_blank" href="http://wordpress.org/support/plugin/wp-rss-aggregator">';
576
- _e( 'Check out the support forum', WPRSS_TEXT_DOMAIN );
 
 
 
577
  echo '</a></p>';
578
- echo '</strong> <a target="_blank" href="http://www.wprssaggregator.com/feature-requests/">';
579
- _e( 'Suggest a new feature', WPRSS_TEXT_DOMAIN );
580
- echo '</a></p>';
581
  }
582
 
583
- /**
584
  * Generate Like this plugin meta box
585
- *
586
  * @since 2.0
587
- *
588
- */
589
  function wprss_like_meta_box_callback() { ?>
590
-
591
  <ul>
592
- <li><a href="http://wordpress.org/extend/plugins/wp-rss-aggregator/"><?php _e( 'Give it a 5 star rating on WordPress.org', WPRSS_TEXT_DOMAIN ) ?></a></li>
593
  <li class="donate_link"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ"><?php _e( 'Donate a token of your appreciation', WPRSS_TEXT_DOMAIN ); ?></a></li>
594
- </ul>
595
  <?php
596
- echo '<p><strong>';
597
  _e( 'Check out the Premium Extensions:', WPRSS_TEXT_DOMAIN );
598
  echo '</strong>'; ?>
599
  <ul>
600
- <li><a href="http://www.wprssaggregator.com/extension/feed-to-post/"><?php echo 'Feed to Post'; ?></a></li>
601
- <li><a href="http://www.wprssaggregator.com/extension/excerpts-thumbnails/"><?php echo 'Excerpts & Thumbnails'; ?></a></li>
602
  <li><a href="http://www.wprssaggregator.com/extension/categories/"><?php echo 'Categories'; ?></a></li>
603
  <li><a href="http://www.wprssaggregator.com/extension/keyword-filtering/"><?php echo 'Keyword Filtering'; ?></a></li>
604
- </ul>
605
  </p>
606
- <?php }
607
 
608
 
609
- /**
610
  * Generate Follow us plugin meta box
611
- *
612
  * @since 2.0
613
- *
614
- */
615
- function wprss_follow_meta_box_callback() {
616
- ?>
617
  <ul>
618
  <li class="twitter"><a href="http://twitter.com/wpmayor"><?php _e( 'Follow WP Mayor on Twitter.', WPRSS_TEXT_DOMAIN ) ?></a></li>
619
  <li class="facebook"><a href="https://www.facebook.com/wpmayor"><?php _e( 'Like WP Mayor on Facebook.', WPRSS_TEXT_DOMAIN ) ?></a></li>
620
- </ul>
621
- <?php }
622
 
623
 
624
  add_action( 'add_meta_boxes', 'wprss_remove_meta_boxes', 100 );
625
  /**
626
  * Remove unneeded meta boxes from add feed source screen
627
- *
628
  * @since 2.0
629
- */
630
  function wprss_remove_meta_boxes() {
631
- if ( 'wprss_feed' !== get_current_screen()->id ) return;
632
- // Remove meta boxes of other plugins that tend to appear on all posts
633
  //remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' );
634
  remove_meta_box( 'postpsp', 'wprss_feed' ,'normal' );
635
  remove_meta_box( 'su_postmeta', 'wprss_feed' ,'normal' );
636
- remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' );
637
- remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' );
638
- remove_meta_box( 'wpar_plugin_meta_box ', 'wprss_feed' ,'normal' );
639
  remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' );
640
- remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' );
641
  remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' );
642
  remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' );
643
  remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' );
644
  remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' );
645
- remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' );
646
- remove_meta_box( 'aiosp', 'wprss_feed' ,'advanced' );
647
- remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' );
648
  }
1
  <?php
2
 
3
+ add_action( 'add_meta_boxes', 'wprss_add_meta_boxes', 99);
4
  /**
5
  * Set up the input boxes for the wprss_feed post type
6
  *
8
  */
9
  function wprss_add_meta_boxes() {
10
  global $wprss_meta_fields;
11
+
12
  // Remove the default WordPress Publish box, because we will be using custom ones
13
  remove_meta_box( 'submitdiv', 'wprss_feed', 'side' );
14
+
15
+ // Remove some plugin's metaboxes because they're not relevant to the wprss_feed post type.
16
+ wprss_remove_unrelated_meta_boxes();
17
+
18
  add_meta_box(
19
  'submitdiv', // $id
20
  __( 'Save Feed Source', WPRSS_TEXT_DOMAIN ), // $title
52
  'low'
53
  );
54
  }
55
+
56
  add_meta_box(
57
  'custom_meta_box',
58
  __( 'Feed Source Details', WPRSS_TEXT_DOMAIN ),
61
  'normal',
62
  'high'
63
  );
64
+
65
+ }
66
+
67
+
68
+ /**
69
+ * Removes some other plugin's metaboxes because they're not relevant to the wprss_feed post type.
70
+ *
71
+ * @since 4.7
72
+ */
73
+ function wprss_remove_unrelated_meta_boxes() {
74
+ $post_type = 'wprss_feed';
75
+ remove_meta_box( 'wpseo_meta', $post_type, 'normal'); // WP SEO Yoast
76
+ remove_meta_box( 'ta-reviews-post-meta-box', $post_type, 'normal'); // Author hReview
77
+ remove_meta_box( 'wpdf_editor_section', $post_type, 'advanced'); // ImageInject
78
  }
79
 
80
 
81
+ /**
82
  * Set up fields for the meta box for the wprss_feed post type
83
+ *
84
  * @since 2.0
85
+ */
86
  function wprss_get_custom_fields() {
87
  $prefix = 'wprss_';
88
+
89
  // Field Array
90
  $wprss_meta_fields[ 'url' ] = array(
91
  'label' => __( 'URL', WPRSS_TEXT_DOMAIN ),
112
  }
113
 
114
 
115
+ /**
116
  * Set up the meta box for the wprss_feed post type
117
+ *
118
  * @since 2.0
119
+ */
120
  function wprss_show_meta_box_callback() {
121
  global $post;
122
  $meta_fields = wprss_get_custom_fields();
124
  $help = WPRSS_Help::get_instance();
125
 
126
  // Use nonce for verification
127
+ wp_nonce_field( basename( __FILE__ ), 'wprss_meta_box_nonce' );
128
+
129
  // Fix for WordpRess SEO JS issue
130
  ?><input type="hidden" id="content" value="" /><?php
131
 
139
  ?><tr>
140
  <th><label for="<?php echo $field['id'] ?>"><?php echo $field['label'] /* Should be already translated */ ?></label></th>
141
  <td><?php
142
+
143
  if ( isset( $field['before'] ) && !empty( $field['before'] ) ) {
144
  call_user_func( $field['before'] );
145
  }
146
+
147
  // Add default placeholder value
148
  $field = wp_parse_args( $field, array(
149
  'desc' => '',
150
  'placeholder' => '',
151
  'type' => 'text'
152
  ) );
153
+
154
  $tooltip = isset( $field['tooltip'] ) ? trim( $field['tooltip'] ) : null;
155
  $tooltip_id = isset( $field['id'] ) ? $field_tooltip_id_prefix . $field['id'] : uniqid( $field_tooltip_id_prefix );
156
+
157
  $field_description = __( $field['desc'], WPRSS_TEXT_DOMAIN );
158
+
159
  /*
160
  * So, here's how tooltips work here.
161
  * Tooltip output will be attempted in any case.
165
  * is by default an empty string, but can be altered
166
  * by the `tooltip_not_found_handle_html` option of `WPRSS_Help`.
167
  */
168
+
169
  switch( $field['type'] ) {
170
+
171
  // text/url
172
  case 'url':
173
  case 'text':
177
  ?><br /><label for="<?php echo $field['id'] ?>"><span class="description"><?php _e( $field['desc'], WPRSS_TEXT_DOMAIN ) ?></span></label><?php
178
  }
179
  break;
180
+
181
  // textarea
182
  case 'textarea':
183
  ?><textarea name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" cols="60" rows="4"><?php echo esc_attr( $meta ) ?></textarea><?php
186
  ?><br /><label for="<?php echo $field['id'] ?>"><span class="description"><?php echo $field_description ?></span></label><?php
187
  }
188
  break;
189
+
190
  // checkbox
191
  case 'checkbox':
192
  ?>
196
  if ( strlen( trim( $field['desc'] ) ) > 0 ) {
197
  ?><label for="<?php echo $field['id'] ?>"><span class="description"><?php echo $field_description ?></span></label><?php
198
  }
199
+ break;
200
+
201
  // select
202
  case 'select':
203
  ?><select name="<?php echo $field['id'] ?>" id="<?php $field['id'] ?>"><?php
210
  if ( strlen( trim( $field['desc'] ) ) > 0 ) {
211
  ?><label for="<?php echo $field['id'] ?>"><span class="description"><?php echo $field_description ?></span></label><?php
212
  }
213
+ break;
214
+
215
  // number
216
  case 'number':
217
  ?><input class="wprss-number-roller" type="number" placeholder="<?php _e( 'Default', WPRSS_TEXT_DOMAIN ) ?>" min="0" name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" value="<?php echo esc_attr( $meta ) ?>" /><?php
231
  } // end foreach
232
  ?></table><?php
233
  }
234
+
235
 
236
  /**
237
  * Adds the link that validates the feed
238
+ * @since 3.9.5
239
  */
240
  function wprss_validate_feed_link() {
241
  ?>
269
 
270
 
271
 
272
+ add_action( 'save_post', 'wprss_save_custom_fields', 10, 2 );
273
+ /**
274
  * Save the custom fields
275
+ *
276
  * @since 2.0
277
+ */
278
  function wprss_save_custom_fields( $post_id, $post ) {
279
  $meta_fields = wprss_get_custom_fields();
280
 
281
  /* Verify the nonce before proceeding. */
282
  if ( !isset( $_POST['wprss_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wprss_meta_box_nonce'], basename( __FILE__ ) ) )
283
+ return $post_id;
284
 
285
  /* Get the post type object. */
286
  $post_type = get_post_type_object( $post->post_type );
287
 
288
  /* Check if the current user has permission to edit the post. */
289
  if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
290
+ return $post_id;
291
 
292
  /* // Stop WP from clearing custom fields on autosave - maybe not needed
293
  if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
303
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
304
  return;
305
  if ( defined( 'DOING_CRON' ) && DOING_CRON )
306
+ return;
307
+
308
  // Change the limit, if it is zero, to an empty string
309
  if ( isset( $_POST['wprss_limit'] ) && strval( $_POST['wprss_limit'] ) == '0' ) {
310
  $_POST['wprss_limit'] = '';
354
  if ( $update_interval === wprss_get_default_feed_source_update_interval() ) {
355
  wp_schedule_single_event( time(), 'wprss_fetch_single_feed_hook', array( $post_id ) );
356
  }
357
+ }
358
 
359
 
360
+ /**
361
  * Generate a preview of the latest 5 posts from the feed source being added/edited
362
+ *
363
  * @since 2.0
364
+ */
365
  function wprss_preview_meta_box_callback() {
366
  global $post;
367
  $feed_url = get_post_meta( $post->ID, 'wprss_url', true );
368
+
369
  $help = WPRSS_Help::get_instance();
370
  /* @var $help WPRSS_Help */
371
+
372
  if ( ! empty( $feed_url ) ) {
373
  $feed = wprss_fetch_feed( $feed_url, $post->ID );
374
  if ( ! is_wp_error( $feed ) ) {
439
 
440
  /**
441
  * Renders the Feed Processing metabox
442
+ *
443
  * @since 3.7
444
  */
445
  function wprss_feed_processing_meta_box_callback() {
483
  // Inline help
484
  $help = WPRSS_Help::get_instance();
485
  $help_options = array('tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-side');
486
+
487
  ?>
488
 
489
  <div class="wprss-meta-side-setting">
572
  </div>
573
  </div>
574
 
575
+
576
  <?php
577
  }
578
 
579
 
580
 
581
+ /**
582
  * Generate Help meta box
583
+ *
584
  * @since 2.0
585
+ *
586
+ */
587
+ function wprss_help_meta_box_callback() {
588
  echo '<p><a href="http://www.wprssaggregator.com/documentation/">View the documentation</p>';
589
  echo '<p><strong>';
590
  _e( 'Need help?', WPRSS_TEXT_DOMAIN );
591
  echo '</strong> <a target="_blank" href="http://wordpress.org/support/plugin/wp-rss-aggregator">';
592
+ _e( 'Check out the support forum', WPRSS_TEXT_DOMAIN );
593
+ echo '</a></p>';
594
+ echo '</strong> <a target="_blank" href="http://www.wprssaggregator.com/feature-requests/">';
595
+ _e( 'Suggest a new feature', WPRSS_TEXT_DOMAIN );
596
  echo '</a></p>';
 
 
 
597
  }
598
 
599
+ /**
600
  * Generate Like this plugin meta box
601
+ *
602
  * @since 2.0
603
+ *
604
+ */
605
  function wprss_like_meta_box_callback() { ?>
606
+
607
  <ul>
608
+ <li><a href="http://wordpress.org/extend/plugins/wp-rss-aggregator/"><?php _e( 'Give it a 5 star rating on WordPress.org', WPRSS_TEXT_DOMAIN ) ?></a></li>
609
  <li class="donate_link"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ"><?php _e( 'Donate a token of your appreciation', WPRSS_TEXT_DOMAIN ); ?></a></li>
610
+ </ul>
611
  <?php
612
+ echo '<p><strong>';
613
  _e( 'Check out the Premium Extensions:', WPRSS_TEXT_DOMAIN );
614
  echo '</strong>'; ?>
615
  <ul>
616
+ <li><a href="http://www.wprssaggregator.com/extension/feed-to-post/"><?php echo 'Feed to Post'; ?></a></li>
617
+ <li><a href="http://www.wprssaggregator.com/extension/excerpts-thumbnails/"><?php echo 'Excerpts & Thumbnails'; ?></a></li>
618
  <li><a href="http://www.wprssaggregator.com/extension/categories/"><?php echo 'Categories'; ?></a></li>
619
  <li><a href="http://www.wprssaggregator.com/extension/keyword-filtering/"><?php echo 'Keyword Filtering'; ?></a></li>
620
+ </ul>
621
  </p>
622
+ <?php }
623
 
624
 
625
+ /**
626
  * Generate Follow us plugin meta box
627
+ *
628
  * @since 2.0
629
+ *
630
+ */
631
+ function wprss_follow_meta_box_callback() {
632
+ ?>
633
  <ul>
634
  <li class="twitter"><a href="http://twitter.com/wpmayor"><?php _e( 'Follow WP Mayor on Twitter.', WPRSS_TEXT_DOMAIN ) ?></a></li>
635
  <li class="facebook"><a href="https://www.facebook.com/wpmayor"><?php _e( 'Like WP Mayor on Facebook.', WPRSS_TEXT_DOMAIN ) ?></a></li>
636
+ </ul>
637
+ <?php }
638
 
639
 
640
  add_action( 'add_meta_boxes', 'wprss_remove_meta_boxes', 100 );
641
  /**
642
  * Remove unneeded meta boxes from add feed source screen
643
+ *
644
  * @since 2.0
645
+ */
646
  function wprss_remove_meta_boxes() {
647
+ if ( 'wprss_feed' !== get_current_screen()->id ) return;
648
+ // Remove meta boxes of other plugins that tend to appear on all posts
649
  //remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' );
650
  remove_meta_box( 'postpsp', 'wprss_feed' ,'normal' );
651
  remove_meta_box( 'su_postmeta', 'wprss_feed' ,'normal' );
652
+ remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' );
653
+ remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' );
654
+ remove_meta_box( 'wpar_plugin_meta_box ', 'wprss_feed' ,'normal' );
655
  remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' );
656
+ remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' );
657
  remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' );
658
  remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' );
659
  remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' );
660
  remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' );
661
+ remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' );
662
+ remove_meta_box( 'aiosp', 'wprss_feed' ,'advanced' );
663
+ remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' );
664
  }
includes/admin.php CHANGED
@@ -1,9 +1,9 @@
1
- <?php
2
  /**
3
- * Plugin administration related functions
4
  *
5
  * @package WPRSSAggregator
6
- */
7
 
8
  add_action( 'admin_head', 'wprss_custom_post_type_icon' );
9
  /**
@@ -16,40 +16,40 @@
16
  /* Post Screen - 32px */
17
  .icon32-posts-wprss_feed {
18
  background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
19
- }
20
  /* Post Screen - 32px */
21
  .icon32-posts-wprss_feed_item {
22
  background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
23
- }
24
  </style>
25
- <?php }
26
-
27
-
28
  add_action( 'admin_menu', 'wprss_register_menu_pages' );
29
  /**
30
  * Register menu and submenus
31
  * @since 2.0
32
- */
33
-
34
- // Add the admin options pages as submenus to the Feed CPT
35
- function wprss_register_menu_pages() {
36
  global $submenu;
37
  // Uncomment line below to hide "Add New" link from menu
38
  // unset( $submenu['edit.php?post_type=wprss_feed'][10] );
39
- // create submenu items
40
- add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Export & Import Settings', WPRSS_TEXT_DOMAIN ), __( 'Import & Export', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings' ), 'wprss-import-export-settings', 'wprss_import_export_settings_page_display' );
41
- add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'WP RSS Aggregator Settings', WPRSS_TEXT_DOMAIN ), __( 'Settings', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings' ), 'wprss-aggregator-settings', 'wprss_settings_page_display' );
42
- add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Debugging', WPRSS_TEXT_DOMAIN ), __( 'Debugging', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-debugging', 'wprss_debugging_page_display' );
43
- add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Add-Ons', WPRSS_TEXT_DOMAIN ), __( 'Add-Ons', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-addons', 'wprss_addons_page_display' );
44
- add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Help & Support', WPRSS_TEXT_DOMAIN ), __( 'Help & Support', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-help', 'wprss_help_page_display' );
45
  }
46
 
47
  add_filter('admin_body_class', 'wprss_base_admin_body_class');
48
- /**
49
  * Set body class for admin screens
50
  * http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/
51
  * @since 2.0
52
- */
53
  function wprss_base_admin_body_class( $classes )
54
  {
55
  // Current action
@@ -86,35 +86,35 @@
86
 
87
  /**
88
  * Change title on wprss_feed post type screen
89
- *
90
  * @since 2.0
91
  * @return void
92
- */
93
  function wprss_change_title_text() {
94
  return __( 'Name this feed (e.g. WP Mayor)', WPRSS_TEXT_DOMAIN );
95
- }
96
 
97
 
98
  add_filter( 'plugin_action_links', 'wprss_plugin_action_links', 10, 2 );
99
- /**
100
  * Add Settings action link in plugin listing
101
  *
102
  * @since 3.0
103
  * @param array $action_links
104
- * @param string $plugin_file
105
  * @return array
106
- */
107
  function wprss_plugin_action_links( $action_links, $plugin_file ) {
108
  // check to make sure we are on the correct plugin
109
  if ( $plugin_file == 'wp-rss-aggregator/wp-rss-aggregator.php' ) {
110
- // the anchor tag and href to the URLs we want.
111
  $settings_link = '<a href="' . admin_url() . 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings">' . __( 'Settings', WPRSS_TEXT_DOMAIN ) . '</a>';
112
  $docs_link = '<a href="http://www.wprssaggregator.com/documentation/">' . __( 'Documentation', WPRSS_TEXT_DOMAIN ) . '</a>';
113
  // add the links to the beginning of the list
114
  array_unshift( $action_links, $settings_link, $docs_link );
115
  }
116
  return $action_links;
117
- }
118
 
119
 
120
 
@@ -123,7 +123,7 @@
123
  }
124
  /**
125
  * Shows a notification that tells the user that there are saved licenses that have not been activated.
126
- *
127
  * @since 3.8.1
128
  */
129
  function wprss_notify_inactive_licenses() {
@@ -137,7 +137,7 @@
137
  // Show the notice ?>
138
  <div class="updated">
139
  <?php echo wpautop( sprintf( __('<b>WP RSS Aggregator</b>:'
140
- . ' There are saved licenses that have not yet been actived. Go to the'
141
  . ' <a href="%1$s">License page</a> to activate them.', WPRSS_TEXT_DOMAIN ), admin_url() . 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings&tab=licenses_settings' ) ) ?>
142
  </div>
143
  <?php
1
+ <?php
2
  /**
3
+ * Plugin administration related functions
4
  *
5
  * @package WPRSSAggregator
6
+ */
7
 
8
  add_action( 'admin_head', 'wprss_custom_post_type_icon' );
9
  /**
16
  /* Post Screen - 32px */
17
  .icon32-posts-wprss_feed {
18
  background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
19
+ }
20
  /* Post Screen - 32px */
21
  .icon32-posts-wprss_feed_item {
22
  background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
23
+ }
24
  </style>
25
+ <?php }
26
+
27
+
28
  add_action( 'admin_menu', 'wprss_register_menu_pages' );
29
  /**
30
  * Register menu and submenus
31
  * @since 2.0
32
+ */
33
+
34
+ // Add the admin options pages as submenus to the Feed CPT
35
+ function wprss_register_menu_pages() {
36
  global $submenu;
37
  // Uncomment line below to hide "Add New" link from menu
38
  // unset( $submenu['edit.php?post_type=wprss_feed'][10] );
39
+ // create submenu items
40
+ add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Export & Import Settings', WPRSS_TEXT_DOMAIN ), __( 'Import & Export', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings' ), 'wprss-import-export-settings', 'wprss_import_export_settings_page_display' );
41
+ add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'WP RSS Aggregator Settings', WPRSS_TEXT_DOMAIN ), __( 'Settings', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings' ), 'wprss-aggregator-settings', 'wprss_settings_page_display' );
42
+ add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Debugging', WPRSS_TEXT_DOMAIN ), __( 'Debugging', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-debugging', 'wprss_debugging_page_display' );
43
+ add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Add-Ons', WPRSS_TEXT_DOMAIN ), __( 'Add-Ons', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-addons', 'wprss_addons_page_display' );
44
+ add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Help & Support', WPRSS_TEXT_DOMAIN ), __( 'Help & Support', WPRSS_TEXT_DOMAIN ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-help', 'wprss_help_page_display' );
45
  }
46
 
47
  add_filter('admin_body_class', 'wprss_base_admin_body_class');
48
+ /**
49
  * Set body class for admin screens
50
  * http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/
51
  * @since 2.0
52
+ */
53
  function wprss_base_admin_body_class( $classes )
54
  {
55
  // Current action
86
 
87
  /**
88
  * Change title on wprss_feed post type screen
89
+ *
90
  * @since 2.0
91
  * @return void
92
+ */
93
  function wprss_change_title_text() {
94
  return __( 'Name this feed (e.g. WP Mayor)', WPRSS_TEXT_DOMAIN );
95
+ }
96
 
97
 
98
  add_filter( 'plugin_action_links', 'wprss_plugin_action_links', 10, 2 );
99
+ /**
100
  * Add Settings action link in plugin listing
101
  *
102
  * @since 3.0
103
  * @param array $action_links
104
+ * @param string $plugin_file
105
  * @return array
106
+ */
107
  function wprss_plugin_action_links( $action_links, $plugin_file ) {
108
  // check to make sure we are on the correct plugin
109
  if ( $plugin_file == 'wp-rss-aggregator/wp-rss-aggregator.php' ) {
110
+ // the anchor tag and href to the URLs we want.
111
  $settings_link = '<a href="' . admin_url() . 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings">' . __( 'Settings', WPRSS_TEXT_DOMAIN ) . '</a>';
112
  $docs_link = '<a href="http://www.wprssaggregator.com/documentation/">' . __( 'Documentation', WPRSS_TEXT_DOMAIN ) . '</a>';
113
  // add the links to the beginning of the list
114
  array_unshift( $action_links, $settings_link, $docs_link );
115
  }
116
  return $action_links;
117
+ }
118
 
119
 
120
 
123
  }
124
  /**
125
  * Shows a notification that tells the user that there are saved licenses that have not been activated.
126
+ *
127
  * @since 3.8.1
128
  */
129
  function wprss_notify_inactive_licenses() {
137
  // Show the notice ?>
138
  <div class="updated">
139
  <?php echo wpautop( sprintf( __('<b>WP RSS Aggregator</b>:'
140
+ . ' There are saved licenses that have not yet been activated. Go to the'
141
  . ' <a href="%1$s">License page</a> to activate them.', WPRSS_TEXT_DOMAIN ), admin_url() . 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings&tab=licenses_settings' ) ) ?>
142
  </div>
143
  <?php
includes/custom-post-types.php CHANGED
@@ -52,6 +52,7 @@
52
  'with_front' => false
53
  ),
54
  'capability_type' => 'feed',
 
55
  'supports' => array( 'title' ),
56
  'labels' => $labels
57
  )
52
  'with_front' => false
53
  ),
54
  'capability_type' => 'feed',
55
+ 'map_meta_cap' => true,
56
  'supports' => array( 'title' ),
57
  'labels' => $labels
58
  )
includes/feed-blacklist.php CHANGED
@@ -16,13 +16,15 @@
16
 
17
 
18
  // Check if the 'blacklist' GET param is set
19
- add_action( 'init', 'wprss_check_if_blacklist_item' );
 
 
20
  // Register custom post type
21
  add_action( 'init', 'wprss_blacklist_cpt' );
22
  // Add the row actions to the targetted post type
23
  add_filter( 'post_row_actions', 'wprss_blacklist_row_actions', 10, 1 );
24
  // Check if deleting a blacklist item, from the GET parameter
25
- add_action( 'init', 'wprss_check_if_blacklist_delete' );
26
  // Changes the wprss_blacklist table columns
27
  add_filter( 'manage_wprss_blacklist_posts_columns', 'wprss_blacklist_columns');
28
  // Prints the table data for each blacklist entry
@@ -31,18 +33,6 @@ add_action( 'manage_wprss_blacklist_posts_custom_column' , 'wprss_blacklist_tabl
31
  add_filter('bulk_actions-edit-wprss_blacklist','wprss_blacklist_bulk_actions', 5, 1 );
32
 
33
 
34
- /**
35
- * Returns the post type being used or blacklisting.
36
- *
37
- * @since 4.4
38
- * @return string The post type being used for blacklisting.
39
- */
40
- function wprss_blacklist_post_type() {
41
- // Return the post type - allow filter
42
- return apply_filters( 'wprss_blacklist_post_type', 'wprss_feed_item' );
43
- }
44
-
45
-
46
  /**
47
  * Retrieves the blacklisted items.
48
  *
@@ -71,14 +61,19 @@ function wprss_get_blacklist() {
71
  */
72
  function wprss_blacklist_item( $ID ) {
73
  // Return if feed item is null
74
- if ( is_null($ID) ) return;
75
 
76
  // Get the feed item data
77
  $item_title = get_the_title( $ID );
78
  $item_permalink = get_post_meta( $ID, 'wprss_item_permalink', TRUE );
 
 
 
 
 
79
  // Prepare the data for blacklisting
80
- $title = apply_filters( 'wprss_blacklist_title', trim($item_title) );
81
- $permalink = apply_filters( 'wprss_blacklist_permalink', trim($item_permalink) );
82
 
83
  // Get the blacklisted items
84
  $blacklist = wprss_get_blacklist();
@@ -135,23 +130,52 @@ function wprss_check_if_blacklist_item() {
135
  }
136
 
137
  // If the post type is not correct,
138
- if ( get_post_type($ID) !== wprss_blacklist_post_type() ) {
139
  wp_die( __( 'The item you are trying to blacklist is not valid!', WPRSS_TEXT_DOMAIN ) );
140
  }
141
 
142
  check_admin_referer( 'blacklist-item-' . $ID, 'wprss_blacklist_item' );
143
  wprss_blacklist_item( $ID );
144
 
 
 
145
  // Check the current page, and generate the URL query string for the page
146
  $paged = isset( $_GET['paged'] )? '&paged=' . $_GET['paged'] : '';
147
- // Get the blacklisting post type
148
- $post_type = wprss_blacklist_post_type();
149
  // Refresh the page without the GET parameter
150
- header( 'Location: ' . admin_url( "edit.php?post_type=$post_type" . $paged ) );
151
  exit();
152
  }
153
 
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
 
157
  /**
@@ -191,15 +215,20 @@ function wprss_blacklist_row_actions( $actions ) {
191
  // Check the current page, and generate the URL query string for the page
192
  $paged = isset( $_GET['paged'] )? '&paged=' . $_GET['paged'] : '';
193
 
194
- $post_type = wprss_blacklist_post_type();
195
 
196
  // Check the post type
197
- if ( get_post_type() == $post_type && get_post_status() == 'trash' ) {
198
  // Get the Post ID
199
  $ID = get_the_ID();
200
-
201
- $remove_url =
202
 
 
 
 
 
 
 
 
 
203
  // Prepare the blacklist URL
204
  $plain_url = apply_filters(
205
  'wprss_blacklist_row_action_url',
16
 
17
 
18
  // Check if the 'blacklist' GET param is set
19
+ add_action( 'admin_init', 'wprss_check_if_blacklist_item' );
20
+ // Checks if the transient is set to show the notice
21
+ add_action( 'admin_init', 'wprss_check_notice_transient' );
22
  // Register custom post type
23
  add_action( 'init', 'wprss_blacklist_cpt' );
24
  // Add the row actions to the targetted post type
25
  add_filter( 'post_row_actions', 'wprss_blacklist_row_actions', 10, 1 );
26
  // Check if deleting a blacklist item, from the GET parameter
27
+ add_action( 'admin_init', 'wprss_check_if_blacklist_delete' );
28
  // Changes the wprss_blacklist table columns
29
  add_filter( 'manage_wprss_blacklist_posts_columns', 'wprss_blacklist_columns');
30
  // Prints the table data for each blacklist entry
33
  add_filter('bulk_actions-edit-wprss_blacklist','wprss_blacklist_bulk_actions', 5, 1 );
34
 
35
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Retrieves the blacklisted items.
38
  *
61
  */
62
  function wprss_blacklist_item( $ID ) {
63
  // Return if feed item is null
64
+ if ( is_null( $ID ) ) return;
65
 
66
  // Get the feed item data
67
  $item_title = get_the_title( $ID );
68
  $item_permalink = get_post_meta( $ID, 'wprss_item_permalink', TRUE );
69
+ // If not an imported item, stop
70
+ if ( $item_permalink === '' ) {
71
+ wprss_log_obj( 'An item being blacklisted was ignored for not being an imported item', $ID, null, WPRSS_LOG_LEVEL_INFO );
72
+ return;
73
+ }
74
  // Prepare the data for blacklisting
75
+ $title = apply_filters( 'wprss_blacklist_title', trim( $item_title ) );
76
+ $permalink = apply_filters( 'wprss_blacklist_permalink', trim( $item_permalink ) );
77
 
78
  // Get the blacklisted items
79
  $blacklist = wprss_get_blacklist();
130
  }
131
 
132
  // If the post type is not correct,
133
+ if ( get_post_meta( $ID, 'wprss_item_permalink', TRUE ) === '' || get_post_status( $ID ) !== 'trash' ) {
134
  wp_die( __( 'The item you are trying to blacklist is not valid!', WPRSS_TEXT_DOMAIN ) );
135
  }
136
 
137
  check_admin_referer( 'blacklist-item-' . $ID, 'wprss_blacklist_item' );
138
  wprss_blacklist_item( $ID );
139
 
140
+ // Get the current post type for the current page
141
+ $post_type = isset( $_GET['post_type'] )? $_GET['post_type'] : 'post';
142
  // Check the current page, and generate the URL query string for the page
143
  $paged = isset( $_GET['paged'] )? '&paged=' . $_GET['paged'] : '';
144
+ // Set the notice transient
145
+ set_transient( 'wprss_item_blacklist_notice', 'true' );
146
  // Refresh the page without the GET parameter
147
+ wp_redirect( admin_url( "edit.php?post_type=$post_type&post_status=trash" . $paged ) );
148
  exit();
149
  }
150
 
151
 
152
+ /**
153
+ * Checks if the transient for the blacklist notice is set, and shows the notice
154
+ * if it is set.
155
+ */
156
+ function wprss_check_notice_transient() {
157
+ // Check if the transient exists
158
+ $transient = get_transient( 'wprss_item_blacklist_notice' );
159
+ if ( $transient !== FALSE ) {
160
+ // Remove the transient
161
+ delete_transient( 'wprss_item_blacklist_notice' );
162
+ // Show the notice
163
+ add_action( 'admin_notices', 'wprss_blacklist_item_notice' );
164
+ }
165
+ }
166
+
167
+ /**
168
+ * The admin notice shown when an item is blacklisted.
169
+ */
170
+ function wprss_blacklist_item_notice() {
171
+ ?>
172
+ <div class="updated">
173
+ <p>
174
+ The item was deleted successfully and added to the blacklist.
175
+ </p>
176
+ </div>
177
+ <?php
178
+ }
179
 
180
 
181
  /**
215
  // Check the current page, and generate the URL query string for the page
216
  $paged = isset( $_GET['paged'] )? '&paged=' . $_GET['paged'] : '';
217
 
 
218
 
219
  // Check the post type
220
+ if ( get_post_status() == 'trash' ) {
221
  // Get the Post ID
222
  $ID = get_the_ID();
 
 
223
 
224
+ // Get the permalink. If does not exist, then it is not an imported item.
225
+ $permalink = get_post_meta( $ID, 'wprss_item_permalink', TRUE );
226
+ if ( $permalink === '' ) {
227
+ $actions;
228
+ }
229
+
230
+ // The post type on the current screen
231
+ $post_type = get_post_type();
232
  // Prepare the blacklist URL
233
  $plain_url = apply_filters(
234
  'wprss_blacklist_row_action_url',
includes/feed-importing.php CHANGED
@@ -67,7 +67,7 @@
67
  wprss_log_obj( 'Feed import limit', $feed_limit, null, WPRSS_LOG_LEVEL_INFO );
68
 
69
  // Filter the URL for validaty
70
- if ( filter_var( $feed_url, FILTER_VALIDATE_URL ) ) {
71
  wprss_log_obj( 'Feed URL is valid', $feed_url, null, WPRSS_LOG_LEVEL_INFO );
72
  // Get the feed items from the source
73
  $items = wprss_get_feed_items( $feed_url, $feed_ID );
@@ -87,32 +87,37 @@
87
 
88
  // Gather the permalinks of existing feed item's related to this feed source
89
  $existing_permalinks = get_existing_permalinks( $feed_ID );
90
- wprss_log_obj( 'Retrieved existing permalinks', count($existing_permalinks), null, WPRSS_LOG_LEVEL_SYSTEM );
91
 
92
  // Generate a list of items fetched, that are not already in the DB
93
  $new_items = array();
94
- foreach( $items_to_insert as $item ) {
95
  $permalink = wprss_normalize_permalink( $item->get_permalink() );
96
  wprss_log_obj( 'Normalizing permalink', sprintf('%1$s -> %2$s', $item->get_permalink(), $permalink), null, WPRSS_LOG_LEVEL_SYSTEM );
97
  // Check if not blacklisted and not already imported
98
  $is_blacklisted = wprss_is_blacklisted( $permalink );
99
- $already_exists = in_array( trim($permalink), $existing_permalinks );
100
- if ( $is_blacklisted === FALSE && !$already_exists ) {
101
  $new_items[] = $item;
102
- wprss_log( 'Permalink OK', $permalink, null, WPRSS_LOG_LEVEL_SYSTEM );
103
  }
104
  else {
105
- if ( $is_blacklisted )
106
  wprss_log( 'Permalink blacklisted', null, WPRSS_LOG_LEVEL_SYSTEM );
107
- if( $already_exists)
 
108
  wprss_log( 'Permalink already exists', null, WPRSS_LOG_LEVEL_SYSTEM );
 
109
  }
110
  }
111
 
112
  $original_count = count( $items_to_insert );
113
  $new_count = count( $new_items );
114
- if( $new_count !== $original_count )
115
- wprss_log_obj( 'Items filtered out', $original_count - $new_count, null, WPRSS_LOG_LEVEL_NOTICE );
 
 
 
116
 
117
  $items_to_insert = $new_items;
118
 
@@ -133,14 +138,14 @@
133
  $db_feed_items_reversed = array_reverse( $db_feed_items->posts );
134
  // Cut the array to get only the first few that are to be deleted ( equal to $num_feed_items_to_delete )
135
  $feed_items_to_delete = array_slice( $db_feed_items_reversed, 0, $num_feed_items_to_delete );
136
- wprss_log( sprintf( 'There already are %1$d items in the database. %2$d items can be inserted. %3$d items will be deleted', $num_db_feed_items, $num_can_insert, $feed_items_to_delete ), null, WPRSS_LOG_LEVEL_SYSTEM );
137
 
138
  // Iterate the feed items and delete them
139
  foreach ( $feed_items_to_delete as $key => $post ) {
140
  wp_delete_post( $post->ID, TRUE );
141
  }
142
 
143
- if( $deleted_items_count = count($feed_items_to_delete) )
144
  wprss_log_obj( 'Items deleted due to limit', $deleted_items_count, null, WPRSS_LOG_LEVEL_NOTICE );
145
  }
146
 
67
  wprss_log_obj( 'Feed import limit', $feed_limit, null, WPRSS_LOG_LEVEL_INFO );
68
 
69
  // Filter the URL for validaty
70
+ if ( wprss_validate_url( $feed_url ) ) {
71
  wprss_log_obj( 'Feed URL is valid', $feed_url, null, WPRSS_LOG_LEVEL_INFO );
72
  // Get the feed items from the source
73
  $items = wprss_get_feed_items( $feed_url, $feed_ID );
87
 
88
  // Gather the permalinks of existing feed item's related to this feed source
89
  $existing_permalinks = get_existing_permalinks( $feed_ID );
90
+ wprss_log_obj( 'Retrieved existing permalinks', count( $existing_permalinks ), null, WPRSS_LOG_LEVEL_SYSTEM );
91
 
92
  // Generate a list of items fetched, that are not already in the DB
93
  $new_items = array();
94
+ foreach ( $items_to_insert as $item ) {
95
  $permalink = wprss_normalize_permalink( $item->get_permalink() );
96
  wprss_log_obj( 'Normalizing permalink', sprintf('%1$s -> %2$s', $item->get_permalink(), $permalink), null, WPRSS_LOG_LEVEL_SYSTEM );
97
  // Check if not blacklisted and not already imported
98
  $is_blacklisted = wprss_is_blacklisted( $permalink );
99
+ $already_exists = in_array( $permalink, $existing_permalinks );
100
+ if ( $is_blacklisted === FALSE && $already_exists === FALSE ) {
101
  $new_items[] = $item;
102
+ wprss_log_obj( 'Permalink OK', $permalink, null, WPRSS_LOG_LEVEL_SYSTEM );
103
  }
104
  else {
105
+ if ( $is_blacklisted ) {
106
  wprss_log( 'Permalink blacklisted', null, WPRSS_LOG_LEVEL_SYSTEM );
107
+ }
108
+ if ( $already_exists ) {
109
  wprss_log( 'Permalink already exists', null, WPRSS_LOG_LEVEL_SYSTEM );
110
+ }
111
  }
112
  }
113
 
114
  $original_count = count( $items_to_insert );
115
  $new_count = count( $new_items );
116
+ if ( $new_count !== $original_count ) {
117
+ wprss_log_obj( 'Items filtered out', $original_count - $new_count, null, WPRSS_LOG_LEVEL_SYSTEM );
118
+ } else {
119
+ wprss_log( 'Items to import remained untouched. Not items already exist or are blacklisted.', null, WPRSS_LOG_LEVEL_SYSTEM );
120
+ }
121
 
122
  $items_to_insert = $new_items;
123
 
138
  $db_feed_items_reversed = array_reverse( $db_feed_items->posts );
139
  // Cut the array to get only the first few that are to be deleted ( equal to $num_feed_items_to_delete )
140
  $feed_items_to_delete = array_slice( $db_feed_items_reversed, 0, $num_feed_items_to_delete );
141
+ wprss_log( sprintf( 'There already are %1$d items in the database. %2$d items can be inserted. %3$d items will be deleted', $num_db_feed_items, $num_can_insert, $num_feed_items_to_delete ), null, WPRSS_LOG_LEVEL_SYSTEM );
142
 
143
  // Iterate the feed items and delete them
144
  foreach ( $feed_items_to_delete as $key => $post ) {
145
  wp_delete_post( $post->ID, TRUE );
146
  }
147
 
148
+ if ( $deleted_items_count = count( $feed_items_to_delete ) )
149
  wprss_log_obj( 'Items deleted due to limit', $deleted_items_count, null, WPRSS_LOG_LEVEL_NOTICE );
150
  }
151
 
includes/feed-processing.php CHANGED
@@ -127,10 +127,32 @@
127
  "SELECT q.`meta_value`
128
  FROM {$wpdb->postmeta} AS p
129
  JOIN {$wpdb->postmeta} AS q ON (q.`meta_key` = 'wprss_item_permalink' AND p.`post_id` = q.`post_id`)
130
- WHERE p.`meta_key` = 'wprss_feed_id' AND p.`meta_value` = {$feed_ID}"
131
  );
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  add_action( 'publish_wprss_feed', 'wprss_fetch_insert_feed_items', 10 );
136
  /**
127
  "SELECT q.`meta_value`
128
  FROM {$wpdb->postmeta} AS p
129
  JOIN {$wpdb->postmeta} AS q ON (q.`meta_key` = 'wprss_item_permalink' AND p.`post_id` = q.`post_id`)
130
+ WHERE p.`meta_key` = 'wprss_feed_id' AND p.`meta_value` = '{$feed_ID}'"
131
  );
132
  }
133
 
134
+ /**
135
+ * Checks if a permalink exists.
136
+ *
137
+ * Untested!
138
+ *
139
+ * @param string $permalink The permalink, expected to be normalized.
140
+ * @return bool
141
+ */
142
+ function wprss_permalink_exists( $permalink ) {
143
+ global $wpdb;
144
+
145
+ $wpdb->query(
146
+ $wpdb->prepare(
147
+ "SELECT *
148
+ FROM {$wpdb->postmeta}
149
+ WHERE `meta_value` = '{$permalink}'"
150
+ )
151
+ );
152
+
153
+ return $wpdb->num_rows > 0;
154
+ }
155
+
156
 
157
  add_action( 'publish_wprss_feed', 'wprss_fetch_insert_feed_items', 10 );
158
  /**
includes/licensing.php CHANGED
@@ -3,7 +3,7 @@
3
 
4
  /**
5
  * Returns all registered addons.
6
- *
7
  * @since 4.4.5
8
  */
9
  function wprss_get_addons() {
@@ -38,7 +38,7 @@ function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_
38
  'url' => urlencode( network_site_url() ),
39
  'time' => time(),
40
  );
41
-
42
  // Send the request to the API
43
  $response = wp_remote_get( add_query_arg( $api_params, $store_url_constant ) );
44
 
@@ -51,7 +51,9 @@ function wprss_edd_licensing_api( $addon, $license_key = NULL, $action = 'check_
51
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
52
 
53
  // Update the DB option
 
54
  $license_statuses["{$addon}_license_status"] = $license_data->license;
 
55
  update_option( 'wprss_settings_license_statuses', $license_statuses );
56
 
57
  // Return the data
@@ -105,7 +107,8 @@ function wprss_default_license_settings( $addon ) {
105
  'wprss_default_license_settings',
106
  array(
107
  "{$addon}_license_key" => FALSE,
108
- "{$addon}_license_status" => 'invalid'
 
109
  )
110
  );
111
 
@@ -113,6 +116,7 @@ function wprss_default_license_settings( $addon ) {
113
  return $settings;
114
  }
115
 
 
116
  /**
117
  * Returns the saved license code.
118
  *
@@ -145,10 +149,143 @@ function wprss_get_license_status( $addon ) {
145
  }
146
 
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  add_action( 'wprss_admin_init', 'wprss_license_settings', 100 );
149
  /**
150
  * Adds the license sections and settings for registered add-ons.
151
- *
152
  * @since 4.4.5
153
  */
154
  function wprss_license_settings() {
@@ -185,7 +322,7 @@ function wprss_license_settings() {
185
 
186
  /**
187
  * Renders the license field for a particular add-on.
188
- *
189
  * @since 4.4.5
190
  */
191
  function wprss_license_key_field( $args ) {
@@ -202,7 +339,7 @@ function wprss_license_key_field( $args ) {
202
 
203
  /**
204
  * Renders the activate/deactivate license button for a particular add-on.
205
- *
206
  * @since 4.4.5
207
  */
208
  function wprss_activate_license_button( $args ) {
@@ -215,16 +352,17 @@ function wprss_activate_license_button( $args ) {
215
  $valid = $status == 'valid';
216
  $btn_text = $valid ? 'Deactivate License' : 'Activate License';
217
  $btn_name = "wprss_{$addon_id}_license_" . ( $valid? 'deactivate' : 'activate' );
 
218
  wp_nonce_field( "wprss_{$addon_id}_license_nonce", "wprss_{$addon_id}_license_nonce" ); ?>
219
 
220
- <input type="submit" class="button-secondary" name="<?php echo $btn_name; ?>" value="<?php _e( $btn_text, WPRSS_TEXT_DOMAIN ); ?>" />
221
  <span id="wprss-<?php echo $addon_id; ?>-license-status-text">
222
- <strong>Status:
223
  <span class="wprss-<?php echo $addon_id; ?>-license-<?php echo $status; ?>">
224
  <?php _e( ucfirst($status), WPRSS_TEXT_DOMAIN ); ?>
225
  <?php if ( $status === 'valid' ) : ?>
226
  <i class="fa fa-check"></i>
227
- <?php elseif( $status === 'invalid' ): ?>
228
  <i class="fa fa-times"></i>
229
  <?php elseif( $status === 'inactive' ): ?>
230
  <i class="fa fa-warning"></i>
@@ -245,17 +383,22 @@ function wprss_activate_license_button( $args ) {
245
  $expires = substr( $expires, 0, strpos( $expires, " " ) );
246
  ?>
247
  <small>
248
- <strong>Activations:</strong>
 
 
 
 
 
249
  <?php echo $acts_current.'/'.$acts_limit; ?> (<?php echo $acts_left; ?> left)
250
  <br/>
251
- <strong>Expires on:</strong>
252
  <code><?php echo $expires; ?></code>
253
  <br/>
254
- <strong>Registered to:</strong>
255
  <?php echo $data->customer_name; ?> (<code><?php echo $data->customer_email; ?></code>)
256
  </small>
257
  <?php else: ?>
258
- <small>Failed to get license information. This is a temporary problem. Check your internet connection and try again later.</small>
259
  <?php endif; ?>
260
  <?php endif;
261
  ?>
@@ -265,7 +408,7 @@ function wprss_activate_license_button( $args ) {
265
  .wprss-<?php echo $addon_id; ?>-license-valid {
266
  color: green;
267
  }
268
- .wprss-<?php echo $addon_id; ?>-license-invalid {
269
  color: #b71919;
270
  }
271
  .wprss-<?php echo $addon_id; ?>-license-inactive {
@@ -283,25 +426,43 @@ function wprss_activate_license_button( $args ) {
283
  }
284
 
285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  add_action( 'admin_init', 'wprss_process_addon_license', 10 );
287
  /**
288
- * Handles the activation/deactivation process
289
- *
290
  * @since 1.0
291
  */
292
  function wprss_process_addon_license() {
293
  $addons = wprss_get_addons();
294
-
295
  // Get for each registered addon
296
  foreach( $addons as $id => $name ) {
297
-
298
  // listen for our activate button to be clicked
299
  if( isset( $_POST["wprss_{$id}_license_activate"] ) || isset( $_POST["wprss_{$id}_license_deactivate"] ) ) {
300
- // run a quick security check
301
- if( ! check_admin_referer( "wprss_{$id}_license_nonce", "wprss_{$id}_license_nonce" ) )
302
  continue; // get out if we didn't click the Activate/Deactivate button
303
  }
304
-
305
  // retrieve the license keys and statuses from the database
306
  $license = wprss_get_license_key( $id );
307
  $license_statuses = get_option( 'wprss_settings_license_statuses' );
@@ -311,7 +472,7 @@ function wprss_process_addon_license() {
311
  // Use the license given in POST
312
  $license = $_POST['wprss_settings_license_keys'][$id.'_license_key'];
313
  }
314
-
315
  // Prepare the action to take
316
  if ( isset( $_POST["wprss_{$id}_license_activate"] ) ) {
317
  wprss_edd_activate_license( $id, $license );
@@ -322,6 +483,7 @@ function wprss_process_addon_license() {
322
  }
323
  }
324
 
 
325
  add_action( 'init', 'wprss_setup_edd_updater' );
326
  /**
327
  * Sets up the EDD updater for all registered add-ons.
@@ -350,7 +512,7 @@ function wprss_setup_edd_updater() {
350
  $version = constant("WPRSS_{$uid}_VERSION");
351
  $path = constant("WPRSS_{$uid}_PATH");
352
  // Set up an updater
353
- $edd_updater = new EDD_SL_Plugin_Updater( WPRSS_SL_STORE_URL, $path, array(
354
  'version' => $version, // current version number
355
  'license' => $license, // license key (used get_option above to retrieve from DB)
356
  'item_name' => $name, // name of this plugin
3
 
4
  /**
5
  * Returns all registered addons.
6
+ *
7
  * @since 4.4.5
8
  */
9
  function wprss_get_addons() {
38
  'url' => urlencode( network_site_url() ),
39
  'time' => time(),
40
  );
41
+
42
  // Send the request to the API
43
  $response = wp_remote_get( add_query_arg( $api_params, $store_url_constant ) );
44
 
51
  $license_data = json_decode( wp_remote_retrieve_body( $response ) );
52
 
53
  // Update the DB option
54
+ $license_statuses = get_option( 'wprss_settings_license_statuses' );
55
  $license_statuses["{$addon}_license_status"] = $license_data->license;
56
+ $license_statuses["{$addon}_license_expires"] = $license_data->expires;
57
  update_option( 'wprss_settings_license_statuses', $license_statuses );
58
 
59
  // Return the data
107
  'wprss_default_license_settings',
108
  array(
109
  "{$addon}_license_key" => FALSE,
110
+ "{$addon}_license_status" => 'invalid',
111
+ "{$addon}_license_expires" => NULL
112
  )
113
  );
114
 
116
  return $settings;
117
  }
118
 
119
+
120
  /**
121
  * Returns the saved license code.
122
  *
149
  }
150
 
151
 
152
+ /**
153
+ * Returns the saved license expiry.
154
+ *
155
+ * @since 4.6.7
156
+ */
157
+ function wprss_get_license_expiry( $addon ) {
158
+ // Get default and current options
159
+ $defaults = wprss_default_license_settings( $addon );
160
+ $statuses = get_option( 'wprss_settings_license_statuses', array() );
161
+ // Prepare the key
162
+ $k = "{$addon}_license_expires";
163
+ // Return the appropriate value
164
+ return isset( $statuses[$k] ) ? $statuses[$k] : $defaults[$k];
165
+ }
166
+
167
+
168
+ add_action( 'wp_ajax_wprss_ajax_manage_license', 'wprss_ajax_manage_license' );
169
+ /**
170
+ * Handles the AJAX request to check a license.
171
+ *
172
+ * @since 4.7
173
+ */
174
+ function wprss_ajax_manage_license() {
175
+ // Get and sanitize the addon ID we're checking.
176
+ if ( isset($_GET['addon']) ) {
177
+ $addon = sanitize_text_field($_GET['addon']);
178
+ } else {
179
+ wprss_echo_error_and_die( __('No addon ID', WPRSS_TEXT_DOMAIN ));
180
+ }
181
+
182
+ // Check what we've been asked to do with the license.
183
+ if ( isset($_GET['event']) ) {
184
+ $event = sanitize_text_field($_GET['event']);
185
+
186
+ if ($event !== 'activate' && $event !== 'deactivate') {
187
+ wprss_echo_error_and_die( __('Invalid event specified', WPRSS_TEXT_DOMAIN), $addon);
188
+ }
189
+ } else {
190
+ wprss_echo_error_and_die( __('No event specified', WPRSS_TEXT_DOMAIN), $addon);
191
+ }
192
+
193
+ // Get and sanitize the license that was entered.
194
+ if ( isset($_GET['license']) ) {
195
+ $license = sanitize_text_field($_GET['license']);
196
+ } else {
197
+ wprss_echo_error_and_die( __('No license', WPRSS_TEXT_DOMAIN), $addon);
198
+ }
199
+
200
+ // Check the nonce for this particular add-on's validation button.
201
+ if ( isset($_GET['nonce']) ) {
202
+ $nonce = sanitize_text_field($_GET['nonce']);
203
+ $nonce_id = "wprss_{$addon}_license_nonce";
204
+
205
+ if ( !wp_verify_nonce($nonce, $nonce_id) ) {
206
+ wprss_echo_error_and_die( __('Bad nonce', WPRSS_TEXT_DOMAIN), $addon);
207
+ }
208
+ } else {
209
+ wprss_echo_error_and_die( __('No nonce', WPRSS_TEXT_DOMAIN), $addon);
210
+ }
211
+
212
+ // Call the appropriate EDD licensing function.
213
+ if ($event === 'activate') {
214
+ $status = wprss_edd_activate_license($addon, $license);
215
+ } else if ($event === 'deactivate') {
216
+ $status = wprss_edd_deactivate_license($addon, $license);
217
+ } else {
218
+ wprss_echo_error_and_die( __('Invalid event specified', WPRSS_TEXT_DOMAIN), $addon);
219
+ }
220
+
221
+ // Update the license key stored in the DB.
222
+ $license_keys = get_option('wprss_settings_license_keys', array());
223
+ $license_keys[$addon . '_license_key'] = $license;
224
+ update_option('wprss_settings_license_keys', $license_keys);
225
+
226
+ // Assemble the JSON data to return.
227
+ $ret = array();
228
+
229
+ // Set the validity of the license.
230
+ if ( $status === 'site_inactive' ) $status = 'inactive';
231
+ if ( $status === 'item_name_mismatch' ) $status = 'invalid';
232
+ $ret['validity'] = $status;
233
+
234
+ // Set the addon ID for use in the callback.
235
+ $ret['addon'] = $addon;
236
+
237
+ // Set the HTML markup for the new button and validity display.
238
+ $ret['html'] = wprss_get_activate_license_button($addon);
239
+
240
+ // Return the JSON data.
241
+ echo json_encode($ret);
242
+ die();
243
+ }
244
+
245
+
246
+ add_action( 'wp_ajax_wprss_ajax_fetch_license', 'wprss_ajax_fetch_license' );
247
+ /**
248
+ * Handles the AJAX request to fetch a license's information.
249
+ *
250
+ * @since 4.7
251
+ */
252
+ function wprss_ajax_fetch_license() {
253
+ // Get and sanitize the addon ID we're checking.
254
+ if ( isset($_GET['addon']) ) {
255
+ $addon = sanitize_text_field($_GET['addon']);
256
+ } else {
257
+ wprss_echo_error_and_die( __('No addon ID', WPRSS_TEXT_DOMAIN ));
258
+ }
259
+
260
+ // Get the license information from EDD
261
+ $ret = wprss_edd_check_license( $addon, NULL, 'ALL' );
262
+
263
+ echo json_encode($ret);
264
+ die();
265
+ }
266
+
267
+
268
+ /**
269
+ * Helper function that echoes a JSON error along with the new
270
+ * activate/deactivate license button HTML markup and then die()s.
271
+ *
272
+ * @since 4.7
273
+ */
274
+ function wprss_echo_error_and_die($msg, $addon = '') {
275
+ $ret = array(
276
+ 'error' => $msg,
277
+ 'html' => wprss_get_activate_license_button($addon)
278
+ );
279
+
280
+ echo json_encode($ret);
281
+ die();
282
+ }
283
+
284
+
285
  add_action( 'wprss_admin_init', 'wprss_license_settings', 100 );
286
  /**
287
  * Adds the license sections and settings for registered add-ons.
288
+ *
289
  * @since 4.4.5
290
  */
291
  function wprss_license_settings() {
322
 
323
  /**
324
  * Renders the license field for a particular add-on.
325
+ *
326
  * @since 4.4.5
327
  */
328
  function wprss_license_key_field( $args ) {
339
 
340
  /**
341
  * Renders the activate/deactivate license button for a particular add-on.
342
+ *
343
  * @since 4.4.5
344
  */
345
  function wprss_activate_license_button( $args ) {
352
  $valid = $status == 'valid';
353
  $btn_text = $valid ? 'Deactivate License' : 'Activate License';
354
  $btn_name = "wprss_{$addon_id}_license_" . ( $valid? 'deactivate' : 'activate' );
355
+ $btn_class = "button-" . ( $valid ? 'deactivate' : 'activate' ) . "-license";
356
  wp_nonce_field( "wprss_{$addon_id}_license_nonce", "wprss_{$addon_id}_license_nonce" ); ?>
357
 
358
+ <input type="button" class="<?php echo $btn_class; ?> button-process-license button-secondary" name="<?php echo $btn_name; ?>" value="<?php _e( $btn_text, WPRSS_TEXT_DOMAIN ); ?>" />
359
  <span id="wprss-<?php echo $addon_id; ?>-license-status-text">
360
+ <strong><?php _e('Status', WPRSS_TEXT_DOMAIN); ?>:
361
  <span class="wprss-<?php echo $addon_id; ?>-license-<?php echo $status; ?>">
362
  <?php _e( ucfirst($status), WPRSS_TEXT_DOMAIN ); ?>
363
  <?php if ( $status === 'valid' ) : ?>
364
  <i class="fa fa-check"></i>
365
+ <?php elseif( $status === 'invalid' || $status === 'expired' ): ?>
366
  <i class="fa fa-times"></i>
367
  <?php elseif( $status === 'inactive' ): ?>
368
  <i class="fa fa-warning"></i>
383
  $expires = substr( $expires, 0, strpos( $expires, " " ) );
384
  ?>
385
  <small>
386
+ <?php if ( strtotime($expires) < strtotime("+2 weeks") ) : ?>
387
+ <?php $renewal_url = esc_attr(WPRSS_SL_STORE_URL . '/checkout/?edd_license_key=' . $license_key); ?>
388
+ <a href="<?php echo $renewal_url; ?>"><?php _e('Renew your license to continue receiving updates and support.', WPRSS_TEXT_DOMAIN); ?></a>
389
+ <br/>
390
+ <?php endif; ?>
391
+ <strong><?php _e('Activations', WPRSS_TEXT_DOMAIN); ?>:</strong>
392
  <?php echo $acts_current.'/'.$acts_limit; ?> (<?php echo $acts_left; ?> left)
393
  <br/>
394
+ <strong><?php _e('Expires on', WPRSS_TEXT_DOMAIN); ?>:</strong>
395
  <code><?php echo $expires; ?></code>
396
  <br/>
397
+ <strong><?php _e('Registered to', WPRSS_TEXT_DOMAIN); ?>:</strong>
398
  <?php echo $data->customer_name; ?> (<code><?php echo $data->customer_email; ?></code>)
399
  </small>
400
  <?php else: ?>
401
+ <small><?php _e('Failed to get license information. This is a temporary problem. Check your internet connection and try again later.', WPRSS_TEXT_DOMAIN); ?></small>
402
  <?php endif; ?>
403
  <?php endif;
404
  ?>
408
  .wprss-<?php echo $addon_id; ?>-license-valid {
409
  color: green;
410
  }
411
+ .wprss-<?php echo $addon_id; ?>-license-invalid, .wprss-<?php echo $addon_id; ?>-license-expired {
412
  color: #b71919;
413
  }
414
  .wprss-<?php echo $addon_id; ?>-license-inactive {
426
  }
427
 
428
 
429
+ /**
430
+ * Returns the activate/deactivate license button markup for a particular add-on.
431
+ *
432
+ * @since 4.7
433
+ */
434
+ function wprss_get_activate_license_button( $addon ) {
435
+ // Buffer the output from the rendering function.
436
+ ob_start();
437
+
438
+ wprss_activate_license_button(array($addon));
439
+ $ret = ob_get_contents();
440
+
441
+ ob_end_clean();
442
+
443
+ return $ret;
444
+ }
445
+
446
+
447
  add_action( 'admin_init', 'wprss_process_addon_license', 10 );
448
  /**
449
+ * Handles the activation/deactivation process
450
+ *
451
  * @since 1.0
452
  */
453
  function wprss_process_addon_license() {
454
  $addons = wprss_get_addons();
455
+
456
  // Get for each registered addon
457
  foreach( $addons as $id => $name ) {
458
+
459
  // listen for our activate button to be clicked
460
  if( isset( $_POST["wprss_{$id}_license_activate"] ) || isset( $_POST["wprss_{$id}_license_deactivate"] ) ) {
461
+ // run a quick security check
462
+ if( ! check_admin_referer( "wprss_{$id}_license_nonce", "wprss_{$id}_license_nonce" ) )
463
  continue; // get out if we didn't click the Activate/Deactivate button
464
  }
465
+
466
  // retrieve the license keys and statuses from the database
467
  $license = wprss_get_license_key( $id );
468
  $license_statuses = get_option( 'wprss_settings_license_statuses' );
472
  // Use the license given in POST
473
  $license = $_POST['wprss_settings_license_keys'][$id.'_license_key'];
474
  }
475
+
476
  // Prepare the action to take
477
  if ( isset( $_POST["wprss_{$id}_license_activate"] ) ) {
478
  wprss_edd_activate_license( $id, $license );
483
  }
484
  }
485
 
486
+
487
  add_action( 'init', 'wprss_setup_edd_updater' );
488
  /**
489
  * Sets up the EDD updater for all registered add-ons.
512
  $version = constant("WPRSS_{$uid}_VERSION");
513
  $path = constant("WPRSS_{$uid}_PATH");
514
  // Set up an updater
515
+ $edd_updater = new EDD_SL_Plugin_Updater( WPRSS_SL_STORE_URL, $path, array(
516
  'version' => $version, // current version number
517
  'license' => $license, // license key (used get_option above to retrieve from DB)
518
  'item_name' => $name, // name of this plugin
includes/misc-functions.php CHANGED
@@ -298,4 +298,36 @@ function wp_trim_words_wprss( $text, $num_words = 55, $more = null ) {
298
  * @param string $original_text The text before it was trimmed.
299
  */
300
  return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
298
  * @param string $original_text The text before it was trimmed.
299
  */
300
  return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
301
+ }
302
+
303
+
304
+ function wprss_validate_url( $url ) {
305
+ $expression =
306
+ '(' . # Capture 1: entire matched URL
307
+ '(?:' .
308
+ '[a-z][\w-]+:' . # URL protocol and colon
309
+ '(?:' .
310
+ '/{1,3}' . # 1-3 slashes
311
+ '|' . # or
312
+ 'a-z0-9%' . # Single letter or digit or '%'
313
+ # (Trying not to match e.g. "URI::Escape")
314
+ ')' .
315
+ '|' . # or
316
+ 'www\d{0,3}[.]' . # "www.", "www1.", "www2." … "www999."
317
+ '|' . # or
318
+ '[a-z0-9.\-]+[.][a-z]{2,4}/' . # looks like domain name followed by a slash
319
+ ')' .
320
+ '(?:' . # One or more:
321
+ '[^\s()<>]+' . # Run of non-space, non-()<>
322
+ '|' . # or
323
+ '\(([^\s()<>]+|(\([^\s()<>]+\)))*\)' . # balanced parens, up to 2 levels
324
+ ')+' .
325
+ '(?:' . # End with:
326
+ '\(([^\s()<>]+|(\([^\s()<>]+\)))*\)' . # balanced parens, up to 2 levels
327
+ '|' . # or
328
+ '[^\s`\!()\[\]{};:\'".,<>?«»“”‘’]' . # not a space or one of these punct chars
329
+ ')' .
330
+ ')';
331
+
332
+ return preg_match('!' . $expression . '!', $url) ? $url : null;
333
  }
includes/scripts.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
  /**
3
  * Scripts
4
- *
5
  * @package WPRSSAggregator
6
- */
7
 
8
 
9
- add_action( 'admin_enqueue_scripts', 'wprss_admin_scripts_styles' );
10
  /**
11
  * Insert required scripts, styles and filters on the admin side
12
- *
13
  * @since 2.0
14
- */
15
  function wprss_admin_scripts_styles() {
16
 
17
  // Only load scripts if we are on particular pages of the plugin in admin
18
- if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wprss-aggregator' || $_GET['page'] == 'wprss-aggregator-settings'
19
- || $_GET['page'] == 'wprss-import-export-settings' || $_GET['page'] == 'wprss-debugging' || $_GET['page'] == 'wprss-addons' ) ) {
20
  wp_enqueue_style( 'wprss-styles', WPRSS_CSS . 'admin-styles.css' );
21
- }
22
 
23
  if ( is_admin() ) {
24
  wp_enqueue_style( 'wprss-admin-3.8-styles', WPRSS_CSS . 'admin-3.8.css' );
@@ -35,8 +35,8 @@
35
  wp_enqueue_style( 'wprss-admin-tracking-styles', WPRSS_CSS . 'admin-tracking-styles.css' );
36
 
37
  $page = isset( $_GET['page'] )? $_GET['page'] : '';
38
-
39
- if ( ( 'post' === $screen->base || 'edit' === $screen->base || 'wprss-debugging' === $screen->base ) &&
40
  ( 'wprss_feed' === $screen->post_type || 'wprss_feed_item' === $screen->post_type ) ||
41
  $page == 'wprss-aggregator-settings' || $screen->post_type === 'wprss_blacklist' ) {
42
  wp_enqueue_style( 'wprss-admin-styles', WPRSS_CSS . 'admin-styles.css' );
@@ -92,7 +92,17 @@
92
  'import_export' => admin_url('edit.php?post_type=wprss_feed&page=wprss-import-export-settings')
93
  )
94
  );
95
-
 
 
 
 
 
 
 
 
 
 
96
  do_action( 'wprss_admin_scripts_styles' );
97
  } // end wprss_admin_scripts_styles
98
 
@@ -100,13 +110,13 @@
100
  add_action( 'wp_enqueue_scripts', 'wprss_load_scripts' );
101
  /**
102
  * Enqueues the required scripts.
103
- *
104
  * @since 3.0
105
- */
106
- function wprss_load_scripts() {
107
- /* wp_enqueue_script( 'jquery.colorbox-min', WPRSS_JS . 'jquery.colorbox-min.js', array( 'jquery' ) );
108
  wp_enqueue_script( 'custom', WPRSS_JS . 'custom.js', array( 'jquery', 'jquery.colorbox-min' ) ); */
109
- do_action( 'wprss_register_scripts' );
110
  } // end wprss_head_scripts_styles
111
 
112
 
@@ -136,19 +146,19 @@
136
  /**
137
  * Register front end CSS styling files
138
  * Inspiration from Easy Digital Downloads
139
- *
140
  * @since 3.0
141
- */
142
- function wprss_register_styles() {
143
 
144
  /* $general_settings = get_option( 'wprss_settings_general' );
145
 
146
  if( $general_settings['styles_disable'] == 1 )
147
  return;
148
- wp_enqueue_style( 'colorbox', WPRSS_CSS . 'colorbox.css', array(), '1.4.1' );
149
- wp_enqueue_style( 'styles', WPRSS_CSS . 'styles.css', array(), '' );
150
 
151
- /* If using DISABLE CSS option:
152
  global $edd_options;
153
 
154
  if( isset( $edd_options['disable_styles'] ) )
@@ -162,14 +172,14 @@
162
  if ( file_exists( trailingslashit( get_stylesheet_directory() ) . 'wprss_templates/' . $file ) ) {
163
  $url = trailingslashit( get_stylesheet_directory_uri() ) . 'wprss_templates/' . $file;
164
 
165
- // Check parent theme next
166
  } elseif ( file_exists( trailingslashit( get_template_directory() ) . 'wprss_templates/' . $file ) ) {
167
  $url = trailingslashit( get_template_directory_uri() ) . 'wprss_templates/' . $file;
168
 
169
- // Check theme compatibility last
170
  } elseif ( file_exists( trailingslashit( wprss_get_templates_dir() ) . $file ) ) {
171
  $url = trailingslashit( wprss_get_templates_uri() ) . $file;
172
- }
173
 
174
  wp_enqueue_style( 'wprss-styles', $url, WPRSS_VERSION );*/
175
  }
1
+ <?php
2
  /**
3
  * Scripts
4
+ *
5
  * @package WPRSSAggregator
6
+ */
7
 
8
 
9
+ add_action( 'admin_enqueue_scripts', 'wprss_admin_scripts_styles' );
10
  /**
11
  * Insert required scripts, styles and filters on the admin side
12
+ *
13
  * @since 2.0
14
+ */
15
  function wprss_admin_scripts_styles() {
16
 
17
  // Only load scripts if we are on particular pages of the plugin in admin
18
+ if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wprss-aggregator' || $_GET['page'] == 'wprss-aggregator-settings'
19
+ || $_GET['page'] == 'wprss-import-export-settings' || $_GET['page'] == 'wprss-debugging' || $_GET['page'] == 'wprss-addons' ) ) {
20
  wp_enqueue_style( 'wprss-styles', WPRSS_CSS . 'admin-styles.css' );
21
+ }
22
 
23
  if ( is_admin() ) {
24
  wp_enqueue_style( 'wprss-admin-3.8-styles', WPRSS_CSS . 'admin-3.8.css' );
35
  wp_enqueue_style( 'wprss-admin-tracking-styles', WPRSS_CSS . 'admin-tracking-styles.css' );
36
 
37
  $page = isset( $_GET['page'] )? $_GET['page'] : '';
38
+
39
+ if ( ( 'post' === $screen->base || 'edit' === $screen->base || 'wprss-debugging' === $screen->base ) &&
40
  ( 'wprss_feed' === $screen->post_type || 'wprss_feed_item' === $screen->post_type ) ||
41
  $page == 'wprss-aggregator-settings' || $screen->post_type === 'wprss_blacklist' ) {
42
  wp_enqueue_style( 'wprss-admin-styles', WPRSS_CSS . 'admin-styles.css' );
92
  'import_export' => admin_url('edit.php?post_type=wprss_feed&page=wprss-import-export-settings')
93
  )
94
  );
95
+
96
+ if ( 'wprss_feed_page_wprss-aggregator-settings' === $screen->base ) {
97
+ wp_enqueue_script( 'wprss-admin-license-manager', WPRSS_JS . 'admin-license-manager.js' );
98
+
99
+ wp_enqueue_script( 'wprss-admin-licensing', WPRSS_JS . 'admin-licensing.js' );
100
+ wp_localize_script( 'wprss-admin-licensing', 'wprss_admin_licensing', array(
101
+ 'activating' => __('Activating...', WPRSS_TEXT_DOMAIN),
102
+ 'deactivating' => __('Deactivating...', WPRSS_TEXT_DOMAIN)
103
+ ) );
104
+ }
105
+
106
  do_action( 'wprss_admin_scripts_styles' );
107
  } // end wprss_admin_scripts_styles
108
 
110
  add_action( 'wp_enqueue_scripts', 'wprss_load_scripts' );
111
  /**
112
  * Enqueues the required scripts.
113
+ *
114
  * @since 3.0
115
+ */
116
+ function wprss_load_scripts() {
117
+ /* wp_enqueue_script( 'jquery.colorbox-min', WPRSS_JS . 'jquery.colorbox-min.js', array( 'jquery' ) );
118
  wp_enqueue_script( 'custom', WPRSS_JS . 'custom.js', array( 'jquery', 'jquery.colorbox-min' ) ); */
119
+ do_action( 'wprss_register_scripts' );
120
  } // end wprss_head_scripts_styles
121
 
122
 
146
  /**
147
  * Register front end CSS styling files
148
  * Inspiration from Easy Digital Downloads
149
+ *
150
  * @since 3.0
151
+ */
152
+ function wprss_register_styles() {
153
 
154
  /* $general_settings = get_option( 'wprss_settings_general' );
155
 
156
  if( $general_settings['styles_disable'] == 1 )
157
  return;
158
+ wp_enqueue_style( 'colorbox', WPRSS_CSS . 'colorbox.css', array(), '1.4.1' );
159
+ wp_enqueue_style( 'styles', WPRSS_CSS . 'styles.css', array(), '' );
160
 
161
+ /* If using DISABLE CSS option:
162
  global $edd_options;
163
 
164
  if( isset( $edd_options['disable_styles'] ) )
172
  if ( file_exists( trailingslashit( get_stylesheet_directory() ) . 'wprss_templates/' . $file ) ) {
173
  $url = trailingslashit( get_stylesheet_directory_uri() ) . 'wprss_templates/' . $file;
174
 
175
+ // Check parent theme next
176
  } elseif ( file_exists( trailingslashit( get_template_directory() ) . 'wprss_templates/' . $file ) ) {
177
  $url = trailingslashit( get_template_directory_uri() ) . 'wprss_templates/' . $file;
178
 
179
+ // Check theme compatibility last
180
  } elseif ( file_exists( trailingslashit( wprss_get_templates_dir() ) . $file ) ) {
181
  $url = trailingslashit( wprss_get_templates_uri() ) . $file;
182
+ }
183
 
184
  wp_enqueue_style( 'wprss-styles', $url, WPRSS_VERSION );*/
185
  }
js/admin-license-manager.js ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($, window, document) {
2
+ var wprss = window.wprss = window.wprss || {};
3
+ var licenseManager = wprss.licenseManager = wprss.licenseManager || {};
4
+
5
+ $.extend(licenseManager, {
6
+ /**
7
+ @class LicenseManager
8
+ @description This class provides a way to get add-on license data or de/activate licenses.
9
+ @... The class' methods return jQuery Promises since the license data will be fetched
10
+ @... asynchronously. The Promise will resolve if the request was handled successfully,
11
+ @... and will otherwise be rejected. Attach .then()/.done()/.fail() handlers as required.
12
+ */
13
+ namespace: 'wprss.licenseManager',
14
+ licenses: {},
15
+
16
+ /**
17
+ @function isValid Returns a Promise to return whether the license for a given addon is valid.
18
+ @param {String} addon The abbr of the addon
19
+ @returns {Object} promise A jQuery Promise
20
+ @promise {Boolean} isValid TRUE when the license is valid.
21
+ */
22
+ isValid: function(addon) {
23
+ return this.getValidity(addon).then(function(validity) {
24
+ return validity === 'valid';
25
+ });
26
+ },
27
+
28
+ /**
29
+ @function isInvalid Returns a Promise to return whether the license for a given addon is invalid.
30
+ @param {String} addon The abbr of the addon
31
+ @returns {Object} promise A jQuery Promise
32
+ @promise {Boolean} isValid TRUE when the license is invalid.
33
+ */
34
+ isInvalid: function(addon) {
35
+ return this.getValidity(addon).then(function(validity) {
36
+ return validity !== 'valid';
37
+ });
38
+ },
39
+
40
+ /**
41
+ @function getLicense Returns a Promise to return an object containing the full license information as provided by EDD.
42
+ @param {String} addon The abbr of the addon
43
+ @param {Boolean} forceFetch If TRUE, bypass the cache.
44
+ @returns {Object} promise A jQuery Promise
45
+ @promise {Object} license The complete EDD license object.
46
+ */
47
+ getLicense: function(addon, forceFetch) {
48
+ var me = this;
49
+
50
+ if (this.licenses[addon] === undefined || forceFetch === true) {
51
+ // If the license hasn't been fetched before or we're forcing a fetch,
52
+ // return a Promise that'll be fulfilled after the license is XHR fetched.
53
+ return this._fetchLicense(addon).then(function(license) {
54
+ // We got the license info, save it for later use.
55
+ me.licenses[addon] = license;
56
+
57
+ return me.licenses[addon];
58
+ }, function(error) {
59
+ console.log(error);
60
+ });
61
+ } else {
62
+ // The license is cached so create a Deferred and immediately resolve it,
63
+ // returning the (fulfilled) Promise.
64
+ // When the caller attaches callbacks via .then(), the callbacks
65
+ // will immediately fire with the data we're passing back.
66
+ return $.Deferred().resolve(me.licenses[addon]).promise();
67
+ }
68
+ },
69
+
70
+ /**
71
+ @function getExpiry Returns a Promise to return the expiry date for an addon license.
72
+ @param {String} addon The abbr of the addon
73
+ @returns {Object} promise A jQuery Promise
74
+ @promise {String} date Date in "YYYY-MM-DD HH:MM:SS" format.
75
+ */
76
+ getExpiry: function(addon) {
77
+ return this._getAttribute(addon, 'expires').then(function(expiry) {
78
+ return expiry;
79
+ });
80
+ },
81
+
82
+ /**
83
+ @function getName Returns a Promise to return the name an addon license is registered to.
84
+ @param {String} addon The abbr of the addon
85
+ @returns {Object} promise A jQuery Promise
86
+ @promise {String} name Customer name
87
+ */
88
+ getName: function(addon) {
89
+ return this._getAttribute(addon, 'customer_name').then(function(name) {
90
+ return name;
91
+ });
92
+ },
93
+
94
+ /**
95
+ @function getEmail Returns a Promise to return the email an addon license is registered to.
96
+ @param {String} addon The abbr of the addon
97
+ @returns {Object} promise A jQuery Promise
98
+ @promise {String} email Customer email
99
+ */
100
+ getEmail: function(addon) {
101
+ return this._getAttribute(addon, 'customer_email').then(function(email) {
102
+ return email;
103
+ });
104
+ },
105
+
106
+ /**
107
+ @function getValidity Returns a Promise to return the validity status string of an addon license.
108
+ @param {String} addon The abbr of the addon
109
+ @returns {Object} promise A jQuery Promise
110
+ @promise {String} validity EDD license validity status.
111
+ */
112
+ getValidity: function(addon) {
113
+ return this._getAttribute(addon, 'license').then(function(validity) {
114
+ return validity;
115
+ });
116
+ },
117
+
118
+ /**
119
+ @function activateLicense Activates a specified license key for a given addon.
120
+ @param {String} addon The abbr of the addon
121
+ @param {String} license The license key to activate
122
+ @param {String} nonce The security nonce
123
+ @returns {Object} promise A jQuery Promise
124
+ @promise {Object} response
125
+ @... {String} validity EDD license validity status.
126
+ @... {String} addon The addon the license was activated for.
127
+ @... {String} html The HTML markup of a deactivation button and info div.
128
+ */
129
+ activateLicense: function(addon, license, nonce) {
130
+ return this._manageLicense(addon, 'activate', license, nonce);
131
+ },
132
+
133
+ /**
134
+ @function deactivateLicense Deactivates a specified license key for a given addon.
135
+ @param {String} addon The abbr of the addon
136
+ @param {String} license The license key to deactivate
137
+ @param {String} nonce The security nonce
138
+ @returns {Object} promise A jQuery Promise
139
+ @promise {Object} response
140
+ @... {String} validity EDD license validity status.
141
+ @... {String} addon The addon the license was activated for.
142
+ @... {String} html The HTML markup of a deactivation button and info div.
143
+ */
144
+ deactivateLicense: function(addon, license, nonce) {
145
+ return this._manageLicense(addon, 'deactivate', license, nonce);
146
+ },
147
+
148
+ /**
149
+ @function _getAttribute Gets a specified attribute from a specified addon's license.
150
+ @private
151
+ @param {String} addon The abbr of the addon
152
+ @param {String} attr The license attribute to fetch
153
+ @returns {Object} promise A jQuery Promise
154
+ @promise {String} value The attr's value
155
+ */
156
+ _getAttribute: function(addon, attr) {
157
+ return this.getLicense(addon).then(function(license) {
158
+ return license[attr];
159
+ });
160
+ },
161
+
162
+ /**
163
+ @function _fetchLicense Fetches license data via AJAX call to WordPress.
164
+ @private
165
+ @param {String} addon The abbr of the addon
166
+ @returns {Object} promise A jQuery Promise
167
+ @promise {Object} license The license object, if no errors.
168
+ */
169
+ _fetchLicense: function(addon) {
170
+ return $.ajax({
171
+ url: ajaxurl,
172
+ dataType: 'json',
173
+ data: {
174
+ action: 'wprss_ajax_fetch_license',
175
+ addon: addon
176
+ }
177
+ }).then(function(response, textStatus, jqXHR) {
178
+ if (response.error !== undefined) {
179
+ console.log('Error: ', response.error);
180
+ return $.Deferred().reject(jqXHR, response, 'Not YES').promise();
181
+ }
182
+
183
+ return response;
184
+ });
185
+ },
186
+
187
+ /**
188
+ @function _manageLicense De/activates a license via AJAX call to WordPress.
189
+ @private
190
+ @param {String} addon The abbr of the addon
191
+ @param {String} action 'activate' or 'deactivate'
192
+ @param {String} license The license key to deactivate
193
+ @param {String} nonce The security nonce
194
+ @returns {Object} promise A jQuery Promise
195
+ @promise {Object} response The response, if no errors.
196
+ @... {String} validity EDD license validity status.
197
+ @... {String} addon The addon the license was activated for.
198
+ @... {String} html The HTML markup of a deactivation button and info div.
199
+ */
200
+ _manageLicense: function(addon, action, license, nonce) {
201
+ return $.ajax({
202
+ url: ajaxurl,
203
+ dataType: 'json',
204
+ data: {
205
+ action: 'wprss_ajax_manage_license',
206
+ addon: addon,
207
+ event: action,
208
+ license: license,
209
+ nonce: nonce
210
+ }
211
+ }).then(function(response, textStatus, jqXHR) {
212
+ if (response.error !== undefined) {
213
+ // If there was an error on the backend, we want to break the chain
214
+ // of resolves. We do this by creating a new Promise and rejecting it with
215
+ // the data indicating the error.
216
+ console.log('Error: ', response.error);
217
+ return $.Deferred().reject(jqXHR, response, 'Not YES').promise();
218
+ }
219
+
220
+ return response;
221
+ });
222
+ }
223
+
224
+ });
225
+
226
+ })(jQuery, top, document);
js/admin-licensing.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($) {
2
+ var licenseManager = window.wprss.licenseManager;
3
+
4
+ manage_license = function() {
5
+ var button = $(this),
6
+ activating = button.hasClass('button-activate-license'),
7
+ button_orig_label = button.attr('value'),
8
+ addon = button.attr('name').split('_', 3)[1], // Name has form "wprss_ftp_license_deactivate"; grab the "ftp" part.
9
+ license = $('#wprss-' + addon + '-license-key').val(),
10
+ nonce = $('#wprss_' + addon + '_license_nonce').val(),
11
+ promise;
12
+
13
+ button.attr('disabled', true);
14
+ button.attr('value', activating ? wprss_admin_licensing.activating : wprss_admin_licensing.deactivating);
15
+
16
+ if (activating) {
17
+ promise = licenseManager.activateLicense(addon, license, nonce);
18
+ } else {
19
+ promise = licenseManager.deactivateLicense(addon, license, nonce);
20
+ }
21
+
22
+ promise.then(function( response ) {
23
+ var td = button.parent();
24
+
25
+ // Inject the new HTML we got to update the UI and hook up the onClick handler.
26
+ if (response.html !== undefined) {
27
+ td.empty();
28
+ td.append(response.html);
29
+ td.children('.button-activate-license').click(manage_license);
30
+ td.children('.button-deactivate-license').click(manage_license);
31
+ }
32
+
33
+ // There was an error.
34
+ if (response.error !== undefined) {
35
+ console.log('There was an error: ' + response.error);
36
+ }
37
+ },
38
+ function ( error ) {
39
+ console.log('Error: ', error);
40
+ button.attr('disabled', false);
41
+ button.attr('value', button_orig_label);
42
+ });
43
+
44
+ };
45
+
46
+ $('.button-activate-license').click(manage_license);
47
+ $('.button-deactivate-license').click(manage_license);
48
+
49
+ });
js/heartbeat.js CHANGED
@@ -63,31 +63,13 @@
63
  // Update the items imported count and the icon
64
  var icon = itemsCol.find('i.fa-spin');
65
  var itemCount = itemsCol.find('span.items-imported');
66
- // Check if the icon is shown, and the current heartbeat data indicates no updating
67
- var stopUpdating = icon.hasClass('wprss-show') && !feed_source['updating'];
68
- // Check if the item count changed
69
- var itemCountChanged = feed_source['items'] != itemCount.text();
 
 
70
 
71
- // Check if we are waiting for the item count to update
72
- var waiting = itemsCol.hasClass('waiting');
73
-
74
- // Check if the updating stopped, but the item count remained the same.
75
- // If we were previously waiting, prevent this which causes the script to "wait" again (forever)
76
- if ( stopUpdating && !itemCountChanged && !waiting ) {
77
- // If so, then we must wait for next heartbeat pulse to get the item count and remove the spinning icon
78
- itemsCol.addClass('waiting');
79
- }
80
- // Otherwise,
81
- else {
82
- // Update the count and the icon appropriately
83
- itemCount.text( feed_source['items'] );
84
- icon.toggleClass( 'wprss-show', feed_source['updating'] );
85
- }
86
-
87
- // If we were waiting, we are not anymore. Remove the waiting class
88
- if ( waiting ) {
89
- itemsCol.removeClass('waiting');
90
- }
91
 
92
 
93
  // Update the error icon
63
  // Update the items imported count and the icon
64
  var icon = itemsCol.find('i.fa-spin');
65
  var itemCount = itemsCol.find('span.items-imported');
66
+
67
+ // Update the count and the icon appropriately
68
+ itemCount.text( feed_source['items'] );
69
+ icon.toggleClass( 'wprss-show', feed_source['updating'] );
70
+
71
+
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
 
75
  // Update the error icon
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WP RSS Aggregator ===
2
- Contributors: jeangalea, Mekku, xedin.unknown, markzahra
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ
4
  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, rss feeder, rss post importer, autoblog aggregator, autoblog, autopost, content curation, feedwordpress, wp rss multi import, hungryfeed, wp-o-matic, rss feed, rss feed to post, rss retriever, syndication
6
  Requires at least: 3.3
7
- Tested up to: 4.0
8
- Stable tag: 4.6.6
9
  License: GPLv2 or later
10
  The no.1 RSS feed importer for WordPress. Premium add-ons available for more functionality.
11
 
@@ -167,6 +167,14 @@ The full documentation section can be found on the [WP RSS Aggregator website](w
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
 
 
170
  = 4.6.7 (2014-12-17) =
171
  * Enhanced: Some minor interface updates.
172
  * Enhanced: Added filters for use by the premium add-ons.
1
  === WP RSS Aggregator ===
2
+ Contributors: jeangalea, Mekku, xedin.unknown, markzahra, doytch
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ
4
  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, rss feeder, rss post importer, autoblog aggregator, autoblog, autopost, content curation, feedwordpress, wp rss multi import, hungryfeed, wp-o-matic, rss feed, rss feed to post, rss retriever, syndication
6
  Requires at least: 3.3
7
+ Tested up to: 4.1
8
+ Stable tag: 4.6.8
9
  License: GPLv2 or later
10
  The no.1 RSS feed importer for WordPress. Premium add-ons available for more functionality.
11
 
167
 
168
  == Changelog ==
169
 
170
+ = 4.6.8 (2014-01-07) =
171
+ * Enhanced: Added more logging during feed importing.
172
+ * Enhanced: Irrelevent metaboxes added by other plugins are now removed from the Add/Edit Feed Source page.
173
+ * Fixed bug: Valid feed URLS were being invalidated.
174
+ * Fixed bug: The Blacklist feature was being hidden when the Feed to Post add-on was enabled.
175
+ * Fixed bug: Patched a vulnerability where any user on the site can issue a feed fetch.
176
+ * Fixed bug: The "Activate" and "Pause" actions are not shown in the bulk actions dropdown in WordPress v4.1.
177
+
178
  = 4.6.7 (2014-12-17) =
179
  * Enhanced: Some minor interface updates.
180
  * Enhanced: Added filters for use by the premium add-ons.
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.6.7
7
  Author: Jean Galea
8
  Author URI: http://www.wprssaggregator.com
9
  License: GPLv2
@@ -11,7 +11,7 @@
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,10 +29,10 @@
29
 
30
  /**
31
  * @package WPRSSAggregator
32
- * @version 4.6.7
33
  * @since 1.0
34
  * @author Jean Galea <info@wprssaggregator.com>
35
- * @copyright Copyright (c) 2012-2014, Jean Galea
36
  * @link http://www.wprssaggregator.com/
37
  * @license http://www.gnu.org/licenses/gpl.html
38
  */
@@ -43,7 +43,7 @@
43
 
44
  // Set the version number of the plugin.
45
  if( !defined( 'WPRSS_VERSION' ) )
46
- define( 'WPRSS_VERSION', '4.6.7', true );
47
 
48
  // Set the database version number of the plugin.
49
  if( !defined( 'WPRSS_DB_VERSION' ) )
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.6.8
7
  Author: Jean Galea
8
  Author URI: http://www.wprssaggregator.com
9
  License: GPLv2
11
  */
12
 
13
  /*
14
+ Copyright 2012-2015 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 4.6.8
33
  * @since 1.0
34
  * @author Jean Galea <info@wprssaggregator.com>
35
+ * @copyright Copyright (c) 2012-2015, Jean Galea
36
  * @link http://www.wprssaggregator.com/
37
  * @license http://www.gnu.org/licenses/gpl.html
38
  */
43
 
44
  // Set the version number of the plugin.
45
  if( !defined( 'WPRSS_VERSION' ) )
46
+ define( 'WPRSS_VERSION', '4.6.8', true );
47
 
48
  // Set the database version number of the plugin.
49
  if( !defined( 'WPRSS_DB_VERSION' ) )