author | ymh <ymh.work@gmail.com> |
Mon, 14 Oct 2019 18:28:13 +0200 | |
changeset 9 | 177826044cd9 |
parent 7 | cf61fcea0001 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Feed API |
|
4 |
* |
|
5 |
* Many of the functions used in here belong in The Loop, or The Loop for the |
|
6 |
* Feeds. |
|
7 |
* |
|
8 |
* @package WordPress |
|
9 |
* @subpackage Feed |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
10 |
* @since 2.1.0 |
0 | 11 |
*/ |
12 |
||
13 |
/** |
|
14 |
* RSS container for the bloginfo function. |
|
15 |
* |
|
16 |
* You can retrieve anything that you can using the get_bloginfo() function. |
|
17 |
* Everything will be stripped of tags and characters converted, when the values |
|
18 |
* are retrieved for use in the feeds. |
|
19 |
* |
|
20 |
* @since 1.5.1 |
|
21 |
* @see get_bloginfo() For the list of possible values to display. |
|
22 |
* |
|
23 |
* @param string $show See get_bloginfo() for possible values. |
|
24 |
* @return string |
|
25 |
*/ |
|
9 | 26 |
function get_bloginfo_rss( $show = '' ) { |
27 |
$info = strip_tags( get_bloginfo( $show ) ); |
|
5 | 28 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
29 |
* Filters the bloginfo for use in RSS feeds. |
5 | 30 |
* |
31 |
* @since 2.2.0 |
|
32 |
* |
|
33 |
* @see convert_chars() |
|
34 |
* @see get_bloginfo() |
|
35 |
* |
|
36 |
* @param string $info Converted string value of the blog information. |
|
37 |
* @param string $show The type of blog information to retrieve. |
|
38 |
*/ |
|
39 |
return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show ); |
|
0 | 40 |
} |
41 |
||
42 |
/** |
|
43 |
* Display RSS container for the bloginfo function. |
|
44 |
* |
|
45 |
* You can retrieve anything that you can using the get_bloginfo() function. |
|
46 |
* Everything will be stripped of tags and characters converted, when the values |
|
47 |
* are retrieved for use in the feeds. |
|
48 |
* |
|
49 |
* @since 0.71 |
|
50 |
* @see get_bloginfo() For the list of possible values to display. |
|
51 |
* |
|
52 |
* @param string $show See get_bloginfo() for possible values. |
|
53 |
*/ |
|
9 | 54 |
function bloginfo_rss( $show = '' ) { |
5 | 55 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
* Filters the bloginfo for display in RSS feeds. |
5 | 57 |
* |
58 |
* @since 2.1.0 |
|
59 |
* |
|
60 |
* @see get_bloginfo() |
|
61 |
* |
|
62 |
* @param string $rss_container RSS container for the blog information. |
|
63 |
* @param string $show The type of blog information to retrieve. |
|
64 |
*/ |
|
65 |
echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show ); |
|
0 | 66 |
} |
67 |
||
68 |
/** |
|
69 |
* Retrieve the default feed. |
|
70 |
* |
|
71 |
* The default feed is 'rss2', unless a plugin changes it through the |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
72 |
* {@see 'default_feed'} filter. |
0 | 73 |
* |
5 | 74 |
* @since 2.5.0 |
0 | 75 |
* |
76 |
* @return string Default feed, or for example 'rss2', 'atom', etc. |
|
77 |
*/ |
|
78 |
function get_default_feed() { |
|
5 | 79 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
* Filters the default feed type. |
5 | 81 |
* |
82 |
* @since 2.5.0 |
|
83 |
* |
|
84 |
* @param string $feed_type Type of default feed. Possible values include 'rss2', 'atom'. |
|
85 |
* Default 'rss2'. |
|
86 |
*/ |
|
87 |
$default_feed = apply_filters( 'default_feed', 'rss2' ); |
|
0 | 88 |
return 'rss' == $default_feed ? 'rss2' : $default_feed; |
89 |
} |
|
90 |
||
91 |
/** |
|
92 |
* Retrieve the blog title for the feed title. |
|
93 |
* |
|
94 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
95 |
* @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`. |
0 | 96 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
97 |
* @param string $deprecated Unused.. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
98 |
* @return string The document title. |
0 | 99 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
function get_wp_title_rss( $deprecated = '–' ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
101 |
if ( '–' !== $deprecated ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
/* translators: %s: 'document_title_separator' filter name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) ); |
5 | 104 |
} |
105 |
||
106 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
107 |
* Filters the blog title for use as the feed title. |
5 | 108 |
* |
109 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
110 |
* @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`. |
5 | 111 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
112 |
* @param string $title The current blog title. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
113 |
* @param string $deprecated Unused. |
5 | 114 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
115 |
return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated ); |
0 | 116 |
} |
117 |
||
118 |
/** |
|
119 |
* Display the blog title for display of the feed title. |
|
120 |
* |
|
121 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
122 |
* @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`. |
0 | 123 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
124 |
* @param string $deprecated Unused. |
0 | 125 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
126 |
function wp_title_rss( $deprecated = '–' ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
127 |
if ( '–' !== $deprecated ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
128 |
/* translators: %s: 'document_title_separator' filter name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
129 |
_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
130 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
131 |
|
5 | 132 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
133 |
* Filters the blog title for display of the feed title. |
5 | 134 |
* |
135 |
* @since 2.2.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
136 |
* @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`. |
5 | 137 |
* |
138 |
* @see get_wp_title_rss() |
|
139 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
140 |
* @param string $wp_title_rss The current blog title. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
141 |
* @param string $deprecated Unused. |
5 | 142 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated ); |
0 | 144 |
} |
145 |
||
146 |
/** |
|
147 |
* Retrieve the current post title for the feed. |
|
148 |
* |
|
149 |
* @since 2.0.0 |
|
150 |
* |
|
151 |
* @return string Current post title. |
|
152 |
*/ |
|
153 |
function get_the_title_rss() { |
|
154 |
$title = get_the_title(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
155 |
|
5 | 156 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
157 |
* Filters the post title for use in a feed. |
5 | 158 |
* |
159 |
* @since 1.2.0 |
|
160 |
* |
|
161 |
* @param string $title The current post title. |
|
162 |
*/ |
|
163 |
$title = apply_filters( 'the_title_rss', $title ); |
|
0 | 164 |
return $title; |
165 |
} |
|
166 |
||
167 |
/** |
|
168 |
* Display the post title in the feed. |
|
169 |
* |
|
170 |
* @since 0.71 |
|
171 |
*/ |
|
172 |
function the_title_rss() { |
|
173 |
echo get_the_title_rss(); |
|
174 |
} |
|
175 |
||
176 |
/** |
|
177 |
* Retrieve the post content for feeds. |
|
178 |
* |
|
179 |
* @since 2.9.0 |
|
180 |
* @see get_the_content() |
|
181 |
* |
|
182 |
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf |
|
183 |
* @return string The filtered content. |
|
184 |
*/ |
|
9 | 185 |
function get_the_content_feed( $feed_type = null ) { |
186 |
if ( ! $feed_type ) { |
|
0 | 187 |
$feed_type = get_default_feed(); |
9 | 188 |
} |
0 | 189 |
|
5 | 190 |
/** This filter is documented in wp-includes/post-template.php */ |
191 |
$content = apply_filters( 'the_content', get_the_content() ); |
|
9 | 192 |
$content = str_replace( ']]>', ']]>', $content ); |
5 | 193 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
194 |
* Filters the post content for use in feeds. |
5 | 195 |
* |
196 |
* @since 2.9.0 |
|
197 |
* |
|
198 |
* @param string $content The current post content. |
|
199 |
* @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'. |
|
200 |
* Default 'rss2'. |
|
201 |
*/ |
|
202 |
return apply_filters( 'the_content_feed', $content, $feed_type ); |
|
0 | 203 |
} |
204 |
||
205 |
/** |
|
206 |
* Display the post content for feeds. |
|
207 |
* |
|
208 |
* @since 2.9.0 |
|
209 |
* |
|
210 |
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf |
|
211 |
*/ |
|
9 | 212 |
function the_content_feed( $feed_type = null ) { |
213 |
echo get_the_content_feed( $feed_type ); |
|
0 | 214 |
} |
215 |
||
216 |
/** |
|
217 |
* Display the post excerpt for the feed. |
|
218 |
* |
|
219 |
* @since 0.71 |
|
220 |
*/ |
|
221 |
function the_excerpt_rss() { |
|
222 |
$output = get_the_excerpt(); |
|
5 | 223 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
224 |
* Filters the post excerpt for a feed. |
5 | 225 |
* |
226 |
* @since 1.2.0 |
|
227 |
* |
|
228 |
* @param string $output The current post excerpt. |
|
229 |
*/ |
|
230 |
echo apply_filters( 'the_excerpt_rss', $output ); |
|
0 | 231 |
} |
232 |
||
233 |
/** |
|
234 |
* Display the permalink to the post for use in feeds. |
|
235 |
* |
|
236 |
* @since 2.3.0 |
|
237 |
*/ |
|
238 |
function the_permalink_rss() { |
|
5 | 239 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
240 |
* Filters the permalink to the post for use in feeds. |
5 | 241 |
* |
242 |
* @since 2.3.0 |
|
243 |
* |
|
244 |
* @param string $post_permalink The current post permalink. |
|
245 |
*/ |
|
246 |
echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ); |
|
0 | 247 |
} |
248 |
||
249 |
/** |
|
250 |
* Outputs the link to the comments for the current post in an xml safe way |
|
251 |
* |
|
252 |
* @since 3.0.0 |
|
253 |
* @return none |
|
254 |
*/ |
|
255 |
function comments_link_feed() { |
|
5 | 256 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
257 |
* Filters the comments permalink for the current post. |
5 | 258 |
* |
259 |
* @since 3.6.0 |
|
260 |
* |
|
261 |
* @param string $comment_permalink The current comment permalink with |
|
262 |
* '#comments' appended. |
|
263 |
*/ |
|
0 | 264 |
echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) ); |
265 |
} |
|
266 |
||
267 |
/** |
|
268 |
* Display the feed GUID for the current comment. |
|
269 |
* |
|
270 |
* @since 2.5.0 |
|
271 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
272 |
* @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object. |
0 | 273 |
*/ |
9 | 274 |
function comment_guid( $comment_id = null ) { |
275 |
echo esc_url( get_comment_guid( $comment_id ) ); |
|
0 | 276 |
} |
277 |
||
278 |
/** |
|
279 |
* Retrieve the feed GUID for the current comment. |
|
280 |
* |
|
281 |
* @since 2.5.0 |
|
282 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
283 |
* @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object. |
5 | 284 |
* @return false|string false on failure or guid for comment on success. |
0 | 285 |
*/ |
9 | 286 |
function get_comment_guid( $comment_id = null ) { |
287 |
$comment = get_comment( $comment_id ); |
|
0 | 288 |
|
9 | 289 |
if ( ! is_object( $comment ) ) { |
0 | 290 |
return false; |
9 | 291 |
} |
0 | 292 |
|
9 | 293 |
return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; |
0 | 294 |
} |
295 |
||
296 |
/** |
|
297 |
* Display the link to the comments. |
|
298 |
* |
|
299 |
* @since 1.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
300 |
* @since 4.4.0 Introduced the `$comment` argument. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
301 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
302 |
* @param int|WP_Comment $comment Optional. Comment object or id. Defaults to global comment object. |
0 | 303 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
304 |
function comment_link( $comment = null ) { |
5 | 305 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
306 |
* Filters the current comment's permalink. |
5 | 307 |
* |
308 |
* @since 3.6.0 |
|
309 |
* |
|
310 |
* @see get_comment_link() |
|
311 |
* |
|
312 |
* @param string $comment_permalink The current comment permalink. |
|
313 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
314 |
echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) ); |
0 | 315 |
} |
316 |
||
317 |
/** |
|
318 |
* Retrieve the current comment author for use in the feeds. |
|
319 |
* |
|
320 |
* @since 2.0.0 |
|
321 |
* |
|
322 |
* @return string Comment Author |
|
323 |
*/ |
|
324 |
function get_comment_author_rss() { |
|
5 | 325 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
* Filters the current comment author for use in a feed. |
5 | 327 |
* |
328 |
* @since 1.5.0 |
|
329 |
* |
|
330 |
* @see get_comment_author() |
|
331 |
* |
|
332 |
* @param string $comment_author The current comment author. |
|
333 |
*/ |
|
334 |
return apply_filters( 'comment_author_rss', get_comment_author() ); |
|
0 | 335 |
} |
336 |
||
337 |
/** |
|
338 |
* Display the current comment author in the feed. |
|
339 |
* |
|
340 |
* @since 1.0.0 |
|
341 |
*/ |
|
342 |
function comment_author_rss() { |
|
343 |
echo get_comment_author_rss(); |
|
344 |
} |
|
345 |
||
346 |
/** |
|
347 |
* Display the current comment content for use in the feeds. |
|
348 |
* |
|
349 |
* @since 1.0.0 |
|
350 |
*/ |
|
351 |
function comment_text_rss() { |
|
352 |
$comment_text = get_comment_text(); |
|
5 | 353 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
354 |
* Filters the current comment content for use in a feed. |
5 | 355 |
* |
356 |
* @since 1.5.0 |
|
357 |
* |
|
358 |
* @param string $comment_text The content of the current comment. |
|
359 |
*/ |
|
360 |
$comment_text = apply_filters( 'comment_text_rss', $comment_text ); |
|
0 | 361 |
echo $comment_text; |
362 |
} |
|
363 |
||
364 |
/** |
|
365 |
* Retrieve all of the post categories, formatted for use in feeds. |
|
366 |
* |
|
367 |
* All of the categories for the current post in the feed loop, will be |
|
368 |
* retrieved and have feed markup added, so that they can easily be added to the |
|
369 |
* RSS2, Atom, or RSS1 and RSS0.91 RDF feeds. |
|
370 |
* |
|
371 |
* @since 2.1.0 |
|
372 |
* |
|
373 |
* @param string $type Optional, default is the type returned by get_default_feed(). |
|
374 |
* @return string All of the post categories for displaying in the feed. |
|
375 |
*/ |
|
9 | 376 |
function get_the_category_rss( $type = null ) { |
377 |
if ( empty( $type ) ) { |
|
0 | 378 |
$type = get_default_feed(); |
9 | 379 |
} |
0 | 380 |
$categories = get_the_category(); |
9 | 381 |
$tags = get_the_tags(); |
382 |
$the_list = ''; |
|
383 |
$cat_names = array(); |
|
0 | 384 |
|
385 |
$filter = 'rss'; |
|
9 | 386 |
if ( 'atom' == $type ) { |
0 | 387 |
$filter = 'raw'; |
9 | 388 |
} |
0 | 389 |
|
9 | 390 |
if ( ! empty( $categories ) ) { |
391 |
foreach ( (array) $categories as $category ) { |
|
392 |
$cat_names[] = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', $filter ); |
|
393 |
} |
|
0 | 394 |
} |
395 |
||
9 | 396 |
if ( ! empty( $tags ) ) { |
397 |
foreach ( (array) $tags as $tag ) { |
|
398 |
$cat_names[] = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', $filter ); |
|
399 |
} |
|
0 | 400 |
} |
401 |
||
9 | 402 |
$cat_names = array_unique( $cat_names ); |
0 | 403 |
|
404 |
foreach ( $cat_names as $cat_name ) { |
|
9 | 405 |
if ( 'rdf' == $type ) { |
0 | 406 |
$the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; |
9 | 407 |
} elseif ( 'atom' == $type ) { |
5 | 408 |
$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); |
9 | 409 |
} else { |
410 |
$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option( 'blog_charset' ) ) . "]]></category>\n"; |
|
411 |
} |
|
0 | 412 |
} |
413 |
||
5 | 414 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
415 |
* Filters all of the post categories for display in a feed. |
5 | 416 |
* |
417 |
* @since 1.2.0 |
|
418 |
* |
|
419 |
* @param string $the_list All of the RSS post categories. |
|
420 |
* @param string $type Type of feed. Possible values include 'rss2', 'atom'. |
|
421 |
* Default 'rss2'. |
|
422 |
*/ |
|
423 |
return apply_filters( 'the_category_rss', $the_list, $type ); |
|
0 | 424 |
} |
425 |
||
426 |
/** |
|
427 |
* Display the post categories in the feed. |
|
428 |
* |
|
429 |
* @since 0.71 |
|
430 |
* @see get_the_category_rss() For better explanation. |
|
431 |
* |
|
432 |
* @param string $type Optional, default is the type returned by get_default_feed(). |
|
433 |
*/ |
|
9 | 434 |
function the_category_rss( $type = null ) { |
435 |
echo get_the_category_rss( $type ); |
|
0 | 436 |
} |
437 |
||
438 |
/** |
|
439 |
* Display the HTML type based on the blog setting. |
|
440 |
* |
|
441 |
* The two possible values are either 'xhtml' or 'html'. |
|
442 |
* |
|
443 |
* @since 2.2.0 |
|
444 |
*/ |
|
445 |
function html_type_rss() { |
|
9 | 446 |
$type = get_bloginfo( 'html_type' ); |
447 |
if ( strpos( $type, 'xhtml' ) !== false ) { |
|
0 | 448 |
$type = 'xhtml'; |
9 | 449 |
} else { |
0 | 450 |
$type = 'html'; |
9 | 451 |
} |
0 | 452 |
echo $type; |
453 |
} |
|
454 |
||
455 |
/** |
|
456 |
* Display the rss enclosure for the current post. |
|
457 |
* |
|
458 |
* Uses the global $post to check whether the post requires a password and if |
|
459 |
* the user has the password for the post. If not then it will return before |
|
460 |
* displaying. |
|
461 |
* |
|
462 |
* Also uses the function get_post_custom() to get the post's 'enclosure' |
|
463 |
* metadata field and parses the value to display the enclosure(s). The |
|
464 |
* enclosure(s) consist of enclosure HTML tag(s) with a URI and other |
|
465 |
* attributes. |
|
466 |
* |
|
467 |
* @since 1.5.0 |
|
468 |
*/ |
|
469 |
function rss_enclosure() { |
|
9 | 470 |
if ( post_password_required() ) { |
0 | 471 |
return; |
9 | 472 |
} |
0 | 473 |
|
9 | 474 |
foreach ( (array) get_post_custom() as $key => $val ) { |
475 |
if ( $key == 'enclosure' ) { |
|
0 | 476 |
foreach ( (array) $val as $enc ) { |
9 | 477 |
$enclosure = explode( "\n", $enc ); |
0 | 478 |
|
479 |
// only get the first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3' |
|
9 | 480 |
$t = preg_split( '/[ \t]/', trim( $enclosure[2] ) ); |
0 | 481 |
$type = $t[0]; |
482 |
||
5 | 483 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
484 |
* Filters the RSS enclosure HTML link tag for the current post. |
5 | 485 |
* |
486 |
* @since 2.2.0 |
|
487 |
* |
|
488 |
* @param string $html_link_tag The HTML link tag with a URI and other attributes. |
|
489 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
490 |
echo apply_filters( 'rss_enclosure', '<enclosure url="' . esc_url( trim( $enclosure[0] ) ) . '" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( $type ) . '" />' . "\n" ); |
0 | 491 |
} |
492 |
} |
|
493 |
} |
|
494 |
} |
|
495 |
||
496 |
/** |
|
497 |
* Display the atom enclosure for the current post. |
|
498 |
* |
|
499 |
* Uses the global $post to check whether the post requires a password and if |
|
500 |
* the user has the password for the post. If not then it will return before |
|
501 |
* displaying. |
|
502 |
* |
|
503 |
* Also uses the function get_post_custom() to get the post's 'enclosure' |
|
504 |
* metadata field and parses the value to display the enclosure(s). The |
|
505 |
* enclosure(s) consist of link HTML tag(s) with a URI and other attributes. |
|
506 |
* |
|
507 |
* @since 2.2.0 |
|
508 |
*/ |
|
509 |
function atom_enclosure() { |
|
9 | 510 |
if ( post_password_required() ) { |
0 | 511 |
return; |
9 | 512 |
} |
0 | 513 |
|
514 |
foreach ( (array) get_post_custom() as $key => $val ) { |
|
9 | 515 |
if ( $key == 'enclosure' ) { |
0 | 516 |
foreach ( (array) $val as $enc ) { |
9 | 517 |
$enclosure = explode( "\n", $enc ); |
5 | 518 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
519 |
* Filters the atom enclosure HTML link tag for the current post. |
5 | 520 |
* |
521 |
* @since 2.2.0 |
|
522 |
* |
|
523 |
* @param string $html_link_tag The HTML link tag with a URI and other attributes. |
|
524 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
525 |
echo apply_filters( 'atom_enclosure', '<link href="' . esc_url( trim( $enclosure[0] ) ) . '" rel="enclosure" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( trim( $enclosure[2] ) ) . '" />' . "\n" ); |
0 | 526 |
} |
527 |
} |
|
528 |
} |
|
529 |
} |
|
530 |
||
531 |
/** |
|
532 |
* Determine the type of a string of data with the data formatted. |
|
533 |
* |
|
534 |
* Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1. |
|
535 |
* |
|
536 |
* In the case of WordPress, text is defined as containing no markup, |
|
537 |
* xhtml is defined as "well formed", and html as tag soup (i.e., the rest). |
|
538 |
* |
|
539 |
* Container div tags are added to xhtml values, per section 3.1.1.3. |
|
540 |
* |
|
541 |
* @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1 |
|
542 |
* |
|
5 | 543 |
* @since 2.5.0 |
0 | 544 |
* |
545 |
* @param string $data Input string |
|
546 |
* @return array array(type, value) |
|
547 |
*/ |
|
9 | 548 |
function prep_atom_text_construct( $data ) { |
549 |
if ( strpos( $data, '<' ) === false && strpos( $data, '&' ) === false ) { |
|
550 |
return array( 'text', $data ); |
|
0 | 551 |
} |
552 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
553 |
if ( ! function_exists( 'xml_parser_create' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
554 |
trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
555 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
556 |
return array( 'html', "<![CDATA[$data]]>" ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
557 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
558 |
|
0 | 559 |
$parser = xml_parser_create(); |
9 | 560 |
xml_parse( $parser, '<div>' . $data . '</div>', true ); |
561 |
$code = xml_get_error_code( $parser ); |
|
562 |
xml_parser_free( $parser ); |
|
0 | 563 |
|
9 | 564 |
if ( ! $code ) { |
565 |
if ( strpos( $data, '<' ) === false ) { |
|
566 |
return array( 'text', $data ); |
|
0 | 567 |
} else { |
568 |
$data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>"; |
|
9 | 569 |
return array( 'xhtml', $data ); |
0 | 570 |
} |
571 |
} |
|
572 |
||
9 | 573 |
if ( strpos( $data, ']]>' ) === false ) { |
574 |
return array( 'html', "<![CDATA[$data]]>" ); |
|
0 | 575 |
} else { |
9 | 576 |
return array( 'html', htmlspecialchars( $data ) ); |
0 | 577 |
} |
578 |
} |
|
579 |
||
580 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
581 |
* Displays Site Icon in atom feeds. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
582 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
583 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
584 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
585 |
* @see get_site_icon_url() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
586 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
587 |
function atom_site_icon() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
588 |
$url = get_site_icon_url( 32 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
589 |
if ( $url ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
590 |
echo "<icon>$url</icon>\n"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
591 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
592 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
593 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
594 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
595 |
* Displays Site Icon in RSS2. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
596 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
597 |
* @since 4.3.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
598 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
599 |
function rss2_site_icon() { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
600 |
$rss_title = get_wp_title_rss(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
601 |
if ( empty( $rss_title ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
602 |
$rss_title = get_bloginfo_rss( 'name' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
603 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
604 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
605 |
$url = get_site_icon_url( 32 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
606 |
if ( $url ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
607 |
echo ' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
608 |
<image> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
609 |
<url>' . convert_chars( $url ) . '</url> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
610 |
<title>' . $rss_title . '</title> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
611 |
<link>' . get_bloginfo_rss( 'url' ) . '</link> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
612 |
<width>32</width> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
613 |
<height>32</height> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
614 |
</image> ' . "\n"; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
615 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
616 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
617 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
618 |
/** |
0 | 619 |
* Display the link for the currently displayed feed in a XSS safe way. |
620 |
* |
|
621 |
* Generate a correct link for the atom:self element. |
|
622 |
* |
|
5 | 623 |
* @since 2.5.0 |
0 | 624 |
*/ |
625 |
function self_link() { |
|
9 | 626 |
$host = @parse_url( home_url() ); |
5 | 627 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
628 |
* Filters the current feed URL. |
5 | 629 |
* |
630 |
* @since 3.6.0 |
|
631 |
* |
|
632 |
* @see set_url_scheme() |
|
633 |
* @see wp_unslash() |
|
634 |
* |
|
635 |
* @param string $feed_link The link for the feed with set URL scheme. |
|
636 |
*/ |
|
0 | 637 |
echo esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ); |
638 |
} |
|
639 |
||
9 | 640 |
/* |
641 |
* Get the timestamp of the most recently modified post from WP_Query. |
|
642 |
* |
|
643 |
* If viewing a comment feed, the timestamp of the most recently modified |
|
644 |
* comment will be returned. |
|
645 |
* |
|
646 |
* @global WP_Query $wp_query The global WP_Query object. |
|
647 |
* |
|
648 |
* @since 5.2.0 |
|
649 |
* |
|
650 |
* @param string $format Format of the timestamp to return, passed to mysql2date. |
|
651 |
* |
|
652 |
* @return string The timestamp. |
|
653 |
*/ |
|
654 |
function get_feed_build_date( $format ) { |
|
655 |
global $wp_query; |
|
656 |
||
657 |
if ( empty( $wp_query ) || ! $wp_query->have_posts() ) { |
|
658 |
// Fallback to last time any post was modified or published. |
|
659 |
return get_lastpostmodified( 'GMT' ); |
|
660 |
} |
|
661 |
||
662 |
// Extract the post modified times from the posts. |
|
663 |
$modified_times = wp_list_pluck( $wp_query->posts, 'post_modified_gmt' ); |
|
664 |
||
665 |
// If this is a comment feed, check those objects too. |
|
666 |
if ( $wp_query->is_comment_feed() && $wp_query->comment_count ) { |
|
667 |
// Extract the comment modified times from the comments. |
|
668 |
$comment_times = wp_list_pluck( $wp_query->comments, 'comment_date_gmt' ); |
|
669 |
||
670 |
// Add the comment times to the post times for comparison. |
|
671 |
$modified_times = array_merge( $modified_times, $comment_times ); |
|
672 |
} |
|
673 |
||
674 |
// Determine the maximum modified time. |
|
675 |
$max_modified_time = mysql2date( $format, max( $modified_times ), false ); |
|
676 |
||
677 |
/** |
|
678 |
* Filters the date the last post or comment in the query was modified. |
|
679 |
* |
|
680 |
* @since 5.2.0 |
|
681 |
* |
|
682 |
* @param string $max_modified_time Date the last post or comment was modified in the query. |
|
683 |
* @param string $format The date format requested in get_feed_build_date. |
|
684 |
*/ |
|
685 |
return apply_filters( 'get_feed_build_date', $max_modified_time, $format ); |
|
686 |
} |
|
687 |
||
0 | 688 |
/** |
689 |
* Return the content type for specified feed type. |
|
690 |
* |
|
691 |
* @since 2.8.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
692 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
693 |
* @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. |
0 | 694 |
*/ |
695 |
function feed_content_type( $type = '' ) { |
|
9 | 696 |
if ( empty( $type ) ) { |
0 | 697 |
$type = get_default_feed(); |
9 | 698 |
} |
0 | 699 |
|
700 |
$types = array( |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
701 |
'rss' => 'application/rss+xml', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
702 |
'rss2' => 'application/rss+xml', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
703 |
'rss-http' => 'text/xml', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
704 |
'atom' => 'application/atom+xml', |
9 | 705 |
'rdf' => 'application/rdf+xml', |
0 | 706 |
); |
707 |
||
9 | 708 |
$content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream'; |
0 | 709 |
|
5 | 710 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
711 |
* Filters the content type for a specific feed type. |
5 | 712 |
* |
713 |
* @since 2.8.0 |
|
714 |
* |
|
715 |
* @param string $content_type Content type indicating the type of data that a feed contains. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
716 |
* @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. |
5 | 717 |
*/ |
0 | 718 |
return apply_filters( 'feed_content_type', $content_type, $type ); |
719 |
} |
|
720 |
||
721 |
/** |
|
722 |
* Build SimplePie object based on RSS or Atom feed from URL. |
|
723 |
* |
|
5 | 724 |
* @since 2.8.0 |
0 | 725 |
* |
726 |
* @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged |
|
727 |
* using SimplePie's multifeed feature. |
|
9 | 728 |
* See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas} |
0 | 729 |
* |
730 |
* @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success |
|
731 |
*/ |
|
732 |
function fetch_feed( $url ) { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
733 |
if ( ! class_exists( 'SimplePie', false ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
734 |
require_once( ABSPATH . WPINC . '/class-simplepie.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
735 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
736 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
737 |
require_once( ABSPATH . WPINC . '/class-wp-feed-cache.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
738 |
require_once( ABSPATH . WPINC . '/class-wp-feed-cache-transient.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
739 |
require_once( ABSPATH . WPINC . '/class-wp-simplepie-file.php' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
740 |
require_once( ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php' ); |
0 | 741 |
|
742 |
$feed = new SimplePie(); |
|
743 |
||
744 |
$feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); |
|
745 |
// We must manually overwrite $feed->sanitize because SimplePie's |
|
746 |
// constructor sets it before we have a chance to set the sanitization class |
|
747 |
$feed->sanitize = new WP_SimplePie_Sanitize_KSES(); |
|
748 |
||
749 |
$feed->set_cache_class( 'WP_Feed_Cache' ); |
|
750 |
$feed->set_file_class( 'WP_SimplePie_File' ); |
|
751 |
||
752 |
$feed->set_feed_url( $url ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
753 |
/** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */ |
0 | 754 |
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); |
5 | 755 |
/** |
756 |
* Fires just before processing the SimplePie feed object. |
|
757 |
* |
|
758 |
* @since 3.0.0 |
|
759 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
760 |
* @param object $feed SimplePie feed object (passed by reference). |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
761 |
* @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged. |
5 | 762 |
*/ |
0 | 763 |
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); |
764 |
$feed->init(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
765 |
$feed->set_output_encoding( get_option( 'blog_charset' ) ); |
0 | 766 |
|
9 | 767 |
if ( $feed->error() ) { |
0 | 768 |
return new WP_Error( 'simplepie-error', $feed->error() ); |
9 | 769 |
} |
0 | 770 |
|
771 |
return $feed; |
|
772 |
} |