RSSImport - Version 4.6.1

Version Description

Download this release

Release Info

Developer Bueltge
Plugin Icon wp plugin RSSImport
Version 4.6.1
Comparing to
See all releases

Code changes from version 4.6.0 to 4.6.1

Files changed (2) hide show
  1. readme.txt +4 -1
  2. rssimport.php +54 -26
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://bueltge.de/wunschliste/
7
  Tags: rss, post, content, post, feed
8
  Requires at least: 1.5
9
  Tested up to: 5.3
10
- Stable tag: 4.6.0
11
 
12
  Display feeds on your blog, using PHP in your templates or Shortcode in your posts and pages.
13
 
@@ -144,6 +144,9 @@ or
144
  1. Widget support
145
 
146
  == Changelog ==
 
 
 
147
  = v4.6.0 (2019-12-23) =
148
  * Add new parameter to set the order of date, title, creator and description.
149
  * Maintain simple topics inside the code.
7
  Tags: rss, post, content, post, feed
8
  Requires at least: 1.5
9
  Tested up to: 5.3
10
+ Stable tag: 4.6.1
11
 
12
  Display feeds on your blog, using PHP in your templates or Shortcode in your posts and pages.
13
 
144
  1. Widget support
145
 
146
  == Changelog ==
147
+ = v4.6.1 (2019-12-25) =
148
+ * Fix simple bug on shortcode to output the content.
149
+
150
  = v4.6.0 (2019-12-23) =
151
  * Add new parameter to set the order of date, title, creator and description.
152
  * Maintain simple topics inside the code.
rssimport.php CHANGED
@@ -6,12 +6,12 @@
6
  * Domain Path: /languages
7
  * Description: Display Feeds in your blog. Use the function <code>RSSImport()</code>, a Widget or the Shortcode <code>[RSSImport]</code>.
8
  * Author: Frank Bültge, took77
9
- * Version: 4.6.0
10
  * License: GPLv3+
11
- * Last change: 2019-12-23
12
  */
13
 
14
- /*
15
  ------------------------------------------------------------
16
  ACKNOWLEDGEMENTS
17
  ------------------------------------------------------------
@@ -19,11 +19,6 @@ Original and Idea: Dave Wolf, http://www.davewolf.net
19
  Thx to Thomas Fischer, http://www.securityfocus.de and
20
  Gunnar Tillmann http://www.gunnart.de for a rearrange code,
21
  Ilya Shindyapin, http://skookum.com for adding of paging
22
-
23
- ------------------------------------------------------------
24
- USAGE: Use following code with a PHP-Plugin for WordPress:
25
- Example: <?php RSSImport(10, "https://bueltge.de/feed/"); ?>
26
- ------------------------------------------------------------
27
  */
28
 
29
  //avoid direct calls to this file, because now WP core and framework has been used
@@ -329,7 +324,7 @@ function RSSImport(
329
  if ( $use_simplepie && $displaydescriptions && $html ) {
330
  $desc = @html_entity_decode( $item->get_content(), ENT_QUOTES, get_option( 'blog_charset' ) );
331
  } // For import with HTML
332
- elseif ( $use_simplepie && $displaydescriptions && ! $html ) {
333
  $desc = str_replace(
334
  [ "\n", "\r" ],
335
  ' ',
@@ -341,19 +336,19 @@ function RSSImport(
341
  )
342
  );
343
  } // For import without HTML
344
- elseif ( $displaydescriptions
345
  && $html
346
  && isset( $item['content']['encoded'] )
347
  && $item['content']['encoded'] !== 'A' ) {
348
  $desc = $item['content']['encoded'];
349
  } // For import with HTML
350
- elseif ( $displaydescriptions
351
  && $html
352
  && isset( $item['content']['atom_content'] )
353
  && $item['content']['atom_content'] !== 'A' ) {
354
  $desc = $item['content']['atom_content'];
355
  } // For import with HTML
356
- elseif ( $displaydescriptions
357
  && $html
358
  && isset( $item['content'] )
359
  && ! is_array( $item['content'] ) ) {
@@ -1428,6 +1423,11 @@ function RSSImport_end_on_word( $str ) {
1428
  return rtrim( implode( ' ', $arr ), ',;' );
1429
  }
1430
 
 
 
 
 
 
1431
  function RSSImport_Shortcode( $atts ) {
1432
  $args = shortcode_atts(
1433
  [
@@ -1477,40 +1477,40 @@ function RSSImport_Shortcode( $atts ) {
1477
  $atts
1478
  );
1479
 
1480
- $display = (int) $args['display'];
1481
  $feedurl = html_entity_decode( $args['feedurl'] ); // novaclic: undo encoding due to wordpress WYSIWYG editor
1482
  if ( 'true' === strtolower( $args['html'] ) ) {
1483
  $args['html'] = 1;
1484
  }
1485
  $before_desc = $args['before_desc'];
1486
- $html = (int) $args['html'];
1487
  if ( 'true' === strtolower( $args['displaydescriptions'] ) ) {
1488
  $args['displaydescriptions'] = 1;
1489
  }
1490
  $after_desc = $args['after_desc'];
1491
- $displaydescriptions = (int) $args['displaydescriptions'];
1492
  if ( 'true' === strtolower( $args['truncatedescchar'] ) ) {
1493
  $args['truncatedescchar'] = 1;
1494
  }
1495
- $truncatedescchar = (int) $args['truncatedescchar'];
1496
  if ( 'true' === strtolower( $args['truncatetitlechar'] ) ) {
1497
  $args['truncatetitlechar'] = 1;
1498
  }
1499
  $truncatedescstring = $args['truncatedescstring'];
1500
  $truncatetitlestring = $args['truncatetitlestring'];
1501
- $truncatetitlechar = (int) $args['truncatetitlechar'];
1502
  $before_date = $args['before_date'];
1503
  if ( 'true' === strtolower( $args['date'] ) ) {
1504
  $args['date'] = 1;
1505
  }
1506
- $date = (int) $args['date'];
1507
  $after_date = $args['after_date'];
1508
  $date_format = $args['date_format'];
1509
  if ( 'true' === strtolower( $args['creator'] ) ) {
1510
  $args['creator'] = 1;
1511
  }
1512
  $before_creator = $args['before_creator'];
1513
- $creator = (int) $args['creator'];
1514
  $after_creator = $args['after_creator'];
1515
  $start_items = $args['start_items'];
1516
  $end_items = $args['end_items'];
@@ -1522,11 +1522,11 @@ function RSSImport_Shortcode( $atts ) {
1522
  if ( 'true' === strtolower( $args['charsetscan'] ) ) {
1523
  $args['charsetscan'] = 1;
1524
  }
1525
- $charsetscan = (int) $args['charsetscan'];
1526
  if ( 'true' === strtolower( $args['debug'] ) ) {
1527
  $args['debug'] = 1;
1528
  }
1529
- $debug = (int) $args['debug'];
1530
  $before_noitems = $args['before_noitems'];
1531
  $noitems = $args['noitems'];
1532
  $after_noitems = $args['after_noitems'];
@@ -1536,7 +1536,7 @@ function RSSImport_Shortcode( $atts ) {
1536
  if ( 'true' === strtolower( $args['paging'] ) ) {
1537
  $args['paging'] = 1;
1538
  }
1539
- $paging = (int) $args['paging'];
1540
  if ( 'true' === strtolower( $args['use_simplepie'] ) ) {
1541
  $args['use_simplepie'] = 1;
1542
  }
@@ -1544,12 +1544,12 @@ function RSSImport_Shortcode( $atts ) {
1544
  $next_paging_link = $args['next_paging_link'];
1545
  $prev_paging_title = $args['prev_paging_title'];
1546
  $next_paging_title = $args['next_paging_title'];
1547
- $use_simplepie = (int) $args['use_simplepie'];
1548
  $view = $args['view'];
1549
  $random_sort = $args['random_sort'];
1550
  $order = $args['order'];
1551
 
1552
- RSSImport(
1553
  $display,
1554
  $feedurl,
1555
  $before_desc,
@@ -1727,6 +1727,9 @@ add_action( 'init', 'RSSImport_textdomain' );
1727
  /**
1728
  * code to utf-8 in PHP 4
1729
  *
 
 
 
1730
  * @package WP-RSSImport
1731
  */
1732
  function RSSImport_code_to_utf8( $num ) {
@@ -1739,8 +1742,9 @@ function RSSImport_code_to_utf8( $num ) {
1739
  }
1740
 
1741
  if ( $num <= 0xFFFF ) {
1742
- return chr( ( $num >> 0x0C ) + 0xE0 ) . chr( ( ( $num >> 0x06 ) & 0x3F ) + 0x80 ) . chr( ( $num & 0x3F )
1743
- + 0x80 );
 
1744
  }
1745
 
1746
  if ( $num <= 0x1FFFFF ) {
@@ -1757,6 +1761,9 @@ function RSSImport_code_to_utf8( $num ) {
1757
  /**
1758
  * html_entity_decode for PHP 4
1759
  *
 
 
 
1760
  * @package WP-RSSImport
1761
  */
1762
  function RSSImport_html_entity_decode_php4( $str ) {
@@ -2023,8 +2030,14 @@ function RSSImport_html_entity_decode_php4( $str ) {
2023
 
2024
  // check class wp_widget exists
2025
  if ( class_exists( 'WP_Widget' ) ) {
 
 
 
2026
  class RSSImport_Widget extends WP_Widget {
2027
 
 
 
 
2028
  public function __construct() {
2029
  $widget_ops = [
2030
  'classname' => 'rssimport',
@@ -2033,6 +2046,10 @@ if ( class_exists( 'WP_Widget' ) ) {
2033
  parent::__construct( 'rssimport', __( 'RSSImport' ), $widget_ops );
2034
  }
2035
 
 
 
 
 
2036
  public function widget( $args, $instance ) {
2037
  $title = empty( $instance['title'] )
2038
  ? '&nbsp;'
@@ -2210,6 +2227,12 @@ if ( class_exists( 'WP_Widget' ) ) {
2210
  echo $args['after_widget'];
2211
  }
2212
 
 
 
 
 
 
 
2213
  public function update( $new_instance, $old_instance ) {
2214
  $instance['instance'] = $old_instance;
2215
  $instance['title'] = strip_tags( $new_instance['title'] );
@@ -2263,6 +2286,11 @@ if ( class_exists( 'WP_Widget' ) ) {
2263
  return stripslashes( strip_tags( $instance ) );
2264
  }
2265
 
 
 
 
 
 
2266
  public function form( $instance ) {
2267
  $instance = wp_parse_args(
2268
  (array) $instance,
6
  * Domain Path: /languages
7
  * Description: Display Feeds in your blog. Use the function <code>RSSImport()</code>, a Widget or the Shortcode <code>[RSSImport]</code>.
8
  * Author: Frank Bültge, took77
9
+ * Version: 4.6.1
10
  * License: GPLv3+
11
+ * Last change: 2019-12-25
12
  */
13
 
14
+ /**
15
  ------------------------------------------------------------
16
  ACKNOWLEDGEMENTS
17
  ------------------------------------------------------------
19
  Thx to Thomas Fischer, http://www.securityfocus.de and
20
  Gunnar Tillmann http://www.gunnart.de for a rearrange code,
21
  Ilya Shindyapin, http://skookum.com for adding of paging
 
 
 
 
 
22
  */
23
 
24
  //avoid direct calls to this file, because now WP core and framework has been used
324
  if ( $use_simplepie && $displaydescriptions && $html ) {
325
  $desc = @html_entity_decode( $item->get_content(), ENT_QUOTES, get_option( 'blog_charset' ) );
326
  } // For import with HTML
327
+ elseif ( $use_simplepie && $displaydescriptions && ! $html ) {
328
  $desc = str_replace(
329
  [ "\n", "\r" ],
330
  ' ',
336
  )
337
  );
338
  } // For import without HTML
339
+ elseif ( $displaydescriptions
340
  && $html
341
  && isset( $item['content']['encoded'] )
342
  && $item['content']['encoded'] !== 'A' ) {
343
  $desc = $item['content']['encoded'];
344
  } // For import with HTML
345
+ elseif ( $displaydescriptions
346
  && $html
347
  && isset( $item['content']['atom_content'] )
348
  && $item['content']['atom_content'] !== 'A' ) {
349
  $desc = $item['content']['atom_content'];
350
  } // For import with HTML
351
+ elseif ( $displaydescriptions
352
  && $html
353
  && isset( $item['content'] )
354
  && ! is_array( $item['content'] ) ) {
1423
  return rtrim( implode( ' ', $arr ), ',;' );
1424
  }
1425
 
1426
+ /**
1427
+ * @param array $atts
1428
+ *
1429
+ * @return string
1430
+ */
1431
  function RSSImport_Shortcode( $atts ) {
1432
  $args = shortcode_atts(
1433
  [
1477
  $atts
1478
  );
1479
 
1480
+ $display = $args['display'];
1481
  $feedurl = html_entity_decode( $args['feedurl'] ); // novaclic: undo encoding due to wordpress WYSIWYG editor
1482
  if ( 'true' === strtolower( $args['html'] ) ) {
1483
  $args['html'] = 1;
1484
  }
1485
  $before_desc = $args['before_desc'];
1486
+ $html = $args['html'];
1487
  if ( 'true' === strtolower( $args['displaydescriptions'] ) ) {
1488
  $args['displaydescriptions'] = 1;
1489
  }
1490
  $after_desc = $args['after_desc'];
1491
+ $displaydescriptions = $args['displaydescriptions'];
1492
  if ( 'true' === strtolower( $args['truncatedescchar'] ) ) {
1493
  $args['truncatedescchar'] = 1;
1494
  }
1495
+ $truncatedescchar = $args['truncatedescchar'];
1496
  if ( 'true' === strtolower( $args['truncatetitlechar'] ) ) {
1497
  $args['truncatetitlechar'] = 1;
1498
  }
1499
  $truncatedescstring = $args['truncatedescstring'];
1500
  $truncatetitlestring = $args['truncatetitlestring'];
1501
+ $truncatetitlechar = $args['truncatetitlechar'];
1502
  $before_date = $args['before_date'];
1503
  if ( 'true' === strtolower( $args['date'] ) ) {
1504
  $args['date'] = 1;
1505
  }
1506
+ $date = $args['date'];
1507
  $after_date = $args['after_date'];
1508
  $date_format = $args['date_format'];
1509
  if ( 'true' === strtolower( $args['creator'] ) ) {
1510
  $args['creator'] = 1;
1511
  }
1512
  $before_creator = $args['before_creator'];
1513
+ $creator = $args['creator'];
1514
  $after_creator = $args['after_creator'];
1515
  $start_items = $args['start_items'];
1516
  $end_items = $args['end_items'];
1522
  if ( 'true' === strtolower( $args['charsetscan'] ) ) {
1523
  $args['charsetscan'] = 1;
1524
  }
1525
+ $charsetscan = $args['charsetscan'];
1526
  if ( 'true' === strtolower( $args['debug'] ) ) {
1527
  $args['debug'] = 1;
1528
  }
1529
+ $debug = $args['debug'];
1530
  $before_noitems = $args['before_noitems'];
1531
  $noitems = $args['noitems'];
1532
  $after_noitems = $args['after_noitems'];
1536
  if ( 'true' === strtolower( $args['paging'] ) ) {
1537
  $args['paging'] = 1;
1538
  }
1539
+ $paging = $args['paging'];
1540
  if ( 'true' === strtolower( $args['use_simplepie'] ) ) {
1541
  $args['use_simplepie'] = 1;
1542
  }
1544
  $next_paging_link = $args['next_paging_link'];
1545
  $prev_paging_title = $args['prev_paging_title'];
1546
  $next_paging_title = $args['next_paging_title'];
1547
+ $use_simplepie = $args['use_simplepie'];
1548
  $view = $args['view'];
1549
  $random_sort = $args['random_sort'];
1550
  $order = $args['order'];
1551
 
1552
+ return RSSImport(
1553
  $display,
1554
  $feedurl,
1555
  $before_desc,
1727
  /**
1728
  * code to utf-8 in PHP 4
1729
  *
1730
+ * @param string $num
1731
+ *
1732
+ * @return string
1733
  * @package WP-RSSImport
1734
  */
1735
  function RSSImport_code_to_utf8( $num ) {
1742
  }
1743
 
1744
  if ( $num <= 0xFFFF ) {
1745
+ return chr( ( $num >> 0x0C ) + 0xE0 ) .
1746
+ chr( ( ( $num >> 0x06 ) & 0x3F ) + 0x80 ) .
1747
+ chr( ( $num & 0x3F ) + 0x80 );
1748
  }
1749
 
1750
  if ( $num <= 0x1FFFFF ) {
1761
  /**
1762
  * html_entity_decode for PHP 4
1763
  *
1764
+ * @param string $str
1765
+ *
1766
+ * @return string|string[]|null
1767
  * @package WP-RSSImport
1768
  */
1769
  function RSSImport_html_entity_decode_php4( $str ) {
2030
 
2031
  // check class wp_widget exists
2032
  if ( class_exists( 'WP_Widget' ) ) {
2033
+ /**
2034
+ * Class RSSImport_Widget
2035
+ */
2036
  class RSSImport_Widget extends WP_Widget {
2037
 
2038
+ /**
2039
+ * RSSImport_Widget constructor.
2040
+ */
2041
  public function __construct() {
2042
  $widget_ops = [
2043
  'classname' => 'rssimport',
2046
  parent::__construct( 'rssimport', __( 'RSSImport' ), $widget_ops );
2047
  }
2048
 
2049
+ /**
2050
+ * @param array $args
2051
+ * @param array $instance
2052
+ */
2053
  public function widget( $args, $instance ) {
2054
  $title = empty( $instance['title'] )
2055
  ? '&nbsp;'
2227
  echo $args['after_widget'];
2228
  }
2229
 
2230
+ /**
2231
+ * @param array $new_instance
2232
+ * @param array $old_instance
2233
+ *
2234
+ * @return array|string
2235
+ */
2236
  public function update( $new_instance, $old_instance ) {
2237
  $instance['instance'] = $old_instance;
2238
  $instance['title'] = strip_tags( $new_instance['title'] );
2286
  return stripslashes( strip_tags( $instance ) );
2287
  }
2288
 
2289
+ /**
2290
+ * @param array $instance
2291
+ *
2292
+ * @return string|void
2293
+ */
2294
  public function form( $instance ) {
2295
  $instance = wp_parse_args(
2296
  (array) $instance,