raw
mp-wp_genesis           1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * Outputs the OPML XML format for getting the links defined in the link
mp-wp_genesis 4 * administration. This can be used to export links from one blog over to
mp-wp_genesis 5 * another. Links aren't exported by the WordPress export, so this file handles
mp-wp_genesis 6 * that.
mp-wp_genesis 7 *
mp-wp_genesis 8 * This file is not added by default to WordPress theme pages when outputting
mp-wp_genesis 9 * feed links. It will have to be added manually for browsers and users to pick
mp-wp_genesis 10 * up that this file exists.
mp-wp_genesis 11 *
mp-wp_genesis 12 * @package WordPress
mp-wp_genesis 13 */
mp-wp_genesis 14
mp-wp_genesis 15 if (empty($wp)) {
mp-wp_genesis 16 require_once('./wp-load.php');
mp-wp_genesis 17 wp();
mp-wp_genesis 18 }
mp-wp_genesis 19
mp-wp_genesis 20 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
mp-wp_genesis 21 $link_cat = $_GET['link_cat'];
mp-wp_genesis 22 if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
mp-wp_genesis 23 $link_cat = '';
mp-wp_genesis 24 } else { // be safe
mp-wp_genesis 25 $link_cat = '' . urldecode($link_cat) . '';
mp-wp_genesis 26 $link_cat = intval($link_cat);
mp-wp_genesis 27 }
mp-wp_genesis 28 ?><?php echo '<?xml version="1.0"?'.">\n"; ?>
mp-wp_genesis 29 <?php the_generator( 'comment' ); ?>
mp-wp_genesis 30 <opml version="1.0">
mp-wp_genesis 31 <head>
mp-wp_genesis 32 <title>Links for <?php echo attribute_escape(get_bloginfo('name', 'display').$cat_name); ?></title>
mp-wp_genesis 33 <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
mp-wp_genesis 34 </head>
mp-wp_genesis 35 <body>
mp-wp_genesis 36 <?php
mp-wp_genesis 37
mp-wp_genesis 38 if (empty ($link_cat))
mp-wp_genesis 39 $cats = get_categories("type=link&hierarchical=0");
mp-wp_genesis 40 else
mp-wp_genesis 41 $cats = get_categories('type=link&hierarchical=0&include='.$link_cat);
mp-wp_genesis 42
mp-wp_genesis 43 foreach ((array) $cats as $cat) {
mp-wp_genesis 44 $catname = apply_filters('link_category', $cat->name);
mp-wp_genesis 45
mp-wp_genesis 46 ?>
mp-wp_genesis 47 <outline type="category" title="<?php echo attribute_escape($catname); ?>">
mp-wp_genesis 48 <?php
mp-wp_genesis 49
mp-wp_genesis 50 $bookmarks = get_bookmarks("category={$cat->term_id}");
mp-wp_genesis 51 foreach ((array) $bookmarks as $bookmark) {
mp-wp_genesis 52 $title = attribute_escape(apply_filters('link_title', $bookmark->link_name));
mp-wp_genesis 53 ?>
mp-wp_genesis 54 <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; ?>" />
mp-wp_genesis 55 <?php
mp-wp_genesis 56
mp-wp_genesis 57 }
mp-wp_genesis 58 ?>
mp-wp_genesis 59 </outline>
mp-wp_genesis 60 <?php
mp-wp_genesis 61
mp-wp_genesis 62 }
mp-wp_genesis 63 ?>
mp-wp_genesis 64 </body>
mp-wp_genesis 65 </opml>