Super RSS Reader - Version 4.3

Version Description

Download this release

Release Info

Developer vaakash
Plugin Icon 128x128 Super RSS Reader
Version 4.3
Comparing to
See all releases

Code changes from version 4.2 to 4.3

includes/feed.php CHANGED
@@ -31,6 +31,7 @@ class SRR_Feed{
31
  $strip_desc = intval( $this->options['strip_desc'] );
32
  $strip_title = intval( $this->options['strip_title'] );
33
  $date_format = htmlspecialchars( $this->options['date_format'] );
 
34
  $read_more = htmlspecialchars( $this->options['read_more'] );
35
  $rich_desc = intval( $this->options['rich_desc'] );
36
  $thumbnail_position = htmlspecialchars( $this->options['thumbnail_position'] );
@@ -105,22 +106,25 @@ class SRR_Feed{
105
  continue;
106
  }
107
 
108
- if( method_exists( $feed, 'enable_order_by_date' ) ){
109
- $feed->enable_order_by_date( false );
110
  }
111
 
112
- $max_items = $feed->get_item_quantity( $count );
113
- $feed_items = $feed->get_items( 0, $max_items );
114
-
115
  // Outer wrap start
116
  $html .= '<div class="' . $class . '" data-visible="' . $visible_items . '" data-speed="' . $ticker_speed . '" data-id="srr-tab-' . $id . '">';
117
  $html .= '<div>';
118
 
 
 
119
  // Check feed items
120
  if ( $max_items == 0 ){
121
  $html .= '<div>' . __( 'No items', 'super-rss-reader' ) . '</div>';
122
  }else{
 
 
 
123
  $j=1;
 
124
  // Loop through each feed item
125
  foreach( $feed_items as $item ){
126
 
@@ -155,6 +159,7 @@ class SRR_Feed{
155
  $thumb = '';
156
  if ( $show_thumb == 1 ){
157
  $thumb_url = $this->get_thumbnail_url( $item, $thumbnail_default );
 
158
  if( !empty( $thumb_url ) ){
159
  $thumb_styles = array(
160
  'width' => $thumbnail_size,
@@ -278,6 +283,29 @@ class SRR_Feed{
278
 
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  function get_thumbnail_url( $item, $thumbnail_default ){
282
 
283
  // Try to get from the item enclosure
31
  $strip_desc = intval( $this->options['strip_desc'] );
32
  $strip_title = intval( $this->options['strip_title'] );
33
  $date_format = htmlspecialchars( $this->options['date_format'] );
34
+ $order_by = htmlspecialchars( $this->options['order_by'] );
35
  $read_more = htmlspecialchars( $this->options['read_more'] );
36
  $rich_desc = intval( $this->options['rich_desc'] );
37
  $thumbnail_position = htmlspecialchars( $this->options['thumbnail_position'] );
106
  continue;
107
  }
108
 
109
+ if( method_exists( $feed, 'enable_order_by_date' ) && in_array( $order_by, array( 'date', 'date_reverse' ) ) ){
110
+ $feed->enable_order_by_date( true );
111
  }
112
 
 
 
 
113
  // Outer wrap start
114
  $html .= '<div class="' . $class . '" data-visible="' . $visible_items . '" data-speed="' . $ticker_speed . '" data-id="srr-tab-' . $id . '">';
115
  $html .= '<div>';
116
 
117
+ $max_items = $feed->get_item_quantity();
118
+
119
  // Check feed items
120
  if ( $max_items == 0 ){
121
  $html .= '<div>' . __( 'No items', 'super-rss-reader' ) . '</div>';
122
  }else{
123
+
124
+ $feed_items = $feed->get_items();
125
+ $feed_items = $this->process_items( $feed_items, $count, $order_by );
126
  $j=1;
127
+
128
  // Loop through each feed item
129
  foreach( $feed_items as $item ){
130
 
159
  $thumb = '';
160
  if ( $show_thumb == 1 ){
161
  $thumb_url = $this->get_thumbnail_url( $item, $thumbnail_default );
162
+ $thumb_url = apply_filters( 'srr_mod_thumbnail_url', $thumb_url, $item, $feed, $thumbnail_default );
163
  if( !empty( $thumb_url ) ){
164
  $thumb_styles = array(
165
  'width' => $thumbnail_size,
283
 
284
  }
285
 
286
+ function process_items( $items, $count, $order_by ){
287
+
288
+ if( count( $items ) == 0 ){
289
+ return $items;
290
+ }
291
+
292
+ // For shuffle order - Shuffle first and then slice as per count
293
+ if( $order_by == 'random' ){
294
+ shuffle( $items );
295
+ return array_slice( $items, 0, $count );
296
+ }
297
+
298
+ // For date based order - slice first and then order
299
+ $items = array_slice( $items, 0, $count );
300
+
301
+ if( $order_by == 'date_reverse' ){
302
+ $items = array_reverse( $items );
303
+ }
304
+
305
+ return $items;
306
+
307
+ }
308
+
309
  function get_thumbnail_url( $item, $thumbnail_default ){
310
 
311
  // Try to get from the item enclosure
includes/options.php CHANGED
@@ -67,6 +67,15 @@ class SRR_Options{
67
  'default' => 'j F Y',
68
  'description' => __( 'The format of the feed item date.', 'super-rss-reader' )
69
  ),
 
 
 
 
 
 
 
 
 
70
  'read_more' => array(
71
  'default' => '[...]',
72
  'description' => __( 'The read more text if the description is trimmed.', 'super-rss-reader' )
67
  'default' => 'j F Y',
68
  'description' => __( 'The format of the feed item date.', 'super-rss-reader' )
69
  ),
70
+ 'order_by' => array(
71
+ 'default' => 'date',
72
+ 'description' => __( 'The order of the feed', 'super-rss-reader' ),
73
+ 'options' => array(
74
+ 'date' => __( 'Date', 'super-rss-reader' ),
75
+ 'date_reverse' => __( 'Date reverse', 'super-rss-reader' ),
76
+ 'random' => __( 'Random', 'super-rss-reader' )
77
+ )
78
+ ),
79
  'read_more' => array(
80
  'default' => '[...]',
81
  'description' => __( 'The read more text if the description is trimmed.', 'super-rss-reader' )
includes/widget-admin.php CHANGED
@@ -57,6 +57,7 @@ class super_rss_reader_widget extends WP_Widget{
57
  $instance[ 'strip_desc' ] = intval( $new_instance['strip_desc'] );
58
  $instance[ 'strip_title' ] = intval( $new_instance['strip_title'] );
59
  $instance[ 'date_format' ] = stripslashes( $new_instance['date_format'] );
 
60
  $instance[ 'read_more' ] = stripslashes( $new_instance['read_more'] );
61
  $instance[ 'add_nofollow' ] = intval( isset( $new_instance['add_nofollow'] ) ? $new_instance['add_nofollow'] : 0 );
62
  $instance[ 'open_newtab' ] = intval( isset( $new_instance['open_newtab'] ) ? $new_instance['open_newtab'] : 0 );
@@ -92,6 +93,7 @@ class super_rss_reader_widget extends WP_Widget{
92
  $strip_desc = intval($instance['strip_desc']);
93
  $strip_title = intval($instance['strip_title']);
94
  $date_format = htmlspecialchars($instance['date_format']);
 
95
  $read_more = htmlspecialchars($instance['read_more']);
96
  $rich_desc = intval($instance['rich_desc']);
97
  $thumbnail_position = htmlspecialchars($instance['thumbnail_position']);
@@ -186,6 +188,19 @@ class super_rss_reader_widget extends WP_Widget{
186
  <div class="srr_field"><input id="<?php echo $this->get_field_id('date_format'); ?>" name="<?php echo $this->get_field_name('date_format'); ?>" type="text" value="<?php echo $date_format; ?>" class="widefat" /><div><a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><?php _e( 'Refer format codes here', 'super-rss-reader' ); ?></a></div></div>
187
  </div>
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  <h4><?php _e( 'Description', 'super-rss-reader' ); ?></h4>
190
 
191
  <div class="srr_row">
57
  $instance[ 'strip_desc' ] = intval( $new_instance['strip_desc'] );
58
  $instance[ 'strip_title' ] = intval( $new_instance['strip_title'] );
59
  $instance[ 'date_format' ] = stripslashes( $new_instance['date_format'] );
60
+ $instance[ 'order_by' ] = stripslashes( $new_instance['order_by'] );
61
  $instance[ 'read_more' ] = stripslashes( $new_instance['read_more'] );
62
  $instance[ 'add_nofollow' ] = intval( isset( $new_instance['add_nofollow'] ) ? $new_instance['add_nofollow'] : 0 );
63
  $instance[ 'open_newtab' ] = intval( isset( $new_instance['open_newtab'] ) ? $new_instance['open_newtab'] : 0 );
93
  $strip_desc = intval($instance['strip_desc']);
94
  $strip_title = intval($instance['strip_title']);
95
  $date_format = htmlspecialchars($instance['date_format']);
96
+ $order_by = htmlspecialchars($instance['order_by']);
97
  $read_more = htmlspecialchars($instance['read_more']);
98
  $rich_desc = intval($instance['rich_desc']);
99
  $thumbnail_position = htmlspecialchars($instance['thumbnail_position']);
188
  <div class="srr_field"><input id="<?php echo $this->get_field_id('date_format'); ?>" name="<?php echo $this->get_field_name('date_format'); ?>" type="text" value="<?php echo $date_format; ?>" class="widefat" /><div><a href="https://wordpress.org/support/article/formatting-date-and-time/" target="_blank"><?php _e( 'Refer format codes here', 'super-rss-reader' ); ?></a></div></div>
189
  </div>
190
 
191
+ <div class="srr_row">
192
+ <div class="srr_label"><label for="<?php echo $this->get_field_id('order_by');?>"><?php _e( 'Order feed items by', 'super-rss-reader' ); ?></label></div>
193
+ <div class="srr_field">
194
+ <?php
195
+ echo '<select name="' . $this->get_field_name('order_by') . '" id="' . $this->get_field_id('order_by') . '">';
196
+ foreach( $option_lists[ 'order_by' ] as $k => $v ){
197
+ echo '<option value="' . $k . '" ' . selected( $order_by, $k ) . '>' . $v . '</option>';
198
+ }
199
+ echo '</select>';
200
+ ?>
201
+ </div>
202
+ </div>
203
+
204
  <h4><?php _e( 'Description', 'super-rss-reader' ); ?></h4>
205
 
206
  <div class="srr_row">
readme.txt CHANGED
@@ -7,8 +7,8 @@ License: GPLv2 or later
7
  Donate Link: https://www.paypal.me/vaakash
8
  Requires at least: 2.8
9
  Requires PHP: 5.3
10
- Tested up to: 5.7.1
11
- Stable tag: 4.2
12
 
13
  Display any RSS feed(s) in widget with news ticker effect in multiple tabs, thumbnails, customizable color themes and more.
14
 
@@ -30,6 +30,7 @@ The widget is fully customizable with external styles and also has color themes
30
  * Customizable ticker speed.
31
  * Supports RSS and atom feed.
32
  * Trim title and description text of the feed item.
 
33
 
34
  ### 🌄 Display RSS feeds like
35
 
@@ -126,6 +127,10 @@ The additional effect needs only 2.5 KB of additional JavaScript file which is v
126
 
127
  ## Changelog
128
 
 
 
 
 
129
  ### 4.2
130
  * Fix: Ticker sometimes gets stuck when browser tab is switched or not viewed.
131
  * New: Featured image is automatically inserted into local RSS feed to show as thumbnail if the post has no image in it.
7
  Donate Link: https://www.paypal.me/vaakash
8
  Requires at least: 2.8
9
  Requires PHP: 5.3
10
+ Tested up to: 5.7.2
11
+ Stable tag: 4.3
12
 
13
  Display any RSS feed(s) in widget with news ticker effect in multiple tabs, thumbnails, customizable color themes and more.
14
 
30
  * Customizable ticker speed.
31
  * Supports RSS and atom feed.
32
  * Trim title and description text of the feed item.
33
+ * **Order** feed items by date or random.
34
 
35
  ### 🌄 Display RSS feeds like
36
 
127
 
128
  ## Changelog
129
 
130
+ ### 4.3
131
+ * New: Option to order/sort feed items by date, random.
132
+ * New: Filter hook to customize thumbnail URL.
133
+
134
  ### 4.2
135
  * Fix: Ticker sometimes gets stuck when browser tab is switched or not viewed.
136
  * New: Featured image is automatically inserted into local RSS feed to show as thumbnail if the post has no image in it.
super-rss-reader.php CHANGED
@@ -5,12 +5,12 @@
5
  * Description: Display any RSS feed(s) in widget with news ticker effect in multiple tabs, thumbnails, customizable color themes and more.
6
  * Author: Aakash Chakravarthy
7
  * Author URI: https://www.aakashweb.com/
8
- * Version: 4.2
9
  * Text Domain: super-rss-reader
10
  * Domain Path: /languages
11
  */
12
 
13
- define( 'SRR_VERSION', '4.2' );
14
  define( 'SRR_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15
  define( 'SRR_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'SRR_BASE_NAME', plugin_basename( __FILE__ ) );
5
  * Description: Display any RSS feed(s) in widget with news ticker effect in multiple tabs, thumbnails, customizable color themes and more.
6
  * Author: Aakash Chakravarthy
7
  * Author URI: https://www.aakashweb.com/
8
+ * Version: 4.3
9
  * Text Domain: super-rss-reader
10
  * Domain Path: /languages
11
  */
12
 
13
+ define( 'SRR_VERSION', '4.3' );
14
  define( 'SRR_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
15
  define( 'SRR_URL', plugin_dir_url( __FILE__ ) );
16
  define( 'SRR_BASE_NAME', plugin_basename( __FILE__ ) );