RSSImport - Version 4.4.17

Version Description

Download this release

Release Info

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

Code changes from version 4.4.16 to 4.4.17

Files changed (3) hide show
  1. readme.txt +246 -241
  2. rssimport.php +1419 -1182
  3. screenshot-1.png +0 -0
readme.txt CHANGED
@@ -1,241 +1,246 @@
1
- === RSSImport ===
2
- Contributors: Bueltge, inpsyde, took77
3
- Plugin URI: http://bueltge.de/wp-rss-import-plugin/55/
4
- Author: Frank Bültge
5
- Author URI: http://bueltge.de/
6
- Donate link: http://bueltge.de/wunschliste/
7
- Tags: rss, post, content, post, feed
8
- Requires at least: 1.5
9
- Tested up to: 4.4
10
- Stable tag: 4.4.16
11
-
12
- Import and display feeds on your blog, using PHP in your templates or Shortcode in your posts and pages.
13
-
14
- == Description ==
15
- Import and 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
-
19
- You can insert the following code into a PHP plugin or in a template, for example `sidebar.php` or `single.php`:
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/"]`
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.
38
- 1. `html` - (bool) When set to true, the description can include HTML tags. Default is `false`.
39
- 1. `truncatedescchar` - The maximum number of characters allowed in descriptions. If the description is longer than this length, it will be truncated to the given length. Default is `200`, set the value to empty quotes `''` to never truncate descriptions.
40
- 1. `truncatedescstring` - The HTML or string to insert at the end of a description after it has been truncated. Default is ` ... `
41
- 1. `truncatetitlechar` - The maximum number of characters allowed in titles. If the title is longer than this value, it will be truncated to the given length. Default is `''`, which means never truncate titles.
42
- 1. `truncatetitlestring` - The HTML or string to insert at the end of a title after it has been truncated. Default is `' ... '`.
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>`.
50
- 1. `start_items` - The HTML or string to insert before the list of items. Default is `<ul>`.
51
- 1. `end_items` - The HTML or string to insert after the list of items. Default is `</ul>`.
52
- 1. `start_item` - The HTML or string to insert before each item. Default is `<li>`. You can use some variables which will be replaced, see below.
53
- 1. `end_item` - The HTML or string to insert after each item. Default is `</li>`. You can use some variables which will be replaced, see below.
54
- 1. `target` - The string to use for the `target` attribute on links. Default is `empty`. Valid options are `blank`, `self`, `parent`, `top`.
55
- 1. `rel` - The string to use for the `rel` attribute on links. Default is `empty`. Valid options are `nofollow` and `follow`.
56
- 1. `desc4title` - The description to use in the `title` attribute on item title links. Default is `false`.
57
- 1. `charsetscan` - (bool) If true, scan the feed content for the correct character set. This may cause the content to load more slowly. Use this option if you're having problems with feed content being displayed with stranged characters. Default is `false`.
58
- 1. `debug` - (bool) If true, activate debug-mode, which will echo the Magpie object as an array. Default is `false`. Only use this option for debugging.
59
- 1. `before_noitems` - The HTML or string to insert before the no items message. Default is `<p>`.
60
- 1. `noitems`- The message to display when the feed is empty. Default is `No items, feed is empty.`.
61
- 1. `after_noitems` - The HTML or string to insert before the no items message. Default is `</p>`.
62
- 1. `before_error` - The HTML or string to insert before the error message. Default is `<p>`.
63
- 1. `error` - Error message displayed when there is an error loading or displaying the feed. Default is `Error: Feed has an error or is not valid`.
64
- 1. `after_error` - The HTML or string to insert before the error message. Default is `</p>`.
65
- 1. `paging` - (bool) If true, enable pagination. Default is `false`.
66
- 1. `prev_paging_link` - The name of the previous page link. Default is `&laquo; Previous`.
67
- 1. `next_paging_link` - The name next page link. Default is `Next &raquo;`.
68
- 1. `prev_paging_title` - The title attribute of the previous page link. Default is `more items`.
69
- 1. `next_paging_title` - The title attribute of the next page link. Default is `more items`.
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
-
73
- The parameters `before_desc`, `after_desc`, `start_item` and `end_item` accepts the following variables which will be replaced:
74
-
75
-
76
- 1. `%title%` for the title of the entry
77
- 1. `%href%` for the entry's URL
78
- 1. `%picture_url%` for the URL of a thumbnail image for the entry if available. To use this variable, SimplePie is required to be enabled (`use_simplepie="true"`)
79
-
80
-
81
- If pagination is enabled, it adds a `div` with the class `rsspaging` to enable easier styling with CSS. You can also style the previous and next links, which have the classes: `rsspaging_prev` and `rsspaging_next`.
82
-
83
- You can use any of the parameters in the php function `RSSImport()` in your templates or with the Shortcode `[RSSImport]` in posts and pages.
84
-
85
- = Examples =
86
- _Using the PHP function with many parameters:_
87
-
88
- RSSImport(
89
- $display = 5, $feedurl = 'http://bueltge.de/feed/',
90
- $before_desc = '', $displaydescriptions = false, $after_desc = '', $html = false, $truncatedescchar = 200, $truncatedescstring = ' ... ',
91
- $truncatetitlechar = '', $truncatetitlestring = ' ... ',
92
- $before_date = ' <small>', $date = false, $after_date = '</small>',
93
- $before_creator = ' <small>', $creator = false, $after_creator = '</small>',
94
- $start_items = '<ul>', $end_items = '</ul>',
95
- $start_item = '<li>', $end_item = '</li>'
96
- );
97
-
98
- Please note that for the PHP function the parameters are expected in the order in which they are defined in the above list. Thus if you skip one parameter, you will also have to skip all of the subsequent parameters.
99
-
100
- _Using Shortcode with several parameters:_
101
-
102
- [RSSImport display="10" feedurl="http://your_feed_url/"
103
- displaydescriptions="true" html="true"
104
- start_items="<ol>" end_items="</ol>" paging="true"]
105
-
106
- _Add a "more" link to the output:_
107
-
108
- RSSImport(
109
- $display = 5,
110
- $feedurl = 'http://bueltge.de/feed/',
111
- $before_desc = '',
112
- $displaydescriptions = true,
113
- $after_desc = ' <a href="%href%" target="_blank">show more</a>'
114
- );
115
-
116
- or
117
-
118
- [RSSImport feedurl="http://www.ichdruck3d.de/feed/" after_desc=" <a href='%href%' target='_blank'>show more</a>" displaydescriptions="true"]
119
-
120
- _Enable Thumbnail Pictures:_
121
-
122
- RSSImport(
123
- $display = 5,
124
- $feedurl = 'http://www.thestage.co.uk/opinion/shenton/feed/',
125
- $before_desc = '<img src="%picture_url%" alt="">',
126
- $displaydescriptions = true
127
- );
128
-
129
- or
130
-
131
- [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"]
132
-
133
- == Installation ==
134
- 1. Unpack the download package.
135
- 1. Upload all files to the `/wp-content/plugins/` directory.
136
- 1. Activate the plugin through the 'Plugins' menu in WordPress.
137
- 1. Create a new site in WordPress or edit your template.
138
- 1. Copy the code into the site content or add it to your templates.
139
-
140
-
141
- == Screenshots ==
142
- 1. Widget support
143
-
144
- == Changelog ==
145
- = v4.4.16 (09/24/2015) =
146
- * Fix the widget PHP4 style
147
-
148
- = v4.4.15 (08/22/2014) =
149
- * Added `%picture_url%` for `before_desc`, `after_desc`, `start_item` and `end_item`
150
-
151
- = v4.4.14 (07/08/2014) =
152
- * Fix typo in readme
153
- * Fix a bug with `%href%` and `%title%` in after_desc
154
- * Shortened some over-long lines in the code
155
-
156
- = v4.4.13 (08/22/2013) =
157
- * Set simplepie to default settings; is the default way of WP since lot of versions
158
- * Fix for Quicktag on Post/Page Editor; use now the core functions, there we have since WP 3.3
159
-
160
- = v4.4.12 (04/02/2012) =
161
- * Bugfix: restored RSSImport QuickTag for Wordpress 3.3 and later
162
- * Improvement: avoid PHP-notice when description is missing for an item
163
- * TODO: add parameter to allow prefix of url (see http://wordpress.org/support/topic/plugin-rssimport-fix-for-headline-links-without-full-paths)
164
- * TODO: check documentation of call to function (PHP), see http://wordpress.org/support/topic/plugin-rssimport-change-feed-display
165
- * Documentation: corrected 'after_desc' (thanks to elricky for reporting)
166
-
167
- = v4.4.11 (13/12/2011) =
168
- * Bugfix: noitems string display is back
169
- * Improvement: html_entity_decode feedurl when using shortcodes
170
- * Maintenance: Add romanian language files
171
-
172
- = v4.4.10 (01/12/2011) =
173
- * Bugfix: add param desc4title on shortcodes
174
- * Bugfix: Filter Feed-Url vor masked `&`; now works Yahoo Pipes feeds
175
- * Maintenance: Translate strings from options
176
-
177
- = v4.4.9 (09/16/2010) =
178
- * Feature: add new param `desc4title` to add the description to title-attribut on title-links
179
- * Bugfix: target parameter in widget
180
- * Maintenance: rescan/rewrite de_DE language file
181
- * Maintenance: rescan .pot
182
-
183
- = v4.4.8 (06/04/2010) =
184
- * small changes for better debugging
185
- * change metadata for WordPress
186
- * multilanguage plugin-description
187
- * change error-handling on feeds; use WP-Error
188
-
189
- = v4.4.7 (05/20/2010) =
190
- * bugfix widget parameter for description
191
- * small changes on source
192
-
193
- = v4.4.6 (07/10/2009) =
194
- * add function for WordPress lower version 2.8
195
- * add option for format the date
196
-
197
- = v4.4.5 (30/09/2009) =
198
- * bugfix Widget-title
199
- * include class SimpliePie for alternative parse
200
- * new parameter `$use_simplepie` for active parse with class SimplePie
201
- * change for boolean type, possible to use `true` or `false` and `1` or `0`
202
-
203
- = v4.4.4 (15/09/2009) =
204
- * change updatenotice to standard WP
205
-
206
- = v4.4.3 (14/09/2009) =
207
- * add strings %title% and %href% to replace in after-desc-option
208
-
209
- = v4.4.2 (07/09/2009) =
210
- * Bugfix for utl-value on shortcode
211
- * change clean the title-attribut an links for multilanguage-support
212
-
213
- = v4.4.1 (14/07/2009) =
214
-
215
- * add rel attribut for links
216
- * add widget support, WP 2.8 and higher
217
-
218
- See on [the official website](http://bueltge.de/wp-rss-import-plugin/55/#historie "RSSImport Changelog") for older entries on changelog.
219
-
220
-
221
- == Other Notes ==
222
- = Acknowledgements =
223
- 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.
224
-
225
- = Localizations =
226
- * German language files by me [Frank B&uuml;ltge](http://bueltge.de/) ;-)
227
- * Russian translation by Fat Cow
228
- * Ukrainian translation by [WordPress Ukraine](http://wpp.pp.ua/)
229
- * French translation by [Martin Korolczuk](http://petitnuage.fr)
230
- * Hungarian translation by [Feriman](http://feriman.com)
231
- * Hindi translation by [Ashish Jha](http://outshinesolutions.com)
232
- * Italian translation by [Gianni Diurno](http://gidibao.net/)
233
- * Romanian language files, thanks to [Alexander Ovsov](http://webhostinggeeks.com/)
234
- * Lithuanian translation files by [Vincent G](http://www.host1plus.com)
235
- * Portuguese translation files by [Miguel Patricio Angelo](http://www.miguelpatricio.com/)
236
-
237
- = License =
238
- 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 ;)
239
-
240
- = Translations =
241
- 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, 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.4.17
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
+
19
+ You can insert the following code into a PHP plugin or in a template, for example `sidebar.php` or `single.php`:
20
+
21
+
22
+ _Example:_
23
+ `&lt;?php RSSImport(10, 'http://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="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.
38
+ 1. `html` - (bool) When set to true, the description can include HTML tags. Default is `false`.
39
+ 1. `truncatedescchar` - The maximum number of characters allowed in descriptions. If the description is longer than this length, it will be truncated to the given length. Default is `200`, set the value to empty quotes `''` to never truncate descriptions.
40
+ 1. `truncatedescstring` - The HTML or string to insert at the end of a description after it has been truncated. Default is ` ... `
41
+ 1. `truncatetitlechar` - The maximum number of characters allowed in titles. If the title is longer than this value, it will be truncated to the given length. Default is `''`, which means never truncate titles.
42
+ 1. `truncatetitlestring` - The HTML or string to insert at the end of a title after it has been truncated. Default is `' ... '`.
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>`.
50
+ 1. `start_items` - The HTML or string to insert before the list of items. Default is `<ul>`.
51
+ 1. `end_items` - The HTML or string to insert after the list of items. Default is `</ul>`.
52
+ 1. `start_item` - The HTML or string to insert before each item. Default is `<li>`. You can use some variables which will be replaced, see below.
53
+ 1. `end_item` - The HTML or string to insert after each item. Default is `</li>`. You can use some variables which will be replaced, see below.
54
+ 1. `target` - The string to use for the `target` attribute on links. Default is `empty`. Valid options are `blank`, `self`, `parent`, `top`.
55
+ 1. `rel` - The string to use for the `rel` attribute on links. Default is `empty`. Valid options are `nofollow` and `follow`.
56
+ 1. `desc4title` - The description to use in the `title` attribute on item title links. Default is `false`.
57
+ 1. `charsetscan` - (bool) If true, scan the feed content for the correct character set. This may cause the content to load more slowly. Use this option if you're having problems with feed content being displayed with stranged characters. Default is `false`.
58
+ 1. `debug` - (bool) If true, activate debug-mode, which will echo the Magpie object as an array. Default is `false`. Only use this option for debugging.
59
+ 1. `before_noitems` - The HTML or string to insert before the no items message. Default is `<p>`.
60
+ 1. `noitems`- The message to display when the feed is empty. Default is `No items, feed is empty.`.
61
+ 1. `after_noitems` - The HTML or string to insert before the no items message. Default is `</p>`.
62
+ 1. `before_error` - The HTML or string to insert before the error message. Default is `<p>`.
63
+ 1. `error` - Error message displayed when there is an error loading or displaying the feed. Default is `Error: Feed has an error or is not valid`.
64
+ 1. `after_error` - The HTML or string to insert before the error message. Default is `</p>`.
65
+ 1. `paging` - (bool) If true, enable pagination. Default is `false`.
66
+ 1. `prev_paging_link` - The name of the previous page link. Default is `&laquo; Previous`.
67
+ 1. `next_paging_link` - The name next page link. Default is `Next &raquo;`.
68
+ 1. `prev_paging_title` - The title attribute of the previous page link. Default is `more items`.
69
+ 1. `next_paging_title` - The title attribute of the next page link. Default is `more items`.
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
+
73
+ The parameters `before_desc`, `after_desc`, `start_item` and `end_item` accepts the following variables which will be replaced:
74
+
75
+
76
+ 1. `%title%` for the title of the entry
77
+ 1. `%href%` for the entry's URL
78
+ 1. `%picture_url%` for the URL of a thumbnail image for the entry if available. To use this variable, SimplePie is required to be enabled (`use_simplepie="true"`)
79
+
80
+
81
+ If pagination is enabled, it adds a `div` with the class `rsspaging` to enable easier styling with CSS. You can also style the previous and next links, which have the classes: `rsspaging_prev` and `rsspaging_next`.
82
+
83
+ You can use any of the parameters in the php function `RSSImport()` in your templates or with the Shortcode `[RSSImport]` in posts and pages.
84
+
85
+ = Examples =
86
+ _Using the PHP function with many parameters:_
87
+
88
+ RSSImport(
89
+ $display = 5, $feedurl = 'http://bueltge.de/feed/',
90
+ $before_desc = '', $displaydescriptions = false, $after_desc = '', $html = false, $truncatedescchar = 200, $truncatedescstring = ' ... ',
91
+ $truncatetitlechar = '', $truncatetitlestring = ' ... ',
92
+ $before_date = ' <small>', $date = false, $after_date = '</small>',
93
+ $before_creator = ' <small>', $creator = false, $after_creator = '</small>',
94
+ $start_items = '<ul>', $end_items = '</ul>',
95
+ $start_item = '<li>', $end_item = '</li>'
96
+ );
97
+
98
+ Please note that for the PHP function the parameters are expected in the order in which they are defined in the above list. Thus if you skip one parameter, you will also have to skip all of the subsequent parameters.
99
+
100
+ _Using Shortcode with several parameters:_
101
+
102
+ [RSSImport display="10" feedurl="http://your_feed_url/"
103
+ displaydescriptions="true" html="true"
104
+ start_items="<ol>" end_items="</ol>" paging="true" use_simplepie="true"]
105
+
106
+ _Add a "more" link to the output:_
107
+
108
+ RSSImport(
109
+ $display = 5,
110
+ $feedurl = 'http://bueltge.de/feed/',
111
+ $before_desc = '',
112
+ $displaydescriptions = true,
113
+ $after_desc = ' <a href="%href%" target="_blank">show more</a>'
114
+ );
115
+
116
+ or
117
+
118
+ [RSSImport feedurl="http://www.ichdruck3d.de/feed/" after_desc=" <a href='%href%' target='_blank'>show more</a>" displaydescriptions="true" use_simplepie="true"]
119
+
120
+ _Enable Thumbnail Pictures:_
121
+
122
+ RSSImport(
123
+ $display = 5,
124
+ $feedurl = 'http://www.thestage.co.uk/opinion/shenton/feed/',
125
+ $before_desc = '<img src="%picture_url%" alt="">',
126
+ $displaydescriptions = true
127
+ );
128
+
129
+ or
130
+
131
+ [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"]
132
+
133
+ == Installation ==
134
+ 1. Unpack the download package.
135
+ 1. Upload all files to the `/wp-content/plugins/` directory.
136
+ 1. Activate the plugin through the 'Plugins' menu in WordPress.
137
+ 1. Create a new site in WordPress or edit your template.
138
+ 1. Copy the code into the site content or add it to your templates.
139
+
140
+
141
+ == Screenshots ==
142
+ 1. Widget support
143
+
144
+ == Changelog ==
145
+ = v4.4.17 (2016-04-17) =
146
+ * Fix for usage under php 7*
147
+ * Code Formatting, WP Codex
148
+ * *You should always use SimplePie library as Feed Parser - check your parameter.*
149
+
150
+ = v4.4.16 (09/24/2015) =
151
+ * Fix the widget PHP4 style
152
+
153
+ = v4.4.15 (08/22/2014) =
154
+ * Added `%picture_url%` for `before_desc`, `after_desc`, `start_item` and `end_item`
155
+
156
+ = v4.4.14 (07/08/2014) =
157
+ * Fix typo in readme
158
+ * Fix a bug with `%href%` and `%title%` in after_desc
159
+ * Shortened some over-long lines in the code
160
+
161
+ = v4.4.13 (08/22/2013) =
162
+ * Set simplepie to default settings; is the default way of WP since lot of versions
163
+ * Fix for Quicktag on Post/Page Editor; use now the core functions, there we have since WP 3.3
164
+
165
+ = v4.4.12 (04/02/2012) =
166
+ * Bugfix: restored RSSImport QuickTag for Wordpress 3.3 and later
167
+ * Improvement: avoid PHP-notice when description is missing for an item
168
+ * TODO: add parameter to allow prefix of url (see http://wordpress.org/support/topic/plugin-rssimport-fix-for-headline-links-without-full-paths)
169
+ * TODO: check documentation of call to function (PHP), see http://wordpress.org/support/topic/plugin-rssimport-change-feed-display
170
+ * Documentation: corrected 'after_desc' (thanks to elricky for reporting)
171
+
172
+ = v4.4.11 (13/12/2011) =
173
+ * Bugfix: noitems string display is back
174
+ * Improvement: html_entity_decode feedurl when using shortcodes
175
+ * Maintenance: Add romanian language files
176
+
177
+ = v4.4.10 (01/12/2011) =
178
+ * Bugfix: add param desc4title on shortcodes
179
+ * Bugfix: Filter Feed-Url vor masked `&`; now works Yahoo Pipes feeds
180
+ * Maintenance: Translate strings from options
181
+
182
+ = v4.4.9 (09/16/2010) =
183
+ * Feature: add new param `desc4title` to add the description to title-attribut on title-links
184
+ * Bugfix: target parameter in widget
185
+ * Maintenance: rescan/rewrite de_DE language file
186
+ * Maintenance: rescan .pot
187
+
188
+ = v4.4.8 (06/04/2010) =
189
+ * small changes for better debugging
190
+ * change metadata for WordPress
191
+ * multilanguage plugin-description
192
+ * change error-handling on feeds; use WP-Error
193
+
194
+ = v4.4.7 (05/20/2010) =
195
+ * bugfix widget parameter for description
196
+ * small changes on source
197
+
198
+ = v4.4.6 (07/10/2009) =
199
+ * add function for WordPress lower version 2.8
200
+ * add option for format the date
201
+
202
+ = v4.4.5 (30/09/2009) =
203
+ * bugfix Widget-title
204
+ * include class SimpliePie for alternative parse
205
+ * new parameter `$use_simplepie` for active parse with class SimplePie
206
+ * change for boolean type, possible to use `true` or `false` and `1` or `0`
207
+
208
+ = v4.4.4 (15/09/2009) =
209
+ * change updatenotice to standard WP
210
+
211
+ = v4.4.3 (14/09/2009) =
212
+ * add strings %title% and %href% to replace in after-desc-option
213
+
214
+ = v4.4.2 (07/09/2009) =
215
+ * Bugfix for utl-value on shortcode
216
+ * change clean the title-attribut an links for multilanguage-support
217
+
218
+ = v4.4.1 (14/07/2009) =
219
+
220
+ * add rel attribut for links
221
+ * add widget support, WP 2.8 and higher
222
+
223
+ See on [the official website](http://bueltge.de/wp-rss-import-plugin/55/#historie "RSSImport Changelog") for older entries on changelog.
224
+
225
+
226
+ == Other Notes ==
227
+ = Acknowledgements =
228
+ 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.
229
+
230
+ = Localizations =
231
+ * German language files by me [Frank B&uuml;ltge](http://bueltge.de/) ;-)
232
+ * Russian translation by Fat Cow
233
+ * Ukrainian translation by [WordPress Ukraine](http://wpp.pp.ua/)
234
+ * French translation by [Martin Korolczuk](http://petitnuage.fr)
235
+ * Hungarian translation by [Feriman](http://feriman.com)
236
+ * Hindi translation by [Ashish Jha](http://outshinesolutions.com)
237
+ * Italian translation by [Gianni Diurno](http://gidibao.net/)
238
+ * Romanian language files, thanks to [Alexander Ovsov](http://webhostinggeeks.com/)
239
+ * Lithuanian translation files by [Vincent G](http://www.host1plus.com)
240
+ * Portuguese translation files by [Miguel Patricio Angelo](http://www.miguelpatricio.com/)
241
+
242
+ = License =
243
+ 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 ;)
244
+
245
+ = Translations =
246
+ 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).
rssimport.php CHANGED
@@ -1,20 +1,15 @@
1
<?php
2
- /**
3
- * @package WP-RSSImport
4
- * @author Frank Bültge
5
- */
6
-
7
/**
8
* Plugin Name: WP-RSSImport
9
- * Plugin URI: http://bueltge.de/wp-rss-import-plugin/55/
10
* Text Domain: rssimport
11
* Domain Path: /languages
12
- * Description: Import and display Feeds in your blog, use the function RSSImport(), a Widget or Shortcode [RSSImport].
13
* Author: Frank Bültge, took77
14
- * Version: 4.4.16
15
- * License: GPLv2+
16
- * Last change: 09/24/2015
17
- */
18
19
/*
20
------------------------------------------------------------
@@ -23,7 +18,6 @@
23
Original and Idea: Dave Wolf, http://www.davewolf.net
24
Thx to Thomas Fischer, http://www.securityfocus.de and
25
Gunnar Tillmann http://www.gunnart.de for a better code
26
-
27
Paging: Ilya Shindyapin, http://skookum.com
28
29
------------------------------------------------------------
@@ -33,29 +27,35 @@ Example: <?php RSSImport(10, "http://bueltge.de/feed/"); ?>
33
*/
34
35
//avoid direct calls to this file, because now WP core and framework has been used
36
- if ( ! function_exists('add_action') ) {
37
- header('Status: 403 Forbidden');
38
- header('HTTP/1.1 403 Forbidden');
39
exit();
40
}
41
42
- if ( function_exists('add_action') ) {
43
//WordPress definitions
44
- if ( !defined('WP_CONTENT_URL') )
45
- define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
46
- if ( !defined('WP_CONTENT_DIR') )
47
- define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
48
- if ( !defined('WP_PLUGIN_URL') )
49
- define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');
50
- if ( !defined('WP_PLUGIN_DIR') )
51
- define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins');
52
- if ( !defined('PLUGINDIR') )
53
- define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
54
- if ( !defined('WP_LANG_DIR') )
55
- define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages');
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 );
@@ -63,561 +63,649 @@ if ( function_exists('add_action') ) {
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
- }
69
-
70
- if ( ! function_exists('esc_attr') ) {
71
- function esc_attr( $text ) {
72
- return attribute_escape( $text );
73
}
74
}
75
76
- if ( ! function_exists('esc_url') ) {
77
- function esc_url($text ) {
78
- return clean_url($text);
79
- }
80
}
81
82
-
83
- // cache and error report
84
- //define('MAGPIE_CACHE_ON', FALSE); // Cache off
85
- if ( ! defined('MAGPIE_CACHE_AGE') )
86
- define('MAGPIE_CACHE_AGE', '60*60'); // in sec, one hour
87
- // error reporting
88
- //error_reporting(E_ALL);
89
-
90
function RSSImport(
91
- $display = 5,
92
- $feedurl = 'http://bueltge.de/feed/',
93
- $before_desc = '',
94
- $displaydescriptions = 0,
95
- $after_desc = '',
96
- $html = 0,
97
- $truncatedescchar = 200,
98
- $truncatedescstring = ' ... ',
99
- $truncatetitlechar = '',
100
- $truncatetitlestring = ' ... ',
101
- $before_date = ' <small>',
102
- $date = 0,
103
- $after_date = '</small>',
104
- $date_format = '',
105
- $before_creator = ' <small>',
106
- $creator = 0,
107
- $after_creator = '</small>',
108
- $start_items = '<ul>',
109
- $end_items = '</ul>',
110
- $start_item = '<li>',
111
- $end_item = '</li>',
112
- $target = '',
113
- $rel = '',
114
- $desc4title = 0,
115
- $charsetscan = 0,
116
- $debug = 0,
117
- $before_noitems = '<p>',
118
- $noitems = 'No items, feed is empty.',
119
- $after_noitems = '</p>',
120
- $before_error = '<p>',
121
- $error = 'Error: Feed has an error or is not valid',
122
- $after_error = '</p>',
123
- $paging = 0,
124
- $prev_paging_link = '&laquo; Previous',
125
- $next_paging_link = 'Next &raquo;',
126
- $prev_paging_title = 'more items',
127
- $next_paging_title = 'more items',
128
- $use_simplepie = 1,
129
- $view = 1
130
- ) {
131
-
132
// replace for yahoo pipes urls
133
- $feedurl = str_replace('&#038;', '&', $feedurl);
134
-
135
- $display = (int) $display;
136
$displaydescriptions = (int) $displaydescriptions;
137
- $html = (int) $html;
138
- $truncatedescchar = (int) $truncatedescchar;
139
- $truncatetitlechar = (int) $truncatetitlechar;
140
- $date = (int) $date;
141
- if ( $date_format == '' )
142
- $date_format = get_option('date_format');
143
- $creator = (int) $creator;
144
- $charsetscan = (int) $charsetscan;
145
- $debug = (int) $debug;
146
- $paging = (int) $paging;
147
$use_simplepie = (int) $use_simplepie;
148
- $view = (int) $view;
149
-
150
- if ($use_simplepie) {
151
- if ( ! class_exists('SimplePie') ) {
152
- if ( file_exists(ABSPATH . WPINC . '/class-simplepie.php') ) {
153
- @require_once (ABSPATH . WPINC . '/class-simplepie.php');
154
} else {
155
- die (__('Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The WordPress file "class-simplepie.php" with class SimplePie could not be included.'));
156
}
157
}
158
} else {
159
// For function fetch_rss from wp-core
160
- if ( file_exists(ABSPATH . WPINC . '/rss.php') ) {
161
- @require_once (ABSPATH . WPINC . '/rss.php');
162
// It's Wordpress 2.x. since it has been loaded successfully
163
- } elseif (file_exists(ABSPATH . WPINC . '/rss-functions.php')) {
164
- @require_once (ABSPATH . WPINC . '/rss-functions.php');
165
// In Wordpress < 2.1
166
} else {
167
- die (__('Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The Wordpress file "rss-functions.php" or "rss.php" could not be included.'));
168
}
169
}
170
-
171
- $display = intval($display);
172
- $page = ( ( !empty( $_GET['rsspage'] ) && intval($_GET['rsspage']) > 0 ) ? intval($_GET['rsspage']) : 1 );
173
- $truncatedescchar = intval($truncatedescchar);
174
- $truncatetitlechar = intval($truncatetitlechar);
175
- if ($use_simplepie)
176
$echo = '<!--via SimplePie with RSSImport-->';
177
- else
178
- $echo = '<!--via MagpieRSS with RSSImport-->';
179
-
180
- if ($charsetscan) {
181
- // read in file for search charset
182
- if ( function_exists('file_get_contents') ) {
183
- ini_set('default_socket_timeout', 10);
184
- $a = file_get_contents($feedurl);
185
- // for better performance, if the server accepts the method
186
- // $a = file_get_contents($feedurl, FALSE, NULL, 0, 50);
187
- }
188
}
189
-
190
- if ($use_simplepie)
191
- $rss = fetch_feed($feedurl);
192
- else
193
- $rss = fetch_rss($feedurl);
194
-
195
- if ( $rss && ! is_wp_error($rss) ) {
196
-
197
// the follow print_r list all items in array, for debug purpose
198
if ( $debug ) {
199
- print('FeedURL: ' . $feedurl);
200
- print('<pre>');
201
- print_r($rss);
202
- print('</pre>');
203
- if ( ! defined('MAGPIE_CACHE_ON') )
204
- define('MAGPIE_CACHE_ON', FALSE);
205
}
206
-
207
- if ( isset($target) && $target != '' )
208
$target = ' target="_' . $target . '"';
209
-
210
- if ( isset($rel) && $rel != '' )
211
$rel = ' rel="' . $rel . '"';
212
-
213
- $displayitems = $display;
214
- $displaylimit = ($page * $display);
215
- $display = (($page-1) * $display);
216
- $nextitems = TRUE;
217
$previousitems = FALSE;
218
- if ( $page > 1 )
219
$previousitems = TRUE;
220
-
221
- while($display < $displaylimit) {
222
-
223
- if ( $use_simplepie && (1 ==$paging) )
224
$items = $rss->get_items();
225
- elseif ($use_simplepie)
226
- $items = $rss->get_items(0, $displayitems);
227
- else
228
$items = $rss->items;
229
-
230
if ( array_key_exists( $display, $items ) ) {
231
-
232
- if ($use_simplepie)
233
- $item = $rss->get_item($display);
234
- else
235
- $item = $rss->items[$display];
236
// import title
237
- if ($use_simplepie)
238
$title = esc_attr( strip_tags( $item->get_title() ) );
239
- elseif ( isset($item['title']) )
240
- $title = esc_attr( strip_tags( $item['title'] ) );
241
// import link
242
- if ($use_simplepie)
243
- $href = wp_filter_kses( $item->get_link() );
244
- elseif ( isset($item['link']) )
245
- $href = wp_filter_kses( $item['link'] );
246
// import picture_url
247
- $picture_url = '';
248
- if ($use_simplepie) {
249
- if ( $enclosure = $item->get_enclosure() ) {
250
- $picture_url = wp_filter_kses( $enclosure->get_thumbnail() );
251
- }
252
}
253
-
254
- $start_item_temp = str_replace('%title%', $title, $start_item);
255
- $start_item_temp = str_replace('%href%', $href, $start_item_temp);
256
- $start_item_temp = str_replace('%picture_url%', $picture_url, $start_item_temp);
257
$echo .= $start_item_temp;
258
-
259
// import date
260
- if ($use_simplepie && $date)
261
$pubDate = date_i18n( $date_format, strtotime( $item->get_date() ) );
262
- elseif ($date && isset($item['pubdate']) )
263
- $pubDate = date_i18n( $date_format, strtotime( $item['pubdate'] ) );
264
// import creator
265
- if ($use_simplepie && $creator) {
266
$creator = $item->get_author();
267
- if ( is_object($creator) ) {
268
$creator = $creator->get_name();
269
$creator = ' <cite>' . esc_html( strip_tags( $creator ) ) . '</cite>';
270
}
271
- } elseif ($creator && isset($item['dc']['creator']) ) {
272
- $creator = wp_specialchars( $item['dc']['creator'] );
273
- } elseif ($creator && isset($item['creator']) ) {
274
- $creator = wp_specialchars( $item['creator'] );
275
}
276
// import desc
277
- if ( $use_simplepie && $displaydescriptions && $html )
278
- $desc = @html_entity_decode( $item->get_content(), ENT_QUOTES, get_option('blog_charset') ); // For import with HTML
279
- elseif ( $use_simplepie && $displaydescriptions && !$html )
280
- $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); // For import without HTML
281
- elseif ( $displaydescriptions && $html && isset($item['content']['encoded']) && $item['content']['encoded'] != 'A' )
282
- $desc = $item['content']['encoded']; // For import with HTML
283
- elseif ( $displaydescriptions && $html && isset($item['content']['atom_content']) && $item['content']['atom_content'] != 'A' )
284
- $desc = $item['content']['atom_content']; // For import with HTML
285
- elseif ( $displaydescriptions && $html && isset($item['content']) && !is_array($item['content']) )
286
- $desc = $item['content'];
287
- elseif ( $displaydescriptions && $html && isset($item['description']) )
288
- $desc = $item['description'];
289
- elseif ( $displaydescriptions && !$html && isset($item['description']) )
290
- $desc = wp_specialchars(strip_tags($item['description'])); // For import without HTML
291
-
292
- if ( isset($a) && eregi('ISO', $a) ) {
293
- if ($debug)
294
$echo .= 'ISO Feed' . "\n";
295
- if ( isset($title) )
296
- isodec($title);
297
- if ( isset($creator) )
298
- isodec($creator);
299
- if ( isset($desc) )
300
- isodec($desc);
301
} else {
302
- if ($debug)
303
$echo .= 'NonISO Feed' . "\n";
304
- if ( isset($title) )
305
- utf8dec($title);
306
- if ( isset($creator) )
307
- utf8dec($creator);
308
- if ( isset($desc) )
309
- utf8dec($desc);
310
}
311
-
312
- if ( isset($title) )
313
- all_convert($title);
314
- if ( isset($creator) )
315
- all_convert($creator);
316
- if ( isset($desc) )
317
- all_convert($desc);
318
-
319
- if ( isset($title) && $truncatetitlechar && (strlen($title) > $truncatetitlechar) ) {
320
- $title = wp_html_excerpt($title, $truncatetitlechar) . $truncatetitlestring;
321
}
322
-
323
- if ( isset($desc) && $truncatedescchar && (strlen($desc) > $truncatedescchar) ) {
324
- $desc = wp_html_excerpt($desc, $truncatedescchar) . $truncatedescstring;
325
}
326
-
327
if ( $desc4title ) {
328
- if ($use_simplepie)
329
- $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) ); // For import without HTML
330
- else if (isset($item['description']))
331
- $desc = wp_specialchars(strip_tags($item['description']));
332
- else
333
- $desc ='';
334
- $atitle = wp_html_excerpt($desc, $truncatedescchar) . $truncatedescstring;
335
} else {
336
$atitle = $title;
337
}
338
-
339
- $echo .= '<a' . $target . $rel . ' href="' . $href . '" title="'. $atitle . '">' . $title . '</a>';
340
- if ( isset($pubDate) && $date && $pubDate != '' )
341
$echo .= $before_date . $pubDate . $after_date;
342
- if ( isset($creator) && $creator && $creator != '' )
343
$echo .= $before_creator . $creator . $after_creator;
344
- if ( isset($desc) && $displaydescriptions && $desc != '' ) {
345
- $after_desc_temp = stripslashes_deep( $after_desc );
346
- $after_desc_temp = str_replace('%title%', $title, $after_desc_temp);
347
- $after_desc_temp = str_replace('%href%', $href, $after_desc_temp);
348
- $after_desc_temp = str_replace('%picture_url%', $picture_url, $after_desc_temp);
349
- $before_desc_temp = str_replace('%title%', $title, $before_desc);
350
- $before_desc_temp = str_replace('%href%', $href, $before_desc_temp);
351
- $before_desc_temp = str_replace('%picture_url%', $picture_url, $before_desc_temp);
352
$echo .= $before_desc_temp . $desc . $after_desc_temp;
353
}
354
- $end_item_temp = str_replace('%title%', $title, $end_item);
355
- $end_item_temp = str_replace('%href%', $href, $end_item_temp);
356
- $end_item_temp = str_replace('%picture_url%', $picture_url, $end_item_temp);
357
$echo .= $end_item_temp;
358
} else {
359
$nextitems = FALSE;
360
}
361
-
362
- $display++;
363
}
364
-
365
- if (strip_tags($echo)) { // novaclic: needed to filter out false content madeof tags alone (html comments, html tags, ...)
366
- $echo = wptexturize($start_items . $echo . $end_items);
367
- } else
368
- $echo = wptexturize($before_noitems . $noitems . $after_noitems);
369
-
370
} else {
371
- if ( empty($rss->ERROR) )
372
$rss->ERROR = NULL;
373
- $echo = wptexturize($before_error . $error . $rss->ERROR . $after_error);
374
}
375
-
376
- if ($paging) {
377
$echo .= '<div class="rsspaging">';
378
- if ($previousitems)
379
- $echo .= '<a href="' . add_query_arg( 'rsspage', ($page-1) ) . '" class="rsspaging_prev" title="' . $prev_paging_title . '">' . $prev_paging_link . '</a>';
380
- if ($nextitems)
381
- $echo .= '<a href="' . add_query_arg( 'rsspage', ($page+1) ) . '" class="rsspaging_next" title="' . $next_paging_title . '">' . $next_paging_link .'</a>';
382
$echo .= '<br style="clear: both" />';
383
$echo .= '</div>';
384
}
385
-
386
- if ($view)
387
echo $echo;
388
- else
389
return $echo;
390
}
391
392
- function utf8dec($s_String) {
393
- if ( version_compare(phpversion(), '5.0.0', '>=') )
394
- $s_String = html_entity_decode(htmlentities( $s_String." ", ENT_COMPAT, 'UTF-8') );
395
- else
396
- $s_String = RSSImport_html_entity_decode_php4( htmlentities($s_String." ") );
397
- return substr($s_String, 0, strlen($s_String)-1);
398
}
399
400
- function isodec($s_String) {
401
- if ( version_compare(phpversion(), '5.0.0', '>=') )
402
- $s_String = html_entity_decode(htmlentities($s_String." ", ENT_COMPAT, 'ISO-8859-1'));
403
- else
404
- $s_String = RSSImport_html_entity_decode_php4( htmlentities($s_String." ") );
405
- return substr($s_String, 0, strlen($s_String)-1);
406
}
407
408
- function all_convert($s_String) {
409
410
// Array for entities
411
- $umlaute = array('„','“','–',' \&#34;','&#8211;','&#8212;','&#8216;','&#8217;','&#8220;','&#8221;','&#8222;','&#8226;','&#8230;' ,
412
- '�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,
413
- '�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�','�','�','�','�','�','�','�','�',
414
- '�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�',
415
- '�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�',
416
- '�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�',utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
417
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
418
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
419
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
420
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
421
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
422
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
423
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
424
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
425
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
426
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
427
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
428
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
429
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
430
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),
431
- utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),utf8_encode('�'),chr(128),chr(129),chr(130),
432
- chr(131),chr(132),chr(133),chr(134),chr(135),chr(136),chr(137),chr(138),chr(139),chr(140),chr(141),chr(142),chr(143),chr(144),chr(145),
433
- chr(146),chr(147),chr(148),chr(149),chr(150),chr(151),chr(152),chr(153),chr(154),chr(155),chr(156),chr(157),chr(158),chr(159),chr(160),
434
- chr(161),chr(162),chr(163),chr(164),chr(165),chr(166),chr(167),chr(168),chr(169),chr(170),chr(171),chr(172),chr(173),chr(174),chr(175),
435
- chr(176),chr(177),chr(178),chr(179),chr(180),chr(181),chr(182),chr(183),chr(184),chr(185),chr(186),chr(187),chr(188),chr(189),chr(190),
436
- chr(191),chr(192),chr(193),chr(194),chr(195),chr(196),chr(197),chr(198),chr(199),chr(200),chr(201),chr(202),chr(203),chr(204),chr(205),
437
- chr(206),chr(207),chr(208),chr(209),chr(210),chr(211),chr(212),chr(213),chr(214),chr(215),chr(216),chr(217),chr(218),chr(219),chr(220),
438
- chr(221),chr(222),chr(223),chr(224),chr(225),chr(226),chr(227),chr(228),chr(229),chr(230),chr(231),chr(232),chr(233),chr(234),chr(235),
439
- chr(236),chr(237),chr(238),chr(239),chr(240),chr(241),chr(242),chr(243),chr(244),chr(245),chr(246),chr(247),chr(248),chr(249),chr(250),
440
- chr(251),chr(252),chr(253),chr(254),chr(255),chr(256));
441
- $htmlcode = array('&bdquo;','&ldquo;','&ndash;',' &#34;','&ndash;','&mdash;','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bdquo;','&bull;' ,
442
- '&hellip;','&euro;','&sbquo;','&fnof;','&bdquo;','&hellip;','&dagger;','&Dagger;','&circ;','&permil;','&Scaron;','&lsaquo;','&OElig;',
443
- '&#x017D;','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bull;','&ndash;','&mdash;','&tilde;','&trade;','&scaron;','&rsaquo;','&oelig;',
444
- '&#x017E;','&Yuml;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;',
445
- '&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&supl;','&ordm;','&raquo;',
446
- '&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;',
447
- '&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;',
448
- '&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;',
449
- '&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;',
450
- '&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;',
451
- '&yacute;','&thorn;','&yuml;','&euro;','&sbquo;','&fnof;','&bdquo;','&hellip;','&dagger;','&Dagger;','&circ;','&permil;','&Scaron;',
452
- '&lsaquo;','&OElig;','&#x017D;','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bull;','&ndash;','&mdash;','&tilde;','&trade;','&scaron;',
453
- '&rsaquo;','&oelig;','&#x017E;','&Yuml;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;',
454
- '&laquo;','&not;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&supl;',
455
- '&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;',
456
- '&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;',
457
- '&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;',
458
- '&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;',
459
- '&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;',
460
- '&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;','&euro;','','&sbquo;','&fnof;','&bdquo;','&hellip;','&dagger;','&Dagger;','&circ;',
461
- '&permil;','&Scaron;','&lsaquo;','&OElig;','','&#x017D;','','','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bull;','&ndash;','&mdash;',
462
- '&tilde;','&trade;','&scaron;','&rsaquo;','&oelig;','','&#x017E;','&Yuml;','&nbsp;','&iexcl;','&iexcl;','&iexcl;','&iexcl;','&yen;',
463
- '&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','�&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;',
464
- '&acute;','&micro;','&para;','&middot;','&cedil;','&supl;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;',
465
- '&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;',
466
- '&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;',
467
- '&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;',
468
- '&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;',
469
- '&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;');
470
//$s_String = str_replace($umlaute, $htmlcode, $s_String);
471
- if ( version_compare(phpversion(), '5.0.0', '>=') )
472
- $s_String = utf8_encode( html_entity_decode( str_replace($umlaute, $htmlcode, $s_String) ) );
473
- else
474
- $s_String = utf8_encode( RSSImport_html_entity_decode_php4( str_replace($umlaute, $htmlcode, $s_String) ) );
475
-
476
// &hellip; , &#8230;
477
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC2\xA6~', '&hellip;', $s_String);
478
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\xA6~', '&hellip;', $s_String);
479
- $s_String = preg_replace('~\xD0\xB2\xD0\x82\xC2\xA6~', '&hellip;', $s_String);
480
-
481
// &mdash; , &#8212;
482
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9D~', '&mdash;', $s_String);
483
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '&mdash;', $s_String);
484
- $s_String = preg_replace('~\xD0\xB2\xD0\x82\xE2\x80\x9D~', '&mdash;', $s_String);
485
-
486
// &ndash; , &#8211;
487
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9C~', '&ndash;', $s_String);
488
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ndash;', $s_String);
489
- $s_String = preg_replace('~\xD0\xB2\xD0\x82\xE2\x80\x9C~', '&ndash;', $s_String);
490
-
491
// &rsquo; , &#8217;
492
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2~', '&rsquo;', $s_String);
493
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '&rsquo;', $s_String);
494
- $s_String = preg_replace('~\xD0\xB2\xD0\x82\xE2\x84\xA2~', '&rsquo;', $s_String);
495
- $s_String = preg_replace('~\xD0\xBF\xD1\x97\xD0\x85~', '&rsquo;', $s_String);
496
-
497
// &lsquo; , &#8216;
498
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xCB\x9C~', '&lsquo;', $s_String);
499
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x8B\xC5\x93~', '&lsquo;', $s_String);
500
-
501
// &rdquo; , &#8221;
502
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '&rdquo;', $s_String);
503
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\x9D~', '&rdquo;', $s_String);
504
- $s_String = preg_replace('~\xD0\xB2\xD0\x82\xD1\x9C~', '&rdquo;', $s_String);
505
-
506
// &ldquo; , &#8220;
507
- $s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ldquo;', $s_String);
508
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x85\xE2\x80\x9C~', '&ldquo;', $s_String);
509
- $s_String = preg_replace('~\xD0\xB2\xD0\x82\xD1\x9A~', '&ldquo;', $s_String);
510
-
511
// &trade; , &#8482;
512
- $s_String = preg_replace('~\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '&trade;', $s_String);
513
- $s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x82\xAC\xC5\xBE\xC3\x82\xC2\xA2~', '&trade;', $s_String);
514
-
515
// th
516
- $s_String = preg_replace('~t\xC3\x82\xC2\xADh~', 'th', $s_String);
517
-
518
// .
519
- $s_String = preg_replace('~.\xD0\x92+~', '.', $s_String);
520
- $s_String = preg_replace('~.\xD0\x92~', '.', $s_String);
521
-
522
// ,
523
- $s_String = preg_replace('~\x2C\xD0\x92~', ',', $s_String);
524
525
return $s_String;
526
}
527
528
/**
529
* Entfernt unvollstaendige Worte am Ende eines Strings.
530
* @author Thomas Scholz <http://toscho.de>
531
- * @param $str Zeichenkette
532
* @return string
533
*/
534
- function RSSImport_end_on_word($str) {
535
-
536
- $arr = explode( ' ', trim($str) );
537
- array_pop($arr);
538
-
539
- return rtrim( implode(' ', $arr), ',;');
540
}
541
542
- function RSSImport_Shortcode($atts) {
543
- extract(
544
- shortcode_atts( array(
545
- 'display' => 5,
546
- 'feedurl' => 'http://bueltge.de/feed/',
547
- 'before_desc' => '<br />',
548
'displaydescriptions' => 0,
549
- 'after_desc' => '',
550
- 'html' => 0,
551
- 'truncatedescchar' => 200,
552
- 'truncatedescstring' => ' ... ',
553
- 'truncatetitlechar' => '',
554
'truncatetitlestring' => ' ... ',
555
- 'before_date' => ' <small>',
556
- 'date' => 0,
557
- 'after_date' => '</small>',
558
- 'date_format' => '',
559
- 'before_creator' => ' <small>',
560
- 'creator' => 0,
561
- 'after_creator' => '</small>',
562
- 'start_items' => '<ul>',
563
- 'end_items' => '</ul>',
564
- 'start_item' => '<li>',
565
- 'end_item' => '</li>',
566
- 'target' => '',
567
- 'rel' => '',
568
- 'desc4title' => 0,
569
- 'charsetscan' => 0,
570
- 'debug' => 0,
571
- 'before_noitems' => '<p>',
572
- 'noitems' => __('No items, feed is empty.', FB_RSSI_TEXTDOMAIN ),
573
- 'after_noitems' => '</p>',
574
- 'before_error' => '<p>',
575
- 'error' => __('Error: Feed has an error or is not valid', FB_RSSI_TEXTDOMAIN ),
576
- 'after_error' => '</p>',
577
- 'paging' => 0,
578
- 'prev_paging_link' => __( '&laquo; Previous', FB_RSSI_TEXTDOMAIN ),
579
- 'next_paging_link' => __( 'Next &raquo;', FB_RSSI_TEXTDOMAIN ),
580
- 'prev_paging_title' => __( 'more items', FB_RSSI_TEXTDOMAIN ),
581
- 'next_paging_title' => __( 'more items', FB_RSSI_TEXTDOMAIN ),
582
- 'use_simplepie' => 1,
583
- 'view' => 0
584
- ), $atts)
585
);
586
- //var_dump($atts);
587
-
588
- $display = intval($display);
589
- if ( strtolower($html) == 'true')
590
- $html = 1;
591
- $html = intval($html);
592
- if ( strtolower($displaydescriptions) == 'true')
593
- $displaydescriptions = 1;
594
- $displaydescriptions = intval($displaydescriptions);
595
- if ( strtolower($truncatedescchar) == 'true')
596
- $truncatedescchar = 1;
597
- $truncatedescchar = intval($truncatedescchar);
598
- if ( strtolower($truncatetitlechar) == 'true')
599
- $truncatetitlechar = 1;
600
- $truncatetitlechar = intval($truncatetitlechar);
601
- if ( strtolower($date) == 'true')
602
- $date = 1;
603
- $date = intval($date);
604
- if ( strtolower($creator) == 'true')
605
- $creator = 1;
606
- $creator = intval($creator);
607
- if ( strtolower($charsetscan) == 'true')
608
- $charsetscan = 1;
609
- $charsetscan = intval($charsetscan);
610
- if ( strtolower($debug) == 'true')
611
- $debug = 1;
612
- $debug = intval($debug);
613
- if ( strtolower($paging) == 'true')
614
- $paging = 1;
615
- $paging = intval($paging);
616
- if ( strtolower($use_simplepie) == 'true')
617
- $use_simplepie = 1;
618
- $use_simplepie = intval($use_simplepie);
619
- $feedurl = html_entity_decode( $feedurl ); // novaclic: undo encoding due to wordpress WYSIWYG editor
620
-
621
$return = RSSImport(
622
$display, $feedurl,
623
$before_desc, $displaydescriptions, $after_desc, $html,
@@ -637,460 +725,488 @@ function RSSImport_Shortcode($atts) {
637
$use_simplepie,
638
$view
639
);
640
-
641
return $return;
642
}
643
644
- function RSSImport_shortcode_quot($pee) {
645
global $shortcode_tags;
646
-
647
- if ( !empty($shortcode_tags) && is_array($shortcode_tags) ) {
648
- $tagnames = array_keys($shortcode_tags);
649
- $tagregexp = join( '|', array_map('preg_quote', $tagnames) );
650
- $pee = preg_replace('/\\s*?(\\[(' . $tagregexp . ')\\b.*?\\/?\\](?:.+?\\[\\/\\2\\])?)\\s*/s', '$1', $pee);
651
}
652
653
return $pee;
654
}
655
656
-
657
/**
658
- * add quicktag-button to editor
659
*/
660
-
661
function RSSImport_insert_button() {
662
global $pagenow;
663
-
664
- $post_page_pages = array('post-new.php', 'post.php', 'page-new.php', 'page.php');
665
- if ( ! in_array( $pagenow, $post_page_pages ) )
666
return;
667
-
668
?>
669
<script type="text/javascript" charset="utf-8">
670
- /* Adding Quicktag buttons to the editor WordPress ver. 3.3 and above
671
- * - Button HTML ID (required)
672
- * - Button display, value="" attribute (required)
673
- * - Opening Tag (required)
674
- * - Closing Tag (required)
675
- * - Access key, accesskey="" attribute for the button (optional)
676
- * - Title, title="" attribute (optional)
677
- * - Priority/position on bar, 1-9 = first, 11-19 = second, 21-29 = third, etc. (optional)
678
- */
679
- var id = 'rssimport',
680
- text = '<?php _e( 'RSSImport', FB_RSSI_TEXTDOMAIN ); ?>',
681
- start = '[RSSImport display="5" feedurl="http://feedurl.com/" before_desc="<br />" displaydescriptions="TRUE" after_desc=" " ' +
682
- 'html="FALSE" truncatedescchar="200" truncatedescstring=" ... " truncatetitlechar="" truncatetitlestring=" ... " ' +
683
- 'before_date=" <small>" date="FALSE" after_date="</small>" date_format="" before_creator=" <small>" creator="FALSE" ' +
684
- 'after_creator="</small>" start_items="<ul>" end_items="</ul>" start_item="<li>" end_item="</li>" target="" rel="" ' +
685
- 'desc4title="" charsetscan="FALSE" debug="FALSE" before_noitems="<p>" noitems="No items, feed is empty." ' +
686
- 'after_noitems="</p>" before_error="<p>" error="Error: Feed has an error or is not valid" after_error="</p>" ' +
687
- 'paging="FALSE" prev_paging_link="&laquo; Previous" next_paging_link="Next &raquo;" prev_paging_title="more items" ' +
688
- 'next_paging_title="more items" use_simplepie="FALSE"]',
689
- end = '',
690
- access = 'r',
691
- title = '<?php _e( 'Import a feed with RSSImport', FB_RSSI_TEXTDOMAIN ); ?>';
692
-
693
- QTags.addButton( id, text, start, end, access );
694
</script>
695
<?php
696
}
697
698
function RSSImport_insert_button_old() {
699
global $pagenow;
700
-
701
- $post_page_pages = array('post-new.php', 'post.php', 'page-new.php', 'page.php');
702
- if ( ! in_array( $pagenow, $post_page_pages ) )
703
return;
704
-
705
echo '
706
<script type="text/javascript">
707
//<![CDATA[
708
if ( typeof edButtons != \'undefined\' ) {
709
- var length = edButtons.length;
710
- edButtons[length] = new edButton(\'RSSImport\', \'$context\', \'[RSSImport display="5" feedurl="http://feedurl.com/"'.
711
- ' before_desc="<br />" displaydescriptions="TRUE" after_desc=" " html="FALSE" truncatedescchar="200" truncatedescstring=" ... "'.
712
- ' truncatetitlechar=" " truncatetitlestring=" ... " before_date=" <small>" date="FALSE" after_date="</small>"'.
713
- ' date_format="" before_creator=" <small>" creator="FALSE" after_creator="</small>" start_items="<ul>" end_items="</ul>"'.
714
- ' start_item="<li>" end_item="</li>" target="" rel="" desc4title="" charsetscan="FALSE" debug="FALSE" before_noitems="<p>"'.
715
- ' noitems="No items, feed is empty." after_noitems="</p>" before_error="<p>" error="Error: Feed has an error or is not valid"'.
716
- ' after_error="</p>" paging="FALSE" prev_paging_link="&laquo; Previous" next_paging_link="Next &raquo;"'.
717
- ' prev_paging_title="more items" next_paging_title="more items" use_simplepie="FALSE"]\', \'\', \'\');
718
- function RSSImport_tag(id) {
719
- id = id.replace(/RSSImport_/, \'\');
720
- edInsertTag(edCanvas, id);
721
}
722
- jQuery(document).ready(function() {
723
- content = \'<input id="RSSImport_\'+length+\'" class="ed_button" type="button" value="' . __( 'RSSImport', FB_RSSI_TEXTDOMAIN ) .
724
- '" title="' . __( 'Import a feed with RSSImport', FB_RSSI_TEXTDOMAIN ) . '" onclick="RSSImport_tag(this.id);" />\';
725
- jQuery("#ed_toolbar").append(content);
726
- });
727
}
728
//]]>
729
</script>';
730
}
731
732
if ( is_admin() && FB_RSSI_QUICKTAG ) {
733
- if ( version_compare( $GLOBALS['wp_version'], '3.3alpha', '>=' ) )
734
add_action( 'admin_print_footer_scripts', 'RSSImport_insert_button' );
735
- else
736
add_action( 'admin_footer', 'RSSImport_insert_button_old' );
737
}
738
739
- if ( function_exists('add_shortcode') )
740
- add_shortcode('RSSImport', 'RSSImport_Shortcode');
741
742
add_action( 'init', 'RSSImport_textdomain' );
743
744
-
745
-
746
/**
747
* code to utf-8 in PHP 4
748
*
749
* @package WP-RSSImport
750
*/
751
- function RSSImport_code_to_utf8($num) {
752
-
753
- if ($num <= 0x7F) {
754
- return chr($num);
755
- } elseif ($num <= 0x7FF) {
756
- return chr(($num >> 0x06) + 0xC0) . chr(($num & 0x3F) + 128);
757
- } elseif ($num <= 0xFFFF) {
758
- return chr(($num >> 0x0C) + 0xE0) . chr((($num >> 0x06) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80);
759
- } elseif ($num <= 0x1FFFFF) {
760
- return chr(($num >> 0x12) + 0xF0) . chr((($num >> 0x0C) & 0x3F) + 0x80) . chr((($num >> 0x06) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80);
761
}
762
763
return '';
764
}
765
766
-
767
/**
768
* html_entity_decode for PHP 4
769
*
770
* @package WP-RSSImport
771
*/
772
- function RSSImport_html_entity_decode_php4($str) {
773
- $htmlentities = array (
774
- "&Aacute;" => chr(195).chr(129),
775
- "&aacute;" => chr(195).chr(161),
776
- "&Acirc;" => chr(195).chr(130),
777
- "&acirc;" => chr(195).chr(162),
778
- "&acute;" => chr(194).chr(180),
779
- "&AElig;" => chr(195).chr(134),
780
- "&aelig;" => chr(195).chr(166),
781
- "&Agrave;" => chr(195).chr(128),
782
- "&agrave;" => chr(195).chr(160),
783
- "&alefsym;" => chr(226).chr(132).chr(181),
784
- "&Alpha;" => chr(206).chr(145),
785
- "&alpha;" => chr(206).chr(177),
786
- "&amp;" => chr(38),
787
- "&and;" => chr(226).chr(136).chr(167),
788
- "&ang;" => chr(226).chr(136).chr(160),
789
- "&Aring;" => chr(195).chr(133),
790
- "&aring;" => chr(195).chr(165),
791
- "&asymp;" => chr(226).chr(137).chr(136),
792
- "&Atilde;" => chr(195).chr(131),
793
- "&atilde;" => chr(195).chr(163),
794
- "&Auml;" => chr(195).chr(132),
795
- "&auml;" => chr(195).chr(164),
796
- "&bdquo;" => chr(226).chr(128).chr(158),
797
- "&Beta;" => chr(206).chr(146),
798
- "&beta;" => chr(206).chr(178),
799
- "&brvbar;" => chr(194).chr(166),
800
- "&bull;" => chr(226).chr(128).chr(162),
801
- "&cap;" => chr(226).chr(136).chr(169),
802
- "&Ccedil;" => chr(195).chr(135),
803
- "&ccedil;" => chr(195).chr(167),
804
- "&cedil;" => chr(194).chr(184),
805
- "&cent;" => chr(194).chr(162),
806
- "&Chi;" => chr(206).chr(167),
807
- "&chi;" => chr(207).chr(135),
808
- "&circ;" => chr(203).chr(134),
809
- "&clubs;" => chr(226).chr(153).chr(163),
810
- "&cong;" => chr(226).chr(137).chr(133),
811
- "&copy;" => chr(194).chr(169),
812
- "&crarr;" => chr(226).chr(134).chr(181),
813
- "&cup;" => chr(226).chr(136).chr(170),
814
- "&curren;" => chr(194).chr(164),
815
- "&dagger;" => chr(226).chr(128).chr(160),
816
- "&Dagger;" => chr(226).chr(128).chr(161),
817
- "&darr;" => chr(226).chr(134).chr(147),
818
- "&dArr;" => chr(226).chr(135).chr(147),
819
- "&deg;" => chr(194).chr(176),
820
- "&Delta;" => chr(206).chr(148),
821
- "&delta;" => chr(206).chr(180),
822
- "&diams;" => chr(226).chr(153).chr(166),
823
- "&divide;" => chr(195).chr(183),
824
- "&Eacute;" => chr(195).chr(137),
825
- "&eacute;" => chr(195).chr(169),
826
- "&Ecirc;" => chr(195).chr(138),
827
- "&ecirc;" => chr(195).chr(170),
828
- "&Egrave;" => chr(195).chr(136),
829
- "&egrave;" => chr(195).chr(168),
830
- "&empty;" => chr(226).chr(136).chr(133),
831
- "&emsp;" => chr(226).chr(128).chr(131),
832
- "&ensp;" => chr(226).chr(128).chr(130),
833
- "&Epsilon;" => chr(206).chr(149),
834
- "&epsilon;" => chr(206).chr(181),
835
- "&equiv;" => chr(226).chr(137).chr(161),
836
- "&Eta;" => chr(206).chr(151),
837
- "&eta;" => chr(206).chr(183),
838
- "&ETH;" => chr(195).chr(144),
839
- "&eth;" => chr(195).chr(176),
840
- "&Euml;" => chr(195).chr(139),
841
- "&euml;" => chr(195).chr(171),
842
- "&euro;" => chr(226).chr(130).chr(172),
843
- "&exist;" => chr(226).chr(136).chr(131),
844
- "&fnof;" => chr(198).chr(146),
845
- "&forall;" => chr(226).chr(136).chr(128),
846
- "&frac12;" => chr(194).chr(189),
847
- "&frac14;" => chr(194).chr(188),
848
- "&frac34;" => chr(194).chr(190),
849
- "&frasl;" => chr(226).chr(129).chr(132),
850
- "&Gamma;" => chr(206).chr(147),
851
- "&gamma;" => chr(206).chr(179),
852
- "&ge;" => chr(226).chr(137).chr(165),
853
- "&harr;" => chr(226).chr(134).chr(148),
854
- "&hArr;" => chr(226).chr(135).chr(148),
855
- "&hearts;" => chr(226).chr(153).chr(165),
856
- "&hellip;" => chr(226).chr(128).chr(166),
857
- "&Iacute;" => chr(195).chr(141),
858
- "&iacute;" => chr(195).chr(173),
859
- "&Icirc;" => chr(195).chr(142),
860
- "&icirc;" => chr(195).chr(174),
861
- "&iexcl;" => chr(194).chr(161),
862
- "&Igrave;" => chr(195).chr(140),
863
- "&igrave;" => chr(195).chr(172),
864
- "&image;" => chr(226).chr(132).chr(145),
865
- "&infin;" => chr(226).chr(136).chr(158),
866
- "&int;" => chr(226).chr(136).chr(171),
867
- "&Iota;" => chr(206).chr(153),
868
- "&iota;" => chr(206).chr(185),
869
- "&iquest;" => chr(194).chr(191),
870
- "&isin;" => chr(226).chr(136).chr(136),
871
- "&Iuml;" => chr(195).chr(143),
872
- "&iuml;" => chr(195).chr(175),
873
- "&Kappa;" => chr(206).chr(154),
874
- "&kappa;" => chr(206).chr(186),
875
- "&Lambda;" => chr(206).chr(155),
876
- "&lambda;" => chr(206).chr(187),
877
- "&lang;" => chr(226).chr(140).chr(169),
878
- "&laquo;" => chr(194).chr(171),
879
- "&larr;" => chr(226).chr(134).chr(144),
880
- "&lArr;" => chr(226).chr(135).chr(144),
881
- "&lceil;" => chr(226).chr(140).chr(136),
882
- "&ldquo;" => chr(226).chr(128).chr(156),
883
- "&le;" => chr(226).chr(137).chr(164),
884
- "&lfloor;" => chr(226).chr(140).chr(138),
885
- "&lowast;" => chr(226).chr(136).chr(151),
886
- "&loz;" => chr(226).chr(151).chr(138),
887
- "&lrm;" => chr(226).chr(128).chr(142),
888
- "&lsaquo;" => chr(226).chr(128).chr(185),
889
- "&lsquo;" => chr(226).chr(128).chr(152),
890
- "&macr;" => chr(194).chr(175),
891
- "&mdash;" => chr(226).chr(128).chr(148),
892
- "&micro;" => chr(194).chr(181),
893
- "&middot;" => chr(194).chr(183),
894
- "&minus;" => chr(226).chr(136).chr(146),
895
- "&Mu;" => chr(206).chr(156),
896
- "&mu;" => chr(206).chr(188),
897
- "&nabla;" => chr(226).chr(136).chr(135),
898
- "&nbsp;" => chr(194).chr(160),
899
- "&ndash;" => chr(226).chr(128).chr(147),
900
- "&ne;" => chr(226).chr(137).chr(160),
901
- "&ni;" => chr(226).chr(136).chr(139),
902
- "&not;" => chr(194).chr(172),
903
- "&notin;" => chr(226).chr(136).chr(137),
904
- "&nsub;" => chr(226).chr(138).chr(132),
905
- "&Ntilde;" => chr(195).chr(145),
906
- "&ntilde;" => chr(195).chr(177),
907
- "&Nu;" => chr(206).chr(157),
908
- "&nu;" => chr(206).chr(189),
909
- "&Oacute;" => chr(195).chr(147),
910
- "&oacute;" => chr(195).chr(179),
911
- "&Ocirc;" => chr(195).chr(148),
912
- "&ocirc;" => chr(195).chr(180),
913
- "&OElig;" => chr(197).chr(146),
914
- "&oelig;" => chr(197).chr(147),
915
- "&Ograve;" => chr(195).chr(146),
916
- "&ograve;" => chr(195).chr(178),
917
- "&oline;" => chr(226).chr(128).chr(190),
918
- "&Omega;" => chr(206).chr(169),
919
- "&omega;" => chr(207).chr(137),
920
- "&Omicron;" => chr(206).chr(159),
921
- "&omicron;" => chr(206).chr(191),
922
- "&oplus;" => chr(226).chr(138).chr(149),
923
- "&or;" => chr(226).chr(136).chr(168),
924
- "&ordf;" => chr(194).chr(170),
925
- "&ordm;" => chr(194).chr(186),
926
- "&Oslash;" => chr(195).chr(152),
927
- "&oslash;" => chr(195).chr(184),
928
- "&Otilde;" => chr(195).chr(149),
929
- "&otilde;" => chr(195).chr(181),
930
- "&otimes;" => chr(226).chr(138).chr(151),
931
- "&Ouml;" => chr(195).chr(150),
932
- "&ouml;" => chr(195).chr(182),
933
- "&para;" => chr(194).chr(182),
934
- "&part;" => chr(226).chr(136).chr(130),
935
- "&permil;" => chr(226).chr(128).chr(176),
936
- "&perp;" => chr(226).chr(138).chr(165),
937
- "&Phi;" => chr(206).chr(166),
938
- "&phi;" => chr(207).chr(134),
939
- "&Pi;" => chr(206).chr(160),
940
- "&pi;" => chr(207).chr(128),
941
- "&piv;" => chr(207).chr(150),
942
- "&plusmn;" => chr(194).chr(177),
943
- "&pound;" => chr(194).chr(163),
944
- "&prime;" => chr(226).chr(128).chr(178),
945
- "&Prime;" => chr(226).chr(128).chr(179),
946
- "&prod;" => chr(226).chr(136).chr(143),
947
- "&prop;" => chr(226).chr(136).chr(157),
948
- "&Psi;" => chr(206).chr(168),
949
- "&psi;" => chr(207).chr(136),
950
- "&radic;" => chr(226).chr(136).chr(154),
951
- "&rang;" => chr(226).chr(140).chr(170),
952
- "&raquo;" => chr(194).chr(187),
953
- "&rarr;" => chr(226).chr(134).chr(146),
954
- "&rArr;" => chr(226).chr(135).chr(146),
955
- "&rceil;" => chr(226).chr(140).chr(137),
956
- "&rdquo;" => chr(226).chr(128).chr(157),
957
- "&real;" => chr(226).chr(132).chr(156),
958
- "&reg;" => chr(194).chr(174),
959
- "&rfloor;" => chr(226).chr(140).chr(139),
960
- "&Rho;" => chr(206).chr(161),
961
- "&rho;" => chr(207).chr(129),
962
- "&rlm;" => chr(226).chr(128).chr(143),
963
- "&rsaquo;" => chr(226).chr(128).chr(186),
964
- "&rsquo;" => chr(226).chr(128).chr(153),
965
- "&sbquo;" => chr(226).chr(128).chr(154),
966
- "&Scaron;" => chr(197).chr(160),
967
- "&scaron;" => chr(197).chr(161),
968
- "&sdot;" => chr(226).chr(139).chr(133),
969
- "&sect;" => chr(194).chr(167),
970
- "&shy;" => chr(194).chr(173),
971
- "&Sigma;" => chr(206).chr(163),
972
- "&sigma;" => chr(207).chr(131),
973
- "&sigmaf;" => chr(207).chr(130),
974
- "&sim;" => chr(226).chr(136).chr(188),
975
- "&spades;" => chr(226).chr(153).chr(160),
976
- "&sub;" => chr(226).chr(138).chr(130),
977
- "&sube;" => chr(226).chr(138).chr(134),
978
- "&sum;" => chr(226).chr(136).chr(145),
979
- "&sup1;" => chr(194).chr(185),
980
- "&sup2;" => chr(194).chr(178),
981
- "&sup3;" => chr(194).chr(179),
982
- "&sup;" => chr(226).chr(138).chr(131),
983
- "&supe;" => chr(226).chr(138).chr(135),
984
- "&szlig;" => chr(195).chr(159),
985
- "&Tau;" => chr(206).chr(164),
986
- "&tau;" => chr(207).chr(132),
987
- "&there4;" => chr(226).chr(136).chr(180),
988
- "&Theta;" => chr(206).chr(152),
989
- "&theta;" => chr(206).chr(184),
990
- "&thetasym;" => chr(207).chr(145),
991
- "&thinsp;" => chr(226).chr(128).chr(137),
992
- "&THORN;" => chr(195).chr(158),
993
- "&thorn;" => chr(195).chr(190),
994
- "&tilde;" => chr(203).chr(156),
995
- "&times;" => chr(195).chr(151),
996
- "&trade;" => chr(226).chr(132).chr(162),
997
- "&Uacute;" => chr(195).chr(154),
998
- "&uacute;" => chr(195).chr(186),
999
- "&uarr;" => chr(226).chr(134).chr(145),
1000
- "&uArr;" => chr(226).chr(135).chr(145),
1001
- "&Ucirc;" => chr(195).chr(155),
1002
- "&ucirc;" => chr(195).chr(187),
1003
- "&Ugrave;" => chr(195).chr(153),
1004
- "&ugrave;" => chr(195).chr(185),
1005
- "&uml;" => chr(194).chr(168),
1006
- "&upsih;" => chr(207).chr(146),
1007
- "&Upsilon;" => chr(206).chr(165),
1008
- "&upsilon;" => chr(207).chr(133),
1009
- "&Uuml;" => chr(195).chr(156),
1010
- "&uuml;" => chr(195).chr(188),
1011
- "&weierp;" => chr(226).chr(132).chr(152),
1012
- "&Xi;" => chr(206).chr(158),
1013
- "&xi;" => chr(206).chr(190),
1014
- "&Yacute;" => chr(195).chr(157),
1015
- "&yacute;" => chr(195).chr(189),
1016
- "&yen;" => chr(194).chr(165),
1017
- "&yuml;" => chr(195).chr(191),
1018
- "&Yuml;" => chr(197).chr(184),
1019
- "&Zeta;" => chr(206).chr(150),
1020
- "&zeta;" => chr(206).chr(182),
1021
- "&zwj;" => chr(226).chr(128).chr(141),
1022
- "&zwnj;" => chr(226).chr(128).chr(140),
1023
- "&gt;" => ">",
1024
- "&lt;" => "<"
1025
);
1026
1027
- $return = strtr($str, $htmlentities);
1028
- $return = preg_replace('~&#x([0-9a-f]+);~ei', 'RSSImport_code_to_utf8(hexdec("\\1"))', $return);
1029
- $return = preg_replace('~&#([0-9]+);~e', 'RSSImport_code_to_utf8(\\1)', $return);
1030
1031
return $return;
1032
}
1033
1034
-
1035
// check class wp_widget exists
1036
- if ( class_exists('WP_Widget') ) {
1037
-
1038
class RSSImport_Widget extends WP_Widget {
1039
-
1040
- function __construct() {
1041
- $widget_ops = array('classname' => 'rssimport', 'description' => __( 'Entries from any RSS or Atom feed', FB_RSSI_TEXTDOMAIN ) );
1042
- parent::__construct('rssimport', __( 'RSSImport' ), $widget_ops);
1043
}
1044
-
1045
- function widget($args, $instance) {
1046
- extract($args, EXTR_SKIP);
1047
-
1048
- $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
1049
- $titlelink = empty($instance['titlelink']) ? '' : $instance['titlelink'];
1050
- $display = empty($instance['display']) ? '5' : $instance['display'];
1051
- $feedurl = empty($instance['feedurl']) ? 'http://bueltge.de/feed/' : $instance['feedurl'];
1052
- $before_desc = empty($instance['before_desc']) ? '' : $instance['before_desc'];
1053
- $displaydescriptions = empty($instance['displaydescriptions']) ? '0' : $instance['displaydescriptions'];
1054
- $after_desc = empty($instance['after_desc']) ? '' : $instance['after_desc'];
1055
- $html = empty($instance['html']) ? '0' : $instance['html'];
1056
- $truncatedescchar = empty($instance['truncatedescchar']) ? '200' : $instance['truncatedescchar'];
1057
- $truncatedescstring = empty($instance['truncatedescstring']) ? '' : $instance['truncatedescstring'];
1058
- $truncatetitlechar = empty($instance['truncatetitlechar']) ? '' : $instance['truncatetitlechar'];
1059
- $truncatetitlestring = empty($instance['truncatetitlestring']) ? ' ... ' : $instance['truncatetitlestring'];
1060
- $before_date = empty($instance['before_date']) ? ' <small>' : $instance['before_date'];
1061
- $date = empty($instance['date']) ? '0' : $instance['date'];
1062
- $after_date = empty($instance['after_date']) ? '</small>' : $instance['after_date'];
1063
- $date_format = empty($instance['date_format']) ? '' : $instance['date_format'];
1064
- $before_creator = empty($instance['before_creator']) ? ' <small>' : $instance['before_creator'];
1065
- $creator = empty($instance['creator']) ? '0' : $instance['creator'];
1066
- $after_creator = empty($instance['after_creator']) ? '</small>' : $instance['after_creator'];
1067
- $start_items = empty($instance['start_items']) ? '<ul>' : $instance['start_items'];
1068
- $end_items = empty($instance['end_items']) ? '</ul>' : $instance['end_items'];
1069
- $start_item = empty($instance['start_item']) ? '<li>' : $instance['start_item'];
1070
- $end_item = empty($instance['end_item']) ? '</li>' : $instance['end_item'];
1071
- $target = empty($instance['target']) ? '' : $instance['target'];
1072
- $rel = empty($instance['rel']) ? '' : $instance['rel'];
1073
- $desc4title = empty($instance['desc4title']) ? '0' : $instance['desc4title'];
1074
- $charsetscan = empty($instance['charsetscan']) ? '0' : $instance['charsetscan'];
1075
- $debug = empty($instance['debug']) ? '0' : $instance['debug'];
1076
- $before_noitems = empty($instance['before_noitems']) ? '<p>' : $instance['before_noitems'];
1077
- $noitems = empty($instance['noitems']) ? __('No items, feed is empty.', FB_RSSI_TEXTDOMAIN) : $instance['noitems'];
1078
- $after_noitems = empty($instance['after_noitems']) ? '</p>' : $instance['after_noitems'];
1079
- $before_error = empty($instance['before_error']) ? '<p>' : $instance['before_error'];
1080
- $error = empty($instance['error']) ? __('Error: Feed has an error or is not valid', FB_RSSI_TEXTDOMAIN) : $instance['error'];
1081
- $after_error = empty($instance['after_error']) ? '</p>' : $instance['after_error'];
1082
- $paging = empty($instance['paging']) ? '0' : $instance['paging'];
1083
- $prev_paging_link = empty($instance['prev_paging_link']) ? __('&laquo; Previous', FB_RSSI_TEXTDOMAIN) : $instance['prev_paging_link'];
1084
- $next_paging_link = empty($instance['next_paging_link']) ? __('Next &raquo;', FB_RSSI_TEXTDOMAIN) : $instance['next_paging_link'];
1085
- $prev_paging_title = empty($instance['prev_paging_title']) ? __('more items', FB_RSSI_TEXTDOMAIN) : $instance['prev_paging_title'];
1086
- $next_paging_title = empty($instance['next_paging_title']) ? __('more items', FB_RSSI_TEXTDOMAIN) : $instance['next_paging_title'];
1087
- $use_simplepie = empty($instance['use_simplepie']) ? '1' : $instance['use_simplepie'];
1088
- $view = empty($instance['view']) ? '1' : $instance['view'];
1089
-
1090
- echo $before_widget;
1091
- if ( $titlelink != '' )
1092
$title = '<a href="' . $titlelink . '">' . $title . '</a>';
1093
- echo $before_title . $title . $after_title;
1094
RSSImport(
1095
$display, $feedurl,
1096
$before_desc, $displaydescriptions, $after_desc, $html, $truncatedescchar, $truncatedescstring,
@@ -1109,331 +1225,452 @@ if ( class_exists('WP_Widget') ) {
1109
$use_simplepie,
1110
$view
1111
);
1112
- echo $after_widget;
1113
}
1114
-
1115
- function update($new_instance, $old_instance) {
1116
- $instance['instance'] = $old_instance;
1117
- $instance['title'] = strip_tags( $new_instance['title'] );
1118
- $instance['titlelink'] = esc_url($new_instance['titlelink']);
1119
- $instance['display'] = (int) $new_instance['display'];
1120
- $instance['feedurl'] = $new_instance['feedurl'];
1121
- $instance['before_desc'] = $new_instance['before_desc'];
1122
- $instance['displaydescriptions'] = (int) $new_instance['displaydescriptions'];
1123
- $instance['after_desc'] = stripslashes_deep( $new_instance['after_desc'] );
1124
- $instance['html'] = (int) $new_instance['html'];
1125
- $instance['truncatedescchar'] = (int) $new_instance['truncatedescchar'];
1126
- $instance['truncatedescstring'] = $new_instance['truncatedescstring'];
1127
- $instance['truncatetitlechar'] = (int) $new_instance['truncatetitlechar'];
1128
- $instance['truncatetitlestring'] = $new_instance['truncatetitlestring'];
1129
- $instance['before_date'] = $new_instance['before_date'];
1130
- $instance['date'] = (int) $new_instance['date'];
1131
- $instance['after_date'] = $new_instance['after_date'];
1132
- $instance['date_format'] = $new_instance['date_format'];
1133
- $instance['before_creator'] = $new_instance['before_creator'];
1134
- $instance['creator'] = (int) $new_instance['creator'];
1135
- $instance['after_creator'] = $new_instance['after_creator'];
1136
- $instance['start_items'] = $new_instance['start_items'];
1137
- $instance['end_items'] = $new_instance['end_items'];
1138
- $instance['start_item'] = $new_instance['start_item'];
1139
- $instance['end_item'] = $new_instance['end_item'];
1140
- $instance['target'] = $new_instance['target'];
1141
- $instance['rel'] = $new_instance['rel'];
1142
- $instance['desc4title'] = (int) $new_instance['desc4title'];
1143
- $instance['charsetscan'] = (int) $new_instance['charsetscan'];
1144
- $instance['debug'] = (int) $new_instance['debug'];
1145
- $instance['view'] = (int) $new_instance['view'];
1146
- $instance['before_noitems'] = $new_instance['before_noitems'];
1147
- $instance['noitems'] = $new_instance['noitems'];
1148
- $instance['after_noitems'] = $new_instance['after_noitems'];
1149
- $instance['before_error'] = $new_instance['before_error'];
1150
- $instance['error'] = $new_instance['error'];
1151
- $instance['after_error'] = $new_instance['after_error'];
1152
- $instance['paging'] = (int) $new_instance['paging'];
1153
- $instance['prev_paging_link'] = $new_instance['prev_paging_link'];
1154
- $instance['next_paging_link'] = $new_instance['next_paging_link'];
1155
- $instance['prev_paging_title'] = $new_instance['prev_paging_title'];
1156
- $instance['next_paging_title'] = $new_instance['next_paging_title'];
1157
- $instance['use_simplepie'] = (int) $new_instance['use_simplepie'];
1158
-
1159
- if ( current_user_can('unfiltered_html') )
1160
return $instance;
1161
- else
1162
- return stripslashes( strip_tags ( $instance ) );
1163
}
1164
-
1165
- function form($instance) {
1166
- $instance = wp_parse_args(
1167
- (array) $instance, array(
1168
- 'title' => '',
1169
- 'titlelink' => '',
1170
- 'display' => 5,
1171
- 'feedurl' => 'http://bueltge.de/feed/',
1172
- 'before_desc' => '',
1173
- 'displaydescriptions' => 0,
1174
- 'after_desc' => '',
1175
- 'html' => 0,
1176
- 'truncatedescchar' => 200,
1177
- 'truncatedescstring' => ' ... ',
1178
- 'truncatetitlechar' => '',
1179
- 'truncatetitlestring' => ' ... ',
1180
- 'before_date' => ' <small>',
1181
- 'date' => 0,
1182
- 'after_date' => '</small>',
1183
- 'date_format' => '',
1184
- 'before_creator' => ' <small>',
1185
- 'creator' => 0,
1186
- 'after_creator' => '</small>',
1187
- 'start_items' => '<ul>',
1188
- 'end_items' => '</ul>',
1189
- 'start_item' => '<li>',
1190
- 'end_item' => '</li>',
1191
- 'target' => '',
1192
- 'rel' => '',
1193
- 'desc4title' => 0,
1194
- 'charsetscan' => 0,
1195
- 'debug' => 0,
1196
- 'view' => 1,
1197
- 'before_noitems' => '<p>',
1198
- 'noitems' => __('No items, feed is empty.', FB_RSSI_TEXTDOMAIN),
1199
- 'after_noitems' => '</p>',
1200
- 'before_error' => '<p>',
1201
- 'error' => __('Error: Feed has an error or is not valid', FB_RSSI_TEXTDOMAIN),
1202
- 'after_error' => '</p>',
1203
- 'paging' => 0,
1204
- 'prev_paging_link' => __('&laquo; Previous', FB_RSSI_TEXTDOMAIN),
1205
- 'next_paging_link' => __('Next &raquo;', FB_RSSI_TEXTDOMAIN),
1206
- 'prev_paging_title' => __('more items', FB_RSSI_TEXTDOMAIN),
1207
- 'next_paging_title' => __('more items', FB_RSSI_TEXTDOMAIN),
1208
- 'use_simplepie' => 1
1209
- )
1210
);
1211
-
1212
- $title = strip_tags($instance['title']);
1213
- $titlelink = esc_url($instance['titlelink']);
1214
- $display = (int) $instance['display'];
1215
- $feedurl = $instance['feedurl'];
1216
- $before_desc = $instance['before_desc'];
1217
- $displaydescriptions = (int) $instance['displaydescriptions'];
1218
- $after_desc = format_to_edit( $instance['after_desc'] );
1219
- $html = (int) $instance['html'];
1220
- $truncatedescchar = (int) $instance['truncatedescchar'];
1221
- $truncatedescstring = (int) $instance['truncatedescstring'];
1222
- $truncatetitlechar = $instance['truncatetitlechar'];
1223
- $truncatetitlestring = $instance['truncatetitlestring'];
1224
- $before_date = $instance['before_date'];
1225
- $date = (int) $instance['date'];
1226
- $after_date = $instance['after_date'];
1227
- $date_format = $instance['date_format'];
1228
- $before_creator = $instance['before_creator'];
1229
- $creator = (int) $instance['creator'];
1230
- $after_creator = $instance['after_creator'];
1231
- $start_items = $instance['start_items'];
1232
- $end_items = $instance['end_items'];
1233
- $start_item = $instance['start_item'];
1234
- $end_item = $instance['end_item'];
1235
- $target = $instance['target'];
1236
- $rel = $instance['rel'];
1237
- $desc4title = (int) $instance['desc4title'];
1238
- $charsetscan = (int) $instance['charsetscan'];
1239
- $debug = (int) $instance['debug'];
1240
- $before_noitems = $instance['before_noitems'];
1241
- $noitems = $instance['noitems'];
1242
- $after_noitems = $instance['after_noitems'];
1243
- $before_error = $instance['before_error'];
1244
- $error = $instance['error'];
1245
- $after_error = $instance['after_error'];
1246
- $paging = (int) $instance['paging'];
1247
- $prev_paging_link = $instance['prev_paging_link'];
1248
- $next_paging_link = $instance['next_paging_link'];
1249
- $prev_paging_title = $instance['prev_paging_title'];
1250
- $next_paging_title = $instance['next_paging_title'];
1251
- $use_simplepie = (int) $instance['use_simplepie'];
1252
- $view = (int) $instance['view'];
1253
?>
1254
- <p>
1255
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1256
- </p>
1257
- <p>
1258
- <label for="<?php echo $this->get_field_id('titlelink'); ?>"><?php _e( 'URL for Title (incl. http://):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1259
- </p>
1260
- <p>
1261
- <label for="<?php echo $this->get_field_id('display'); ?>"><?php _e( 'Display:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1262
- </p>
1263
- <p>
1264
- <label for="<?php echo $this->get_field_id('feedurl'); ?>"><?php _e( 'FeedURL:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1265
- </p>
1266
- <p>
1267
- <label for="<?php echo $this->get_field_id('before_desc'); ?>"><?php _e( 'Before Description:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1268
- </p>
1269
- <p>
1270
- <label for="<?php echo $this->get_field_id('displaydescriptions'); ?>"><?php _e( 'Display Description:', FB_RSSI_TEXTDOMAIN ) ?>
1271
- <select id="<?php echo $this->get_field_id('displaydescriptions'); ?>" name="<?php echo $this->get_field_name('displaydescriptions'); ?>">
1272
- <option value="0"<?php if ($displaydescriptions == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1273
- <option value="1"<?php if ($displaydescriptions == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1274
- </select>
1275
- </label>
1276
- </p>
1277
- <p>
1278
- <label for="<?php echo $this->get_field_id('after_desc'); ?>"><?php _e( 'After Description:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1279
- <br /><small><?php _e( 'You can use the following strings to create custom links:', FB_RSSI_TEXTDOMAIN ); ?> <code>%title%</code>, <code>%href%</code>
1280
- <br /><?php _e( 'Example:', FB_RSSI_TEXTDOMAIN ); ?> <code>&lt;a href="%href%" target="self" rel="follow"&gt;%title%&lt;/a&gt;</code></small>
1281
- </p>
1282
- <p>
1283
- <label for="<?php echo $this->get_field_id('html'); ?>"><?php _e( 'HTML:', FB_RSSI_TEXTDOMAIN ) ?>
1284
- <select id="<?php echo $this->get_field_id('html'); ?>" name="<?php echo $this->get_field_name('html'); ?>">
1285
- <option value="0"<?php if ($html == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1286
- <option value="1"<?php if ($html == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1287
- </select>
1288
- </label>
1289
- </p>
1290
- <p>
1291
- <label for="<?php echo $this->get_field_id('truncatedescchar'); ?>"><?php _e( 'Truncate Description Char:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1292
- </p>
1293
- <p>
1294
- <label for="<?php echo $this->get_field_id('truncatedescstring'); ?>"><?php _e( 'Truncate Description String (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1295
- </p>
1296
- <p>
1297
- <label for="<?php echo $this->get_field_id('truncatetitlechar'); ?>"><?php _e( 'Truncate Title Char:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1298
- </p>
1299
- <p>
1300
- <label for="<?php echo $this->get_field_id('truncatetitlestring'); ?>"><?php _e( 'Truncate Title String (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1301
- </p>
1302
- <p>
1303
- <label for="<?php echo $this->get_field_id('before_date'); ?>"><?php _e( 'Before Date (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1304
- </p>
1305
- <p>
1306
- <label for="<?php echo $this->get_field_id('date'); ?>"><?php _e( 'Date:', FB_RSSI_TEXTDOMAIN ) ?>
1307
- <select id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>">
1308
- <option value="0"<?php if ($date == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1309
- <option value="1"<?php if ($date == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1310
- </select>
1311
- </label>
1312
- </p>
1313
- <p>
1314
- <label for="<?php echo $this->get_field_id('after_date'); ?>"><?php _e( 'After Date (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1315
- </p>
1316
- <p>
1317
- <label for="<?php echo $this->get_field_id('date_format'); ?>"><?php _e( 'Date Formatting:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1318
- <br /><small><?php _e( 'Leave empty for use the date format of your WordPress settings.', FB_RSSI_TEXTDOMAIN ); ?> <a href="http://codex.wordpress.org/Formatting_Date_and_Time"><?php _e( 'Documentation on date formatting', FB_RSSI_TEXTDOMAIN ); ?></a></small>
1319
- </p>
1320
- <p>
1321
- <label for="<?php echo $this->get_field_id('before_creator'); ?>"><?php _e( 'Before Creator (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1322
- </p>
1323
- <p>
1324
- <label for="<?php echo $this->get_field_id('creator'); ?>"><?php _e( 'Creator:', FB_RSSI_TEXTDOMAIN ) ?>
1325
- <select id="<?php echo $this->get_field_id('creator'); ?>" name="<?php echo $this->get_field_name('creator'); ?>">
1326
- <option value="0"<?php if ($creator == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1327
- <option value="1"<?php if ($creator == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1328
- </select>
1329
- </label>
1330
- </p>
1331
- <p>
1332
- <label for="<?php echo $this->get_field_id('after_creator'); ?>"><?php _e( 'After Creator (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1333
- </p>
1334
- <p>
1335
- <label for="<?php echo $this->get_field_id('start_items'); ?>"><?php _e( 'Before Items (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1336
- </p>
1337
- <p>
1338
- <label for="<?php echo $this->get_field_id('end_items'); ?>"><?php _e( 'After Items (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1339
- </p>
1340
- <p>
1341
- <label for="<?php echo $this->get_field_id('start_item'); ?>"><?php _e( 'Before Item (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1342
- </p>
1343
- <p>
1344
- <label for="<?php echo $this->get_field_id('end_item'); ?>"><?php _e( 'After Item (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1345
- </p>
1346
- <p>
1347
- <label for="<?php echo $this->get_field_id('target'); ?>"><?php _e( 'Target Attribut:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1348
- </p>
1349
- <p>
1350
- <label for="<?php echo $this->get_field_id('rel'); ?>"><?php _e( 'Rel Attribut:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1351
- </p>
1352
- <p>
1353
- <label for="<?php echo $this->get_field_id('desc4title'); ?>"><?php _e( 'Desc4Title:', FB_RSSI_TEXTDOMAIN ) ?>
1354
- <select id="<?php echo $this->get_field_id('desc4title'); ?>" name="<?php echo $this->get_field_name('desc4title'); ?>">
1355
- <option value="0"<?php if ($desc4title == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1356
- <option value="1"<?php if ($desc4title == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1357
- </select>
1358
- </label>
1359
- <br />
1360
- <small><?php _e( 'Description for title-Attribut on Title-Link', FB_RSSI_TEXTDOMAIN ); ?></small>
1361
- </p>
1362
- <p>
1363
- <label for="<?php echo $this->get_field_id('charsetscan'); ?>"><?php _e( 'Charsetscan:', FB_RSSI_TEXTDOMAIN ) ?>
1364
- <select id="<?php echo $this->get_field_id('charsetscan'); ?>" name="<?php echo $this->get_field_name('charsetscan'); ?>">
1365
- <option value="0"<?php if ($charsetscan == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1366
- <option value="1"<?php if ($charsetscan == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1367
- </select>
1368
- </label>
1369
- </p>
1370
- <p>
1371
- <label for="<?php echo $this->get_field_id('debug'); ?>"><?php _e( 'Debug mode:', FB_RSSI_TEXTDOMAIN ) ?>
1372
- <select id="<?php echo $this->get_field_id('debug'); ?>" name="<?php echo $this->get_field_name('debug'); ?>">
1373
- <option value="0"<?php if ($debug == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1374
- <option value="1"<?php if ($debug == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1375
- </select>
1376
- </label>
1377
- </p>
1378
- <p>
1379
- <label for="<?php echo $this->get_field_id('before_noitems'); ?>"><?php _e( 'Before <em>No</em> Items Message (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1380
- </p>
1381
- <p>
1382
- <label for="<?php echo $this->get_field_id('noitems'); ?>"><?php _e( '<em>No</em> Items Message:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1383
- </p>
1384
- <p>
1385
- <label for="<?php echo $this->get_field_id('after_noitems'); ?>"><?php _e( 'After <em>No</em> Items Message (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1386
- </p>
1387
- <p>
1388
- <label for="<?php echo $this->get_field_id('before_error'); ?>"><?php _e( 'Before Error Message (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1389
- </p>
1390
- <p>
1391
- <label for="<?php echo $this->get_field_id('error'); ?>"><?php _e( 'Error Message:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1392
- </p>
1393
- <p>
1394
- <label for="<?php echo $this->get_field_id('after_error'); ?>"><?php _e( 'After Error Message (HTML):', FB_RSSI_TEXTDOMAIN ) ?> <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>
1395
- </p>
1396
- <p>
1397
- <label for="<?php echo $this->get_field_id('paging'); ?>"><?php _e( 'Pagination:', FB_RSSI_TEXTDOMAIN ) ?>
1398
- <select id="<?php echo $this->get_field_id('paging'); ?>" name="<?php echo $this->get_field_name('paging'); ?>">
1399
- <option value="0"<?php if ($paging == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1400
- <option value="1"<?php if ($paging == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1401
- </select>
1402
- </label>
1403
- </p>
1404
- <p>
1405
- <label for="<?php echo $this->get_field_id('prev_paging_link'); ?>"><?php _e( 'Previous Pagination Link String:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1406
- </p>
1407
- <p>
1408
- <label for="<?php echo $this->get_field_id('next_paging_link'); ?>"><?php _e( 'Next Pagination Link String:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1409
- </p>
1410
- <p>
1411
- <label for="<?php echo $this->get_field_id('prev_paging_title'); ?>"><?php _e( 'Previous Pagination Title String:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1412
- </p>
1413
- <p>
1414
- <label for="<?php echo $this->get_field_id('next_paging_title'); ?>"><?php _e( 'Next Pagination Title String:', FB_RSSI_TEXTDOMAIN ) ?> <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>
1415
- </p>
1416
- <p>
1417
- <label for="<?php echo $this->get_field_id('use_simplepie'); ?>"><?php _e( 'Use SimplePie class:', FB_RSSI_TEXTDOMAIN ) ?>
1418
- <select id="<?php echo $this->get_field_id('use_simplepie'); ?>" name="<?php echo $this->get_field_name('use_simplepie'); ?>">
1419
- <option value="0"<?php if ($use_simplepie == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1420
- <option value="1"<?php if ($use_simplepie == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1421
- </select>
1422
- </label>
1423
- </p>
1424
- <p>
1425
- <label for="<?php echo $this->get_field_id('view'); ?>"><?php _e( 'Echo/Return:', FB_RSSI_TEXTDOMAIN ) ?>
1426
- <select id="<?php echo $this->get_field_id('view'); ?>" name="<?php echo $this->get_field_name('view'); ?>">
1427
- <option value="0"<?php if ($view == '0') { echo ' selected="selected"'; } ?>><?php _e('False', FB_RSSI_TEXTDOMAIN ); ?></option>
1428
- <option value="1"<?php if ($view == '1') { echo ' selected="selected"'; } ?>><?php _e('True', FB_RSSI_TEXTDOMAIN ); ?></option>
1429
- </select>
1430
- </label>
1431
- </p>
1432
<?php
1433
-
1434
}
1435
}
1436
-
1437
- add_action( 'widgets_init', create_function('', 'return register_widget("RSSImport_Widget");') );
1438
1439
} // end if class wp_widget exists
1
<?php
2
/**
3
* Plugin Name: WP-RSSImport
4
+ * Plugin URI: https://wordpress.org/support/plugin/
5
* Text Domain: rssimport
6
* Domain Path: /languages
7
+ * Description: Display Feeds in your blog. Use the function RSSImport(), a Widget or the Shortcode [RSSImport].
8
* Author: Frank Bültge, took77
9
+ * Version: 4.4.17
10
+ * License: GPLv3+
11
+ * Last change: 2016-04-17
12
+ */
13
14
/*
15
------------------------------------------------------------
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
------------------------------------------------------------
27
*/
28
29
//avoid direct calls to this file, because now WP core and framework has been used
30
+ if ( ! function_exists( 'add_action' ) ) {
31
+ header( 'Status: 403 Forbidden' );
32
+ header( 'HTTP/1.1 403 Forbidden' );
33
exit();
34
}
35
36
+ if ( function_exists( 'add_action' ) ) {
37
//WordPress definitions
38
+ if ( ! defined( 'WP_CONTENT_URL' ) ) {
39
+ define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
40
+ }
41
+ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
42
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
43
+ }
44
+ if ( ! defined( 'WP_PLUGIN_URL' ) ) {
45
+ define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );
46
+ }
47
+ if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
48
+ define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
49
+ }
50
+ if ( ! defined( 'PLUGINDIR' ) ) {
51
+ define( 'PLUGINDIR', 'wp-content/plugins' );
52
+ } // Relative to ABSPATH. For back combat
53
+ if ( ! defined( 'WP_LANG_DIR' ) ) {
54
+ define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
55
+ }
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 );
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
}
69
}
70
71
+ // Cache reporting.
72
+ // define('MAGPIE_CACHE_ON', FALSE); // Cache off
73
+ if ( ! defined( 'MAGPIE_CACHE_AGE' ) ) {
74
+ define( 'MAGPIE_CACHE_AGE', '60*60' ); // in sec, one hour
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 string $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 $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
+ *
118
+ * @return string
119
+ */
120
function RSSImport(
121
+ $display = 5,
122
+ $feedurl = 'http://bueltge.de/feed/',
123
+ $before_desc = '',
124
+ $displaydescriptions = 0,
125
+ $after_desc = '',
126
+ $html = 0,
127
+ $truncatedescchar = 200,
128
+ $truncatedescstring = ' ... ',
129
+ $truncatetitlechar = 0,
130
+ $truncatetitlestring = ' ... ',
131
+ $before_date = ' <small>',
132
+ $date = 0,
133
+ $after_date = '</small>',
134
+ $date_format = '',
135
+ $before_creator = ' <small>',
136
+ $creator = 0,
137
+ $after_creator = '</small>',
138
+ $start_items = '<ul>',
139
+ $end_items = '</ul>',
140
+ $start_item = '<li>',
141
+ $end_item = '</li>',
142
+ $target = '',
143
+ $rel = '',
144
+ $desc4title = 0,
145
+ $charsetscan = 0,
146
+ $debug = 0,
147
+ $before_noitems = '<p>',
148
+ $noitems = 'No items, feed is empty.',
149
+ $after_noitems = '</p>',
150
+ $before_error = '<p>',
151
+ $error = 'Error: Feed has an error or is not valid',
152
+ $after_error = '</p>',
153
+ $paging = 0,
154
+ $prev_paging_link = '&laquo; Previous',
155
+ $next_paging_link = 'Next &raquo;',
156
+ $prev_paging_title = 'more items',
157
+ $next_paging_title = 'more items',
158
+ $use_simplepie = 1,
159
+ $view = 1
160
+ ) {
161
+
162
// replace for yahoo pipes urls
163
+ $feedurl = str_replace( '&#038;', '&', $feedurl );
164
+
165
+ $display = (int) $display;
166
$displaydescriptions = (int) $displaydescriptions;
167
+ $html = (int) $html;
168
+ $truncatedescchar = (int) $truncatedescchar;
169
+ $truncatetitlechar = (int) $truncatetitlechar;
170
+ $date = (int) $date;
171
+ if ( '' === $date_format ) {
172
+ $date_format = get_option( 'date_format' );
173
+ }
174
+ $creator = (int) $creator;
175
+ $charsetscan = (int) $charsetscan;
176
+ $debug = (int) $debug;
177
+ $paging = (int) $paging;
178
$use_simplepie = (int) $use_simplepie;
179
+ $view = (int) $view;
180
+
181
+ if ( $use_simplepie ) {
182
+ if ( ! class_exists( 'SimplePie' ) ) {
183
+ if ( file_exists( ABSPATH . WPINC . '/class-simplepie.php' ) ) {
184
+ @require_once( ABSPATH . WPINC . '/class-simplepie.php' );
185
} else {
186
+ die ( __( 'Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The WordPress file "class-simplepie.php" with class SimplePie could not be included.' ) );
187
}
188
}
189
} else {
190
// For function fetch_rss from wp-core
191
+ if ( file_exists( ABSPATH . WPINC . '/rss.php' ) ) {
192
+ require_once( ABSPATH . WPINC . '/rss.php' );
193
// It's Wordpress 2.x. since it has been loaded successfully
194
+ } elseif ( file_exists( ABSPATH . WPINC . '/rss-functions.php' ) ) {
195
+ require_once( ABSPATH . WPINC . '/rss-functions.php' );
196
// In Wordpress < 2.1
197
} else {
198
+ die ( __( 'Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The Wordpress file "rss-functions.php" or "rss.php" could not be included.' ) );
199
}
200
}
201
+
202
+ $display = (int) $display;
203
+ $page = ( ( ! empty( $_GET[ 'rsspage' ] ) && (int) $_GET[ 'rsspage' ] > 0 )
204
+ ? (int) $_GET[ 'rsspage' ] : 1 );
205
+ $truncatedescchar = (int) $truncatedescchar;
206
+ $truncatetitlechar = (int) $truncatetitlechar;
207
+ $echo = '<!--via MagpieRSS with RSSImport-->';
208
+ if ( $use_simplepie ) {
209
$echo = '<!--via SimplePie with RSSImport-->';
210
}
211
+
212
+ // read in file for search charset
213
+ if ( $charsetscan && function_exists( 'file_get_contents' ) ) {
214
+ ini_set( 'default_socket_timeout', 10 );
215
+ $a = file_get_contents( $feedurl );
216
+ // for better performance, if the server accepts the method
217
+ // $a = file_get_contents( $feedurl, FALSE, NULL, 0, 50 );
218
+ }
219
+
220
+ if ( $use_simplepie ) {
221
+ $rss = fetch_feed( $feedurl );
222
+ } else {
223
+ $rss = fetch_rss( $feedurl );
224
+ }
225
+
226
+ if ( $rss && ! is_wp_error( $rss ) ) {
227
+
228
// the follow print_r list all items in array, for debug purpose
229
if ( $debug ) {
230
+ print '<pre>';
231
+ print 'FeedURL: ' . $feedurl . '<br>';
232
+ print 'The object after parsing Feed URL:<br>';
233
+ print_r( $rss );
234
+ print '</pre>';
235
+ if ( ! defined( 'MAGPIE_CACHE_ON' ) ) {
236
+ define( 'MAGPIE_CACHE_ON', FALSE );
237
+ }
238
}
239
+
240
+ if ( isset( $target ) && '' !== $target ) {
241
$target = ' target="_' . $target . '"';
242
+ }
243
+
244
+ if ( isset( $rel ) && '' !== $rel ) {
245
$rel = ' rel="' . $rel . '"';
246
+ }
247
+
248
+ $displayitems = $display;
249
+ $displaylimit = ( $page * $display );
250
+ $display = ( ( $page - 1 ) * $display );
251
+ $nextitems = TRUE;
252
$previousitems = FALSE;
253
+ if ( $page > 1 ) {
254
$previousitems = TRUE;
255
+ }
256
+
257
+ while ( $display < $displaylimit ) {
258
+
259
+ if ( $use_simplepie && ( 1 === $paging ) ) {
260
+ /** @var SimplePie $rss */
261
$items = $rss->get_items();
262
+ } elseif ( $use_simplepie ) {
263
+ /** @var SimplePie $rss */
264
+ $items = $rss->get_items( 0, $displayitems );
265
+ } else {
266
+ /** @var MagpieRSS $rss */
267
$items = $rss->items;
268
+ }
269
+
270
if ( array_key_exists( $display, $items ) ) {
271
+
272
+ if ( $use_simplepie ) {
273
+ /** @var SimplePie $rss */
274
+ $item = $rss->get_item( $display );
275
+ } else {
276
+ /** @var MagpieRSS $rss */
277
+ $item = $rss->items[ $display ];
278
+ }
279
// import title
280
+ $title = '';
281
+ if ( $use_simplepie ) {
282
$title = esc_attr( strip_tags( $item->get_title() ) );
283
+ } elseif ( isset( $item[ 'title' ] ) ) {
284
+ $title = esc_attr( strip_tags( $item[ 'title' ] ) );
285
+ }
286
// import link
287
+ $href = '';
288
+ if ( $use_simplepie ) {
289
+ $href = wp_filter_kses( $item->get_link() );
290
+ } elseif ( isset( $item[ 'link' ] ) ) {
291
+ $href = wp_filter_kses( $item[ 'link' ] );
292
+ }
293
// import picture_url
294
+ $picture_url = '';
295
+ if ( $use_simplepie && $enclosure = $item->get_enclosure() ) {
296
+ $picture_url = wp_filter_kses( $enclosure->get_thumbnail() );
297
}
298
+
299
+ $start_item_temp = str_replace( '%title%', $title, $start_item );
300
+ $start_item_temp = str_replace( '%href%', $href, $start_item_temp );
301
+ $start_item_temp = str_replace( '%picture_url%', $picture_url, $start_item_temp );
302
$echo .= $start_item_temp;
303
+
304
// import date
305
+ if ( $use_simplepie && $date ) {
306
$pubDate = date_i18n( $date_format, strtotime( $item->get_date() ) );
307
+ } elseif ( $date && isset( $item[ 'pubdate' ] ) ) {
308
+ $pubDate = date_i18n( $date_format, strtotime( $item[ 'pubdate' ] ) );
309
+ }
310
// import creator
311
+ if ( $use_simplepie && $creator ) {
312
$creator = $item->get_author();
313
+ if ( is_object( $creator ) ) {
314
$creator = $creator->get_name();
315
$creator = ' <cite>' . esc_html( strip_tags( $creator ) ) . '</cite>';
316
}
317
+ } elseif ( $creator && isset( $item[ 'dc' ][ 'creator' ] ) ) {
318
+ $creator = esc_html( $item[ 'dc' ][ 'creator' ] );
319
+ } elseif ( $creator && isset( $item[ 'creator' ] ) ) {
320
+ $creator = esc_html( $item[ 'creator' ] );
321
}
322
// import desc
323
+ if ( $use_simplepie && $displaydescriptions && $html ) {
324
+ $desc = @html_entity_decode( $item->get_content(), ENT_QUOTES, get_option( 'blog_charset' ) );
325
+ } // For import with HTML
326
+ elseif ( $use_simplepie && $displaydescriptions && ! $html ) {
327
+ $desc = str_replace(
328
+ array( "\n", "\r" ), ' ',
329
+ esc_attr( strip_tags(
330
+ @html_entity_decode(
331
+ $item->get_description(),
332
+ ENT_QUOTES,
333
+ get_option( 'blog_charset' ) ) )
334
+ )
335
+ );
336
+ } // For import without HTML
337
+ elseif ( $displaydescriptions && $html && isset( $item[ 'content' ][ 'encoded' ] ) && $item[ 'content' ][ 'encoded' ] != 'A' ) {
338
+ $desc = $item[ 'content' ][ 'encoded' ];
339
+ } // For import with HTML
340
+ elseif ( $displaydescriptions && $html && isset( $item[ 'content' ][ 'atom_content' ] ) && $item[ 'content' ][ 'atom_content' ] != 'A' ) {
341
+ $desc = $item[ 'content' ][ 'atom_content' ];
342
+ } // For import with HTML
343
+ elseif ( $displaydescriptions && $html && isset( $item[ 'content' ] ) && ! is_array( $item[ 'content' ] ) ) {
344
+ $desc = $item[ 'content' ];
345
+ } elseif ( $displaydescriptions && $html && isset( $item[ 'description' ] ) ) {
346
+ $desc = $item[ 'description' ];
347
+ } elseif ( $displaydescriptions && ! $html && isset( $item[ 'description' ] ) ) {
348
+ $desc = esc_html( strip_tags( $item[ 'description' ] ) );
349
+ } // For import without HTML
350
+
351
+ if ( isset( $a ) && FALSE !== stripos( $a, 'ISO' ) ) {
352
+ if ( $debug ) {
353
$echo .= 'ISO Feed' . "\n";
354
+ }
355
+ if ( isset( $title ) ) {
356
+ isodec( $title );
357
+ }
358
+ if ( isset( $creator ) ) {
359
+ isodec( $creator );
360
+ }
361
+ if ( isset( $desc ) ) {
362
+ isodec( $desc );
363
+ }
364
} else {
365
+ if ( $debug ) {
366
$echo .= 'NonISO Feed' . "\n";
367
+ }
368
+ if ( isset( $title ) ) {
369
+ utf8dec( $title );
370
+ }
371
+ if ( isset( $creator ) ) {
372
+ utf8dec( $creator );
373
+ }
374
+ if ( isset( $desc ) ) {
375
+ utf8dec( $desc );
376
+ }
377
}
378
+
379
+ if ( isset( $title ) ) {
380
+ all_convert( $title );
381
}
382
+ if ( isset( $creator ) ) {
383
+ all_convert( $creator );
384
+ }
385
+ if ( isset( $desc ) ) {
386
+ all_convert( $desc );
387
+ }
388
+
389
+ if ( isset( $title ) && $truncatetitlechar && ( strlen( $title ) > $truncatetitlechar ) ) {
390
+ $title = wp_html_excerpt( $title, $truncatetitlechar ) . $truncatetitlestring;
391
+ }
392
+
393
+ if ( isset( $desc ) && $truncatedescchar && ( strlen( $desc ) > $truncatedescchar ) ) {
394
+ $desc = wp_html_excerpt( $desc, $truncatedescchar ) . $truncatedescstring;
395
}
396
+
397
if ( $desc4title ) {
398
+ $desc = '';
399
+ if ( $use_simplepie ) {
400
+ $desc = str_replace(
401
+ array( "\n", "\r" ),
402
+ ' ',
403
+ esc_attr( strip_tags(
404
+ @html_entity_decode( $item->get_description(),
405
+ ENT_QUOTES,
406
+ get_option( 'blog_charset' )
407
+ )
408
+ )
409
+ )
410
+ );
411
+ } // For import without HTML
412
+ else if ( isset( $item[ 'description' ] ) ) {
413
+ $desc = esc_html( strip_tags( $item[ 'description' ] ) );
414
+ }
415
+ $atitle = wp_html_excerpt( $desc, $truncatedescchar ) . $truncatedescstring;
416
} else {
417
$atitle = $title;
418
}
419
+
420
+ $echo .= '<a' . $target . $rel . ' href="' . $href . '" title="' . $atitle . '">' . $title . '</a>';
421
+ if ( isset( $pubDate ) && $date && '' !== $pubDate ) {
422
$echo .= $before_date . $pubDate . $after_date;
423
+ }
424
+ if ( isset( $creator ) && $creator && '' !== $creator ) {
425
$echo .= $before_creator . $creator . $after_creator;
426
+ }
427
+ if ( isset( $desc ) && $displaydescriptions && '' !== $desc ) {
428
+ $after_desc_temp = stripslashes_deep( $after_desc );
429
+ $after_desc_temp = str_replace( '%title%', $title, $after_desc_temp );
430
+ $after_desc_temp = str_replace( '%href%', $href, $after_desc_temp );
431
+ $after_desc_temp = str_replace( '%picture_url%', $picture_url, $after_desc_temp );
432
+ $before_desc_temp = str_replace( '%title%', $title, $before_desc );
433
+ $before_desc_temp = str_replace( '%href%', $href, $before_desc_temp );
434
+ $before_desc_temp = str_replace( '%picture_url%', $picture_url, $before_desc_temp );
435
$echo .= $before_desc_temp . $desc . $after_desc_temp;
436
}
437
+ $end_item_temp = str_replace( '%title%', $title, $end_item );
438
+ $end_item_temp = str_replace( '%href%', $href, $end_item_temp );
439
+ $end_item_temp = str_replace( '%picture_url%', $picture_url, $end_item_temp );
440
$echo .= $end_item_temp;
441
} else {
442
$nextitems = FALSE;
443
}
444
+
445
+ $display ++;
446
+ }
447
+
448
+ if ( strip_tags( $echo ) ) { // novaclic: needed to filter out false content made of tags alone (html comments, html tags, ...)
449
+ $echo = wptexturize( $start_items . $echo . $end_items );
450
+ } else {
451
+ $echo = wptexturize( $before_noitems . $noitems . $after_noitems );
452
}
453
+
454
} else {
455
+ if ( empty( $rss->ERROR ) ) {
456
$rss->ERROR = NULL;
457
+ }
458
+ $echo = wptexturize( $before_error . $error . $rss->ERROR . $after_error );
459
}
460
+
461
+ if ( $paging ) {
462
$echo .= '<div class="rsspaging">';
463
+ if ( $previousitems ) {
464
+ $echo .= '<a href="' . add_query_arg( 'rsspage',
465
+ ( $page - 1 ) ) . '" class="rsspaging_prev" title="' . $prev_paging_title . '">' . $prev_paging_link . '</a>';
466
+ }
467
+ if ( $nextitems ) {
468
+ $echo .= '<a href="' . add_query_arg( 'rsspage',
469
+ ( $page + 1 ) ) . '" class="rsspaging_next" title="' . $next_paging_title . '">' . $next_paging_link . '</a>';
470
+ }
471
$echo .= '<br style="clear: both" />';
472
$echo .= '</div>';
473
}
474
+
475
+ if ( $view ) {
476
echo $echo;
477
+ } else {
478
return $echo;
479
+ }
480
}
481
482
+ function utf8dec( $s_String ) {
483
+
484
+ if ( version_compare( phpversion(), '5.0.0', '>=' ) ) {
485
+ $s_String = html_entity_decode( htmlentities( $s_String . " ", ENT_COMPAT, 'UTF-8' ) );
486
+ } else {
487
+ $s_String = RSSImport_html_entity_decode_php4( htmlentities( $s_String . " " ) );
488
+ }
489
+
490
+ return substr( $s_String, 0, - 1 );
491
}
492
493
+ function isodec( $s_String ) {
494
+
495
+ if ( version_compare( phpversion(), '5.0.0', '>=' ) ) {
496
+ $s_String = html_entity_decode( htmlentities( $s_String . ' ', ENT_COMPAT, 'ISO-8859-1' ) );
497
+ } else {
498
+ $s_String = RSSImport_html_entity_decode_php4( htmlentities( $s_String . ' ' ) );
499
+ }
500
+
501
+ return substr( $s_String, 0, - 1 );
502
}
503
504
+ function all_convert( $s_String ) {
505
506
// Array for entities
507
+ $umlaute = array('„','“','–',' \&#34;','&#8211;','&#8212;','&#8216;','&#8217;','&#8220;','&#8221;','&#8222;','&#8226;','&#8230;', '€', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', 'Ž', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›','œ','ž','Ÿ','¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','®','¯','°','±','²','³','´','µ','¶','·','¸','¹','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ',utf8_encode('€'),utf8_encode('‚'),utf8_encode('ƒ'),utf8_encode('„'),utf8_encode('…'),utf8_encode('†'),utf8_encode('‡'),utf8_encode('ˆ'),utf8_encode('‰'),utf8_encode('Š'),utf8_encode('‹'),utf8_encode('Œ'),utf8_encode('Ž'),utf8_encode('‘'),utf8_encode('’'),utf8_encode('“'),utf8_encode('”'),utf8_encode('•'),utf8_encode('–'),utf8_encode('—'),utf8_encode('˜'),utf8_encode('™'),utf8_encode('š'),utf8_encode('›'),utf8_encode('œ'),utf8_encode('ž'),utf8_encode('Ÿ'),utf8_encode('¡'),utf8_encode('¢'),utf8_encode('£'),utf8_encode('¤'),utf8_encode('¥'),utf8_encode('¦'),utf8_encode('§'),utf8_encode('¨'),utf8_encode('©'),utf8_encode('ª'),utf8_encode('«'),utf8_encode('¬'),utf8_encode('®'),utf8_encode('¯'),utf8_encode('°'),utf8_encode('±'),utf8_encode('²'),utf8_encode('³'),utf8_encode('´'),utf8_encode('µ'),utf8_encode('¶'),utf8_encode('·'),utf8_encode('¸'),utf8_encode('¹'),utf8_encode('º'),utf8_encode('»'),utf8_encode('¼'),utf8_encode('½'),utf8_encode('¾'),utf8_encode('¿'),utf8_encode('À'),utf8_encode('Á'),utf8_encode('Â'),utf8_encode('Ã'),utf8_encode('Ä'),utf8_encode('Å'),utf8_encode('Æ'),utf8_encode('Ç'),utf8_encode('È'),utf8_encode('É'),utf8_encode('Ê'),utf8_encode('Ë'),utf8_encode('Ì'),utf8_encode('Í'),utf8_encode('Î'),utf8_encode('Ï'),utf8_encode('Ð'),utf8_encode('Ñ'),utf8_encode('Ò'),utf8_encode('Ó'),utf8_encode('Ô'),utf8_encode('Õ'),utf8_encode('Ö'),utf8_encode('×'),utf8_encode('Ø'),utf8_encode('Ù'),utf8_encode('Ú'),utf8_encode('Û'),utf8_encode('Ü'),utf8_encode('Ý'),utf8_encode('Þ'),utf8_encode('ß'),utf8_encode('à'),utf8_encode('á'),utf8_encode('â'),utf8_encode('ã'),utf8_encode('ä'),utf8_encode('å'),utf8_encode('æ'),utf8_encode('ç'),utf8_encode('è'),utf8_encode('é'),utf8_encode('ê'),utf8_encode('ë'),utf8_encode('ì'),utf8_encode('í'),utf8_encode('î'),utf8_encode('ï'),utf8_encode('ð'),utf8_encode('ñ'),utf8_encode('ò'),utf8_encode('ó'),utf8_encode('ô'),utf8_encode('õ'),utf8_encode('ö'),utf8_encode('÷'),utf8_encode('ø'),utf8_encode('ù'),utf8_encode('ú'),utf8_encode('û'),utf8_encode('ü'),utf8_encode('ý'),utf8_encode('þ'),utf8_encode('ÿ'),chr(128),chr(129),chr(130),chr(131),chr(132),chr(133),chr(134),chr(135),chr(136),chr(137),chr(138),chr(139),chr(140),chr(141),chr(142),chr(143),chr(144),chr(145),chr(146),chr(147),chr(148),chr(149),chr(150),chr(151),chr(152),chr(153),chr(154),chr(155),chr(156),chr(157),chr(158),chr(159),chr(160),chr(161),chr(162),chr(163),chr(164),chr(165),chr(166),chr(167),chr(168),chr(169),chr(170),chr(171),chr(172),chr(173),chr(174),chr(175),chr(176),chr(177),chr(178),chr(179),chr(180),chr(181),chr(182),chr(183),chr(184),chr(185),chr(186),chr(187),chr(188),chr(189),chr(190),chr(191),chr(192),chr(193),chr(194),chr(195),chr(196),chr(197),chr(198),chr(199),chr(200),chr(201),chr(202),chr(203),chr(204),chr(205),chr(206),chr(207),chr(208),chr(209),chr(210),chr(211),chr(212),chr(213),chr(214),chr(215),chr(216),chr(217),chr(218),chr(219),chr(220),chr(221),chr(222),chr(223),chr(224),chr(225),chr(226),chr(227),chr(228),chr(229),chr(230),chr(231),chr(232),chr(233),chr(234),chr(235),chr(236),chr(237),chr(238),chr(239),chr(240),chr(241),chr(242),chr(243),chr(244),chr(245),chr(246),chr(247),chr(248),chr(249),chr(250),chr(251),chr(252),chr(253),chr(254),chr(255),chr(256));
508
+
509
+ $htmlcode = array( '&bdquo;','&ldquo;','&ndash;',' &#34;','&ndash;','&mdash;','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bdquo;','&bull;' ,'&hellip;','&euro;','&sbquo;','&fnof;','&bdquo;','&hellip;','&dagger;','&Dagger;','&circ;','&permil;','&Scaron;','&lsaquo;','&OElig;','&#x017D;','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bull;','&ndash;','&mdash;','&tilde;','&trade;','&scaron;','&rsaquo;','&oelig;','&#x017E;','&Yuml;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&supl;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;','&euro;','&sbquo;','&fnof;','&bdquo;','&hellip;','&dagger;','&Dagger;','&circ;','&permil;','&Scaron;','&lsaquo;','&OElig;','&#x017D;','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bull;','&ndash;','&mdash;','&tilde;','&trade;','&scaron;','&rsaquo;','&oelig;','&#x017E;','&Yuml;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&supl;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;','&euro;','','&sbquo;','&fnof;','&bdquo;','&hellip;','&dagger;','&Dagger;','&circ;','&permil;','&Scaron;','&lsaquo;','&OElig;','','&#x017D;','','','&lsquo;','&rsquo;','&ldquo;','&rdquo;','&bull;','&ndash;','&mdash;','&tilde;','&trade;','&scaron;','&rsaquo;','&oelig;','','&#x017E;','&Yuml;','&nbsp;','&iexcl;','&iexcl;','&iexcl;','&iexcl;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','­&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&supl;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;' );
510
+
511
//$s_String = str_replace($umlaute, $htmlcode, $s_String);
512
+ if ( version_compare( phpversion(), '5.0.0', '>=' ) ) {
513
+ $s_String = utf8_encode( html_entity_decode( str_replace( $umlaute, $htmlcode, $s_String ) ) );
514
+ } else {
515
+ $s_String = utf8_encode( RSSImport_html_entity_decode_php4( str_replace( $umlaute, $htmlcode, $s_String ) ) );
516
+ }
517
+
518
// &hellip; , &#8230;
519
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xC2\xA6~', '&hellip;', $s_String );
520
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\xA6~', '&hellip;', $s_String );
521
+ $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xC2\xA6~', '&hellip;', $s_String );
522
+
523
// &mdash; , &#8212;
524
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9D~', '&mdash;', $s_String );
525
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '&mdash;',
526
+ $s_String );
527
+ $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x80\x9D~', '&mdash;', $s_String );
528
+
529
// &ndash; , &#8211;
530
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9C~', '&ndash;', $s_String );
531
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ndash;',
532
+ $s_String );
533
+ $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x80\x9C~', '&ndash;', $s_String );
534
+
535
// &rsquo; , &#8217;
536
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2~', '&rsquo;', $s_String );
537
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '&rsquo;',
538
+ $s_String );
539
+ $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xE2\x84\xA2~', '&rsquo;', $s_String );
540
+ $s_String = preg_replace( '~\xD0\xBF\xD1\x97\xD0\x85~', '&rsquo;', $s_String );
541
+
542
// &lsquo; , &#8216;
543
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xCB\x9C~', '&lsquo;', $s_String );
544
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x8B\xC5\x93~', '&lsquo;', $s_String );
545
+
546
// &rdquo; , &#8221;
547
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '&rdquo;', $s_String );
548
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\x9D~', '&rdquo;', $s_String );
549
+ $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xD1\x9C~', '&rdquo;', $s_String );
550
+
551
// &ldquo; , &#8220;
552
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x82\xAC\xC5\x93~', '&ldquo;', $s_String );
553
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x85\xE2\x80\x9C~', '&ldquo;',
554
+ $s_String );
555
+ $s_String = preg_replace( '~\xD0\xB2\xD0\x82\xD1\x9A~', '&ldquo;', $s_String );
556
+
557
// &trade; , &#8482;
558
+ $s_String = preg_replace( '~\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '&trade;', $s_String );
559
+ $s_String = preg_replace( '~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x82\xAC\xC5\xBE\xC3\x82\xC2\xA2~', '&trade;', $s_String );
560
+
561
// th
562
+ $s_String = preg_replace( '~t\xC3\x82\xC2\xADh~', 'th', $s_String );
563
+
564
// .
565
+ $s_String = preg_replace( '~.\xD0\x92+~', '.', $s_String );
566
+ $s_String = preg_replace( '~.\xD0\x92~', '.', $s_String );
567
+
568
// ,
569
+ $s_String = preg_replace( '~\x2C\xD0\x92~', ',', $s_String );
570
571
return $s_String;
572
}
573
574
/**
575
* Entfernt unvollstaendige Worte am Ende eines Strings.
576
+ *
577
* @author Thomas Scholz <http://toscho.de>
578
+ *
579
+ * @param $str
580
+ *
581
* @return string
582
*/
583
+ function RSSImport_end_on_word( $str ) {
584
+
585
+ $arr = explode( ' ', trim( $str ) );
586
+ array_pop( $arr );
587
+
588
+ return rtrim( implode( ' ', $arr ), ',;' );
589
}
590
591
+ function RSSImport_Shortcode( $atts ) {
592
+
593
+ $args = shortcode_atts(
594
+ array(
595
+ 'display' => 5,
596
+ 'feedurl' => 'http://bueltge.de/feed/',
597
+ 'before_desc' => '<br />',
598
'displaydescriptions' => 0,
599
+ 'after_desc' => '',
600
+ 'html' => 0,
601
+ 'truncatedescchar' => 200,
602
+ 'truncatedescstring' => ' ... ',
603
+ 'truncatetitlechar' => '',
604
'truncatetitlestring' => ' ... ',
605
+ 'before_date' => ' <small>',
606
+ 'date' => 0,
607
+ 'after_date' => '</small>',
608
+ 'date_format' => '',
609
+ 'before_creator' => ' <small>',
610
+ 'creator' => 0,
611
+ 'after_creator' => '</small>',
612
+ 'start_items' => '<ul>',
613
+ 'end_items' => '</ul>',
614
+ 'start_item' => '<li>',
615
+ 'end_item' => '</li>',
616
+ 'target' => '',
617
+ 'rel' => '',
618
+ 'desc4title' => 0,
619
+ 'charsetscan' => 0,
620
+ 'debug' => 0,
621
+ 'before_noitems' => '<p>',
622
+ 'noitems' => __( 'No items, feed is empty.', FB_RSSI_TEXTDOMAIN ),
623
+ 'after_noitems' => '</p>',
624
+ 'before_error' => '<p>',
625
+ 'error' => __( 'Error: Feed has an error or is not valid',
626
+ FB_RSSI_TEXTDOMAIN ),
627
+ 'after_error' => '</p>',
628
+ 'paging' => 0,
629
+ 'prev_paging_link' => __( '&laquo; Previous', FB_RSSI_TEXTDOMAIN ),
630
+ 'next_paging_link' => __( 'Next &raquo;', FB_RSSI_TEXTDOMAIN ),
631
+ 'prev_paging_title' => __( 'more items', FB_RSSI_TEXTDOMAIN ),
632
+ 'next_paging_title' => __( 'more items', FB_RSSI_TEXTDOMAIN ),
633
+ 'use_simplepie' => 1,
634
+ 'view' => 0,
635
+ ),
636
+ $atts
637
);
638
+
639
+ $display = (int) $args[ 'display' ];
640
+ $feedurl = html_entity_decode( $args[ 'feedurl' ] ); // novaclic: undo encoding due to wordpress WYSIWYG editor
641
+ if ( 'true' === strtolower( $args[ 'html' ] ) ) {
642
+ $args[ 'html' ] = 1;
643
+ }
644
+ $before_desc = $args[ 'before_desc' ];
645
+ $html = (int) $args[ 'html' ];
646
+ if ( 'true' === strtolower( $args[ 'displaydescriptions' ] ) ) {
647
+ $args[ 'displaydescriptions' ] = 1;
648
+ }
649
+ $after_desc = $args[ 'after_desc' ];
650
+ $displaydescriptions = (int) $args[ 'displaydescriptions' ];
651
+ if ( 'true' === strtolower( $args[ 'truncatedescchar' ] ) ) {
652
+ $args[ 'truncatedescchar' ] = 1;
653
+ }
654
+ $truncatedescchar = (int) $args[ 'truncatedescchar' ];
655
+ if ( 'true' === strtolower( $args[ 'truncatetitlechar' ] ) ) {
656
+ $args[ 'truncatetitlechar' ] = 1;
657
+ }
658
+ $truncatedescstring = $args[ 'truncatedescstring' ];
659
+ $truncatetitlestring = $args[ 'truncatetitlestring' ];