RSSImport - Version 4.6.0

Version Description

Download this release

Release Info

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

Code changes from version 4.5.1 to 4.6.0

Files changed (2) hide show
  1. readme.txt +25 -31
  2. rssimport.php +1260 -927
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
  === RSSImport ===
2
- Contributors: Bueltge, inpsyde, took77
3
  Plugin URI: https://bueltge.de/wp-rss-import-plugin/55/
4
  Author: Frank Bültge
5
  Author URI: https://bueltge.de/
6
  Donate link: https://bueltge.de/wunschliste/
7
  Tags: rss, post, content, post, feed
8
  Requires at least: 1.5
9
- Tested up to: 4.9
10
- Stable tag: 4.5.1
11
 
12
  Display feeds on your blog, using PHP in your templates or Shortcode in your posts and pages.
13
 
14
  == Description ==
15
- Display feeds in your blog, using PHP, a Widget or Shortcode. The plugin uses only standard WordPress functionality, so no external libraries are required. For older versions of Wordpress, the built-in [MagpieRSS library](http://magpierss.sourceforge.net/) is used. For WordPress 2.8 and newer, there is a setting available to enable the built-in [SimplePie library](http://simplepie.org/) for parsing feeds.
16
 
17
  As with all other content you publish, make sure you are allowed to (re-)publish the content of the feeds you are about to import!
18
 
@@ -20,18 +20,18 @@ You can insert the following code into a PHP plugin or in a template, for exampl
20
 
21
 
22
  _Example:_
23
- `<?php RSSImport(10, 'http://bueltge.de/feed/'); ?>`
24
 
25
  This is the minimal code needed for using the plugin. The plugin accepts a number of parameters for customizing the feed content import. See below for the full list of available parameters. You can also use any of the parameters with Shortcode in posts and pages.
26
 
27
  _Example Shortcode:_
28
- `[RSSImport display="5" feedurl="http://bueltge.de/feed/" use_simplepie="true"]`
29
 
30
  For all (bool) parameters you can either use the strings `true` and `false` or the integer values `1` and `0`.
31
 
32
 
33
  1. `display` - The number of items to display. Default is `5`.
34
- 1. `feedurl` - The feed address. Default is `http://bueltge.de/feed/`.
35
  1. `before_desc` - The HTML or string to insert before the description. Default is `empty`. You can use some variables which will be replaced, see below.
36
  1. `displaydescriptions` - (bool) When set to true, the description for each entry will be displayed. Default is `false`.
37
  1. `after_desc` - The HTML or string to insert after the description. Default is `empty`. You can use some variables which will be replaced, see below.
@@ -43,7 +43,7 @@ For all (bool) parameters you can either use the strings `true` and `false` or t
43
  1. `before_date` - The HTML or string to insert before the date. Default is ` <small>`.
44
  1. `date` - (bool) If true, display the date of the item. Default is `false`.
45
  1. `after_date` - The HTML or string to insert after the date. Default is `</small>`.
46
- 1. `date_format`- The date format string. Leave empty to use the format of your WordPress installation. If a different date format is desired, specify a PHP date string, for example: `F j, Y`. See also [the date and time formatting page in the WordPress Codex](http://codex.wordpress.org/Formatting_Date_and_Time).
47
  1. `before_creator` - The HTML or string to insert before the creator of the item. Default is ` <small>`.
48
  1. `creator` - (bool) If true, display the creator of the item. Default is `false`.
49
  1. `after_creator` - The HTML or string to insert after creator of the item. Default is `</small>`.
@@ -70,6 +70,7 @@ For all (bool) parameters you can either use the strings `true` and `false` or t
70
  1. `use_simplepie` - (bool) If true, use SimplePie to parse the feed. SimplePie is included in WordPress 2.8 and newer and can parse both RSS and ATOM feeds. Default is `false` if used with Shortcode, `true` if used with the PHP function.
71
  1. `view` - (bool) If true, calling the `RSSImport()` function will print the rendered HTML directly to the output. If false, the rendered HTML will be returned by the function as a string value and nothing will be output. Default when using PHP code is `true`. Default when using Shortcode is `false`.
72
  1. `random_sort` - (bool) If true, Items will be displayed in random order. Default when using Shortcode is `false`.
 
73
 
74
  The parameters `before_desc`, `after_desc`, `start_item` and `end_item` accepts the following variables which will be replaced:
75
 
@@ -87,7 +88,7 @@ You can use any of the parameters in the php function `RSSImport()` in your temp
87
  _Using the PHP function with many parameters:_
88
 
89
  RSSImport(
90
- $display = 5, $feedurl = 'http://bueltge.de/feed/',
91
  $before_desc = '', $displaydescriptions = false, $after_desc = '', $html = false, $truncatedescchar = 200, $truncatedescstring = ' ... ',
92
  $truncatetitlechar = '', $truncatetitlestring = ' ... ',
93
  $before_date = ' <small>', $date = false, $after_date = '</small>',
@@ -100,7 +101,7 @@ Please note that for the PHP function the parameters are expected in the order i
100
 
101
  _Using Shortcode with several parameters:_
102
 
103
- [RSSImport display="10" feedurl="http://your_feed_url/"
104
  displaydescriptions="true" html="true"
105
  start_items="<ol>" end_items="</ol>" paging="true" use_simplepie="true"]
106
 
@@ -108,7 +109,7 @@ _Add a "more" link to the output:_
108
 
109
  RSSImport(
110
  $display = 5,
111
- $feedurl = 'http://bueltge.de/feed/',
112
  $before_desc = '',
113
  $displaydescriptions = true,
114
  $after_desc = ' <a href="%href%" target="_blank">show more</a>'
@@ -116,20 +117,20 @@ _Add a "more" link to the output:_
116
 
117
  or
118
 
119
- [RSSImport feedurl="http://www.ichdruck3d.de/feed/" after_desc=" <a href='%href%' target='_blank'>show more</a>" displaydescriptions="true" use_simplepie="true"]
120
 
121
  _Enable Thumbnail Pictures:_
122
 
123
  RSSImport(
124
  $display = 5,
125
- $feedurl = 'http://www.thestage.co.uk/opinion/shenton/feed/',
126
  $before_desc = '<img src="%picture_url%" alt="">',
127
  $displaydescriptions = true
128
  );
129
 
130
  or
131
 
132
- [RSSImport feedurl="http://www.thestage.co.uk/opinion/shenton/feed/" displaydescriptions="true" before_desc="<div><img src='%picture_url%' width='50px' alt='' style='float:left;' />" after_desc="</div>" use_simplepie="true"]
133
 
134
  == Installation ==
135
  1. Unpack the download package.
@@ -143,6 +144,11 @@ or
143
  1. Widget support
144
 
145
  == Changelog ==
 
 
 
 
 
146
  = v4.5.1 (2017-12-14) =
147
  * Fix escaping in widget admin form
148
 
@@ -176,8 +182,8 @@ or
176
  = v4.4.12 (04/02/2012) =
177
  * Bugfix: restored RSSImport QuickTag for Wordpress 3.3 and later
178
  * Improvement: avoid PHP-notice when description is missing for an item
179
- * TODO: add parameter to allow prefix of url (see http://wordpress.org/support/topic/plugin-rssimport-fix-for-headline-links-without-full-paths)
180
- * TODO: check documentation of call to function (PHP), see http://wordpress.org/support/topic/plugin-rssimport-change-feed-display
181
  * Documentation: corrected 'after_desc' (thanks to elricky for reporting)
182
 
183
  = v4.4.11 (13/12/2011) =
@@ -231,27 +237,15 @@ or
231
  * add rel attribut for links
232
  * add widget support, WP 2.8 and higher
233
 
234
- See on [the official website](http://bueltge.de/wp-rss-import-plugin/55/#historie "RSSImport Changelog") for older entries on changelog.
235
 
236
 
237
  == Other Notes ==
238
  = Acknowledgements =
239
  Thanks to [Dave Wolf](http://www.davewolf.net, "Dave Wolf") for the idea, to [Thomas Fischer](http://www.securityfocus.de "Thomas Fischer") and [Gunnar Tillmann](http://www.gunnart.de "Gunnar Tillmann") for better code and Ilya Shindyapin, http://skookum.com for the idea and solution of pagination.
240
 
241
- = Localizations =
242
- * German language files by me [Frank B&uuml;ltge](http://bueltge.de/) ;-)
243
- * Russian translation by Fat Cow
244
- * Ukrainian translation by [WordPress Ukraine](http://wpp.pp.ua/)
245
- * French translation by [Martin Korolczuk](http://petitnuage.fr)
246
- * Hungarian translation by [Feriman](http://feriman.com)
247
- * Hindi translation by [Ashish Jha](http://outshinesolutions.com)
248
- * Italian translation by [Gianni Diurno](http://gidibao.net/)
249
- * Romanian language files, thanks to [Alexander Ovsov](http://webhostinggeeks.com/)
250
- * Lithuanian translation files by [Vincent G](http://www.host1plus.com)
251
- * Portuguese translation files by [Miguel Patricio Angelo](http://www.miguelpatricio.com/)
252
-
253
  = License =
254
- Good news, this plugin is free for everyone! Since it's released under the GPL, you can use it free of charge on your personal or commercial blog. But if you enjoy this plugin, you can thank me by leaving a [small donation](http://bueltge.de/wunschliste/ "Wish lists and donations") for the time I've spent writing and supporting this plugin. And I really don't want to know how many hours of my life this plugin has already eaten ;)
255
 
256
  = Translations =
257
- The plugin comes with various translations, please refer to the [WordPress Codex](http://codex.wordpress.org/Installing_WordPress_in_Your_Language "Installing WordPress in Your Language") for more information about activating the translation. If you want to help to translate the plugin to your language, please have a look at the sitemap.pot file which contains all defintions and may be used with a [gettext](http://www.gnu.org/software/gettext/) editor like [Poedit](http://www.poedit.net/) (Windows).
1
  === RSSImport ===
2
+ Contributors: Bueltge, took77
3
  Plugin URI: https://bueltge.de/wp-rss-import-plugin/55/
4
  Author: Frank Bültge
5
  Author URI: https://bueltge.de/
6
  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
 
14
  == Description ==
15
+ Display feeds in your blog, using PHP, a Widget or Shortcode. The plugin uses only standard WordPress functionality, so no external libraries are required. For older versions of Wordpress, the built-in [MagpieRSS library](https://magpierss.sourceforge.net/) is used. For WordPress 2.8 and newer, there is a setting available to enable the built-in [SimplePie library](https://simplepie.org/) for parsing feeds.
16
 
17
  As with all other content you publish, make sure you are allowed to (re-)publish the content of the feeds you are about to import!
18
 
20
 
21
 
22
  _Example:_
23
+ `&lt;?php RSSImport(10, 'https://bueltge.de/feed/'); ?&gt;`
24
 
25
  This is the minimal code needed for using the plugin. The plugin accepts a number of parameters for customizing the feed content import. See below for the full list of available parameters. You can also use any of the parameters with Shortcode in posts and pages.
26
 
27
  _Example Shortcode:_
28
+ `[RSSImport display="5" feedurl="https://bueltge.de/feed/" use_simplepie="true"]`
29
 
30
  For all (bool) parameters you can either use the strings `true` and `false` or the integer values `1` and `0`.
31
 
32
 
33
  1. `display` - The number of items to display. Default is `5`.
34
+ 1. `feedurl` - The feed address. Default is `https://bueltge.de/feed/`.
35
  1. `before_desc` - The HTML or string to insert before the description. Default is `empty`. You can use some variables which will be replaced, see below.
36
  1. `displaydescriptions` - (bool) When set to true, the description for each entry will be displayed. Default is `false`.
37
  1. `after_desc` - The HTML or string to insert after the description. Default is `empty`. You can use some variables which will be replaced, see below.
43
  1. `before_date` - The HTML or string to insert before the date. Default is ` <small>`.
44
  1. `date` - (bool) If true, display the date of the item. Default is `false`.
45
  1. `after_date` - The HTML or string to insert after the date. Default is `</small>`.
46
+ 1. `date_format`- The date format string. Leave empty to use the format of your WordPress installation. If a different date format is desired, specify a PHP date string, for example: `F j, Y`. See also [the date and time formatting page in the WordPress Codex](https://codex.wordpress.org/Formatting_Date_and_Time).
47
  1. `before_creator` - The HTML or string to insert before the creator of the item. Default is ` <small>`.
48
  1. `creator` - (bool) If true, display the creator of the item. Default is `false`.
49
  1. `after_creator` - The HTML or string to insert after creator of the item. Default is `</small>`.
70
  1. `use_simplepie` - (bool) If true, use SimplePie to parse the feed. SimplePie is included in WordPress 2.8 and newer and can parse both RSS and ATOM feeds. Default is `false` if used with Shortcode, `true` if used with the PHP function.
71
  1. `view` - (bool) If true, calling the `RSSImport()` function will print the rendered HTML directly to the output. If false, the rendered HTML will be returned by the function as a string value and nothing will be output. Default when using PHP code is `true`. Default when using Shortcode is `false`.
72
  1. `random_sort` - (bool) If true, Items will be displayed in random order. Default when using Shortcode is `false`.
73
+ 1. `order` - (string) Order of the filds Date, Title, Creator, Description. Use a comma separated string for your order. Default is `date,title,creator,description`
74
 
75
  The parameters `before_desc`, `after_desc`, `start_item` and `end_item` accepts the following variables which will be replaced:
76
 
88
  _Using the PHP function with many parameters:_
89
 
90
  RSSImport(
91
+ $display = 5, $feedurl = 'https://bueltge.de/feed/',
92
  $before_desc = '', $displaydescriptions = false, $after_desc = '', $html = false, $truncatedescchar = 200, $truncatedescstring = ' ... ',
93
  $truncatetitlechar = '', $truncatetitlestring = ' ... ',
94
  $before_date = ' <small>', $date = false, $after_date = '</small>',
101
 
102
  _Using Shortcode with several parameters:_
103
 
104
+ [RSSImport display="10" feedurl="https://your_feed_url/"
105
  displaydescriptions="true" html="true"
106
  start_items="<ol>" end_items="</ol>" paging="true" use_simplepie="true"]
107
 
109
 
110
  RSSImport(
111
  $display = 5,
112
+ $feedurl = 'https://bueltge.de/feed/',
113
  $before_desc = '',
114
  $displaydescriptions = true,
115
  $after_desc = ' <a href="%href%" target="_blank">show more</a>'
117
 
118
  or
119
 
120
+ [RSSImport feedurl="https://wordpress.org/news/feed/" after_desc=" <a href='%href%' target='_blank'>show more</a>" displaydescriptions="true" use_simplepie="true"]
121
 
122
  _Enable Thumbnail Pictures:_
123
 
124
  RSSImport(
125
  $display = 5,
126
+ $feedurl = 'https://bueltge.de/feed/',
127
  $before_desc = '<img src="%picture_url%" alt="">',
128
  $displaydescriptions = true
129
  );
130
 
131
  or
132
 
133
+ [RSSImport feedurl="https://wordpress.org/news/feed/" displaydescriptions="true" before_desc="<div><img src='%picture_url%' width='50px' alt='' style='float:left;' />" after_desc="</div>" use_simplepie="true"]
134
 
135
  == Installation ==
136
  1. Unpack the download package.
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.
150
+ * Ready for usage in PHP 7.2*, replace `create_function`
151
+
152
  = v4.5.1 (2017-12-14) =
153
  * Fix escaping in widget admin form
154
 
182
  = v4.4.12 (04/02/2012) =
183
  * Bugfix: restored RSSImport QuickTag for Wordpress 3.3 and later
184
  * Improvement: avoid PHP-notice when description is missing for an item
185
+ * TODO: add parameter to allow prefix of url (see https://wordpress.org/support/topic/plugin-rssimport-fix-for-headline-links-without-full-paths)
186
+ * TODO: check documentation of call to function (PHP), see https://wordpress.org/support/topic/plugin-rssimport-change-feed-display
187
  * Documentation: corrected 'after_desc' (thanks to elricky for reporting)
188
 
189
  = v4.4.11 (13/12/2011) =
237
  * add rel attribut for links
238
  * add widget support, WP 2.8 and higher
239
 
240
+ See on [the official website](https://bueltge.de/wp-rss-import-plugin/55/#historie "RSSImport Changelog") for older entries on changelog.
241
 
242
 
243
  == Other Notes ==
244
  = Acknowledgements =
245
  Thanks to [Dave Wolf](http://www.davewolf.net, "Dave Wolf") for the idea, to [Thomas Fischer](http://www.securityfocus.de "Thomas Fischer") and [Gunnar Tillmann](http://www.gunnart.de "Gunnar Tillmann") for better code and Ilya Shindyapin, http://skookum.com for the idea and solution of pagination.
246
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  = License =
248
+ Good news, this plugin is free for everyone! Since it's released under the GPL, you can use it free of charge on your personal or commercial blog. But if you enjoy this plugin, you can thank me by leaving a [small donation](https://bueltge.de/wunschliste/ "Wish lists and donations") for the time I've spent writing and supporting this plugin. And I really don't want to know how many hours of my life this plugin has already eaten ;)
249
 
250
  = Translations =
251
+ The plugin comes with various translations, please refer to the [WordPress Codex](https://codex.wordpress.org/Installing_WordPress_in_Your_Language "Installing WordPress in Your Language") for more information about activating the translation. Please helpt [to translate or improve](https://translate.wordpress.org/projects/wp-plugins/rss-import/) the translations of this plugin.
rssimport.php CHANGED
@@ -6,9 +6,9 @@
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.5.0
10
  * License: GPLv3+
11
- * Last change: 2017-11-29
12
  */
13
 
14
  /*
@@ -17,12 +17,12 @@
17
  ------------------------------------------------------------
18
  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 better code
21
- Paging: Ilya Shindyapin, http://skookum.com
22
 
23
  ------------------------------------------------------------
24
  USAGE: Use following code with a PHP-Plugin for WordPress:
25
- Example: <?php RSSImport(10, "http://bueltge.de/feed/"); ?>
26
  ------------------------------------------------------------
27
  */
28
 
@@ -56,13 +56,12 @@ if ( function_exists( 'add_action' ) ) {
56
 
57
  // plugin definitions
58
  define( 'FB_RSSI_BASENAME', plugin_basename( __FILE__ ) );
59
- define( 'FB_RSSI_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
60
  define( 'FB_RSSI_TEXTDOMAIN', 'rssimport' );
61
  define( 'FB_RSSI_QUICKTAG', true );
62
  }
63
 
64
  function RSSImport_textdomain() {
65
-
66
  if ( function_exists( 'load_plugin_textdomain' ) ) {
67
  load_plugin_textdomain( FB_RSSI_TEXTDOMAIN, false, dirname( FB_RSSI_BASENAME ) . '/languages' );
68
  }
@@ -75,52 +74,53 @@ if ( ! defined( 'MAGPIE_CACHE_AGE' ) ) {
75
  }
76
 
77
  /**
78
- * @param int $display
79
- * @param string $feedurl
80
- * @param string $before_desc
81
- * @param int $displaydescriptions
82
- * @param string $after_desc
83
- * @param int $html
84
- * @param int $truncatedescchar
85
- * @param string $truncatedescstring
86
- * @param int $truncatetitlechar
87
- * @param string $truncatetitlestring
88
- * @param string $before_date
89
- * @param int $date
90
- * @param string $after_date
91
- * @param string $date_format
92
- * @param string $before_creator
93
  * @param int|string $creator
94
- * @param string $after_creator
95
- * @param string $start_items
96
- * @param string $end_items
97
- * @param string $start_item
98
- * @param string $end_item
99
- * @param string $target
100
- * @param string $rel
101
- * @param int $desc4title
102
- * @param int $charsetscan
103
- * @param int $debug
104
- * @param string $before_noitems
105
- * @param string $noitems
106
- * @param string $after_noitems
107
- * @param string $before_error
108
- * @param string $error
109
- * @param string $after_error
110
- * @param int $paging
111
- * @param string $prev_paging_link
112
- * @param string $next_paging_link
113
- * @param string $prev_paging_title
114
- * @param string $next_paging_title
115
- * @param int $use_simplepie
116
- * @param int $view
117
- * @param int $random_sort
 
118
  *
119
  * @return string
120
  */
121
  function RSSImport(
122
  $display = 5,
123
- $feedurl = 'http://bueltge.de/feed/',
124
  $before_desc = '',
125
  $displaydescriptions = 0,
126
  $after_desc = '',
@@ -149,7 +149,7 @@ function RSSImport(
149
  $noitems = 'No items, feed is empty.',
150
  $after_noitems = '</p>',
151
  $before_error = '<p>',
152
- $error = 'Error: Feed has an error or is not valid',
153
  $after_error = '</p>',
154
  $paging = 0,
155
  $prev_paging_link = '&laquo; Previous',
@@ -158,9 +158,9 @@ function RSSImport(
158
  $next_paging_title = 'more items',
159
  $use_simplepie = 1,
160
  $view = 1,
161
- $random_sort = 0
 
162
  ) {
163
-
164
  // replace for yahoo pipes urls
165
  $feedurl = str_replace( '&#038;', '&', $feedurl );
166
 
@@ -186,26 +186,28 @@ function RSSImport(
186
  if ( file_exists( ABSPATH . WPINC . '/class-simplepie.php' ) ) {
187
  @require ABSPATH . WPINC . '/class-simplepie.php';
188
  } else {
189
- wp_die( __( 'Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The WordPress file "class-simplepie.php" with class SimplePie could not be included.' ) );
 
 
 
 
190
  }
191
  }
 
 
 
 
 
 
192
  } else {
193
- // For function fetch_rss from wp-core
194
- if ( file_exists( ABSPATH . WPINC . '/rss.php' ) ) {
195
- require_once ABSPATH . WPINC . '/rss.php';
196
- // It's WordPress 2.x. since it has been loaded successfully
197
- } elseif ( file_exists( ABSPATH . WPINC . '/rss-functions.php' ) ) {
198
- require_once ABSPATH . WPINC . '/rss-functions.php';
199
- // In WordPress < 2.1
200
- } else {
201
- wp_die( __( 'Error in file: ' . __FILE__ . ' on line: ' . __LINE__
202
- . '.<br>The WordPress file "rss-functions.php" or "rss.php" could not be included.' ) );
203
- }
204
  }
205
 
206
  $display = (int) $display;
207
- $page = ( ( ! empty( $_GET[ 'rsspage' ] ) && (int) $_GET[ 'rsspage' ] > 0 )
208
- ? (int) $_GET[ 'rsspage' ] : 1 );
 
209
  $truncatedescchar = (int) $truncatedescchar;
210
  $truncatetitlechar = (int) $truncatetitlechar;
211
  $echo = '<!--via MagpieRSS with RSSImport-->';
@@ -228,7 +230,6 @@ function RSSImport(
228
  }
229
 
230
  if ( $rss && ! is_wp_error( $rss ) ) {
231
-
232
  // the follow print_r list all items in array, for debug purpose
233
  if ( $debug ) {
234
  print '<pre>';
@@ -253,15 +254,9 @@ function RSSImport(
253
  $displayitems = $display;
254
  $displaylimit = ( $page * $display );
255
  $display = ( ( $page - 1 ) * $display );
256
- $nextitems = true;
257
- $previousitems = false;
258
- if ( $page > 1 ) {
259
- $previousitems = true;
260
- }
261
 
262
- $picked = array();
263
-
264
- if ( $use_simplepie && ( 1 === $paging || $random_sort) ) {
265
  /** @var SimplePie $rss */
266
  $items = $rss->get_items();
267
  } elseif ( $use_simplepie ) {
@@ -271,20 +266,18 @@ function RSSImport(
271
  /** @var MagpieRSS $rss */
272
  $items = $rss->items;
273
  }
274
- $cnt_items = count($items);
275
 
276
  while ( $display < $displaylimit ) {
277
-
278
  $i = $display;
279
- if ($random_sort) {
280
- do {
281
- $i = rand(0, $cnt_items-1);
282
- } while (in_array($i, $picked) && count($picked) < $cnt_items);
283
  $picked[] = $i;
284
- }
285
 
286
  if ( array_key_exists( $i, $items ) ) {
287
-
288
  if ( $use_simplepie ) {
289
  /** @var SimplePie $rss */
290
  $item = $rss->get_item( $i );
@@ -296,15 +289,15 @@ function RSSImport(
296
  $title = '';
297
  if ( $use_simplepie ) {
298
  $title = esc_attr( strip_tags( $item->get_title() ) );
299
- } elseif ( isset( $item[ 'title' ] ) ) {
300
- $title = esc_attr( strip_tags( $item[ 'title' ] ) );
301
  }
302
  // import link
303
  $href = '';
304
  if ( $use_simplepie ) {
305
  $href = wp_filter_kses( $item->get_link() );
306
- } elseif ( isset( $item[ 'link' ] ) ) {
307
- $href = wp_filter_kses( $item[ 'link' ] );
308
  }
309
  // import picture_url
310
  $picture_url = '';
@@ -312,37 +305,34 @@ function RSSImport(
312
  $picture_url = wp_filter_kses( $enclosure->get_thumbnail() );
313
  }
314
 
315
- $start_item_temp = str_replace( '%title%', $title, $start_item );
316
- $start_item_temp = str_replace( '%href%', $href, $start_item_temp );
317
- $start_item_temp = str_replace( '%picture_url%', $picture_url, $start_item_temp );
318
  $echo .= $start_item_temp;
319
 
320
  // import date
321
  if ( $use_simplepie && $date ) {
322
  $pubDate = date_i18n( $date_format, strtotime( $item->get_date() ) );
323
- } elseif ( $date && isset( $item[ 'pubdate' ] ) ) {
324
- $pubDate = date_i18n( $date_format, strtotime( $item[ 'pubdate' ] ) );
325
  }
326
  // import creator
327
  if ( $use_simplepie && $creator ) {
328
  /** @var SimplePie $item */
329
- $creator = $item->get_author();
330
- if ( is_object( $creator ) ) {
331
- $creator = $creator->get_name();
332
- $creator = ' <cite>' . esc_html( strip_tags( $creator ) ) . '</cite>';
333
- }
334
- } elseif ( $creator && isset( $item[ 'dc' ][ 'creator' ] ) ) {
335
- $creator = esc_html( $item[ 'dc' ][ 'creator' ] );
336
- } elseif ( $creator && isset( $item[ 'creator' ] ) ) {
337
- $creator = esc_html( $item[ 'creator' ] );
338
  }
339
  // import desc
340
  if ( $use_simplepie && $displaydescriptions && $html ) {
341
  $desc = @html_entity_decode( $item->get_content(), ENT_QUOTES, get_option( 'blog_charset' ) );
342
  } // For import with HTML
343
- elseif ( $use_simplepie && $displaydescriptions && ! $html ) {
344
  $desc = str_replace(
345
- array( "\n", "\r" ), ' ',
 
346
  esc_attr( strip_tags(
347
  @html_entity_decode(
348
  $item->get_description(),
@@ -351,18 +341,27 @@ function RSSImport(
351
  )
352
  );
353
  } // For import without HTML
354
- elseif ( $displaydescriptions && $html && isset( $item[ 'content' ][ 'encoded' ] ) && $item[ 'content' ][ 'encoded' ] !== 'A' ) {
355
- $desc = $item[ 'content' ][ 'encoded' ];
 
 
 
356
  } // For import with HTML
357
- elseif ( $displaydescriptions && $html && isset( $item[ 'content' ][ 'atom_content' ] ) && $item[ 'content' ][ 'atom_content' ] !== 'A' ) {
358
- $desc = $item[ 'content' ][ 'atom_content' ];
 
 
 
359
  } // For import with HTML
360
- elseif ( $displaydescriptions && $html && isset( $item[ 'content' ] ) && ! is_array( $item[ 'content' ] ) ) {
361
- $desc = $item[ 'content' ];
362
- } elseif ( $displaydescriptions && $html && isset( $item[ 'description' ] ) ) {
363
- $desc = $item[ 'description' ];
364
- } elseif ( $displaydescriptions && ! $html && isset( $item[ 'description' ] ) ) {
365
- $desc = esc_html( strip_tags( $item[ 'description' ] ) );
 
 
 
366
  } // For import without HTML
367
 
368
  if ( isset( $a ) && false !== stripos( $a, 'ISO' ) ) {
@@ -415,7 +414,7 @@ function RSSImport(
415
  $desc = '';
416
  if ( $use_simplepie ) {
417
  $desc = str_replace(
418
- array( "\n", "\r" ),
419
  ' ',
420
  esc_attr( strip_tags(
421
  @html_entity_decode(
@@ -427,38 +426,59 @@ function RSSImport(
427
  )
428
  );
429
  } // For import without HTML
430
- else if ( isset( $item[ 'description' ] ) ) {
431
- $desc = esc_html( strip_tags( $item[ 'description' ] ) );
432
  }
433
  $atitle = wp_html_excerpt( $desc, $truncatedescchar ) . $truncatedescstring;
434
  } else {
435
  $atitle = $title;
436
  }
437
 
438
- $echo .= '<a' . $target . $rel . ' href="' . $href . '" title="' . $atitle . '">' . $title . '</a>';
439
-
440
- if ( isset( $pubDate ) && $date && '' !== $pubDate ) {
441
- $echo .= $before_date . $pubDate . $after_date;
442
- }
443
- if ( isset( $creator ) && $creator && '' !== $creator ) {
444
- $echo .= $before_creator . $creator . $after_creator;
445
- }
446
- if ( isset( $desc ) && $displaydescriptions && '' !== $desc ) {
447
- $after_desc_temp = stripslashes_deep( $after_desc );
448
- $after_desc_temp = str_replace( '%title%', $title, $after_desc_temp );
449
- $after_desc_temp = str_replace( '%href%', $href, $after_desc_temp );
450
- $after_desc_temp = str_replace( '%picture_url%', $picture_url, $after_desc_temp );
451
- $before_desc_temp = str_replace( '%title%', $title, $before_desc );
452
- $before_desc_temp = str_replace( '%href%', $href, $before_desc_temp );
453
- $before_desc_temp = str_replace( '%picture_url%', $picture_url, $before_desc_temp );
454
- $echo .= $before_desc_temp . $desc . $after_desc_temp;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  }
456
- $end_item_temp = str_replace( '%title%', $title, $end_item );
457
- $end_item_temp = str_replace( '%href%', $href, $end_item_temp );
458
- $end_item_temp = str_replace( '%picture_url%', $picture_url, $end_item_temp );
 
459
  $echo .= $end_item_temp;
460
- } else {
461
- $nextitems = false;
462
  }
463
 
464
  $display ++;
@@ -469,24 +489,40 @@ function RSSImport(
469
  } else {
470
  $echo = wptexturize( $before_noitems . $noitems . $after_noitems );
471
  }
472
-
473
  } else {
474
  /** @noinspection MissingIssetImplementationInspection */
475
  if ( empty( $rss->ERROR ) ) {
476
- $rss->ERROR = NULL;
477
  }
478
  $echo = wptexturize( $before_error . $error . $rss->ERROR . $after_error );
479
  }
480
 
481
  if ( $paging ) {
 
 
 
 
 
482
  $echo .= '<div class="rsspaging">';
483
  if ( $previousitems ) {
484
- $echo .= '<a href="' . add_query_arg( 'rsspage',
485
- ( $page - 1 ) ) . '" class="rsspaging_prev" title="' . $prev_paging_title . '">' . $prev_paging_link . '</a>';
 
 
 
 
 
 
486
  }
487
  if ( $nextitems ) {
488
- $echo .= '<a href="' . add_query_arg( 'rsspage',
489
- ( $page + 1 ) ) . '" class="rsspaging_next" title="' . $next_paging_title . '">' . $next_paging_link . '</a>';
 
 
 
 
 
 
490
  }
491
  $echo .= '<br style="clear: both" />';
492
  $echo .= '</div>';
@@ -494,13 +530,16 @@ function RSSImport(
494
 
495
  if ( $view ) {
496
  echo $echo;
497
- } else {
498
- return $echo;
499
  }
 
500
  }
501
 
 
 
 
 
 
502
  function utf8dec( $s_String ) {
503
-
504
  if ( PHP_VERSION_ID >= 50000 ) {
505
  $s_String = html_entity_decode(
506
  htmlentities( $s_String . ' ', ENT_COMPAT, 'UTF-8' )
@@ -512,8 +551,12 @@ function utf8dec( $s_String ) {
512
  return substr( $s_String, 0, - 1 );
513
  }
514
 
 
 
 
 
 
515
  function isodec( $s_String ) {
516
-
517
  if ( PHP_VERSION_ID >= 50000 ) {
518
  $s_String = html_entity_decode( htmlentities( $s_String . ' ', ENT_COMPAT, 'ISO-8859-1' ) );
519
  } else {
@@ -523,10 +566,14 @@ function isodec( $s_String ) {
523
  return substr( $s_String, 0, - 1 );
524
  }
525
 
 
 
 
 
 
526
  function all_convert( $s_String ) {
527
-
528
  // Array for entities
529
- $umlaute = array(
530
  '„',
531
  '“',
532
  '–',
@@ -910,10 +957,10 @@ function all_convert( $s_String ) {
910
  chr( 253 ),
911
  chr( 254 ),
912
  chr( 255 ),
913
- chr( 256 )
914
- );
915
 
916
- $htmlcode = array(
917
  '&bdquo;',
918
  '&ldquo;',
919
  '&ndash;',
@@ -1296,11 +1343,10 @@ function all_convert( $s_String ) {
1296
  '&uuml;',
1297
  '&yacute;',
1298
  '&thorn;',
1299
- '&yuml;'
1300
- );
1301
 
1302
- //$s_String = str_replace($umlaute, $htmlcode, $s_String);
1303
- if ( version_compare( phpversion(), '5.0.0', '>=' ) ) {
1304
  $s_String = utf8_encode( html_entity_decode( str_replace( $umlaute, $htmlcode, $s_String ) ) );
1305
  } else {
1306
  $s_String = utf8_encode( RSSImport_html_entity_decode_php4( str_replace( $umlaute, $htmlcode, $s_String ) ) );
@@ -1313,19 +1359,22 @@ function all_convert( $s_String ) {
1313
 
1314
  // &mdash; , &#8212;
1315
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9D~', '&mdash;', $s_String );
1316
- $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '&mdash;',
 
1317
  $s_String );
1318
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x80\x9D~', '&mdash;', $s_String );
1319
 
1320
  // &ndash; , &#8211;
1321
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9C~', '&ndash;', $s_String );
1322
- $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ndash;',
 
1323
  $s_String );
1324
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x80\x9C~', '&ndash;', $s_String );
1325
 
1326
  // &rsquo; , &#8217;
1327
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2~', '&rsquo;', $s_String );
1328
- $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '&rsquo;',
 
1329
  $s_String );
1330
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x84\xA2~', '&rsquo;', $s_String );
1331
  $s_String = preg_replace( '~\xD0\xBF\xD1\x97\xD0\x85~', '&rsquo;', $s_String );
@@ -1341,7 +1390,8 @@ function all_convert( $s_String ) {
1341
 
1342
  // &ldquo; , &#8220;
1343
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ldquo;', $s_String );
1344
- $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x85\xE2\x80\x9C~', '&ldquo;',
 
1345
  $s_String );
1346
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xD1\x9A~', '&ldquo;', $s_String );
1347
 
@@ -1372,7 +1422,6 @@ function all_convert( $s_String ) {
1372
  * @return string
1373
  */
1374
  function RSSImport_end_on_word( $str ) {
1375
-
1376
  $arr = explode( ' ', trim( $str ) );
1377
  array_pop( $arr );
1378
 
@@ -1380,11 +1429,10 @@ function RSSImport_end_on_word( $str ) {
1380
  }
1381
 
1382
  function RSSImport_Shortcode( $atts ) {
1383
-
1384
  $args = shortcode_atts(
1385
- array(
1386
  'display' => 5,
1387
- 'feedurl' => 'http://bueltge.de/feed/',
1388
  'before_desc' => '<br />',
1389
  'displaydescriptions' => 0,
1390
  'after_desc' => '',
@@ -1413,7 +1461,7 @@ function RSSImport_Shortcode( $atts ) {
1413
  'noitems' => __( 'No items, feed is empty.', FB_RSSI_TEXTDOMAIN ),
1414
  'after_noitems' => '</p>',
1415
  'before_error' => '<p>',
1416
- 'error' => __( 'Error: Feed has an error or is not valid',
1417
  FB_RSSI_TEXTDOMAIN ),
1418
  'after_error' => '</p>',
1419
  'paging' => 0,
@@ -1424,114 +1472,141 @@ function RSSImport_Shortcode( $atts ) {
1424
  'use_simplepie' => 1,
1425
  'view' => 0,
1426
  'random_sort' => 0,
1427
- ),
 
1428
  $atts
1429
  );
1430
 
1431
- $display = (int) $args[ 'display' ];
1432
- $feedurl = html_entity_decode( $args[ 'feedurl' ] ); // novaclic: undo encoding due to wordpress WYSIWYG editor
1433
- if ( 'true' === strtolower( $args[ 'html' ] ) ) {
1434
- $args[ 'html' ] = 1;
1435
  }
1436
- $before_desc = $args[ 'before_desc' ];
1437
- $html = (int) $args[ 'html' ];
1438
- if ( 'true' === strtolower( $args[ 'displaydescriptions' ] ) ) {
1439
- $args[ 'displaydescriptions' ] = 1;
1440
  }
1441
- $after_desc = $args[ 'after_desc' ];
1442
- $displaydescriptions = (int) $args[ 'displaydescriptions' ];
1443
- if ( 'true' === strtolower( $args[ 'truncatedescchar' ] ) ) {
1444
- $args[ 'truncatedescchar' ] = 1;
1445
  }
1446
- $truncatedescchar = (int) $args[ 'truncatedescchar' ];
1447
- if ( 'true' === strtolower( $args[ 'truncatetitlechar' ] ) ) {
1448
- $args[ 'truncatetitlechar' ] = 1;
1449
  }
1450
- $truncatedescstring = $args[ 'truncatedescstring' ];
1451
- $truncatetitlestring = $args[ 'truncatetitlestring' ];
1452
- $truncatetitlechar = (int) $args[ 'truncatetitlechar' ];
1453
- $before_date = $args[ 'before_date' ];
1454
- if ( 'true' === strtolower( $args[ 'date' ] ) ) {
1455
- $args[ 'date' ] = 1;
1456
  }
1457
- $date = (int) $args[ 'date' ];
1458
- $after_date = $args[ 'after_date' ];
1459
- $date_format = $args[ 'date_format' ];
1460
- if ( 'true' === strtolower( $args[ 'creator' ] ) ) {
1461
- $args[ 'creator' ] = 1;
1462
  }
1463
- $before_creator = $args[ 'before_creator' ];
1464
- $creator = (int) $args[ 'creator' ];
1465
- $after_creator = $args[ 'after_creator' ];
1466
- $start_items = $args[ 'start_items' ];
1467
- $end_items = $args[ 'end_items' ];
1468
- $start_item = $args[ 'start_item' ];
1469
- $end_item = $args[ 'end_item' ];
1470
- $target = $args[ 'target' ];
1471
- $rel = $args[ 'rel' ];
1472
- $desc4title = $args[ 'desc4title' ];
1473
- if ( 'true' === strtolower( $args[ 'charsetscan' ] ) ) {
1474
- $args[ 'charsetscan' ] = 1;
1475
  }
1476
- $charsetscan = (int) $args[ 'charsetscan' ];
1477
- if ( 'true' === strtolower( $args[ 'debug' ] ) ) {
1478
- $args[ 'debug' ] = 1;
1479
  }
1480
- $debug = (int) $args[ 'debug' ];
1481
- $before_noitems = $args[ 'before_noitems' ];
1482
- $noitems = $args[ 'noitems' ];
1483
- $after_noitems = $args[ 'after_noitems' ];
1484
- $before_error = $args[ 'before_error' ];
1485
- $error = $args[ 'error' ];
1486
- $after_error = $args[ 'after_error' ];
1487
- if ( 'true' === strtolower( $args[ 'paging' ] ) ) {
1488
- $args[ 'paging' ] = 1;
1489
  }
1490
- $paging = (int) $args[ 'paging' ];
1491
- if ( 'true' === strtolower( $args[ 'use_simplepie' ] ) ) {
1492
- $args[ 'use_simplepie' ] = 1;
1493
  }
1494
- $prev_paging_link = $args[ 'prev_paging_link' ];
1495
- $next_paging_link = $args[ 'next_paging_link' ];
1496
- $prev_paging_title = $args[ 'prev_paging_title' ];
1497
- $next_paging_title = $args[ 'next_paging_title' ];
1498
- $use_simplepie = (int) $args[ 'use_simplepie' ];
1499
- $view = $args[ 'view' ];
1500
- $random_sort = $args[ 'random_sort' ];
1501
-
1502
- $return = RSSImport(
1503
- $display, $feedurl,
1504
- $before_desc, $displaydescriptions, $after_desc, $html,
1505
- $truncatedescchar, $truncatedescstring,
1506
- $truncatetitlechar, $truncatetitlestring,
1507
- $before_date, $date, $after_date, $date_format,
1508
- $before_creator, $creator, $after_creator,
1509
- $start_items, $end_items,
1510
- $start_item, $end_item,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1511
  $target,
1512
  $rel,
1513
  $desc4title,
1514
- $charsetscan, $debug,
1515
- $before_noitems, $noitems, $after_noitems,
1516
- $before_error, $error, $after_error,
1517
- $paging, $prev_paging_link, $next_paging_link, $prev_paging_title, $next_paging_title,
 
 
 
 
 
 
 
 
 
1518
  $use_simplepie,
1519
  $view,
1520
- $random_sort
 
1521
  );
1522
-
1523
- return $return;
1524
  }
1525
 
 
 
 
 
 
1526
  function RSSImport_shortcode_quot( $pee ) {
1527
-
1528
  global $shortcode_tags;
1529
 
1530
  if ( ! empty( $shortcode_tags ) && is_array( $shortcode_tags ) ) {
1531
  $tagnames = array_keys( $shortcode_tags );
1532
  $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) );
1533
  $pee = preg_replace(
1534
- '/\\s*?(\\[(' . $tagregexp . ')\\b.*?\\/?\\](?:.+?\\[\\/\\2\\])?)\\s*/s',
1535
  '$1',
1536
  $pee
1537
  );
@@ -1543,19 +1618,17 @@ function RSSImport_shortcode_quot( $pee ) {
1543
  /**
1544
  * Add Quicktag-button to editor.
1545
  */
1546
-
1547
  function RSSImport_insert_button() {
1548
-
1549
  global $pagenow;
1550
 
1551
- $post_page_pages = array( 'post-new.php', 'post.php', 'page-new.php', 'page.php' );
1552
  if ( ! in_array( $pagenow, $post_page_pages, true ) ) {
1553
  return;
1554
  }
1555
 
1556
  ?>
1557
- <script type="text/javascript" charset="utf-8">
1558
- /* Adding Quicktag buttons to the editor WordPress ver. 3.3 and above
1559
  * - Button HTML ID (required)
1560
  * - Button display, value="" attribute (required)
1561
  * - Opening Tag (required)
@@ -1564,30 +1637,32 @@ function RSSImport_insert_button() {
1564
  * - Title, title="" attribute (optional)
1565
  * - Priority/position on bar, 1-9 = first, 11-19 = second, 21-29 = third, etc. (optional)
1566
  */
1567
- var id = 'rssimport',
1568
- text = '<?php _e( 'RSSImport', FB_RSSI_TEXTDOMAIN ); ?>',
1569
- start = '[RSSImport display="5" feedurl="http://feedurl.com/" before_desc="<br />" displaydescriptions="TRUE" after_desc=" " ' +
1570
- 'html="FALSE" truncatedescchar="200" truncatedescstring=" ... " truncatetitlechar="" truncatetitlestring=" ... " ' +
1571
- 'before_date=" <small>" date="FALSE" after_date="</small>" date_format="" before_creator=" <small>" creator="FALSE" ' +
1572
- 'after_creator="</small>" start_items="<ul>" end_items="</ul>" start_item="<li>" end_item="</li>" target="" rel="" ' +
1573
- 'desc4title="" charsetscan="FALSE" debug="FALSE" before_noitems="<p>" noitems="No items, feed is empty." ' +
1574
- 'after_noitems="</p>" before_error="<p>" error="Error: Feed has an error or is not valid" after_error="</p>" ' +
1575
- 'paging="FALSE" prev_paging_link="&laquo; Previous" next_paging_link="Next &raquo;" prev_paging_title="more items" ' +
1576
- 'next_paging_title="more items" use_simplepie="FALSE" random_sort="FALSE"]',
1577
- end = '',
1578
- access = 'r',
1579
- title = '<?php _e( 'Import a feed with RSSImport', FB_RSSI_TEXTDOMAIN ); ?>';
1580
-
1581
- QTags.addButton(id, text, start, end, access);
1582
- </script>
1583
  <?php
1584
  }
1585
 
 
 
 
1586
  function RSSImport_insert_button_old() {
1587
-
1588
  global $pagenow;
1589
 
1590
- $post_page_pages = array( 'post-new.php', 'post.php', 'page-new.php', 'page.php' );
1591
  if ( ! in_array( $pagenow, $post_page_pages, true ) ) {
1592
  return;
1593
  }
@@ -1601,13 +1676,20 @@ function RSSImport_insert_button_old() {
1601
  content;
1602
 
1603
  edButtons[length] = new edButton(
1604
- \'RSSImport\', \'$context\', \'[RSSImport display="5" feedurl="http://feedurl.com/"' .
1605
- ' before_desc="<br />" displaydescriptions="TRUE" after_desc=" " html="FALSE" truncatedescchar="200" truncatedescstring=" ... "' .
1606
- ' truncatetitlechar=" " truncatetitlestring=" ... " before_date=" <small>" date="FALSE" after_date="</small>"' .
1607
- ' date_format="" before_creator=" <small>" creator="FALSE" after_creator="</small>" start_items="<ul>" end_items="</ul>"' .
1608
- ' start_item="<li>" end_item="</li>" target="" rel="" desc4title="" charsetscan="FALSE" debug="FALSE" before_noitems="<p>"' .
1609
- ' noitems="No items, feed is empty." after_noitems="</p>" before_error="<p>" error="Error: Feed has an error or is not valid"' .
1610
- ' after_error="</p>" paging="FALSE" prev_paging_link="&laquo; Previous" next_paging_link="Next &raquo;"' .
 
 
 
 
 
 
 
1611
  ' prev_paging_title="more items" next_paging_title="more items" use_simplepie="FALSE"]\', \'\', \'\'
1612
  );
1613
 
@@ -1617,8 +1699,10 @@ function RSSImport_insert_button_old() {
1617
  }
1618
  jQuery( document ).ready( function() {
1619
  content = \'<input id="RSSImport_\' + length + \'" class="ed_button" type="button" value="'
1620
- . __( 'RSSImport', FB_RSSI_TEXTDOMAIN ) . '" title="'
1621
- . __( 'Import a feed with RSSImport', FB_RSSI_TEXTDOMAIN ) . '" onclick="RSSImport_tag(this.id);" />\';
 
 
1622
  jQuery( "#ed_toolbar" ).append( content );
1623
  } );
1624
  }
@@ -1627,7 +1711,7 @@ function RSSImport_insert_button_old() {
1627
  }
1628
 
1629
  if ( FB_RSSI_QUICKTAG && is_admin() ) {
1630
- if ( version_compare( $GLOBALS[ 'wp_version' ], '3.3alpha', '>=' ) ) {
1631
  add_action( 'admin_print_footer_scripts', 'RSSImport_insert_button' );
1632
  } else {
1633
  add_action( 'admin_footer', 'RSSImport_insert_button_old' );
@@ -1646,15 +1730,25 @@ add_action( 'init', 'RSSImport_textdomain' );
1646
  * @package WP-RSSImport
1647
  */
1648
  function RSSImport_code_to_utf8( $num ) {
1649
-
1650
  if ( $num <= 0x7F ) {
1651
  return chr( $num );
1652
- } elseif ( $num <= 0x7FF ) {
 
 
1653
  return chr( ( $num >> 0x06 ) + 0xC0 ) . chr( ( $num & 0x3F ) + 128 );
1654
- } elseif ( $num <= 0xFFFF ) {
1655
- return chr( ( $num >> 0x0C ) + 0xE0 ) . chr( ( ( $num >> 0x06 ) & 0x3F ) + 0x80 ) . chr( ( $num & 0x3F ) + 0x80 );
1656
- } elseif ( $num <= 0x1FFFFF ) {
1657
- return chr( ( $num >> 0x12 ) + 0xF0 ) . chr( ( ( $num >> 0x0C ) & 0x3F ) + 0x80 ) . chr( ( ( $num >> 0x06 ) & 0x3F ) + 0x80 ) . chr( ( $num & 0x3F ) + 0x80 );
 
 
 
 
 
 
 
 
 
1658
  }
1659
 
1660
  return '';
@@ -1666,409 +1760,501 @@ function RSSImport_code_to_utf8( $num ) {
1666
  * @package WP-RSSImport
1667
  */
1668
  function RSSImport_html_entity_decode_php4( $str ) {
1669
-
1670
- $htmlentities = array(
1671
- "&Aacute;" => chr( 195 ) . chr( 129 ),
1672
- "&aacute;" => chr( 195 ) . chr( 161 ),
1673
- "&Acirc;" => chr( 195 ) . chr( 130 ),
1674
- "&acirc;" => chr( 195 ) . chr( 162 ),
1675
- "&acute;" => chr( 194 ) . chr( 180 ),
1676
- "&AElig;" => chr( 195 ) . chr( 134 ),
1677
- "&aelig;" => chr( 195 ) . chr( 166 ),
1678
- "&Agrave;" => chr( 195 ) . chr( 128 ),
1679
- "&agrave;" => chr( 195 ) . chr( 160 ),
1680
- "&alefsym;" => chr( 226 ) . chr( 132 ) . chr( 181 ),
1681
- "&Alpha;" => chr( 206 ) . chr( 145 ),
1682
- "&alpha;" => chr( 206 ) . chr( 177 ),
1683
- "&amp;" => chr( 38 ),
1684
- "&and;" => chr( 226 ) . chr( 136 ) . chr( 167 ),
1685
- "&ang;" => chr( 226 ) . chr( 136 ) . chr( 160 ),
1686
- "&Aring;" => chr( 195 ) . chr( 133 ),
1687
- "&aring;" => chr( 195 ) . chr( 165 ),
1688
- "&asymp;" => chr( 226 ) . chr( 137 ) . chr( 136 ),
1689
- "&Atilde;" => chr( 195 ) . chr( 131 ),
1690
- "&atilde;" => chr( 195 ) . chr( 163 ),
1691
- "&Auml;" => chr( 195 ) . chr( 132 ),
1692
- "&auml;" => chr( 195 ) . chr( 164 ),
1693
- "&bdquo;" => chr( 226 ) . chr( 128 ) . chr( 158 ),
1694
- "&Beta;" => chr( 206 ) . chr( 146 ),
1695
- "&beta;" => chr( 206 ) . chr( 178 ),
1696
- "&brvbar;" => chr( 194 ) . chr( 166 ),
1697
- "&bull;" => chr( 226 ) . chr( 128 ) . chr( 162 ),
1698
- "&cap;" => chr( 226 ) . chr( 136 ) . chr( 169 ),
1699
- "&Ccedil;" => chr( 195 ) . chr( 135 ),
1700
- "&ccedil;" => chr( 195 ) . chr( 167 ),
1701
- "&cedil;" => chr( 194 ) . chr( 184 ),
1702
- "&cent;" => chr( 194 ) . chr( 162 ),
1703
- "&Chi;" => chr( 206 ) . chr( 167 ),
1704
- "&chi;" => chr( 207 ) . chr( 135 ),
1705
- "&circ;" => chr( 203 ) . chr( 134 ),
1706
- "&clubs;" => chr( 226 ) . chr( 153 ) . chr( 163 ),
1707
- "&cong;" => chr( 226 ) . chr( 137 ) . chr( 133 ),
1708
- "&copy;" => chr( 194 ) . chr( 169 ),
1709
- "&crarr;" => chr( 226 ) . chr( 134 ) . chr( 181 ),
1710
- "&cup;" => chr( 226 ) . chr( 136 ) . chr( 170 ),
1711
- "&curren;" => chr( 194 ) . chr( 164 ),
1712
- "&dagger;" => chr( 226 ) . chr( 128 ) . chr( 160 ),
1713
- "&Dagger;" => chr( 226 ) . chr( 128 ) . chr( 161 ),
1714
- "&darr;" => chr( 226 ) . chr( 134 ) . chr( 147 ),
1715
- "&dArr;" => chr( 226 ) . chr( 135 ) . chr( 147 ),
1716
- "&deg;" => chr( 194 ) . chr( 176 ),
1717
- "&Delta;" => chr( 206 ) . chr( 148 ),
1718
- "&delta;" => chr( 206 ) . chr( 180 ),
1719
- "&diams;" => chr( 226 ) . chr( 153 ) . chr( 166 ),
1720
- "&divide;" => chr( 195 ) . chr( 183 ),
1721
- "&Eacute;" => chr( 195 ) . chr( 137 ),
1722
- "&eacute;" => chr( 195 ) . chr( 169 ),
1723
- "&Ecirc;" => chr( 195 ) . chr( 138 ),
1724
- "&ecirc;" => chr( 195 ) . chr( 170 ),
1725
- "&Egrave;" => chr( 195 ) . chr( 136 ),
1726
- "&egrave;" => chr( 195 ) . chr( 168 ),
1727
- "&empty;" => chr( 226 ) . chr( 136 ) . chr( 133 ),
1728
- "&emsp;" => chr( 226 ) . chr( 128 ) . chr( 131 ),
1729
- "&ensp;" => chr( 226 ) . chr( 128 ) . chr( 130 ),
1730
- "&Epsilon;" => chr( 206 ) . chr( 149 ),
1731
- "&epsilon;" => chr( 206 ) . chr( 181 ),
1732
- "&equiv;" => chr( 226 ) . chr( 137 ) . chr( 161 ),
1733
- "&Eta;" => chr( 206 ) . chr( 151 ),
1734
- "&eta;" => chr( 206 ) . chr( 183 ),
1735
- "&ETH;" => chr( 195 ) . chr( 144 ),
1736
- "&eth;" => chr( 195 ) . chr( 176 ),
1737
- "&Euml;" => chr( 195 ) . chr( 139 ),
1738
- "&euml;" => chr( 195 ) . chr( 171 ),
1739
- "&euro;" => chr( 226 ) . chr( 130 ) . chr( 172 ),
1740
- "&exist;" => chr( 226 ) . chr( 136 ) . chr( 131 ),
1741
- "&fnof;" => chr( 198 ) . chr( 146 ),
1742
- "&forall;" => chr( 226 ) . chr( 136 ) . chr( 128 ),
1743
- "&frac12;" => chr( 194 ) . chr( 189 ),
1744
- "&frac14;" => chr( 194 ) . chr( 188 ),
1745
- "&frac34;" => chr( 194 ) . chr( 190 ),
1746
- "&frasl;" => chr( 226 ) . chr( 129 ) . chr( 132 ),
1747
- "&Gamma;" => chr( 206 ) . chr( 147 ),
1748
- "&gamma;" => chr( 206 ) . chr( 179 ),
1749
- "&ge;" => chr( 226 ) . chr( 137 ) . chr( 165 ),
1750
- "&harr;" => chr( 226 ) . chr( 134 ) . chr( 148 ),
1751
- "&hArr;" => chr( 226 ) . chr( 135 ) . chr( 148 ),
1752
- "&hearts;" => chr( 226 ) . chr( 153 ) . chr( 165 ),
1753
- "&hellip;" => chr( 226 ) . chr( 128 ) . chr( 166 ),
1754
- "&Iacute;" => chr( 195 ) . chr( 141 ),
1755
- "&iacute;" => chr( 195 ) . chr( 173 ),
1756
- "&Icirc;" => chr( 195 ) . chr( 142 ),
1757
- "&icirc;" => chr( 195 ) . chr( 174 ),
1758
- "&iexcl;" => chr( 194 ) . chr( 161 ),
1759
- "&Igrave;" => chr( 195 ) . chr( 140 ),
1760
- "&igrave;" => chr( 195 ) . chr( 172 ),
1761
- "&image;" => chr( 226 ) . chr( 132 ) . chr( 145 ),
1762
- "&infin;" => chr( 226 ) . chr( 136 ) . chr( 158 ),
1763
- "&int;" => chr( 226 ) . chr( 136 ) . chr( 171 ),
1764
- "&Iota;" => chr( 206 ) . chr( 153 ),
1765
- "&iota;" => chr( 206 ) . chr( 185 ),
1766
- "&iquest;" => chr( 194 ) . chr( 191 ),
1767
- "&isin;" => chr( 226 ) . chr( 136 ) . chr( 136 ),
1768
- "&Iuml;" => chr( 195 ) . chr( 143 ),
1769
- "&iuml;" => chr( 195 ) . chr( 175 ),
1770
- "&Kappa;" => chr( 206 ) . chr( 154 ),
1771
- "&kappa;" => chr( 206 ) . chr( 186 ),
1772
- "&Lambda;" => chr( 206 ) . chr( 155 ),
1773
- "&lambda;" => chr( 206 ) . chr( 187 ),
1774
- "&lang;" => chr( 226 ) . chr( 140 ) . chr( 169 ),
1775
- "&laquo;" => chr( 194 ) . chr( 171 ),
1776
- "&larr;" => chr( 226 ) . chr( 134 ) . chr( 144 ),
1777
- "&lArr;" => chr( 226 ) . chr( 135 ) . chr( 144 ),
1778
- "&lceil;" => chr( 226 ) . chr( 140 ) . chr( 136 ),
1779
- "&ldquo;" => chr( 226 ) . chr( 128 ) . chr( 156 ),
1780
- "&le;" => chr( 226 ) . chr( 137 ) . chr( 164 ),
1781
- "&lfloor;" => chr( 226 ) . chr( 140 ) . chr( 138 ),
1782
- "&lowast;" => chr( 226 ) . chr( 136 ) . chr( 151 ),
1783
- "&loz;" => chr( 226 ) . chr( 151 ) . chr( 138 ),
1784
- "&lrm;" => chr( 226 ) . chr( 128 ) . chr( 142 ),
1785
- "&lsaquo;" => chr( 226 ) . chr( 128 ) . chr( 185 ),
1786
- "&lsquo;" => chr( 226 ) . chr( 128 ) . chr( 152 ),
1787
- "&macr;" => chr( 194 ) . chr( 175 ),
1788
- "&mdash;" => chr( 226 ) . chr( 128 ) . chr( 148 ),
1789
- "&micro;" => chr( 194 ) . chr( 181 ),
1790
- "&middot;" => chr( 194 ) . chr( 183 ),
1791
- "&minus;" => chr( 226 ) . chr( 136 ) . chr( 146 ),
1792
- "&Mu;" => chr( 206 ) . chr( 156 ),
1793
- "&mu;" => chr( 206 ) . chr( 188 ),
1794
- "&nabla;" => chr( 226 ) . chr( 136 ) . chr( 135 ),
1795
- "&nbsp;" => chr( 194 ) . chr( 160 ),
1796
- "&ndash;" => chr( 226 ) . chr( 128 ) . chr( 147 ),
1797
- "&ne;" => chr( 226 ) . chr( 137 ) . chr( 160 ),
1798
- "&ni;" => chr( 226 ) . chr( 136 ) . chr( 139 ),
1799
- "&not;" => chr( 194 ) . chr( 172 ),
1800
- "&notin;" => chr( 226 ) . chr( 136 ) . chr( 137 ),
1801
- "&nsub;" => chr( 226 ) . chr( 138 ) . chr( 132 ),
1802
- "&Ntilde;" => chr( 195 ) . chr( 145 ),
1803
- "&ntilde;" => chr( 195 ) . chr( 177 ),
1804
- "&Nu;" => chr( 206 ) . chr( 157 ),
1805
- "&nu;" => chr( 206 ) . chr( 189 ),
1806
- "&Oacute;" => chr( 195 ) . chr( 147 ),
1807
- "&oacute;" => chr( 195 ) . chr( 179 ),
1808
- "&Ocirc;" => chr( 195 ) . chr( 148 ),
1809
- "&ocirc;" => chr( 195 ) . chr( 180 ),
1810
- "&OElig;" => chr( 197 ) . chr( 146 ),
1811
- "&oelig;" => chr( 197 ) . chr( 147 ),
1812
- "&Ograve;" => chr( 195 ) . chr( 146 ),
1813
- "&ograve;" => chr( 195 ) . chr( 178 ),
1814
- "&oline;" => chr( 226 ) . chr( 128 ) . chr( 190 ),
1815
- "&Omega;" => chr( 206 ) . chr( 169 ),
1816
- "&omega;" => chr( 207 ) . chr( 137 ),
1817
- "&Omicron;" => chr( 206 ) . chr( 159 ),
1818
- "&omicron;" => chr( 206 ) . chr( 191 ),
1819
- "&oplus;" => chr( 226 ) . chr( 138 ) . chr( 149 ),
1820
- "&or;" => chr( 226 ) . chr( 136 ) . chr( 168 ),
1821
- "&ordf;" => chr( 194 ) . chr( 170 ),
1822
- "&ordm;" => chr( 194 ) . chr( 186 ),
1823
- "&Oslash;" => chr( 195 ) . chr( 152 ),
1824
- "&oslash;" => chr( 195 ) . chr( 184 ),
1825
- "&Otilde;" => chr( 195 ) . chr( 149 ),
1826
- "&otilde;" => chr( 195 ) . chr( 181 ),
1827
- "&otimes;" => chr( 226 ) . chr( 138 ) . chr( 151 ),
1828
- "&Ouml;" => chr( 195 ) . chr( 150 ),
1829
- "&ouml;" => chr( 195 ) . chr( 182 ),
1830
- "&para;" => chr( 194 ) . chr( 182 ),
1831
- "&part;" => chr( 226 ) . chr( 136 ) . chr( 130 ),
1832
- "&permil;" => chr( 226 ) . chr( 128 ) . chr( 176 ),
1833
- "&perp;" => chr( 226 ) . chr( 138 ) . chr( 165 ),
1834
- "&Phi;" => chr( 206 ) . chr( 166 ),
1835
- "&phi;" => chr( 207 ) . chr( 134 ),
1836
- "&Pi;" => chr( 206 ) . chr( 160 ),
1837
- "&pi;" => chr( 207 ) . chr( 128 ),
1838
- "&piv;" => chr( 207 ) . chr( 150 ),
1839
- "&plusmn;" => chr( 194 ) . chr( 177 ),
1840
- "&pound;" => chr( 194 ) . chr( 163 ),
1841
- "&prime;" => chr( 226 ) . chr( 128 ) . chr( 178 ),
1842
- "&Prime;" => chr( 226 ) . chr( 128 ) . chr( 179 ),
1843
- "&prod;" => chr( 226 ) . chr( 136 ) . chr( 143 ),
1844
- "&prop;" => chr( 226 ) . chr( 136 ) . chr( 157 ),
1845
- "&Psi;" => chr( 206 ) . chr( 168 ),
1846
- "&psi;" => chr( 207 ) . chr( 136 ),
1847
- "&radic;" => chr( 226 ) . chr( 136 ) . chr( 154 ),
1848
- "&rang;" => chr( 226 ) . chr( 140 ) . chr( 170 ),
1849
- "&raquo;" => chr( 194 ) . chr( 187 ),
1850
- "&rarr;" => chr( 226 ) . chr( 134 ) . chr( 146 ),
1851
- "&rArr;" => chr( 226 ) . chr( 135 ) . chr( 146 ),
1852
- "&rceil;" => chr( 226 ) . chr( 140 ) . chr( 137 ),
1853
- "&rdquo;" => chr( 226 ) . chr( 128 ) . chr( 157 ),
1854
- "&real;" => chr( 226 ) . chr( 132 ) . chr( 156 ),
1855
- "&reg;" => chr( 194 ) . chr( 174 ),
1856
- "&rfloor;" => chr( 226 ) . chr( 140 ) . chr( 139 ),
1857
- "&Rho;" => chr( 206 ) . chr( 161 ),
1858
- "&rho;" => chr( 207 ) . chr( 129 ),
1859
- "&rlm;" => chr( 226 ) . chr( 128 ) . chr( 143 ),
1860
- "&rsaquo;" => chr( 226 ) . chr( 128 ) . chr( 186 ),
1861
- "&rsquo;" => chr( 226 ) . chr( 128 ) . chr( 153 ),
1862
- "&sbquo;" => chr( 226 ) . chr( 128 ) . chr( 154 ),
1863
- "&Scaron;" => chr( 197 ) . chr( 160 ),
1864
- "&scaron;" => chr( 197 ) . chr( 161 ),
1865
- "&sdot;" => chr( 226 ) . chr( 139 ) . chr( 133 ),
1866
- "&sect;" => chr( 194 ) . chr( 167 ),
1867
- "&shy;" => chr( 194 ) . chr( 173 ),
1868
- "&Sigma;" => chr( 206 ) . chr( 163 ),
1869
- "&sigma;" => chr( 207 ) . chr( 131 ),
1870
- "&sigmaf;" => chr( 207 ) . chr( 130 ),
1871
- "&sim;" => chr( 226 ) . chr( 136 ) . chr( 188 ),
1872
- "&spades;" => chr( 226 ) . chr( 153 ) . chr( 160 ),
1873
- "&sub;" => chr( 226 ) . chr( 138 ) . chr( 130 ),
1874
- "&sube;" => chr( 226 ) . chr( 138 ) . chr( 134 ),
1875
- "&sum;" => chr( 226 ) . chr( 136 ) . chr( 145 ),
1876
- "&sup1;" => chr( 194 ) . chr( 185 ),
1877
- "&sup2;" => chr( 194 ) . chr( 178 ),
1878
- "&sup3;" => chr( 194 ) . chr( 179 ),
1879
- "&sup;" => chr( 226 ) . chr( 138 ) . chr( 131 ),
1880
- "&supe;" => chr( 226 ) . chr( 138 ) . chr( 135 ),
1881
- "&szlig;" => chr( 195 ) . chr( 159 ),
1882
- "&Tau;" => chr( 206 ) . chr( 164 ),
1883
- "&tau;" => chr( 207 ) . chr( 132 ),
1884
- "&there4;" => chr( 226 ) . chr( 136 ) . chr( 180 ),
1885
- "&Theta;" => chr( 206 ) . chr( 152 ),
1886
- "&theta;" => chr( 206 ) . chr( 184 ),
1887
- "&thetasym;" => chr( 207 ) . chr( 145 ),
1888
- "&thinsp;" => chr( 226 ) . chr( 128 ) . chr( 137 ),
1889
- "&THORN;" => chr( 195 ) . chr( 158 ),
1890
- "&thorn;" => chr( 195 ) . chr( 190 ),
1891
- "&tilde;" => chr( 203 ) . chr( 156 ),
1892
- "&times;" => chr( 195 ) . chr( 151 ),
1893
- "&trade;" => chr( 226 ) . chr( 132 ) . chr( 162 ),
1894
- "&Uacute;" => chr( 195 ) . chr( 154 ),
1895
- "&uacute;" => chr( 195 ) . chr( 186 ),
1896
- "&uarr;" => chr( 226 ) . chr( 134 ) . chr( 145 ),
1897
- "&uArr;" => chr( 226 ) . chr( 135 ) . chr( 145 ),
1898
- "&Ucirc;" => chr( 195 ) . chr( 155 ),
1899
- "&ucirc;" => chr( 195 ) . chr( 187 ),
1900
- "&Ugrave;" => chr( 195 ) . chr( 153 ),
1901
- "&ugrave;" => chr( 195 ) . chr( 185 ),
1902
- "&uml;" => chr( 194 ) . chr( 168 ),
1903
- "&upsih;" => chr( 207 ) . chr( 146 ),
1904
- "&Upsilon;" => chr( 206 ) . chr( 165 ),
1905
- "&upsilon;" => chr( 207 ) . chr( 133 ),
1906
- "&Uuml;" => chr( 195 ) . chr( 156 ),
1907
- "&uuml;" => chr( 195 ) . chr( 188 ),
1908
- "&weierp;" => chr( 226 ) . chr( 132 ) . chr( 152 ),
1909
- "&Xi;" => chr( 206 ) . chr( 158 ),
1910
- "&xi;" => chr( 206 ) . chr( 190 ),
1911
- "&Yacute;" => chr( 195 ) . chr( 157 ),
1912
- "&yacute;" => chr( 195 ) . chr( 189 ),
1913
- "&yen;" => chr( 194 ) . chr( 165 ),
1914
- "&yuml;" => chr( 195 ) . chr( 191 ),
1915
- "&Yuml;" => chr( 197 ) . chr( 184 ),
1916
- "&Zeta;" => chr( 206 ) . chr( 150 ),
1917
- "&zeta;" => chr( 206 ) . chr( 182 ),
1918
- "&zwj;" => chr( 226 ) . chr( 128 ) . chr( 141 ),
1919
- "&zwnj;" => chr( 226 ) . chr( 128 ) . chr( 140 ),
1920
- "&gt;" => ">",
1921
- "&lt;" => "<",
1922
- );
1923
 
1924
  $return = strtr( $str, $htmlentities );
1925
- $return = preg_replace( '~&#x([0-9a-f]+);i', 'RSSImport_code_to_utf8( hexdec( "\\1" ) )', $return );
1926
- $return = preg_replace( '~&#([0-9]+);', 'RSSImport_code_to_utf8( \\1 )', $return );
1927
 
1928
  return $return;
1929
  }
1930
 
1931
  // check class wp_widget exists
1932
  if ( class_exists( 'WP_Widget' ) ) {
1933
-
1934
  class RSSImport_Widget extends WP_Widget {
1935
 
1936
  public function __construct() {
1937
-
1938
- $widget_ops = array(
1939
  'classname' => 'rssimport',
1940
  'description' => __( 'Entries from any RSS or Atom feed', FB_RSSI_TEXTDOMAIN ),
1941
- );
1942
  parent::__construct( 'rssimport', __( 'RSSImport' ), $widget_ops );
1943
  }
1944
 
1945
  public function widget( $args, $instance ) {
1946
-
1947
- $title = empty( $instance[ 'title' ] ) ? '&nbsp;'
1948
- : apply_filters( 'widget_title', $instance[ 'title' ] );
1949
- $titlelink = empty( $instance[ 'titlelink' ] ) ? '' : $instance[ 'titlelink' ];
1950
- $display = empty( $instance[ 'display' ] ) ? '5' : $instance[ 'display' ];
1951
- $feedurl = empty( $instance[ 'feedurl' ] ) ? 'http://bueltge.de/feed/' : $instance[ 'feedurl' ];
1952
- $before_desc = empty( $instance[ 'before_desc' ] ) ? '' : $instance[ 'before_desc' ];
1953
- $displaydescriptions = empty( $instance[ 'displaydescriptions' ] ) ? '0'
1954
- : $instance[ 'displaydescriptions' ];
1955
- $after_desc = empty( $instance[ 'after_desc' ] ) ? '' : $instance[ 'after_desc' ];
1956
- $html = empty( $instance[ 'html' ] ) ? '0' : $instance[ 'html' ];
1957
- $truncatedescchar = empty( $instance[ 'truncatedescchar' ] ) ? '200' : $instance[ 'truncatedescchar' ];
1958
- $truncatedescstring = empty( $instance[ 'truncatedescstring' ] ) ? '' : $instance[ 'truncatedescstring' ];
1959
- $truncatetitlechar = empty( $instance[ 'truncatetitlechar' ] ) ? '' : $instance[ 'truncatetitlechar' ];
1960
- $truncatetitlestring = empty( $instance[ 'truncatetitlestring' ] ) ? ' ... '
1961
- : $instance[ 'truncatetitlestring' ];
1962
- $before_date = empty( $instance[ 'before_date' ] ) ? ' <small>' : $instance[ 'before_date' ];
1963
- $date = empty( $instance[ 'date' ] ) ? '0' : $instance[ 'date' ];
1964
- $after_date = empty( $instance[ 'after_date' ] ) ? '</small>' : $instance[ 'after_date' ];
1965
- $date_format = empty( $instance[ 'date_format' ] ) ? '' : $instance[ 'date_format' ];
1966
- $before_creator = empty( $instance[ 'before_creator' ] ) ? ' <small>' : $instance[ 'before_creator' ];
1967
- $creator = empty( $instance[ 'creator' ] ) ? '0' : $instance[ 'creator' ];
1968
- $after_creator = empty( $instance[ 'after_creator' ] ) ? '</small>' : $instance[ 'after_creator' ];
1969
- $start_items = empty( $instance[ 'start_items' ] ) ? '<ul>' : $instance[ 'start_items' ];
1970
- $end_items = empty( $instance[ 'end_items' ] ) ? '</ul>' : $instance[ 'end_items' ];
1971
- $start_item = empty( $instance[ 'start_item' ] ) ? '<li>' : $instance[ 'start_item' ];
1972
- $end_item = empty( $instance[ 'end_item' ] ) ? '</li>' : $instance[ 'end_item' ];
1973
- $target = empty( $instance[ 'target' ] ) ? '' : $instance[ 'target' ];
1974
- $rel = empty( $instance[ 'rel' ] ) ? '' : $instance[ 'rel' ];
1975
- $desc4title = empty( $instance[ 'desc4title' ] ) ? '0' : $instance[ 'desc4title' ];
1976
- $charsetscan = empty( $instance[ 'charsetscan' ] ) ? '0' : $instance[ 'charsetscan' ];
1977
- $debug = empty( $instance[ 'debug' ] ) ? '0' : $instance[ 'debug' ];
1978
- $before_noitems = empty( $instance[ 'before_noitems' ] ) ? '<p>' : $instance[ 'before_noitems' ];
1979
- $noitems = empty( $instance[ 'noitems' ] ) ? __( 'No items, feed is empty.',
1980
- FB_RSSI_TEXTDOMAIN ) : $instance[ 'noitems' ];
1981
- $after_noitems = empty( $instance[ 'after_noitems' ] ) ? '</p>' : $instance[ 'after_noitems' ];
1982
- $before_error = empty( $instance[ 'before_error' ] ) ? '<p>' : $instance[ 'before_error' ];
1983
- $error = empty( $instance[ 'error' ] ) ? __( 'Error: Feed has an error or is not valid',
1984
- FB_RSSI_TEXTDOMAIN ) : $instance[ 'error' ];
1985
- $after_error = empty( $instance[ 'after_error' ] ) ? '</p>' : $instance[ 'after_error' ];
1986
- $paging = empty( $instance[ 'paging' ] ) ? '0' : $instance[ 'paging' ];
1987
- $prev_paging_link = empty( $instance[ 'prev_paging_link' ] ) ? __( '&laquo; Previous',
1988
- FB_RSSI_TEXTDOMAIN )
1989
- : $instance[ 'prev_paging_link' ];
1990
- $next_paging_link = empty( $instance[ 'next_paging_link' ] ) ? __( 'Next &raquo;', FB_RSSI_TEXTDOMAIN )
1991
- : $instance[ 'next_paging_link' ];
1992
- $prev_paging_title = empty( $instance[ 'prev_paging_title' ] ) ? __( 'more items', FB_RSSI_TEXTDOMAIN )
1993
- : $instance[ 'prev_paging_title' ];
1994
- $next_paging_title = empty( $instance[ 'next_paging_title' ] ) ? __( 'more items', FB_RSSI_TEXTDOMAIN )
1995
- : $instance[ 'next_paging_title' ];
1996
- $use_simplepie = $instance[ 'use_simplepie' ];
1997
- $view = $instance[ 'view' ];
1998
- $random_sort = $instance[ 'random_sort' ];
1999
-
2000
- echo $args[ 'before_widget' ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2001
  if ( '' !== $titlelink ) {
2002
  $title = '<a href="' . $titlelink . '">' . $title . '</a>';
2003
  }
2004
- echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
2005
  RSSImport(
2006
- $display, $feedurl,
2007
- $before_desc, $displaydescriptions, $after_desc, $html, $truncatedescchar, $truncatedescstring,
2008
- $truncatetitlechar, $truncatetitlestring,
2009
- $before_date, $date, $after_date, $date_format,
2010
- $before_creator, $creator, $after_creator,
2011
- $start_items, $end_items,
2012
- $start_item, $end_item,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2013
  $target,
2014
  $rel,
2015
  $desc4title,
2016
- $charsetscan, $debug,
2017
- $before_noitems, $noitems, $after_noitems,
2018
- $before_error, $error, $after_error,
2019
- $paging, $prev_paging_link, $next_paging_link, $prev_paging_title, $next_paging_title,
 
 
 
 
 
 
 
 
 
2020
  $use_simplepie,
2021
  $view,
2022
- $random_sort
 
2023
  );
2024
- echo $args[ 'after_widget' ];
2025
  }
2026
 
2027
  public function update( $new_instance, $old_instance ) {
2028
-
2029
- $instance[ 'instance' ] = $old_instance;
2030
- $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
2031
- $instance[ 'titlelink' ] = esc_url( $new_instance[ 'titlelink' ] );
2032
- $instance[ 'display' ] = (int) $new_instance[ 'display' ];
2033
- $instance[ 'feedurl' ] = $new_instance[ 'feedurl' ];
2034
- $instance[ 'before_desc' ] = $new_instance[ 'before_desc' ];
2035
- $instance[ 'displaydescriptions' ] = (int) $new_instance[ 'displaydescriptions' ];
2036
- $instance[ 'after_desc' ] = stripslashes_deep( $new_instance[ 'after_desc' ] );
2037
- $instance[ 'html' ] = (int) $new_instance[ 'html' ];
2038
- $instance[ 'truncatedescchar' ] = (int) $new_instance[ 'truncatedescchar' ];
2039
- $instance[ 'truncatedescstring' ] = $new_instance[ 'truncatedescstring' ];
2040
- $instance[ 'truncatetitlechar' ] = (int) $new_instance[ 'truncatetitlechar' ];
2041
- $instance[ 'truncatetitlestring' ] = $new_instance[ 'truncatetitlestring' ];
2042
- $instance[ 'before_date' ] = $new_instance[ 'before_date' ];
2043
- $instance[ 'date' ] = (int) $new_instance[ 'date' ];
2044
- $instance[ 'after_date' ] = $new_instance[ 'after_date' ];
2045
- $instance[ 'date_format' ] = $new_instance[ 'date_format' ];
2046
- $instance[ 'before_creator' ] = $new_instance[ 'before_creator' ];
2047
- $instance[ 'creator' ] = (int) $new_instance[ 'creator' ];
2048
- $instance[ 'after_creator' ] = $new_instance[ 'after_creator' ];
2049
- $instance[ 'start_items' ] = $new_instance[ 'start_items' ];
2050
- $instance[ 'end_items' ] = $new_instance[ 'end_items' ];
2051
- $instance[ 'start_item' ] = $new_instance[ 'start_item' ];
2052
- $instance[ 'end_item' ] = $new_instance[ 'end_item' ];
2053
- $instance[ 'target' ] = $new_instance[ 'target' ];
2054
- $instance[ 'rel' ] = $new_instance[ 'rel' ];
2055
- $instance[ 'desc4title' ] = (int) $new_instance[ 'desc4title' ];
2056
- $instance[ 'charsetscan' ] = (int) $new_instance[ 'charsetscan' ];
2057
- $instance[ 'debug' ] = (int) $new_instance[ 'debug' ];
2058
- $instance[ 'view' ] = (int) $new_instance[ 'view' ];
2059
- $instance[ 'before_noitems' ] = $new_instance[ 'before_noitems' ];
2060
- $instance[ 'noitems' ] = $new_instance[ 'noitems' ];
2061
- $instance[ 'after_noitems' ] = $new_instance[ 'after_noitems' ];
2062
- $instance[ 'before_error' ] = $new_instance[ 'before_error' ];
2063
- $instance[ 'error' ] = $new_instance[ 'error' ];
2064
- $instance[ 'after_error' ] = $new_instance[ 'after_error' ];
2065
- $instance[ 'paging' ] = (int) $new_instance[ 'paging' ];
2066
- $instance[ 'prev_paging_link' ] = $new_instance[ 'prev_paging_link' ];
2067
- $instance[ 'next_paging_link' ] = $new_instance[ 'next_paging_link' ];
2068
- $instance[ 'prev_paging_title' ] = $new_instance[ 'prev_paging_title' ];
2069
- $instance[ 'next_paging_title' ] = $new_instance[ 'next_paging_title' ];
2070
- $instance[ 'use_simplepie' ] = (int) $new_instance[ 'use_simplepie' ];
2071
- $instance[ 'random_sort' ] = (int) $new_instance[ 'random_sort' ];
2072
 
2073
  if ( current_user_can( 'unfiltered_html' ) ) {
2074
  return $instance;
@@ -2078,9 +2264,9 @@ if ( class_exists( 'WP_Widget' ) ) {
2078
  }
2079
 
2080
  public function form( $instance ) {
2081
-
2082
  $instance = wp_parse_args(
2083
- (array) $instance, array(
 
2084
  'title' => '',
2085
  'titlelink' => '',
2086
  'display' => 5,
@@ -2124,365 +2310,512 @@ if ( class_exists( 'WP_Widget' ) ) {
2124
  'next_paging_title' => __( 'more items', FB_RSSI_TEXTDOMAIN ),
2125
  'use_simplepie' => 1,
2126
  'random_sort' => 0,
2127
- )
 
2128
  );
2129
 
2130
- $title = format_to_edit( strip_tags( $instance[ 'title' ] ) );
2131
- $titlelink = format_to_edit( esc_url( $instance[ 'titlelink' ] ) );
2132
- $display = (int) $instance[ 'display' ];
2133
- $feedurl = format_to_edit( $instance[ 'feedurl' ] );
2134
- $before_desc = format_to_edit( $instance[ 'before_desc' ] );
2135
- $displaydescriptions = (int) $instance[ 'displaydescriptions' ];
2136
- $after_desc = format_to_edit( $instance[ 'after_desc' ] );
2137
- $html = (int) $instance[ 'html' ];
2138
- $truncatedescchar = (int) $instance[ 'truncatedescchar' ];
2139
- $truncatedescstring = (int) $instance[ 'truncatedescstring' ];
2140
- $truncatetitlechar = format_to_edit( $instance[ 'truncatetitlechar' ] );
2141
- $truncatetitlestring = format_to_edit( $instance[ 'truncatetitlestring' ] );
2142
- $before_date = format_to_edit( $instance[ 'before_date' ] );
2143
- $date = (int) $instance[ 'date' ];
2144
- $after_date = format_to_edit( $instance[ 'after_date' ] );
2145
- $date_format = format_to_edit( $instance[ 'date_format' ] );
2146
- $before_creator = format_to_edit( $instance[ 'before_creator' ] );
2147
- $creator = (int) $instance[ 'creator' ];
2148
- $after_creator = format_to_edit( $instance[ 'after_creator' ] );
2149
- $start_items = format_to_edit( $instance[ 'start_items' ] );
2150
- $end_items = format_to_edit( $instance[ 'end_items' ] );
2151
- $start_item = format_to_edit( $instance[ 'start_item' ] );
2152
- $end_item = format_to_edit( $instance[ 'end_item' ] );
2153
- $target = format_to_edit( $instance[ 'target' ] );
2154
- $rel = format_to_edit( $instance[ 'rel' ] );
2155
- $desc4title = (int) $instance[ 'desc4title' ];
2156
- $charsetscan = (int) $instance[ 'charsetscan' ];
2157
- $debug = (int) $instance[ 'debug' ];
2158
- $before_noitems = format_to_edit( $instance[ 'before_noitems' ] );
2159
- $noitems = format_to_edit( $instance[ 'noitems' ] );
2160
- $after_noitems = format_to_edit( $instance[ 'after_noitems' ] );
2161
- $before_error = format_to_edit( $instance[ 'before_error' ] );
2162
- $error = format_to_edit( $instance[ 'error' ] );
2163
- $after_error = format_to_edit( $instance[ 'after_error' ] );
2164
- $paging = (int) $instance[ 'paging' ];
2165
- $prev_paging_link = format_to_edit( $instance[ 'prev_paging_link' ] );
2166
- $next_paging_link = format_to_edit( $instance[ 'next_paging_link' ] );
2167
- $prev_paging_title = format_to_edit( $instance[ 'prev_paging_title' ] );
2168
- $next_paging_title = format_to_edit( $instance[ 'next_paging_title' ] );
2169
- $use_simplepie = (int) $instance[ 'use_simplepie' ];
2170
- $view = (int) $instance[ 'view' ];
2171
- $random_sort = (int) $instance[ 'random_sort' ];
 
2172
  ?>
2173
- <p>
2174
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', FB_RSSI_TEXTDOMAIN ) ?>
2175
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label>
2176
- </p>
2177
- <p>
2178
- <label for="<?php echo $this->get_field_id( 'titlelink' ); ?>"><?php _e( 'URL for Title (incl. http://):',
 
 
 
 
2179
  FB_RSSI_TEXTDOMAIN ) ?>
2180
- <input class="widefat" id="<?php echo $this->get_field_id( 'titlelink' ); ?>" name="<?php echo $this->get_field_name( 'titlelink' ); ?>" type="text" value="<?php echo esc_url( $titlelink ); ?>" /></label>
2181
- </p>
2182
- <p>
2183
- <label for="<?php echo $this->get_field_id( 'display' ); ?>"><?php _e( 'Display:',
 
 
 
 
2184
  FB_RSSI_TEXTDOMAIN ) ?>
2185
- <input class="widefat" id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>" type="text" value="<?php echo esc_attr( $display ); ?>" /></label>
2186
- </p>
2187
- <p>
2188
- <label for="<?php echo $this->get_field_id( 'feedurl' ); ?>"><?php _e( 'FeedURL:',
 
 
 
 
2189
  FB_RSSI_TEXTDOMAIN ) ?>
2190
- <input class="widefat" id="<?php echo $this->get_field_id( 'feedurl' ); ?>" name="<?php echo $this->get_field_name( 'feedurl' ); ?>" type="text" value="<?php echo $feedurl; ?>" /></label>
2191
- </p>
2192
- <p>
2193
- <label for="<?php echo $this->get_field_id( 'before_desc' ); ?>"><?php _e( 'Before Description:',
 
 
 
 
2194
  FB_RSSI_TEXTDOMAIN ) ?>
2195
- <input class="widefat" id="<?php echo $this->get_field_id( 'before_desc' ); ?>" name="<?php echo $this->get_field_name( 'before_desc' ); ?>" type="text" value="<?php echo $before_desc; ?>" /></label>
2196
- </p>
2197
- <p>
2198
- <label for="<?php echo $this->get_field_id( 'displaydescriptions' ); ?>"><?php _e( 'Display Description:',
 
 
 
 
2199
  FB_RSSI_TEXTDOMAIN ) ?>
2200
- <select id="<?php echo $this->get_field_id( 'displaydescriptions' ); ?>" name="<?php echo $this->get_field_name( 'displaydescriptions' ); ?>">
2201
- <option value="0"<?php if ( $displaydescriptions == '0' ) {
 
2202
  echo ' selected="selected"';
2203
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2204
- <option value="1"<?php if ( $displaydescriptions == '1' ) {
2205
  echo ' selected="selected"';
2206
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2207
- </select>
2208
- </label>
2209
- </p>
2210
- <p>
2211
- <label for="<?php echo $this->get_field_id( 'after_desc' ); ?>"><?php _e( 'After Description:',
2212
  FB_RSSI_TEXTDOMAIN ) ?>
2213
- <input class="widefat code" id="<?php echo $this->get_field_id( 'after_desc' ); ?>" name="<?php echo $this->get_field_name( 'after_desc' ); ?>" type="text" value="<?php echo $after_desc; ?>" /></label>
2214
- <br />
2215
- <small><?php _e( 'You can use the following strings to create custom links:', FB_RSSI_TEXTDOMAIN ); ?>
2216
- <code>%title%</code>, <code>%href%</code>
2217
- <br /><?php _e( 'Example:', FB_RSSI_TEXTDOMAIN ); ?>
2218
- <code>&lt;a href="%href%" target="self" rel="follow"&gt;%title%&lt;/a&gt;</code></small>
2219
- </p>
2220
- <p>
2221
- <label for="<?php echo $this->get_field_id( 'html' ); ?>"><?php _e( 'HTML:', FB_RSSI_TEXTDOMAIN ) ?>
2222
- <select id="<?php echo $this->get_field_id( 'html' ); ?>" name="<?php echo $this->get_field_name( 'html' ); ?>">
2223
- <option value="0"<?php if ( ! $html ) {
 
 
 
 
 
2224
  echo ' selected="selected"';
2225
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2226
- <option value="1"<?php if ( $html ) {
2227
  echo ' selected="selected"';
2228
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2229
- </select>
2230
- </label>
2231
- </p>
2232
- <p>
2233
- <label for="<?php echo $this->get_field_id( 'truncatedescchar' ); ?>"><?php _e( 'Truncate Description Char:',
2234
  FB_RSSI_TEXTDOMAIN ) ?>
2235
- <input class="widefat" id="<?php echo $this->get_field_id( 'truncatedescchar' ); ?>" name="<?php echo $this->get_field_name( 'truncatedescchar' ); ?>" type="text" value="<?php echo esc_attr( $truncatedescchar ); ?>" /></label>
2236
- </p>
2237
- <p>
2238
- <label for="<?php echo $this->get_field_id( 'truncatedescstring' ); ?>"><?php _e( 'Truncate Description String (HTML):',
 
 
 
 
2239
  FB_RSSI_TEXTDOMAIN ) ?>
2240
- <input class="widefat code" id="<?php echo $this->get_field_id( 'truncatedescstring' ); ?>" name="<?php echo $this->get_field_name( 'truncatedescstring' ); ?>" type="text" value="<?php echo $truncatedescstring; ?>" /></label>
2241
- </p>
2242
- <p>
2243
- <label for="<?php echo $this->get_field_id( 'truncatetitlechar' ); ?>"><?php _e( 'Truncate Title Char:',
 
 
 
 
2244
  FB_RSSI_TEXTDOMAIN ) ?>
2245
- <input class="widefat" id="<?php echo $this->get_field_id( 'truncatetitlechar' ); ?>" name="<?php echo $this->get_field_name( 'truncatetitlechar' ); ?>" type="text" value="<?php echo esc_attr( $truncatetitlechar ); ?>" /></label>
2246
- </p>
2247
- <p>
2248
- <label for="<?php echo $this->get_field_id( 'truncatetitlestring' ); ?>"><?php _e( 'Truncate Title String (HTML):',
 
 
 
 
2249
  FB_RSSI_TEXTDOMAIN ) ?>
2250
- <input class="widefat code" id="<?php echo $this->get_field_id( 'truncatetitlestring' ); ?>" name="<?php echo $this->get_field_name( 'truncatetitlestring' ); ?>" type="text" value="<?php echo $truncatetitlestring; ?>" /></label>
2251
- </p>
2252
- <p>
2253
- <label for="<?php echo $this->get_field_id( 'before_date' ); ?>"><?php _e( 'Before Date (HTML):',
 
 
 
 
2254
  FB_RSSI_TEXTDOMAIN ) ?>
2255
- <input class="widefat code" id="<?php echo $this->get_field_id( 'before_date' ); ?>" name="<?php echo $this->get_field_name( 'before_date' ); ?>" type="text" value="<?php echo $before_date; ?>" /></label>
2256
- </p>
2257
- <p>
2258
- <label for="<?php echo $this->get_field_id( 'date' ); ?>"><?php _e( 'Date:', FB_RSSI_TEXTDOMAIN ) ?>
2259
- <select id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>">
2260
- <option value="0"<?php if ( ! $date ) {
 
 
 
 
 
2261
  echo ' selected="selected"';
2262
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2263
- <option value="1"<?php if ( $date ) {
2264
  echo ' selected="selected"';
2265
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2266
- </select>
2267
- </label>
2268
- </p>
2269
- <p>
2270
- <label for="<?php echo $this->get_field_id( 'after_date' ); ?>"><?php _e( 'After Date (HTML):',
2271
  FB_RSSI_TEXTDOMAIN ) ?>
2272
- <input class="widefat code" id="<?php echo $this->get_field_id( 'after_date' ); ?>" name="<?php echo $this->get_field_name( 'after_date' ); ?>" type="text" value="<?php echo $after_date; ?>" /></label>
2273
- </p>
2274
- <p>
2275
- <label for="<?php echo $this->get_field_id( 'date_format' ); ?>"><?php _e( 'Date Formatting:',
 
 
 
 
2276
  FB_RSSI_TEXTDOMAIN ) ?>
2277
- <input class="widefat" 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; ?>" /></label>
2278
- <br />
2279
- <small><?php _e( 'Leave empty for use the date format of your WordPress settings.',
 
 
 
 
2280
  FB_RSSI_TEXTDOMAIN ); ?>
2281
- <a href="http://codex.wordpress.org/Formatting_Date_and_Time"><?php _e( 'Documentation on date formatting',
2282
  FB_RSSI_TEXTDOMAIN ); ?></a>
2283
- </small>
2284
- </p>
2285
- <p>
2286
- <label for="<?php echo $this->get_field_id( 'before_creator' ); ?>"><?php _e( 'Before Creator (HTML):',
2287
  FB_RSSI_TEXTDOMAIN ) ?>
2288
- <input class="widefat code" id="<?php echo $this->get_field_id( 'before_creator' ); ?>" name="<?php echo $this->get_field_name( 'before_creator' ); ?>" type="text" value="<?php echo $before_creator; ?>" /></label>
2289
- </p>
2290
- <p>
2291
- <label for="<?php echo $this->get_field_id( 'creator' ); ?>"><?php _e( 'Creator:',
 
 
 
 
2292
  FB_RSSI_TEXTDOMAIN ) ?>
2293
- <select id="<?php echo $this->get_field_id( 'creator' ); ?>" name="<?php echo $this->get_field_name( 'creator' ); ?>">
2294
- <option value="0"<?php if ( ! $creator ) {
 
2295
  echo ' selected="selected"';
2296
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2297
- <option value="1"<?php if ( $creator ) {
2298
  echo ' selected="selected"';
2299
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2300
- </select>
2301
- </label>
2302
- </p>
2303
- <p>
2304
- <label for="<?php echo $this->get_field_id( 'after_creator' ); ?>"><?php _e( 'After Creator (HTML):',
2305
  FB_RSSI_TEXTDOMAIN ) ?>
2306
- <input class="widefat code" id="<?php echo $this->get_field_id( 'after_creator' ); ?>" name="<?php echo $this->get_field_name( 'after_creator' ); ?>" type="text" value="<?php echo $after_creator; ?>" /></label>
2307
- </p>
2308
- <p>
2309
- <label for="<?php echo $this->get_field_id( 'start_items' ); ?>"><?php _e( 'Before Items (HTML):',
 
 
 
 
2310
  FB_RSSI_TEXTDOMAIN ) ?>
2311
- <input class="widefat code" id="<?php echo $this->get_field_id( 'start_items' ); ?>" name="<?php echo $this->get_field_name( 'start_items' ); ?>" type="text" value="<?php echo $start_items; ?>" /></label>
2312
- </p>
2313
- <p>
2314
- <label for="<?php echo $this->get_field_id( 'end_items' ); ?>"><?php _e( 'After Items (HTML):',
 
 
 
 
2315
  FB_RSSI_TEXTDOMAIN ) ?>
2316
- <input class="widefat code" id="<?php echo $this->get_field_id( 'end_items' ); ?>" name="<?php echo $this->get_field_name( 'end_items' ); ?>" type="text" value="<?php echo $end_items; ?>" /></label>
2317
- </p>
2318
- <p>
2319
- <label for="<?php echo $this->get_field_id( 'start_item' ); ?>"><?php _e( 'Before Item (HTML):',
 
 
 
 
2320
  FB_RSSI_TEXTDOMAIN ) ?>
2321
- <input class="widefat code" id="<?php echo $this->get_field_id( 'start_item' ); ?>" name="<?php echo $this->get_field_name( 'start_item' ); ?>" type="text" value="<?php echo $start_item; ?>" /></label>
2322
- </p>
2323
- <p>
2324
- <label for="<?php echo $this->get_field_id( 'end_item' ); ?>"><?php _e( 'After Item (HTML):',
 
 
 
 
2325
  FB_RSSI_TEXTDOMAIN ) ?>
2326
- <input class="widefat code" id="<?php echo $this->get_field_id( 'end_item' ); ?>" name="<?php echo $this->get_field_name( 'end_item' ); ?>" type="text" value="<?php echo $end_item; ?>" /></label>
2327
- </p>
2328
- <p>
2329
- <label for="<?php echo $this->get_field_id( 'target' ); ?>"><?php _e( 'Target Attribut:',
 
 
 
 
2330
  FB_RSSI_TEXTDOMAIN ) ?>
2331
- <input class="widefat" id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" type="text" value="<?php echo esc_attr( $target ); ?>" /></label>
2332
- </p>
2333
- <p>
2334
- <label for="<?php echo $this->get_field_id( 'rel' ); ?>"><?php _e( 'Rel Attribut:',
 
 
 
 
2335
  FB_RSSI_TEXTDOMAIN ) ?>
2336
- <input class="widefat" id="<?php echo $this->get_field_id( 'rel' ); ?>" name="<?php echo $this->get_field_name( 'rel' ); ?>" type="text" value="<?php echo esc_attr( $rel ); ?>" /></label>
2337
- </p>
2338
- <p>
2339
- <label for="<?php echo $this->get_field_id( 'desc4title' ); ?>"><?php _e( 'Desc4Title:',
 
 
 
 
2340
  FB_RSSI_TEXTDOMAIN ) ?>
2341
- <select id="<?php echo $this->get_field_id( 'desc4title' ); ?>" name="<?php echo $this->get_field_name( 'desc4title' ); ?>">
2342
- <option value="0"<?php if ( ! $desc4title ) {
 
2343
  echo ' selected="selected"';
2344
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2345
- <option value="1"<?php if ( $desc4title ) {
2346
  echo ' selected="selected"';
2347
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2348
- </select>
2349
- </label>
2350
- <br />
2351
- <small><?php _e( 'Description for title-Attribut on Title-Link', FB_RSSI_TEXTDOMAIN ); ?></small>
2352
- </p>
2353
- <p>
2354
- <label for="<?php echo $this->get_field_id( 'charsetscan' ); ?>"><?php _e( 'Charsetscan:',
2355
  FB_RSSI_TEXTDOMAIN ) ?>
2356
- <select id="<?php echo $this->get_field_id( 'charsetscan' ); ?>" name="<?php echo $this->get_field_name( 'charsetscan' ); ?>">
2357
- <option value="0"<?php if ( ! $charsetscan ) {
 
2358
  echo ' selected="selected"';
2359
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2360
- <option value="1"<?php if ( $charsetscan ) {
2361
  echo ' selected="selected"';
2362
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2363
- </select>
2364
- </label>
2365
- </p>
2366
- <p>
2367
- <label for="<?php echo $this->get_field_id( 'debug' ); ?>"><?php _e( 'Debug mode:',
2368
  FB_RSSI_TEXTDOMAIN ) ?>
2369
- <select id="<?php echo $this->get_field_id( 'debug' ); ?>" name="<?php echo $this->get_field_name( 'debug' ); ?>">
2370
- <option value="0"<?php if ( ! $debug ) {
 
2371
  echo ' selected="selected"';
2372
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2373
- <option value="1"<?php if ( $debug ) {
2374
  echo ' selected="selected"';
2375
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2376
- </select>
2377
- </label>
2378
- </p>
2379
- <p>
2380
- <label for="<?php echo $this->get_field_id( 'before_noitems' ); ?>"><?php _e( 'Before <em>No</em> Items Message (HTML):',
2381
  FB_RSSI_TEXTDOMAIN ) ?>
2382
- <input class="widefat code" id="<?php echo $this->get_field_id( 'before_noitems' ); ?>" name="<?php echo $this->get_field_name( 'before_noitems' ); ?>" type="text" value="<?php echo $before_noitems; ?>" /></label>
2383
- </p>
2384
- <p>
2385
- <label for="<?php echo $this->get_field_id( 'noitems' ); ?>"><?php _e( '<em>No</em> Items Message:',
 
 
 
 
2386
  FB_RSSI_TEXTDOMAIN ) ?>
2387
- <input class="widefat" id="<?php echo $this->get_field_id( 'noitems' ); ?>" name="<?php echo $this->get_field_name( 'noitems' ); ?>" type="text" value="<?php echo esc_attr( $noitems ); ?>" /></label>
2388
- </p>
2389
- <p>
2390
- <label for="<?php echo $this->get_field_id( 'after_noitems' ); ?>"><?php _e( 'After <em>No</em> Items Message (HTML):',
 
 
 
 
2391
  FB_RSSI_TEXTDOMAIN ) ?>
2392
- <input class="widefat code" id="<?php echo $this->get_field_id( 'after_noitems' ); ?>" name="<?php echo $this->get_field_name( 'after_noitems' ); ?>" type="text" value="<?php echo $after_noitems; ?>" /></label>
2393
- </p>
2394
- <p>
2395
- <label for="<?php echo $this->get_field_id( 'before_error' ); ?>"><?php _e( 'Before Error Message (HTML):',
 
 
 
 
2396
  FB_RSSI_TEXTDOMAIN ) ?>
2397
- <input class="widefat code" id="<?php echo $this->get_field_id( 'before_error' ); ?>" name="<?php echo $this->get_field_name( 'before_error' ); ?>" type="text" value="<?php echo $before_error; ?>" /></label>
2398
- </p>
2399
- <p>
2400
- <label for="<?php echo $this->get_field_id( 'error' ); ?>"><?php _e( 'Error Message:',
 
 
 
 
2401
  FB_RSSI_TEXTDOMAIN ) ?>
2402
- <input class="widefat" id="<?php echo $this->get_field_id( 'error' ); ?>" name="<?php echo $this->get_field_name( 'error' ); ?>" type="text" value="<?php echo esc_attr( $error ); ?>" /></label>
2403
- </p>
2404
- <p>
2405
- <label for="<?php echo $this->get_field_id( 'after_error' ); ?>"><?php _e( 'After Error Message (HTML):',
 
 
 
 
2406
  FB_RSSI_TEXTDOMAIN ) ?>
2407
- <input class="widefat code" id="<?php echo $this->get_field_id( 'after_error' ); ?>" name="<?php echo $this->get_field_name( 'after_error' ); ?>" type="text" value="<?php echo $after_error; ?>" /></label>
2408
- </p>
2409
- <p>
2410
- <label for="<?php echo $this->get_field_id( 'paging' ); ?>"><?php _e( 'Pagination:',
 
 
 
 
2411
  FB_RSSI_TEXTDOMAIN ) ?>
2412
- <select id="<?php echo $this->get_field_id( 'paging' ); ?>" name="<?php echo $this->get_field_name( 'paging' ); ?>">
2413
- <option value="0"<?php if ( ! $paging ) {
 
2414
  echo ' selected="selected"';
2415
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2416
- <option value="1"<?php if ( $paging ) {
2417
  echo ' selected="selected"';
2418
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2419
- </select>
2420
- </label>
2421
- </p>
2422
- <p>
2423
- <label for="<?php echo $this->get_field_id( 'prev_paging_link' ); ?>"><?php _e( 'Previous Pagination Link String:',
2424
  FB_RSSI_TEXTDOMAIN ) ?>
2425
- <input class="widefat" id="<?php echo $this->get_field_id( 'prev_paging_link' ); ?>" name="<?php echo $this->get_field_name( 'prev_paging_link' ); ?>" type="text" value="<?php echo esc_attr( $prev_paging_link ); ?>" /></label>
2426
- </p>
2427
- <p>
2428
- <label for="<?php echo $this->get_field_id( 'next_paging_link' ); ?>"><?php _e( 'Next Pagination Link String:',
 
 
 
 
2429
  FB_RSSI_TEXTDOMAIN ) ?>
2430
- <input class="widefat" id="<?php echo $this->get_field_id( 'next_paging_link' ); ?>" name="<?php echo $this->get_field_name( 'next_paging_link' ); ?>" type="text" value="<?php echo esc_attr( $next_paging_link ); ?>" /></label>
2431
- </p>
2432
- <p>
2433
- <label for="<?php echo $this->get_field_id( 'prev_paging_title' ); ?>"><?php _e( 'Previous Pagination Title String:',
 
 
 
 
2434
  FB_RSSI_TEXTDOMAIN ) ?>
2435
- <input class="widefat" id="<?php echo $this->get_field_id( 'prev_paging_title' ); ?>" name="<?php echo $this->get_field_name( 'prev_paging_title' ); ?>" type="text" value="<?php echo esc_attr( $prev_paging_title ); ?>" /></label>
2436
- </p>
2437
- <p>
2438
- <label for="<?php echo $this->get_field_id( 'next_paging_title' ); ?>"><?php _e( 'Next Pagination Title String:',
 
 
 
 
2439
  FB_RSSI_TEXTDOMAIN ) ?>
2440
- <input class="widefat" id="<?php echo $this->get_field_id( 'next_paging_title' ); ?>" name="<?php echo $this->get_field_name( 'next_paging_title' ); ?>" type="text" value="<?php echo esc_attr( $next_paging_title ); ?>" /></label>
2441
- </p>
2442
- <p>
2443
- <label for="<?php echo $this->get_field_id( 'use_simplepie' ); ?>"><?php _e( 'Use SimplePie class:',
 
 
 
 
2444
  FB_RSSI_TEXTDOMAIN ) ?>
2445
- <select id="<?php echo $this->get_field_id( 'use_simplepie' ); ?>" name="<?php echo $this->get_field_name( 'use_simplepie' ); ?>">
2446
- <option value="0"<?php if ( ! $use_simplepie ) {
 
2447
  echo ' selected="selected"';
2448
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2449
- <option value="1"<?php if ( $use_simplepie ) {
2450
  echo ' selected="selected"';
2451
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2452
- </select>
2453
- </label>
2454
- </p>
2455
- <p>
2456
- <label for="<?php echo $this->get_field_id( 'view' ); ?>"><?php _e( 'Echo/Return:',
2457
  FB_RSSI_TEXTDOMAIN ) ?>
2458
- <select id="<?php echo $this->get_field_id( 'view' ); ?>" name="<?php echo $this->get_field_name( 'view' ); ?>">
2459
- <option value="0"<?php if ( ! $view ) {
 
2460
  echo ' selected="selected"';
2461
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2462
- <option value="1"<?php if ( $view ) {
2463
  echo ' selected="selected"';
2464
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2465
- </select>
2466
- </label>
2467
- </p>
2468
- <p>
2469
- <label for="<?php echo $this->get_field_id( 'random_sort' ); ?>"><?php _e( 'Random Order:',
2470
  FB_RSSI_TEXTDOMAIN ) ?>
2471
- <select id="<?php echo $this->get_field_id( 'random_sort' ); ?>" name="<?php echo $this->get_field_name( 'random_sort' ); ?>">
2472
- <option value="0"<?php if ( ! $random_sort ) {
 
2473
  echo ' selected="selected"';
2474
  } ?>><?php _e( 'False', FB_RSSI_TEXTDOMAIN ); ?></option>
2475
- <option value="1"<?php if ( $random_sort ) {
2476
  echo ' selected="selected"';
2477
  } ?>><?php _e( 'True', FB_RSSI_TEXTDOMAIN ); ?></option>
2478
- </select>
2479
- </label>
2480
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
2481
  <?php
2482
-
2483
  }
2484
  }
2485
 
2486
- add_action( 'widgets_init', create_function( '', 'return register_widget("RSSImport_Widget");' ) );
2487
-
2488
  } // end if class wp_widget exists
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
  /*
17
  ------------------------------------------------------------
18
  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
 
56
 
57
  // plugin definitions
58
  define( 'FB_RSSI_BASENAME', plugin_basename( __FILE__ ) );
59
+ define( 'FB_RSSI_BASEFOLDER', plugin_basename( __DIR__ ) );
60
  define( 'FB_RSSI_TEXTDOMAIN', 'rssimport' );
61
  define( 'FB_RSSI_QUICKTAG', true );
62
  }
63
 
64
  function RSSImport_textdomain() {
 
65
  if ( function_exists( 'load_plugin_textdomain' ) ) {
66
  load_plugin_textdomain( FB_RSSI_TEXTDOMAIN, false, dirname( FB_RSSI_BASENAME ) . '/languages' );
67
  }
74
  }
75
 
76
  /**
77
+ * @param int $display
78
+ * @param string $feedurl
79
+ * @param string $before_desc
80
+ * @param int $displaydescriptions
81
+ * @param string $after_desc
82
+ * @param int $html
83
+ * @param int $truncatedescchar
84
+ * @param string $truncatedescstring
85
+ * @param int $truncatetitlechar
86
+ * @param string $truncatetitlestring
87
+ * @param string $before_date
88
+ * @param int $date
89
+ * @param string $after_date
90
+ * @param string $date_format
91
+ * @param string $before_creator
92
  * @param int|string $creator
93
+ * @param string $after_creator
94
+ * @param string $start_items
95
+ * @param string $end_items
96
+ * @param string $start_item
97
+ * @param string $end_item
98
+ * @param string $target
99
+ * @param string $rel
100
+ * @param int $desc4title
101
+ * @param int $charsetscan
102
+ * @param int $debug
103
+ * @param string $before_noitems
104
+ * @param string $noitems
105
+ * @param string $after_noitems
106
+ * @param string $before_error
107
+ * @param string $error
108
+ * @param string $after_error
109
+ * @param int $paging
110
+ * @param string $prev_paging_link
111
+ * @param string $next_paging_link
112
+ * @param string $prev_paging_title
113
+ * @param string $next_paging_title
114
+ * @param int $use_simplepie
115
+ * @param int $view
116
+ * @param int $random_sort
117
+ * @param string $order
118
  *
119
  * @return string
120
  */
121
  function RSSImport(
122
  $display = 5,
123
+ $feedurl = 'https://bueltge.de/feed/',
124
  $before_desc = '',
125
  $displaydescriptions = 0,
126
  $after_desc = '',
149
  $noitems = 'No items, feed is empty.',
150
  $after_noitems = '</p>',
151
  $before_error = '<p>',
152
+ $error = 'Error: Feed has an error or is not valid.',
153
  $after_error = '</p>',
154
  $paging = 0,
155
  $prev_paging_link = '&laquo; Previous',
158
  $next_paging_title = 'more items',
159
  $use_simplepie = 1,
160
  $view = 1,
161
+ $random_sort = 0,
162
+ $order = 'date,title,creator,description'
163
  ) {
 
164
  // replace for yahoo pipes urls
165
  $feedurl = str_replace( '&#038;', '&', $feedurl );
166
 
186
  if ( file_exists( ABSPATH . WPINC . '/class-simplepie.php' ) ) {
187
  @require ABSPATH . WPINC . '/class-simplepie.php';
188
  } else {
189
+ wp_die( __( 'Error in file: '
190
+ . __FILE__
191
+ . ' on line: '
192
+ . __LINE__
193
+ . '.<br />The WordPress file "class-simplepie.php" with class SimplePie could not be included.' ) );
194
  }
195
  }
196
+ } elseif ( file_exists( ABSPATH . WPINC . '/rss.php' ) ) {
197
+ require_once ABSPATH . WPINC . '/rss.php';
198
+ // It's WordPress 2.x. since it has been loaded successfully
199
+ } elseif ( file_exists( ABSPATH . WPINC . '/rss-functions.php' ) ) {
200
+ require_once ABSPATH . WPINC . '/rss-functions.php';
201
+ // In WordPress < 2.1
202
  } else {
203
+ wp_die( __( 'Error in file: ' . __FILE__ . ' on line: ' . __LINE__
204
+ . '.<br>The WordPress file "rss-functions.php" or "rss.php" could not be included.' ) );
 
 
 
 
 
 
 
 
 
205
  }
206
 
207
  $display = (int) $display;
208
+ $page = ( ( ! empty( $_GET['rsspage'] ) && (int) $_GET['rsspage'] > 0 )
209
+ ? (int) $_GET['rsspage']
210
+ : 1 );
211
  $truncatedescchar = (int) $truncatedescchar;
212
  $truncatetitlechar = (int) $truncatetitlechar;
213
  $echo = '<!--via MagpieRSS with RSSImport-->';
230
  }
231
 
232
  if ( $rss && ! is_wp_error( $rss ) ) {
 
233
  // the follow print_r list all items in array, for debug purpose
234
  if ( $debug ) {
235
  print '<pre>';
254
  $displayitems = $display;
255
  $displaylimit = ( $page * $display );
256
  $display = ( ( $page - 1 ) * $display );
257
+ $picked = [];
 
 
 
 
258
 
259
+ if ( $use_simplepie && ( 1 === $paging || $random_sort ) ) {
 
 
260
  /** @var SimplePie $rss */
261
  $items = $rss->get_items();
262
  } elseif ( $use_simplepie ) {
266
  /** @var MagpieRSS $rss */
267
  $items = $rss->items;
268
  }
269
+ $cnt_items = count( $items );
270
 
271
  while ( $display < $displaylimit ) {
 
272
  $i = $display;
273
+ if ( $random_sort ) {
274
+ do {
275
+ $i = mt_rand( 0, $cnt_items - 1 );
276
+ } while ( in_array( $i, $picked, true ) && count( $picked ) < $cnt_items );
277
  $picked[] = $i;
278
+ }
279
 
280
  if ( array_key_exists( $i, $items ) ) {
 
281
  if ( $use_simplepie ) {
282
  /** @var SimplePie $rss */
283
  $item = $rss->get_item( $i );
289
  $title = '';
290
  if ( $use_simplepie ) {
291
  $title = esc_attr( strip_tags( $item->get_title() ) );
292
+ } elseif ( isset( $item['title'] ) ) {
293
+ $title = esc_attr( strip_tags( $item['title'] ) );
294
  }
295
  // import link
296
  $href = '';
297
  if ( $use_simplepie ) {
298
  $href = wp_filter_kses( $item->get_link() );
299
+ } elseif ( isset( $item['link'] ) ) {
300
+ $href = wp_filter_kses( $item['link'] );
301
  }
302
  // import picture_url
303
  $picture_url = '';
305
  $picture_url = wp_filter_kses( $enclosure->get_thumbnail() );
306
  }
307
 
308
+ $start_item_temp = str_replace( [ '%title%', '%href%', '%picture_url%' ],
309
+ [ $title, $href, $picture_url ],
310
+ $start_item );
311
  $echo .= $start_item_temp;
312
 
313
  // import date
314
  if ( $use_simplepie && $date ) {
315
  $pubDate = date_i18n( $date_format, strtotime( $item->get_date() ) );
316
+ } elseif ( $date && isset( $item['pubdate'] ) ) {
317
+ $pubDate = date_i18n( $date_format, strtotime( $item['pubdate'] ) );
318
  }
319
  // import creator
320
  if ( $use_simplepie && $creator ) {
321
  /** @var SimplePie $item */
322
+ $creator = ' <cite>' . esc_html( strip_tags( $item->get_author()->get_name() ) ) . '</cite>';
323
+ } elseif ( $creator && isset( $item['dc']['creator'] ) ) {
324
+ $creator = esc_html( $item['dc']['creator'] );
325
+ } elseif ( $creator && isset( $item['creator'] ) ) {
326
+ $creator = esc_html( $item['creator'] );
 
 
 
 
327
  }
328
  // import desc
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
+ ' ',
336
  esc_attr( strip_tags(
337
  @html_entity_decode(
338
  $item->get_description(),
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'] ) ) {
360
+ $desc = $item['content'];
361
+ } elseif ( $displaydescriptions && $html && isset( $item['description'] ) ) {
362
+ $desc = $item['description'];
363
+ } elseif ( $displaydescriptions && ! $html && isset( $item['description'] ) ) {
364
+ $desc = esc_html( strip_tags( $item['description'] ) );
365
  } // For import without HTML
366
 
367
  if ( isset( $a ) && false !== stripos( $a, 'ISO' ) ) {
414
  $desc = '';
415
  if ( $use_simplepie ) {
416
  $desc = str_replace(
417
+ [ "\n", "\r" ],
418
  ' ',
419
  esc_attr( strip_tags(
420
  @html_entity_decode(
426
  )
427
  );
428
  } // For import without HTML
429
+ elseif ( isset( $item['description'] ) ) {
430
+ $desc = esc_html( strip_tags( $item['description'] ) );
431
  }
432
  $atitle = wp_html_excerpt( $desc, $truncatedescchar ) . $truncatedescstring;
433
  } else {
434
  $atitle = $title;
435
  }
436
 
437
+ // Read order settings and rearrange them before output.
438
+ $order_array = explode( ',', $order );
439
+ foreach ( $order_array as $objects ) {
440
+ switch ( $objects ) {
441
+ case 'date':
442
+ if ( isset( $pubDate ) && $date && '' !== $pubDate ) {
443
+ $echo .= $before_date . $pubDate . $after_date;
444
+ }
445
+ break;
446
+ case 'title':
447
+ $echo .= '<a'
448
+ . $target
449
+ . $rel
450
+ . ' href="'
451
+ . $href
452
+ . '" title="'
453
+ . $atitle
454
+ . '">'
455
+ . $title
456
+ . '</a>';
457
+ break;
458
+ case 'creator':
459
+ if ( isset( $creator ) && $creator && '' !== $creator ) {
460
+ $echo .= $before_creator . $creator . $after_creator;
461
+ }
462
+ break;
463
+ case 'description':
464
+ if ( isset( $desc ) && $displaydescriptions && '' !== $desc ) {
465
+ $after_desc_temp = stripslashes_deep( $after_desc );
466
+ $after_desc_temp = str_replace( [ '%title%', '%href%', '%picture_url%' ],
467
+ [ $title, $href, $picture_url ],
468
+ $after_desc_temp );
469
+ $before_desc_temp = str_replace( [ '%title%', '%href%', '%picture_url%' ],
470
+ [ $title, $href, $picture_url ],
471
+ $before_desc );
472
+ $echo .= $before_desc_temp . $desc . $after_desc_temp;
473
+ }
474
+ break;
475
+ }
476
  }
477
+
478
+ $end_item_temp = str_replace( [ '%title%', '%href%', '%picture_url%' ],
479
+ [ $title, $href, $picture_url ],
480
+ $end_item );
481
  $echo .= $end_item_temp;
 
 
482
  }
483
 
484
  $display ++;
489
  } else {
490
  $echo = wptexturize( $before_noitems . $noitems . $after_noitems );
491
  }
 
492
  } else {
493
  /** @noinspection MissingIssetImplementationInspection */
494
  if ( empty( $rss->ERROR ) ) {
495
+ $rss->ERROR = null;
496
  }
497
  $echo = wptexturize( $before_error . $error . $rss->ERROR . $after_error );
498
  }
499
 
500
  if ( $paging ) {
501
+ $nextitems = true;
502
+ $previousitems = false;
503
+ if ( $page > 1 ) {
504
+ $previousitems = true;
505
+ }
506
  $echo .= '<div class="rsspaging">';
507
  if ( $previousitems ) {
508
+ $echo .= '<a href="'
509
+ . add_query_arg( 'rsspage',
510
+ ( $page - 1 ) )
511
+ . '" class="rsspaging_prev" title="'
512
+ . $prev_paging_title
513
+ . '">'
514
+ . $prev_paging_link
515
+ . '</a>';
516
  }
517
  if ( $nextitems ) {
518
+ $echo .= '<a href="'
519
+ . add_query_arg( 'rsspage',
520
+ ( $page + 1 ) )
521
+ . '" class="rsspaging_next" title="'
522
+ . $next_paging_title
523
+ . '">'
524
+ . $next_paging_link
525
+ . '</a>';
526
  }
527
  $echo .= '<br style="clear: both" />';
528
  $echo .= '</div>';
530
 
531
  if ( $view ) {
532
  echo $echo;
 
 
533
  }
534
+ return $echo;
535
  }
536
 
537
+ /**
538
+ * @param $s_String
539
+ *
540
+ * @return false|string
541
+ */
542
  function utf8dec( $s_String ) {
 
543
  if ( PHP_VERSION_ID >= 50000 ) {
544
  $s_String = html_entity_decode(
545
  htmlentities( $s_String . ' ', ENT_COMPAT, 'UTF-8' )
551
  return substr( $s_String, 0, - 1 );
552
  }
553
 
554
+ /**
555
+ * @param $s_String
556
+ *
557
+ * @return false|string
558
+ */
559
  function isodec( $s_String ) {
 
560
  if ( PHP_VERSION_ID >= 50000 ) {
561
  $s_String = html_entity_decode( htmlentities( $s_String . ' ', ENT_COMPAT, 'ISO-8859-1' ) );
562
  } else {
566
  return substr( $s_String, 0, - 1 );
567
  }
568
 
569
+ /**
570
+ * @param $s_String
571
+ *
572
+ * @return string|string[]|null
573
+ */
574
  function all_convert( $s_String ) {
 
575
  // Array for entities
576
+ $umlaute = [
577
  '„',
578
  '“',
579
  '–',
957
  chr( 253 ),
958
  chr( 254 ),
959
  chr( 255 ),
960
+ chr( 256 ),
961
+ ];
962
 
963
+ $htmlcode = [
964
  '&bdquo;',
965
  '&ldquo;',
966
  '&ndash;',
1343
  '&uuml;',
1344
  '&yacute;',
1345
  '&thorn;',
1346
+ '&yuml;',
1347
+ ];
1348
 
1349
+ if ( PHP_VERSION_ID >= 50000 ) {
 
1350
  $s_String = utf8_encode( html_entity_decode( str_replace( $umlaute, $htmlcode, $s_String ) ) );
1351
  } else {
1352
  $s_String = utf8_encode( RSSImport_html_entity_decode_php4( str_replace( $umlaute, $htmlcode, $s_String ) ) );
1359
 
1360
  // &mdash; , &#8212;
1361
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9D~', '&mdash;', $s_String );
1362
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC2\x9D~',
1363
+ '&mdash;',
1364
  $s_String );
1365
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x80\x9D~', '&mdash;', $s_String );
1366
 
1367
  // &ndash; , &#8211;
1368
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9C~', '&ndash;', $s_String );
1369
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC5\x93~',
1370
+ '&ndash;',
1371
  $s_String );
1372
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x80\x9C~', '&ndash;', $s_String );
1373
 
1374
  // &rsquo; , &#8217;
1375
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2~', '&rsquo;', $s_String );
1376
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x80\x9E\xC2\xA2~',
1377
+ '&rsquo;',
1378
  $s_String );
1379
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x84\xA2~', '&rsquo;', $s_String );
1380
  $s_String = preg_replace( '~\xD0\xBF\xD1\x97\xD0\x85~', '&rsquo;', $s_String );
1390
 
1391
  // &ldquo; , &#8220;
1392
  $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ldquo;', $s_String );
1393
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x85\xE2\x80\x9C~',
1394
+ '&ldquo;',
1395
  $s_String );
1396
  $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xD1\x9A~', '&ldquo;', $s_String );
1397
 
1422
  * @return string
1423
  */
1424
  function RSSImport_end_on_word( $str ) {
 
1425
  $arr = explode( ' ', trim( $str ) );
1426
  array_pop( $arr );
1427
 
1429
  }
1430
 
1431
  function RSSImport_Shortcode( $atts ) {
 
1432
  $args = shortcode_atts(
1433
+ [
1434
  'display' => 5,
1435
+ 'feedurl' => 'https://bueltge.de/feed/',
1436
  'before_desc' => '<br />',
1437
  'displaydescriptions' => 0,
1438
  'after_desc' => '',
1461
  'noitems' => __( 'No items, feed is empty.', FB_RSSI_TEXTDOMAIN ),
1462
  'after_noitems' => '</p>',
1463
  'before_error' => '<p>',
1464
+ 'error' => __( 'Error: Feed has an error or is not valid.',
1465
  FB_RSSI_TEXTDOMAIN ),
1466
  'after_error' => '</p>',
1467
  'paging' => 0,
1472
  'use_simplepie' => 1,
1473
  'view' => 0,
1474
  'random_sort' => 0,
1475
+ 'order' => 'date,title,creator,description',
1476
+ ],
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'];
1517
+ $start_item = $args['start_item'];
1518
+ $end_item = $args['end_item'];
1519
+ $target = $args['target'];
1520
+ $rel = $args['rel'];
1521
+ $desc4title = $args['desc4title'];
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'];
1533
+ $before_error = $args['before_error'];
1534
+ $error = $args['error'];
1535
+ $after_error = $args['after_error'];
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
  }
1543
+ $prev_paging_link = $args['prev_paging_link'];
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,
1556
+ $displaydescriptions,
1557
+ $after_desc,
1558
+ $html,
1559
+ $truncatedescchar,
1560
+ $truncatedescstring,
1561
+ $truncatetitlechar,
1562
+ $truncatetitlestring,
1563
+ $before_date,
1564
+ $date,
1565
+ $after_date,
1566
+ $date_format,
1567
+ $before_creator,
1568
+ $creator,
1569
+ $after_creator,
1570
+ $start_items,
1571
+ $end_items,
1572
+ $start_item,
1573
+ $end_item,
1574
  $target,
1575
  $rel,
1576
  $desc4title,
1577
+ $charsetscan,
1578
+ $debug,
1579
+ $before_noitems,
1580
+ $noitems,
1581
+ $after_noitems,
1582
+ $before_error,
1583
+ $error,
1584
+ $after_error,
1585
+ $paging,
1586
+ $prev_paging_link,
1587
+ $next_paging_link,
1588
+ $prev_paging_title,
1589
+ $next_paging_title,
1590
  $use_simplepie,
1591
  $view,
1592
+ $random_sort,
1593
+ $order
1594
  );
 
 
1595
  }
1596
 
1597
+ /**
1598
+ * @param $pee
1599
+ *
1600
+ * @return string|string[]|null
1601
+ */
1602
  function RSSImport_shortcode_quot( $pee ) {
 
1603
  global $shortcode_tags;
1604
 
1605
  if ( ! empty( $shortcode_tags ) && is_array( $shortcode_tags ) ) {
1606
  $tagnames = array_keys( $shortcode_tags );
1607
  $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) );
1608
  $pee = preg_replace(
1609
+ '/\\s*?(\\[(' . $tagregexp . ')\\b.*?\\/?](?:.+?\\[\\/\\2])?)\\s*/s',