root/branches/2.2/wp-links-opml.php

Revision 5155, 1.5 kB (checked in by rob1n, 1 year ago)

attribute_escape() the OPML feed's title. fixes #4061

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2
3 if (empty($wp)) {
4     require_once('./wp-config.php');
5     wp();
6 }
7
8 header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);
9 $link_cat = $_GET['link_cat'];
10 if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
11     $link_cat = '';
12 } else { // be safe
13     $link_cat = '' . urldecode($link_cat) . '';
14     $link_cat = intval($link_cat);
15 }
16 ?><?php echo '<?xml version="1.0"?'.">\n"; ?>
17 <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
18 <opml version="1.0">
19     <head>
20         <title>Links for <?php echo attribute_escape(get_bloginfo('name').$cat_name); ?></title>
21         <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
22     </head>
23     <body>
24 <?php
25
26 if (empty ($link_cat))
27     $cats = get_categories("type=link&hierarchical=0");
28 else
29     $cats = array (get_category($link_cat));
30
31 foreach ((array) $cats as $cat) {
32     $catname = apply_filters('link_category', $cat->cat_name);
33
34 ?>
35 <outline type="category" title="<?php echo attribute_escape($catname); ?>">
36 <?php
37
38     $bookmarks = get_bookmarks("category={$cat->cat_ID}");
39     foreach ((array) $bookmarks as $bookmark) {
40         $title = attribute_escape(apply_filters('link_title', $bookmark->link_name));
41 ?>
42     <outline text="<?php echo $title; ?>" type="link" xmlUrl="<?php echo attribute_escape($bookmark->link_rss); ?>" htmlUrl="<?php echo attribute_escape($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
43 <?php
44
45     }
46 ?>
47 </outline>
48 <?php
49
50 }
51 ?>
52 </body>
53 </opml>
Note: See TracBrowser for help on using the browser.