Version Description
Download this release
Release Info
Developer | Bueltge |
Plugin | RSSImport |
Version | 4.2.2 |
Comparing to | |
See all releases |
Code changes from version 4.1 to 4.2.2
- rssimport.php +77 -17
rssimport.php
CHANGED
@@ -5,7 +5,7 @@ Plugin Name: WP-RSSImport
|
|
5 |
Plugin URI: http://bueltge.de/wp-rss-import-plugin/55/
|
6 |
Description: List a RSS-Feed in your WP-Blog, only headlines or with description.
|
7 |
Author: Frank Bueltge
|
8 |
-
Version: 4.
|
9 |
License: GPL
|
10 |
Author URI: http://bueltge.de
|
11 |
*/
|
@@ -22,13 +22,13 @@ Example: <?php RSSImport(10, "http://bueltge.de/feed/", true, false); ?>
|
|
22 |
------------------------------------------------------
|
23 |
*/
|
24 |
|
25 |
-
// For function fetch_rss
|
26 |
-
if(file_exists(ABSPATH . WPINC . '/rss
|
27 |
-
@require_once (ABSPATH . WPINC . '/rss-functions.php');
|
28 |
-
// It's Wordpress 1.5.2 or 2.x. since it has been loaded successfully
|
29 |
-
} elseif (file_exists(ABSPATH . WPINC . '/rss.php')) {
|
30 |
@require_once (ABSPATH . WPINC . '/rss.php');
|
31 |
-
//
|
|
|
|
|
|
|
32 |
} else {
|
33 |
die (__('Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The Wordpress file "rss-functions.php" or "rss.php" could not be included.'));
|
34 |
}
|
@@ -36,15 +36,18 @@ if(file_exists(ABSPATH . WPINC . '/rss-functions.php')) {
|
|
36 |
// cache and error report
|
37 |
//define('MAGPIE_CACHE_ON', false); // Cache off
|
38 |
define('MAGPIE_CACHE_AGE', '60*60'); // in sec, one hour
|
|
|
39 |
//error_reporting(E_ERROR);
|
40 |
|
41 |
function RSSImport($display=0, $feedurl, $displaydescriptions=false, $truncatetitle=true) {
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
$rss = fetch_rss($feedurl);
|
50 |
|
@@ -61,7 +64,6 @@ function RSSImport($display=0, $feedurl, $displaydescriptions=false, $truncateti
|
|
61 |
$href = $item['link'];
|
62 |
// view date
|
63 |
$pubDate = $item['pubdate'];
|
64 |
-
// cut date
|
65 |
$pubDate = substr($pubDate, 0, 25);
|
66 |
|
67 |
// Edit here:
|
@@ -77,10 +79,9 @@ function RSSImport($display=0, $feedurl, $displaydescriptions=false, $truncateti
|
|
77 |
utf8dec($title);
|
78 |
utf8dec($desc);
|
79 |
}
|
80 |
-
|
81 |
-
$
|
82 |
-
|
83 |
-
$desc = str_replace($umlaute, $htmlcode, $desc);
|
84 |
|
85 |
if ($truncatetitle && (strlen($title)>30)) {
|
86 |
$title = substr($title, 0, 30) . " ... ";
|
@@ -108,4 +109,63 @@ function isodec($s_String) {
|
|
108 |
$s_String = html_entity_decode(htmlentities($s_String." ", ENT_COMPAT, 'ISO-8859-1'));
|
109 |
return substr($s_String, 0, strlen($s_String)-1);
|
110 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
?>
|
5 |
Plugin URI: http://bueltge.de/wp-rss-import-plugin/55/
|
6 |
Description: List a RSS-Feed in your WP-Blog, only headlines or with description.
|
7 |
Author: Frank Bueltge
|
8 |
+
Version: 4.2.2
|
9 |
License: GPL
|
10 |
Author URI: http://bueltge.de
|
11 |
*/
|
22 |
------------------------------------------------------
|
23 |
*/
|
24 |
|
25 |
+
// For function fetch_rss from wp-core
|
26 |
+
if ( file_exists(ABSPATH . WPINC . '/rss.php') ) {
|
|
|
|
|
|
|
27 |
@require_once (ABSPATH . WPINC . '/rss.php');
|
28 |
+
// It's Wordpress 2.x. since it has been loaded successfully
|
29 |
+
} elseif (file_exists(ABSPATH . WPINC . '/rss-functions.php')) {
|
30 |
+
@require_once (ABSPATH . WPINC . '/rss-functions.php');
|
31 |
+
// In Wordpress < 2.1
|
32 |
} else {
|
33 |
die (__('Error in file: ' . __FILE__ . ' on line: ' . __LINE__ . '.<br />The Wordpress file "rss-functions.php" or "rss.php" could not be included.'));
|
34 |
}
|
36 |
// cache and error report
|
37 |
//define('MAGPIE_CACHE_ON', false); // Cache off
|
38 |
define('MAGPIE_CACHE_AGE', '60*60'); // in sec, one hour
|
39 |
+
// error reporting
|
40 |
//error_reporting(E_ERROR);
|
41 |
|
42 |
function RSSImport($display=0, $feedurl, $displaydescriptions=false, $truncatetitle=true) {
|
43 |
|
44 |
+
if ( function_exists('file_get_contents') ) {
|
45 |
+
// read in file for search charset
|
46 |
+
ini_set('default_socket_timeout', 120);
|
47 |
+
$a = file_get_contents($feedurl);
|
48 |
+
// for better performance, if the server accepts the method
|
49 |
+
//$a = file_get_contents($feedurl,FALSE,NULL,0,50);
|
50 |
+
}
|
51 |
|
52 |
$rss = fetch_rss($feedurl);
|
53 |
|
64 |
$href = $item['link'];
|
65 |
// view date
|
66 |
$pubDate = $item['pubdate'];
|
|
|
67 |
$pubDate = substr($pubDate, 0, 25);
|
68 |
|
69 |
// Edit here:
|
79 |
utf8dec($title);
|
80 |
utf8dec($desc);
|
81 |
}
|
82 |
+
|
83 |
+
all_convert($title);
|
84 |
+
all_convert($desc);
|
|
|
85 |
|
86 |
if ($truncatetitle && (strlen($title)>30)) {
|
87 |
$title = substr($title, 0, 30) . " ... ";
|
109 |
$s_String = html_entity_decode(htmlentities($s_String." ", ENT_COMPAT, 'ISO-8859-1'));
|
110 |
return substr($s_String, 0, strlen($s_String)-1);
|
111 |
}
|
112 |
+
|
113 |
+
function all_convert($s_String) {
|
114 |
+
|
115 |
+
// Array for entities
|
116 |
+
$umlaute = array('„','“','–',' \"','–','—','‘','’','“','”','„','•','…' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�' ,'�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�',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));
|
117 |
+
$htmlcode = array('„','“','–',' "','–','—','‘','’','“','”','„','•' ,'…','€','‚','ƒ','„','…','†','‡','ˆ','‰','Š','‹','Œ','Ž','‘','’','“','”','•','–','—','˜','™','š','›','œ','ž','Ÿ','¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','®','¯','°','±','²','³','´','µ','¶','·','¸','&supl;','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ','€','‚','ƒ','„','…','†','‡','ˆ','‰','Š','‹','Œ','Ž','‘','’','“','”','•','–','—','˜','™','š','›','œ','ž','Ÿ','¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','®','¯','°','±','²','³','´','µ','¶','·','¸','&supl;','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ','€','','‚','ƒ','„','…','†','‡','ˆ','‰','Š','‹','Œ','','Ž','','','‘','’','“','”','•','–','—','˜','™','š','›','œ','','ž','Ÿ',' ','¡','¡','¡','¡','¥','¦','§','¨','©','ª','«','¬','�­','®','¯','°','±','²','³','´','µ','¶','·','¸','&supl;','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ');
|
118 |
+
$s_String = str_replace($umlaute, $htmlcode, $s_String);
|
119 |
+
|
120 |
+
// … , …
|
121 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC2\xA6~', '…', $s_String);
|
122 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\xA6~', '…', $s_String);
|
123 |
+
$s_String = preg_replace('~\xD0\xB2\xD0\x82\xC2\xA6~', '…', $s_String);
|
124 |
+
|
125 |
+
// — , —
|
126 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9D~', '—', $s_String);
|
127 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '—', $s_String);
|
128 |
+
$s_String = preg_replace('~\xD0\xB2\xD0\x82\xE2\x80\x9D~', '—', $s_String);
|
129 |
+
|
130 |
+
// – , –
|
131 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x80\x9C~', '–', $s_String);
|
132 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x82\xAC\xC5\x93~', '–', $s_String);
|
133 |
+
$s_String = preg_replace('~\xD0\xB2\xD0\x82\xE2\x80\x9C~', '–', $s_String);
|
134 |
+
|
135 |
+
// ’ , ’
|
136 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2~', '’', $s_String);
|
137 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '’', $s_String);
|
138 |
+
$s_String = preg_replace('~\xD0\xB2\xD0\x82\xE2\x84\xA2~', '’', $s_String);
|
139 |
+
$s_String = preg_replace('~\xD0\xBF\xD1\x97\xD0\x85~', '’', $s_String);
|
140 |
+
|
141 |
+
// ‘ , ‘
|
142 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xCB\x9C~', '‘', $s_String);
|
143 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x8B\xC5\x93~', '‘', $s_String);
|
144 |
+
|
145 |
+
// ” , ”
|
146 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC2\x9D~', '”', $s_String);
|
147 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x82\xC2\x9D~', '”', $s_String);
|
148 |
+
$s_String = preg_replace('~\xD0\xB2\xD0\x82\xD1\x9C~', '”', $s_String);
|
149 |
+
|
150 |
+
// “ , “
|
151 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x82\xAC\xC5\x93~', '“', $s_String);
|
152 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x80\x9A\xC2\xAC\xC3\x85\xE2\x80\x9C~', '“', $s_String);
|
153 |
+
$s_String = preg_replace('~\xD0\xB2\xD0\x82\xD1\x9A~', '“', $s_String);
|
154 |
+
|
155 |
+
// ™ , ™
|
156 |
+
$s_String = preg_replace('~\xC3\xA2\xE2\x80\x9E\xC2\xA2~', '™', $s_String);
|
157 |
+
$s_String = preg_replace('~\xC3\x83\xC2\xA2\xC3\xA2\xE2\x82\xAC\xC5\xBE\xC3\x82\xC2\xA2~', '™', $s_String);
|
158 |
+
|
159 |
+
// th
|
160 |
+
$s_String = preg_replace('~t\xC3\x82\xC2\xADh~', 'th', $s_String);
|
161 |
+
|
162 |
+
// .
|
163 |
+
$s_String = preg_replace('~.\xD0\x92+~', '.', $s_String);
|
164 |
+
$s_String = preg_replace('~.\xD0\x92~', '.', $s_String);
|
165 |
+
|
166 |
+
// ,
|
167 |
+
$s_String = preg_replace('~\x2C\xD0\x92~', ',', $s_String);
|
168 |
+
|
169 |
+
return $s_String;
|
170 |
+
}
|
171 |
?>
|